@treasuredata/tdx 2026.3.12 → 2026.3.14
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
|
-
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
|
+
const a54_0x25f646=a54_0x5dab;(function(_0x33f5e,_0x320685){const _0x4e0273=a54_0x5dab,_0x1fe76f=_0x33f5e();while(!![]){try{const _0x43f0c8=-parseInt(_0x4e0273(0x7e))/0x1+-parseInt(_0x4e0273(0x7b))/0x2+-parseInt(_0x4e0273(0x87))/0x3*(-parseInt(_0x4e0273(0x92))/0x4)+-parseInt(_0x4e0273(0xa1))/0x5+-parseInt(_0x4e0273(0x98))/0x6*(-parseInt(_0x4e0273(0x72))/0x7)+parseInt(_0x4e0273(0x91))/0x8*(-parseInt(_0x4e0273(0x73))/0x9)+parseInt(_0x4e0273(0x83))/0xa;if(_0x43f0c8===_0x320685)break;else _0x1fe76f['push'](_0x1fe76f['shift']());}catch(_0x199b6e){_0x1fe76f['push'](_0x1fe76f['shift']());}}}(a54_0x1652,0x26524));function a54_0x5dab(_0x4f1107,_0x2839b0){_0x4f1107=_0x4f1107-0x6b;const _0x1652a9=a54_0x1652();let _0x5dab92=_0x1652a9[_0x4f1107];return _0x5dab92;}import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a54_0x4bf65e from'node:fs';import*as a54_0xeec917 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_0x2e31d3 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x5a2d83=a54_0x5dab;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x5a2d83(0x86),_0x5a2d83(0xa2));}export function getConfigFile(){const _0x4a3862=a54_0x5dab;return join(getConfigDir(),_0x4a3862(0x7a));}export function getConfigFilePath(_0x321d90){const _0x29a2f1=a54_0x5dab,_0x3ca9d4=getConfigDir();return _0x321d90?a54_0xeec917['join'](_0x3ca9d4,_0x29a2f1(0xab)+_0x321d90):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a54_0x25f646(0x6f),a54_0x25f646(0xb6));export function getLLMProjectCacheFile(_0x140bc6){return llmProjectCache['path'](_0x140bc6);}export function readCachedLLMProject(_0xcc6212){const _0x288e8d=a54_0x25f646,_0x2eef5f=llmProjectCache[_0x288e8d(0x6d)](_0xcc6212);if(_0x2eef5f&&typeof _0x2eef5f['id']===_0x288e8d(0x8d)&&typeof _0x2eef5f[_0x288e8d(0x94)]===_0x288e8d(0x8d))return _0x2eef5f;return null;}export function writeCachedLLMProject(_0xdabcba,_0x4124fc,_0x4d095e){const _0x25aa57=a54_0x25f646;try{llmProjectCache[_0x25aa57(0xaa)]({'name':_0xdabcba,'id':_0x4124fc},_0x4d095e);}catch{}}const llmAgentCache=createOptionalProfileCache(a54_0x25f646(0x75),a54_0x25f646(0x71));export function getLLMAgentCacheFile(_0x531b0e){const _0x49cce6=a54_0x25f646;return llmAgentCache[_0x49cce6(0x84)](_0x531b0e);}export function readCachedLLMAgent(_0x51021f){const _0x57453f=a54_0x25f646,_0x150942=llmAgentCache['read'](_0x51021f);if(_0x150942&&typeof _0x150942['id']==='string'&&typeof _0x150942[_0x57453f(0x94)]==='string'&&typeof _0x150942['projectId']===_0x57453f(0x8d))return _0x150942;return null;}export function writeCachedLLMAgent(_0x302b39,_0x5da555,_0x928821,_0x37d6ad){const _0x1953cf=a54_0x25f646;try{llmAgentCache[_0x1953cf(0xaa)]({'name':_0x302b39,'id':_0x5da555,'projectId':_0x928821},_0x37d6ad);}catch{}}export function clearCachedLLMAgent(_0x520700){const _0x11a6be=a54_0x25f646;try{llmAgentCache[_0x11a6be(0x70)](_0x520700);}catch{}}const accountInfoCache=createOptionalProfileCache(a54_0x25f646(0x99),a54_0x25f646(0x8e),{'suffix':a54_0x25f646(0xa4)});export function getAccountInfoCacheFile(_0x49f25f){const _0x394803=a54_0x25f646;return accountInfoCache[_0x394803(0x84)](_0x49f25f);}export function readCachedAccountInfo(_0x2aa534){const _0x41ff1d=a54_0x25f646,_0x448cc8=accountInfoCache[_0x41ff1d(0x6d)](_0x2aa534);if(_0x448cc8&&typeof _0x448cc8[_0x41ff1d(0x77)]==='string'&&typeof _0x448cc8[_0x41ff1d(0x8b)]===_0x41ff1d(0x9a))return _0x448cc8;return null;}export function writeCachedAccountInfo(_0x46e9eb,_0x483a1f,_0x442edc){const _0xf75455=a54_0x25f646;try{accountInfoCache[_0xf75455(0xaa)]({'site':_0x46e9eb,'accountId':_0x483a1f,'cachedAt':new Date()['toISOString']()},_0x442edc);}catch{}}export function parseEnvFile(_0x1d57b6){const _0x3ca5b7=a54_0x25f646,_0x41ab27={};for(const _0xf07fff of _0x1d57b6[_0x3ca5b7(0xa8)]('\x0a')){const _0x5e1eb0=_0xf07fff['trim']();if(!_0x5e1eb0||_0x5e1eb0['startsWith']('#'))continue;const _0x434e35=_0x5e1eb0[_0x3ca5b7(0x9c)](/^([^=]+)=(.*)$/);if(_0x434e35){const _0x561995=_0x434e35[0x1][_0x3ca5b7(0x95)]();let _0x4b3907=_0x434e35[0x2][_0x3ca5b7(0x95)]();(_0x4b3907[_0x3ca5b7(0x9e)]('\x22')&&_0x4b3907[_0x3ca5b7(0xb1)]('\x22')||_0x4b3907[_0x3ca5b7(0x9e)]('\x27')&&_0x4b3907[_0x3ca5b7(0xb1)]('\x27'))&&(_0x4b3907=_0x4b3907['slice'](0x1,-0x1)),_0x41ab27[_0x561995]=_0x4b3907;}}return _0x41ab27;}export function readUserConfig(){const _0x3a9f5c=a54_0x25f646,_0x241175=getConfigFile();if(!existsSync(_0x241175))return{};try{const _0x4b85f9=readFileSync(_0x241175,_0x3a9f5c(0x6e));return parseEnvFile(_0x4b85f9);}catch(_0x5241e9){return console['warn'](_0x3a9f5c(0xb3)+_0x241175+':',_0x5241e9),{};}}export function resolveSite(_0x11291d){const _0x58505b=a54_0x25f646,_0x33abc8=['us01',_0x58505b(0x90),_0x58505b(0x85),'ap02',_0x58505b(0x88),'dev-us01',_0x58505b(0xaf),_0x58505b(0xb2),_0x58505b(0xa9),_0x58505b(0x7c)];if(_0x33abc8['includes'](_0x11291d))return _0x11291d;if(_0x11291d in SITE_ALIASES)return SITE_ALIASES[_0x11291d];return console['warn']('Warning:\x20Unknown\x20site\x20\x27'+_0x11291d+'\x27,\x20defaulting\x20to\x20us01'),_0x58505b(0xa0);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x5e7869){const _0x4c0ab4=a54_0x25f646,_0x1eb324=_0x5e7869||getActiveProfileName()||undefined;if(_0x1eb324){const _0x4bd770=_0x4c0ab4(0x78)+normalizeProfileForEnvVar(_0x1eb324);if(process.env[_0x4bd770])return{'accessToken':process.env[_0x4bd770],'source':_0x4bd770+_0x4c0ab4(0x93)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x4c0ab4(0x79)};return null;}export function getAccessToken(_0x314874){return resolveAccessToken(_0x314874)?.['accessToken'];}export function getAPIKey(_0x3b3f75){const _0x2f4ef6=_0x3b3f75||getActiveProfileName();if(_0x2f4ef6){const _0x664927='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x2f4ef6);if(process.env[_0x664927])return process.env[_0x664927];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0xc553d0){const _0x2bc434=a54_0x25f646;return _0xc553d0[_0x2bc434(0xad)]()[_0x2bc434(0x6b)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x256f63,_0x1a7ac4){const _0x324a76=a54_0x25f646,_0x2219e4=resolveAccessToken(_0x1a7ac4);if(_0x2219e4)return{'apiKey':_0x2219e4[_0x324a76(0x7f)],'source':_0x2219e4['source'],'isDeprecated':![]};const _0x39f109=_0x1a7ac4||getActiveProfileName()||undefined;if(_0x39f109){const _0x542832='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x39f109);if(process.env[_0x542832])return{'apiKey':process.env[_0x542832],'source':_0x542832+'\x20env\x20var','isDeprecated':![]};const _0x1b7f20=getCachedCredential(_0x256f63,_0x39f109);if(_0x1b7f20)return{'apiKey':_0x1b7f20,'source':_0x324a76(0xae)+_0x39f109+')','isDeprecated':![]};const _0x28ea5a=await getKeychainAPIKey(_0x39f109);if(_0x28ea5a)return setCachedCredential(_0x28ea5a,_0x256f63,_0x39f109),{'apiKey':_0x28ea5a,'source':_0x324a76(0xae)+_0x39f109+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x324a76(0xb5),'isDeprecated':![]};if(!_0x39f109){const _0xe040b8=getCachedCredential(_0x256f63,undefined);if(_0xe040b8)return{'apiKey':_0xe040b8,'source':_0x324a76(0xa3),'isDeprecated':![]};const _0x4264e5=await getKeychainAPIKey(undefined);if(_0x4264e5)return setCachedCredential(_0x4264e5,_0x256f63,undefined),{'apiKey':_0x4264e5,'source':'keychain','isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x93d3b2,_0x2fa3d7){const _0x38fa26=a54_0x25f646,_0x11fd82=await resolveAPIKeyAsync(_0x93d3b2,_0x2fa3d7);return _0x11fd82?.[_0x38fa26(0x74)];}function cleanupLegacyEnvFile(_0x11eee8){const _0x280529=a54_0x25f646;if(!existsSync(_0x11eee8))return![];try{const _0x52d3f5=readFileSync(_0x11eee8,_0x280529(0x6e)),_0x7d45b7=_0x52d3f5[_0x280529(0xa8)]('\x0a'),_0x1e230c=_0x7d45b7[_0x280529(0x80)](_0x57205b=>{const _0x37263f=_0x280529,_0x5af0ce=_0x57205b['trim']();if(!_0x5af0ce||_0x5af0ce[_0x37263f(0x9e)]('#'))return!![];const [_0x5c95c8]=_0x5af0ce[_0x37263f(0xa8)]('=');return!_0x5c95c8['startsWith'](_0x37263f(0xb4));}),_0x3730ca=_0x1e230c[_0x280529(0x96)](_0x244f5c=>{const _0x6705c8=_0x280529,_0x17f279=_0x244f5c['trim']();return _0x17f279&&!_0x17f279[_0x6705c8(0x9e)]('#');});if(!_0x3730ca)return unlinkSync(_0x11eee8),!![];return writeFileSync(_0x11eee8,_0x1e230c[_0x280529(0x76)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x28a940=a54_0x25f646;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x50b607=a54_0xeec917[_0x28a940(0x76)](getConfigDir(),_0x28a940(0x8a));if(!a54_0x4bf65e[_0x28a940(0x97)](_0x50b607))return null;try{const _0x11baf8=a54_0x4bf65e[_0x28a940(0x9f)](_0x50b607,_0x28a940(0x6e)),_0x3cf653=JSON[_0x28a940(0xa6)](_0x11baf8);return _0x3cf653[_0x28a940(0x9d)]||null;}catch{return null;}}export function saveAPIKey(_0x10d66e,_0x3a108f,_0x1406cc){const _0x3532e9=a54_0x25f646,_0xc2d6bd=getConfigDir(),_0x60b326=getConfigFilePath(_0x1406cc);!existsSync(_0xc2d6bd)&&mkdirSync(_0xc2d6bd,{'recursive':!![],'mode':0x1c0});let _0x40c958={};if(existsSync(_0x60b326))try{const _0x1f54c8=readFileSync(_0x60b326,'utf-8');_0x40c958=parseEnvFile(_0x1f54c8);}catch(_0x3857af){console[_0x3532e9(0xa5)](_0x3532e9(0x81)+_0x60b326+':',_0x3857af);}const _0x410395=_0x10d66e[_0x3532e9(0xad)]()['replace'](/-/g,'_');_0x40c958['TD_API_KEY_'+_0x410395]=_0x3a108f;const _0x264efd=Object['entries'](_0x40c958)[_0x3532e9(0x8c)](([_0x117e7d,_0x50a14e])=>_0x117e7d+'='+_0x50a14e);writeFileSync(_0x60b326,_0x264efd[_0x3532e9(0x76)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x55ba0b,_0x1cffea,_0x467787){const _0x365370=a54_0x25f646;await saveKeychainAPIKey(_0x55ba0b,_0x467787),setCachedCredential(_0x55ba0b,_0x1cffea,_0x467787);const _0x5c1870=getConfigFilePath(_0x467787);cleanupLegacyEnvFile(_0x5c1870)&&console[_0x365370(0xa5)](a54_0x2e31d3[_0x365370(0x8f)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x411aa3=a54_0x25f646,_0x332028={'apiKeys':{},'defaultSite':_0x411aa3(0xa0)},_0x7a81f9=[_0x411aa3(0xa0),_0x411aa3(0x90),_0x411aa3(0x85),_0x411aa3(0x89),_0x411aa3(0x88),_0x411aa3(0xb0),'dev-eu01',_0x411aa3(0xb2),_0x411aa3(0xa9),_0x411aa3(0x7c)],_0x435008=getAPIKey();if(_0x435008)for(const _0x2e0fc9 of _0x7a81f9){_0x332028[_0x411aa3(0x7d)][_0x2e0fc9]=_0x435008;}return _0x332028;}function a54_0x1652(){const _0x3085e2=['existsSync','19338SLUPnu','account_info','number','stringify','match','profile','startsWith','readFileSync','us01','257970Vqojjq','tdx','keychain','.json','warn','parse','next','split','stg-ap01','write','.env.','proxy','toUpperCase','keychain\x20(profile:\x20','dev-eu01','dev-us01','endsWith','stg-us01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','TD_API_KEY','TDX_API_KEY\x20env\x20var','config/llm-project','replace','release_channel','read','utf-8','llm_default_project','clear','config/llm-agent','133wfVtcS','1969119KrKfQs','apiKey','llm_default_agent','join','site','TDX_ACCESS_TOKEN_','TDX_ACCESS_TOKEN\x20env\x20var','.env','226446JviWAj','stg-ap03','apiKeys','111815DgXAYc','accessToken','filter','Warning:\x20Failed\x20to\x20read\x20','stable','4276420ASfuYj','path','eu01','.config','123psCKMs','ap03','ap02','tdx.json','accountId','map','string','config/account-info','yellow','ap01','8FRsRWT','15952EcHGZO','\x20env\x20var','name','trim','some'];a54_0x1652=function(){return _0x3085e2;};return a54_0x1652();}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x14130b=a54_0x25f646,_0x56cd28=a54_0xeec917[_0x14130b(0x76)](getConfigDir(),_0x14130b(0x8a));if(!a54_0x4bf65e[_0x14130b(0x97)](_0x56cd28))return undefined;try{const _0x405def=a54_0x4bf65e[_0x14130b(0x9f)](_0x56cd28,_0x14130b(0x6e)),_0x13105d=JSON[_0x14130b(0xa6)](_0x405def);return typeof _0x13105d[_0x14130b(0xac)]===_0x14130b(0x8d)?_0x13105d[_0x14130b(0xac)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x13fc1d=a54_0x25f646,_0x1f047d=process.env.TDX_RELEASE_CHANNEL;if(_0x1f047d===_0x13fc1d(0xa7)||_0x1f047d==='stable')return _0x1f047d;const _0x12eee2=a54_0xeec917[_0x13fc1d(0x76)](getConfigDir(),_0x13fc1d(0x8a));if(!a54_0x4bf65e[_0x13fc1d(0x97)](_0x12eee2))return'stable';try{const _0x33812f=a54_0x4bf65e['readFileSync'](_0x12eee2,_0x13fc1d(0x6e)),_0x487574=JSON['parse'](_0x33812f);if(_0x487574[_0x13fc1d(0x6c)]===_0x13fc1d(0xa7))return _0x13fc1d(0xa7);}catch{}return _0x13fc1d(0x82);}export function saveReleaseChannel(_0x462675){const _0x2b9453=a54_0x25f646,_0x2645c7=getConfigDir(),_0xdd413d=a54_0xeec917[_0x2b9453(0x76)](_0x2645c7,_0x2b9453(0x8a));!existsSync(_0x2645c7)&&mkdirSync(_0x2645c7,{'recursive':!![],'mode':0x1c0});let _0x38e679={};if(existsSync(_0xdd413d))try{const _0x5b95ed=readFileSync(_0xdd413d,'utf-8');_0x38e679=JSON[_0x2b9453(0xa6)](_0x5b95ed);}catch{}_0x38e679[_0x2b9453(0x6c)]=_0x462675,writeFileSync(_0xdd413d,JSON[_0x2b9453(0x9b)](_0x38e679,null,0x2),{'mode':0x180});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a55_0xda8167=a55_0x1d97;(function(_0x520b88,_0x10aa78){const _0x30cd8c=a55_0x1d97,_0x1f84c2=_0x520b88();while(!![]){try{const _0x29e95c=-parseInt(_0x30cd8c(0x133))/0x1*(parseInt(_0x30cd8c(0x135))/0x2)+parseInt(_0x30cd8c(0x139))/0x3+parseInt(_0x30cd8c(0x137))/0x4+-parseInt(_0x30cd8c(0x138))/0x5*(-parseInt(_0x30cd8c(0x13b))/0x6)+-parseInt(_0x30cd8c(0x13a))/0x7*(parseInt(_0x30cd8c(0x130))/0x8)+-parseInt(_0x30cd8c(0x136))/0x9*(-parseInt(_0x30cd8c(0x134))/0xa)+-parseInt(_0x30cd8c(0x13d))/0xb;if(_0x29e95c===_0x10aa78)break;else _0x1f84c2['push'](_0x1f84c2['shift']());}catch(_0x1c72d1){_0x1f84c2['push'](_0x1f84c2['shift']());}}}(a55_0x170f,0x3be2a));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a55_0xda8167(0x12d),'core/connection-cache');function a55_0x170f(){const _0x3269c1=['2185566SNUcdc','write','1783584mYtNGf','connections-{profile}.json','connections','read','871048gjbZos','clear','now','69kEJyth','70pKWmRk','3646GWTpRL','340173hzjSDu','280740brzDbP','5EHKPxq','482517UmyrHY','21plrOkx'];a55_0x170f=function(){return _0x3269c1;};return a55_0x170f();}function a55_0x1d97(_0x481582,_0x156704){_0x481582=_0x481582-0x12d;const _0x170fe9=a55_0x170f();let _0x1d9748=_0x170fe9[_0x481582];return _0x1d9748;}export function loadCachedConnections(_0x5d48d5){const _0x3cabe1=a55_0xda8167,_0x323e1d=connectionCache[_0x3cabe1(0x12f)](_0x5d48d5);return _0x323e1d?.[_0x3cabe1(0x12e)]??null;}export function saveCachedConnections(_0x1c17c1,_0x335aec){const _0x3660cc=a55_0xda8167;connectionCache[_0x3660cc(0x13c)](_0x1c17c1,{'connections':_0x335aec,'cachedAt':Date[_0x3660cc(0x132)]()});}export function clearConnectionCache(_0x960071){const _0x7b8220=a55_0xda8167;connectionCache[_0x7b8220(0x131)](_0x960071);}
|
package/dist/core/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a56_0x27a2ba=a56_0x4df9;function a56_0x8c3d(){const _0x160670=['trim','200206nLZVFu','eu\x20\x20\x20-\x20Europe','11jeSFZR','Enter\x20custom\x20site','5403530LqgLAq','us01','1982232sjVaZu','45bFVzSj','select','17NZizHi','Site\x20name\x20cannot\x20be\x20empty','log','customSite','push','5273049isImwL','site','2007453EwsTyQ','11061906GzEZeI','Select\x20your\x20Treasure\x20Data\x20site:','eu01','other','1594136krudlb','value','ap02','findIndex','ap02\x20-\x20Korea','test','length','Cancelled','5JzrNWF','ap01'];a56_0x8c3d=function(){return _0x160670;};return a56_0x8c3d();}(function(_0x1a52a0,_0x3e1dc5){const _0x1e304c=a56_0x4df9,_0x121683=_0x1a52a0();while(!![]){try{const _0x3e6bb8=parseInt(_0x1e304c(0x19a))/0x1*(parseInt(_0x1e304c(0x191))/0x2)+parseInt(_0x1e304c(0x19f))/0x3+-parseInt(_0x1e304c(0x197))/0x4*(parseInt(_0x1e304c(0x18e))/0x5)+-parseInt(_0x1e304c(0x1a2))/0x6+parseInt(_0x1e304c(0x1a1))/0x7+parseInt(_0x1e304c(0x1a6))/0x8*(-parseInt(_0x1e304c(0x198))/0x9)+parseInt(_0x1e304c(0x195))/0xa*(parseInt(_0x1e304c(0x193))/0xb);if(_0x3e6bb8===_0x3e1dc5)break;else _0x121683['push'](_0x121683['shift']());}catch(_0x4ab59b){_0x121683['push'](_0x121683['shift']());}}}(a56_0x8c3d,0xe82ee));function a56_0x4df9(_0x947e8f,_0x313f82){_0x947e8f=_0x947e8f-0x188;const _0x8c3d70=a56_0x8c3d();let _0x4df939=_0x8c3d70[_0x947e8f];return _0x4df939;}import a56_0x2d884b from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x400920,_0x1f03ad){if(_0x400920===undefined)return _0x1f03ad;if(typeof _0x400920==='number')return _0x400920;return parseInt(_0x400920,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a56_0x27a2ba(0x196)},{'title':'jp\x20\x20\x20-\x20Japan','value':a56_0x27a2ba(0x18f)},{'title':a56_0x27a2ba(0x192),'value':a56_0x27a2ba(0x1a4)},{'title':a56_0x27a2ba(0x18a),'value':a56_0x27a2ba(0x188)}];export function buildSiteChoices(_0x241e28){const _0x2eee1e=a56_0x27a2ba,_0x931237=[...STANDARD_SITE_CHOICES];let _0x49cdcd=_0x931237[_0x2eee1e(0x189)](_0x570bba=>_0x570bba[_0x2eee1e(0x1a7)]===_0x241e28);return _0x49cdcd===-0x1&&_0x241e28!==_0x2eee1e(0x196)&&(_0x931237[_0x2eee1e(0x19e)]({'title':_0x241e28,'value':_0x241e28}),_0x49cdcd=_0x931237[_0x2eee1e(0x18c)]-0x1),_0x931237[_0x2eee1e(0x19e)]({'title':_0x2eee1e(0x194),'value':_0x2eee1e(0x1a5)}),{'choices':_0x931237,'initialIndex':_0x49cdcd>=0x0?_0x49cdcd:0x0};}export async function promptSiteSelection(_0x34e2c3,_0x5acf8c,_0x469911=a56_0x27a2ba(0x18d)){const _0x3af0f4=a56_0x27a2ba,{choices:_0x15f343,initialIndex:_0x137b28}=buildSiteChoices(_0x34e2c3),_0x4b07ef=_0x5acf8c?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x5acf8c+'):':_0x3af0f4(0x1a3),_0x5f4dca=await a56_0x2d884b({'type':_0x3af0f4(0x199),'name':_0x3af0f4(0x1a0),'message':_0x4b07ef,'choices':_0x15f343,'initial':_0x137b28});if(!_0x5f4dca['site'])return console[_0x3af0f4(0x19c)]('\x0a'+_0x469911),null;if(_0x5f4dca[_0x3af0f4(0x1a0)]!==_0x3af0f4(0x1a5))return _0x5f4dca[_0x3af0f4(0x1a0)];const _0x125e17=await a56_0x2d884b({'type':'text','name':_0x3af0f4(0x19d),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x4490eb=>{const _0x5f5573=_0x3af0f4;if(!_0x4490eb||!_0x4490eb[_0x5f5573(0x190)]())return _0x5f5573(0x19b);if(!/^[a-z0-9-]+$/[_0x5f5573(0x18b)](_0x4490eb[_0x5f5573(0x190)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x125e17[_0x3af0f4(0x19d)])return console[_0x3af0f4(0x19c)]('\x0a'+_0x469911),null;return _0x125e17[_0x3af0f4(0x19d)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5d3d0e,_0x4b7b12){const _0x5c04d8=a57_0x231a,_0x3736dc=_0x5d3d0e();while(!![]){try{const _0x5d3de0=-parseInt(_0x5c04d8(0x1d6))/0x1+parseInt(_0x5c04d8(0x1cf))/0x2*(-parseInt(_0x5c04d8(0x1c8))/0x3)+-parseInt(_0x5c04d8(0x1d7))/0x4*(parseInt(_0x5c04d8(0x1cc))/0x5)+-parseInt(_0x5c04d8(0x1c7))/0x6+parseInt(_0x5c04d8(0x1d0))/0x7*(-parseInt(_0x5c04d8(0x1c9))/0x8)+-parseInt(_0x5c04d8(0x1cb))/0x9+parseInt(_0x5c04d8(0x1ce))/0xa;if(_0x5d3de0===_0x4b7b12)break;else _0x3736dc['push'](_0x3736dc['shift']());}catch(_0x480911){_0x3736dc['push'](_0x3736dc['shift']());}}}(a57_0xd44a,0x35eb0));function a57_0xd44a(){const _0x5ab706=['1185344izXJHX','2029410PRCJNF','321SdQkSM','2315064unOViP','loadedAt','2607615BOCYoa','5qmSoth','set','17737390LPsCew','3862AkdtAJ','7ZYLVKd','clear','__default_site__','now','delete','__default_profile__','132585UBJBVr'];a57_0xd44a=function(){return _0x5ab706;};return a57_0xd44a();}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3d66f9,_0x547b29){const _0x23fe7c=a57_0x231a,_0x3a9787=_0x3d66f9||_0x23fe7c(0x1d2),_0x7cc601=_0x547b29||_0x23fe7c(0x1d5);return _0x3a9787+':'+_0x7cc601;}function a57_0x231a(_0x564a59,_0x234588){_0x564a59=_0x564a59-0x1c7;const _0xd44af4=a57_0xd44a();let _0x231aa4=_0xd44af4[_0x564a59];return _0x231aa4;}export function getCachedCredential(_0x4d7f14,_0xdd351e){const _0x2f59a1=a57_0x231a,_0x417681=getCacheKey(_0x4d7f14,_0xdd351e),_0x5cc499=cache['get'](_0x417681);if(!_0x5cc499)return null;if(Date['now']()-_0x5cc499[_0x2f59a1(0x1ca)]>CACHE_TTL_MS)return cache[_0x2f59a1(0x1d4)](_0x417681),null;return _0x5cc499['apiKey'];}export function setCachedCredential(_0x54a9f5,_0x22424b,_0x1df425){const _0x594451=a57_0x231a,_0x1fe70c=getCacheKey(_0x22424b,_0x1df425);cache[_0x594451(0x1cd)](_0x1fe70c,{'apiKey':_0x54a9f5,'loadedAt':Date[_0x594451(0x1d3)]()});}export function clearCredentialCache(){const _0x4332a7=a57_0x231a;cache[_0x4332a7(0x1d1)]();}export function clearCachedCredential(_0x4c93a2,_0x52f7bd){const _0x3c2ccc=a57_0x231a,_0x23d552=getCacheKey(_0x4c93a2,_0x52f7bd);cache[_0x3c2ccc(0x1d4)](_0x23d552);}
|
|
@@ -1 +1 @@
|
|
|
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;}}
|
|
1
|
+
const a58_0x68b67a=a58_0x5ddc;(function(_0xaf2721,_0x47f1a4){const _0x146b1f=a58_0x5ddc,_0x296486=_0xaf2721();while(!![]){try{const _0x3e8834=parseInt(_0x146b1f(0xe6))/0x1*(parseInt(_0x146b1f(0x121))/0x2)+parseInt(_0x146b1f(0xf1))/0x3+parseInt(_0x146b1f(0x120))/0x4*(parseInt(_0x146b1f(0xde))/0x5)+parseInt(_0x146b1f(0xf2))/0x6+-parseInt(_0x146b1f(0x10e))/0x7+parseInt(_0x146b1f(0xe8))/0x8+parseInt(_0x146b1f(0xe3))/0x9*(-parseInt(_0x146b1f(0x104))/0xa);if(_0x3e8834===_0x47f1a4)break;else _0x296486['push'](_0x296486['shift']());}catch(_0x311f1d){_0x296486['push'](_0x296486['shift']());}}}(a58_0x1c88,0xd7b67));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_0x6d8126 from'node:fs';function a58_0x1c88(){const _0x1f56ba=['workflow_project','INFO','join','llm_project','display','logLevel','cliFlags','100FElzos','62WFyAmd','activeProfile','existsSync','none','sessionId','dim','sessions','cyan','(using\x20session:\x20','tdx.json','profileSource','utf-8','project','displayWithSources','entries','Project','configFiles','loadGlobalConfig','154195oCSABc','createAsync','layers','accessToken','bold','426879Ztkbti','green','.json','44687QSMKJo','session','9808928wYfalG','llmProject','Global\x20Credentials','llm_agent','Profile','getSource','apiKey','us01','profiles','2290560hQRcvz','1039554biofBn','global','resolveAPIKeyAsync','not\x20set','workflowProject','string','[configuration\x20files]','site','profile:\x20','segment_path','proxy','injectIntoOptions','database','log','Profile\x20Credentials','default','access_token','parent_segment','680MpesjT','getParameters','Session','cli','env','[context]','profileCredentials','.env','(session:\x20','segmentPath','1472100jbtNWS','Global','parse','llmAgent','parentSegment','config','CLI\x20flag:\x20--','verbose','profile','globalCredentials','assign'];a58_0x1c88=function(){return _0x1f56ba;};return a58_0x1c88();}import*as a58_0x1a8fe4 from'node:path';function a58_0x5ddc(_0x271c0f,_0x5ec64e){_0x271c0f=_0x271c0f-0xd8;const _0x1c8824=a58_0x1c88();let _0x5ddc6b=_0x1c8824[_0x271c0f];return _0x5ddc6b;}import a58_0x1821de from'chalk';export class GlobalContext{[a58_0x68b67a(0xf9)];[a58_0x68b67a(0xfe)];['parent_segment'];[a58_0x68b67a(0xfb)];['llm_project'];[a58_0x68b67a(0xeb)];['workflow_project'];[a58_0x68b67a(0xee)];['accessToken'];[a58_0x68b67a(0xfc)];[a58_0x68b67a(0x115)];[a58_0x68b67a(0x11e)];[a58_0x68b67a(0x116)];[a58_0x68b67a(0x12b)]=null;[a58_0x68b67a(0xe0)];[a58_0x68b67a(0x122)];['sessionId'];[a58_0x68b67a(0xdc)];constructor(_0x13458d){const _0x1a61e5=a58_0x68b67a;this[_0x1a61e5(0x125)]=getSessionID(_0x13458d[_0x1a61e5(0xe7)]);const _0x24f4e7=loadSessionContext(_0x13458d[_0x1a61e5(0xe7)]),_0x23c1d1=loadProjectConfig(),_0x5e557f=this[_0x1a61e5(0xdd)]();if(_0x13458d[_0x1a61e5(0x116)])this[_0x1a61e5(0x122)]=_0x13458d['profile'],this[_0x1a61e5(0x12b)]=_0x1a61e5(0x107);else{if(_0x24f4e7?.[_0x1a61e5(0x116)])this['activeProfile']=_0x24f4e7[_0x1a61e5(0x116)],this[_0x1a61e5(0x12b)]=_0x1a61e5(0xe7);else{if(_0x5e557f[_0x1a61e5(0x116)])this[_0x1a61e5(0x122)]=_0x5e557f[_0x1a61e5(0x116)],this['profileSource']=_0x1a61e5(0x113);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x1a61e5(0x12b)]=_0x1a61e5(0x108)):(this[_0x1a61e5(0x122)]=null,this[_0x1a61e5(0x12b)]=null);}}const _0x59a53d=this[_0x1a61e5(0x122)]?loadProfile(this['activeProfile']):null,_0x3033b2=_0x252a94=>{const _0x81a408=_0x1a61e5;if(!_0x252a94)return{};const _0x58fb9c=_0x252a94,_0x2f6d55={};for(const [_0x4b9d98,_0x170a19]of Object[_0x81a408(0xda)](_0x58fb9c)){typeof _0x170a19===_0x81a408(0xf7)&&(_0x2f6d55[_0x4b9d98]=_0x170a19);}return _0x2f6d55;},_0x255f49={},_0x2e67e0=(_0x146b1b,_0x21ecf2,_0x2aa595)=>{const _0x5af281=_0x1a61e5;if(!_0x146b1b)return![];if(_0x2aa595&&_0x146b1b===_0x2aa595)return![];const _0x4cf16d=_0x24f4e7,_0x3485ad=_0x23c1d1,_0xd627d4=_0x59a53d?.[_0x5af281(0x113)],_0x2a7f7c=_0x5e557f,_0x14ed99=_0x4cf16d?.[_0x21ecf2],_0xb138cd=_0x3485ad?.[_0x21ecf2],_0x1ccc27=_0xd627d4?.[_0x21ecf2],_0x5e4a7e=_0x2a7f7c[_0x21ecf2];return _0x146b1b!==_0x14ed99&&_0x146b1b!==_0xb138cd&&_0x146b1b!==_0x1ccc27&&_0x146b1b!==_0x5e4a7e;},_0x3d10b0=[{'optionKey':_0x1a61e5(0xf9),'contextKey':_0x1a61e5(0xf9),'defaultValue':'us01'},{'optionKey':'database','contextKey':_0x1a61e5(0xfe)},{'optionKey':_0x1a61e5(0x112),'contextKey':_0x1a61e5(0x103)},{'optionKey':_0x1a61e5(0xe9),'contextKey':_0x1a61e5(0x11c)},{'optionKey':_0x1a61e5(0x111),'contextKey':_0x1a61e5(0xeb)},{'optionKey':'profile','contextKey':_0x1a61e5(0x116)}];for(const {optionKey:_0x18482e,contextKey:_0x51bd7a,defaultValue:_0x209b16}of _0x3d10b0){const _0x2b1156=_0x13458d[_0x18482e];_0x2e67e0(_0x2b1156,_0x51bd7a,_0x209b16)&&(_0x255f49[_0x51bd7a]=_0x2b1156);}this[_0x1a61e5(0xe0)]={'cliFlags':_0x255f49,'session':_0x3033b2(_0x24f4e7),'project':_0x3033b2(_0x23c1d1),'profile':_0x3033b2(_0x59a53d?.['config']),'global':_0x3033b2(_0x5e557f)};const _0x404531={...this[_0x1a61e5(0xe0)][_0x1a61e5(0xf3)],...this[_0x1a61e5(0xe0)][_0x1a61e5(0x116)],...this[_0x1a61e5(0xe0)][_0x1a61e5(0xd8)]};process.env.TDX_SITE&&!this[_0x1a61e5(0xe0)]['session'][_0x1a61e5(0xf9)]&&!this[_0x1a61e5(0xe0)][_0x1a61e5(0x11f)][_0x1a61e5(0xf9)]&&(_0x404531[_0x1a61e5(0xf9)]=process.env.TDX_SITE);Object[_0x1a61e5(0x118)](_0x404531,this[_0x1a61e5(0xe0)]['session']),Object[_0x1a61e5(0x118)](_0x404531,this[_0x1a61e5(0xe0)][_0x1a61e5(0x11f)]);const _0x37f80c=_0x404531['site']||_0x1a61e5(0xef);this['site']=resolveSite(_0x37f80c),this[_0x1a61e5(0xfe)]=_0x404531[_0x1a61e5(0xfe)],this[_0x1a61e5(0x103)]=_0x404531[_0x1a61e5(0x103)],this[_0x1a61e5(0xfb)]=_0x404531[_0x1a61e5(0xfb)],this[_0x1a61e5(0x11c)]=_0x404531['llm_project'],this[_0x1a61e5(0xeb)]=_0x404531[_0x1a61e5(0xeb)],this[_0x1a61e5(0x119)]=_0x404531[_0x1a61e5(0x119)],this[_0x1a61e5(0x115)]=_0x13458d[_0x1a61e5(0x115)]||![],this[_0x1a61e5(0x11e)]=_0x13458d[_0x1a61e5(0x11e)]??LogLevel[_0x1a61e5(0x11a)],this[_0x1a61e5(0x116)]=this['activeProfile']||undefined,this[_0x1a61e5(0xe1)]=getAccessToken(this[_0x1a61e5(0x122)]||undefined),this['apiKey']=getAPIKey(this[_0x1a61e5(0x122)]||undefined);const _0x1681a8=typeof _0x5e557f[_0x1a61e5(0xfc)]===_0x1a61e5(0xf7)?_0x5e557f['proxy']:undefined;this[_0x1a61e5(0xfc)]=_0x1681a8||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x15080a=getConfigDir(),_0xd04f20=a58_0x1a8fe4['join'](_0x15080a,_0x1a61e5(0x127),this['sessionId']+_0x1a61e5(0xe5)),_0x4aec07=findProjectConfigPath(),_0xf32ae2=a58_0x1a8fe4['join'](_0x15080a,_0x1a61e5(0x12a)),_0x12018a=a58_0x1a8fe4['join'](_0x15080a,_0x1a61e5(0x10b));let _0x4c3ddd=null,_0x1d7737=null;this['activeProfile']&&(_0x4c3ddd=a58_0x1a8fe4[_0x1a61e5(0x11b)](_0x15080a,'profiles',this[_0x1a61e5(0x122)],_0x1a61e5(0x12a)),_0x1d7737=a58_0x1a8fe4[_0x1a61e5(0x11b)](_0x15080a,_0x1a61e5(0xf0),this[_0x1a61e5(0x122)],_0x1a61e5(0x10b))),this['configFiles']={'session':a58_0x6d8126['existsSync'](_0xd04f20)?_0xd04f20:null,'project':_0x4aec07,'profile':_0x4c3ddd&&a58_0x6d8126[_0x1a61e5(0x123)](_0x4c3ddd)?_0x4c3ddd:null,'profileCredentials':_0x1d7737&&a58_0x6d8126[_0x1a61e5(0x123)](_0x1d7737)?_0x1d7737:null,'global':a58_0x6d8126[_0x1a61e5(0x123)](_0xf32ae2)?_0xf32ae2:null,'globalCredentials':a58_0x6d8126[_0x1a61e5(0x123)](_0x12018a)?_0x12018a:null};}[a58_0x68b67a(0xed)](_0x5609e7,_0x13fd73){const _0x4a3fa3=a58_0x68b67a;if(!_0x13fd73)return _0x4a3fa3(0xf5);const _0x22d8c6=_0x13fd73;if(this[_0x4a3fa3(0xe0)][_0x4a3fa3(0x11f)][_0x5609e7]===_0x22d8c6){if(_0x5609e7===_0x4a3fa3(0xf9)&&_0x22d8c6===_0x4a3fa3(0xef)&&!this[_0x4a3fa3(0xe0)]['session'][_0x4a3fa3(0xf9)]&&!this[_0x4a3fa3(0xe0)]['project'][_0x4a3fa3(0xf9)]&&!this['layers'][_0x4a3fa3(0x116)][_0x4a3fa3(0xf9)]&&!this[_0x4a3fa3(0xe0)][_0x4a3fa3(0xf3)][_0x4a3fa3(0xf9)])return _0x4a3fa3(0x101);return _0x4a3fa3(0x114)+_0x5609e7['replace'](/_/g,'-');}if(this[_0x4a3fa3(0xe0)]['session'][_0x5609e7]===_0x22d8c6)return _0x4a3fa3(0xe7);if(this['layers'][_0x4a3fa3(0xd8)][_0x5609e7]===_0x22d8c6)return _0x4a3fa3(0xd8);if(this['layers']['profile'][_0x5609e7]===_0x22d8c6)return _0x4a3fa3(0xfa)+this[_0x4a3fa3(0x122)];if(this['layers'][_0x4a3fa3(0xf3)][_0x5609e7]===_0x22d8c6)return'global';return'default';}[a58_0x68b67a(0xdd)](){const _0x444aa0=a58_0x68b67a,_0x912bc=a58_0x1a8fe4[_0x444aa0(0x11b)](getConfigDir(),_0x444aa0(0x12a));if(!a58_0x6d8126['existsSync'](_0x912bc))return{};try{const _0x52113b=a58_0x6d8126['readFileSync'](_0x912bc,_0x444aa0(0x12c));return JSON[_0x444aa0(0x110)](_0x52113b);}catch{return{};}}[a58_0x68b67a(0xfd)](_0x57da0b){const _0x589ed9=a58_0x68b67a;_0x57da0b[_0x589ed9(0xf9)]=this[_0x589ed9(0xf9)],!_0x57da0b['database']&&this['database']&&(_0x57da0b[_0x589ed9(0xfe)]=this[_0x589ed9(0xfe)]),!_0x57da0b[_0x589ed9(0x112)]&&this[_0x589ed9(0x103)]&&(_0x57da0b[_0x589ed9(0x112)]=this[_0x589ed9(0x103)]),!_0x57da0b[_0x589ed9(0x10d)]&&this[_0x589ed9(0xfb)]&&(_0x57da0b[_0x589ed9(0x10d)]=this['segment_path']),!_0x57da0b['llmProject']&&this[_0x589ed9(0x11c)]&&(_0x57da0b['llmProject']=this[_0x589ed9(0x11c)]),!_0x57da0b[_0x589ed9(0x111)]&&this['llm_agent']&&(_0x57da0b['llmAgent']=this['llm_agent']),!_0x57da0b['workflowProject']&&this[_0x589ed9(0x119)]&&(_0x57da0b[_0x589ed9(0xf6)]=this[_0x589ed9(0x119)]);}[a58_0x68b67a(0x105)](){const _0x55f497=a58_0x68b67a;return[{'key':_0x55f497(0xf9),'value':this['site']},{'key':_0x55f497(0xfe),'value':this[_0x55f497(0xfe)]},{'key':_0x55f497(0x103),'value':this[_0x55f497(0x103)]},{'key':'segment_path','value':this[_0x55f497(0xfb)]},{'key':_0x55f497(0x11c),'value':this[_0x55f497(0x11c)]},{'key':'llm_agent','value':this[_0x55f497(0xeb)]},{'key':_0x55f497(0x119),'value':this[_0x55f497(0x119)]},{'key':_0x55f497(0x116),'value':this['activeProfile']||undefined}];}[a58_0x68b67a(0x11d)](){const _0xebbe2b=a58_0x68b67a;console[_0xebbe2b(0xff)](a58_0x1821de[_0xebbe2b(0xe2)](_0xebbe2b(0x109)));for(const {key:_0x568eb7,value:_0x124c12}of this[_0xebbe2b(0x105)]()){_0x124c12&&console[_0xebbe2b(0xff)](a58_0x1821de['cyan'](_0x568eb7)+':\x20'+_0x124c12);}}[a58_0x68b67a(0xd9)](){const _0x432af0=a58_0x68b67a;console[_0x432af0(0xff)](a58_0x1821de['bold'](_0x432af0(0x109)));for(const {key:_0x46b37a,value:_0x3bf4f4}of this[_0x432af0(0x105)]()){if(_0x3bf4f4){const _0x5ed9ea=_0x46b37a===_0x432af0(0x116)?'(active)':'('+this[_0x432af0(0xed)](_0x46b37a,_0x3bf4f4)+')';console[_0x432af0(0xff)](a58_0x1821de[_0x432af0(0x128)](_0x46b37a)+':\x20'+_0x3bf4f4+'\x20'+a58_0x1821de['dim'](_0x5ed9ea));}}console[_0x432af0(0xff)]('\x0a'+a58_0x1821de['bold'](_0x432af0(0xf8)));const _0x25a22f=[{'label':_0x432af0(0x106),'path':this['configFiles']['session'],'extra':_0x432af0(0x10c)+this[_0x432af0(0x125)]+')'},{'label':'Project','path':this[_0x432af0(0xdc)]['project']},{'label':_0x432af0(0xec),'path':this['configFiles'][_0x432af0(0x116)]},{'label':_0x432af0(0x100),'path':this['configFiles'][_0x432af0(0x10a)]},{'label':_0x432af0(0x10f),'path':this[_0x432af0(0xdc)]['global']},{'label':_0x432af0(0xea),'path':this[_0x432af0(0xdc)][_0x432af0(0x117)]}];for(const {label:_0x540b64,path:_0x14748b,extra:_0x29b084}of _0x25a22f){if(_0x14748b)console[_0x432af0(0xff)](a58_0x1821de['cyan'](_0x540b64)+':\x20'+_0x14748b+'\x20'+a58_0x1821de[_0x432af0(0xe4)]('✓')+(_0x29b084?'\x20'+a58_0x1821de['dim'](_0x29b084):''));else{if(_0x540b64==='Session')console[_0x432af0(0xff)](a58_0x1821de[_0x432af0(0x128)](_0x540b64)+':\x20'+a58_0x1821de[_0x432af0(0x126)](_0x432af0(0x124))+'\x20'+a58_0x1821de[_0x432af0(0x126)](_0x432af0(0x129)+this[_0x432af0(0x125)]+')'));else(_0x540b64===_0x432af0(0xdb)||_0x540b64===_0x432af0(0x10f))&&console[_0x432af0(0xff)](a58_0x1821de[_0x432af0(0x128)](_0x540b64)+':\x20'+a58_0x1821de[_0x432af0(0x126)](_0x432af0(0x124)));}}}async[a58_0x68b67a(0xf4)](){const _0x4b68dc=a58_0x68b67a;if(!this[_0x4b68dc(0xe1)]){const _0x53de05=await getOAuthTokens(this[_0x4b68dc(0x122)]||undefined);if(_0x53de05)return this[_0x4b68dc(0xe1)]=_0x53de05[_0x4b68dc(0x102)],undefined;}return this[_0x4b68dc(0xee)]=await getAPIKeyAsync(this[_0x4b68dc(0xf9)],this[_0x4b68dc(0x122)]||undefined),this[_0x4b68dc(0xee)];}static async[a58_0x68b67a(0xdf)](_0x359305){const _0x466308=new GlobalContext(_0x359305);return await _0x466308['resolveAPIKeyAsync'](),_0x466308;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a59_0x372af8=a59_0x4a18;(function(_0x3233cb,_0x462fce){const _0x2a5f18=a59_0x4a18,_0x5196bb=_0x3233cb();while(!![]){try{const _0x46e61a=-parseInt(_0x2a5f18(0xd5))/0x1*(-parseInt(_0x2a5f18(0xd8))/0x2)+parseInt(_0x2a5f18(0xe8))/0x3+-parseInt(_0x2a5f18(0xe4))/0x4*(parseInt(_0x2a5f18(0xe6))/0x5)+-parseInt(_0x2a5f18(0xea))/0x6*(parseInt(_0x2a5f18(0xdf))/0x7)+parseInt(_0x2a5f18(0xe5))/0x8+-parseInt(_0x2a5f18(0xf2))/0x9+parseInt(_0x2a5f18(0xdd))/0xa*(parseInt(_0x2a5f18(0xf1))/0xb);if(_0x46e61a===_0x462fce)break;else _0x5196bb['push'](_0x5196bb['shift']());}catch(_0x17efc8){_0x5196bb['push'](_0x5196bb['shift']());}}}(a59_0x22a7,0x65772));const SERVICE_NAME=a59_0x372af8(0xdc);let EntryClass=null,keyringLoadError=null;function a59_0x22a7(){const _0x136811=['error','restricted','__keychain_test__','not\x20available','access_denied','profile:','286QWfbJM','5572386jLxrer','not\x20found','@napi-rs/keyring','System\x20keychain\x20is\x20not\x20available','Entry',':api_key','getPassword','-25300','Warning:\x20','543JqUQsA','setPassword','toLowerCase','522GCLRkO','includes','no\x20matching\x20entry','reason','tdx','106550tNrJpi','unavailable','7RJrZcY','value','success','not_found','access','22228nBcFnd','6409616WrtvSq','25arIwHw','message','599403fBuNwk','cannot\x20find','2143290fHqqEE'];a59_0x22a7=function(){return _0x136811;};return a59_0x22a7();}async function getEntryClass(){const _0x16088d=a59_0x372af8;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x345577=await import(_0x16088d(0xf4));return EntryClass=_0x345577[_0x16088d(0xf6)],EntryClass;}catch(_0x4d7e3e){return keyringLoadError=_0x4d7e3e instanceof Error?_0x4d7e3e:new Error(String(_0x4d7e3e)),null;}}function getAccountName(_0xa31fc7){const _0x1e7503=a59_0x372af8,_0x4965af=_0xa31fc7||'';return _0x1e7503(0xf0)+_0x4965af+_0x1e7503(0xf7);}export async function getKeychainAPIKey(_0x5ba53d){const _0x4ddfae=a59_0x372af8,_0x46f719=await getKeychainAPIKeyWithStatus(_0x5ba53d);if(_0x46f719[_0x4ddfae(0xe1)])return _0x46f719[_0x4ddfae(0xe0)];return _0x46f719[_0x4ddfae(0xdb)]===_0x4ddfae(0xef)&&console[_0x4ddfae(0xeb)](_0x4ddfae(0xd4)+_0x46f719[_0x4ddfae(0xe7)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3a5701){const _0x5702b0=a59_0x372af8;try{const _0x244bd0=await getEntryClass();if(!_0x244bd0)return{'success':![],'reason':'unavailable'};const _0x21834e=getAccountName(_0x3a5701),_0x2c644b=new _0x244bd0(SERVICE_NAME,_0x21834e),_0x261503=_0x2c644b[_0x5702b0(0xf8)]();if(_0x261503)return{'success':!![],'value':_0x261503};return{'success':![],'reason':'not_found'};}catch(_0x32acc6){const _0x3ab10f=_0x32acc6 instanceof Error?_0x32acc6[_0x5702b0(0xe7)]:String(_0x32acc6);if(_0x3ab10f[_0x5702b0(0xd9)](_0x5702b0(0xf9))||_0x3ab10f['toLowerCase']()[_0x5702b0(0xd9)]('could\x20not\x20be\x20found')||_0x3ab10f['toLowerCase']()[_0x5702b0(0xd9)](_0x5702b0(0xf3))||_0x3ab10f[_0x5702b0(0xd7)]()['includes'](_0x5702b0(0xda)))return{'success':![],'reason':_0x5702b0(0xe2)};if(_0x3ab10f[_0x5702b0(0xd9)]('-25293')||_0x3ab10f[_0x5702b0(0xd7)]()[_0x5702b0(0xd9)](_0x5702b0(0xec))||_0x3ab10f[_0x5702b0(0xd7)]()['includes'](_0x5702b0(0xe3)))return{'success':![],'reason':'access_denied','message':'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.'};return{'success':![],'reason':_0x5702b0(0xde),'message':_0x3ab10f};}}export async function saveKeychainAPIKey(_0x4cdbd,_0x4743a6){const _0x48daf7=a59_0x372af8,_0x18a9ae=await getEntryClass();if(!_0x18a9ae)throw new Error(_0x48daf7(0xf5));const _0x4a0e58=getAccountName(_0x4743a6),_0x4b72b2=new _0x18a9ae(SERVICE_NAME,_0x4a0e58);_0x4b72b2[_0x48daf7(0xd6)](_0x4cdbd);}function a59_0x4a18(_0xf4a54e,_0x45fef1){_0xf4a54e=_0xf4a54e-0xd4;const _0x22a76d=a59_0x22a7();let _0x4a1834=_0x22a76d[_0xf4a54e];return _0x4a1834;}export async function deleteKeychainAPIKey(_0xd3a993){try{const _0x4efe36=await getEntryClass();if(!_0x4efe36)return![];const _0xaa264b=getAccountName(_0xd3a993),_0x281ca2=new _0x4efe36(SERVICE_NAME,_0xaa264b);return _0x281ca2['deleteCredential'](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x3818c5=a59_0x372af8;try{const _0x49217b=await getEntryClass();if(!_0x49217b)return![];const _0x50ec15=new _0x49217b(SERVICE_NAME,_0x3818c5(0xed));return _0x50ec15['getPassword'](),!![];}catch(_0x37f5d6){const _0x1e523e=_0x37f5d6 instanceof Error?_0x37f5d6[_0x3818c5(0xe7)][_0x3818c5(0xd7)]():'';if(_0x1e523e[_0x3818c5(0xd9)](_0x3818c5(0xee))||_0x1e523e[_0x3818c5(0xd9)]('not\x20supported')||_0x1e523e['includes'](_0x3818c5(0xe9)))return![];return!![];}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a60_0x2ff146=a60_0x7783;(function(_0x40d470,_0x1bc6bc){const _0x59db1b=a60_0x7783,_0x208b70=_0x40d470();while(!![]){try{const _0x4ff01d=parseInt(_0x59db1b(0x10b))/0x1*(parseInt(_0x59db1b(0x107))/0x2)+-parseInt(_0x59db1b(0x108))/0x3+-parseInt(_0x59db1b(0x102))/0x4+parseInt(_0x59db1b(0x106))/0x5*(-parseInt(_0x59db1b(0xfc))/0x6)+-parseInt(_0x59db1b(0x100))/0x7+-parseInt(_0x59db1b(0x10a))/0x8*(-parseInt(_0x59db1b(0x10c))/0x9)+-parseInt(_0x59db1b(0x104))/0xa*(-parseInt(_0x59db1b(0x101))/0xb);if(_0x4ff01d===_0x1bc6bc)break;else _0x208b70['push'](_0x208b70['shift']());}catch(_0xa2b653){_0x208b70['push'](_0x208b70['shift']());}}}(a60_0x3792,0x6f5fc));function a60_0x3792(){const _0x40ba63=['@napi-rs/keyring','298434gjEYmI','Entry','parse','stringify','338303GIAtVj','22fMoRMT','3245776WxMVVA','tdx','7187170LoyHTS','profile:','25OelXhg','496246JeLGak','1850691JUfMbd','setPassword','1983984KdAaCf','1GYUBsP','18wbkALn'];a60_0x3792=function(){return _0x40ba63;};return a60_0x3792();}const SERVICE_NAME=a60_0x2ff146(0x103);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x54ad8c=a60_0x2ff146;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3eb8ee=await import(_0x54ad8c(0x10d));return EntryClass=_0x3eb8ee[_0x54ad8c(0xfd)],EntryClass;}catch(_0x4a777a){return keyringLoadError=_0x4a777a instanceof Error?_0x4a777a:new Error(String(_0x4a777a)),null;}}function getOAuthAccountName(_0x1d7b93){const _0x14b0d9=a60_0x2ff146,_0x13f7ea=_0x1d7b93||'';return _0x14b0d9(0x105)+_0x13f7ea+':oauth_tokens';}export async function saveOAuthTokens(_0x532116,_0x4b5494){const _0x18b9e9=a60_0x2ff146,_0x1d3e7a=await getEntryClass();if(!_0x1d3e7a)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x355846=getOAuthAccountName(_0x4b5494),_0x7f1048=new _0x1d3e7a(SERVICE_NAME,_0x355846);_0x7f1048[_0x18b9e9(0x109)](JSON[_0x18b9e9(0xff)](_0x532116));}function a60_0x7783(_0x5affe0,_0x545b6f){_0x5affe0=_0x5affe0-0xfc;const _0x3792e9=a60_0x3792();let _0x7783d0=_0x3792e9[_0x5affe0];return _0x7783d0;}export async function getOAuthTokens(_0x249fe2){const _0x90d5f8=a60_0x2ff146;try{const _0x2c9417=await getEntryClass();if(!_0x2c9417)return null;const _0x4dd24f=getOAuthAccountName(_0x249fe2),_0x276b16=new _0x2c9417(SERVICE_NAME,_0x4dd24f),_0x20e90f=_0x276b16['getPassword']();if(_0x20e90f)return JSON[_0x90d5f8(0xfe)](_0x20e90f);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x19347d){try{const _0x54ffe5=await getEntryClass();if(!_0x54ffe5)return![];const _0x23a3e9=getOAuthAccountName(_0x19347d),_0x1d905f=new _0x54ffe5(SERVICE_NAME,_0x23a3e9);return _0x1d905f['deleteCredential'](),!![];}catch{return![];}}
|
package/dist/core/oauth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a61_0x384251=a61_0xd297;(function(_0x16a60b,_0x171761){const _0x31d71f=a61_0xd297,_0x2f0b6a=_0x16a60b();while(!![]){try{const _0xbc9708=-parseInt(_0x31d71f(0x16e))/0x1*(-parseInt(_0x31d71f(0x18e))/0x2)+-parseInt(_0x31d71f(0x169))/0x3+parseInt(_0x31d71f(0x19d))/0x4*(parseInt(_0x31d71f(0x176))/0x5)+-parseInt(_0x31d71f(0x19b))/0x6+-parseInt(_0x31d71f(0x172))/0x7*(-parseInt(_0x31d71f(0x17d))/0x8)+-parseInt(_0x31d71f(0x187))/0x9+-parseInt(_0x31d71f(0x183))/0xa;if(_0xbc9708===_0x171761)break;else _0x2f0b6a['push'](_0x2f0b6a['shift']());}catch(_0x9a5af1){_0x2f0b6a['push'](_0x2f0b6a['shift']());}}}(a61_0x37ca,0x365f6));import*as a61_0x13f596 from'node:crypto';import*as a61_0x34fded from'node:http';function a61_0xd297(_0xa19fdf,_0x48312a){_0xa19fdf=_0xa19fdf-0x164;const _0x37ca56=a61_0x37ca();let _0xd297ed=_0x37ca56[_0xa19fdf];return _0xd297ed;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set([a61_0x384251(0x174),a61_0x384251(0x18a),'stg-us01',a61_0x384251(0x17f),a61_0x384251(0x167)]);export function isOAuthSupported(_0x5abac7){const _0x4cf5d4=a61_0x384251;return OAUTH_SUPPORTED_SITES[_0x4cf5d4(0x193)](_0x5abac7);}function a61_0x37ca(){const _0x484ccb=['client_id','1165096EBlwxH','waitForCallback','stg-ap01','code_challenge_method','code_challenge','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','235180pwTvDP','randomBytes','S256','Port\x20','959391sTHZxS','tdx','/oauth/callback','dev-eu01','redirectUri','url','POST','128666AhqzVd','writeHead','error','status','127.0.0.1','has','toString','close','response_type','base64url','http://127.0.0.1','text/html','application/x-www-form-urlencoded','672546FyrMbS','OAuth\x20token\x20request\x20failed\x20(','5780CefRZr','end','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','scope','set','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','/oauth/authorize','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','update','json','digest','/oauth/token','stg-ap03','redirect_uri','20157rlDoIx','pathname','authorization_code','):\x20','get','5mcMZal','searchParams','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','text','7zxGuEA','EADDRINUSE','dev-us01','createServer','15bYmtLg','Not\x20Found','state','codeChallenge','code','listen'];a61_0x37ca=function(){return _0x484ccb;};return a61_0x37ca();}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a61_0x384251(0x189);export function getOAuthClientId(){const _0x1fd524=a61_0x384251;return process.env.TD_OAUTH_CLIENT_ID||_0x1fd524(0x188);}export function generatePKCEPair(){const _0x420603=a61_0x384251,_0x3e58b1=a61_0x13f596[_0x420603(0x184)](0x20)[_0x420603(0x194)](_0x420603(0x197)),_0x3eb21c=a61_0x13f596['createHash']('sha256')[_0x420603(0x1a5)](_0x3e58b1)[_0x420603(0x165)]('base64url');return{'verifier':_0x3e58b1,'challenge':_0x3eb21c};}export function buildAuthorizeURL(_0x1960a5,_0x44eed1){const _0x2515d4=a61_0x384251,_0x4d20c7=new URL(_0x2515d4(0x1a3),_0x1960a5);return _0x4d20c7[_0x2515d4(0x16f)][_0x2515d4(0x1a1)](_0x2515d4(0x196),_0x2515d4(0x17a)),_0x4d20c7[_0x2515d4(0x16f)][_0x2515d4(0x1a1)](_0x2515d4(0x17c),_0x44eed1['clientId']),_0x4d20c7[_0x2515d4(0x16f)][_0x2515d4(0x1a1)](_0x2515d4(0x168),_0x44eed1[_0x2515d4(0x18b)]),_0x4d20c7[_0x2515d4(0x16f)]['set']('state',_0x44eed1[_0x2515d4(0x178)]),_0x4d20c7[_0x2515d4(0x16f)]['set'](_0x2515d4(0x181),_0x44eed1[_0x2515d4(0x179)]),_0x4d20c7[_0x2515d4(0x16f)][_0x2515d4(0x1a1)](_0x2515d4(0x180),_0x2515d4(0x185)),_0x44eed1[_0x2515d4(0x1a0)]&&_0x4d20c7[_0x2515d4(0x16f)][_0x2515d4(0x1a1)](_0x2515d4(0x1a0),_0x44eed1[_0x2515d4(0x1a0)]),_0x4d20c7[_0x2515d4(0x194)]();}export async function postTokenRequest(_0x456bae,_0x1b8586){const _0x45b611=a61_0x384251,_0x4660f5=new URLSearchParams(_0x1b8586)['toString'](),_0x2f2246=await fetch(_0x456bae,{'method':_0x45b611(0x18d),'headers':{'Content-Type':_0x45b611(0x19a)},'body':_0x4660f5});if(!_0x2f2246['ok']){const _0x3475f3=await _0x2f2246[_0x45b611(0x171)]();throw new Error(_0x45b611(0x19c)+_0x2f2246[_0x45b611(0x191)]+_0x45b611(0x16c)+_0x3475f3);}return await _0x2f2246[_0x45b611(0x164)]();}export async function exchangeCodeForTokens(_0x43cc16,_0x533e2c,_0x443a96,_0x9920ba){const _0x3ac2c4=a61_0x384251,_0x15ad17=_0x43cc16+_0x3ac2c4(0x166);return postTokenRequest(_0x15ad17,{'grant_type':_0x3ac2c4(0x16b),'client_id':getOAuthClientId(),'code':_0x533e2c,'code_verifier':_0x443a96,'redirect_uri':_0x9920ba});}export function startLocalCallbackServer(){const _0x3a4464=a61_0x384251;let _0x3fbed4,_0x38eb72;const _0x1000b1=new Promise((_0x12f7d0,_0x14de1c)=>{_0x3fbed4=_0x12f7d0,_0x38eb72=_0x14de1c;}),_0x553719=a61_0x34fded[_0x3a4464(0x175)]((_0x5425f6,_0x3b2d67)=>{const _0x44bf75=_0x3a4464,_0x5c609a=new URL(_0x5425f6[_0x44bf75(0x18c)]||'/',_0x44bf75(0x198));if(_0x5c609a[_0x44bf75(0x16a)]!==_0x44bf75(0x189)){_0x3b2d67[_0x44bf75(0x18f)](0x194,{'Content-Type':'text/plain'}),_0x3b2d67['end'](_0x44bf75(0x177));return;}const _0x15df20=_0x5c609a['searchParams'][_0x44bf75(0x16d)](_0x44bf75(0x17a)),_0x5d7c77=_0x5c609a['searchParams'][_0x44bf75(0x16d)](_0x44bf75(0x178)),_0x4ddb78=_0x5c609a[_0x44bf75(0x16f)][_0x44bf75(0x16d)]('error');if(_0x4ddb78||!_0x15df20||!_0x5d7c77){_0x3b2d67[_0x44bf75(0x18f)](0x190,{'Content-Type':_0x44bf75(0x199)}),_0x3b2d67['end'](_0x44bf75(0x1a2)),_0x38eb72(new Error(_0x44bf75(0x170)));return;}_0x3b2d67[_0x44bf75(0x18f)](0xc8,{'Content-Type':_0x44bf75(0x199)}),_0x3b2d67[_0x44bf75(0x19e)](_0x44bf75(0x1a4)),_0x3fbed4({'code':_0x15df20,'state':_0x5d7c77});});_0x553719['on'](_0x3a4464(0x190),_0x1a4ee0=>{const _0x10e0fa=_0x3a4464;_0x1a4ee0[_0x10e0fa(0x17a)]===_0x10e0fa(0x173)?_0x38eb72(new Error(_0x10e0fa(0x186)+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x38eb72(new Error(_0x10e0fa(0x19f)+_0x1a4ee0['message']));}),_0x553719[_0x3a4464(0x17b)](OAUTH_CALLBACK_PORT,_0x3a4464(0x192));const _0x38f44e=setTimeout(()=>{const _0x17acbd=_0x3a4464;_0x38eb72(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x553719[_0x17acbd(0x195)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x1000b1,'close':()=>{clearTimeout(_0x38f44e),_0x553719['close']();}};}export async function startOAuthFlow(_0x3fa5f0){const _0x37ccb2=a61_0x384251,_0x203391=getConsoleUrl(_0x3fa5f0),_0x4712ab=getOAuthClientId(),{verifier:_0x59ae17,challenge:_0xdf78aa}=generatePKCEPair(),_0x266df9=a61_0x13f596[_0x37ccb2(0x184)](0x10)[_0x37ccb2(0x194)]('hex'),_0x5086ba=startLocalCallbackServer();try{const _0x43b531=OAUTH_REDIRECT_URI,_0x401ba4=buildAuthorizeURL(_0x203391,{'clientId':_0x4712ab,'redirectUri':_0x43b531,'state':_0x266df9,'codeChallenge':_0xdf78aa});openBrowser(_0x401ba4);const _0xa9df8b=await _0x5086ba[_0x37ccb2(0x17e)]();if(_0xa9df8b[_0x37ccb2(0x178)]!==_0x266df9)throw new Error(_0x37ccb2(0x182));return await exchangeCodeForTokens(_0x203391,_0xa9df8b[_0x37ccb2(0x17a)],_0x59ae17,_0x43b531);}finally{_0x5086ba[_0x37ccb2(0x195)]();}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
+
const a62_0x3b6427=a62_0x3fe6;(function(_0x4d33af,_0x1e3ac3){const _0x47c89a=a62_0x3fe6,_0x58b73f=_0x4d33af();while(!![]){try{const _0x588800=-parseInt(_0x47c89a(0x8c))/0x1+-parseInt(_0x47c89a(0x96))/0x2+-parseInt(_0x47c89a(0xb2))/0x3*(-parseInt(_0x47c89a(0x9b))/0x4)+-parseInt(_0x47c89a(0x8b))/0x5*(-parseInt(_0x47c89a(0xca))/0x6)+parseInt(_0x47c89a(0xcb))/0x7*(-parseInt(_0x47c89a(0x88))/0x8)+-parseInt(_0x47c89a(0x94))/0x9*(-parseInt(_0x47c89a(0xbb))/0xa)+parseInt(_0x47c89a(0xa1))/0xb;if(_0x588800===_0x1e3ac3)break;else _0x58b73f['push'](_0x58b73f['shift']());}catch(_0xcb4349){_0x58b73f['push'](_0x58b73f['shift']());}}}(a62_0xdec3,0xd4bf2));import*as a62_0x174bda from'node:fs';import*as a62_0x3a2d4e 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_0x3b6427(0xab);export function getProfileParams(_0x1320b4){const _0x225f12=a62_0x3b6427,_0x284470={};if(!_0x1320b4)return _0x284470;for(const [_0xe72d3c,_0x244caa]of Object[_0x225f12(0xb6)](_0x1320b4)){_0xe72d3c!=='description'&&_0x244caa!==undefined&&(_0x284470[_0xe72d3c]=_0x244caa);}return _0x284470;}export function getProfilesDir(){return a62_0x3a2d4e['join'](getConfigDir(),'profiles');}function getProfileDir(_0x4a0974){const _0x1dbf7a=a62_0x3b6427;return a62_0x3a2d4e[_0x1dbf7a(0xac)](getProfilesDir(),_0x4a0974);}function getProfileConfigPath(_0x3e9b0f){const _0x2b7a72=a62_0x3b6427;return a62_0x3a2d4e['join'](getProfileDir(_0x3e9b0f),_0x2b7a72(0xa6));}function getProfileEnvPath(_0x49d22c){const _0xb342c5=a62_0x3b6427;return a62_0x3a2d4e['join'](getProfileDir(_0x49d22c),_0xb342c5(0xc6));}function getGlobalConfigPath(){const _0x115069=a62_0x3b6427;return a62_0x3a2d4e[_0x115069(0xac)](getConfigDir(),'tdx.json');}function validateProfileName(_0x516bf9){const _0x1c40b7=a62_0x3b6427;if(/^@?[a-zA-Z0-9_-]+$/['test'](_0x516bf9))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x516bf9))return;throw new Error(_0x1c40b7(0x90)+_0x516bf9+_0x1c40b7(0xa7));}function validateProfileConfig(_0x343075,_0x4e668b){const _0x9f1c84=a62_0x3b6427;if(typeof _0x343075!==_0x9f1c84(0xd7)||_0x343075===null)throw new SDKError(ErrorCode[_0x9f1c84(0xd3)],_0x9f1c84(0x93)+_0x4e668b+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x4375a0=[_0x9f1c84(0xc9),_0x9f1c84(0x8a),_0x9f1c84(0x87),_0x9f1c84(0xd1),'llm_project',_0x9f1c84(0x92),_0x9f1c84(0xb5)],_0x22c545=_0x343075;for(const _0x4dd12d of Object['keys'](_0x22c545)){!_0x4375a0[_0x9f1c84(0x9a)](_0x4dd12d)&&console[_0x9f1c84(0x9f)](_0x9f1c84(0xb9)+_0x4e668b+_0x9f1c84(0xd6)+_0x4dd12d+_0x9f1c84(0xa9));}if(_0x22c545[_0x9f1c84(0xc9)]!==undefined&&typeof _0x22c545[_0x9f1c84(0xc9)]!=='string')throw new SDKError(ErrorCode[_0x9f1c84(0xd3)],_0x9f1c84(0x93)+_0x4e668b+_0x9f1c84(0xaf));if(_0x22c545[_0x9f1c84(0x8a)]!==undefined&&typeof _0x22c545[_0x9f1c84(0x8a)]!==_0x9f1c84(0x99))throw new SDKError(ErrorCode[_0x9f1c84(0xd3)],_0x9f1c84(0x93)+_0x4e668b+_0x9f1c84(0x9d));if(_0x22c545[_0x9f1c84(0x87)]!==undefined&&typeof _0x22c545[_0x9f1c84(0x87)]!==_0x9f1c84(0x99))throw new SDKError(ErrorCode[_0x9f1c84(0xd3)],_0x9f1c84(0x93)+_0x4e668b+_0x9f1c84(0xae));if(_0x22c545[_0x9f1c84(0xd1)]!==undefined&&typeof _0x22c545[_0x9f1c84(0xd1)]!==_0x9f1c84(0x99))throw new SDKError(ErrorCode[_0x9f1c84(0xd3)],'Profile\x20\x27'+_0x4e668b+_0x9f1c84(0xc3));if(_0x22c545[_0x9f1c84(0x91)]!==undefined&&typeof _0x22c545[_0x9f1c84(0x91)]!==_0x9f1c84(0x99))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x4e668b+_0x9f1c84(0xad));if(_0x22c545['llm_agent']!==undefined&&typeof _0x22c545[_0x9f1c84(0x92)]!==_0x9f1c84(0x99))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x9f1c84(0x93)+_0x4e668b+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x1f1166,_0x378b38){const _0x3914c2=a62_0x3b6427;if(!a62_0x174bda['existsSync'](_0x1f1166))return[];try{const _0x3e6c2e=a62_0x174bda[_0x3914c2(0x8d)](_0x1f1166,'utf-8'),_0x25d36e=JSON[_0x3914c2(0xc2)](_0x3e6c2e);if(!_0x25d36e[_0x3914c2(0xd2)]||typeof _0x25d36e[_0x3914c2(0xd2)]!==_0x3914c2(0xd7))return[];const _0x2cc9d8=[];for(const [_0x477efb,_0x5b20f7]of Object['entries'](_0x25d36e[_0x3914c2(0xd2)])){try{validateProfileConfig(_0x5b20f7,_0x477efb);const _0x25384=getNewCredentialPath(_0x477efb),_0x413d15=getOldCredentialPath(_0x477efb),_0x4857fa=a62_0x174bda[_0x3914c2(0xba)](_0x25384)||a62_0x174bda[_0x3914c2(0xba)](_0x413d15);_0x2cc9d8[_0x3914c2(0xbf)]({'name':_0x477efb,'config':_0x5b20f7,'metadata':{'name':_0x477efb,'createdAt':new Date()[_0x3914c2(0xa2)]()},'hasCredentials':_0x4857fa,'scope':_0x378b38});}catch(_0x61919c){_0x61919c instanceof Error&&(console[_0x3914c2(0x9f)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x1f1166+':'),console['warn']('\x20\x20'+_0x61919c[_0x3914c2(0x98)]+'\x0a'));}}return _0x2cc9d8;}catch(_0x495a1c){return _0x495a1c instanceof SyntaxError?(console[_0x3914c2(0x9f)](_0x3914c2(0xa0)+_0x1f1166+_0x3914c2(0xa5)),console['warn'](_0x3914c2(0x8e)+_0x495a1c[_0x3914c2(0x98)]+'\x0a')):console[_0x3914c2(0x9f)](_0x3914c2(0xc4)+_0x1f1166+':\x20'+_0x495a1c+'\x0a'),[];}}export function getNewCredentialPath(_0x40074f){const _0x3f4f2c=a62_0x3b6427;return a62_0x3a2d4e['join'](getConfigDir(),_0x3f4f2c(0x97)+_0x40074f);}function getOldCredentialPath(_0x50474d){const _0x108f28=a62_0x3b6427;return a62_0x3a2d4e['join'](getProfilesDir(),_0x50474d,_0x108f28(0xc6));}function loadProfilesFromTdxJsonFiles(){const _0x2317eb=a62_0x3b6427,_0x5c90cd=[],_0x1f7f78=findProjectConfigPath();_0x1f7f78&&_0x5c90cd[_0x2317eb(0xbf)](...loadProfilesFromTdxJson(_0x1f7f78,_0x2317eb(0x95)));const _0x525cbe=a62_0x3a2d4e[_0x2317eb(0xac)](getConfigDir(),'tdx.json');return _0x5c90cd[_0x2317eb(0xbf)](...loadProfilesFromTdxJson(_0x525cbe,_0x2317eb(0xd5))),_0x5c90cd;}function loadProfilesFromDirectories(){const _0x31f54a=a62_0x3b6427,_0x3fe1a9=getProfilesDir();if(!a62_0x174bda[_0x31f54a(0xba)](_0x3fe1a9))return[];try{return a62_0x174bda['readdirSync'](_0x3fe1a9,{'withFileTypes':!![]})[_0x31f54a(0xcf)](_0x189521=>_0x189521[_0x31f54a(0xbc)]())[_0x31f54a(0xb8)](_0x222e1f=>_0x222e1f[_0x31f54a(0xb0)])[_0x31f54a(0xcf)](_0x3569a4=>{const _0x313e26=_0x31f54a,_0xefd975=getProfileConfigPath(_0x3569a4),_0x23d6c7=getProfileEnvPath(_0x3569a4);return a62_0x174bda[_0x313e26(0xba)](_0xefd975)||a62_0x174bda[_0x313e26(0xba)](_0x23d6c7);})[_0x31f54a(0xb8)](_0x37f48a=>{const _0xe12223=_0x31f54a,_0x1018fb=loadProfileFromDirectory(_0x37f48a);if(_0x1018fb)return{..._0x1018fb,'scope':_0xe12223(0xcd)};return null;})['filter'](_0x15ee88=>_0x15ee88!==null);}catch{return[];}}function loadProfileFromDirectory(_0x50be03){const _0x108d85=a62_0x3b6427,_0x3c24f2=getProfileConfigPath(_0x50be03),_0x28ecba=getOldCredentialPath(_0x50be03);if(!a62_0x174bda[_0x108d85(0xba)](_0x3c24f2)&&!a62_0x174bda[_0x108d85(0xba)](_0x28ecba))return null;let _0x70b317={},_0x2717a7={'name':_0x50be03,'createdAt':new Date()['toISOString']()};if(a62_0x174bda[_0x108d85(0xba)](_0x3c24f2))try{const _0x4dda30=a62_0x174bda[_0x108d85(0x8d)](_0x3c24f2,_0x108d85(0xd8)),_0x296b98=JSON['parse'](_0x4dda30),{metadata:_0x36c83f,..._0x2b4c10}=_0x296b98;_0x70b317=_0x2b4c10,_0x36c83f&&(_0x2717a7=_0x36c83f);}catch{}return{'name':_0x50be03,'config':_0x70b317,'metadata':_0x2717a7,'hasCredentials':a62_0x174bda['existsSync'](_0x28ecba),'scope':_0x108d85(0xcd)};}export function listProfiles(){const _0x52e109=a62_0x3b6427,_0x22169e=loadProfilesFromTdxJsonFiles(),_0x5a832b=loadProfilesFromDirectories();if(_0x5a832b[_0x52e109(0xd0)]>0x0){const _0x4b8140=_0x5a832b[_0x52e109(0xb8)](_0x3c76e6=>_0x3c76e6['name'])[_0x52e109(0xac)](',\x20'),_0x33306f=getConfigDir();console['warn']('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x4b8140),console[_0x52e109(0x9f)](_0x52e109(0xbd)),console[_0x52e109(0x9f)](_0x52e109(0xaa)+a62_0x3a2d4e[_0x52e109(0xac)](_0x33306f,'tdx.json')),console[_0x52e109(0x9f)](_0x52e109(0xda)),console[_0x52e109(0x9f)](_0x52e109(0xb7));}const _0x4caaa4=[..._0x22169e,..._0x5a832b],_0x5ded50=new Map();for(const _0x4434f3 of _0x4caaa4){!_0x5ded50[_0x52e109(0xb4)](_0x4434f3[_0x52e109(0xb0)])&&_0x5ded50[_0x52e109(0xa3)](_0x4434f3['name'],_0x4434f3);}return Array[_0x52e109(0x8f)](_0x5ded50[_0x52e109(0xbe)]())[_0x52e109(0xd4)]((_0x318453,_0x17ddd2)=>_0x318453[_0x52e109(0xb0)]['localeCompare'](_0x17ddd2['name']));}export function profileExists(_0xec5e2f){const _0x2cabe9=a62_0x3b6427,_0xfe17ca=listProfiles();return _0xfe17ca[_0x2cabe9(0x9e)](_0x5b06f7=>_0x5b06f7[_0x2cabe9(0xb0)]===_0xec5e2f);}export function loadProfile(_0x1f262b){const _0x5bd5af=a62_0x3b6427;validateProfileName(_0x1f262b);const _0x5b5c06=listProfiles(),_0x54f15c=_0x5b5c06[_0x5bd5af(0xc5)](_0xb37a81=>_0xb37a81['name']===_0x1f262b);return _0x54f15c||null;}export function saveProfile(_0x4441b0,_0xa10b52,_0x262cd4=![]){saveProfileToUserConfig(_0x4441b0,_0xa10b52);}export function deleteProfile(_0x2b4740){const _0x27a867=a62_0x3b6427;validateProfileName(_0x2b4740);const _0x1c3dcf=getProfileDir(_0x2b4740);if(!a62_0x174bda[_0x27a867(0xba)](_0x1c3dcf))throw new Error(_0x27a867(0xa8)+_0x2b4740+_0x27a867(0xb1));a62_0x174bda[_0x27a867(0xce)](_0x1c3dcf,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x504ad3,_0x38b8a1){const _0x3e04d3=a62_0x3b6427;validateProfileName(_0x504ad3);const _0x457038=getGlobalConfigPath(),_0x10c031=getConfigDir();!a62_0x174bda[_0x3e04d3(0xba)](_0x10c031)&&createSecureDirectory(_0x10c031);let _0x5f0e70={};if(a62_0x174bda[_0x3e04d3(0xba)](_0x457038))try{const _0x329bf8=a62_0x174bda[_0x3e04d3(0x8d)](_0x457038,_0x3e04d3(0xd8));_0x5f0e70=JSON[_0x3e04d3(0xc2)](_0x329bf8);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x457038+_0x3e04d3(0xa4));}!_0x5f0e70['profiles']&&(_0x5f0e70['profiles']={}),_0x5f0e70[_0x3e04d3(0xd2)][_0x504ad3]=_0x38b8a1,writeSecureFile(_0x457038,JSON[_0x3e04d3(0x89)](_0x5f0e70,null,0x2));}export function removeProfileFromUserConfig(_0x500c32){const _0x1ec8ba=a62_0x3b6427;validateProfileName(_0x500c32);const _0x5da283=getGlobalConfigPath();if(!a62_0x174bda[_0x1ec8ba(0xba)](_0x5da283))throw new Error(_0x1ec8ba(0x93)+_0x500c32+_0x1ec8ba(0xc8));let _0x154f8b={};try{const _0x29cec9=a62_0x174bda['readFileSync'](_0x5da283,'utf-8');_0x154f8b=JSON[_0x1ec8ba(0xc2)](_0x29cec9);}catch{throw new Error(_0x1ec8ba(0xdb)+_0x5da283);}if(!_0x154f8b['profiles']||!_0x154f8b[_0x1ec8ba(0xd2)][_0x500c32])throw new Error(_0x1ec8ba(0x93)+_0x500c32+_0x1ec8ba(0xc8));delete _0x154f8b[_0x1ec8ba(0xd2)][_0x500c32],_0x154f8b[_0x1ec8ba(0xc0)]===_0x500c32&&delete _0x154f8b[_0x1ec8ba(0xc0)],writeSecureFile(_0x5da283,JSON[_0x1ec8ba(0x89)](_0x154f8b,null,0x2));}function a62_0xdec3(){const _0xad89f8=['stringify','site','35MEdpJC','1236449yGNeja','readFileSync','Error:\x20','from','Invalid\x20profile\x20name:\x20','llm_project','llm_agent','Profile\x20\x27','4052979nvkMXS','local','3458750BLOrVL','.env.','message','string','includes','6642572LjWYTa','\x22\x20\x22','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','some','warn','\x0aWarning:\x20Failed\x20to\x20parse\x20','3781096MMrOdv','toISOString','set',',\x20creating\x20new\x20file',':\x20Invalid\x20JSON\x20syntax','tdx.json','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','Profile\x20','\x27\x20will\x20be\x20ignored','\x20\x201.\x20Edit:\x20','@tdx-studio','join','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','name','\x20does\x20not\x20exist','3sGkYvc','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','has','user_info','entries','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','map','Warning:\x20Profile\x20\x27','existsSync','30hxALHs','isDirectory','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','values','push','profile','Warning:\x20Failed\x20to\x20parse\x20','parse','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','find','.env','To\x20migrate:','\x27\x20not\x20found\x20in\x20user\x20configuration','description','815394SpRmzx','3286017rTmcBc','\x20already\x20exists','directory','rmSync','filter','length','parent_segment','profiles','INVALID_PROFILE_CONFIG','sort','user','\x27:\x20unknown\x20config\x20key\x20\x27','object','utf-8','\x20\x20mv\x20\x22','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','Failed\x20to\x20parse\x20','database','8mPxJqX'];a62_0xdec3=function(){return _0xad89f8;};return a62_0xdec3();}export function getActiveProfile(){const _0x5596fe=a62_0x3b6427,_0x59882f=loadSessionContext();if(_0x59882f?.['profile'])return _0x59882f[_0x5596fe(0xc0)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x3338b9=getGlobalConfigPath();if(!a62_0x174bda['existsSync'](_0x3338b9))return null;try{const _0x2b9157=a62_0x174bda[_0x5596fe(0x8d)](_0x3338b9,_0x5596fe(0xd8)),_0x14e61b=JSON[_0x5596fe(0xc2)](_0x2b9157);return _0x14e61b[_0x5596fe(0xc0)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x612f6a){const _0x3944b0=a62_0x3b6427,_0x2a66a5=getGlobalConfigPath(),_0x1c3535=getConfigDir();!a62_0x174bda['existsSync'](_0x1c3535)&&createSecureDirectory(_0x1c3535);let _0xa518a9={};if(a62_0x174bda[_0x3944b0(0xba)](_0x2a66a5))try{const _0x597536=a62_0x174bda[_0x3944b0(0x8d)](_0x2a66a5,'utf-8');_0xa518a9=JSON[_0x3944b0(0xc2)](_0x597536);}catch{console[_0x3944b0(0x9f)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x2a66a5+_0x3944b0(0xa4));}_0xa518a9['site']=_0x612f6a,writeSecureFile(_0x2a66a5,JSON[_0x3944b0(0x89)](_0xa518a9,null,0x2));}export function saveActiveProfileToUserConfig(_0x30c887){const _0x3f29e8=a62_0x3b6427;validateProfileName(_0x30c887);const _0x418a31=getGlobalConfigPath(),_0x249b8b=getConfigDir();!a62_0x174bda[_0x3f29e8(0xba)](_0x249b8b)&&createSecureDirectory(_0x249b8b);let _0x3d9b6b={};if(a62_0x174bda[_0x3f29e8(0xba)](_0x418a31))try{const _0x2e4d91=a62_0x174bda[_0x3f29e8(0x8d)](_0x418a31,_0x3f29e8(0xd8));_0x3d9b6b=JSON['parse'](_0x2e4d91);}catch{console[_0x3f29e8(0x9f)](_0x3f29e8(0xc1)+_0x418a31+_0x3f29e8(0xa4));}_0x3d9b6b['profile']=_0x30c887,writeSecureFile(_0x418a31,JSON[_0x3f29e8(0x89)](_0x3d9b6b,null,0x2));}function clearFieldFromUserConfig(_0x474080){const _0x14c9f1=a62_0x3b6427,_0x3663b5=getGlobalConfigPath();if(!a62_0x174bda['existsSync'](_0x3663b5))return;let _0x5bfe54={};try{const _0x583406=a62_0x174bda[_0x14c9f1(0x8d)](_0x3663b5,_0x14c9f1(0xd8));_0x5bfe54=JSON[_0x14c9f1(0xc2)](_0x583406);}catch{return;}delete _0x5bfe54[_0x474080],writeSecureFile(_0x3663b5,JSON['stringify'](_0x5bfe54,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x442e5a=a62_0x3b6427;clearFieldFromUserConfig(_0x442e5a(0x8a));}function a62_0x3fe6(_0x1317db,_0x868978){_0x1317db=_0x1317db-0x87;const _0xdec3b3=a62_0xdec3();let _0x3fe6c8=_0xdec3b3[_0x1317db];return _0x3fe6c8;}export function clearActiveProfileFromUserConfig(){const _0x2707f4=a62_0x3b6427;clearFieldFromUserConfig(_0x2707f4(0xc0));}export function createProfile(_0x365c98,_0x16df66){const _0x2b5d54=a62_0x3b6427;validateProfileName(_0x365c98);if(profileExists(_0x365c98))throw new Error('Profile\x20'+_0x365c98+_0x2b5d54(0xcc));saveProfile(_0x365c98,_0x16df66);}export function saveProfileCredentials(_0x18770b,_0x243be4){const _0x12960d=a62_0x3b6427;validateProfileName(_0x18770b);if(!profileExists(_0x18770b))throw new Error(_0x12960d(0xa8)+_0x18770b+_0x12960d(0xb1));const _0x44ba4f=getNewCredentialPath(_0x18770b);writeSecureFile(_0x44ba4f,_0x243be4);}export function loadProfileCredentials(_0x583886){const _0x959060=a62_0x3b6427;validateProfileName(_0x583886);const _0x4be6c0=getNewCredentialPath(_0x583886);if(a62_0x174bda[_0x959060(0xba)](_0x4be6c0))try{return a62_0x174bda[_0x959060(0x8d)](_0x4be6c0,_0x959060(0xd8));}catch{}const _0x2c650e=getOldCredentialPath(_0x583886);if(a62_0x174bda['existsSync'](_0x2c650e)){console['warn']('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x583886+'\x27'),console[_0x959060(0x9f)](_0x959060(0xc7)),console[_0x959060(0x9f)](_0x959060(0xd9)+_0x2c650e+_0x959060(0x9c)+_0x4be6c0+'\x22'),console[_0x959060(0x9f)](_0x959060(0xb3));try{return a62_0x174bda[_0x959060(0x8d)](_0x2c650e,_0x959060(0xd8));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a63_0xbbec3c=a63_0x4ec7;(function(_0x368a0e,_0x1fde2b){const _0x2f18ee=a63_0x4ec7,_0x3908d6=_0x368a0e();while(!![]){try{const _0x33d10f=-parseInt(_0x2f18ee(0x189))/0x1+-parseInt(_0x2f18ee(0x18e))/0x2*(-parseInt(_0x2f18ee(0x181))/0x3)+parseInt(_0x2f18ee(0x17e))/0x4*(parseInt(_0x2f18ee(0x18f))/0x5)+parseInt(_0x2f18ee(0x194))/0x6*(-parseInt(_0x2f18ee(0x199))/0x7)+parseInt(_0x2f18ee(0x19a))/0x8*(-parseInt(_0x2f18ee(0x184))/0x9)+-parseInt(_0x2f18ee(0x187))/0xa+parseInt(_0x2f18ee(0x19b))/0xb*(parseInt(_0x2f18ee(0x193))/0xc);if(_0x33d10f===_0x1fde2b)break;else _0x3908d6['push'](_0x3908d6['shift']());}catch(_0x31425d){_0x3908d6['push'](_0x3908d6['shift']());}}}(a63_0xbfde,0xa8208));import*as a63_0x39eba0 from'node:fs';import*as a63_0x18e9d0 from'node:path';const PROJECT_CONFIG_FILENAME=a63_0xbbec3c(0x18a);export function findProjectConfigPath(_0x2503ac){const _0x215132=a63_0xbbec3c;let _0x263fdb=_0x2503ac||process[_0x215132(0x196)]();while(!![]){const _0x1fdb91=a63_0x18e9d0[_0x215132(0x185)](_0x263fdb,PROJECT_CONFIG_FILENAME);if(a63_0x39eba0[_0x215132(0x182)](_0x1fdb91))return _0x1fdb91;const _0x24e81c=a63_0x18e9d0[_0x215132(0x191)](_0x263fdb);if(_0x24e81c===_0x263fdb)return null;_0x263fdb=_0x24e81c;}}function a63_0xbfde(){const _0xe3cd0d=['1101122ScIDSG','tdx.json','Failed\x20to\x20load\x20project\x20config\x20from\x20','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','parse','867778rJaDix','1361690weFWZF','ENOENT','dirname','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','31959324LImJHa','1523964WNtIVv','code','cwd','stringify','includes','7fhBNOJ','136kgDvDA','11reWwtn','apiKey','8kTgRWC','readFileSync','Warning:\x20\x27profile\x27\x20field\x20in\x20','3RiWItv','existsSync',').\x20','722862BQdRYx','join','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','2326720RnsxNp','writeFileSync'];a63_0xbfde=function(){return _0xe3cd0d;};return a63_0xbfde();}export function loadProjectConfig(_0x143f6f){const _0x5db841=a63_0xbbec3c,_0x21010c=findProjectConfigPath(_0x143f6f);if(!_0x21010c)return null;try{const _0x4298a7=a63_0x39eba0[_0x5db841(0x17f)](_0x21010c,'utf-8'),_0x1aa467=JSON[_0x5db841(0x18d)](_0x4298a7),_0x5a6c08=JSON[_0x5db841(0x197)](_0x1aa467);if(_0x5a6c08[_0x5db841(0x198)]('TD_API_KEY')||_0x5a6c08[_0x5db841(0x198)]('apiKey')||_0x5a6c08[_0x5db841(0x198)]('api_key'))throw new Error(_0x5db841(0x186)+_0x21010c+_0x5db841(0x183)+_0x5db841(0x18c));const {metadata:_0x3c486d,profile:_0x413a14,..._0x4045d1}=_0x1aa467;return _0x413a14&&console['warn'](_0x5db841(0x180)+_0x21010c+'\x20is\x20ignored.\x20'+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x4045d1;}catch(_0x1a7e25){if(_0x1a7e25 instanceof Error&&_0x5db841(0x195)in _0x1a7e25&&_0x1a7e25['code']===_0x5db841(0x190))return null;throw new Error(_0x5db841(0x18b)+_0x21010c+':\x20'+_0x1a7e25);}}function a63_0x4ec7(_0x4be06b,_0x1c7b60){_0x4be06b=_0x4be06b-0x17d;const _0xbfde58=a63_0xbfde();let _0x4ec74c=_0xbfde58[_0x4be06b];return _0x4ec74c;}export function saveProjectConfig(_0x26ad10,_0x41f8e3){const _0xa344db=a63_0xbbec3c,_0x29a690=_0x41f8e3||process[_0xa344db(0x196)](),_0x58dd3a=a63_0x18e9d0[_0xa344db(0x185)](_0x29a690,PROJECT_CONFIG_FILENAME),_0x83a3be=JSON['stringify'](_0x26ad10);if(_0x83a3be[_0xa344db(0x198)]('TD_API_KEY')||_0x83a3be['includes'](_0xa344db(0x17d))||_0x83a3be[_0xa344db(0x198)]('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if('profile'in _0x26ad10)throw new Error(_0xa344db(0x192));a63_0x39eba0[_0xa344db(0x188)](_0x58dd3a,JSON[_0xa344db(0x197)](_0x26ad10,null,0x2));}export function hasProjectConfig(_0x56e998){return findProjectConfigPath(_0x56e998)!==null;}export function getProjectRoot(_0x1536bb){const _0x1df522=a63_0xbbec3c,_0x5ca3ad=findProjectConfigPath(_0x1536bb);return _0x5ca3ad?a63_0x18e9d0[_0x1df522(0x191)](_0x5ca3ad):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1f8d5d,_0x55f22d){const _0x1485a9=a64_0x15fe,_0x2e92a1=_0x1f8d5d();while(!![]){try{const _0x5e4b9f=-parseInt(_0x1485a9(0x16c))/0x1*(-parseInt(_0x1485a9(0x160))/0x2)+-parseInt(_0x1485a9(0x174))/0x3*(-parseInt(_0x1485a9(0x178))/0x4)+-parseInt(_0x1485a9(0x16b))/0x5+-parseInt(_0x1485a9(0x172))/0x6*(parseInt(_0x1485a9(0x171))/0x7)+parseInt(_0x1485a9(0x179))/0x8*(parseInt(_0x1485a9(0x180))/0x9)+parseInt(_0x1485a9(0x186))/0xa*(parseInt(_0x1485a9(0x177))/0xb)+-parseInt(_0x1485a9(0x161))/0xc*(parseInt(_0x1485a9(0x166))/0xd);if(_0x5e4b9f===_0x55f22d)break;else _0x2e92a1['push'](_0x2e92a1['shift']());}catch(_0x15cfa8){_0x2e92a1['push'](_0x2e92a1['shift']());}}}(a64_0x1573,0xc44fa));import*as a64_0x49ae3a from'node:fs';import*as a64_0x40c9d4 from'node:path';import*as a64_0x2c0048 from'node:os';function a64_0x15fe(_0x144851,_0x14418d){_0x144851=_0x144851-0x15f;const _0x157325=a64_0x1573();let _0x15fecf=_0x157325[_0x144851];return _0x15fecf;}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 _0x54a776=a64_0x15fe,_0x44a71a=process.env.TDX_CONFIG_DIR||a64_0x40c9d4[_0x54a776(0x168)](a64_0x2c0048[_0x54a776(0x16f)](),'.config','tdx');return a64_0x40c9d4[_0x54a776(0x168)](_0x44a71a,_0x54a776(0x181));}function getSessionPath(_0x282b47){const _0x46ba5a=a64_0x15fe;return a64_0x40c9d4[_0x46ba5a(0x168)](getSessionsDir(),_0x282b47+'.json');}function a64_0x1573(){const _0x2d10e0=['.json','warn','1346njyEJO','313428WEKPBS','.\x20This\x20is\x20insecure.\x20Removing\x20session.','api_key','apiKey','TD_API_KEY','949tAYlfw','readdirSync','join','toISOString','replace','2319050jRHNWA','1415FllVGm','getTime','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','homedir','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','63zVWirZ','471276awXcOP','writeFileSync','2706nvVMdV','utf-8','now','790185DBeFLV','5636KGknht','6944824Viyorm','parse','test','includes','readFileSync','stringify','endsWith','9bjRXMi','sessions','unlinkSync','existsSync','sort','createdAt','110RFbAsQ','toString'];a64_0x1573=function(){return _0x2d10e0;};return a64_0x1573();}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x10863f){const _0x3cf2a6=a64_0x15fe;if(_0x10863f)return _0x10863f;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x3cf2a6(0x187)]();}export function loadSessionContext(_0x44685e){const _0x143e93=a64_0x15fe,_0x50fa41=getSessionID(_0x44685e),_0x342116=/^\d+$/[_0x143e93(0x17b)](_0x50fa41)?parseInt(_0x50fa41,0xa):null;return _0x342116!==null?loadSessionContextByPID(_0x342116):loadSessionContextByString(_0x50fa41);}export function loadSessionContextByPID(_0x4025fb){const _0x3c6e69=a64_0x15fe,_0x6cebbf=getSessionPath(_0x4025fb);if(!a64_0x49ae3a[_0x3c6e69(0x183)](_0x6cebbf))return null;try{const _0x4d7814=a64_0x49ae3a[_0x3c6e69(0x17d)](_0x6cebbf,'utf-8'),_0x459484=JSON[_0x3c6e69(0x17a)](_0x4d7814),_0x1dadd7=new Date(_0x459484['createdAt'])[_0x3c6e69(0x16d)](),_0x59e6ef=Date[_0x3c6e69(0x176)]();if(_0x59e6ef-_0x1dadd7>SESSION_EXPIRATION_MS)return a64_0x49ae3a['unlinkSync'](_0x6cebbf),null;const _0x46dfef=JSON['stringify'](_0x459484);if(_0x46dfef[_0x3c6e69(0x17c)](_0x3c6e69(0x165))||_0x46dfef[_0x3c6e69(0x17c)](_0x3c6e69(0x164))||_0x46dfef[_0x3c6e69(0x17c)](_0x3c6e69(0x163)))return console[_0x3c6e69(0x15f)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x6cebbf+_0x3c6e69(0x162)),a64_0x49ae3a[_0x3c6e69(0x182)](_0x6cebbf),null;return _0x459484;}catch{try{a64_0x49ae3a[_0x3c6e69(0x182)](_0x6cebbf);}catch{}return null;}}function loadSessionContextByString(_0x2e4c29){const _0x5570eb=a64_0x15fe,_0x545746=a64_0x40c9d4[_0x5570eb(0x168)](getSessionsDir(),_0x2e4c29+_0x5570eb(0x188));if(!a64_0x49ae3a['existsSync'](_0x545746))return null;try{const _0x4f83f3=a64_0x49ae3a[_0x5570eb(0x17d)](_0x545746,'utf-8'),_0x26f8d5=JSON['parse'](_0x4f83f3),_0x2381d5=new Date(_0x26f8d5[_0x5570eb(0x185)])['getTime'](),_0x49dd5c=Date[_0x5570eb(0x176)]();if(_0x49dd5c-_0x2381d5>SESSION_EXPIRATION_MS)return a64_0x49ae3a[_0x5570eb(0x182)](_0x545746),null;const _0x2c4a42=JSON[_0x5570eb(0x17e)](_0x26f8d5);if(_0x2c4a42[_0x5570eb(0x17c)](_0x5570eb(0x165))||_0x2c4a42[_0x5570eb(0x17c)](_0x5570eb(0x164))||_0x2c4a42[_0x5570eb(0x17c)](_0x5570eb(0x163)))return console['warn'](_0x5570eb(0x170)+_0x545746+_0x5570eb(0x162)),a64_0x49ae3a[_0x5570eb(0x182)](_0x545746),null;return _0x26f8d5;}catch{try{a64_0x49ae3a[_0x5570eb(0x182)](_0x545746);}catch{}return null;}}export function saveSessionContext(_0x9776e7,_0x5cbcad){const _0x414f4c=a64_0x15fe,_0x26a345=getSessionID(_0x5cbcad),_0x1492b3=/^\d+$/[_0x414f4c(0x17b)](_0x26a345)?parseInt(_0x26a345,0xa):getCurrentSessionPID(),_0x4dabff=a64_0x40c9d4['join'](getSessionsDir(),_0x26a345+_0x414f4c(0x188)),_0x4c9744=getSessionsDir();createSecureDirectory(_0x4c9744);const _0x44ab57=JSON[_0x414f4c(0x17e)](_0x9776e7);if(_0x44ab57['includes'](_0x414f4c(0x165))||_0x44ab57[_0x414f4c(0x17c)](_0x414f4c(0x164))||_0x44ab57[_0x414f4c(0x17c)](_0x414f4c(0x163)))throw new Error(_0x414f4c(0x16e));let _0x1c078a;const _0x3cbb3e=/^\d+$/[_0x414f4c(0x17b)](_0x26a345)?loadSessionContextByPID(parseInt(_0x26a345,0xa)):loadSessionContextByString(_0x26a345);_0x3cbb3e?_0x1c078a={..._0x3cbb3e,..._0x9776e7,'pid':_0x1492b3,'sessionId':_0x26a345!==_0x1492b3[_0x414f4c(0x187)]()?_0x26a345:undefined,'updatedAt':new Date()['toISOString']()}:_0x1c078a={'pid':_0x1492b3,'sessionId':_0x26a345!==_0x1492b3[_0x414f4c(0x187)]()?_0x26a345:undefined,..._0x9776e7,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x414f4c(0x169)]()},a64_0x49ae3a[_0x414f4c(0x173)](_0x4dabff,JSON['stringify'](_0x1c078a,null,0x2));}export function clearSessionContext(_0x9a98fe){const _0x3d6af4=a64_0x15fe,_0xd111e4=getSessionID(_0x9a98fe),_0x273d6c=a64_0x40c9d4[_0x3d6af4(0x168)](getSessionsDir(),_0xd111e4+_0x3d6af4(0x188));a64_0x49ae3a['existsSync'](_0x273d6c)&&a64_0x49ae3a[_0x3d6af4(0x182)](_0x273d6c);}export function clearSessionContextField(_0x332599,_0xbdcfcc){const _0x3fae9e=a64_0x15fe,_0x897d=getSessionID(_0xbdcfcc),_0x846575=a64_0x40c9d4[_0x3fae9e(0x168)](getSessionsDir(),_0x897d+_0x3fae9e(0x188));if(!a64_0x49ae3a[_0x3fae9e(0x183)](_0x846575))return;try{const _0x2e916b=a64_0x49ae3a[_0x3fae9e(0x17d)](_0x846575,_0x3fae9e(0x175)),_0x4f1d4f=JSON[_0x3fae9e(0x17a)](_0x2e916b);delete _0x4f1d4f[_0x332599],a64_0x49ae3a[_0x3fae9e(0x173)](_0x846575,JSON[_0x3fae9e(0x17e)](_0x4f1d4f,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x498e85=a64_0x15fe,_0x767df8=getSessionsDir();if(!a64_0x49ae3a[_0x498e85(0x183)](_0x767df8))return 0x0;let _0x598501=0x0;const _0x4c2d85=Date['now']();try{const _0x32417c=a64_0x49ae3a[_0x498e85(0x167)](_0x767df8);for(const _0x4e66ef of _0x32417c){if(!_0x4e66ef[_0x498e85(0x17f)]('.json'))continue;const _0x1616ac=a64_0x40c9d4[_0x498e85(0x168)](_0x767df8,_0x4e66ef),_0x3539af=_0x4e66ef[_0x498e85(0x16a)](_0x498e85(0x188),''),_0x206059=parseInt(_0x3539af,0xa),_0x48fc54=!isNaN(_0x206059);if(_0x48fc54){if(!isProcessRunning(_0x206059)){a64_0x49ae3a['unlinkSync'](_0x1616ac),_0x598501++;continue;}}try{const _0x545d0e=a64_0x49ae3a['readFileSync'](_0x1616ac,_0x498e85(0x175)),_0x2def7a=JSON[_0x498e85(0x17a)](_0x545d0e),_0x3bb83e=new Date(_0x2def7a[_0x498e85(0x185)])['getTime']();_0x4c2d85-_0x3bb83e>SESSION_EXPIRATION_MS&&(a64_0x49ae3a[_0x498e85(0x182)](_0x1616ac),_0x598501++);}catch{a64_0x49ae3a[_0x498e85(0x182)](_0x1616ac),_0x598501++;}}}catch{}return _0x598501;}export function listActiveSessions(){const _0x15aec1=a64_0x15fe,_0x48eb32=getSessionsDir();if(!a64_0x49ae3a[_0x15aec1(0x183)](_0x48eb32))return[];try{const _0x385c10=a64_0x49ae3a[_0x15aec1(0x167)](_0x48eb32),_0x4127f0=[];for(const _0xa6a559 of _0x385c10){if(!_0xa6a559['endsWith'](_0x15aec1(0x188)))continue;const _0xb9336d=_0xa6a559[_0x15aec1(0x16a)](_0x15aec1(0x188),''),_0x1f4015=parseInt(_0xb9336d,0xa);!isNaN(_0x1f4015)&&isProcessRunning(_0x1f4015)&&_0x4127f0['push'](_0x1f4015);}return _0x4127f0[_0x15aec1(0x184)]((_0x76b531,_0x30e065)=>_0x76b531-_0x30e065);}catch{return[];}}
|
package/dist/core/user-cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a65_0x1722(){const _0x7f2dc4=['8091016wQMkKb','9044895bruHYb','read','clear','users','write','136862YUcMaI','36XrYIRy','5057229dkgVrs','users-{profile}.json','2122332Jgdzsa','3365052gkuXSc','now','8799525wWGttM','7ObXKot'];a65_0x1722=function(){return _0x7f2dc4;};return a65_0x1722();}const a65_0x4fec01=a65_0x3446;(function(_0x2f2fb8,_0x5643e2){const _0x496a28=a65_0x3446,_0x15e207=_0x2f2fb8();while(!![]){try{const _0x19baf0=parseInt(_0x496a28(0x1a6))/0x1*(-parseInt(_0x496a28(0x1ad))/0x2)+parseInt(_0x496a28(0x1af))/0x3+-parseInt(_0x496a28(0x1b2))/0x4+-parseInt(_0x496a28(0x1a8))/0x5+-parseInt(_0x496a28(0x1b1))/0x6+-parseInt(_0x496a28(0x1a5))/0x7+parseInt(_0x496a28(0x1a7))/0x8*(parseInt(_0x496a28(0x1ae))/0x9);if(_0x19baf0===_0x5643e2)break;else _0x15e207['push'](_0x15e207['shift']());}catch(_0x538a9f){_0x15e207['push'](_0x15e207['shift']());}}}(a65_0x1722,0xf1fdb));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a65_0x4fec01(0x1b0),'core/user-cache');function a65_0x3446(_0x453eb7,_0xc3a4c6){_0x453eb7=_0x453eb7-0x1a5;const _0x1722e2=a65_0x1722();let _0x3446b5=_0x1722e2[_0x453eb7];return _0x3446b5;}export function loadCachedUsers(_0x3fc991){const _0x361e27=a65_0x4fec01,_0x1d50a4=userCache[_0x361e27(0x1a9)](_0x3fc991);return _0x1d50a4?.[_0x361e27(0x1ab)]??null;}export function saveCachedUsers(_0x256acc,_0x1be0f9){const _0x41e1dd=a65_0x4fec01;userCache[_0x41e1dd(0x1ac)](_0x256acc,{'users':_0x1be0f9,'cachedAt':Date[_0x41e1dd(0x1b3)]()});}export function clearUserCache(_0x4b484b){const _0x350f07=a65_0x4fec01;userCache[_0x350f07(0x1aa)](_0x4b484b);}
|
package/dist/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x249f40,_0x1dff6a){const _0x22ed48=a66_0x3a9b,_0x3c7161=_0x249f40();while(!![]){try{const _0x9c4af1=-parseInt(_0x22ed48(0x1c6))/0x1*(-parseInt(_0x22ed48(0x1d1))/0x2)+-parseInt(_0x22ed48(0x1ca))/0x3+-parseInt(_0x22ed48(0x1c3))/0x4*(-parseInt(_0x22ed48(0x1d5))/0x5)+parseInt(_0x22ed48(0x1cb))/0x6*(parseInt(_0x22ed48(0x1ce))/0x7)+-parseInt(_0x22ed48(0x1c4))/0x8*(parseInt(_0x22ed48(0x1c7))/0x9)+parseInt(_0x22ed48(0x1cf))/0xa+-parseInt(_0x22ed48(0x1c9))/0xb;if(_0x9c4af1===_0x1dff6a)break;else _0x3c7161['push'](_0x3c7161['shift']());}catch(_0x4395f0){_0x3c7161['push'](_0x3c7161['shift']());}}}(a66_0x2341,0x2be95));import{readFileSync}from'fs';function a66_0x3a9b(_0x457004,_0x38e56d){_0x457004=_0x457004-0x1c3;const _0x2341e8=a66_0x2341();let _0x3a9b26=_0x2341e8[_0x457004];return _0x3a9b26;}import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x36788b=a66_0x3a9b;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x2a667a=fileURLToPath(import.meta.url),_0x3a504d=dirname(_0x2a667a);try{const _0x121847=join(_0x3a504d,_0x36788b(0x1d4));cachedBuildInfo=JSON['parse'](readFileSync(_0x121847,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0xd63440=a66_0x3a9b;if(cachedVersion!==null)return cachedVersion;const _0x1de49e=fileURLToPath(import.meta.url),_0x416e69=dirname(_0x1de49e),_0x53656d=getBuildInfo();if(_0x53656d[_0xd63440(0x1cd)])return cachedVersion=_0x53656d[_0xd63440(0x1cd)],cachedVersion;try{const _0x380594=join(_0x416e69,_0xd63440(0x1c8)),_0x2bd40d=JSON[_0xd63440(0x1cc)](readFileSync(_0x380594,_0xd63440(0x1d0)));cachedVersion=_0x2bd40d['version'];}catch{cachedVersion=_0xd63440(0x1d3);}return cachedVersion;}export function isDevVersion(){const _0x48a1c2=a66_0x3a9b,_0x1d398d=getVersion();return _0x1d398d['includes'](_0x48a1c2(0x1d2))||_0x1d398d[_0x48a1c2(0x1c5)]('-');}function a66_0x2341(){const _0x18d412=['63MXJywW','../../package.json','3326125ixHzFA','819378dhvxic','1670982puJXbw','parse','version','7MOlAzR','1362200uRJsRK','utf-8','84826iFCdrU','.dev','0.0.0','../build-info.json','42885uIZAUM','92KPoEZq','30032jyXVsh','includes','4KankOd'];a66_0x2341=function(){return _0x18d412;};return a66_0x2341();}
|