@treasuredata/tdx 0.3.2 → 0.3.3
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/build-info.json +2 -2
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/cdp-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/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/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.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-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/global-context.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/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.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.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/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/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/model-aliases.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/tdx-logger.js.map +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a32_0x51d2(_0x5afc95,_0x347262){const _0x441b2d=a32_0x441b();return a32_0x51d2=function(_0x51d209,_0x27e9b6){_0x51d209=_0x51d209-0x96;let _0x50c7f4=_0x441b2d[_0x51d209];return _0x50c7f4;},a32_0x51d2(_0x5afc95,_0x347262);}const a32_0x2f7c2f=a32_0x51d2;(function(_0x20b611,_0x3adf93){const _0x4d3b61=a32_0x51d2,_0x5af15f=_0x20b611();while(!![]){try{const _0x3863a0=-parseInt(_0x4d3b61(0xb6))/0x1+-parseInt(_0x4d3b61(0x96))/0x2*(-parseInt(_0x4d3b61(0xb3))/0x3)+-parseInt(_0x4d3b61(0xa6))/0x4*(parseInt(_0x4d3b61(0xa0))/0x5)+parseInt(_0x4d3b61(0xb0))/0x6+-parseInt(_0x4d3b61(0xb9))/0x7+-parseInt(_0x4d3b61(0xbb))/0x8+parseInt(_0x4d3b61(0xb8))/0x9;if(_0x3863a0===_0x3adf93)break;else _0x5af15f['push'](_0x5af15f['shift']());}catch(_0x2b78db){_0x5af15f['push'](_0x5af15f['shift']());}}}(a32_0x441b,0x35f88));function a32_0x441b(){const _0x1fcfb4=['llm_project','Or\x20use:\x20tdx\x20context\x20--clear\x20to\x20clear\x20session\x20context\x0a','join','\x27\x20does\x20not\x20exist','733456zIVzwb','toString','validate','use','Error:\x20Profile\x20\x27','Error:\x20','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','Session\x20database\x20set\x20to:\x20','parent_segment','862710KXluID','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','profile','294iJPKkR','message','description','238117PprwSi','length','6344658ostjlZ','1549870MKvqID','database','1599168dFxwUG','8132xYEWLg','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20profile\x0a','error','Invalid\x20resource:\x20','log','session','includes','Session\x20profile\x20set\x20to:\x20','Session\x20llm_project\x20set\x20to:\x20','.\x20Must\x20be\x20one\x20of:\x20','10MwxPZE','\x20(session:\x20'];a32_0x441b=function(){return _0x1fcfb4;};return a32_0x441b();}import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID}from'../core/session.js';import{profileExists}from'../core/profile.js';export class UseCommand extends BaseCommand{['name']=a32_0x2f7c2f(0xa9);[a32_0x2f7c2f(0xb5)]='Set\x20session-level\x20context';[a32_0x2f7c2f(0xa8)](_0x107418){const _0x3e7a4b=a32_0x2f7c2f,{args:_0x19398c}=_0x107418;if(_0x19398c[_0x3e7a4b(0xb7)]<0x2)return _0x3e7a4b(0xb1)+_0x3e7a4b(0x97)+_0x3e7a4b(0xa3)+'\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options';const _0x54c39c=_0x19398c[0x0],_0x3bd0b6=[_0x3e7a4b(0xba),_0x3e7a4b(0xaf),_0x3e7a4b(0xa2),_0x3e7a4b(0xb2)];if(!_0x3bd0b6[_0x3e7a4b(0x9c)](_0x54c39c))return _0x3e7a4b(0x99)+_0x54c39c+_0x3e7a4b(0x9f)+_0x3bd0b6[_0x3e7a4b(0xa4)](',\x20');return undefined;}async['execute'](_0x3ec202){const _0x6eac5d=a32_0x2f7c2f,{args:_0x193e82,options:_0x1aa6e6}=_0x3ec202;try{const _0x5c8ebc=_0x193e82[0x0],_0x57fd62=_0x193e82[0x1];if(_0x5c8ebc==='profile'){if(!profileExists(_0x57fd62))return console[_0x6eac5d(0x98)](_0x6eac5d(0xaa)+_0x57fd62+_0x6eac5d(0xa5)),console[_0x6eac5d(0x98)](_0x6eac5d(0xac)),0x1;const _0x321bd3=_0x1aa6e6[_0x6eac5d(0x9b)]||getCurrentSessionPID()[_0x6eac5d(0xa7)]();return saveSessionContext({'profile':_0x57fd62},_0x1aa6e6[_0x6eac5d(0x9b)]),console[_0x6eac5d(0x9a)](_0x6eac5d(0x9d)+_0x57fd62+_0x6eac5d(0xa1)+_0x321bd3+')'),console[_0x6eac5d(0x9a)](_0x6eac5d(0xad)),0x0;}const _0x4e6eaa={},_0x26b9fb=_0x1aa6e6[_0x6eac5d(0x9b)]||getCurrentSessionPID()[_0x6eac5d(0xa7)]();switch(_0x5c8ebc){case _0x6eac5d(0xba):_0x4e6eaa[_0x6eac5d(0xba)]=_0x57fd62,console['log'](_0x6eac5d(0xae)+_0x57fd62+_0x6eac5d(0xa1)+_0x26b9fb+')');break;case _0x6eac5d(0xaf):_0x4e6eaa[_0x6eac5d(0xaf)]=_0x57fd62,console[_0x6eac5d(0x9a)]('Session\x20parent_segment\x20set\x20to:\x20'+_0x57fd62+_0x6eac5d(0xa1)+_0x26b9fb+')');break;case'llm_project':_0x4e6eaa['llm_project']=_0x57fd62,console[_0x6eac5d(0x9a)](_0x6eac5d(0x9e)+_0x57fd62+_0x6eac5d(0xa1)+_0x26b9fb+')');break;}return saveSessionContext(_0x4e6eaa,_0x1aa6e6[_0x6eac5d(0x9b)]),console[_0x6eac5d(0x9a)](_0x6eac5d(0xad)),0x0;}catch(_0x2592dd){return _0x2592dd instanceof Error&&console['error'](_0x6eac5d(0xab)+_0x2592dd[_0x6eac5d(0xb4)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x14a6de=a33_0x2cba;(function(_0x580f19,_0x2387fb){const _0x8d2e7f=a33_0x2cba,_0xeca515=_0x580f19();while(!![]){try{const _0x29fdd7=parseInt(_0x8d2e7f(0x1e1))/0x1*(parseInt(_0x8d2e7f(0x199))/0x2)+-parseInt(_0x8d2e7f(0x1c5))/0x3+parseInt(_0x8d2e7f(0x1cc))/0x4*(-parseInt(_0x8d2e7f(0x191))/0x5)+-parseInt(_0x8d2e7f(0x1d3))/0x6+-parseInt(_0x8d2e7f(0x1bb))/0x7+parseInt(_0x8d2e7f(0x194))/0x8*(-parseInt(_0x8d2e7f(0x1bd))/0x9)+-parseInt(_0x8d2e7f(0x1b8))/0xa*(-parseInt(_0x8d2e7f(0x1fa))/0xb);if(_0x29fdd7===_0x2387fb)break;else _0xeca515['push'](_0xeca515['shift']());}catch(_0x23eedc){_0xeca515['push'](_0xeca515['shift']());}}}(a33_0x1f5f,0xd5564));function a33_0x1f5f(){const _0x2409b9=['from','✔\x20Deleted\x20project\x20','Attempt\x20ID:\x20','sessionId','substring','4310140bQiFDa','\x20session','\x20project','11188478noTomK','\x20\x20Location:\x20','6594651svwRDY','fromTask','\x20log\x20entr','Show\x20tasks\x20for\x20an\x20attempt','retrySession','\x22?\x20This\x20cannot\x20be\x20undone.','tasks','delete','789750kEkOZf','filesExtracted','Project:\x20','Params:\x20','revision','Project\x20directory:\x20','error','1933376iElsrz','workflow:push','Status:\x20','offset','Listing\x20workflow\x20attempts...','\x20\x20Cause:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','70656XtSMJy','status','attempt:','\x20\x20Files\x20extracted:\x20','workflow:kill','List\x20all\x20workflow\x20projects','\x20is\x20not\x20a\x20directory','Reason:\x20','Error:\x20Project\x20name\x20is\x20required','Error:\x20Attempt\x20ID\x20is\x20required','Listing\x20workflow\x20projects...','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','workflow:workflows','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','87644RnxXtT','split','workflow:attempts','Error:\x20','Kill\x20a\x20running\x20attempt','length','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Filter:\x20','Retrying\x20attempt...','Downloading\x20project\x20','\x20\x20Revision:\x20','sessions','Killing\x20attempt...','attemptId','Retry\x20a\x20session\x20or\x20attempt','Filter:\x20project=','attempts','Cancelled','session','\x20\x20Project\x20ID:\x20','download','startsWith','Getting\x20task\x20logs...','cause','List\x20workflow\x20execution\x20sessions','121SDStCL','parse','projectName','workflow:logs','Force:\x20yes','workflow','reason','Revision:\x20','\x20task','Listing\x20workflow\x20sessions...','isDirectory','workflow:tasks','List\x20workflow\x20attempts','...','limit','name','execute','\x20\x20Session\x20ID:\x20','workflow:attempt','Project\x20filter:\x20','session:','\x20\x20New\x20attempt\x20ID:\x20','workflow:download','10oXjsjV','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','\x20workflow','16PLTiuW','description','Including\x20subtasks:\x20yes','resumeFrom','Retrying\x20session...','10hpvQdk','verbose','Getting\x20attempt\x20tasks...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','yes','data','\x20attempt','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','message','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','force','Getting\x20attempt\x20details...','✔\x20Found\x20','skipValidation','Output\x20directory:\x20','From\x20task:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','ies','workflow:projects','Resume\x20from:\x20','✔\x20Retry\x20started','attempt','params','List\x20workflows','Include\x20retried:\x20yes','Pushing\x20workflow\x20project...'];a33_0x1f5f=function(){return _0x2409b9;};return a33_0x1f5f();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';export class WorkflowProjectsCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1ab);['description']=a33_0x14a6de(0x1d8);async[a33_0x14a6de(0x20a)](_0x214ec9){const _0x277699=a33_0x14a6de,{options:_0x66ecf5,args:_0x426dfe,tdx:_0x33e864}=_0x214ec9,_0x68d873=_0x426dfe[0x0];try{_0x66ecf5['verbose']&&_0x68d873&&console[_0x277699(0x1cb)]('Pattern:\x20'+_0x68d873);const _0x22b0db=await withSpinner(_0x277699(0x1dd),()=>_0x33e864[_0x277699(0x1ff)]['projects'](_0x68d873,{'limit':_0x66ecf5['limit']}),{'verbose':_0x66ecf5[_0x277699(0x19a)]}),_0xec0d4=_0x22b0db[_0x277699(0x19e)];return console[_0x277699(0x1cb)](_0x277699(0x1a5)+_0xec0d4[_0x277699(0x1e6)]+_0x277699(0x1ba)+(_0xec0d4['length']!==0x1?'s':'')),await handleSDKOutput(_0xec0d4,_0x66ecf5),0x0;}catch(_0x38e451){if(_0x38e451 instanceof SDKError)return console[_0x277699(0x1cb)]('Error:\x20'+_0x38e451[_0x277699(0x1a1)]),_0x38e451[_0x277699(0x1f8)]&&console[_0x277699(0x1cb)](_0x277699(0x1d1)+_0x38e451['cause']),0x1;throw _0x38e451;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1df);['description']=a33_0x14a6de(0x1b0);async[a33_0x14a6de(0x20a)](_0x5df72b){const _0x45ae76=a33_0x14a6de,{options:_0x3356a7,args:_0x54bffe,tdx:_0x2988b1}=_0x5df72b,_0x462a70=_0x54bffe[0x0];try{_0x3356a7[_0x45ae76(0x19a)]&&_0x462a70&&console[_0x45ae76(0x1cb)](_0x45ae76(0x20d)+_0x462a70);const _0x3b5ff2=await withSpinner('Listing\x20workflows...',()=>_0x2988b1[_0x45ae76(0x1ff)]['workflows'](_0x462a70,{'limit':_0x3356a7['limit']}),{'verbose':_0x3356a7[_0x45ae76(0x19a)]}),_0x4a07a5=_0x3b5ff2[_0x45ae76(0x19e)];return console[_0x45ae76(0x1cb)](_0x45ae76(0x1a5)+_0x4a07a5['length']+_0x45ae76(0x193)+(_0x4a07a5[_0x45ae76(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x4a07a5,_0x3356a7),0x0;}catch(_0x356235){if(_0x356235 instanceof SDKError)return console[_0x45ae76(0x1cb)](_0x45ae76(0x1e4)+_0x356235[_0x45ae76(0x1a1)]),_0x356235[_0x45ae76(0x1f8)]&&console[_0x45ae76(0x1cb)](_0x45ae76(0x1d1)+_0x356235[_0x45ae76(0x1f8)]),0x1;throw _0x356235;}}}export class WorkflowSessionsCommand extends BaseCommand{[a33_0x14a6de(0x209)]='workflow:sessions';['description']=a33_0x14a6de(0x1f9);async[a33_0x14a6de(0x20a)](_0x3dc2f0){const _0x2eda6b=a33_0x14a6de,{options:_0xb52d1,args:_0x1cecde,tdx:_0x4f49d5}=_0x3dc2f0;let _0x17fb0f,_0x472134;if(_0x1cecde[0x0]){const _0x40a544=_0x1cecde[0x0][_0x2eda6b(0x1e2)]('.');if(_0x40a544['length']===0x1)_0x17fb0f=_0x40a544[0x0];else{if(_0x40a544[_0x2eda6b(0x1e6)]===0x2)[_0x17fb0f,_0x472134]=_0x40a544;else return console[_0x2eda6b(0x1cb)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0xb52d1['verbose']){if(_0x17fb0f&&_0x472134)console['error'](_0x2eda6b(0x1e8)+_0x17fb0f+'.'+_0x472134);else _0x17fb0f&&console['error'](_0x2eda6b(0x1f0)+_0x17fb0f);const _0x22aab9=_0xb52d1[_0x2eda6b(0x1d4)];_0x22aab9&&console[_0x2eda6b(0x1cb)](_0x2eda6b(0x1ce)+_0x22aab9);}const _0x90f85f=await withSpinner(_0x2eda6b(0x203),()=>_0x4f49d5[_0x2eda6b(0x1ff)][_0x2eda6b(0x1ec)]({'projectName':_0x17fb0f,'workflowName':_0x472134,'status':_0xb52d1['status'],'fromTime':_0xb52d1[_0x2eda6b(0x1b3)],'toTime':_0xb52d1['to'],'limit':_0xb52d1[_0x2eda6b(0x208)]}),{'verbose':_0xb52d1[_0x2eda6b(0x19a)]}),_0x5c1896=_0x90f85f[_0x2eda6b(0x19e)];return console[_0x2eda6b(0x1cb)](_0x2eda6b(0x1a5)+_0x5c1896[_0x2eda6b(0x1e6)]+_0x2eda6b(0x1b9)+(_0x5c1896[_0x2eda6b(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x5c1896,_0xb52d1),0x0;}catch(_0x4a2584){if(_0x4a2584 instanceof SDKError)return console['error'](_0x2eda6b(0x1e4)+_0x4a2584[_0x2eda6b(0x1a1)]),_0x4a2584[_0x2eda6b(0x1f8)]&&console[_0x2eda6b(0x1cb)](_0x2eda6b(0x1d1)+_0x4a2584[_0x2eda6b(0x1f8)]),0x1;throw _0x4a2584;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1e3);[a33_0x14a6de(0x195)]=a33_0x14a6de(0x206);async['execute'](_0x4ccece){const _0x12d0fb=a33_0x14a6de,{options:_0x1e5688,args:_0x3cd2dd,tdx:_0x438d87}=_0x4ccece;let _0x386478,_0x531b49;if(_0x3cd2dd[0x0]){const _0x463275=_0x3cd2dd[0x0]['split']('.');if(_0x463275[_0x12d0fb(0x1e6)]===0x1)_0x386478=_0x463275[0x0];else{if(_0x463275[_0x12d0fb(0x1e6)]===0x2)[_0x386478,_0x531b49]=_0x463275;else return console['error']('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x5bae6e=_0x1e5688['includeRetried'];if(_0x1e5688[_0x12d0fb(0x19a)]){if(_0x386478&&_0x531b49)console[_0x12d0fb(0x1cb)](_0x12d0fb(0x1e8)+_0x386478+'.'+_0x531b49);else _0x386478&&console[_0x12d0fb(0x1cb)](_0x12d0fb(0x1f0)+_0x386478);_0x5bae6e&&console['error'](_0x12d0fb(0x1b1));}const _0x30915b=await withSpinner(_0x12d0fb(0x1d0),()=>_0x438d87[_0x12d0fb(0x1ff)][_0x12d0fb(0x1f1)]({'projectName':_0x386478,'workflowName':_0x531b49,'includeRetried':_0x5bae6e,'limit':_0x1e5688['limit']}),{'verbose':_0x1e5688['verbose']}),_0x51dcc0=_0x30915b[_0x12d0fb(0x19e)];return console['error'](_0x12d0fb(0x1a5)+_0x51dcc0[_0x12d0fb(0x1e6)]+_0x12d0fb(0x19f)+(_0x51dcc0[_0x12d0fb(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x51dcc0,_0x1e5688),0x0;}catch(_0x2c9a0a){if(_0x2c9a0a instanceof SDKError)return console[_0x12d0fb(0x1cb)](_0x12d0fb(0x1e4)+_0x2c9a0a[_0x12d0fb(0x1a1)]),_0x2c9a0a[_0x12d0fb(0x1f8)]&&console[_0x12d0fb(0x1cb)](_0x12d0fb(0x1d1)+_0x2c9a0a[_0x12d0fb(0x1f8)]),0x1;throw _0x2c9a0a;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a33_0x14a6de(0x20c);[a33_0x14a6de(0x195)]='Show\x20specific\x20attempt\x20details';async[a33_0x14a6de(0x20a)](_0x305cb4){const _0x1a4787=a33_0x14a6de,{options:_0x33af33,args:_0x5cb66f,tdx:_0x460b27}=_0x305cb4,_0x5838ba=_0x5cb66f[0x0];if(!_0x5838ba)return console['error'](_0x1a4787(0x1dc)),0x1;try{_0x33af33[_0x1a4787(0x19a)]&&console['error'](_0x1a4787(0x1b5)+_0x5838ba);const _0x272ff4=await withSpinner(_0x1a4787(0x1a4),()=>_0x460b27[_0x1a4787(0x1ff)][_0x1a4787(0x1ae)](_0x5838ba),{'verbose':_0x33af33[_0x1a4787(0x19a)]}),_0x1066d8=_0x272ff4['data'];return await handleSDKOutput([_0x1066d8],_0x33af33),0x0;}catch(_0x315a63){if(_0x315a63 instanceof SDKError)return console['error'](_0x1a4787(0x1e4)+_0x315a63[_0x1a4787(0x1a1)]),_0x315a63[_0x1a4787(0x1f8)]&&console[_0x1a4787(0x1cb)](_0x1a4787(0x1d1)+_0x315a63[_0x1a4787(0x1f8)]),0x1;throw _0x315a63;}}}function a33_0x2cba(_0x19f7bc,_0x5d2696){const _0x1f5fb0=a33_0x1f5f();return a33_0x2cba=function(_0x2cba13,_0x56f559){_0x2cba13=_0x2cba13-0x18e;let _0x104e8e=_0x1f5fb0[_0x2cba13];return _0x104e8e;},a33_0x2cba(_0x19f7bc,_0x5d2696);}export class WorkflowTasksCommand extends BaseCommand{['name']=a33_0x14a6de(0x205);['description']=a33_0x14a6de(0x1c0);async[a33_0x14a6de(0x20a)](_0x543978){const _0x168604=a33_0x14a6de,{options:_0x4139c0,args:_0x52244a,tdx:_0x48e9ea}=_0x543978,_0x3e3f86=_0x52244a[0x0];if(!_0x3e3f86)return console['error'](_0x168604(0x1dc)),0x1;try{const _0x2a5284=_0x4139c0['includeSubtasks'];_0x4139c0[_0x168604(0x19a)]&&(console[_0x168604(0x1cb)](_0x168604(0x1b5)+_0x3e3f86),_0x2a5284&&console[_0x168604(0x1cb)](_0x168604(0x196)));const _0x3ba006=await withSpinner(_0x168604(0x19b),()=>_0x48e9ea['workflow'][_0x168604(0x1c3)](_0x3e3f86,_0x2a5284||![]),{'verbose':_0x4139c0[_0x168604(0x19a)]}),_0x30f08a=_0x3ba006[_0x168604(0x19e)];return console[_0x168604(0x1cb)](_0x168604(0x1a5)+_0x30f08a[_0x168604(0x1e6)]+_0x168604(0x202)+(_0x30f08a[_0x168604(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x30f08a,_0x4139c0),0x0;}catch(_0x55faac){if(_0x55faac instanceof SDKError)return console[_0x168604(0x1cb)](_0x168604(0x1e4)+_0x55faac['message']),_0x55faac[_0x168604(0x1f8)]&&console[_0x168604(0x1cb)](_0x168604(0x1d1)+_0x55faac['cause']),0x1;throw _0x55faac;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a33_0x14a6de(0x1fd);['description']='Show\x20logs\x20for\x20a\x20specific\x20task';async[a33_0x14a6de(0x20a)](_0x3e1b23){const _0x24932e=a33_0x14a6de,{options:_0x2110c3,args:_0x1e1e3c,tdx:_0xf394ba}=_0x3e1b23,_0x40616c=_0x1e1e3c[0x0],_0x480802=_0x1e1e3c[0x1];if(!_0x40616c||!_0x480802)return console[_0x24932e(0x1cb)]('Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required'),0x1;try{_0x2110c3[_0x24932e(0x19a)]&&(console[_0x24932e(0x1cb)]('Attempt\x20ID:\x20'+_0x40616c),console[_0x24932e(0x1cb)]('Task\x20name:\x20'+_0x480802));const _0x13e8b8=_0x2110c3[_0x24932e(0x1cf)],_0x23baa4=await withSpinner(_0x24932e(0x1f7),()=>_0xf394ba[_0x24932e(0x1ff)]['logs'](_0x40616c,_0x480802,{'offset':_0x13e8b8,'limit':_0x2110c3[_0x24932e(0x208)]}),{'verbose':_0x2110c3[_0x24932e(0x19a)]}),_0x57e1fe=_0x23baa4[_0x24932e(0x19e)];return console['error'](_0x24932e(0x1a5)+_0x57e1fe[_0x24932e(0x1e6)]+_0x24932e(0x1bf)+(_0x57e1fe[_0x24932e(0x1e6)]!==0x1?_0x24932e(0x1aa):'y')),await handleSDKOutput(_0x57e1fe,_0x2110c3),0x0;}catch(_0x417287){if(_0x417287 instanceof SDKError)return console[_0x24932e(0x1cb)]('Error:\x20'+_0x417287[_0x24932e(0x1a1)]),_0x417287[_0x24932e(0x1f8)]&&console[_0x24932e(0x1cb)]('\x20\x20Cause:\x20'+_0x417287[_0x24932e(0x1f8)]),0x1;throw _0x417287;}}}export class WorkflowKillCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1d7);[a33_0x14a6de(0x195)]=a33_0x14a6de(0x1e5);async[a33_0x14a6de(0x20a)](_0x427d09){const _0x2664a1=a33_0x14a6de,{options:_0x6ff129,args:_0x4a832f,tdx:_0x2c3542}=_0x427d09,_0x1f26d9=_0x4a832f[0x0];if(!_0x1f26d9)return console['error'](_0x2664a1(0x1dc)),0x1;try{const _0x316874=_0x6ff129[_0x2664a1(0x200)];_0x6ff129[_0x2664a1(0x19a)]&&(console[_0x2664a1(0x1cb)](_0x2664a1(0x1b5)+_0x1f26d9),_0x316874&&console['error'](_0x2664a1(0x1da)+_0x316874));if(!_0x6ff129[_0x2664a1(0x19d)]){const _0x4ddf04=await confirm(_0x2664a1(0x1a2)+_0x1f26d9+'?');if(!_0x4ddf04)return console[_0x2664a1(0x1cb)](_0x2664a1(0x1f2)),0x0;}const _0x5f0ad1=await withSpinner(_0x2664a1(0x1ed),()=>_0x2c3542['workflow']['kill'](_0x1f26d9,_0x316874),{'verbose':_0x6ff129[_0x2664a1(0x19a)]}),_0xd35c04=_0x5f0ad1[_0x2664a1(0x19e)];return console[_0x2664a1(0x1cb)]('✔\x20'+_0xd35c04),0x0;}catch(_0x3e7838){if(_0x3e7838 instanceof SDKError)return console[_0x2664a1(0x1cb)](_0x2664a1(0x1e4)+_0x3e7838['message']),_0x3e7838[_0x2664a1(0x1f8)]&&console[_0x2664a1(0x1cb)]('\x20\x20Cause:\x20'+_0x3e7838[_0x2664a1(0x1f8)]),0x1;throw _0x3e7838;}}}export class WorkflowRetryCommand extends BaseCommand{['name']='workflow:retry';[a33_0x14a6de(0x195)]=a33_0x14a6de(0x1ef);async[a33_0x14a6de(0x20a)](_0x31837b){const _0x3dc31e=a33_0x14a6de,{options:_0x33cc6c,args:_0x4275de,tdx:_0x3c7c98}=_0x31837b,_0x769421=_0x4275de[0x0];if(!_0x769421)return console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1e7)),console[_0x3dc31e(0x1cb)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x1bfde4=![],_0x419812=_0x769421;if(_0x769421[_0x3dc31e(0x1f6)](_0x3dc31e(0x18e)))_0x1bfde4=!![],_0x419812=_0x769421[_0x3dc31e(0x1b7)](0x8);else{if(_0x769421[_0x3dc31e(0x1f6)](_0x3dc31e(0x1d5)))_0x1bfde4=![],_0x419812=_0x769421['substring'](0x8);else return console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1a0)),console['error'](_0x3dc31e(0x1d2)),0x1;}try{const _0x914aab=_0x33cc6c[_0x3dc31e(0x1be)],_0xb2236f=_0x33cc6c[_0x3dc31e(0x197)],_0x69496e=_0x33cc6c[_0x3dc31e(0x1af)],_0x32034f=_0x33cc6c[_0x3dc31e(0x1a3)];_0x33cc6c[_0x3dc31e(0x19a)]&&(console['error']('Target:\x20'+(_0x1bfde4?_0x3dc31e(0x1f3):_0x3dc31e(0x1ae))+'\x20'+_0x419812),_0x914aab&&console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1a8)+_0x914aab),_0xb2236f&&console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1ac)+_0xb2236f),_0x69496e&&console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1c8)+_0x69496e),_0x32034f&&console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1fe)));let _0x1beeb7;if(_0x69496e)try{if(_0x69496e['startsWith']('@')){const _0x158e1d=await import('fs/promises'),_0x560ddb=_0x69496e[_0x3dc31e(0x1b7)](0x1),_0x3afd26=await _0x158e1d['readFile'](_0x560ddb,'utf-8');_0x1beeb7=JSON[_0x3dc31e(0x1fb)](_0x3afd26);}else _0x1beeb7=JSON[_0x3dc31e(0x1fb)](_0x69496e);}catch{return console['error']('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x33cc6c[_0x3dc31e(0x19d)]){const _0x5cfd95=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x1bfde4?_0x3dc31e(0x1f3):_0x3dc31e(0x1ae))+'\x20'+_0x419812+'?');if(!_0x5cfd95)return console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1f2)),0x0;}let _0x525010;_0x1bfde4?_0x525010=await withSpinner(_0x3dc31e(0x198),()=>_0x3c7c98[_0x3dc31e(0x1ff)][_0x3dc31e(0x1c1)](_0x419812,{'fromTask':_0x914aab,'retryParams':_0x1beeb7}),{'verbose':_0x33cc6c['verbose']}):_0x525010=await withSpinner(_0x3dc31e(0x1e9),()=>_0x3c7c98['workflow']['retryAttempt'](_0x419812,{'resumeFrom':_0xb2236f,'retryParams':_0x1beeb7,'force':_0x32034f}),{'verbose':_0x33cc6c[_0x3dc31e(0x19a)]});const _0x1f83f6=_0x525010[_0x3dc31e(0x19e)];return console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1ad)),console[_0x3dc31e(0x1cb)](_0x3dc31e(0x18f)+_0x1f83f6[_0x3dc31e(0x1ee)]),console[_0x3dc31e(0x1cb)](_0x3dc31e(0x20b)+_0x1f83f6[_0x3dc31e(0x1b6)]),0x0;}catch(_0x4a8034){if(_0x4a8034 instanceof SDKError)return console[_0x3dc31e(0x1cb)]('Error:\x20'+_0x4a8034[_0x3dc31e(0x1a1)]),_0x4a8034['cause']&&console['error'](_0x3dc31e(0x1d1)+_0x4a8034[_0x3dc31e(0x1f8)]),0x1;throw _0x4a8034;}}}export class WorkflowDownloadCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x190);[a33_0x14a6de(0x195)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async['execute'](_0x45dbf7){const _0x19d189=a33_0x14a6de,{options:_0x535b26,args:_0x1ed258,tdx:_0x26b6f5}=_0x45dbf7,_0x352b3a=_0x1ed258[0x0],_0x18b21b=_0x1ed258[0x1]||'.';if(!_0x352b3a)return console[_0x19d189(0x1cb)](_0x19d189(0x1db)),console[_0x19d189(0x1cb)](_0x19d189(0x1e0)),0x1;const _0x11fe96=_0x535b26['revision'];_0x535b26[_0x19d189(0x19a)]&&(console[_0x19d189(0x1cb)](_0x19d189(0x1c7)+_0x352b3a),console[_0x19d189(0x1cb)](_0x19d189(0x1a7)+_0x18b21b),_0x11fe96&&console[_0x19d189(0x1cb)](_0x19d189(0x201)+_0x11fe96));const _0x204652=await withSpinner(_0x19d189(0x1ea)+_0x352b3a+_0x19d189(0x207),()=>_0x26b6f5['workflow'][_0x19d189(0x1f5)](_0x352b3a,_0x18b21b,{'revision':_0x11fe96}),{'verbose':_0x535b26[_0x19d189(0x19a)]}),_0x3954a1=_0x204652[_0x19d189(0x19e)];return console[_0x19d189(0x1cb)]('✔\x20Downloaded\x20'+_0x3954a1[_0x19d189(0x1fc)]),console['error'](_0x19d189(0x1eb)+_0x3954a1[_0x19d189(0x1c9)]),console[_0x19d189(0x1cb)](_0x19d189(0x1d6)+_0x3954a1[_0x19d189(0x1c6)]),console['error'](_0x19d189(0x1bc)+_0x18b21b+'/'+_0x3954a1[_0x19d189(0x1fc)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1cd);[a33_0x14a6de(0x195)]=a33_0x14a6de(0x192);async[a33_0x14a6de(0x20a)](_0x29581d){const _0x271b54=a33_0x14a6de,{options:_0x3e1aec,args:_0x2c6752,tdx:_0xb52983}=_0x29581d;let _0x986067='.',_0x3f1ac8=_0x3e1aec[_0x271b54(0x209)];if(_0x2c6752[0x0]){const {promises:_0x2062a7}=await import('fs');try{const _0x48567a=await _0x2062a7['stat'](_0x2c6752[0x0]);if(_0x48567a[_0x271b54(0x204)]())_0x986067=_0x2c6752[0x0];else return console['error']('Error:\x20'+_0x2c6752[0x0]+_0x271b54(0x1d9)),0x1;}catch{_0x3f1ac8=_0x2c6752[0x0],_0x986067='.';}}const _0x54be9d=_0x3e1aec[_0x271b54(0x1c9)],_0x5c74df=_0x3e1aec[_0x271b54(0x1a6)];_0x3e1aec[_0x271b54(0x19a)]&&(console[_0x271b54(0x1cb)](_0x271b54(0x1ca)+_0x986067),_0x3f1ac8&&console[_0x271b54(0x1cb)]('Project\x20name:\x20'+_0x3f1ac8),_0x54be9d&&console[_0x271b54(0x1cb)](_0x271b54(0x201)+_0x54be9d),_0x5c74df&&console['error']('Validation:\x20skipped'));const _0x3ae837=await withSpinner(_0x271b54(0x1b2),()=>_0xb52983[_0x271b54(0x1ff)]['push'](_0x986067,{'projectName':_0x3f1ac8,'revision':_0x54be9d,'skipValidation':_0x5c74df}),{'verbose':_0x3e1aec['verbose']}),_0x1e1374=_0x3ae837[_0x271b54(0x19e)];return console[_0x271b54(0x1cb)]('✔\x20Pushed\x20'+_0x1e1374[_0x271b54(0x1fc)]),console[_0x271b54(0x1cb)](_0x271b54(0x1f4)+_0x1e1374['projectId']),console[_0x271b54(0x1cb)](_0x271b54(0x1eb)+_0x1e1374[_0x271b54(0x1c9)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a33_0x14a6de(0x209)]='workflow:delete';[a33_0x14a6de(0x195)]=a33_0x14a6de(0x1a9);async[a33_0x14a6de(0x20a)](_0xc47b8d){const _0xed5a1=a33_0x14a6de,{options:_0x14dac4,args:_0x4cc6f9,tdx:_0x139cce}=_0xc47b8d,_0x4d5b3c=_0x4cc6f9[0x0];if(!_0x4d5b3c)return console[_0xed5a1(0x1cb)](_0xed5a1(0x1de)),console[_0xed5a1(0x1cb)]('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x14dac4[_0xed5a1(0x19a)]&&console['error'](_0xed5a1(0x1c7)+_0x4d5b3c);if(!_0x14dac4[_0xed5a1(0x19d)]){const _0x41c333=await confirm(_0xed5a1(0x19c)+_0x4d5b3c+_0xed5a1(0x1c2));if(!_0x41c333)return console[_0xed5a1(0x1cb)]('Cancelled'),0x0;}const _0x55c609=await withSpinner('Deleting\x20project\x20'+_0x4d5b3c+_0xed5a1(0x207),()=>_0x139cce[_0xed5a1(0x1ff)][_0xed5a1(0x1c4)](_0x4d5b3c),{'verbose':_0x14dac4[_0xed5a1(0x19a)]}),_0x53b4c6=_0x55c609[_0xed5a1(0x19e)];return console[_0xed5a1(0x1cb)](_0xed5a1(0x1b4)+_0x53b4c6[_0xed5a1(0x1fc)]),console[_0xed5a1(0x1cb)](_0xed5a1(0x1f4)+_0x53b4c6['projectId']),0x0;}}
|
|
1
|
+
const a33_0x47e5ec=a33_0x11c0;(function(_0x396042,_0x365320){const _0x2075c8=a33_0x11c0,_0x42696c=_0x396042();while(!![]){try{const _0x4ee476=parseInt(_0x2075c8(0x1f5))/0x1+-parseInt(_0x2075c8(0x1e1))/0x2*(-parseInt(_0x2075c8(0x1cc))/0x3)+parseInt(_0x2075c8(0x1b4))/0x4+parseInt(_0x2075c8(0x21d))/0x5+parseInt(_0x2075c8(0x1dd))/0x6*(parseInt(_0x2075c8(0x1eb))/0x7)+-parseInt(_0x2075c8(0x1ed))/0x8+-parseInt(_0x2075c8(0x204))/0x9;if(_0x4ee476===_0x365320)break;else _0x42696c['push'](_0x42696c['shift']());}catch(_0x162c34){_0x42696c['push'](_0x42696c['shift']());}}}(a33_0x5b00,0x9d368));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a33_0x5b00(){const _0x5e771a=['\x20attempt','length','cause','fromTask','substring','kill','From\x20task:\x20','Attempt\x20ID:\x20','attempt:','Project\x20directory:\x20','attempt','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','\x22?\x20This\x20cannot\x20be\x20undone.','workflow:sessions','status','Listing\x20workflow\x20projects...','parse','retrySession','reason','Retrying\x20session...','1749705dxdllv','✔\x20Found\x20','error','download','Killing\x20attempt...','Error:\x20Attempt\x20ID\x20is\x20required','Validation:\x20skipped','workflow:workflows','...','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','workflow','Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required','delete','readFile','session:','Error:\x20','List\x20workflows','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','\x20\x20Project\x20ID:\x20','startsWith','message','Listing\x20workflow\x20attempts...','Output\x20directory:\x20','workflow:tasks','workflows','885320udhrMS','\x20project','fs/promises','projectId','Retrying\x20attempt...','data','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Project:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','projects','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Task\x20name:\x20','description','tasks','\x20\x20Session\x20ID:\x20','List\x20workflow\x20attempts','limit','Filter:\x20','Kill\x20a\x20running\x20attempt','Deleting\x20project\x20','includeRetried','sessionId','Show\x20tasks\x20for\x20an\x20attempt','Show\x20logs\x20for\x20a\x20specific\x20task','327lbEzbb','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','\x20session','Project\x20name:\x20','Filter:\x20project=','\x20task','Getting\x20attempt\x20details...','workflow:kill','force','\x20log\x20entr','List\x20workflow\x20execution\x20sessions','from','Project\x20filter:\x20','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Error:\x20Project\x20name\x20is\x20required','workflow:delete','Including\x20subtasks:\x20yes','36108AsLtmI','\x20\x20Cause:\x20','Status:\x20','projectName','8828eebfHx','✔\x20Downloaded\x20','filesExtracted','Params:\x20','Getting\x20attempt\x20tasks...','\x20workflow','Reason:\x20','params','workflow:attempt','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','1127QlEKbg','workflow:projects','1627280wWkgwE','List\x20all\x20workflow\x20projects','yes','verbose','name','✔\x20Pushed\x20','✔\x20Deleted\x20project\x20','session','968352VJWEdw','Cancelled','Revision:\x20','logs','workflow:push','retryAttempt','revision','sessions','attemptId','execute','workflow:logs','attempts','stat','workflow:download','Listing\x20workflow\x20sessions...','19280637TfxsQg','split','\x20\x20Location:\x20','Target:\x20','offset'];a33_0x5b00=function(){return _0x5e771a;};return a33_0x5b00();}import{confirm}from'../utils/prompt.js';export class WorkflowProjectsCommand extends BaseCommand{['name']=a33_0x47e5ec(0x1ec);[a33_0x47e5ec(0x1c0)]=a33_0x47e5ec(0x1ee);async[a33_0x47e5ec(0x1fe)](_0x51ecb9){const _0x594276=a33_0x47e5ec,{options:_0x3b4b5d,args:_0x47c3b0,tdx:_0x54f2e7}=_0x51ecb9,_0x3b8714=_0x47c3b0[0x0];try{_0x3b4b5d['verbose']&&_0x3b8714&&console[_0x594276(0x21f)]('Pattern:\x20'+_0x3b8714);const _0x2e6413=await withSpinner(_0x594276(0x218),()=>_0x54f2e7[_0x594276(0x227)][_0x594276(0x1bd)](_0x3b8714,{'limit':_0x3b4b5d[_0x594276(0x1c4)]}),{'verbose':_0x3b4b5d[_0x594276(0x1f0)]}),_0x1b215d=_0x2e6413[_0x594276(0x1b9)];return console[_0x594276(0x21f)](_0x594276(0x21e)+_0x1b215d[_0x594276(0x20a)]+_0x594276(0x1b5)+(_0x1b215d[_0x594276(0x20a)]!==0x1?'s':'')),await handleSDKOutput(_0x1b215d,_0x3b4b5d),0x0;}catch(_0x42fbb3){if(_0x42fbb3 instanceof SDKError)return console[_0x594276(0x21f)](_0x594276(0x1aa)+_0x42fbb3['message']),_0x42fbb3['cause']&&console['error']('\x20\x20Cause:\x20'+_0x42fbb3['cause']),0x1;throw _0x42fbb3;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a33_0x47e5ec(0x224);[a33_0x47e5ec(0x1c0)]=a33_0x47e5ec(0x1ab);async[a33_0x47e5ec(0x1fe)](_0x485698){const _0x374ff1=a33_0x47e5ec,{options:_0x14fc0c,args:_0xbb0606,tdx:_0x2ffb94}=_0x485698,_0x286959=_0xbb0606[0x0];try{_0x14fc0c[_0x374ff1(0x1f0)]&&_0x286959&&console[_0x374ff1(0x21f)](_0x374ff1(0x1d8)+_0x286959);const _0x17823d=await withSpinner('Listing\x20workflows...',()=>_0x2ffb94['workflow'][_0x374ff1(0x1b3)](_0x286959,{'limit':_0x14fc0c[_0x374ff1(0x1c4)]}),{'verbose':_0x14fc0c[_0x374ff1(0x1f0)]}),_0x5f5180=_0x17823d[_0x374ff1(0x1b9)];return console[_0x374ff1(0x21f)](_0x374ff1(0x21e)+_0x5f5180[_0x374ff1(0x20a)]+_0x374ff1(0x1e6)+(_0x5f5180[_0x374ff1(0x20a)]!==0x1?'s':'')),await handleSDKOutput(_0x5f5180,_0x14fc0c),0x0;}catch(_0x5ab76e){if(_0x5ab76e instanceof SDKError)return console['error'](_0x374ff1(0x1aa)+_0x5ab76e['message']),_0x5ab76e[_0x374ff1(0x20b)]&&console['error']('\x20\x20Cause:\x20'+_0x5ab76e['cause']),0x1;throw _0x5ab76e;}}}export class WorkflowSessionsCommand extends BaseCommand{[a33_0x47e5ec(0x1f1)]=a33_0x47e5ec(0x216);['description']=a33_0x47e5ec(0x1d6);async[a33_0x47e5ec(0x1fe)](_0x50e19d){const _0x1d20c9=a33_0x47e5ec,{options:_0x5038fe,args:_0x4bdbfa,tdx:_0x3677fb}=_0x50e19d;let _0xfa24d2,_0x74de72;if(_0x4bdbfa[0x0]){const _0x2520f9=_0x4bdbfa[0x0][_0x1d20c9(0x205)]('.');if(_0x2520f9[_0x1d20c9(0x20a)]===0x1)_0xfa24d2=_0x2520f9[0x0];else{if(_0x2520f9[_0x1d20c9(0x20a)]===0x2)[_0xfa24d2,_0x74de72]=_0x2520f9;else return console[_0x1d20c9(0x21f)](_0x1d20c9(0x1bc)),0x1;}}try{if(_0x5038fe[_0x1d20c9(0x1f0)]){if(_0xfa24d2&&_0x74de72)console[_0x1d20c9(0x21f)]('Filter:\x20'+_0xfa24d2+'.'+_0x74de72);else _0xfa24d2&&console['error'](_0x1d20c9(0x1d0)+_0xfa24d2);const _0xcc41d7=_0x5038fe['status'];_0xcc41d7&&console[_0x1d20c9(0x21f)](_0x1d20c9(0x1df)+_0xcc41d7);}const _0x2ca66b=await withSpinner(_0x1d20c9(0x203),()=>_0x3677fb['workflow'][_0x1d20c9(0x1fc)]({'projectName':_0xfa24d2,'workflowName':_0x74de72,'status':_0x5038fe[_0x1d20c9(0x217)],'fromTime':_0x5038fe[_0x1d20c9(0x1d7)],'toTime':_0x5038fe['to'],'limit':_0x5038fe[_0x1d20c9(0x1c4)]}),{'verbose':_0x5038fe[_0x1d20c9(0x1f0)]}),_0x4fb698=_0x2ca66b['data'];return console[_0x1d20c9(0x21f)](_0x1d20c9(0x21e)+_0x4fb698['length']+_0x1d20c9(0x1ce)+(_0x4fb698[_0x1d20c9(0x20a)]!==0x1?'s':'')),await handleSDKOutput(_0x4fb698,_0x5038fe),0x0;}catch(_0x23d27b){if(_0x23d27b instanceof SDKError)return console[_0x1d20c9(0x21f)](_0x1d20c9(0x1aa)+_0x23d27b[_0x1d20c9(0x1af)]),_0x23d27b[_0x1d20c9(0x20b)]&&console['error'](_0x1d20c9(0x1de)+_0x23d27b[_0x1d20c9(0x20b)]),0x1;throw _0x23d27b;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']='workflow:attempts';[a33_0x47e5ec(0x1c0)]=a33_0x47e5ec(0x1c3);async[a33_0x47e5ec(0x1fe)](_0x48f1d9){const _0x54902b=a33_0x47e5ec,{options:_0x64f6bc,args:_0x3903c0,tdx:_0x2e9d23}=_0x48f1d9;let _0x5e69a6,_0x3ccf6d;if(_0x3903c0[0x0]){const _0x1c2448=_0x3903c0[0x0][_0x54902b(0x205)]('.');if(_0x1c2448[_0x54902b(0x20a)]===0x1)_0x5e69a6=_0x1c2448[0x0];else{if(_0x1c2448[_0x54902b(0x20a)]===0x2)[_0x5e69a6,_0x3ccf6d]=_0x1c2448;else return console['error'](_0x54902b(0x1bc)),0x1;}}try{const _0x2425ea=_0x64f6bc[_0x54902b(0x1c8)];if(_0x64f6bc[_0x54902b(0x1f0)]){if(_0x5e69a6&&_0x3ccf6d)console['error'](_0x54902b(0x1c5)+_0x5e69a6+'.'+_0x3ccf6d);else _0x5e69a6&&console['error']('Filter:\x20project='+_0x5e69a6);_0x2425ea&&console['error']('Include\x20retried:\x20yes');}const _0x3830e7=await withSpinner(_0x54902b(0x1b0),()=>_0x2e9d23['workflow'][_0x54902b(0x200)]({'projectName':_0x5e69a6,'workflowName':_0x3ccf6d,'includeRetried':_0x2425ea,'limit':_0x64f6bc[_0x54902b(0x1c4)]}),{'verbose':_0x64f6bc[_0x54902b(0x1f0)]}),_0x20520b=_0x3830e7[_0x54902b(0x1b9)];return console['error'](_0x54902b(0x21e)+_0x20520b[_0x54902b(0x20a)]+_0x54902b(0x209)+(_0x20520b[_0x54902b(0x20a)]!==0x1?'s':'')),await handleSDKOutput(_0x20520b,_0x64f6bc),0x0;}catch(_0x49abc2){if(_0x49abc2 instanceof SDKError)return console[_0x54902b(0x21f)](_0x54902b(0x1aa)+_0x49abc2['message']),_0x49abc2[_0x54902b(0x20b)]&&console['error']('\x20\x20Cause:\x20'+_0x49abc2[_0x54902b(0x20b)]),0x1;throw _0x49abc2;}}}export class WorkflowAttemptCommand extends BaseCommand{[a33_0x47e5ec(0x1f1)]=a33_0x47e5ec(0x1e9);[a33_0x47e5ec(0x1c0)]='Show\x20specific\x20attempt\x20details';async[a33_0x47e5ec(0x1fe)](_0x5c1c43){const _0x345a64=a33_0x47e5ec,{options:_0x2b8b87,args:_0x227f2d,tdx:_0x3e1224}=_0x5c1c43,_0x1535a0=_0x227f2d[0x0];if(!_0x1535a0)return console['error'](_0x345a64(0x222)),0x1;try{_0x2b8b87[_0x345a64(0x1f0)]&&console[_0x345a64(0x21f)](_0x345a64(0x210)+_0x1535a0);const _0x3950c9=await withSpinner(_0x345a64(0x1d2),()=>_0x3e1224[_0x345a64(0x227)][_0x345a64(0x213)](_0x1535a0),{'verbose':_0x2b8b87[_0x345a64(0x1f0)]}),_0x447e96=_0x3950c9[_0x345a64(0x1b9)];return await handleSDKOutput([_0x447e96],_0x2b8b87),0x0;}catch(_0x42bd64){if(_0x42bd64 instanceof SDKError)return console[_0x345a64(0x21f)](_0x345a64(0x1aa)+_0x42bd64[_0x345a64(0x1af)]),_0x42bd64['cause']&&console['error'](_0x345a64(0x1de)+_0x42bd64[_0x345a64(0x20b)]),0x1;throw _0x42bd64;}}}function a33_0x11c0(_0x58366d,_0x36ce15){const _0x5b00fb=a33_0x5b00();return a33_0x11c0=function(_0x11c0d5,_0x705c98){_0x11c0d5=_0x11c0d5-0x1aa;let _0x18694a=_0x5b00fb[_0x11c0d5];return _0x18694a;},a33_0x11c0(_0x58366d,_0x36ce15);}export class WorkflowTasksCommand extends BaseCommand{['name']=a33_0x47e5ec(0x1b2);[a33_0x47e5ec(0x1c0)]=a33_0x47e5ec(0x1ca);async[a33_0x47e5ec(0x1fe)](_0x2c2591){const _0x28ed27=a33_0x47e5ec,{options:_0xa1d50,args:_0x3cc29b,tdx:_0x2442a7}=_0x2c2591,_0x3e9e83=_0x3cc29b[0x0];if(!_0x3e9e83)return console[_0x28ed27(0x21f)](_0x28ed27(0x222)),0x1;try{const _0x27e66a=_0xa1d50['includeSubtasks'];_0xa1d50[_0x28ed27(0x1f0)]&&(console['error'](_0x28ed27(0x210)+_0x3e9e83),_0x27e66a&&console[_0x28ed27(0x21f)](_0x28ed27(0x1dc)));const _0x4b094b=await withSpinner(_0x28ed27(0x1e5),()=>_0x2442a7['workflow'][_0x28ed27(0x1c1)](_0x3e9e83,_0x27e66a||![]),{'verbose':_0xa1d50[_0x28ed27(0x1f0)]}),_0x1f39d1=_0x4b094b[_0x28ed27(0x1b9)];return console[_0x28ed27(0x21f)](_0x28ed27(0x21e)+_0x1f39d1[_0x28ed27(0x20a)]+_0x28ed27(0x1d1)+(_0x1f39d1['length']!==0x1?'s':'')),await handleSDKOutput(_0x1f39d1,_0xa1d50),0x0;}catch(_0x435f4e){if(_0x435f4e instanceof SDKError)return console[_0x28ed27(0x21f)]('Error:\x20'+_0x435f4e[_0x28ed27(0x1af)]),_0x435f4e['cause']&&console[_0x28ed27(0x21f)]('\x20\x20Cause:\x20'+_0x435f4e['cause']),0x1;throw _0x435f4e;}}}export class WorkflowLogsCommand extends BaseCommand{[a33_0x47e5ec(0x1f1)]=a33_0x47e5ec(0x1ff);[a33_0x47e5ec(0x1c0)]=a33_0x47e5ec(0x1cb);async[a33_0x47e5ec(0x1fe)](_0x2b3d5f){const _0x4ef17a=a33_0x47e5ec,{options:_0x194638,args:_0x44e760,tdx:_0x5cc9a9}=_0x2b3d5f,_0x2e8739=_0x44e760[0x0],_0x342fc0=_0x44e760[0x1];if(!_0x2e8739||!_0x342fc0)return console[_0x4ef17a(0x21f)](_0x4ef17a(0x228)),0x1;try{_0x194638['verbose']&&(console[_0x4ef17a(0x21f)](_0x4ef17a(0x210)+_0x2e8739),console[_0x4ef17a(0x21f)](_0x4ef17a(0x1bf)+_0x342fc0));const _0xd94e15=_0x194638[_0x4ef17a(0x208)],_0xb4294b=await withSpinner('Getting\x20task\x20logs...',()=>_0x5cc9a9[_0x4ef17a(0x227)][_0x4ef17a(0x1f8)](_0x2e8739,_0x342fc0,{'offset':_0xd94e15,'limit':_0x194638[_0x4ef17a(0x1c4)]}),{'verbose':_0x194638[_0x4ef17a(0x1f0)]}),_0x4427ad=_0xb4294b[_0x4ef17a(0x1b9)];return console[_0x4ef17a(0x21f)]('✔\x20Found\x20'+_0x4427ad[_0x4ef17a(0x20a)]+_0x4ef17a(0x1d5)+(_0x4427ad[_0x4ef17a(0x20a)]!==0x1?'ies':'y')),await handleSDKOutput(_0x4427ad,_0x194638),0x0;}catch(_0x5956aa){if(_0x5956aa instanceof SDKError)return console[_0x4ef17a(0x21f)](_0x4ef17a(0x1aa)+_0x5956aa['message']),_0x5956aa[_0x4ef17a(0x20b)]&&console['error']('\x20\x20Cause:\x20'+_0x5956aa[_0x4ef17a(0x20b)]),0x1;throw _0x5956aa;}}}export class WorkflowKillCommand extends BaseCommand{[a33_0x47e5ec(0x1f1)]=a33_0x47e5ec(0x1d3);[a33_0x47e5ec(0x1c0)]=a33_0x47e5ec(0x1c6);async['execute'](_0x3d6464){const _0x49e97e=a33_0x47e5ec,{options:_0x2b7d09,args:_0x40f930,tdx:_0x7303e6}=_0x3d6464,_0x54e24d=_0x40f930[0x0];if(!_0x54e24d)return console[_0x49e97e(0x21f)](_0x49e97e(0x222)),0x1;try{const _0x27b6c8=_0x2b7d09[_0x49e97e(0x21b)];_0x2b7d09[_0x49e97e(0x1f0)]&&(console[_0x49e97e(0x21f)](_0x49e97e(0x210)+_0x54e24d),_0x27b6c8&&console[_0x49e97e(0x21f)](_0x49e97e(0x1e7)+_0x27b6c8));if(!_0x2b7d09[_0x49e97e(0x1ef)]){const _0x11564c=await confirm(_0x49e97e(0x214)+_0x54e24d+'?');if(!_0x11564c)return console[_0x49e97e(0x21f)]('Cancelled'),0x0;}const _0x5e25a2=await withSpinner(_0x49e97e(0x221),()=>_0x7303e6[_0x49e97e(0x227)][_0x49e97e(0x20e)](_0x54e24d,_0x27b6c8),{'verbose':_0x2b7d09[_0x49e97e(0x1f0)]}),_0x45b43c=_0x5e25a2[_0x49e97e(0x1b9)];return console[_0x49e97e(0x21f)]('✔\x20'+_0x45b43c),0x0;}catch(_0x2be95f){if(_0x2be95f instanceof SDKError)return console['error'](_0x49e97e(0x1aa)+_0x2be95f[_0x49e97e(0x1af)]),_0x2be95f['cause']&&console[_0x49e97e(0x21f)](_0x49e97e(0x1de)+_0x2be95f[_0x49e97e(0x20b)]),0x1;throw _0x2be95f;}}}export class WorkflowRetryCommand extends BaseCommand{[a33_0x47e5ec(0x1f1)]='workflow:retry';[a33_0x47e5ec(0x1c0)]='Retry\x20a\x20session\x20or\x20attempt';async[a33_0x47e5ec(0x1fe)](_0x5dfcd9){const _0x37439a=a33_0x47e5ec,{options:_0x468e09,args:_0x33bd7b,tdx:_0x4fa3fd}=_0x5dfcd9,_0x3c42f5=_0x33bd7b[0x0];if(!_0x3c42f5)return console[_0x37439a(0x21f)](_0x37439a(0x226)),console[_0x37439a(0x21f)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0xdf8b71=![],_0x5a20c0=_0x3c42f5;if(_0x3c42f5[_0x37439a(0x1ae)](_0x37439a(0x22b)))_0xdf8b71=!![],_0x5a20c0=_0x3c42f5[_0x37439a(0x20d)](0x8);else{if(_0x3c42f5[_0x37439a(0x1ae)](_0x37439a(0x211)))_0xdf8b71=![],_0x5a20c0=_0x3c42f5['substring'](0x8);else return console[_0x37439a(0x21f)](_0x37439a(0x1ea)),console[_0x37439a(0x21f)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;}try{const _0x21fdc2=_0x468e09[_0x37439a(0x20c)],_0x226bee=_0x468e09['resumeFrom'],_0x196341=_0x468e09[_0x37439a(0x1e8)],_0x295868=_0x468e09[_0x37439a(0x1d4)];_0x468e09[_0x37439a(0x1f0)]&&(console[_0x37439a(0x21f)](_0x37439a(0x207)+(_0xdf8b71?_0x37439a(0x1f4):'attempt')+'\x20'+_0x5a20c0),_0x21fdc2&&console['error'](_0x37439a(0x20f)+_0x21fdc2),_0x226bee&&console['error']('Resume\x20from:\x20'+_0x226bee),_0x196341&&console[_0x37439a(0x21f)](_0x37439a(0x1e4)+_0x196341),_0x295868&&console[_0x37439a(0x21f)]('Force:\x20yes'));let _0x19e8c0;if(_0x196341)try{if(_0x196341['startsWith']('@')){const _0x22e6a7=await import(_0x37439a(0x1b6)),_0x2229aa=_0x196341[_0x37439a(0x20d)](0x1),_0x363b55=await _0x22e6a7[_0x37439a(0x22a)](_0x2229aa,'utf-8');_0x19e8c0=JSON[_0x37439a(0x219)](_0x363b55);}else _0x19e8c0=JSON['parse'](_0x196341);}catch{return console[_0x37439a(0x21f)]('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x468e09[_0x37439a(0x1ef)]){const _0xabaf7c=await confirm(_0x37439a(0x1ac)+(_0xdf8b71?'session':_0x37439a(0x213))+'\x20'+_0x5a20c0+'?');if(!_0xabaf7c)return console[_0x37439a(0x21f)](_0x37439a(0x1f6)),0x0;}let _0x41bed3;_0xdf8b71?_0x41bed3=await withSpinner(_0x37439a(0x21c),()=>_0x4fa3fd[_0x37439a(0x227)][_0x37439a(0x21a)](_0x5a20c0,{'fromTask':_0x21fdc2,'retryParams':_0x19e8c0}),{'verbose':_0x468e09['verbose']}):_0x41bed3=await withSpinner(_0x37439a(0x1b8),()=>_0x4fa3fd[_0x37439a(0x227)][_0x37439a(0x1fa)](_0x5a20c0,{'resumeFrom':_0x226bee,'retryParams':_0x19e8c0,'force':_0x295868}),{'verbose':_0x468e09['verbose']});const _0x132ec1=_0x41bed3[_0x37439a(0x1b9)];return console['error']('✔\x20Retry\x20started'),console['error']('\x20\x20New\x20attempt\x20ID:\x20'+_0x132ec1[_0x37439a(0x1fd)]),console[_0x37439a(0x21f)](_0x37439a(0x1c2)+_0x132ec1[_0x37439a(0x1c9)]),0x0;}catch(_0x3e79c7){if(_0x3e79c7 instanceof SDKError)return console[_0x37439a(0x21f)](_0x37439a(0x1aa)+_0x3e79c7[_0x37439a(0x1af)]),_0x3e79c7[_0x37439a(0x20b)]&&console[_0x37439a(0x21f)](_0x37439a(0x1de)+_0x3e79c7[_0x37439a(0x20b)]),0x1;throw _0x3e79c7;}}}export class WorkflowDownloadCommand extends BaseCommand{[a33_0x47e5ec(0x1f1)]=a33_0x47e5ec(0x202);['description']='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a33_0x47e5ec(0x1fe)](_0x1596dd){const _0xf4a2e5=a33_0x47e5ec,{options:_0x5a6b6a,args:_0x456bbd,tdx:_0x5703b3}=_0x1596dd,_0x3f4399=_0x456bbd[0x0],_0x12d030=_0x456bbd[0x1]||'.';if(!_0x3f4399)return console[_0xf4a2e5(0x21f)](_0xf4a2e5(0x1da)),console['error'](_0xf4a2e5(0x1ba)),0x1;const _0x2456a6=_0x5a6b6a[_0xf4a2e5(0x1fb)];_0x5a6b6a[_0xf4a2e5(0x1f0)]&&(console[_0xf4a2e5(0x21f)](_0xf4a2e5(0x1bb)+_0x3f4399),console[_0xf4a2e5(0x21f)](_0xf4a2e5(0x1b1)+_0x12d030),_0x2456a6&&console[_0xf4a2e5(0x21f)](_0xf4a2e5(0x1f7)+_0x2456a6));const _0x1d33c3=await withSpinner('Downloading\x20project\x20'+_0x3f4399+_0xf4a2e5(0x225),()=>_0x5703b3['workflow'][_0xf4a2e5(0x220)](_0x3f4399,_0x12d030,{'revision':_0x2456a6}),{'verbose':_0x5a6b6a[_0xf4a2e5(0x1f0)]}),_0x2a5537=_0x1d33c3['data'];return console[_0xf4a2e5(0x21f)](_0xf4a2e5(0x1e2)+_0x2a5537[_0xf4a2e5(0x1e0)]),console['error']('\x20\x20Revision:\x20'+_0x2a5537['revision']),console['error']('\x20\x20Files\x20extracted:\x20'+_0x2a5537[_0xf4a2e5(0x1e3)]),console[_0xf4a2e5(0x21f)](_0xf4a2e5(0x206)+_0x12d030+'/'+_0x2a5537['projectName']),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']=a33_0x47e5ec(0x1f9);['description']=a33_0x47e5ec(0x1d9);async[a33_0x47e5ec(0x1fe)](_0x5e7de9){const _0x308b48=a33_0x47e5ec,{options:_0x5af2cd,args:_0x5ed8c0,tdx:_0xc2d1ef}=_0x5e7de9;let _0x33a223='.',_0x3e50ac=_0x5af2cd['name'];if(_0x5ed8c0[0x0]){const {promises:_0x52624a}=await import('fs');try{const _0xa8d989=await _0x52624a[_0x308b48(0x201)](_0x5ed8c0[0x0]);if(_0xa8d989['isDirectory']())_0x33a223=_0x5ed8c0[0x0];else return console[_0x308b48(0x21f)](_0x308b48(0x1aa)+_0x5ed8c0[0x0]+'\x20is\x20not\x20a\x20directory'),0x1;}catch{_0x3e50ac=_0x5ed8c0[0x0],_0x33a223='.';}}const _0x1b1f2e=_0x5af2cd[_0x308b48(0x1fb)],_0x31239f=_0x5af2cd['skipValidation'];_0x5af2cd[_0x308b48(0x1f0)]&&(console[_0x308b48(0x21f)](_0x308b48(0x212)+_0x33a223),_0x3e50ac&&console[_0x308b48(0x21f)](_0x308b48(0x1cf)+_0x3e50ac),_0x1b1f2e&&console[_0x308b48(0x21f)]('Revision:\x20'+_0x1b1f2e),_0x31239f&&console[_0x308b48(0x21f)](_0x308b48(0x223)));const _0x3c1807=await withSpinner('Pushing\x20workflow\x20project...',()=>_0xc2d1ef[_0x308b48(0x227)]['push'](_0x33a223,{'projectName':_0x3e50ac,'revision':_0x1b1f2e,'skipValidation':_0x31239f}),{'verbose':_0x5af2cd[_0x308b48(0x1f0)]}),_0x389c8a=_0x3c1807['data'];return console['error'](_0x308b48(0x1f2)+_0x389c8a['projectName']),console[_0x308b48(0x21f)](_0x308b48(0x1ad)+_0x389c8a[_0x308b48(0x1b7)]),console[_0x308b48(0x21f)]('\x20\x20Revision:\x20'+_0x389c8a[_0x308b48(0x1fb)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a33_0x47e5ec(0x1f1)]=a33_0x47e5ec(0x1db);[a33_0x47e5ec(0x1c0)]=a33_0x47e5ec(0x1cd);async[a33_0x47e5ec(0x1fe)](_0x565609){const _0x1c26a5=a33_0x47e5ec,{options:_0x476f50,args:_0x3509b7,tdx:_0x27c811}=_0x565609,_0x2f83c9=_0x3509b7[0x0];if(!_0x2f83c9)return console[_0x1c26a5(0x21f)](_0x1c26a5(0x1be)),console[_0x1c26a5(0x21f)]('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x476f50[_0x1c26a5(0x1f0)]&&console['error'](_0x1c26a5(0x1bb)+_0x2f83c9);if(!_0x476f50[_0x1c26a5(0x1ef)]){const _0x21fa77=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22'+_0x2f83c9+_0x1c26a5(0x215));if(!_0x21fa77)return console[_0x1c26a5(0x21f)](_0x1c26a5(0x1f6)),0x0;}const _0x2ee61c=await withSpinner(_0x1c26a5(0x1c7)+_0x2f83c9+_0x1c26a5(0x225),()=>_0x27c811[_0x1c26a5(0x227)][_0x1c26a5(0x229)](_0x2f83c9),{'verbose':_0x476f50[_0x1c26a5(0x1f0)]}),_0x1c4a1f=_0x2ee61c['data'];return console['error'](_0x1c26a5(0x1f3)+_0x1c4a1f[_0x1c26a5(0x1e0)]),console[_0x1c26a5(0x21f)]('\x20\x20Project\x20ID:\x20'+_0x1c4a1f['projectId']),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3f854b,_0x4ed6de){const _0x440207=a34_0xe635,_0x2c56e6=_0x3f854b();while(!![]){try{const _0x2651cd=-parseInt(_0x440207(0x74))/0x1+-parseInt(_0x440207(0x73))/0x2+parseInt(_0x440207(0x7f))/0x3+-parseInt(_0x440207(0x7b))/0x4+parseInt(_0x440207(0x80))/0x5+-parseInt(_0x440207(0x7e))/0x6+-parseInt(_0x440207(0x76))/0x7*(-parseInt(_0x440207(0x6c))/0x8);if(_0x2651cd===_0x4ed6de)break;else _0x2c56e6['push'](_0x2c56e6['shift']());}catch(_0x4212a6){_0x2c56e6['push'](_0x2c56e6['shift']());}}}(a34_0x1e74,0xe23e3));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x47e49c=a34_0xe635;try{const _0x44fd5c=fileURLToPath(import.meta[_0x47e49c(0x6f)]),_0x4bbcb0=dirname(_0x44fd5c),_0x15103=join(_0x4bbcb0,_0x47e49c(0x79)),_0xa821ef=JSON[_0x47e49c(0x72)](readFileSync(_0x15103,_0x47e49c(0x7c)));return _0xa821ef[_0x47e49c(0x78)];}catch{return'0.0.0';}}export function getUserAgent(){const _0x570fbc=a34_0xe635,_0x2eebe4=getVersion(),_0x182e25=platform(),_0x420e4a=process['version'][_0x570fbc(0x7a)]('v','');return _0x570fbc(0x77)+_0x2eebe4+'\x20('+_0x182e25+_0x570fbc(0x7d)+_0x420e4a+')';}function a34_0x1e74(){const _0x125ce1=[';\x20node/','5894754HroLpI','5187222qiyvHS','6491870XZNYrA','6376QDXVuI','length','Authorization','url','TD1\x20','entries','parse','1442742Hqnhkl','1091116IdDJhn','X-Trino-User','20419pfKtaG','tdx/','version','../../package.json','replace','6522640ookVvo','utf-8'];a34_0x1e74=function(){return _0x125ce1;};return a34_0x1e74();}function a34_0xe635(_0x15ccbf,_0x3c0482){const _0x1e74fc=a34_0x1e74();return a34_0xe635=function(_0xe635cf,_0x105f38){_0xe635cf=_0xe635cf-0x6c;let _0x3d2e07=_0x1e74fc[_0xe635cf];return _0x3d2e07;},a34_0xe635(_0x15ccbf,_0x3c0482);}export function getAuthHeaders(_0x2c0d97,_0x49dd97){const _0x3ebd25=a34_0xe635,_0x342679=getVersion(),_0x16a0f2={'User-Agent':getUserAgent(),'X-TD-Client':'tdx','X-TD-Client-Version':_0x342679};return _0x49dd97&&(_0x16a0f2[_0x3ebd25(0x6e)]=_0x3ebd25(0x70)+_0x49dd97),_0x16a0f2;}export function toHeaderRecord(_0x3617c9){const _0x304e16=a34_0xe635,_0x25833f={};for(const [_0x544014,_0x4b9e0e]of Object[_0x304e16(0x71)](_0x3617c9)){_0x4b9e0e!==undefined&&(_0x25833f[_0x544014]=_0x4b9e0e);}return _0x25833f;}export function getTrinoHeaders(_0x3b8531,_0x53396b){const _0x8d84dc=a34_0xe635,_0x21ebc9=getAuthHeaders(_0x3b8531,_0x53396b),_0x446df1=toHeaderRecord(_0x21ebc9);return delete _0x446df1[_0x8d84dc(0x6e)],_0x53396b&&(_0x446df1[_0x8d84dc(0x75)]=_0x53396b),_0x446df1;}export function hasAPIKey(_0x44789a){const _0x5bb1d3=a34_0xe635,_0x366819=getAPIKey(_0x44789a);return _0x366819!==undefined&&_0x366819[_0x5bb1d3(0x6d)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1e24df,_0x36500d){const _0x1d0ded=a35_0x755e,_0x8032df=_0x1e24df();while(!![]){try{const _0x397192=parseInt(_0x1d0ded(0xc5))/0x1*(parseInt(_0x1d0ded(0xce))/0x2)+parseInt(_0x1d0ded(0xea))/0x3+parseInt(_0x1d0ded(0xee))/0x4+-parseInt(_0x1d0ded(0xe8))/0x5+-parseInt(_0x1d0ded(0xf5))/0x6+-parseInt(_0x1d0ded(0xcb))/0x7+-parseInt(_0x1d0ded(0xd7))/0x8*(-parseInt(_0x1d0ded(0xe1))/0x9);if(_0x397192===_0x36500d)break;else _0x8032df['push'](_0x8032df['shift']());}catch(_0x1cc234){_0x8032df['push'](_0x8032df['shift']());}}}(a35_0xd035,0xafe6c));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import*as a35_0x116f13 from'node:fs';import*as a35_0x512b77 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';export function getConfigDir(){const _0x7cb801=a35_0x755e;return process[_0x7cb801(0xe3)][_0x7cb801(0xc6)]||join(homedir(),_0x7cb801(0xe2),_0x7cb801(0xf6));}function a35_0xd035(){const _0x1e97dd=['startsWith','4647879xjjkMs','.config','env','map','profile','toUpperCase','apiKeys','4009485sLExYR','TD_API_KEY_','2733774BOAXSa','Warning:\x20Unknown\x20site\x20\x27','error','replace','1523084cFMTAD','stg-jp01','ap03','trim','\x20(TD_API_KEY)','profile:\x20','existsSync','2726334owlJDl','tdx','warn','Warning:\x20Failed\x20to\x20load\x20','dev-us01','parse','eu01','env:\x20TD_API_KEY','6047sSlAuS','TDX_CONFIG_DIR','profiles','\x27,\x20defaulting\x20to\x20us01','.cache','stg-ap03','1954120VyWSWA','tdx.json','TD_API_KEY','148BeLmgV','join','.env.','dev-eu01','ap02','utf-8','env:\x20','us01','endsWith','8yMsZqk','global:\x20','Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:','includes','jp01','split','.env','stg-us01','readFileSync'];a35_0xd035=function(){return _0x1e97dd;};return a35_0xd035();}export function getConfigFile(){const _0x3317c3=a35_0x755e;return join(getConfigDir(),_0x3317c3(0xdd));}export function getConfigFilePath(_0x4f5b1b){const _0x5e91c6=a35_0x755e,_0x5f47e6=getConfigDir();return _0x4f5b1b?a35_0x512b77[_0x5e91c6(0xcf)](_0x5f47e6,'.env.'+_0x4f5b1b):getConfigFile();}export function getCacheDir(){const _0x5b2ce1=a35_0x755e;return process['env']['TDX_CACHE_DIR']||join(homedir(),_0x5b2ce1(0xc9),_0x5b2ce1(0xf6));}export function getLLMProjectCacheFile(){return join(getCacheDir(),'llm_default_project');}export function readCachedLLMProject(){const _0x5cad82=a35_0x755e;try{const _0x26941b=getLLMProjectCacheFile();if(!existsSync(_0x26941b))return null;return readFileSync(_0x26941b,_0x5cad82(0xd3))[_0x5cad82(0xf1)]();}catch{return null;}}export function writeCachedLLMProject(_0x4f366f){const _0x24eb35=a35_0x755e;try{const _0x266757=getCacheDir(),_0x38da74=getLLMProjectCacheFile();!existsSync(_0x266757)&&mkdirSync(_0x266757,{'recursive':!![]}),writeFileSync(_0x38da74,_0x4f366f,'utf-8');}catch(_0x4fd933){console[_0x24eb35(0xec)](_0x24eb35(0xd9),_0x4fd933);}}export function parseEnvFile(_0x58108a){const _0x40250f=a35_0x755e,_0x4a74e1={};for(const _0x406247 of _0x58108a[_0x40250f(0xdc)]('\x0a')){const _0x57b866=_0x406247[_0x40250f(0xf1)]();if(!_0x57b866||_0x57b866[_0x40250f(0xe0)]('#'))continue;const _0x36fcd7=_0x57b866['match'](/^([^=]+)=(.*)$/);if(_0x36fcd7){const _0x328e98=_0x36fcd7[0x1][_0x40250f(0xf1)]();let _0x5f162b=_0x36fcd7[0x2][_0x40250f(0xf1)]();(_0x5f162b[_0x40250f(0xe0)]('\x22')&&_0x5f162b[_0x40250f(0xd6)]('\x22')||_0x5f162b['startsWith']('\x27')&&_0x5f162b['endsWith']('\x27'))&&(_0x5f162b=_0x5f162b['slice'](0x1,-0x1)),_0x4a74e1[_0x328e98]=_0x5f162b;}}return _0x4a74e1;}export function readUserConfig(){const _0x7d22b8=a35_0x755e,_0x48351b=getConfigFile();if(!existsSync(_0x48351b))return{};try{const _0xe6ff44=readFileSync(_0x48351b,_0x7d22b8(0xd3));return parseEnvFile(_0xe6ff44);}catch(_0x423a54){return console[_0x7d22b8(0xf7)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x48351b+':',_0x423a54),{};}}export function resolveSite(_0x3ec3c4){const _0x152e29=a35_0x755e,_0x83e5de=[_0x152e29(0xd5),'jp01','eu01',_0x152e29(0xd2),_0x152e29(0xf0),'dev-us01','dev-eu01',_0x152e29(0xde),'stg-jp01',_0x152e29(0xca)];if(_0x83e5de[_0x152e29(0xda)](_0x3ec3c4))return _0x3ec3c4;if(_0x3ec3c4 in SITE_ALIASES)return SITE_ALIASES[_0x3ec3c4];return console[_0x152e29(0xf7)](_0x152e29(0xeb)+_0x3ec3c4+_0x152e29(0xc8)),_0x152e29(0xd5);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}function a35_0x755e(_0x2d6e77,_0x6b349b){const _0xd035b5=a35_0xd035();return a35_0x755e=function(_0x755e81,_0xaaab34){_0x755e81=_0x755e81-0xc1;let _0x508d89=_0xd035b5[_0x755e81];return _0x508d89;},a35_0x755e(_0x2d6e77,_0x6b349b);}export function getAPIKey(_0x444951,_0x569ac0){const _0x4a4437=a35_0x755e,_0x32a3f9=_0x444951['toUpperCase']()[_0x4a4437(0xed)](/-/g,'_'),_0x4af875=_0x4a4437(0xe9)+_0x32a3f9;if(process['env'][_0x4af875])return process[_0x4a4437(0xe3)][_0x4af875];if(process['env'][_0x4a4437(0xcd)])return process[_0x4a4437(0xe3)][_0x4a4437(0xcd)];const _0x397632=_0x569ac0||getActiveProfileName();if(_0x397632){const _0xc0ee52=loadProfileEnv(_0x397632);if(_0xc0ee52){if(_0xc0ee52[_0x4af875])return _0xc0ee52[_0x4af875];if(_0xc0ee52[_0x4a4437(0xcd)])return _0xc0ee52[_0x4a4437(0xcd)];}}const _0xe20aa8=loadUserConfigOnce();if(_0xe20aa8[_0x4af875])return _0xe20aa8[_0x4af875];if(_0xe20aa8[_0x4a4437(0xcd)])return _0xe20aa8[_0x4a4437(0xcd)];return undefined;}export function getAPIKeySource(_0x14fdac,_0x3002f8){const _0x4950da=a35_0x755e,_0x5b2469=_0x4950da(0xe9)+_0x14fdac[_0x4950da(0xe6)]()[_0x4950da(0xed)](/-/g,'_');if(process[_0x4950da(0xe3)][_0x5b2469])return _0x4950da(0xd4)+_0x5b2469;if(process[_0x4950da(0xe3)][_0x4950da(0xcd)])return _0x4950da(0xc4);const _0x4a46b3=_0x3002f8||getActiveProfileName();if(_0x4a46b3){const _0x1972a5=loadProfileEnv(_0x4a46b3);if(_0x1972a5){if(_0x1972a5[_0x5b2469])return _0x4950da(0xf3)+_0x4a46b3+'\x20('+_0x5b2469+')';if(_0x1972a5[_0x4950da(0xcd)])return _0x4950da(0xf3)+_0x4a46b3+'\x20(TD_API_KEY)';}}const _0x8b574d=loadUserConfigOnce(),_0x2c1365=getConfigFile();if(_0x8b574d[_0x5b2469])return _0x4950da(0xd8)+_0x2c1365+'\x20('+_0x5b2469+')';if(_0x8b574d['TD_API_KEY'])return'global:\x20'+_0x2c1365+_0x4950da(0xf2);return null;}function loadProfileEnv(_0x2c9269){const _0xa18bf2=a35_0x755e,_0x5b71c9=a35_0x512b77[_0xa18bf2(0xcf)](getConfigDir(),_0xa18bf2(0xd0)+_0x2c9269);if(a35_0x116f13[_0xa18bf2(0xf4)](_0x5b71c9)){validateSecureFilePermissions(_0x5b71c9);try{const _0x5cb9b9=a35_0x116f13['readFileSync'](_0x5b71c9,_0xa18bf2(0xd3));return parseEnvFile(_0x5cb9b9);}catch(_0x4b1dd0){console[_0xa18bf2(0xf7)]('Warning:\x20Failed\x20to\x20load\x20'+_0x5b71c9+':\x20'+_0x4b1dd0);}}const _0x2854c6=a35_0x512b77[_0xa18bf2(0xcf)](getConfigDir(),_0xa18bf2(0xc7),_0x2c9269,_0xa18bf2(0xdd));if(a35_0x116f13[_0xa18bf2(0xf4)](_0x2854c6)){validateSecureFilePermissions(_0x2854c6);try{const _0x70edd4=a35_0x116f13['readFileSync'](_0x2854c6,_0xa18bf2(0xd3));return parseEnvFile(_0x70edd4);}catch(_0x22d68b){return console[_0xa18bf2(0xf7)](_0xa18bf2(0xf8)+_0x2854c6+':\x20'+_0x22d68b),null;}}return null;}function getActiveProfileName(){const _0x38eab9=a35_0x755e,_0x4a185c=a35_0x512b77[_0x38eab9(0xcf)](getConfigDir(),_0x38eab9(0xcc));if(!a35_0x116f13['existsSync'](_0x4a185c))return null;try{const _0x35a0d4=a35_0x116f13[_0x38eab9(0xdf)](_0x4a185c,_0x38eab9(0xd3)),_0x1ede92=JSON[_0x38eab9(0xc2)](_0x35a0d4);return _0x1ede92[_0x38eab9(0xe5)]||null;}catch{return null;}}export function saveAPIKey(_0xa85c3a,_0x3b115e,_0x114f13){const _0x35e23a=a35_0x755e,_0xd17c7a=getConfigDir(),_0x1e7c41=getConfigFilePath(_0x114f13);!existsSync(_0xd17c7a)&&mkdirSync(_0xd17c7a,{'recursive':!![],'mode':0x1c0});let _0x58563d={};if(existsSync(_0x1e7c41))try{const _0x421624=readFileSync(_0x1e7c41,_0x35e23a(0xd3));_0x58563d=parseEnvFile(_0x421624);}catch(_0x479d24){console[_0x35e23a(0xf7)]('Warning:\x20Failed\x20to\x20read\x20'+_0x1e7c41+':',_0x479d24);}const _0x24dfe0=_0xa85c3a[_0x35e23a(0xe6)]()[_0x35e23a(0xed)](/-/g,'_');_0x58563d[_0x35e23a(0xe9)+_0x24dfe0]=_0x3b115e;const _0x3d917a=Object['entries'](_0x58563d)[_0x35e23a(0xe4)](([_0x37c787,_0x99bdb])=>_0x37c787+'='+_0x99bdb);writeFileSync(_0x1e7c41,_0x3d917a['join']('\x0a')+'\x0a',{'mode':0x180});}export function loadConfig(){const _0x4f2e15=a35_0x755e,_0x460140={'apiKeys':{},'defaultSite':_0x4f2e15(0xd5)},_0x1f883e=[_0x4f2e15(0xd5),_0x4f2e15(0xdb),_0x4f2e15(0xc3),'ap02',_0x4f2e15(0xf0),_0x4f2e15(0xc1),_0x4f2e15(0xd1),_0x4f2e15(0xde),_0x4f2e15(0xef),_0x4f2e15(0xca)];for(const _0x372c9c of _0x1f883e){const _0x22475d=getAPIKey(_0x372c9c);_0x22475d&&(_0x460140[_0x4f2e15(0xe7)][_0x372c9c]=_0x22475d);}return _0x460140;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a36_0x5d3b(_0x1aea52,_0x29e625){const _0x22c52e=a36_0x22c5();return a36_0x5d3b=function(_0x5d3bc3,_0x494a7f){_0x5d3bc3=_0x5d3bc3-0x155;let _0x103d17=_0x22c52e[_0x5d3bc3];return _0x103d17;},a36_0x5d3b(_0x1aea52,_0x29e625);}const a36_0x20b9c8=a36_0x5d3b;function a36_0x22c5(){const _0x122637=['llmProject','activeProfile','parentSegment','database','sessions','layers','segmentPath','log','Global\x20Credentials','24orkLCY','Profile\x20Credentials','694105vzIgRT','getParameters','entries','string','1920478YzHjMj','displayWithSources','3qAPOhD','profile','verbose','default','display','[context]','loadGlobalConfig','project','27882DvcxvC','2894927kYCOSm','readFileSync','getSource','logLevel','profiles','(session:\x20','existsSync','(active)','config','replace','join','Profile','site','cliFlags','tdx.json',':\x20none','configFiles','8Uxewdw','43637SJScJj','CLI\x20flag:\x20--','global','1284pjVjeC','Global','us01','parent_segment','apiKey','.json','llm_project','segment_path','injectIntoOptions','parse','\x0a[configuration\x20files]','profileCredentials','utf-8','toString','2570drQWyf','session','.env','sessionId','Session','293164GjfmLc','1000525yzSOhj'];a36_0x22c5=function(){return _0x122637;};return a36_0x22c5();}(function(_0x3f530d,_0x575b7e){const _0x47887d=a36_0x5d3b,_0x33f234=_0x3f530d();while(!![]){try{const _0x2712de=parseInt(_0x47887d(0x161))/0x1+parseInt(_0x47887d(0x171))/0x2+parseInt(_0x47887d(0x173))/0x3*(-parseInt(_0x47887d(0x160))/0x4)+-parseInt(_0x47887d(0x16d))/0x5*(parseInt(_0x47887d(0x16b))/0x6)+-parseInt(_0x47887d(0x17c))/0x7*(parseInt(_0x47887d(0x18d))/0x8)+parseInt(_0x47887d(0x17b))/0x9*(-parseInt(_0x47887d(0x15b))/0xa)+-parseInt(_0x47887d(0x18e))/0xb*(-parseInt(_0x47887d(0x191))/0xc);if(_0x2712de===_0x575b7e)break;else _0x33f234['push'](_0x33f234['shift']());}catch(_0x377600){_0x33f234['push'](_0x33f234['shift']());}}}(a36_0x22c5,0x8585f));import{resolveSite,getAPIKey,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a36_0x386a1a from'node:fs';import*as a36_0x575634 from'node:path';export class GlobalContext{['site'];[a36_0x20b9c8(0x165)];[a36_0x20b9c8(0x194)];[a36_0x20b9c8(0x198)];[a36_0x20b9c8(0x197)];[a36_0x20b9c8(0x195)];[a36_0x20b9c8(0x175)];[a36_0x20b9c8(0x17f)];[a36_0x20b9c8(0x167)];[a36_0x20b9c8(0x163)];[a36_0x20b9c8(0x15e)];[a36_0x20b9c8(0x18c)];constructor(_0x113ab8){const _0x1091fe=a36_0x20b9c8;this[_0x1091fe(0x15e)]=_0x113ab8['session']||getCurrentSessionPID()[_0x1091fe(0x15a)]();const _0x2f584e=loadSessionContext(_0x113ab8[_0x1091fe(0x15c)]),_0x468fb2=loadProjectConfig(),_0x5ec4b2=this[_0x1091fe(0x179)]();this[_0x1091fe(0x163)]=_0x113ab8[_0x1091fe(0x174)]||_0x2f584e?.[_0x1091fe(0x174)]||_0x5ec4b2[_0x1091fe(0x174)]||getActiveProfile();const _0x45c943=this['activeProfile']?loadProfile(this[_0x1091fe(0x163)]):null,_0x269c8e=_0x584da9=>{const _0x3ac862=_0x1091fe;if(!_0x584da9)return{};const _0x422a63=_0x584da9,_0x521134={};for(const [_0x921b1a,_0x14f7f6]of Object[_0x3ac862(0x16f)](_0x422a63)){typeof _0x14f7f6===_0x3ac862(0x170)&&(_0x521134[_0x921b1a]=_0x14f7f6);}return _0x521134;},_0x2349bd={};if(_0x113ab8['site']&&_0x113ab8[_0x1091fe(0x188)]!=='us01')_0x2349bd['site']=_0x113ab8[_0x1091fe(0x188)];const _0x42462b=_0x2f584e?.['database'],_0x27f451=_0x468fb2?.[_0x1091fe(0x165)],_0x2b8db0=_0x45c943?.[_0x1091fe(0x184)]?.[_0x1091fe(0x165)],_0x447fc4=_0x5ec4b2[_0x1091fe(0x165)];_0x113ab8[_0x1091fe(0x165)]&&(_0x113ab8[_0x1091fe(0x165)]!==_0x42462b&&_0x113ab8[_0x1091fe(0x165)]!==_0x27f451&&_0x113ab8[_0x1091fe(0x165)]!==_0x2b8db0&&_0x113ab8[_0x1091fe(0x165)]!==_0x447fc4)&&(_0x2349bd[_0x1091fe(0x165)]=_0x113ab8['database']);if(_0x113ab8[_0x1091fe(0x164)])_0x2349bd[_0x1091fe(0x194)]=_0x113ab8[_0x1091fe(0x164)];if(_0x113ab8[_0x1091fe(0x162)])_0x2349bd['llm_project']=_0x113ab8['llmProject'];if(_0x113ab8[_0x1091fe(0x174)])_0x2349bd[_0x1091fe(0x174)]=_0x113ab8[_0x1091fe(0x174)];this[_0x1091fe(0x167)]={'cliFlags':_0x2349bd,'session':_0x269c8e(_0x2f584e),'project':_0x269c8e(_0x468fb2),'profile':_0x269c8e(_0x45c943?.[_0x1091fe(0x184)]),'global':_0x269c8e(_0x5ec4b2)};const _0x18ee5d={...this[_0x1091fe(0x167)][_0x1091fe(0x190)],...this[_0x1091fe(0x167)][_0x1091fe(0x174)],...this['layers'][_0x1091fe(0x17a)],...this[_0x1091fe(0x167)][_0x1091fe(0x15c)],...this[_0x1091fe(0x167)][_0x1091fe(0x189)]},_0x5c7f8c=_0x18ee5d[_0x1091fe(0x188)]||_0x1091fe(0x193);this[_0x1091fe(0x188)]=resolveSite(_0x5c7f8c),this['database']=_0x18ee5d[_0x1091fe(0x165)],this[_0x1091fe(0x194)]=_0x18ee5d['parent_segment'],this['segment_path']=_0x18ee5d[_0x1091fe(0x198)],this[_0x1091fe(0x197)]=_0x18ee5d[_0x1091fe(0x197)],this['verbose']=_0x113ab8[_0x1091fe(0x175)]||![],this[_0x1091fe(0x17f)]=_0x113ab8['logLevel']??LogLevel['INFO'],this['apiKey']=getAPIKey(this[_0x1091fe(0x188)],this[_0x1091fe(0x163)]||undefined);const _0xbbc581=getConfigDir(),_0x289b33=a36_0x575634[_0x1091fe(0x186)](_0xbbc581,_0x1091fe(0x166),this[_0x1091fe(0x15e)]+_0x1091fe(0x196)),_0x280202=findProjectConfigPath(),_0x37e52e=a36_0x575634[_0x1091fe(0x186)](_0xbbc581,'tdx.json'),_0x33a8ec=a36_0x575634[_0x1091fe(0x186)](_0xbbc581,'.env');let _0x234bd1=null,_0x3acbb8=null;this[_0x1091fe(0x163)]&&(_0x234bd1=a36_0x575634[_0x1091fe(0x186)](_0xbbc581,_0x1091fe(0x180),this[_0x1091fe(0x163)],_0x1091fe(0x18a)),_0x3acbb8=a36_0x575634[_0x1091fe(0x186)](_0xbbc581,_0x1091fe(0x180),this[_0x1091fe(0x163)],_0x1091fe(0x15d))),this[_0x1091fe(0x18c)]={'session':a36_0x386a1a[_0x1091fe(0x182)](_0x289b33)?_0x289b33:null,'project':_0x280202,'profile':_0x234bd1&&a36_0x386a1a[_0x1091fe(0x182)](_0x234bd1)?_0x234bd1:null,'profileCredentials':_0x3acbb8&&a36_0x386a1a[_0x1091fe(0x182)](_0x3acbb8)?_0x3acbb8:null,'global':a36_0x386a1a[_0x1091fe(0x182)](_0x37e52e)?_0x37e52e:null,'globalCredentials':a36_0x386a1a[_0x1091fe(0x182)](_0x33a8ec)?_0x33a8ec:null};}[a36_0x20b9c8(0x17e)](_0x4c157a,_0x150a51){const _0x1551e9=a36_0x20b9c8;if(!_0x150a51)return'not\x20set';const _0x5481b7=_0x150a51;if(this['layers'][_0x1551e9(0x189)][_0x4c157a]===_0x5481b7){if(_0x4c157a===_0x1551e9(0x188)&&_0x5481b7===_0x1551e9(0x193)&&!this[_0x1551e9(0x167)][_0x1551e9(0x15c)]['site']&&!this[_0x1551e9(0x167)]['project'][_0x1551e9(0x188)]&&!this['layers'][_0x1551e9(0x174)][_0x1551e9(0x188)]&&!this[_0x1551e9(0x167)]['global'][_0x1551e9(0x188)])return _0x1551e9(0x176);return _0x1551e9(0x18f)+_0x4c157a[_0x1551e9(0x185)](/_/g,'-');}if(this[_0x1551e9(0x167)][_0x1551e9(0x15c)][_0x4c157a]===_0x5481b7)return _0x1551e9(0x15c);if(this['layers'][_0x1551e9(0x17a)][_0x4c157a]===_0x5481b7)return'project';if(this['layers'][_0x1551e9(0x174)][_0x4c157a]===_0x5481b7)return'profile:\x20'+this['activeProfile'];if(this[_0x1551e9(0x167)][_0x1551e9(0x190)][_0x4c157a]===_0x5481b7)return'global';return _0x1551e9(0x176);}[a36_0x20b9c8(0x179)](){const _0x348f0e=a36_0x20b9c8,_0x5adc52=a36_0x575634['join'](getConfigDir(),'tdx.json');if(!a36_0x386a1a['existsSync'](_0x5adc52))return{};try{const _0xb251ad=a36_0x386a1a[_0x348f0e(0x17d)](_0x5adc52,_0x348f0e(0x159));return JSON[_0x348f0e(0x156)](_0xb251ad);}catch{return{};}}[a36_0x20b9c8(0x155)](_0x3b52c2){const _0x18bd21=a36_0x20b9c8;_0x3b52c2['site']=this[_0x18bd21(0x188)],!_0x3b52c2[_0x18bd21(0x165)]&&this[_0x18bd21(0x165)]&&(_0x3b52c2[_0x18bd21(0x165)]=this[_0x18bd21(0x165)]),!_0x3b52c2['parentSegment']&&this[_0x18bd21(0x194)]&&(_0x3b52c2['parentSegment']=this[_0x18bd21(0x194)]),!_0x3b52c2[_0x18bd21(0x168)]&&this[_0x18bd21(0x198)]&&(_0x3b52c2[_0x18bd21(0x168)]=this['segment_path']),!_0x3b52c2[_0x18bd21(0x162)]&&this[_0x18bd21(0x197)]&&(_0x3b52c2[_0x18bd21(0x162)]=this[_0x18bd21(0x197)]);}[a36_0x20b9c8(0x16e)](){const _0x1ceecd=a36_0x20b9c8;return[{'key':_0x1ceecd(0x188),'value':this[_0x1ceecd(0x188)]},{'key':_0x1ceecd(0x165),'value':this[_0x1ceecd(0x165)]},{'key':_0x1ceecd(0x194),'value':this['parent_segment']},{'key':_0x1ceecd(0x198),'value':this[_0x1ceecd(0x198)]},{'key':'llm_project','value':this[_0x1ceecd(0x197)]},{'key':_0x1ceecd(0x174),'value':this[_0x1ceecd(0x163)]||undefined}];}[a36_0x20b9c8(0x177)](){const _0x3990f9=a36_0x20b9c8;console[_0x3990f9(0x169)](_0x3990f9(0x178));for(const {key:_0xb833cd,value:_0x5960c1}of this[_0x3990f9(0x16e)]()){_0x5960c1&&console[_0x3990f9(0x169)](_0xb833cd+':\x20'+_0x5960c1);}}[a36_0x20b9c8(0x172)](){const _0x4cd1c1=a36_0x20b9c8;console[_0x4cd1c1(0x169)](_0x4cd1c1(0x178));for(const {key:_0x14860d,value:_0x19eec6}of this[_0x4cd1c1(0x16e)]()){if(_0x19eec6){const _0x54358c=_0x14860d===_0x4cd1c1(0x174)?_0x4cd1c1(0x183):'('+this[_0x4cd1c1(0x17e)](_0x14860d,_0x19eec6)+')';console[_0x4cd1c1(0x169)](_0x14860d+':\x20'+_0x19eec6+'\x20'+_0x54358c);}}console[_0x4cd1c1(0x169)](_0x4cd1c1(0x157));const _0x1119d4=[{'label':'Session','path':this['configFiles'][_0x4cd1c1(0x15c)],'extra':_0x4cd1c1(0x181)+this[_0x4cd1c1(0x15e)]+')'},{'label':'Project','path':this[_0x4cd1c1(0x18c)]['project']},{'label':_0x4cd1c1(0x187),'path':this['configFiles'][_0x4cd1c1(0x174)]},{'label':_0x4cd1c1(0x16c),'path':this[_0x4cd1c1(0x18c)][_0x4cd1c1(0x158)]},{'label':_0x4cd1c1(0x192),'path':this['configFiles'][_0x4cd1c1(0x190)]},{'label':_0x4cd1c1(0x16a),'path':this[_0x4cd1c1(0x18c)]['globalCredentials']}];for(const {label:_0x834359,path:_0x13d2b0,extra:_0x4d35b8}of _0x1119d4){if(_0x13d2b0)console[_0x4cd1c1(0x169)](_0x834359+':\x20'+_0x13d2b0+'\x20✓'+(_0x4d35b8?'\x20'+_0x4d35b8:''));else{if(_0x834359===_0x4cd1c1(0x15f))console[_0x4cd1c1(0x169)](_0x834359+':\x20none\x20(using\x20session:\x20'+this[_0x4cd1c1(0x15e)]+')');else(_0x834359==='Project'||_0x834359===_0x4cd1c1(0x192))&&console[_0x4cd1c1(0x169)](_0x834359+_0x4cd1c1(0x18b));}}}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x99e804,_0x4256b9){const _0x1d1868=a37_0x3aff,_0x5d1eac=_0x99e804();while(!![]){try{const _0x59f7bd=parseInt(_0x1d1868(0x1cf))/0x1*(parseInt(_0x1d1868(0x1ba))/0x2)+-parseInt(_0x1d1868(0x1d3))/0x3+parseInt(_0x1d1868(0x1b1))/0x4+-parseInt(_0x1d1868(0x1ad))/0x5+-parseInt(_0x1d1868(0x1ee))/0x6+parseInt(_0x1d1868(0x1e6))/0x7*(parseInt(_0x1d1868(0x1e5))/0x8)+parseInt(_0x1d1868(0x1ac))/0x9;if(_0x59f7bd===_0x4256b9)break;else _0x5d1eac['push'](_0x5d1eac['shift']());}catch(_0x4b7996){_0x5d1eac['push'](_0x5d1eac['shift']());}}}(a37_0x59af,0x61138));function a37_0x59af(){const _0xb8222f=['625444IXLWgb','has','rmSync','push','map','tdx.json','\x27:\x20unknown\x20config\x20key\x20\x27','profiles','readFileSync','toISOString','\x20\x201.\x20Edit:\x20','values','Error:\x20','user','llm_project','llm_agent','parent_segment','utf-8','stringify','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','existsSync','1ncmkiP','test','Warning:\x20Profile\x20\x27','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','490845SSrOKD','\x20\x20mv\x20\x22','readdirSync','\x22\x20\x22','warn','entries','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','Invalid\x20profile\x20name:\x20','.env','parse','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','Profile\x20\x27','string','description','message','name','24kOaaxg','1450848ALTbPA','from','filter','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','Profile\x20','\x20does\x20not\x20exist','length','2287500HfNQqS','some','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','keys','2209779vtgmnL','2791295ynFbDZ','sort','\x0aWarning:\x20Failed\x20to\x20parse\x20','set','1282812lCLiaD','object','.env.','database','isDirectory','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','site','join','localeCompare'];a37_0x59af=function(){return _0xb8222f;};return a37_0x59af();}import*as a37_0x1c0357 from'node:fs';import*as a37_0x4c44c0 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';export function getProfileParams(_0x5e3b28){const _0x1fc2d9=a37_0x3aff,_0x2f652d={};if(!_0x5e3b28)return _0x2f652d;for(const [_0x37e5fd,_0x4c486c]of Object[_0x1fc2d9(0x1d8)](_0x5e3b28)){_0x37e5fd!=='description'&&_0x4c486c!==undefined&&(_0x2f652d[_0x37e5fd]=_0x4c486c);}return _0x2f652d;}export function getProfilesDir(){const _0x24a02c=a37_0x3aff;return a37_0x4c44c0[_0x24a02c(0x1b8)](getConfigDir(),_0x24a02c(0x1c1));}function getProfileDir(_0x56f92f){return a37_0x4c44c0['join'](getProfilesDir(),_0x56f92f);}function getProfileConfigPath(_0x2ff91d){const _0x4d2a2a=a37_0x3aff;return a37_0x4c44c0[_0x4d2a2a(0x1b8)](getProfileDir(_0x2ff91d),_0x4d2a2a(0x1bf));}function getProfileEnvPath(_0x5d2dbf){const _0x447e1b=a37_0x3aff;return a37_0x4c44c0[_0x447e1b(0x1b8)](getProfileDir(_0x5d2dbf),_0x447e1b(0x1dd));}function getGlobalConfigPath(){const _0x50286e=a37_0x3aff;return a37_0x4c44c0[_0x50286e(0x1b8)](getConfigDir(),_0x50286e(0x1bf));}function validateProfileName(_0x3ce852){const _0x3e6bfd=a37_0x3aff;if(!/^[a-zA-Z0-9_-]+$/[_0x3e6bfd(0x1d0)](_0x3ce852))throw new Error(_0x3e6bfd(0x1dc)+_0x3ce852+_0x3e6bfd(0x1b6));}function validateProfileConfig(_0x85d73a,_0x148c98){const _0x243d88=a37_0x3aff;if(typeof _0x85d73a!==_0x243d88(0x1b2)||_0x85d73a===null)throw new Error(_0x243d88(0x1e0)+_0x148c98+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x4b8487=[_0x243d88(0x1e2),'site',_0x243d88(0x1b4),_0x243d88(0x1ca),_0x243d88(0x1c8),_0x243d88(0x1c9)],_0x319335=_0x85d73a;for(const _0x4766b5 of Object[_0x243d88(0x1ab)](_0x319335)){!_0x4b8487['includes'](_0x4766b5)&&console[_0x243d88(0x1d7)](_0x243d88(0x1d1)+_0x148c98+_0x243d88(0x1c0)+_0x4766b5+'\x27\x20will\x20be\x20ignored');}if(_0x319335['description']!==undefined&&typeof _0x319335['description']!==_0x243d88(0x1e1))throw new Error(_0x243d88(0x1e0)+_0x148c98+_0x243d88(0x1d9));if(_0x319335[_0x243d88(0x1b7)]!==undefined&&typeof _0x319335[_0x243d88(0x1b7)]!=='string')throw new Error(_0x243d88(0x1e0)+_0x148c98+_0x243d88(0x1e9));if(_0x319335['database']!==undefined&&typeof _0x319335[_0x243d88(0x1b4)]!==_0x243d88(0x1e1))throw new Error('Profile\x20\x27'+_0x148c98+_0x243d88(0x1df));if(_0x319335[_0x243d88(0x1ca)]!==undefined&&typeof _0x319335[_0x243d88(0x1ca)]!=='string')throw new Error(_0x243d88(0x1e0)+_0x148c98+_0x243d88(0x1da));if(_0x319335['llm_project']!==undefined&&typeof _0x319335['llm_project']!=='string')throw new Error(_0x243d88(0x1e0)+_0x148c98+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x319335['llm_agent']!==undefined&&typeof _0x319335[_0x243d88(0x1c9)]!==_0x243d88(0x1e1))throw new Error(_0x243d88(0x1e0)+_0x148c98+_0x243d88(0x1d2));return!![];}function loadProfilesFromTdxJson(_0x570be4,_0x15a4ac){const _0x478a1e=a37_0x3aff;if(!a37_0x1c0357[_0x478a1e(0x1ce)](_0x570be4))return[];try{const _0x4c3401=a37_0x1c0357[_0x478a1e(0x1c2)](_0x570be4,_0x478a1e(0x1cb)),_0x3c1cf6=JSON[_0x478a1e(0x1de)](_0x4c3401);if(!_0x3c1cf6['profiles']||typeof _0x3c1cf6['profiles']!==_0x478a1e(0x1b2))return[];const _0x432843=[];for(const [_0x44c5f4,_0x35eef7]of Object[_0x478a1e(0x1d8)](_0x3c1cf6[_0x478a1e(0x1c1)])){try{validateProfileConfig(_0x35eef7,_0x44c5f4);const _0x5e4dcf=getNewCredentialPath(_0x44c5f4),_0x32788c=getOldCredentialPath(_0x44c5f4),_0x30bab7=a37_0x1c0357[_0x478a1e(0x1ce)](_0x5e4dcf)||a37_0x1c0357['existsSync'](_0x32788c);_0x432843[_0x478a1e(0x1bd)]({'name':_0x44c5f4,'config':_0x35eef7,'metadata':{'name':_0x44c5f4,'createdAt':new Date()[_0x478a1e(0x1c3)]()},'hasCredentials':_0x30bab7,'scope':_0x15a4ac});}catch(_0x3c9f1d){_0x3c9f1d instanceof Error&&(console[_0x478a1e(0x1d7)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x570be4+':'),console['warn']('\x20\x20'+_0x3c9f1d[_0x478a1e(0x1e3)]+'\x0a'));}}return _0x432843;}catch(_0x1110e5){return _0x1110e5 instanceof SyntaxError?(console['warn'](_0x478a1e(0x1af)+_0x570be4+':\x20Invalid\x20JSON\x20syntax'),console[_0x478a1e(0x1d7)](_0x478a1e(0x1c6)+_0x1110e5[_0x478a1e(0x1e3)]+'\x0a')):console[_0x478a1e(0x1d7)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x570be4+':\x20'+_0x1110e5+'\x0a'),[];}}export function getNewCredentialPath(_0x325548){const _0x5ef572=a37_0x3aff;return a37_0x4c44c0[_0x5ef572(0x1b8)](getConfigDir(),_0x5ef572(0x1b3)+_0x325548);}function getOldCredentialPath(_0x538187){const _0x5cf887=a37_0x3aff;return a37_0x4c44c0[_0x5cf887(0x1b8)](getProfilesDir(),_0x538187,_0x5cf887(0x1dd));}function loadProfilesFromTdxJsonFiles(){const _0x2d40f1=a37_0x3aff,_0x239b03=[],_0x57f898=findProjectConfigPath();_0x57f898&&_0x239b03['push'](...loadProfilesFromTdxJson(_0x57f898,'local'));const _0x5ececc=a37_0x4c44c0[_0x2d40f1(0x1b8)](getConfigDir(),'tdx.json');return _0x239b03[_0x2d40f1(0x1bd)](...loadProfilesFromTdxJson(_0x5ececc,_0x2d40f1(0x1c7))),_0x239b03;}function loadProfilesFromDirectories(){const _0x3d3a00=a37_0x3aff,_0x46b8a6=getProfilesDir();if(!a37_0x1c0357[_0x3d3a00(0x1ce)](_0x46b8a6))return[];try{return a37_0x1c0357[_0x3d3a00(0x1d5)](_0x46b8a6,{'withFileTypes':!![]})['filter'](_0x26be3a=>_0x26be3a[_0x3d3a00(0x1b5)]())['map'](_0x363d8d=>_0x363d8d[_0x3d3a00(0x1e4)])[_0x3d3a00(0x1e8)](_0x16ce70=>{const _0x1b2bcc=_0x3d3a00,_0x3f6532=getProfileConfigPath(_0x16ce70),_0x951368=getProfileEnvPath(_0x16ce70);return a37_0x1c0357['existsSync'](_0x3f6532)||a37_0x1c0357[_0x1b2bcc(0x1ce)](_0x951368);})[_0x3d3a00(0x1be)](_0x522931=>{const _0x54b3cc=loadProfileFromDirectory(_0x522931);if(_0x54b3cc)return{..._0x54b3cc,'scope':'directory'};return null;})['filter'](_0x1536fa=>_0x1536fa!==null);}catch{return[];}}function loadProfileFromDirectory(_0x49c88f){const _0x4496ef=a37_0x3aff,_0x2a7040=getProfileConfigPath(_0x49c88f),_0x567df3=getOldCredentialPath(_0x49c88f);if(!a37_0x1c0357[_0x4496ef(0x1ce)](_0x2a7040)&&!a37_0x1c0357[_0x4496ef(0x1ce)](_0x567df3))return null;let _0x15b926={},_0xe097c={'name':_0x49c88f,'createdAt':new Date()['toISOString']()};if(a37_0x1c0357[_0x4496ef(0x1ce)](_0x2a7040))try{const _0x349037=a37_0x1c0357[_0x4496ef(0x1c2)](_0x2a7040,_0x4496ef(0x1cb)),_0x48c11c=JSON[_0x4496ef(0x1de)](_0x349037),{metadata:_0x4e4588,..._0x59a852}=_0x48c11c;_0x15b926=_0x59a852,_0x4e4588&&(_0xe097c=_0x4e4588);}catch{}return{'name':_0x49c88f,'config':_0x15b926,'metadata':_0xe097c,'hasCredentials':a37_0x1c0357[_0x4496ef(0x1ce)](_0x567df3),'scope':'directory'};}export function listProfiles(){const _0x254255=a37_0x3aff,_0x2104b9=loadProfilesFromTdxJsonFiles(),_0x2dbe3a=loadProfilesFromDirectories();if(_0x2dbe3a[_0x254255(0x1ed)]>0x0){const _0x445d44=_0x2dbe3a[_0x254255(0x1be)](_0xb87ab5=>_0xb87ab5[_0x254255(0x1e4)])['join'](',\x20'),_0x5b7281=getConfigDir();console[_0x254255(0x1d7)](_0x254255(0x1ea)+_0x445d44),console['warn'](_0x254255(0x1db)),console[_0x254255(0x1d7)](_0x254255(0x1c4)+a37_0x4c44c0[_0x254255(0x1b8)](_0x5b7281,_0x254255(0x1bf))),console[_0x254255(0x1d7)](_0x254255(0x1f0)),console[_0x254255(0x1d7)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x297105=[..._0x2104b9,..._0x2dbe3a],_0x224dfe=new Map();for(const _0x48cd2a of _0x297105){!_0x224dfe[_0x254255(0x1bb)](_0x48cd2a[_0x254255(0x1e4)])&&_0x224dfe[_0x254255(0x1b0)](_0x48cd2a['name'],_0x48cd2a);}return Array[_0x254255(0x1e7)](_0x224dfe[_0x254255(0x1c5)]())[_0x254255(0x1ae)]((_0x2edd99,_0x423e6e)=>_0x2edd99[_0x254255(0x1e4)][_0x254255(0x1b9)](_0x423e6e[_0x254255(0x1e4)]));}export function profileExists(_0x2de8df){const _0x62e885=a37_0x3aff,_0x190ccd=listProfiles();return _0x190ccd[_0x62e885(0x1ef)](_0x6de4e7=>_0x6de4e7[_0x62e885(0x1e4)]===_0x2de8df);}export function loadProfile(_0x22a694){const _0x583de1=a37_0x3aff;validateProfileName(_0x22a694);const _0x3b1c56=listProfiles(),_0x4248f7=_0x3b1c56['find'](_0x2ade1c=>_0x2ade1c[_0x583de1(0x1e4)]===_0x22a694);return _0x4248f7||null;}export function saveProfile(_0x251c63,_0xf7122d,_0x5e0551=![]){saveProfileToUserConfig(_0x251c63,_0xf7122d);}export function deleteProfile(_0x481193){const _0x21d426=a37_0x3aff;validateProfileName(_0x481193);const _0x4f48b8=getProfileDir(_0x481193);if(!a37_0x1c0357[_0x21d426(0x1ce)](_0x4f48b8))throw new Error(_0x21d426(0x1eb)+_0x481193+_0x21d426(0x1ec));a37_0x1c0357[_0x21d426(0x1bc)](_0x4f48b8,{'recursive':!![],'force':!![]});}function a37_0x3aff(_0x50b7b7,_0x47ffd0){const _0x59af30=a37_0x59af();return a37_0x3aff=function(_0x3affb3,_0x16a7d4){_0x3affb3=_0x3affb3-0x1ab;let _0x352151=_0x59af30[_0x3affb3];return _0x352151;},a37_0x3aff(_0x50b7b7,_0x47ffd0);}export function saveProfileToUserConfig(_0x34fe96,_0x1f0115){const _0x25bbb8=a37_0x3aff;validateProfileName(_0x34fe96);const _0x31bb5b=getGlobalConfigPath(),_0x1f3d57=getConfigDir();!a37_0x1c0357['existsSync'](_0x1f3d57)&&createSecureDirectory(_0x1f3d57);let _0x165950={};if(a37_0x1c0357['existsSync'](_0x31bb5b))try{const _0x160f2e=a37_0x1c0357[_0x25bbb8(0x1c2)](_0x31bb5b,_0x25bbb8(0x1cb));_0x165950=JSON[_0x25bbb8(0x1de)](_0x160f2e);}catch{console[_0x25bbb8(0x1d7)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x31bb5b+',\x20creating\x20new\x20file');}!_0x165950[_0x25bbb8(0x1c1)]&&(_0x165950['profiles']={}),_0x165950[_0x25bbb8(0x1c1)][_0x34fe96]=_0x1f0115,writeSecureFile(_0x31bb5b,JSON[_0x25bbb8(0x1cc)](_0x165950,null,0x2));}export function getActiveProfile(){const _0x456f96=a37_0x3aff,_0x59479c=getGlobalConfigPath();if(!a37_0x1c0357[_0x456f96(0x1ce)](_0x59479c))return null;try{const _0x45cf9d=a37_0x1c0357['readFileSync'](_0x59479c,_0x456f96(0x1cb)),_0x1d55c3=JSON[_0x456f96(0x1de)](_0x45cf9d);return _0x1d55c3['profile']||null;}catch{return null;}}export function createProfile(_0x46844a,_0x26cd81){const _0x230769=a37_0x3aff;validateProfileName(_0x46844a);if(profileExists(_0x46844a))throw new Error(_0x230769(0x1eb)+_0x46844a+'\x20already\x20exists');saveProfile(_0x46844a,_0x26cd81);}export function saveProfileCredentials(_0x9a885e,_0xdbde48){const _0x114969=a37_0x3aff;validateProfileName(_0x9a885e);if(!profileExists(_0x9a885e))throw new Error(_0x114969(0x1eb)+_0x9a885e+_0x114969(0x1ec));const _0x160d17=getNewCredentialPath(_0x9a885e);writeSecureFile(_0x160d17,_0xdbde48);}export function loadProfileCredentials(_0x3dc822){const _0xfe7c2b=a37_0x3aff;validateProfileName(_0x3dc822);const _0x582e43=getNewCredentialPath(_0x3dc822);if(a37_0x1c0357[_0xfe7c2b(0x1ce)](_0x582e43))try{return a37_0x1c0357[_0xfe7c2b(0x1c2)](_0x582e43,_0xfe7c2b(0x1cb));}catch{}const _0x4a714c=getOldCredentialPath(_0x3dc822);if(a37_0x1c0357['existsSync'](_0x4a714c)){console[_0xfe7c2b(0x1d7)](_0xfe7c2b(0x1cd)+_0x3dc822+'\x27'),console[_0xfe7c2b(0x1d7)]('To\x20migrate:'),console[_0xfe7c2b(0x1d7)](_0xfe7c2b(0x1d4)+_0x4a714c+_0xfe7c2b(0x1d6)+_0x582e43+'\x22'),console[_0xfe7c2b(0x1d7)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a37_0x1c0357['readFileSync'](_0x4a714c,'utf-8');}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x2849eb,_0x578026){const _0xb3baf6=a37_0x4a80,_0xba9276=_0x2849eb();while(!![]){try{const _0x273f7e=-parseInt(_0xb3baf6(0xe7))/0x1*(-parseInt(_0xb3baf6(0xad))/0x2)+-parseInt(_0xb3baf6(0xb1))/0x3+parseInt(_0xb3baf6(0xe0))/0x4+-parseInt(_0xb3baf6(0xa6))/0x5+parseInt(_0xb3baf6(0xdb))/0x6+parseInt(_0xb3baf6(0xcc))/0x7+-parseInt(_0xb3baf6(0xe6))/0x8;if(_0x273f7e===_0x578026)break;else _0xba9276['push'](_0xba9276['shift']());}catch(_0x23923f){_0xba9276['push'](_0xba9276['shift']());}}}(a37_0x389f,0x3df96));import*as a37_0x259959 from'node:fs';import*as a37_0x4ba642 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';export function getProfileParams(_0x322ec0){const _0x2c4169=a37_0x4a80,_0x170463={};if(!_0x322ec0)return _0x170463;for(const [_0x495cf1,_0x14fc31]of Object[_0x2c4169(0xdc)](_0x322ec0)){_0x495cf1!==_0x2c4169(0xde)&&_0x14fc31!==undefined&&(_0x170463[_0x495cf1]=_0x14fc31);}return _0x170463;}export function getProfilesDir(){return a37_0x4ba642['join'](getConfigDir(),'profiles');}function getProfileDir(_0x50bc2d){const _0xc792f8=a37_0x4a80;return a37_0x4ba642[_0xc792f8(0xac)](getProfilesDir(),_0x50bc2d);}function getProfileConfigPath(_0x21f780){const _0x4204c2=a37_0x4a80;return a37_0x4ba642[_0x4204c2(0xac)](getProfileDir(_0x21f780),_0x4204c2(0xc0));}function getProfileEnvPath(_0x2a87d5){const _0x57f8f8=a37_0x4a80;return a37_0x4ba642[_0x57f8f8(0xac)](getProfileDir(_0x2a87d5),_0x57f8f8(0xe9));}function getGlobalConfigPath(){const _0x152b44=a37_0x4a80;return a37_0x4ba642[_0x152b44(0xac)](getConfigDir(),_0x152b44(0xc0));}function a37_0x4a80(_0x556828,_0x499c13){const _0x389f1d=a37_0x389f();return a37_0x4a80=function(_0x4a80eb,_0x31e032){_0x4a80eb=_0x4a80eb-0xa6;let _0x597dda=_0x389f1d[_0x4a80eb];return _0x597dda;},a37_0x4a80(_0x556828,_0x499c13);}function validateProfileName(_0xce7929){const _0x275656=a37_0x4a80;if(!/^[a-zA-Z0-9_-]+$/['test'](_0xce7929))throw new Error(_0x275656(0xb9)+_0xce7929+_0x275656(0xe1));}function validateProfileConfig(_0x39bad8,_0x30d1f0){const _0xeeedce=a37_0x4a80;if(typeof _0x39bad8!==_0xeeedce(0xd8)||_0x39bad8===null)throw new Error('Profile\x20\x27'+_0x30d1f0+_0xeeedce(0xa7));const _0x3cc5c5=[_0xeeedce(0xde),'site',_0xeeedce(0xc6),_0xeeedce(0xcb),_0xeeedce(0xa9),'llm_agent'],_0x5116bf=_0x39bad8;for(const _0x4a511c of Object[_0xeeedce(0xbd)](_0x5116bf)){!_0x3cc5c5[_0xeeedce(0xb6)](_0x4a511c)&&console['warn']('Warning:\x20Profile\x20\x27'+_0x30d1f0+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x4a511c+'\x27\x20will\x20be\x20ignored');}if(_0x5116bf['description']!==undefined&&typeof _0x5116bf[_0xeeedce(0xde)]!=='string')throw new Error(_0xeeedce(0xeb)+_0x30d1f0+_0xeeedce(0xea));if(_0x5116bf[_0xeeedce(0xca)]!==undefined&&typeof _0x5116bf['site']!==_0xeeedce(0xbf))throw new Error(_0xeeedce(0xeb)+_0x30d1f0+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x5116bf[_0xeeedce(0xc6)]!==undefined&&typeof _0x5116bf[_0xeeedce(0xc6)]!==_0xeeedce(0xbf))throw new Error(_0xeeedce(0xeb)+_0x30d1f0+_0xeeedce(0xba));if(_0x5116bf[_0xeeedce(0xcb)]!==undefined&&typeof _0x5116bf['parent_segment']!==_0xeeedce(0xbf))throw new Error(_0xeeedce(0xeb)+_0x30d1f0+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x5116bf[_0xeeedce(0xa9)]!==undefined&&typeof _0x5116bf[_0xeeedce(0xa9)]!==_0xeeedce(0xbf))throw new Error(_0xeeedce(0xeb)+_0x30d1f0+_0xeeedce(0xdd));if(_0x5116bf[_0xeeedce(0xed)]!==undefined&&typeof _0x5116bf[_0xeeedce(0xed)]!==_0xeeedce(0xbf))throw new Error(_0xeeedce(0xeb)+_0x30d1f0+_0xeeedce(0xdf));return!![];}function loadProfilesFromTdxJson(_0x1876f1,_0x6d156b){const _0x4033b8=a37_0x4a80;if(!a37_0x259959[_0x4033b8(0xce)](_0x1876f1))return[];try{const _0x11a89d=a37_0x259959['readFileSync'](_0x1876f1,_0x4033b8(0xc3)),_0x37b2af=JSON['parse'](_0x11a89d);if(!_0x37b2af[_0x4033b8(0xb8)]||typeof _0x37b2af[_0x4033b8(0xb8)]!==_0x4033b8(0xd8))return[];const _0x28bb96=[];for(const [_0x2977ee,_0x3a9a5b]of Object['entries'](_0x37b2af[_0x4033b8(0xb8)])){try{validateProfileConfig(_0x3a9a5b,_0x2977ee);const _0x1d2584=getNewCredentialPath(_0x2977ee),_0x35c2e0=getOldCredentialPath(_0x2977ee),_0x2aadb8=a37_0x259959['existsSync'](_0x1d2584)||a37_0x259959['existsSync'](_0x35c2e0);_0x28bb96[_0x4033b8(0xc8)]({'name':_0x2977ee,'config':_0x3a9a5b,'metadata':{'name':_0x2977ee,'createdAt':new Date()[_0x4033b8(0xd4)]()},'hasCredentials':_0x2aadb8,'scope':_0x6d156b});}catch(_0x2feb4a){_0x2feb4a instanceof Error&&(console['warn'](_0x4033b8(0xb4)+_0x1876f1+':'),console[_0x4033b8(0xcd)]('\x20\x20'+_0x2feb4a['message']+'\x0a'));}}return _0x28bb96;}catch(_0x2ed09e){return _0x2ed09e instanceof SyntaxError?(console['warn'](_0x4033b8(0xe4)+_0x1876f1+_0x4033b8(0xc4)),console[_0x4033b8(0xcd)](_0x4033b8(0xbb)+_0x2ed09e['message']+'\x0a')):console[_0x4033b8(0xcd)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x1876f1+':\x20'+_0x2ed09e+'\x0a'),[];}}export function getNewCredentialPath(_0x310053){const _0x3799dd=a37_0x4a80;return a37_0x4ba642[_0x3799dd(0xac)](getConfigDir(),_0x3799dd(0xe3)+_0x310053);}function getOldCredentialPath(_0x2c70e8){const _0x1572fc=a37_0x4a80;return a37_0x4ba642['join'](getProfilesDir(),_0x2c70e8,_0x1572fc(0xe9));}function loadProfilesFromTdxJsonFiles(){const _0xefe1e1=a37_0x4a80,_0x372383=[],_0x5079a8=findProjectConfigPath();_0x5079a8&&_0x372383['push'](...loadProfilesFromTdxJson(_0x5079a8,_0xefe1e1(0xd6)));const _0x5718f6=a37_0x4ba642[_0xefe1e1(0xac)](getConfigDir(),_0xefe1e1(0xc0));return _0x372383[_0xefe1e1(0xc8)](...loadProfilesFromTdxJson(_0x5718f6,_0xefe1e1(0xc7))),_0x372383;}function loadProfilesFromDirectories(){const _0x957103=a37_0x4a80,_0x4efc9f=getProfilesDir();if(!a37_0x259959[_0x957103(0xce)](_0x4efc9f))return[];try{return a37_0x259959[_0x957103(0xaf)](_0x4efc9f,{'withFileTypes':!![]})[_0x957103(0xe8)](_0x21babd=>_0x21babd[_0x957103(0xcf)]())[_0x957103(0xe5)](_0x5c04b1=>_0x5c04b1[_0x957103(0xd2)])[_0x957103(0xe8)](_0xc06f5c=>{const _0x24226c=_0x957103,_0x520d68=getProfileConfigPath(_0xc06f5c),_0x366402=getProfileEnvPath(_0xc06f5c);return a37_0x259959[_0x24226c(0xce)](_0x520d68)||a37_0x259959[_0x24226c(0xce)](_0x366402);})[_0x957103(0xe5)](_0x25ed07=>{const _0x20d7d7=_0x957103,_0x144d00=loadProfileFromDirectory(_0x25ed07);if(_0x144d00)return{..._0x144d00,'scope':_0x20d7d7(0xb3)};return null;})['filter'](_0x366eb3=>_0x366eb3!==null);}catch{return[];}}function loadProfileFromDirectory(_0x28204c){const _0x563725=a37_0x4a80,_0x24dd11=getProfileConfigPath(_0x28204c),_0x26bd6a=getOldCredentialPath(_0x28204c);if(!a37_0x259959[_0x563725(0xce)](_0x24dd11)&&!a37_0x259959[_0x563725(0xce)](_0x26bd6a))return null;let _0x2d309d={},_0x52e50c={'name':_0x28204c,'createdAt':new Date()[_0x563725(0xd4)]()};if(a37_0x259959['existsSync'](_0x24dd11))try{const _0x1137f5=a37_0x259959[_0x563725(0xc5)](_0x24dd11,_0x563725(0xc3)),_0x5abd4d=JSON[_0x563725(0xda)](_0x1137f5),{metadata:_0x583027,..._0x111292}=_0x5abd4d;_0x2d309d=_0x111292,_0x583027&&(_0x52e50c=_0x583027);}catch{}return{'name':_0x28204c,'config':_0x2d309d,'metadata':_0x52e50c,'hasCredentials':a37_0x259959[_0x563725(0xce)](_0x26bd6a),'scope':_0x563725(0xb3)};}export function listProfiles(){const _0x7669d1=a37_0x4a80,_0x9f2895=loadProfilesFromTdxJsonFiles(),_0x2bc0de=loadProfilesFromDirectories();if(_0x2bc0de[_0x7669d1(0xee)]>0x0){const _0x24e16e=_0x2bc0de[_0x7669d1(0xe5)](_0x570ef1=>_0x570ef1[_0x7669d1(0xd2)])[_0x7669d1(0xac)](',\x20'),_0x241c00=getConfigDir();console[_0x7669d1(0xcd)](_0x7669d1(0xec)+_0x24e16e),console['warn'](_0x7669d1(0xbe)),console['warn'](_0x7669d1(0xd5)+a37_0x4ba642[_0x7669d1(0xac)](_0x241c00,'tdx.json')),console[_0x7669d1(0xcd)](_0x7669d1(0xd9)),console[_0x7669d1(0xcd)](_0x7669d1(0xb7));}const _0x217ee9=[..._0x9f2895,..._0x2bc0de],_0x1dd0ee=new Map();for(const _0x48c926 of _0x217ee9){!_0x1dd0ee['has'](_0x48c926['name'])&&_0x1dd0ee['set'](_0x48c926[_0x7669d1(0xd2)],_0x48c926);}return Array[_0x7669d1(0xaa)](_0x1dd0ee[_0x7669d1(0xb2)]())[_0x7669d1(0xbc)]((_0x1d4cff,_0x4e6653)=>_0x1d4cff['name'][_0x7669d1(0xef)](_0x4e6653[_0x7669d1(0xd2)]));}export function profileExists(_0x468812){const _0x2d8bd3=a37_0x4a80,_0x301e74=listProfiles();return _0x301e74[_0x2d8bd3(0xd7)](_0x6b92c8=>_0x6b92c8[_0x2d8bd3(0xd2)]===_0x468812);}export function loadProfile(_0x394239){const _0x3f1bde=a37_0x4a80;validateProfileName(_0x394239);const _0x332385=listProfiles(),_0x3873a9=_0x332385[_0x3f1bde(0xae)](_0x5db821=>_0x5db821[_0x3f1bde(0xd2)]===_0x394239);return _0x3873a9||null;}export function saveProfile(_0xe17565,_0x14b3ad,_0x48b57b=![]){saveProfileToUserConfig(_0xe17565,_0x14b3ad);}export function deleteProfile(_0x147cc6){const _0x151889=a37_0x4a80;validateProfileName(_0x147cc6);const _0x1ba63f=getProfileDir(_0x147cc6);if(!a37_0x259959[_0x151889(0xce)](_0x1ba63f))throw new Error('Profile\x20'+_0x147cc6+_0x151889(0xd3));a37_0x259959[_0x151889(0xd0)](_0x1ba63f,{'recursive':!![],'force':!![]});}function a37_0x389f(){const _0x33684b=['To\x20migrate:','name','\x20does\x20not\x20exist','toISOString','\x20\x201.\x20Edit:\x20','local','some','object','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','parse','2261442mfhZak','entries','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','description','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','1236948VKGXKH','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','\x20already\x20exists','.env.','\x0aWarning:\x20Failed\x20to\x20parse\x20','map','4626016yOBTXn','34FAwRHH','filter','.env','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','Profile\x20\x27','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','llm_agent','length','localeCompare','1806940Lxpwwu','\x27:\x20config\x20must\x20be\x20an\x20object','profile','llm_project','from',',\x20creating\x20new\x20file','join','27356aIaatv','find','readdirSync','stringify','292875qcIhFf','values','directory','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','includes','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','profiles','Invalid\x20profile\x20name:\x20','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','Error:\x20','sort','keys','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','string','tdx.json','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x22\x20\x22','utf-8',':\x20Invalid\x20JSON\x20syntax','readFileSync','database','user','push','Profile\x20','site','parent_segment','979405MGKaHV','warn','existsSync','isDirectory','rmSync'];a37_0x389f=function(){return _0x33684b;};return a37_0x389f();}export function saveProfileToUserConfig(_0x9fca69,_0x2a53e3){const _0x3d7fec=a37_0x4a80;validateProfileName(_0x9fca69);const _0x3830a7=getGlobalConfigPath(),_0x4e1ba7=getConfigDir();!a37_0x259959[_0x3d7fec(0xce)](_0x4e1ba7)&&createSecureDirectory(_0x4e1ba7);let _0x6aa368={};if(a37_0x259959[_0x3d7fec(0xce)](_0x3830a7))try{const _0x2860f7=a37_0x259959['readFileSync'](_0x3830a7,_0x3d7fec(0xc3));_0x6aa368=JSON[_0x3d7fec(0xda)](_0x2860f7);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x3830a7+_0x3d7fec(0xab));}!_0x6aa368[_0x3d7fec(0xb8)]&&(_0x6aa368[_0x3d7fec(0xb8)]={}),_0x6aa368[_0x3d7fec(0xb8)][_0x9fca69]=_0x2a53e3,writeSecureFile(_0x3830a7,JSON[_0x3d7fec(0xb0)](_0x6aa368,null,0x2));}export function getActiveProfile(){const _0x251dd0=a37_0x4a80,_0x9abd35=getGlobalConfigPath();if(!a37_0x259959['existsSync'](_0x9abd35))return null;try{const _0x327e69=a37_0x259959[_0x251dd0(0xc5)](_0x9abd35,_0x251dd0(0xc3)),_0x39ac47=JSON[_0x251dd0(0xda)](_0x327e69);return _0x39ac47[_0x251dd0(0xa8)]||null;}catch{return null;}}export function createProfile(_0x3c0f1a,_0x1f0d38){const _0x41cb35=a37_0x4a80;validateProfileName(_0x3c0f1a);if(profileExists(_0x3c0f1a))throw new Error(_0x41cb35(0xc9)+_0x3c0f1a+_0x41cb35(0xe2));saveProfile(_0x3c0f1a,_0x1f0d38);}export function saveProfileCredentials(_0x1e29f9,_0x5e887a){const _0x2a16fe=a37_0x4a80;validateProfileName(_0x1e29f9);if(!profileExists(_0x1e29f9))throw new Error(_0x2a16fe(0xc9)+_0x1e29f9+'\x20does\x20not\x20exist');const _0x45e39a=getNewCredentialPath(_0x1e29f9);writeSecureFile(_0x45e39a,_0x5e887a);}export function loadProfileCredentials(_0x2b0ed3){const _0x432e7c=a37_0x4a80;validateProfileName(_0x2b0ed3);const _0x230f45=getNewCredentialPath(_0x2b0ed3);if(a37_0x259959[_0x432e7c(0xce)](_0x230f45))try{return a37_0x259959[_0x432e7c(0xc5)](_0x230f45,_0x432e7c(0xc3));}catch{}const _0x3d1b59=getOldCredentialPath(_0x2b0ed3);if(a37_0x259959['existsSync'](_0x3d1b59)){console[_0x432e7c(0xcd)](_0x432e7c(0xb5)+_0x2b0ed3+'\x27'),console[_0x432e7c(0xcd)](_0x432e7c(0xd1)),console['warn']('\x20\x20mv\x20\x22'+_0x3d1b59+_0x432e7c(0xc2)+_0x230f45+'\x22'),console['warn'](_0x432e7c(0xc1));try{return a37_0x259959[_0x432e7c(0xc5)](_0x3d1b59,_0x432e7c(0xc3));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a38_0x5dc2(){const _0x28847b=['apiKey','14882870RGFLkY','existsSync','1355247AlGFjF','\x20is\x20ignored.\x20','1064968BEsFbZ','api_key','TD_API_KEY','cwd','stringify','36TayjHh','readFileSync','includes','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','3533726yhwLZw','writeFileSync','1102565XjRbvp','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','30124uAhjYo','Warning:\x20\x27profile\x27\x20field\x20in\x20','2CiJgmj','Failed\x20to\x20load\x20project\x20config\x20from\x20','dirname','code','utf-8','tdx.json','parse','3224898xJtpch','4rWgSdX','profile'];a38_0x5dc2=function(){return _0x28847b;};return a38_0x5dc2();}function a38_0x21f4(_0x4a31da,_0x20cfd0){const _0x5dc29f=a38_0x5dc2();return a38_0x21f4=function(_0x21f436,_0x5e4b59){_0x21f436=_0x21f436-0xf8;let _0x5c7142=_0x5dc29f[_0x21f436];return _0x5c7142;},a38_0x21f4(_0x4a31da,_0x20cfd0);}const a38_0x3ad30e=a38_0x21f4;(function(_0x4b268f,_0x43c4bd){const _0x3c943c=a38_0x21f4,_0x5b0c42=_0x4b268f();while(!![]){try{const _0x54f63b=-parseInt(_0x3c943c(0xf8))/0x1*(-parseInt(_0x3c943c(0x115))/0x2)+-parseInt(_0x3c943c(0x105))/0x3+parseInt(_0x3c943c(0x100))/0x4*(-parseInt(_0x3c943c(0x113))/0x5)+parseInt(_0x3c943c(0xff))/0x6+-parseInt(_0x3c943c(0x111))/0x7+parseInt(_0x3c943c(0x107))/0x8*(-parseInt(_0x3c943c(0x10c))/0x9)+parseInt(_0x3c943c(0x103))/0xa;if(_0x54f63b===_0x43c4bd)break;else _0x5b0c42['push'](_0x5b0c42['shift']());}catch(_0x156c6a){_0x5b0c42['push'](_0x5b0c42['shift']());}}}(a38_0x5dc2,0x548da));import*as a38_0x14e3ca from'node:fs';import*as a38_0xdebddb from'node:path';const PROJECT_CONFIG_FILENAME=a38_0x3ad30e(0xfd);export function findProjectConfigPath(_0x59d5be){const _0x4cf009=a38_0x3ad30e;let _0x2b69fc=_0x59d5be||process['cwd']();while(!![]){const _0x4a12aa=a38_0xdebddb['join'](_0x2b69fc,PROJECT_CONFIG_FILENAME);if(a38_0x14e3ca[_0x4cf009(0x104)](_0x4a12aa))return _0x4a12aa;const _0x40e947=a38_0xdebddb[_0x4cf009(0xfa)](_0x2b69fc);if(_0x40e947===_0x2b69fc)return null;_0x2b69fc=_0x40e947;}}export function loadProjectConfig(_0xe90b94){const _0x4597d7=a38_0x3ad30e,_0x5d1cad=findProjectConfigPath(_0xe90b94);if(!_0x5d1cad)return null;try{const _0x1ce928=a38_0x14e3ca[_0x4597d7(0x10d)](_0x5d1cad,_0x4597d7(0xfc)),_0x2fec47=JSON[_0x4597d7(0xfe)](_0x1ce928),_0x187dbe=JSON['stringify'](_0x2fec47);if(_0x187dbe['includes'](_0x4597d7(0x109))||_0x187dbe['includes']('apiKey')||_0x187dbe[_0x4597d7(0x10e)](_0x4597d7(0x108)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x5d1cad+').\x20'+_0x4597d7(0x110));const {metadata:_0x141072,profile:_0x517c85,..._0x1b0f53}=_0x2fec47;return _0x517c85&&console['warn'](_0x4597d7(0x116)+_0x5d1cad+_0x4597d7(0x106)+_0x4597d7(0x114)),_0x1b0f53;}catch(_0x2817f3){if(_0x2817f3 instanceof Error&&_0x4597d7(0xfb)in _0x2817f3&&_0x2817f3[_0x4597d7(0xfb)]==='ENOENT')return null;throw new Error(_0x4597d7(0xf9)+_0x5d1cad+':\x20'+_0x2817f3);}}export function saveProjectConfig(_0x264d71,_0x30f55b){const _0x37c514=a38_0x3ad30e,_0x370540=_0x30f55b||process[_0x37c514(0x10a)](),_0x567615=a38_0xdebddb['join'](_0x370540,PROJECT_CONFIG_FILENAME),_0x5bbc53=JSON[_0x37c514(0x10b)](_0x264d71);if(_0x5bbc53['includes'](_0x37c514(0x109))||_0x5bbc53['includes'](_0x37c514(0x102))||_0x5bbc53[_0x37c514(0x10e)]('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x37c514(0x101)in _0x264d71)throw new Error(_0x37c514(0x10f));a38_0x14e3ca[_0x37c514(0x112)](_0x567615,JSON[_0x37c514(0x10b)](_0x264d71,null,0x2));}export function hasProjectConfig(_0x33486e){return findProjectConfigPath(_0x33486e)!==null;}export function getProjectRoot(_0x51c3ea){const _0x3f7bf6=findProjectConfigPath(_0x51c3ea);return _0x3f7bf6?a38_0xdebddb['dirname'](_0x3f7bf6):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x54524c,_0xbff8b4){const _0x710d17=a39_0x5627,_0x5e4f1b=_0x54524c();while(!![]){try{const _0x1c4765=-parseInt(_0x710d17(0x1ec))/0x1*(parseInt(_0x710d17(0x1e2))/0x2)+-parseInt(_0x710d17(0x1eb))/0x3*(-parseInt(_0x710d17(0x1d9))/0x4)+parseInt(_0x710d17(0x1ea))/0x5*(-parseInt(_0x710d17(0x1d7))/0x6)+parseInt(_0x710d17(0x1db))/0x7+-parseInt(_0x710d17(0x1d4))/0x8+-parseInt(_0x710d17(0x1f3))/0x9+parseInt(_0x710d17(0x1e6))/0xa;if(_0x1c4765===_0xbff8b4)break;else _0x5e4f1b['push'](_0x5e4f1b['shift']());}catch(_0x3fcba2){_0x5e4f1b['push'](_0x5e4f1b['shift']());}}}(a39_0x1b50,0xa0f3a));function a39_0x1b50(){const _0x131226=['3274YMIEcL','join','apiKey','readdirSync','15668170xqLhhW','replace','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','5vfMHTW','18GToaxd','220SeYjbR','getTime','tdx','parse','homedir','existsSync','test','8099172ruwluQ','warn','now','toISOString','includes','unlinkSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','TD_API_KEY','1686328aUIWZK','stringify','createdAt','3195114SpOjvD','env','443716fJdpto','.json','3011575hhyaPb','writeFileSync','push','endsWith','utf-8','toString','TDX_CONFIG_DIR'];a39_0x1b50=function(){return _0x131226;};return a39_0x1b50();}import*as a39_0x4dddfc from'node:fs';function a39_0x5627(_0x21fa51,_0x4058e3){const _0x1b50cb=a39_0x1b50();return a39_0x5627=function(_0x5627a3,_0x111685){_0x5627a3=_0x5627a3-0x1cd;let _0x530e4b=_0x1b50cb[_0x5627a3];return _0x530e4b;},a39_0x5627(_0x21fa51,_0x4058e3);}import*as a39_0x4d74ef from'node:path';import*as a39_0x3208c7 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 _0x254be5=a39_0x5627,_0x5e8424=process[_0x254be5(0x1d8)][_0x254be5(0x1e1)]||a39_0x4d74ef['join'](a39_0x3208c7[_0x254be5(0x1f0)](),'.config',_0x254be5(0x1ee));return a39_0x4d74ef[_0x254be5(0x1e3)](_0x5e8424,'sessions');}function getSessionPath(_0x4a17df){const _0x27c71c=a39_0x5627;return a39_0x4d74ef['join'](getSessionsDir(),_0x4a17df+_0x27c71c(0x1da));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x29296c){const _0x4a9b87=a39_0x5627;if(_0x29296c)return _0x29296c;return getCurrentSessionPID()[_0x4a9b87(0x1e0)]();}export function loadSessionContext(_0x5b057c){const _0x237cda=a39_0x5627,_0x4fbfd0=_0x5b057c||getCurrentSessionPID()['toString'](),_0x282cba=/^\d+$/[_0x237cda(0x1f2)](_0x4fbfd0)?parseInt(_0x4fbfd0,0xa):null;return _0x282cba!==null?loadSessionContextByPID(_0x282cba):loadSessionContextByString(_0x4fbfd0);}export function loadSessionContextByPID(_0x24395c){const _0x18cf43=a39_0x5627,_0xc7f045=getSessionPath(_0x24395c);if(!a39_0x4dddfc['existsSync'](_0xc7f045))return null;try{const _0x3e7cde=a39_0x4dddfc['readFileSync'](_0xc7f045,_0x18cf43(0x1df)),_0x448496=JSON['parse'](_0x3e7cde),_0x3d0922=new Date(_0x448496[_0x18cf43(0x1d6)])[_0x18cf43(0x1ed)](),_0x2c2df0=Date[_0x18cf43(0x1ce)]();if(_0x2c2df0-_0x3d0922>SESSION_EXPIRATION_MS)return a39_0x4dddfc[_0x18cf43(0x1d1)](_0xc7f045),null;const _0x5cbde1=JSON[_0x18cf43(0x1d5)](_0x448496);if(_0x5cbde1[_0x18cf43(0x1d0)](_0x18cf43(0x1d3))||_0x5cbde1[_0x18cf43(0x1d0)](_0x18cf43(0x1e4))||_0x5cbde1[_0x18cf43(0x1d0)]('api_key'))return console[_0x18cf43(0x1cd)](_0x18cf43(0x1e8)+_0xc7f045+_0x18cf43(0x1d2)),a39_0x4dddfc['unlinkSync'](_0xc7f045),null;return _0x448496;}catch{try{a39_0x4dddfc[_0x18cf43(0x1d1)](_0xc7f045);}catch{}return null;}}function loadSessionContextByString(_0x48331f){const _0x56ca7c=a39_0x5627,_0x527bc4=a39_0x4d74ef[_0x56ca7c(0x1e3)](getSessionsDir(),_0x48331f+_0x56ca7c(0x1da));if(!a39_0x4dddfc[_0x56ca7c(0x1f1)](_0x527bc4))return null;try{const _0x19d28a=a39_0x4dddfc['readFileSync'](_0x527bc4,_0x56ca7c(0x1df)),_0x527aef=JSON['parse'](_0x19d28a),_0x17ba00=new Date(_0x527aef[_0x56ca7c(0x1d6)])[_0x56ca7c(0x1ed)](),_0x352777=Date[_0x56ca7c(0x1ce)]();if(_0x352777-_0x17ba00>SESSION_EXPIRATION_MS)return a39_0x4dddfc[_0x56ca7c(0x1d1)](_0x527bc4),null;const _0x5eae16=JSON[_0x56ca7c(0x1d5)](_0x527aef);if(_0x5eae16[_0x56ca7c(0x1d0)](_0x56ca7c(0x1d3))||_0x5eae16[_0x56ca7c(0x1d0)]('apiKey')||_0x5eae16[_0x56ca7c(0x1d0)]('api_key'))return console[_0x56ca7c(0x1cd)](_0x56ca7c(0x1e8)+_0x527bc4+_0x56ca7c(0x1d2)),a39_0x4dddfc[_0x56ca7c(0x1d1)](_0x527bc4),null;return _0x527aef;}catch{try{a39_0x4dddfc[_0x56ca7c(0x1d1)](_0x527bc4);}catch{}return null;}}export function saveSessionContext(_0x18d225,_0x266fcb){const _0x3ef120=a39_0x5627,_0x447c69=_0x266fcb||getCurrentSessionPID()[_0x3ef120(0x1e0)](),_0x52f093=/^\d+$/['test'](_0x447c69)?parseInt(_0x447c69,0xa):getCurrentSessionPID(),_0x27c318=a39_0x4d74ef[_0x3ef120(0x1e3)](getSessionsDir(),_0x447c69+_0x3ef120(0x1da)),_0x3ed021=getSessionsDir();createSecureDirectory(_0x3ed021);const _0x59c711=JSON['stringify'](_0x18d225);if(_0x59c711[_0x3ef120(0x1d0)](_0x3ef120(0x1d3))||_0x59c711[_0x3ef120(0x1d0)](_0x3ef120(0x1e4))||_0x59c711[_0x3ef120(0x1d0)]('api_key'))throw new Error(_0x3ef120(0x1e9));let _0x5446d8;const _0x294943=/^\d+$/[_0x3ef120(0x1f2)](_0x447c69)?loadSessionContextByPID(parseInt(_0x447c69,0xa)):loadSessionContextByString(_0x447c69);_0x294943?_0x5446d8={..._0x294943,..._0x18d225,'pid':_0x52f093,'sessionId':_0x447c69!==_0x52f093['toString']()?_0x447c69:undefined,'updatedAt':new Date()['toISOString']()}:_0x5446d8={'pid':_0x52f093,'sessionId':_0x447c69!==_0x52f093[_0x3ef120(0x1e0)]()?_0x447c69:undefined,..._0x18d225,'createdAt':new Date()[_0x3ef120(0x1cf)](),'updatedAt':new Date()[_0x3ef120(0x1cf)]()},a39_0x4dddfc[_0x3ef120(0x1dc)](_0x27c318,JSON[_0x3ef120(0x1d5)](_0x5446d8,null,0x2));}export function clearSessionContext(_0x403f3b){const _0x4c5521=a39_0x5627,_0x530734=_0x403f3b||getCurrentSessionPID()[_0x4c5521(0x1e0)](),_0x171e38=a39_0x4d74ef[_0x4c5521(0x1e3)](getSessionsDir(),_0x530734+_0x4c5521(0x1da));a39_0x4dddfc[_0x4c5521(0x1f1)](_0x171e38)&&a39_0x4dddfc[_0x4c5521(0x1d1)](_0x171e38);}export function cleanExpiredSessions(){const _0x401f6b=a39_0x5627,_0x4a3a19=getSessionsDir();if(!a39_0x4dddfc[_0x401f6b(0x1f1)](_0x4a3a19))return 0x0;let _0x367243=0x0;const _0x52c1fe=Date[_0x401f6b(0x1ce)]();try{const _0x5b4b94=a39_0x4dddfc[_0x401f6b(0x1e5)](_0x4a3a19);for(const _0x29c40a of _0x5b4b94){if(!_0x29c40a[_0x401f6b(0x1de)](_0x401f6b(0x1da)))continue;const _0x41da2d=a39_0x4d74ef[_0x401f6b(0x1e3)](_0x4a3a19,_0x29c40a),_0x1691f0=_0x29c40a[_0x401f6b(0x1e7)](_0x401f6b(0x1da),''),_0x442e7f=parseInt(_0x1691f0,0xa),_0x4d3c90=!isNaN(_0x442e7f);if(_0x4d3c90){if(!isProcessRunning(_0x442e7f)){a39_0x4dddfc['unlinkSync'](_0x41da2d),_0x367243++;continue;}}try{const _0x43b3f1=a39_0x4dddfc['readFileSync'](_0x41da2d,_0x401f6b(0x1df)),_0x4babc6=JSON[_0x401f6b(0x1ef)](_0x43b3f1),_0x1783f7=new Date(_0x4babc6[_0x401f6b(0x1d6)])[_0x401f6b(0x1ed)]();_0x52c1fe-_0x1783f7>SESSION_EXPIRATION_MS&&(a39_0x4dddfc[_0x401f6b(0x1d1)](_0x41da2d),_0x367243++);}catch{a39_0x4dddfc[_0x401f6b(0x1d1)](_0x41da2d),_0x367243++;}}}catch{}return _0x367243;}export function listActiveSessions(){const _0x3e5bfe=a39_0x5627,_0x86da27=getSessionsDir();if(!a39_0x4dddfc[_0x3e5bfe(0x1f1)](_0x86da27))return[];try{const _0x16b353=a39_0x4dddfc[_0x3e5bfe(0x1e5)](_0x86da27),_0x54ae93=[];for(const _0x1870a5 of _0x16b353){if(!_0x1870a5[_0x3e5bfe(0x1de)](_0x3e5bfe(0x1da)))continue;const _0x5128a5=_0x1870a5[_0x3e5bfe(0x1e7)](_0x3e5bfe(0x1da),''),_0x100349=parseInt(_0x5128a5,0xa);!isNaN(_0x100349)&&isProcessRunning(_0x100349)&&_0x54ae93[_0x3e5bfe(0x1dd)](_0x100349);}return _0x54ae93['sort']((_0x55668a,_0x44a99d)=>_0x55668a-_0x44a99d);}catch{return[];}}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xdd88ba,_0x226c4f){var _0x14ceaf=a40_0x4c34,_0xaaf0fa=_0xdd88ba();while(!![]){try{var _0x39fca7=-parseInt(_0x14ceaf(0x1f3))/0x1*(-parseInt(_0x14ceaf(0x1f4))/0x2)+-parseInt(_0x14ceaf(0x1f0))/0x3+-parseInt(_0x14ceaf(0x1f7))/0x4+-parseInt(_0x14ceaf(0x1f5))/0x5*(parseInt(_0x14ceaf(0x1f8))/0x6)+-parseInt(_0x14ceaf(0x1f6))/0x7*(parseInt(_0x14ceaf(0x1f9))/0x8)+-parseInt(_0x14ceaf(0x1ef))/0x9*(parseInt(_0x14ceaf(0x1f2))/0xa)+parseInt(_0x14ceaf(0x1f1))/0xb;if(_0x39fca7===_0x226c4f)break;else _0xaaf0fa['push'](_0xaaf0fa['shift']());}catch(_0x187604){_0xaaf0fa['push'](_0xaaf0fa['shift']());}}}(a40_0x5f5a,0xd5cb6));export*from'./types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./client/http-client.js';function a40_0x5f5a(){var _0x5042df=['38iBlAeG','35hBOSWG','7pBscTJ','6934856RmfiLy','599790ATijLV','7837224PWgDlu','99XvtpKi','3504018oSJsqH','56423114hfGXAV','1190030ZwXVVB','86131Rczoxs'];a40_0x5f5a=function(){return _0x5042df;};return a40_0x5f5a();}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';function a40_0x4c34(_0x58b6c9,_0x364dbe){var _0x5f5a60=a40_0x5f5a();return a40_0x4c34=function(_0x4c341b,_0x59914f){_0x4c341b=_0x4c341b-0x1ef;var _0x204b9b=_0x5f5a60[_0x4c341b];return _0x204b9b;},a40_0x4c34(_0x58b6c9,_0x364dbe);}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';
|