@treasuredata/tdx 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.d.ts.map +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/connection-command.js.map +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.d.ts.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-command.js.map +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-pull-command.d.ts +6 -0
- package/dist/commands/segment-pull-command.d.ts.map +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-pull-command.js.map +1 -1
- package/dist/commands/segment-push-command.d.ts.map +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-push-command.js.map +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/user-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/connection-cache.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.d.ts +113 -1
- package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/cdp.d.ts +2 -1
- package/dist/types/cdp.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-config.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/journey-utils.d.ts.map +1 -1
- package/dist/utils/journey-utils.js +1 -1
- package/dist/utils/journey-utils.js.map +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a42_0x3f9f(){const _0x1a3ac7=['60807tqJLQl','llm_agent','128VZKpiM','Session\x20agent\x20set\x20to:\x20','148ApgsjB','\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace\x0a','Session\x20engage_workspace\x20set\x20to:\x20','5752UxoQHp','Session\x20database\x20set\x20to:\x20','use','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','parent_segment','Error:\x20Profile\x20\x27','7125700CQZlng','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','toString','includes','(session:\x20','display','name','2659240oopEfX','execute','displayWithSources','join','message','dim','Session\x20llm_project\x20set\x20to:\x20','11835YFwtiP','6wqWFiV','llm_project','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20current\x20context\x0a','debug','Session\x20parent_segment\x20set\x20to:\x20','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace','validate','cleared','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','\x27\x20does\x20not\x20exist','engage_workspace','Session\x20profile\x20set\x20to:\x20','length','15358nGsgoq','profile','18573467Udmojb','session','1714419wXZEVX','green','12QYTKQz','Invalid\x20resource:\x20','database','.\x20Must\x20be\x20one\x20of:\x20','error','log'];a42_0x3f9f=function(){return _0x1a3ac7;};return a42_0x3f9f();}const a42_0x3fd59e=a42_0xe761;(function(_0x545040,_0x58dd40){const _0x1e1483=a42_0xe761,_0x3ada3f=_0x545040();while(!![]){try{const _0x4b8e6b=parseInt(_0x1e1483(0x1cc))/0x1*(parseInt(_0x1e1483(0x1a5))/0x2)+-parseInt(_0x1e1483(0x1a3))/0x3*(-parseInt(_0x1e1483(0x1a7))/0x4)+-parseInt(_0x1e1483(0x1b7))/0x5*(-parseInt(_0x1e1483(0x1bf))/0x6)+-parseInt(_0x1e1483(0x1d0))/0x7+parseInt(_0x1e1483(0x1aa))/0x8*(parseInt(_0x1e1483(0x1be))/0x9)+-parseInt(_0x1e1483(0x1b0))/0xa+-parseInt(_0x1e1483(0x1ce))/0xb*(parseInt(_0x1e1483(0x19d))/0xc);if(_0x4b8e6b===_0x58dd40)break;else _0x3ada3f['push'](_0x3ada3f['shift']());}catch(_0x36e84e){_0x3ada3f['push'](_0x3ada3f['shift']());}}}(a42_0x3f9f,0x89bf6));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import a42_0x3127bd from'chalk';function a42_0xe761(_0x3d77d8,_0x4004ad){_0x3d77d8=_0x3d77d8-0x19c;const _0x3f9f96=a42_0x3f9f();let _0xe761a1=_0x3f9f96[_0x3d77d8];return _0xe761a1;}export class UseCommand extends BaseCommand{[a42_0x3fd59e(0x1b6)]=a42_0x3fd59e(0x1ac);['description']='Set\x20session-level\x20context';[a42_0x3fd59e(0x1c5)](_0x20fba1){const _0x442e43=a42_0x3fd59e,{args:_0x5e6be6}=_0x20fba1;if(_0x5e6be6[_0x442e43(0x1cb)]===0x0)return undefined;if(_0x5e6be6[_0x442e43(0x1cb)]===0x1)return _0x442e43(0x1b1)+_0x442e43(0x1c1)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a'+_0x442e43(0x1a8)+_0x442e43(0x1c7);const _0x432e85=_0x5e6be6[0x0],_0x2397f4=['database',_0x442e43(0x1ae),'llm_project','agent',_0x442e43(0x1cd),_0x442e43(0x1c9)];if(!_0x2397f4[_0x442e43(0x1b3)](_0x432e85))return _0x442e43(0x19e)+_0x432e85+_0x442e43(0x1a0)+_0x2397f4[_0x442e43(0x1ba)](',\x20');return undefined;}async[a42_0x3fd59e(0x1b8)](_0x4063bc){const _0x3a7253=a42_0x3fd59e,{args:_0x5a54bb,options:_0xe7ca36}=_0x4063bc,_0x9fc924=_0xe7ca36[_0x3a7253(0x1c2)],_0x1b821c=_0xe7ca36['clear'];cleanExpiredSessions();try{if(_0x1b821c){clearSessionContext(_0xe7ca36[_0x3a7253(0x1cf)]);const _0x3b3403=_0xe7ca36[_0x3a7253(0x1cf)]||getCurrentSessionPID()[_0x3a7253(0x1b2)]();return console['log']('Session\x20context\x20'+a42_0x3127bd[_0x3a7253(0x19c)](_0x3a7253(0x1c6))+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x3b3403+')')),0x0;}if(_0x5a54bb[_0x3a7253(0x1cb)]===0x0){const _0x1eff2a=new GlobalContext(_0xe7ca36);return _0x9fc924?_0x1eff2a[_0x3a7253(0x1b9)]():_0x1eff2a[_0x3a7253(0x1b5)](),console[_0x3a7253(0x1a2)](a42_0x3127bd[_0x3a7253(0x1bc)]('\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>')),console[_0x3a7253(0x1a2)](a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1c4))),0x0;}const _0x157499=_0x5a54bb[0x0],_0x583e8d=_0x5a54bb[0x1];if(_0x157499===_0x3a7253(0x1cd)){if(!profileExists(_0x583e8d))return console['error'](_0x3a7253(0x1af)+_0x583e8d+_0x3a7253(0x1c8)),console['error']('\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles'),0x1;const _0x5c6b3b=_0xe7ca36['session']||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x583e8d},_0xe7ca36['session']),console[_0x3a7253(0x1a2)](_0x3a7253(0x1ca)+a42_0x3127bd[_0x3a7253(0x19c)](_0x583e8d)+'\x20'+a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1b4)+_0x5c6b3b+')')),console[_0x3a7253(0x1a2)](a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1ad))),0x0;}const _0x6217e0={},_0x58505f=_0xe7ca36['session']||getCurrentSessionPID()[_0x3a7253(0x1b2)]();switch(_0x157499){case _0x3a7253(0x19f):_0x6217e0[_0x3a7253(0x19f)]=_0x583e8d,console[_0x3a7253(0x1a2)](_0x3a7253(0x1ab)+a42_0x3127bd[_0x3a7253(0x19c)](_0x583e8d)+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x58505f+')'));break;case _0x3a7253(0x1ae):_0x6217e0['parent_segment']=_0x583e8d,console[_0x3a7253(0x1a2)](_0x3a7253(0x1c3)+a42_0x3127bd[_0x3a7253(0x19c)](_0x583e8d)+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x58505f+')'));break;case'llm_project':_0x6217e0['llm_project']=_0x583e8d,console['log'](_0x3a7253(0x1bd)+a42_0x3127bd['green'](_0x583e8d)+'\x20'+a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1b4)+_0x58505f+')'));break;case'agent':{const {projectName:_0x581b91,agentName:_0x2182ab}=parseAgentRef(_0x583e8d);_0x2182ab?(_0x6217e0[_0x3a7253(0x1c0)]=_0x581b91,_0x6217e0[_0x3a7253(0x1a4)]=_0x2182ab,console['log']('Session\x20llm_project\x20set\x20to:\x20'+a42_0x3127bd[_0x3a7253(0x19c)](_0x581b91)+'\x20'+a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1b4)+_0x58505f+')')),console[_0x3a7253(0x1a2)]('Session\x20agent\x20set\x20to:\x20'+a42_0x3127bd['green'](_0x2182ab)+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x58505f+')'))):(_0x6217e0[_0x3a7253(0x1a4)]=_0x583e8d,console['log'](_0x3a7253(0x1a6)+a42_0x3127bd['green'](_0x583e8d)+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x58505f+')')));break;}case'engage_workspace':_0x6217e0[_0x3a7253(0x1c9)]=_0x583e8d,console[_0x3a7253(0x1a2)](_0x3a7253(0x1a9)+a42_0x3127bd[_0x3a7253(0x19c)](_0x583e8d)+'\x20'+a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1b4)+_0x58505f+')'));break;}return saveSessionContext(_0x6217e0,_0xe7ca36['session']),console['log'](a42_0x3127bd[_0x3a7253(0x1bc)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides')),0x0;}catch(_0x300f1f){return _0x300f1f instanceof Error&&console[_0x3a7253(0x1a1)]('Error:\x20'+_0x300f1f[_0x3a7253(0x1bb)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a43_0x249d60=a43_0x3645;(function(_0x4e52e3,_0x46f969){const _0x3faedc=a43_0x3645,_0x99d13a=_0x4e52e3();while(!![]){try{const _0x49366e=-parseInt(_0x3faedc(0x158))/0x1+-parseInt(_0x3faedc(0x153))/0x2+-parseInt(_0x3faedc(0x152))/0x3+-parseInt(_0x3faedc(0x151))/0x4*(-parseInt(_0x3faedc(0x15c))/0x5)+-parseInt(_0x3faedc(0x149))/0x6+parseInt(_0x3faedc(0x14d))/0x7+parseInt(_0x3faedc(0x15d))/0x8*(parseInt(_0x3faedc(0x14a))/0x9);if(_0x49366e===_0x46f969)break;else _0x99d13a['push'](_0x99d13a['shift']());}catch(_0x48985f){_0x99d13a['push'](_0x99d13a['shift']());}}}(a43_0x45b0,0x2d996));function a43_0x3645(_0xb0f238,_0x378d78){_0xb0f238=_0xb0f238-0x148;const _0x45b0ae=a43_0x45b0();let _0x364515=_0x45b0ae[_0xb0f238];return _0x364515;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{[a43_0x249d60(0x14e)]=a43_0x249d60(0x163);['description']=a43_0x249d60(0x14c);async[a43_0x249d60(0x156)](_0x26d44c){const _0x3d7157=a43_0x249d60,{options:_0x3fc8f2,tdx:_0x2ecd94}=_0x26d44c;try{const _0x3f2592=await withSpinner(_0x3d7157(0x150),()=>_0x2ecd94[_0x3d7157(0x163)]['getCurrent'](),{'verbose':_0x3fc8f2[_0x3d7157(0x155)]}),_0x461561=_0x3f2592[_0x3d7157(0x154)];return await handleSingleObjectOutput(_0x461561,_0x3fc8f2),0x0;}catch(_0x59be69){if(_0x59be69 instanceof SDKError)return console[_0x3d7157(0x15a)](_0x3d7157(0x161)+_0x59be69[_0x3d7157(0x157)]),_0x59be69[_0x3d7157(0x160)]&&console[_0x3d7157(0x15a)]('\x20\x20Cause:\x20'+_0x59be69['cause']),0x1;throw _0x59be69;}}}function a43_0x45b0(){const _0x3e73fb=['407912ympCUD','data','verbose','execute','message','150365cmtzTi','List\x20all\x20users\x20in\x20the\x20account','error','description','351635pPKvKi','5721456ztlWjn','user\x20list','length','cause','Error:\x20','list','user','Listing\x20users...','2212932nhfDzf','9VbyaEJ','\x20user','Show\x20current\x20user\x20information','1261498eUMrWl','name','✔\x20Found\x20','Fetching\x20user\x20info...','12wYRESe','589380EmLmkH'];a43_0x45b0=function(){return _0x3e73fb;};return a43_0x45b0();}export class UserListCommand extends BaseCommand{[a43_0x249d60(0x14e)]=a43_0x249d60(0x15e);[a43_0x249d60(0x15b)]=a43_0x249d60(0x159);async[a43_0x249d60(0x156)](_0x13eff4){const _0x320f44=a43_0x249d60,{options:_0x23cb98,tdx:_0x562ed9}=_0x13eff4;try{const _0x1f2a75=await withSpinner(_0x320f44(0x148),()=>_0x562ed9[_0x320f44(0x163)][_0x320f44(0x162)](),{'verbose':_0x23cb98[_0x320f44(0x155)]}),_0x20a0c4=_0x1f2a75['data'];return console['error'](_0x320f44(0x14f)+_0x20a0c4[_0x320f44(0x15f)]+_0x320f44(0x14b)+(_0x20a0c4[_0x320f44(0x15f)]!==0x1?'s':'')),await handleSDKOutput(_0x20a0c4,_0x23cb98),0x0;}catch(_0x25ee31){if(_0x25ee31 instanceof SDKError)return console['error']('Error:\x20'+_0x25ee31['message']),_0x25ee31['cause']&&console[_0x320f44(0x15a)]('\x20\x20Cause:\x20'+_0x25ee31[_0x320f44(0x160)]),0x1;throw _0x25ee31;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a44_0x322c85=a44_0x3098;(function(_0x556959,_0xadb28d){const _0x4a74a0=a44_0x3098,_0x56f2d1=_0x556959();while(!![]){try{const _0x1f4704=-parseInt(_0x4a74a0(0x9a))/0x1*(-parseInt(_0x4a74a0(0xaf))/0x2)+-parseInt(_0x4a74a0(0xf4))/0x3+-parseInt(_0x4a74a0(0xfe))/0x4+parseInt(_0x4a74a0(0x125))/0x5*(-parseInt(_0x4a74a0(0x9e))/0x6)+parseInt(_0x4a74a0(0xbf))/0x7+-parseInt(_0x4a74a0(0x12c))/0x8*(-parseInt(_0x4a74a0(0xdb))/0x9)+parseInt(_0x4a74a0(0xc5))/0xa;if(_0x1f4704===_0xadb28d)break;else _0x56f2d1['push'](_0x56f2d1['shift']());}catch(_0x20fe76){_0x56f2d1['push'](_0x56f2d1['shift']());}}}(a44_0x20af,0x2b536));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a44_0x526862 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xe3);[a44_0x322c85(0xe7)]=a44_0x322c85(0x95);async[a44_0x322c85(0x11d)](_0x101ddf){const _0x461ffb=a44_0x322c85,{options:_0x325c77,args:_0x24a728,tdx:_0x1f7e47}=_0x101ddf,_0x27eab3=_0x24a728[0x0];try{_0x325c77[_0x461ffb(0x118)]&&_0x27eab3&&console['error'](_0x461ffb(0xdd)+_0x27eab3);const _0x357447=await withSpinner(_0x461ffb(0x131),()=>_0x1f7e47['workflow'][_0x461ffb(0xae)](_0x27eab3,{'limit':_0x325c77[_0x461ffb(0x138)]}),{'verbose':_0x325c77[_0x461ffb(0x118)]}),_0x49b584=_0x357447['data'];return console[_0x461ffb(0xe8)](_0x461ffb(0xd4)+_0x49b584[_0x461ffb(0xb0)]+_0x461ffb(0xb3)+(_0x49b584[_0x461ffb(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x49b584,_0x325c77),0x0;}catch(_0x120564){if(_0x120564 instanceof SDKError)return console[_0x461ffb(0xe8)](_0x461ffb(0x10f)+_0x120564[_0x461ffb(0xaa)]),_0x120564['cause']&&console[_0x461ffb(0xe8)](_0x461ffb(0x108)+_0x120564['cause']),0x1;throw _0x120564;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a44_0x322c85(0x129);[a44_0x322c85(0xe7)]=a44_0x322c85(0x132);async[a44_0x322c85(0x11d)](_0x14f317){const _0x36ef3f=a44_0x322c85,{options:_0x537c18,args:_0x2042d1,tdx:_0x444e25}=_0x14f317,_0x237536=_0x2042d1[0x0];try{_0x537c18[_0x36ef3f(0x118)]&&_0x237536&&console[_0x36ef3f(0xe8)](_0x36ef3f(0x121)+_0x237536);const _0x6ddcdd=await withSpinner(_0x36ef3f(0xbe),()=>_0x444e25['workflow'][_0x36ef3f(0x9d)](_0x237536,{'limit':_0x537c18[_0x36ef3f(0x138)]}),{'verbose':_0x537c18[_0x36ef3f(0x118)]}),_0x230099=_0x6ddcdd['data'];return console[_0x36ef3f(0xe8)](_0x36ef3f(0xd4)+_0x230099['length']+_0x36ef3f(0xa8)+(_0x230099['length']!==0x1?'s':'')),await handleSDKOutput(_0x230099,_0x537c18),0x0;}catch(_0x4d9262){if(_0x4d9262 instanceof SDKError)return console[_0x36ef3f(0xe8)](_0x36ef3f(0x10f)+_0x4d9262[_0x36ef3f(0xaa)]),_0x4d9262[_0x36ef3f(0xd8)]&&console[_0x36ef3f(0xe8)](_0x36ef3f(0x108)+_0x4d9262[_0x36ef3f(0xd8)]),0x1;throw _0x4d9262;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']='workflow:sessions';[a44_0x322c85(0xe7)]='List\x20workflow\x20execution\x20sessions';async['execute'](_0x1c00bc){const _0x184b34=a44_0x322c85,{options:_0x43c984,args:_0x2ef045,tdx:_0x52816d}=_0x1c00bc;let _0x585f6d,_0xc2ad6c;if(_0x2ef045[0x0]){const _0x57eabb=_0x2ef045[0x0]['split']('.');if(_0x57eabb[_0x184b34(0xb0)]===0x1)_0x585f6d=_0x57eabb[0x0];else{if(_0x57eabb['length']===0x2)[_0x585f6d,_0xc2ad6c]=_0x57eabb;else return console[_0x184b34(0xe8)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x43c984[_0x184b34(0x118)]){if(_0x585f6d&&_0xc2ad6c)console['error'](_0x184b34(0x133)+_0x585f6d+'.'+_0xc2ad6c);else _0x585f6d&&console[_0x184b34(0xe8)](_0x184b34(0x11e)+_0x585f6d);const _0x17aa1d=_0x43c984[_0x184b34(0x106)];_0x17aa1d&&console[_0x184b34(0xe8)]('Status:\x20'+_0x17aa1d);}const _0x2d0a99=await withSpinner(_0x184b34(0xb1),()=>_0x52816d[_0x184b34(0x117)][_0x184b34(0xcb)]({'projectName':_0x585f6d,'workflowName':_0xc2ad6c,'status':_0x43c984[_0x184b34(0x106)],'fromTime':_0x43c984[_0x184b34(0xde)],'toTime':_0x43c984['to'],'limit':_0x43c984[_0x184b34(0x138)]}),{'verbose':_0x43c984[_0x184b34(0x118)]}),_0x2f2a32=_0x2d0a99[_0x184b34(0xfc)];return console[_0x184b34(0xe8)](_0x184b34(0xd4)+_0x2f2a32[_0x184b34(0xb0)]+_0x184b34(0x123)+(_0x2f2a32[_0x184b34(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x2f2a32,_0x43c984),0x0;}catch(_0x3bcf11){if(_0x3bcf11 instanceof SDKError)return console['error'](_0x184b34(0x10f)+_0x3bcf11[_0x184b34(0xaa)]),_0x3bcf11[_0x184b34(0xd8)]&&console['error']('\x20\x20Cause:\x20'+_0x3bcf11[_0x184b34(0xd8)]),0x1;throw _0x3bcf11;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:attempts';[a44_0x322c85(0xe7)]=a44_0x322c85(0xa5);async[a44_0x322c85(0x11d)](_0x300acc){const _0x4aefbf=a44_0x322c85,{options:_0x179489,args:_0x82f917,tdx:_0x3d1dbc}=_0x300acc;let _0x2df8b1,_0x2c5c5f;if(_0x82f917[0x0]){const _0x5081de=_0x82f917[0x0][_0x4aefbf(0xcd)]('.');if(_0x5081de[_0x4aefbf(0xb0)]===0x1)_0x2df8b1=_0x5081de[0x0];else{if(_0x5081de[_0x4aefbf(0xb0)]===0x2)[_0x2df8b1,_0x2c5c5f]=_0x5081de;else return console[_0x4aefbf(0xe8)](_0x4aefbf(0xe5)),0x1;}}try{const _0x4a5626=_0x179489[_0x4aefbf(0xce)];if(_0x179489[_0x4aefbf(0x118)]){if(_0x2df8b1&&_0x2c5c5f)console[_0x4aefbf(0xe8)](_0x4aefbf(0x133)+_0x2df8b1+'.'+_0x2c5c5f);else _0x2df8b1&&console[_0x4aefbf(0xe8)](_0x4aefbf(0x11e)+_0x2df8b1);_0x4a5626&&console[_0x4aefbf(0xe8)]('Include\x20retried:\x20yes');}const _0x2abc97=await withSpinner(_0x4aefbf(0xd6),()=>_0x3d1dbc[_0x4aefbf(0x117)][_0x4aefbf(0x98)]({'projectName':_0x2df8b1,'workflowName':_0x2c5c5f,'includeRetried':_0x4a5626,'limit':_0x179489[_0x4aefbf(0x138)]}),{'verbose':_0x179489[_0x4aefbf(0x118)]}),_0x36b502=_0x2abc97[_0x4aefbf(0xfc)];return console['error'](_0x4aefbf(0xd4)+_0x36b502['length']+'\x20attempt'+(_0x36b502[_0x4aefbf(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x36b502,_0x179489),0x0;}catch(_0x3291b0){if(_0x3291b0 instanceof SDKError)return console[_0x4aefbf(0xe8)](_0x4aefbf(0x10f)+_0x3291b0[_0x4aefbf(0xaa)]),_0x3291b0['cause']&&console[_0x4aefbf(0xe8)](_0x4aefbf(0x108)+_0x3291b0[_0x4aefbf(0xd8)]),0x1;throw _0x3291b0;}}}export class WorkflowAttemptCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xf2);[a44_0x322c85(0xe7)]=a44_0x322c85(0x97);async['execute'](_0x5ad75c){const _0x153e5f=a44_0x322c85,{options:_0x2803e0,args:_0x84ccc0,tdx:_0x26fa71}=_0x5ad75c,_0x4179e9=_0x84ccc0[0x0];if(!_0x4179e9)return console[_0x153e5f(0xe8)](_0x153e5f(0xa0)),0x1;try{_0x2803e0[_0x153e5f(0x118)]&&console[_0x153e5f(0xe8)](_0x153e5f(0x10c)+_0x4179e9);const _0x175ca2=await withSpinner(_0x153e5f(0xf0),()=>_0x26fa71['workflow'][_0x153e5f(0x126)](_0x4179e9),{'verbose':_0x2803e0[_0x153e5f(0x118)]}),_0x1dd592=_0x175ca2[_0x153e5f(0xfc)];let _0x2c9a73;!_0x1dd592[_0x153e5f(0xd1)]?_0x2c9a73=_0x1dd592[_0x153e5f(0xe4)]?_0x153e5f(0xdf):_0x153e5f(0xf5):_0x2c9a73=_0x1dd592['success']?_0x153e5f(0xe1):_0x153e5f(0xe8);let _0x2fdafe;if(_0x1dd592[_0x153e5f(0xda)]&&_0x1dd592[_0x153e5f(0xd0)]){const _0x9c306e=new Date(_0x1dd592[_0x153e5f(0xda)])[_0x153e5f(0x128)](),_0x186a37=new Date(_0x1dd592[_0x153e5f(0xd0)])['getTime']();_0x2fdafe=Math[_0x153e5f(0xb2)]((_0x186a37-_0x9c306e)/0x3e8);}const _0x2a6a2f={'attempt_id':_0x1dd592['id'],'status':_0x2c9a73,..._0x1dd592[_0x153e5f(0x107)]!==undefined&&{'index':_0x1dd592[_0x153e5f(0x107)]},..._0x1dd592[_0x153e5f(0xab)]&&{'project':_0x1dd592[_0x153e5f(0xab)][_0x153e5f(0x10a)]},..._0x1dd592[_0x153e5f(0x117)]&&{'workflow':_0x1dd592['workflow']['name']},..._0x1dd592[_0x153e5f(0x100)]&&{'session_id':_0x1dd592[_0x153e5f(0x100)]},..._0x1dd592['sessionTime']&&{'session_time':_0x1dd592[_0x153e5f(0xa1)]},..._0x1dd592[_0x153e5f(0xc1)]&&{'retry_attempt':_0x1dd592[_0x153e5f(0xc1)]},..._0x2fdafe!==undefined&&{'duration_sec':_0x2fdafe},..._0x1dd592['createdAt']&&{'created_at':_0x1dd592[_0x153e5f(0xda)]},..._0x1dd592[_0x153e5f(0xd0)]&&{'finished_at':_0x1dd592['finishedAt']},...Object[_0x153e5f(0xd7)](_0x1dd592[_0x153e5f(0x12d)])[_0x153e5f(0xb0)]>0x0&&{'params':_0x1dd592[_0x153e5f(0x12d)]}};return await handleSingleObjectOutput(_0x2a6a2f,_0x2803e0),0x0;}catch(_0x681004){if(_0x681004 instanceof SDKError)return console[_0x153e5f(0xe8)]('Error:\x20'+_0x681004[_0x153e5f(0xaa)]),_0x681004[_0x153e5f(0xd8)]&&console[_0x153e5f(0xe8)]('\x20\x20Cause:\x20'+_0x681004[_0x153e5f(0xd8)]),0x1;throw _0x681004;}}}export class WorkflowTasksCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:tasks';[a44_0x322c85(0xe7)]=a44_0x322c85(0x130);async['execute'](_0x5a52a7){const _0x16e03d=a44_0x322c85,{options:_0x33be0a,args:_0x259ba7,tdx:_0x3654a6}=_0x5a52a7,_0x14615e=_0x259ba7[0x0];if(!_0x14615e)return console[_0x16e03d(0xe8)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x232c1b=_0x33be0a[_0x16e03d(0x120)];_0x33be0a[_0x16e03d(0x118)]&&(console[_0x16e03d(0xe8)](_0x16e03d(0x10c)+_0x14615e),_0x232c1b&&console[_0x16e03d(0xe8)](_0x16e03d(0xd5)));const _0x11b4f8=await withSpinner(_0x16e03d(0xa9),()=>_0x3654a6[_0x16e03d(0x117)][_0x16e03d(0xbb)](_0x14615e,_0x232c1b||![]),{'verbose':_0x33be0a[_0x16e03d(0x118)]}),_0x5f2fdd=_0x11b4f8[_0x16e03d(0xfc)];return console[_0x16e03d(0xe8)](_0x16e03d(0xd4)+_0x5f2fdd[_0x16e03d(0xb0)]+_0x16e03d(0x124)+(_0x5f2fdd[_0x16e03d(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x5f2fdd,_0x33be0a),0x0;}catch(_0x1fd0ef){if(_0x1fd0ef instanceof SDKError)return console['error'](_0x16e03d(0x10f)+_0x1fd0ef['message']),_0x1fd0ef['cause']&&console['error'](_0x16e03d(0x108)+_0x1fd0ef[_0x16e03d(0xd8)]),0x1;throw _0x1fd0ef;}}}function a44_0x3098(_0x3ada99,_0x34981c){_0x3ada99=_0x3ada99-0x95;const _0x20af1b=a44_0x20af();let _0x309897=_0x20af1b[_0x3ada99];return _0x309897;}export class WorkflowLogsCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xeb);[a44_0x322c85(0xe7)]=a44_0x322c85(0xe9);async[a44_0x322c85(0x11d)](_0x3f5b25){const _0x2c31ce=a44_0x322c85,{options:_0x4957fb,args:_0x27ce6a,tdx:_0x132cfe}=_0x3f5b25,_0x1e3372=_0x27ce6a[0x0];let _0x5edf9d=_0x27ce6a[0x1];if(!_0x1e3372)return console[_0x2c31ce(0xe8)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x4957fb[_0x2c31ce(0x118)]&&(console['error'](_0x2c31ce(0x10c)+_0x1e3372),_0x5edf9d&&console[_0x2c31ce(0xe8)](_0x2c31ce(0xd3)+_0x5edf9d));const _0x418ed2=await withSpinner(_0x2c31ce(0x134),()=>_0x132cfe[_0x2c31ce(0x117)][_0x2c31ce(0xe0)](_0x1e3372,_0x5edf9d),{'verbose':_0x4957fb['verbose']}),_0x3eeb6d=_0x418ed2[_0x2c31ce(0xfc)];if(_0x3eeb6d[_0x2c31ce(0xb0)]===0x0)return console['error'](_0x2c31ce(0x96)),0x0;if(!_0x5edf9d&&(_0x4957fb[_0x2c31ce(0xc3)]||_0x4957fb[_0x2c31ce(0xbc)]))return await handleSDKOutput(_0x3eeb6d,_0x4957fb),0x0;if(!_0x5edf9d){const _0x108185=_0x3eeb6d['map'](_0x3dc1c5=>({'title':_0x3dc1c5[_0x2c31ce(0xcc)]+'\x20('+formatBytes(_0x3dc1c5[_0x2c31ce(0xb7)])+')','value':_0x3dc1c5[_0x2c31ce(0xcc)]})),_0x3cfec8=await a44_0x526862({'type':_0x2c31ce(0x113),'name':_0x2c31ce(0xb8),'message':_0x2c31ce(0x115),'choices':_0x108185});if(!_0x3cfec8[_0x2c31ce(0xb8)])return console[_0x2c31ce(0xe8)]('Cancelled'),0x0;_0x5edf9d=_0x3cfec8[_0x2c31ce(0xb8)];}const _0x212a08=await withSpinner(_0x2c31ce(0xc9),()=>_0x132cfe[_0x2c31ce(0x117)][_0x2c31ce(0x109)](_0x1e3372,_0x5edf9d),{'verbose':_0x4957fb[_0x2c31ce(0x118)]}),_0x17134c=_0x212a08[_0x2c31ce(0xfc)];return _0x17134c?console['log'](_0x17134c):console[_0x2c31ce(0xe8)](_0x2c31ce(0xc4)),0x0;}catch(_0x52f283){if(_0x52f283 instanceof SDKError)return console[_0x2c31ce(0xe8)](_0x2c31ce(0x10f)+_0x52f283[_0x2c31ce(0xaa)]),_0x52f283['cause']&&console[_0x2c31ce(0xe8)](_0x2c31ce(0x108)+_0x52f283['cause']),0x1;throw _0x52f283;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a44_0x322c85(0xd2);[a44_0x322c85(0xe7)]=a44_0x322c85(0xff);async[a44_0x322c85(0x11d)](_0x231979){const _0xc045d7=a44_0x322c85,{options:_0x404499,args:_0x217c1a,tdx:_0x333992}=_0x231979,_0x587d4c=_0x217c1a[0x0];if(!_0x587d4c)return console[_0xc045d7(0xe8)](_0xc045d7(0xa0)),0x1;try{const _0x37bf66=_0x404499[_0xc045d7(0xe2)];_0x404499[_0xc045d7(0x118)]&&(console[_0xc045d7(0xe8)](_0xc045d7(0x10c)+_0x587d4c),_0x37bf66&&console[_0xc045d7(0xe8)]('Reason:\x20'+_0x37bf66));if(!_0x404499[_0xc045d7(0x127)]){const _0x3c7dd3=await confirm(_0xc045d7(0xca)+_0x587d4c+'?');if(!_0x3c7dd3)return console[_0xc045d7(0xe8)]('Cancelled'),0x0;}const _0x53d07a=await withSpinner(_0xc045d7(0xc0),()=>_0x333992[_0xc045d7(0x117)][_0xc045d7(0x101)](_0x587d4c,_0x37bf66),{'verbose':_0x404499[_0xc045d7(0x118)]}),_0x5bee9e=_0x53d07a['data'];return console[_0xc045d7(0xe8)]('✔\x20'+_0x5bee9e),0x0;}catch(_0x2dc934){if(_0x2dc934 instanceof SDKError)return console[_0xc045d7(0xe8)](_0xc045d7(0x10f)+_0x2dc934[_0xc045d7(0xaa)]),_0x2dc934[_0xc045d7(0xd8)]&&console[_0xc045d7(0xe8)](_0xc045d7(0x108)+_0x2dc934[_0xc045d7(0xd8)]),0x1;throw _0x2dc934;}}}export class WorkflowRetryCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xfb);[a44_0x322c85(0xe7)]=a44_0x322c85(0x99);async[a44_0x322c85(0x11d)](_0x185ee8){const _0x903c12=a44_0x322c85,{options:_0x2c61c9,args:_0x6c9d3b,tdx:_0x558ccd}=_0x185ee8,_0x49d1c1=_0x6c9d3b[0x0];if(!_0x49d1c1)return console[_0x903c12(0xe8)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console['error']('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x2ba413=![],_0x1a5b34=_0x49d1c1;if(_0x49d1c1['startsWith']('session:'))_0x2ba413=!![],_0x1a5b34=_0x49d1c1[_0x903c12(0xcf)](0x8);else{if(_0x49d1c1['startsWith']('attempt:'))_0x2ba413=![],_0x1a5b34=_0x49d1c1['substring'](0x8);else return console[_0x903c12(0xe8)](_0x903c12(0xdc)),console['error'](_0x903c12(0x10e)),0x1;}try{const _0x2bc132=_0x2c61c9[_0x903c12(0x9f)],_0x2e5815=_0x2c61c9[_0x903c12(0x11a)],_0x22cb7a=_0x2c61c9['params'],_0x11bd5b=_0x2c61c9['force'];_0x2c61c9[_0x903c12(0x118)]&&(console['error'](_0x903c12(0x13a)+(_0x2ba413?_0x903c12(0x135):_0x903c12(0x126))+'\x20'+_0x1a5b34),_0x2bc132&&console['error'](_0x903c12(0xc6)+_0x2bc132),_0x2e5815&&console[_0x903c12(0xe8)](_0x903c12(0x12e)+_0x2e5815),_0x22cb7a&&console[_0x903c12(0xe8)](_0x903c12(0x112)+_0x22cb7a),_0x11bd5b&&console[_0x903c12(0xe8)](_0x903c12(0x12b)));let _0x264f25;if(_0x22cb7a)try{if(_0x22cb7a['startsWith']('@')){const _0x21ac58=await import(_0x903c12(0xe6)),_0x424261=_0x22cb7a[_0x903c12(0xcf)](0x1),_0x4e3753=await _0x21ac58['readFile'](_0x424261,_0x903c12(0xb4));_0x264f25=JSON[_0x903c12(0xfd)](_0x4e3753);}else _0x264f25=JSON[_0x903c12(0xfd)](_0x22cb7a);}catch{return console[_0x903c12(0xe8)](_0x903c12(0xf1)),0x1;}if(!_0x2c61c9['yes']){const _0x3d8e29=await confirm(_0x903c12(0xa2)+(_0x2ba413?_0x903c12(0x135):_0x903c12(0x126))+'\x20'+_0x1a5b34+'?');if(!_0x3d8e29)return console[_0x903c12(0xe8)](_0x903c12(0xa4)),0x0;}let _0x329cec;_0x2ba413?_0x329cec=await withSpinner(_0x903c12(0x116),()=>_0x558ccd[_0x903c12(0x117)][_0x903c12(0xac)](_0x1a5b34,{'fromTask':_0x2bc132,'retryParams':_0x264f25}),{'verbose':_0x2c61c9[_0x903c12(0x118)]}):_0x329cec=await withSpinner(_0x903c12(0x105),()=>_0x558ccd[_0x903c12(0x117)][_0x903c12(0xed)](_0x1a5b34,{'resumeFrom':_0x2e5815,'retryParams':_0x264f25,'force':_0x11bd5b}),{'verbose':_0x2c61c9[_0x903c12(0x118)]});const _0x2df30c=_0x329cec[_0x903c12(0xfc)];return console[_0x903c12(0xe8)](_0x903c12(0x122)),console[_0x903c12(0xe8)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x2df30c[_0x903c12(0xad)]),console[_0x903c12(0xe8)](_0x903c12(0xb5)+_0x2df30c[_0x903c12(0x100)]),0x0;}catch(_0x35f295){if(_0x35f295 instanceof SDKError)return console[_0x903c12(0xe8)](_0x903c12(0x10f)+_0x35f295[_0x903c12(0xaa)]),_0x35f295[_0x903c12(0xd8)]&&console[_0x903c12(0xe8)](_0x903c12(0x108)+_0x35f295[_0x903c12(0xd8)]),0x1;throw _0x35f295;}}}export class WorkflowRunCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:run';[a44_0x322c85(0xe7)]='Start\x20a\x20workflow\x20run';async[a44_0x322c85(0x11d)](_0x26512c){const _0xfe3a0d=a44_0x322c85,{options:_0x3f9a61,args:_0x384cde,tdx:_0x4b2b75}=_0x26512c,_0x3a2683=_0x384cde[0x0];if(!_0x3a2683)return console['error']('Error:\x20Workflow\x20identifier\x20is\x20required'),console['error'](_0xfe3a0d(0xee)),0x1;const _0x2664e9=_0x3f9a61['param'],_0x35a6ce=_0x3f9a61[_0xfe3a0d(0xa1)],_0x3b4771={};if(_0x2664e9&&Array[_0xfe3a0d(0xb6)](_0x2664e9))for(const _0x421c61 of _0x2664e9){const _0x34fb75=_0x421c61[_0xfe3a0d(0xf8)]('=');if(_0x34fb75===-0x1)return console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xfa)+_0x421c61),console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xc2)),0x1;const _0x3b4896=_0x421c61['substring'](0x0,_0x34fb75),_0x232e27=_0x421c61[_0xfe3a0d(0xcf)](_0x34fb75+0x1);try{_0x3b4771[_0x3b4896]=JSON[_0xfe3a0d(0xfd)](_0x232e27);}catch{_0x3b4771[_0x3b4896]=_0x232e27;}}_0x3f9a61['verbose']&&(console['error'](_0xfe3a0d(0xbd)+_0x3a2683),Object[_0xfe3a0d(0xd7)](_0x3b4771)[_0xfe3a0d(0xb0)]>0x0&&console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xb9)+JSON[_0xfe3a0d(0xba)](_0x3b4771)),_0x35a6ce&&console[_0xfe3a0d(0xe8)](_0xfe3a0d(0x137)+_0x35a6ce));const _0x4c08b9=await withSpinner(_0xfe3a0d(0x111),()=>_0x4b2b75[_0xfe3a0d(0x117)][_0xfe3a0d(0x119)](_0x3a2683,_0x3b4771,{'sessionTime':_0x35a6ce}),{'verbose':_0x3f9a61[_0xfe3a0d(0x118)]}),_0x333b1d=_0x4c08b9['data'];return console[_0xfe3a0d(0xe8)](_0xfe3a0d(0x12f)),console['error'](_0xfe3a0d(0xea)+_0x333b1d['id']),console[_0xfe3a0d(0xe8)]('\x20\x20Session\x20ID:\x20'+_0x333b1d[_0xfe3a0d(0x100)]),console[_0xfe3a0d(0xe8)]('\x20\x20Project:\x20'+_0x333b1d['project']?.[_0xfe3a0d(0x10a)]),console[_0xfe3a0d(0xe8)]('\x20\x20Workflow:\x20'+_0x333b1d[_0xfe3a0d(0x117)]?.[_0xfe3a0d(0x10a)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:download';[a44_0x322c85(0xe7)]=a44_0x322c85(0x104);async[a44_0x322c85(0x11d)](_0x2aa2f2){const _0x972b89=a44_0x322c85,{options:_0x3c7a5a,args:_0xaaf384,tdx:_0x2883ff}=_0x2aa2f2,_0x180de5=_0xaaf384[0x0],_0x4e61fe=_0xaaf384[0x1]||'.';if(!_0x180de5)return console[_0x972b89(0xe8)](_0x972b89(0x136)),console[_0x972b89(0xe8)](_0x972b89(0x10b)),0x1;const _0x52358b=_0x3c7a5a['revision'];_0x3c7a5a[_0x972b89(0x118)]&&(console['error']('Project:\x20'+_0x180de5),console[_0x972b89(0xe8)](_0x972b89(0xd9)+_0x4e61fe),_0x52358b&&console[_0x972b89(0xe8)]('Revision:\x20'+_0x52358b));const _0x16a408=await withSpinner('Downloading\x20project\x20'+_0x180de5+_0x972b89(0x10d),()=>_0x2883ff[_0x972b89(0x117)][_0x972b89(0xf7)](_0x180de5,_0x4e61fe,{'revision':_0x52358b}),{'verbose':_0x3c7a5a['verbose']}),_0x450824=_0x16a408[_0x972b89(0xfc)];return console[_0x972b89(0xe8)](_0x972b89(0xec)+_0x450824[_0x972b89(0xa6)]),console['error'](_0x972b89(0x12a)+_0x450824[_0x972b89(0x11f)]),console[_0x972b89(0xe8)](_0x972b89(0xc8)+_0x450824['filesExtracted']),console['error'](_0x972b89(0x9b)+_0x4e61fe+'/'+_0x450824[_0x972b89(0xa6)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0x114);[a44_0x322c85(0xe7)]=a44_0x322c85(0xc7);async['execute'](_0x1d2097){const _0x4195d2=a44_0x322c85,{options:_0x49cfc4,args:_0x8d9631,tdx:_0x426e9d}=_0x1d2097;let _0x422ddc='.',_0x566694=_0x49cfc4[_0x4195d2(0x10a)];if(_0x8d9631[0x0]){const {promises:_0x4c3917}=await import('fs');try{const _0x19fd3e=await _0x4c3917[_0x4195d2(0xa3)](_0x8d9631[0x0]);if(_0x19fd3e['isDirectory']())_0x422ddc=_0x8d9631[0x0];else return console['error'](_0x4195d2(0x10f)+_0x8d9631[0x0]+_0x4195d2(0x11b)),0x1;}catch{_0x566694=_0x8d9631[0x0],_0x422ddc='.';}}const _0x3da80a=_0x49cfc4[_0x4195d2(0x11f)],_0x16a957=_0x49cfc4[_0x4195d2(0x9c)];_0x49cfc4[_0x4195d2(0x118)]&&(console[_0x4195d2(0xe8)](_0x4195d2(0xf6)+_0x422ddc),_0x566694&&console[_0x4195d2(0xe8)]('Project\x20name:\x20'+_0x566694),_0x3da80a&&console[_0x4195d2(0xe8)](_0x4195d2(0xef)+_0x3da80a),_0x16a957&&console[_0x4195d2(0xe8)](_0x4195d2(0x11c)));const _0x295aca=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x426e9d[_0x4195d2(0x117)]['push'](_0x422ddc,{'projectName':_0x566694,'revision':_0x3da80a,'skipValidation':_0x16a957}),{'verbose':_0x49cfc4[_0x4195d2(0x118)]}),_0xd291f9=_0x295aca['data'];return console[_0x4195d2(0xe8)](_0x4195d2(0xf9)+_0xd291f9[_0x4195d2(0xa6)]),console[_0x4195d2(0xe8)](_0x4195d2(0x102)+_0xd291f9['projectId']),console[_0x4195d2(0xe8)](_0x4195d2(0x12a)+_0xd291f9[_0x4195d2(0x11f)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0x110);[a44_0x322c85(0xe7)]=a44_0x322c85(0x103);async[a44_0x322c85(0x11d)](_0x35030d){const _0x35bc39=a44_0x322c85,{options:_0x3f1ecd,args:_0x45069a,tdx:_0x5c8b85}=_0x35030d,_0x109f09=_0x45069a[0x0];if(!_0x109f09)return console[_0x35bc39(0xe8)]('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console['error']('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x3f1ecd[_0x35bc39(0x118)]&&console[_0x35bc39(0xe8)]('Project:\x20'+_0x109f09);if(!_0x3f1ecd[_0x35bc39(0x127)]){const _0x3ce086=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22'+_0x109f09+_0x35bc39(0xa7));if(!_0x3ce086)return console['error'](_0x35bc39(0xa4)),0x0;}const _0x496bf6=await withSpinner(_0x35bc39(0x139)+_0x109f09+_0x35bc39(0x10d),()=>_0x5c8b85[_0x35bc39(0x117)]['delete'](_0x109f09),{'verbose':_0x3f1ecd[_0x35bc39(0x118)]}),_0x4581bf=_0x496bf6[_0x35bc39(0xfc)];return console[_0x35bc39(0xe8)](_0x35bc39(0xf3)+_0x4581bf['projectName']),console[_0x35bc39(0xe8)](_0x35bc39(0x102)+_0x4581bf[_0x35bc39(0x13b)]),0x0;}}function a44_0x20af(){const _0x65cdc0=['Resume\x20from:\x20','✔\x20Workflow\x20run\x20started','Show\x20tasks\x20for\x20an\x20attempt','Listing\x20workflow\x20projects...','List\x20workflows','Filter:\x20','Fetching\x20log\x20files...','session','Error:\x20Project\x20name\x20is\x20required','Session\x20time:\x20','limit','Deleting\x20project\x20','Target:\x20','projectId','List\x20all\x20workflow\x20projects','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Show\x20specific\x20attempt\x20details','attempts','Retry\x20a\x20session\x20or\x20attempt','94ZuzSpP','\x20\x20Location:\x20','skipValidation','workflows','72ziCedG','fromTask','Error:\x20Attempt\x20ID\x20is\x20required','sessionTime','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','stat','Cancelled','List\x20workflow\x20attempts','projectName','\x22?\x20This\x20cannot\x20be\x20undone.','\x20workflow','Getting\x20attempt\x20tasks...','message','project','retrySession','attemptId','projects','2424dyHITP','length','Listing\x20workflow\x20sessions...','round','\x20project','utf-8','\x20\x20Session\x20ID:\x20','isArray','fileSize','task','Parameters:\x20','stringify','tasks','format','Workflow:\x20','Listing\x20workflows...','1304534KaDlvR','Killing\x20attempt...','retryAttemptName','Expected\x20format:\x20--param\x20key=value','json','No\x20log\x20content\x20found','1575130pajnpP','From\x20task:\x20','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','\x20\x20Files\x20extracted:\x20','Downloading\x20logs...','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','sessions','taskName','split','includeRetried','substring','finishedAt','done','workflow:kill','Task\x20name:\x20','✔\x20Found\x20','Including\x20subtasks:\x20yes','Listing\x20workflow\x20attempts...','keys','cause','Output\x20directory:\x20','createdAt','12051ikCVBY','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Pattern:\x20','from','canceling','logFiles','success','reason','workflow:projects','cancelRequested','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','fs/promises','description','error','Show\x20logs\x20for\x20a\x20workflow\x20attempt','\x20\x20Attempt\x20ID:\x20','workflow:logs','✔\x20Downloaded\x20','retryAttempt','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','Revision:\x20','Getting\x20attempt\x20details...','Error:\x20Invalid\x20JSON\x20in\x20--params','workflow:attempt','✔\x20Deleted\x20project\x20','539211QnyscT','running','Project\x20directory:\x20','download','indexOf','✔\x20Pushed\x20','Error:\x20Invalid\x20parameter\x20format:\x20','workflow:retry','data','parse','1070292ltzxbY','Kill\x20a\x20running\x20attempt','sessionId','kill','\x20\x20Project\x20ID:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Retrying\x20attempt...','status','index','\x20\x20Cause:\x20','logs','name','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Attempt\x20ID:\x20','...','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Error:\x20','workflow:delete','Starting\x20workflow\x20run...','Params:\x20','select','workflow:push','Select\x20a\x20task\x20to\x20view\x20logs:','Retrying\x20session...','workflow','verbose','run','resumeFrom','\x20is\x20not\x20a\x20directory','Validation:\x20skipped','execute','Filter:\x20project=','revision','includeSubtasks','Project\x20filter:\x20','✔\x20Retry\x20started','\x20session','\x20task','1285BwyGhy','attempt','yes','getTime','workflow:workflows','\x20\x20Revision:\x20','Force:\x20yes','1016RlixoF','params'];a44_0x20af=function(){return _0x65cdc0;};return a44_0x20af();}
|
|
1
|
+
const a44_0x16383b=a44_0x3f12;(function(_0x263e41,_0x400f82){const _0xe93d38=a44_0x3f12,_0x6da8bc=_0x263e41();while(!![]){try{const _0x33bf3b=parseInt(_0xe93d38(0x96))/0x1*(-parseInt(_0xe93d38(0xa3))/0x2)+parseInt(_0xe93d38(0xf2))/0x3*(parseInt(_0xe93d38(0xf7))/0x4)+-parseInt(_0xe93d38(0xb2))/0x5+-parseInt(_0xe93d38(0xbb))/0x6+parseInt(_0xe93d38(0xc9))/0x7+-parseInt(_0xe93d38(0xdc))/0x8+parseInt(_0xe93d38(0xd1))/0x9;if(_0x33bf3b===_0x400f82)break;else _0x6da8bc['push'](_0x6da8bc['shift']());}catch(_0x524d1d){_0x6da8bc['push'](_0x6da8bc['shift']());}}}(a44_0x5e5d,0x7265b));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a44_0x210539 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0xd5);[a44_0x16383b(0xde)]=a44_0x16383b(0xd7);async[a44_0x16383b(0x121)](_0x5cc5f){const _0x5423e6=a44_0x16383b,{options:_0x27e056,args:_0x51547b,tdx:_0x264647}=_0x5cc5f,_0x545d4d=_0x51547b[0x0];try{_0x27e056[_0x5423e6(0x10d)]&&_0x545d4d&&console[_0x5423e6(0xdf)](_0x5423e6(0x10b)+_0x545d4d);const _0x1f63b3=await withSpinner(_0x5423e6(0x112),()=>_0x264647[_0x5423e6(0x10f)][_0x5423e6(0x87)](_0x545d4d,{'limit':_0x27e056[_0x5423e6(0xb8)]}),{'verbose':_0x27e056['verbose']}),_0x3c5f87=_0x1f63b3['data'];return console[_0x5423e6(0xdf)](_0x5423e6(0xbd)+_0x3c5f87[_0x5423e6(0x118)]+_0x5423e6(0x105)+(_0x3c5f87[_0x5423e6(0x118)]!==0x1?'s':'')),await handleSDKOutput(_0x3c5f87,_0x27e056),0x0;}catch(_0x1dec0d){if(_0x1dec0d instanceof SDKError)return console[_0x5423e6(0xdf)](_0x5423e6(0xf4)+_0x1dec0d[_0x5423e6(0x8c)]),_0x1dec0d['cause']&&console[_0x5423e6(0xdf)](_0x5423e6(0xb1)+_0x1dec0d[_0x5423e6(0xbf)]),0x1;throw _0x1dec0d;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x124);[a44_0x16383b(0xde)]='List\x20workflows';async[a44_0x16383b(0x121)](_0x5452ba){const _0x3148b4=a44_0x16383b,{options:_0x3c269a,args:_0x31a0a3,tdx:_0x37af11}=_0x5452ba,_0x5253da=_0x31a0a3[0x0];try{_0x3c269a[_0x3148b4(0x10d)]&&_0x5253da&&console[_0x3148b4(0xdf)](_0x3148b4(0x122)+_0x5253da);const _0xd1661e=await withSpinner(_0x3148b4(0x10e),()=>_0x37af11['workflow'][_0x3148b4(0x107)](_0x5253da,{'limit':_0x3c269a[_0x3148b4(0xb8)]}),{'verbose':_0x3c269a[_0x3148b4(0x10d)]}),_0x5609eb=_0xd1661e[_0x3148b4(0xb7)];return console[_0x3148b4(0xdf)](_0x3148b4(0xbd)+_0x5609eb[_0x3148b4(0x118)]+_0x3148b4(0xc1)+(_0x5609eb['length']!==0x1?'s':'')),await handleSDKOutput(_0x5609eb,_0x3c269a),0x0;}catch(_0x36a81a){if(_0x36a81a instanceof SDKError)return console['error'](_0x3148b4(0xf4)+_0x36a81a[_0x3148b4(0x8c)]),_0x36a81a['cause']&&console[_0x3148b4(0xdf)](_0x3148b4(0xb1)+_0x36a81a[_0x3148b4(0xbf)]),0x1;throw _0x36a81a;}}}function a44_0x5e5d(){const _0x28166a=['workflow:kill','\x22?\x20This\x20cannot\x20be\x20undone.','List\x20workflow\x20execution\x20sessions','Retry\x20a\x20session\x20or\x20attempt','kill','Error:\x20Invalid\x20parameter\x20format:\x20','...','stringify','log','23mTuaUv','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Error:\x20Project\x20name\x20is\x20required','\x20\x20Revision:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Including\x20subtasks:\x20yes','workflow:delete','\x20\x20Project\x20ID:\x20','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','parse','split','\x20session','retryAttemptName','59886hFLOzi','Project:\x20','Session\x20time:\x20','fileSize','Error:\x20Attempt\x20ID\x20is\x20required','json','\x20is\x20not\x20a\x20directory','projectId','projectName','getTime','workflow:sessions','stat','done','running','\x20\x20Cause:\x20','1247905eFDvNc','name','\x20task','Getting\x20attempt\x20tasks...','Filter:\x20','data','limit','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','substring','5179044hQYUBZ','Pushing\x20workflow\x20project...','✔\x20Found\x20','task','cause','revision','\x20workflow','✔\x20Downloaded\x20','Error:\x20Workflow\x20identifier\x20is\x20required','project','logs','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','delete','Include\x20retried:\x20yes','6144257PFOZSl','cancelRequested','attempt','canceling','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Resume\x20from:\x20','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','reason','19123542biCsBs','Filter:\x20project=','isArray','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','workflow:projects','createdAt','List\x20all\x20workflow\x20projects','format','utf-8','finishedAt','attemptId','6113264UhAIyc','Project\x20directory:\x20','description','error','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Kill\x20a\x20running\x20attempt','success','Show\x20specific\x20attempt\x20details','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','From\x20task:\x20','No\x20log\x20content\x20found','map','params','Task\x20name:\x20','workflow:push','Retrying\x20session...','param','✔\x20Retry\x20started','retryAttempt','Show\x20tasks\x20for\x20an\x20attempt','\x20\x20Location:\x20','sessionTime','21OohWyl','Deleting\x20project\x20','Error:\x20','List\x20workflow\x20attempts','workflow:attempts','18048OFpkmT','yes','index','skipValidation','taskName','status','filesExtracted','attempt:','Attempt\x20ID:\x20','fs/promises','workflow:retry','✔\x20Pushed\x20','Expected\x20format:\x20--param\x20key=value','attempts','\x20project','Reason:\x20','workflows','\x20\x20Workflow:\x20','download','Validation:\x20skipped','Pattern:\x20','Listing\x20workflow\x20sessions...','verbose','Listing\x20workflows...','workflow','startsWith','workflow:attempt','Listing\x20workflow\x20projects...','Parameters:\x20','session:','workflow:logs','Start\x20a\x20workflow\x20run','Starting\x20workflow\x20run...','length','✔\x20Deleted\x20project\x20','includeSubtasks','includeRetried','Revision:\x20','No\x20log\x20files\x20found\x20for\x20this\x20attempt','retrySession','Show\x20logs\x20for\x20a\x20workflow\x20attempt','sessions','execute','Project\x20filter:\x20','sessionId','workflow:workflows','session','Listing\x20workflow\x20attempts...','readFile','Target:\x20','keys','\x20attempt','force','from','\x20\x20Session\x20ID:\x20','projects','select','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20\x20Attempt\x20ID:\x20','Usage:\x20workflow:delete\x20<project-name-or-id>','message'];a44_0x5e5d=function(){return _0x28166a;};return a44_0x5e5d();}export class WorkflowSessionsCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0xad);[a44_0x16383b(0xde)]=a44_0x16383b(0x8f);async[a44_0x16383b(0x121)](_0x37ef64){const _0x44f5ab=a44_0x16383b,{options:_0x5ed4a0,args:_0x260cf0,tdx:_0x44fbd8}=_0x37ef64;let _0x433ffc,_0x56b037;if(_0x260cf0[0x0]){const _0x40f46f=_0x260cf0[0x0][_0x44f5ab(0xa0)]('.');if(_0x40f46f[_0x44f5ab(0x118)]===0x1)_0x433ffc=_0x40f46f[0x0];else{if(_0x40f46f['length']===0x2)[_0x433ffc,_0x56b037]=_0x40f46f;else return console[_0x44f5ab(0xdf)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x5ed4a0[_0x44f5ab(0x10d)]){if(_0x433ffc&&_0x56b037)console['error'](_0x44f5ab(0xb6)+_0x433ffc+'.'+_0x56b037);else _0x433ffc&&console['error'](_0x44f5ab(0xd2)+_0x433ffc);const _0xd04765=_0x5ed4a0[_0x44f5ab(0xfc)];_0xd04765&&console[_0x44f5ab(0xdf)]('Status:\x20'+_0xd04765);}const _0x26968f=await withSpinner(_0x44f5ab(0x10c),()=>_0x44fbd8[_0x44f5ab(0x10f)][_0x44f5ab(0x120)]({'projectName':_0x433ffc,'workflowName':_0x56b037,'status':_0x5ed4a0['status'],'fromTime':_0x5ed4a0[_0x44f5ab(0x85)],'toTime':_0x5ed4a0['to'],'limit':_0x5ed4a0[_0x44f5ab(0xb8)]}),{'verbose':_0x5ed4a0[_0x44f5ab(0x10d)]}),_0x280687=_0x26968f[_0x44f5ab(0xb7)];return console[_0x44f5ab(0xdf)]('✔\x20Found\x20'+_0x280687[_0x44f5ab(0x118)]+_0x44f5ab(0xa1)+(_0x280687[_0x44f5ab(0x118)]!==0x1?'s':'')),await handleSDKOutput(_0x280687,_0x5ed4a0),0x0;}catch(_0x4634f0){if(_0x4634f0 instanceof SDKError)return console[_0x44f5ab(0xdf)](_0x44f5ab(0xf4)+_0x4634f0[_0x44f5ab(0x8c)]),_0x4634f0['cause']&&console['error'](_0x44f5ab(0xb1)+_0x4634f0[_0x44f5ab(0xbf)]),0x1;throw _0x4634f0;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a44_0x16383b(0xf6);['description']=a44_0x16383b(0xf5);async['execute'](_0x3812a1){const _0x257218=a44_0x16383b,{options:_0x2671c8,args:_0x4eaf41,tdx:_0x3a40a5}=_0x3812a1;let _0x1b32dd,_0x1ef97f;if(_0x4eaf41[0x0]){const _0x27d70a=_0x4eaf41[0x0][_0x257218(0xa0)]('.');if(_0x27d70a[_0x257218(0x118)]===0x1)_0x1b32dd=_0x27d70a[0x0];else{if(_0x27d70a[_0x257218(0x118)]===0x2)[_0x1b32dd,_0x1ef97f]=_0x27d70a;else return console[_0x257218(0xdf)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x44c3c6=_0x2671c8[_0x257218(0x11b)];if(_0x2671c8[_0x257218(0x10d)]){if(_0x1b32dd&&_0x1ef97f)console['error'](_0x257218(0xb6)+_0x1b32dd+'.'+_0x1ef97f);else _0x1b32dd&&console[_0x257218(0xdf)](_0x257218(0xd2)+_0x1b32dd);_0x44c3c6&&console[_0x257218(0xdf)](_0x257218(0xc8));}const _0x5d105e=await withSpinner(_0x257218(0x126),()=>_0x3a40a5[_0x257218(0x10f)][_0x257218(0x104)]({'projectName':_0x1b32dd,'workflowName':_0x1ef97f,'includeRetried':_0x44c3c6,'limit':_0x2671c8[_0x257218(0xb8)]}),{'verbose':_0x2671c8[_0x257218(0x10d)]}),_0x3d400c=_0x5d105e[_0x257218(0xb7)];return console['error'](_0x257218(0xbd)+_0x3d400c['length']+_0x257218(0x83)+(_0x3d400c[_0x257218(0x118)]!==0x1?'s':'')),await handleSDKOutput(_0x3d400c,_0x2671c8),0x0;}catch(_0x267a4b){if(_0x267a4b instanceof SDKError)return console[_0x257218(0xdf)](_0x257218(0xf4)+_0x267a4b['message']),_0x267a4b[_0x257218(0xbf)]&&console['error'](_0x257218(0xb1)+_0x267a4b[_0x257218(0xbf)]),0x1;throw _0x267a4b;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a44_0x16383b(0x111);[a44_0x16383b(0xde)]=a44_0x16383b(0xe3);async[a44_0x16383b(0x121)](_0x589922){const _0x41c770=a44_0x16383b,{options:_0x55d90b,args:_0x4a68a6,tdx:_0x5e67c1}=_0x589922,_0x2952f0=_0x4a68a6[0x0];if(!_0x2952f0)return console[_0x41c770(0xdf)](_0x41c770(0xa7)),0x1;try{_0x55d90b[_0x41c770(0x10d)]&&console['error'](_0x41c770(0xff)+_0x2952f0);const _0x12d7cc=await withSpinner('Getting\x20attempt\x20details...',()=>_0x5e67c1['workflow'][_0x41c770(0xcb)](_0x2952f0),{'verbose':_0x55d90b[_0x41c770(0x10d)]}),_0x2932fa=_0x12d7cc[_0x41c770(0xb7)];let _0x5d37c1;!_0x2932fa[_0x41c770(0xaf)]?_0x5d37c1=_0x2932fa[_0x41c770(0xca)]?_0x41c770(0xcc):_0x41c770(0xb0):_0x5d37c1=_0x2932fa[_0x41c770(0xe2)]?'success':_0x41c770(0xdf);let _0x58c0e2;if(_0x2932fa['createdAt']&&_0x2932fa[_0x41c770(0xda)]){const _0x435560=new Date(_0x2932fa[_0x41c770(0xd6)])[_0x41c770(0xac)](),_0x406eb5=new Date(_0x2932fa[_0x41c770(0xda)])['getTime']();_0x58c0e2=Math['round']((_0x406eb5-_0x435560)/0x3e8);}const _0x3dddb3={'attempt_id':_0x2932fa['id'],'status':_0x5d37c1,..._0x2932fa[_0x41c770(0xf9)]!==undefined&&{'index':_0x2932fa[_0x41c770(0xf9)]},..._0x2932fa[_0x41c770(0xc4)]&&{'project':_0x2932fa['project'][_0x41c770(0xb3)]},..._0x2932fa[_0x41c770(0x10f)]&&{'workflow':_0x2932fa[_0x41c770(0x10f)][_0x41c770(0xb3)]},..._0x2932fa[_0x41c770(0x123)]&&{'session_id':_0x2932fa[_0x41c770(0x123)]},..._0x2932fa[_0x41c770(0xf1)]&&{'session_time':_0x2932fa[_0x41c770(0xf1)]},..._0x2932fa[_0x41c770(0xa2)]&&{'retry_attempt':_0x2932fa[_0x41c770(0xa2)]},..._0x58c0e2!==undefined&&{'duration_sec':_0x58c0e2},..._0x2932fa[_0x41c770(0xd6)]&&{'created_at':_0x2932fa[_0x41c770(0xd6)]},..._0x2932fa[_0x41c770(0xda)]&&{'finished_at':_0x2932fa[_0x41c770(0xda)]},...Object[_0x41c770(0x82)](_0x2932fa[_0x41c770(0xe8)])[_0x41c770(0x118)]>0x0&&{'params':_0x2932fa[_0x41c770(0xe8)]}};return await handleSingleObjectOutput(_0x3dddb3,_0x55d90b),0x0;}catch(_0x55c629){if(_0x55c629 instanceof SDKError)return console[_0x41c770(0xdf)]('Error:\x20'+_0x55c629[_0x41c770(0x8c)]),_0x55c629[_0x41c770(0xbf)]&&console['error']('\x20\x20Cause:\x20'+_0x55c629[_0x41c770(0xbf)]),0x1;throw _0x55c629;}}}export class WorkflowTasksCommand extends BaseCommand{['name']='workflow:tasks';[a44_0x16383b(0xde)]=a44_0x16383b(0xef);async[a44_0x16383b(0x121)](_0x4457dc){const _0x49ee9e=a44_0x16383b,{options:_0x3734a3,args:_0x34ee58,tdx:_0x4c30a3}=_0x4457dc,_0x354d24=_0x34ee58[0x0];if(!_0x354d24)return console[_0x49ee9e(0xdf)](_0x49ee9e(0xa7)),0x1;try{const _0x3504b8=_0x3734a3[_0x49ee9e(0x11a)];_0x3734a3['verbose']&&(console[_0x49ee9e(0xdf)]('Attempt\x20ID:\x20'+_0x354d24),_0x3504b8&&console[_0x49ee9e(0xdf)](_0x49ee9e(0x9b)));const _0x57d41c=await withSpinner(_0x49ee9e(0xb5),()=>_0x4c30a3['workflow']['tasks'](_0x354d24,_0x3504b8||![]),{'verbose':_0x3734a3['verbose']}),_0x24bc0a=_0x57d41c[_0x49ee9e(0xb7)];return console[_0x49ee9e(0xdf)](_0x49ee9e(0xbd)+_0x24bc0a[_0x49ee9e(0x118)]+_0x49ee9e(0xb4)+(_0x24bc0a[_0x49ee9e(0x118)]!==0x1?'s':'')),await handleSDKOutput(_0x24bc0a,_0x3734a3),0x0;}catch(_0x5c1d28){if(_0x5c1d28 instanceof SDKError)return console[_0x49ee9e(0xdf)](_0x49ee9e(0xf4)+_0x5c1d28[_0x49ee9e(0x8c)]),_0x5c1d28[_0x49ee9e(0xbf)]&&console['error'](_0x49ee9e(0xb1)+_0x5c1d28[_0x49ee9e(0xbf)]),0x1;throw _0x5c1d28;}}}export class WorkflowLogsCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x115);['description']=a44_0x16383b(0x11f);async[a44_0x16383b(0x121)](_0x53e90d){const _0x2df433=a44_0x16383b,{options:_0x46b1c6,args:_0x132e90,tdx:_0x3c5cce}=_0x53e90d,_0x50187b=_0x132e90[0x0];let _0xcbaaa6=_0x132e90[0x1];if(!_0x50187b)return console[_0x2df433(0xdf)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x46b1c6['verbose']&&(console['error']('Attempt\x20ID:\x20'+_0x50187b),_0xcbaaa6&&console['error'](_0x2df433(0xe9)+_0xcbaaa6));const _0x2eb8dd=await withSpinner('Fetching\x20log\x20files...',()=>_0x3c5cce[_0x2df433(0x10f)]['logFiles'](_0x50187b,_0xcbaaa6),{'verbose':_0x46b1c6[_0x2df433(0x10d)]}),_0x1ed0ee=_0x2eb8dd['data'];if(_0x1ed0ee[_0x2df433(0x118)]===0x0)return console[_0x2df433(0xdf)](_0x2df433(0x11d)),0x0;if(!_0xcbaaa6&&(_0x46b1c6[_0x2df433(0xa8)]||_0x46b1c6[_0x2df433(0xd8)]))return await handleSDKOutput(_0x1ed0ee,_0x46b1c6),0x0;if(!_0xcbaaa6){const _0x41c615=_0x1ed0ee[_0x2df433(0xe7)](_0x54608d=>({'title':_0x54608d[_0x2df433(0xfb)]+'\x20('+formatBytes(_0x54608d[_0x2df433(0xa6)])+')','value':_0x54608d['taskName']})),_0x4ea3a8=await a44_0x210539({'type':_0x2df433(0x88),'name':'task','message':'Select\x20a\x20task\x20to\x20view\x20logs:','choices':_0x41c615});if(!_0x4ea3a8[_0x2df433(0xbe)])return console[_0x2df433(0xdf)]('Cancelled'),0x0;_0xcbaaa6=_0x4ea3a8[_0x2df433(0xbe)];}const _0x1cc2f8=await withSpinner('Downloading\x20logs...',()=>_0x3c5cce[_0x2df433(0x10f)][_0x2df433(0xc5)](_0x50187b,_0xcbaaa6),{'verbose':_0x46b1c6[_0x2df433(0x10d)]}),_0x47d34b=_0x1cc2f8[_0x2df433(0xb7)];return _0x47d34b?console[_0x2df433(0x95)](_0x47d34b):console[_0x2df433(0xdf)](_0x2df433(0xe6)),0x0;}catch(_0x17ba09){if(_0x17ba09 instanceof SDKError)return console[_0x2df433(0xdf)](_0x2df433(0xf4)+_0x17ba09[_0x2df433(0x8c)]),_0x17ba09['cause']&&console['error'](_0x2df433(0xb1)+_0x17ba09['cause']),0x1;throw _0x17ba09;}}}export class WorkflowKillCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x8d);['description']=a44_0x16383b(0xe1);async[a44_0x16383b(0x121)](_0x54c24d){const _0x240e34=a44_0x16383b,{options:_0x566222,args:_0x40b127,tdx:_0x4d8465}=_0x54c24d,_0x544350=_0x40b127[0x0];if(!_0x544350)return console[_0x240e34(0xdf)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x13a890=_0x566222[_0x240e34(0xd0)];_0x566222[_0x240e34(0x10d)]&&(console[_0x240e34(0xdf)](_0x240e34(0xff)+_0x544350),_0x13a890&&console['error'](_0x240e34(0x106)+_0x13a890));if(!_0x566222[_0x240e34(0xf8)]){const _0x189b2e=await confirm(_0x240e34(0xb9)+_0x544350+'?');if(!_0x189b2e)return console['error']('Cancelled'),0x0;}const _0x11a16f=await withSpinner('Killing\x20attempt...',()=>_0x4d8465['workflow'][_0x240e34(0x91)](_0x544350,_0x13a890),{'verbose':_0x566222[_0x240e34(0x10d)]}),_0x5f20ae=_0x11a16f[_0x240e34(0xb7)];return console[_0x240e34(0xdf)]('✔\x20'+_0x5f20ae),0x0;}catch(_0x5b94c4){if(_0x5b94c4 instanceof SDKError)return console['error'](_0x240e34(0xf4)+_0x5b94c4[_0x240e34(0x8c)]),_0x5b94c4[_0x240e34(0xbf)]&&console[_0x240e34(0xdf)](_0x240e34(0xb1)+_0x5b94c4[_0x240e34(0xbf)]),0x1;throw _0x5b94c4;}}}export class WorkflowRetryCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x101);[a44_0x16383b(0xde)]=a44_0x16383b(0x90);async[a44_0x16383b(0x121)](_0x30679b){const _0x16589e=a44_0x16383b,{options:_0x3ae809,args:_0x5e6450,tdx:_0x141df6}=_0x30679b,_0x17fd86=_0x5e6450[0x0];if(!_0x17fd86)return console[_0x16589e(0xdf)](_0x16589e(0xe0)),console[_0x16589e(0xdf)](_0x16589e(0xc6)),0x1;let _0x341955=![],_0x541a41=_0x17fd86;if(_0x17fd86[_0x16589e(0x110)](_0x16589e(0x114)))_0x341955=!![],_0x541a41=_0x17fd86[_0x16589e(0xba)](0x8);else{if(_0x17fd86['startsWith'](_0x16589e(0xfe)))_0x341955=![],_0x541a41=_0x17fd86[_0x16589e(0xba)](0x8);else return console[_0x16589e(0xdf)]('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x16589e(0xdf)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;}try{const _0x11cc20=_0x3ae809['fromTask'],_0x4418ca=_0x3ae809['resumeFrom'],_0x1b2402=_0x3ae809['params'],_0x312ac3=_0x3ae809[_0x16589e(0x84)];_0x3ae809['verbose']&&(console[_0x16589e(0xdf)](_0x16589e(0x81)+(_0x341955?_0x16589e(0x125):'attempt')+'\x20'+_0x541a41),_0x11cc20&&console[_0x16589e(0xdf)](_0x16589e(0xe5)+_0x11cc20),_0x4418ca&&console[_0x16589e(0xdf)](_0x16589e(0xce)+_0x4418ca),_0x1b2402&&console[_0x16589e(0xdf)]('Params:\x20'+_0x1b2402),_0x312ac3&&console['error']('Force:\x20yes'));let _0x1a60e9;if(_0x1b2402)try{if(_0x1b2402[_0x16589e(0x110)]('@')){const _0xb395ff=await import(_0x16589e(0x100)),_0x1919eb=_0x1b2402[_0x16589e(0xba)](0x1),_0x2ab894=await _0xb395ff[_0x16589e(0x80)](_0x1919eb,_0x16589e(0xd9));_0x1a60e9=JSON[_0x16589e(0x9f)](_0x2ab894);}else _0x1a60e9=JSON['parse'](_0x1b2402);}catch{return console[_0x16589e(0xdf)](_0x16589e(0x89)),0x1;}if(!_0x3ae809[_0x16589e(0xf8)]){const _0x418eec=await confirm(_0x16589e(0xd4)+(_0x341955?_0x16589e(0x125):_0x16589e(0xcb))+'\x20'+_0x541a41+'?');if(!_0x418eec)return console[_0x16589e(0xdf)]('Cancelled'),0x0;}let _0x2c5cfc;_0x341955?_0x2c5cfc=await withSpinner(_0x16589e(0xeb),()=>_0x141df6[_0x16589e(0x10f)][_0x16589e(0x11e)](_0x541a41,{'fromTask':_0x11cc20,'retryParams':_0x1a60e9}),{'verbose':_0x3ae809['verbose']}):_0x2c5cfc=await withSpinner('Retrying\x20attempt...',()=>_0x141df6[_0x16589e(0x10f)][_0x16589e(0xee)](_0x541a41,{'resumeFrom':_0x4418ca,'retryParams':_0x1a60e9,'force':_0x312ac3}),{'verbose':_0x3ae809[_0x16589e(0x10d)]});const _0x462d46=_0x2c5cfc[_0x16589e(0xb7)];return console[_0x16589e(0xdf)](_0x16589e(0xed)),console[_0x16589e(0xdf)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x462d46[_0x16589e(0xdb)]),console['error'](_0x16589e(0x86)+_0x462d46[_0x16589e(0x123)]),0x0;}catch(_0xac485e){if(_0xac485e instanceof SDKError)return console[_0x16589e(0xdf)](_0x16589e(0xf4)+_0xac485e['message']),_0xac485e['cause']&&console['error']('\x20\x20Cause:\x20'+_0xac485e[_0x16589e(0xbf)]),0x1;throw _0xac485e;}}}function a44_0x3f12(_0x5d86a1,_0xc2ecc0){_0x5d86a1=_0x5d86a1-0x80;const _0x5e5da7=a44_0x5e5d();let _0x3f1251=_0x5e5da7[_0x5d86a1];return _0x3f1251;}export class WorkflowRunCommand extends BaseCommand{['name']='workflow:run';[a44_0x16383b(0xde)]=a44_0x16383b(0x116);async[a44_0x16383b(0x121)](_0x43b471){const _0xf2da62=a44_0x16383b,{options:_0x20b7cc,args:_0x49a86e,tdx:_0x3739f5}=_0x43b471,_0x12fbe2=_0x49a86e[0x0];if(!_0x12fbe2)return console[_0xf2da62(0xdf)](_0xf2da62(0xc3)),console[_0xf2da62(0xdf)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0x2b27e9=_0x20b7cc[_0xf2da62(0xec)],_0x3c22b2=_0x20b7cc['sessionTime'],_0x4ac0e3={};if(_0x2b27e9&&Array[_0xf2da62(0xd3)](_0x2b27e9))for(const _0x3d11be of _0x2b27e9){const _0x2604cf=_0x3d11be['indexOf']('=');if(_0x2604cf===-0x1)return console[_0xf2da62(0xdf)](_0xf2da62(0x92)+_0x3d11be),console[_0xf2da62(0xdf)](_0xf2da62(0x103)),0x1;const _0x2566c2=_0x3d11be[_0xf2da62(0xba)](0x0,_0x2604cf),_0x18247f=_0x3d11be[_0xf2da62(0xba)](_0x2604cf+0x1);try{_0x4ac0e3[_0x2566c2]=JSON[_0xf2da62(0x9f)](_0x18247f);}catch{_0x4ac0e3[_0x2566c2]=_0x18247f;}}_0x20b7cc['verbose']&&(console['error']('Workflow:\x20'+_0x12fbe2),Object[_0xf2da62(0x82)](_0x4ac0e3)[_0xf2da62(0x118)]>0x0&&console[_0xf2da62(0xdf)](_0xf2da62(0x113)+JSON[_0xf2da62(0x94)](_0x4ac0e3)),_0x3c22b2&&console[_0xf2da62(0xdf)](_0xf2da62(0xa5)+_0x3c22b2));const _0x3a4ae1=await withSpinner(_0xf2da62(0x117),()=>_0x3739f5[_0xf2da62(0x10f)]['run'](_0x12fbe2,_0x4ac0e3,{'sessionTime':_0x3c22b2}),{'verbose':_0x20b7cc['verbose']}),_0x46340c=_0x3a4ae1['data'];return console['error']('✔\x20Workflow\x20run\x20started'),console[_0xf2da62(0xdf)](_0xf2da62(0x8a)+_0x46340c['id']),console['error'](_0xf2da62(0x86)+_0x46340c[_0xf2da62(0x123)]),console[_0xf2da62(0xdf)]('\x20\x20Project:\x20'+_0x46340c[_0xf2da62(0xc4)]?.[_0xf2da62(0xb3)]),console['error'](_0xf2da62(0x108)+_0x46340c[_0xf2da62(0x10f)]?.[_0xf2da62(0xb3)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']='workflow:download';[a44_0x16383b(0xde)]=a44_0x16383b(0xcf);async[a44_0x16383b(0x121)](_0x5525a7){const _0x2e9b9c=a44_0x16383b,{options:_0x7d48dc,args:_0x2cf29e,tdx:_0x401a5e}=_0x5525a7,_0x47dcf2=_0x2cf29e[0x0],_0x2129b3=_0x2cf29e[0x1]||'.';if(!_0x47dcf2)return console[_0x2e9b9c(0xdf)](_0x2e9b9c(0x98)),console[_0x2e9b9c(0xdf)](_0x2e9b9c(0xe4)),0x1;const _0x5dbd3a=_0x7d48dc['revision'];_0x7d48dc[_0x2e9b9c(0x10d)]&&(console[_0x2e9b9c(0xdf)](_0x2e9b9c(0xa4)+_0x47dcf2),console['error']('Output\x20directory:\x20'+_0x2129b3),_0x5dbd3a&&console['error'](_0x2e9b9c(0x11c)+_0x5dbd3a));const _0x22c702=await withSpinner('Downloading\x20project\x20'+_0x47dcf2+_0x2e9b9c(0x93),()=>_0x401a5e['workflow'][_0x2e9b9c(0x109)](_0x47dcf2,_0x2129b3,{'revision':_0x5dbd3a}),{'verbose':_0x7d48dc[_0x2e9b9c(0x10d)]}),_0x26d570=_0x22c702[_0x2e9b9c(0xb7)];return console['error'](_0x2e9b9c(0xc2)+_0x26d570[_0x2e9b9c(0xab)]),console[_0x2e9b9c(0xdf)](_0x2e9b9c(0x99)+_0x26d570['revision']),console[_0x2e9b9c(0xdf)]('\x20\x20Files\x20extracted:\x20'+_0x26d570[_0x2e9b9c(0xfd)]),console[_0x2e9b9c(0xdf)](_0x2e9b9c(0xf0)+_0x2129b3+'/'+_0x26d570[_0x2e9b9c(0xab)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']=a44_0x16383b(0xea);[a44_0x16383b(0xde)]=a44_0x16383b(0x9e);async[a44_0x16383b(0x121)](_0x667f53){const _0x4b5a8b=a44_0x16383b,{options:_0x1f876b,args:_0x45cac5,tdx:_0x593855}=_0x667f53;let _0x5ca53b='.',_0x5a8a5a=_0x1f876b[_0x4b5a8b(0xb3)];if(_0x45cac5[0x0]){const {promises:_0x1773f8}=await import('fs');try{const _0x2ea449=await _0x1773f8[_0x4b5a8b(0xae)](_0x45cac5[0x0]);if(_0x2ea449['isDirectory']())_0x5ca53b=_0x45cac5[0x0];else return console[_0x4b5a8b(0xdf)]('Error:\x20'+_0x45cac5[0x0]+_0x4b5a8b(0xa9)),0x1;}catch{_0x5a8a5a=_0x45cac5[0x0],_0x5ca53b='.';}}const _0x51bd47=_0x1f876b['revision'],_0x487e11=_0x1f876b[_0x4b5a8b(0xfa)];_0x1f876b['verbose']&&(console[_0x4b5a8b(0xdf)](_0x4b5a8b(0xdd)+_0x5ca53b),_0x5a8a5a&&console[_0x4b5a8b(0xdf)]('Project\x20name:\x20'+_0x5a8a5a),_0x51bd47&&console[_0x4b5a8b(0xdf)](_0x4b5a8b(0x11c)+_0x51bd47),_0x487e11&&console[_0x4b5a8b(0xdf)](_0x4b5a8b(0x10a)));const _0xfcbec=await withSpinner(_0x4b5a8b(0xbc),()=>_0x593855['workflow']['push'](_0x5ca53b,{'projectName':_0x5a8a5a,'revision':_0x51bd47,'skipValidation':_0x487e11}),{'verbose':_0x1f876b['verbose']}),_0x995a01=_0xfcbec[_0x4b5a8b(0xb7)];return console[_0x4b5a8b(0xdf)](_0x4b5a8b(0x102)+_0x995a01[_0x4b5a8b(0xab)]),console[_0x4b5a8b(0xdf)](_0x4b5a8b(0x9d)+_0x995a01[_0x4b5a8b(0xaa)]),console['error'](_0x4b5a8b(0x99)+_0x995a01[_0x4b5a8b(0xc0)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x9c);[a44_0x16383b(0xde)]=a44_0x16383b(0xcd);async[a44_0x16383b(0x121)](_0x38d1ef){const _0x4338cb=a44_0x16383b,{options:_0x254838,args:_0x592624,tdx:_0x5b2de8}=_0x38d1ef,_0x5cdc1c=_0x592624[0x0];if(!_0x5cdc1c)return console[_0x4338cb(0xdf)](_0x4338cb(0x97)),console[_0x4338cb(0xdf)](_0x4338cb(0x8b)),0x1;_0x254838[_0x4338cb(0x10d)]&&console['error'](_0x4338cb(0xa4)+_0x5cdc1c);if(!_0x254838[_0x4338cb(0xf8)]){const _0x2ffe1c=await confirm(_0x4338cb(0x9a)+_0x5cdc1c+_0x4338cb(0x8e));if(!_0x2ffe1c)return console['error']('Cancelled'),0x0;}const _0x43defc=await withSpinner(_0x4338cb(0xf3)+_0x5cdc1c+'...',()=>_0x5b2de8[_0x4338cb(0x10f)][_0x4338cb(0xc7)](_0x5cdc1c),{'verbose':_0x254838[_0x4338cb(0x10d)]}),_0x523887=_0x43defc[_0x4338cb(0xb7)];return console[_0x4338cb(0xdf)](_0x4338cb(0x119)+_0x523887[_0x4338cb(0xab)]),console['error'](_0x4338cb(0x9d)+_0x523887[_0x4338cb(0xaa)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x503778,_0x44804b){const _0xdd5eef=a45_0x4c30,_0x278333=_0x503778();while(!![]){try{const _0x5e8b31=parseInt(_0xdd5eef(0x149))/0x1+-parseInt(_0xdd5eef(0x13f))/0x2+parseInt(_0xdd5eef(0x14a))/0x3*(-parseInt(_0xdd5eef(0x150))/0x4)+parseInt(_0xdd5eef(0x143))/0x5*(-parseInt(_0xdd5eef(0x14d))/0x6)+-parseInt(_0xdd5eef(0x142))/0x7+-parseInt(_0xdd5eef(0x141))/0x8+parseInt(_0xdd5eef(0x14e))/0x9;if(_0x5e8b31===_0x44804b)break;else _0x278333['push'](_0x278333['shift']());}catch(_0x3d322d){_0x278333['push'](_0x278333['shift']());}}}(a45_0x149a,0xac936));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';function a45_0x4c30(_0x428462,_0x4a0a4c){_0x428462=_0x428462-0x13d;const _0x149aaa=a45_0x149a();let _0x4c309e=_0x149aaa[_0x428462];return _0x4c309e;}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x2c3f5c=a45_0x4c30;try{const _0xafb4f9=fileURLToPath(import.meta.url),_0x1a53de=dirname(_0xafb4f9),_0x20146d=join(_0x1a53de,_0x2c3f5c(0x145)),_0x39adff=JSON[_0x2c3f5c(0x148)](readFileSync(_0x20146d,_0x2c3f5c(0x147)));return _0x39adff[_0x2c3f5c(0x144)];}catch{return _0x2c3f5c(0x14f);}}export function getUserAgent(){const _0x5f35be=a45_0x4c30,_0x27be85=getVersion(),_0x56ce82=platform(),_0x23592a=process[_0x5f35be(0x144)][_0x5f35be(0x13e)]('v','');return _0x5f35be(0x14b)+_0x27be85+'\x20('+_0x56ce82+_0x5f35be(0x140)+_0x23592a+')';}export function getAuthHeaders(_0x527423,_0x6d5b47){const _0x3f5d62=a45_0x4c30,_0xd933d9=getVersion(),_0x44b7af={'User-Agent':getUserAgent(),'X-TD-Client':_0x3f5d62(0x151),'X-TD-Client-Version':_0xd933d9};return _0x6d5b47&&(_0x44b7af[_0x3f5d62(0x14c)]='TD1\x20'+_0x6d5b47),_0x44b7af;}export function toHeaderRecord(_0x5344c8){const _0xfcd8ac=a45_0x4c30,_0x2a5a70={};for(const [_0x36c676,_0x5c4aa3]of Object[_0xfcd8ac(0x146)](_0x5344c8)){_0x5c4aa3!==undefined&&(_0x2a5a70[_0x36c676]=_0x5c4aa3);}return _0x2a5a70;}export function getTrinoHeaders(_0x1fe294,_0x468e4a){const _0x3ff48a=a45_0x4c30,_0x16dbb1=getAuthHeaders(_0x1fe294,_0x468e4a),_0x512646=toHeaderRecord(_0x16dbb1);return delete _0x512646[_0x3ff48a(0x14c)],_0x468e4a&&(_0x512646[_0x3ff48a(0x13d)]=_0x468e4a),_0x512646;}function a45_0x149a(){const _0x239e40=['683932tUFgFZ','tdx','X-Trino-User','replace','2256336joJggY',';\x20node/','2929600rEHcFJ','1773975CfFgqL','5MJgaRj','version','../../package.json','entries','utf-8','parse','918367YHkxeG','9BVtZcE','tdx/','Authorization','1685874qMYpFk','20972016oDsXAJ','0.0.0'];a45_0x149a=function(){return _0x239e40;};return a45_0x149a();}export function hasAPIKey(_0x369f15){const _0x6ebd1a=getAPIKey(_0x369f15);return _0x6ebd1a!==undefined&&_0x6ebd1a['length']>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x24938e,_0x6434b2){const _0x216a23=a46_0xab65,_0x31ea4d=_0x24938e();while(!![]){try{const _0x49af49=-parseInt(_0x216a23(0xea))/0x1+-parseInt(_0x216a23(0xf6))/0x2*(parseInt(_0x216a23(0x107))/0x3)+-parseInt(_0x216a23(0xc9))/0x4+-parseInt(_0x216a23(0xc5))/0x5+-parseInt(_0x216a23(0xfc))/0x6+parseInt(_0x216a23(0xca))/0x7*(parseInt(_0x216a23(0xfb))/0x8)+-parseInt(_0x216a23(0xe9))/0x9*(-parseInt(_0x216a23(0xc4))/0xa);if(_0x49af49===_0x6434b2)break;else _0x31ea4d['push'](_0x31ea4d['shift']());}catch(_0x4545ac){_0x31ea4d['push'](_0x31ea4d['shift']());}}}(a46_0x5c57,0xe8cf6));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x43163b from'node:fs';import*as a46_0x36b25d from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';function a46_0x5c57(){const _0x569fb4=['env','account_info.json','some','trim','replace','28085830pCexMa','2867670bGCVgL','ap02','readFileSync','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','2877836CFHmXq','10563QAbAns','split','TD_API_KEY_','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','legacy\x20.env\x20file\x20(profile:\x20','keychain\x20(profile:\x20','keychain','toISOString','warn','toUpperCase','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','filter','entries','parse','account_info.','apiKey','join','.env','site','profiles','eu01','dev-us01','.env.','yellow','match','\x20env\x20var','slice','map','llm_default_project.','Warning:\x20Failed\x20to\x20load\x20','profile','9iAVoqS','1009189AIHsRq','llm_default_agent','us01','TDX_API_KEY','stg-jp01','startsWith','jp01','includes','ap03','TDX_CONFIG_DIR','projectId','Warning:\x20Unknown\x20site\x20\x27','1250xKkbPw','tdx','llm_default_project','stg-ap03','stringify','7808buJMHi','2354820xFoDjC','.cache','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','source','Warning:\x20Failed\x20to\x20read\x20','stg-us01','endsWith','TD_API_KEY','tdx.json','TDX_API_KEY_','utf-8','3039IuJbYp','llm_default_agent.','\x27,\x20defaulting\x20to\x20us01','string','existsSync','legacy\x20.env\x20file','isDeprecated','.json','number'];a46_0x5c57=function(){return _0x569fb4;};return a46_0x5c57();}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a46_0x517804 from'chalk';export function getConfigDir(){const _0x98f778=a46_0xab65;return process[_0x98f778(0xbf)][_0x98f778(0xf3)]||join(homedir(),'.config','tdx');}export function getConfigFile(){const _0x53c0dc=a46_0xab65;return join(getConfigDir(),_0x53c0dc(0xdb));}export function getConfigFilePath(_0x5b5ec3){const _0x304b65=a46_0xab65,_0x5cc7f5=getConfigDir();return _0x5b5ec3?a46_0x36b25d[_0x304b65(0xda)](_0x5cc7f5,_0x304b65(0xe0)+_0x5b5ec3):getConfigFile();}export function getCacheDir(){const _0x3eb4ca=a46_0xab65;return process['env']['TDX_CACHE_DIR']||join(homedir(),_0x3eb4ca(0xfd),_0x3eb4ca(0xf7));}export function getLLMProjectCacheFile(_0x1ea230){const _0x2beae2=a46_0xab65,_0x550a0b=_0x1ea230?_0x2beae2(0xe6)+_0x1ea230:_0x2beae2(0xf8);return join(getCacheDir(),_0x550a0b);}export function readCachedLLMProject(_0x2346f6){const _0x23b47d=a46_0xab65;try{const _0x56ec6c=getLLMProjectCacheFile(_0x2346f6);if(!existsSync(_0x56ec6c))return null;const _0x3b2833=readFileSync(_0x56ec6c,'utf-8')['trim']();try{const _0x48bb49=JSON['parse'](_0x3b2833);if(_0x48bb49&&typeof _0x48bb49['id']===_0x23b47d(0x10a)&&typeof _0x48bb49['name']==='string')return _0x48bb49;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x596c10,_0x514dd0,_0x52a4ff){const _0x22a743=a46_0xab65;try{const _0x4e986c=getCacheDir(),_0x2e3893=getLLMProjectCacheFile(_0x52a4ff);!existsSync(_0x4e986c)&&mkdirSync(_0x4e986c,{'recursive':!![]});const _0x5d9d82={'name':_0x596c10,'id':_0x514dd0};writeFileSync(_0x2e3893,JSON[_0x22a743(0xfa)](_0x5d9d82),_0x22a743(0x106));}catch{}}export function getLLMAgentCacheFile(_0x3e2065){const _0x23736b=a46_0xab65,_0xa024b2=_0x3e2065?_0x23736b(0x108)+_0x3e2065:_0x23736b(0xeb);return join(getCacheDir(),_0xa024b2);}export function readCachedLLMAgent(_0x55cf1f){const _0x4164f8=a46_0xab65;try{const _0x260d23=getLLMAgentCacheFile(_0x55cf1f);if(!existsSync(_0x260d23))return null;const _0x2a5ec1=readFileSync(_0x260d23,'utf-8')[_0x4164f8(0xc2)]();try{const _0x2b8205=JSON[_0x4164f8(0xd7)](_0x2a5ec1);if(_0x2b8205&&typeof _0x2b8205['id']==='string'&&typeof _0x2b8205['name']===_0x4164f8(0x10a)&&typeof _0x2b8205[_0x4164f8(0xf4)]===_0x4164f8(0x10a))return _0x2b8205;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x4de545,_0x21c4f6,_0x5eb5a8,_0x14fa85){const _0x152e78=a46_0xab65;try{const _0x1057c4=getCacheDir(),_0x4ce514=getLLMAgentCacheFile(_0x14fa85);!existsSync(_0x1057c4)&&mkdirSync(_0x1057c4,{'recursive':!![]});const _0xa40750={'name':_0x4de545,'id':_0x21c4f6,'projectId':_0x5eb5a8};writeFileSync(_0x4ce514,JSON['stringify'](_0xa40750),_0x152e78(0x106));}catch{}}export function clearCachedLLMAgent(_0x5c8d55){try{const _0x1c7a8e=getLLMAgentCacheFile(_0x5c8d55);existsSync(_0x1c7a8e)&&unlinkSync(_0x1c7a8e);}catch{}}export function getAccountInfoCacheFile(_0x405ae9){const _0xb5a210=a46_0xab65,_0x52baa8=_0x405ae9?_0xb5a210(0xd8)+_0x405ae9+_0xb5a210(0x10e):_0xb5a210(0xc0);return join(getCacheDir(),_0x52baa8);}export function readCachedAccountInfo(_0x73c302){const _0x2109ee=a46_0xab65;try{const _0xc26e2d=getAccountInfoCacheFile(_0x73c302);if(!existsSync(_0xc26e2d))return null;const _0x511712=readFileSync(_0xc26e2d,'utf-8')[_0x2109ee(0xc2)](),_0x5b866a=JSON[_0x2109ee(0xd7)](_0x511712);if(_0x5b866a&&typeof _0x5b866a[_0x2109ee(0xdc)]===_0x2109ee(0x10a)&&typeof _0x5b866a['accountId']===_0x2109ee(0x10f))return _0x5b866a;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x3e4de5,_0x254cd3,_0x4bf2d5){const _0x4c413f=a46_0xab65;try{const _0x59e5b9=getCacheDir(),_0x25e1b8=getAccountInfoCacheFile(_0x4bf2d5);!existsSync(_0x59e5b9)&&mkdirSync(_0x59e5b9,{'recursive':!![]});const _0xfdbc1a={'site':_0x3e4de5,'accountId':_0x254cd3,'cachedAt':new Date()[_0x4c413f(0xd1)]()};writeFileSync(_0x25e1b8,JSON[_0x4c413f(0xfa)](_0xfdbc1a),'utf-8');}catch{}}export function parseEnvFile(_0x5dfdf8){const _0x44654d=a46_0xab65,_0x1da87f={};for(const _0x22efb8 of _0x5dfdf8['split']('\x0a')){const _0x3e3828=_0x22efb8[_0x44654d(0xc2)]();if(!_0x3e3828||_0x3e3828['startsWith']('#'))continue;const _0x62d246=_0x3e3828[_0x44654d(0xe2)](/^([^=]+)=(.*)$/);if(_0x62d246){const _0x3c1563=_0x62d246[0x1][_0x44654d(0xc2)]();let _0x3a8af4=_0x62d246[0x2]['trim']();(_0x3a8af4[_0x44654d(0xef)]('\x22')&&_0x3a8af4['endsWith']('\x22')||_0x3a8af4['startsWith']('\x27')&&_0x3a8af4[_0x44654d(0x102)]('\x27'))&&(_0x3a8af4=_0x3a8af4[_0x44654d(0xe4)](0x1,-0x1)),_0x1da87f[_0x3c1563]=_0x3a8af4;}}return _0x1da87f;}export function readUserConfig(){const _0x1f3d04=a46_0xab65,_0x459fff=getConfigFile();if(!existsSync(_0x459fff))return{};try{const _0x361799=readFileSync(_0x459fff,'utf-8');return parseEnvFile(_0x361799);}catch(_0x52a46d){return console[_0x1f3d04(0xd2)](_0x1f3d04(0xc8)+_0x459fff+':',_0x52a46d),{};}}export function resolveSite(_0x585389){const _0x34ff85=a46_0xab65,_0x58a309=[_0x34ff85(0xec),_0x34ff85(0xf0),_0x34ff85(0xde),_0x34ff85(0xc6),_0x34ff85(0xf2),_0x34ff85(0xdf),'dev-eu01',_0x34ff85(0x101),_0x34ff85(0xee),'stg-ap03'];if(_0x58a309[_0x34ff85(0xf1)](_0x585389))return _0x585389;if(_0x585389 in SITE_ALIASES)return SITE_ALIASES[_0x585389];return console[_0x34ff85(0xd2)](_0x34ff85(0xf5)+_0x585389+_0x34ff85(0x109)),_0x34ff85(0xec);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2f83e8,_0x4ba6a5){const _0x248dcb=a46_0xab65,_0x20d45e=_0x4ba6a5||getActiveProfileName();if(_0x20d45e){const _0x15338b='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x20d45e);if(process['env'][_0x15338b])return process[_0x248dcb(0xbf)][_0x15338b];}if(process[_0x248dcb(0xbf)][_0x248dcb(0xed)])return process['env'][_0x248dcb(0xed)];if(process[_0x248dcb(0xbf)][_0x248dcb(0x103)])return process[_0x248dcb(0xbf)][_0x248dcb(0x103)];const _0x4b2326=_0x2f83e8[_0x248dcb(0xd3)]()[_0x248dcb(0xc3)](/-/g,'_'),_0x498f97=_0x248dcb(0xcc)+_0x4b2326;if(_0x20d45e){const _0x2fc2d8=loadProfileEnv(_0x20d45e);if(_0x2fc2d8){if(_0x2fc2d8[_0x498f97])return _0x2fc2d8[_0x498f97];if(_0x2fc2d8[_0x248dcb(0x103)])return _0x2fc2d8['TD_API_KEY'];}}const _0x437d32=loadUserConfigOnce();if(_0x437d32[_0x498f97])return _0x437d32[_0x498f97];if(_0x437d32[_0x248dcb(0x103)])return _0x437d32[_0x248dcb(0x103)];return undefined;}export function normalizeProfileForEnvVar(_0x23f7c0){const _0x4e1cd8=a46_0xab65;return _0x23f7c0['toUpperCase']()[_0x4e1cd8(0xc3)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x4460a0,_0x49b95d){const _0x449ee7=a46_0xab65,_0x29ccf5=_0x49b95d||getActiveProfileName()||undefined;if(_0x29ccf5){const _0x550816=_0x449ee7(0x105)+normalizeProfileForEnvVar(_0x29ccf5);if(process[_0x449ee7(0xbf)][_0x550816])return{'apiKey':process[_0x449ee7(0xbf)][_0x550816],'source':_0x550816+_0x449ee7(0xe3),'isDeprecated':![]};const _0x346294=getCachedCredential(_0x4460a0,_0x29ccf5);if(_0x346294)return{'apiKey':_0x346294,'source':_0x449ee7(0xcf)+_0x29ccf5+')','isDeprecated':![]};const _0x2bdb4d=await getKeychainAPIKey(_0x29ccf5);if(_0x2bdb4d)return setCachedCredential(_0x2bdb4d,_0x4460a0,_0x29ccf5),{'apiKey':_0x2bdb4d,'source':_0x449ee7(0xcf)+_0x29ccf5+')','isDeprecated':![]};}if(process[_0x449ee7(0xbf)][_0x449ee7(0xed)])return{'apiKey':process[_0x449ee7(0xbf)][_0x449ee7(0xed)],'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x29ccf5){const _0x381523=getCachedCredential(_0x4460a0,undefined);if(_0x381523)return{'apiKey':_0x381523,'source':_0x449ee7(0xd0),'isDeprecated':![]};const _0x393cd3=await getKeychainAPIKey(undefined);if(_0x393cd3)return setCachedCredential(_0x393cd3,_0x4460a0,undefined),{'apiKey':_0x393cd3,'source':_0x449ee7(0xd0),'isDeprecated':![]};}if(process[_0x449ee7(0xbf)]['TD_API_KEY'])return{'apiKey':process[_0x449ee7(0xbf)][_0x449ee7(0x103)],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x35013c=getLegacyEnvAPIKey(_0x4460a0,_0x29ccf5);if(_0x35013c){const _0xe5274e=await isKeychainAvailable();if(_0xe5274e)try{await saveKeychainAPIKey(_0x35013c,_0x29ccf5),setCachedCredential(_0x35013c,_0x4460a0,_0x29ccf5);const _0x57253f=getConfigFilePath(_0x29ccf5);cleanupLegacyEnvFile(_0x57253f)&&console[_0x449ee7(0xd2)](a46_0x517804[_0x449ee7(0xe1)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x5dd7db){console[_0x449ee7(0xd2)](a46_0x517804[_0x449ee7(0xe1)](_0x449ee7(0xcd)+_0x5dd7db));}const _0x402f2a=_0x29ccf5?_0x449ee7(0xce)+_0x29ccf5+')':_0x449ee7(0x10c);return{'apiKey':_0x35013c,'source':_0x402f2a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x558591,_0x1313ab,_0x48a576=!![]){const _0x3e6448=a46_0xab65,_0x43cde9=await resolveAPIKeyAsync(_0x558591,_0x1313ab);if(!_0x43cde9)return undefined;if(_0x48a576&&_0x43cde9[_0x3e6448(0x10d)]&&_0x43cde9[_0x3e6448(0xff)][_0x3e6448(0xf1)]('TD_API_KEY')){const _0x3862ec=_0x1313ab||getActiveProfileName()||undefined,_0x54647b=_0x3862ec?_0x3e6448(0x105)+normalizeProfileForEnvVar(_0x3862ec):'TDX_API_KEY_<PROFILE>';console[_0x3e6448(0xd2)](a46_0x517804[_0x3e6448(0xe1)](_0x3e6448(0xfe)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x54647b+').')));}return _0x43cde9[_0x3e6448(0xd9)];}function getLegacyEnvAPIKey(_0x4ca193,_0x4a122e){const _0x435f3a=a46_0xab65,_0x3d211c=_0x4ca193['toUpperCase']()[_0x435f3a(0xc3)](/-/g,'_'),_0xffe9e0='TD_API_KEY_'+_0x3d211c;if(_0x4a122e){const _0x387814=loadProfileEnv(_0x4a122e);if(_0x387814){if(_0x387814[_0xffe9e0])return _0x387814[_0xffe9e0];if(_0x387814['TD_API_KEY'])return _0x387814['TD_API_KEY'];}}const _0x3eebd3=loadUserConfigOnce();if(_0x3eebd3[_0xffe9e0])return _0x3eebd3[_0xffe9e0];if(_0x3eebd3[_0x435f3a(0x103)])return _0x3eebd3[_0x435f3a(0x103)];return undefined;}function cleanupLegacyEnvFile(_0x570d13){const _0x2f2b2f=a46_0xab65;if(!existsSync(_0x570d13))return![];try{const _0x31b443=readFileSync(_0x570d13,_0x2f2b2f(0x106)),_0x470d3f=_0x31b443[_0x2f2b2f(0xcb)]('\x0a'),_0x263b1d=_0x470d3f[_0x2f2b2f(0xd5)](_0x54abf9=>{const _0x1004e3=_0x2f2b2f,_0x12ba3e=_0x54abf9['trim']();if(!_0x12ba3e||_0x12ba3e[_0x1004e3(0xef)]('#'))return!![];const [_0x113a0c]=_0x12ba3e[_0x1004e3(0xcb)]('=');return!_0x113a0c['startsWith'](_0x1004e3(0x103));}),_0x315d2d=_0x263b1d[_0x2f2b2f(0xc1)](_0x258de2=>{const _0x2e80f1=_0x2f2b2f,_0x55eb4f=_0x258de2[_0x2e80f1(0xc2)]();return _0x55eb4f&&!_0x55eb4f['startsWith']('#');});if(!_0x315d2d)return unlinkSync(_0x570d13),!![];return writeFileSync(_0x570d13,_0x263b1d['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x503e9b){const _0xa25bbd=a46_0xab65,_0x5790f1=a46_0x36b25d[_0xa25bbd(0xda)](getConfigDir(),_0xa25bbd(0xe0)+_0x503e9b);if(a46_0x43163b['existsSync'](_0x5790f1)){validateSecureFilePermissions(_0x5790f1);try{const _0x18198d=a46_0x43163b[_0xa25bbd(0xc7)](_0x5790f1,_0xa25bbd(0x106));return parseEnvFile(_0x18198d);}catch(_0x20323e){console['warn'](_0xa25bbd(0xe7)+_0x5790f1+':\x20'+_0x20323e);}}const _0x276b71=a46_0x36b25d[_0xa25bbd(0xda)](getConfigDir(),_0xa25bbd(0xdd),_0x503e9b,_0xa25bbd(0xdb));if(a46_0x43163b[_0xa25bbd(0x10b)](_0x276b71)){validateSecureFilePermissions(_0x276b71);try{const _0x3d6018=a46_0x43163b['readFileSync'](_0x276b71,_0xa25bbd(0x106));return parseEnvFile(_0x3d6018);}catch(_0x147fde){return console[_0xa25bbd(0xd2)](_0xa25bbd(0xe7)+_0x276b71+':\x20'+_0x147fde),null;}}return null;}function getActiveProfileName(){const _0x3e0582=a46_0xab65,_0x4c79fa=a46_0x36b25d[_0x3e0582(0xda)](getConfigDir(),_0x3e0582(0x104));if(!a46_0x43163b['existsSync'](_0x4c79fa))return null;try{const _0x23466f=a46_0x43163b['readFileSync'](_0x4c79fa,_0x3e0582(0x106)),_0x5bf7bd=JSON[_0x3e0582(0xd7)](_0x23466f);return _0x5bf7bd[_0x3e0582(0xe8)]||null;}catch{return null;}}export function saveAPIKey(_0x4dcb,_0xe90d77,_0x340d8e){const _0x14ca68=a46_0xab65,_0x30498c=getConfigDir(),_0x1b4db5=getConfigFilePath(_0x340d8e);!existsSync(_0x30498c)&&mkdirSync(_0x30498c,{'recursive':!![],'mode':0x1c0});let _0x3c9605={};if(existsSync(_0x1b4db5))try{const _0x6186e7=readFileSync(_0x1b4db5,'utf-8');_0x3c9605=parseEnvFile(_0x6186e7);}catch(_0xf93c81){console[_0x14ca68(0xd2)](_0x14ca68(0x100)+_0x1b4db5+':',_0xf93c81);}const _0xa53132=_0x4dcb[_0x14ca68(0xd3)]()[_0x14ca68(0xc3)](/-/g,'_');_0x3c9605[_0x14ca68(0xcc)+_0xa53132]=_0xe90d77;const _0x1bca46=Object[_0x14ca68(0xd6)](_0x3c9605)[_0x14ca68(0xe5)](([_0x77cad8,_0x3fa959])=>_0x77cad8+'='+_0x3fa959);writeFileSync(_0x1b4db5,_0x1bca46['join']('\x0a')+'\x0a',{'mode':0x180});}function a46_0xab65(_0x5b18c5,_0x59b94b){_0x5b18c5=_0x5b18c5-0xbf;const _0x5c57bb=a46_0x5c57();let _0xab6555=_0x5c57bb[_0x5b18c5];return _0xab6555;}export async function saveAPIKeyAsync(_0x7631a1,_0x29b015,_0x5edf98){const _0x3dcd4b=a46_0xab65;await saveKeychainAPIKey(_0x7631a1,_0x5edf98),setCachedCredential(_0x7631a1,_0x29b015,_0x5edf98);const _0x16bd0b=getConfigFilePath(_0x5edf98);cleanupLegacyEnvFile(_0x16bd0b)&&console[_0x3dcd4b(0xd2)](a46_0x517804[_0x3dcd4b(0xe1)](_0x3dcd4b(0xd4)));}export function loadConfig(){const _0x5f08f2=a46_0xab65,_0x257491={'apiKeys':{},'defaultSite':_0x5f08f2(0xec)},_0x58a731=[_0x5f08f2(0xec),_0x5f08f2(0xf0),_0x5f08f2(0xde),_0x5f08f2(0xc6),'ap03',_0x5f08f2(0xdf),'dev-eu01',_0x5f08f2(0x101),_0x5f08f2(0xee),_0x5f08f2(0xf9)];for(const _0x43df5e of _0x58a731){const _0x17c652=getAPIKey(_0x43df5e);_0x17c652&&(_0x257491['apiKeys'][_0x43df5e]=_0x17c652);}return _0x257491;}
|
|
1
|
+
(function(_0xd44700,_0x1e2b76){const _0x3d2517=a46_0x455e,_0x3a192e=_0xd44700();while(!![]){try{const _0x10d5f4=-parseInt(_0x3d2517(0x1d6))/0x1*(parseInt(_0x3d2517(0x1eb))/0x2)+-parseInt(_0x3d2517(0x1ee))/0x3+parseInt(_0x3d2517(0x1f1))/0x4*(-parseInt(_0x3d2517(0x1d4))/0x5)+-parseInt(_0x3d2517(0x1cb))/0x6+-parseInt(_0x3d2517(0x1df))/0x7+-parseInt(_0x3d2517(0x1c8))/0x8*(parseInt(_0x3d2517(0x1cf))/0x9)+-parseInt(_0x3d2517(0x1d9))/0xa*(-parseInt(_0x3d2517(0x1d0))/0xb);if(_0x10d5f4===_0x1e2b76)break;else _0x3a192e['push'](_0x3a192e['shift']());}catch(_0x50b168){_0x3a192e['push'](_0x3a192e['shift']());}}}(a46_0x150e,0x6c3cd));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x4b4054 from'node:fs';import*as a46_0x3ba6ea from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a46_0xdb86fc from'chalk';export function getConfigDir(){const _0x505a27=a46_0x455e;return process[_0x505a27(0x1ab)]['TDX_CONFIG_DIR']||join(homedir(),_0x505a27(0x1bd),_0x505a27(0x1b4));}export function getConfigFile(){const _0x26d68a=a46_0x455e;return join(getConfigDir(),_0x26d68a(0x1c4));}export function getConfigFilePath(_0x529418){const _0x210fba=a46_0x455e,_0x56123e=getConfigDir();return _0x529418?a46_0x3ba6ea['join'](_0x56123e,_0x210fba(0x1d8)+_0x529418):getConfigFile();}export function getCacheDir(){const _0x333100=a46_0x455e;return process[_0x333100(0x1ab)]['TDX_CACHE_DIR']||join(homedir(),_0x333100(0x1e3),'tdx');}export function getLLMProjectCacheFile(_0x51dd82){const _0x2cf61c=a46_0x455e,_0xee818e=_0x51dd82?'llm_default_project.'+_0x51dd82:_0x2cf61c(0x1ea);return join(getCacheDir(),_0xee818e);}export function readCachedLLMProject(_0x3430d5){const _0x11acf7=a46_0x455e;try{const _0x4c2c16=getLLMProjectCacheFile(_0x3430d5);if(!existsSync(_0x4c2c16))return null;const _0x22e017=readFileSync(_0x4c2c16,_0x11acf7(0x1cd))['trim']();try{const _0x3ff4f4=JSON[_0x11acf7(0x1e6)](_0x22e017);if(_0x3ff4f4&&typeof _0x3ff4f4['id']===_0x11acf7(0x1ed)&&typeof _0x3ff4f4[_0x11acf7(0x1ac)]===_0x11acf7(0x1ed))return _0x3ff4f4;}catch{}return null;}catch{return null;}}function a46_0x455e(_0x41d9c0,_0x1752e3){_0x41d9c0=_0x41d9c0-0x1aa;const _0x150efc=a46_0x150e();let _0x455e00=_0x150efc[_0x41d9c0];return _0x455e00;}export function writeCachedLLMProject(_0x4f54b9,_0x4e5e83,_0xe79617){const _0x2a1ffc=a46_0x455e;try{const _0x2adede=getCacheDir(),_0x462c57=getLLMProjectCacheFile(_0xe79617);!existsSync(_0x2adede)&&mkdirSync(_0x2adede,{'recursive':!![]});const _0x23826d={'name':_0x4f54b9,'id':_0x4e5e83};writeFileSync(_0x462c57,JSON[_0x2a1ffc(0x1ae)](_0x23826d),'utf-8');}catch{}}export function getLLMAgentCacheFile(_0x1a76e1){const _0x8130b=_0x1a76e1?'llm_default_agent.'+_0x1a76e1:'llm_default_agent';return join(getCacheDir(),_0x8130b);}export function readCachedLLMAgent(_0x242903){const _0x300ed7=a46_0x455e;try{const _0x321a67=getLLMAgentCacheFile(_0x242903);if(!existsSync(_0x321a67))return null;const _0x3edbf6=readFileSync(_0x321a67,_0x300ed7(0x1cd))[_0x300ed7(0x1d5)]();try{const _0xb68f32=JSON[_0x300ed7(0x1e6)](_0x3edbf6);if(_0xb68f32&&typeof _0xb68f32['id']===_0x300ed7(0x1ed)&&typeof _0xb68f32[_0x300ed7(0x1ac)]==='string'&&typeof _0xb68f32['projectId']===_0x300ed7(0x1ed))return _0xb68f32;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x2f233c,_0x44cebd,_0x315910,_0x11d0a6){try{const _0x15a6fe=getCacheDir(),_0x5f578c=getLLMAgentCacheFile(_0x11d0a6);!existsSync(_0x15a6fe)&&mkdirSync(_0x15a6fe,{'recursive':!![]});const _0xa7b6c6={'name':_0x2f233c,'id':_0x44cebd,'projectId':_0x315910};writeFileSync(_0x5f578c,JSON['stringify'](_0xa7b6c6),'utf-8');}catch{}}export function clearCachedLLMAgent(_0x1bef79){try{const _0x32e0ff=getLLMAgentCacheFile(_0x1bef79);existsSync(_0x32e0ff)&&unlinkSync(_0x32e0ff);}catch{}}export function getAccountInfoCacheFile(_0x18fadf){const _0x5ec345=a46_0x455e,_0x5d1691=_0x18fadf?_0x5ec345(0x1c5)+_0x18fadf+_0x5ec345(0x1e4):_0x5ec345(0x1c6);return join(getCacheDir(),_0x5d1691);}export function readCachedAccountInfo(_0x3291dd){const _0x4d2347=a46_0x455e;try{const _0x1d3ed6=getAccountInfoCacheFile(_0x3291dd);if(!existsSync(_0x1d3ed6))return null;const _0x5822ce=readFileSync(_0x1d3ed6,_0x4d2347(0x1cd))[_0x4d2347(0x1d5)](),_0x55db5e=JSON[_0x4d2347(0x1e6)](_0x5822ce);if(_0x55db5e&&typeof _0x55db5e['site']==='string'&&typeof _0x55db5e[_0x4d2347(0x1b7)]===_0x4d2347(0x1db))return _0x55db5e;return null;}catch{return null;}}export function writeCachedAccountInfo(_0xb60133,_0xbb3055,_0x190043){const _0x19f002=a46_0x455e;try{const _0x19aef5=getCacheDir(),_0x483244=getAccountInfoCacheFile(_0x190043);!existsSync(_0x19aef5)&&mkdirSync(_0x19aef5,{'recursive':!![]});const _0x5f13c8={'site':_0xb60133,'accountId':_0xbb3055,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x483244,JSON['stringify'](_0x5f13c8),_0x19f002(0x1cd));}catch{}}export function parseEnvFile(_0x24a612){const _0x4edd9e=a46_0x455e,_0x1395c5={};for(const _0x531bf0 of _0x24a612[_0x4edd9e(0x1bc)]('\x0a')){const _0x3c9fe2=_0x531bf0[_0x4edd9e(0x1d5)]();if(!_0x3c9fe2||_0x3c9fe2['startsWith']('#'))continue;const _0x42cc93=_0x3c9fe2['match'](/^([^=]+)=(.*)$/);if(_0x42cc93){const _0x4d31de=_0x42cc93[0x1][_0x4edd9e(0x1d5)]();let _0x4247f7=_0x42cc93[0x2][_0x4edd9e(0x1d5)]();(_0x4247f7['startsWith']('\x22')&&_0x4247f7[_0x4edd9e(0x1d2)]('\x22')||_0x4247f7['startsWith']('\x27')&&_0x4247f7[_0x4edd9e(0x1d2)]('\x27'))&&(_0x4247f7=_0x4247f7['slice'](0x1,-0x1)),_0x1395c5[_0x4d31de]=_0x4247f7;}}return _0x1395c5;}export function readUserConfig(){const _0x308b5c=a46_0x455e,_0x39e367=getConfigFile();if(!existsSync(_0x39e367))return{};try{const _0x2eee92=readFileSync(_0x39e367,_0x308b5c(0x1cd));return parseEnvFile(_0x2eee92);}catch(_0x5d46e6){return console[_0x308b5c(0x1ce)](_0x308b5c(0x1aa)+_0x39e367+':',_0x5d46e6),{};}}export function resolveSite(_0x33191e){const _0x207be9=a46_0x455e,_0x54ea8b=['us01','jp01',_0x207be9(0x1b9),_0x207be9(0x1e9),_0x207be9(0x1ba),_0x207be9(0x1dd),_0x207be9(0x1b8),_0x207be9(0x1d7),_0x207be9(0x1f0),_0x207be9(0x1c7)];if(_0x54ea8b['includes'](_0x33191e))return _0x33191e;if(_0x33191e in SITE_ALIASES)return SITE_ALIASES[_0x33191e];return console[_0x207be9(0x1ce)](_0x207be9(0x1f2)+_0x33191e+_0x207be9(0x1bf)),_0x207be9(0x1e8);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}function a46_0x150e(){const _0x1dc5f1=['ap02','llm_default_project','6SJvWrN','profile','string','23013JUhhRr','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','stg-jp01','8tJlaZn','Warning:\x20Unknown\x20site\x20\x27','keychain','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','env','name','legacy\x20.env\x20file','stringify','yellow','map','replace','keychain\x20(profile:\x20','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','tdx','TD_API_KEY\x20env\x20var\x20(deprecated)','TDX_API_KEY','accountId','dev-eu01','eu01','ap03','TDX_API_KEY_<PROFILE>','split','.config','TD_API_KEY_','\x27,\x20defaulting\x20to\x20us01','includes','Warning:\x20Failed\x20to\x20load\x20','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','toUpperCase','.env','account_info.','account_info.json','stg-ap03','8OmNNXU','readFileSync','join','4186134IRhQdT','TDX_API_KEY_','utf-8','warn','5765301HLiTUv','11Cnaqys','filter','endsWith','profiles','959205DiiYen','trim','4586GHQYKe','stg-us01','.env.','29282170AQbZug','legacy\x20.env\x20file\x20(profile:\x20','number','existsSync','dev-us01','TDX_API_KEY\x20env\x20var','5190409oNidBE','startsWith','apiKey','TD_API_KEY','.cache','.json','apiKeys','parse','source','us01'];a46_0x150e=function(){return _0x1dc5f1;};return a46_0x150e();}export function getAPIKey(_0x290cf4,_0x18f296){const _0x15a840=a46_0x455e,_0x439cfe=_0x18f296||getActiveProfileName();if(_0x439cfe){const _0x2af58a=_0x15a840(0x1cc)+normalizeProfileForEnvVar(_0x439cfe);if(process[_0x15a840(0x1ab)][_0x2af58a])return process[_0x15a840(0x1ab)][_0x2af58a];}if(process[_0x15a840(0x1ab)][_0x15a840(0x1b6)])return process[_0x15a840(0x1ab)]['TDX_API_KEY'];if(process['env']['TD_API_KEY'])return process['env'][_0x15a840(0x1e2)];const _0x1948e6=_0x290cf4[_0x15a840(0x1c3)]()[_0x15a840(0x1b1)](/-/g,'_'),_0x27d2c5='TD_API_KEY_'+_0x1948e6;if(_0x439cfe){const _0x5e01e7=loadProfileEnv(_0x439cfe);if(_0x5e01e7){if(_0x5e01e7[_0x27d2c5])return _0x5e01e7[_0x27d2c5];if(_0x5e01e7[_0x15a840(0x1e2)])return _0x5e01e7['TD_API_KEY'];}}const _0x1c63ca=loadUserConfigOnce();if(_0x1c63ca[_0x27d2c5])return _0x1c63ca[_0x27d2c5];if(_0x1c63ca['TD_API_KEY'])return _0x1c63ca['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x46f1f){const _0x17c62d=a46_0x455e;return _0x46f1f[_0x17c62d(0x1c3)]()[_0x17c62d(0x1b1)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x4954de,_0x2bb592){const _0x249936=a46_0x455e,_0x3c1b02=_0x2bb592||getActiveProfileName()||undefined;if(_0x3c1b02){const _0xd432a2=_0x249936(0x1cc)+normalizeProfileForEnvVar(_0x3c1b02);if(process[_0x249936(0x1ab)][_0xd432a2])return{'apiKey':process['env'][_0xd432a2],'source':_0xd432a2+'\x20env\x20var','isDeprecated':![]};const _0x556e21=getCachedCredential(_0x4954de,_0x3c1b02);if(_0x556e21)return{'apiKey':_0x556e21,'source':'keychain\x20(profile:\x20'+_0x3c1b02+')','isDeprecated':![]};const _0x37076d=await getKeychainAPIKey(_0x3c1b02);if(_0x37076d)return setCachedCredential(_0x37076d,_0x4954de,_0x3c1b02),{'apiKey':_0x37076d,'source':_0x249936(0x1b2)+_0x3c1b02+')','isDeprecated':![]};}if(process['env'][_0x249936(0x1b6)])return{'apiKey':process[_0x249936(0x1ab)]['TDX_API_KEY'],'source':_0x249936(0x1de),'isDeprecated':![]};if(!_0x3c1b02){const _0x4d95a7=getCachedCredential(_0x4954de,undefined);if(_0x4d95a7)return{'apiKey':_0x4d95a7,'source':'keychain','isDeprecated':![]};const _0x5f44ad=await getKeychainAPIKey(undefined);if(_0x5f44ad)return setCachedCredential(_0x5f44ad,_0x4954de,undefined),{'apiKey':_0x5f44ad,'source':_0x249936(0x1f3),'isDeprecated':![]};}if(process[_0x249936(0x1ab)]['TD_API_KEY'])return{'apiKey':process['env'][_0x249936(0x1e2)],'source':_0x249936(0x1b5),'isDeprecated':!![]};const _0x2271f5=getLegacyEnvAPIKey(_0x4954de,_0x3c1b02);if(_0x2271f5){const _0x4e62fe=await isKeychainAvailable();if(_0x4e62fe)try{await saveKeychainAPIKey(_0x2271f5,_0x3c1b02),setCachedCredential(_0x2271f5,_0x4954de,_0x3c1b02);const _0x20416a=getConfigFilePath(_0x3c1b02);cleanupLegacyEnvFile(_0x20416a)&&console[_0x249936(0x1ce)](a46_0xdb86fc[_0x249936(0x1af)](_0x249936(0x1c2)));}catch(_0x1244bb){console[_0x249936(0x1ce)](a46_0xdb86fc['yellow']('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x1244bb));}const _0x4e5026=_0x3c1b02?_0x249936(0x1da)+_0x3c1b02+')':_0x249936(0x1ad);return{'apiKey':_0x2271f5,'source':_0x4e5026,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x2b199f,_0x3c2687,_0x263ef8=!![]){const _0x22b169=a46_0x455e,_0x4a5fd7=await resolveAPIKeyAsync(_0x2b199f,_0x3c2687);if(!_0x4a5fd7)return undefined;if(_0x263ef8&&_0x4a5fd7['isDeprecated']&&_0x4a5fd7[_0x22b169(0x1e7)][_0x22b169(0x1c0)](_0x22b169(0x1e2))){const _0x37f486=_0x3c2687||getActiveProfileName()||undefined,_0x3d7eac=_0x37f486?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x37f486):_0x22b169(0x1bb);console[_0x22b169(0x1ce)](a46_0xdb86fc[_0x22b169(0x1af)](_0x22b169(0x1b3)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x3d7eac+').')));}return _0x4a5fd7[_0x22b169(0x1e1)];}function getLegacyEnvAPIKey(_0x59d29d,_0x4bae80){const _0xfdaedc=a46_0x455e,_0x4c4127=_0x59d29d[_0xfdaedc(0x1c3)]()[_0xfdaedc(0x1b1)](/-/g,'_'),_0x3ccc25=_0xfdaedc(0x1be)+_0x4c4127;if(_0x4bae80){const _0x597007=loadProfileEnv(_0x4bae80);if(_0x597007){if(_0x597007[_0x3ccc25])return _0x597007[_0x3ccc25];if(_0x597007['TD_API_KEY'])return _0x597007[_0xfdaedc(0x1e2)];}}const _0x11f2fa=loadUserConfigOnce();if(_0x11f2fa[_0x3ccc25])return _0x11f2fa[_0x3ccc25];if(_0x11f2fa['TD_API_KEY'])return _0x11f2fa[_0xfdaedc(0x1e2)];return undefined;}function cleanupLegacyEnvFile(_0x5db281){const _0x1e333b=a46_0x455e;if(!existsSync(_0x5db281))return![];try{const _0x194aa2=readFileSync(_0x5db281,_0x1e333b(0x1cd)),_0x20c0b4=_0x194aa2[_0x1e333b(0x1bc)]('\x0a'),_0x5113f1=_0x20c0b4[_0x1e333b(0x1d1)](_0x2ef571=>{const _0x58e9af=_0x1e333b,_0x3ca357=_0x2ef571['trim']();if(!_0x3ca357||_0x3ca357[_0x58e9af(0x1e0)]('#'))return!![];const [_0x50ac71]=_0x3ca357[_0x58e9af(0x1bc)]('=');return!_0x50ac71[_0x58e9af(0x1e0)](_0x58e9af(0x1e2));}),_0x421b9e=_0x5113f1['some'](_0x4787c7=>{const _0x4df17b=_0x1e333b,_0x3f8d18=_0x4787c7[_0x4df17b(0x1d5)]();return _0x3f8d18&&!_0x3f8d18[_0x4df17b(0x1e0)]('#');});if(!_0x421b9e)return unlinkSync(_0x5db281),!![];return writeFileSync(_0x5db281,_0x5113f1[_0x1e333b(0x1ca)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x2dba29){const _0x59d2aa=a46_0x455e,_0xb010e3=a46_0x3ba6ea['join'](getConfigDir(),_0x59d2aa(0x1d8)+_0x2dba29);if(a46_0x4b4054[_0x59d2aa(0x1dc)](_0xb010e3)){validateSecureFilePermissions(_0xb010e3);try{const _0x1a2318=a46_0x4b4054[_0x59d2aa(0x1c9)](_0xb010e3,'utf-8');return parseEnvFile(_0x1a2318);}catch(_0x2867ca){console[_0x59d2aa(0x1ce)](_0x59d2aa(0x1c1)+_0xb010e3+':\x20'+_0x2867ca);}}const _0x648241=a46_0x3ba6ea[_0x59d2aa(0x1ca)](getConfigDir(),_0x59d2aa(0x1d3),_0x2dba29,_0x59d2aa(0x1c4));if(a46_0x4b4054['existsSync'](_0x648241)){validateSecureFilePermissions(_0x648241);try{const _0x3d5929=a46_0x4b4054[_0x59d2aa(0x1c9)](_0x648241,_0x59d2aa(0x1cd));return parseEnvFile(_0x3d5929);}catch(_0x4d6c68){return console[_0x59d2aa(0x1ce)](_0x59d2aa(0x1c1)+_0x648241+':\x20'+_0x4d6c68),null;}}return null;}function getActiveProfileName(){const _0x33d99b=a46_0x455e,_0x46a0c5=a46_0x3ba6ea[_0x33d99b(0x1ca)](getConfigDir(),'tdx.json');if(!a46_0x4b4054[_0x33d99b(0x1dc)](_0x46a0c5))return null;try{const _0x31e1a4=a46_0x4b4054[_0x33d99b(0x1c9)](_0x46a0c5,_0x33d99b(0x1cd)),_0x453097=JSON['parse'](_0x31e1a4);return _0x453097[_0x33d99b(0x1ec)]||null;}catch{return null;}}export function saveAPIKey(_0x7ac853,_0x3d20cb,_0x5e9dab){const _0x39eafd=a46_0x455e,_0x584012=getConfigDir(),_0x157ecf=getConfigFilePath(_0x5e9dab);!existsSync(_0x584012)&&mkdirSync(_0x584012,{'recursive':!![],'mode':0x1c0});let _0x24cdc6={};if(existsSync(_0x157ecf))try{const _0x53696b=readFileSync(_0x157ecf,'utf-8');_0x24cdc6=parseEnvFile(_0x53696b);}catch(_0x15ab34){console[_0x39eafd(0x1ce)]('Warning:\x20Failed\x20to\x20read\x20'+_0x157ecf+':',_0x15ab34);}const _0x4430c0=_0x7ac853[_0x39eafd(0x1c3)]()[_0x39eafd(0x1b1)](/-/g,'_');_0x24cdc6[_0x39eafd(0x1be)+_0x4430c0]=_0x3d20cb;const _0x1de105=Object['entries'](_0x24cdc6)[_0x39eafd(0x1b0)](([_0x3e91b4,_0x4831d6])=>_0x3e91b4+'='+_0x4831d6);writeFileSync(_0x157ecf,_0x1de105[_0x39eafd(0x1ca)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x4395ca,_0x224f5d,_0x15e99e){const _0x4ba267=a46_0x455e;await saveKeychainAPIKey(_0x4395ca,_0x15e99e),setCachedCredential(_0x4395ca,_0x224f5d,_0x15e99e);const _0x492a2c=getConfigFilePath(_0x15e99e);cleanupLegacyEnvFile(_0x492a2c)&&console['warn'](a46_0xdb86fc[_0x4ba267(0x1af)](_0x4ba267(0x1ef)));}export function loadConfig(){const _0xe65587=a46_0x455e,_0x23395d={'apiKeys':{},'defaultSite':_0xe65587(0x1e8)},_0x436271=[_0xe65587(0x1e8),'jp01','eu01',_0xe65587(0x1e9),_0xe65587(0x1ba),_0xe65587(0x1dd),_0xe65587(0x1b8),_0xe65587(0x1d7),_0xe65587(0x1f0),'stg-ap03'];for(const _0xfd0d05 of _0x436271){const _0x8bcba=getAPIKey(_0xfd0d05);_0x8bcba&&(_0x23395d[_0xe65587(0x1e5)][_0xfd0d05]=_0x8bcba);}return _0x23395d;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x43d34c,_0x568624){const _0x6e616d=a47_0x3ed7,_0x229566=_0x43d34c();while(!![]){try{const _0x15651c=parseInt(_0x6e616d(0x1a3))/0x1*(parseInt(_0x6e616d(0x1a2))/0x2)+-parseInt(_0x6e616d(0x19d))/0x3*(parseInt(_0x6e616d(0x1a0))/0x4)+parseInt(_0x6e616d(0x19b))/0x5*(-parseInt(_0x6e616d(0x19f))/0x6)+parseInt(_0x6e616d(0x1a9))/0x7+-parseInt(_0x6e616d(0x1aa))/0x8*(parseInt(_0x6e616d(0x1a4))/0x9)+parseInt(_0x6e616d(0x19c))/0xa+parseInt(_0x6e616d(0x19e))/0xb;if(_0x15651c===_0x568624)break;else _0x229566['push'](_0x229566['shift']());}catch(_0x8eab7f){_0x229566['push'](_0x229566['shift']());}}}(a47_0x2e15,0x6172d));function a47_0x3ed7(_0x44327c,_0x6f8541){_0x44327c=_0x44327c-0x19b;const _0x2e157f=a47_0x2e15();let _0x3ed7c2=_0x2e157f[_0x44327c];return _0x3ed7c2;}import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function a47_0x2e15(){const _0x206da9=['stringify','.json','utf-8','now','3145870gmhtBU','2224lPpDON','1945JHWoKl','5530010DqOoAA','79026qRnyrw','3836789bIcrdu','5568fRUtpm','48marKnK','connections','2yPcZVb','125911ZiqeMC','12978PAflIK'];a47_0x2e15=function(){return _0x206da9;};return a47_0x2e15();}function getCacheFilePath(_0x3984a4){const _0x58d076=a47_0x3ed7,_0x373963=_0x3984a4||'default';return join(getCacheDir(),'connections-'+_0x373963+_0x58d076(0x1a6));}export function loadCachedConnections(_0x138f6e){const _0x41a7a3=a47_0x3ed7,_0x305543=getCacheFilePath(_0x138f6e);if(!existsSync(_0x305543))return null;try{const _0x55ca1d=readFileSync(_0x305543,_0x41a7a3(0x1a7)),_0x53c127=JSON['parse'](_0x55ca1d);return _0x53c127[_0x41a7a3(0x1a1)];}catch{return null;}}export function saveCachedConnections(_0x28306d,_0x5f3dc5){const _0x15a6ce=a47_0x3ed7,_0x297a1b=getCacheDir();!existsSync(_0x297a1b)&&mkdirSync(_0x297a1b,{'recursive':!![]});const _0x1f55ed=getCacheFilePath(_0x28306d),_0x13a906={'connections':_0x5f3dc5,'cachedAt':Date[_0x15a6ce(0x1a8)]()};writeFileSync(_0x1f55ed,JSON[_0x15a6ce(0x1a5)](_0x13a906,null,0x2),'utf-8');}export function clearConnectionCache(_0x552d8d){const _0x179f27=getCacheFilePath(_0x552d8d);if(existsSync(_0x179f27))try{unlinkSync(_0x179f27);}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x25421e,_0x5a12a6){const _0x50fd26=a48_0x56ce,_0x2fed0e=_0x25421e();while(!![]){try{const _0x5e3ecf=parseInt(_0x50fd26(0x86))/0x1*(parseInt(_0x50fd26(0x88))/0x2)+parseInt(_0x50fd26(0x8c))/0x3+parseInt(_0x50fd26(0x7e))/0x4*(parseInt(_0x50fd26(0x82))/0x5)+-parseInt(_0x50fd26(0x89))/0x6+-parseInt(_0x50fd26(0x8d))/0x7*(parseInt(_0x50fd26(0x84))/0x8)+parseInt(_0x50fd26(0x8e))/0x9*(parseInt(_0x50fd26(0x87))/0xa)+parseInt(_0x50fd26(0x7b))/0xb;if(_0x5e3ecf===_0x5a12a6)break;else _0x2fed0e['push'](_0x2fed0e['shift']());}catch(_0x1562db){_0x2fed0e['push'](_0x2fed0e['shift']());}}}(a48_0x265c,0x7758f));function a48_0x265c(){const _0x365945=['166923BfRmmQ','2746172VzYcNH','__default_profile__','__default_site__','98776iPRiUW','loadedAt','get','clear','20xdeUbj','apiKey','11528rLcEJp','delete','1umHvCA','60aJBxXo','1227086asvZpu','4079298xLsicw','set','now','1293690nRaJev','1631wZWAVS'];a48_0x265c=function(){return _0x365945;};return a48_0x265c();}function a48_0x56ce(_0x123118,_0x4fbeb2){_0x123118=_0x123118-0x7b;const _0x265c35=a48_0x265c();let _0x56ce6d=_0x265c35[_0x123118];return _0x56ce6d;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x390a00,_0x386a3c){const _0x4ed6fd=a48_0x56ce,_0x4ce47b=_0x390a00||_0x4ed6fd(0x7d),_0x2039a0=_0x386a3c||_0x4ed6fd(0x7c);return _0x4ce47b+':'+_0x2039a0;}export function getCachedCredential(_0x5255f6,_0x3a55f2){const _0x1586ce=a48_0x56ce,_0x51e909=getCacheKey(_0x5255f6,_0x3a55f2),_0x438d61=cache[_0x1586ce(0x80)](_0x51e909);if(!_0x438d61)return null;if(Date[_0x1586ce(0x8b)]()-_0x438d61[_0x1586ce(0x7f)]>CACHE_TTL_MS)return cache['delete'](_0x51e909),null;return _0x438d61[_0x1586ce(0x83)];}export function setCachedCredential(_0x1acac9,_0x12eeb4,_0x5ba3af){const _0x587e85=a48_0x56ce,_0x347aa=getCacheKey(_0x12eeb4,_0x5ba3af);cache[_0x587e85(0x8a)](_0x347aa,{'apiKey':_0x1acac9,'loadedAt':Date[_0x587e85(0x8b)]()});}export function clearCredentialCache(){const _0x450927=a48_0x56ce;cache[_0x450927(0x81)]();}export function clearCachedCredential(_0x3d496e,_0x6a5c72){const _0x5c7766=a48_0x56ce,_0x4c9cf0=getCacheKey(_0x3d496e,_0x6a5c72);cache[_0x5c7766(0x85)](_0x4c9cf0);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a49_0x964417=a49_0x1e4e;function a49_0x28b8(){const _0x3c5a9b=['llmProject','llm_project','llm_agent','\x0a[configuration\x20files]','config','loadGlobalConfig',':\x20none','injectIntoOptions','1640949JlduPj','entries','apiKey','log','(active)','35248oPHBrk','not\x20set','parentSegment','3015uhUtsL','3047655KRMfRV','displayWithSources','Session','createAsync','display','globalCredentials','verbose','parse','1576468aFHfSR','.env','database','440610EsyWMQ','join','project','.json','activeProfile','4307898wpyiHV','session','getSource','readFileSync','tdx.json','resolveAPIKeyAsync','[context]','11083QxKYOl','replace','Global\x20Credentials','parent_segment','Project','existsSync','toString','Profile\x20Credentials','profileCredentials','utf-8','layers','(session:\x20','site','default','profile','2RVfSEi','segment_path','us01','logLevel','INFO','profile:\x20','global','cliFlags','profiles','Global',':\x20none\x20(using\x20session:\x20','configFiles','sessionId','llmAgent','getParameters'];a49_0x28b8=function(){return _0x3c5a9b;};return a49_0x28b8();}(function(_0x735d77,_0x4b6dbd){const _0x2f46d0=a49_0x1e4e,_0x43f4e5=_0x735d77();while(!![]){try{const _0x1fc7c4=parseInt(_0x2f46d0(0x142))/0x1+parseInt(_0x2f46d0(0x10b))/0x2*(parseInt(_0x2f46d0(0x122))/0x3)+-parseInt(_0x2f46d0(0x133))/0x4+-parseInt(_0x2f46d0(0x12b))/0x5+-parseInt(_0x2f46d0(0x136))/0x6+-parseInt(_0x2f46d0(0x13b))/0x7+-parseInt(_0x2f46d0(0x127))/0x8*(-parseInt(_0x2f46d0(0x12a))/0x9);if(_0x1fc7c4===_0x4b6dbd)break;else _0x43f4e5['push'](_0x43f4e5['shift']());}catch(_0x175db5){_0x43f4e5['push'](_0x43f4e5['shift']());}}}(a49_0x28b8,0x5364b));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a49_0x1ce6a7 from'node:fs';function a49_0x1e4e(_0x3d4c35,_0x393e66){_0x3d4c35=_0x3d4c35-0x101;const _0x28b8a5=a49_0x28b8();let _0x1e4e59=_0x28b8a5[_0x3d4c35];return _0x1e4e59;}import*as a49_0x377a3d from'node:path';export class GlobalContext{[a49_0x964417(0x108)];['database'];[a49_0x964417(0x145)];[a49_0x964417(0x10c)];['llm_project'];['llm_agent'];['apiKey'];[a49_0x964417(0x131)];[a49_0x964417(0x10e)];[a49_0x964417(0x10a)];[a49_0x964417(0x106)];[a49_0x964417(0x13a)];[a49_0x964417(0x117)];[a49_0x964417(0x116)];constructor(_0x47e438){const _0x425500=a49_0x964417;this[_0x425500(0x117)]=_0x47e438[_0x425500(0x13c)]||getCurrentSessionPID()[_0x425500(0x102)]();const _0x141fec=loadSessionContext(_0x47e438[_0x425500(0x13c)]),_0x3db8e7=loadProjectConfig(),_0x5e5d7c=this[_0x425500(0x11f)]();this[_0x425500(0x13a)]=_0x47e438['profile']||_0x141fec?.['profile']||_0x5e5d7c[_0x425500(0x10a)]||getActiveProfile();const _0x44da8a=this['activeProfile']?loadProfile(this[_0x425500(0x13a)]):null,_0x3f5803=_0x255327=>{const _0x26c6eb=_0x425500;if(!_0x255327)return{};const _0x4074f0=_0x255327,_0x1c71c0={};for(const [_0x432ea6,_0x24c4e2]of Object[_0x26c6eb(0x123)](_0x4074f0)){typeof _0x24c4e2==='string'&&(_0x1c71c0[_0x432ea6]=_0x24c4e2);}return _0x1c71c0;},_0x1f26fb={};if(_0x47e438[_0x425500(0x108)]&&_0x47e438[_0x425500(0x108)]!==_0x425500(0x10d))_0x1f26fb[_0x425500(0x108)]=_0x47e438['site'];const _0x1abc06=_0x141fec?.['database'],_0x5785ad=_0x3db8e7?.[_0x425500(0x135)],_0x5486c9=_0x44da8a?.[_0x425500(0x11e)]?.[_0x425500(0x135)],_0x74b1ce=_0x5e5d7c[_0x425500(0x135)];_0x47e438[_0x425500(0x135)]&&(_0x47e438['database']!==_0x1abc06&&_0x47e438[_0x425500(0x135)]!==_0x5785ad&&_0x47e438[_0x425500(0x135)]!==_0x5486c9&&_0x47e438['database']!==_0x74b1ce)&&(_0x1f26fb[_0x425500(0x135)]=_0x47e438[_0x425500(0x135)]);if(_0x47e438['parentSegment'])_0x1f26fb['parent_segment']=_0x47e438['parentSegment'];if(_0x47e438[_0x425500(0x11a)])_0x1f26fb[_0x425500(0x11b)]=_0x47e438[_0x425500(0x11a)];if(_0x47e438['llmAgent'])_0x1f26fb[_0x425500(0x11c)]=_0x47e438['llmAgent'];if(_0x47e438[_0x425500(0x10a)])_0x1f26fb[_0x425500(0x10a)]=_0x47e438['profile'];this[_0x425500(0x106)]={'cliFlags':_0x1f26fb,'session':_0x3f5803(_0x141fec),'project':_0x3f5803(_0x3db8e7),'profile':_0x3f5803(_0x44da8a?.[_0x425500(0x11e)]),'global':_0x3f5803(_0x5e5d7c)};const _0xd83663={...this['layers']['global'],...this[_0x425500(0x106)][_0x425500(0x10a)],...this[_0x425500(0x106)][_0x425500(0x138)],...this['layers'][_0x425500(0x13c)],...this[_0x425500(0x106)][_0x425500(0x112)]},_0x1c7513=_0xd83663[_0x425500(0x108)]||_0x425500(0x10d);this['site']=resolveSite(_0x1c7513),this[_0x425500(0x135)]=_0xd83663[_0x425500(0x135)],this[_0x425500(0x145)]=_0xd83663[_0x425500(0x145)],this[_0x425500(0x10c)]=_0xd83663[_0x425500(0x10c)],this[_0x425500(0x11b)]=_0xd83663['llm_project'],this['llm_agent']=_0xd83663['llm_agent'],this[_0x425500(0x131)]=_0x47e438[_0x425500(0x131)]||![],this[_0x425500(0x10e)]=_0x47e438[_0x425500(0x10e)]??LogLevel[_0x425500(0x10f)],this[_0x425500(0x10a)]=this[_0x425500(0x13a)]||undefined,this[_0x425500(0x124)]=getAPIKey(this[_0x425500(0x108)],this[_0x425500(0x13a)]||undefined);const _0x93c0f7=getConfigDir(),_0xe0e42=a49_0x377a3d['join'](_0x93c0f7,'sessions',this[_0x425500(0x117)]+_0x425500(0x139)),_0x44a3cc=findProjectConfigPath(),_0x5da1fd=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x13f)),_0x377626=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x134));let _0x3b50d8=null,_0x506683=null;this[_0x425500(0x13a)]&&(_0x3b50d8=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x113),this[_0x425500(0x13a)],_0x425500(0x13f)),_0x506683=a49_0x377a3d['join'](_0x93c0f7,'profiles',this[_0x425500(0x13a)],_0x425500(0x134))),this[_0x425500(0x116)]={'session':a49_0x1ce6a7[_0x425500(0x101)](_0xe0e42)?_0xe0e42:null,'project':_0x44a3cc,'profile':_0x3b50d8&&a49_0x1ce6a7['existsSync'](_0x3b50d8)?_0x3b50d8:null,'profileCredentials':_0x506683&&a49_0x1ce6a7['existsSync'](_0x506683)?_0x506683:null,'global':a49_0x1ce6a7['existsSync'](_0x5da1fd)?_0x5da1fd:null,'globalCredentials':a49_0x1ce6a7[_0x425500(0x101)](_0x377626)?_0x377626:null};}[a49_0x964417(0x13d)](_0xaa3b78,_0x5460e5){const _0x281b64=a49_0x964417;if(!_0x5460e5)return _0x281b64(0x128);const _0x4642c9=_0x5460e5;if(this[_0x281b64(0x106)]['cliFlags'][_0xaa3b78]===_0x4642c9){if(_0xaa3b78===_0x281b64(0x108)&&_0x4642c9==='us01'&&!this[_0x281b64(0x106)]['session'][_0x281b64(0x108)]&&!this['layers'][_0x281b64(0x138)][_0x281b64(0x108)]&&!this[_0x281b64(0x106)][_0x281b64(0x10a)][_0x281b64(0x108)]&&!this[_0x281b64(0x106)][_0x281b64(0x111)]['site'])return'default';return'CLI\x20flag:\x20--'+_0xaa3b78[_0x281b64(0x143)](/_/g,'-');}if(this['layers'][_0x281b64(0x13c)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x13c);if(this[_0x281b64(0x106)][_0x281b64(0x138)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x138);if(this['layers'][_0x281b64(0x10a)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x110)+this['activeProfile'];if(this[_0x281b64(0x106)]['global'][_0xaa3b78]===_0x4642c9)return _0x281b64(0x111);return _0x281b64(0x109);}['loadGlobalConfig'](){const _0x2d2a16=a49_0x964417,_0x4fc9bd=a49_0x377a3d[_0x2d2a16(0x137)](getConfigDir(),_0x2d2a16(0x13f));if(!a49_0x1ce6a7[_0x2d2a16(0x101)](_0x4fc9bd))return{};try{const _0x11a2df=a49_0x1ce6a7[_0x2d2a16(0x13e)](_0x4fc9bd,_0x2d2a16(0x105));return JSON[_0x2d2a16(0x132)](_0x11a2df);}catch{return{};}}[a49_0x964417(0x121)](_0xa1245b){const _0x149553=a49_0x964417;_0xa1245b['site']=this[_0x149553(0x108)],!_0xa1245b[_0x149553(0x135)]&&this[_0x149553(0x135)]&&(_0xa1245b['database']=this[_0x149553(0x135)]),!_0xa1245b[_0x149553(0x129)]&&this[_0x149553(0x145)]&&(_0xa1245b[_0x149553(0x129)]=this[_0x149553(0x145)]),!_0xa1245b['segmentPath']&&this[_0x149553(0x10c)]&&(_0xa1245b['segmentPath']=this[_0x149553(0x10c)]),!_0xa1245b[_0x149553(0x11a)]&&this[_0x149553(0x11b)]&&(_0xa1245b[_0x149553(0x11a)]=this[_0x149553(0x11b)]),!_0xa1245b[_0x149553(0x118)]&&this[_0x149553(0x11c)]&&(_0xa1245b[_0x149553(0x118)]=this[_0x149553(0x11c)]);}[a49_0x964417(0x119)](){const _0x596509=a49_0x964417;return[{'key':_0x596509(0x108),'value':this['site']},{'key':_0x596509(0x135),'value':this[_0x596509(0x135)]},{'key':_0x596509(0x145),'value':this[_0x596509(0x145)]},{'key':_0x596509(0x10c),'value':this['segment_path']},{'key':_0x596509(0x11b),'value':this[_0x596509(0x11b)]},{'key':_0x596509(0x11c),'value':this[_0x596509(0x11c)]},{'key':_0x596509(0x10a),'value':this['activeProfile']||undefined}];}[a49_0x964417(0x12f)](){const _0x29c776=a49_0x964417;console[_0x29c776(0x125)](_0x29c776(0x141));for(const {key:_0x4f6ec7,value:_0x88a193}of this['getParameters']()){_0x88a193&&console[_0x29c776(0x125)](_0x4f6ec7+':\x20'+_0x88a193);}}[a49_0x964417(0x12c)](){const _0x7c6ef8=a49_0x964417;console[_0x7c6ef8(0x125)](_0x7c6ef8(0x141));for(const {key:_0x24b562,value:_0x5daac1}of this[_0x7c6ef8(0x119)]()){if(_0x5daac1){const _0x5b42cc=_0x24b562===_0x7c6ef8(0x10a)?_0x7c6ef8(0x126):'('+this[_0x7c6ef8(0x13d)](_0x24b562,_0x5daac1)+')';console[_0x7c6ef8(0x125)](_0x24b562+':\x20'+_0x5daac1+'\x20'+_0x5b42cc);}}console[_0x7c6ef8(0x125)](_0x7c6ef8(0x11d));const _0x1688f8=[{'label':_0x7c6ef8(0x12d),'path':this[_0x7c6ef8(0x116)]['session'],'extra':_0x7c6ef8(0x107)+this[_0x7c6ef8(0x117)]+')'},{'label':_0x7c6ef8(0x146),'path':this[_0x7c6ef8(0x116)]['project']},{'label':'Profile','path':this['configFiles']['profile']},{'label':_0x7c6ef8(0x103),'path':this['configFiles'][_0x7c6ef8(0x104)]},{'label':_0x7c6ef8(0x114),'path':this[_0x7c6ef8(0x116)][_0x7c6ef8(0x111)]},{'label':_0x7c6ef8(0x144),'path':this['configFiles'][_0x7c6ef8(0x130)]}];for(const {label:_0x96bccf,path:_0x4ddfa0,extra:_0x8fc033}of _0x1688f8){if(_0x4ddfa0)console[_0x7c6ef8(0x125)](_0x96bccf+':\x20'+_0x4ddfa0+'\x20✓'+(_0x8fc033?'\x20'+_0x8fc033:''));else{if(_0x96bccf===_0x7c6ef8(0x12d))console['log'](_0x96bccf+_0x7c6ef8(0x115)+this[_0x7c6ef8(0x117)]+')');else(_0x96bccf===_0x7c6ef8(0x146)||_0x96bccf===_0x7c6ef8(0x114))&&console[_0x7c6ef8(0x125)](_0x96bccf+_0x7c6ef8(0x120));}}}async[a49_0x964417(0x140)](){const _0x17573f=a49_0x964417;return this[_0x17573f(0x124)]=await getAPIKeyAsync(this[_0x17573f(0x108)],this[_0x17573f(0x13a)]||undefined),this[_0x17573f(0x124)];}static async[a49_0x964417(0x12e)](_0x13212e){const _0x16a883=a49_0x964417,_0x26e8bf=new GlobalContext(_0x13212e);return await _0x26e8bf[_0x16a883(0x140)](),_0x26e8bf;}}
|
|
1
|
+
const a49_0x2c5ae3=a49_0x5118;(function(_0x43452e,_0x1933f8){const _0x19b5c4=a49_0x5118,_0x281496=_0x43452e();while(!![]){try{const _0x1b0515=parseInt(_0x19b5c4(0x173))/0x1*(parseInt(_0x19b5c4(0x1a0))/0x2)+parseInt(_0x19b5c4(0x16a))/0x3+parseInt(_0x19b5c4(0x19f))/0x4*(-parseInt(_0x19b5c4(0x1a2))/0x5)+-parseInt(_0x19b5c4(0x187))/0x6+parseInt(_0x19b5c4(0x1a5))/0x7+-parseInt(_0x19b5c4(0x177))/0x8*(parseInt(_0x19b5c4(0x169))/0x9)+parseInt(_0x19b5c4(0x16f))/0xa;if(_0x1b0515===_0x1933f8)break;else _0x281496['push'](_0x281496['shift']());}catch(_0x9f0fab){_0x281496['push'](_0x281496['shift']());}}}(a49_0xfb5c,0xd2549));function a49_0x5118(_0x2e95ac,_0x5c11b9){_0x2e95ac=_0x2e95ac-0x164;const _0xfb5c8=a49_0xfb5c();let _0x5118e3=_0xfb5c8[_0x2e95ac];return _0x5118e3;}import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';function a49_0xfb5c(){const _0x37f9de=['Global','llmAgent','session','73440vIOUwd','782964hScWYQ','getSource','injectIntoOptions','parse','llm_project','4879880YgVarl','Project','global','display','9IjquXi','profiles','log','database','384mLsczM','utf-8','default','verbose','(session:\x20','logLevel','site','config','Profile\x20Credentials','existsSync','llmProject',':\x20none\x20(using\x20session:\x20','configFiles','entries','profile','getParameters','8771682rGdqZP','us01','loadGlobalConfig','llm_agent','.env','Session','CLI\x20flag:\x20--','tdx.json','apiKey','cliFlags','readFileSync','[context]','Global\x20Credentials','sessionId','parent_segment','profileCredentials','.json','parentSegment','not\x20set','join',':\x20none','displayWithSources','project','globalCredentials','32212DiuNgN','352226KXeHXA','createAsync','795koDNCi','segment_path','Profile','11631018wLQWhH','activeProfile','(active)','layers','\x0a[configuration\x20files]'];a49_0xfb5c=function(){return _0x37f9de;};return a49_0xfb5c();}import*as a49_0xd95b99 from'node:fs';import*as a49_0x546cda from'node:path';export class GlobalContext{[a49_0x2c5ae3(0x17d)];[a49_0x2c5ae3(0x176)];[a49_0x2c5ae3(0x195)];[a49_0x2c5ae3(0x1a3)];['llm_project'];['llm_agent'];[a49_0x2c5ae3(0x18f)];[a49_0x2c5ae3(0x17a)];['logLevel'];[a49_0x2c5ae3(0x185)];[a49_0x2c5ae3(0x164)];[a49_0x2c5ae3(0x1a6)];[a49_0x2c5ae3(0x194)];[a49_0x2c5ae3(0x183)];constructor(_0xb65707){const _0x2a4a31=a49_0x2c5ae3;this[_0x2a4a31(0x194)]=_0xb65707[_0x2a4a31(0x168)]||getCurrentSessionPID()['toString']();const _0x16ff74=loadSessionContext(_0xb65707[_0x2a4a31(0x168)]),_0x5396c7=loadProjectConfig(),_0x12b508=this[_0x2a4a31(0x189)]();this[_0x2a4a31(0x1a6)]=_0xb65707[_0x2a4a31(0x185)]||_0x16ff74?.[_0x2a4a31(0x185)]||_0x12b508['profile']||getActiveProfile();const _0x357168=this['activeProfile']?loadProfile(this[_0x2a4a31(0x1a6)]):null,_0x30a9d1=_0x2a612c=>{const _0x582924=_0x2a4a31;if(!_0x2a612c)return{};const _0x38c989=_0x2a612c,_0x42aa84={};for(const [_0x5d3f80,_0x513857]of Object[_0x582924(0x184)](_0x38c989)){typeof _0x513857==='string'&&(_0x42aa84[_0x5d3f80]=_0x513857);}return _0x42aa84;},_0x130cfd={};if(_0xb65707[_0x2a4a31(0x17d)]&&_0xb65707[_0x2a4a31(0x17d)]!=='us01')_0x130cfd[_0x2a4a31(0x17d)]=_0xb65707['site'];const _0x1914b5=_0x16ff74?.[_0x2a4a31(0x176)],_0x7ec6e5=_0x5396c7?.[_0x2a4a31(0x176)],_0x43255c=_0x357168?.[_0x2a4a31(0x17e)]?.[_0x2a4a31(0x176)],_0x567ed9=_0x12b508[_0x2a4a31(0x176)];_0xb65707[_0x2a4a31(0x176)]&&(_0xb65707['database']!==_0x1914b5&&_0xb65707[_0x2a4a31(0x176)]!==_0x7ec6e5&&_0xb65707['database']!==_0x43255c&&_0xb65707[_0x2a4a31(0x176)]!==_0x567ed9)&&(_0x130cfd[_0x2a4a31(0x176)]=_0xb65707[_0x2a4a31(0x176)]);if(_0xb65707[_0x2a4a31(0x198)])_0x130cfd[_0x2a4a31(0x195)]=_0xb65707[_0x2a4a31(0x198)];if(_0xb65707['llmProject'])_0x130cfd[_0x2a4a31(0x16e)]=_0xb65707[_0x2a4a31(0x181)];if(_0xb65707[_0x2a4a31(0x167)])_0x130cfd[_0x2a4a31(0x18a)]=_0xb65707['llmAgent'];if(_0xb65707[_0x2a4a31(0x185)])_0x130cfd['profile']=_0xb65707[_0x2a4a31(0x185)];this[_0x2a4a31(0x164)]={'cliFlags':_0x130cfd,'session':_0x30a9d1(_0x16ff74),'project':_0x30a9d1(_0x5396c7),'profile':_0x30a9d1(_0x357168?.['config']),'global':_0x30a9d1(_0x12b508)};const _0x4a43cf={...this[_0x2a4a31(0x164)][_0x2a4a31(0x171)],...this[_0x2a4a31(0x164)]['profile'],...this[_0x2a4a31(0x164)][_0x2a4a31(0x19d)],...this['layers'][_0x2a4a31(0x168)],...this['layers'][_0x2a4a31(0x190)]},_0x23247f=_0x4a43cf['site']||_0x2a4a31(0x188);this[_0x2a4a31(0x17d)]=resolveSite(_0x23247f),this[_0x2a4a31(0x176)]=_0x4a43cf[_0x2a4a31(0x176)],this[_0x2a4a31(0x195)]=_0x4a43cf[_0x2a4a31(0x195)],this['segment_path']=_0x4a43cf[_0x2a4a31(0x1a3)],this[_0x2a4a31(0x16e)]=_0x4a43cf[_0x2a4a31(0x16e)],this['llm_agent']=_0x4a43cf[_0x2a4a31(0x18a)],this[_0x2a4a31(0x17a)]=_0xb65707[_0x2a4a31(0x17a)]||![],this['logLevel']=_0xb65707[_0x2a4a31(0x17c)]??LogLevel['INFO'],this[_0x2a4a31(0x185)]=this[_0x2a4a31(0x1a6)]||undefined,this[_0x2a4a31(0x18f)]=getAPIKey(this['site'],this['activeProfile']||undefined);const _0x29a5bb=getConfigDir(),_0x58e9a8=a49_0x546cda['join'](_0x29a5bb,'sessions',this[_0x2a4a31(0x194)]+_0x2a4a31(0x197)),_0x473b8f=findProjectConfigPath(),_0x3f1d39=a49_0x546cda[_0x2a4a31(0x19a)](_0x29a5bb,_0x2a4a31(0x18e)),_0x6587fc=a49_0x546cda[_0x2a4a31(0x19a)](_0x29a5bb,_0x2a4a31(0x18b));let _0x1cd6b9=null,_0x3f0b76=null;this[_0x2a4a31(0x1a6)]&&(_0x1cd6b9=a49_0x546cda['join'](_0x29a5bb,_0x2a4a31(0x174),this['activeProfile'],'tdx.json'),_0x3f0b76=a49_0x546cda[_0x2a4a31(0x19a)](_0x29a5bb,_0x2a4a31(0x174),this['activeProfile'],_0x2a4a31(0x18b))),this[_0x2a4a31(0x183)]={'session':a49_0xd95b99[_0x2a4a31(0x180)](_0x58e9a8)?_0x58e9a8:null,'project':_0x473b8f,'profile':_0x1cd6b9&&a49_0xd95b99['existsSync'](_0x1cd6b9)?_0x1cd6b9:null,'profileCredentials':_0x3f0b76&&a49_0xd95b99[_0x2a4a31(0x180)](_0x3f0b76)?_0x3f0b76:null,'global':a49_0xd95b99[_0x2a4a31(0x180)](_0x3f1d39)?_0x3f1d39:null,'globalCredentials':a49_0xd95b99[_0x2a4a31(0x180)](_0x6587fc)?_0x6587fc:null};}[a49_0x2c5ae3(0x16b)](_0x190b74,_0xea362b){const _0x195b67=a49_0x2c5ae3;if(!_0xea362b)return _0x195b67(0x199);const _0x3cdd50=_0xea362b;if(this[_0x195b67(0x164)][_0x195b67(0x190)][_0x190b74]===_0x3cdd50){if(_0x190b74===_0x195b67(0x17d)&&_0x3cdd50===_0x195b67(0x188)&&!this[_0x195b67(0x164)][_0x195b67(0x168)]['site']&&!this[_0x195b67(0x164)][_0x195b67(0x19d)][_0x195b67(0x17d)]&&!this[_0x195b67(0x164)][_0x195b67(0x185)][_0x195b67(0x17d)]&&!this[_0x195b67(0x164)][_0x195b67(0x171)]['site'])return _0x195b67(0x179);return _0x195b67(0x18d)+_0x190b74['replace'](/_/g,'-');}if(this[_0x195b67(0x164)][_0x195b67(0x168)][_0x190b74]===_0x3cdd50)return _0x195b67(0x168);if(this[_0x195b67(0x164)]['project'][_0x190b74]===_0x3cdd50)return _0x195b67(0x19d);if(this[_0x195b67(0x164)][_0x195b67(0x185)][_0x190b74]===_0x3cdd50)return'profile:\x20'+this[_0x195b67(0x1a6)];if(this[_0x195b67(0x164)][_0x195b67(0x171)][_0x190b74]===_0x3cdd50)return _0x195b67(0x171);return _0x195b67(0x179);}[a49_0x2c5ae3(0x189)](){const _0x35b396=a49_0x2c5ae3,_0x474312=a49_0x546cda['join'](getConfigDir(),_0x35b396(0x18e));if(!a49_0xd95b99[_0x35b396(0x180)](_0x474312))return{};try{const _0x2193b3=a49_0xd95b99[_0x35b396(0x191)](_0x474312,_0x35b396(0x178));return JSON[_0x35b396(0x16d)](_0x2193b3);}catch{return{};}}[a49_0x2c5ae3(0x16c)](_0xa2537b){const _0x22b034=a49_0x2c5ae3;_0xa2537b[_0x22b034(0x17d)]=this[_0x22b034(0x17d)],!_0xa2537b[_0x22b034(0x176)]&&this[_0x22b034(0x176)]&&(_0xa2537b[_0x22b034(0x176)]=this[_0x22b034(0x176)]),!_0xa2537b['parentSegment']&&this[_0x22b034(0x195)]&&(_0xa2537b[_0x22b034(0x198)]=this[_0x22b034(0x195)]),!_0xa2537b['segmentPath']&&this[_0x22b034(0x1a3)]&&(_0xa2537b['segmentPath']=this['segment_path']),!_0xa2537b['llmProject']&&this[_0x22b034(0x16e)]&&(_0xa2537b[_0x22b034(0x181)]=this[_0x22b034(0x16e)]),!_0xa2537b[_0x22b034(0x167)]&&this[_0x22b034(0x18a)]&&(_0xa2537b[_0x22b034(0x167)]=this[_0x22b034(0x18a)]);}['getParameters'](){const _0x5b5ac3=a49_0x2c5ae3;return[{'key':_0x5b5ac3(0x17d),'value':this[_0x5b5ac3(0x17d)]},{'key':_0x5b5ac3(0x176),'value':this['database']},{'key':_0x5b5ac3(0x195),'value':this[_0x5b5ac3(0x195)]},{'key':_0x5b5ac3(0x1a3),'value':this[_0x5b5ac3(0x1a3)]},{'key':'llm_project','value':this['llm_project']},{'key':_0x5b5ac3(0x18a),'value':this[_0x5b5ac3(0x18a)]},{'key':_0x5b5ac3(0x185),'value':this[_0x5b5ac3(0x1a6)]||undefined}];}[a49_0x2c5ae3(0x172)](){const _0x2308db=a49_0x2c5ae3;console[_0x2308db(0x175)](_0x2308db(0x192));for(const {key:_0x28f190,value:_0x9f022c}of this[_0x2308db(0x186)]()){_0x9f022c&&console[_0x2308db(0x175)](_0x28f190+':\x20'+_0x9f022c);}}[a49_0x2c5ae3(0x19c)](){const _0x6294e2=a49_0x2c5ae3;console['log']('[context]');for(const {key:_0x1c968a,value:_0x429593}of this['getParameters']()){if(_0x429593){const _0x59b4ac=_0x1c968a===_0x6294e2(0x185)?_0x6294e2(0x1a7):'('+this['getSource'](_0x1c968a,_0x429593)+')';console[_0x6294e2(0x175)](_0x1c968a+':\x20'+_0x429593+'\x20'+_0x59b4ac);}}console[_0x6294e2(0x175)](_0x6294e2(0x165));const _0x4ac46f=[{'label':_0x6294e2(0x18c),'path':this[_0x6294e2(0x183)][_0x6294e2(0x168)],'extra':_0x6294e2(0x17b)+this[_0x6294e2(0x194)]+')'},{'label':_0x6294e2(0x170),'path':this['configFiles'][_0x6294e2(0x19d)]},{'label':_0x6294e2(0x1a4),'path':this['configFiles'][_0x6294e2(0x185)]},{'label':_0x6294e2(0x17f),'path':this[_0x6294e2(0x183)][_0x6294e2(0x196)]},{'label':_0x6294e2(0x166),'path':this[_0x6294e2(0x183)][_0x6294e2(0x171)]},{'label':_0x6294e2(0x193),'path':this['configFiles'][_0x6294e2(0x19e)]}];for(const {label:_0x5df64d,path:_0x322965,extra:_0x4ae84e}of _0x4ac46f){if(_0x322965)console[_0x6294e2(0x175)](_0x5df64d+':\x20'+_0x322965+'\x20✓'+(_0x4ae84e?'\x20'+_0x4ae84e:''));else{if(_0x5df64d===_0x6294e2(0x18c))console[_0x6294e2(0x175)](_0x5df64d+_0x6294e2(0x182)+this[_0x6294e2(0x194)]+')');else(_0x5df64d===_0x6294e2(0x170)||_0x5df64d===_0x6294e2(0x166))&&console['log'](_0x5df64d+_0x6294e2(0x19b));}}}async['resolveAPIKeyAsync'](){const _0x4ef631=a49_0x2c5ae3;return this[_0x4ef631(0x18f)]=await getAPIKeyAsync(this[_0x4ef631(0x17d)],this[_0x4ef631(0x1a6)]||undefined),this[_0x4ef631(0x18f)];}static async[a49_0x2c5ae3(0x1a1)](_0x2ed0a2){const _0x291697=new GlobalContext(_0x2ed0a2);return await _0x291697['resolveAPIKeyAsync'](),_0x291697;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a50_0x19e73d=a50_0x392f;(function(_0x30d1ce,_0x2d50a9){const _0x4c2605=a50_0x392f,_0x3bcbb6=_0x30d1ce();while(!![]){try{const _0x405601=parseInt(_0x4c2605(0x103))/0x1+parseInt(_0x4c2605(0xe3))/0x2*(parseInt(_0x4c2605(0x104))/0x3)+parseInt(_0x4c2605(0xe7))/0x4*(-parseInt(_0x4c2605(0xfc))/0x5)+-parseInt(_0x4c2605(0xeb))/0x6*(parseInt(_0x4c2605(0xfe))/0x7)+parseInt(_0x4c2605(0xed))/0x8*(parseInt(_0x4c2605(0xef))/0x9)+parseInt(_0x4c2605(0xe4))/0xa+-parseInt(_0x4c2605(0x105))/0xb;if(_0x405601===_0x2d50a9)break;else _0x3bcbb6['push'](_0x3bcbb6['shift']());}catch(_0x2d992f){_0x3bcbb6['push'](_0x3bcbb6['shift']());}}}(a50_0x37b3,0xb461d));const SERVICE_NAME=a50_0x19e73d(0xf3);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x516be0=a50_0x19e73d;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x4b287f=await import(_0x516be0(0xe5));return keyringModule=_0x4b287f[_0x516be0(0xfd)],keyringModule;}catch(_0x3d1da5){return keyringLoadError=_0x3d1da5 instanceof Error?_0x3d1da5:new Error(String(_0x3d1da5)),null;}}function getAccountName(_0x53abc5){const _0x1b19b5=a50_0x19e73d,_0xe48813=_0x53abc5||'';return _0x1b19b5(0xf5)+_0xe48813+_0x1b19b5(0x100);}export async function getKeychainAPIKey(_0x4b2039){const _0x2a29e0=a50_0x19e73d,_0x56ed64=await getKeychainAPIKeyWithStatus(_0x4b2039);if(_0x56ed64[_0x2a29e0(0xe8)])return _0x56ed64['value'];return _0x56ed64[_0x2a29e0(0xe1)]===_0x2a29e0(0xf7)&&console['error'](_0x2a29e0(0x102)+_0x56ed64[_0x2a29e0(0xf0)]),null;}function a50_0x392f(_0x360b6c,_0x32ff35){_0x360b6c=_0x360b6c-0xe1;const _0x37b386=a50_0x37b3();let _0x392fbf=_0x37b386[_0x360b6c];return _0x392fbf;}function a50_0x37b3(){const _0x553e0c=['Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','30piAVdu','toLowerCase','111496vkSRMo','not\x20found','423iScJPB','message','-25293','restricted','tdx','not_found','profile:','getPassword','access_denied','could\x20not\x20be\x20found','setPassword','__keychain_test__','unavailable','5051485qbsSpQ','keyring','1814491JjzaIR','deletePassword',':api_key','-25300','Warning:\x20','942745gIGSOs','3dmNjzQ','4836117RQPgor','System\x20keychain\x20is\x20not\x20available','reason','includes','2382914rNDPJp','6956130tijFDm','@zowe/secrets-for-zowe-sdk','not\x20supported','4jMJfFL','success','access'];a50_0x37b3=function(){return _0x553e0c;};return a50_0x37b3();}export async function getKeychainAPIKeyWithStatus(_0x5f5b55){const _0x1d8952=a50_0x19e73d;try{const _0x568405=await getKeyring();if(!_0x568405)return{'success':![],'reason':_0x1d8952(0xfb)};const _0x54629e=getAccountName(_0x5f5b55),_0x598b0d=await _0x568405['getPassword'](SERVICE_NAME,_0x54629e);if(_0x598b0d)return{'success':!![],'value':_0x598b0d};return{'success':![],'reason':_0x1d8952(0xf4)};}catch(_0x12a97f){const _0x42f61f=_0x12a97f instanceof Error?_0x12a97f[_0x1d8952(0xf0)]:String(_0x12a97f);if(_0x42f61f['includes'](_0x1d8952(0x101))||_0x42f61f['toLowerCase']()['includes'](_0x1d8952(0xf8))||_0x42f61f[_0x1d8952(0xec)]()['includes'](_0x1d8952(0xee)))return{'success':![],'reason':_0x1d8952(0xf4)};if(_0x42f61f[_0x1d8952(0xe2)](_0x1d8952(0xf1))||_0x42f61f[_0x1d8952(0xec)]()['includes'](_0x1d8952(0xf2))||_0x42f61f[_0x1d8952(0xec)]()[_0x1d8952(0xe2)](_0x1d8952(0xe9)))return{'success':![],'reason':_0x1d8952(0xf7),'message':_0x1d8952(0xea)};return{'success':![],'reason':_0x1d8952(0xfb),'message':_0x42f61f};}}export async function saveKeychainAPIKey(_0xbb07f8,_0x18b979){const _0x4d73a1=a50_0x19e73d,_0x2b365e=await getKeyring();if(!_0x2b365e)throw new Error(_0x4d73a1(0x106));const _0x1d9f36=getAccountName(_0x18b979);await _0x2b365e[_0x4d73a1(0xf9)](SERVICE_NAME,_0x1d9f36,_0xbb07f8);}export async function deleteKeychainAPIKey(_0x9248bf){const _0x502a17=a50_0x19e73d;try{const _0x385314=await getKeyring();if(!_0x385314)return![];const _0x3f7dd7=getAccountName(_0x9248bf);return await _0x385314[_0x502a17(0xff)](SERVICE_NAME,_0x3f7dd7);}catch{return![];}}export async function isKeychainAvailable(){const _0x4d69fb=a50_0x19e73d;try{const _0x230e35=await getKeyring();if(!_0x230e35)return![];return await _0x230e35[_0x4d69fb(0xf6)](SERVICE_NAME,_0x4d69fb(0xfa)),!![];}catch(_0x2b5dc8){const _0x2c3f22=_0x2b5dc8 instanceof Error?_0x2b5dc8[_0x4d69fb(0xf0)][_0x4d69fb(0xec)]():'';if(_0x2c3f22[_0x4d69fb(0xe2)]('not\x20available')||_0x2c3f22[_0x4d69fb(0xe2)](_0x4d69fb(0xe6))||_0x2c3f22['includes']('cannot\x20find'))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x1e49a4,_0x26a21e){const _0xb6230f=a51_0x706e,_0x29ed23=_0x1e49a4();while(!![]){try{const _0xc91a1a=-parseInt(_0xb6230f(0x173))/0x1+parseInt(_0xb6230f(0x189))/0x2+parseInt(_0xb6230f(0x18a))/0x3+-parseInt(_0xb6230f(0x174))/0x4+parseInt(_0xb6230f(0x167))/0x5*(parseInt(_0xb6230f(0x164))/0x6)+-parseInt(_0xb6230f(0x169))/0x7*(parseInt(_0xb6230f(0x15d))/0x8)+parseInt(_0xb6230f(0x19d))/0x9;if(_0xc91a1a===_0x26a21e)break;else _0x29ed23['push'](_0x29ed23['shift']());}catch(_0x34ba67){_0x29ed23['push'](_0x29ed23['shift']());}}}(a51_0x5028,0x8099c));import*as a51_0x14df1a from'node:fs';import*as a51_0x268f27 from'node:path';import{getConfigDir}from'./config.js';function a51_0x706e(_0x2671fb,_0x14862d){_0x2671fb=_0x2671fb-0x156;const _0x50282c=a51_0x5028();let _0x706e9c=_0x50282c[_0x2671fb];return _0x706e9c;}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x131742){const _0x4c1bd5=a51_0x706e,_0x39550c={};if(!_0x131742)return _0x39550c;for(const [_0xeda854,_0x240f09]of Object[_0x4c1bd5(0x197)](_0x131742)){_0xeda854!==_0x4c1bd5(0x172)&&_0x240f09!==undefined&&(_0x39550c[_0xeda854]=_0x240f09);}return _0x39550c;}export function getProfilesDir(){const _0x2275fb=a51_0x706e;return a51_0x268f27['join'](getConfigDir(),_0x2275fb(0x15a));}function getProfileDir(_0x50e213){return a51_0x268f27['join'](getProfilesDir(),_0x50e213);}function getProfileConfigPath(_0x4a6974){const _0x3bad2c=a51_0x706e;return a51_0x268f27[_0x3bad2c(0x176)](getProfileDir(_0x4a6974),_0x3bad2c(0x178));}function getProfileEnvPath(_0x425249){const _0x2390de=a51_0x706e;return a51_0x268f27[_0x2390de(0x176)](getProfileDir(_0x425249),_0x2390de(0x198));}function getGlobalConfigPath(){const _0xc5b422=a51_0x706e;return a51_0x268f27[_0xc5b422(0x176)](getConfigDir(),_0xc5b422(0x178));}function validateProfileName(_0x1bd8b3){const _0x10831b=a51_0x706e;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x1bd8b3))throw new Error(_0x10831b(0x17b)+_0x1bd8b3+_0x10831b(0x156));}function validateProfileConfig(_0x3de453,_0x578ec2){const _0x22cd50=a51_0x706e;if(typeof _0x3de453!==_0x22cd50(0x192)||_0x3de453===null)throw new Error('Profile\x20\x27'+_0x578ec2+_0x22cd50(0x16b));const _0x22f1b2=[_0x22cd50(0x172),_0x22cd50(0x186),_0x22cd50(0x15c),_0x22cd50(0x17c),_0x22cd50(0x17f),'llm_agent'],_0x434295=_0x3de453;for(const _0xfed396 of Object[_0x22cd50(0x158)](_0x434295)){!_0x22f1b2[_0x22cd50(0x180)](_0xfed396)&&console[_0x22cd50(0x171)](_0x22cd50(0x170)+_0x578ec2+_0x22cd50(0x19a)+_0xfed396+'\x27\x20will\x20be\x20ignored');}if(_0x434295[_0x22cd50(0x172)]!==undefined&&typeof _0x434295[_0x22cd50(0x172)]!=='string')throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x194));if(_0x434295[_0x22cd50(0x186)]!==undefined&&typeof _0x434295['site']!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x181));if(_0x434295['database']!==undefined&&typeof _0x434295[_0x22cd50(0x15c)]!=='string')throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x15b));if(_0x434295[_0x22cd50(0x17c)]!==undefined&&typeof _0x434295[_0x22cd50(0x17c)]!==_0x22cd50(0x199))throw new Error('Profile\x20\x27'+_0x578ec2+_0x22cd50(0x160));if(_0x434295['llm_project']!==undefined&&typeof _0x434295[_0x22cd50(0x17f)]!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x19c));if(_0x434295[_0x22cd50(0x157)]!==undefined&&typeof _0x434295[_0x22cd50(0x157)]!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x185));return!![];}function loadProfilesFromTdxJson(_0x4614b7,_0x13f6df){const _0x290279=a51_0x706e;if(!a51_0x14df1a['existsSync'](_0x4614b7))return[];try{const _0x3b2dfe=a51_0x14df1a['readFileSync'](_0x4614b7,_0x290279(0x17d)),_0x22544c=JSON[_0x290279(0x18e)](_0x3b2dfe);if(!_0x22544c[_0x290279(0x15a)]||typeof _0x22544c[_0x290279(0x15a)]!==_0x290279(0x192))return[];const _0x48354f=[];for(const [_0x5a0a1c,_0x3795e3]of Object[_0x290279(0x197)](_0x22544c[_0x290279(0x15a)])){try{validateProfileConfig(_0x3795e3,_0x5a0a1c);const _0x1e30df=getNewCredentialPath(_0x5a0a1c),_0x212359=getOldCredentialPath(_0x5a0a1c),_0x52c17e=a51_0x14df1a[_0x290279(0x175)](_0x1e30df)||a51_0x14df1a[_0x290279(0x175)](_0x212359);_0x48354f[_0x290279(0x179)]({'name':_0x5a0a1c,'config':_0x3795e3,'metadata':{'name':_0x5a0a1c,'createdAt':new Date()[_0x290279(0x17a)]()},'hasCredentials':_0x52c17e,'scope':_0x13f6df});}catch(_0x20ac00){_0x20ac00 instanceof Error&&(console['warn'](_0x290279(0x19b)+_0x4614b7+':'),console[_0x290279(0x171)]('\x20\x20'+_0x20ac00['message']+'\x0a'));}}return _0x48354f;}catch(_0x182139){return _0x182139 instanceof SyntaxError?(console[_0x290279(0x171)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x4614b7+_0x290279(0x16d)),console[_0x290279(0x171)](_0x290279(0x18d)+_0x182139[_0x290279(0x165)]+'\x0a')):console[_0x290279(0x171)](_0x290279(0x196)+_0x4614b7+':\x20'+_0x182139+'\x0a'),[];}}export function getNewCredentialPath(_0x3d6d66){const _0x518fa5=a51_0x706e;return a51_0x268f27[_0x518fa5(0x176)](getConfigDir(),'.env.'+_0x3d6d66);}function getOldCredentialPath(_0x557ba9){const _0x3e7869=a51_0x706e;return a51_0x268f27[_0x3e7869(0x176)](getProfilesDir(),_0x557ba9,_0x3e7869(0x198));}function a51_0x5028(){const _0x4dea8d=['set','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','entries','.env','string','\x27:\x20unknown\x20config\x20key\x20\x27','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','13798296yNavTZ','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','llm_agent','keys','stringify','profiles','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','database','8zyxvvT','length','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','some','\x20does\x20not\x20exist','name','6RiNqTu','message','from','1530040Vzeipe','\x20\x201.\x20Edit:\x20','4275663TZYXJL','Profile\x20\x27','\x27:\x20config\x20must\x20be\x20an\x20object','find',':\x20Invalid\x20JSON\x20syntax','Profile\x20','isDirectory','Warning:\x20Profile\x20\x27','warn','description','826063ZDrhjL','3565164ceCYzJ','existsSync','join','readFileSync','tdx.json','push','toISOString','Invalid\x20profile\x20name:\x20','parent_segment','utf-8','values','llm_project','includes','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','directory','filter','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','site','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','profile','1666736gQYuHU','547173aTIoTh','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','map','Error:\x20','parse','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','localeCompare','\x20\x20mv\x20\x22','object',',\x20creating\x20new\x20file','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string'];a51_0x5028=function(){return _0x4dea8d;};return a51_0x5028();}function loadProfilesFromTdxJsonFiles(){const _0x496ea8=a51_0x706e,_0x41ea2b=[],_0x3c04fd=findProjectConfigPath();_0x3c04fd&&_0x41ea2b[_0x496ea8(0x179)](...loadProfilesFromTdxJson(_0x3c04fd,'local'));const _0x5c30fa=a51_0x268f27[_0x496ea8(0x176)](getConfigDir(),_0x496ea8(0x178));return _0x41ea2b[_0x496ea8(0x179)](...loadProfilesFromTdxJson(_0x5c30fa,'user')),_0x41ea2b;}function loadProfilesFromDirectories(){const _0x4afdfe=a51_0x706e,_0xef0494=getProfilesDir();if(!a51_0x14df1a['existsSync'](_0xef0494))return[];try{return a51_0x14df1a['readdirSync'](_0xef0494,{'withFileTypes':!![]})[_0x4afdfe(0x184)](_0x44e5e3=>_0x44e5e3[_0x4afdfe(0x16f)]())[_0x4afdfe(0x18c)](_0x5cae48=>_0x5cae48['name'])['filter'](_0x2505d4=>{const _0xefe896=_0x4afdfe,_0x45c2c8=getProfileConfigPath(_0x2505d4),_0x596fce=getProfileEnvPath(_0x2505d4);return a51_0x14df1a[_0xefe896(0x175)](_0x45c2c8)||a51_0x14df1a[_0xefe896(0x175)](_0x596fce);})[_0x4afdfe(0x18c)](_0xb1a361=>{const _0x2f7532=_0x4afdfe,_0x36f762=loadProfileFromDirectory(_0xb1a361);if(_0x36f762)return{..._0x36f762,'scope':_0x2f7532(0x183)};return null;})['filter'](_0x5c260d=>_0x5c260d!==null);}catch{return[];}}function loadProfileFromDirectory(_0x56454c){const _0x3c798f=a51_0x706e,_0x577cc2=getProfileConfigPath(_0x56454c),_0x3a6268=getOldCredentialPath(_0x56454c);if(!a51_0x14df1a[_0x3c798f(0x175)](_0x577cc2)&&!a51_0x14df1a[_0x3c798f(0x175)](_0x3a6268))return null;let _0x3038d0={},_0x3babd7={'name':_0x56454c,'createdAt':new Date()[_0x3c798f(0x17a)]()};if(a51_0x14df1a[_0x3c798f(0x175)](_0x577cc2))try{const _0x22061b=a51_0x14df1a[_0x3c798f(0x177)](_0x577cc2,_0x3c798f(0x17d)),_0x2d7850=JSON[_0x3c798f(0x18e)](_0x22061b),{metadata:_0x10ec9b,..._0x2c88f1}=_0x2d7850;_0x3038d0=_0x2c88f1,_0x10ec9b&&(_0x3babd7=_0x10ec9b);}catch{}return{'name':_0x56454c,'config':_0x3038d0,'metadata':_0x3babd7,'hasCredentials':a51_0x14df1a['existsSync'](_0x3a6268),'scope':_0x3c798f(0x183)};}export function listProfiles(){const _0x19c023=a51_0x706e,_0x2c1ffd=loadProfilesFromTdxJsonFiles(),_0x9478bf=loadProfilesFromDirectories();if(_0x9478bf[_0x19c023(0x15e)]>0x0){const _0x1df6bd=_0x9478bf[_0x19c023(0x18c)](_0x5f001a=>_0x5f001a[_0x19c023(0x163)])['join'](',\x20'),_0xaf7c40=getConfigDir();console[_0x19c023(0x171)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x1df6bd),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x19c023(0x171)](_0x19c023(0x168)+a51_0x268f27[_0x19c023(0x176)](_0xaf7c40,_0x19c023(0x178))),console[_0x19c023(0x171)](_0x19c023(0x18f)),console[_0x19c023(0x171)](_0x19c023(0x187));}const _0x853066=[..._0x2c1ffd,..._0x9478bf],_0x1fa03f=new Map();for(const _0xc439b2 of _0x853066){!_0x1fa03f['has'](_0xc439b2[_0x19c023(0x163)])&&_0x1fa03f[_0x19c023(0x195)](_0xc439b2[_0x19c023(0x163)],_0xc439b2);}return Array[_0x19c023(0x166)](_0x1fa03f[_0x19c023(0x17e)]())['sort']((_0x5e4281,_0x37443b)=>_0x5e4281[_0x19c023(0x163)][_0x19c023(0x190)](_0x37443b[_0x19c023(0x163)]));}export function profileExists(_0x40dbab){const _0x1640ec=a51_0x706e,_0x194cea=listProfiles();return _0x194cea[_0x1640ec(0x161)](_0x5a94dc=>_0x5a94dc[_0x1640ec(0x163)]===_0x40dbab);}export function loadProfile(_0x57d39c){const _0x12358b=a51_0x706e;validateProfileName(_0x57d39c);const _0x139d76=listProfiles(),_0x43b28e=_0x139d76[_0x12358b(0x16c)](_0x214710=>_0x214710[_0x12358b(0x163)]===_0x57d39c);return _0x43b28e||null;}export function saveProfile(_0x5a64f7,_0x1dcea7,_0x31ba3c=![]){saveProfileToUserConfig(_0x5a64f7,_0x1dcea7);}export function deleteProfile(_0x749683){const _0x2e83a7=a51_0x706e;validateProfileName(_0x749683);const _0x3333af=getProfileDir(_0x749683);if(!a51_0x14df1a['existsSync'](_0x3333af))throw new Error(_0x2e83a7(0x16e)+_0x749683+_0x2e83a7(0x162));a51_0x14df1a['rmSync'](_0x3333af,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x3fa8a8,_0x876f86){const _0x281ba3=a51_0x706e;validateProfileName(_0x3fa8a8);const _0x1fdcb2=getGlobalConfigPath(),_0x54f9fc=getConfigDir();!a51_0x14df1a[_0x281ba3(0x175)](_0x54f9fc)&&createSecureDirectory(_0x54f9fc);let _0x483a24={};if(a51_0x14df1a['existsSync'](_0x1fdcb2))try{const _0x1f9a77=a51_0x14df1a[_0x281ba3(0x177)](_0x1fdcb2,_0x281ba3(0x17d));_0x483a24=JSON[_0x281ba3(0x18e)](_0x1f9a77);}catch{console[_0x281ba3(0x171)](_0x281ba3(0x182)+_0x1fdcb2+_0x281ba3(0x193));}!_0x483a24[_0x281ba3(0x15a)]&&(_0x483a24['profiles']={}),_0x483a24['profiles'][_0x3fa8a8]=_0x876f86,writeSecureFile(_0x1fdcb2,JSON[_0x281ba3(0x159)](_0x483a24,null,0x2));}export function getActiveProfile(){const _0x99ae80=a51_0x706e,_0x5365a3=loadSessionContext();if(_0x5365a3?.[_0x99ae80(0x188)])return _0x5365a3['profile'];const _0x496311=getGlobalConfigPath();if(!a51_0x14df1a[_0x99ae80(0x175)](_0x496311))return null;try{const _0x723492=a51_0x14df1a['readFileSync'](_0x496311,_0x99ae80(0x17d)),_0x24691c=JSON[_0x99ae80(0x18e)](_0x723492);return _0x24691c[_0x99ae80(0x188)]||null;}catch{return null;}}export function createProfile(_0x113834,_0x1886c5){const _0x123d03=a51_0x706e;validateProfileName(_0x113834);if(profileExists(_0x113834))throw new Error(_0x123d03(0x16e)+_0x113834+'\x20already\x20exists');saveProfile(_0x113834,_0x1886c5);}export function saveProfileCredentials(_0x59a5a1,_0x3a54e3){const _0x432ca8=a51_0x706e;validateProfileName(_0x59a5a1);if(!profileExists(_0x59a5a1))throw new Error(_0x432ca8(0x16e)+_0x59a5a1+_0x432ca8(0x162));const _0x45af11=getNewCredentialPath(_0x59a5a1);writeSecureFile(_0x45af11,_0x3a54e3);}export function loadProfileCredentials(_0x355336){const _0x30be96=a51_0x706e;validateProfileName(_0x355336);const _0x10845f=getNewCredentialPath(_0x355336);if(a51_0x14df1a[_0x30be96(0x175)](_0x10845f))try{return a51_0x14df1a[_0x30be96(0x177)](_0x10845f,_0x30be96(0x17d));}catch{}const _0x5bb120=getOldCredentialPath(_0x355336);if(a51_0x14df1a['existsSync'](_0x5bb120)){console[_0x30be96(0x171)](_0x30be96(0x15f)+_0x355336+'\x27'),console[_0x30be96(0x171)]('To\x20migrate:'),console['warn'](_0x30be96(0x191)+_0x5bb120+'\x22\x20\x22'+_0x10845f+'\x22'),console['warn'](_0x30be96(0x18b));try{return a51_0x14df1a[_0x30be96(0x177)](_0x5bb120,_0x30be96(0x17d));}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x4cd448,_0x5ee62b){const _0xa20f5f=a51_0x2175,_0x248110=_0x4cd448();while(!![]){try{const _0x205615=-parseInt(_0xa20f5f(0x1fe))/0x1*(-parseInt(_0xa20f5f(0x209))/0x2)+-parseInt(_0xa20f5f(0x203))/0x3+parseInt(_0xa20f5f(0x1e7))/0x4*(parseInt(_0xa20f5f(0x212))/0x5)+parseInt(_0xa20f5f(0x1ec))/0x6*(parseInt(_0xa20f5f(0x1e5))/0x7)+-parseInt(_0xa20f5f(0x1fa))/0x8+-parseInt(_0xa20f5f(0x1df))/0x9*(-parseInt(_0xa20f5f(0x21e))/0xa)+parseInt(_0xa20f5f(0x20b))/0xb*(parseInt(_0xa20f5f(0x20a))/0xc);if(_0x205615===_0x5ee62b)break;else _0x248110['push'](_0x248110['shift']());}catch(_0x53c6ec){_0x248110['push'](_0x248110['shift']());}}}(a51_0x1d6f,0xacc47));import*as a51_0x266790 from'node:fs';import*as a51_0x41b3a1 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x189071){const _0x21962b=a51_0x2175,_0x475361={};if(!_0x189071)return _0x475361;for(const [_0x36cb2e,_0x540cee]of Object[_0x21962b(0x1f4)](_0x189071)){_0x36cb2e!=='description'&&_0x540cee!==undefined&&(_0x475361[_0x36cb2e]=_0x540cee);}return _0x475361;}export function getProfilesDir(){const _0x197882=a51_0x2175;return a51_0x41b3a1[_0x197882(0x201)](getConfigDir(),_0x197882(0x1f6));}function getProfileDir(_0x4a74b3){const _0x282182=a51_0x2175;return a51_0x41b3a1[_0x282182(0x201)](getProfilesDir(),_0x4a74b3);}function getProfileConfigPath(_0x38f9f5){const _0x5537d9=a51_0x2175;return a51_0x41b3a1[_0x5537d9(0x201)](getProfileDir(_0x38f9f5),_0x5537d9(0x1f5));}function getProfileEnvPath(_0x5a189e){const _0x241950=a51_0x2175;return a51_0x41b3a1[_0x241950(0x201)](getProfileDir(_0x5a189e),_0x241950(0x1f1));}function getGlobalConfigPath(){return a51_0x41b3a1['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x3969ca){const _0x393fbd=a51_0x2175;if(!/^[a-zA-Z0-9_-]+$/[_0x393fbd(0x1e9)](_0x3969ca))throw new Error(_0x393fbd(0x213)+_0x3969ca+_0x393fbd(0x207));}function validateProfileConfig(_0x1da3f,_0x3ef6a7){const _0xacfa44=a51_0x2175;if(typeof _0x1da3f!=='object'||_0x1da3f===null)throw new Error('Profile\x20\x27'+_0x3ef6a7+_0xacfa44(0x20f));const _0x334ff6=['description',_0xacfa44(0x1f2),'database','parent_segment','llm_project',_0xacfa44(0x20e)],_0x198596=_0x1da3f;for(const _0x3727b7 of Object[_0xacfa44(0x217)](_0x198596)){!_0x334ff6[_0xacfa44(0x21a)](_0x3727b7)&&console[_0xacfa44(0x21c)](_0xacfa44(0x200)+_0x3ef6a7+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x3727b7+_0xacfa44(0x1e3));}if(_0x198596[_0xacfa44(0x210)]!==undefined&&typeof _0x198596['description']!==_0xacfa44(0x220))throw new Error('Profile\x20\x27'+_0x3ef6a7+_0xacfa44(0x205));if(_0x198596['site']!==undefined&&typeof _0x198596[_0xacfa44(0x1f2)]!==_0xacfa44(0x220))throw new Error('Profile\x20\x27'+_0x3ef6a7+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x198596[_0xacfa44(0x202)]!==undefined&&typeof _0x198596[_0xacfa44(0x202)]!=='string')throw new Error(_0xacfa44(0x218)+_0x3ef6a7+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x198596[_0xacfa44(0x215)]!==undefined&&typeof _0x198596[_0xacfa44(0x215)]!==_0xacfa44(0x220))throw new Error('Profile\x20\x27'+_0x3ef6a7+_0xacfa44(0x222));if(_0x198596['llm_project']!==undefined&&typeof _0x198596[_0xacfa44(0x221)]!=='string')throw new Error(_0xacfa44(0x218)+_0x3ef6a7+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x198596['llm_agent']!==undefined&&typeof _0x198596[_0xacfa44(0x20e)]!==_0xacfa44(0x220))throw new Error(_0xacfa44(0x218)+_0x3ef6a7+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x32ad23,_0x27c68c){const _0x1dba89=a51_0x2175;if(!a51_0x266790[_0x1dba89(0x1f3)](_0x32ad23))return[];try{const _0x705f0a=a51_0x266790['readFileSync'](_0x32ad23,'utf-8'),_0x4b9a90=JSON[_0x1dba89(0x1ff)](_0x705f0a);if(!_0x4b9a90['profiles']||typeof _0x4b9a90['profiles']!=='object')return[];const _0x2d47ea=[];for(const [_0x484d39,_0x292c3d]of Object['entries'](_0x4b9a90['profiles'])){try{validateProfileConfig(_0x292c3d,_0x484d39);const _0x41a0af=getNewCredentialPath(_0x484d39),_0x5436eb=getOldCredentialPath(_0x484d39),_0x1ee94d=a51_0x266790[_0x1dba89(0x1f3)](_0x41a0af)||a51_0x266790[_0x1dba89(0x1f3)](_0x5436eb);_0x2d47ea[_0x1dba89(0x1f7)]({'name':_0x484d39,'config':_0x292c3d,'metadata':{'name':_0x484d39,'createdAt':new Date()[_0x1dba89(0x1de)]()},'hasCredentials':_0x1ee94d,'scope':_0x27c68c});}catch(_0x285652){_0x285652 instanceof Error&&(console[_0x1dba89(0x21c)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x32ad23+':'),console[_0x1dba89(0x21c)]('\x20\x20'+_0x285652['message']+'\x0a'));}}return _0x2d47ea;}catch(_0x342ed3){return _0x342ed3 instanceof SyntaxError?(console[_0x1dba89(0x21c)](_0x1dba89(0x1fb)+_0x32ad23+_0x1dba89(0x1e2)),console[_0x1dba89(0x21c)](_0x1dba89(0x204)+_0x342ed3[_0x1dba89(0x1da)]+'\x0a')):console[_0x1dba89(0x21c)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x32ad23+':\x20'+_0x342ed3+'\x0a'),[];}}export function getNewCredentialPath(_0x217813){const _0xc5b24=a51_0x2175;return a51_0x41b3a1[_0xc5b24(0x201)](getConfigDir(),_0xc5b24(0x1ed)+_0x217813);}function getOldCredentialPath(_0x4f8b80){const _0x17186d=a51_0x2175;return a51_0x41b3a1[_0x17186d(0x201)](getProfilesDir(),_0x4f8b80,_0x17186d(0x1f1));}function loadProfilesFromTdxJsonFiles(){const _0xc35583=a51_0x2175,_0x1499f5=[],_0x4b73ed=findProjectConfigPath();_0x4b73ed&&_0x1499f5[_0xc35583(0x1f7)](...loadProfilesFromTdxJson(_0x4b73ed,_0xc35583(0x1dc)));const _0x136b4d=a51_0x41b3a1['join'](getConfigDir(),_0xc35583(0x1f5));return _0x1499f5[_0xc35583(0x1f7)](...loadProfilesFromTdxJson(_0x136b4d,_0xc35583(0x1f0))),_0x1499f5;}function a51_0x2175(_0x5149b7,_0x38876a){_0x5149b7=_0x5149b7-0x1d7;const _0x1d6f18=a51_0x1d6f();let _0x21756d=_0x1d6f18[_0x5149b7];return _0x21756d;}function loadProfilesFromDirectories(){const _0x29689b=a51_0x2175,_0x5c5c87=getProfilesDir();if(!a51_0x266790[_0x29689b(0x1f3)](_0x5c5c87))return[];try{return a51_0x266790['readdirSync'](_0x5c5c87,{'withFileTypes':!![]})['filter'](_0x4a007d=>_0x4a007d[_0x29689b(0x20c)]())['map'](_0x3092cb=>_0x3092cb[_0x29689b(0x21b)])[_0x29689b(0x1fc)](_0x228e82=>{const _0x460fec=_0x29689b,_0x370eab=getProfileConfigPath(_0x228e82),_0x468f5c=getProfileEnvPath(_0x228e82);return a51_0x266790[_0x460fec(0x1f3)](_0x370eab)||a51_0x266790['existsSync'](_0x468f5c);})['map'](_0x134fed=>{const _0x5a6b28=_0x29689b,_0x4bc6a6=loadProfileFromDirectory(_0x134fed);if(_0x4bc6a6)return{..._0x4bc6a6,'scope':_0x5a6b28(0x1f9)};return null;})[_0x29689b(0x1fc)](_0x253631=>_0x253631!==null);}catch{return[];}}function loadProfileFromDirectory(_0x727f02){const _0x40d973=a51_0x2175,_0x43d931=getProfileConfigPath(_0x727f02),_0xc1bfcc=getOldCredentialPath(_0x727f02);if(!a51_0x266790[_0x40d973(0x1f3)](_0x43d931)&&!a51_0x266790[_0x40d973(0x1f3)](_0xc1bfcc))return null;let _0x4da8af={},_0x4a95a8={'name':_0x727f02,'createdAt':new Date()['toISOString']()};if(a51_0x266790['existsSync'](_0x43d931))try{const _0xcc19e6=a51_0x266790['readFileSync'](_0x43d931,'utf-8'),_0x4a56fc=JSON['parse'](_0xcc19e6),{metadata:_0x3cec0c,..._0x2ef86b}=_0x4a56fc;_0x4da8af=_0x2ef86b,_0x3cec0c&&(_0x4a95a8=_0x3cec0c);}catch{}return{'name':_0x727f02,'config':_0x4da8af,'metadata':_0x4a95a8,'hasCredentials':a51_0x266790[_0x40d973(0x1f3)](_0xc1bfcc),'scope':_0x40d973(0x1f9)};}export function listProfiles(){const _0x54112d=a51_0x2175,_0x2ba7fb=loadProfilesFromTdxJsonFiles(),_0x1f0cf6=loadProfilesFromDirectories();if(_0x1f0cf6['length']>0x0){const _0x18a0f1=_0x1f0cf6[_0x54112d(0x223)](_0x43588f=>_0x43588f[_0x54112d(0x21b)])['join'](',\x20'),_0x3e3b30=getConfigDir();console[_0x54112d(0x21c)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x18a0f1),console[_0x54112d(0x21c)](_0x54112d(0x216)),console[_0x54112d(0x21c)](_0x54112d(0x1dd)+a51_0x41b3a1[_0x54112d(0x201)](_0x3e3b30,'tdx.json')),console[_0x54112d(0x21c)](_0x54112d(0x211)),console[_0x54112d(0x21c)](_0x54112d(0x1e8));}const _0x2db01e=[..._0x2ba7fb,..._0x1f0cf6],_0x2fc966=new Map();for(const _0x572ae4 of _0x2db01e){!_0x2fc966[_0x54112d(0x1ea)](_0x572ae4[_0x54112d(0x21b)])&&_0x2fc966[_0x54112d(0x20d)](_0x572ae4[_0x54112d(0x21b)],_0x572ae4);}return Array[_0x54112d(0x1ee)](_0x2fc966[_0x54112d(0x1db)]())[_0x54112d(0x1e1)]((_0x5cd9c0,_0x4a465c)=>_0x5cd9c0[_0x54112d(0x21b)]['localeCompare'](_0x4a465c[_0x54112d(0x21b)]));}export function profileExists(_0x555ab5){const _0x3942f7=a51_0x2175,_0x38e6a9=listProfiles();return _0x38e6a9[_0x3942f7(0x208)](_0x3c45e0=>_0x3c45e0[_0x3942f7(0x21b)]===_0x555ab5);}export function loadProfile(_0x433575){const _0x16b5fa=a51_0x2175;validateProfileName(_0x433575);const _0x3cb66b=listProfiles(),_0x4ad840=_0x3cb66b[_0x16b5fa(0x1e0)](_0xc42240=>_0xc42240['name']===_0x433575);return _0x4ad840||null;}function a51_0x1d6f(){const _0x5ec452=['\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','590RoGMuK','Profile\x20','string','llm_project','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','map','readFileSync','\x20already\x20exists','profile','message','values','local','\x20\x201.\x20Edit:\x20','toISOString','2286cHBAqY','find','sort',':\x20Invalid\x20JSON\x20syntax','\x27\x20will\x20be\x20ignored','To\x20migrate:','2470363JdrCWq','\x20\x20mv\x20\x22','86140aDtDQq','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','test','has',',\x20creating\x20new\x20file','6RMRpNz','.env.','from','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','user','.env','site','existsSync','entries','tdx.json','profiles','push','\x22\x20\x22','directory','1927816SIINzI','\x0aWarning:\x20Failed\x20to\x20parse\x20','filter','rmSync','1kgKVck','parse','Warning:\x20Profile\x20\x27','join','database','2959752HFGHpq','Error:\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','stringify','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','some','1271052wvLzXE','36XMcAAS','731885tpnbIa','isDirectory','set','llm_agent','\x27:\x20config\x20must\x20be\x20an\x20object','description','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','170KHaomf','Invalid\x20profile\x20name:\x20','\x20does\x20not\x20exist','parent_segment','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','keys','Profile\x20\x27','utf-8','includes','name','warn'];a51_0x1d6f=function(){return _0x5ec452;};return a51_0x1d6f();}export function saveProfile(_0x31e53d,_0x4060a1,_0x241172=![]){saveProfileToUserConfig(_0x31e53d,_0x4060a1);}export function deleteProfile(_0x589165){const _0x1381a8=a51_0x2175;validateProfileName(_0x589165);const _0x42ec06=getProfileDir(_0x589165);if(!a51_0x266790[_0x1381a8(0x1f3)](_0x42ec06))throw new Error(_0x1381a8(0x21f)+_0x589165+_0x1381a8(0x214));a51_0x266790[_0x1381a8(0x1fd)](_0x42ec06,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1f63e2,_0x2ba7ca){const _0x1841dd=a51_0x2175;validateProfileName(_0x1f63e2);const _0x48106b=getGlobalConfigPath(),_0x60c05b=getConfigDir();!a51_0x266790[_0x1841dd(0x1f3)](_0x60c05b)&&createSecureDirectory(_0x60c05b);let _0x1f3bc9={};if(a51_0x266790['existsSync'](_0x48106b))try{const _0x114cd7=a51_0x266790[_0x1841dd(0x1d7)](_0x48106b,_0x1841dd(0x219));_0x1f3bc9=JSON['parse'](_0x114cd7);}catch{console[_0x1841dd(0x21c)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x48106b+_0x1841dd(0x1eb));}!_0x1f3bc9[_0x1841dd(0x1f6)]&&(_0x1f3bc9[_0x1841dd(0x1f6)]={}),_0x1f3bc9[_0x1841dd(0x1f6)][_0x1f63e2]=_0x2ba7ca,writeSecureFile(_0x48106b,JSON[_0x1841dd(0x206)](_0x1f3bc9,null,0x2));}export function getActiveProfile(){const _0x351a22=a51_0x2175,_0x351ef5=loadSessionContext();if(_0x351ef5?.[_0x351a22(0x1d9)])return _0x351ef5[_0x351a22(0x1d9)];const _0x4d0eb7=getGlobalConfigPath();if(!a51_0x266790[_0x351a22(0x1f3)](_0x4d0eb7))return null;try{const _0x406c8c=a51_0x266790[_0x351a22(0x1d7)](_0x4d0eb7,_0x351a22(0x219)),_0x41f637=JSON[_0x351a22(0x1ff)](_0x406c8c);return _0x41f637[_0x351a22(0x1d9)]||null;}catch{return null;}}export function createProfile(_0xfc8ca,_0x221997){const _0xae32ba=a51_0x2175;validateProfileName(_0xfc8ca);if(profileExists(_0xfc8ca))throw new Error(_0xae32ba(0x21f)+_0xfc8ca+_0xae32ba(0x1d8));saveProfile(_0xfc8ca,_0x221997);}export function saveProfileCredentials(_0x51b9e3,_0x5377b6){const _0x2aace9=a51_0x2175;validateProfileName(_0x51b9e3);if(!profileExists(_0x51b9e3))throw new Error('Profile\x20'+_0x51b9e3+_0x2aace9(0x214));const _0x1caf1a=getNewCredentialPath(_0x51b9e3);writeSecureFile(_0x1caf1a,_0x5377b6);}export function loadProfileCredentials(_0x105f7c){const _0x535dab=a51_0x2175;validateProfileName(_0x105f7c);const _0x225c2b=getNewCredentialPath(_0x105f7c);if(a51_0x266790[_0x535dab(0x1f3)](_0x225c2b))try{return a51_0x266790[_0x535dab(0x1d7)](_0x225c2b,_0x535dab(0x219));}catch{}const _0x4260b3=getOldCredentialPath(_0x105f7c);if(a51_0x266790[_0x535dab(0x1f3)](_0x4260b3)){console[_0x535dab(0x21c)](_0x535dab(0x21d)+_0x105f7c+'\x27'),console[_0x535dab(0x21c)](_0x535dab(0x1e4)),console['warn'](_0x535dab(0x1e6)+_0x4260b3+_0x535dab(0x1f8)+_0x225c2b+'\x22'),console[_0x535dab(0x21c)](_0x535dab(0x1ef));try{return a51_0x266790[_0x535dab(0x1d7)](_0x4260b3,'utf-8');}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a52_0x1614e4=a52_0x4cf5;function a52_0x4a16(){const _0x217db8=['Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8','includes','ENOENT','1642096EfaTFv','writeFileSync','Failed\x20to\x20load\x20project\x20config\x20from\x20',').\x20','cwd','dirname','Warning:\x20\x27profile\x27\x20field\x20in\x20','7oQYKbP','tdx.json','36885IMZSpi','507528VXnayz','join','3861801qSUSjU','1165632cHkeQB','267gHMepC','TD_API_KEY','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','\x20is\x20ignored.\x20','294016oQTqxh','api_key','654TvKDVG','stringify','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'];a52_0x4a16=function(){return _0x217db8;};return a52_0x4a16();}function a52_0x4cf5(_0x173838,_0x4791a7){_0x173838=_0x173838-0x10a;const _0x4a1650=a52_0x4a16();let _0x4cf5cf=_0x4a1650[_0x173838];return _0x4cf5cf;}(function(_0x4ac4ee,_0x4f6ca6){const _0x3e25de=a52_0x4cf5,_0x399ae1=_0x4ac4ee();while(!![]){try{const _0x14b287=-parseInt(_0x3e25de(0x119))/0x1+parseInt(_0x3e25de(0x11b))/0x2*(parseInt(_0x3e25de(0x115))/0x3)+-parseInt(_0x3e25de(0x114))/0x4+parseInt(_0x3e25de(0x110))/0x5+parseInt(_0x3e25de(0x111))/0x6+-parseInt(_0x3e25de(0x10e))/0x7*(-parseInt(_0x3e25de(0x122))/0x8)+parseInt(_0x3e25de(0x113))/0x9;if(_0x14b287===_0x4f6ca6)break;else _0x399ae1['push'](_0x399ae1['shift']());}catch(_0x3a7579){_0x399ae1['push'](_0x399ae1['shift']());}}}(a52_0x4a16,0x2980b));import*as a52_0x4b46b9 from'node:fs';import*as a52_0xc81cf9 from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x1614e4(0x10f);export function findProjectConfigPath(_0x577a31){const _0x555791=a52_0x1614e4;let _0x14c7f6=_0x577a31||process[_0x555791(0x10b)]();while(!![]){const _0x502396=a52_0xc81cf9['join'](_0x14c7f6,PROJECT_CONFIG_FILENAME);if(a52_0x4b46b9['existsSync'](_0x502396))return _0x502396;const _0x4c6d9b=a52_0xc81cf9['dirname'](_0x14c7f6);if(_0x4c6d9b===_0x14c7f6)return null;_0x14c7f6=_0x4c6d9b;}}export function loadProjectConfig(_0x527220){const _0x2ff044=a52_0x1614e4,_0x1d6b3f=findProjectConfigPath(_0x527220);if(!_0x1d6b3f)return null;try{const _0x34690d=a52_0x4b46b9['readFileSync'](_0x1d6b3f,_0x2ff044(0x11f)),_0x5d6751=JSON['parse'](_0x34690d),_0x14359c=JSON[_0x2ff044(0x11c)](_0x5d6751);if(_0x14359c[_0x2ff044(0x120)]('TD_API_KEY')||_0x14359c[_0x2ff044(0x120)]('apiKey')||_0x14359c[_0x2ff044(0x120)](_0x2ff044(0x11a)))throw new Error(_0x2ff044(0x11e)+_0x1d6b3f+_0x2ff044(0x10a)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x108bbc,profile:_0x4cd7a0,..._0x2c2dee}=_0x5d6751;return _0x4cd7a0&&console['warn'](_0x2ff044(0x10d)+_0x1d6b3f+_0x2ff044(0x118)+_0x2ff044(0x11d)),_0x2c2dee;}catch(_0x1090a3){if(_0x1090a3 instanceof Error&&'code'in _0x1090a3&&_0x1090a3['code']===_0x2ff044(0x121))return null;throw new Error(_0x2ff044(0x124)+_0x1d6b3f+':\x20'+_0x1090a3);}}export function saveProjectConfig(_0x35ee5e,_0x36ac0a){const _0x19afa3=a52_0x1614e4,_0x10baf1=_0x36ac0a||process[_0x19afa3(0x10b)](),_0x444f57=a52_0xc81cf9[_0x19afa3(0x112)](_0x10baf1,PROJECT_CONFIG_FILENAME),_0x477f76=JSON['stringify'](_0x35ee5e);if(_0x477f76[_0x19afa3(0x120)](_0x19afa3(0x116))||_0x477f76[_0x19afa3(0x120)]('apiKey')||_0x477f76[_0x19afa3(0x120)]('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if('profile'in _0x35ee5e)throw new Error(_0x19afa3(0x117));a52_0x4b46b9[_0x19afa3(0x123)](_0x444f57,JSON['stringify'](_0x35ee5e,null,0x2));}export function hasProjectConfig(_0x1ac66c){return findProjectConfigPath(_0x1ac66c)!==null;}export function getProjectRoot(_0x2b37da){const _0x4838b9=a52_0x1614e4,_0xde75d=findProjectConfigPath(_0x2b37da);return _0xde75d?a52_0xc81cf9[_0x4838b9(0x10c)](_0xde75d):null;}
|