@treasuredata/tdx 2026.3.10 → 2026.3.12
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 +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-login-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/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-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/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.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/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.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/oauth-keychain.js +1 -1
- package/dist/core/oauth.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/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.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/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.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/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a54_0xcc7bae=a54_0x9f4c;function a54_0x9f4c(_0x507a0f,_0x591bb0){_0x507a0f=_0x507a0f-0xc0;const _0x3e1217=a54_0x3e12();let _0x9f4cb9=_0x3e1217[_0x507a0f];return _0x9f4cb9;}(function(_0x41357a,_0x560833){const _0x349455=a54_0x9f4c,_0xb39342=_0x41357a();while(!![]){try{const _0x5e6811=-parseInt(_0x349455(0x103))/0x1*(-parseInt(_0x349455(0xed))/0x2)+-parseInt(_0x349455(0xd7))/0x3*(-parseInt(_0x349455(0xdc))/0x4)+-parseInt(_0x349455(0xf0))/0x5*(-parseInt(_0x349455(0xe1))/0x6)+-parseInt(_0x349455(0xd6))/0x7*(parseInt(_0x349455(0xd9))/0x8)+parseInt(_0x349455(0xe2))/0x9+-parseInt(_0x349455(0xeb))/0xa*(parseInt(_0x349455(0xc7))/0xb)+-parseInt(_0x349455(0xdd))/0xc;if(_0x5e6811===_0x560833)break;else _0xb39342['push'](_0xb39342['shift']());}catch(_0x25e900){_0xb39342['push'](_0xb39342['shift']());}}}(a54_0x3e12,0x4a09b));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a54_0x226771 from'node:fs';import*as a54_0x498468 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a54_0x4202a2 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x10848e=a54_0x9f4c;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x10848e(0x110));}export function getConfigFile(){const _0x3e4d95=a54_0x9f4c;return join(getConfigDir(),_0x3e4d95(0xff));}export function getConfigFilePath(_0x5ce923){const _0xa94fb6=a54_0x9f4c,_0x52f49e=getConfigDir();return _0x5ce923?a54_0x498468[_0xa94fb6(0xdb)](_0x52f49e,_0xa94fb6(0xcd)+_0x5ce923):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a54_0xcc7bae(0xfd),'config/llm-project');export function getLLMProjectCacheFile(_0x3f5ab7){const _0x75b771=a54_0xcc7bae;return llmProjectCache[_0x75b771(0xe8)](_0x3f5ab7);}export function readCachedLLMProject(_0x2122c2){const _0x2ec9da=a54_0xcc7bae,_0x136dce=llmProjectCache[_0x2ec9da(0xec)](_0x2122c2);if(_0x136dce&&typeof _0x136dce['id']===_0x2ec9da(0x109)&&typeof _0x136dce[_0x2ec9da(0xf6)]===_0x2ec9da(0x109))return _0x136dce;return null;}function a54_0x3e12(){const _0x45b5eb=['ap02','dev-eu01','TDX_API_KEY\x20env\x20var','string','stg-ap01','toUpperCase','filter','next','TDX_API_KEY_','match','tdx','TDX_ACCESS_TOKEN_','yellow','split','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','llm_default_agent','write','slice','11cbUFFT','stg-us01','ap01','trim','parse','site','.env.','tdx.json','config/llm-agent','profile','toISOString','keychain','stable','startsWith','us01','49zBlNvK','12ZWibzE','TDX_ACCESS_TOKEN\x20env\x20var','91888xznGiP','dev-us01','join','32024HbNFBm','3875496eCNiRl','apiKeys','apiKey','accessToken','20922wAgooE','498339RcMEaw','readFileSync','\x20env\x20var','some','TD_API_KEY_','proxy','path','includes','TD_API_KEY','1555460UDxGxo','read','2raCcZG','ap03','source','415szchFN','Warning:\x20Failed\x20to\x20read\x20','stringify','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','\x27,\x20defaulting\x20to\x20us01','warn','name','.json','eu01','config/account-info','release_channel','utf-8','projectId','llm_default_project','keychain\x20(profile:\x20','.env','existsSync','entries','endsWith','485349TtrhiJ','replace','stg-ap03'];a54_0x3e12=function(){return _0x45b5eb;};return a54_0x3e12();}export function writeCachedLLMProject(_0x5372c3,_0x3531b0,_0xb5e440){const _0x1ef8d9=a54_0xcc7bae;try{llmProjectCache[_0x1ef8d9(0xc5)]({'name':_0x5372c3,'id':_0x3531b0},_0xb5e440);}catch{}}const llmAgentCache=createOptionalProfileCache(a54_0xcc7bae(0xc4),a54_0xcc7bae(0xcf));export function getLLMAgentCacheFile(_0x209073){const _0xb4c49d=a54_0xcc7bae;return llmAgentCache[_0xb4c49d(0xe8)](_0x209073);}export function readCachedLLMAgent(_0x2ad664){const _0x3b022a=a54_0xcc7bae,_0x2a591d=llmAgentCache[_0x3b022a(0xec)](_0x2ad664);if(_0x2a591d&&typeof _0x2a591d['id']===_0x3b022a(0x109)&&typeof _0x2a591d[_0x3b022a(0xf6)]==='string'&&typeof _0x2a591d[_0x3b022a(0xfc)]===_0x3b022a(0x109))return _0x2a591d;return null;}export function writeCachedLLMAgent(_0x53c725,_0x4fd804,_0x3a4ad9,_0x36e07f){const _0x2d5107=a54_0xcc7bae;try{llmAgentCache[_0x2d5107(0xc5)]({'name':_0x53c725,'id':_0x4fd804,'projectId':_0x3a4ad9},_0x36e07f);}catch{}}export function clearCachedLLMAgent(_0x430f62){try{llmAgentCache['clear'](_0x430f62);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a54_0xcc7bae(0xf9),{'suffix':a54_0xcc7bae(0xf7)});export function getAccountInfoCacheFile(_0x42718b){const _0x3fff86=a54_0xcc7bae;return accountInfoCache[_0x3fff86(0xe8)](_0x42718b);}export function readCachedAccountInfo(_0x371b08){const _0x30b4e8=a54_0xcc7bae,_0x51a3df=accountInfoCache[_0x30b4e8(0xec)](_0x371b08);if(_0x51a3df&&typeof _0x51a3df[_0x30b4e8(0xcc)]===_0x30b4e8(0x109)&&typeof _0x51a3df['accountId']==='number')return _0x51a3df;return null;}export function writeCachedAccountInfo(_0xa8e3c3,_0x19a476,_0x519192){const _0x141a60=a54_0xcc7bae;try{accountInfoCache[_0x141a60(0xc5)]({'site':_0xa8e3c3,'accountId':_0x19a476,'cachedAt':new Date()[_0x141a60(0xd1)]()},_0x519192);}catch{}}export function parseEnvFile(_0x5f40f8){const _0x210280=a54_0xcc7bae,_0x2d06da={};for(const _0x2336a6 of _0x5f40f8['split']('\x0a')){const _0x3a76d0=_0x2336a6[_0x210280(0xca)]();if(!_0x3a76d0||_0x3a76d0['startsWith']('#'))continue;const _0x224781=_0x3a76d0[_0x210280(0x10f)](/^([^=]+)=(.*)$/);if(_0x224781){const _0x1742ea=_0x224781[0x1][_0x210280(0xca)]();let _0xa50742=_0x224781[0x2][_0x210280(0xca)]();(_0xa50742['startsWith']('\x22')&&_0xa50742[_0x210280(0x102)]('\x22')||_0xa50742['startsWith']('\x27')&&_0xa50742[_0x210280(0x102)]('\x27'))&&(_0xa50742=_0xa50742[_0x210280(0xc6)](0x1,-0x1)),_0x2d06da[_0x1742ea]=_0xa50742;}}return _0x2d06da;}export function readUserConfig(){const _0x51c7b6=a54_0xcc7bae,_0x3717d9=getConfigFile();if(!existsSync(_0x3717d9))return{};try{const _0xf24e5a=readFileSync(_0x3717d9,_0x51c7b6(0xfb));return parseEnvFile(_0xf24e5a);}catch(_0x5270f0){return console[_0x51c7b6(0xf5)](_0x51c7b6(0xc3)+_0x3717d9+':',_0x5270f0),{};}}export function resolveSite(_0x63c63d){const _0x1d768f=a54_0xcc7bae,_0x4265f3=[_0x1d768f(0xd5),_0x1d768f(0xc9),_0x1d768f(0xf8),_0x1d768f(0x106),_0x1d768f(0xee),_0x1d768f(0xda),_0x1d768f(0x107),_0x1d768f(0xc8),_0x1d768f(0x10a),_0x1d768f(0x105)];if(_0x4265f3[_0x1d768f(0xe9)](_0x63c63d))return _0x63c63d;if(_0x63c63d in SITE_ALIASES)return SITE_ALIASES[_0x63c63d];return console[_0x1d768f(0xf5)]('Warning:\x20Unknown\x20site\x20\x27'+_0x63c63d+_0x1d768f(0xf4)),_0x1d768f(0xd5);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x9d3cd){const _0x518ba1=a54_0xcc7bae,_0x438e6b=_0x9d3cd||getActiveProfileName()||undefined;if(_0x438e6b){const _0x281114=_0x518ba1(0xc0)+normalizeProfileForEnvVar(_0x438e6b);if(process.env[_0x281114])return{'accessToken':process.env[_0x281114],'source':_0x281114+_0x518ba1(0xe4)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x518ba1(0xd8)};return null;}export function getAccessToken(_0x22b5a6){const _0x146e15=a54_0xcc7bae;return resolveAccessToken(_0x22b5a6)?.[_0x146e15(0xe0)];}export function getAPIKey(_0x5195dd){const _0x2c776b=_0x5195dd||getActiveProfileName();if(_0x2c776b){const _0x1dfe16='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x2c776b);if(process.env[_0x1dfe16])return process.env[_0x1dfe16];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x357418){const _0x3a625e=a54_0xcc7bae;return _0x357418[_0x3a625e(0x10b)]()[_0x3a625e(0x104)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x4b8c4a,_0x39111e){const _0x56aeb1=a54_0xcc7bae,_0x10d0ef=resolveAccessToken(_0x39111e);if(_0x10d0ef)return{'apiKey':_0x10d0ef['accessToken'],'source':_0x10d0ef[_0x56aeb1(0xef)],'isDeprecated':![]};const _0x202235=_0x39111e||getActiveProfileName()||undefined;if(_0x202235){const _0x2bc4fa=_0x56aeb1(0x10e)+normalizeProfileForEnvVar(_0x202235);if(process.env[_0x2bc4fa])return{'apiKey':process.env[_0x2bc4fa],'source':_0x2bc4fa+_0x56aeb1(0xe4),'isDeprecated':![]};const _0x304263=getCachedCredential(_0x4b8c4a,_0x202235);if(_0x304263)return{'apiKey':_0x304263,'source':'keychain\x20(profile:\x20'+_0x202235+')','isDeprecated':![]};const _0x7362cb=await getKeychainAPIKey(_0x202235);if(_0x7362cb)return setCachedCredential(_0x7362cb,_0x4b8c4a,_0x202235),{'apiKey':_0x7362cb,'source':_0x56aeb1(0xfe)+_0x202235+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x56aeb1(0x108),'isDeprecated':![]};if(!_0x202235){const _0x3b99ed=getCachedCredential(_0x4b8c4a,undefined);if(_0x3b99ed)return{'apiKey':_0x3b99ed,'source':_0x56aeb1(0xd2),'isDeprecated':![]};const _0xe166bf=await getKeychainAPIKey(undefined);if(_0xe166bf)return setCachedCredential(_0xe166bf,_0x4b8c4a,undefined),{'apiKey':_0xe166bf,'source':_0x56aeb1(0xd2),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x5a1197,_0x418ad8){const _0x1db671=a54_0xcc7bae,_0x1aefef=await resolveAPIKeyAsync(_0x5a1197,_0x418ad8);return _0x1aefef?.[_0x1db671(0xdf)];}function cleanupLegacyEnvFile(_0x4f51f9){const _0x59b63b=a54_0xcc7bae;if(!existsSync(_0x4f51f9))return![];try{const _0x51bea7=readFileSync(_0x4f51f9,_0x59b63b(0xfb)),_0x4925e5=_0x51bea7[_0x59b63b(0xc2)]('\x0a'),_0x4485ee=_0x4925e5[_0x59b63b(0x10c)](_0x3b61bd=>{const _0x4278aa=_0x59b63b,_0x2183dd=_0x3b61bd[_0x4278aa(0xca)]();if(!_0x2183dd||_0x2183dd[_0x4278aa(0xd4)]('#'))return!![];const [_0x292a7e]=_0x2183dd['split']('=');return!_0x292a7e[_0x4278aa(0xd4)](_0x4278aa(0xea));}),_0x4f85a3=_0x4485ee[_0x59b63b(0xe5)](_0x2ca66c=>{const _0x188642=_0x59b63b,_0x41d186=_0x2ca66c[_0x188642(0xca)]();return _0x41d186&&!_0x41d186[_0x188642(0xd4)]('#');});if(!_0x4f85a3)return unlinkSync(_0x4f51f9),!![];return writeFileSync(_0x4f51f9,_0x4485ee[_0x59b63b(0xdb)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x126bf3=a54_0xcc7bae;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x569b71=a54_0x498468[_0x126bf3(0xdb)](getConfigDir(),_0x126bf3(0xce));if(!a54_0x226771['existsSync'](_0x569b71))return null;try{const _0x4267c4=a54_0x226771[_0x126bf3(0xe3)](_0x569b71,_0x126bf3(0xfb)),_0x4372f0=JSON['parse'](_0x4267c4);return _0x4372f0[_0x126bf3(0xd0)]||null;}catch{return null;}}export function saveAPIKey(_0x3378d3,_0x29f112,_0x3d1a7e){const _0x4f3140=a54_0xcc7bae,_0x5b3105=getConfigDir(),_0x128a52=getConfigFilePath(_0x3d1a7e);!existsSync(_0x5b3105)&&mkdirSync(_0x5b3105,{'recursive':!![],'mode':0x1c0});let _0x53e4f8={};if(existsSync(_0x128a52))try{const _0x13f79f=readFileSync(_0x128a52,_0x4f3140(0xfb));_0x53e4f8=parseEnvFile(_0x13f79f);}catch(_0x29a5c4){console[_0x4f3140(0xf5)](_0x4f3140(0xf1)+_0x128a52+':',_0x29a5c4);}const _0x2f25e9=_0x3378d3[_0x4f3140(0x10b)]()['replace'](/-/g,'_');_0x53e4f8[_0x4f3140(0xe6)+_0x2f25e9]=_0x29f112;const _0x2eba19=Object[_0x4f3140(0x101)](_0x53e4f8)['map'](([_0x124992,_0x32e797])=>_0x124992+'='+_0x32e797);writeFileSync(_0x128a52,_0x2eba19[_0x4f3140(0xdb)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x246a24,_0x51eac3,_0xea2075){const _0x420b71=a54_0xcc7bae;await saveKeychainAPIKey(_0x246a24,_0xea2075),setCachedCredential(_0x246a24,_0x51eac3,_0xea2075);const _0x39aafa=getConfigFilePath(_0xea2075);cleanupLegacyEnvFile(_0x39aafa)&&console[_0x420b71(0xf5)](a54_0x4202a2[_0x420b71(0xc1)](_0x420b71(0xf3)));}export function loadConfig(){const _0x3e71c7=a54_0xcc7bae,_0x5923c1={'apiKeys':{},'defaultSite':_0x3e71c7(0xd5)},_0x2d93d0=[_0x3e71c7(0xd5),_0x3e71c7(0xc9),_0x3e71c7(0xf8),_0x3e71c7(0x106),_0x3e71c7(0xee),_0x3e71c7(0xda),_0x3e71c7(0x107),_0x3e71c7(0xc8),_0x3e71c7(0x10a),_0x3e71c7(0x105)],_0x38cbfc=getAPIKey();if(_0x38cbfc)for(const _0x29a2e4 of _0x2d93d0){_0x5923c1[_0x3e71c7(0xde)][_0x29a2e4]=_0x38cbfc;}return _0x5923c1;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x891cf6=a54_0xcc7bae,_0x5b89d2=a54_0x498468[_0x891cf6(0xdb)](getConfigDir(),'tdx.json');if(!a54_0x226771[_0x891cf6(0x100)](_0x5b89d2))return undefined;try{const _0x1eb8c0=a54_0x226771[_0x891cf6(0xe3)](_0x5b89d2,_0x891cf6(0xfb)),_0x30a91a=JSON[_0x891cf6(0xcb)](_0x1eb8c0);return typeof _0x30a91a[_0x891cf6(0xe7)]===_0x891cf6(0x109)?_0x30a91a[_0x891cf6(0xe7)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0xc11aea=a54_0xcc7bae,_0x13d09c=process.env.TDX_RELEASE_CHANNEL;if(_0x13d09c===_0xc11aea(0x10d)||_0x13d09c===_0xc11aea(0xd3))return _0x13d09c;const _0x504eab=a54_0x498468[_0xc11aea(0xdb)](getConfigDir(),_0xc11aea(0xce));if(!a54_0x226771[_0xc11aea(0x100)](_0x504eab))return _0xc11aea(0xd3);try{const _0x1edaae=a54_0x226771[_0xc11aea(0xe3)](_0x504eab,'utf-8'),_0x1b1ef4=JSON[_0xc11aea(0xcb)](_0x1edaae);if(_0x1b1ef4[_0xc11aea(0xfa)]===_0xc11aea(0x10d))return'next';}catch{}return _0xc11aea(0xd3);}export function saveReleaseChannel(_0x35d88a){const _0x1ddb3c=a54_0xcc7bae,_0x59d641=getConfigDir(),_0x570465=a54_0x498468[_0x1ddb3c(0xdb)](_0x59d641,_0x1ddb3c(0xce));!existsSync(_0x59d641)&&mkdirSync(_0x59d641,{'recursive':!![],'mode':0x1c0});let _0x4a0c66={};if(existsSync(_0x570465))try{const _0x26728e=readFileSync(_0x570465,'utf-8');_0x4a0c66=JSON[_0x1ddb3c(0xcb)](_0x26728e);}catch{}_0x4a0c66[_0x1ddb3c(0xfa)]=_0x35d88a,writeFileSync(_0x570465,JSON[_0x1ddb3c(0xf2)](_0x4a0c66,null,0x2),{'mode':0x180});}
|
|
1
|
+
function a54_0x8923(_0x444b6a,_0x263b34){_0x444b6a=_0x444b6a-0x1b8;const _0x505f45=a54_0x505f();let _0x89239b=_0x505f45[_0x444b6a];return _0x89239b;}const a54_0x2f07fa=a54_0x8923;(function(_0x1fd6d6,_0x5037e2){const _0x520674=a54_0x8923,_0x4ebc22=_0x1fd6d6();while(!![]){try{const _0x1ede04=parseInt(_0x520674(0x1ff))/0x1*(parseInt(_0x520674(0x1c9))/0x2)+parseInt(_0x520674(0x1e8))/0x3+parseInt(_0x520674(0x1c6))/0x4+-parseInt(_0x520674(0x1c0))/0x5+parseInt(_0x520674(0x1ef))/0x6*(-parseInt(_0x520674(0x201))/0x7)+parseInt(_0x520674(0x1ea))/0x8*(parseInt(_0x520674(0x1d9))/0x9)+-parseInt(_0x520674(0x1bb))/0xa;if(_0x1ede04===_0x5037e2)break;else _0x4ebc22['push'](_0x4ebc22['shift']());}catch(_0x77c44f){_0x4ebc22['push'](_0x4ebc22['shift']());}}}(a54_0x505f,0x3fb4a));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a54_0x4690d2 from'node:fs';import*as a54_0x2f967d from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a54_0x15eca2 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x17b29e=a54_0x8923;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x17b29e(0x1ee),_0x17b29e(0x1fa));}export function getConfigFile(){const _0x138583=a54_0x8923;return join(getConfigDir(),_0x138583(0x1e1));}export function getConfigFilePath(_0x3862a3){const _0x309d7d=a54_0x8923,_0xfe7bc9=getConfigDir();return _0x3862a3?a54_0x2f967d[_0x309d7d(0x1e6)](_0xfe7bc9,'.env.'+_0x3862a3):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a54_0x2f07fa(0x1c1),'config/llm-project');export function getLLMProjectCacheFile(_0x25f8f2){const _0x32da0d=a54_0x2f07fa;return llmProjectCache[_0x32da0d(0x1be)](_0x25f8f2);}export function readCachedLLMProject(_0x357f6e){const _0x19d75a=a54_0x2f07fa,_0x2ab5ec=llmProjectCache['read'](_0x357f6e);if(_0x2ab5ec&&typeof _0x2ab5ec['id']===_0x19d75a(0x1d0)&&typeof _0x2ab5ec[_0x19d75a(0x1bd)]===_0x19d75a(0x1d0))return _0x2ab5ec;return null;}export function writeCachedLLMProject(_0x4203e7,_0x4bec0d,_0x150bf3){const _0x28291a=a54_0x2f07fa;try{llmProjectCache[_0x28291a(0x1fc)]({'name':_0x4203e7,'id':_0x4bec0d},_0x150bf3);}catch{}}const llmAgentCache=createOptionalProfileCache(a54_0x2f07fa(0x1cb),a54_0x2f07fa(0x1ba));export function getLLMAgentCacheFile(_0x4ab1ee){const _0x4bb1da=a54_0x2f07fa;return llmAgentCache[_0x4bb1da(0x1be)](_0x4ab1ee);}export function readCachedLLMAgent(_0x966be0){const _0xb01905=a54_0x2f07fa,_0xdc24a6=llmAgentCache[_0xb01905(0x1c2)](_0x966be0);if(_0xdc24a6&&typeof _0xdc24a6['id']===_0xb01905(0x1d0)&&typeof _0xdc24a6[_0xb01905(0x1bd)]==='string'&&typeof _0xdc24a6[_0xb01905(0x1da)]===_0xb01905(0x1d0))return _0xdc24a6;return null;}export function writeCachedLLMAgent(_0x4941ec,_0x409a75,_0x45d290,_0x119b2e){const _0x1617c2=a54_0x2f07fa;try{llmAgentCache[_0x1617c2(0x1fc)]({'name':_0x4941ec,'id':_0x409a75,'projectId':_0x45d290},_0x119b2e);}catch{}}export function clearCachedLLMAgent(_0x1b70eb){try{llmAgentCache['clear'](_0x1b70eb);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a54_0x2f07fa(0x1f9),{'suffix':a54_0x2f07fa(0x1f0)});export function getAccountInfoCacheFile(_0xae649){const _0x56194d=a54_0x2f07fa;return accountInfoCache[_0x56194d(0x1be)](_0xae649);}export function readCachedAccountInfo(_0x6e1b4c){const _0xcb63ab=a54_0x2f07fa,_0x2ac4fb=accountInfoCache[_0xcb63ab(0x1c2)](_0x6e1b4c);if(_0x2ac4fb&&typeof _0x2ac4fb[_0xcb63ab(0x1cd)]===_0xcb63ab(0x1d0)&&typeof _0x2ac4fb['accountId']===_0xcb63ab(0x1f7))return _0x2ac4fb;return null;}export function writeCachedAccountInfo(_0x8af8d1,_0x2938f6,_0x2487af){const _0xd59ff7=a54_0x2f07fa;try{accountInfoCache[_0xd59ff7(0x1fc)]({'site':_0x8af8d1,'accountId':_0x2938f6,'cachedAt':new Date()[_0xd59ff7(0x1d8)]()},_0x2487af);}catch{}}export function parseEnvFile(_0x2cf531){const _0x2841e9=a54_0x2f07fa,_0x122a05={};for(const _0xc7c381 of _0x2cf531['split']('\x0a')){const _0x1e5fa1=_0xc7c381[_0x2841e9(0x1f5)]();if(!_0x1e5fa1||_0x1e5fa1['startsWith']('#'))continue;const _0x3bc85c=_0x1e5fa1[_0x2841e9(0x1f2)](/^([^=]+)=(.*)$/);if(_0x3bc85c){const _0x16afac=_0x3bc85c[0x1][_0x2841e9(0x1f5)]();let _0x153519=_0x3bc85c[0x2]['trim']();(_0x153519[_0x2841e9(0x1bf)]('\x22')&&_0x153519[_0x2841e9(0x1c7)]('\x22')||_0x153519[_0x2841e9(0x1bf)]('\x27')&&_0x153519[_0x2841e9(0x1c7)]('\x27'))&&(_0x153519=_0x153519[_0x2841e9(0x1f8)](0x1,-0x1)),_0x122a05[_0x16afac]=_0x153519;}}return _0x122a05;}export function readUserConfig(){const _0x2f70bd=a54_0x2f07fa,_0x5d7a7d=getConfigFile();if(!existsSync(_0x5d7a7d))return{};try{const _0x141768=readFileSync(_0x5d7a7d,'utf-8');return parseEnvFile(_0x141768);}catch(_0x5be1c4){return console[_0x2f70bd(0x1f1)](_0x2f70bd(0x1cc)+_0x5d7a7d+':',_0x5be1c4),{};}}export function resolveSite(_0x406ce1){const _0x5de0a6=a54_0x2f07fa,_0x205f41=[_0x5de0a6(0x1ec),'ap01','eu01',_0x5de0a6(0x1de),'ap03',_0x5de0a6(0x1db),'dev-eu01',_0x5de0a6(0x1d5),'stg-ap01',_0x5de0a6(0x1cf)];if(_0x205f41[_0x5de0a6(0x1e5)](_0x406ce1))return _0x406ce1;if(_0x406ce1 in SITE_ALIASES)return SITE_ALIASES[_0x406ce1];return console[_0x5de0a6(0x1f1)]('Warning:\x20Unknown\x20site\x20\x27'+_0x406ce1+_0x5de0a6(0x1c4)),_0x5de0a6(0x1ec);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0xcb4d78){const _0x21c927=a54_0x2f07fa,_0x1cf482=_0xcb4d78||getActiveProfileName()||undefined;if(_0x1cf482){const _0x2b41dc=_0x21c927(0x1e2)+normalizeProfileForEnvVar(_0x1cf482);if(process.env[_0x2b41dc])return{'accessToken':process.env[_0x2b41dc],'source':_0x2b41dc+_0x21c927(0x1fb)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':'TDX_ACCESS_TOKEN\x20env\x20var'};return null;}export function getAccessToken(_0x5d88af){const _0x4bdb37=a54_0x2f07fa;return resolveAccessToken(_0x5d88af)?.[_0x4bdb37(0x1ca)];}export function getAPIKey(_0x11acd6){const _0x285894=a54_0x2f07fa,_0x1da43e=_0x11acd6||getActiveProfileName();if(_0x1da43e){const _0x22b5f8=_0x285894(0x1ce)+normalizeProfileForEnvVar(_0x1da43e);if(process.env[_0x22b5f8])return process.env[_0x22b5f8];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x8789){const _0x304a8e=a54_0x2f07fa;return _0x8789[_0x304a8e(0x1bc)]()[_0x304a8e(0x1d3)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0xc544fb,_0x58da65){const _0x190d73=a54_0x2f07fa,_0x40b9b6=resolveAccessToken(_0x58da65);if(_0x40b9b6)return{'apiKey':_0x40b9b6['accessToken'],'source':_0x40b9b6[_0x190d73(0x1b8)],'isDeprecated':![]};const _0x1c360b=_0x58da65||getActiveProfileName()||undefined;if(_0x1c360b){const _0x16e95e=_0x190d73(0x1ce)+normalizeProfileForEnvVar(_0x1c360b);if(process.env[_0x16e95e])return{'apiKey':process.env[_0x16e95e],'source':_0x16e95e+_0x190d73(0x1fb),'isDeprecated':![]};const _0x488161=getCachedCredential(_0xc544fb,_0x1c360b);if(_0x488161)return{'apiKey':_0x488161,'source':_0x190d73(0x1d1)+_0x1c360b+')','isDeprecated':![]};const _0x19473e=await getKeychainAPIKey(_0x1c360b);if(_0x19473e)return setCachedCredential(_0x19473e,_0xc544fb,_0x1c360b),{'apiKey':_0x19473e,'source':'keychain\x20(profile:\x20'+_0x1c360b+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x190d73(0x1e0),'isDeprecated':![]};if(!_0x1c360b){const _0x2e911a=getCachedCredential(_0xc544fb,undefined);if(_0x2e911a)return{'apiKey':_0x2e911a,'source':_0x190d73(0x1f6),'isDeprecated':![]};const _0x4093de=await getKeychainAPIKey(undefined);if(_0x4093de)return setCachedCredential(_0x4093de,_0xc544fb,undefined),{'apiKey':_0x4093de,'source':_0x190d73(0x1f6),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x46defd,_0x47c7e8){const _0x533655=a54_0x2f07fa,_0x31b1c7=await resolveAPIKeyAsync(_0x46defd,_0x47c7e8);return _0x31b1c7?.[_0x533655(0x1fe)];}function cleanupLegacyEnvFile(_0x3d96f9){const _0x263e8b=a54_0x2f07fa;if(!existsSync(_0x3d96f9))return![];try{const _0x29c82d=readFileSync(_0x3d96f9,'utf-8'),_0x72a69c=_0x29c82d[_0x263e8b(0x1df)]('\x0a'),_0x513668=_0x72a69c[_0x263e8b(0x1dd)](_0xd8496c=>{const _0x3635e1=_0x263e8b,_0x157c97=_0xd8496c[_0x3635e1(0x1f5)]();if(!_0x157c97||_0x157c97['startsWith']('#'))return!![];const [_0x450fe8]=_0x157c97[_0x3635e1(0x1df)]('=');return!_0x450fe8[_0x3635e1(0x1bf)](_0x3635e1(0x1c8));}),_0x227945=_0x513668[_0x263e8b(0x1c5)](_0x340e42=>{const _0x1ff9b6=_0x263e8b,_0x4c0c4c=_0x340e42['trim']();return _0x4c0c4c&&!_0x4c0c4c[_0x1ff9b6(0x1bf)]('#');});if(!_0x227945)return unlinkSync(_0x3d96f9),!![];return writeFileSync(_0x3d96f9,_0x513668[_0x263e8b(0x1e6)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x36c1de=a54_0x2f07fa;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x3164e6=a54_0x2f967d[_0x36c1de(0x1e6)](getConfigDir(),'tdx.json');if(!a54_0x4690d2[_0x36c1de(0x1e3)](_0x3164e6))return null;try{const _0x226764=a54_0x4690d2[_0x36c1de(0x202)](_0x3164e6,_0x36c1de(0x1e7)),_0x4db511=JSON[_0x36c1de(0x203)](_0x226764);return _0x4db511[_0x36c1de(0x1b9)]||null;}catch{return null;}}export function saveAPIKey(_0x313f57,_0x50f1c7,_0x27f291){const _0x3cdebf=a54_0x2f07fa,_0x3b8e90=getConfigDir(),_0x12f05f=getConfigFilePath(_0x27f291);!existsSync(_0x3b8e90)&&mkdirSync(_0x3b8e90,{'recursive':!![],'mode':0x1c0});let _0x5ee341={};if(existsSync(_0x12f05f))try{const _0x3a19d2=readFileSync(_0x12f05f,_0x3cdebf(0x1e7));_0x5ee341=parseEnvFile(_0x3a19d2);}catch(_0x4f4ad1){console['warn'](_0x3cdebf(0x1c3)+_0x12f05f+':',_0x4f4ad1);}const _0x542885=_0x313f57[_0x3cdebf(0x1bc)]()[_0x3cdebf(0x1d3)](/-/g,'_');_0x5ee341[_0x3cdebf(0x1d6)+_0x542885]=_0x50f1c7;const _0x421cc1=Object['entries'](_0x5ee341)[_0x3cdebf(0x1e9)](([_0x24c1a0,_0x5cf963])=>_0x24c1a0+'='+_0x5cf963);writeFileSync(_0x12f05f,_0x421cc1[_0x3cdebf(0x1e6)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x7ae8d6,_0x1fb859,_0x278469){const _0x46392f=a54_0x2f07fa;await saveKeychainAPIKey(_0x7ae8d6,_0x278469),setCachedCredential(_0x7ae8d6,_0x1fb859,_0x278469);const _0x925bf6=getConfigFilePath(_0x278469);cleanupLegacyEnvFile(_0x925bf6)&&console['warn'](a54_0x15eca2['yellow'](_0x46392f(0x200)));}export function loadConfig(){const _0x3fb294=a54_0x2f07fa,_0x23bf3f={'apiKeys':{},'defaultSite':'us01'},_0x10a9c5=[_0x3fb294(0x1ec),_0x3fb294(0x1fd),_0x3fb294(0x1d2),'ap02',_0x3fb294(0x1e4),_0x3fb294(0x1db),_0x3fb294(0x1f3),_0x3fb294(0x1d5),_0x3fb294(0x1dc),_0x3fb294(0x1cf)],_0x37aa00=getAPIKey();if(_0x37aa00)for(const _0x4959c1 of _0x10a9c5){_0x23bf3f['apiKeys'][_0x4959c1]=_0x37aa00;}return _0x23bf3f;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x51e4f1=a54_0x2f07fa,_0x25ed6f=a54_0x2f967d['join'](getConfigDir(),_0x51e4f1(0x1eb));if(!a54_0x4690d2[_0x51e4f1(0x1e3)](_0x25ed6f))return undefined;try{const _0x5e4df8=a54_0x4690d2['readFileSync'](_0x25ed6f,'utf-8'),_0xd3d6a8=JSON[_0x51e4f1(0x203)](_0x5e4df8);return typeof _0xd3d6a8['proxy']===_0x51e4f1(0x1d0)?_0xd3d6a8['proxy']:undefined;}catch{return undefined;}}function a54_0x505f(){const _0x1fe1d4=['name','path','startsWith','795055THTfbF','llm_default_project','read','Warning:\x20Failed\x20to\x20read\x20','\x27,\x20defaulting\x20to\x20us01','some','373844qYWLXv','endsWith','TD_API_KEY','48510agmVZb','accessToken','llm_default_agent','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','site','TDX_API_KEY_','stg-ap03','string','keychain\x20(profile:\x20','eu01','replace','release_channel','stg-us01','TD_API_KEY_','stable','toISOString','9GUKEGv','projectId','dev-us01','stg-ap01','filter','ap02','split','TDX_API_KEY\x20env\x20var','.env','TDX_ACCESS_TOKEN_','existsSync','ap03','includes','join','utf-8','1524774BJDPAz','map','1729128nwwgtD','tdx.json','us01','next','.config','846hIutXx','.json','warn','match','dev-eu01','stringify','trim','keychain','number','slice','config/account-info','tdx','\x20env\x20var','write','ap01','apiKey','3qZvwdZ','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','8505UJtlGq','readFileSync','parse','source','profile','config/llm-agent','2993610LtZCfe','toUpperCase'];a54_0x505f=function(){return _0x1fe1d4;};return a54_0x505f();}export function loadReleaseChannel(){const _0xf6ed29=a54_0x2f07fa,_0x5ac561=process.env.TDX_RELEASE_CHANNEL;if(_0x5ac561==='next'||_0x5ac561==='stable')return _0x5ac561;const _0x4399ae=a54_0x2f967d['join'](getConfigDir(),_0xf6ed29(0x1eb));if(!a54_0x4690d2['existsSync'](_0x4399ae))return'stable';try{const _0x555dea=a54_0x4690d2[_0xf6ed29(0x202)](_0x4399ae,_0xf6ed29(0x1e7)),_0x4540ab=JSON['parse'](_0x555dea);if(_0x4540ab['release_channel']===_0xf6ed29(0x1ed))return _0xf6ed29(0x1ed);}catch{}return _0xf6ed29(0x1d7);}export function saveReleaseChannel(_0x153a56){const _0x39519f=a54_0x2f07fa,_0x4f91ba=getConfigDir(),_0x34354a=a54_0x2f967d[_0x39519f(0x1e6)](_0x4f91ba,_0x39519f(0x1eb));!existsSync(_0x4f91ba)&&mkdirSync(_0x4f91ba,{'recursive':!![],'mode':0x1c0});let _0x555608={};if(existsSync(_0x34354a))try{const _0x255ecc=readFileSync(_0x34354a,_0x39519f(0x1e7));_0x555608=JSON[_0x39519f(0x203)](_0x255ecc);}catch{}_0x555608[_0x39519f(0x1d4)]=_0x153a56,writeFileSync(_0x34354a,JSON[_0x39519f(0x1f4)](_0x555608,null,0x2),{'mode':0x180});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a55_0x1ab8(){const _0x4ea404=['write','3497864HUJmRp','connections-{profile}.json','6814950KYTBod','connections','5325523hVGAmV','6MaZeyv','read','26767116MVnpHG','572701SxNWDh','2642106ntJgPN','2hmtTRN','5139728NzzhUO'];a55_0x1ab8=function(){return _0x4ea404;};return a55_0x1ab8();}function a55_0x4160(_0x253a96,_0x4a273d){_0x253a96=_0x253a96-0x169;const _0x1ab84a=a55_0x1ab8();let _0x4160d2=_0x1ab84a[_0x253a96];return _0x4160d2;}const a55_0x1e9085=a55_0x4160;(function(_0x35a11e,_0x42f806){const _0x24f8ac=a55_0x4160,_0xb35f2a=_0x35a11e();while(!![]){try{const _0x2b1c25=-parseInt(_0x24f8ac(0x169))/0x1*(parseInt(_0x24f8ac(0x16b))/0x2)+-parseInt(_0x24f8ac(0x16a))/0x3+-parseInt(_0x24f8ac(0x16e))/0x4+-parseInt(_0x24f8ac(0x170))/0x5+-parseInt(_0x24f8ac(0x173))/0x6*(-parseInt(_0x24f8ac(0x172))/0x7)+parseInt(_0x24f8ac(0x16c))/0x8+parseInt(_0x24f8ac(0x175))/0x9;if(_0x2b1c25===_0x42f806)break;else _0xb35f2a['push'](_0xb35f2a['shift']());}catch(_0x15934f){_0xb35f2a['push'](_0xb35f2a['shift']());}}}(a55_0x1ab8,0xa79b8));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a55_0x1e9085(0x16f),'core/connection-cache');export function loadCachedConnections(_0x48e544){const _0x59251d=a55_0x1e9085,_0x5cc36f=connectionCache[_0x59251d(0x174)](_0x48e544);return _0x5cc36f?.[_0x59251d(0x171)]??null;}export function saveCachedConnections(_0x5d75ed,_0x543709){const _0x2840ff=a55_0x1e9085;connectionCache[_0x2840ff(0x16d)](_0x5d75ed,{'connections':_0x543709,'cachedAt':Date['now']()});}export function clearConnectionCache(_0xc09a38){connectionCache['clear'](_0xc09a38);}
|
package/dist/core/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a56_0x8dac(_0x1da760,_0x39818b){_0x1da760=_0x1da760-0x172;const _0x27a45e=a56_0x27a4();let _0x8dacf2=_0x27a45e[_0x1da760];return _0x8dacf2;}const a56_0x14c94b=a56_0x8dac;(function(_0x2cb069,_0x1da8a4){const _0x11ef35=a56_0x8dac,_0x2a19b1=_0x2cb069();while(!![]){try{const _0x5f0fc4=-parseInt(_0x11ef35(0x189))/0x1*(-parseInt(_0x11ef35(0x179))/0x2)+-parseInt(_0x11ef35(0x183))/0x3*(parseInt(_0x11ef35(0x18c))/0x4)+-parseInt(_0x11ef35(0x193))/0x5+parseInt(_0x11ef35(0x17d))/0x6*(parseInt(_0x11ef35(0x18b))/0x7)+parseInt(_0x11ef35(0x175))/0x8*(parseInt(_0x11ef35(0x17e))/0x9)+-parseInt(_0x11ef35(0x176))/0xa*(parseInt(_0x11ef35(0x173))/0xb)+-parseInt(_0x11ef35(0x182))/0xc;if(_0x5f0fc4===_0x1da8a4)break;else _0x2a19b1['push'](_0x2a19b1['shift']());}catch(_0xbcfe72){_0x2a19b1['push'](_0x2a19b1['shift']());}}}(a56_0x27a4,0xd7017));import a56_0x421c23 from'prompts';function a56_0x27a4(){const _0x80377b=['us01','number','select','36ctTUQf','18CChyWn','customSite','site','ap02','4131780RFaoXm','492537nbMyDW','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','trim','Select\x20your\x20Treasure\x20Data\x20site:','log','Site\x20name\x20cannot\x20be\x20empty','44127XIZtUF','Cancelled','577843TBpwsj','8Dipbvi','jp\x20\x20\x20-\x20Japan','push','Enter\x20custom\x20site','value','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','findIndex','379705lcSTUW','other','length','341uUrddj','eu\x20\x20\x20-\x20Europe','4708072VSqzoP','227400fDxuXy','ap01','us\x20\x20\x20-\x20United\x20States','30yWVoRK'];a56_0x27a4=function(){return _0x80377b;};return a56_0x27a4();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x23ebd5,_0x23370a){const _0x397caa=a56_0x8dac;if(_0x23ebd5===undefined)return _0x23370a;if(typeof _0x23ebd5===_0x397caa(0x17b))return _0x23ebd5;return parseInt(_0x23ebd5,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a56_0x14c94b(0x178),'value':'us01'},{'title':a56_0x14c94b(0x18d),'value':a56_0x14c94b(0x177)},{'title':a56_0x14c94b(0x174),'value':'eu01'},{'title':'ap02\x20-\x20Korea','value':a56_0x14c94b(0x181)}];export function buildSiteChoices(_0x4d6722){const _0x4ba7e4=a56_0x14c94b,_0x2fc07c=[...STANDARD_SITE_CHOICES];let _0x520cc6=_0x2fc07c[_0x4ba7e4(0x192)](_0x4c68a7=>_0x4c68a7[_0x4ba7e4(0x190)]===_0x4d6722);return _0x520cc6===-0x1&&_0x4d6722!==_0x4ba7e4(0x17a)&&(_0x2fc07c[_0x4ba7e4(0x18e)]({'title':_0x4d6722,'value':_0x4d6722}),_0x520cc6=_0x2fc07c[_0x4ba7e4(0x172)]-0x1),_0x2fc07c[_0x4ba7e4(0x18e)]({'title':_0x4ba7e4(0x18f),'value':'other'}),{'choices':_0x2fc07c,'initialIndex':_0x520cc6>=0x0?_0x520cc6:0x0};}export async function promptSiteSelection(_0x42daf6,_0x1e76c8,_0x4f9f6e=a56_0x14c94b(0x18a)){const _0x347e90=a56_0x14c94b,{choices:_0x55002b,initialIndex:_0x173249}=buildSiteChoices(_0x42daf6),_0x4ac74e=_0x1e76c8?_0x347e90(0x184)+_0x1e76c8+'):':_0x347e90(0x186),_0x1cd6fb=await a56_0x421c23({'type':_0x347e90(0x17c),'name':_0x347e90(0x180),'message':_0x4ac74e,'choices':_0x55002b,'initial':_0x173249});if(!_0x1cd6fb[_0x347e90(0x180)])return console[_0x347e90(0x187)]('\x0a'+_0x4f9f6e),null;if(_0x1cd6fb[_0x347e90(0x180)]!==_0x347e90(0x194))return _0x1cd6fb['site'];const _0x362849=await a56_0x421c23({'type':'text','name':_0x347e90(0x17f),'message':'Enter\x20site\x20name:','initial':_0x347e90(0x17a),'validate':_0x4f7b9=>{const _0x42f325=_0x347e90;if(!_0x4f7b9||!_0x4f7b9[_0x42f325(0x185)]())return _0x42f325(0x188);if(!/^[a-z0-9-]+$/['test'](_0x4f7b9[_0x42f325(0x185)]()))return _0x42f325(0x191);return!![];}});if(!_0x362849['customSite'])return console[_0x347e90(0x187)]('\x0a'+_0x4f9f6e),null;return _0x362849['customSite'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x265e01,_0x52a8c1){const _0x1d868f=a57_0x5cc2,_0x3ae49c=_0x265e01();while(!![]){try{const _0x5afdfe=parseInt(_0x1d868f(0x100))/0x1*(-parseInt(_0x1d868f(0xff))/0x2)+-parseInt(_0x1d868f(0xf8))/0x3+parseInt(_0x1d868f(0xfb))/0x4+-parseInt(_0x1d868f(0xfa))/0x5+-parseInt(_0x1d868f(0x102))/0x6*(-parseInt(_0x1d868f(0x104))/0x7)+-parseInt(_0x1d868f(0xfe))/0x8+parseInt(_0x1d868f(0x103))/0x9;if(_0x5afdfe===_0x52a8c1)break;else _0x3ae49c['push'](_0x3ae49c['shift']());}catch(_0x3dcf52){_0x3ae49c['push'](_0x3ae49c['shift']());}}}(a57_0x3f05,0x5ae96));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a57_0x3f05(){const _0x533ae7=['clear','__default_site__','set','apiKey','1510326wiwSlY','get','1493445FTNkgE','548628zMPoLZ','loadedAt','delete','698384bTwUjP','2esFlcp','39559GiILZB','now','2064258ZpEHRw','4285071NkvtAa','14EiJjTc','__default_profile__'];a57_0x3f05=function(){return _0x533ae7;};return a57_0x3f05();}function a57_0x5cc2(_0x49cc05,_0x5d21b6){_0x49cc05=_0x49cc05-0xf8;const _0x3f053c=a57_0x3f05();let _0x5cc21d=_0x3f053c[_0x49cc05];return _0x5cc21d;}function getCacheKey(_0x4dbe8c,_0x325bfc){const _0x321bc5=a57_0x5cc2,_0x38517e=_0x4dbe8c||_0x321bc5(0x107),_0x17b260=_0x325bfc||_0x321bc5(0x105);return _0x38517e+':'+_0x17b260;}export function getCachedCredential(_0x1a7438,_0x8bab7){const _0x285dc7=a57_0x5cc2,_0x70dac=getCacheKey(_0x1a7438,_0x8bab7),_0x27dd86=cache[_0x285dc7(0xf9)](_0x70dac);if(!_0x27dd86)return null;if(Date[_0x285dc7(0x101)]()-_0x27dd86[_0x285dc7(0xfc)]>CACHE_TTL_MS)return cache['delete'](_0x70dac),null;return _0x27dd86[_0x285dc7(0x109)];}export function setCachedCredential(_0x1ee918,_0x3aec6a,_0x569c57){const _0x4dd38d=a57_0x5cc2,_0x2ed03b=getCacheKey(_0x3aec6a,_0x569c57);cache[_0x4dd38d(0x108)](_0x2ed03b,{'apiKey':_0x1ee918,'loadedAt':Date[_0x4dd38d(0x101)]()});}export function clearCredentialCache(){const _0x2b56aa=a57_0x5cc2;cache[_0x2b56aa(0x106)]();}export function clearCachedCredential(_0x9213ce,_0x4468c7){const _0x1d6d68=a57_0x5cc2,_0x442fb1=getCacheKey(_0x9213ce,_0x4468c7);cache[_0x1d6d68(0xfd)](_0x442fb1);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a58_0x382f64=a58_0x41eb;(function(_0x4e51b9,_0x2d6744){const _0x2218fa=a58_0x41eb,_0x595da5=_0x4e51b9();while(!![]){try{const _0x2f6b46=-parseInt(_0x2218fa(0x11c))/0x1+parseInt(_0x2218fa(0x118))/0x2+-parseInt(_0x2218fa(0x101))/0x3+-parseInt(_0x2218fa(0x124))/0x4+parseInt(_0x2218fa(0x10e))/0x5*(parseInt(_0x2218fa(0x135))/0x6)+parseInt(_0x2218fa(0x14a))/0x7+parseInt(_0x2218fa(0x12d))/0x8;if(_0x2f6b46===_0x2d6744)break;else _0x595da5['push'](_0x595da5['shift']());}catch(_0x33efc4){_0x595da5['push'](_0x595da5['shift']());}}}(a58_0x2717,0x1a65f));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens}from'./oauth-keychain.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a58_0x102de4 from'node:fs';function a58_0x41eb(_0x20d307,_0x46997d){_0x20d307=_0x20d307-0x101;const _0x2717ce=a58_0x2717();let _0x41ebbb=_0x2717ce[_0x20d307];return _0x41ebbb;}import*as a58_0x268243 from'node:path';function a58_0x2717(){const _0x4ca064=['join','segmentPath','not\x20set','Global\x20Credentials','workflow_project','Profile\x20Credentials','workflowProject','[configuration\x20files]','logLevel','Project','readFileSync','profileCredentials','760fTPrqy','resolveAPIKeyAsync','verbose','display','session','us01','assign','loadGlobalConfig','layers','(active)','24374qTrAlK','global','llmAgent','llm_project','106778qWGwBa','segment_path','access_token','bold','createAsync','project','apiKey','getParameters','686516DsDPLJ','getSource','parentSegment','activeProfile','.env','profile','string','cliFlags','database','3688608PXanXw','globalCredentials','existsSync','(session:\x20','replace','sessionId','log','entries','2412gzhevS','profileSource','Profile','cyan','displayWithSources','INFO','llm_agent','default','(using\x20session:\x20','proxy','[context]','env','configFiles','site','injectIntoOptions','profile:\x20','accessToken','config','Session','sessions','dim','337155cQNhUq','tdx.json','parent_segment','587994CjJiAR'];a58_0x2717=function(){return _0x4ca064;};return a58_0x2717();}import a58_0x30f6ee from'chalk';export class GlobalContext{[a58_0x382f64(0x142)];[a58_0x382f64(0x12c)];[a58_0x382f64(0x14c)];[a58_0x382f64(0x11d)];[a58_0x382f64(0x11b)];[a58_0x382f64(0x13b)];[a58_0x382f64(0x106)];[a58_0x382f64(0x122)];[a58_0x382f64(0x145)];['proxy'];['verbose'];['logLevel'];['profile'];['profileSource']=null;[a58_0x382f64(0x116)];[a58_0x382f64(0x127)];['sessionId'];[a58_0x382f64(0x141)];constructor(_0x2fbe98){const _0x2a5463=a58_0x382f64;this[_0x2a5463(0x132)]=getSessionID(_0x2fbe98[_0x2a5463(0x112)]);const _0x256ca5=loadSessionContext(_0x2fbe98[_0x2a5463(0x112)]),_0x55f2ed=loadProjectConfig(),_0x231122=this[_0x2a5463(0x115)]();if(_0x2fbe98[_0x2a5463(0x129)])this[_0x2a5463(0x127)]=_0x2fbe98['profile'],this['profileSource']='cli';else{if(_0x256ca5?.[_0x2a5463(0x129)])this[_0x2a5463(0x127)]=_0x256ca5[_0x2a5463(0x129)],this['profileSource']=_0x2a5463(0x112);else{if(_0x231122[_0x2a5463(0x129)])this[_0x2a5463(0x127)]=_0x231122['profile'],this[_0x2a5463(0x136)]='config';else process.env.TDX_PROFILE?(this[_0x2a5463(0x127)]=process.env.TDX_PROFILE,this['profileSource']=_0x2a5463(0x140)):(this[_0x2a5463(0x127)]=null,this[_0x2a5463(0x136)]=null);}}const _0x1b4f6d=this[_0x2a5463(0x127)]?loadProfile(this[_0x2a5463(0x127)]):null,_0x5ebed2=_0x4e6c35=>{const _0x179d42=_0x2a5463;if(!_0x4e6c35)return{};const _0x4a6ebf=_0x4e6c35,_0x49cdca={};for(const [_0x42eaff,_0x3534d2]of Object[_0x179d42(0x134)](_0x4a6ebf)){typeof _0x3534d2===_0x179d42(0x12a)&&(_0x49cdca[_0x42eaff]=_0x3534d2);}return _0x49cdca;},_0x9efd90={},_0x22aeee=(_0x16cf3e,_0x3395f9,_0x113cc5)=>{const _0x3b30a0=_0x2a5463;if(!_0x16cf3e)return![];if(_0x113cc5&&_0x16cf3e===_0x113cc5)return![];const _0x3545ff=_0x256ca5,_0x2541ac=_0x55f2ed,_0x26a89e=_0x1b4f6d?.[_0x3b30a0(0x146)],_0x188f72=_0x231122,_0x3e3ea3=_0x3545ff?.[_0x3395f9],_0x402433=_0x2541ac?.[_0x3395f9],_0x262349=_0x26a89e?.[_0x3395f9],_0x238d9d=_0x188f72[_0x3395f9];return _0x16cf3e!==_0x3e3ea3&&_0x16cf3e!==_0x402433&&_0x16cf3e!==_0x262349&&_0x16cf3e!==_0x238d9d;},_0x4d4d42=[{'optionKey':_0x2a5463(0x142),'contextKey':'site','defaultValue':_0x2a5463(0x113)},{'optionKey':_0x2a5463(0x12c),'contextKey':_0x2a5463(0x12c)},{'optionKey':_0x2a5463(0x126),'contextKey':'parent_segment'},{'optionKey':'llmProject','contextKey':_0x2a5463(0x11b)},{'optionKey':_0x2a5463(0x11a),'contextKey':_0x2a5463(0x13b)},{'optionKey':_0x2a5463(0x129),'contextKey':_0x2a5463(0x129)}];for(const {optionKey:_0x15c130,contextKey:_0x2eb865,defaultValue:_0x4b23a3}of _0x4d4d42){const _0x19a7af=_0x2fbe98[_0x15c130];_0x22aeee(_0x19a7af,_0x2eb865,_0x4b23a3)&&(_0x9efd90[_0x2eb865]=_0x19a7af);}this[_0x2a5463(0x116)]={'cliFlags':_0x9efd90,'session':_0x5ebed2(_0x256ca5),'project':_0x5ebed2(_0x55f2ed),'profile':_0x5ebed2(_0x1b4f6d?.[_0x2a5463(0x146)]),'global':_0x5ebed2(_0x231122)};const _0x1385b8={...this[_0x2a5463(0x116)][_0x2a5463(0x119)],...this[_0x2a5463(0x116)][_0x2a5463(0x129)],...this[_0x2a5463(0x116)][_0x2a5463(0x121)]};process.env.TDX_SITE&&!this[_0x2a5463(0x116)][_0x2a5463(0x112)][_0x2a5463(0x142)]&&!this[_0x2a5463(0x116)]['cliFlags']['site']&&(_0x1385b8[_0x2a5463(0x142)]=process.env.TDX_SITE);Object[_0x2a5463(0x114)](_0x1385b8,this[_0x2a5463(0x116)][_0x2a5463(0x112)]),Object[_0x2a5463(0x114)](_0x1385b8,this[_0x2a5463(0x116)][_0x2a5463(0x12b)]);const _0x4b8abc=_0x1385b8['site']||_0x2a5463(0x113);this['site']=resolveSite(_0x4b8abc),this[_0x2a5463(0x12c)]=_0x1385b8['database'],this[_0x2a5463(0x14c)]=_0x1385b8[_0x2a5463(0x14c)],this['segment_path']=_0x1385b8[_0x2a5463(0x11d)],this[_0x2a5463(0x11b)]=_0x1385b8[_0x2a5463(0x11b)],this['llm_agent']=_0x1385b8[_0x2a5463(0x13b)],this['workflow_project']=_0x1385b8['workflow_project'],this['verbose']=_0x2fbe98[_0x2a5463(0x110)]||![],this[_0x2a5463(0x10a)]=_0x2fbe98[_0x2a5463(0x10a)]??LogLevel[_0x2a5463(0x13a)],this[_0x2a5463(0x129)]=this[_0x2a5463(0x127)]||undefined,this[_0x2a5463(0x145)]=getAccessToken(this[_0x2a5463(0x127)]||undefined),this[_0x2a5463(0x122)]=getAPIKey(this[_0x2a5463(0x127)]||undefined);const _0x2ef11f=typeof _0x231122['proxy']==='string'?_0x231122[_0x2a5463(0x13e)]:undefined;this[_0x2a5463(0x13e)]=_0x2ef11f||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x570f1a=getConfigDir(),_0x3b09fc=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,_0x2a5463(0x148),this['sessionId']+'.json'),_0x5f4ec1=findProjectConfigPath(),_0x483881=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,_0x2a5463(0x14b)),_0x22c96b=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,_0x2a5463(0x128));let _0x5c4359=null,_0x231d17=null;this[_0x2a5463(0x127)]&&(_0x5c4359=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,'profiles',this['activeProfile'],_0x2a5463(0x14b)),_0x231d17=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,'profiles',this['activeProfile'],'.env')),this[_0x2a5463(0x141)]={'session':a58_0x102de4[_0x2a5463(0x12f)](_0x3b09fc)?_0x3b09fc:null,'project':_0x5f4ec1,'profile':_0x5c4359&&a58_0x102de4['existsSync'](_0x5c4359)?_0x5c4359:null,'profileCredentials':_0x231d17&&a58_0x102de4[_0x2a5463(0x12f)](_0x231d17)?_0x231d17:null,'global':a58_0x102de4[_0x2a5463(0x12f)](_0x483881)?_0x483881:null,'globalCredentials':a58_0x102de4[_0x2a5463(0x12f)](_0x22c96b)?_0x22c96b:null};}[a58_0x382f64(0x125)](_0x52b1ab,_0x585211){const _0x2a3ad9=a58_0x382f64;if(!_0x585211)return _0x2a3ad9(0x104);const _0x32308d=_0x585211;if(this[_0x2a3ad9(0x116)]['cliFlags'][_0x52b1ab]===_0x32308d){if(_0x52b1ab===_0x2a3ad9(0x142)&&_0x32308d===_0x2a3ad9(0x113)&&!this['layers'][_0x2a3ad9(0x112)][_0x2a3ad9(0x142)]&&!this['layers'][_0x2a3ad9(0x121)][_0x2a3ad9(0x142)]&&!this['layers'][_0x2a3ad9(0x129)][_0x2a3ad9(0x142)]&&!this[_0x2a3ad9(0x116)][_0x2a3ad9(0x119)][_0x2a3ad9(0x142)])return _0x2a3ad9(0x13c);return'CLI\x20flag:\x20--'+_0x52b1ab[_0x2a3ad9(0x131)](/_/g,'-');}if(this['layers'][_0x2a3ad9(0x112)][_0x52b1ab]===_0x32308d)return'session';if(this[_0x2a3ad9(0x116)]['project'][_0x52b1ab]===_0x32308d)return _0x2a3ad9(0x121);if(this[_0x2a3ad9(0x116)]['profile'][_0x52b1ab]===_0x32308d)return _0x2a3ad9(0x144)+this[_0x2a3ad9(0x127)];if(this[_0x2a3ad9(0x116)][_0x2a3ad9(0x119)][_0x52b1ab]===_0x32308d)return _0x2a3ad9(0x119);return _0x2a3ad9(0x13c);}[a58_0x382f64(0x115)](){const _0x2eff22=a58_0x382f64,_0x72887=a58_0x268243['join'](getConfigDir(),_0x2eff22(0x14b));if(!a58_0x102de4[_0x2eff22(0x12f)](_0x72887))return{};try{const _0x1cfa6e=a58_0x102de4[_0x2eff22(0x10c)](_0x72887,'utf-8');return JSON['parse'](_0x1cfa6e);}catch{return{};}}[a58_0x382f64(0x143)](_0x3fc9e9){const _0x5ac31c=a58_0x382f64;_0x3fc9e9[_0x5ac31c(0x142)]=this['site'],!_0x3fc9e9[_0x5ac31c(0x12c)]&&this['database']&&(_0x3fc9e9['database']=this[_0x5ac31c(0x12c)]),!_0x3fc9e9[_0x5ac31c(0x126)]&&this[_0x5ac31c(0x14c)]&&(_0x3fc9e9[_0x5ac31c(0x126)]=this['parent_segment']),!_0x3fc9e9[_0x5ac31c(0x103)]&&this[_0x5ac31c(0x11d)]&&(_0x3fc9e9[_0x5ac31c(0x103)]=this[_0x5ac31c(0x11d)]),!_0x3fc9e9['llmProject']&&this[_0x5ac31c(0x11b)]&&(_0x3fc9e9['llmProject']=this['llm_project']),!_0x3fc9e9[_0x5ac31c(0x11a)]&&this['llm_agent']&&(_0x3fc9e9[_0x5ac31c(0x11a)]=this[_0x5ac31c(0x13b)]),!_0x3fc9e9['workflowProject']&&this[_0x5ac31c(0x106)]&&(_0x3fc9e9[_0x5ac31c(0x108)]=this[_0x5ac31c(0x106)]);}[a58_0x382f64(0x123)](){const _0x4990d6=a58_0x382f64;return[{'key':_0x4990d6(0x142),'value':this[_0x4990d6(0x142)]},{'key':'database','value':this[_0x4990d6(0x12c)]},{'key':_0x4990d6(0x14c),'value':this[_0x4990d6(0x14c)]},{'key':_0x4990d6(0x11d),'value':this[_0x4990d6(0x11d)]},{'key':'llm_project','value':this[_0x4990d6(0x11b)]},{'key':_0x4990d6(0x13b),'value':this[_0x4990d6(0x13b)]},{'key':_0x4990d6(0x106),'value':this['workflow_project']},{'key':_0x4990d6(0x129),'value':this['activeProfile']||undefined}];}[a58_0x382f64(0x111)](){const _0x40b201=a58_0x382f64;console[_0x40b201(0x133)](a58_0x30f6ee[_0x40b201(0x11f)](_0x40b201(0x13f)));for(const {key:_0x4ab475,value:_0x420bf3}of this['getParameters']()){_0x420bf3&&console['log'](a58_0x30f6ee['cyan'](_0x4ab475)+':\x20'+_0x420bf3);}}[a58_0x382f64(0x139)](){const _0x184ff8=a58_0x382f64;console[_0x184ff8(0x133)](a58_0x30f6ee[_0x184ff8(0x11f)]('[context]'));for(const {key:_0x4a0239,value:_0x2612c9}of this['getParameters']()){if(_0x2612c9){const _0x2d0df7=_0x4a0239===_0x184ff8(0x129)?_0x184ff8(0x117):'('+this[_0x184ff8(0x125)](_0x4a0239,_0x2612c9)+')';console[_0x184ff8(0x133)](a58_0x30f6ee[_0x184ff8(0x138)](_0x4a0239)+':\x20'+_0x2612c9+'\x20'+a58_0x30f6ee[_0x184ff8(0x149)](_0x2d0df7));}}console[_0x184ff8(0x133)]('\x0a'+a58_0x30f6ee[_0x184ff8(0x11f)](_0x184ff8(0x109)));const _0x114084=[{'label':_0x184ff8(0x147),'path':this[_0x184ff8(0x141)][_0x184ff8(0x112)],'extra':_0x184ff8(0x130)+this[_0x184ff8(0x132)]+')'},{'label':_0x184ff8(0x10b),'path':this[_0x184ff8(0x141)][_0x184ff8(0x121)]},{'label':_0x184ff8(0x137),'path':this[_0x184ff8(0x141)][_0x184ff8(0x129)]},{'label':_0x184ff8(0x107),'path':this[_0x184ff8(0x141)][_0x184ff8(0x10d)]},{'label':'Global','path':this[_0x184ff8(0x141)][_0x184ff8(0x119)]},{'label':_0x184ff8(0x105),'path':this[_0x184ff8(0x141)][_0x184ff8(0x12e)]}];for(const {label:_0x28d48c,path:_0x1f21d0,extra:_0x18d208}of _0x114084){if(_0x1f21d0)console[_0x184ff8(0x133)](a58_0x30f6ee['cyan'](_0x28d48c)+':\x20'+_0x1f21d0+'\x20'+a58_0x30f6ee['green']('✓')+(_0x18d208?'\x20'+a58_0x30f6ee[_0x184ff8(0x149)](_0x18d208):''));else{if(_0x28d48c==='Session')console['log'](a58_0x30f6ee[_0x184ff8(0x138)](_0x28d48c)+':\x20'+a58_0x30f6ee[_0x184ff8(0x149)]('none')+'\x20'+a58_0x30f6ee[_0x184ff8(0x149)](_0x184ff8(0x13d)+this[_0x184ff8(0x132)]+')'));else(_0x28d48c===_0x184ff8(0x10b)||_0x28d48c==='Global')&&console[_0x184ff8(0x133)](a58_0x30f6ee[_0x184ff8(0x138)](_0x28d48c)+':\x20'+a58_0x30f6ee[_0x184ff8(0x149)]('none'));}}}async['resolveAPIKeyAsync'](){const _0x26360b=a58_0x382f64;if(!this['accessToken']){const _0x5da118=await getOAuthTokens(this['activeProfile']||undefined);if(_0x5da118)return this[_0x26360b(0x145)]=_0x5da118[_0x26360b(0x11e)],undefined;}return this[_0x26360b(0x122)]=await getAPIKeyAsync(this[_0x26360b(0x142)],this[_0x26360b(0x127)]||undefined),this['apiKey'];}static async[a58_0x382f64(0x120)](_0x437b2a){const _0x3d04a5=a58_0x382f64,_0x2048c8=new GlobalContext(_0x437b2a);return await _0x2048c8[_0x3d04a5(0x10f)](),_0x2048c8;}}
|
|
1
|
+
const a58_0x241559=a58_0x144f;function a58_0x144f(_0x1bf70b,_0x56c2e7){_0x1bf70b=_0x1bf70b-0x164;const _0x3dd9e3=a58_0x3dd9();let _0x144fb3=_0x3dd9e3[_0x1bf70b];return _0x144fb3;}function a58_0x3dd9(){const _0x11ae43=['profile','(using\x20session:\x20','green','9945864zuRzGI','loadGlobalConfig','assign','Profile\x20Credentials','verbose','8151730CLFleU','proxy','activeProfile','us01','apiKey','Project','tdx.json','Global','env','segmentPath','cyan','llmProject','llm_project','join','injectIntoOptions','llm_agent','llmAgent','layers','.json','INFO','660KtLijd','getParameters','1133726qBEJSR','getSource','.env','config','entries','dim','access_token','sessionId','workflowProject','database','Global\x20Credentials','globalCredentials','CLI\x20flag:\x20--','readFileSync','none','bold','[configuration\x20files]','project','cli','workflow_project','cliFlags','107821nybcCG','displayWithSources','configFiles','2620326rTTjJg','parse','segment_path','resolveAPIKeyAsync','display','session','logLevel','site','global','parentSegment','replace','108469anxdXg','string','[context]','createAsync','log','utf-8','default','profiles','27030KcpPqV','existsSync','profileSource','profileCredentials','8HJpovU','parent_segment','accessToken','Session','not\x20set','profile:\x20'];a58_0x3dd9=function(){return _0x11ae43;};return a58_0x3dd9();}(function(_0x4adcce,_0x4969ba){const _0x56707c=a58_0x144f,_0x527d0e=_0x4adcce();while(!![]){try{const _0x5f26e6=parseInt(_0x56707c(0x165))/0x1+-parseInt(_0x56707c(0x195))/0x2+parseInt(_0x56707c(0x16d))/0x3*(parseInt(_0x56707c(0x193))/0x4)+-parseInt(_0x56707c(0x17f))/0x5+parseInt(_0x56707c(0x1ad))/0x6+-parseInt(_0x56707c(0x1aa))/0x7+parseInt(_0x56707c(0x171))/0x8*(parseInt(_0x56707c(0x17a))/0x9);if(_0x5f26e6===_0x4969ba)break;else _0x527d0e['push'](_0x527d0e['shift']());}catch(_0x3baae){_0x527d0e['push'](_0x527d0e['shift']());}}}(a58_0x3dd9,0xe1aa4));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens}from'./oauth-keychain.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a58_0x2dd967 from'node:fs';import*as a58_0x584a91 from'node:path';import a58_0x347817 from'chalk';export class GlobalContext{['site'];[a58_0x241559(0x19e)];[a58_0x241559(0x172)];[a58_0x241559(0x1af)];[a58_0x241559(0x18b)];[a58_0x241559(0x18e)];[a58_0x241559(0x1a8)];[a58_0x241559(0x183)];[a58_0x241559(0x173)];[a58_0x241559(0x180)];[a58_0x241559(0x17e)];[a58_0x241559(0x1b3)];[a58_0x241559(0x177)];[a58_0x241559(0x16f)]=null;[a58_0x241559(0x190)];['activeProfile'];[a58_0x241559(0x19c)];[a58_0x241559(0x1ac)];constructor(_0x5cb55a){const _0x36dbb8=a58_0x241559;this['sessionId']=getSessionID(_0x5cb55a[_0x36dbb8(0x1b2)]);const _0x111593=loadSessionContext(_0x5cb55a[_0x36dbb8(0x1b2)]),_0x21f201=loadProjectConfig(),_0x491c4f=this[_0x36dbb8(0x17b)]();if(_0x5cb55a[_0x36dbb8(0x177)])this[_0x36dbb8(0x181)]=_0x5cb55a[_0x36dbb8(0x177)],this[_0x36dbb8(0x16f)]=_0x36dbb8(0x1a7);else{if(_0x111593?.['profile'])this[_0x36dbb8(0x181)]=_0x111593['profile'],this[_0x36dbb8(0x16f)]='session';else{if(_0x491c4f[_0x36dbb8(0x177)])this[_0x36dbb8(0x181)]=_0x491c4f[_0x36dbb8(0x177)],this['profileSource']=_0x36dbb8(0x198);else process.env.TDX_PROFILE?(this[_0x36dbb8(0x181)]=process.env.TDX_PROFILE,this[_0x36dbb8(0x16f)]=_0x36dbb8(0x187)):(this[_0x36dbb8(0x181)]=null,this[_0x36dbb8(0x16f)]=null);}}const _0x14fe0a=this[_0x36dbb8(0x181)]?loadProfile(this[_0x36dbb8(0x181)]):null,_0x3ebfda=_0x3cc4f1=>{const _0x3121e6=_0x36dbb8;if(!_0x3cc4f1)return{};const _0x4be58b=_0x3cc4f1,_0x315a61={};for(const [_0x28bae0,_0x5f4f0c]of Object[_0x3121e6(0x199)](_0x4be58b)){typeof _0x5f4f0c===_0x3121e6(0x166)&&(_0x315a61[_0x28bae0]=_0x5f4f0c);}return _0x315a61;},_0x23f4c0={},_0x29e02b=(_0x4a6f3a,_0x2e4104,_0x5ea7cf)=>{const _0x542cf1=_0x36dbb8;if(!_0x4a6f3a)return![];if(_0x5ea7cf&&_0x4a6f3a===_0x5ea7cf)return![];const _0x40f28f=_0x111593,_0x4a0b9b=_0x21f201,_0xac6230=_0x14fe0a?.[_0x542cf1(0x198)],_0x2632cb=_0x491c4f,_0x2cad55=_0x40f28f?.[_0x2e4104],_0x4a64aa=_0x4a0b9b?.[_0x2e4104],_0x15366e=_0xac6230?.[_0x2e4104],_0x179992=_0x2632cb[_0x2e4104];return _0x4a6f3a!==_0x2cad55&&_0x4a6f3a!==_0x4a64aa&&_0x4a6f3a!==_0x15366e&&_0x4a6f3a!==_0x179992;},_0x14d118=[{'optionKey':'site','contextKey':_0x36dbb8(0x1b4),'defaultValue':_0x36dbb8(0x182)},{'optionKey':_0x36dbb8(0x19e),'contextKey':_0x36dbb8(0x19e)},{'optionKey':_0x36dbb8(0x1b6),'contextKey':_0x36dbb8(0x172)},{'optionKey':_0x36dbb8(0x18a),'contextKey':'llm_project'},{'optionKey':'llmAgent','contextKey':'llm_agent'},{'optionKey':_0x36dbb8(0x177),'contextKey':_0x36dbb8(0x177)}];for(const {optionKey:_0x344971,contextKey:_0x27be23,defaultValue:_0x425425}of _0x14d118){const _0x554dae=_0x5cb55a[_0x344971];_0x29e02b(_0x554dae,_0x27be23,_0x425425)&&(_0x23f4c0[_0x27be23]=_0x554dae);}this['layers']={'cliFlags':_0x23f4c0,'session':_0x3ebfda(_0x111593),'project':_0x3ebfda(_0x21f201),'profile':_0x3ebfda(_0x14fe0a?.[_0x36dbb8(0x198)]),'global':_0x3ebfda(_0x491c4f)};const _0x391c88={...this[_0x36dbb8(0x190)][_0x36dbb8(0x1b5)],...this['layers']['profile'],...this[_0x36dbb8(0x190)][_0x36dbb8(0x1a6)]};process.env.TDX_SITE&&!this['layers'][_0x36dbb8(0x1b2)]['site']&&!this['layers'][_0x36dbb8(0x1a9)][_0x36dbb8(0x1b4)]&&(_0x391c88[_0x36dbb8(0x1b4)]=process.env.TDX_SITE);Object[_0x36dbb8(0x17c)](_0x391c88,this[_0x36dbb8(0x190)][_0x36dbb8(0x1b2)]),Object[_0x36dbb8(0x17c)](_0x391c88,this[_0x36dbb8(0x190)][_0x36dbb8(0x1a9)]);const _0xee7083=_0x391c88[_0x36dbb8(0x1b4)]||_0x36dbb8(0x182);this['site']=resolveSite(_0xee7083),this[_0x36dbb8(0x19e)]=_0x391c88[_0x36dbb8(0x19e)],this[_0x36dbb8(0x172)]=_0x391c88[_0x36dbb8(0x172)],this['segment_path']=_0x391c88[_0x36dbb8(0x1af)],this['llm_project']=_0x391c88[_0x36dbb8(0x18b)],this[_0x36dbb8(0x18e)]=_0x391c88[_0x36dbb8(0x18e)],this[_0x36dbb8(0x1a8)]=_0x391c88[_0x36dbb8(0x1a8)],this[_0x36dbb8(0x17e)]=_0x5cb55a[_0x36dbb8(0x17e)]||![],this[_0x36dbb8(0x1b3)]=_0x5cb55a[_0x36dbb8(0x1b3)]??LogLevel[_0x36dbb8(0x192)],this[_0x36dbb8(0x177)]=this['activeProfile']||undefined,this[_0x36dbb8(0x173)]=getAccessToken(this[_0x36dbb8(0x181)]||undefined),this[_0x36dbb8(0x183)]=getAPIKey(this[_0x36dbb8(0x181)]||undefined);const _0x1bef1a=typeof _0x491c4f['proxy']===_0x36dbb8(0x166)?_0x491c4f['proxy']:undefined;this[_0x36dbb8(0x180)]=_0x1bef1a||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x50914d=getConfigDir(),_0x178cec=a58_0x584a91['join'](_0x50914d,'sessions',this[_0x36dbb8(0x19c)]+_0x36dbb8(0x191)),_0x528e3b=findProjectConfigPath(),_0x1dace8=a58_0x584a91['join'](_0x50914d,'tdx.json'),_0x496a60=a58_0x584a91[_0x36dbb8(0x18c)](_0x50914d,_0x36dbb8(0x197));let _0x1019b2=null,_0xf81735=null;this[_0x36dbb8(0x181)]&&(_0x1019b2=a58_0x584a91[_0x36dbb8(0x18c)](_0x50914d,_0x36dbb8(0x16c),this[_0x36dbb8(0x181)],_0x36dbb8(0x185)),_0xf81735=a58_0x584a91['join'](_0x50914d,'profiles',this[_0x36dbb8(0x181)],_0x36dbb8(0x197))),this[_0x36dbb8(0x1ac)]={'session':a58_0x2dd967[_0x36dbb8(0x16e)](_0x178cec)?_0x178cec:null,'project':_0x528e3b,'profile':_0x1019b2&&a58_0x2dd967[_0x36dbb8(0x16e)](_0x1019b2)?_0x1019b2:null,'profileCredentials':_0xf81735&&a58_0x2dd967['existsSync'](_0xf81735)?_0xf81735:null,'global':a58_0x2dd967[_0x36dbb8(0x16e)](_0x1dace8)?_0x1dace8:null,'globalCredentials':a58_0x2dd967[_0x36dbb8(0x16e)](_0x496a60)?_0x496a60:null};}[a58_0x241559(0x196)](_0x5a12c3,_0x23af24){const _0x473448=a58_0x241559;if(!_0x23af24)return _0x473448(0x175);const _0x4b672a=_0x23af24;if(this[_0x473448(0x190)][_0x473448(0x1a9)][_0x5a12c3]===_0x4b672a){if(_0x5a12c3==='site'&&_0x4b672a===_0x473448(0x182)&&!this['layers'][_0x473448(0x1b2)]['site']&&!this['layers']['project'][_0x473448(0x1b4)]&&!this[_0x473448(0x190)][_0x473448(0x177)][_0x473448(0x1b4)]&&!this['layers'][_0x473448(0x1b5)][_0x473448(0x1b4)])return _0x473448(0x16b);return _0x473448(0x1a1)+_0x5a12c3[_0x473448(0x164)](/_/g,'-');}if(this[_0x473448(0x190)][_0x473448(0x1b2)][_0x5a12c3]===_0x4b672a)return'session';if(this[_0x473448(0x190)][_0x473448(0x1a6)][_0x5a12c3]===_0x4b672a)return _0x473448(0x1a6);if(this['layers']['profile'][_0x5a12c3]===_0x4b672a)return _0x473448(0x176)+this[_0x473448(0x181)];if(this[_0x473448(0x190)][_0x473448(0x1b5)][_0x5a12c3]===_0x4b672a)return _0x473448(0x1b5);return'default';}[a58_0x241559(0x17b)](){const _0x143c82=a58_0x241559,_0x528f43=a58_0x584a91['join'](getConfigDir(),_0x143c82(0x185));if(!a58_0x2dd967[_0x143c82(0x16e)](_0x528f43))return{};try{const _0x2a5010=a58_0x2dd967[_0x143c82(0x1a2)](_0x528f43,_0x143c82(0x16a));return JSON[_0x143c82(0x1ae)](_0x2a5010);}catch{return{};}}[a58_0x241559(0x18d)](_0x34e7df){const _0x4978cb=a58_0x241559;_0x34e7df['site']=this[_0x4978cb(0x1b4)],!_0x34e7df['database']&&this[_0x4978cb(0x19e)]&&(_0x34e7df[_0x4978cb(0x19e)]=this[_0x4978cb(0x19e)]),!_0x34e7df['parentSegment']&&this[_0x4978cb(0x172)]&&(_0x34e7df[_0x4978cb(0x1b6)]=this[_0x4978cb(0x172)]),!_0x34e7df[_0x4978cb(0x188)]&&this[_0x4978cb(0x1af)]&&(_0x34e7df['segmentPath']=this[_0x4978cb(0x1af)]),!_0x34e7df[_0x4978cb(0x18a)]&&this[_0x4978cb(0x18b)]&&(_0x34e7df[_0x4978cb(0x18a)]=this[_0x4978cb(0x18b)]),!_0x34e7df[_0x4978cb(0x18f)]&&this['llm_agent']&&(_0x34e7df[_0x4978cb(0x18f)]=this[_0x4978cb(0x18e)]),!_0x34e7df[_0x4978cb(0x19d)]&&this[_0x4978cb(0x1a8)]&&(_0x34e7df[_0x4978cb(0x19d)]=this[_0x4978cb(0x1a8)]);}[a58_0x241559(0x194)](){const _0x45be1b=a58_0x241559;return[{'key':_0x45be1b(0x1b4),'value':this[_0x45be1b(0x1b4)]},{'key':'database','value':this[_0x45be1b(0x19e)]},{'key':_0x45be1b(0x172),'value':this[_0x45be1b(0x172)]},{'key':_0x45be1b(0x1af),'value':this[_0x45be1b(0x1af)]},{'key':_0x45be1b(0x18b),'value':this['llm_project']},{'key':_0x45be1b(0x18e),'value':this[_0x45be1b(0x18e)]},{'key':_0x45be1b(0x1a8),'value':this[_0x45be1b(0x1a8)]},{'key':_0x45be1b(0x177),'value':this[_0x45be1b(0x181)]||undefined}];}[a58_0x241559(0x1b1)](){const _0xa1c86d=a58_0x241559;console[_0xa1c86d(0x169)](a58_0x347817[_0xa1c86d(0x1a4)]('[context]'));for(const {key:_0x544942,value:_0x23e351}of this[_0xa1c86d(0x194)]()){_0x23e351&&console['log'](a58_0x347817[_0xa1c86d(0x189)](_0x544942)+':\x20'+_0x23e351);}}[a58_0x241559(0x1ab)](){const _0x22556b=a58_0x241559;console[_0x22556b(0x169)](a58_0x347817[_0x22556b(0x1a4)](_0x22556b(0x167)));for(const {key:_0x10962d,value:_0x14cddf}of this[_0x22556b(0x194)]()){if(_0x14cddf){const _0x960482=_0x10962d===_0x22556b(0x177)?'(active)':'('+this[_0x22556b(0x196)](_0x10962d,_0x14cddf)+')';console[_0x22556b(0x169)](a58_0x347817['cyan'](_0x10962d)+':\x20'+_0x14cddf+'\x20'+a58_0x347817[_0x22556b(0x19a)](_0x960482));}}console['log']('\x0a'+a58_0x347817[_0x22556b(0x1a4)](_0x22556b(0x1a5)));const _0x5af5bf=[{'label':_0x22556b(0x174),'path':this['configFiles'][_0x22556b(0x1b2)],'extra':'(session:\x20'+this[_0x22556b(0x19c)]+')'},{'label':_0x22556b(0x184),'path':this[_0x22556b(0x1ac)][_0x22556b(0x1a6)]},{'label':'Profile','path':this[_0x22556b(0x1ac)][_0x22556b(0x177)]},{'label':_0x22556b(0x17d),'path':this[_0x22556b(0x1ac)][_0x22556b(0x170)]},{'label':'Global','path':this[_0x22556b(0x1ac)][_0x22556b(0x1b5)]},{'label':_0x22556b(0x19f),'path':this['configFiles'][_0x22556b(0x1a0)]}];for(const {label:_0x40b1a5,path:_0x42ad9e,extra:_0x14d192}of _0x5af5bf){if(_0x42ad9e)console[_0x22556b(0x169)](a58_0x347817['cyan'](_0x40b1a5)+':\x20'+_0x42ad9e+'\x20'+a58_0x347817[_0x22556b(0x179)]('✓')+(_0x14d192?'\x20'+a58_0x347817[_0x22556b(0x19a)](_0x14d192):''));else{if(_0x40b1a5===_0x22556b(0x174))console[_0x22556b(0x169)](a58_0x347817['cyan'](_0x40b1a5)+':\x20'+a58_0x347817[_0x22556b(0x19a)]('none')+'\x20'+a58_0x347817[_0x22556b(0x19a)](_0x22556b(0x178)+this['sessionId']+')'));else(_0x40b1a5===_0x22556b(0x184)||_0x40b1a5===_0x22556b(0x186))&&console[_0x22556b(0x169)](a58_0x347817[_0x22556b(0x189)](_0x40b1a5)+':\x20'+a58_0x347817[_0x22556b(0x19a)](_0x22556b(0x1a3)));}}}async[a58_0x241559(0x1b0)](){const _0x401b27=a58_0x241559;if(!this[_0x401b27(0x173)]){const _0x346dbe=await getOAuthTokens(this[_0x401b27(0x181)]||undefined);if(_0x346dbe)return this[_0x401b27(0x173)]=_0x346dbe[_0x401b27(0x19b)],undefined;}return this[_0x401b27(0x183)]=await getAPIKeyAsync(this['site'],this[_0x401b27(0x181)]||undefined),this[_0x401b27(0x183)];}static async[a58_0x241559(0x168)](_0x32e68f){const _0x5ee800=a58_0x241559,_0x488b61=new GlobalContext(_0x32e68f);return await _0x488b61[_0x5ee800(0x1b0)](),_0x488b61;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a59_0x8e7b2c=a59_0x4e2d;(function(_0x5e9bba,_0x179705){const _0xa210d=a59_0x4e2d,_0x306ee9=_0x5e9bba();while(!![]){try{const _0x11f8cd=-parseInt(_0xa210d(0xbd))/0x1*(-parseInt(_0xa210d(0xc5))/0x2)+parseInt(_0xa210d(0xc8))/0x3+-parseInt(_0xa210d(0xc3))/0x4+-parseInt(_0xa210d(0xcb))/0x5*(parseInt(_0xa210d(0xb4))/0x6)+parseInt(_0xa210d(0xcf))/0x7*(parseInt(_0xa210d(0xca))/0x8)+-parseInt(_0xa210d(0xb2))/0x9+parseInt(_0xa210d(0xbf))/0xa;if(_0x11f8cd===_0x179705)break;else _0x306ee9['push'](_0x306ee9['shift']());}catch(_0x3f305a){_0x306ee9['push'](_0x306ee9['shift']());}}}(a59_0x5f56,0x381bf));const SERVICE_NAME=a59_0x8e7b2c(0xc6);function a59_0x5f56(){const _0x164561=['Warning:\x20','16QWRhAM','225aXSVpd','access_denied','not_found','@napi-rs/keyring','61579VOSmcc','setPassword','toLowerCase','no\x20matching\x20entry','System\x20keychain\x20is\x20not\x20available','could\x20not\x20be\x20found','getPassword','reason','2847447YPWroS','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.','5982vsHGsx','includes','-25293','not\x20available','Entry','deleteCredential','__keychain_test__','profile:','unavailable','3ZFLuMx','not\x20supported','2005460Vsiplr','cannot\x20find','message','success','671116UOjRUp',':api_key','296196TwsENY','tdx','value','289248iunQlT'];a59_0x5f56=function(){return _0x164561;};return a59_0x5f56();}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x56fa8a=a59_0x8e7b2c;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x5030c2=await import(_0x56fa8a(0xce));return EntryClass=_0x5030c2[_0x56fa8a(0xb8)],EntryClass;}catch(_0x1a0f8b){return keyringLoadError=_0x1a0f8b instanceof Error?_0x1a0f8b:new Error(String(_0x1a0f8b)),null;}}function getAccountName(_0x153707){const _0x44e41c=a59_0x8e7b2c,_0x5861c1=_0x153707||'';return _0x44e41c(0xbb)+_0x5861c1+_0x44e41c(0xc4);}export async function getKeychainAPIKey(_0x53096b){const _0x5e733e=a59_0x8e7b2c,_0x24183c=await getKeychainAPIKeyWithStatus(_0x53096b);if(_0x24183c[_0x5e733e(0xc2)])return _0x24183c[_0x5e733e(0xc7)];return _0x24183c[_0x5e733e(0xb1)]===_0x5e733e(0xcc)&&console['error'](_0x5e733e(0xc9)+_0x24183c['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x144b66){const _0x37c024=a59_0x8e7b2c;try{const _0x5ec853=await getEntryClass();if(!_0x5ec853)return{'success':![],'reason':'unavailable'};const _0x413f0a=getAccountName(_0x144b66),_0x43e25f=new _0x5ec853(SERVICE_NAME,_0x413f0a),_0x4cde83=_0x43e25f[_0x37c024(0xb0)]();if(_0x4cde83)return{'success':!![],'value':_0x4cde83};return{'success':![],'reason':_0x37c024(0xcd)};}catch(_0x42432d){const _0x38cb5b=_0x42432d instanceof Error?_0x42432d['message']:String(_0x42432d);if(_0x38cb5b[_0x37c024(0xb5)]('-25300')||_0x38cb5b[_0x37c024(0xac)]()[_0x37c024(0xb5)](_0x37c024(0xaf))||_0x38cb5b[_0x37c024(0xac)]()[_0x37c024(0xb5)]('not\x20found')||_0x38cb5b[_0x37c024(0xac)]()[_0x37c024(0xb5)](_0x37c024(0xad)))return{'success':![],'reason':_0x37c024(0xcd)};if(_0x38cb5b['includes'](_0x37c024(0xb6))||_0x38cb5b[_0x37c024(0xac)]()[_0x37c024(0xb5)]('restricted')||_0x38cb5b[_0x37c024(0xac)]()[_0x37c024(0xb5)]('access'))return{'success':![],'reason':'access_denied','message':_0x37c024(0xb3)};return{'success':![],'reason':_0x37c024(0xbc),'message':_0x38cb5b};}}function a59_0x4e2d(_0x1db056,_0x404a13){_0x1db056=_0x1db056-0xab;const _0x5f56a6=a59_0x5f56();let _0x4e2d08=_0x5f56a6[_0x1db056];return _0x4e2d08;}export async function saveKeychainAPIKey(_0x354f1c,_0x51872b){const _0x388d9d=a59_0x8e7b2c,_0x4a915e=await getEntryClass();if(!_0x4a915e)throw new Error(_0x388d9d(0xae));const _0x18c92b=getAccountName(_0x51872b),_0x3f1e8b=new _0x4a915e(SERVICE_NAME,_0x18c92b);_0x3f1e8b[_0x388d9d(0xab)](_0x354f1c);}export async function deleteKeychainAPIKey(_0x3e2b92){const _0x540e3f=a59_0x8e7b2c;try{const _0x47ec57=await getEntryClass();if(!_0x47ec57)return![];const _0x3853e2=getAccountName(_0x3e2b92),_0x47bfb1=new _0x47ec57(SERVICE_NAME,_0x3853e2);return _0x47bfb1[_0x540e3f(0xb9)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0xa369e=a59_0x8e7b2c;try{const _0x490216=await getEntryClass();if(!_0x490216)return![];const _0x12b717=new _0x490216(SERVICE_NAME,_0xa369e(0xba));return _0x12b717[_0xa369e(0xb0)](),!![];}catch(_0x3c786f){const _0x4b8111=_0x3c786f instanceof Error?_0x3c786f[_0xa369e(0xc1)][_0xa369e(0xac)]():'';if(_0x4b8111[_0xa369e(0xb5)](_0xa369e(0xb7))||_0x4b8111[_0xa369e(0xb5)](_0xa369e(0xbe))||_0x4b8111[_0xa369e(0xb5)](_0xa369e(0xc0)))return![];return!![];}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a60_0x33dfc2=a60_0x20ff;(function(_0x393f56,_0x557053){const _0x1cbe26=a60_0x20ff,_0x1c45b8=_0x393f56();while(!![]){try{const _0x58acd7=-parseInt(_0x1cbe26(0xff))/0x1+parseInt(_0x1cbe26(0x105))/0x2+parseInt(_0x1cbe26(0x101))/0x3+parseInt(_0x1cbe26(0x10a))/0x4+-parseInt(_0x1cbe26(0x109))/0x5*(parseInt(_0x1cbe26(0x106))/0x6)+parseInt(_0x1cbe26(0x100))/0x7+parseInt(_0x1cbe26(0x10c))/0x8*(-parseInt(_0x1cbe26(0x10b))/0x9);if(_0x58acd7===_0x557053)break;else _0x1c45b8['push'](_0x1c45b8['shift']());}catch(_0x5c9806){_0x1c45b8['push'](_0x1c45b8['shift']());}}}(a60_0x1c1b,0x5de2b));const SERVICE_NAME=a60_0x33dfc2(0x103);function a60_0x1c1b(){const _0x37c475=['1115716uCcrHK','9tJsvUD','659112VCzViQ','profile:','parse','deleteCredential','stringify','337585KvzKPk','1118278oQlJRc','1060866zZHIyf',':oauth_tokens','tdx','Entry','763076MDEXvk','132JBiNku','setPassword','@napi-rs/keyring','83935BrODDp'];a60_0x1c1b=function(){return _0x37c475;};return a60_0x1c1b();}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x6195c7=a60_0x33dfc2;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x48c1e6=await import(_0x6195c7(0x108));return EntryClass=_0x48c1e6[_0x6195c7(0x104)],EntryClass;}catch(_0x43e65e){return keyringLoadError=_0x43e65e instanceof Error?_0x43e65e:new Error(String(_0x43e65e)),null;}}function a60_0x20ff(_0x2ac642,_0x5eb013){_0x2ac642=_0x2ac642-0xfb;const _0x1c1b1b=a60_0x1c1b();let _0x20ffd3=_0x1c1b1b[_0x2ac642];return _0x20ffd3;}function getOAuthAccountName(_0x434cb5){const _0x4d0a78=a60_0x33dfc2,_0x3c33d3=_0x434cb5||'';return _0x4d0a78(0xfb)+_0x3c33d3+_0x4d0a78(0x102);}export async function saveOAuthTokens(_0x131442,_0xb689ac){const _0x5ab0f5=a60_0x33dfc2,_0x3c4d53=await getEntryClass();if(!_0x3c4d53)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x2cd894=getOAuthAccountName(_0xb689ac),_0x58794c=new _0x3c4d53(SERVICE_NAME,_0x2cd894);_0x58794c[_0x5ab0f5(0x107)](JSON[_0x5ab0f5(0xfe)](_0x131442));}export async function getOAuthTokens(_0x3c6b4c){const _0x5ceccd=a60_0x33dfc2;try{const _0xa0533b=await getEntryClass();if(!_0xa0533b)return null;const _0x34efef=getOAuthAccountName(_0x3c6b4c),_0x43825f=new _0xa0533b(SERVICE_NAME,_0x34efef),_0x52c9c8=_0x43825f['getPassword']();if(_0x52c9c8)return JSON[_0x5ceccd(0xfc)](_0x52c9c8);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x243e31){const _0x6b0431=a60_0x33dfc2;try{const _0x3577ea=await getEntryClass();if(!_0x3577ea)return![];const _0x3da514=getOAuthAccountName(_0x243e31),_0x22c79a=new _0x3577ea(SERVICE_NAME,_0x3da514);return _0x22c79a[_0x6b0431(0xfd)](),!![];}catch{return![];}}
|
package/dist/core/oauth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a61_0x445eac=a61_0xd51c;(function(_0x5951ba,_0xbe8388){const _0xe933f5=a61_0xd51c,_0x6f016e=_0x5951ba();while(!![]){try{const _0x38fa49=-parseInt(_0xe933f5(0x1a8))/0x1+-parseInt(_0xe933f5(0x1b9))/0x2*(-parseInt(_0xe933f5(0x1d8))/0x3)+-parseInt(_0xe933f5(0x1c4))/0x4*(parseInt(_0xe933f5(0x1aa))/0x5)+parseInt(_0xe933f5(0x1ba))/0x6*(parseInt(_0xe933f5(0x1b3))/0x7)+-parseInt(_0xe933f5(0x1a3))/0x8+-parseInt(_0xe933f5(0x1cb))/0x9+-parseInt(_0xe933f5(0x1d2))/0xa;if(_0x38fa49===_0xbe8388)break;else _0x6f016e['push'](_0x6f016e['shift']());}catch(_0x1a102d){_0x6f016e['push'](_0x6f016e['shift']());}}}(a61_0xa6e2,0x85b0c));import*as a61_0x50a467 from'node:crypto';function a61_0xa6e2(){const _0x3451cc=['<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','end','get','127.0.0.1','/oauth/token','client_id','state','toString','response_type','8xwledo','set','hex','error','redirectUri','text','searchParams','1107018BeCTGk','createHash','pathname','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','digest','application/x-www-form-urlencoded','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','2085030XGkEuH','close','/oauth/authorize','base64url','message','dev-eu01','807oAiFaM','update','randomBytes','stg-ap01','/oauth/callback','scope','EADDRINUSE','writeHead','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','status','json','2974400jbCZfk','):\x20','POST','text/html','sha256','358401acbhnf','text/plain','1286255BLYBDN','Port\x20','OAuth\x20token\x20request\x20failed\x20(','has','code','waitForCallback','stg-ap03','tdx','http://127.0.0.1','1829891qSzNVB','Not\x20Found','stg-us01','redirect_uri','codeChallenge','code_challenge_method','8016wrprYY','24ItyLdT'];a61_0xa6e2=function(){return _0x3451cc;};return a61_0xa6e2();}import*as a61_0x529dea from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set(['dev-us01',a61_0x445eac(0x1d7),a61_0x445eac(0x1b5),a61_0x445eac(0x19b),a61_0x445eac(0x1b0)]);export function isOAuthSupported(_0x58d7a0){const _0x37e8e7=a61_0x445eac;return OAUTH_SUPPORTED_SITES[_0x37e8e7(0x1ad)](_0x58d7a0);}function a61_0xd51c(_0x404d73,_0x7647fa){_0x404d73=_0x404d73-0x19b;const _0xa6e253=a61_0xa6e2();let _0xd51cd0=_0xa6e253[_0x404d73];return _0xd51cd0;}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a61_0x445eac(0x19c);export function getOAuthClientId(){const _0x1e3e76=a61_0x445eac;return process.env.TD_OAUTH_CLIENT_ID||_0x1e3e76(0x1b1);}export function generatePKCEPair(){const _0x992972=a61_0x445eac,_0x3a0163=a61_0x50a467[_0x992972(0x1da)](0x20)[_0x992972(0x1c2)](_0x992972(0x1d5)),_0x28026c=a61_0x50a467[_0x992972(0x1cc)](_0x992972(0x1a7))[_0x992972(0x1d9)](_0x3a0163)[_0x992972(0x1cf)](_0x992972(0x1d5));return{'verifier':_0x3a0163,'challenge':_0x28026c};}export function buildAuthorizeURL(_0x15db07,_0x30e3c1){const _0x4588f7=a61_0x445eac,_0x49573a=new URL(_0x4588f7(0x1d4),_0x15db07);return _0x49573a[_0x4588f7(0x1ca)][_0x4588f7(0x1c5)](_0x4588f7(0x1c3),_0x4588f7(0x1ae)),_0x49573a[_0x4588f7(0x1ca)][_0x4588f7(0x1c5)](_0x4588f7(0x1c0),_0x30e3c1['clientId']),_0x49573a[_0x4588f7(0x1ca)][_0x4588f7(0x1c5)](_0x4588f7(0x1b6),_0x30e3c1[_0x4588f7(0x1c8)]),_0x49573a[_0x4588f7(0x1ca)][_0x4588f7(0x1c5)](_0x4588f7(0x1c1),_0x30e3c1[_0x4588f7(0x1c1)]),_0x49573a[_0x4588f7(0x1ca)][_0x4588f7(0x1c5)]('code_challenge',_0x30e3c1[_0x4588f7(0x1b7)]),_0x49573a['searchParams'][_0x4588f7(0x1c5)](_0x4588f7(0x1b8),'S256'),_0x30e3c1['scope']&&_0x49573a['searchParams'][_0x4588f7(0x1c5)]('scope',_0x30e3c1[_0x4588f7(0x19d)]),_0x49573a[_0x4588f7(0x1c2)]();}export async function postTokenRequest(_0xf5565c,_0x4b8652){const _0x58c579=a61_0x445eac,_0x2937f5=new URLSearchParams(_0x4b8652)['toString'](),_0x412280=await fetch(_0xf5565c,{'method':_0x58c579(0x1a5),'headers':{'Content-Type':_0x58c579(0x1d0)},'body':_0x2937f5});if(!_0x412280['ok']){const _0x5a67d0=await _0x412280[_0x58c579(0x1c9)]();throw new Error(_0x58c579(0x1ac)+_0x412280[_0x58c579(0x1a1)]+_0x58c579(0x1a4)+_0x5a67d0);}return await _0x412280[_0x58c579(0x1a2)]();}export async function exchangeCodeForTokens(_0x13d61e,_0x39501b,_0x2bc3ea,_0x369801){const _0x1e5b82=a61_0x445eac,_0x373c85=_0x13d61e+_0x1e5b82(0x1bf);return postTokenRequest(_0x373c85,{'grant_type':'authorization_code','client_id':getOAuthClientId(),'code':_0x39501b,'code_verifier':_0x2bc3ea,'redirect_uri':_0x369801});}export function startLocalCallbackServer(){const _0x1a184f=a61_0x445eac;let _0x344b09,_0x1746ab;const _0x5b891f=new Promise((_0x3f8373,_0x4fa520)=>{_0x344b09=_0x3f8373,_0x1746ab=_0x4fa520;}),_0x4fee65=a61_0x529dea['createServer']((_0x173a5a,_0x340e03)=>{const _0x258c7c=a61_0xd51c,_0x229b5e=new URL(_0x173a5a['url']||'/',_0x258c7c(0x1b2));if(_0x229b5e[_0x258c7c(0x1cd)]!==_0x258c7c(0x19c)){_0x340e03[_0x258c7c(0x19f)](0x194,{'Content-Type':_0x258c7c(0x1a9)}),_0x340e03['end'](_0x258c7c(0x1b4));return;}const _0x495717=_0x229b5e[_0x258c7c(0x1ca)][_0x258c7c(0x1bd)](_0x258c7c(0x1ae)),_0x2e5d6e=_0x229b5e[_0x258c7c(0x1ca)]['get']('state'),_0x12b4bc=_0x229b5e[_0x258c7c(0x1ca)]['get'](_0x258c7c(0x1c7));if(_0x12b4bc||!_0x495717||!_0x2e5d6e){_0x340e03['writeHead'](0x190,{'Content-Type':_0x258c7c(0x1a6)}),_0x340e03[_0x258c7c(0x1bc)](_0x258c7c(0x1a0)),_0x1746ab(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x340e03[_0x258c7c(0x19f)](0xc8,{'Content-Type':'text/html'}),_0x340e03['end'](_0x258c7c(0x1bb)),_0x344b09({'code':_0x495717,'state':_0x2e5d6e});});_0x4fee65['on']('error',_0x27c689=>{const _0x254ede=a61_0xd51c;_0x27c689[_0x254ede(0x1ae)]===_0x254ede(0x19e)?_0x1746ab(new Error(_0x254ede(0x1ab)+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x1746ab(new Error(_0x254ede(0x1ce)+_0x27c689[_0x254ede(0x1d6)]));}),_0x4fee65['listen'](OAUTH_CALLBACK_PORT,_0x1a184f(0x1be));const _0x22743d=setTimeout(()=>{const _0x489c6b=_0x1a184f;_0x1746ab(new Error(_0x489c6b(0x1d1))),_0x4fee65[_0x489c6b(0x1d3)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x5b891f,'close':()=>{const _0x4dc930=_0x1a184f;clearTimeout(_0x22743d),_0x4fee65[_0x4dc930(0x1d3)]();}};}export async function startOAuthFlow(_0x53f32e){const _0xbe7b18=a61_0x445eac,_0x20be03=getConsoleUrl(_0x53f32e),_0x3ba1ba=getOAuthClientId(),{verifier:_0x5e557b,challenge:_0x17660a}=generatePKCEPair(),_0xf39afe=a61_0x50a467[_0xbe7b18(0x1da)](0x10)[_0xbe7b18(0x1c2)](_0xbe7b18(0x1c6)),_0x2f08e9=startLocalCallbackServer();try{const _0x2ee153=OAUTH_REDIRECT_URI,_0x8b94e7=buildAuthorizeURL(_0x20be03,{'clientId':_0x3ba1ba,'redirectUri':_0x2ee153,'state':_0xf39afe,'codeChallenge':_0x17660a});openBrowser(_0x8b94e7);const _0x206363=await _0x2f08e9[_0xbe7b18(0x1af)]();if(_0x206363[_0xbe7b18(0x1c1)]!==_0xf39afe)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x20be03,_0x206363[_0xbe7b18(0x1ae)],_0x5e557b,_0x2ee153);}finally{_0x2f08e9[_0xbe7b18(0x1d3)]();}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a62_0x4052(){const _0x3b913a=['warn','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x27:\x20config\x20must\x20be\x20an\x20object','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','Error:\x20','profiles','parse','set','readFileSync','1022511akYQbp','stringify','message','\x27\x20will\x20be\x20ignored','\x20does\x20not\x20exist','from','\x22\x20\x22','test','filter','database','entries','Invalid\x20profile\x20name:\x20','To\x20migrate:','has','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','some','localeCompare','Warning:\x20Profile\x20\x27','sort','2QIhzXc','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x27\x20not\x20found\x20in\x20user\x20configuration','site','utf-8','existsSync','object','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x27:\x20unknown\x20config\x20key\x20\x27','length','string','Failed\x20to\x20parse\x20','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','3054648FWyWfy','.env','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','@tdx-studio','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','description','parent_segment','readdirSync','2262305SJJAuG','profile','user_info','local','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','.env.','3191447xCHaxd','Profile\x20','\x0aWarning:\x20Failed\x20to\x20parse\x20','1210704WMBxBv','llm_agent','Warning:\x20Failed\x20to\x20parse\x20','Profile\x20\x27','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','480268bVNCfS','map',',\x20creating\x20new\x20file','join','find','2425122yaPxHx','tdx.json','values','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','directory','name','push','toISOString','keys',':\x20Invalid\x20JSON\x20syntax','llm_project','rmSync','INVALID_PROFILE_CONFIG'];a62_0x4052=function(){return _0x3b913a;};return a62_0x4052();}const a62_0x153bd8=a62_0x1278;(function(_0x622c4a,_0x2c628d){const _0x2a69ea=a62_0x1278,_0x22f654=_0x622c4a();while(!![]){try{const _0xcb9566=-parseInt(_0x2a69ea(0x1c3))/0x1*(parseInt(_0x2a69ea(0x19f))/0x2)+-parseInt(_0x2a69ea(0x1df))/0x3+parseInt(_0x2a69ea(0x1bd))/0x4+parseInt(_0x2a69ea(0x1b4))/0x5+parseInt(_0x2a69ea(0x1c8))/0x6+-parseInt(_0x2a69ea(0x1ba))/0x7+parseInt(_0x2a69ea(0x1ac))/0x8;if(_0xcb9566===_0x2c628d)break;else _0x22f654['push'](_0x22f654['shift']());}catch(_0x4809b0){_0x22f654['push'](_0x22f654['shift']());}}}(a62_0x4052,0x407c1));import*as a62_0x15430e from'node:fs';import*as a62_0x3d50b8 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';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 const STUDIO_PROFILE_NAME=a62_0x153bd8(0x1af);export function getProfileParams(_0x4f9c08){const _0x55b788=a62_0x153bd8,_0x37aaa4={};if(!_0x4f9c08)return _0x37aaa4;for(const [_0x452da8,_0x11d232]of Object[_0x55b788(0x196)](_0x4f9c08)){_0x452da8!=='description'&&_0x11d232!==undefined&&(_0x37aaa4[_0x452da8]=_0x11d232);}return _0x37aaa4;}export function getProfilesDir(){const _0x2a8dea=a62_0x153bd8;return a62_0x3d50b8[_0x2a8dea(0x1c6)](getConfigDir(),_0x2a8dea(0x1db));}function getProfileDir(_0x4c2344){const _0x48f36a=a62_0x153bd8;return a62_0x3d50b8[_0x48f36a(0x1c6)](getProfilesDir(),_0x4c2344);}function getProfileConfigPath(_0x2b79c3){const _0x47699a=a62_0x153bd8;return a62_0x3d50b8[_0x47699a(0x1c6)](getProfileDir(_0x2b79c3),'tdx.json');}function getProfileEnvPath(_0x15ea1f){const _0x2e8f9d=a62_0x153bd8;return a62_0x3d50b8['join'](getProfileDir(_0x15ea1f),_0x2e8f9d(0x1ad));}function getGlobalConfigPath(){const _0x434eef=a62_0x153bd8;return a62_0x3d50b8[_0x434eef(0x1c6)](getConfigDir(),'tdx.json');}function validateProfileName(_0x380ff0){const _0x2d6d98=a62_0x153bd8;if(/^@?[a-zA-Z0-9_-]+$/[_0x2d6d98(0x1e6)](_0x380ff0))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x2d6d98(0x1e6)](_0x380ff0))return;throw new Error(_0x2d6d98(0x197)+_0x380ff0+_0x2d6d98(0x19a));}function validateProfileConfig(_0x4c251e,_0x2280a9){const _0x2dc79f=a62_0x153bd8;if(typeof _0x4c251e!=='object'||_0x4c251e===null)throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1d8));const _0x162c56=[_0x2dc79f(0x1b1),_0x2dc79f(0x1a2),_0x2dc79f(0x1e8),'parent_segment',_0x2dc79f(0x1d2),_0x2dc79f(0x1be),_0x2dc79f(0x1b6)],_0x2d79e1=_0x4c251e;for(const _0x2f2efc of Object[_0x2dc79f(0x1d0)](_0x2d79e1)){!_0x162c56['includes'](_0x2f2efc)&&console[_0x2dc79f(0x1d5)](_0x2dc79f(0x19d)+_0x2280a9+_0x2dc79f(0x1a7)+_0x2f2efc+_0x2dc79f(0x1e2));}if(_0x2d79e1[_0x2dc79f(0x1b1)]!==undefined&&typeof _0x2d79e1['description']!==_0x2dc79f(0x1a9))throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],_0x2dc79f(0x1c0)+_0x2280a9+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x2d79e1[_0x2dc79f(0x1a2)]!==undefined&&typeof _0x2d79e1['site']!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1c1));if(_0x2d79e1[_0x2dc79f(0x1e8)]!==undefined&&typeof _0x2d79e1['database']!==_0x2dc79f(0x1a9))throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1d6));if(_0x2d79e1[_0x2dc79f(0x1b2)]!==undefined&&typeof _0x2d79e1[_0x2dc79f(0x1b2)]!=='string')throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],'Profile\x20\x27'+_0x2280a9+_0x2dc79f(0x1a0));if(_0x2d79e1[_0x2dc79f(0x1d2)]!==undefined&&typeof _0x2d79e1[_0x2dc79f(0x1d2)]!==_0x2dc79f(0x1a9))throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1ae));if(_0x2d79e1['llm_agent']!==undefined&&typeof _0x2d79e1['llm_agent']!==_0x2dc79f(0x1a9))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1a6));return!![];}function loadProfilesFromTdxJson(_0x2e0048,_0x5bbd8d){const _0x208dfa=a62_0x153bd8;if(!a62_0x15430e[_0x208dfa(0x1a4)](_0x2e0048))return[];try{const _0x5ce378=a62_0x15430e[_0x208dfa(0x1de)](_0x2e0048,_0x208dfa(0x1a3)),_0x48d528=JSON[_0x208dfa(0x1dc)](_0x5ce378);if(!_0x48d528[_0x208dfa(0x1db)]||typeof _0x48d528[_0x208dfa(0x1db)]!==_0x208dfa(0x1a5))return[];const _0x2732e2=[];for(const [_0x5d8941,_0x573f98]of Object[_0x208dfa(0x196)](_0x48d528['profiles'])){try{validateProfileConfig(_0x573f98,_0x5d8941);const _0x41aae3=getNewCredentialPath(_0x5d8941),_0x278446=getOldCredentialPath(_0x5d8941),_0x289578=a62_0x15430e['existsSync'](_0x41aae3)||a62_0x15430e[_0x208dfa(0x1a4)](_0x278446);_0x2732e2[_0x208dfa(0x1ce)]({'name':_0x5d8941,'config':_0x573f98,'metadata':{'name':_0x5d8941,'createdAt':new Date()[_0x208dfa(0x1cf)]()},'hasCredentials':_0x289578,'scope':_0x5bbd8d});}catch(_0x32a615){_0x32a615 instanceof Error&&(console[_0x208dfa(0x1d5)](_0x208dfa(0x1b8)+_0x2e0048+':'),console[_0x208dfa(0x1d5)]('\x20\x20'+_0x32a615[_0x208dfa(0x1e1)]+'\x0a'));}}return _0x2732e2;}catch(_0x59a23b){return _0x59a23b instanceof SyntaxError?(console[_0x208dfa(0x1d5)](_0x208dfa(0x1bc)+_0x2e0048+_0x208dfa(0x1d1)),console['warn'](_0x208dfa(0x1da)+_0x59a23b[_0x208dfa(0x1e1)]+'\x0a')):console['warn']('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x2e0048+':\x20'+_0x59a23b+'\x0a'),[];}}export function getNewCredentialPath(_0x2d6a79){const _0x80820b=a62_0x153bd8;return a62_0x3d50b8[_0x80820b(0x1c6)](getConfigDir(),_0x80820b(0x1b9)+_0x2d6a79);}function getOldCredentialPath(_0x23c250){const _0x3d0e1d=a62_0x153bd8;return a62_0x3d50b8[_0x3d0e1d(0x1c6)](getProfilesDir(),_0x23c250,_0x3d0e1d(0x1ad));}function loadProfilesFromTdxJsonFiles(){const _0x472904=a62_0x153bd8,_0x1a6258=[],_0x3c8a17=findProjectConfigPath();_0x3c8a17&&_0x1a6258[_0x472904(0x1ce)](...loadProfilesFromTdxJson(_0x3c8a17,_0x472904(0x1b7)));const _0x4febc9=a62_0x3d50b8[_0x472904(0x1c6)](getConfigDir(),_0x472904(0x1c9));return _0x1a6258['push'](...loadProfilesFromTdxJson(_0x4febc9,'user')),_0x1a6258;}function loadProfilesFromDirectories(){const _0x51d0a7=a62_0x153bd8,_0x2c94b4=getProfilesDir();if(!a62_0x15430e[_0x51d0a7(0x1a4)](_0x2c94b4))return[];try{return a62_0x15430e[_0x51d0a7(0x1b3)](_0x2c94b4,{'withFileTypes':!![]})[_0x51d0a7(0x1e7)](_0xc11108=>_0xc11108['isDirectory']())[_0x51d0a7(0x1c4)](_0x27b924=>_0x27b924['name'])[_0x51d0a7(0x1e7)](_0x3bc40b=>{const _0x227ca9=_0x51d0a7,_0x4e086f=getProfileConfigPath(_0x3bc40b),_0x5ecda8=getProfileEnvPath(_0x3bc40b);return a62_0x15430e[_0x227ca9(0x1a4)](_0x4e086f)||a62_0x15430e[_0x227ca9(0x1a4)](_0x5ecda8);})[_0x51d0a7(0x1c4)](_0x7d8e45=>{const _0x84f810=_0x51d0a7,_0x398c5e=loadProfileFromDirectory(_0x7d8e45);if(_0x398c5e)return{..._0x398c5e,'scope':_0x84f810(0x1cc)};return null;})[_0x51d0a7(0x1e7)](_0x4a34fc=>_0x4a34fc!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4a36ae){const _0x4af2c3=a62_0x153bd8,_0x48b5d7=getProfileConfigPath(_0x4a36ae),_0x1aeedc=getOldCredentialPath(_0x4a36ae);if(!a62_0x15430e[_0x4af2c3(0x1a4)](_0x48b5d7)&&!a62_0x15430e[_0x4af2c3(0x1a4)](_0x1aeedc))return null;let _0x8cc0d={},_0x164bf4={'name':_0x4a36ae,'createdAt':new Date()[_0x4af2c3(0x1cf)]()};if(a62_0x15430e['existsSync'](_0x48b5d7))try{const _0x490e2e=a62_0x15430e[_0x4af2c3(0x1de)](_0x48b5d7,_0x4af2c3(0x1a3)),_0x188be2=JSON[_0x4af2c3(0x1dc)](_0x490e2e),{metadata:_0xfe9e70,..._0x55ab10}=_0x188be2;_0x8cc0d=_0x55ab10,_0xfe9e70&&(_0x164bf4=_0xfe9e70);}catch{}return{'name':_0x4a36ae,'config':_0x8cc0d,'metadata':_0x164bf4,'hasCredentials':a62_0x15430e['existsSync'](_0x1aeedc),'scope':'directory'};}export function listProfiles(){const _0xde44cd=a62_0x153bd8,_0x24aef0=loadProfilesFromTdxJsonFiles(),_0x1c9dcf=loadProfilesFromDirectories();if(_0x1c9dcf[_0xde44cd(0x1a8)]>0x0){const _0x226cf6=_0x1c9dcf[_0xde44cd(0x1c4)](_0x656c1c=>_0x656c1c[_0xde44cd(0x1cd)])[_0xde44cd(0x1c6)](',\x20'),_0x337feb=getConfigDir();console[_0xde44cd(0x1d5)](_0xde44cd(0x1b0)+_0x226cf6),console[_0xde44cd(0x1d5)](_0xde44cd(0x1cb)),console['warn']('\x20\x201.\x20Edit:\x20'+a62_0x3d50b8['join'](_0x337feb,_0xde44cd(0x1c9))),console['warn'](_0xde44cd(0x1c2)),console[_0xde44cd(0x1d5)](_0xde44cd(0x1d7));}const _0xf1e938=[..._0x24aef0,..._0x1c9dcf],_0x3a58e4=new Map();for(const _0x46a6b3 of _0xf1e938){!_0x3a58e4[_0xde44cd(0x199)](_0x46a6b3[_0xde44cd(0x1cd)])&&_0x3a58e4[_0xde44cd(0x1dd)](_0x46a6b3['name'],_0x46a6b3);}return Array[_0xde44cd(0x1e4)](_0x3a58e4[_0xde44cd(0x1ca)]())[_0xde44cd(0x19e)]((_0x330878,_0x37d62f)=>_0x330878[_0xde44cd(0x1cd)][_0xde44cd(0x19c)](_0x37d62f['name']));}export function profileExists(_0x268b71){const _0x3ad16f=a62_0x153bd8,_0x1bdbc0=listProfiles();return _0x1bdbc0[_0x3ad16f(0x19b)](_0x2d78ac=>_0x2d78ac[_0x3ad16f(0x1cd)]===_0x268b71);}export function loadProfile(_0x5178b9){const _0x59a5e3=a62_0x153bd8;validateProfileName(_0x5178b9);const _0x5b9aea=listProfiles(),_0x307767=_0x5b9aea[_0x59a5e3(0x1c7)](_0x4ace15=>_0x4ace15[_0x59a5e3(0x1cd)]===_0x5178b9);return _0x307767||null;}export function saveProfile(_0x44162f,_0x582c8c,_0x5424fc=![]){saveProfileToUserConfig(_0x44162f,_0x582c8c);}function a62_0x1278(_0x15b68a,_0x554be9){_0x15b68a=_0x15b68a-0x196;const _0x405226=a62_0x4052();let _0x1278c7=_0x405226[_0x15b68a];return _0x1278c7;}export function deleteProfile(_0x1b3229){const _0x2e9bd5=a62_0x153bd8;validateProfileName(_0x1b3229);const _0x224894=getProfileDir(_0x1b3229);if(!a62_0x15430e[_0x2e9bd5(0x1a4)](_0x224894))throw new Error(_0x2e9bd5(0x1bb)+_0x1b3229+_0x2e9bd5(0x1e3));a62_0x15430e[_0x2e9bd5(0x1d3)](_0x224894,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x48755e,_0x312025){const _0x886227=a62_0x153bd8;validateProfileName(_0x48755e);const _0x263ecf=getGlobalConfigPath(),_0x36e259=getConfigDir();!a62_0x15430e['existsSync'](_0x36e259)&&createSecureDirectory(_0x36e259);let _0x28a495={};if(a62_0x15430e[_0x886227(0x1a4)](_0x263ecf))try{const _0x32dda0=a62_0x15430e[_0x886227(0x1de)](_0x263ecf,_0x886227(0x1a3));_0x28a495=JSON[_0x886227(0x1dc)](_0x32dda0);}catch{console[_0x886227(0x1d5)](_0x886227(0x1bf)+_0x263ecf+_0x886227(0x1c5));}!_0x28a495[_0x886227(0x1db)]&&(_0x28a495['profiles']={}),_0x28a495[_0x886227(0x1db)][_0x48755e]=_0x312025,writeSecureFile(_0x263ecf,JSON[_0x886227(0x1e0)](_0x28a495,null,0x2));}export function removeProfileFromUserConfig(_0x261ddb){const _0x4abff2=a62_0x153bd8;validateProfileName(_0x261ddb);const _0x536b17=getGlobalConfigPath();if(!a62_0x15430e[_0x4abff2(0x1a4)](_0x536b17))throw new Error(_0x4abff2(0x1c0)+_0x261ddb+_0x4abff2(0x1a1));let _0x2dd0c4={};try{const _0x5e577a=a62_0x15430e['readFileSync'](_0x536b17,_0x4abff2(0x1a3));_0x2dd0c4=JSON['parse'](_0x5e577a);}catch{throw new Error(_0x4abff2(0x1aa)+_0x536b17);}if(!_0x2dd0c4[_0x4abff2(0x1db)]||!_0x2dd0c4[_0x4abff2(0x1db)][_0x261ddb])throw new Error('Profile\x20\x27'+_0x261ddb+_0x4abff2(0x1a1));delete _0x2dd0c4[_0x4abff2(0x1db)][_0x261ddb],_0x2dd0c4[_0x4abff2(0x1b5)]===_0x261ddb&&delete _0x2dd0c4[_0x4abff2(0x1b5)],writeSecureFile(_0x536b17,JSON[_0x4abff2(0x1e0)](_0x2dd0c4,null,0x2));}export function getActiveProfile(){const _0x1ddd9f=a62_0x153bd8,_0x3899c8=loadSessionContext();if(_0x3899c8?.[_0x1ddd9f(0x1b5)])return _0x3899c8['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x32a9d2=getGlobalConfigPath();if(!a62_0x15430e[_0x1ddd9f(0x1a4)](_0x32a9d2))return null;try{const _0x4ac8a3=a62_0x15430e[_0x1ddd9f(0x1de)](_0x32a9d2,_0x1ddd9f(0x1a3)),_0x1df41c=JSON['parse'](_0x4ac8a3);return _0x1df41c[_0x1ddd9f(0x1b5)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x2ab2db){const _0x350afc=a62_0x153bd8,_0x59f664=getGlobalConfigPath(),_0x48d729=getConfigDir();!a62_0x15430e['existsSync'](_0x48d729)&&createSecureDirectory(_0x48d729);let _0x1bf7c5={};if(a62_0x15430e[_0x350afc(0x1a4)](_0x59f664))try{const _0x41c88d=a62_0x15430e[_0x350afc(0x1de)](_0x59f664,_0x350afc(0x1a3));_0x1bf7c5=JSON[_0x350afc(0x1dc)](_0x41c88d);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x59f664+_0x350afc(0x1c5));}_0x1bf7c5[_0x350afc(0x1a2)]=_0x2ab2db,writeSecureFile(_0x59f664,JSON[_0x350afc(0x1e0)](_0x1bf7c5,null,0x2));}export function saveActiveProfileToUserConfig(_0x42110d){const _0x37dd97=a62_0x153bd8;validateProfileName(_0x42110d);const _0x57f9ae=getGlobalConfigPath(),_0x2ad1ad=getConfigDir();!a62_0x15430e[_0x37dd97(0x1a4)](_0x2ad1ad)&&createSecureDirectory(_0x2ad1ad);let _0x545c6d={};if(a62_0x15430e[_0x37dd97(0x1a4)](_0x57f9ae))try{const _0x588d3b=a62_0x15430e['readFileSync'](_0x57f9ae,_0x37dd97(0x1a3));_0x545c6d=JSON[_0x37dd97(0x1dc)](_0x588d3b);}catch{console['warn'](_0x37dd97(0x1bf)+_0x57f9ae+_0x37dd97(0x1c5));}_0x545c6d[_0x37dd97(0x1b5)]=_0x42110d,writeSecureFile(_0x57f9ae,JSON['stringify'](_0x545c6d,null,0x2));}function clearFieldFromUserConfig(_0x267db1){const _0x2148bd=a62_0x153bd8,_0x2efb38=getGlobalConfigPath();if(!a62_0x15430e['existsSync'](_0x2efb38))return;let _0x410231={};try{const _0xb09b49=a62_0x15430e[_0x2148bd(0x1de)](_0x2efb38,_0x2148bd(0x1a3));_0x410231=JSON[_0x2148bd(0x1dc)](_0xb09b49);}catch{return;}delete _0x410231[_0x267db1],writeSecureFile(_0x2efb38,JSON[_0x2148bd(0x1e0)](_0x410231,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x1e4475=a62_0x153bd8;clearFieldFromUserConfig(_0x1e4475(0x1a2));}export function clearActiveProfileFromUserConfig(){const _0x59bbbc=a62_0x153bd8;clearFieldFromUserConfig(_0x59bbbc(0x1b5));}export function createProfile(_0x3176ed,_0x54e89a){const _0x135897=a62_0x153bd8;validateProfileName(_0x3176ed);if(profileExists(_0x3176ed))throw new Error(_0x135897(0x1bb)+_0x3176ed+'\x20already\x20exists');saveProfile(_0x3176ed,_0x54e89a);}export function saveProfileCredentials(_0x433d8e,_0x130751){const _0x207081=a62_0x153bd8;validateProfileName(_0x433d8e);if(!profileExists(_0x433d8e))throw new Error('Profile\x20'+_0x433d8e+_0x207081(0x1e3));const _0x32bef7=getNewCredentialPath(_0x433d8e);writeSecureFile(_0x32bef7,_0x130751);}export function loadProfileCredentials(_0x448e95){const _0x28ae1f=a62_0x153bd8;validateProfileName(_0x448e95);const _0x4fc2ed=getNewCredentialPath(_0x448e95);if(a62_0x15430e['existsSync'](_0x4fc2ed))try{return a62_0x15430e[_0x28ae1f(0x1de)](_0x4fc2ed,_0x28ae1f(0x1a3));}catch{}const _0x29103e=getOldCredentialPath(_0x448e95);if(a62_0x15430e['existsSync'](_0x29103e)){console[_0x28ae1f(0x1d5)](_0x28ae1f(0x1ab)+_0x448e95+'\x27'),console['warn'](_0x28ae1f(0x198)),console[_0x28ae1f(0x1d5)]('\x20\x20mv\x20\x22'+_0x29103e+_0x28ae1f(0x1e5)+_0x4fc2ed+'\x22'),console[_0x28ae1f(0x1d5)](_0x28ae1f(0x1d9));try{return a62_0x15430e[_0x28ae1f(0x1de)](_0x29103e,_0x28ae1f(0x1a3));}catch{return null;}}return null;}
|
|
1
|
+
const a62_0x3bdfa6=a62_0x2092;(function(_0x2f8dd5,_0x334e50){const _0x406ec0=a62_0x2092,_0x15a754=_0x2f8dd5();while(!![]){try{const _0x347233=parseInt(_0x406ec0(0xaa))/0x1+-parseInt(_0x406ec0(0xe8))/0x2*(-parseInt(_0x406ec0(0xc8))/0x3)+parseInt(_0x406ec0(0xb8))/0x4+-parseInt(_0x406ec0(0xec))/0x5+-parseInt(_0x406ec0(0xda))/0x6+-parseInt(_0x406ec0(0xae))/0x7*(parseInt(_0x406ec0(0xa7))/0x8)+parseInt(_0x406ec0(0xea))/0x9;if(_0x347233===_0x334e50)break;else _0x15a754['push'](_0x15a754['shift']());}catch(_0x1c7aff){_0x15a754['push'](_0x15a754['shift']());}}}(a62_0x586b,0x8983b));import*as a62_0x36f609 from'node:fs';import*as a62_0x525965 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';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 const STUDIO_PROFILE_NAME=a62_0x3bdfa6(0xe9);export function getProfileParams(_0x33f218){const _0x38d1ba=a62_0x3bdfa6,_0x4376b8={};if(!_0x33f218)return _0x4376b8;for(const [_0x1fd545,_0x36c4dc]of Object[_0x38d1ba(0xe4)](_0x33f218)){_0x1fd545!=='description'&&_0x36c4dc!==undefined&&(_0x4376b8[_0x1fd545]=_0x36c4dc);}return _0x4376b8;}export function getProfilesDir(){return a62_0x525965['join'](getConfigDir(),'profiles');}function getProfileDir(_0x1e3208){const _0x387382=a62_0x3bdfa6;return a62_0x525965[_0x387382(0xbe)](getProfilesDir(),_0x1e3208);}function getProfileConfigPath(_0x287471){const _0x2e07c1=a62_0x3bdfa6;return a62_0x525965[_0x2e07c1(0xbe)](getProfileDir(_0x287471),_0x2e07c1(0xcd));}function a62_0x586b(){const _0x582e3f=['3023380iGtEwO','rmSync','llm_agent','set','parse','\x20does\x20not\x20exist','\x22\x20\x22','readdirSync','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','message','\x27\x20not\x20found\x20in\x20user\x20configuration','Error:\x20','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','localeCompare','8VIMaOd','description','.env','591385Mjzvna','\x0aWarning:\x20Failed\x20to\x20parse\x20','Profile\x20','stringify','4207469aGjwGY','local','Warning:\x20Profile\x20\x27','length','Warning:\x20Failed\x20to\x20parse\x20','\x20\x20mv\x20\x22','directory','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','user','profile','754368tdwjUH','isDirectory','site','has','\x20already\x20exists','object','join','readFileSync','utf-8','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','Failed\x20to\x20parse\x20','push','from','test','user_info','INVALID_PROFILE_CONFIG','27wmMobi','existsSync','includes','\x20\x201.\x20Edit:\x20','Profile\x20\x27','tdx.json','toISOString','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20',':\x20Invalid\x20JSON\x20syntax','profiles','sort','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','string','find','.env.','parent_segment','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','map','2179914TECzbZ',',\x20creating\x20new\x20file','\x27:\x20unknown\x20config\x20key\x20\x27','database','name','keys','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','Invalid\x20profile\x20name:\x20','llm_project','values','entries','warn','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','some','20414nEHGlq','@tdx-studio','11344329ZahrxW','filter'];a62_0x586b=function(){return _0x582e3f;};return a62_0x586b();}function getProfileEnvPath(_0xdc46bd){const _0xc7edbc=a62_0x3bdfa6;return a62_0x525965[_0xc7edbc(0xbe)](getProfileDir(_0xdc46bd),'.env');}function getGlobalConfigPath(){const _0x4517c5=a62_0x3bdfa6;return a62_0x525965[_0x4517c5(0xbe)](getConfigDir(),_0x4517c5(0xcd));}function validateProfileName(_0x2e7626){const _0x217815=a62_0x3bdfa6;if(/^@?[a-zA-Z0-9_-]+$/[_0x217815(0xc5)](_0x2e7626))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x217815(0xc5)](_0x2e7626))return;throw new Error(_0x217815(0xe1)+_0x2e7626+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x19b5d1,_0x32fc58){const _0x51600b=a62_0x3bdfa6;if(typeof _0x19b5d1!==_0x51600b(0xbd)||_0x19b5d1===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x51600b(0xcc)+_0x32fc58+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x569471=[_0x51600b(0xa8),'site',_0x51600b(0xdd),_0x51600b(0xd7),_0x51600b(0xe2),_0x51600b(0x9b),_0x51600b(0xc6)],_0x4b8a4f=_0x19b5d1;for(const _0x5e9f5b of Object[_0x51600b(0xdf)](_0x4b8a4f)){!_0x569471[_0x51600b(0xca)](_0x5e9f5b)&&console[_0x51600b(0xe5)](_0x51600b(0xb0)+_0x32fc58+_0x51600b(0xdc)+_0x5e9f5b+'\x27\x20will\x20be\x20ignored');}if(_0x4b8a4f[_0x51600b(0xa8)]!==undefined&&typeof _0x4b8a4f[_0x51600b(0xa8)]!==_0x51600b(0xd4))throw new SDKError(ErrorCode[_0x51600b(0xc7)],_0x51600b(0xcc)+_0x32fc58+_0x51600b(0xe0));if(_0x4b8a4f[_0x51600b(0xba)]!==undefined&&typeof _0x4b8a4f[_0x51600b(0xba)]!==_0x51600b(0xd4))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x51600b(0xcc)+_0x32fc58+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x4b8a4f[_0x51600b(0xdd)]!==undefined&&typeof _0x4b8a4f[_0x51600b(0xdd)]!=='string')throw new SDKError(ErrorCode[_0x51600b(0xc7)],_0x51600b(0xcc)+_0x32fc58+_0x51600b(0xb5));if(_0x4b8a4f[_0x51600b(0xd7)]!==undefined&&typeof _0x4b8a4f[_0x51600b(0xd7)]!==_0x51600b(0xd4))throw new SDKError(ErrorCode[_0x51600b(0xc7)],_0x51600b(0xcc)+_0x32fc58+_0x51600b(0xe6));if(_0x4b8a4f[_0x51600b(0xe2)]!==undefined&&typeof _0x4b8a4f[_0x51600b(0xe2)]!==_0x51600b(0xd4))throw new SDKError(ErrorCode[_0x51600b(0xc7)],'Profile\x20\x27'+_0x32fc58+_0x51600b(0xd3));if(_0x4b8a4f['llm_agent']!==undefined&&typeof _0x4b8a4f[_0x51600b(0x9b)]!==_0x51600b(0xd4))throw new SDKError(ErrorCode[_0x51600b(0xc7)],_0x51600b(0xcc)+_0x32fc58+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x3d85c2,_0x86d947){const _0x35441d=a62_0x3bdfa6;if(!a62_0x36f609['existsSync'](_0x3d85c2))return[];try{const _0x56d751=a62_0x36f609['readFileSync'](_0x3d85c2,_0x35441d(0xc0)),_0x49c401=JSON['parse'](_0x56d751);if(!_0x49c401[_0x35441d(0xd1)]||typeof _0x49c401['profiles']!==_0x35441d(0xbd))return[];const _0x131a4d=[];for(const [_0x59da5f,_0x29d89d]of Object[_0x35441d(0xe4)](_0x49c401['profiles'])){try{validateProfileConfig(_0x29d89d,_0x59da5f);const _0x25573e=getNewCredentialPath(_0x59da5f),_0x59c3f1=getOldCredentialPath(_0x59da5f),_0x2458a8=a62_0x36f609[_0x35441d(0xc9)](_0x25573e)||a62_0x36f609[_0x35441d(0xc9)](_0x59c3f1);_0x131a4d[_0x35441d(0xc3)]({'name':_0x59da5f,'config':_0x29d89d,'metadata':{'name':_0x59da5f,'createdAt':new Date()[_0x35441d(0xce)]()},'hasCredentials':_0x2458a8,'scope':_0x86d947});}catch(_0x572260){_0x572260 instanceof Error&&(console[_0x35441d(0xe5)](_0x35441d(0xa5)+_0x3d85c2+':'),console[_0x35441d(0xe5)]('\x20\x20'+_0x572260['message']+'\x0a'));}}return _0x131a4d;}catch(_0x455577){return _0x455577 instanceof SyntaxError?(console['warn'](_0x35441d(0xab)+_0x3d85c2+_0x35441d(0xd0)),console[_0x35441d(0xe5)](_0x35441d(0xa4)+_0x455577[_0x35441d(0xa2)]+'\x0a')):console[_0x35441d(0xe5)](_0x35441d(0xc1)+_0x3d85c2+':\x20'+_0x455577+'\x0a'),[];}}export function getNewCredentialPath(_0xf4a48b){const _0x29d6e4=a62_0x3bdfa6;return a62_0x525965['join'](getConfigDir(),_0x29d6e4(0xd6)+_0xf4a48b);}function getOldCredentialPath(_0xadac41){const _0x183cfb=a62_0x3bdfa6;return a62_0x525965['join'](getProfilesDir(),_0xadac41,_0x183cfb(0xa9));}function loadProfilesFromTdxJsonFiles(){const _0x20f4af=a62_0x3bdfa6,_0x3f03de=[],_0x581986=findProjectConfigPath();_0x581986&&_0x3f03de[_0x20f4af(0xc3)](...loadProfilesFromTdxJson(_0x581986,_0x20f4af(0xaf)));const _0x2416d9=a62_0x525965[_0x20f4af(0xbe)](getConfigDir(),_0x20f4af(0xcd));return _0x3f03de[_0x20f4af(0xc3)](...loadProfilesFromTdxJson(_0x2416d9,_0x20f4af(0xb6))),_0x3f03de;}function loadProfilesFromDirectories(){const _0x509424=a62_0x3bdfa6,_0x9b33a9=getProfilesDir();if(!a62_0x36f609[_0x509424(0xc9)](_0x9b33a9))return[];try{return a62_0x36f609[_0x509424(0xa0)](_0x9b33a9,{'withFileTypes':!![]})[_0x509424(0xeb)](_0x84e359=>_0x84e359[_0x509424(0xb9)]())[_0x509424(0xd9)](_0x3544b3=>_0x3544b3[_0x509424(0xde)])[_0x509424(0xeb)](_0x29fec7=>{const _0xf0cb0b=_0x509424,_0x1810ae=getProfileConfigPath(_0x29fec7),_0x541b6f=getProfileEnvPath(_0x29fec7);return a62_0x36f609['existsSync'](_0x1810ae)||a62_0x36f609[_0xf0cb0b(0xc9)](_0x541b6f);})[_0x509424(0xd9)](_0x5b2ea7=>{const _0x3e6256=loadProfileFromDirectory(_0x5b2ea7);if(_0x3e6256)return{..._0x3e6256,'scope':'directory'};return null;})[_0x509424(0xeb)](_0x5516a0=>_0x5516a0!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2912c1){const _0x77a26=a62_0x3bdfa6,_0x4a1084=getProfileConfigPath(_0x2912c1),_0x5f2f03=getOldCredentialPath(_0x2912c1);if(!a62_0x36f609[_0x77a26(0xc9)](_0x4a1084)&&!a62_0x36f609[_0x77a26(0xc9)](_0x5f2f03))return null;let _0x24bf82={},_0x40fa1d={'name':_0x2912c1,'createdAt':new Date()[_0x77a26(0xce)]()};if(a62_0x36f609[_0x77a26(0xc9)](_0x4a1084))try{const _0x730c13=a62_0x36f609['readFileSync'](_0x4a1084,_0x77a26(0xc0)),_0xae7f3e=JSON[_0x77a26(0x9d)](_0x730c13),{metadata:_0x5b2f4b,..._0x4e048a}=_0xae7f3e;_0x24bf82=_0x4e048a,_0x5b2f4b&&(_0x40fa1d=_0x5b2f4b);}catch{}return{'name':_0x2912c1,'config':_0x24bf82,'metadata':_0x40fa1d,'hasCredentials':a62_0x36f609[_0x77a26(0xc9)](_0x5f2f03),'scope':_0x77a26(0xb4)};}export function listProfiles(){const _0xe678c8=a62_0x3bdfa6,_0x56197a=loadProfilesFromTdxJsonFiles(),_0x501687=loadProfilesFromDirectories();if(_0x501687[_0xe678c8(0xb1)]>0x0){const _0x3ba0e6=_0x501687['map'](_0x10175c=>_0x10175c[_0xe678c8(0xde)])[_0xe678c8(0xbe)](',\x20'),_0x1f99f7=getConfigDir();console[_0xe678c8(0xe5)](_0xe678c8(0xcf)+_0x3ba0e6),console[_0xe678c8(0xe5)](_0xe678c8(0xa1)),console[_0xe678c8(0xe5)](_0xe678c8(0xcb)+a62_0x525965['join'](_0x1f99f7,_0xe678c8(0xcd))),console[_0xe678c8(0xe5)](_0xe678c8(0xd8)),console[_0xe678c8(0xe5)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x1c37f8=[..._0x56197a,..._0x501687],_0x30e9ae=new Map();for(const _0x1aeaa3 of _0x1c37f8){!_0x30e9ae[_0xe678c8(0xbb)](_0x1aeaa3[_0xe678c8(0xde)])&&_0x30e9ae[_0xe678c8(0x9c)](_0x1aeaa3['name'],_0x1aeaa3);}return Array[_0xe678c8(0xc4)](_0x30e9ae[_0xe678c8(0xe3)]())[_0xe678c8(0xd2)]((_0x509c3b,_0x5c76b1)=>_0x509c3b['name'][_0xe678c8(0xa6)](_0x5c76b1['name']));}export function profileExists(_0x4295dc){const _0x435781=a62_0x3bdfa6,_0x41574c=listProfiles();return _0x41574c[_0x435781(0xe7)](_0xba67c2=>_0xba67c2[_0x435781(0xde)]===_0x4295dc);}export function loadProfile(_0x520e26){const _0x19bcb0=a62_0x3bdfa6;validateProfileName(_0x520e26);const _0x3ada47=listProfiles(),_0x3912ff=_0x3ada47[_0x19bcb0(0xd5)](_0xe7021=>_0xe7021[_0x19bcb0(0xde)]===_0x520e26);return _0x3912ff||null;}export function saveProfile(_0x4a3abf,_0x4db229,_0x147e77=![]){saveProfileToUserConfig(_0x4a3abf,_0x4db229);}export function deleteProfile(_0x9727b5){const _0x538688=a62_0x3bdfa6;validateProfileName(_0x9727b5);const _0x4ed80c=getProfileDir(_0x9727b5);if(!a62_0x36f609[_0x538688(0xc9)](_0x4ed80c))throw new Error(_0x538688(0xac)+_0x9727b5+_0x538688(0x9e));a62_0x36f609[_0x538688(0x9a)](_0x4ed80c,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x3fd098,_0x5af727){const _0x5054ad=a62_0x3bdfa6;validateProfileName(_0x3fd098);const _0xda3434=getGlobalConfigPath(),_0x55d61e=getConfigDir();!a62_0x36f609[_0x5054ad(0xc9)](_0x55d61e)&&createSecureDirectory(_0x55d61e);let _0x364e0c={};if(a62_0x36f609[_0x5054ad(0xc9)](_0xda3434))try{const _0x202623=a62_0x36f609[_0x5054ad(0xbf)](_0xda3434,_0x5054ad(0xc0));_0x364e0c=JSON[_0x5054ad(0x9d)](_0x202623);}catch{console['warn'](_0x5054ad(0xb2)+_0xda3434+_0x5054ad(0xdb));}!_0x364e0c[_0x5054ad(0xd1)]&&(_0x364e0c[_0x5054ad(0xd1)]={}),_0x364e0c[_0x5054ad(0xd1)][_0x3fd098]=_0x5af727,writeSecureFile(_0xda3434,JSON[_0x5054ad(0xad)](_0x364e0c,null,0x2));}export function removeProfileFromUserConfig(_0x4a919c){const _0xa91060=a62_0x3bdfa6;validateProfileName(_0x4a919c);const _0x54b924=getGlobalConfigPath();if(!a62_0x36f609[_0xa91060(0xc9)](_0x54b924))throw new Error(_0xa91060(0xcc)+_0x4a919c+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x1b9488={};try{const _0x4cf41a=a62_0x36f609[_0xa91060(0xbf)](_0x54b924,_0xa91060(0xc0));_0x1b9488=JSON[_0xa91060(0x9d)](_0x4cf41a);}catch{throw new Error(_0xa91060(0xc2)+_0x54b924);}if(!_0x1b9488[_0xa91060(0xd1)]||!_0x1b9488[_0xa91060(0xd1)][_0x4a919c])throw new Error(_0xa91060(0xcc)+_0x4a919c+_0xa91060(0xa3));delete _0x1b9488[_0xa91060(0xd1)][_0x4a919c],_0x1b9488[_0xa91060(0xb7)]===_0x4a919c&&delete _0x1b9488[_0xa91060(0xb7)],writeSecureFile(_0x54b924,JSON[_0xa91060(0xad)](_0x1b9488,null,0x2));}export function getActiveProfile(){const _0x5cb1fd=a62_0x3bdfa6,_0x549ab4=loadSessionContext();if(_0x549ab4?.['profile'])return _0x549ab4['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1b6acb=getGlobalConfigPath();if(!a62_0x36f609[_0x5cb1fd(0xc9)](_0x1b6acb))return null;try{const _0x56a2e4=a62_0x36f609[_0x5cb1fd(0xbf)](_0x1b6acb,_0x5cb1fd(0xc0)),_0x2126e5=JSON[_0x5cb1fd(0x9d)](_0x56a2e4);return _0x2126e5[_0x5cb1fd(0xb7)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x43847b){const _0x4f54b9=a62_0x3bdfa6,_0x178b3e=getGlobalConfigPath(),_0x4c2240=getConfigDir();!a62_0x36f609[_0x4f54b9(0xc9)](_0x4c2240)&&createSecureDirectory(_0x4c2240);let _0x28ccb8={};if(a62_0x36f609['existsSync'](_0x178b3e))try{const _0x55ea92=a62_0x36f609[_0x4f54b9(0xbf)](_0x178b3e,'utf-8');_0x28ccb8=JSON[_0x4f54b9(0x9d)](_0x55ea92);}catch{console['warn'](_0x4f54b9(0xb2)+_0x178b3e+_0x4f54b9(0xdb));}_0x28ccb8[_0x4f54b9(0xba)]=_0x43847b,writeSecureFile(_0x178b3e,JSON['stringify'](_0x28ccb8,null,0x2));}function a62_0x2092(_0x4bbe19,_0x41986c){_0x4bbe19=_0x4bbe19-0x9a;const _0x586b78=a62_0x586b();let _0x2092ea=_0x586b78[_0x4bbe19];return _0x2092ea;}export function saveActiveProfileToUserConfig(_0x53d982){const _0x21ca50=a62_0x3bdfa6;validateProfileName(_0x53d982);const _0x197140=getGlobalConfigPath(),_0x42dd84=getConfigDir();!a62_0x36f609[_0x21ca50(0xc9)](_0x42dd84)&&createSecureDirectory(_0x42dd84);let _0x20efff={};if(a62_0x36f609[_0x21ca50(0xc9)](_0x197140))try{const _0x4967a6=a62_0x36f609['readFileSync'](_0x197140,'utf-8');_0x20efff=JSON[_0x21ca50(0x9d)](_0x4967a6);}catch{console[_0x21ca50(0xe5)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x197140+_0x21ca50(0xdb));}_0x20efff['profile']=_0x53d982,writeSecureFile(_0x197140,JSON['stringify'](_0x20efff,null,0x2));}function clearFieldFromUserConfig(_0x11313e){const _0x28117a=a62_0x3bdfa6,_0x33719c=getGlobalConfigPath();if(!a62_0x36f609[_0x28117a(0xc9)](_0x33719c))return;let _0x24db8d={};try{const _0x3bc72c=a62_0x36f609[_0x28117a(0xbf)](_0x33719c,'utf-8');_0x24db8d=JSON[_0x28117a(0x9d)](_0x3bc72c);}catch{return;}delete _0x24db8d[_0x11313e],writeSecureFile(_0x33719c,JSON[_0x28117a(0xad)](_0x24db8d,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x27398e=a62_0x3bdfa6;clearFieldFromUserConfig(_0x27398e(0xba));}export function clearActiveProfileFromUserConfig(){const _0x38ab9a=a62_0x3bdfa6;clearFieldFromUserConfig(_0x38ab9a(0xb7));}export function createProfile(_0x463248,_0x12b327){const _0x5c6187=a62_0x3bdfa6;validateProfileName(_0x463248);if(profileExists(_0x463248))throw new Error(_0x5c6187(0xac)+_0x463248+_0x5c6187(0xbc));saveProfile(_0x463248,_0x12b327);}export function saveProfileCredentials(_0x47c7fd,_0x1dacba){const _0x102277=a62_0x3bdfa6;validateProfileName(_0x47c7fd);if(!profileExists(_0x47c7fd))throw new Error(_0x102277(0xac)+_0x47c7fd+_0x102277(0x9e));const _0x5392ce=getNewCredentialPath(_0x47c7fd);writeSecureFile(_0x5392ce,_0x1dacba);}export function loadProfileCredentials(_0x5e2b65){const _0x53335a=a62_0x3bdfa6;validateProfileName(_0x5e2b65);const _0x33eb5c=getNewCredentialPath(_0x5e2b65);if(a62_0x36f609['existsSync'](_0x33eb5c))try{return a62_0x36f609['readFileSync'](_0x33eb5c,'utf-8');}catch{}const _0x2dff71=getOldCredentialPath(_0x5e2b65);if(a62_0x36f609[_0x53335a(0xc9)](_0x2dff71)){console[_0x53335a(0xe5)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x5e2b65+'\x27'),console[_0x53335a(0xe5)]('To\x20migrate:'),console[_0x53335a(0xe5)](_0x53335a(0xb3)+_0x2dff71+_0x53335a(0x9f)+_0x33eb5c+'\x22'),console[_0x53335a(0xe5)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a62_0x36f609['readFileSync'](_0x2dff71,_0x53335a(0xc0));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x41b336,_0x23de12){const _0x5b487e=a63_0x3413,_0x1fda57=_0x41b336();while(!![]){try{const _0x1521ed=-parseInt(_0x5b487e(0x1fd))/0x1*(-parseInt(_0x5b487e(0x1f0))/0x2)+parseInt(_0x5b487e(0x1e8))/0x3*(-parseInt(_0x5b487e(0x1e5))/0x4)+-parseInt(_0x5b487e(0x1f4))/0x5*(parseInt(_0x5b487e(0x1f7))/0x6)+-parseInt(_0x5b487e(0x1eb))/0x7+-parseInt(_0x5b487e(0x1ec))/0x8*(-parseInt(_0x5b487e(0x1f2))/0x9)+-parseInt(_0x5b487e(0x1e2))/0xa*(-parseInt(_0x5b487e(0x1f9))/0xb)+parseInt(_0x5b487e(0x1e7))/0xc;if(_0x1521ed===_0x23de12)break;else _0x1fda57['push'](_0x1fda57['shift']());}catch(_0x4c5c78){_0x1fda57['push'](_0x1fda57['shift']());}}}(a63_0x481b,0xea488));function a63_0x481b(){const _0x33af13=['Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','2iEDlTH','profile','36SbSIcw','writeFileSync','1055EfQnIb','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','code','34758nPxJcB','readFileSync','223432thfabV','dirname','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','api_key','1430830ApRGOy','utf-8','Failed\x20to\x20load\x20project\x20config\x20from\x20','existsSync','apiKey',').\x20','Warning:\x20\x27profile\x27\x20field\x20in\x20','110tRhopo','stringify','TD_API_KEY','1336xpbVWb','ENOENT','19510260tNxsqm','11082XfKPGb','cwd','parse','6790182EdGsNF','2211304FiluZk','includes'];a63_0x481b=function(){return _0x33af13;};return a63_0x481b();}import*as a63_0x1422bb from'node:fs';import*as a63_0x2d10c5 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x2ac6e2){const _0x1e8e38=a63_0x3413;let _0x213647=_0x2ac6e2||process[_0x1e8e38(0x1e9)]();while(!![]){const _0x9e5b9c=a63_0x2d10c5['join'](_0x213647,PROJECT_CONFIG_FILENAME);if(a63_0x1422bb[_0x1e8e38(0x200)](_0x9e5b9c))return _0x9e5b9c;const _0x46710e=a63_0x2d10c5['dirname'](_0x213647);if(_0x46710e===_0x213647)return null;_0x213647=_0x46710e;}}function a63_0x3413(_0x1e9ae2,_0x2f817d){_0x1e9ae2=_0x1e9ae2-0x1e1;const _0x481bf9=a63_0x481b();let _0x3413fc=_0x481bf9[_0x1e9ae2];return _0x3413fc;}export function loadProjectConfig(_0x418312){const _0x274af4=a63_0x3413,_0x26877c=findProjectConfigPath(_0x418312);if(!_0x26877c)return null;try{const _0x391832=a63_0x1422bb[_0x274af4(0x1f8)](_0x26877c,_0x274af4(0x1fe)),_0x273e30=JSON[_0x274af4(0x1ea)](_0x391832),_0x1e744c=JSON['stringify'](_0x273e30);if(_0x1e744c[_0x274af4(0x1ed)](_0x274af4(0x1e4))||_0x1e744c[_0x274af4(0x1ed)](_0x274af4(0x201))||_0x1e744c[_0x274af4(0x1ed)]('api_key'))throw new Error(_0x274af4(0x1ee)+_0x26877c+_0x274af4(0x202)+_0x274af4(0x1fb));const {metadata:_0x39518e,profile:_0x44182a,..._0x69e1cb}=_0x273e30;return _0x44182a&&console['warn'](_0x274af4(0x1e1)+_0x26877c+'\x20is\x20ignored.\x20'+_0x274af4(0x1f5)),_0x69e1cb;}catch(_0x3a0fb3){if(_0x3a0fb3 instanceof Error&&_0x274af4(0x1f6)in _0x3a0fb3&&_0x3a0fb3[_0x274af4(0x1f6)]===_0x274af4(0x1e6))return null;throw new Error(_0x274af4(0x1ff)+_0x26877c+':\x20'+_0x3a0fb3);}}export function saveProjectConfig(_0x189cd8,_0x425b90){const _0x29ff22=a63_0x3413,_0x4c1f27=_0x425b90||process[_0x29ff22(0x1e9)](),_0x5a3de7=a63_0x2d10c5['join'](_0x4c1f27,PROJECT_CONFIG_FILENAME),_0x5b9e65=JSON[_0x29ff22(0x1e3)](_0x189cd8);if(_0x5b9e65['includes'](_0x29ff22(0x1e4))||_0x5b9e65[_0x29ff22(0x1ed)]('apiKey')||_0x5b9e65[_0x29ff22(0x1ed)](_0x29ff22(0x1fc)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x29ff22(0x1f1)in _0x189cd8)throw new Error(_0x29ff22(0x1ef));a63_0x1422bb[_0x29ff22(0x1f3)](_0x5a3de7,JSON[_0x29ff22(0x1e3)](_0x189cd8,null,0x2));}export function hasProjectConfig(_0x1661cf){return findProjectConfigPath(_0x1661cf)!==null;}export function getProjectRoot(_0x527af1){const _0x51b89d=a63_0x3413,_0x37848e=findProjectConfigPath(_0x527af1);return _0x37848e?a63_0x2d10c5[_0x51b89d(0x1fa)](_0x37848e):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4c19b1,_0x13a19a){const _0x5930a4=a64_0x4aac,_0x2b2864=_0x4c19b1();while(!![]){try{const _0x5028ae=-parseInt(_0x5930a4(0x196))/0x1+parseInt(_0x5930a4(0x194))/0x2+parseInt(_0x5930a4(0x1a0))/0x3*(parseInt(_0x5930a4(0x1af))/0x4)+-parseInt(_0x5930a4(0x18d))/0x5*(parseInt(_0x5930a4(0x198))/0x6)+parseInt(_0x5930a4(0x1a6))/0x7*(parseInt(_0x5930a4(0x1a1))/0x8)+parseInt(_0x5930a4(0x1ae))/0x9*(-parseInt(_0x5930a4(0x1a2))/0xa)+-parseInt(_0x5930a4(0x19b))/0xb;if(_0x5028ae===_0x13a19a)break;else _0x2b2864['push'](_0x2b2864['shift']());}catch(_0x1b16cd){_0x2b2864['push'](_0x2b2864['shift']());}}}(a64_0x302e,0x56d86));import*as a64_0xfe48af from'node:fs';import*as a64_0x5d188f from'node:path';import*as a64_0x34e91b from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x2a999d=a64_0x4aac,_0x56a236=process.env.TDX_CONFIG_DIR||a64_0x5d188f['join'](a64_0x34e91b[_0x2a999d(0x19d)](),'.config',_0x2a999d(0x1a8));return a64_0x5d188f[_0x2a999d(0x1a4)](_0x56a236,_0x2a999d(0x197));}function getSessionPath(_0x3f0dd9){const _0x35b8c2=a64_0x4aac;return a64_0x5d188f[_0x35b8c2(0x1a4)](getSessionsDir(),_0x3f0dd9+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x4f3aaa){const _0xa55fbb=a64_0x4aac;if(_0x4f3aaa)return _0x4f3aaa;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0xa55fbb(0x18f)]();}export function loadSessionContext(_0x26e0d2){const _0x2ccdff=a64_0x4aac,_0x2edc0c=getSessionID(_0x26e0d2),_0x350ffc=/^\d+$/[_0x2ccdff(0x190)](_0x2edc0c)?parseInt(_0x2edc0c,0xa):null;return _0x350ffc!==null?loadSessionContextByPID(_0x350ffc):loadSessionContextByString(_0x2edc0c);}export function loadSessionContextByPID(_0x39241e){const _0x394f66=a64_0x4aac,_0x8691b9=getSessionPath(_0x39241e);if(!a64_0xfe48af[_0x394f66(0x191)](_0x8691b9))return null;try{const _0x2081cf=a64_0xfe48af['readFileSync'](_0x8691b9,_0x394f66(0x193)),_0x150e85=JSON[_0x394f66(0x1a3)](_0x2081cf),_0x5aa84c=new Date(_0x150e85[_0x394f66(0x1ab)])['getTime'](),_0xd0627=Date['now']();if(_0xd0627-_0x5aa84c>SESSION_EXPIRATION_MS)return a64_0xfe48af['unlinkSync'](_0x8691b9),null;const _0x385d9d=JSON[_0x394f66(0x1b3)](_0x150e85);if(_0x385d9d[_0x394f66(0x1b1)](_0x394f66(0x19c))||_0x385d9d['includes'](_0x394f66(0x1ac))||_0x385d9d[_0x394f66(0x1b1)](_0x394f66(0x1ad)))return console[_0x394f66(0x1a9)](_0x394f66(0x18e)+_0x8691b9+_0x394f66(0x1a7)),a64_0xfe48af['unlinkSync'](_0x8691b9),null;return _0x150e85;}catch{try{a64_0xfe48af[_0x394f66(0x1b0)](_0x8691b9);}catch{}return null;}}function a64_0x4aac(_0x4467bd,_0x478ae7){_0x4467bd=_0x4467bd-0x18d;const _0x302ea8=a64_0x302e();let _0x4aacc5=_0x302ea8[_0x4467bd];return _0x4aacc5;}function loadSessionContextByString(_0x5eeb92){const _0x3d030f=a64_0x4aac,_0x1c431b=a64_0x5d188f[_0x3d030f(0x1a4)](getSessionsDir(),_0x5eeb92+_0x3d030f(0x1b4));if(!a64_0xfe48af[_0x3d030f(0x191)](_0x1c431b))return null;try{const _0x28c319=a64_0xfe48af['readFileSync'](_0x1c431b,'utf-8'),_0x3de24f=JSON[_0x3d030f(0x1a3)](_0x28c319),_0x1a8c65=new Date(_0x3de24f[_0x3d030f(0x1ab)])['getTime'](),_0x526763=Date['now']();if(_0x526763-_0x1a8c65>SESSION_EXPIRATION_MS)return a64_0xfe48af[_0x3d030f(0x1b0)](_0x1c431b),null;const _0x3e0f26=JSON[_0x3d030f(0x1b3)](_0x3de24f);if(_0x3e0f26[_0x3d030f(0x1b1)](_0x3d030f(0x19c))||_0x3e0f26['includes']('apiKey')||_0x3e0f26[_0x3d030f(0x1b1)](_0x3d030f(0x1ad)))return console['warn'](_0x3d030f(0x18e)+_0x1c431b+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a64_0xfe48af[_0x3d030f(0x1b0)](_0x1c431b),null;return _0x3de24f;}catch{try{a64_0xfe48af['unlinkSync'](_0x1c431b);}catch{}return null;}}export function saveSessionContext(_0x387c00,_0x7bfef3){const _0x18220c=a64_0x4aac,_0x3b754f=getSessionID(_0x7bfef3),_0x4aed29=/^\d+$/[_0x18220c(0x190)](_0x3b754f)?parseInt(_0x3b754f,0xa):getCurrentSessionPID(),_0x1ea1cb=a64_0x5d188f[_0x18220c(0x1a4)](getSessionsDir(),_0x3b754f+_0x18220c(0x1b4)),_0x3ebe19=getSessionsDir();createSecureDirectory(_0x3ebe19);const _0x246b7b=JSON[_0x18220c(0x1b3)](_0x387c00);if(_0x246b7b[_0x18220c(0x1b1)]('TD_API_KEY')||_0x246b7b[_0x18220c(0x1b1)]('apiKey')||_0x246b7b['includes']('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x17eb19;const _0x28c307=/^\d+$/[_0x18220c(0x190)](_0x3b754f)?loadSessionContextByPID(parseInt(_0x3b754f,0xa)):loadSessionContextByString(_0x3b754f);_0x28c307?_0x17eb19={..._0x28c307,..._0x387c00,'pid':_0x4aed29,'sessionId':_0x3b754f!==_0x4aed29[_0x18220c(0x18f)]()?_0x3b754f:undefined,'updatedAt':new Date()[_0x18220c(0x195)]()}:_0x17eb19={'pid':_0x4aed29,'sessionId':_0x3b754f!==_0x4aed29[_0x18220c(0x18f)]()?_0x3b754f:undefined,..._0x387c00,'createdAt':new Date()[_0x18220c(0x195)](),'updatedAt':new Date()['toISOString']()},a64_0xfe48af[_0x18220c(0x192)](_0x1ea1cb,JSON[_0x18220c(0x1b3)](_0x17eb19,null,0x2));}export function clearSessionContext(_0x4f1316){const _0x1bca73=a64_0x4aac,_0x13e445=getSessionID(_0x4f1316),_0x5d7edb=a64_0x5d188f[_0x1bca73(0x1a4)](getSessionsDir(),_0x13e445+'.json');a64_0xfe48af['existsSync'](_0x5d7edb)&&a64_0xfe48af[_0x1bca73(0x1b0)](_0x5d7edb);}export function clearSessionContextField(_0xea34c9,_0x373e92){const _0x53cc15=a64_0x4aac,_0x9de8c2=getSessionID(_0x373e92),_0x378af9=a64_0x5d188f['join'](getSessionsDir(),_0x9de8c2+_0x53cc15(0x1b4));if(!a64_0xfe48af[_0x53cc15(0x191)](_0x378af9))return;try{const _0x4d2a7f=a64_0xfe48af[_0x53cc15(0x19f)](_0x378af9,'utf-8'),_0x40e239=JSON[_0x53cc15(0x1a3)](_0x4d2a7f);delete _0x40e239[_0xea34c9],a64_0xfe48af['writeFileSync'](_0x378af9,JSON[_0x53cc15(0x1b3)](_0x40e239,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x4a32e0=a64_0x4aac,_0x58635e=getSessionsDir();if(!a64_0xfe48af[_0x4a32e0(0x191)](_0x58635e))return 0x0;let _0x504a19=0x0;const _0x81a9f6=Date[_0x4a32e0(0x1aa)]();try{const _0xa26dcf=a64_0xfe48af['readdirSync'](_0x58635e);for(const _0x828d72 of _0xa26dcf){if(!_0x828d72['endsWith']('.json'))continue;const _0x8494ad=a64_0x5d188f[_0x4a32e0(0x1a4)](_0x58635e,_0x828d72),_0x91cdb2=_0x828d72['replace'](_0x4a32e0(0x1b4),''),_0x573b69=parseInt(_0x91cdb2,0xa),_0x4a6bb5=!isNaN(_0x573b69);if(_0x4a6bb5){if(!isProcessRunning(_0x573b69)){a64_0xfe48af[_0x4a32e0(0x1b0)](_0x8494ad),_0x504a19++;continue;}}try{const _0x39c2fc=a64_0xfe48af[_0x4a32e0(0x19f)](_0x8494ad,_0x4a32e0(0x193)),_0x4d3d69=JSON[_0x4a32e0(0x1a3)](_0x39c2fc),_0x34353a=new Date(_0x4d3d69[_0x4a32e0(0x1ab)])[_0x4a32e0(0x1a5)]();_0x81a9f6-_0x34353a>SESSION_EXPIRATION_MS&&(a64_0xfe48af[_0x4a32e0(0x1b0)](_0x8494ad),_0x504a19++);}catch{a64_0xfe48af[_0x4a32e0(0x1b0)](_0x8494ad),_0x504a19++;}}}catch{}return _0x504a19;}function a64_0x302e(){const _0x5bba07=['now','createdAt','apiKey','api_key','2189043kuYHZi','24JWyNfM','unlinkSync','includes','endsWith','stringify','.json','845ZpuKuX','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','toString','test','existsSync','writeFileSync','utf-8','868472PkicoU','toISOString','141802QvYKTV','sessions','930dwloAS','readdirSync','replace','1553134nmVUea','TD_API_KEY','homedir','sort','readFileSync','41079woRSZE','1352CfWKRQ','10OOAcxZ','parse','join','getTime','16226ZlllTZ','.\x20This\x20is\x20insecure.\x20Removing\x20session.','tdx','warn'];a64_0x302e=function(){return _0x5bba07;};return a64_0x302e();}export function listActiveSessions(){const _0x50993a=a64_0x4aac,_0x13792a=getSessionsDir();if(!a64_0xfe48af[_0x50993a(0x191)](_0x13792a))return[];try{const _0x52c604=a64_0xfe48af[_0x50993a(0x199)](_0x13792a),_0x1d96bc=[];for(const _0x1fadd9 of _0x52c604){if(!_0x1fadd9[_0x50993a(0x1b2)]('.json'))continue;const _0x521bf3=_0x1fadd9[_0x50993a(0x19a)]('.json',''),_0x37df69=parseInt(_0x521bf3,0xa);!isNaN(_0x37df69)&&isProcessRunning(_0x37df69)&&_0x1d96bc['push'](_0x37df69);}return _0x1d96bc[_0x50993a(0x19e)]((_0x177ab9,_0x161ed5)=>_0x177ab9-_0x161ed5);}catch{return[];}}
|
package/dist/core/user-cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a65_0x1518b7=a65_0xb28e;(function(_0x142435,_0x770497){const _0x4cd4be=a65_0xb28e,_0x1fb6c5=_0x142435();while(!![]){try{const _0x2a7b72=parseInt(_0x4cd4be(0xf0))/0x1+-parseInt(_0x4cd4be(0xec))/0x2*(parseInt(_0x4cd4be(0xed))/0x3)+parseInt(_0x4cd4be(0xf1))/0x4*(-parseInt(_0x4cd4be(0xeb))/0x5)+-parseInt(_0x4cd4be(0xee))/0x6+parseInt(_0x4cd4be(0xf8))/0x7*(-parseInt(_0x4cd4be(0xf6))/0x8)+parseInt(_0x4cd4be(0xf7))/0x9+-parseInt(_0x4cd4be(0xf4))/0xa*(-parseInt(_0x4cd4be(0xf2))/0xb);if(_0x2a7b72===_0x770497)break;else _0x1fb6c5['push'](_0x1fb6c5['shift']());}catch(_0x198c01){_0x1fb6c5['push'](_0x1fb6c5['shift']());}}}(a65_0x277a,0x50535));import{createProfileCache}from'../utils/global-cache.js';function a65_0xb28e(_0x226ec5,_0xe7c0d6){_0x226ec5=_0x226ec5-0xea;const _0x277a0b=a65_0x277a();let _0xb28e6f=_0x277a0b[_0x226ec5];return _0xb28e6f;}const userCache=createProfileCache(a65_0x1518b7(0xf9),a65_0x1518b7(0xef));export function loadCachedUsers(_0x10d370){const _0x39a143=a65_0x1518b7,_0x353f1e=userCache['read'](_0x10d370);return _0x353f1e?.[_0x39a143(0xf5)]??null;}export function saveCachedUsers(_0x27603d,_0x24bf39){const _0x131fe2=a65_0x1518b7;userCache[_0x131fe2(0xf3)](_0x27603d,{'users':_0x24bf39,'cachedAt':Date[_0x131fe2(0xea)]()});}export function clearUserCache(_0x4faafd){userCache['clear'](_0x4faafd);}function a65_0x277a(){const _0x4a14f1=['5012874vDZmgu','126gfpGVf','users-{profile}.json','now','1910630KbuYBA','86JvNDNR','14289xhyDBT','2519346yRuYKG','core/user-cache','268227TVBGvT','4tNHriV','583QRwchn','write','142360SqboZr','users','108392EpLlox'];a65_0x277a=function(){return _0x4a14f1;};return a65_0x277a();}
|
package/dist/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x8b52f4,_0xc44f07){const _0x1b7c83=a66_0x1b18,_0xeab572=_0x8b52f4();while(!![]){try{const _0x317204=-parseInt(_0x1b7c83(0xae))/0x1+-parseInt(_0x1b7c83(0xa2))/0x2*(-parseInt(_0x1b7c83(0xa9))/0x3)+parseInt(_0x1b7c83(0xac))/0x4*(-parseInt(_0x1b7c83(0xaf))/0x5)+-parseInt(_0x1b7c83(0xa6))/0x6*(parseInt(_0x1b7c83(0xab))/0x7)+-parseInt(_0x1b7c83(0xa8))/0x8*(parseInt(_0x1b7c83(0xaa))/0x9)+parseInt(_0x1b7c83(0xad))/0xa*(parseInt(_0x1b7c83(0xa1))/0xb)+parseInt(_0x1b7c83(0x9c))/0xc*(parseInt(_0x1b7c83(0x9b))/0xd);if(_0x317204===_0xc44f07)break;else _0xeab572['push'](_0xeab572['shift']());}catch(_0x2ab65d){_0xeab572['push'](_0xeab572['shift']());}}}(a66_0x5a98,0x3ace7));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x3ecdf3=a66_0x1b18;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4729b6=fileURLToPath(import.meta.url),_0x3a72c7=dirname(_0x4729b6);try{const _0x257c72=join(_0x3a72c7,_0x3ecdf3(0xa3));cachedBuildInfo=JSON['parse'](readFileSync(_0x257c72,_0x3ecdf3(0x9f)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}function a66_0x5a98(){const _0x42539e=['1158989ikQuNM','240eQyzFF','includes','.dev','utf-8','version','33GRmVma','22fUFfbF','../build-info.json','parse','../../package.json','6bgiALo','0.0.0','1960OtVfuq','3411udFNhw','16596epUkLu','3316726MdYZWD','34384TUqTjV','49160KyRTcK','179662qTIpZX','270MOjmSp'];a66_0x5a98=function(){return _0x42539e;};return a66_0x5a98();}export function getVersion(){const _0xc55406=a66_0x1b18;if(cachedVersion!==null)return cachedVersion;const _0x4f26ac=fileURLToPath(import.meta.url),_0x597a09=dirname(_0x4f26ac),_0x423259=getBuildInfo();if(_0x423259[_0xc55406(0xa0)])return cachedVersion=_0x423259[_0xc55406(0xa0)],cachedVersion;try{const _0x1fbb0c=join(_0x597a09,_0xc55406(0xa5)),_0x47a595=JSON[_0xc55406(0xa4)](readFileSync(_0x1fbb0c,_0xc55406(0x9f)));cachedVersion=_0x47a595[_0xc55406(0xa0)];}catch{cachedVersion=_0xc55406(0xa7);}return cachedVersion;}function a66_0x1b18(_0x1502c8,_0x1a7677){_0x1502c8=_0x1502c8-0x9b;const _0x5a98c1=a66_0x5a98();let _0x1b1851=_0x5a98c1[_0x1502c8];return _0x1b1851;}export function isDevVersion(){const _0x311c0f=a66_0x1b18,_0x49db5b=getVersion();return _0x49db5b['includes'](_0x311c0f(0x9e))||_0x49db5b[_0x311c0f(0x9d)]('-');}
|