@treasuredata/tdx 0.9.0 → 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.d.ts +1 -1
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/agent-yaml.js.map +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
|
-
|
|
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_0x271447=a44_0x1a3a;(function(_0x46a887,_0x5c17cd){const _0xeecdff=a44_0x1a3a,_0x2dd917=_0x46a887();while(!![]){try{const _0x4290c5=parseInt(_0xeecdff(0xb8))/0x1+-parseInt(_0xeecdff(0xcf))/0x2*(-parseInt(_0xeecdff(0xb4))/0x3)+parseInt(_0xeecdff(0x106))/0x4*(-parseInt(_0xeecdff(0xca))/0x5)+parseInt(_0xeecdff(0xd7))/0x6*(parseInt(_0xeecdff(0x11f))/0x7)+parseInt(_0xeecdff(0xd4))/0x8*(-parseInt(_0xeecdff(0x126))/0x9)+-parseInt(_0xeecdff(0x155))/0xa*(parseInt(_0xeecdff(0xe8))/0xb)+parseInt(_0xeecdff(0x146))/0xc;if(_0x4290c5===_0x5c17cd)break;else _0x2dd917['push'](_0x2dd917['shift']());}catch(_0x4c2a83){_0x2dd917['push'](_0x2dd917['shift']());}}}(a44_0x2d94,0x607e1));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_0x4f8c1e from'prompts';export class WorkflowProjectsCommand extends BaseCommand{['name']='workflow:projects';['description']=a44_0x271447(0x152);async[a44_0x271447(0xe1)](_0x2ad5fc){const _0x55d7c3=a44_0x271447,{options:_0x2fb7e1,args:_0x23d384,tdx:_0x3c65f3}=_0x2ad5fc,_0x468963=_0x23d384[0x0];try{_0x2fb7e1['verbose']&&_0x468963&&console['error'](_0x55d7c3(0x114)+_0x468963);const _0x2efaf6=await withSpinner(_0x55d7c3(0x158),()=>_0x3c65f3[_0x55d7c3(0xfe)][_0x55d7c3(0x112)](_0x468963,{'limit':_0x2fb7e1[_0x55d7c3(0x118)]}),{'verbose':_0x2fb7e1[_0x55d7c3(0x12c)]}),_0x3c2197=_0x2efaf6[_0x55d7c3(0xcd)];return console[_0x55d7c3(0x147)](_0x55d7c3(0xc2)+_0x3c2197[_0x55d7c3(0xd9)]+'\x20project'+(_0x3c2197[_0x55d7c3(0xd9)]!==0x1?'s':'')),await handleSDKOutput(_0x3c2197,_0x2fb7e1),0x0;}catch(_0x290bf4){if(_0x290bf4 instanceof SDKError)return console[_0x55d7c3(0x147)]('Error:\x20'+_0x290bf4[_0x55d7c3(0xb3)]),_0x290bf4[_0x55d7c3(0x137)]&&console[_0x55d7c3(0x147)]('\x20\x20Cause:\x20'+_0x290bf4[_0x55d7c3(0x137)]),0x1;throw _0x290bf4;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a44_0x271447(0xf7);[a44_0x271447(0x13a)]='List\x20workflows';async[a44_0x271447(0xe1)](_0x413459){const _0x5a880a=a44_0x271447,{options:_0xcd8dde,args:_0x59b274,tdx:_0x160855}=_0x413459,_0x1f084e=_0x59b274[0x0];try{_0xcd8dde['verbose']&&_0x1f084e&&console[_0x5a880a(0x147)]('Project\x20filter:\x20'+_0x1f084e);const _0x44cc12=await withSpinner(_0x5a880a(0x11a),()=>_0x160855[_0x5a880a(0xfe)][_0x5a880a(0xf2)](_0x1f084e,{'limit':_0xcd8dde[_0x5a880a(0x118)]}),{'verbose':_0xcd8dde[_0x5a880a(0x12c)]}),_0x135bbe=_0x44cc12[_0x5a880a(0xcd)];return console[_0x5a880a(0x147)](_0x5a880a(0xc2)+_0x135bbe[_0x5a880a(0xd9)]+_0x5a880a(0x15d)+(_0x135bbe[_0x5a880a(0xd9)]!==0x1?'s':'')),await handleSDKOutput(_0x135bbe,_0xcd8dde),0x0;}catch(_0xf27f5f){if(_0xf27f5f instanceof SDKError)return console[_0x5a880a(0x147)]('Error:\x20'+_0xf27f5f['message']),_0xf27f5f[_0x5a880a(0x137)]&&console['error']('\x20\x20Cause:\x20'+_0xf27f5f[_0x5a880a(0x137)]),0x1;throw _0xf27f5f;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a44_0x271447(0x135);[a44_0x271447(0x13a)]='List\x20workflow\x20execution\x20sessions';async[a44_0x271447(0xe1)](_0x10e029){const _0x5b3c54=a44_0x271447,{options:_0x276483,args:_0x1b86c6,tdx:_0x454643}=_0x10e029;let _0x2dcbf4,_0x175076;if(_0x1b86c6[0x0]){const _0x47e6d0=_0x1b86c6[0x0]['split']('.');if(_0x47e6d0[_0x5b3c54(0xd9)]===0x1)_0x2dcbf4=_0x47e6d0[0x0];else{if(_0x47e6d0[_0x5b3c54(0xd9)]===0x2)[_0x2dcbf4,_0x175076]=_0x47e6d0;else return console[_0x5b3c54(0x147)](_0x5b3c54(0x124)),0x1;}}try{if(_0x276483['verbose']){if(_0x2dcbf4&&_0x175076)console[_0x5b3c54(0x147)]('Filter:\x20'+_0x2dcbf4+'.'+_0x175076);else _0x2dcbf4&&console[_0x5b3c54(0x147)](_0x5b3c54(0xdc)+_0x2dcbf4);const _0x4de504=_0x276483[_0x5b3c54(0x13f)];_0x4de504&&console[_0x5b3c54(0x147)](_0x5b3c54(0xc5)+_0x4de504);}const _0x32d872=await withSpinner(_0x5b3c54(0xd5),()=>_0x454643[_0x5b3c54(0xfe)]['sessions']({'projectName':_0x2dcbf4,'workflowName':_0x175076,'status':_0x276483[_0x5b3c54(0x13f)],'fromTime':_0x276483[_0x5b3c54(0xf1)],'toTime':_0x276483['to'],'limit':_0x276483[_0x5b3c54(0x118)]}),{'verbose':_0x276483[_0x5b3c54(0x12c)]}),_0x35839d=_0x32d872[_0x5b3c54(0xcd)];return console['error'](_0x5b3c54(0xc2)+_0x35839d['length']+_0x5b3c54(0xe2)+(_0x35839d['length']!==0x1?'s':'')),await handleSDKOutput(_0x35839d,_0x276483),0x0;}catch(_0x4794c1){if(_0x4794c1 instanceof SDKError)return console[_0x5b3c54(0x147)]('Error:\x20'+_0x4794c1[_0x5b3c54(0xb3)]),_0x4794c1[_0x5b3c54(0x137)]&&console[_0x5b3c54(0x147)](_0x5b3c54(0x131)+_0x4794c1[_0x5b3c54(0x137)]),0x1;throw _0x4794c1;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a44_0x271447(0x128)]=a44_0x271447(0xce);['description']=a44_0x271447(0x121);async['execute'](_0x5bf5cf){const _0x5ad73c=a44_0x271447,{options:_0x3c40cd,args:_0x1bfca7,tdx:_0x4d2fd8}=_0x5bf5cf;let _0x5bb682,_0x21855b;if(_0x1bfca7[0x0]){const _0x4f95ea=_0x1bfca7[0x0][_0x5ad73c(0x15c)]('.');if(_0x4f95ea['length']===0x1)_0x5bb682=_0x4f95ea[0x0];else{if(_0x4f95ea[_0x5ad73c(0xd9)]===0x2)[_0x5bb682,_0x21855b]=_0x4f95ea;else return console[_0x5ad73c(0x147)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0xc6ea24=_0x3c40cd[_0x5ad73c(0x13e)];if(_0x3c40cd[_0x5ad73c(0x12c)]){if(_0x5bb682&&_0x21855b)console[_0x5ad73c(0x147)](_0x5ad73c(0x151)+_0x5bb682+'.'+_0x21855b);else _0x5bb682&&console[_0x5ad73c(0x147)](_0x5ad73c(0xdc)+_0x5bb682);_0xc6ea24&&console[_0x5ad73c(0x147)](_0x5ad73c(0xd1));}const _0x3c1346=await withSpinner(_0x5ad73c(0x120),()=>_0x4d2fd8[_0x5ad73c(0xfe)][_0x5ad73c(0x12b)]({'projectName':_0x5bb682,'workflowName':_0x21855b,'includeRetried':_0xc6ea24,'limit':_0x3c40cd['limit']}),{'verbose':_0x3c40cd[_0x5ad73c(0x12c)]}),_0x244aa0=_0x3c1346['data'];return console[_0x5ad73c(0x147)]('✔\x20Found\x20'+_0x244aa0[_0x5ad73c(0xd9)]+'\x20attempt'+(_0x244aa0[_0x5ad73c(0xd9)]!==0x1?'s':'')),await handleSDKOutput(_0x244aa0,_0x3c40cd),0x0;}catch(_0x69f973){if(_0x69f973 instanceof SDKError)return console[_0x5ad73c(0x147)](_0x5ad73c(0x11e)+_0x69f973[_0x5ad73c(0xb3)]),_0x69f973['cause']&&console[_0x5ad73c(0x147)]('\x20\x20Cause:\x20'+_0x69f973[_0x5ad73c(0x137)]),0x1;throw _0x69f973;}}}export class WorkflowAttemptCommand extends BaseCommand{[a44_0x271447(0x128)]=a44_0x271447(0x127);['description']=a44_0x271447(0xec);async[a44_0x271447(0xe1)](_0x18c456){const _0x2be13c=a44_0x271447,{options:_0x300f2d,args:_0x63ec86,tdx:_0x5a8892}=_0x18c456,_0x190f6f=_0x63ec86[0x0];if(!_0x190f6f)return console[_0x2be13c(0x147)](_0x2be13c(0x109)),0x1;try{_0x300f2d[_0x2be13c(0x12c)]&&console[_0x2be13c(0x147)]('Attempt\x20ID:\x20'+_0x190f6f);const _0xca2161=await withSpinner(_0x2be13c(0xae),()=>_0x5a8892['workflow'][_0x2be13c(0xc9)](_0x190f6f),{'verbose':_0x300f2d[_0x2be13c(0x12c)]}),_0x531e5f=_0xca2161[_0x2be13c(0xcd)];let _0x3cc539;!_0x531e5f[_0x2be13c(0x141)]?_0x3cc539=_0x531e5f[_0x2be13c(0x133)]?'canceling':_0x2be13c(0xd8):_0x3cc539=_0x531e5f[_0x2be13c(0x110)]?'success':_0x2be13c(0x147);let _0xaa7c9a;if(_0x531e5f[_0x2be13c(0x123)]&&_0x531e5f[_0x2be13c(0xd0)]){const _0x93afc1=new Date(_0x531e5f[_0x2be13c(0x123)])['getTime'](),_0x43f794=new Date(_0x531e5f[_0x2be13c(0xd0)])[_0x2be13c(0x148)]();_0xaa7c9a=Math[_0x2be13c(0x116)]((_0x43f794-_0x93afc1)/0x3e8);}const _0x3f8d9c={'attempt_id':_0x531e5f['id'],'status':_0x3cc539,..._0x531e5f['index']!==undefined&&{'index':_0x531e5f[_0x2be13c(0x129)]},..._0x531e5f[_0x2be13c(0xf4)]&&{'project':_0x531e5f[_0x2be13c(0xf4)][_0x2be13c(0x128)]},..._0x531e5f['workflow']&&{'workflow':_0x531e5f['workflow'][_0x2be13c(0x128)]},..._0x531e5f['sessionId']&&{'session_id':_0x531e5f[_0x2be13c(0xb5)]},..._0x531e5f[_0x2be13c(0xf9)]&&{'session_time':_0x531e5f[_0x2be13c(0xf9)]},..._0x531e5f[_0x2be13c(0x10d)]&&{'retry_attempt':_0x531e5f[_0x2be13c(0x10d)]},..._0xaa7c9a!==undefined&&{'duration_sec':_0xaa7c9a},..._0x531e5f[_0x2be13c(0x123)]&&{'created_at':_0x531e5f['createdAt']},..._0x531e5f[_0x2be13c(0xd0)]&&{'finished_at':_0x531e5f['finishedAt']},...Object['keys'](_0x531e5f[_0x2be13c(0xf0)])['length']>0x0&&{'params':_0x531e5f['params']}};return await handleSingleObjectOutput(_0x3f8d9c,_0x300f2d),0x0;}catch(_0x18204c){if(_0x18204c instanceof SDKError)return console[_0x2be13c(0x147)](_0x2be13c(0x11e)+_0x18204c[_0x2be13c(0xb3)]),_0x18204c[_0x2be13c(0x137)]&&console[_0x2be13c(0x147)](_0x2be13c(0x131)+_0x18204c[_0x2be13c(0x137)]),0x1;throw _0x18204c;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a44_0x271447(0xde);[a44_0x271447(0x13a)]=a44_0x271447(0xe4);async['execute'](_0x2581b4){const _0xd8661a=a44_0x271447,{options:_0x5e9065,args:_0x5cfae0,tdx:_0x5a65ca}=_0x2581b4,_0x15f336=_0x5cfae0[0x0];if(!_0x15f336)return console['error']('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x587a89=_0x5e9065[_0xd8661a(0x10c)];_0x5e9065[_0xd8661a(0x12c)]&&(console[_0xd8661a(0x147)](_0xd8661a(0x11d)+_0x15f336),_0x587a89&&console['error'](_0xd8661a(0x10a)));const _0x4d062b=await withSpinner(_0xd8661a(0x130),()=>_0x5a65ca[_0xd8661a(0xfe)]['tasks'](_0x15f336,_0x587a89||![]),{'verbose':_0x5e9065[_0xd8661a(0x12c)]}),_0x2d1fc2=_0x4d062b[_0xd8661a(0xcd)];return console[_0xd8661a(0x147)](_0xd8661a(0xc2)+_0x2d1fc2[_0xd8661a(0xd9)]+_0xd8661a(0x107)+(_0x2d1fc2['length']!==0x1?'s':'')),await handleSDKOutput(_0x2d1fc2,_0x5e9065),0x0;}catch(_0x54eff9){if(_0x54eff9 instanceof SDKError)return console['error']('Error:\x20'+_0x54eff9[_0xd8661a(0xb3)]),_0x54eff9['cause']&&console[_0xd8661a(0x147)](_0xd8661a(0x131)+_0x54eff9[_0xd8661a(0x137)]),0x1;throw _0x54eff9;}}}function a44_0x1a3a(_0x166b8c,_0x484563){_0x166b8c=_0x166b8c-0xad;const _0x2d9492=a44_0x2d94();let _0x1a3a7e=_0x2d9492[_0x166b8c];return _0x1a3a7e;}export class WorkflowLogsCommand extends BaseCommand{[a44_0x271447(0x128)]=a44_0x271447(0x12a);[a44_0x271447(0x13a)]=a44_0x271447(0x136);async[a44_0x271447(0xe1)](_0x3225af){const _0x1e28d1=a44_0x271447,{options:_0x196a10,args:_0x2820dd,tdx:_0x3e461c}=_0x3225af,_0x50f105=_0x2820dd[0x0];let _0x1f3787=_0x2820dd[0x1];if(!_0x50f105)return console[_0x1e28d1(0x147)](_0x1e28d1(0x109)),0x1;try{_0x196a10[_0x1e28d1(0x12c)]&&(console['error'](_0x1e28d1(0x11d)+_0x50f105),_0x1f3787&&console[_0x1e28d1(0x147)]('Task\x20name:\x20'+_0x1f3787));const _0x34821c=await withSpinner('Fetching\x20log\x20files...',()=>_0x3e461c[_0x1e28d1(0xfe)][_0x1e28d1(0x14c)](_0x50f105,_0x1f3787),{'verbose':_0x196a10[_0x1e28d1(0x12c)]}),_0x3ad980=_0x34821c['data'];if(_0x3ad980[_0x1e28d1(0xd9)]===0x0)return console[_0x1e28d1(0x147)]('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x1f3787&&(_0x196a10[_0x1e28d1(0x13c)]||_0x196a10[_0x1e28d1(0xbd)]))return await handleSDKOutput(_0x3ad980,_0x196a10),0x0;if(!_0x1f3787){const _0x163109=_0x3ad980[_0x1e28d1(0x119)](_0x162795=>({'title':_0x162795[_0x1e28d1(0xe7)]+'\x20('+formatBytes(_0x162795[_0x1e28d1(0x14e)])+')','value':_0x162795[_0x1e28d1(0xe7)]})),_0xa54e0c=await a44_0x4f8c1e({'type':_0x1e28d1(0xfd),'name':'task','message':_0x1e28d1(0x12e),'choices':_0x163109});if(!_0xa54e0c[_0x1e28d1(0x122)])return console[_0x1e28d1(0x147)]('Cancelled'),0x0;_0x1f3787=_0xa54e0c[_0x1e28d1(0x122)];}const _0xef422e=await withSpinner(_0x1e28d1(0x11b),()=>_0x3e461c['workflow'][_0x1e28d1(0xb6)](_0x50f105,_0x1f3787),{'verbose':_0x196a10[_0x1e28d1(0x12c)]}),_0x323800=_0xef422e['data'];return _0x323800?console[_0x1e28d1(0x144)](_0x323800):console[_0x1e28d1(0x147)](_0x1e28d1(0xc8)),0x0;}catch(_0x2e7e21){if(_0x2e7e21 instanceof SDKError)return console[_0x1e28d1(0x147)](_0x1e28d1(0x11e)+_0x2e7e21[_0x1e28d1(0xb3)]),_0x2e7e21[_0x1e28d1(0x137)]&&console[_0x1e28d1(0x147)]('\x20\x20Cause:\x20'+_0x2e7e21['cause']),0x1;throw _0x2e7e21;}}}export class WorkflowKillCommand extends BaseCommand{[a44_0x271447(0x128)]='workflow:kill';[a44_0x271447(0x13a)]='Kill\x20a\x20running\x20attempt';async[a44_0x271447(0xe1)](_0x148128){const _0x4f018e=a44_0x271447,{options:_0x19d615,args:_0x584af8,tdx:_0x7cbde9}=_0x148128,_0x5dedb3=_0x584af8[0x0];if(!_0x5dedb3)return console[_0x4f018e(0x147)](_0x4f018e(0x109)),0x1;try{const _0x247cce=_0x19d615[_0x4f018e(0xf5)];_0x19d615[_0x4f018e(0x12c)]&&(console[_0x4f018e(0x147)](_0x4f018e(0x11d)+_0x5dedb3),_0x247cce&&console[_0x4f018e(0x147)](_0x4f018e(0x13b)+_0x247cce));if(!_0x19d615[_0x4f018e(0x103)]){const _0x1c3734=await confirm(_0x4f018e(0xbe)+_0x5dedb3+'?');if(!_0x1c3734)return console['error'](_0x4f018e(0x15e)),0x0;}const _0x1ccb2e=await withSpinner(_0x4f018e(0xc4),()=>_0x7cbde9[_0x4f018e(0xfe)][_0x4f018e(0xc0)](_0x5dedb3,_0x247cce),{'verbose':_0x19d615[_0x4f018e(0x12c)]}),_0x58df25=_0x1ccb2e[_0x4f018e(0xcd)];return console[_0x4f018e(0x147)]('✔\x20'+_0x58df25),0x0;}catch(_0x48e167){if(_0x48e167 instanceof SDKError)return console[_0x4f018e(0x147)]('Error:\x20'+_0x48e167[_0x4f018e(0xb3)]),_0x48e167['cause']&&console[_0x4f018e(0x147)](_0x4f018e(0x131)+_0x48e167['cause']),0x1;throw _0x48e167;}}}export class WorkflowRetryCommand extends BaseCommand{[a44_0x271447(0x128)]=a44_0x271447(0xda);[a44_0x271447(0x13a)]=a44_0x271447(0x115);async[a44_0x271447(0xe1)](_0xde2a87){const _0x45ef13=a44_0x271447,{options:_0x27d47e,args:_0x243763,tdx:_0x552c5f}=_0xde2a87,_0x703f49=_0x243763[0x0];if(!_0x703f49)return console[_0x45ef13(0x147)](_0x45ef13(0xf6)),console[_0x45ef13(0x147)](_0x45ef13(0x11c)),0x1;let _0x5b459c=![],_0x1b328e=_0x703f49;if(_0x703f49[_0x45ef13(0xb7)](_0x45ef13(0x150)))_0x5b459c=!![],_0x1b328e=_0x703f49[_0x45ef13(0xee)](0x8);else{if(_0x703f49[_0x45ef13(0xb7)](_0x45ef13(0xbf)))_0x5b459c=![],_0x1b328e=_0x703f49[_0x45ef13(0xee)](0x8);else return console[_0x45ef13(0x147)](_0x45ef13(0xdd)),console[_0x45ef13(0x147)](_0x45ef13(0x11c)),0x1;}try{const _0x2a26a3=_0x27d47e[_0x45ef13(0x113)],_0x476350=_0x27d47e[_0x45ef13(0xed)],_0x4f39dc=_0x27d47e[_0x45ef13(0xf0)],_0x4062c1=_0x27d47e[_0x45ef13(0xd2)];_0x27d47e[_0x45ef13(0x12c)]&&(console['error'](_0x45ef13(0x10e)+(_0x5b459c?_0x45ef13(0x15a):_0x45ef13(0xc9))+'\x20'+_0x1b328e),_0x2a26a3&&console[_0x45ef13(0x147)](_0x45ef13(0xe5)+_0x2a26a3),_0x476350&&console[_0x45ef13(0x147)](_0x45ef13(0xb1)+_0x476350),_0x4f39dc&&console[_0x45ef13(0x147)](_0x45ef13(0xbb)+_0x4f39dc),_0x4062c1&&console['error'](_0x45ef13(0xe3)));let _0x10adf0;if(_0x4f39dc)try{if(_0x4f39dc[_0x45ef13(0xb7)]('@')){const _0x462977=await import(_0x45ef13(0x111)),_0x596bb7=_0x4f39dc[_0x45ef13(0xee)](0x1),_0x1b2c6a=await _0x462977[_0x45ef13(0x104)](_0x596bb7,_0x45ef13(0xc6));_0x10adf0=JSON['parse'](_0x1b2c6a);}else _0x10adf0=JSON[_0x45ef13(0xb9)](_0x4f39dc);}catch{return console['error'](_0x45ef13(0x142)),0x1;}if(!_0x27d47e[_0x45ef13(0x103)]){const _0x1f8c16=await confirm(_0x45ef13(0xba)+(_0x5b459c?_0x45ef13(0x15a):'attempt')+'\x20'+_0x1b328e+'?');if(!_0x1f8c16)return console[_0x45ef13(0x147)]('Cancelled'),0x0;}let _0x5694b8;_0x5b459c?_0x5694b8=await withSpinner('Retrying\x20session...',()=>_0x552c5f[_0x45ef13(0xfe)][_0x45ef13(0x14f)](_0x1b328e,{'fromTask':_0x2a26a3,'retryParams':_0x10adf0}),{'verbose':_0x27d47e[_0x45ef13(0x12c)]}):_0x5694b8=await withSpinner(_0x45ef13(0xfb),()=>_0x552c5f['workflow']['retryAttempt'](_0x1b328e,{'resumeFrom':_0x476350,'retryParams':_0x10adf0,'force':_0x4062c1}),{'verbose':_0x27d47e['verbose']});const _0x43065e=_0x5694b8[_0x45ef13(0xcd)];return console[_0x45ef13(0x147)](_0x45ef13(0xc7)),console['error'](_0x45ef13(0xf3)+_0x43065e[_0x45ef13(0xaf)]),console[_0x45ef13(0x147)]('\x20\x20Session\x20ID:\x20'+_0x43065e[_0x45ef13(0xb5)]),0x0;}catch(_0x352464){if(_0x352464 instanceof SDKError)return console[_0x45ef13(0x147)]('Error:\x20'+_0x352464[_0x45ef13(0xb3)]),_0x352464['cause']&&console['error']('\x20\x20Cause:\x20'+_0x352464[_0x45ef13(0x137)]),0x1;throw _0x352464;}}}export class WorkflowRunCommand extends BaseCommand{[a44_0x271447(0x128)]=a44_0x271447(0xbc);[a44_0x271447(0x13a)]=a44_0x271447(0x157);async[a44_0x271447(0xe1)](_0xcd2458){const _0xd08258=a44_0x271447,{options:_0x5bd1d3,args:_0x112132,tdx:_0x2f630f}=_0xcd2458,_0x22bc5c=_0x112132[0x0];if(!_0x22bc5c)return console[_0xd08258(0x147)](_0xd08258(0x125)),console[_0xd08258(0x147)](_0xd08258(0x100)),0x1;const _0x528259=_0x5bd1d3[_0xd08258(0x153)],_0xcad821=_0x5bd1d3[_0xd08258(0xf9)],_0x39bb23={};if(_0x528259&&Array[_0xd08258(0xef)](_0x528259))for(const _0x1c4af3 of _0x528259){const _0x41fd30=_0x1c4af3[_0xd08258(0xcc)]('=');if(_0x41fd30===-0x1)return console['error']('Error:\x20Invalid\x20parameter\x20format:\x20'+_0x1c4af3),console[_0xd08258(0x147)](_0xd08258(0xeb)),0x1;const _0x5df491=_0x1c4af3[_0xd08258(0xee)](0x0,_0x41fd30),_0x5a837c=_0x1c4af3[_0xd08258(0xee)](_0x41fd30+0x1);try{_0x39bb23[_0x5df491]=JSON[_0xd08258(0xb9)](_0x5a837c);}catch{_0x39bb23[_0x5df491]=_0x5a837c;}}_0x5bd1d3[_0xd08258(0x12c)]&&(console[_0xd08258(0x147)]('Workflow:\x20'+_0x22bc5c),Object[_0xd08258(0xe0)](_0x39bb23)['length']>0x0&&console[_0xd08258(0x147)]('Parameters:\x20'+JSON[_0xd08258(0xff)](_0x39bb23)),_0xcad821&&console[_0xd08258(0x147)](_0xd08258(0x117)+_0xcad821));const _0x23a877=await withSpinner(_0xd08258(0x105),()=>_0x2f630f['workflow'][_0xd08258(0x13d)](_0x22bc5c,_0x39bb23,{'sessionTime':_0xcad821}),{'verbose':_0x5bd1d3['verbose']}),_0x21fbe4=_0x23a877[_0xd08258(0xcd)];return console[_0xd08258(0x147)](_0xd08258(0xc1)),console[_0xd08258(0x147)](_0xd08258(0xd6)+_0x21fbe4['id']),console[_0xd08258(0x147)](_0xd08258(0x102)+_0x21fbe4['sessionId']),console[_0xd08258(0x147)](_0xd08258(0x12f)+_0x21fbe4[_0xd08258(0xf4)]?.[_0xd08258(0x128)]),console[_0xd08258(0x147)](_0xd08258(0xfc)+_0x21fbe4[_0xd08258(0xfe)]?.[_0xd08258(0x128)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a44_0x271447(0x149);[a44_0x271447(0x13a)]=a44_0x271447(0x140);async[a44_0x271447(0xe1)](_0x350c87){const _0x5b9918=a44_0x271447,{options:_0xaead21,args:_0x503bd1,tdx:_0x220b32}=_0x350c87,_0x30c1d7=_0x503bd1[0x0],_0x4a04c4=_0x503bd1[0x1]||'.';if(!_0x30c1d7)return console[_0x5b9918(0x147)](_0x5b9918(0xe6)),console[_0x5b9918(0x147)](_0x5b9918(0x12d)),0x1;const _0x561d40=_0xaead21[_0x5b9918(0x10b)];_0xaead21[_0x5b9918(0x12c)]&&(console[_0x5b9918(0x147)](_0x5b9918(0x101)+_0x30c1d7),console['error']('Output\x20directory:\x20'+_0x4a04c4),_0x561d40&&console[_0x5b9918(0x147)](_0x5b9918(0x139)+_0x561d40));const _0x440045=await withSpinner(_0x5b9918(0xdf)+_0x30c1d7+'...',()=>_0x220b32[_0x5b9918(0xfe)][_0x5b9918(0xcb)](_0x30c1d7,_0x4a04c4,{'revision':_0x561d40}),{'verbose':_0xaead21['verbose']}),_0x5cd4cc=_0x440045['data'];return console[_0x5b9918(0x147)](_0x5b9918(0x15b)+_0x5cd4cc[_0x5b9918(0x154)]),console[_0x5b9918(0x147)](_0x5b9918(0x134)+_0x5cd4cc['revision']),console[_0x5b9918(0x147)](_0x5b9918(0x14d)+_0x5cd4cc[_0x5b9918(0x10f)]),console['error']('\x20\x20Location:\x20'+_0x4a04c4+'/'+_0x5cd4cc[_0x5b9918(0x154)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a44_0x271447(0x128)]=a44_0x271447(0xfa);[a44_0x271447(0x13a)]=a44_0x271447(0xd3);async['execute'](_0x4f7190){const _0x4106b6=a44_0x271447,{options:_0x4459f5,args:_0x547981,tdx:_0x4bfe6a}=_0x4f7190;let _0x1a2806='.',_0x2ec197=_0x4459f5['name'];if(_0x547981[0x0]){const {promises:_0x33e313}=await import('fs');try{const _0x2adc85=await _0x33e313[_0x4106b6(0xad)](_0x547981[0x0]);if(_0x2adc85['isDirectory']())_0x1a2806=_0x547981[0x0];else return console[_0x4106b6(0x147)](_0x4106b6(0x11e)+_0x547981[0x0]+_0x4106b6(0x159)),0x1;}catch{_0x2ec197=_0x547981[0x0],_0x1a2806='.';}}const _0x460f46=_0x4459f5[_0x4106b6(0x10b)],_0x4ae9e1=_0x4459f5[_0x4106b6(0xea)];_0x4459f5[_0x4106b6(0x12c)]&&(console['error'](_0x4106b6(0xdb)+_0x1a2806),_0x2ec197&&console[_0x4106b6(0x147)](_0x4106b6(0xc3)+_0x2ec197),_0x460f46&&console[_0x4106b6(0x147)](_0x4106b6(0x139)+_0x460f46),_0x4ae9e1&&console[_0x4106b6(0x147)]('Validation:\x20skipped'));const _0x5e1890=await withSpinner(_0x4106b6(0x145),()=>_0x4bfe6a[_0x4106b6(0xfe)][_0x4106b6(0xe9)](_0x1a2806,{'projectName':_0x2ec197,'revision':_0x460f46,'skipValidation':_0x4ae9e1}),{'verbose':_0x4459f5[_0x4106b6(0x12c)]}),_0x5ec865=_0x5e1890[_0x4106b6(0xcd)];return console[_0x4106b6(0x147)](_0x4106b6(0xf8)+_0x5ec865['projectName']),console[_0x4106b6(0x147)]('\x20\x20Project\x20ID:\x20'+_0x5ec865[_0x4106b6(0x14a)]),console['error'](_0x4106b6(0x134)+_0x5ec865[_0x4106b6(0x10b)]),0x0;}}function a44_0x2d94(){const _0x205a86=['Pushing\x20workflow\x20project...','20969616psMdrO','error','getTime','workflow:download','projectId','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','logFiles','\x20\x20Files\x20extracted:\x20','fileSize','retrySession','session:','Filter:\x20','List\x20all\x20workflow\x20projects','param','projectName','46590LipLOZ','...','Start\x20a\x20workflow\x20run','Listing\x20workflow\x20projects...','\x20is\x20not\x20a\x20directory','session','✔\x20Downloaded\x20','split','\x20workflow','Cancelled','stat','Getting\x20attempt\x20details...','attemptId','delete','Resume\x20from:\x20','Deleting\x20project\x20','message','387FJFEkR','sessionId','logs','startsWith','40695mgmiHB','parse','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Params:\x20','workflow:run','format','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','attempt:','kill','✔\x20Workflow\x20run\x20started','✔\x20Found\x20','Project\x20name:\x20','Killing\x20attempt...','Status:\x20','utf-8','✔\x20Retry\x20started','No\x20log\x20content\x20found','attempt','3763125SZMqkt','download','indexOf','data','workflow:attempts','5834hCoXZY','finishedAt','Include\x20retried:\x20yes','force','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','8MjrcIz','Listing\x20workflow\x20sessions...','\x20\x20Attempt\x20ID:\x20','276riymIP','running','length','workflow:retry','Project\x20directory:\x20','Filter:\x20project=','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','workflow:tasks','Downloading\x20project\x20','keys','execute','\x20session','Force:\x20yes','Show\x20tasks\x20for\x20an\x20attempt','From\x20task:\x20','Error:\x20Project\x20name\x20is\x20required','taskName','1529KxoFma','push','skipValidation','Expected\x20format:\x20--param\x20key=value','Show\x20specific\x20attempt\x20details','resumeFrom','substring','isArray','params','from','workflows','\x20\x20New\x20attempt\x20ID:\x20','project','reason','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','workflow:workflows','✔\x20Pushed\x20','sessionTime','workflow:push','Retrying\x20attempt...','\x20\x20Workflow:\x20','select','workflow','stringify','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','Project:\x20','\x20\x20Session\x20ID:\x20','yes','readFile','Starting\x20workflow\x20run...','4CvUxNP','\x20task','\x20\x20Project\x20ID:\x20','Error:\x20Attempt\x20ID\x20is\x20required','Including\x20subtasks:\x20yes','revision','includeSubtasks','retryAttemptName','Target:\x20','filesExtracted','success','fs/promises','projects','fromTask','Pattern:\x20','Retry\x20a\x20session\x20or\x20attempt','round','Session\x20time:\x20','limit','map','Listing\x20workflows...','Downloading\x20logs...','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Attempt\x20ID:\x20','Error:\x20','56014AkbsJl','Listing\x20workflow\x20attempts...','List\x20workflow\x20attempts','task','createdAt','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Error:\x20Workflow\x20identifier\x20is\x20required','6633801oLZxjS','workflow:attempt','name','index','workflow:logs','attempts','verbose','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Select\x20a\x20task\x20to\x20view\x20logs:','\x20\x20Project:\x20','Getting\x20attempt\x20tasks...','\x20\x20Cause:\x20','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','cancelRequested','\x20\x20Revision:\x20','workflow:sessions','Show\x20logs\x20for\x20a\x20workflow\x20attempt','cause','Usage:\x20workflow:delete\x20<project-name-or-id>','Revision:\x20','description','Reason:\x20','json','run','includeRetried','status','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','done','Error:\x20Invalid\x20JSON\x20in\x20--params','\x22?\x20This\x20cannot\x20be\x20undone.','log'];a44_0x2d94=function(){return _0x205a86;};return a44_0x2d94();}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x271447(0x128)]='workflow:delete';[a44_0x271447(0x13a)]='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a44_0x271447(0xe1)](_0x54f39e){const _0x29fed9=a44_0x271447,{options:_0xb45b2c,args:_0x15addd,tdx:_0x4b49a6}=_0x54f39e,_0x36661a=_0x15addd[0x0];if(!_0x36661a)return console[_0x29fed9(0x147)](_0x29fed9(0x132)),console[_0x29fed9(0x147)](_0x29fed9(0x138)),0x1;_0xb45b2c['verbose']&&console['error']('Project:\x20'+_0x36661a);if(!_0xb45b2c[_0x29fed9(0x103)]){const _0x304e72=await confirm(_0x29fed9(0x14b)+_0x36661a+_0x29fed9(0x143));if(!_0x304e72)return console[_0x29fed9(0x147)](_0x29fed9(0x15e)),0x0;}const _0x52d3cb=await withSpinner(_0x29fed9(0xb2)+_0x36661a+_0x29fed9(0x156),()=>_0x4b49a6[_0x29fed9(0xfe)][_0x29fed9(0xb0)](_0x36661a),{'verbose':_0xb45b2c['verbose']}),_0x5bafdf=_0x52d3cb[_0x29fed9(0xcd)];return console[_0x29fed9(0x147)]('✔\x20Deleted\x20project\x20'+_0x5bafdf[_0x29fed9(0x154)]),console[_0x29fed9(0x147)](_0x29fed9(0x108)+_0x5bafdf[_0x29fed9(0x14a)]),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(_0x18714a,_0x1ad61f){const _0x57166b=a46_0x4b59,_0xc9e4d4=_0x18714a();while(!![]){try{const _0x2cacfe=-parseInt(_0x57166b(0xb6))/0x1+-parseInt(_0x57166b(0xa8))/0x2*(-parseInt(_0x57166b(0xc5))/0x3)+parseInt(_0x57166b(0xca))/0x4*(-parseInt(_0x57166b(0x9c))/0x5)+-parseInt(_0x57166b(0xb7))/0x6+parseInt(_0x57166b(0xb3))/0x7+parseInt(_0x57166b(0x92))/0x8+parseInt(_0x57166b(0xc1))/0x9*(parseInt(_0x57166b(0x86))/0xa);if(_0x2cacfe===_0x1ad61f)break;else _0xc9e4d4['push'](_0xc9e4d4['shift']());}catch(_0x50ac9e){_0xc9e4d4['push'](_0xc9e4d4['shift']());}}}(a46_0x31ba,0x7d344));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x564d42 from'node:fs';import*as a46_0x4750fb 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_0x587f12 from'chalk';export function getConfigDir(){const _0x1c44b8=a46_0x4b59;return process['env'][_0x1c44b8(0x94)]||join(homedir(),'.config',_0x1c44b8(0xb2));}function a46_0x31ba(){const _0x35d5e8=['3VwjVax','stg-ap03','\x27,\x20defaulting\x20to\x20us01','TD_API_KEY\x20env\x20var\x20(deprecated)','split','4WLjwVF','TD_API_KEY','dev-us01','TDX_API_KEY\x20env\x20var','string','entries','stringify','eu01','.env.','account_info.','keychain','30CMbshc','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','startsWith','slice','.env','utf-8','includes','some','readFileSync','name','.json','env','7237408UHMYWi','parse','TDX_CONFIG_DIR','warn','jp01','us01','\x20env\x20var','account_info.json','yellow','tdx.json','1444510nwsXxn','replace','.cache','accountId','Warning:\x20Unknown\x20site\x20\x27','llm_default_project','match','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','keychain\x20(profile:\x20','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','join','131286SgZgyP','projectId','TDX_API_KEY','ap03','apiKeys','toISOString','toUpperCase','ap02','legacy\x20.env\x20file\x20(profile:\x20','stg-jp01','tdx','5510400hfrPFb','dev-eu01','TDX_API_KEY_<PROFILE>','389820yakYOq','4979244CRsHVB','existsSync','trim','source','endsWith','isDeprecated','TD_API_KEY_','legacy\x20.env\x20file','Warning:\x20Failed\x20to\x20load\x20','Warning:\x20Failed\x20to\x20read\x20','791739ckwBji','TDX_API_KEY_','stg-us01','profile'];a46_0x31ba=function(){return _0x35d5e8;};return a46_0x31ba();}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x5660ab){const _0x13d7a6=a46_0x4b59,_0xdec8dc=getConfigDir();return _0x5660ab?a46_0x4750fb[_0x13d7a6(0xa7)](_0xdec8dc,_0x13d7a6(0x83)+_0x5660ab):getConfigFile();}export function getCacheDir(){const _0x4c4665=a46_0x4b59;return process[_0x4c4665(0x91)]['TDX_CACHE_DIR']||join(homedir(),_0x4c4665(0x9e),'tdx');}export function getLLMProjectCacheFile(_0xc4d4b4){const _0xef57f0=a46_0x4b59,_0x4f2f7a=_0xc4d4b4?'llm_default_project.'+_0xc4d4b4:_0xef57f0(0xa1);return join(getCacheDir(),_0x4f2f7a);}export function readCachedLLMProject(_0x3f1316){const _0x5de7b3=a46_0x4b59;try{const _0x3a1986=getLLMProjectCacheFile(_0x3f1316);if(!existsSync(_0x3a1986))return null;const _0xea2ad0=readFileSync(_0x3a1986,'utf-8')[_0x5de7b3(0xb9)]();try{const _0x675454=JSON[_0x5de7b3(0x93)](_0xea2ad0);if(_0x675454&&typeof _0x675454['id']===_0x5de7b3(0xce)&&typeof _0x675454[_0x5de7b3(0x8f)]===_0x5de7b3(0xce))return _0x675454;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x11a504,_0x3d14ce,_0x114bc3){try{const _0x5db0ab=getCacheDir(),_0x2b45ac=getLLMProjectCacheFile(_0x114bc3);!existsSync(_0x5db0ab)&&mkdirSync(_0x5db0ab,{'recursive':!![]});const _0x250370={'name':_0x11a504,'id':_0x3d14ce};writeFileSync(_0x2b45ac,JSON['stringify'](_0x250370),'utf-8');}catch{}}function a46_0x4b59(_0x4dca63,_0x1fdb98){_0x4dca63=_0x4dca63-0x81;const _0x31ba8e=a46_0x31ba();let _0x4b592d=_0x31ba8e[_0x4dca63];return _0x4b592d;}export function getLLMAgentCacheFile(_0x4b3aea){const _0x5033f5=_0x4b3aea?'llm_default_agent.'+_0x4b3aea:'llm_default_agent';return join(getCacheDir(),_0x5033f5);}export function readCachedLLMAgent(_0x4c5eb0){const _0x5b4d90=a46_0x4b59;try{const _0x8ac50f=getLLMAgentCacheFile(_0x4c5eb0);if(!existsSync(_0x8ac50f))return null;const _0x285567=readFileSync(_0x8ac50f,'utf-8')[_0x5b4d90(0xb9)]();try{const _0x4f6bed=JSON['parse'](_0x285567);if(_0x4f6bed&&typeof _0x4f6bed['id']==='string'&&typeof _0x4f6bed['name']===_0x5b4d90(0xce)&&typeof _0x4f6bed[_0x5b4d90(0xa9)]==='string')return _0x4f6bed;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x36c15c,_0x18fddc,_0xedac4f,_0x517729){try{const _0x39b9a6=getCacheDir(),_0x216605=getLLMAgentCacheFile(_0x517729);!existsSync(_0x39b9a6)&&mkdirSync(_0x39b9a6,{'recursive':!![]});const _0x514d73={'name':_0x36c15c,'id':_0x18fddc,'projectId':_0xedac4f};writeFileSync(_0x216605,JSON['stringify'](_0x514d73),'utf-8');}catch{}}export function clearCachedLLMAgent(_0x5ba215){try{const _0x4222dc=getLLMAgentCacheFile(_0x5ba215);existsSync(_0x4222dc)&&unlinkSync(_0x4222dc);}catch{}}export function getAccountInfoCacheFile(_0x44edf9){const _0x1d62ae=a46_0x4b59,_0x7c1293=_0x44edf9?_0x1d62ae(0x84)+_0x44edf9+_0x1d62ae(0x90):_0x1d62ae(0x99);return join(getCacheDir(),_0x7c1293);}export function readCachedAccountInfo(_0x275df1){const _0x4e85fa=a46_0x4b59;try{const _0x11d447=getAccountInfoCacheFile(_0x275df1);if(!existsSync(_0x11d447))return null;const _0x551ca6=readFileSync(_0x11d447,'utf-8')[_0x4e85fa(0xb9)](),_0x5cd76b=JSON[_0x4e85fa(0x93)](_0x551ca6);if(_0x5cd76b&&typeof _0x5cd76b['site']===_0x4e85fa(0xce)&&typeof _0x5cd76b[_0x4e85fa(0x9f)]==='number')return _0x5cd76b;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x4a9a9c,_0xc6640d,_0x429444){const _0x12bd76=a46_0x4b59;try{const _0x4968db=getCacheDir(),_0x382ac9=getAccountInfoCacheFile(_0x429444);!existsSync(_0x4968db)&&mkdirSync(_0x4968db,{'recursive':!![]});const _0x20b8cb={'site':_0x4a9a9c,'accountId':_0xc6640d,'cachedAt':new Date()[_0x12bd76(0xad)]()};writeFileSync(_0x382ac9,JSON[_0x12bd76(0x81)](_0x20b8cb),_0x12bd76(0x8b));}catch{}}export function parseEnvFile(_0x2b69ba){const _0x30a20c=a46_0x4b59,_0x35b658={};for(const _0x4e8a87 of _0x2b69ba[_0x30a20c(0xc9)]('\x0a')){const _0x34b3b3=_0x4e8a87[_0x30a20c(0xb9)]();if(!_0x34b3b3||_0x34b3b3[_0x30a20c(0x88)]('#'))continue;const _0x2aae28=_0x34b3b3[_0x30a20c(0xa2)](/^([^=]+)=(.*)$/);if(_0x2aae28){const _0x3a2567=_0x2aae28[0x1]['trim']();let _0x59c0de=_0x2aae28[0x2][_0x30a20c(0xb9)]();(_0x59c0de['startsWith']('\x22')&&_0x59c0de[_0x30a20c(0xbb)]('\x22')||_0x59c0de['startsWith']('\x27')&&_0x59c0de[_0x30a20c(0xbb)]('\x27'))&&(_0x59c0de=_0x59c0de[_0x30a20c(0x89)](0x1,-0x1)),_0x35b658[_0x3a2567]=_0x59c0de;}}return _0x35b658;}export function readUserConfig(){const _0x4b7fe8=a46_0x4b59,_0x25e36d=getConfigFile();if(!existsSync(_0x25e36d))return{};try{const _0x2e0bf5=readFileSync(_0x25e36d,_0x4b7fe8(0x8b));return parseEnvFile(_0x2e0bf5);}catch(_0x199e88){return console[_0x4b7fe8(0x95)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x25e36d+':',_0x199e88),{};}}export function resolveSite(_0x57a19b){const _0x284a46=a46_0x4b59,_0x2807ec=[_0x284a46(0x97),_0x284a46(0x96),'eu01',_0x284a46(0xaf),_0x284a46(0xab),_0x284a46(0xcc),_0x284a46(0xb4),_0x284a46(0xc3),_0x284a46(0xb1),_0x284a46(0xc6)];if(_0x2807ec[_0x284a46(0x8c)](_0x57a19b))return _0x57a19b;if(_0x57a19b in SITE_ALIASES)return SITE_ALIASES[_0x57a19b];return console['warn'](_0x284a46(0xa0)+_0x57a19b+_0x284a46(0xc7)),_0x284a46(0x97);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2da2f2,_0x247663){const _0x5c6305=a46_0x4b59,_0x19d859=_0x247663||getActiveProfileName();if(_0x19d859){const _0x256e7a=_0x5c6305(0xc2)+normalizeProfileForEnvVar(_0x19d859);if(process['env'][_0x256e7a])return process[_0x5c6305(0x91)][_0x256e7a];}if(process[_0x5c6305(0x91)][_0x5c6305(0xaa)])return process[_0x5c6305(0x91)]['TDX_API_KEY'];if(process[_0x5c6305(0x91)][_0x5c6305(0xcb)])return process[_0x5c6305(0x91)]['TD_API_KEY'];const _0xb39454=_0x2da2f2['toUpperCase']()['replace'](/-/g,'_'),_0x45c1ad=_0x5c6305(0xbd)+_0xb39454;if(_0x19d859){const _0x1360fb=loadProfileEnv(_0x19d859);if(_0x1360fb){if(_0x1360fb[_0x45c1ad])return _0x1360fb[_0x45c1ad];if(_0x1360fb[_0x5c6305(0xcb)])return _0x1360fb[_0x5c6305(0xcb)];}}const _0x1b7326=loadUserConfigOnce();if(_0x1b7326[_0x45c1ad])return _0x1b7326[_0x45c1ad];if(_0x1b7326[_0x5c6305(0xcb)])return _0x1b7326['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x4540af){const _0x7697bc=a46_0x4b59;return _0x4540af[_0x7697bc(0xae)]()[_0x7697bc(0x9d)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x497c95,_0x2d18ee){const _0x22e324=a46_0x4b59,_0x174c19=_0x2d18ee||getActiveProfileName()||undefined;if(_0x174c19){const _0x316173=_0x22e324(0xc2)+normalizeProfileForEnvVar(_0x174c19);if(process[_0x22e324(0x91)][_0x316173])return{'apiKey':process[_0x22e324(0x91)][_0x316173],'source':_0x316173+_0x22e324(0x98),'isDeprecated':![]};const _0x11ca59=getCachedCredential(_0x497c95,_0x174c19);if(_0x11ca59)return{'apiKey':_0x11ca59,'source':_0x22e324(0xa5)+_0x174c19+')','isDeprecated':![]};const _0xc1446b=await getKeychainAPIKey(_0x174c19);if(_0xc1446b)return setCachedCredential(_0xc1446b,_0x497c95,_0x174c19),{'apiKey':_0xc1446b,'source':'keychain\x20(profile:\x20'+_0x174c19+')','isDeprecated':![]};}if(process[_0x22e324(0x91)][_0x22e324(0xaa)])return{'apiKey':process['env']['TDX_API_KEY'],'source':_0x22e324(0xcd),'isDeprecated':![]};if(!_0x174c19){const _0x3c69db=getCachedCredential(_0x497c95,undefined);if(_0x3c69db)return{'apiKey':_0x3c69db,'source':_0x22e324(0x85),'isDeprecated':![]};const _0x369447=await getKeychainAPIKey(undefined);if(_0x369447)return setCachedCredential(_0x369447,_0x497c95,undefined),{'apiKey':_0x369447,'source':_0x22e324(0x85),'isDeprecated':![]};}if(process[_0x22e324(0x91)][_0x22e324(0xcb)])return{'apiKey':process['env'][_0x22e324(0xcb)],'source':_0x22e324(0xc8),'isDeprecated':!![]};const _0x13a799=getLegacyEnvAPIKey(_0x497c95,_0x174c19);if(_0x13a799){const _0x2ca193=await isKeychainAvailable();if(_0x2ca193)try{await saveKeychainAPIKey(_0x13a799,_0x174c19),setCachedCredential(_0x13a799,_0x497c95,_0x174c19);const _0x530f54=getConfigFilePath(_0x174c19);cleanupLegacyEnvFile(_0x530f54)&&console['warn'](a46_0x587f12[_0x22e324(0x9a)](_0x22e324(0x87)));}catch(_0x3b9c7a){console[_0x22e324(0x95)](a46_0x587f12['yellow'](_0x22e324(0xa6)+_0x3b9c7a));}const _0x366e90=_0x174c19?_0x22e324(0xb0)+_0x174c19+')':_0x22e324(0xbe);return{'apiKey':_0x13a799,'source':_0x366e90,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x5c2511,_0x51dba0,_0x11ac0d=!![]){const _0x59584a=a46_0x4b59,_0x37552f=await resolveAPIKeyAsync(_0x5c2511,_0x51dba0);if(!_0x37552f)return undefined;if(_0x11ac0d&&_0x37552f[_0x59584a(0xbc)]&&_0x37552f[_0x59584a(0xba)][_0x59584a(0x8c)](_0x59584a(0xcb))){const _0x2c75c3=_0x51dba0||getActiveProfileName()||undefined,_0x2379b0=_0x2c75c3?_0x59584a(0xc2)+normalizeProfileForEnvVar(_0x2c75c3):_0x59584a(0xb5);console[_0x59584a(0x95)](a46_0x587f12[_0x59584a(0x9a)](_0x59584a(0xa4)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x2379b0+').')));}return _0x37552f['apiKey'];}function getLegacyEnvAPIKey(_0x5616cc,_0x50a907){const _0x3b0894=a46_0x4b59,_0x3b9f95=_0x5616cc[_0x3b0894(0xae)]()[_0x3b0894(0x9d)](/-/g,'_'),_0x3a2af1=_0x3b0894(0xbd)+_0x3b9f95;if(_0x50a907){const _0x594dd6=loadProfileEnv(_0x50a907);if(_0x594dd6){if(_0x594dd6[_0x3a2af1])return _0x594dd6[_0x3a2af1];if(_0x594dd6[_0x3b0894(0xcb)])return _0x594dd6['TD_API_KEY'];}}const _0x4fcdf1=loadUserConfigOnce();if(_0x4fcdf1[_0x3a2af1])return _0x4fcdf1[_0x3a2af1];if(_0x4fcdf1[_0x3b0894(0xcb)])return _0x4fcdf1['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0x3d9443){const _0x31ccdd=a46_0x4b59;if(!existsSync(_0x3d9443))return![];try{const _0x294f0c=readFileSync(_0x3d9443,_0x31ccdd(0x8b)),_0xd20ac1=_0x294f0c[_0x31ccdd(0xc9)]('\x0a'),_0x1b8474=_0xd20ac1['filter'](_0x45357c=>{const _0x41738f=_0x31ccdd,_0x5b2a45=_0x45357c[_0x41738f(0xb9)]();if(!_0x5b2a45||_0x5b2a45['startsWith']('#'))return!![];const [_0x3b322a]=_0x5b2a45[_0x41738f(0xc9)]('=');return!_0x3b322a['startsWith'](_0x41738f(0xcb));}),_0x516066=_0x1b8474[_0x31ccdd(0x8d)](_0x33fa90=>{const _0x619708=_0x31ccdd,_0x601497=_0x33fa90[_0x619708(0xb9)]();return _0x601497&&!_0x601497[_0x619708(0x88)]('#');});if(!_0x516066)return unlinkSync(_0x3d9443),!![];return writeFileSync(_0x3d9443,_0x1b8474[_0x31ccdd(0xa7)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x3a35e6){const _0x59b368=a46_0x4b59,_0x428c4e=a46_0x4750fb[_0x59b368(0xa7)](getConfigDir(),_0x59b368(0x83)+_0x3a35e6);if(a46_0x564d42[_0x59b368(0xb8)](_0x428c4e)){validateSecureFilePermissions(_0x428c4e);try{const _0x9a470f=a46_0x564d42[_0x59b368(0x8e)](_0x428c4e,'utf-8');return parseEnvFile(_0x9a470f);}catch(_0x299fec){console[_0x59b368(0x95)](_0x59b368(0xbf)+_0x428c4e+':\x20'+_0x299fec);}}const _0x227ce8=a46_0x4750fb[_0x59b368(0xa7)](getConfigDir(),'profiles',_0x3a35e6,_0x59b368(0x8a));if(a46_0x564d42[_0x59b368(0xb8)](_0x227ce8)){validateSecureFilePermissions(_0x227ce8);try{const _0x196773=a46_0x564d42['readFileSync'](_0x227ce8,_0x59b368(0x8b));return parseEnvFile(_0x196773);}catch(_0x5c601d){return console[_0x59b368(0x95)](_0x59b368(0xbf)+_0x227ce8+':\x20'+_0x5c601d),null;}}return null;}function getActiveProfileName(){const _0x9cb9be=a46_0x4b59,_0x3651ba=a46_0x4750fb[_0x9cb9be(0xa7)](getConfigDir(),_0x9cb9be(0x9b));if(!a46_0x564d42['existsSync'](_0x3651ba))return null;try{const _0x2d08d6=a46_0x564d42[_0x9cb9be(0x8e)](_0x3651ba,_0x9cb9be(0x8b)),_0x5b9b33=JSON[_0x9cb9be(0x93)](_0x2d08d6);return _0x5b9b33[_0x9cb9be(0xc4)]||null;}catch{return null;}}export function saveAPIKey(_0x354816,_0x149f57,_0x393d58){const _0xbf8aa0=a46_0x4b59,_0xd3be5=getConfigDir(),_0x35abef=getConfigFilePath(_0x393d58);!existsSync(_0xd3be5)&&mkdirSync(_0xd3be5,{'recursive':!![],'mode':0x1c0});let _0x35122f={};if(existsSync(_0x35abef))try{const _0x28e375=readFileSync(_0x35abef,'utf-8');_0x35122f=parseEnvFile(_0x28e375);}catch(_0x4e7cf8){console['warn'](_0xbf8aa0(0xc0)+_0x35abef+':',_0x4e7cf8);}const _0x50f04f=_0x354816['toUpperCase']()[_0xbf8aa0(0x9d)](/-/g,'_');_0x35122f[_0xbf8aa0(0xbd)+_0x50f04f]=_0x149f57;const _0x3c3168=Object[_0xbf8aa0(0xcf)](_0x35122f)['map'](([_0x2746c7,_0x5d35ff])=>_0x2746c7+'='+_0x5d35ff);writeFileSync(_0x35abef,_0x3c3168[_0xbf8aa0(0xa7)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0xea2943,_0x177a3c,_0x32cf58){const _0x5aeda1=a46_0x4b59;await saveKeychainAPIKey(_0xea2943,_0x32cf58),setCachedCredential(_0xea2943,_0x177a3c,_0x32cf58);const _0x3b9cbc=getConfigFilePath(_0x32cf58);cleanupLegacyEnvFile(_0x3b9cbc)&&console[_0x5aeda1(0x95)](a46_0x587f12[_0x5aeda1(0x9a)](_0x5aeda1(0xa3)));}export function loadConfig(){const _0x46196e=a46_0x4b59,_0x5bd0e2={'apiKeys':{},'defaultSite':_0x46196e(0x97)},_0x33ddc4=[_0x46196e(0x97),'jp01',_0x46196e(0x82),'ap02',_0x46196e(0xab),_0x46196e(0xcc),_0x46196e(0xb4),_0x46196e(0xc3),_0x46196e(0xb1),'stg-ap03'];for(const _0x1f163f of _0x33ddc4){const _0xc5b5b2=getAPIKey(_0x1f163f);_0xc5b5b2&&(_0x5bd0e2[_0x46196e(0xac)][_0x1f163f]=_0xc5b5b2);}return _0x5bd0e2;}
|
|
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
|
-
|
|
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
|
-
const a49_0x50363a=a49_0x1d74;(function(_0x4ef9bf,_0x4a2428){const _0x5ab585=a49_0x1d74,_0x5bffc8=_0x4ef9bf();while(!![]){try{const _0x5ae1c9=parseInt(_0x5ab585(0x18f))/0x1+-parseInt(_0x5ab585(0x1b2))/0x2*(-parseInt(_0x5ab585(0x1a3))/0x3)+-parseInt(_0x5ab585(0x18d))/0x4*(parseInt(_0x5ab585(0x1b5))/0x5)+-parseInt(_0x5ab585(0x18c))/0x6+-parseInt(_0x5ab585(0x18a))/0x7+-parseInt(_0x5ab585(0x190))/0x8*(-parseInt(_0x5ab585(0x1c3))/0x9)+parseInt(_0x5ab585(0x18b))/0xa;if(_0x5ae1c9===_0x4a2428)break;else _0x5bffc8['push'](_0x5bffc8['shift']());}catch(_0x32fe32){_0x5bffc8['push'](_0x5bffc8['shift']());}}}(a49_0x37af,0x4212e));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a49_0x1d74(_0xa42ea3,_0x1227e5){_0xa42ea3=_0xa42ea3-0x181;const _0x37af9e=a49_0x37af();let _0x1d7402=_0x37af9e[_0xa42ea3];return _0x1d7402;}import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a49_0x37af(){const _0x7b600=['site','default','apiKey','utf-8','829983gGekQC','3206780ulhmOY','2401788procNL','65672ghQcoQ','config','20891TkzdEl','371264teFKBY','Profile\x20Credentials','[context]','llm_agent','project','displayWithSources','CLI\x20flag:\x20--','loadGlobalConfig','Global\x20Credentials','display','.json','parentSegment','globalCredentials','verbose','sessionId','readFileSync','profile','.env','llm_project','8274oShpDw','\x0a[configuration\x20files]',':\x20none','tdx.json','llmAgent','createAsync','layers','replace','injectIntoOptions','profileCredentials','segment_path','activeProfile','profile:\x20','log','llmProject','288kpStCo','segmentPath','Global','140JzoUfm','(session:\x20','Project','(active)','parent_segment','us01','cliFlags','configFiles','join','resolveAPIKeyAsync','parse','existsSync','session','getSource','99ylADmj','database','sessions',':\x20none\x20(using\x20session:\x20','global','string','getParameters','logLevel','profiles'];a49_0x37af=function(){return _0x7b600;};return a49_0x37af();}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a49_0x43804 from'node:fs';import*as a49_0x492958 from'node:path';export class GlobalContext{[a49_0x50363a(0x186)];[a49_0x50363a(0x1c4)];[a49_0x50363a(0x1b9)];['segment_path'];[a49_0x50363a(0x1a2)];[a49_0x50363a(0x193)];[a49_0x50363a(0x188)];[a49_0x50363a(0x19d)];['logLevel'];[a49_0x50363a(0x1a0)];[a49_0x50363a(0x1a9)];['activeProfile'];[a49_0x50363a(0x19e)];['configFiles'];constructor(_0xbd8015){const _0x41190b=a49_0x50363a;this['sessionId']=_0xbd8015[_0x41190b(0x1c1)]||getCurrentSessionPID()['toString']();const _0x47cce8=loadSessionContext(_0xbd8015['session']),_0x291291=loadProjectConfig(),_0x53523f=this[_0x41190b(0x197)]();this[_0x41190b(0x1ae)]=_0xbd8015[_0x41190b(0x1a0)]||_0x47cce8?.[_0x41190b(0x1a0)]||_0x53523f[_0x41190b(0x1a0)]||getActiveProfile();const _0x50923a=this[_0x41190b(0x1ae)]?loadProfile(this['activeProfile']):null,_0x384d01=_0x45f907=>{const _0x252b88=_0x41190b;if(!_0x45f907)return{};const _0x5db94=_0x45f907,_0x1d1e66={};for(const [_0xf7d842,_0x406aa4]of Object['entries'](_0x5db94)){typeof _0x406aa4===_0x252b88(0x182)&&(_0x1d1e66[_0xf7d842]=_0x406aa4);}return _0x1d1e66;},_0x279d7c={};if(_0xbd8015[_0x41190b(0x186)]&&_0xbd8015['site']!=='us01')_0x279d7c[_0x41190b(0x186)]=_0xbd8015[_0x41190b(0x186)];const _0x35bacb=_0x47cce8?.['database'],_0x5a9be1=_0x291291?.[_0x41190b(0x1c4)],_0x4916d3=_0x50923a?.[_0x41190b(0x18e)]?.[_0x41190b(0x1c4)],_0x38f8af=_0x53523f['database'];_0xbd8015[_0x41190b(0x1c4)]&&(_0xbd8015['database']!==_0x35bacb&&_0xbd8015[_0x41190b(0x1c4)]!==_0x5a9be1&&_0xbd8015[_0x41190b(0x1c4)]!==_0x4916d3&&_0xbd8015[_0x41190b(0x1c4)]!==_0x38f8af)&&(_0x279d7c[_0x41190b(0x1c4)]=_0xbd8015[_0x41190b(0x1c4)]);if(_0xbd8015[_0x41190b(0x19b)])_0x279d7c[_0x41190b(0x1b9)]=_0xbd8015[_0x41190b(0x19b)];if(_0xbd8015[_0x41190b(0x1b1)])_0x279d7c[_0x41190b(0x1a2)]=_0xbd8015[_0x41190b(0x1b1)];if(_0xbd8015[_0x41190b(0x1a7)])_0x279d7c[_0x41190b(0x193)]=_0xbd8015['llmAgent'];if(_0xbd8015[_0x41190b(0x1a0)])_0x279d7c[_0x41190b(0x1a0)]=_0xbd8015['profile'];this['layers']={'cliFlags':_0x279d7c,'session':_0x384d01(_0x47cce8),'project':_0x384d01(_0x291291),'profile':_0x384d01(_0x50923a?.[_0x41190b(0x18e)]),'global':_0x384d01(_0x53523f)};const _0x4b51a9={...this[_0x41190b(0x1a9)][_0x41190b(0x181)],...this['layers'][_0x41190b(0x1a0)],...this[_0x41190b(0x1a9)]['project'],...this[_0x41190b(0x1a9)][_0x41190b(0x1c1)],...this['layers']['cliFlags']},_0x4c1a61=_0x4b51a9['site']||_0x41190b(0x1ba);this[_0x41190b(0x186)]=resolveSite(_0x4c1a61),this[_0x41190b(0x1c4)]=_0x4b51a9[_0x41190b(0x1c4)],this['parent_segment']=_0x4b51a9[_0x41190b(0x1b9)],this[_0x41190b(0x1ad)]=_0x4b51a9[_0x41190b(0x1ad)],this[_0x41190b(0x1a2)]=_0x4b51a9[_0x41190b(0x1a2)],this['llm_agent']=_0x4b51a9[_0x41190b(0x193)],this[_0x41190b(0x19d)]=_0xbd8015[_0x41190b(0x19d)]||![],this['logLevel']=_0xbd8015[_0x41190b(0x184)]??LogLevel['INFO'],this[_0x41190b(0x1a0)]=this[_0x41190b(0x1ae)]||undefined,this['apiKey']=getAPIKey(this[_0x41190b(0x186)],this[_0x41190b(0x1ae)]||undefined);const _0x5263d7=getConfigDir(),_0x15d377=a49_0x492958['join'](_0x5263d7,_0x41190b(0x1c5),this[_0x41190b(0x19e)]+_0x41190b(0x19a)),_0x1caa42=findProjectConfigPath(),_0x4921c1=a49_0x492958[_0x41190b(0x1bd)](_0x5263d7,'tdx.json'),_0x5c88b0=a49_0x492958['join'](_0x5263d7,_0x41190b(0x1a1));let _0x265b62=null,_0x3da0a0=null;this[_0x41190b(0x1ae)]&&(_0x265b62=a49_0x492958[_0x41190b(0x1bd)](_0x5263d7,'profiles',this[_0x41190b(0x1ae)],_0x41190b(0x1a6)),_0x3da0a0=a49_0x492958[_0x41190b(0x1bd)](_0x5263d7,_0x41190b(0x185),this[_0x41190b(0x1ae)],_0x41190b(0x1a1))),this[_0x41190b(0x1bc)]={'session':a49_0x43804[_0x41190b(0x1c0)](_0x15d377)?_0x15d377:null,'project':_0x1caa42,'profile':_0x265b62&&a49_0x43804[_0x41190b(0x1c0)](_0x265b62)?_0x265b62:null,'profileCredentials':_0x3da0a0&&a49_0x43804[_0x41190b(0x1c0)](_0x3da0a0)?_0x3da0a0:null,'global':a49_0x43804['existsSync'](_0x4921c1)?_0x4921c1:null,'globalCredentials':a49_0x43804[_0x41190b(0x1c0)](_0x5c88b0)?_0x5c88b0:null};}[a49_0x50363a(0x1c2)](_0x4a0420,_0x29b9b9){const _0x660e0d=a49_0x50363a;if(!_0x29b9b9)return'not\x20set';const _0x1d70fb=_0x29b9b9;if(this['layers'][_0x660e0d(0x1bb)][_0x4a0420]===_0x1d70fb){if(_0x4a0420==='site'&&_0x1d70fb===_0x660e0d(0x1ba)&&!this[_0x660e0d(0x1a9)][_0x660e0d(0x1c1)][_0x660e0d(0x186)]&&!this['layers'][_0x660e0d(0x194)]['site']&&!this['layers'][_0x660e0d(0x1a0)]['site']&&!this[_0x660e0d(0x1a9)]['global']['site'])return _0x660e0d(0x187);return _0x660e0d(0x196)+_0x4a0420[_0x660e0d(0x1aa)](/_/g,'-');}if(this[_0x660e0d(0x1a9)][_0x660e0d(0x1c1)][_0x4a0420]===_0x1d70fb)return _0x660e0d(0x1c1);if(this['layers'][_0x660e0d(0x194)][_0x4a0420]===_0x1d70fb)return _0x660e0d(0x194);if(this[_0x660e0d(0x1a9)]['profile'][_0x4a0420]===_0x1d70fb)return _0x660e0d(0x1af)+this[_0x660e0d(0x1ae)];if(this[_0x660e0d(0x1a9)][_0x660e0d(0x181)][_0x4a0420]===_0x1d70fb)return _0x660e0d(0x181);return _0x660e0d(0x187);}['loadGlobalConfig'](){const _0x56cc30=a49_0x50363a,_0xbf5c5e=a49_0x492958['join'](getConfigDir(),_0x56cc30(0x1a6));if(!a49_0x43804[_0x56cc30(0x1c0)](_0xbf5c5e))return{};try{const _0x3f18ad=a49_0x43804[_0x56cc30(0x19f)](_0xbf5c5e,_0x56cc30(0x189));return JSON[_0x56cc30(0x1bf)](_0x3f18ad);}catch{return{};}}[a49_0x50363a(0x1ab)](_0x32823b){const _0x4107a8=a49_0x50363a;_0x32823b[_0x4107a8(0x186)]=this[_0x4107a8(0x186)],!_0x32823b['database']&&this[_0x4107a8(0x1c4)]&&(_0x32823b[_0x4107a8(0x1c4)]=this[_0x4107a8(0x1c4)]),!_0x32823b[_0x4107a8(0x19b)]&&this[_0x4107a8(0x1b9)]&&(_0x32823b[_0x4107a8(0x19b)]=this[_0x4107a8(0x1b9)]),!_0x32823b[_0x4107a8(0x1b3)]&&this[_0x4107a8(0x1ad)]&&(_0x32823b['segmentPath']=this['segment_path']),!_0x32823b['llmProject']&&this[_0x4107a8(0x1a2)]&&(_0x32823b[_0x4107a8(0x1b1)]=this[_0x4107a8(0x1a2)]),!_0x32823b[_0x4107a8(0x1a7)]&&this['llm_agent']&&(_0x32823b[_0x4107a8(0x1a7)]=this[_0x4107a8(0x193)]);}[a49_0x50363a(0x183)](){const _0x4e5384=a49_0x50363a;return[{'key':_0x4e5384(0x186),'value':this[_0x4e5384(0x186)]},{'key':_0x4e5384(0x1c4),'value':this[_0x4e5384(0x1c4)]},{'key':'parent_segment','value':this[_0x4e5384(0x1b9)]},{'key':_0x4e5384(0x1ad),'value':this[_0x4e5384(0x1ad)]},{'key':_0x4e5384(0x1a2),'value':this['llm_project']},{'key':'llm_agent','value':this['llm_agent']},{'key':_0x4e5384(0x1a0),'value':this[_0x4e5384(0x1ae)]||undefined}];}[a49_0x50363a(0x199)](){const _0x36d410=a49_0x50363a;console[_0x36d410(0x1b0)](_0x36d410(0x192));for(const {key:_0x3dc13d,value:_0x39874a}of this['getParameters']()){_0x39874a&&console[_0x36d410(0x1b0)](_0x3dc13d+':\x20'+_0x39874a);}}[a49_0x50363a(0x195)](){const _0xe91270=a49_0x50363a;console[_0xe91270(0x1b0)](_0xe91270(0x192));for(const {key:_0x4ea6c5,value:_0x73c2dc}of this[_0xe91270(0x183)]()){if(_0x73c2dc){const _0x50f3dd=_0x4ea6c5===_0xe91270(0x1a0)?_0xe91270(0x1b8):'('+this[_0xe91270(0x1c2)](_0x4ea6c5,_0x73c2dc)+')';console[_0xe91270(0x1b0)](_0x4ea6c5+':\x20'+_0x73c2dc+'\x20'+_0x50f3dd);}}console['log'](_0xe91270(0x1a4));const _0x6280b6=[{'label':'Session','path':this[_0xe91270(0x1bc)][_0xe91270(0x1c1)],'extra':_0xe91270(0x1b6)+this[_0xe91270(0x19e)]+')'},{'label':_0xe91270(0x1b7),'path':this['configFiles'][_0xe91270(0x194)]},{'label':'Profile','path':this[_0xe91270(0x1bc)][_0xe91270(0x1a0)]},{'label':_0xe91270(0x191),'path':this[_0xe91270(0x1bc)][_0xe91270(0x1ac)]},{'label':_0xe91270(0x1b4),'path':this[_0xe91270(0x1bc)][_0xe91270(0x181)]},{'label':_0xe91270(0x198),'path':this[_0xe91270(0x1bc)][_0xe91270(0x19c)]}];for(const {label:_0x1911e1,path:_0x5ce6ad,extra:_0x45bfdf}of _0x6280b6){if(_0x5ce6ad)console['log'](_0x1911e1+':\x20'+_0x5ce6ad+'\x20✓'+(_0x45bfdf?'\x20'+_0x45bfdf:''));else{if(_0x1911e1==='Session')console['log'](_0x1911e1+_0xe91270(0x1c6)+this['sessionId']+')');else(_0x1911e1===_0xe91270(0x1b7)||_0x1911e1===_0xe91270(0x1b4))&&console[_0xe91270(0x1b0)](_0x1911e1+_0xe91270(0x1a5));}}}async[a49_0x50363a(0x1be)](){const _0x4294e9=a49_0x50363a;return this[_0x4294e9(0x188)]=await getAPIKeyAsync(this[_0x4294e9(0x186)],this['activeProfile']||undefined),this[_0x4294e9(0x188)];}static async[a49_0x50363a(0x1a8)](_0x11650a){const _0x5e6e9e=a49_0x50363a,_0x961569=new GlobalContext(_0x11650a);return await _0x961569[_0x5e6e9e(0x1be)](),_0x961569;}}
|
|
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(_0x418104,_0x5dda4f){const _0x1fcf73=a51_0x2fd5,_0x378f45=_0x418104();while(!![]){try{const _0x3e280d=-parseInt(_0x1fcf73(0x20b))/0x1*(parseInt(_0x1fcf73(0x209))/0x2)+parseInt(_0x1fcf73(0x200))/0x3*(-parseInt(_0x1fcf73(0x205))/0x4)+-parseInt(_0x1fcf73(0x22d))/0x5*(parseInt(_0x1fcf73(0x20e))/0x6)+-parseInt(_0x1fcf73(0x238))/0x7*(-parseInt(_0x1fcf73(0x1fa))/0x8)+parseInt(_0x1fcf73(0x22a))/0x9+parseInt(_0x1fcf73(0x1fb))/0xa+parseInt(_0x1fcf73(0x215))/0xb;if(_0x3e280d===_0x5dda4f)break;else _0x378f45['push'](_0x378f45['shift']());}catch(_0x34bcce){_0x378f45['push'](_0x378f45['shift']());}}}(a51_0x271e,0x6dae6));import*as a51_0x5c4355 from'node:fs';import*as a51_0x1b793b 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(_0x4c425a){const _0x255fd9=a51_0x2fd5,_0x262524={};if(!_0x4c425a)return _0x262524;for(const [_0x3c3c0e,_0x5438bf]of Object[_0x255fd9(0x236)](_0x4c425a)){_0x3c3c0e!==_0x255fd9(0x21d)&&_0x5438bf!==undefined&&(_0x262524[_0x3c3c0e]=_0x5438bf);}return _0x262524;}export function getProfilesDir(){return a51_0x1b793b['join'](getConfigDir(),'profiles');}function a51_0x2fd5(_0x1694da,_0x583dc5){_0x1694da=_0x1694da-0x1f0;const _0x271e07=a51_0x271e();let _0x2fd50c=_0x271e07[_0x1694da];return _0x2fd50c;}function getProfileDir(_0x3345a0){const _0x2435f5=a51_0x2fd5;return a51_0x1b793b[_0x2435f5(0x225)](getProfilesDir(),_0x3345a0);}function getProfileConfigPath(_0x4ab2fc){const _0x3d121b=a51_0x2fd5;return a51_0x1b793b[_0x3d121b(0x225)](getProfileDir(_0x4ab2fc),_0x3d121b(0x220));}function getProfileEnvPath(_0x5bf5bc){const _0x466684=a51_0x2fd5;return a51_0x1b793b[_0x466684(0x225)](getProfileDir(_0x5bf5bc),_0x466684(0x203));}function getGlobalConfigPath(){const _0x12f45b=a51_0x2fd5;return a51_0x1b793b[_0x12f45b(0x225)](getConfigDir(),_0x12f45b(0x220));}function validateProfileName(_0x2b1da8){const _0x2465b3=a51_0x2fd5;if(!/^[a-zA-Z0-9_-]+$/[_0x2465b3(0x1f7)](_0x2b1da8))throw new Error(_0x2465b3(0x20d)+_0x2b1da8+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function a51_0x271e(){const _0x2c05d9=['776855EDCsET','warn','parse','find','localeCompare','stringify','filter','Profile\x20\x27','utf-8','entries','llm_agent','22267bKIEVD','string','from','existsSync','profile','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','map','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','name','includes','rmSync','test','\x0aWarning:\x20Failed\x20to\x20parse\x20',':\x20Invalid\x20JSON\x20syntax','392wSiwWR','3541280esABKY','.env.','To\x20migrate:','readdirSync','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','180YzUXkN','\x20already\x20exists',',\x20creating\x20new\x20file','.env','profiles','30700SDIsEa','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','toISOString','\x27\x20will\x20be\x20ignored','1200674LJYIkM','readFileSync','1EUkuOg','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Invalid\x20profile\x20name:\x20','6dNKnDv','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','has','Warning:\x20Failed\x20to\x20parse\x20','site','Profile\x20','directory','3218666ngaYED','message','push','length','sort','some','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','description','database','user','tdx.json','\x20\x20mv\x20\x22','\x20\x201.\x20Edit:\x20','\x20does\x20not\x20exist','object','join','keys','isDirectory','parent_segment','\x27:\x20config\x20must\x20be\x20an\x20object','7765731FgSrMP','llm_project','set'];a51_0x271e=function(){return _0x2c05d9;};return a51_0x271e();}function validateProfileConfig(_0x301759,_0x50ee4a){const _0x515207=a51_0x2fd5;if(typeof _0x301759!==_0x515207(0x224)||_0x301759===null)throw new Error(_0x515207(0x234)+_0x50ee4a+_0x515207(0x229));const _0x3d790b=['description',_0x515207(0x212),_0x515207(0x21e),'parent_segment','llm_project',_0x515207(0x237)],_0x2b56fe=_0x301759;for(const _0x481e9a of Object[_0x515207(0x226)](_0x2b56fe)){!_0x3d790b[_0x515207(0x1f5)](_0x481e9a)&&console['warn']('Warning:\x20Profile\x20\x27'+_0x50ee4a+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x481e9a+_0x515207(0x208));}if(_0x2b56fe[_0x515207(0x21d)]!==undefined&&typeof _0x2b56fe[_0x515207(0x21d)]!==_0x515207(0x239))throw new Error('Profile\x20\x27'+_0x50ee4a+_0x515207(0x206));if(_0x2b56fe[_0x515207(0x212)]!==undefined&&typeof _0x2b56fe[_0x515207(0x212)]!==_0x515207(0x239))throw new Error(_0x515207(0x234)+_0x50ee4a+_0x515207(0x21b));if(_0x2b56fe[_0x515207(0x21e)]!==undefined&&typeof _0x2b56fe[_0x515207(0x21e)]!=='string')throw new Error(_0x515207(0x234)+_0x50ee4a+_0x515207(0x1f1));if(_0x2b56fe[_0x515207(0x228)]!==undefined&&typeof _0x2b56fe['parent_segment']!==_0x515207(0x239))throw new Error(_0x515207(0x234)+_0x50ee4a+_0x515207(0x20c));if(_0x2b56fe[_0x515207(0x22b)]!==undefined&&typeof _0x2b56fe[_0x515207(0x22b)]!==_0x515207(0x239))throw new Error('Profile\x20\x27'+_0x50ee4a+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x2b56fe[_0x515207(0x237)]!==undefined&&typeof _0x2b56fe[_0x515207(0x237)]!==_0x515207(0x239))throw new Error(_0x515207(0x234)+_0x50ee4a+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0xbae7ce,_0x330cad){const _0x2d8832=a51_0x2fd5;if(!a51_0x5c4355[_0x2d8832(0x23b)](_0xbae7ce))return[];try{const _0x54bc95=a51_0x5c4355[_0x2d8832(0x20a)](_0xbae7ce,_0x2d8832(0x235)),_0x2fdded=JSON['parse'](_0x54bc95);if(!_0x2fdded[_0x2d8832(0x204)]||typeof _0x2fdded[_0x2d8832(0x204)]!==_0x2d8832(0x224))return[];const _0xb3869f=[];for(const [_0x3c0708,_0x1320b4]of Object[_0x2d8832(0x236)](_0x2fdded['profiles'])){try{validateProfileConfig(_0x1320b4,_0x3c0708);const _0x419ac8=getNewCredentialPath(_0x3c0708),_0x70e3e5=getOldCredentialPath(_0x3c0708),_0x3e9afb=a51_0x5c4355[_0x2d8832(0x23b)](_0x419ac8)||a51_0x5c4355[_0x2d8832(0x23b)](_0x70e3e5);_0xb3869f[_0x2d8832(0x217)]({'name':_0x3c0708,'config':_0x1320b4,'metadata':{'name':_0x3c0708,'createdAt':new Date()[_0x2d8832(0x207)]()},'hasCredentials':_0x3e9afb,'scope':_0x330cad});}catch(_0x32e3da){_0x32e3da instanceof Error&&(console[_0x2d8832(0x22e)](_0x2d8832(0x20f)+_0xbae7ce+':'),console[_0x2d8832(0x22e)]('\x20\x20'+_0x32e3da[_0x2d8832(0x216)]+'\x0a'));}}return _0xb3869f;}catch(_0x5152f7){return _0x5152f7 instanceof SyntaxError?(console[_0x2d8832(0x22e)](_0x2d8832(0x1f8)+_0xbae7ce+_0x2d8832(0x1f9)),console[_0x2d8832(0x22e)]('Error:\x20'+_0x5152f7[_0x2d8832(0x216)]+'\x0a')):console['warn']('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0xbae7ce+':\x20'+_0x5152f7+'\x0a'),[];}}export function getNewCredentialPath(_0x33ca63){const _0x4e1bad=a51_0x2fd5;return a51_0x1b793b['join'](getConfigDir(),_0x4e1bad(0x1fc)+_0x33ca63);}function getOldCredentialPath(_0x120ce4){const _0x51a7f2=a51_0x2fd5;return a51_0x1b793b[_0x51a7f2(0x225)](getProfilesDir(),_0x120ce4,_0x51a7f2(0x203));}function loadProfilesFromTdxJsonFiles(){const _0x270b39=a51_0x2fd5,_0x1b2b70=[],_0x5abe01=findProjectConfigPath();_0x5abe01&&_0x1b2b70[_0x270b39(0x217)](...loadProfilesFromTdxJson(_0x5abe01,'local'));const _0x5ebf3a=a51_0x1b793b[_0x270b39(0x225)](getConfigDir(),_0x270b39(0x220));return _0x1b2b70[_0x270b39(0x217)](...loadProfilesFromTdxJson(_0x5ebf3a,_0x270b39(0x21f))),_0x1b2b70;}function loadProfilesFromDirectories(){const _0x1eeee5=a51_0x2fd5,_0x3c7bdd=getProfilesDir();if(!a51_0x5c4355[_0x1eeee5(0x23b)](_0x3c7bdd))return[];try{return a51_0x5c4355[_0x1eeee5(0x1fe)](_0x3c7bdd,{'withFileTypes':!![]})[_0x1eeee5(0x233)](_0xb8c9d9=>_0xb8c9d9[_0x1eeee5(0x227)]())['map'](_0x4c9ac5=>_0x4c9ac5[_0x1eeee5(0x1f4)])[_0x1eeee5(0x233)](_0x3da2c4=>{const _0x3c756c=_0x1eeee5,_0x54f76f=getProfileConfigPath(_0x3da2c4),_0x224218=getProfileEnvPath(_0x3da2c4);return a51_0x5c4355[_0x3c756c(0x23b)](_0x54f76f)||a51_0x5c4355[_0x3c756c(0x23b)](_0x224218);})['map'](_0x3a3d5a=>{const _0x11ed56=loadProfileFromDirectory(_0x3a3d5a);if(_0x11ed56)return{..._0x11ed56,'scope':'directory'};return null;})[_0x1eeee5(0x233)](_0x3e4b59=>_0x3e4b59!==null);}catch{return[];}}function loadProfileFromDirectory(_0x573615){const _0xc2168c=a51_0x2fd5,_0x4a7c91=getProfileConfigPath(_0x573615),_0x446466=getOldCredentialPath(_0x573615);if(!a51_0x5c4355['existsSync'](_0x4a7c91)&&!a51_0x5c4355[_0xc2168c(0x23b)](_0x446466))return null;let _0x1feb58={},_0x46eb8f={'name':_0x573615,'createdAt':new Date()[_0xc2168c(0x207)]()};if(a51_0x5c4355[_0xc2168c(0x23b)](_0x4a7c91))try{const _0x5b3adf=a51_0x5c4355[_0xc2168c(0x20a)](_0x4a7c91,'utf-8'),_0x422053=JSON[_0xc2168c(0x22f)](_0x5b3adf),{metadata:_0x4bcd53,..._0xd891a5}=_0x422053;_0x1feb58=_0xd891a5,_0x4bcd53&&(_0x46eb8f=_0x4bcd53);}catch{}return{'name':_0x573615,'config':_0x1feb58,'metadata':_0x46eb8f,'hasCredentials':a51_0x5c4355['existsSync'](_0x446466),'scope':_0xc2168c(0x214)};}export function listProfiles(){const _0x5685b3=a51_0x2fd5,_0x1fc4b2=loadProfilesFromTdxJsonFiles(),_0x46236c=loadProfilesFromDirectories();if(_0x46236c[_0x5685b3(0x218)]>0x0){const _0x12dd83=_0x46236c[_0x5685b3(0x1f2)](_0x503ba0=>_0x503ba0['name'])[_0x5685b3(0x225)](',\x20'),_0x38b5b0=getConfigDir();console[_0x5685b3(0x22e)](_0x5685b3(0x1ff)+_0x12dd83),console[_0x5685b3(0x22e)](_0x5685b3(0x21c)),console[_0x5685b3(0x22e)](_0x5685b3(0x222)+a51_0x1b793b[_0x5685b3(0x225)](_0x38b5b0,_0x5685b3(0x220))),console['warn']('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x5685b3(0x22e)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x592e94=[..._0x1fc4b2,..._0x46236c],_0xdb308a=new Map();for(const _0xb93113 of _0x592e94){!_0xdb308a[_0x5685b3(0x210)](_0xb93113['name'])&&_0xdb308a[_0x5685b3(0x22c)](_0xb93113[_0x5685b3(0x1f4)],_0xb93113);}return Array[_0x5685b3(0x23a)](_0xdb308a['values']())[_0x5685b3(0x219)]((_0x58e992,_0x5046bb)=>_0x58e992['name'][_0x5685b3(0x231)](_0x5046bb['name']));}export function profileExists(_0x253020){const _0x1ef22c=a51_0x2fd5,_0x2b2e94=listProfiles();return _0x2b2e94[_0x1ef22c(0x21a)](_0x151d23=>_0x151d23[_0x1ef22c(0x1f4)]===_0x253020);}export function loadProfile(_0x436e41){const _0x3181b5=a51_0x2fd5;validateProfileName(_0x436e41);const _0xf5635e=listProfiles(),_0x238fb3=_0xf5635e[_0x3181b5(0x230)](_0x43180f=>_0x43180f[_0x3181b5(0x1f4)]===_0x436e41);return _0x238fb3||null;}export function saveProfile(_0x248c8e,_0x52dda1,_0x29f63f=![]){saveProfileToUserConfig(_0x248c8e,_0x52dda1);}export function deleteProfile(_0x18be57){const _0x5700ab=a51_0x2fd5;validateProfileName(_0x18be57);const _0x4a2ca7=getProfileDir(_0x18be57);if(!a51_0x5c4355[_0x5700ab(0x23b)](_0x4a2ca7))throw new Error(_0x5700ab(0x213)+_0x18be57+_0x5700ab(0x223));a51_0x5c4355[_0x5700ab(0x1f6)](_0x4a2ca7,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x394ebf,_0x467593){const _0x28be9f=a51_0x2fd5;validateProfileName(_0x394ebf);const _0x48d4a6=getGlobalConfigPath(),_0x3826ce=getConfigDir();!a51_0x5c4355[_0x28be9f(0x23b)](_0x3826ce)&&createSecureDirectory(_0x3826ce);let _0x3c86e6={};if(a51_0x5c4355[_0x28be9f(0x23b)](_0x48d4a6))try{const _0x11e3f9=a51_0x5c4355[_0x28be9f(0x20a)](_0x48d4a6,_0x28be9f(0x235));_0x3c86e6=JSON[_0x28be9f(0x22f)](_0x11e3f9);}catch{console['warn'](_0x28be9f(0x211)+_0x48d4a6+_0x28be9f(0x202));}!_0x3c86e6[_0x28be9f(0x204)]&&(_0x3c86e6[_0x28be9f(0x204)]={}),_0x3c86e6[_0x28be9f(0x204)][_0x394ebf]=_0x467593,writeSecureFile(_0x48d4a6,JSON[_0x28be9f(0x232)](_0x3c86e6,null,0x2));}export function getActiveProfile(){const _0x35b673=a51_0x2fd5,_0x18ec5a=loadSessionContext();if(_0x18ec5a?.[_0x35b673(0x1f0)])return _0x18ec5a[_0x35b673(0x1f0)];const _0x244dc5=getGlobalConfigPath();if(!a51_0x5c4355[_0x35b673(0x23b)](_0x244dc5))return null;try{const _0x3fcbf3=a51_0x5c4355['readFileSync'](_0x244dc5,_0x35b673(0x235)),_0x17fc86=JSON[_0x35b673(0x22f)](_0x3fcbf3);return _0x17fc86[_0x35b673(0x1f0)]||null;}catch{return null;}}export function createProfile(_0x260c18,_0x315abc){const _0x34b749=a51_0x2fd5;validateProfileName(_0x260c18);if(profileExists(_0x260c18))throw new Error(_0x34b749(0x213)+_0x260c18+_0x34b749(0x201));saveProfile(_0x260c18,_0x315abc);}export function saveProfileCredentials(_0x46e9e0,_0x35bf33){const _0x300c55=a51_0x2fd5;validateProfileName(_0x46e9e0);if(!profileExists(_0x46e9e0))throw new Error(_0x300c55(0x213)+_0x46e9e0+_0x300c55(0x223));const _0x3f112c=getNewCredentialPath(_0x46e9e0);writeSecureFile(_0x3f112c,_0x35bf33);}export function loadProfileCredentials(_0x4773ec){const _0xfa50b7=a51_0x2fd5;validateProfileName(_0x4773ec);const _0x2d924b=getNewCredentialPath(_0x4773ec);if(a51_0x5c4355[_0xfa50b7(0x23b)](_0x2d924b))try{return a51_0x5c4355['readFileSync'](_0x2d924b,_0xfa50b7(0x235));}catch{}const _0x49f10a=getOldCredentialPath(_0x4773ec);if(a51_0x5c4355[_0xfa50b7(0x23b)](_0x49f10a)){console[_0xfa50b7(0x22e)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x4773ec+'\x27'),console[_0xfa50b7(0x22e)](_0xfa50b7(0x1fd)),console['warn'](_0xfa50b7(0x221)+_0x49f10a+'\x22\x20\x22'+_0x2d924b+'\x22'),console['warn'](_0xfa50b7(0x1f3));try{return a51_0x5c4355['readFileSync'](_0x49f10a,_0xfa50b7(0x235));}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
|
-
const
|
|
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;}
|