@treasuredata/tdx 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/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.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/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.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.d.ts +27 -20
- package/dist/sdk/llm.d.ts.map +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/llm.js.map +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-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.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-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
|
-
const
|
|
1
|
+
const a42_0x32dbba=a42_0x7b31;(function(_0x1ae02f,_0x4b25aa){const _0x69ab8e=a42_0x7b31,_0x587aeb=_0x1ae02f();while(!![]){try{const _0x577480=parseInt(_0x69ab8e(0x1ce))/0x1*(parseInt(_0x69ab8e(0x1c1))/0x2)+parseInt(_0x69ab8e(0x1ea))/0x3*(parseInt(_0x69ab8e(0x1c7))/0x4)+-parseInt(_0x69ab8e(0x1e8))/0x5+-parseInt(_0x69ab8e(0x1c6))/0x6*(parseInt(_0x69ab8e(0x1cd))/0x7)+parseInt(_0x69ab8e(0x1e0))/0x8+parseInt(_0x69ab8e(0x1c4))/0x9*(parseInt(_0x69ab8e(0x1c5))/0xa)+-parseInt(_0x69ab8e(0x1ee))/0xb;if(_0x577480===_0x4b25aa)break;else _0x587aeb['push'](_0x587aeb['shift']());}catch(_0x11c6a1){_0x587aeb['push'](_0x587aeb['shift']());}}}(a42_0x4dac,0x78dee));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';function a42_0x7b31(_0x3a69b1,_0x4d3b3d){_0x3a69b1=_0x3a69b1-0x1bc;const _0x4daccd=a42_0x4dac();let _0x7b31ba=_0x4daccd[_0x3a69b1];return _0x7b31ba;}import{parseAgentRef}from'../utils/agent-ref-parser.js';import a42_0x4c5838 from'chalk';function a42_0x4dac(){const _0x36c454=['name','Session\x20database\x20set\x20to:\x20','llm_agent','parent_segment','\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','2910800XYGTsk','Error:\x20Profile\x20\x27','toString','Session\x20engage_workspace\x20set\x20to:\x20','execute','log','.\x20Must\x20be\x20one\x20of:\x20','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','2406065JQbqpN','Error:\x20','3mSseNo','\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace\x0a','profile','\x27\x20does\x20not\x20exist','11430474rACFyy','Invalid\x20resource:\x20','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','includes','engage_workspace','llm_project','198266RMvKgq','validate','dim','9IUwbcZ','3509210mEybfH','1464JWJmDP','3688892NTZTvV','session','displayWithSources','display','(session:\x20','use','9051QvLsRL','7AdmHFD','Session\x20context\x20','Session\x20llm_project\x20set\x20to:\x20','length','database','error','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace','description','green','cleared','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','Session\x20agent\x20set\x20to:\x20'];a42_0x4dac=function(){return _0x36c454;};return a42_0x4dac();}export class UseCommand extends BaseCommand{[a42_0x32dbba(0x1da)]=a42_0x32dbba(0x1cc);[a42_0x32dbba(0x1d5)]='Set\x20session-level\x20context';[a42_0x32dbba(0x1c2)](_0x35047d){const _0x55d757=a42_0x32dbba,{args:_0x38c17a}=_0x35047d;if(_0x38c17a[_0x55d757(0x1d1)]===0x0)return undefined;if(_0x38c17a[_0x55d757(0x1d1)]===0x1)return'Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a'+_0x55d757(0x1de)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a'+_0x55d757(0x1eb)+_0x55d757(0x1d8);const _0x3b5d96=_0x38c17a[0x0],_0x5b2f86=[_0x55d757(0x1d2),_0x55d757(0x1dd),_0x55d757(0x1c0),'agent',_0x55d757(0x1ec),_0x55d757(0x1bf)];if(!_0x5b2f86[_0x55d757(0x1be)](_0x3b5d96))return _0x55d757(0x1bc)+_0x3b5d96+_0x55d757(0x1e6)+_0x5b2f86['join'](',\x20');return undefined;}async[a42_0x32dbba(0x1e4)](_0x241198){const _0x507c68=a42_0x32dbba,{args:_0x3e50bf,options:_0x3b2ed8}=_0x241198,_0x122ec9=_0x3b2ed8[_0x507c68(0x1df)],_0x12351e=_0x3b2ed8['clear'];cleanExpiredSessions();try{if(_0x12351e){clearSessionContext(_0x3b2ed8[_0x507c68(0x1c8)]);const _0x29d409=_0x3b2ed8['session']||getCurrentSessionPID()[_0x507c68(0x1e2)]();return console[_0x507c68(0x1e5)](_0x507c68(0x1cf)+a42_0x4c5838[_0x507c68(0x1d6)](_0x507c68(0x1d7))+'\x20'+a42_0x4c5838[_0x507c68(0x1c3)](_0x507c68(0x1cb)+_0x29d409+')')),0x0;}if(_0x3e50bf[_0x507c68(0x1d1)]===0x0){const _0x148587=new GlobalContext(_0x3b2ed8);return _0x122ec9?_0x148587[_0x507c68(0x1c9)]():_0x148587[_0x507c68(0x1ca)](),console['log'](a42_0x4c5838[_0x507c68(0x1c3)](_0x507c68(0x1bd))),console[_0x507c68(0x1e5)](a42_0x4c5838[_0x507c68(0x1c3)](_0x507c68(0x1d4))),0x0;}const _0x253904=_0x3e50bf[0x0],_0x1444de=_0x3e50bf[0x1];if(_0x253904===_0x507c68(0x1ec)){if(!profileExists(_0x1444de))return console[_0x507c68(0x1d3)](_0x507c68(0x1e1)+_0x1444de+_0x507c68(0x1ed)),console[_0x507c68(0x1d3)]('\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles'),0x1;const _0x4084ca=_0x3b2ed8[_0x507c68(0x1c8)]||getCurrentSessionPID()[_0x507c68(0x1e2)]();return saveSessionContext({'profile':_0x1444de},_0x3b2ed8[_0x507c68(0x1c8)]),console[_0x507c68(0x1e5)]('Session\x20profile\x20set\x20to:\x20'+a42_0x4c5838['green'](_0x1444de)+'\x20'+a42_0x4c5838['dim']('(session:\x20'+_0x4084ca+')')),console[_0x507c68(0x1e5)](a42_0x4c5838[_0x507c68(0x1c3)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides')),0x0;}const _0x4ea619={},_0x1f48d1=_0x3b2ed8[_0x507c68(0x1c8)]||getCurrentSessionPID()[_0x507c68(0x1e2)]();switch(_0x253904){case _0x507c68(0x1d2):_0x4ea619[_0x507c68(0x1d2)]=_0x1444de,console[_0x507c68(0x1e5)](_0x507c68(0x1db)+a42_0x4c5838[_0x507c68(0x1d6)](_0x1444de)+'\x20'+a42_0x4c5838[_0x507c68(0x1c3)](_0x507c68(0x1cb)+_0x1f48d1+')'));break;case _0x507c68(0x1dd):_0x4ea619[_0x507c68(0x1dd)]=_0x1444de,console[_0x507c68(0x1e5)]('Session\x20parent_segment\x20set\x20to:\x20'+a42_0x4c5838[_0x507c68(0x1d6)](_0x1444de)+'\x20'+a42_0x4c5838['dim'](_0x507c68(0x1cb)+_0x1f48d1+')'));break;case _0x507c68(0x1c0):_0x4ea619[_0x507c68(0x1c0)]=_0x1444de,console[_0x507c68(0x1e5)](_0x507c68(0x1d0)+a42_0x4c5838[_0x507c68(0x1d6)](_0x1444de)+'\x20'+a42_0x4c5838[_0x507c68(0x1c3)](_0x507c68(0x1cb)+_0x1f48d1+')'));break;case'agent':{const {projectName:_0x1d1e45,agentName:_0x1e5e55}=parseAgentRef(_0x1444de);_0x1e5e55?(_0x4ea619[_0x507c68(0x1c0)]=_0x1d1e45,_0x4ea619['llm_agent']=_0x1e5e55,console[_0x507c68(0x1e5)](_0x507c68(0x1d0)+a42_0x4c5838[_0x507c68(0x1d6)](_0x1d1e45)+'\x20'+a42_0x4c5838[_0x507c68(0x1c3)]('(session:\x20'+_0x1f48d1+')')),console[_0x507c68(0x1e5)](_0x507c68(0x1d9)+a42_0x4c5838[_0x507c68(0x1d6)](_0x1e5e55)+'\x20'+a42_0x4c5838[_0x507c68(0x1c3)](_0x507c68(0x1cb)+_0x1f48d1+')'))):(_0x4ea619[_0x507c68(0x1dc)]=_0x1444de,console[_0x507c68(0x1e5)](_0x507c68(0x1d9)+a42_0x4c5838[_0x507c68(0x1d6)](_0x1444de)+'\x20'+a42_0x4c5838[_0x507c68(0x1c3)](_0x507c68(0x1cb)+_0x1f48d1+')')));break;}case _0x507c68(0x1bf):_0x4ea619[_0x507c68(0x1bf)]=_0x1444de,console['log'](_0x507c68(0x1e3)+a42_0x4c5838[_0x507c68(0x1d6)](_0x1444de)+'\x20'+a42_0x4c5838[_0x507c68(0x1c3)]('(session:\x20'+_0x1f48d1+')'));break;}return saveSessionContext(_0x4ea619,_0x3b2ed8[_0x507c68(0x1c8)]),console[_0x507c68(0x1e5)](a42_0x4c5838[_0x507c68(0x1c3)](_0x507c68(0x1e7))),0x0;}catch(_0x458cb7){return _0x458cb7 instanceof Error&&console[_0x507c68(0x1d3)](_0x507c68(0x1e9)+_0x458cb7['message']),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a43_0x20b4(_0x36750e,_0x234f37){_0x36750e=_0x36750e-0xc2;const _0x54aca5=a43_0x54ac();let _0x20b48b=_0x54aca5[_0x36750e];return _0x20b48b;}const a43_0x548a1a=a43_0x20b4;function a43_0x54ac(){const _0xaa951a=['Show\x20current\x20user\x20information','verbose','execute','7nOwcwn','cause','3594wvHogM','description','4339650UMcXOR','6249114HdLVkQ','Fetching\x20user\x20info...','length','233456iOITpd','\x20\x20Cause:\x20','name','error','Error:\x20','251060CUSSrG','getCurrent','4347400ghIMXs','data','user','2390Wablzf','user\x20list','128315PnHcrg','✔\x20Found\x20','list','message'];a43_0x54ac=function(){return _0xaa951a;};return a43_0x54ac();}(function(_0x48d5d6,_0x430b8d){const _0x31d033=a43_0x20b4,_0x267866=_0x48d5d6();while(!![]){try{const _0x33b200=parseInt(_0x31d033(0xcf))/0x1+parseInt(_0x31d033(0xd4))/0x2*(parseInt(_0x31d033(0xc4))/0x3)+-parseInt(_0x31d033(0xca))/0x4+-parseInt(_0x31d033(0xd6))/0x5+-parseInt(_0x31d033(0xc6))/0x6+parseInt(_0x31d033(0xc2))/0x7*(parseInt(_0x31d033(0xd1))/0x8)+-parseInt(_0x31d033(0xc7))/0x9;if(_0x33b200===_0x430b8d)break;else _0x267866['push'](_0x267866['shift']());}catch(_0x1ffc99){_0x267866['push'](_0x267866['shift']());}}}(a43_0x54ac,0xb0ddf));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_0x548a1a(0xcc)]=a43_0x548a1a(0xd3);[a43_0x548a1a(0xc5)]=a43_0x548a1a(0xda);async['execute'](_0x6c1e41){const _0x35baa6=a43_0x548a1a,{options:_0x2043c3,tdx:_0xc5c0bb}=_0x6c1e41;try{const _0x210482=await withSpinner(_0x35baa6(0xc8),()=>_0xc5c0bb['user'][_0x35baa6(0xd0)](),{'verbose':_0x2043c3[_0x35baa6(0xdb)]}),_0x4d71f0=_0x210482['data'];return await handleSingleObjectOutput(_0x4d71f0,_0x2043c3),0x0;}catch(_0x51a7ab){if(_0x51a7ab instanceof SDKError)return console[_0x35baa6(0xcd)](_0x35baa6(0xce)+_0x51a7ab[_0x35baa6(0xd9)]),_0x51a7ab[_0x35baa6(0xc3)]&&console['error'](_0x35baa6(0xcb)+_0x51a7ab['cause']),0x1;throw _0x51a7ab;}}}export class UserListCommand extends BaseCommand{['name']=a43_0x548a1a(0xd5);[a43_0x548a1a(0xc5)]='List\x20all\x20users\x20in\x20the\x20account';async[a43_0x548a1a(0xdc)](_0x2e5fcf){const _0x5c08a3=a43_0x548a1a,{options:_0x512002,tdx:_0x2cc299}=_0x2e5fcf;try{const _0xc3e84b=await withSpinner('Listing\x20users...',()=>_0x2cc299[_0x5c08a3(0xd3)][_0x5c08a3(0xd8)](),{'verbose':_0x512002[_0x5c08a3(0xdb)]}),_0x57ee47=_0xc3e84b[_0x5c08a3(0xd2)];return console['error'](_0x5c08a3(0xd7)+_0x57ee47[_0x5c08a3(0xc9)]+'\x20user'+(_0x57ee47[_0x5c08a3(0xc9)]!==0x1?'s':'')),await handleSDKOutput(_0x57ee47,_0x512002),0x0;}catch(_0x15c1c1){if(_0x15c1c1 instanceof SDKError)return console[_0x5c08a3(0xcd)](_0x5c08a3(0xce)+_0x15c1c1['message']),_0x15c1c1['cause']&&console[_0x5c08a3(0xcd)](_0x5c08a3(0xcb)+_0x15c1c1[_0x5c08a3(0xc3)]),0x1;throw _0x15c1c1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a44_0x42df42=a44_0xaa61;(function(_0x4cc158,_0x40bbc7){const _0x5b6317=a44_0xaa61,_0x5bacf6=_0x4cc158();while(!![]){try{const _0x1d46c6=-parseInt(_0x5b6317(0x128))/0x1+-parseInt(_0x5b6317(0x18c))/0x2+parseInt(_0x5b6317(0x133))/0x3*(parseInt(_0x5b6317(0x168))/0x4)+parseInt(_0x5b6317(0x141))/0x5*(-parseInt(_0x5b6317(0x1b3))/0x6)+-parseInt(_0x5b6317(0x166))/0x7+-parseInt(_0x5b6317(0x130))/0x8+parseInt(_0x5b6317(0x1a8))/0x9;if(_0x1d46c6===_0x40bbc7)break;else _0x5bacf6['push'](_0x5bacf6['shift']());}catch(_0x46bbaf){_0x5bacf6['push'](_0x5bacf6['shift']());}}}(a44_0x19e3,0xe06f7));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a44_0xaa61(_0x389cb0,_0x3bfba4){_0x389cb0=_0x389cb0-0x11f;const _0x19e385=a44_0x19e3();let _0xaa61b8=_0x19e385[_0x389cb0];return _0xaa61b8;}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a44_0x10c99b from'prompts';function a44_0x19e3(){const _0x4a91c1=['task','Task\x20name:\x20','38157687wvzLQo','Status:\x20','Filter:\x20project=','round','\x20\x20Attempt\x20ID:\x20','Retry\x20a\x20session\x20or\x20attempt','\x20\x20Files\x20extracted:\x20','includeSubtasks','startsWith','keys','sessions','8601732gvVDQg','description','running','\x20session','Target:\x20','Starting\x20workflow\x20run...','project','execute','run','Validation:\x20skipped','Output\x20directory:\x20','\x20attempt','cause','canceling','kill','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','force','index','651363kjVZoB','download','Fetching\x20log\x20files...','From\x20task:\x20','\x20\x20Project\x20ID:\x20','workflow:delete','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Resume\x20from:\x20','4579912qHsnbn','\x20\x20Workflow:\x20','Usage:\x20workflow:delete\x20<project-name-or-id>','37779FoUIaW','projectId','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','workflow:tasks','workflow:run','isArray','Error:\x20Project\x20name\x20is\x20required','Error:\x20Invalid\x20parameter\x20format:\x20','Error:\x20Invalid\x20JSON\x20in\x20--params','Listing\x20workflow\x20attempts...','Expected\x20format:\x20--param\x20key=value','stat','workflow:kill','verbose','5AEGdUj','getTime','success','param','Getting\x20attempt\x20tasks...','projects','Listing\x20workflow\x20sessions...','isDirectory','push','✔\x20Retry\x20started','map','workflows','retryAttempt','Pattern:\x20','attempt','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Session\x20time:\x20','length','delete','Start\x20a\x20workflow\x20run','error','\x20is\x20not\x20a\x20directory','\x20\x20Session\x20ID:\x20','Pushing\x20workflow\x20project...','name','Listing\x20workflows...','✔\x20Downloaded\x20','\x20\x20Project:\x20','session','yes','log','Revision:\x20','No\x20log\x20content\x20found','attempt:','Retrying\x20session...','stringify','\x20workflow','11043130uXFJPH','fileSize','532gpBKqk','from','Error:\x20','sessionTime','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Project\x20directory:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','status','Params:\x20','createdAt','indexOf','Downloading\x20logs...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','finishedAt','Include\x20retried:\x20yes','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','split','taskName','tasks','params','Downloading\x20project\x20','sessionId','data','\x20\x20Cause:\x20','includeRetried','message','revision','Cancelled','Getting\x20attempt\x20details...','workflow:download','Error:\x20Attempt\x20ID\x20is\x20required','session:','workflow:sessions','Retrying\x20attempt...','workflow:attempts','✔\x20Deleted\x20project\x20','1520522lcNWXZ','attempts','...','resumeFrom','workflow','\x20\x20Location:\x20','parse','substring','\x22?\x20This\x20cannot\x20be\x20undone.','workflow:logs','Project:\x20','\x20\x20Revision:\x20','workflow:workflows','select','Parameters:\x20','logs','Killing\x20attempt...','✔\x20Found\x20','Force:\x20yes','projectName','Attempt\x20ID:\x20','limit','filesExtracted','workflow:projects','retryAttemptName','Workflow:\x20'];a44_0x19e3=function(){return _0x4a91c1;};return a44_0x19e3();}export class WorkflowProjectsCommand extends BaseCommand{['name']=a44_0x42df42(0x1a3);['description']='List\x20all\x20workflow\x20projects';async['execute'](_0x5b524b){const _0x4dc3a8=a44_0x42df42,{options:_0x5c09f3,args:_0x8f6c67,tdx:_0xda7bea}=_0x5b524b,_0x2d22b6=_0x8f6c67[0x0];try{_0x5c09f3[_0x4dc3a8(0x140)]&&_0x2d22b6&&console[_0x4dc3a8(0x155)](_0x4dc3a8(0x14e)+_0x2d22b6);const _0x204f5a=await withSpinner('Listing\x20workflow\x20projects...',()=>_0xda7bea[_0x4dc3a8(0x190)][_0x4dc3a8(0x146)](_0x2d22b6,{'limit':_0x5c09f3[_0x4dc3a8(0x1a1)]}),{'verbose':_0x5c09f3[_0x4dc3a8(0x140)]}),_0x420973=_0x204f5a['data'];return console[_0x4dc3a8(0x155)](_0x4dc3a8(0x19d)+_0x420973['length']+'\x20project'+(_0x420973[_0x4dc3a8(0x152)]!==0x1?'s':'')),await handleSDKOutput(_0x420973,_0x5c09f3),0x0;}catch(_0x36fede){if(_0x36fede instanceof SDKError)return console['error'](_0x4dc3a8(0x16a)+_0x36fede[_0x4dc3a8(0x181)]),_0x36fede[_0x4dc3a8(0x122)]&&console[_0x4dc3a8(0x155)]('\x20\x20Cause:\x20'+_0x36fede[_0x4dc3a8(0x122)]),0x1;throw _0x36fede;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a44_0x42df42(0x159)]=a44_0x42df42(0x198);['description']='List\x20workflows';async[a44_0x42df42(0x1ba)](_0x1803ec){const _0x159ac3=a44_0x42df42,{options:_0x3b40bc,args:_0x46e5f6,tdx:_0x19436d}=_0x1803ec,_0xaa6357=_0x46e5f6[0x0];try{_0x3b40bc[_0x159ac3(0x140)]&&_0xaa6357&&console[_0x159ac3(0x155)]('Project\x20filter:\x20'+_0xaa6357);const _0x2192e6=await withSpinner(_0x159ac3(0x15a),()=>_0x19436d[_0x159ac3(0x190)][_0x159ac3(0x14c)](_0xaa6357,{'limit':_0x3b40bc['limit']}),{'verbose':_0x3b40bc[_0x159ac3(0x140)]}),_0x2e6ce9=_0x2192e6[_0x159ac3(0x17e)];return console[_0x159ac3(0x155)]('✔\x20Found\x20'+_0x2e6ce9[_0x159ac3(0x152)]+_0x159ac3(0x165)+(_0x2e6ce9['length']!==0x1?'s':'')),await handleSDKOutput(_0x2e6ce9,_0x3b40bc),0x0;}catch(_0x167dfe){if(_0x167dfe instanceof SDKError)return console[_0x159ac3(0x155)](_0x159ac3(0x16a)+_0x167dfe[_0x159ac3(0x181)]),_0x167dfe['cause']&&console['error']('\x20\x20Cause:\x20'+_0x167dfe[_0x159ac3(0x122)]),0x1;throw _0x167dfe;}}}export class WorkflowSessionsCommand extends BaseCommand{[a44_0x42df42(0x159)]=a44_0x42df42(0x188);[a44_0x42df42(0x1b4)]='List\x20workflow\x20execution\x20sessions';async[a44_0x42df42(0x1ba)](_0x4ca8a0){const _0x470be2=a44_0x42df42,{options:_0x8038bd,args:_0x59cbef,tdx:_0x4e009d}=_0x4ca8a0;let _0x3e8a45,_0x520018;if(_0x59cbef[0x0]){const _0x5af0ee=_0x59cbef[0x0][_0x470be2(0x178)]('.');if(_0x5af0ee[_0x470be2(0x152)]===0x1)_0x3e8a45=_0x5af0ee[0x0];else{if(_0x5af0ee[_0x470be2(0x152)]===0x2)[_0x3e8a45,_0x520018]=_0x5af0ee;else return console[_0x470be2(0x155)](_0x470be2(0x16e)),0x1;}}try{if(_0x8038bd['verbose']){if(_0x3e8a45&&_0x520018)console[_0x470be2(0x155)]('Filter:\x20'+_0x3e8a45+'.'+_0x520018);else _0x3e8a45&&console[_0x470be2(0x155)](_0x470be2(0x1aa)+_0x3e8a45);const _0x11005d=_0x8038bd[_0x470be2(0x16f)];_0x11005d&&console[_0x470be2(0x155)](_0x470be2(0x1a9)+_0x11005d);}const _0x9bba30=await withSpinner(_0x470be2(0x147),()=>_0x4e009d[_0x470be2(0x190)][_0x470be2(0x1b2)]({'projectName':_0x3e8a45,'workflowName':_0x520018,'status':_0x8038bd['status'],'fromTime':_0x8038bd[_0x470be2(0x169)],'toTime':_0x8038bd['to'],'limit':_0x8038bd['limit']}),{'verbose':_0x8038bd[_0x470be2(0x140)]}),_0x27cfce=_0x9bba30[_0x470be2(0x17e)];return console[_0x470be2(0x155)](_0x470be2(0x19d)+_0x27cfce[_0x470be2(0x152)]+_0x470be2(0x1b6)+(_0x27cfce['length']!==0x1?'s':'')),await handleSDKOutput(_0x27cfce,_0x8038bd),0x0;}catch(_0x535896){if(_0x535896 instanceof SDKError)return console[_0x470be2(0x155)](_0x470be2(0x16a)+_0x535896[_0x470be2(0x181)]),_0x535896[_0x470be2(0x122)]&&console['error'](_0x470be2(0x17f)+_0x535896[_0x470be2(0x122)]),0x1;throw _0x535896;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a44_0x42df42(0x159)]=a44_0x42df42(0x18a);[a44_0x42df42(0x1b4)]='List\x20workflow\x20attempts';async[a44_0x42df42(0x1ba)](_0x3ef5f6){const _0x40405a=a44_0x42df42,{options:_0x395bb8,args:_0x39348d,tdx:_0x3e77ec}=_0x3ef5f6;let _0x347b23,_0x4b0b03;if(_0x39348d[0x0]){const _0x296e5c=_0x39348d[0x0][_0x40405a(0x178)]('.');if(_0x296e5c[_0x40405a(0x152)]===0x1)_0x347b23=_0x296e5c[0x0];else{if(_0x296e5c[_0x40405a(0x152)]===0x2)[_0x347b23,_0x4b0b03]=_0x296e5c;else return console['error'](_0x40405a(0x16e)),0x1;}}try{const _0x10bd22=_0x395bb8[_0x40405a(0x180)];if(_0x395bb8[_0x40405a(0x140)]){if(_0x347b23&&_0x4b0b03)console['error']('Filter:\x20'+_0x347b23+'.'+_0x4b0b03);else _0x347b23&&console[_0x40405a(0x155)]('Filter:\x20project='+_0x347b23);_0x10bd22&&console['error'](_0x40405a(0x176));}const _0x509fdb=await withSpinner(_0x40405a(0x13c),()=>_0x3e77ec[_0x40405a(0x190)][_0x40405a(0x18d)]({'projectName':_0x347b23,'workflowName':_0x4b0b03,'includeRetried':_0x10bd22,'limit':_0x395bb8[_0x40405a(0x1a1)]}),{'verbose':_0x395bb8['verbose']}),_0xf3ba64=_0x509fdb[_0x40405a(0x17e)];return console[_0x40405a(0x155)](_0x40405a(0x19d)+_0xf3ba64[_0x40405a(0x152)]+_0x40405a(0x121)+(_0xf3ba64[_0x40405a(0x152)]!==0x1?'s':'')),await handleSDKOutput(_0xf3ba64,_0x395bb8),0x0;}catch(_0xc751c6){if(_0xc751c6 instanceof SDKError)return console['error'](_0x40405a(0x16a)+_0xc751c6[_0x40405a(0x181)]),_0xc751c6[_0x40405a(0x122)]&&console['error']('\x20\x20Cause:\x20'+_0xc751c6[_0x40405a(0x122)]),0x1;throw _0xc751c6;}}}export class WorkflowAttemptCommand extends BaseCommand{[a44_0x42df42(0x159)]='workflow:attempt';[a44_0x42df42(0x1b4)]='Show\x20specific\x20attempt\x20details';async['execute'](_0x342a11){const _0x2d2d7a=a44_0x42df42,{options:_0x203b6a,args:_0x42f9a9,tdx:_0x36122f}=_0x342a11,_0x1abec7=_0x42f9a9[0x0];if(!_0x1abec7)return console['error'](_0x2d2d7a(0x186)),0x1;try{_0x203b6a['verbose']&&console[_0x2d2d7a(0x155)]('Attempt\x20ID:\x20'+_0x1abec7);const _0x11dbd9=await withSpinner(_0x2d2d7a(0x184),()=>_0x36122f[_0x2d2d7a(0x190)]['attempt'](_0x1abec7),{'verbose':_0x203b6a[_0x2d2d7a(0x140)]}),_0x2ddd4f=_0x11dbd9[_0x2d2d7a(0x17e)];let _0x43708a;!_0x2ddd4f['done']?_0x43708a=_0x2ddd4f['cancelRequested']?_0x2d2d7a(0x123):_0x2d2d7a(0x1b5):_0x43708a=_0x2ddd4f[_0x2d2d7a(0x143)]?'success':_0x2d2d7a(0x155);let _0x5f34f0;if(_0x2ddd4f['createdAt']&&_0x2ddd4f[_0x2d2d7a(0x175)]){const _0x517c71=new Date(_0x2ddd4f['createdAt'])[_0x2d2d7a(0x142)](),_0x5e1200=new Date(_0x2ddd4f[_0x2d2d7a(0x175)])['getTime']();_0x5f34f0=Math[_0x2d2d7a(0x1ab)]((_0x5e1200-_0x517c71)/0x3e8);}const _0x5b87f2={'attempt_id':_0x2ddd4f['id'],'status':_0x43708a,..._0x2ddd4f[_0x2d2d7a(0x127)]!==undefined&&{'index':_0x2ddd4f[_0x2d2d7a(0x127)]},..._0x2ddd4f[_0x2d2d7a(0x1b9)]&&{'project':_0x2ddd4f[_0x2d2d7a(0x1b9)][_0x2d2d7a(0x159)]},..._0x2ddd4f['workflow']&&{'workflow':_0x2ddd4f['workflow'][_0x2d2d7a(0x159)]},..._0x2ddd4f[_0x2d2d7a(0x17d)]&&{'session_id':_0x2ddd4f[_0x2d2d7a(0x17d)]},..._0x2ddd4f[_0x2d2d7a(0x16b)]&&{'session_time':_0x2ddd4f[_0x2d2d7a(0x16b)]},..._0x2ddd4f[_0x2d2d7a(0x1a4)]&&{'retry_attempt':_0x2ddd4f['retryAttemptName']},..._0x5f34f0!==undefined&&{'duration_sec':_0x5f34f0},..._0x2ddd4f[_0x2d2d7a(0x171)]&&{'created_at':_0x2ddd4f['createdAt']},..._0x2ddd4f[_0x2d2d7a(0x175)]&&{'finished_at':_0x2ddd4f[_0x2d2d7a(0x175)]},...Object['keys'](_0x2ddd4f[_0x2d2d7a(0x17b)])[_0x2d2d7a(0x152)]>0x0&&{'params':_0x2ddd4f[_0x2d2d7a(0x17b)]}};return await handleSingleObjectOutput(_0x5b87f2,_0x203b6a),0x0;}catch(_0x35864f){if(_0x35864f instanceof SDKError)return console[_0x2d2d7a(0x155)](_0x2d2d7a(0x16a)+_0x35864f[_0x2d2d7a(0x181)]),_0x35864f['cause']&&console[_0x2d2d7a(0x155)](_0x2d2d7a(0x17f)+_0x35864f[_0x2d2d7a(0x122)]),0x1;throw _0x35864f;}}}export class WorkflowTasksCommand extends BaseCommand{[a44_0x42df42(0x159)]=a44_0x42df42(0x136);['description']='Show\x20tasks\x20for\x20an\x20attempt';async['execute'](_0x2350f6){const _0x476517=a44_0x42df42,{options:_0x57848c,args:_0x22cfec,tdx:_0x224b1a}=_0x2350f6,_0x392131=_0x22cfec[0x0];if(!_0x392131)return console[_0x476517(0x155)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x58ee4d=_0x57848c[_0x476517(0x1af)];_0x57848c[_0x476517(0x140)]&&(console[_0x476517(0x155)](_0x476517(0x1a0)+_0x392131),_0x58ee4d&&console[_0x476517(0x155)]('Including\x20subtasks:\x20yes'));const _0x33a131=await withSpinner(_0x476517(0x145),()=>_0x224b1a[_0x476517(0x190)][_0x476517(0x17a)](_0x392131,_0x58ee4d||![]),{'verbose':_0x57848c[_0x476517(0x140)]}),_0x56f81a=_0x33a131['data'];return console[_0x476517(0x155)]('✔\x20Found\x20'+_0x56f81a[_0x476517(0x152)]+'\x20task'+(_0x56f81a[_0x476517(0x152)]!==0x1?'s':'')),await handleSDKOutput(_0x56f81a,_0x57848c),0x0;}catch(_0x5c1097){if(_0x5c1097 instanceof SDKError)return console[_0x476517(0x155)](_0x476517(0x16a)+_0x5c1097['message']),_0x5c1097[_0x476517(0x122)]&&console[_0x476517(0x155)](_0x476517(0x17f)+_0x5c1097['cause']),0x1;throw _0x5c1097;}}}export class WorkflowLogsCommand extends BaseCommand{[a44_0x42df42(0x159)]=a44_0x42df42(0x195);[a44_0x42df42(0x1b4)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async['execute'](_0x300189){const _0x4ed597=a44_0x42df42,{options:_0x52be97,args:_0x24c13a,tdx:_0x45e5bc}=_0x300189,_0x4bc590=_0x24c13a[0x0];let _0x171e98=_0x24c13a[0x1];if(!_0x4bc590)return console['error'](_0x4ed597(0x186)),0x1;try{_0x52be97[_0x4ed597(0x140)]&&(console[_0x4ed597(0x155)](_0x4ed597(0x1a0)+_0x4bc590),_0x171e98&&console[_0x4ed597(0x155)](_0x4ed597(0x1a7)+_0x171e98));const _0x172236=await withSpinner(_0x4ed597(0x12a),()=>_0x45e5bc[_0x4ed597(0x190)]['logFiles'](_0x4bc590,_0x171e98),{'verbose':_0x52be97['verbose']}),_0x429e64=_0x172236['data'];if(_0x429e64['length']===0x0)return console[_0x4ed597(0x155)]('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x171e98&&(_0x52be97['json']||_0x52be97['format']))return await handleSDKOutput(_0x429e64,_0x52be97),0x0;if(!_0x171e98){const _0x224b57=_0x429e64[_0x4ed597(0x14b)](_0x1bc1e9=>({'title':_0x1bc1e9[_0x4ed597(0x179)]+'\x20('+formatBytes(_0x1bc1e9[_0x4ed597(0x167)])+')','value':_0x1bc1e9[_0x4ed597(0x179)]})),_0x17fd44=await a44_0x10c99b({'type':_0x4ed597(0x199),'name':_0x4ed597(0x1a6),'message':'Select\x20a\x20task\x20to\x20view\x20logs:','choices':_0x224b57});if(!_0x17fd44[_0x4ed597(0x1a6)])return console[_0x4ed597(0x155)](_0x4ed597(0x183)),0x0;_0x171e98=_0x17fd44[_0x4ed597(0x1a6)];}const _0x3adf24=await withSpinner(_0x4ed597(0x173),()=>_0x45e5bc[_0x4ed597(0x190)][_0x4ed597(0x19b)](_0x4bc590,_0x171e98),{'verbose':_0x52be97['verbose']}),_0x3a2fe0=_0x3adf24[_0x4ed597(0x17e)];return _0x3a2fe0?console[_0x4ed597(0x15f)](_0x3a2fe0):console[_0x4ed597(0x155)](_0x4ed597(0x161)),0x0;}catch(_0x1d18d6){if(_0x1d18d6 instanceof SDKError)return console[_0x4ed597(0x155)](_0x4ed597(0x16a)+_0x1d18d6['message']),_0x1d18d6[_0x4ed597(0x122)]&&console[_0x4ed597(0x155)](_0x4ed597(0x17f)+_0x1d18d6['cause']),0x1;throw _0x1d18d6;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a44_0x42df42(0x13f);[a44_0x42df42(0x1b4)]='Kill\x20a\x20running\x20attempt';async['execute'](_0x54ab75){const _0x35cb34=a44_0x42df42,{options:_0xfced00,args:_0x44d0c3,tdx:_0x742a1b}=_0x54ab75,_0x5dc081=_0x44d0c3[0x0];if(!_0x5dc081)return console[_0x35cb34(0x155)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x6b13b5=_0xfced00['reason'];_0xfced00[_0x35cb34(0x140)]&&(console[_0x35cb34(0x155)]('Attempt\x20ID:\x20'+_0x5dc081),_0x6b13b5&&console[_0x35cb34(0x155)]('Reason:\x20'+_0x6b13b5));if(!_0xfced00['yes']){const _0x13b223=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x5dc081+'?');if(!_0x13b223)return console[_0x35cb34(0x155)]('Cancelled'),0x0;}const _0x5c1520=await withSpinner(_0x35cb34(0x19c),()=>_0x742a1b[_0x35cb34(0x190)][_0x35cb34(0x124)](_0x5dc081,_0x6b13b5),{'verbose':_0xfced00['verbose']}),_0x4b98bb=_0x5c1520[_0x35cb34(0x17e)];return console[_0x35cb34(0x155)]('✔\x20'+_0x4b98bb),0x0;}catch(_0x5ab95f){if(_0x5ab95f instanceof SDKError)return console['error'](_0x35cb34(0x16a)+_0x5ab95f['message']),_0x5ab95f[_0x35cb34(0x122)]&&console[_0x35cb34(0x155)](_0x35cb34(0x17f)+_0x5ab95f[_0x35cb34(0x122)]),0x1;throw _0x5ab95f;}}}export class WorkflowRetryCommand extends BaseCommand{[a44_0x42df42(0x159)]='workflow:retry';[a44_0x42df42(0x1b4)]=a44_0x42df42(0x1ad);async[a44_0x42df42(0x1ba)](_0x2809b1){const _0x1486c9=a44_0x42df42,{options:_0xa205d7,args:_0x170c50,tdx:_0x421607}=_0x2809b1,_0xe38162=_0x170c50[0x0];if(!_0xe38162)return console[_0x1486c9(0x155)](_0x1486c9(0x12e)),console[_0x1486c9(0x155)](_0x1486c9(0x125)),0x1;let _0x32ae69=![],_0x1c1612=_0xe38162;if(_0xe38162[_0x1486c9(0x1b0)](_0x1486c9(0x187)))_0x32ae69=!![],_0x1c1612=_0xe38162[_0x1486c9(0x193)](0x8);else{if(_0xe38162['startsWith'](_0x1486c9(0x162)))_0x32ae69=![],_0x1c1612=_0xe38162['substring'](0x8);else return console[_0x1486c9(0x155)](_0x1486c9(0x177)),console[_0x1486c9(0x155)](_0x1486c9(0x125)),0x1;}try{const _0x1a4e1f=_0xa205d7['fromTask'],_0x1110fe=_0xa205d7[_0x1486c9(0x18f)],_0x3ba348=_0xa205d7[_0x1486c9(0x17b)],_0x4fe210=_0xa205d7[_0x1486c9(0x126)];_0xa205d7['verbose']&&(console['error'](_0x1486c9(0x1b7)+(_0x32ae69?_0x1486c9(0x15d):_0x1486c9(0x14f))+'\x20'+_0x1c1612),_0x1a4e1f&&console[_0x1486c9(0x155)](_0x1486c9(0x12b)+_0x1a4e1f),_0x1110fe&&console[_0x1486c9(0x155)](_0x1486c9(0x12f)+_0x1110fe),_0x3ba348&&console['error'](_0x1486c9(0x170)+_0x3ba348),_0x4fe210&&console[_0x1486c9(0x155)](_0x1486c9(0x19e)));let _0x1d91ee;if(_0x3ba348)try{if(_0x3ba348[_0x1486c9(0x1b0)]('@')){const _0x13fe70=await import('fs/promises'),_0x57fef9=_0x3ba348[_0x1486c9(0x193)](0x1),_0x154ce7=await _0x13fe70['readFile'](_0x57fef9,'utf-8');_0x1d91ee=JSON[_0x1486c9(0x192)](_0x154ce7);}else _0x1d91ee=JSON[_0x1486c9(0x192)](_0x3ba348);}catch{return console['error'](_0x1486c9(0x13b)),0x1;}if(!_0xa205d7[_0x1486c9(0x15e)]){const _0x364d65=await confirm(_0x1486c9(0x135)+(_0x32ae69?_0x1486c9(0x15d):_0x1486c9(0x14f))+'\x20'+_0x1c1612+'?');if(!_0x364d65)return console[_0x1486c9(0x155)](_0x1486c9(0x183)),0x0;}let _0x2a2d9f;_0x32ae69?_0x2a2d9f=await withSpinner(_0x1486c9(0x163),()=>_0x421607[_0x1486c9(0x190)]['retrySession'](_0x1c1612,{'fromTask':_0x1a4e1f,'retryParams':_0x1d91ee}),{'verbose':_0xa205d7['verbose']}):_0x2a2d9f=await withSpinner(_0x1486c9(0x189),()=>_0x421607[_0x1486c9(0x190)][_0x1486c9(0x14d)](_0x1c1612,{'resumeFrom':_0x1110fe,'retryParams':_0x1d91ee,'force':_0x4fe210}),{'verbose':_0xa205d7['verbose']});const _0x139c5a=_0x2a2d9f[_0x1486c9(0x17e)];return console['error'](_0x1486c9(0x14a)),console[_0x1486c9(0x155)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x139c5a['attemptId']),console[_0x1486c9(0x155)](_0x1486c9(0x157)+_0x139c5a[_0x1486c9(0x17d)]),0x0;}catch(_0x62c43f){if(_0x62c43f instanceof SDKError)return console[_0x1486c9(0x155)](_0x1486c9(0x16a)+_0x62c43f[_0x1486c9(0x181)]),_0x62c43f[_0x1486c9(0x122)]&&console[_0x1486c9(0x155)]('\x20\x20Cause:\x20'+_0x62c43f[_0x1486c9(0x122)]),0x1;throw _0x62c43f;}}}export class WorkflowRunCommand extends BaseCommand{[a44_0x42df42(0x159)]=a44_0x42df42(0x137);[a44_0x42df42(0x1b4)]=a44_0x42df42(0x154);async[a44_0x42df42(0x1ba)](_0x3ab4b4){const _0x1bb862=a44_0x42df42,{options:_0x3e45a,args:_0xcca38b,tdx:_0x21805c}=_0x3ab4b4,_0x3f71a0=_0xcca38b[0x0];if(!_0x3f71a0)return console[_0x1bb862(0x155)]('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x1bb862(0x155)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0xea7b8=_0x3e45a[_0x1bb862(0x144)],_0xf9f64d=_0x3e45a[_0x1bb862(0x16b)],_0x2d1ff0={};if(_0xea7b8&&Array[_0x1bb862(0x138)](_0xea7b8))for(const _0x14bbe4 of _0xea7b8){const _0x144d36=_0x14bbe4[_0x1bb862(0x172)]('=');if(_0x144d36===-0x1)return console[_0x1bb862(0x155)](_0x1bb862(0x13a)+_0x14bbe4),console['error'](_0x1bb862(0x13d)),0x1;const _0x435ca9=_0x14bbe4['substring'](0x0,_0x144d36),_0x21da68=_0x14bbe4[_0x1bb862(0x193)](_0x144d36+0x1);try{_0x2d1ff0[_0x435ca9]=JSON['parse'](_0x21da68);}catch{_0x2d1ff0[_0x435ca9]=_0x21da68;}}_0x3e45a[_0x1bb862(0x140)]&&(console[_0x1bb862(0x155)](_0x1bb862(0x1a5)+_0x3f71a0),Object[_0x1bb862(0x1b1)](_0x2d1ff0)['length']>0x0&&console[_0x1bb862(0x155)](_0x1bb862(0x19a)+JSON[_0x1bb862(0x164)](_0x2d1ff0)),_0xf9f64d&&console[_0x1bb862(0x155)](_0x1bb862(0x151)+_0xf9f64d));const _0x580105=await withSpinner(_0x1bb862(0x1b8),()=>_0x21805c[_0x1bb862(0x190)][_0x1bb862(0x1bb)](_0x3f71a0,_0x2d1ff0,{'sessionTime':_0xf9f64d}),{'verbose':_0x3e45a['verbose']}),_0x29a9ff=_0x580105[_0x1bb862(0x17e)];return console[_0x1bb862(0x155)]('✔\x20Workflow\x20run\x20started'),console[_0x1bb862(0x155)](_0x1bb862(0x1ac)+_0x29a9ff['id']),console[_0x1bb862(0x155)](_0x1bb862(0x157)+_0x29a9ff[_0x1bb862(0x17d)]),console[_0x1bb862(0x155)](_0x1bb862(0x15c)+_0x29a9ff[_0x1bb862(0x1b9)]?.[_0x1bb862(0x159)]),console[_0x1bb862(0x155)](_0x1bb862(0x131)+_0x29a9ff['workflow']?.['name']),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a44_0x42df42(0x159)]=a44_0x42df42(0x185);['description']='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a44_0x42df42(0x1ba)](_0x2c21f7){const _0x47aab4=a44_0x42df42,{options:_0x1997fc,args:_0x2239c0,tdx:_0x2feee1}=_0x2c21f7,_0x372245=_0x2239c0[0x0],_0x1b9055=_0x2239c0[0x1]||'.';if(!_0x372245)return console[_0x47aab4(0x155)](_0x47aab4(0x139)),console['error']('Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'),0x1;const _0x3d6f3a=_0x1997fc[_0x47aab4(0x182)];_0x1997fc[_0x47aab4(0x140)]&&(console[_0x47aab4(0x155)](_0x47aab4(0x196)+_0x372245),console[_0x47aab4(0x155)](_0x47aab4(0x120)+_0x1b9055),_0x3d6f3a&&console[_0x47aab4(0x155)](_0x47aab4(0x160)+_0x3d6f3a));const _0x1768f9=await withSpinner(_0x47aab4(0x17c)+_0x372245+_0x47aab4(0x18e),()=>_0x2feee1['workflow'][_0x47aab4(0x129)](_0x372245,_0x1b9055,{'revision':_0x3d6f3a}),{'verbose':_0x1997fc[_0x47aab4(0x140)]}),_0x2b4f6c=_0x1768f9[_0x47aab4(0x17e)];return console[_0x47aab4(0x155)](_0x47aab4(0x15b)+_0x2b4f6c['projectName']),console[_0x47aab4(0x155)](_0x47aab4(0x197)+_0x2b4f6c[_0x47aab4(0x182)]),console['error'](_0x47aab4(0x1ae)+_0x2b4f6c[_0x47aab4(0x1a2)]),console['error'](_0x47aab4(0x191)+_0x1b9055+'/'+_0x2b4f6c[_0x47aab4(0x19f)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']='workflow:push';[a44_0x42df42(0x1b4)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a44_0x42df42(0x1ba)](_0x567dbc){const _0x24cb23=a44_0x42df42,{options:_0x4eda32,args:_0x549380,tdx:_0x25e0c2}=_0x567dbc;let _0x7a18eb='.',_0x329cad=_0x4eda32['name'];if(_0x549380[0x0]){const {promises:_0x3606e3}=await import('fs');try{const _0x568346=await _0x3606e3[_0x24cb23(0x13e)](_0x549380[0x0]);if(_0x568346[_0x24cb23(0x148)]())_0x7a18eb=_0x549380[0x0];else return console['error']('Error:\x20'+_0x549380[0x0]+_0x24cb23(0x156)),0x1;}catch{_0x329cad=_0x549380[0x0],_0x7a18eb='.';}}const _0x49154d=_0x4eda32[_0x24cb23(0x182)],_0x4ddd7d=_0x4eda32['skipValidation'];_0x4eda32[_0x24cb23(0x140)]&&(console[_0x24cb23(0x155)](_0x24cb23(0x16d)+_0x7a18eb),_0x329cad&&console[_0x24cb23(0x155)]('Project\x20name:\x20'+_0x329cad),_0x49154d&&console[_0x24cb23(0x155)](_0x24cb23(0x160)+_0x49154d),_0x4ddd7d&&console[_0x24cb23(0x155)](_0x24cb23(0x11f)));const _0x35bbd5=await withSpinner(_0x24cb23(0x158),()=>_0x25e0c2['workflow'][_0x24cb23(0x149)](_0x7a18eb,{'projectName':_0x329cad,'revision':_0x49154d,'skipValidation':_0x4ddd7d}),{'verbose':_0x4eda32['verbose']}),_0x44e0d6=_0x35bbd5[_0x24cb23(0x17e)];return console[_0x24cb23(0x155)]('✔\x20Pushed\x20'+_0x44e0d6[_0x24cb23(0x19f)]),console[_0x24cb23(0x155)](_0x24cb23(0x12c)+_0x44e0d6[_0x24cb23(0x134)]),console[_0x24cb23(0x155)](_0x24cb23(0x197)+_0x44e0d6[_0x24cb23(0x182)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x42df42(0x159)]=a44_0x42df42(0x12d);[a44_0x42df42(0x1b4)]=a44_0x42df42(0x16c);async[a44_0x42df42(0x1ba)](_0x21708a){const _0x36fae7=a44_0x42df42,{options:_0x3d6478,args:_0x551280,tdx:_0x33977b}=_0x21708a,_0x28b06d=_0x551280[0x0];if(!_0x28b06d)return console[_0x36fae7(0x155)](_0x36fae7(0x150)),console[_0x36fae7(0x155)](_0x36fae7(0x132)),0x1;_0x3d6478[_0x36fae7(0x140)]&&console[_0x36fae7(0x155)]('Project:\x20'+_0x28b06d);if(!_0x3d6478['yes']){const _0x2bcac6=await confirm(_0x36fae7(0x174)+_0x28b06d+_0x36fae7(0x194));if(!_0x2bcac6)return console['error'](_0x36fae7(0x183)),0x0;}const _0x59786c=await withSpinner('Deleting\x20project\x20'+_0x28b06d+_0x36fae7(0x18e),()=>_0x33977b[_0x36fae7(0x190)][_0x36fae7(0x153)](_0x28b06d),{'verbose':_0x3d6478[_0x36fae7(0x140)]}),_0x4042e1=_0x59786c['data'];return console['error'](_0x36fae7(0x18b)+_0x4042e1[_0x36fae7(0x19f)]),console[_0x36fae7(0x155)](_0x36fae7(0x12c)+_0x4042e1[_0x36fae7(0x134)]),0x0;}}
|
|
1
|
+
const a44_0xe97346=a44_0xecaf;(function(_0x3d7e50,_0x336d78){const _0x1f6e60=a44_0xecaf,_0x1fa35c=_0x3d7e50();while(!![]){try{const _0x2ae61c=-parseInt(_0x1f6e60(0x219))/0x1+parseInt(_0x1f6e60(0x1aa))/0x2+-parseInt(_0x1f6e60(0x20b))/0x3*(parseInt(_0x1f6e60(0x188))/0x4)+parseInt(_0x1f6e60(0x223))/0x5*(-parseInt(_0x1f6e60(0x1e3))/0x6)+parseInt(_0x1f6e60(0x20a))/0x7+parseInt(_0x1f6e60(0x185))/0x8+-parseInt(_0x1f6e60(0x1af))/0x9*(parseInt(_0x1f6e60(0x1f1))/0xa);if(_0x2ae61c===_0x336d78)break;else _0x1fa35c['push'](_0x1fa35c['shift']());}catch(_0x2f4009){_0x1fa35c['push'](_0x1fa35c['shift']());}}}(a44_0x31ca,0x94506));function a44_0xecaf(_0x53b4cf,_0x328c5b){_0x53b4cf=_0x53b4cf-0x180;const _0x31cafc=a44_0x31ca();let _0xecaf4b=_0x31cafc[_0x53b4cf];return _0xecaf4b;}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_0x185a25 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a44_0xe97346(0x228)]='workflow:projects';['description']='List\x20all\x20workflow\x20projects';async['execute'](_0x157e0e){const _0x4bac11=a44_0xe97346,{options:_0x5a5060,args:_0x2af7ba,tdx:_0x425c85}=_0x157e0e,_0x1361e4=_0x2af7ba[0x0];try{_0x5a5060[_0x4bac11(0x1c2)]&&_0x1361e4&&console[_0x4bac11(0x1d0)](_0x4bac11(0x186)+_0x1361e4);const _0x39fc36=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x425c85['workflow'][_0x4bac11(0x198)](_0x1361e4,{'limit':_0x5a5060[_0x4bac11(0x1d3)]}),{'verbose':_0x5a5060[_0x4bac11(0x1c2)]}),_0xa9a5b5=_0x39fc36[_0x4bac11(0x1fb)];return console[_0x4bac11(0x1d0)]('✔\x20Found\x20'+_0xa9a5b5[_0x4bac11(0x1c9)]+_0x4bac11(0x22b)+(_0xa9a5b5['length']!==0x1?'s':'')),await handleSDKOutput(_0xa9a5b5,_0x5a5060),0x0;}catch(_0x2fc013){if(_0x2fc013 instanceof SDKError)return console[_0x4bac11(0x1d0)](_0x4bac11(0x1ce)+_0x2fc013[_0x4bac11(0x1ed)]),_0x2fc013[_0x4bac11(0x1c6)]&&console[_0x4bac11(0x1d0)](_0x4bac11(0x1d1)+_0x2fc013[_0x4bac11(0x1c6)]),0x1;throw _0x2fc013;}}}function a44_0x31ca(){const _0x3b9361=['sessionId','split','Resume\x20from:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','workflow:attempts','Including\x20subtasks:\x20yes','2068192YYKZpR','retrySession','Output\x20directory:\x20','revision','Revision:\x20','2817vLvQdt','keys','Getting\x20attempt\x20tasks...','Getting\x20attempt\x20details...','\x20is\x20not\x20a\x20directory','No\x20log\x20files\x20found\x20for\x20this\x20attempt','\x22?\x20This\x20cannot\x20be\x20undone.','description','Listing\x20workflow\x20sessions...','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Listing\x20workflows...','workflow:workflows','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','\x20attempt','Listing\x20workflow\x20attempts...','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','includeSubtasks','index','Start\x20a\x20workflow\x20run','verbose','\x20\x20Project\x20ID:\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','Include\x20retried:\x20yes','cause','Workflow:\x20','delete','length','workflow:retry','Project:\x20','✔\x20Retry\x20started','retryAttempt','Error:\x20','projectId','error','\x20\x20Cause:\x20','List\x20workflows','limit','fileSize','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Select\x20a\x20task\x20to\x20view\x20logs:','Session\x20time:\x20','createdAt','List\x20workflow\x20execution\x20sessions','\x20\x20Location:\x20','params','task','cancelRequested','force','sessions','map','Kill\x20a\x20running\x20attempt','filesExtracted','10818NtEUyy','finishedAt','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','\x20workflow','logFiles','download','\x20\x20New\x20attempt\x20ID:\x20','Reason:\x20','canceling','skipValidation','message','status','Pushing\x20workflow\x20project...','from','2270Fyfmjo','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','done','workflow:tasks','retryAttemptName','Usage:\x20workflow:delete\x20<project-name-or-id>','attempt:','Force:\x20yes','Downloading\x20project\x20','List\x20workflow\x20attempts','data','Error:\x20Attempt\x20ID\x20is\x20required','utf-8','Downloading\x20logs...','Cancelled','fromTask','Error:\x20Invalid\x20parameter\x20format:\x20','Killing\x20attempt...','stringify','...','From\x20task:\x20','workflow:run','push','workflow:kill','workflow:push','6694345PHaoqr','3RjUxZv','session:','sessionTime','reason','✔\x20Workflow\x20run\x20started','Fetching\x20log\x20files...','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','log','Expected\x20format:\x20--param\x20key=value','fs/promises','isArray','isDirectory','\x20task','json','624495vIVZFf','Parameters:\x20','format','round','Error:\x20Invalid\x20JSON\x20in\x20--params','yes','workflows','projectName','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','Show\x20tasks\x20for\x20an\x20attempt','1875cTYlvD','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Project\x20filter:\x20','Error:\x20Workflow\x20identifier\x20is\x20required','Attempt\x20ID:\x20','name','project','Retry\x20a\x20session\x20or\x20attempt','\x20project','includeRetried','run','Project\x20name:\x20','select','stat','taskName','4660648tNUbGY','Pattern:\x20','success','2375388vwGczY','Starting\x20workflow\x20run...','indexOf','attempt','\x20\x20Project:\x20','Error:\x20Project\x20name\x20is\x20required','parse','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','workflow:sessions','substring','Retrying\x20attempt...','Status:\x20','getTime','Validation:\x20skipped','\x20session','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','projects','attemptId','Params:\x20','workflow:delete','✔\x20Found\x20','\x20\x20Session\x20ID:\x20','Retrying\x20session...','execute','\x20\x20Revision:\x20','workflow','startsWith'];a44_0x31ca=function(){return _0x3b9361;};return a44_0x31ca();}export class WorkflowWorkflowsCommand extends BaseCommand{[a44_0xe97346(0x228)]=a44_0xe97346(0x1ba);[a44_0xe97346(0x1b6)]=a44_0xe97346(0x1d2);async['execute'](_0x16c196){const _0x10bc50=a44_0xe97346,{options:_0x154053,args:_0xb613f3,tdx:_0x4c097b}=_0x16c196,_0x399755=_0xb613f3[0x0];try{_0x154053['verbose']&&_0x399755&&console[_0x10bc50(0x1d0)](_0x10bc50(0x225)+_0x399755);const _0x252255=await withSpinner(_0x10bc50(0x1b9),()=>_0x4c097b[_0x10bc50(0x1a1)][_0x10bc50(0x21f)](_0x399755,{'limit':_0x154053[_0x10bc50(0x1d3)]}),{'verbose':_0x154053[_0x10bc50(0x1c2)]}),_0x49d0d8=_0x252255[_0x10bc50(0x1fb)];return console[_0x10bc50(0x1d0)](_0x10bc50(0x19c)+_0x49d0d8[_0x10bc50(0x1c9)]+_0x10bc50(0x1e6)+(_0x49d0d8[_0x10bc50(0x1c9)]!==0x1?'s':'')),await handleSDKOutput(_0x49d0d8,_0x154053),0x0;}catch(_0x2fee1b){if(_0x2fee1b instanceof SDKError)return console[_0x10bc50(0x1d0)](_0x10bc50(0x1ce)+_0x2fee1b['message']),_0x2fee1b[_0x10bc50(0x1c6)]&&console[_0x10bc50(0x1d0)](_0x10bc50(0x1d1)+_0x2fee1b[_0x10bc50(0x1c6)]),0x1;throw _0x2fee1b;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a44_0xe97346(0x190);[a44_0xe97346(0x1b6)]=a44_0xe97346(0x1d9);async['execute'](_0x178d90){const _0xc97a9e=a44_0xe97346,{options:_0x532323,args:_0x23500f,tdx:_0x323cbb}=_0x178d90;let _0x3143a7,_0x52e260;if(_0x23500f[0x0]){const _0x560b0b=_0x23500f[0x0][_0xc97a9e(0x1a4)]('.');if(_0x560b0b[_0xc97a9e(0x1c9)]===0x1)_0x3143a7=_0x560b0b[0x0];else{if(_0x560b0b[_0xc97a9e(0x1c9)]===0x2)[_0x3143a7,_0x52e260]=_0x560b0b;else return console['error'](_0xc97a9e(0x224)),0x1;}}try{if(_0x532323[_0xc97a9e(0x1c2)]){if(_0x3143a7&&_0x52e260)console[_0xc97a9e(0x1d0)]('Filter:\x20'+_0x3143a7+'.'+_0x52e260);else _0x3143a7&&console[_0xc97a9e(0x1d0)]('Filter:\x20project='+_0x3143a7);const _0x266583=_0x532323['status'];_0x266583&&console['error'](_0xc97a9e(0x193)+_0x266583);}const _0x320a5d=await withSpinner(_0xc97a9e(0x1b7),()=>_0x323cbb[_0xc97a9e(0x1a1)][_0xc97a9e(0x1df)]({'projectName':_0x3143a7,'workflowName':_0x52e260,'status':_0x532323[_0xc97a9e(0x1ee)],'fromTime':_0x532323[_0xc97a9e(0x1f0)],'toTime':_0x532323['to'],'limit':_0x532323[_0xc97a9e(0x1d3)]}),{'verbose':_0x532323[_0xc97a9e(0x1c2)]}),_0x4fb3e3=_0x320a5d[_0xc97a9e(0x1fb)];return console[_0xc97a9e(0x1d0)](_0xc97a9e(0x19c)+_0x4fb3e3[_0xc97a9e(0x1c9)]+_0xc97a9e(0x196)+(_0x4fb3e3[_0xc97a9e(0x1c9)]!==0x1?'s':'')),await handleSDKOutput(_0x4fb3e3,_0x532323),0x0;}catch(_0x226aeb){if(_0x226aeb instanceof SDKError)return console[_0xc97a9e(0x1d0)](_0xc97a9e(0x1ce)+_0x226aeb['message']),_0x226aeb[_0xc97a9e(0x1c6)]&&console[_0xc97a9e(0x1d0)](_0xc97a9e(0x1d1)+_0x226aeb['cause']),0x1;throw _0x226aeb;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a44_0xe97346(0x228)]=a44_0xe97346(0x1a8);[a44_0xe97346(0x1b6)]=a44_0xe97346(0x1fa);async[a44_0xe97346(0x19f)](_0x4f8fdb){const _0x3f6904=a44_0xe97346,{options:_0x2e2f33,args:_0x5e0107,tdx:_0x145a36}=_0x4f8fdb;let _0x528633,_0xb0bc2d;if(_0x5e0107[0x0]){const _0x3ec8e6=_0x5e0107[0x0][_0x3f6904(0x1a4)]('.');if(_0x3ec8e6['length']===0x1)_0x528633=_0x3ec8e6[0x0];else{if(_0x3ec8e6['length']===0x2)[_0x528633,_0xb0bc2d]=_0x3ec8e6;else return console['error'](_0x3f6904(0x224)),0x1;}}try{const _0x45d761=_0x2e2f33[_0x3f6904(0x22c)];if(_0x2e2f33[_0x3f6904(0x1c2)]){if(_0x528633&&_0xb0bc2d)console[_0x3f6904(0x1d0)]('Filter:\x20'+_0x528633+'.'+_0xb0bc2d);else _0x528633&&console[_0x3f6904(0x1d0)]('Filter:\x20project='+_0x528633);_0x45d761&&console[_0x3f6904(0x1d0)](_0x3f6904(0x1c5));}const _0x3d9b3a=await withSpinner(_0x3f6904(0x1bd),()=>_0x145a36[_0x3f6904(0x1a1)]['attempts']({'projectName':_0x528633,'workflowName':_0xb0bc2d,'includeRetried':_0x45d761,'limit':_0x2e2f33[_0x3f6904(0x1d3)]}),{'verbose':_0x2e2f33[_0x3f6904(0x1c2)]}),_0x2d2296=_0x3d9b3a['data'];return console[_0x3f6904(0x1d0)](_0x3f6904(0x19c)+_0x2d2296[_0x3f6904(0x1c9)]+_0x3f6904(0x1bc)+(_0x2d2296[_0x3f6904(0x1c9)]!==0x1?'s':'')),await handleSDKOutput(_0x2d2296,_0x2e2f33),0x0;}catch(_0x10ba90){if(_0x10ba90 instanceof SDKError)return console[_0x3f6904(0x1d0)](_0x3f6904(0x1ce)+_0x10ba90[_0x3f6904(0x1ed)]),_0x10ba90[_0x3f6904(0x1c6)]&&console[_0x3f6904(0x1d0)](_0x3f6904(0x1d1)+_0x10ba90[_0x3f6904(0x1c6)]),0x1;throw _0x10ba90;}}}export class WorkflowAttemptCommand extends BaseCommand{[a44_0xe97346(0x228)]='workflow:attempt';[a44_0xe97346(0x1b6)]='Show\x20specific\x20attempt\x20details';async[a44_0xe97346(0x19f)](_0x507b8c){const _0x725131=a44_0xe97346,{options:_0x19e800,args:_0x5667f7,tdx:_0x20a75d}=_0x507b8c,_0x5a6aa1=_0x5667f7[0x0];if(!_0x5a6aa1)return console[_0x725131(0x1d0)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x19e800[_0x725131(0x1c2)]&&console[_0x725131(0x1d0)]('Attempt\x20ID:\x20'+_0x5a6aa1);const _0x45f7a3=await withSpinner(_0x725131(0x1b2),()=>_0x20a75d[_0x725131(0x1a1)][_0x725131(0x18b)](_0x5a6aa1),{'verbose':_0x19e800[_0x725131(0x1c2)]}),_0x12590c=_0x45f7a3[_0x725131(0x1fb)];let _0x307810;!_0x12590c[_0x725131(0x1f3)]?_0x307810=_0x12590c[_0x725131(0x1dd)]?_0x725131(0x1eb):'running':_0x307810=_0x12590c[_0x725131(0x187)]?_0x725131(0x187):_0x725131(0x1d0);let _0x35b3ff;if(_0x12590c[_0x725131(0x1d8)]&&_0x12590c[_0x725131(0x1e4)]){const _0x293ebc=new Date(_0x12590c['createdAt'])[_0x725131(0x194)](),_0xc0b3ee=new Date(_0x12590c[_0x725131(0x1e4)])[_0x725131(0x194)]();_0x35b3ff=Math[_0x725131(0x21c)]((_0xc0b3ee-_0x293ebc)/0x3e8);}const _0x79d2b={'attempt_id':_0x12590c['id'],'status':_0x307810,..._0x12590c[_0x725131(0x1c0)]!==undefined&&{'index':_0x12590c['index']},..._0x12590c[_0x725131(0x229)]&&{'project':_0x12590c[_0x725131(0x229)][_0x725131(0x228)]},..._0x12590c[_0x725131(0x1a1)]&&{'workflow':_0x12590c[_0x725131(0x1a1)]['name']},..._0x12590c[_0x725131(0x1a3)]&&{'session_id':_0x12590c['sessionId']},..._0x12590c['sessionTime']&&{'session_time':_0x12590c[_0x725131(0x20d)]},..._0x12590c[_0x725131(0x1f5)]&&{'retry_attempt':_0x12590c[_0x725131(0x1f5)]},..._0x35b3ff!==undefined&&{'duration_sec':_0x35b3ff},..._0x12590c[_0x725131(0x1d8)]&&{'created_at':_0x12590c['createdAt']},..._0x12590c[_0x725131(0x1e4)]&&{'finished_at':_0x12590c['finishedAt']},...Object[_0x725131(0x1b0)](_0x12590c[_0x725131(0x1db)])[_0x725131(0x1c9)]>0x0&&{'params':_0x12590c[_0x725131(0x1db)]}};return await handleSingleObjectOutput(_0x79d2b,_0x19e800),0x0;}catch(_0x585e5a){if(_0x585e5a instanceof SDKError)return console[_0x725131(0x1d0)](_0x725131(0x1ce)+_0x585e5a['message']),_0x585e5a[_0x725131(0x1c6)]&&console[_0x725131(0x1d0)](_0x725131(0x1d1)+_0x585e5a[_0x725131(0x1c6)]),0x1;throw _0x585e5a;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a44_0xe97346(0x1f4);['description']=a44_0xe97346(0x222);async[a44_0xe97346(0x19f)](_0x2ca355){const _0x4c6147=a44_0xe97346,{options:_0x420afd,args:_0x5b120b,tdx:_0x424059}=_0x2ca355,_0x756f8b=_0x5b120b[0x0];if(!_0x756f8b)return console[_0x4c6147(0x1d0)](_0x4c6147(0x1fc)),0x1;try{const _0x10572a=_0x420afd[_0x4c6147(0x1bf)];_0x420afd['verbose']&&(console['error'](_0x4c6147(0x227)+_0x756f8b),_0x10572a&&console[_0x4c6147(0x1d0)](_0x4c6147(0x1a9)));const _0x536681=await withSpinner(_0x4c6147(0x1b1),()=>_0x424059[_0x4c6147(0x1a1)]['tasks'](_0x756f8b,_0x10572a||![]),{'verbose':_0x420afd['verbose']}),_0x1c44f4=_0x536681[_0x4c6147(0x1fb)];return console[_0x4c6147(0x1d0)]('✔\x20Found\x20'+_0x1c44f4[_0x4c6147(0x1c9)]+_0x4c6147(0x217)+(_0x1c44f4[_0x4c6147(0x1c9)]!==0x1?'s':'')),await handleSDKOutput(_0x1c44f4,_0x420afd),0x0;}catch(_0x1ca01d){if(_0x1ca01d instanceof SDKError)return console['error'](_0x4c6147(0x1ce)+_0x1ca01d[_0x4c6147(0x1ed)]),_0x1ca01d[_0x4c6147(0x1c6)]&&console['error'](_0x4c6147(0x1d1)+_0x1ca01d[_0x4c6147(0x1c6)]),0x1;throw _0x1ca01d;}}}export class WorkflowLogsCommand extends BaseCommand{[a44_0xe97346(0x228)]='workflow:logs';[a44_0xe97346(0x1b6)]=a44_0xe97346(0x1c4);async['execute'](_0x923dd5){const _0x21f521=a44_0xe97346,{options:_0x1c1272,args:_0x105bcb,tdx:_0x59e222}=_0x923dd5,_0x262f87=_0x105bcb[0x0];let _0x2cb890=_0x105bcb[0x1];if(!_0x262f87)return console['error'](_0x21f521(0x1fc)),0x1;try{_0x1c1272[_0x21f521(0x1c2)]&&(console[_0x21f521(0x1d0)]('Attempt\x20ID:\x20'+_0x262f87),_0x2cb890&&console['error']('Task\x20name:\x20'+_0x2cb890));const _0x436612=await withSpinner(_0x21f521(0x210),()=>_0x59e222[_0x21f521(0x1a1)][_0x21f521(0x1e7)](_0x262f87,_0x2cb890),{'verbose':_0x1c1272[_0x21f521(0x1c2)]}),_0x2478cb=_0x436612[_0x21f521(0x1fb)];if(_0x2478cb['length']===0x0)return console[_0x21f521(0x1d0)](_0x21f521(0x1b4)),0x0;if(!_0x2cb890&&(_0x1c1272[_0x21f521(0x218)]||_0x1c1272[_0x21f521(0x21b)]))return await handleSDKOutput(_0x2478cb,_0x1c1272),0x0;if(!_0x2cb890){const _0x4f1941=_0x2478cb[_0x21f521(0x1e0)](_0x320955=>({'title':_0x320955[_0x21f521(0x184)]+'\x20('+formatBytes(_0x320955[_0x21f521(0x1d4)])+')','value':_0x320955[_0x21f521(0x184)]})),_0x17d3e8=await a44_0x185a25({'type':_0x21f521(0x182),'name':_0x21f521(0x1dc),'message':_0x21f521(0x1d6),'choices':_0x4f1941});if(!_0x17d3e8['task'])return console[_0x21f521(0x1d0)](_0x21f521(0x1ff)),0x0;_0x2cb890=_0x17d3e8['task'];}const _0x1637f7=await withSpinner(_0x21f521(0x1fe),()=>_0x59e222[_0x21f521(0x1a1)]['logs'](_0x262f87,_0x2cb890),{'verbose':_0x1c1272[_0x21f521(0x1c2)]}),_0xc54472=_0x1637f7[_0x21f521(0x1fb)];return _0xc54472?console[_0x21f521(0x212)](_0xc54472):console[_0x21f521(0x1d0)]('No\x20log\x20content\x20found'),0x0;}catch(_0x1f8a87){if(_0x1f8a87 instanceof SDKError)return console[_0x21f521(0x1d0)](_0x21f521(0x1ce)+_0x1f8a87[_0x21f521(0x1ed)]),_0x1f8a87[_0x21f521(0x1c6)]&&console[_0x21f521(0x1d0)](_0x21f521(0x1d1)+_0x1f8a87[_0x21f521(0x1c6)]),0x1;throw _0x1f8a87;}}}export class WorkflowKillCommand extends BaseCommand{[a44_0xe97346(0x228)]=a44_0xe97346(0x208);[a44_0xe97346(0x1b6)]=a44_0xe97346(0x1e1);async[a44_0xe97346(0x19f)](_0x5cd6df){const _0x572316=a44_0xe97346,{options:_0x136609,args:_0x5cac5f,tdx:_0x565db5}=_0x5cd6df,_0x4871a2=_0x5cac5f[0x0];if(!_0x4871a2)return console[_0x572316(0x1d0)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x37608a=_0x136609[_0x572316(0x20e)];_0x136609[_0x572316(0x1c2)]&&(console[_0x572316(0x1d0)](_0x572316(0x227)+_0x4871a2),_0x37608a&&console[_0x572316(0x1d0)](_0x572316(0x1ea)+_0x37608a));if(!_0x136609[_0x572316(0x21e)]){const _0x1f1f1a=await confirm(_0x572316(0x221)+_0x4871a2+'?');if(!_0x1f1f1a)return console[_0x572316(0x1d0)]('Cancelled'),0x0;}const _0x187d91=await withSpinner(_0x572316(0x202),()=>_0x565db5['workflow']['kill'](_0x4871a2,_0x37608a),{'verbose':_0x136609[_0x572316(0x1c2)]}),_0x1da64e=_0x187d91[_0x572316(0x1fb)];return console[_0x572316(0x1d0)]('✔\x20'+_0x1da64e),0x0;}catch(_0x1a1bf2){if(_0x1a1bf2 instanceof SDKError)return console[_0x572316(0x1d0)]('Error:\x20'+_0x1a1bf2[_0x572316(0x1ed)]),_0x1a1bf2['cause']&&console[_0x572316(0x1d0)](_0x572316(0x1d1)+_0x1a1bf2[_0x572316(0x1c6)]),0x1;throw _0x1a1bf2;}}}export class WorkflowRetryCommand extends BaseCommand{[a44_0xe97346(0x228)]=a44_0xe97346(0x1ca);[a44_0xe97346(0x1b6)]=a44_0xe97346(0x22a);async[a44_0xe97346(0x19f)](_0xb3208){const _0x56be08=a44_0xe97346,{options:_0x34ed85,args:_0x51c99c,tdx:_0x3fd078}=_0xb3208,_0x1c5295=_0x51c99c[0x0];if(!_0x1c5295)return console[_0x56be08(0x1d0)](_0x56be08(0x1f2)),console[_0x56be08(0x1d0)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x170aef=![],_0x378b97=_0x1c5295;if(_0x1c5295[_0x56be08(0x1a2)](_0x56be08(0x20c)))_0x170aef=!![],_0x378b97=_0x1c5295[_0x56be08(0x191)](0x8);else{if(_0x1c5295[_0x56be08(0x1a2)](_0x56be08(0x1f7)))_0x170aef=![],_0x378b97=_0x1c5295[_0x56be08(0x191)](0x8);else return console[_0x56be08(0x1d0)](_0x56be08(0x18f)),console[_0x56be08(0x1d0)](_0x56be08(0x1e5)),0x1;}try{const _0x2a7a2d=_0x34ed85[_0x56be08(0x200)],_0x253fcb=_0x34ed85['resumeFrom'],_0x10fae7=_0x34ed85['params'],_0x5b563a=_0x34ed85[_0x56be08(0x1de)];_0x34ed85['verbose']&&(console[_0x56be08(0x1d0)]('Target:\x20'+(_0x170aef?'session':_0x56be08(0x18b))+'\x20'+_0x378b97),_0x2a7a2d&&console['error'](_0x56be08(0x205)+_0x2a7a2d),_0x253fcb&&console['error'](_0x56be08(0x1a5)+_0x253fcb),_0x10fae7&&console['error'](_0x56be08(0x19a)+_0x10fae7),_0x5b563a&&console[_0x56be08(0x1d0)](_0x56be08(0x1f8)));let _0x2593e2;if(_0x10fae7)try{if(_0x10fae7[_0x56be08(0x1a2)]('@')){const _0x2c0cd9=await import(_0x56be08(0x214)),_0x37bff9=_0x10fae7['substring'](0x1),_0x4c98a3=await _0x2c0cd9['readFile'](_0x37bff9,_0x56be08(0x1fd));_0x2593e2=JSON['parse'](_0x4c98a3);}else _0x2593e2=JSON[_0x56be08(0x18e)](_0x10fae7);}catch{return console[_0x56be08(0x1d0)](_0x56be08(0x21d)),0x1;}if(!_0x34ed85[_0x56be08(0x21e)]){const _0x29a05e=await confirm(_0x56be08(0x1b8)+(_0x170aef?'session':'attempt')+'\x20'+_0x378b97+'?');if(!_0x29a05e)return console['error']('Cancelled'),0x0;}let _0x430a64;_0x170aef?_0x430a64=await withSpinner(_0x56be08(0x19e),()=>_0x3fd078[_0x56be08(0x1a1)][_0x56be08(0x1ab)](_0x378b97,{'fromTask':_0x2a7a2d,'retryParams':_0x2593e2}),{'verbose':_0x34ed85[_0x56be08(0x1c2)]}):_0x430a64=await withSpinner(_0x56be08(0x192),()=>_0x3fd078[_0x56be08(0x1a1)][_0x56be08(0x1cd)](_0x378b97,{'resumeFrom':_0x253fcb,'retryParams':_0x2593e2,'force':_0x5b563a}),{'verbose':_0x34ed85[_0x56be08(0x1c2)]});const _0x13f1d1=_0x430a64[_0x56be08(0x1fb)];return console['error'](_0x56be08(0x1cc)),console[_0x56be08(0x1d0)](_0x56be08(0x1e9)+_0x13f1d1[_0x56be08(0x199)]),console[_0x56be08(0x1d0)](_0x56be08(0x19d)+_0x13f1d1[_0x56be08(0x1a3)]),0x0;}catch(_0xb962d2){if(_0xb962d2 instanceof SDKError)return console[_0x56be08(0x1d0)](_0x56be08(0x1ce)+_0xb962d2[_0x56be08(0x1ed)]),_0xb962d2['cause']&&console[_0x56be08(0x1d0)]('\x20\x20Cause:\x20'+_0xb962d2['cause']),0x1;throw _0xb962d2;}}}export class WorkflowRunCommand extends BaseCommand{[a44_0xe97346(0x228)]=a44_0xe97346(0x206);[a44_0xe97346(0x1b6)]=a44_0xe97346(0x1c1);async[a44_0xe97346(0x19f)](_0x10a05c){const _0x2c89be=a44_0xe97346,{options:_0x52e035,args:_0x17c724,tdx:_0x3d598b}=_0x10a05c,_0x9528f8=_0x17c724[0x0];if(!_0x9528f8)return console[_0x2c89be(0x1d0)](_0x2c89be(0x226)),console[_0x2c89be(0x1d0)](_0x2c89be(0x211)),0x1;const _0x1f194c=_0x52e035['param'],_0x1f8acf=_0x52e035['sessionTime'],_0x55921a={};if(_0x1f194c&&Array[_0x2c89be(0x215)](_0x1f194c))for(const _0x4b9d17 of _0x1f194c){const _0x270125=_0x4b9d17[_0x2c89be(0x18a)]('=');if(_0x270125===-0x1)return console['error'](_0x2c89be(0x201)+_0x4b9d17),console[_0x2c89be(0x1d0)](_0x2c89be(0x213)),0x1;const _0x533228=_0x4b9d17[_0x2c89be(0x191)](0x0,_0x270125),_0x3cc31b=_0x4b9d17[_0x2c89be(0x191)](_0x270125+0x1);try{_0x55921a[_0x533228]=JSON[_0x2c89be(0x18e)](_0x3cc31b);}catch{_0x55921a[_0x533228]=_0x3cc31b;}}_0x52e035['verbose']&&(console[_0x2c89be(0x1d0)](_0x2c89be(0x1c7)+_0x9528f8),Object['keys'](_0x55921a)['length']>0x0&&console[_0x2c89be(0x1d0)](_0x2c89be(0x21a)+JSON[_0x2c89be(0x203)](_0x55921a)),_0x1f8acf&&console['error'](_0x2c89be(0x1d7)+_0x1f8acf));const _0x46d736=await withSpinner(_0x2c89be(0x189),()=>_0x3d598b[_0x2c89be(0x1a1)][_0x2c89be(0x180)](_0x9528f8,_0x55921a,{'sessionTime':_0x1f8acf}),{'verbose':_0x52e035[_0x2c89be(0x1c2)]}),_0x5a282f=_0x46d736[_0x2c89be(0x1fb)];return console['error'](_0x2c89be(0x20f)),console[_0x2c89be(0x1d0)]('\x20\x20Attempt\x20ID:\x20'+_0x5a282f['id']),console[_0x2c89be(0x1d0)](_0x2c89be(0x19d)+_0x5a282f['sessionId']),console[_0x2c89be(0x1d0)](_0x2c89be(0x18c)+_0x5a282f[_0x2c89be(0x229)]?.[_0x2c89be(0x228)]),console[_0x2c89be(0x1d0)]('\x20\x20Workflow:\x20'+_0x5a282f[_0x2c89be(0x1a1)]?.[_0x2c89be(0x228)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a44_0xe97346(0x228)]='workflow:download';[a44_0xe97346(0x1b6)]=a44_0xe97346(0x1bb);async[a44_0xe97346(0x19f)](_0x3f8503){const _0x742500=a44_0xe97346,{options:_0x4f3b3c,args:_0x18a20c,tdx:_0x522b2b}=_0x3f8503,_0x37151b=_0x18a20c[0x0],_0x1fd137=_0x18a20c[0x1]||'.';if(!_0x37151b)return console[_0x742500(0x1d0)](_0x742500(0x18d)),console[_0x742500(0x1d0)](_0x742500(0x1be)),0x1;const _0x1a836d=_0x4f3b3c[_0x742500(0x1ad)];_0x4f3b3c['verbose']&&(console[_0x742500(0x1d0)](_0x742500(0x1cb)+_0x37151b),console[_0x742500(0x1d0)](_0x742500(0x1ac)+_0x1fd137),_0x1a836d&&console[_0x742500(0x1d0)]('Revision:\x20'+_0x1a836d));const _0x3570c4=await withSpinner(_0x742500(0x1f9)+_0x37151b+_0x742500(0x204),()=>_0x522b2b[_0x742500(0x1a1)][_0x742500(0x1e8)](_0x37151b,_0x1fd137,{'revision':_0x1a836d}),{'verbose':_0x4f3b3c[_0x742500(0x1c2)]}),_0x273f6d=_0x3570c4[_0x742500(0x1fb)];return console[_0x742500(0x1d0)]('✔\x20Downloaded\x20'+_0x273f6d[_0x742500(0x220)]),console[_0x742500(0x1d0)]('\x20\x20Revision:\x20'+_0x273f6d[_0x742500(0x1ad)]),console[_0x742500(0x1d0)]('\x20\x20Files\x20extracted:\x20'+_0x273f6d[_0x742500(0x1e2)]),console[_0x742500(0x1d0)](_0x742500(0x1da)+_0x1fd137+'/'+_0x273f6d['projectName']),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a44_0xe97346(0x228)]=a44_0xe97346(0x209);[a44_0xe97346(0x1b6)]=a44_0xe97346(0x197);async['execute'](_0x114fb1){const _0x14988c=a44_0xe97346,{options:_0x5a1590,args:_0x4cc5e6,tdx:_0x31874d}=_0x114fb1;let _0x5d2451='.',_0x10be1b=_0x5a1590[_0x14988c(0x228)];if(_0x4cc5e6[0x0]){const {promises:_0x346892}=await import('fs');try{const _0x2823a0=await _0x346892[_0x14988c(0x183)](_0x4cc5e6[0x0]);if(_0x2823a0[_0x14988c(0x216)]())_0x5d2451=_0x4cc5e6[0x0];else return console['error']('Error:\x20'+_0x4cc5e6[0x0]+_0x14988c(0x1b3)),0x1;}catch{_0x10be1b=_0x4cc5e6[0x0],_0x5d2451='.';}}const _0x1caeeb=_0x5a1590[_0x14988c(0x1ad)],_0x121504=_0x5a1590[_0x14988c(0x1ec)];_0x5a1590[_0x14988c(0x1c2)]&&(console[_0x14988c(0x1d0)]('Project\x20directory:\x20'+_0x5d2451),_0x10be1b&&console[_0x14988c(0x1d0)](_0x14988c(0x181)+_0x10be1b),_0x1caeeb&&console['error'](_0x14988c(0x1ae)+_0x1caeeb),_0x121504&&console[_0x14988c(0x1d0)](_0x14988c(0x195)));const _0x13b702=await withSpinner(_0x14988c(0x1ef),()=>_0x31874d[_0x14988c(0x1a1)][_0x14988c(0x207)](_0x5d2451,{'projectName':_0x10be1b,'revision':_0x1caeeb,'skipValidation':_0x121504}),{'verbose':_0x5a1590[_0x14988c(0x1c2)]}),_0x4bdb50=_0x13b702[_0x14988c(0x1fb)];return console['error']('✔\x20Pushed\x20'+_0x4bdb50[_0x14988c(0x220)]),console[_0x14988c(0x1d0)]('\x20\x20Project\x20ID:\x20'+_0x4bdb50[_0x14988c(0x1cf)]),console[_0x14988c(0x1d0)](_0x14988c(0x1a0)+_0x4bdb50['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0xe97346(0x228)]=a44_0xe97346(0x19b);[a44_0xe97346(0x1b6)]=a44_0xe97346(0x1a7);async[a44_0xe97346(0x19f)](_0x1090b7){const _0x94f3c1=a44_0xe97346,{options:_0x5472e0,args:_0x3c0c6b,tdx:_0x5a33ac}=_0x1090b7,_0x101379=_0x3c0c6b[0x0];if(!_0x101379)return console['error'](_0x94f3c1(0x1d5)),console['error'](_0x94f3c1(0x1f6)),0x1;_0x5472e0[_0x94f3c1(0x1c2)]&&console['error']('Project:\x20'+_0x101379);if(!_0x5472e0[_0x94f3c1(0x21e)]){const _0x284a7c=await confirm(_0x94f3c1(0x1a6)+_0x101379+_0x94f3c1(0x1b5));if(!_0x284a7c)return console[_0x94f3c1(0x1d0)]('Cancelled'),0x0;}const _0x1d12c8=await withSpinner('Deleting\x20project\x20'+_0x101379+_0x94f3c1(0x204),()=>_0x5a33ac['workflow'][_0x94f3c1(0x1c8)](_0x101379),{'verbose':_0x5472e0[_0x94f3c1(0x1c2)]}),_0x16ab4b=_0x1d12c8[_0x94f3c1(0x1fb)];return console[_0x94f3c1(0x1d0)]('✔\x20Deleted\x20project\x20'+_0x16ab4b[_0x94f3c1(0x220)]),console['error'](_0x94f3c1(0x1c3)+_0x16ab4b[_0x94f3c1(0x1cf)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2d71a2,_0x4b225f){const _0x5baca5=a45_0x1373,_0x1bd5cb=_0x2d71a2();while(!![]){try{const _0x2dbc33=-parseInt(_0x5baca5(0x1e4))/0x1+-parseInt(_0x5baca5(0x1d6))/0x2*(parseInt(_0x5baca5(0x1d9))/0x3)+-parseInt(_0x5baca5(0x1de))/0x4*(-parseInt(_0x5baca5(0x1dc))/0x5)+-parseInt(_0x5baca5(0x1d5))/0x6+-parseInt(_0x5baca5(0x1e3))/0x7+parseInt(_0x5baca5(0x1d8))/0x8+-parseInt(_0x5baca5(0x1db))/0x9*(-parseInt(_0x5baca5(0x1e2))/0xa);if(_0x2dbc33===_0x4b225f)break;else _0x1bd5cb['push'](_0x1bd5cb['shift']());}catch(_0x2cfea){_0x1bd5cb['push'](_0x1bd5cb['shift']());}}}(a45_0x4a9b,0x5d1eb));import{platform}from'os';import{readFileSync}from'fs';function a45_0x4a9b(){const _0x4dba54=['tdx','parse','3052338bYhpIq','40aZZGGf','replace','359976CoHqVy','92403BdWpfh','../../package.json','2525751vGpzUD','835YzaUFk','TD1\x20','3428FIrcRn','version','Authorization','entries','70UvwswC','3829021uVXISM','99424UDyaWL',';\x20node/','tdx/','0.0.0'];a45_0x4a9b=function(){return _0x4dba54;};return a45_0x4a9b();}import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x3d7314=a45_0x1373;try{const _0x4b9229=fileURLToPath(import.meta.url),_0x49f453=dirname(_0x4b9229),_0x1ed835=join(_0x49f453,_0x3d7314(0x1da)),_0x2c3d19=JSON[_0x3d7314(0x1d4)](readFileSync(_0x1ed835,'utf-8'));return _0x2c3d19[_0x3d7314(0x1df)];}catch{return _0x3d7314(0x1d2);}}export function getUserAgent(){const _0x59340a=a45_0x1373,_0x18a377=getVersion(),_0xfada6d=platform(),_0x5a340e=process['version'][_0x59340a(0x1d7)]('v','');return _0x59340a(0x1d1)+_0x18a377+'\x20('+_0xfada6d+_0x59340a(0x1d0)+_0x5a340e+')';}export function getAuthHeaders(_0x1ca283,_0x369183){const _0x52dcf3=a45_0x1373,_0x194110=getVersion(),_0x489d4b={'User-Agent':getUserAgent(),'X-TD-Client':_0x52dcf3(0x1d3),'X-TD-Client-Version':_0x194110};return _0x369183&&(_0x489d4b['Authorization']=_0x52dcf3(0x1dd)+_0x369183),_0x489d4b;}export function toHeaderRecord(_0x3b5a6b){const _0x527cf8=a45_0x1373,_0x169799={};for(const [_0xb5a783,_0x49245d]of Object[_0x527cf8(0x1e1)](_0x3b5a6b)){_0x49245d!==undefined&&(_0x169799[_0xb5a783]=_0x49245d);}return _0x169799;}export function getTrinoHeaders(_0x182849,_0x34bdc6){const _0x11176e=a45_0x1373,_0x2a50c6=getAuthHeaders(_0x182849,_0x34bdc6),_0x3fb84f=toHeaderRecord(_0x2a50c6);return delete _0x3fb84f[_0x11176e(0x1e0)],_0x34bdc6&&(_0x3fb84f['X-Trino-User']=_0x34bdc6),_0x3fb84f;}function a45_0x1373(_0x531158,_0x955afd){_0x531158=_0x531158-0x1d0;const _0x4a9b1b=a45_0x4a9b();let _0x13734a=_0x4a9b1b[_0x531158];return _0x13734a;}export function hasAPIKey(_0x5a077f){const _0xd6f29a=getAPIKey(_0x5a077f);return _0xd6f29a!==undefined&&_0xd6f29a['length']>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0xd436fa,_0x27a7da){const _0x5e2990=a46_0x1a85,_0x3db7d7=_0xd436fa();while(!![]){try{const _0x2ebee1=parseInt(_0x5e2990(0x11e))/0x1*(parseInt(_0x5e2990(0x126))/0x2)+-parseInt(_0x5e2990(0x10d))/0x3+parseInt(_0x5e2990(0x122))/0x4+-parseInt(_0x5e2990(0x11a))/0x5*(parseInt(_0x5e2990(0xf8))/0x6)+-parseInt(_0x5e2990(0x10e))/0x7*(-parseInt(_0x5e2990(0x10c))/0x8)+-parseInt(_0x5e2990(0x115))/0x9*(-parseInt(_0x5e2990(0xe5))/0xa)+parseInt(_0x5e2990(0xef))/0xb;if(_0x2ebee1===_0x27a7da)break;else _0x3db7d7['push'](_0x3db7d7['shift']());}catch(_0x2c68ec){_0x3db7d7['push'](_0x3db7d7['shift']());}}}(a46_0x1cd2,0xb24a8));import{homedir}from'os';function a46_0x1cd2(){const _0x48c739=['apiKey','22794LrUiDl','llm_default_project','Warning:\x20Unknown\x20site\x20\x27','.env','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','split','profiles','TDX_API_KEY\x20env\x20var','keychain\x20(profile:\x20','dev-eu01','env','includes','stg-us01','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','match','startsWith','Warning:\x20Failed\x20to\x20load\x20','source','entries','TDX_API_KEY_','28072TVesro','3147540JEPcmx','2443KvjabI','eu01','\x27,\x20defaulting\x20to\x20us01','us01','ap03','replace','account_info.','6471tmMuYs','toUpperCase','dev-us01','TDX_API_KEY_<PROFILE>','utf-8','855aUjMmO','llm_default_project.','\x20env\x20var','tdx.json','589231BnFdmM','TD_API_KEY','stg-ap03','legacy\x20.env\x20file\x20(profile:\x20','931240jfciaS','.env.','parse','.config','2cozUoB','legacy\x20.env\x20file','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','keychain','jp01','name','llm_default_agent.','existsSync','stg-jp01','TD_API_KEY\x20env\x20var\x20(deprecated)','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','yellow','warn','stringify','projectId','Warning:\x20Failed\x20to\x20read\x20','filter','2440GxoKrs','apiKeys','readFileSync','accountId','trim','slice','ap02','profile','.json','join','2276681qPTxMO','string','number','TDX_API_KEY','site','some','TD_API_KEY_','endsWith'];a46_0x1cd2=function(){return _0x48c739;};return a46_0x1cd2();}import{join}from'path';function a46_0x1a85(_0x2eba8b,_0xb068d5){_0x2eba8b=_0x2eba8b-0xe0;const _0x1cd29e=a46_0x1cd2();let _0x1a85c8=_0x1cd29e[_0x2eba8b];return _0x1a85c8;}import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x52c338 from'node:fs';import*as a46_0x52ea98 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_0x5260c2 from'chalk';export function getConfigDir(){const _0x1d9a14=a46_0x1a85;return process[_0x1d9a14(0x102)]['TDX_CONFIG_DIR']||join(homedir(),_0x1d9a14(0x125),'tdx');}export function getConfigFile(){const _0x193d2f=a46_0x1a85;return join(getConfigDir(),_0x193d2f(0xfb));}export function getConfigFilePath(_0x467e5b){const _0x4230b5=a46_0x1a85,_0x253af7=getConfigDir();return _0x467e5b?a46_0x52ea98['join'](_0x253af7,_0x4230b5(0x123)+_0x467e5b):getConfigFile();}export function getCacheDir(){const _0x3476ed=a46_0x1a85;return process[_0x3476ed(0x102)]['TDX_CACHE_DIR']||join(homedir(),'.cache','tdx');}export function getLLMProjectCacheFile(_0x5e7d82){const _0x35b6a5=a46_0x1a85,_0x1eb9e5=_0x5e7d82?_0x35b6a5(0x11b)+_0x5e7d82:_0x35b6a5(0xf9);return join(getCacheDir(),_0x1eb9e5);}export function readCachedLLMProject(_0x2c3e1d){const _0x365664=a46_0x1a85;try{const _0x253400=getLLMProjectCacheFile(_0x2c3e1d);if(!existsSync(_0x253400))return null;const _0x6320d5=readFileSync(_0x253400,_0x365664(0x119))[_0x365664(0xe9)]();try{const _0x3ce07a=JSON[_0x365664(0x124)](_0x6320d5);if(_0x3ce07a&&typeof _0x3ce07a['id']===_0x365664(0xf0)&&typeof _0x3ce07a[_0x365664(0x12b)]===_0x365664(0xf0))return _0x3ce07a;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x38a150,_0x135c9f,_0x245c9d){const _0x353f2e=a46_0x1a85;try{const _0x732a81=getCacheDir(),_0x1381a9=getLLMProjectCacheFile(_0x245c9d);!existsSync(_0x732a81)&&mkdirSync(_0x732a81,{'recursive':!![]});const _0x268ff2={'name':_0x38a150,'id':_0x135c9f};writeFileSync(_0x1381a9,JSON[_0x353f2e(0xe1)](_0x268ff2),'utf-8');}catch{}}export function getLLMAgentCacheFile(_0x3f4e96){const _0x6022f1=a46_0x1a85,_0x1c068a=_0x3f4e96?_0x6022f1(0x12c)+_0x3f4e96:'llm_default_agent';return join(getCacheDir(),_0x1c068a);}export function readCachedLLMAgent(_0x1a2b74){const _0x47ae46=a46_0x1a85;try{const _0x46fe00=getLLMAgentCacheFile(_0x1a2b74);if(!existsSync(_0x46fe00))return null;const _0x212b14=readFileSync(_0x46fe00,_0x47ae46(0x119))[_0x47ae46(0xe9)]();try{const _0x3431f9=JSON['parse'](_0x212b14);if(_0x3431f9&&typeof _0x3431f9['id']===_0x47ae46(0xf0)&&typeof _0x3431f9[_0x47ae46(0x12b)]===_0x47ae46(0xf0)&&typeof _0x3431f9[_0x47ae46(0xe2)]==='string')return _0x3431f9;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x50a00a,_0x522e95,_0x164275,_0x28dde7){const _0x57e67d=a46_0x1a85;try{const _0x36dadd=getCacheDir(),_0x28c9b6=getLLMAgentCacheFile(_0x28dde7);!existsSync(_0x36dadd)&&mkdirSync(_0x36dadd,{'recursive':!![]});const _0x5a4281={'name':_0x50a00a,'id':_0x522e95,'projectId':_0x164275};writeFileSync(_0x28c9b6,JSON['stringify'](_0x5a4281),_0x57e67d(0x119));}catch{}}export function clearCachedLLMAgent(_0x1f5ca9){try{const _0x9fddf1=getLLMAgentCacheFile(_0x1f5ca9);existsSync(_0x9fddf1)&&unlinkSync(_0x9fddf1);}catch{}}export function getAccountInfoCacheFile(_0x42a58e){const _0x4abc79=a46_0x1a85,_0x1b8cdd=_0x42a58e?_0x4abc79(0x114)+_0x42a58e+_0x4abc79(0xed):'account_info.json';return join(getCacheDir(),_0x1b8cdd);}export function readCachedAccountInfo(_0x57fe2e){const _0x31f043=a46_0x1a85;try{const _0x318869=getAccountInfoCacheFile(_0x57fe2e);if(!existsSync(_0x318869))return null;const _0x48ca24=readFileSync(_0x318869,'utf-8')[_0x31f043(0xe9)](),_0x5c38a7=JSON[_0x31f043(0x124)](_0x48ca24);if(_0x5c38a7&&typeof _0x5c38a7[_0x31f043(0xf3)]===_0x31f043(0xf0)&&typeof _0x5c38a7[_0x31f043(0xe8)]===_0x31f043(0xf1))return _0x5c38a7;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x3900f7,_0x1b495b,_0x27eed5){const _0x152e73=a46_0x1a85;try{const _0x2f4ff5=getCacheDir(),_0x58d93b=getAccountInfoCacheFile(_0x27eed5);!existsSync(_0x2f4ff5)&&mkdirSync(_0x2f4ff5,{'recursive':!![]});const _0x4ceb54={'site':_0x3900f7,'accountId':_0x1b495b,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x58d93b,JSON[_0x152e73(0xe1)](_0x4ceb54),_0x152e73(0x119));}catch{}}export function parseEnvFile(_0x18c0f9){const _0x31058e=a46_0x1a85,_0x9e52b9={};for(const _0x2efd7e of _0x18c0f9[_0x31058e(0xfd)]('\x0a')){const _0x49e941=_0x2efd7e[_0x31058e(0xe9)]();if(!_0x49e941||_0x49e941[_0x31058e(0x107)]('#'))continue;const _0x479112=_0x49e941[_0x31058e(0x106)](/^([^=]+)=(.*)$/);if(_0x479112){const _0x4b6fab=_0x479112[0x1][_0x31058e(0xe9)]();let _0x2bbd78=_0x479112[0x2][_0x31058e(0xe9)]();(_0x2bbd78['startsWith']('\x22')&&_0x2bbd78['endsWith']('\x22')||_0x2bbd78[_0x31058e(0x107)]('\x27')&&_0x2bbd78[_0x31058e(0xf6)]('\x27'))&&(_0x2bbd78=_0x2bbd78[_0x31058e(0xea)](0x1,-0x1)),_0x9e52b9[_0x4b6fab]=_0x2bbd78;}}return _0x9e52b9;}export function readUserConfig(){const _0x53355f=a46_0x1a85,_0x836025=getConfigFile();if(!existsSync(_0x836025))return{};try{const _0x13de70=readFileSync(_0x836025,_0x53355f(0x119));return parseEnvFile(_0x13de70);}catch(_0x5ac782){return console[_0x53355f(0xe0)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x836025+':',_0x5ac782),{};}}export function resolveSite(_0x2170fd){const _0xc77a5a=a46_0x1a85,_0x4cb1ff=[_0xc77a5a(0x111),_0xc77a5a(0x12a),_0xc77a5a(0x10f),_0xc77a5a(0xeb),_0xc77a5a(0x112),_0xc77a5a(0x117),_0xc77a5a(0x101),_0xc77a5a(0x104),_0xc77a5a(0x12e),_0xc77a5a(0x120)];if(_0x4cb1ff[_0xc77a5a(0x103)](_0x2170fd))return _0x2170fd;if(_0x2170fd in SITE_ALIASES)return SITE_ALIASES[_0x2170fd];return console[_0xc77a5a(0xe0)](_0xc77a5a(0xfa)+_0x2170fd+_0xc77a5a(0x110)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x24dc07,_0xb5ffda){const _0x30c0d8=a46_0x1a85,_0x49acf9=_0xb5ffda||getActiveProfileName();if(_0x49acf9){const _0x1aaca8=_0x30c0d8(0x10b)+normalizeProfileForEnvVar(_0x49acf9);if(process[_0x30c0d8(0x102)][_0x1aaca8])return process[_0x30c0d8(0x102)][_0x1aaca8];}if(process['env'][_0x30c0d8(0xf2)])return process[_0x30c0d8(0x102)][_0x30c0d8(0xf2)];if(process[_0x30c0d8(0x102)][_0x30c0d8(0x11f)])return process[_0x30c0d8(0x102)]['TD_API_KEY'];const _0x19c16b=_0x24dc07['toUpperCase']()[_0x30c0d8(0x113)](/-/g,'_'),_0x53b905=_0x30c0d8(0xf5)+_0x19c16b;if(_0x49acf9){const _0x1d5b07=loadProfileEnv(_0x49acf9);if(_0x1d5b07){if(_0x1d5b07[_0x53b905])return _0x1d5b07[_0x53b905];if(_0x1d5b07[_0x30c0d8(0x11f)])return _0x1d5b07['TD_API_KEY'];}}const _0x1623c9=loadUserConfigOnce();if(_0x1623c9[_0x53b905])return _0x1623c9[_0x53b905];if(_0x1623c9[_0x30c0d8(0x11f)])return _0x1623c9['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x4437be){return _0x4437be['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x5b8bc5,_0x35fb7c){const _0x5cfee0=a46_0x1a85,_0xa28cb6=_0x35fb7c||getActiveProfileName()||undefined;if(_0xa28cb6){const _0x1e9d0f=_0x5cfee0(0x10b)+normalizeProfileForEnvVar(_0xa28cb6);if(process[_0x5cfee0(0x102)][_0x1e9d0f])return{'apiKey':process[_0x5cfee0(0x102)][_0x1e9d0f],'source':_0x1e9d0f+_0x5cfee0(0x11c),'isDeprecated':![]};const _0x19d83f=getCachedCredential(_0x5b8bc5,_0xa28cb6);if(_0x19d83f)return{'apiKey':_0x19d83f,'source':_0x5cfee0(0x100)+_0xa28cb6+')','isDeprecated':![]};const _0x2b4f6e=await getKeychainAPIKey(_0xa28cb6);if(_0x2b4f6e)return setCachedCredential(_0x2b4f6e,_0x5b8bc5,_0xa28cb6),{'apiKey':_0x2b4f6e,'source':_0x5cfee0(0x100)+_0xa28cb6+')','isDeprecated':![]};}if(process[_0x5cfee0(0x102)][_0x5cfee0(0xf2)])return{'apiKey':process[_0x5cfee0(0x102)][_0x5cfee0(0xf2)],'source':_0x5cfee0(0xff),'isDeprecated':![]};if(!_0xa28cb6){const _0x385f3b=getCachedCredential(_0x5b8bc5,undefined);if(_0x385f3b)return{'apiKey':_0x385f3b,'source':_0x5cfee0(0x129),'isDeprecated':![]};const _0x2b8ac8=await getKeychainAPIKey(undefined);if(_0x2b8ac8)return setCachedCredential(_0x2b8ac8,_0x5b8bc5,undefined),{'apiKey':_0x2b8ac8,'source':_0x5cfee0(0x129),'isDeprecated':![]};}if(process[_0x5cfee0(0x102)][_0x5cfee0(0x11f)])return{'apiKey':process['env'][_0x5cfee0(0x11f)],'source':_0x5cfee0(0x12f),'isDeprecated':!![]};const _0x2e3df4=getLegacyEnvAPIKey(_0x5b8bc5,_0xa28cb6);if(_0x2e3df4){const _0x2ea36a=await isKeychainAvailable();if(_0x2ea36a)try{await saveKeychainAPIKey(_0x2e3df4,_0xa28cb6),setCachedCredential(_0x2e3df4,_0x5b8bc5,_0xa28cb6);const _0x12c89b=getConfigFilePath(_0xa28cb6);cleanupLegacyEnvFile(_0x12c89b)&&console[_0x5cfee0(0xe0)](a46_0x5260c2[_0x5cfee0(0x131)](_0x5cfee0(0x128)));}catch(_0x1e99db){console['warn'](a46_0x5260c2[_0x5cfee0(0x131)](_0x5cfee0(0x130)+_0x1e99db));}const _0x4ec634=_0xa28cb6?_0x5cfee0(0x121)+_0xa28cb6+')':_0x5cfee0(0x127);return{'apiKey':_0x2e3df4,'source':_0x4ec634,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0xf49628,_0x1513fb,_0x4972a9=!![]){const _0x271226=a46_0x1a85,_0x4a919e=await resolveAPIKeyAsync(_0xf49628,_0x1513fb);if(!_0x4a919e)return undefined;if(_0x4972a9&&_0x4a919e['isDeprecated']&&_0x4a919e[_0x271226(0x109)][_0x271226(0x103)](_0x271226(0x11f))){const _0x1a1b2b=_0x1513fb||getActiveProfileName()||undefined,_0x31bcf3=_0x1a1b2b?_0x271226(0x10b)+normalizeProfileForEnvVar(_0x1a1b2b):_0x271226(0x118);console[_0x271226(0xe0)](a46_0x5260c2[_0x271226(0x131)](_0x271226(0x105)+(_0x271226(0xfc)+_0x31bcf3+').')));}return _0x4a919e[_0x271226(0xf7)];}function getLegacyEnvAPIKey(_0x586009,_0x3ad9c0){const _0x214cff=a46_0x1a85,_0x47b094=_0x586009['toUpperCase']()['replace'](/-/g,'_'),_0x38984c=_0x214cff(0xf5)+_0x47b094;if(_0x3ad9c0){const _0x2c1884=loadProfileEnv(_0x3ad9c0);if(_0x2c1884){if(_0x2c1884[_0x38984c])return _0x2c1884[_0x38984c];if(_0x2c1884[_0x214cff(0x11f)])return _0x2c1884['TD_API_KEY'];}}const _0x1c4d93=loadUserConfigOnce();if(_0x1c4d93[_0x38984c])return _0x1c4d93[_0x38984c];if(_0x1c4d93[_0x214cff(0x11f)])return _0x1c4d93[_0x214cff(0x11f)];return undefined;}function cleanupLegacyEnvFile(_0x524f92){const _0x3b3efb=a46_0x1a85;if(!existsSync(_0x524f92))return![];try{const _0x3db141=readFileSync(_0x524f92,_0x3b3efb(0x119)),_0x4a3ba9=_0x3db141['split']('\x0a'),_0x17d96c=_0x4a3ba9[_0x3b3efb(0xe4)](_0x5f18dd=>{const _0x2e208f=_0x3b3efb,_0x2c84a5=_0x5f18dd[_0x2e208f(0xe9)]();if(!_0x2c84a5||_0x2c84a5['startsWith']('#'))return!![];const [_0x4a333c]=_0x2c84a5[_0x2e208f(0xfd)]('=');return!_0x4a333c[_0x2e208f(0x107)](_0x2e208f(0x11f));}),_0x574cca=_0x17d96c[_0x3b3efb(0xf4)](_0x300749=>{const _0x4dbf6f=_0x3b3efb,_0x290d42=_0x300749[_0x4dbf6f(0xe9)]();return _0x290d42&&!_0x290d42[_0x4dbf6f(0x107)]('#');});if(!_0x574cca)return unlinkSync(_0x524f92),!![];return writeFileSync(_0x524f92,_0x17d96c[_0x3b3efb(0xee)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x70a79){const _0x5822a8=a46_0x1a85,_0x4db3bb=a46_0x52ea98[_0x5822a8(0xee)](getConfigDir(),_0x5822a8(0x123)+_0x70a79);if(a46_0x52c338[_0x5822a8(0x12d)](_0x4db3bb)){validateSecureFilePermissions(_0x4db3bb);try{const _0x6966b0=a46_0x52c338['readFileSync'](_0x4db3bb,'utf-8');return parseEnvFile(_0x6966b0);}catch(_0x586845){console['warn'](_0x5822a8(0x108)+_0x4db3bb+':\x20'+_0x586845);}}const _0x4126f0=a46_0x52ea98[_0x5822a8(0xee)](getConfigDir(),_0x5822a8(0xfe),_0x70a79,_0x5822a8(0xfb));if(a46_0x52c338[_0x5822a8(0x12d)](_0x4126f0)){validateSecureFilePermissions(_0x4126f0);try{const _0x8a996=a46_0x52c338[_0x5822a8(0xe7)](_0x4126f0,_0x5822a8(0x119));return parseEnvFile(_0x8a996);}catch(_0x2d16e5){return console[_0x5822a8(0xe0)](_0x5822a8(0x108)+_0x4126f0+':\x20'+_0x2d16e5),null;}}return null;}function getActiveProfileName(){const _0x314b8a=a46_0x1a85,_0xf1ee45=a46_0x52ea98['join'](getConfigDir(),_0x314b8a(0x11d));if(!a46_0x52c338['existsSync'](_0xf1ee45))return null;try{const _0x578396=a46_0x52c338['readFileSync'](_0xf1ee45,_0x314b8a(0x119)),_0x4ff5c9=JSON[_0x314b8a(0x124)](_0x578396);return _0x4ff5c9[_0x314b8a(0xec)]||null;}catch{return null;}}export function saveAPIKey(_0x45569d,_0x309cdc,_0x4cd2a5){const _0x27a337=a46_0x1a85,_0x534221=getConfigDir(),_0x5a94d2=getConfigFilePath(_0x4cd2a5);!existsSync(_0x534221)&&mkdirSync(_0x534221,{'recursive':!![],'mode':0x1c0});let _0x17527f={};if(existsSync(_0x5a94d2))try{const _0x352d9a=readFileSync(_0x5a94d2,_0x27a337(0x119));_0x17527f=parseEnvFile(_0x352d9a);}catch(_0x77d532){console[_0x27a337(0xe0)](_0x27a337(0xe3)+_0x5a94d2+':',_0x77d532);}const _0x33ef4e=_0x45569d[_0x27a337(0x116)]()[_0x27a337(0x113)](/-/g,'_');_0x17527f['TD_API_KEY_'+_0x33ef4e]=_0x309cdc;const _0x555e5a=Object[_0x27a337(0x10a)](_0x17527f)['map'](([_0x2a01fc,_0xcc149])=>_0x2a01fc+'='+_0xcc149);writeFileSync(_0x5a94d2,_0x555e5a[_0x27a337(0xee)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x56ae71,_0x5e9b53,_0x29cf07){await saveKeychainAPIKey(_0x56ae71,_0x29cf07),setCachedCredential(_0x56ae71,_0x5e9b53,_0x29cf07);const _0x1e3598=getConfigFilePath(_0x29cf07);cleanupLegacyEnvFile(_0x1e3598)&&console['warn'](a46_0x5260c2['yellow']('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x5d1554=a46_0x1a85,_0x2cb514={'apiKeys':{},'defaultSite':_0x5d1554(0x111)},_0x593eb4=[_0x5d1554(0x111),'jp01',_0x5d1554(0x10f),_0x5d1554(0xeb),_0x5d1554(0x112),'dev-us01',_0x5d1554(0x101),_0x5d1554(0x104),_0x5d1554(0x12e),_0x5d1554(0x120)];for(const _0x4d2d10 of _0x593eb4){const _0x1743d8=getAPIKey(_0x4d2d10);_0x1743d8&&(_0x2cb514[_0x5d1554(0xe6)][_0x4d2d10]=_0x1743d8);}return _0x2cb514;}
|
|
1
|
+
(function(_0x22ab3a,_0x232a46){const _0x5f290a=a46_0xf41e,_0x485c54=_0x22ab3a();while(!![]){try{const _0x398be7=-parseInt(_0x5f290a(0x187))/0x1+-parseInt(_0x5f290a(0x1bf))/0x2+-parseInt(_0x5f290a(0x19b))/0x3+parseInt(_0x5f290a(0x1ac))/0x4+-parseInt(_0x5f290a(0x199))/0x5+parseInt(_0x5f290a(0x18e))/0x6+-parseInt(_0x5f290a(0x1a3))/0x7*(-parseInt(_0x5f290a(0x1b0))/0x8);if(_0x398be7===_0x232a46)break;else _0x485c54['push'](_0x485c54['shift']());}catch(_0x168a64){_0x485c54['push'](_0x485c54['shift']());}}}(a46_0x2b50,0x49ea2));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';function a46_0x2b50(){const _0x1dfacb=['keychain','jp01','TDX_API_KEY_<PROFILE>','llm_default_project','match','stg-jp01','join','1204418LQGTTp','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','toUpperCase','replace','.env','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','tdx.json','Warning:\x20Unknown\x20site\x20\x27','profile','readFileSync','isDeprecated','Warning:\x20Failed\x20to\x20read\x20','TD_API_KEY_','dev-eu01','TDX_API_KEY_','account_info.','.env.','stg-ap03','string','warn','legacy\x20.env\x20file','existsSync','234212VxwSHv','TDX_API_KEY','utf-8','stg-us01','ap02','yellow','number','3352692oQJCRU','name','includes','profiles','slice','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','map','llm_default_project.','tdx','keychain\x20(profile:\x20','TD_API_KEY','2697470dMsucE','us01','1674702gUiGSm','endsWith','stringify','source','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','some','.json','TDX_CONFIG_DIR','7hCVmgc','accountId','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','filter','ap03','trim','startsWith','legacy\x20.env\x20file\x20(profile:\x20','env','1989712TNLaIe','entries','apiKey','split','9445544YbOyaf','TDX_CACHE_DIR','parse','apiKeys','.cache','eu01','toISOString','site'];a46_0x2b50=function(){return _0x1dfacb;};return a46_0x2b50();}import*as a46_0x108dda from'node:fs';import*as a46_0x12dd06 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_0x451a86 from'chalk';export function getConfigDir(){const _0x3ce108=a46_0xf41e;return process[_0x3ce108(0x1ab)][_0x3ce108(0x1a2)]||join(homedir(),'.config',_0x3ce108(0x196));}export function getConfigFile(){const _0x29fb7d=a46_0xf41e;return join(getConfigDir(),_0x29fb7d(0x1c4));}export function getConfigFilePath(_0x4e65ed){const _0x2ecc80=a46_0xf41e,_0x43607a=getConfigDir();return _0x4e65ed?a46_0x12dd06[_0x2ecc80(0x1be)](_0x43607a,_0x2ecc80(0x181)+_0x4e65ed):getConfigFile();}export function getCacheDir(){const _0x821d92=a46_0xf41e;return process[_0x821d92(0x1ab)][_0x821d92(0x1b1)]||join(homedir(),_0x821d92(0x1b4),_0x821d92(0x196));}export function getLLMProjectCacheFile(_0x183156){const _0x13d1e4=a46_0xf41e,_0x29326c=_0x183156?_0x13d1e4(0x195)+_0x183156:_0x13d1e4(0x1bb);return join(getCacheDir(),_0x29326c);}export function readCachedLLMProject(_0x39f9bd){const _0xc15906=a46_0xf41e;try{const _0x31f516=getLLMProjectCacheFile(_0x39f9bd);if(!existsSync(_0x31f516))return null;const _0x255091=readFileSync(_0x31f516,_0xc15906(0x189))[_0xc15906(0x1a8)]();try{const _0x576c7a=JSON[_0xc15906(0x1b2)](_0x255091);if(_0x576c7a&&typeof _0x576c7a['id']===_0xc15906(0x183)&&typeof _0x576c7a[_0xc15906(0x18f)]===_0xc15906(0x183))return _0x576c7a;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x1349e5,_0x24d3ed,_0x34d534){try{const _0x4807e3=getCacheDir(),_0x1aec5f=getLLMProjectCacheFile(_0x34d534);!existsSync(_0x4807e3)&&mkdirSync(_0x4807e3,{'recursive':!![]});const _0x2edb3b={'name':_0x1349e5,'id':_0x24d3ed};writeFileSync(_0x1aec5f,JSON['stringify'](_0x2edb3b),'utf-8');}catch{}}export function getLLMAgentCacheFile(_0x84275c){const _0x460672=_0x84275c?'llm_default_agent.'+_0x84275c:'llm_default_agent';return join(getCacheDir(),_0x460672);}export function readCachedLLMAgent(_0xa06f1d){const _0x280ba1=a46_0xf41e;try{const _0x1a4512=getLLMAgentCacheFile(_0xa06f1d);if(!existsSync(_0x1a4512))return null;const _0x3b1dcb=readFileSync(_0x1a4512,_0x280ba1(0x189))[_0x280ba1(0x1a8)]();try{const _0x372c2e=JSON[_0x280ba1(0x1b2)](_0x3b1dcb);if(_0x372c2e&&typeof _0x372c2e['id']===_0x280ba1(0x183)&&typeof _0x372c2e['name']===_0x280ba1(0x183)&&typeof _0x372c2e['projectId']===_0x280ba1(0x183))return _0x372c2e;}catch{}return null;}catch{return null;}}function a46_0xf41e(_0x31eee9,_0x287470){_0x31eee9=_0x31eee9-0x17a;const _0x2b505e=a46_0x2b50();let _0xf41ec3=_0x2b505e[_0x31eee9];return _0xf41ec3;}export function writeCachedLLMAgent(_0x29cca1,_0x395ff2,_0xce8f1b,_0x54f95d){const _0x40d770=a46_0xf41e;try{const _0x45243c=getCacheDir(),_0x4f0a00=getLLMAgentCacheFile(_0x54f95d);!existsSync(_0x45243c)&&mkdirSync(_0x45243c,{'recursive':!![]});const _0x584fc9={'name':_0x29cca1,'id':_0x395ff2,'projectId':_0xce8f1b};writeFileSync(_0x4f0a00,JSON[_0x40d770(0x19d)](_0x584fc9),'utf-8');}catch{}}export function clearCachedLLMAgent(_0x5d1ffd){try{const _0x292d94=getLLMAgentCacheFile(_0x5d1ffd);existsSync(_0x292d94)&&unlinkSync(_0x292d94);}catch{}}export function getAccountInfoCacheFile(_0x4b094a){const _0x25905d=a46_0xf41e,_0x392c78=_0x4b094a?_0x25905d(0x180)+_0x4b094a+_0x25905d(0x1a1):'account_info.json';return join(getCacheDir(),_0x392c78);}export function readCachedAccountInfo(_0x545b3b){const _0x441063=a46_0xf41e;try{const _0x25d4ba=getAccountInfoCacheFile(_0x545b3b);if(!existsSync(_0x25d4ba))return null;const _0x5360f2=readFileSync(_0x25d4ba,_0x441063(0x189))[_0x441063(0x1a8)](),_0xe3c384=JSON['parse'](_0x5360f2);if(_0xe3c384&&typeof _0xe3c384[_0x441063(0x1b7)]===_0x441063(0x183)&&typeof _0xe3c384[_0x441063(0x1a4)]===_0x441063(0x18d))return _0xe3c384;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x4b507e,_0x4606d0,_0x52a89d){const _0x16ee11=a46_0xf41e;try{const _0x5bf89f=getCacheDir(),_0x22c8ed=getAccountInfoCacheFile(_0x52a89d);!existsSync(_0x5bf89f)&&mkdirSync(_0x5bf89f,{'recursive':!![]});const _0x23d6e8={'site':_0x4b507e,'accountId':_0x4606d0,'cachedAt':new Date()[_0x16ee11(0x1b6)]()};writeFileSync(_0x22c8ed,JSON[_0x16ee11(0x19d)](_0x23d6e8),_0x16ee11(0x189));}catch{}}export function parseEnvFile(_0x1ec5fb){const _0x4ff1ea=a46_0xf41e,_0xe95ee2={};for(const _0x2b941f of _0x1ec5fb[_0x4ff1ea(0x1af)]('\x0a')){const _0x3cc4a8=_0x2b941f[_0x4ff1ea(0x1a8)]();if(!_0x3cc4a8||_0x3cc4a8[_0x4ff1ea(0x1a9)]('#'))continue;const _0x362acc=_0x3cc4a8[_0x4ff1ea(0x1bc)](/^([^=]+)=(.*)$/);if(_0x362acc){const _0x4de78f=_0x362acc[0x1]['trim']();let _0x34e256=_0x362acc[0x2][_0x4ff1ea(0x1a8)]();(_0x34e256[_0x4ff1ea(0x1a9)]('\x22')&&_0x34e256[_0x4ff1ea(0x19c)]('\x22')||_0x34e256[_0x4ff1ea(0x1a9)]('\x27')&&_0x34e256['endsWith']('\x27'))&&(_0x34e256=_0x34e256[_0x4ff1ea(0x192)](0x1,-0x1)),_0xe95ee2[_0x4de78f]=_0x34e256;}}return _0xe95ee2;}export function readUserConfig(){const _0x3c28c3=a46_0xf41e,_0x43d641=getConfigFile();if(!existsSync(_0x43d641))return{};try{const _0x999e86=readFileSync(_0x43d641,_0x3c28c3(0x189));return parseEnvFile(_0x999e86);}catch(_0xbc3aef){return console[_0x3c28c3(0x184)](_0x3c28c3(0x193)+_0x43d641+':',_0xbc3aef),{};}}export function resolveSite(_0x260c5d){const _0x36932b=a46_0xf41e,_0x527d81=[_0x36932b(0x19a),_0x36932b(0x1b9),_0x36932b(0x1b5),_0x36932b(0x18b),_0x36932b(0x1a7),'dev-us01',_0x36932b(0x17e),'stg-us01','stg-jp01',_0x36932b(0x182)];if(_0x527d81[_0x36932b(0x190)](_0x260c5d))return _0x260c5d;if(_0x260c5d in SITE_ALIASES)return SITE_ALIASES[_0x260c5d];return console[_0x36932b(0x184)](_0x36932b(0x1c7)+_0x260c5d+'\x27,\x20defaulting\x20to\x20us01'),_0x36932b(0x19a);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x53874f,_0x546007){const _0x30dac2=a46_0xf41e,_0x1d9ae5=_0x546007||getActiveProfileName();if(_0x1d9ae5){const _0x4fec64='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x1d9ae5);if(process[_0x30dac2(0x1ab)][_0x4fec64])return process['env'][_0x4fec64];}if(process[_0x30dac2(0x1ab)][_0x30dac2(0x188)])return process['env'][_0x30dac2(0x188)];if(process['env'][_0x30dac2(0x198)])return process[_0x30dac2(0x1ab)][_0x30dac2(0x198)];const _0x2bf58b=_0x53874f[_0x30dac2(0x1c2)]()[_0x30dac2(0x1c3)](/-/g,'_'),_0xc881ef=_0x30dac2(0x17d)+_0x2bf58b;if(_0x1d9ae5){const _0x43c77c=loadProfileEnv(_0x1d9ae5);if(_0x43c77c){if(_0x43c77c[_0xc881ef])return _0x43c77c[_0xc881ef];if(_0x43c77c['TD_API_KEY'])return _0x43c77c[_0x30dac2(0x198)];}}const _0x48b7cd=loadUserConfigOnce();if(_0x48b7cd[_0xc881ef])return _0x48b7cd[_0xc881ef];if(_0x48b7cd[_0x30dac2(0x198)])return _0x48b7cd['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x157df8){return _0x157df8['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x460ad7,_0x1cbf94){const _0x38f2c4=a46_0xf41e,_0x94737=_0x1cbf94||getActiveProfileName()||undefined;if(_0x94737){const _0x29c1db=_0x38f2c4(0x17f)+normalizeProfileForEnvVar(_0x94737);if(process[_0x38f2c4(0x1ab)][_0x29c1db])return{'apiKey':process[_0x38f2c4(0x1ab)][_0x29c1db],'source':_0x29c1db+'\x20env\x20var','isDeprecated':![]};const _0x1977ae=getCachedCredential(_0x460ad7,_0x94737);if(_0x1977ae)return{'apiKey':_0x1977ae,'source':_0x38f2c4(0x197)+_0x94737+')','isDeprecated':![]};const _0x4d6c60=await getKeychainAPIKey(_0x94737);if(_0x4d6c60)return setCachedCredential(_0x4d6c60,_0x460ad7,_0x94737),{'apiKey':_0x4d6c60,'source':'keychain\x20(profile:\x20'+_0x94737+')','isDeprecated':![]};}if(process[_0x38f2c4(0x1ab)][_0x38f2c4(0x188)])return{'apiKey':process[_0x38f2c4(0x1ab)][_0x38f2c4(0x188)],'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x94737){const _0x4a7693=getCachedCredential(_0x460ad7,undefined);if(_0x4a7693)return{'apiKey':_0x4a7693,'source':_0x38f2c4(0x1b8),'isDeprecated':![]};const _0x34c868=await getKeychainAPIKey(undefined);if(_0x34c868)return setCachedCredential(_0x34c868,_0x460ad7,undefined),{'apiKey':_0x34c868,'source':'keychain','isDeprecated':![]};}if(process[_0x38f2c4(0x1ab)]['TD_API_KEY'])return{'apiKey':process[_0x38f2c4(0x1ab)]['TD_API_KEY'],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x54a1fa=getLegacyEnvAPIKey(_0x460ad7,_0x94737);if(_0x54a1fa){const _0x44e4ed=await isKeychainAvailable();if(_0x44e4ed)try{await saveKeychainAPIKey(_0x54a1fa,_0x94737),setCachedCredential(_0x54a1fa,_0x460ad7,_0x94737);const _0xa3f7cb=getConfigFilePath(_0x94737);cleanupLegacyEnvFile(_0xa3f7cb)&&console[_0x38f2c4(0x184)](a46_0x451a86['yellow'](_0x38f2c4(0x1c0)));}catch(_0x1ce57e){console[_0x38f2c4(0x184)](a46_0x451a86[_0x38f2c4(0x18c)](_0x38f2c4(0x1c5)+_0x1ce57e));}const _0x1d27e3=_0x94737?_0x38f2c4(0x1aa)+_0x94737+')':_0x38f2c4(0x185);return{'apiKey':_0x54a1fa,'source':_0x1d27e3,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x1df572,_0x16361e,_0x39c8c4=!![]){const _0x525636=a46_0xf41e,_0x4ed08f=await resolveAPIKeyAsync(_0x1df572,_0x16361e);if(!_0x4ed08f)return undefined;if(_0x39c8c4&&_0x4ed08f[_0x525636(0x17b)]&&_0x4ed08f[_0x525636(0x19e)]['includes'](_0x525636(0x198))){const _0x836db7=_0x16361e||getActiveProfileName()||undefined,_0x4b7ccd=_0x836db7?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x836db7):_0x525636(0x1ba);console[_0x525636(0x184)](a46_0x451a86[_0x525636(0x18c)](_0x525636(0x1c1)+(_0x525636(0x1a5)+_0x4b7ccd+').')));}return _0x4ed08f[_0x525636(0x1ae)];}function getLegacyEnvAPIKey(_0x3d0921,_0x4e1d16){const _0x50a3b4=a46_0xf41e,_0xa8857a=_0x3d0921[_0x50a3b4(0x1c2)]()[_0x50a3b4(0x1c3)](/-/g,'_'),_0x28f625='TD_API_KEY_'+_0xa8857a;if(_0x4e1d16){const _0x32c342=loadProfileEnv(_0x4e1d16);if(_0x32c342){if(_0x32c342[_0x28f625])return _0x32c342[_0x28f625];if(_0x32c342[_0x50a3b4(0x198)])return _0x32c342[_0x50a3b4(0x198)];}}const _0x36e59a=loadUserConfigOnce();if(_0x36e59a[_0x28f625])return _0x36e59a[_0x28f625];if(_0x36e59a[_0x50a3b4(0x198)])return _0x36e59a[_0x50a3b4(0x198)];return undefined;}function cleanupLegacyEnvFile(_0x34bac4){const _0x334e02=a46_0xf41e;if(!existsSync(_0x34bac4))return![];try{const _0xbde486=readFileSync(_0x34bac4,_0x334e02(0x189)),_0x549053=_0xbde486[_0x334e02(0x1af)]('\x0a'),_0x48e7c2=_0x549053[_0x334e02(0x1a6)](_0x4d45a7=>{const _0x46278b=_0x334e02,_0xefe18f=_0x4d45a7[_0x46278b(0x1a8)]();if(!_0xefe18f||_0xefe18f[_0x46278b(0x1a9)]('#'))return!![];const [_0x79ea5f]=_0xefe18f[_0x46278b(0x1af)]('=');return!_0x79ea5f[_0x46278b(0x1a9)](_0x46278b(0x198));}),_0x51cc18=_0x48e7c2[_0x334e02(0x1a0)](_0xc8c9a4=>{const _0x20d138=_0x334e02,_0xf59787=_0xc8c9a4[_0x20d138(0x1a8)]();return _0xf59787&&!_0xf59787[_0x20d138(0x1a9)]('#');});if(!_0x51cc18)return unlinkSync(_0x34bac4),!![];return writeFileSync(_0x34bac4,_0x48e7c2[_0x334e02(0x1be)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x2ece30){const _0x48b106=a46_0xf41e,_0x242c35=a46_0x12dd06['join'](getConfigDir(),_0x48b106(0x181)+_0x2ece30);if(a46_0x108dda[_0x48b106(0x186)](_0x242c35)){validateSecureFilePermissions(_0x242c35);try{const _0x3399ee=a46_0x108dda[_0x48b106(0x17a)](_0x242c35,_0x48b106(0x189));return parseEnvFile(_0x3399ee);}catch(_0x20dba8){console[_0x48b106(0x184)]('Warning:\x20Failed\x20to\x20load\x20'+_0x242c35+':\x20'+_0x20dba8);}}const _0x4c301d=a46_0x12dd06[_0x48b106(0x1be)](getConfigDir(),_0x48b106(0x191),_0x2ece30,'.env');if(a46_0x108dda[_0x48b106(0x186)](_0x4c301d)){validateSecureFilePermissions(_0x4c301d);try{const _0x3b4e29=a46_0x108dda['readFileSync'](_0x4c301d,_0x48b106(0x189));return parseEnvFile(_0x3b4e29);}catch(_0x1b4663){return console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x4c301d+':\x20'+_0x1b4663),null;}}return null;}function getActiveProfileName(){const _0x509402=a46_0xf41e,_0x2205f2=a46_0x12dd06[_0x509402(0x1be)](getConfigDir(),_0x509402(0x1c6));if(!a46_0x108dda[_0x509402(0x186)](_0x2205f2))return null;try{const _0x344cbb=a46_0x108dda[_0x509402(0x17a)](_0x2205f2,_0x509402(0x189)),_0x1fc407=JSON['parse'](_0x344cbb);return _0x1fc407[_0x509402(0x1c8)]||null;}catch{return null;}}export function saveAPIKey(_0x1d9838,_0x1d1c43,_0x41704d){const _0x4bfc5a=a46_0xf41e,_0x2ed459=getConfigDir(),_0x22d652=getConfigFilePath(_0x41704d);!existsSync(_0x2ed459)&&mkdirSync(_0x2ed459,{'recursive':!![],'mode':0x1c0});let _0xd9e6be={};if(existsSync(_0x22d652))try{const _0x25de05=readFileSync(_0x22d652,_0x4bfc5a(0x189));_0xd9e6be=parseEnvFile(_0x25de05);}catch(_0x506516){console[_0x4bfc5a(0x184)](_0x4bfc5a(0x17c)+_0x22d652+':',_0x506516);}const _0x294fa0=_0x1d9838[_0x4bfc5a(0x1c2)]()['replace'](/-/g,'_');_0xd9e6be[_0x4bfc5a(0x17d)+_0x294fa0]=_0x1d1c43;const _0x425418=Object[_0x4bfc5a(0x1ad)](_0xd9e6be)[_0x4bfc5a(0x194)](([_0x24254f,_0x2ca3e0])=>_0x24254f+'='+_0x2ca3e0);writeFileSync(_0x22d652,_0x425418[_0x4bfc5a(0x1be)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x279829,_0x3de515,_0x573888){const _0x36ea10=a46_0xf41e;await saveKeychainAPIKey(_0x279829,_0x573888),setCachedCredential(_0x279829,_0x3de515,_0x573888);const _0x54a39b=getConfigFilePath(_0x573888);cleanupLegacyEnvFile(_0x54a39b)&&console[_0x36ea10(0x184)](a46_0x451a86[_0x36ea10(0x18c)](_0x36ea10(0x19f)));}export function loadConfig(){const _0x5ea371=a46_0xf41e,_0x26dda1={'apiKeys':{},'defaultSite':_0x5ea371(0x19a)},_0xcf483f=['us01','jp01',_0x5ea371(0x1b5),_0x5ea371(0x18b),_0x5ea371(0x1a7),'dev-us01',_0x5ea371(0x17e),_0x5ea371(0x18a),_0x5ea371(0x1bd),'stg-ap03'];for(const _0x3a5ef6 of _0xcf483f){const _0x38d8f1=getAPIKey(_0x3a5ef6);_0x38d8f1&&(_0x26dda1[_0x5ea371(0x1b3)][_0x3a5ef6]=_0x38d8f1);}return _0x26dda1;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2b1ba3,_0xcab525){const _0x179a96=a47_0x3025,_0x221311=_0x2b1ba3();while(!![]){try{const _0x1d0364=parseInt(_0x179a96(0x85))/0x1+parseInt(_0x179a96(0x87))/0x2*(parseInt(_0x179a96(0x8a))/0x3)+parseInt(_0x179a96(0x88))/0x4+-parseInt(_0x179a96(0x8b))/0x5+-parseInt(_0x179a96(0x90))/0x6*(parseInt(_0x179a96(0x89))/0x7)+parseInt(_0x179a96(0x93))/0x8+-parseInt(_0x179a96(0x84))/0x9;if(_0x1d0364===_0xcab525)break;else _0x221311['push'](_0x221311['shift']());}catch(_0x46e41f){_0x221311['push'](_0x221311['shift']());}}}(a47_0x302a,0xbeac9));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';function a47_0x302a(){const _0x2208c5=['12095120JUInsg','.json','6315039eYNYjz','1428667MLrsbi','now','126ftYdnc','1563312SdgYvw','7YhwjLi','41091luwZJx','6034640MrlMWp','connections-','parse','connections','utf-8','9028176iwhkdb','default','stringify'];a47_0x302a=function(){return _0x2208c5;};return a47_0x302a();}import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x32392e){const _0x2735a5=a47_0x3025,_0x51a15d=_0x32392e||_0x2735a5(0x91);return join(getCacheDir(),_0x2735a5(0x8c)+_0x51a15d+_0x2735a5(0x94));}export function loadCachedConnections(_0x5ba05a){const _0x12499e=a47_0x3025,_0x2bb37f=getCacheFilePath(_0x5ba05a);if(!existsSync(_0x2bb37f))return null;try{const _0x523481=readFileSync(_0x2bb37f,_0x12499e(0x8f)),_0x6cde99=JSON[_0x12499e(0x8d)](_0x523481);return _0x6cde99[_0x12499e(0x8e)];}catch{return null;}}function a47_0x3025(_0x1059b3,_0x2e1fa7){_0x1059b3=_0x1059b3-0x84;const _0x302aff=a47_0x302a();let _0x30256e=_0x302aff[_0x1059b3];return _0x30256e;}export function saveCachedConnections(_0x43437f,_0x19864f){const _0x5ed9b4=a47_0x3025,_0x10c623=getCacheDir();!existsSync(_0x10c623)&&mkdirSync(_0x10c623,{'recursive':!![]});const _0x1dd6a8=getCacheFilePath(_0x43437f),_0x6f2810={'connections':_0x19864f,'cachedAt':Date[_0x5ed9b4(0x86)]()};writeFileSync(_0x1dd6a8,JSON[_0x5ed9b4(0x92)](_0x6f2810,null,0x2),_0x5ed9b4(0x8f));}export function clearConnectionCache(_0x21b281){const _0x4bf302=getCacheFilePath(_0x21b281);if(existsSync(_0x4bf302))try{unlinkSync(_0x4bf302);}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5081f3,_0x1f5b8f){const _0x315743=a48_0x3930,_0x218962=_0x5081f3();while(!![]){try{const _0x2e15c4=-parseInt(_0x315743(0x19b))/0x1*(-parseInt(_0x315743(0x194))/0x2)+parseInt(_0x315743(0x18e))/0x3*(-parseInt(_0x315743(0x18f))/0x4)+parseInt(_0x315743(0x191))/0x5+parseInt(_0x315743(0x18d))/0x6+parseInt(_0x315743(0x19a))/0x7+-parseInt(_0x315743(0x193))/0x8*(-parseInt(_0x315743(0x195))/0x9)+-parseInt(_0x315743(0x196))/0xa;if(_0x2e15c4===_0x1f5b8f)break;else _0x218962['push'](_0x218962['shift']());}catch(_0x292f16){_0x218962['push'](_0x218962['shift']());}}}(a48_0x5180,0x19aed));function a48_0x5180(){const _0x54ca18=['394555ipBarR','176cYqSbR','__default_site__','apiKey','38826cAZZwT','57OfmWPi','5660InbOXj','__default_profile__','908790Zrxzuu','get','452544ojzbub','466ZDvLuU','18ufaIaj','2666560ZkJTpK','now','loadedAt','delete'];a48_0x5180=function(){return _0x54ca18;};return a48_0x5180();}function a48_0x3930(_0x488d42,_0x6b3a9a){_0x488d42=_0x488d42-0x18b;const _0x51803c=a48_0x5180();let _0x393084=_0x51803c[_0x488d42];return _0x393084;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0xc83c54,_0x5499fe){const _0x5a67c6=a48_0x3930,_0x3d18c8=_0xc83c54||_0x5a67c6(0x18b),_0x3d72d9=_0x5499fe||_0x5a67c6(0x190);return _0x3d18c8+':'+_0x3d72d9;}export function getCachedCredential(_0x215f13,_0x5656ad){const _0x3914ef=a48_0x3930,_0x4eb7a6=getCacheKey(_0x215f13,_0x5656ad),_0x3b4a64=cache[_0x3914ef(0x192)](_0x4eb7a6);if(!_0x3b4a64)return null;if(Date[_0x3914ef(0x197)]()-_0x3b4a64[_0x3914ef(0x198)]>CACHE_TTL_MS)return cache[_0x3914ef(0x199)](_0x4eb7a6),null;return _0x3b4a64[_0x3914ef(0x18c)];}export function setCachedCredential(_0x5d084c,_0x2dd2e9,_0xf0a51){const _0x1b44ba=a48_0x3930,_0x21c2aa=getCacheKey(_0x2dd2e9,_0xf0a51);cache['set'](_0x21c2aa,{'apiKey':_0x5d084c,'loadedAt':Date[_0x1b44ba(0x197)]()});}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x1db6b4,_0x305e80){const _0x428d67=a48_0x3930,_0x2ce475=getCacheKey(_0x1db6b4,_0x305e80);cache[_0x428d67(0x199)](_0x2ce475);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a49_0x1d89(){const _0x448cf2=['string','replace','configFiles','sessionId','llm_project','.env','tdx.json','config','resolveAPIKeyAsync','793532MOWxWl','profiles','CLI\x20flag:\x20--','parentSegment','getParameters','us01','existsSync','activeProfile','(session:\x20','layers','segment_path','\x0a[configuration\x20files]','51335889YBBrHq','join','not\x20set','createAsync','.json','segmentPath','Global\x20Credentials','project','1mMwhxo','toString','llm_agent','global','4701144owOvxL',':\x20none','apiKey','logLevel','Project','7255661CEsdao','parse','default','4500plKOpv','verbose','globalCredentials','parent_segment','profile:\x20','displayWithSources','getSource','log','18714KGLaLq','entries','llmProject','Profile','cliFlags',':\x20none\x20(using\x20session:\x20','Profile\x20Credentials','session','Session','database','profile','151630FjqZWL','370pMOueN','readFileSync','llmAgent','site','[context]','1383gnkKHv','738YLjmhv'];a49_0x1d89=function(){return _0x448cf2;};return a49_0x1d89();}const a49_0x5c4fa5=a49_0x3d4a;(function(_0x2fc0cc,_0x32d20e){const _0x38a9ad=a49_0x3d4a,_0x161156=_0x2fc0cc();while(!![]){try{const _0x34e92e=parseInt(_0x38a9ad(0xe4))/0x1*(-parseInt(_0x38a9ad(0xd0))/0x2)+-parseInt(_0x38a9ad(0xc5))/0x3*(parseInt(_0x38a9ad(0xf0))/0x4)+parseInt(_0x38a9ad(0x104))/0x5*(-parseInt(_0x38a9ad(0xf8))/0x6)+-parseInt(_0x38a9ad(0xed))/0x7+-parseInt(_0x38a9ad(0xe8))/0x8+parseInt(_0x38a9ad(0xc6))/0x9*(-parseInt(_0x38a9ad(0x103))/0xa)+parseInt(_0x38a9ad(0xdc))/0xb;if(_0x34e92e===_0x32d20e)break;else _0x161156['push'](_0x161156['shift']());}catch(_0xaf189e){_0x161156['push'](_0x161156['shift']());}}}(a49_0x1d89,0x9f772));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_0x3f3261 from'node:fs';function a49_0x3d4a(_0xd59b6c,_0x703af4){_0xd59b6c=_0xd59b6c-0xc5;const _0x1d897e=a49_0x1d89();let _0x3d4a49=_0x1d897e[_0xd59b6c];return _0x3d4a49;}import*as a49_0x5dba86 from'node:path';export class GlobalContext{['site'];['database'];[a49_0x5c4fa5(0xf3)];[a49_0x5c4fa5(0xda)];[a49_0x5c4fa5(0xcb)];['llm_agent'];[a49_0x5c4fa5(0xea)];['verbose'];['logLevel'];[a49_0x5c4fa5(0x102)];['layers'];['activeProfile'];[a49_0x5c4fa5(0xca)];[a49_0x5c4fa5(0xc9)];constructor(_0x51bf34){const _0x17d245=a49_0x5c4fa5;this[_0x17d245(0xca)]=_0x51bf34[_0x17d245(0xff)]||getCurrentSessionPID()[_0x17d245(0xe5)]();const _0x51640b=loadSessionContext(_0x51bf34[_0x17d245(0xff)]),_0x19ea70=loadProjectConfig(),_0x38e5c7=this['loadGlobalConfig']();this['activeProfile']=_0x51bf34[_0x17d245(0x102)]||_0x51640b?.[_0x17d245(0x102)]||_0x38e5c7[_0x17d245(0x102)]||getActiveProfile();const _0x1e19e7=this[_0x17d245(0xd7)]?loadProfile(this['activeProfile']):null,_0x1547a3=_0x1e194b=>{const _0x1e8d72=_0x17d245;if(!_0x1e194b)return{};const _0x53c42c=_0x1e194b,_0x4f4fdf={};for(const [_0x57617e,_0x1cd6b5]of Object[_0x1e8d72(0xf9)](_0x53c42c)){typeof _0x1cd6b5===_0x1e8d72(0xc7)&&(_0x4f4fdf[_0x57617e]=_0x1cd6b5);}return _0x4f4fdf;},_0xc72888={};if(_0x51bf34[_0x17d245(0x107)]&&_0x51bf34[_0x17d245(0x107)]!==_0x17d245(0xd5))_0xc72888[_0x17d245(0x107)]=_0x51bf34['site'];const _0x4bf784=_0x51640b?.[_0x17d245(0x101)],_0x361fcc=_0x19ea70?.[_0x17d245(0x101)],_0x5995ca=_0x1e19e7?.[_0x17d245(0xce)]?.[_0x17d245(0x101)],_0x10841c=_0x38e5c7[_0x17d245(0x101)];_0x51bf34[_0x17d245(0x101)]&&(_0x51bf34[_0x17d245(0x101)]!==_0x4bf784&&_0x51bf34[_0x17d245(0x101)]!==_0x361fcc&&_0x51bf34[_0x17d245(0x101)]!==_0x5995ca&&_0x51bf34['database']!==_0x10841c)&&(_0xc72888[_0x17d245(0x101)]=_0x51bf34['database']);if(_0x51bf34[_0x17d245(0xd3)])_0xc72888['parent_segment']=_0x51bf34[_0x17d245(0xd3)];if(_0x51bf34['llmProject'])_0xc72888['llm_project']=_0x51bf34[_0x17d245(0xfa)];if(_0x51bf34[_0x17d245(0x106)])_0xc72888[_0x17d245(0xe6)]=_0x51bf34[_0x17d245(0x106)];if(_0x51bf34[_0x17d245(0x102)])_0xc72888['profile']=_0x51bf34['profile'];this['layers']={'cliFlags':_0xc72888,'session':_0x1547a3(_0x51640b),'project':_0x1547a3(_0x19ea70),'profile':_0x1547a3(_0x1e19e7?.[_0x17d245(0xce)]),'global':_0x1547a3(_0x38e5c7)};const _0x3366a8={...this['layers'][_0x17d245(0xe7)],...this[_0x17d245(0xd9)][_0x17d245(0x102)],...this['layers'][_0x17d245(0xe3)],...this[_0x17d245(0xd9)][_0x17d245(0xff)],...this[_0x17d245(0xd9)]['cliFlags']},_0x422c82=_0x3366a8[_0x17d245(0x107)]||_0x17d245(0xd5);this[_0x17d245(0x107)]=resolveSite(_0x422c82),this[_0x17d245(0x101)]=_0x3366a8[_0x17d245(0x101)],this[_0x17d245(0xf3)]=_0x3366a8['parent_segment'],this[_0x17d245(0xda)]=_0x3366a8[_0x17d245(0xda)],this['llm_project']=_0x3366a8['llm_project'],this[_0x17d245(0xe6)]=_0x3366a8[_0x17d245(0xe6)],this[_0x17d245(0xf1)]=_0x51bf34[_0x17d245(0xf1)]||![],this['logLevel']=_0x51bf34[_0x17d245(0xeb)]??LogLevel['INFO'],this[_0x17d245(0x102)]=this[_0x17d245(0xd7)]||undefined,this[_0x17d245(0xea)]=getAPIKey(this[_0x17d245(0x107)],this['activeProfile']||undefined);const _0x507942=getConfigDir(),_0x49c279=a49_0x5dba86[_0x17d245(0xdd)](_0x507942,'sessions',this[_0x17d245(0xca)]+_0x17d245(0xe0)),_0x542516=findProjectConfigPath(),_0x2a804b=a49_0x5dba86[_0x17d245(0xdd)](_0x507942,_0x17d245(0xcd)),_0x5d0a46=a49_0x5dba86[_0x17d245(0xdd)](_0x507942,_0x17d245(0xcc));let _0x31b9b1=null,_0x1d9143=null;this[_0x17d245(0xd7)]&&(_0x31b9b1=a49_0x5dba86[_0x17d245(0xdd)](_0x507942,_0x17d245(0xd1),this['activeProfile'],_0x17d245(0xcd)),_0x1d9143=a49_0x5dba86[_0x17d245(0xdd)](_0x507942,_0x17d245(0xd1),this['activeProfile'],_0x17d245(0xcc))),this['configFiles']={'session':a49_0x3f3261[_0x17d245(0xd6)](_0x49c279)?_0x49c279:null,'project':_0x542516,'profile':_0x31b9b1&&a49_0x3f3261[_0x17d245(0xd6)](_0x31b9b1)?_0x31b9b1:null,'profileCredentials':_0x1d9143&&a49_0x3f3261['existsSync'](_0x1d9143)?_0x1d9143:null,'global':a49_0x3f3261['existsSync'](_0x2a804b)?_0x2a804b:null,'globalCredentials':a49_0x3f3261[_0x17d245(0xd6)](_0x5d0a46)?_0x5d0a46:null};}['getSource'](_0x2481d5,_0x5e9a2a){const _0x260cc0=a49_0x5c4fa5;if(!_0x5e9a2a)return _0x260cc0(0xde);const _0x75abdc=_0x5e9a2a;if(this[_0x260cc0(0xd9)][_0x260cc0(0xfc)][_0x2481d5]===_0x75abdc){if(_0x2481d5===_0x260cc0(0x107)&&_0x75abdc===_0x260cc0(0xd5)&&!this[_0x260cc0(0xd9)]['session']['site']&&!this[_0x260cc0(0xd9)][_0x260cc0(0xe3)][_0x260cc0(0x107)]&&!this[_0x260cc0(0xd9)][_0x260cc0(0x102)][_0x260cc0(0x107)]&&!this[_0x260cc0(0xd9)][_0x260cc0(0xe7)][_0x260cc0(0x107)])return _0x260cc0(0xef);return _0x260cc0(0xd2)+_0x2481d5[_0x260cc0(0xc8)](/_/g,'-');}if(this['layers'][_0x260cc0(0xff)][_0x2481d5]===_0x75abdc)return'session';if(this[_0x260cc0(0xd9)][_0x260cc0(0xe3)][_0x2481d5]===_0x75abdc)return _0x260cc0(0xe3);if(this['layers'][_0x260cc0(0x102)][_0x2481d5]===_0x75abdc)return _0x260cc0(0xf4)+this[_0x260cc0(0xd7)];if(this['layers'][_0x260cc0(0xe7)][_0x2481d5]===_0x75abdc)return _0x260cc0(0xe7);return _0x260cc0(0xef);}['loadGlobalConfig'](){const _0x284379=a49_0x5c4fa5,_0x6ece72=a49_0x5dba86[_0x284379(0xdd)](getConfigDir(),'tdx.json');if(!a49_0x3f3261['existsSync'](_0x6ece72))return{};try{const _0x285a66=a49_0x3f3261[_0x284379(0x105)](_0x6ece72,'utf-8');return JSON[_0x284379(0xee)](_0x285a66);}catch{return{};}}['injectIntoOptions'](_0x549818){const _0x4de05c=a49_0x5c4fa5;_0x549818[_0x4de05c(0x107)]=this[_0x4de05c(0x107)],!_0x549818[_0x4de05c(0x101)]&&this[_0x4de05c(0x101)]&&(_0x549818[_0x4de05c(0x101)]=this['database']),!_0x549818[_0x4de05c(0xd3)]&&this[_0x4de05c(0xf3)]&&(_0x549818[_0x4de05c(0xd3)]=this[_0x4de05c(0xf3)]),!_0x549818[_0x4de05c(0xe1)]&&this[_0x4de05c(0xda)]&&(_0x549818[_0x4de05c(0xe1)]=this['segment_path']),!_0x549818[_0x4de05c(0xfa)]&&this[_0x4de05c(0xcb)]&&(_0x549818[_0x4de05c(0xfa)]=this[_0x4de05c(0xcb)]),!_0x549818[_0x4de05c(0x106)]&&this[_0x4de05c(0xe6)]&&(_0x549818[_0x4de05c(0x106)]=this[_0x4de05c(0xe6)]);}[a49_0x5c4fa5(0xd4)](){const _0x563241=a49_0x5c4fa5;return[{'key':_0x563241(0x107),'value':this[_0x563241(0x107)]},{'key':'database','value':this[_0x563241(0x101)]},{'key':_0x563241(0xf3),'value':this['parent_segment']},{'key':_0x563241(0xda),'value':this['segment_path']},{'key':_0x563241(0xcb),'value':this[_0x563241(0xcb)]},{'key':_0x563241(0xe6),'value':this[_0x563241(0xe6)]},{'key':_0x563241(0x102),'value':this['activeProfile']||undefined}];}['display'](){const _0x4eb5bc=a49_0x5c4fa5;console[_0x4eb5bc(0xf7)](_0x4eb5bc(0x108));for(const {key:_0xc1f70b,value:_0x23ae0a}of this[_0x4eb5bc(0xd4)]()){_0x23ae0a&&console[_0x4eb5bc(0xf7)](_0xc1f70b+':\x20'+_0x23ae0a);}}[a49_0x5c4fa5(0xf5)](){const _0x528f22=a49_0x5c4fa5;console[_0x528f22(0xf7)](_0x528f22(0x108));for(const {key:_0xb9fdb5,value:_0xd915d7}of this['getParameters']()){if(_0xd915d7){const _0x3132cc=_0xb9fdb5==='profile'?'(active)':'('+this[_0x528f22(0xf6)](_0xb9fdb5,_0xd915d7)+')';console[_0x528f22(0xf7)](_0xb9fdb5+':\x20'+_0xd915d7+'\x20'+_0x3132cc);}}console[_0x528f22(0xf7)](_0x528f22(0xdb));const _0x4e7a03=[{'label':_0x528f22(0x100),'path':this[_0x528f22(0xc9)][_0x528f22(0xff)],'extra':_0x528f22(0xd8)+this['sessionId']+')'},{'label':_0x528f22(0xec),'path':this[_0x528f22(0xc9)][_0x528f22(0xe3)]},{'label':_0x528f22(0xfb),'path':this[_0x528f22(0xc9)][_0x528f22(0x102)]},{'label':_0x528f22(0xfe),'path':this[_0x528f22(0xc9)]['profileCredentials']},{'label':'Global','path':this[_0x528f22(0xc9)]['global']},{'label':_0x528f22(0xe2),'path':this[_0x528f22(0xc9)][_0x528f22(0xf2)]}];for(const {label:_0x14d143,path:_0x11b3d7,extra:_0x2d9339}of _0x4e7a03){if(_0x11b3d7)console[_0x528f22(0xf7)](_0x14d143+':\x20'+_0x11b3d7+'\x20✓'+(_0x2d9339?'\x20'+_0x2d9339:''));else{if(_0x14d143==='Session')console[_0x528f22(0xf7)](_0x14d143+_0x528f22(0xfd)+this[_0x528f22(0xca)]+')');else(_0x14d143===_0x528f22(0xec)||_0x14d143==='Global')&&console[_0x528f22(0xf7)](_0x14d143+_0x528f22(0xe9));}}}async[a49_0x5c4fa5(0xcf)](){const _0x5ca14e=a49_0x5c4fa5;return this[_0x5ca14e(0xea)]=await getAPIKeyAsync(this[_0x5ca14e(0x107)],this['activeProfile']||undefined),this[_0x5ca14e(0xea)];}static async[a49_0x5c4fa5(0xdf)](_0x721c76){const _0x45afa7=new GlobalContext(_0x721c76);return await _0x45afa7['resolveAPIKeyAsync'](),_0x45afa7;}}
|
|
1
|
+
const a49_0x3ce863=a49_0x3397;(function(_0x186521,_0x5aedff){const _0x424960=a49_0x3397,_0x473ade=_0x186521();while(!![]){try{const _0x4709ad=parseInt(_0x424960(0x1c1))/0x1+parseInt(_0x424960(0x19c))/0x2+parseInt(_0x424960(0x1af))/0x3+-parseInt(_0x424960(0x1c8))/0x4+parseInt(_0x424960(0x1d2))/0x5*(-parseInt(_0x424960(0x1d1))/0x6)+parseInt(_0x424960(0x1da))/0x7*(-parseInt(_0x424960(0x1d6))/0x8)+parseInt(_0x424960(0x1bc))/0x9;if(_0x4709ad===_0x5aedff)break;else _0x473ade['push'](_0x473ade['shift']());}catch(_0x5301f2){_0x473ade['push'](_0x473ade['shift']());}}}(a49_0x1f7b,0xb32ed));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_0x436d1f from'node:fs';import*as a49_0x2374e8 from'node:path';function a49_0x3397(_0x145d71,_0x32081e){_0x145d71=_0x145d71-0x198;const _0x1f7b8a=a49_0x1f7b();let _0x33971d=_0x1f7b8a[_0x145d71];return _0x33971d;}function a49_0x1f7b(){const _0x7a5754=['getParameters','5375512coIkkK','parse','sessionId','(session:\x20','7PXZrAG','parent_segment','configFiles','global','sessions','549342wBrkGa','string','parentSegment','layers','apiKey','site','tdx.json','segment_path','(active)','toString','us01','join','existsSync','globalCredentials','session','Global','entries','Profile','log','1823997GyCchV','\x0a[configuration\x20files]','Project','llmAgent','[context]','.json','profiles','llm_project','loadGlobalConfig','resolveAPIKeyAsync','activeProfile','config','profileCredentials','14130117YhPVqA','project','default','not\x20set','utf-8','1101929ZvKqKQ','logLevel','Global\x20Credentials','llm_agent','.env','verbose','llmProject','3921436RrcVmu','database',':\x20none\x20(using\x20session:\x20','CLI\x20flag:\x20--','display','Session','segmentPath','profile','INFO','241734oEycpI','145ptsXhX','readFileSync','getSource'];a49_0x1f7b=function(){return _0x7a5754;};return a49_0x1f7b();}export class GlobalContext{[a49_0x3ce863(0x1a1)];[a49_0x3ce863(0x1c9)];[a49_0x3ce863(0x198)];[a49_0x3ce863(0x1a3)];[a49_0x3ce863(0x1b6)];[a49_0x3ce863(0x1c4)];[a49_0x3ce863(0x1a0)];[a49_0x3ce863(0x1c6)];['logLevel'];[a49_0x3ce863(0x1cf)];['layers'];[a49_0x3ce863(0x1b9)];[a49_0x3ce863(0x1d8)];['configFiles'];constructor(_0xf0f99c){const _0x34c805=a49_0x3ce863;this[_0x34c805(0x1d8)]=_0xf0f99c['session']||getCurrentSessionPID()[_0x34c805(0x1a5)]();const _0x293f93=loadSessionContext(_0xf0f99c['session']),_0x41c727=loadProjectConfig(),_0x5cfc2c=this[_0x34c805(0x1b7)]();this[_0x34c805(0x1b9)]=_0xf0f99c[_0x34c805(0x1cf)]||_0x293f93?.[_0x34c805(0x1cf)]||_0x5cfc2c['profile']||getActiveProfile();const _0x4ca299=this[_0x34c805(0x1b9)]?loadProfile(this[_0x34c805(0x1b9)]):null,_0x12e605=_0x1c1c97=>{const _0xbccf0=_0x34c805;if(!_0x1c1c97)return{};const _0x45ebb9=_0x1c1c97,_0x1e8d36={};for(const [_0x398960,_0x1927f2]of Object[_0xbccf0(0x1ac)](_0x45ebb9)){typeof _0x1927f2===_0xbccf0(0x19d)&&(_0x1e8d36[_0x398960]=_0x1927f2);}return _0x1e8d36;},_0x5026f7={};if(_0xf0f99c[_0x34c805(0x1a1)]&&_0xf0f99c[_0x34c805(0x1a1)]!==_0x34c805(0x1a6))_0x5026f7['site']=_0xf0f99c[_0x34c805(0x1a1)];const _0x40504c=_0x293f93?.[_0x34c805(0x1c9)],_0x174390=_0x41c727?.[_0x34c805(0x1c9)],_0x5071ab=_0x4ca299?.[_0x34c805(0x1ba)]?.[_0x34c805(0x1c9)],_0x110b78=_0x5cfc2c[_0x34c805(0x1c9)];_0xf0f99c[_0x34c805(0x1c9)]&&(_0xf0f99c['database']!==_0x40504c&&_0xf0f99c[_0x34c805(0x1c9)]!==_0x174390&&_0xf0f99c['database']!==_0x5071ab&&_0xf0f99c[_0x34c805(0x1c9)]!==_0x110b78)&&(_0x5026f7[_0x34c805(0x1c9)]=_0xf0f99c[_0x34c805(0x1c9)]);if(_0xf0f99c[_0x34c805(0x19e)])_0x5026f7[_0x34c805(0x198)]=_0xf0f99c[_0x34c805(0x19e)];if(_0xf0f99c[_0x34c805(0x1c7)])_0x5026f7[_0x34c805(0x1b6)]=_0xf0f99c[_0x34c805(0x1c7)];if(_0xf0f99c[_0x34c805(0x1b2)])_0x5026f7[_0x34c805(0x1c4)]=_0xf0f99c['llmAgent'];if(_0xf0f99c['profile'])_0x5026f7[_0x34c805(0x1cf)]=_0xf0f99c[_0x34c805(0x1cf)];this[_0x34c805(0x19f)]={'cliFlags':_0x5026f7,'session':_0x12e605(_0x293f93),'project':_0x12e605(_0x41c727),'profile':_0x12e605(_0x4ca299?.[_0x34c805(0x1ba)]),'global':_0x12e605(_0x5cfc2c)};const _0x2ffc89={...this[_0x34c805(0x19f)]['global'],...this[_0x34c805(0x19f)][_0x34c805(0x1cf)],...this['layers'][_0x34c805(0x1bd)],...this[_0x34c805(0x19f)]['session'],...this[_0x34c805(0x19f)]['cliFlags']},_0x34de25=_0x2ffc89[_0x34c805(0x1a1)]||'us01';this[_0x34c805(0x1a1)]=resolveSite(_0x34de25),this[_0x34c805(0x1c9)]=_0x2ffc89['database'],this[_0x34c805(0x198)]=_0x2ffc89[_0x34c805(0x198)],this[_0x34c805(0x1a3)]=_0x2ffc89[_0x34c805(0x1a3)],this[_0x34c805(0x1b6)]=_0x2ffc89[_0x34c805(0x1b6)],this[_0x34c805(0x1c4)]=_0x2ffc89[_0x34c805(0x1c4)],this[_0x34c805(0x1c6)]=_0xf0f99c['verbose']||![],this[_0x34c805(0x1c2)]=_0xf0f99c['logLevel']??LogLevel[_0x34c805(0x1d0)],this[_0x34c805(0x1cf)]=this['activeProfile']||undefined,this['apiKey']=getAPIKey(this[_0x34c805(0x1a1)],this[_0x34c805(0x1b9)]||undefined);const _0x575543=getConfigDir(),_0x53eec8=a49_0x2374e8[_0x34c805(0x1a7)](_0x575543,_0x34c805(0x19b),this[_0x34c805(0x1d8)]+_0x34c805(0x1b4)),_0x178b11=findProjectConfigPath(),_0x592080=a49_0x2374e8['join'](_0x575543,_0x34c805(0x1a2)),_0x31cba5=a49_0x2374e8[_0x34c805(0x1a7)](_0x575543,'.env');let _0x39731e=null,_0x5c2a23=null;this[_0x34c805(0x1b9)]&&(_0x39731e=a49_0x2374e8[_0x34c805(0x1a7)](_0x575543,_0x34c805(0x1b5),this[_0x34c805(0x1b9)],_0x34c805(0x1a2)),_0x5c2a23=a49_0x2374e8[_0x34c805(0x1a7)](_0x575543,'profiles',this[_0x34c805(0x1b9)],_0x34c805(0x1c5))),this[_0x34c805(0x199)]={'session':a49_0x436d1f[_0x34c805(0x1a8)](_0x53eec8)?_0x53eec8:null,'project':_0x178b11,'profile':_0x39731e&&a49_0x436d1f['existsSync'](_0x39731e)?_0x39731e:null,'profileCredentials':_0x5c2a23&&a49_0x436d1f[_0x34c805(0x1a8)](_0x5c2a23)?_0x5c2a23:null,'global':a49_0x436d1f[_0x34c805(0x1a8)](_0x592080)?_0x592080:null,'globalCredentials':a49_0x436d1f[_0x34c805(0x1a8)](_0x31cba5)?_0x31cba5:null};}[a49_0x3ce863(0x1d4)](_0x3290af,_0x463ef2){const _0x1f8923=a49_0x3ce863;if(!_0x463ef2)return _0x1f8923(0x1bf);const _0x1dfe6a=_0x463ef2;if(this['layers']['cliFlags'][_0x3290af]===_0x1dfe6a){if(_0x3290af===_0x1f8923(0x1a1)&&_0x1dfe6a===_0x1f8923(0x1a6)&&!this[_0x1f8923(0x19f)][_0x1f8923(0x1aa)][_0x1f8923(0x1a1)]&&!this['layers'][_0x1f8923(0x1bd)][_0x1f8923(0x1a1)]&&!this[_0x1f8923(0x19f)][_0x1f8923(0x1cf)]['site']&&!this[_0x1f8923(0x19f)][_0x1f8923(0x19a)][_0x1f8923(0x1a1)])return _0x1f8923(0x1be);return _0x1f8923(0x1cb)+_0x3290af['replace'](/_/g,'-');}if(this[_0x1f8923(0x19f)][_0x1f8923(0x1aa)][_0x3290af]===_0x1dfe6a)return _0x1f8923(0x1aa);if(this[_0x1f8923(0x19f)][_0x1f8923(0x1bd)][_0x3290af]===_0x1dfe6a)return'project';if(this[_0x1f8923(0x19f)][_0x1f8923(0x1cf)][_0x3290af]===_0x1dfe6a)return'profile:\x20'+this[_0x1f8923(0x1b9)];if(this[_0x1f8923(0x19f)][_0x1f8923(0x19a)][_0x3290af]===_0x1dfe6a)return _0x1f8923(0x19a);return _0x1f8923(0x1be);}['loadGlobalConfig'](){const _0x4bd568=a49_0x3ce863,_0x3b236f=a49_0x2374e8[_0x4bd568(0x1a7)](getConfigDir(),_0x4bd568(0x1a2));if(!a49_0x436d1f['existsSync'](_0x3b236f))return{};try{const _0x38ad7d=a49_0x436d1f[_0x4bd568(0x1d3)](_0x3b236f,_0x4bd568(0x1c0));return JSON[_0x4bd568(0x1d7)](_0x38ad7d);}catch{return{};}}['injectIntoOptions'](_0x2660eb){const _0x2ed432=a49_0x3ce863;_0x2660eb[_0x2ed432(0x1a1)]=this[_0x2ed432(0x1a1)],!_0x2660eb[_0x2ed432(0x1c9)]&&this[_0x2ed432(0x1c9)]&&(_0x2660eb[_0x2ed432(0x1c9)]=this[_0x2ed432(0x1c9)]),!_0x2660eb[_0x2ed432(0x19e)]&&this[_0x2ed432(0x198)]&&(_0x2660eb[_0x2ed432(0x19e)]=this[_0x2ed432(0x198)]),!_0x2660eb[_0x2ed432(0x1ce)]&&this['segment_path']&&(_0x2660eb[_0x2ed432(0x1ce)]=this[_0x2ed432(0x1a3)]),!_0x2660eb[_0x2ed432(0x1c7)]&&this[_0x2ed432(0x1b6)]&&(_0x2660eb['llmProject']=this[_0x2ed432(0x1b6)]),!_0x2660eb['llmAgent']&&this[_0x2ed432(0x1c4)]&&(_0x2660eb['llmAgent']=this[_0x2ed432(0x1c4)]);}[a49_0x3ce863(0x1d5)](){const _0x332828=a49_0x3ce863;return[{'key':_0x332828(0x1a1),'value':this[_0x332828(0x1a1)]},{'key':'database','value':this[_0x332828(0x1c9)]},{'key':'parent_segment','value':this[_0x332828(0x198)]},{'key':_0x332828(0x1a3),'value':this['segment_path']},{'key':_0x332828(0x1b6),'value':this[_0x332828(0x1b6)]},{'key':_0x332828(0x1c4),'value':this['llm_agent']},{'key':_0x332828(0x1cf),'value':this[_0x332828(0x1b9)]||undefined}];}[a49_0x3ce863(0x1cc)](){const _0x6ac4c1=a49_0x3ce863;console[_0x6ac4c1(0x1ae)](_0x6ac4c1(0x1b3));for(const {key:_0x1378c7,value:_0x4970fc}of this[_0x6ac4c1(0x1d5)]()){_0x4970fc&&console[_0x6ac4c1(0x1ae)](_0x1378c7+':\x20'+_0x4970fc);}}['displayWithSources'](){const _0x245943=a49_0x3ce863;console[_0x245943(0x1ae)](_0x245943(0x1b3));for(const {key:_0x326891,value:_0x131cde}of this[_0x245943(0x1d5)]()){if(_0x131cde){const _0x25e829=_0x326891===_0x245943(0x1cf)?_0x245943(0x1a4):'('+this[_0x245943(0x1d4)](_0x326891,_0x131cde)+')';console[_0x245943(0x1ae)](_0x326891+':\x20'+_0x131cde+'\x20'+_0x25e829);}}console[_0x245943(0x1ae)](_0x245943(0x1b0));const _0xeca1ce=[{'label':_0x245943(0x1cd),'path':this['configFiles'][_0x245943(0x1aa)],'extra':_0x245943(0x1d9)+this[_0x245943(0x1d8)]+')'},{'label':'Project','path':this[_0x245943(0x199)][_0x245943(0x1bd)]},{'label':_0x245943(0x1ad),'path':this[_0x245943(0x199)][_0x245943(0x1cf)]},{'label':'Profile\x20Credentials','path':this[_0x245943(0x199)][_0x245943(0x1bb)]},{'label':_0x245943(0x1ab),'path':this[_0x245943(0x199)][_0x245943(0x19a)]},{'label':_0x245943(0x1c3),'path':this[_0x245943(0x199)][_0x245943(0x1a9)]}];for(const {label:_0x103c8e,path:_0x1fdb3a,extra:_0x3ea49e}of _0xeca1ce){if(_0x1fdb3a)console[_0x245943(0x1ae)](_0x103c8e+':\x20'+_0x1fdb3a+'\x20✓'+(_0x3ea49e?'\x20'+_0x3ea49e:''));else{if(_0x103c8e==='Session')console[_0x245943(0x1ae)](_0x103c8e+_0x245943(0x1ca)+this[_0x245943(0x1d8)]+')');else(_0x103c8e===_0x245943(0x1b1)||_0x103c8e===_0x245943(0x1ab))&&console['log'](_0x103c8e+':\x20none');}}}async[a49_0x3ce863(0x1b8)](){const _0x265d95=a49_0x3ce863;return this[_0x265d95(0x1a0)]=await getAPIKeyAsync(this[_0x265d95(0x1a1)],this[_0x265d95(0x1b9)]||undefined),this[_0x265d95(0x1a0)];}static async['createAsync'](_0x519961){const _0x207d8a=a49_0x3ce863,_0x550261=new GlobalContext(_0x519961);return await _0x550261[_0x207d8a(0x1b8)](),_0x550261;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a50_0xe08659=a50_0x2728;(function(_0x5c0fec,_0xfa3ef0){const _0x4aaa14=a50_0x2728,_0x375f56=_0x5c0fec();while(!![]){try{const _0x3e1770=-parseInt(_0x4aaa14(0x92))/0x1+parseInt(_0x4aaa14(0xa3))/0x2+parseInt(_0x4aaa14(0x9f))/0x3+-parseInt(_0x4aaa14(0x94))/0x4*(-parseInt(_0x4aaa14(0xa5))/0x5)+-parseInt(_0x4aaa14(0x87))/0x6*(parseInt(_0x4aaa14(0x90))/0x7)+-parseInt(_0x4aaa14(0x84))/0x8*(parseInt(_0x4aaa14(0x9b))/0x9)+parseInt(_0x4aaa14(0xa4))/0xa*(parseInt(_0x4aaa14(0x8f))/0xb);if(_0x3e1770===_0xfa3ef0)break;else _0x375f56['push'](_0x375f56['shift']());}catch(_0x3d9496){_0x375f56['push'](_0x375f56['shift']());}}}(a50_0x348e,0x281dd));const SERVICE_NAME=a50_0xe08659(0x8a);function a50_0x348e(){const _0x2ff20a=['restricted','toLowerCase','deletePassword','2667434cwQZjb','2786BHwVLD','includes','167530gvtHlj','reason','240872HWOJya','@zowe/secrets-for-zowe-sdk','not_found','success','System\x20keychain\x20is\x20not\x20available','unavailable','getPassword','9YaJZOY','not\x20found','not\x20supported','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.','146343vdFiyb','-25300','cannot\x20find','access','496018eosWlS','10XKEreU','10hntyMs','Warning:\x20','1368488fYxKyr','error','message','2364jJHHDL','access_denied','keyring','tdx','value'];a50_0x348e=function(){return _0x2ff20a;};return a50_0x348e();}let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x123e5b=a50_0xe08659;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x1e2a82=await import(_0x123e5b(0x95));return keyringModule=_0x1e2a82[_0x123e5b(0x89)],keyringModule;}catch(_0x5440b2){return keyringLoadError=_0x5440b2 instanceof Error?_0x5440b2:new Error(String(_0x5440b2)),null;}}function getAccountName(_0x27f923){const _0xbc2030=_0x27f923||'';return'profile:'+_0xbc2030+':api_key';}function a50_0x2728(_0x2d33a3,_0x33490a){_0x2d33a3=_0x2d33a3-0x84;const _0x348e7c=a50_0x348e();let _0x27286a=_0x348e7c[_0x2d33a3];return _0x27286a;}export async function getKeychainAPIKey(_0x396763){const _0x427b47=a50_0xe08659,_0x1a64f1=await getKeychainAPIKeyWithStatus(_0x396763);if(_0x1a64f1[_0x427b47(0x97)])return _0x1a64f1[_0x427b47(0x8b)];return _0x1a64f1[_0x427b47(0x93)]===_0x427b47(0x88)&&console[_0x427b47(0x85)](_0x427b47(0xa6)+_0x1a64f1[_0x427b47(0x86)]),null;}export async function getKeychainAPIKeyWithStatus(_0x2c2408){const _0x139711=a50_0xe08659;try{const _0x21ac81=await getKeyring();if(!_0x21ac81)return{'success':![],'reason':_0x139711(0x99)};const _0x481c95=getAccountName(_0x2c2408),_0x2e1248=await _0x21ac81['getPassword'](SERVICE_NAME,_0x481c95);if(_0x2e1248)return{'success':!![],'value':_0x2e1248};return{'success':![],'reason':_0x139711(0x96)};}catch(_0x16b35b){const _0x3f95d3=_0x16b35b instanceof Error?_0x16b35b['message']:String(_0x16b35b);if(_0x3f95d3[_0x139711(0x91)](_0x139711(0xa0))||_0x3f95d3[_0x139711(0x8d)]()[_0x139711(0x91)]('could\x20not\x20be\x20found')||_0x3f95d3[_0x139711(0x8d)]()['includes'](_0x139711(0x9c)))return{'success':![],'reason':_0x139711(0x96)};if(_0x3f95d3[_0x139711(0x91)]('-25293')||_0x3f95d3[_0x139711(0x8d)]()[_0x139711(0x91)](_0x139711(0x8c))||_0x3f95d3['toLowerCase']()[_0x139711(0x91)](_0x139711(0xa2)))return{'success':![],'reason':_0x139711(0x88),'message':_0x139711(0x9e)};return{'success':![],'reason':'unavailable','message':_0x3f95d3};}}export async function saveKeychainAPIKey(_0x3191a7,_0x180158){const _0x335dbe=a50_0xe08659,_0x4b5b2b=await getKeyring();if(!_0x4b5b2b)throw new Error(_0x335dbe(0x98));const _0x22832b=getAccountName(_0x180158);await _0x4b5b2b['setPassword'](SERVICE_NAME,_0x22832b,_0x3191a7);}export async function deleteKeychainAPIKey(_0x5f470a){const _0x3761c9=a50_0xe08659;try{const _0x5e15cd=await getKeyring();if(!_0x5e15cd)return![];const _0x21f028=getAccountName(_0x5f470a);return await _0x5e15cd[_0x3761c9(0x8e)](SERVICE_NAME,_0x21f028);}catch{return![];}}export async function isKeychainAvailable(){const _0x4186d3=a50_0xe08659;try{const _0x13dc2a=await getKeyring();if(!_0x13dc2a)return![];return await _0x13dc2a[_0x4186d3(0x9a)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x5c7e27){const _0x2330e5=_0x5c7e27 instanceof Error?_0x5c7e27[_0x4186d3(0x86)][_0x4186d3(0x8d)]():'';if(_0x2330e5[_0x4186d3(0x91)]('not\x20available')||_0x2330e5[_0x4186d3(0x91)](_0x4186d3(0x9d))||_0x2330e5[_0x4186d3(0x91)](_0x4186d3(0xa1)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x4b34c6,_0x45e08c){const _0x156db8=a51_0x16e8,_0x42e71a=_0x4b34c6();while(!![]){try{const _0x53206f=parseInt(_0x156db8(0x125))/0x1*(parseInt(_0x156db8(0x126))/0x2)+-parseInt(_0x156db8(0x11d))/0x3*(-parseInt(_0x156db8(0x13f))/0x4)+-parseInt(_0x156db8(0xf5))/0x5+parseInt(_0x156db8(0x129))/0x6*(-parseInt(_0x156db8(0xfa))/0x7)+parseInt(_0x156db8(0x13b))/0x8*(-parseInt(_0x156db8(0x13e))/0x9)+parseInt(_0x156db8(0x10b))/0xa+parseInt(_0x156db8(0x104))/0xb;if(_0x53206f===_0x45e08c)break;else _0x42e71a['push'](_0x42e71a['shift']());}catch(_0x4ce3db){_0x42e71a['push'](_0x42e71a['shift']());}}}(a51_0x991f,0xba703));import*as a51_0x3e5160 from'node:fs';import*as a51_0x1ccbdd from'node:path';import{getConfigDir}from'./config.js';function a51_0x991f(){const _0xcfea68=['11215qzunDL','34CClvJL','message','.env.','6phEslm','\x22\x20\x22','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','keys','warn','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','llm_project','name','existsSync','readFileSync','set','Invalid\x20profile\x20name:\x20','\x20\x20mv\x20\x22','stringify','Warning:\x20Failed\x20to\x20parse\x20','site','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','parent_segment','60824XAKWeZ','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','map','1431ShXJDm','3580euvlXJ','Error:\x20','3377445APaavf','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','length','filter','localeCompare','5259758QaHyff','utf-8','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string',',\x20creating\x20new\x20file','readdirSync','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','directory','profiles','\x0aWarning:\x20Failed\x20to\x20parse\x20','find','14151808rWkWUM','join','\x20already\x20exists','from','string','.env','\x20does\x20not\x20exist','10343880rhacLB','local','database','\x27\x20will\x20be\x20ignored','Profile\x20','push','\x27:\x20unknown\x20config\x20key\x20\x27','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','Warning:\x20Profile\x20\x27','test','values','isDirectory','parse','entries','\x20\x201.\x20Edit:\x20','Profile\x20\x27','llm_agent','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','2976IxYEVv','description','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','has','tdx.json','profile','some',':\x20Invalid\x20JSON\x20syntax'];a51_0x991f=function(){return _0xcfea68;};return a51_0x991f();}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0xf737f0){const _0x73f2cb=a51_0x16e8,_0x40aa10={};if(!_0xf737f0)return _0x40aa10;for(const [_0x4df796,_0x2a9666]of Object[_0x73f2cb(0x118)](_0xf737f0)){_0x4df796!==_0x73f2cb(0x11e)&&_0x2a9666!==undefined&&(_0x40aa10[_0x4df796]=_0x2a9666);}return _0x40aa10;}export function getProfilesDir(){const _0x1752fc=a51_0x16e8;return a51_0x1ccbdd[_0x1752fc(0x105)](getConfigDir(),_0x1752fc(0x101));}function getProfileDir(_0xce7546){const _0x1033ac=a51_0x16e8;return a51_0x1ccbdd[_0x1033ac(0x105)](getProfilesDir(),_0xce7546);}function getProfileConfigPath(_0x484993){const _0x5b4239=a51_0x16e8;return a51_0x1ccbdd[_0x5b4239(0x105)](getProfileDir(_0x484993),_0x5b4239(0x121));}function getProfileEnvPath(_0x3c9085){const _0x48d900=a51_0x16e8;return a51_0x1ccbdd[_0x48d900(0x105)](getProfileDir(_0x3c9085),_0x48d900(0x109));}function getGlobalConfigPath(){const _0x5af9c2=a51_0x16e8;return a51_0x1ccbdd[_0x5af9c2(0x105)](getConfigDir(),'tdx.json');}function validateProfileName(_0x27ef39){const _0x3cf043=a51_0x16e8;if(!/^[a-zA-Z0-9_-]+$/[_0x3cf043(0x114)](_0x27ef39))throw new Error(_0x3cf043(0x134)+_0x27ef39+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x2885e9,_0x32aae8){const _0x277e91=a51_0x16e8;if(typeof _0x2885e9!=='object'||_0x2885e9===null)throw new Error('Profile\x20\x27'+_0x32aae8+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0xf95715=['description',_0x277e91(0x138),_0x277e91(0x10d),_0x277e91(0x13a),'llm_project',_0x277e91(0x11b)],_0x488fe4=_0x2885e9;for(const _0x100ddd of Object[_0x277e91(0x12c)](_0x488fe4)){!_0xf95715['includes'](_0x100ddd)&&console[_0x277e91(0x12d)](_0x277e91(0x113)+_0x32aae8+_0x277e91(0x111)+_0x100ddd+_0x277e91(0x10e));}if(_0x488fe4[_0x277e91(0x11e)]!==undefined&&typeof _0x488fe4['description']!==_0x277e91(0x108))throw new Error(_0x277e91(0x11a)+_0x32aae8+_0x277e91(0x112));if(_0x488fe4[_0x277e91(0x138)]!==undefined&&typeof _0x488fe4[_0x277e91(0x138)]!=='string')throw new Error(_0x277e91(0x11a)+_0x32aae8+_0x277e91(0xfc));if(_0x488fe4[_0x277e91(0x10d)]!==undefined&&typeof _0x488fe4[_0x277e91(0x10d)]!==_0x277e91(0x108))throw new Error(_0x277e91(0x11a)+_0x32aae8+_0x277e91(0xf6));if(_0x488fe4['parent_segment']!==undefined&&typeof _0x488fe4[_0x277e91(0x13a)]!==_0x277e91(0x108))throw new Error('Profile\x20\x27'+_0x32aae8+_0x277e91(0x11f));if(_0x488fe4[_0x277e91(0x12f)]!==undefined&&typeof _0x488fe4['llm_project']!==_0x277e91(0x108))throw new Error(_0x277e91(0x11a)+_0x32aae8+_0x277e91(0x12b));if(_0x488fe4[_0x277e91(0x11b)]!==undefined&&typeof _0x488fe4[_0x277e91(0x11b)]!==_0x277e91(0x108))throw new Error(_0x277e91(0x11a)+_0x32aae8+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function a51_0x16e8(_0x710f7d,_0x3b17e6){_0x710f7d=_0x710f7d-0xf5;const _0x991f17=a51_0x991f();let _0x16e889=_0x991f17[_0x710f7d];return _0x16e889;}function loadProfilesFromTdxJson(_0x41dc16,_0x4d28ad){const _0x5245bc=a51_0x16e8;if(!a51_0x3e5160['existsSync'](_0x41dc16))return[];try{const _0x29d5a7=a51_0x3e5160[_0x5245bc(0x132)](_0x41dc16,'utf-8'),_0x4c7e27=JSON[_0x5245bc(0x117)](_0x29d5a7);if(!_0x4c7e27[_0x5245bc(0x101)]||typeof _0x4c7e27['profiles']!=='object')return[];const _0x50b4d6=[];for(const [_0xcd3aa4,_0x4d6463]of Object[_0x5245bc(0x118)](_0x4c7e27[_0x5245bc(0x101)])){try{validateProfileConfig(_0x4d6463,_0xcd3aa4);const _0x55cf22=getNewCredentialPath(_0xcd3aa4),_0x145854=getOldCredentialPath(_0xcd3aa4),_0x2a0fcf=a51_0x3e5160[_0x5245bc(0x131)](_0x55cf22)||a51_0x3e5160[_0x5245bc(0x131)](_0x145854);_0x50b4d6['push']({'name':_0xcd3aa4,'config':_0x4d6463,'metadata':{'name':_0xcd3aa4,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x2a0fcf,'scope':_0x4d28ad});}catch(_0x4213db){_0x4213db instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x41dc16+':'),console[_0x5245bc(0x12d)]('\x20\x20'+_0x4213db[_0x5245bc(0x127)]+'\x0a'));}}return _0x50b4d6;}catch(_0x3367de){return _0x3367de instanceof SyntaxError?(console[_0x5245bc(0x12d)](_0x5245bc(0x102)+_0x41dc16+_0x5245bc(0x124)),console[_0x5245bc(0x12d)](_0x5245bc(0x140)+_0x3367de[_0x5245bc(0x127)]+'\x0a')):console[_0x5245bc(0x12d)](_0x5245bc(0x11c)+_0x41dc16+':\x20'+_0x3367de+'\x0a'),[];}}export function getNewCredentialPath(_0x4130c7){const _0x2208fe=a51_0x16e8;return a51_0x1ccbdd[_0x2208fe(0x105)](getConfigDir(),_0x2208fe(0x128)+_0x4130c7);}function getOldCredentialPath(_0x591d12){const _0xb312ce=a51_0x16e8;return a51_0x1ccbdd['join'](getProfilesDir(),_0x591d12,_0xb312ce(0x109));}function loadProfilesFromTdxJsonFiles(){const _0x17c580=a51_0x16e8,_0x326b73=[],_0x2bc99a=findProjectConfigPath();_0x2bc99a&&_0x326b73[_0x17c580(0x110)](...loadProfilesFromTdxJson(_0x2bc99a,_0x17c580(0x10c)));const _0x54b4a0=a51_0x1ccbdd[_0x17c580(0x105)](getConfigDir(),_0x17c580(0x121));return _0x326b73[_0x17c580(0x110)](...loadProfilesFromTdxJson(_0x54b4a0,'user')),_0x326b73;}function loadProfilesFromDirectories(){const _0x2220a5=a51_0x16e8,_0x4d0720=getProfilesDir();if(!a51_0x3e5160['existsSync'](_0x4d0720))return[];try{return a51_0x3e5160[_0x2220a5(0xfe)](_0x4d0720,{'withFileTypes':!![]})['filter'](_0x29666f=>_0x29666f[_0x2220a5(0x116)]())[_0x2220a5(0x13d)](_0x541a44=>_0x541a44[_0x2220a5(0x130)])[_0x2220a5(0xf8)](_0x54b07d=>{const _0x41436e=_0x2220a5,_0x1039f7=getProfileConfigPath(_0x54b07d),_0x27818c=getProfileEnvPath(_0x54b07d);return a51_0x3e5160[_0x41436e(0x131)](_0x1039f7)||a51_0x3e5160[_0x41436e(0x131)](_0x27818c);})[_0x2220a5(0x13d)](_0x31c272=>{const _0x4ad23b=loadProfileFromDirectory(_0x31c272);if(_0x4ad23b)return{..._0x4ad23b,'scope':'directory'};return null;})['filter'](_0x5d8a29=>_0x5d8a29!==null);}catch{return[];}}function loadProfileFromDirectory(_0xfebc5c){const _0x280f84=a51_0x16e8,_0x317a5c=getProfileConfigPath(_0xfebc5c),_0x56fb2f=getOldCredentialPath(_0xfebc5c);if(!a51_0x3e5160[_0x280f84(0x131)](_0x317a5c)&&!a51_0x3e5160['existsSync'](_0x56fb2f))return null;let _0xc71aae={},_0xa467a={'name':_0xfebc5c,'createdAt':new Date()['toISOString']()};if(a51_0x3e5160[_0x280f84(0x131)](_0x317a5c))try{const _0x10b6ed=a51_0x3e5160[_0x280f84(0x132)](_0x317a5c,_0x280f84(0xfb)),_0x75d489=JSON[_0x280f84(0x117)](_0x10b6ed),{metadata:_0xda3b7c,..._0xd658ca}=_0x75d489;_0xc71aae=_0xd658ca,_0xda3b7c&&(_0xa467a=_0xda3b7c);}catch{}return{'name':_0xfebc5c,'config':_0xc71aae,'metadata':_0xa467a,'hasCredentials':a51_0x3e5160[_0x280f84(0x131)](_0x56fb2f),'scope':_0x280f84(0x100)};}export function listProfiles(){const _0x418406=a51_0x16e8,_0x49ec6a=loadProfilesFromTdxJsonFiles(),_0x1af178=loadProfilesFromDirectories();if(_0x1af178[_0x418406(0xf7)]>0x0){const _0x34eafd=_0x1af178[_0x418406(0x13d)](_0x247ced=>_0x247ced[_0x418406(0x130)])[_0x418406(0x105)](',\x20'),_0x22019b=getConfigDir();console[_0x418406(0x12d)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x34eafd),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x418406(0x12d)](_0x418406(0x119)+a51_0x1ccbdd[_0x418406(0x105)](_0x22019b,_0x418406(0x121))),console[_0x418406(0x12d)](_0x418406(0x12e)),console[_0x418406(0x12d)](_0x418406(0x13c));}const _0x5f4d5d=[..._0x49ec6a,..._0x1af178],_0x4b3fbc=new Map();for(const _0x49908e of _0x5f4d5d){!_0x4b3fbc[_0x418406(0x120)](_0x49908e[_0x418406(0x130)])&&_0x4b3fbc[_0x418406(0x133)](_0x49908e[_0x418406(0x130)],_0x49908e);}return Array[_0x418406(0x107)](_0x4b3fbc[_0x418406(0x115)]())['sort']((_0x444961,_0x3885cf)=>_0x444961[_0x418406(0x130)][_0x418406(0xf9)](_0x3885cf[_0x418406(0x130)]));}export function profileExists(_0x29328c){const _0x5a8293=a51_0x16e8,_0x129c96=listProfiles();return _0x129c96[_0x5a8293(0x123)](_0xf59936=>_0xf59936[_0x5a8293(0x130)]===_0x29328c);}export function loadProfile(_0x5e6db0){const _0xcd0f72=a51_0x16e8;validateProfileName(_0x5e6db0);const _0xe10be1=listProfiles(),_0x83bb87=_0xe10be1[_0xcd0f72(0x103)](_0x1079a3=>_0x1079a3[_0xcd0f72(0x130)]===_0x5e6db0);return _0x83bb87||null;}export function saveProfile(_0x1acf27,_0x5432da,_0x3f0997=![]){saveProfileToUserConfig(_0x1acf27,_0x5432da);}export function deleteProfile(_0x1ef648){const _0xb5db0c=a51_0x16e8;validateProfileName(_0x1ef648);const _0x4fd7c8=getProfileDir(_0x1ef648);if(!a51_0x3e5160[_0xb5db0c(0x131)](_0x4fd7c8))throw new Error(_0xb5db0c(0x10f)+_0x1ef648+_0xb5db0c(0x10a));a51_0x3e5160['rmSync'](_0x4fd7c8,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x58f038,_0xd6473d){const _0x4bbe17=a51_0x16e8;validateProfileName(_0x58f038);const _0x4b758d=getGlobalConfigPath(),_0x5b4b55=getConfigDir();!a51_0x3e5160[_0x4bbe17(0x131)](_0x5b4b55)&&createSecureDirectory(_0x5b4b55);let _0x2c61d9={};if(a51_0x3e5160['existsSync'](_0x4b758d))try{const _0x511eff=a51_0x3e5160[_0x4bbe17(0x132)](_0x4b758d,'utf-8');_0x2c61d9=JSON[_0x4bbe17(0x117)](_0x511eff);}catch{console[_0x4bbe17(0x12d)](_0x4bbe17(0x137)+_0x4b758d+_0x4bbe17(0xfd));}!_0x2c61d9[_0x4bbe17(0x101)]&&(_0x2c61d9[_0x4bbe17(0x101)]={}),_0x2c61d9[_0x4bbe17(0x101)][_0x58f038]=_0xd6473d,writeSecureFile(_0x4b758d,JSON[_0x4bbe17(0x136)](_0x2c61d9,null,0x2));}export function getActiveProfile(){const _0x4f4cbc=a51_0x16e8,_0x416e5a=loadSessionContext();if(_0x416e5a?.[_0x4f4cbc(0x122)])return _0x416e5a[_0x4f4cbc(0x122)];const _0x570301=getGlobalConfigPath();if(!a51_0x3e5160[_0x4f4cbc(0x131)](_0x570301))return null;try{const _0x5d055c=a51_0x3e5160[_0x4f4cbc(0x132)](_0x570301,_0x4f4cbc(0xfb)),_0x76783d=JSON['parse'](_0x5d055c);return _0x76783d[_0x4f4cbc(0x122)]||null;}catch{return null;}}export function createProfile(_0x12c3a6,_0x3e5dd2){const _0x3cf7bc=a51_0x16e8;validateProfileName(_0x12c3a6);if(profileExists(_0x12c3a6))throw new Error('Profile\x20'+_0x12c3a6+_0x3cf7bc(0x106));saveProfile(_0x12c3a6,_0x3e5dd2);}export function saveProfileCredentials(_0x14011b,_0x202998){const _0x54ada6=a51_0x16e8;validateProfileName(_0x14011b);if(!profileExists(_0x14011b))throw new Error('Profile\x20'+_0x14011b+_0x54ada6(0x10a));const _0x52de9e=getNewCredentialPath(_0x14011b);writeSecureFile(_0x52de9e,_0x202998);}export function loadProfileCredentials(_0x33f98c){const _0x14f753=a51_0x16e8;validateProfileName(_0x33f98c);const _0x2baf66=getNewCredentialPath(_0x33f98c);if(a51_0x3e5160['existsSync'](_0x2baf66))try{return a51_0x3e5160[_0x14f753(0x132)](_0x2baf66,_0x14f753(0xfb));}catch{}const _0x4d7ac4=getOldCredentialPath(_0x33f98c);if(a51_0x3e5160[_0x14f753(0x131)](_0x4d7ac4)){console['warn'](_0x14f753(0x139)+_0x33f98c+'\x27'),console[_0x14f753(0x12d)]('To\x20migrate:'),console[_0x14f753(0x12d)](_0x14f753(0x135)+_0x4d7ac4+_0x14f753(0x12a)+_0x2baf66+'\x22'),console['warn'](_0x14f753(0xff));try{return a51_0x3e5160[_0x14f753(0x132)](_0x4d7ac4,_0x14f753(0xfb));}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x2e8213,_0x2bf019){const _0x29a398=a51_0x2cb6,_0x3d603f=_0x2e8213();while(!![]){try{const _0x24d153=parseInt(_0x29a398(0x216))/0x1+-parseInt(_0x29a398(0x1e0))/0x2*(parseInt(_0x29a398(0x1ec))/0x3)+parseInt(_0x29a398(0x213))/0x4*(-parseInt(_0x29a398(0x1f2))/0x5)+-parseInt(_0x29a398(0x224))/0x6*(parseInt(_0x29a398(0x1f4))/0x7)+-parseInt(_0x29a398(0x1f8))/0x8+parseInt(_0x29a398(0x208))/0x9*(-parseInt(_0x29a398(0x21c))/0xa)+-parseInt(_0x29a398(0x214))/0xb*(-parseInt(_0x29a398(0x21b))/0xc);if(_0x24d153===_0x2bf019)break;else _0x3d603f['push'](_0x3d603f['shift']());}catch(_0x446c27){_0x3d603f['push'](_0x3d603f['shift']());}}}(a51_0x398f,0x87bed));import*as a51_0x434d42 from'node:fs';import*as a51_0x1a62b0 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(_0x28ca2e){const _0x3959b2=a51_0x2cb6,_0x504122={};if(!_0x28ca2e)return _0x504122;for(const [_0x5990e8,_0x9f2b6d]of Object[_0x3959b2(0x1ef)](_0x28ca2e)){_0x5990e8!==_0x3959b2(0x1e5)&&_0x9f2b6d!==undefined&&(_0x504122[_0x5990e8]=_0x9f2b6d);}return _0x504122;}export function getProfilesDir(){const _0xc257f4=a51_0x2cb6;return a51_0x1a62b0[_0xc257f4(0x1f5)](getConfigDir(),_0xc257f4(0x207));}function getProfileDir(_0x55f5fe){const _0x31b132=a51_0x2cb6;return a51_0x1a62b0[_0x31b132(0x1f5)](getProfilesDir(),_0x55f5fe);}function getProfileConfigPath(_0x4d9505){const _0x3d012c=a51_0x2cb6;return a51_0x1a62b0[_0x3d012c(0x1f5)](getProfileDir(_0x4d9505),_0x3d012c(0x222));}function getProfileEnvPath(_0x266ac0){const _0x517444=a51_0x2cb6;return a51_0x1a62b0[_0x517444(0x1f5)](getProfileDir(_0x266ac0),_0x517444(0x1db));}function getGlobalConfigPath(){const _0x55cb98=a51_0x2cb6;return a51_0x1a62b0[_0x55cb98(0x1f5)](getConfigDir(),_0x55cb98(0x222));}function validateProfileName(_0x8c043d){const _0x579e48=a51_0x2cb6;if(!/^[a-zA-Z0-9_-]+$/[_0x579e48(0x1eb)](_0x8c043d))throw new Error('Invalid\x20profile\x20name:\x20'+_0x8c043d+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x4c4c39,_0x2bad0d){const _0x3001b7=a51_0x2cb6;if(typeof _0x4c4c39!==_0x3001b7(0x212)||_0x4c4c39===null)throw new Error(_0x3001b7(0x21a)+_0x2bad0d+_0x3001b7(0x21e));const _0x22db6a=[_0x3001b7(0x1e5),_0x3001b7(0x1ee),'database',_0x3001b7(0x1da),_0x3001b7(0x201),_0x3001b7(0x1df)],_0x10a314=_0x4c4c39;for(const _0x3de091 of Object['keys'](_0x10a314)){!_0x22db6a[_0x3001b7(0x220)](_0x3de091)&&console[_0x3001b7(0x223)]('Warning:\x20Profile\x20\x27'+_0x2bad0d+_0x3001b7(0x20f)+_0x3de091+_0x3001b7(0x1ff));}if(_0x10a314['description']!==undefined&&typeof _0x10a314[_0x3001b7(0x1e5)]!==_0x3001b7(0x1dc))throw new Error('Profile\x20\x27'+_0x2bad0d+_0x3001b7(0x1e6));if(_0x10a314['site']!==undefined&&typeof _0x10a314[_0x3001b7(0x1ee)]!==_0x3001b7(0x1dc))throw new Error('Profile\x20\x27'+_0x2bad0d+_0x3001b7(0x20a));if(_0x10a314[_0x3001b7(0x1ea)]!==undefined&&typeof _0x10a314[_0x3001b7(0x1ea)]!==_0x3001b7(0x1dc))throw new Error(_0x3001b7(0x21a)+_0x2bad0d+_0x3001b7(0x1fa));if(_0x10a314[_0x3001b7(0x1da)]!==undefined&&typeof _0x10a314['parent_segment']!==_0x3001b7(0x1dc))throw new Error(_0x3001b7(0x21a)+_0x2bad0d+_0x3001b7(0x1e1));if(_0x10a314[_0x3001b7(0x201)]!==undefined&&typeof _0x10a314[_0x3001b7(0x201)]!=='string')throw new Error(_0x3001b7(0x21a)+_0x2bad0d+_0x3001b7(0x209));if(_0x10a314[_0x3001b7(0x1df)]!==undefined&&typeof _0x10a314['llm_agent']!==_0x3001b7(0x1dc))throw new Error('Profile\x20\x27'+_0x2bad0d+_0x3001b7(0x210));return!![];}function loadProfilesFromTdxJson(_0x5d9867,_0x36e2bb){const _0x14f614=a51_0x2cb6;if(!a51_0x434d42[_0x14f614(0x225)](_0x5d9867))return[];try{const _0x460090=a51_0x434d42['readFileSync'](_0x5d9867,'utf-8'),_0x2019d6=JSON[_0x14f614(0x1f7)](_0x460090);if(!_0x2019d6[_0x14f614(0x207)]||typeof _0x2019d6[_0x14f614(0x207)]!==_0x14f614(0x212))return[];const _0x42b5dd=[];for(const [_0x4f7316,_0x115f69]of Object[_0x14f614(0x1ef)](_0x2019d6[_0x14f614(0x207)])){try{validateProfileConfig(_0x115f69,_0x4f7316);const _0x171d70=getNewCredentialPath(_0x4f7316),_0x22a975=getOldCredentialPath(_0x4f7316),_0x54ffb0=a51_0x434d42[_0x14f614(0x225)](_0x171d70)||a51_0x434d42[_0x14f614(0x225)](_0x22a975);_0x42b5dd[_0x14f614(0x1fe)]({'name':_0x4f7316,'config':_0x115f69,'metadata':{'name':_0x4f7316,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x54ffb0,'scope':_0x36e2bb});}catch(_0x3baf59){_0x3baf59 instanceof Error&&(console['warn'](_0x14f614(0x227)+_0x5d9867+':'),console['warn']('\x20\x20'+_0x3baf59[_0x14f614(0x206)]+'\x0a'));}}return _0x42b5dd;}catch(_0x421c27){return _0x421c27 instanceof SyntaxError?(console['warn']('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x5d9867+':\x20Invalid\x20JSON\x20syntax'),console['warn'](_0x14f614(0x1fd)+_0x421c27[_0x14f614(0x206)]+'\x0a')):console[_0x14f614(0x223)](_0x14f614(0x20e)+_0x5d9867+':\x20'+_0x421c27+'\x0a'),[];}}export function getNewCredentialPath(_0x52f2a6){const _0x3826ea=a51_0x2cb6;return a51_0x1a62b0[_0x3826ea(0x1f5)](getConfigDir(),'.env.'+_0x52f2a6);}function a51_0x398f(){const _0x3b6fa0=[',\x20creating\x20new\x20file','llm_agent','21990rmVxqe','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','rmSync','filter','\x20already\x20exists','description','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','length','local','\x20\x201.\x20Edit:\x20','database','test','171dcKilI','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','site','entries','map','some','35avzsSS','sort','49Yumfgl','join','find','parse','6387128ziIxQg','values','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','readFileSync','utf-8','Error:\x20','push','\x27\x20will\x20be\x20ignored','stringify','llm_project','localeCompare','\x20does\x20not\x20exist','profile','directory','message','profiles','315gcImhF','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','To\x20migrate:','isDirectory','user','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x27:\x20unknown\x20config\x20key\x20\x27','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','name','object','321044FbKuBd','39145832EPqkAa','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','850084rhJMbG','\x22\x20\x22','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','Profile\x20','Profile\x20\x27','12RJRrte','315850nxKwlF','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x27:\x20config\x20must\x20be\x20an\x20object','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','includes','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','tdx.json','warn','651750eqJLDO','existsSync','toISOString','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Warning:\x20Failed\x20to\x20parse\x20','parent_segment','.env','string','from'];a51_0x398f=function(){return _0x3b6fa0;};return a51_0x398f();}function getOldCredentialPath(_0xa1ce4){const _0x4536b0=a51_0x2cb6;return a51_0x1a62b0[_0x4536b0(0x1f5)](getProfilesDir(),_0xa1ce4,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x48e2af=a51_0x2cb6,_0x428f68=[],_0x33a524=findProjectConfigPath();_0x33a524&&_0x428f68[_0x48e2af(0x1fe)](...loadProfilesFromTdxJson(_0x33a524,_0x48e2af(0x1e8)));const _0x218833=a51_0x1a62b0[_0x48e2af(0x1f5)](getConfigDir(),'tdx.json');return _0x428f68['push'](...loadProfilesFromTdxJson(_0x218833,_0x48e2af(0x20d))),_0x428f68;}function loadProfilesFromDirectories(){const _0x3d497f=a51_0x2cb6,_0x3a16f7=getProfilesDir();if(!a51_0x434d42[_0x3d497f(0x225)](_0x3a16f7))return[];try{return a51_0x434d42['readdirSync'](_0x3a16f7,{'withFileTypes':!![]})[_0x3d497f(0x1e3)](_0x16ac71=>_0x16ac71[_0x3d497f(0x20c)]())[_0x3d497f(0x1f0)](_0x1f8561=>_0x1f8561[_0x3d497f(0x211)])[_0x3d497f(0x1e3)](_0x394a98=>{const _0x3bb02e=_0x3d497f,_0x50d6f9=getProfileConfigPath(_0x394a98),_0x5d3e7b=getProfileEnvPath(_0x394a98);return a51_0x434d42[_0x3bb02e(0x225)](_0x50d6f9)||a51_0x434d42[_0x3bb02e(0x225)](_0x5d3e7b);})[_0x3d497f(0x1f0)](_0x256db7=>{const _0x42cfe2=loadProfileFromDirectory(_0x256db7);if(_0x42cfe2)return{..._0x42cfe2,'scope':'directory'};return null;})[_0x3d497f(0x1e3)](_0x368f31=>_0x368f31!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2a2680){const _0x43bc2c=a51_0x2cb6,_0x1859e4=getProfileConfigPath(_0x2a2680),_0xcbfe68=getOldCredentialPath(_0x2a2680);if(!a51_0x434d42[_0x43bc2c(0x225)](_0x1859e4)&&!a51_0x434d42[_0x43bc2c(0x225)](_0xcbfe68))return null;let _0x40dae5={},_0x968a12={'name':_0x2a2680,'createdAt':new Date()[_0x43bc2c(0x226)]()};if(a51_0x434d42[_0x43bc2c(0x225)](_0x1859e4))try{const _0x406c3d=a51_0x434d42[_0x43bc2c(0x1fb)](_0x1859e4,'utf-8'),_0x428ff4=JSON[_0x43bc2c(0x1f7)](_0x406c3d),{metadata:_0x3a8451,..._0x1b94e6}=_0x428ff4;_0x40dae5=_0x1b94e6,_0x3a8451&&(_0x968a12=_0x3a8451);}catch{}return{'name':_0x2a2680,'config':_0x40dae5,'metadata':_0x968a12,'hasCredentials':a51_0x434d42[_0x43bc2c(0x225)](_0xcbfe68),'scope':_0x43bc2c(0x205)};}export function listProfiles(){const _0x334308=a51_0x2cb6,_0x336b7d=loadProfilesFromTdxJsonFiles(),_0xb56573=loadProfilesFromDirectories();if(_0xb56573[_0x334308(0x1e7)]>0x0){const _0x1c73ac=_0xb56573[_0x334308(0x1f0)](_0x40e6c5=>_0x40e6c5[_0x334308(0x211)])[_0x334308(0x1f5)](',\x20'),_0x47e5e1=getConfigDir();console[_0x334308(0x223)](_0x334308(0x221)+_0x1c73ac),console[_0x334308(0x223)](_0x334308(0x215)),console[_0x334308(0x223)](_0x334308(0x1e9)+a51_0x1a62b0[_0x334308(0x1f5)](_0x47e5e1,'tdx.json')),console['warn'](_0x334308(0x218)),console[_0x334308(0x223)](_0x334308(0x21d));}const _0x478972=[..._0x336b7d,..._0xb56573],_0x54ff22=new Map();for(const _0x4647ec of _0x478972){!_0x54ff22['has'](_0x4647ec[_0x334308(0x211)])&&_0x54ff22['set'](_0x4647ec['name'],_0x4647ec);}return Array[_0x334308(0x1dd)](_0x54ff22[_0x334308(0x1f9)]())[_0x334308(0x1f3)]((_0xffe600,_0x4eadb3)=>_0xffe600['name'][_0x334308(0x202)](_0x4eadb3[_0x334308(0x211)]));}export function profileExists(_0x37f4e6){const _0x3abfa1=a51_0x2cb6,_0x20c3cf=listProfiles();return _0x20c3cf[_0x3abfa1(0x1f1)](_0x4e2487=>_0x4e2487[_0x3abfa1(0x211)]===_0x37f4e6);}export function loadProfile(_0x537dc1){const _0x29bc1d=a51_0x2cb6;validateProfileName(_0x537dc1);const _0x346f25=listProfiles(),_0x5228ef=_0x346f25[_0x29bc1d(0x1f6)](_0x4b1b02=>_0x4b1b02['name']===_0x537dc1);return _0x5228ef||null;}export function saveProfile(_0x56feb5,_0x3d352a,_0x505246=![]){saveProfileToUserConfig(_0x56feb5,_0x3d352a);}export function deleteProfile(_0x530735){const _0x6e4e59=a51_0x2cb6;validateProfileName(_0x530735);const _0x2c6389=getProfileDir(_0x530735);if(!a51_0x434d42['existsSync'](_0x2c6389))throw new Error(_0x6e4e59(0x219)+_0x530735+'\x20does\x20not\x20exist');a51_0x434d42[_0x6e4e59(0x1e2)](_0x2c6389,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x2d6b1e,_0x430830){const _0x1350b0=a51_0x2cb6;validateProfileName(_0x2d6b1e);const _0x17a7ed=getGlobalConfigPath(),_0x35768d=getConfigDir();!a51_0x434d42['existsSync'](_0x35768d)&&createSecureDirectory(_0x35768d);let _0x3ef833={};if(a51_0x434d42[_0x1350b0(0x225)](_0x17a7ed))try{const _0x3cbdc1=a51_0x434d42[_0x1350b0(0x1fb)](_0x17a7ed,_0x1350b0(0x1fc));_0x3ef833=JSON[_0x1350b0(0x1f7)](_0x3cbdc1);}catch{console['warn'](_0x1350b0(0x228)+_0x17a7ed+_0x1350b0(0x1de));}!_0x3ef833[_0x1350b0(0x207)]&&(_0x3ef833[_0x1350b0(0x207)]={}),_0x3ef833[_0x1350b0(0x207)][_0x2d6b1e]=_0x430830,writeSecureFile(_0x17a7ed,JSON[_0x1350b0(0x200)](_0x3ef833,null,0x2));}function a51_0x2cb6(_0x43b08a,_0x28f015){_0x43b08a=_0x43b08a-0x1da;const _0x398f6e=a51_0x398f();let _0x2cb6bf=_0x398f6e[_0x43b08a];return _0x2cb6bf;}export function getActiveProfile(){const _0x210b0e=a51_0x2cb6,_0x46de32=loadSessionContext();if(_0x46de32?.[_0x210b0e(0x204)])return _0x46de32[_0x210b0e(0x204)];const _0x5396dc=getGlobalConfigPath();if(!a51_0x434d42[_0x210b0e(0x225)](_0x5396dc))return null;try{const _0x52253f=a51_0x434d42[_0x210b0e(0x1fb)](_0x5396dc,'utf-8'),_0x22782a=JSON[_0x210b0e(0x1f7)](_0x52253f);return _0x22782a['profile']||null;}catch{return null;}}export function createProfile(_0x19ee05,_0x2ca203){const _0x1e4822=a51_0x2cb6;validateProfileName(_0x19ee05);if(profileExists(_0x19ee05))throw new Error('Profile\x20'+_0x19ee05+_0x1e4822(0x1e4));saveProfile(_0x19ee05,_0x2ca203);}export function saveProfileCredentials(_0x41a66a,_0xfa4107){const _0x2cbc1b=a51_0x2cb6;validateProfileName(_0x41a66a);if(!profileExists(_0x41a66a))throw new Error('Profile\x20'+_0x41a66a+_0x2cbc1b(0x203));const _0x438932=getNewCredentialPath(_0x41a66a);writeSecureFile(_0x438932,_0xfa4107);}export function loadProfileCredentials(_0x302ef2){const _0x4a6e46=a51_0x2cb6;validateProfileName(_0x302ef2);const _0x553ee2=getNewCredentialPath(_0x302ef2);if(a51_0x434d42[_0x4a6e46(0x225)](_0x553ee2))try{return a51_0x434d42['readFileSync'](_0x553ee2,'utf-8');}catch{}const _0x3dd3ca=getOldCredentialPath(_0x302ef2);if(a51_0x434d42[_0x4a6e46(0x225)](_0x3dd3ca)){console[_0x4a6e46(0x223)](_0x4a6e46(0x21f)+_0x302ef2+'\x27'),console[_0x4a6e46(0x223)](_0x4a6e46(0x20b)),console['warn']('\x20\x20mv\x20\x22'+_0x3dd3ca+_0x4a6e46(0x217)+_0x553ee2+'\x22'),console['warn'](_0x4a6e46(0x1ed));try{return a51_0x434d42['readFileSync'](_0x3dd3ca,_0x4a6e46(0x1fc));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a52_0x98c4bc=a52_0x4f35;(function(_0x1f6846,_0x658c02){const _0x2f60b3=a52_0x4f35,_0x15d66a=_0x1f6846();while(!![]){try{const _0x4fab41=-parseInt(_0x2f60b3(0xc0))/0x1*(-parseInt(_0x2f60b3(0xc7))/0x2)+parseInt(_0x2f60b3(0xd5))/0x3+parseInt(_0x2f60b3(0xcd))/0x4*(parseInt(_0x2f60b3(0xd7))/0x5)+parseInt(_0x2f60b3(0xbd))/0x6+parseInt(_0x2f60b3(0xc2))/0x7*(parseInt(_0x2f60b3(0xc9))/0x8)+parseInt(_0x2f60b3(0xd4))/0x9*(-parseInt(_0x2f60b3(0xd0))/0xa)+-parseInt(_0x2f60b3(0xd2))/0xb;if(_0x4fab41===_0x658c02)break;else _0x15d66a['push'](_0x15d66a['shift']());}catch(_0x177999){_0x15d66a['push'](_0x15d66a['shift']());}}}(a52_0x2ce7,0x5d251));import*as a52_0x4c6bde from'node:fs';import*as a52_0x38f7b9 from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x98c4bc(0xd6);function a52_0x4f35(_0x46bcc8,_0x278de0){_0x46bcc8=_0x46bcc8-0xbc;const _0x2ce7c4=a52_0x2ce7();let _0x4f35c4=_0x2ce7c4[_0x46bcc8];return _0x4f35c4;}function a52_0x2ce7(){const _0x1b2491=['TD_API_KEY','5282376VomyFr',').\x20','586179UhythE','897855IPaMSu','tdx.json','30pPObPW','code','readFileSync','314400gvdPMM','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20','2707lLXdJQ','join','346003FVczYb','dirname','profile','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','apiKey','198eYXUBL','parse','24dnIgnP','api_key','includes','Failed\x20to\x20load\x20project\x20config\x20from\x20','149356ITgXYd','utf-8','cwd','20ohlEeA'];a52_0x2ce7=function(){return _0x1b2491;};return a52_0x2ce7();}export function findProjectConfigPath(_0x229ff1){const _0x59488e=a52_0x98c4bc;let _0x1a7098=_0x229ff1||process[_0x59488e(0xcf)]();while(!![]){const _0xe04b8=a52_0x38f7b9[_0x59488e(0xc1)](_0x1a7098,PROJECT_CONFIG_FILENAME);if(a52_0x4c6bde['existsSync'](_0xe04b8))return _0xe04b8;const _0x2a443e=a52_0x38f7b9[_0x59488e(0xc3)](_0x1a7098);if(_0x2a443e===_0x1a7098)return null;_0x1a7098=_0x2a443e;}}export function loadProjectConfig(_0x482b36){const _0x465679=a52_0x98c4bc,_0xc4f437=findProjectConfigPath(_0x482b36);if(!_0xc4f437)return null;try{const _0x5cfe25=a52_0x4c6bde[_0x465679(0xbc)](_0xc4f437,_0x465679(0xce)),_0xf5961a=JSON[_0x465679(0xc8)](_0x5cfe25),_0x520c8f=JSON['stringify'](_0xf5961a);if(_0x520c8f[_0x465679(0xcb)](_0x465679(0xd1))||_0x520c8f[_0x465679(0xcb)](_0x465679(0xc6))||_0x520c8f[_0x465679(0xcb)]('api_key'))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0xc4f437+_0x465679(0xd3)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0xa0d210,profile:_0x364d71,..._0xe8b564}=_0xf5961a;return _0x364d71&&console['warn'](_0x465679(0xbf)+_0xc4f437+'\x20is\x20ignored.\x20'+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0xe8b564;}catch(_0x13a91d){if(_0x13a91d instanceof Error&&_0x465679(0xd8)in _0x13a91d&&_0x13a91d[_0x465679(0xd8)]==='ENOENT')return null;throw new Error(_0x465679(0xcc)+_0xc4f437+':\x20'+_0x13a91d);}}export function saveProjectConfig(_0x1b0474,_0x4306f7){const _0x5ba051=a52_0x98c4bc,_0x3c577e=_0x4306f7||process[_0x5ba051(0xcf)](),_0x364779=a52_0x38f7b9[_0x5ba051(0xc1)](_0x3c577e,PROJECT_CONFIG_FILENAME),_0x1bb578=JSON['stringify'](_0x1b0474);if(_0x1bb578[_0x5ba051(0xcb)](_0x5ba051(0xd1))||_0x1bb578['includes'](_0x5ba051(0xc6))||_0x1bb578[_0x5ba051(0xcb)](_0x5ba051(0xca)))throw new Error(_0x5ba051(0xbe));if(_0x5ba051(0xc4)in _0x1b0474)throw new Error(_0x5ba051(0xc5));a52_0x4c6bde['writeFileSync'](_0x364779,JSON['stringify'](_0x1b0474,null,0x2));}export function hasProjectConfig(_0x3d1ba7){return findProjectConfigPath(_0x3d1ba7)!==null;}export function getProjectRoot(_0x2a0028){const _0x40fdd1=findProjectConfigPath(_0x2a0028);return _0x40fdd1?a52_0x38f7b9['dirname'](_0x40fdd1):null;}
|