@treasuredata/tdx 0.23.1 → 0.25.0
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.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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/chat-command.d.ts +14 -3
- package/dist/commands/chat-command.d.ts.map +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/chat-command.js.map +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/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/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/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/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/api.js +1 -1
- package/dist/sdk/client/cdp-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/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/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.d.ts.map +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/index.js.map +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.d.ts +4 -4
- package/dist/sdk/llm/model-factors.d.ts.map +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/llm/model-factors.js.map +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.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-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-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/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.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/llm.d.ts +1 -0
- package/dist/sdk/types/llm.d.ts.map +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/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/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/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/process.js.map +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a45_0x1a3b1c=a45_0x3a3f;(function(_0xe2d095,_0x4a0faa){const _0x518fc5=a45_0x3a3f,_0x24d086=_0xe2d095();while(!![]){try{const _0x64fc3e=parseInt(_0x518fc5(0x1e9))/0x1+-parseInt(_0x518fc5(0x1fa))/0x2+-parseInt(_0x518fc5(0x1c2))/0x3*(parseInt(_0x518fc5(0x1c8))/0x4)+parseInt(_0x518fc5(0x1bc))/0x5+parseInt(_0x518fc5(0x1fd))/0x6+-parseInt(_0x518fc5(0x1d2))/0x7+parseInt(_0x518fc5(0x1ea))/0x8;if(_0x64fc3e===_0x4a0faa)break;else _0x24d086['push'](_0x24d086['shift']());}catch(_0x27db30){_0x24d086['push'](_0x24d086['shift']());}}}(a45_0x4497,0xb83ff));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x1e2a0e from'node:fs';import*as a45_0x998cd8 from'node:path';function a45_0x3a3f(_0xbbf11a,_0x525baa){_0xbbf11a=_0xbbf11a-0x1b8;const _0x449700=a45_0x4497();let _0x3a3f9b=_0x449700[_0xbbf11a];return _0x3a3f9b;}import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x5f1974 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x45625c=a45_0x3a3f;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x45625c(0x1f6),_0x45625c(0x1c9));}export function getConfigFile(){const _0x5783cb=a45_0x3a3f;return join(getConfigDir(),_0x5783cb(0x1e1));}export function getConfigFilePath(_0x27737f){const _0x4a5266=a45_0x3a3f,_0x55c67d=getConfigDir();return _0x27737f?a45_0x998cd8[_0x4a5266(0x1dd)](_0x55c67d,_0x4a5266(0x1ec)+_0x27737f):getConfigFile();}function a45_0x4497(){const _0x2f67f7=['stg-jp01','map','keychain','config/llm-project','dev-eu01','endsWith','warn','.config','toISOString','name','\x20env\x20var','1204046dceoGu','path','read','3374100MONhtH','accountId','TD_API_KEY_','number','profile','280040RGnHjt','slice','apiKey','config/account-info','\x27,\x20defaulting\x20to\x20us01','Warning:\x20Unknown\x20site\x20\x27','355341vgvcYZ','proxy','string','TDX_API_KEY_','dev-us01','stg-ap03','28pzJSlp','tdx','TDX_API_KEY\x20env\x20var','utf-8','trim','readFileSync','split','keychain\x20(profile:\x20','.json','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','7539980wDvSZa','Warning:\x20Failed\x20to\x20read\x20','write','ap02','toUpperCase','jp01','some','config/llm-agent','eu01','match','startsWith','join','replace','parse','site','.env','account_info','existsSync','yellow','entries','ap03','tdx.json','stg-us01','650299CTWcMw','15954576PPGNLV','us01','.env.','llm_default_agent','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'];a45_0x4497=function(){return _0x2f67f7;};return a45_0x4497();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project',a45_0x1a3b1c(0x1f2));export function getLLMProjectCacheFile(_0x5dcae4){const _0x1b7db8=a45_0x1a3b1c;return llmProjectCache[_0x1b7db8(0x1fb)](_0x5dcae4);}export function readCachedLLMProject(_0x5080e4){const _0x134321=a45_0x1a3b1c,_0x54a89a=llmProjectCache['read'](_0x5080e4);if(_0x54a89a&&typeof _0x54a89a['id']==='string'&&typeof _0x54a89a[_0x134321(0x1f8)]===_0x134321(0x1c4))return _0x54a89a;return null;}export function writeCachedLLMProject(_0x5af097,_0x4281b7,_0x122a58){const _0x30e844=a45_0x1a3b1c;try{llmProjectCache[_0x30e844(0x1d4)]({'name':_0x5af097,'id':_0x4281b7},_0x122a58);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x1a3b1c(0x1ed),a45_0x1a3b1c(0x1d9));export function getLLMAgentCacheFile(_0x3b9b0b){return llmAgentCache['path'](_0x3b9b0b);}export function readCachedLLMAgent(_0x1e64d6){const _0x4dd14f=a45_0x1a3b1c,_0x819c2c=llmAgentCache['read'](_0x1e64d6);if(_0x819c2c&&typeof _0x819c2c['id']===_0x4dd14f(0x1c4)&&typeof _0x819c2c[_0x4dd14f(0x1f8)]===_0x4dd14f(0x1c4)&&typeof _0x819c2c['projectId']===_0x4dd14f(0x1c4))return _0x819c2c;return null;}export function writeCachedLLMAgent(_0x1c0db7,_0x3c5eb5,_0x43ac5a,_0x55d5ef){const _0x487c5c=a45_0x1a3b1c;try{llmAgentCache[_0x487c5c(0x1d4)]({'name':_0x1c0db7,'id':_0x3c5eb5,'projectId':_0x43ac5a},_0x55d5ef);}catch{}}export function clearCachedLLMAgent(_0x333040){try{llmAgentCache['clear'](_0x333040);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0x1a3b1c(0x1e2),a45_0x1a3b1c(0x1bf),{'suffix':a45_0x1a3b1c(0x1d0)});export function getAccountInfoCacheFile(_0x279358){return accountInfoCache['path'](_0x279358);}export function readCachedAccountInfo(_0xae6001){const _0x10df94=a45_0x1a3b1c,_0x2969a5=accountInfoCache[_0x10df94(0x1fc)](_0xae6001);if(_0x2969a5&&typeof _0x2969a5[_0x10df94(0x1e0)]==='string'&&typeof _0x2969a5[_0x10df94(0x1b8)]===_0x10df94(0x1ba))return _0x2969a5;return null;}export function writeCachedAccountInfo(_0xe7091d,_0x3c66b9,_0x37454e){const _0x276ac2=a45_0x1a3b1c;try{accountInfoCache[_0x276ac2(0x1d4)]({'site':_0xe7091d,'accountId':_0x3c66b9,'cachedAt':new Date()[_0x276ac2(0x1f7)]()},_0x37454e);}catch{}}export function parseEnvFile(_0x2465d0){const _0xaa044d=a45_0x1a3b1c,_0x3cd718={};for(const _0x15b4c3 of _0x2465d0[_0xaa044d(0x1ce)]('\x0a')){const _0x33401d=_0x15b4c3['trim']();if(!_0x33401d||_0x33401d[_0xaa044d(0x1dc)]('#'))continue;const _0x5b01fe=_0x33401d[_0xaa044d(0x1db)](/^([^=]+)=(.*)$/);if(_0x5b01fe){const _0x3f9ff8=_0x5b01fe[0x1][_0xaa044d(0x1cc)]();let _0x20cb2e=_0x5b01fe[0x2][_0xaa044d(0x1cc)]();(_0x20cb2e[_0xaa044d(0x1dc)]('\x22')&&_0x20cb2e[_0xaa044d(0x1f4)]('\x22')||_0x20cb2e['startsWith']('\x27')&&_0x20cb2e['endsWith']('\x27'))&&(_0x20cb2e=_0x20cb2e[_0xaa044d(0x1bd)](0x1,-0x1)),_0x3cd718[_0x3f9ff8]=_0x20cb2e;}}return _0x3cd718;}export function readUserConfig(){const _0x49eca8=a45_0x1a3b1c,_0x4a9bb9=getConfigFile();if(!existsSync(_0x4a9bb9))return{};try{const _0x452cdc=readFileSync(_0x4a9bb9,'utf-8');return parseEnvFile(_0x452cdc);}catch(_0x253a79){return console['warn'](_0x49eca8(0x1d1)+_0x4a9bb9+':',_0x253a79),{};}}export function resolveSite(_0x392583){const _0x124504=a45_0x1a3b1c,_0x5bf345=[_0x124504(0x1eb),_0x124504(0x1d7),_0x124504(0x1da),'ap02',_0x124504(0x1e6),_0x124504(0x1c6),'dev-eu01',_0x124504(0x1e8),_0x124504(0x1ef),_0x124504(0x1c7)];if(_0x5bf345['includes'](_0x392583))return _0x392583;if(_0x392583 in SITE_ALIASES)return SITE_ALIASES[_0x392583];return console[_0x124504(0x1f5)](_0x124504(0x1c1)+_0x392583+_0x124504(0x1c0)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x28491c){const _0x1a90dd=a45_0x1a3b1c,_0x191a1e=_0x28491c||getActiveProfileName();if(_0x191a1e){const _0x44218e=_0x1a90dd(0x1c5)+normalizeProfileForEnvVar(_0x191a1e);if(process.env[_0x44218e])return process.env[_0x44218e];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x4553d3){const _0x16f6cc=a45_0x1a3b1c;return _0x4553d3[_0x16f6cc(0x1d6)]()[_0x16f6cc(0x1de)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0xaa722a,_0x53b728){const _0x4dbb02=a45_0x1a3b1c,_0x5ee19d=_0x53b728||getActiveProfileName()||undefined;if(_0x5ee19d){const _0x5d9340=_0x4dbb02(0x1c5)+normalizeProfileForEnvVar(_0x5ee19d);if(process.env[_0x5d9340])return{'apiKey':process.env[_0x5d9340],'source':_0x5d9340+_0x4dbb02(0x1f9),'isDeprecated':![]};const _0x1fe04f=getCachedCredential(_0xaa722a,_0x5ee19d);if(_0x1fe04f)return{'apiKey':_0x1fe04f,'source':_0x4dbb02(0x1cf)+_0x5ee19d+')','isDeprecated':![]};const _0x2cca6f=await getKeychainAPIKey(_0x5ee19d);if(_0x2cca6f)return setCachedCredential(_0x2cca6f,_0xaa722a,_0x5ee19d),{'apiKey':_0x2cca6f,'source':'keychain\x20(profile:\x20'+_0x5ee19d+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x4dbb02(0x1ca),'isDeprecated':![]};if(!_0x5ee19d){const _0x2b7213=getCachedCredential(_0xaa722a,undefined);if(_0x2b7213)return{'apiKey':_0x2b7213,'source':_0x4dbb02(0x1f1),'isDeprecated':![]};const _0x23b5f5=await getKeychainAPIKey(undefined);if(_0x23b5f5)return setCachedCredential(_0x23b5f5,_0xaa722a,undefined),{'apiKey':_0x23b5f5,'source':_0x4dbb02(0x1f1),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x12753c,_0x3f1391){const _0x59637c=a45_0x1a3b1c,_0x3eaced=await resolveAPIKeyAsync(_0x12753c,_0x3f1391);return _0x3eaced?.[_0x59637c(0x1be)];}function cleanupLegacyEnvFile(_0x1014b7){const _0x55ad4b=a45_0x1a3b1c;if(!existsSync(_0x1014b7))return![];try{const _0x5e23ae=readFileSync(_0x1014b7,_0x55ad4b(0x1cb)),_0x1a2629=_0x5e23ae[_0x55ad4b(0x1ce)]('\x0a'),_0x1cb21d=_0x1a2629['filter'](_0x3a7104=>{const _0x1b7192=_0x55ad4b,_0x486c53=_0x3a7104[_0x1b7192(0x1cc)]();if(!_0x486c53||_0x486c53[_0x1b7192(0x1dc)]('#'))return!![];const [_0x5e4093]=_0x486c53[_0x1b7192(0x1ce)]('=');return!_0x5e4093[_0x1b7192(0x1dc)]('TD_API_KEY');}),_0x31fa72=_0x1cb21d[_0x55ad4b(0x1d8)](_0x2074e7=>{const _0x57b176=_0x55ad4b,_0x585c51=_0x2074e7[_0x57b176(0x1cc)]();return _0x585c51&&!_0x585c51['startsWith']('#');});if(!_0x31fa72)return unlinkSync(_0x1014b7),!![];return writeFileSync(_0x1014b7,_0x1cb21d[_0x55ad4b(0x1dd)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x37ad7a=a45_0x1a3b1c;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xe5fff0=a45_0x998cd8[_0x37ad7a(0x1dd)](getConfigDir(),_0x37ad7a(0x1e7));if(!a45_0x1e2a0e[_0x37ad7a(0x1e3)](_0xe5fff0))return null;try{const _0xe1792c=a45_0x1e2a0e[_0x37ad7a(0x1cd)](_0xe5fff0,_0x37ad7a(0x1cb)),_0xf901f7=JSON[_0x37ad7a(0x1df)](_0xe1792c);return _0xf901f7[_0x37ad7a(0x1bb)]||null;}catch{return null;}}export function saveAPIKey(_0x5f0758,_0x1a5ca5,_0x37d1c5){const _0x50a641=a45_0x1a3b1c,_0x3ccb6d=getConfigDir(),_0x424951=getConfigFilePath(_0x37d1c5);!existsSync(_0x3ccb6d)&&mkdirSync(_0x3ccb6d,{'recursive':!![],'mode':0x1c0});let _0x569ee5={};if(existsSync(_0x424951))try{const _0x252b28=readFileSync(_0x424951,'utf-8');_0x569ee5=parseEnvFile(_0x252b28);}catch(_0x20d68a){console['warn'](_0x50a641(0x1d3)+_0x424951+':',_0x20d68a);}const _0x1af953=_0x5f0758[_0x50a641(0x1d6)]()[_0x50a641(0x1de)](/-/g,'_');_0x569ee5[_0x50a641(0x1b9)+_0x1af953]=_0x1a5ca5;const _0x44f24d=Object[_0x50a641(0x1e5)](_0x569ee5)[_0x50a641(0x1f0)](([_0x3a013b,_0x35bee5])=>_0x3a013b+'='+_0x35bee5);writeFileSync(_0x424951,_0x44f24d[_0x50a641(0x1dd)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x504e86,_0x3a4c80,_0x18030e){const _0x28b445=a45_0x1a3b1c;await saveKeychainAPIKey(_0x504e86,_0x18030e),setCachedCredential(_0x504e86,_0x3a4c80,_0x18030e);const _0x252cee=getConfigFilePath(_0x18030e);cleanupLegacyEnvFile(_0x252cee)&&console[_0x28b445(0x1f5)](a45_0x5f1974[_0x28b445(0x1e4)](_0x28b445(0x1ee)));}export function loadConfig(){const _0x21a53e=a45_0x1a3b1c,_0x128c2c={'apiKeys':{},'defaultSite':_0x21a53e(0x1eb)},_0x5912d5=[_0x21a53e(0x1eb),_0x21a53e(0x1d7),'eu01',_0x21a53e(0x1d5),_0x21a53e(0x1e6),_0x21a53e(0x1c6),_0x21a53e(0x1f3),_0x21a53e(0x1e8),_0x21a53e(0x1ef),'stg-ap03'],_0x865e14=getAPIKey();if(_0x865e14)for(const _0x325bd3 of _0x5912d5){_0x128c2c['apiKeys'][_0x325bd3]=_0x865e14;}return _0x128c2c;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x2834a2=a45_0x1a3b1c,_0x2574dc=a45_0x998cd8[_0x2834a2(0x1dd)](getConfigDir(),_0x2834a2(0x1e7));if(!a45_0x1e2a0e['existsSync'](_0x2574dc))return undefined;try{const _0x1b7b13=a45_0x1e2a0e['readFileSync'](_0x2574dc,_0x2834a2(0x1cb)),_0x870181=JSON['parse'](_0x1b7b13);return typeof _0x870181[_0x2834a2(0x1c3)]==='string'?_0x870181[_0x2834a2(0x1c3)]:undefined;}catch{return undefined;}}
|
|
1
|
+
const a45_0x5c4f21=a45_0x2ca1;(function(_0xd7dd7b,_0x57fb5a){const _0xb0e0a1=a45_0x2ca1,_0x1ddaf6=_0xd7dd7b();while(!![]){try{const _0x43994d=-parseInt(_0xb0e0a1(0x202))/0x1+parseInt(_0xb0e0a1(0x1e7))/0x2+parseInt(_0xb0e0a1(0x1f7))/0x3*(-parseInt(_0xb0e0a1(0x1dd))/0x4)+parseInt(_0xb0e0a1(0x1e0))/0x5+parseInt(_0xb0e0a1(0x1ce))/0x6+-parseInt(_0xb0e0a1(0x1fe))/0x7+-parseInt(_0xb0e0a1(0x1ca))/0x8*(parseInt(_0xb0e0a1(0x1e4))/0x9);if(_0x43994d===_0x57fb5a)break;else _0x1ddaf6['push'](_0x1ddaf6['shift']());}catch(_0x4af039){_0x1ddaf6['push'](_0x1ddaf6['shift']());}}}(a45_0x15c4,0xf1458));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0xe102df from'node:fs';import*as a45_0x2d90b5 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 a45_0x3e6581 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){return process.env.TDX_CONFIG_DIR||join(homedir(),'.config','tdx');}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x1db334){const _0x4161a4=a45_0x2ca1,_0x57b165=getConfigDir();return _0x1db334?a45_0x2d90b5['join'](_0x57b165,_0x4161a4(0x1d6)+_0x1db334):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0x5c4f21(0x1d3),'config/llm-project');export function getLLMProjectCacheFile(_0x39e958){const _0x5c4a14=a45_0x5c4f21;return llmProjectCache[_0x5c4a14(0x1e1)](_0x39e958);}export function readCachedLLMProject(_0x2c0062){const _0x3b9410=a45_0x5c4f21,_0x36cb40=llmProjectCache['read'](_0x2c0062);if(_0x36cb40&&typeof _0x36cb40['id']==='string'&&typeof _0x36cb40[_0x3b9410(0x1ea)]===_0x3b9410(0x204))return _0x36cb40;return null;}export function writeCachedLLMProject(_0x5b64f5,_0x578888,_0x5399f2){try{llmProjectCache['write']({'name':_0x5b64f5,'id':_0x578888},_0x5399f2);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x5c4f21(0x1fa),'config/llm-agent');export function getLLMAgentCacheFile(_0x9ead08){const _0x23cc02=a45_0x5c4f21;return llmAgentCache[_0x23cc02(0x1e1)](_0x9ead08);}export function readCachedLLMAgent(_0x5b57e9){const _0x201ed1=a45_0x5c4f21,_0x147b2a=llmAgentCache[_0x201ed1(0x1c6)](_0x5b57e9);if(_0x147b2a&&typeof _0x147b2a['id']==='string'&&typeof _0x147b2a[_0x201ed1(0x1ea)]===_0x201ed1(0x204)&&typeof _0x147b2a['projectId']===_0x201ed1(0x204))return _0x147b2a;return null;}export function writeCachedLLMAgent(_0x25ecc6,_0x4d5f15,_0x419591,_0x2b3953){try{llmAgentCache['write']({'name':_0x25ecc6,'id':_0x4d5f15,'projectId':_0x419591},_0x2b3953);}catch{}}export function clearCachedLLMAgent(_0x6d230a){const _0x3f67ed=a45_0x5c4f21;try{llmAgentCache[_0x3f67ed(0x205)](_0x6d230a);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0x5c4f21(0x1cd),a45_0x5c4f21(0x1d7),{'suffix':'.json'});export function getAccountInfoCacheFile(_0x14cd54){const _0x24114a=a45_0x5c4f21;return accountInfoCache[_0x24114a(0x1e1)](_0x14cd54);}export function readCachedAccountInfo(_0x1676f9){const _0x246997=a45_0x5c4f21,_0x567ccf=accountInfoCache[_0x246997(0x1c6)](_0x1676f9);if(_0x567ccf&&typeof _0x567ccf[_0x246997(0x1f5)]==='string'&&typeof _0x567ccf['accountId']===_0x246997(0x1f8))return _0x567ccf;return null;}export function writeCachedAccountInfo(_0x33d7e6,_0x3dbcf7,_0x45f720){const _0x1d1b9=a45_0x5c4f21;try{accountInfoCache[_0x1d1b9(0x1dc)]({'site':_0x33d7e6,'accountId':_0x3dbcf7,'cachedAt':new Date()[_0x1d1b9(0x1d2)]()},_0x45f720);}catch{}}export function parseEnvFile(_0x399e2e){const _0x4dbcec=a45_0x5c4f21,_0x344577={};for(const _0x37ad52 of _0x399e2e[_0x4dbcec(0x1fc)]('\x0a')){const _0x3811b2=_0x37ad52[_0x4dbcec(0x1f9)]();if(!_0x3811b2||_0x3811b2[_0x4dbcec(0x1c5)]('#'))continue;const _0x6b5289=_0x3811b2[_0x4dbcec(0x201)](/^([^=]+)=(.*)$/);if(_0x6b5289){const _0x1ae2b7=_0x6b5289[0x1][_0x4dbcec(0x1f9)]();let _0x2c6a4b=_0x6b5289[0x2][_0x4dbcec(0x1f9)]();(_0x2c6a4b[_0x4dbcec(0x1c5)]('\x22')&&_0x2c6a4b[_0x4dbcec(0x1e3)]('\x22')||_0x2c6a4b[_0x4dbcec(0x1c5)]('\x27')&&_0x2c6a4b[_0x4dbcec(0x1e3)]('\x27'))&&(_0x2c6a4b=_0x2c6a4b[_0x4dbcec(0x1de)](0x1,-0x1)),_0x344577[_0x1ae2b7]=_0x2c6a4b;}}return _0x344577;}export function readUserConfig(){const _0xd328ec=a45_0x5c4f21,_0x4529a6=getConfigFile();if(!existsSync(_0x4529a6))return{};try{const _0x433b73=readFileSync(_0x4529a6,_0xd328ec(0x1cb));return parseEnvFile(_0x433b73);}catch(_0xd8f37d){return console['warn'](_0xd328ec(0x1df)+_0x4529a6+':',_0xd8f37d),{};}}export function resolveSite(_0x52e897){const _0x2a8422=a45_0x5c4f21,_0x6c8b43=[_0x2a8422(0x1f4),_0x2a8422(0x1da),'eu01',_0x2a8422(0x1db),_0x2a8422(0x1e8),'dev-us01',_0x2a8422(0x1fb),_0x2a8422(0x1ef),_0x2a8422(0x1cc),_0x2a8422(0x1c4)];if(_0x6c8b43[_0x2a8422(0x1d1)](_0x52e897))return _0x52e897;if(_0x52e897 in SITE_ALIASES)return SITE_ALIASES[_0x52e897];return console[_0x2a8422(0x1e2)](_0x2a8422(0x1d8)+_0x52e897+_0x2a8422(0x1f3)),_0x2a8422(0x1f4);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x450b0b){const _0x386e0c=_0x450b0b||getActiveProfileName();if(_0x386e0c){const _0x2c5749='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x386e0c);if(process.env[_0x2c5749])return process.env[_0x2c5749];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}function a45_0x2ca1(_0x25fda6,_0x357f7a){_0x25fda6=_0x25fda6-0x1c4;const _0x15c4a6=a45_0x15c4();let _0x2ca12e=_0x15c4a6[_0x25fda6];return _0x2ca12e;}export function normalizeProfileForEnvVar(_0x93d8f8){const _0x25894a=a45_0x5c4f21;return _0x93d8f8[_0x25894a(0x200)]()[_0x25894a(0x203)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x2317aa,_0x5b4dfe){const _0x50701c=a45_0x5c4f21,_0x38433e=_0x5b4dfe||getActiveProfileName()||undefined;if(_0x38433e){const _0x86369f=_0x50701c(0x1d5)+normalizeProfileForEnvVar(_0x38433e);if(process.env[_0x86369f])return{'apiKey':process.env[_0x86369f],'source':_0x86369f+_0x50701c(0x1d9),'isDeprecated':![]};const _0x2464a8=getCachedCredential(_0x2317aa,_0x38433e);if(_0x2464a8)return{'apiKey':_0x2464a8,'source':'keychain\x20(profile:\x20'+_0x38433e+')','isDeprecated':![]};const _0x220ec9=await getKeychainAPIKey(_0x38433e);if(_0x220ec9)return setCachedCredential(_0x220ec9,_0x2317aa,_0x38433e),{'apiKey':_0x220ec9,'source':_0x50701c(0x1cf)+_0x38433e+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x50701c(0x1d0),'isDeprecated':![]};if(!_0x38433e){const _0x1b83fe=getCachedCredential(_0x2317aa,undefined);if(_0x1b83fe)return{'apiKey':_0x1b83fe,'source':_0x50701c(0x1fd),'isDeprecated':![]};const _0x2675d8=await getKeychainAPIKey(undefined);if(_0x2675d8)return setCachedCredential(_0x2675d8,_0x2317aa,undefined),{'apiKey':_0x2675d8,'source':'keychain','isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x2ae1f8,_0x4e92fe){const _0x1e459f=a45_0x5c4f21,_0x40623d=await resolveAPIKeyAsync(_0x2ae1f8,_0x4e92fe);return _0x40623d?.[_0x1e459f(0x1e6)];}function cleanupLegacyEnvFile(_0x17149e){const _0x541c15=a45_0x5c4f21;if(!existsSync(_0x17149e))return![];try{const _0x46b15a=readFileSync(_0x17149e,_0x541c15(0x1cb)),_0x255602=_0x46b15a['split']('\x0a'),_0x16cba3=_0x255602['filter'](_0x46f4a3=>{const _0x5ea1e0=_0x541c15,_0x5ba527=_0x46f4a3['trim']();if(!_0x5ba527||_0x5ba527[_0x5ea1e0(0x1c5)]('#'))return!![];const [_0x3f4bb7]=_0x5ba527['split']('=');return!_0x3f4bb7[_0x5ea1e0(0x1c5)](_0x5ea1e0(0x1e5));}),_0x1629f2=_0x16cba3[_0x541c15(0x1ed)](_0x44c5a9=>{const _0x7e5e7e=_0x541c15,_0x159d2a=_0x44c5a9['trim']();return _0x159d2a&&!_0x159d2a[_0x7e5e7e(0x1c5)]('#');});if(!_0x1629f2)return unlinkSync(_0x17149e),!![];return writeFileSync(_0x17149e,_0x16cba3[_0x541c15(0x1c7)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x5e16b9=a45_0x5c4f21;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x571b05=a45_0x2d90b5[_0x5e16b9(0x1c7)](getConfigDir(),_0x5e16b9(0x1d4));if(!a45_0xe102df['existsSync'](_0x571b05))return null;try{const _0x396133=a45_0xe102df[_0x5e16b9(0x1f6)](_0x571b05,_0x5e16b9(0x1cb)),_0x19fede=JSON[_0x5e16b9(0x1f2)](_0x396133);return _0x19fede['profile']||null;}catch{return null;}}export function saveAPIKey(_0x543349,_0x44afef,_0x41f7e1){const _0x14ae9c=a45_0x5c4f21,_0x2911cf=getConfigDir(),_0x57497b=getConfigFilePath(_0x41f7e1);!existsSync(_0x2911cf)&&mkdirSync(_0x2911cf,{'recursive':!![],'mode':0x1c0});let _0x106f29={};if(existsSync(_0x57497b))try{const _0x17b38f=readFileSync(_0x57497b,_0x14ae9c(0x1cb));_0x106f29=parseEnvFile(_0x17b38f);}catch(_0x1f882d){console[_0x14ae9c(0x1e2)](_0x14ae9c(0x1e9)+_0x57497b+':',_0x1f882d);}const _0x1cb099=_0x543349[_0x14ae9c(0x200)]()[_0x14ae9c(0x203)](/-/g,'_');_0x106f29[_0x14ae9c(0x1f0)+_0x1cb099]=_0x44afef;const _0x483623=Object[_0x14ae9c(0x1ff)](_0x106f29)[_0x14ae9c(0x1ec)](([_0x2b9a39,_0x158d68])=>_0x2b9a39+'='+_0x158d68);writeFileSync(_0x57497b,_0x483623['join']('\x0a')+'\x0a',{'mode':0x180});}function a45_0x15c4(){const _0xaa00c3=['stg-jp01','account_info','10457844yLVDnL','keychain\x20(profile:\x20','TDX_API_KEY\x20env\x20var','includes','toISOString','llm_default_project','tdx.json','TDX_API_KEY_','.env.','config/account-info','Warning:\x20Unknown\x20site\x20\x27','\x20env\x20var','jp01','ap02','write','28qkKgyO','slice','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','5890005ospUwS','path','warn','endsWith','127026PWbOZH','TD_API_KEY','apiKey','2529886GUmUat','ap03','Warning:\x20Failed\x20to\x20read\x20','name','proxy','map','some','yellow','stg-us01','TD_API_KEY_','dev-us01','parse','\x27,\x20defaulting\x20to\x20us01','us01','site','readFileSync','572307vaOqaE','number','trim','llm_default_agent','dev-eu01','split','keychain','1340458mkUuQP','entries','toUpperCase','match','725155wBgVqn','replace','string','clear','stg-ap03','startsWith','read','join','eu01','apiKeys','536TfoMjM','utf-8'];a45_0x15c4=function(){return _0xaa00c3;};return a45_0x15c4();}export async function saveAPIKeyAsync(_0x559b75,_0x365698,_0x27eb7e){const _0x516eec=a45_0x5c4f21;await saveKeychainAPIKey(_0x559b75,_0x27eb7e),setCachedCredential(_0x559b75,_0x365698,_0x27eb7e);const _0x476da0=getConfigFilePath(_0x27eb7e);cleanupLegacyEnvFile(_0x476da0)&&console[_0x516eec(0x1e2)](a45_0x3e6581[_0x516eec(0x1ee)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x3e74aa=a45_0x5c4f21,_0x3cc16f={'apiKeys':{},'defaultSite':_0x3e74aa(0x1f4)},_0x51cd63=[_0x3e74aa(0x1f4),_0x3e74aa(0x1da),_0x3e74aa(0x1c8),_0x3e74aa(0x1db),_0x3e74aa(0x1e8),_0x3e74aa(0x1f1),_0x3e74aa(0x1fb),_0x3e74aa(0x1ef),_0x3e74aa(0x1cc),_0x3e74aa(0x1c4)],_0x2d16fc=getAPIKey();if(_0x2d16fc)for(const _0x4456fd of _0x51cd63){_0x3cc16f[_0x3e74aa(0x1c9)][_0x4456fd]=_0x2d16fc;}return _0x3cc16f;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0xe824f0=a45_0x5c4f21,_0x4ca478=a45_0x2d90b5[_0xe824f0(0x1c7)](getConfigDir(),_0xe824f0(0x1d4));if(!a45_0xe102df['existsSync'](_0x4ca478))return undefined;try{const _0x2a7bd7=a45_0xe102df[_0xe824f0(0x1f6)](_0x4ca478,'utf-8'),_0x56f00f=JSON[_0xe824f0(0x1f2)](_0x2a7bd7);return typeof _0x56f00f[_0xe824f0(0x1eb)]==='string'?_0x56f00f[_0xe824f0(0x1eb)]:undefined;}catch{return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a46_0x410990=a46_0x3b6b;(function(_0x3a878d,_0x2926a8){const _0x4b2c8f=a46_0x3b6b,_0x315190=_0x3a878d();while(!![]){try{const _0x201ae9=-parseInt(_0x4b2c8f(0xf6))/0x1*(-parseInt(_0x4b2c8f(0xfc))/0x2)+-parseInt(_0x4b2c8f(0xfb))/0x3+-parseInt(_0x4b2c8f(0xf2))/0x4+-parseInt(_0x4b2c8f(0xf0))/0x5*(parseInt(_0x4b2c8f(0xef))/0x6)+-parseInt(_0x4b2c8f(0xfa))/0x7*(parseInt(_0x4b2c8f(0xf3))/0x8)+parseInt(_0x4b2c8f(0xf8))/0x9+-parseInt(_0x4b2c8f(0xee))/0xa*(-parseInt(_0x4b2c8f(0xf9))/0xb);if(_0x201ae9===_0x2926a8)break;else _0x315190['push'](_0x315190['shift']());}catch(_0x539ef4){_0x315190['push'](_0x315190['shift']());}}}(a46_0x5247,0x2c9e6));function a46_0x5247(){const _0x3577bf=['read','1DMVmPi','core/connection-cache','3275343DSnCHJ','43406jzTJXV','219408kGjyLs','527775vJhNTG','339526TsHzys','clear','connections-{profile}.json','590fkOGSM','66OmPXmf','109780OjEXyA','connections','289092OfQBxi','24Vmbgte','write'];a46_0x5247=function(){return _0x3577bf;};return a46_0x5247();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a46_0x410990(0xed),a46_0x410990(0xf7));function a46_0x3b6b(_0x3cfaef,_0xebab53){_0x3cfaef=_0x3cfaef-0xed;const _0x524781=a46_0x5247();let _0x3b6bef=_0x524781[_0x3cfaef];return _0x3b6bef;}export function loadCachedConnections(_0x1200f8){const _0x2bca7b=a46_0x410990,_0x4f15d0=connectionCache[_0x2bca7b(0xf5)](_0x1200f8);return _0x4f15d0?.[_0x2bca7b(0xf1)]??null;}export function saveCachedConnections(_0x49b5bb,_0x4227d3){const _0x45831b=a46_0x410990;connectionCache[_0x45831b(0xf4)](_0x49b5bb,{'connections':_0x4227d3,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x1ad476){const _0xe69ee6=a46_0x410990;connectionCache[_0xe69ee6(0xfd)](_0x1ad476);}
|
package/dist/core/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a47_0x44521c=a47_0x235d;(function(_0x3dcdfc,_0x192a2a){const _0x32e0a4=a47_0x235d,_0x28e2c6=_0x3dcdfc();while(!![]){try{const _0x4467b0=parseInt(_0x32e0a4(0xc2))/0x1+parseInt(_0x32e0a4(0xcc))/0x2+-parseInt(_0x32e0a4(0xc9))/0x3*(parseInt(_0x32e0a4(0xc6))/0x4)+-parseInt(_0x32e0a4(0xbd))/0x5+-parseInt(_0x32e0a4(0xcd))/0x6+parseInt(_0x32e0a4(0xc5))/0x7+-parseInt(_0x32e0a4(0xc7))/0x8;if(_0x4467b0===_0x192a2a)break;else _0x28e2c6['push'](_0x28e2c6['shift']());}catch(_0x2be7d5){_0x28e2c6['push'](_0x28e2c6['shift']());}}}(a47_0x2eca,0x7e441));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x19e637,_0x3cc748){const _0x305d9e=a47_0x235d;if(_0x19e637===undefined)return _0x3cc748;if(typeof _0x19e637===_0x305d9e(0xc3))return _0x19e637;return parseInt(_0x19e637,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a47_0x44521c(0xc8),'value':a47_0x44521c(0xbf)},{'title':a47_0x44521c(0xce),'value':a47_0x44521c(0xc0)},{'title':'eu\x20\x20\x20-\x20Europe','value':a47_0x44521c(0xc1)},{'title':'ap02\x20-\x20Korea','value':a47_0x44521c(0xbb)}];function a47_0x2eca(){const _0x550c89=['898081EBbnSa','number','length','4085158xFISTq','261292KcQSfc','5868440fRwvMn','us\x20\x20\x20-\x20United\x20States','3RAHsno','other','value','252326ADRiwg','1645614YHmbJF','jp\x20\x20\x20-\x20Japan','findIndex','ap02','Enter\x20custom\x20site','87530ewECiP','push','us01','jp01','eu01'];a47_0x2eca=function(){return _0x550c89;};return a47_0x2eca();}function a47_0x235d(_0x43ca1d,_0x3a4465){_0x43ca1d=_0x43ca1d-0xbb;const _0x2eca94=a47_0x2eca();let _0x235d15=_0x2eca94[_0x43ca1d];return _0x235d15;}export function buildSiteChoices(_0x37465b){const _0x3355c7=a47_0x44521c,_0x273f25=[...STANDARD_SITE_CHOICES];let _0xbbd17e=_0x273f25[_0x3355c7(0xcf)](_0x157342=>_0x157342[_0x3355c7(0xcb)]===_0x37465b);return _0xbbd17e===-0x1&&_0x37465b!=='us01'&&(_0x273f25['push']({'title':_0x37465b,'value':_0x37465b}),_0xbbd17e=_0x273f25[_0x3355c7(0xc4)]-0x1),_0x273f25[_0x3355c7(0xbe)]({'title':_0x3355c7(0xbc),'value':_0x3355c7(0xca)}),{'choices':_0x273f25,'initialIndex':_0xbbd17e>=0x0?_0xbbd17e:0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x20f261,_0x217b52){const _0x574857=a48_0x3398,_0x265afb=_0x20f261();while(!![]){try{const _0x1b7200=-parseInt(_0x574857(0x152))/0x1*(parseInt(_0x574857(0x15d))/0x2)+-parseInt(_0x574857(0x154))/0x3+parseInt(_0x574857(0x155))/0x4+parseInt(_0x574857(0x15e))/0x5+-parseInt(_0x574857(0x15c))/0x6*(-parseInt(_0x574857(0x15f))/0x7)+-parseInt(_0x574857(0x156))/0x8*(parseInt(_0x574857(0x153))/0x9)+-parseInt(_0x574857(0x158))/0xa;if(_0x1b7200===_0x217b52)break;else _0x265afb['push'](_0x265afb['shift']());}catch(_0x23e3ec){_0x265afb['push'](_0x265afb['shift']());}}}(a48_0x4c3d,0x721db));function a48_0x3398(_0x572b5c,_0x413270){_0x572b5c=_0x572b5c-0x152;const _0x4c3d97=a48_0x4c3d();let _0x3398f1=_0x4c3d97[_0x572b5c];return _0x3398f1;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5ebc04,_0x5c29bf){const _0x368c25=_0x5ebc04||'__default_site__',_0x28a77a=_0x5c29bf||'__default_profile__';return _0x368c25+':'+_0x28a77a;}export function getCachedCredential(_0xf6d775,_0x5850d4){const _0x3fc9c9=a48_0x3398,_0x16376b=getCacheKey(_0xf6d775,_0x5850d4),_0x2b2f7e=cache[_0x3fc9c9(0x157)](_0x16376b);if(!_0x2b2f7e)return null;if(Date[_0x3fc9c9(0x15a)]()-_0x2b2f7e['loadedAt']>CACHE_TTL_MS)return cache[_0x3fc9c9(0x15b)](_0x16376b),null;return _0x2b2f7e['apiKey'];}export function setCachedCredential(_0x3e5113,_0x4f5843,_0x293b83){const _0x1f875c=a48_0x3398,_0x4c6867=getCacheKey(_0x4f5843,_0x293b83);cache[_0x1f875c(0x159)](_0x4c6867,{'apiKey':_0x3e5113,'loadedAt':Date[_0x1f875c(0x15a)]()});}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x2b67d5,_0x46b310){const _0x5f40d0=a48_0x3398,_0x521189=getCacheKey(_0x2b67d5,_0x46b310);cache[_0x5f40d0(0x15b)](_0x521189);}function a48_0x4c3d(){const _0x5f1b88=['14qkAiSM','422346GDOYZd','9cffpmw','49323CFeTLo','2941304hKrltC','1616808OaKHfW','get','3977380KIQjCU','set','now','delete','1157766JXJQIE','2uroZdW','1923985KnNgDc'];a48_0x4c3d=function(){return _0x5f1b88;};return a48_0x4c3d();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a49_0x3b2200=a49_0x29c4;function a49_0x29c4(_0x5c453e,_0x52e0b5){_0x5c453e=_0x5c453e-0x163;const _0x2a74ce=a49_0x2a74();let _0x29c4f1=_0x2a74ce[_0x5c453e];return _0x29c4f1;}(function(_0x43a6f7,_0x487ffc){const _0x3b333b=a49_0x29c4,_0x5533c3=_0x43a6f7();while(!![]){try{const _0x405b88=-parseInt(_0x3b333b(0x175))/0x1+parseInt(_0x3b333b(0x187))/0x2+-parseInt(_0x3b333b(0x174))/0x3+parseInt(_0x3b333b(0x1a2))/0x4+-parseInt(_0x3b333b(0x166))/0x5*(-parseInt(_0x3b333b(0x194))/0x6)+parseInt(_0x3b333b(0x17e))/0x7*(parseInt(_0x3b333b(0x183))/0x8)+-parseInt(_0x3b333b(0x17d))/0x9;if(_0x405b88===_0x487ffc)break;else _0x5533c3['push'](_0x5533c3['shift']());}catch(_0x4de179){_0x5533c3['push'](_0x5533c3['shift']());}}}(a49_0x2a74,0x78d22));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getSessionID}from'./session.js';function a49_0x2a74(){const _0x499123=['llmProject','dim','Profile\x20Credentials','replace','utf-8','default','296736XrtINo','env','us01','join','layers','(using\x20session:\x20','(session:\x20','[configuration\x20files]','loadGlobalConfig','workflowProject','database','sessionId','parent_segment','30jgKWFb','proxy','display','readFileSync','green','Global\x20Credentials','Profile','getSource','getParameters','tdx.json','configFiles','[context]','profile:\x20','apiKey','488886ctoUMX','376552okCoir','activeProfile','global','existsSync','logLevel','llm_agent','Project','sessions','7134138sHHXUc','35xGHdrf','cliFlags','injectIntoOptions','llmAgent','none','1018552uzIKKF','Session','segmentPath','profile','680014kQVHFH','assign','segment_path','site','bold','config','parentSegment','cyan','resolveAPIKeyAsync','session','workflow_project','log','project','776292gbwaBB','llm_project','profileSource','Global','CLI\x20flag:\x20--','parse','not\x20set','verbose'];a49_0x2a74=function(){return _0x499123;};return a49_0x2a74();}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a49_0x30c22d from'node:fs';import*as a49_0xb97e91 from'node:path';import a49_0x4733de from'chalk';export class GlobalContext{[a49_0x3b2200(0x18a)];['database'];['parent_segment'];['segment_path'];[a49_0x3b2200(0x195)];[a49_0x3b2200(0x17a)];[a49_0x3b2200(0x191)];[a49_0x3b2200(0x173)];['proxy'];[a49_0x3b2200(0x19b)];[a49_0x3b2200(0x179)];[a49_0x3b2200(0x186)];['profileSource']=null;[a49_0x3b2200(0x1a6)];[a49_0x3b2200(0x176)];[a49_0x3b2200(0x164)];[a49_0x3b2200(0x170)];constructor(_0x2f8148){const _0x2269a7=a49_0x3b2200;this['sessionId']=getSessionID(_0x2f8148[_0x2269a7(0x190)]);const _0x292e70=loadSessionContext(_0x2f8148[_0x2269a7(0x190)]),_0xbee0ce=loadProjectConfig(),_0x271866=this[_0x2269a7(0x1aa)]();if(_0x2f8148['profile'])this[_0x2269a7(0x176)]=_0x2f8148['profile'],this['profileSource']='cli';else{if(_0x292e70?.[_0x2269a7(0x186)])this[_0x2269a7(0x176)]=_0x292e70[_0x2269a7(0x186)],this[_0x2269a7(0x196)]=_0x2269a7(0x190);else{if(_0x271866['profile'])this[_0x2269a7(0x176)]=_0x271866[_0x2269a7(0x186)],this['profileSource']=_0x2269a7(0x18c);else process.env.TDX_PROFILE?(this[_0x2269a7(0x176)]=process.env.TDX_PROFILE,this[_0x2269a7(0x196)]=_0x2269a7(0x1a3)):(this[_0x2269a7(0x176)]=null,this[_0x2269a7(0x196)]=null);}}const _0x3b306c=this[_0x2269a7(0x176)]?loadProfile(this[_0x2269a7(0x176)]):null,_0x383479=_0x56d92d=>{if(!_0x56d92d)return{};const _0x26fa4e=_0x56d92d,_0x2c6ca0={};for(const [_0x134a48,_0x196faa]of Object['entries'](_0x26fa4e)){typeof _0x196faa==='string'&&(_0x2c6ca0[_0x134a48]=_0x196faa);}return _0x2c6ca0;},_0x165847={},_0x12ae58=(_0x41329d,_0x225742,_0xf72062)=>{const _0x1331aa=_0x2269a7;if(!_0x41329d)return![];if(_0xf72062&&_0x41329d===_0xf72062)return![];const _0x22af50=_0x292e70,_0xef8643=_0xbee0ce,_0x9bfd1e=_0x3b306c?.[_0x1331aa(0x18c)],_0x44c355=_0x271866,_0x20270a=_0x22af50?.[_0x225742],_0x3a2120=_0xef8643?.[_0x225742],_0x3ac480=_0x9bfd1e?.[_0x225742],_0xe70f26=_0x44c355[_0x225742];return _0x41329d!==_0x20270a&&_0x41329d!==_0x3a2120&&_0x41329d!==_0x3ac480&&_0x41329d!==_0xe70f26;},_0x4f2660=[{'optionKey':_0x2269a7(0x18a),'contextKey':_0x2269a7(0x18a),'defaultValue':_0x2269a7(0x1a4)},{'optionKey':_0x2269a7(0x163),'contextKey':_0x2269a7(0x163)},{'optionKey':_0x2269a7(0x18d),'contextKey':'parent_segment'},{'optionKey':_0x2269a7(0x19c),'contextKey':_0x2269a7(0x195)},{'optionKey':_0x2269a7(0x181),'contextKey':_0x2269a7(0x17a)},{'optionKey':_0x2269a7(0x186),'contextKey':'profile'}];for(const {optionKey:_0x2df0ed,contextKey:_0x58f8f4,defaultValue:_0x21c4bf}of _0x4f2660){const _0x4b33a5=_0x2f8148[_0x2df0ed];_0x12ae58(_0x4b33a5,_0x58f8f4,_0x21c4bf)&&(_0x165847[_0x58f8f4]=_0x4b33a5);}this['layers']={'cliFlags':_0x165847,'session':_0x383479(_0x292e70),'project':_0x383479(_0xbee0ce),'profile':_0x383479(_0x3b306c?.[_0x2269a7(0x18c)]),'global':_0x383479(_0x271866)};const _0x50b0ad={...this['layers'][_0x2269a7(0x177)],...this[_0x2269a7(0x1a6)][_0x2269a7(0x186)],...this[_0x2269a7(0x1a6)][_0x2269a7(0x193)]};process.env.TDX_SITE&&!this[_0x2269a7(0x1a6)][_0x2269a7(0x190)]['site']&&!this['layers'][_0x2269a7(0x17f)][_0x2269a7(0x18a)]&&(_0x50b0ad[_0x2269a7(0x18a)]=process.env.TDX_SITE);Object[_0x2269a7(0x188)](_0x50b0ad,this[_0x2269a7(0x1a6)][_0x2269a7(0x190)]),Object['assign'](_0x50b0ad,this[_0x2269a7(0x1a6)]['cliFlags']);const _0x51a0b8=_0x50b0ad[_0x2269a7(0x18a)]||_0x2269a7(0x1a4);this[_0x2269a7(0x18a)]=resolveSite(_0x51a0b8),this[_0x2269a7(0x163)]=_0x50b0ad[_0x2269a7(0x163)],this[_0x2269a7(0x165)]=_0x50b0ad[_0x2269a7(0x165)],this[_0x2269a7(0x189)]=_0x50b0ad[_0x2269a7(0x189)],this[_0x2269a7(0x195)]=_0x50b0ad[_0x2269a7(0x195)],this[_0x2269a7(0x17a)]=_0x50b0ad[_0x2269a7(0x17a)],this[_0x2269a7(0x191)]=_0x50b0ad['workflow_project'],this['verbose']=_0x2f8148[_0x2269a7(0x19b)]||![],this[_0x2269a7(0x179)]=_0x2f8148[_0x2269a7(0x179)]??LogLevel['INFO'],this['profile']=this[_0x2269a7(0x176)]||undefined,this[_0x2269a7(0x173)]=getAPIKey(this['activeProfile']||undefined);const _0x3f0466=typeof _0x271866[_0x2269a7(0x167)]==='string'?_0x271866[_0x2269a7(0x167)]:undefined;this[_0x2269a7(0x167)]=_0x3f0466||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x318e3a=getConfigDir(),_0x104498=a49_0xb97e91[_0x2269a7(0x1a5)](_0x318e3a,_0x2269a7(0x17c),this[_0x2269a7(0x164)]+'.json'),_0x5f10e1=findProjectConfigPath(),_0x12b623=a49_0xb97e91[_0x2269a7(0x1a5)](_0x318e3a,_0x2269a7(0x16f)),_0x4bfbc9=a49_0xb97e91[_0x2269a7(0x1a5)](_0x318e3a,'.env');let _0x2e1a26=null,_0xb7dc46=null;this[_0x2269a7(0x176)]&&(_0x2e1a26=a49_0xb97e91['join'](_0x318e3a,'profiles',this[_0x2269a7(0x176)],'tdx.json'),_0xb7dc46=a49_0xb97e91[_0x2269a7(0x1a5)](_0x318e3a,'profiles',this[_0x2269a7(0x176)],'.env')),this[_0x2269a7(0x170)]={'session':a49_0x30c22d[_0x2269a7(0x178)](_0x104498)?_0x104498:null,'project':_0x5f10e1,'profile':_0x2e1a26&&a49_0x30c22d[_0x2269a7(0x178)](_0x2e1a26)?_0x2e1a26:null,'profileCredentials':_0xb7dc46&&a49_0x30c22d['existsSync'](_0xb7dc46)?_0xb7dc46:null,'global':a49_0x30c22d['existsSync'](_0x12b623)?_0x12b623:null,'globalCredentials':a49_0x30c22d[_0x2269a7(0x178)](_0x4bfbc9)?_0x4bfbc9:null};}['getSource'](_0x4d661d,_0x3eeb9c){const _0x589a79=a49_0x3b2200;if(!_0x3eeb9c)return _0x589a79(0x19a);const _0x42fb78=_0x3eeb9c;if(this[_0x589a79(0x1a6)][_0x589a79(0x17f)][_0x4d661d]===_0x42fb78){if(_0x4d661d==='site'&&_0x42fb78===_0x589a79(0x1a4)&&!this[_0x589a79(0x1a6)][_0x589a79(0x190)]['site']&&!this[_0x589a79(0x1a6)]['project'][_0x589a79(0x18a)]&&!this[_0x589a79(0x1a6)][_0x589a79(0x186)][_0x589a79(0x18a)]&&!this[_0x589a79(0x1a6)][_0x589a79(0x177)][_0x589a79(0x18a)])return _0x589a79(0x1a1);return _0x589a79(0x198)+_0x4d661d[_0x589a79(0x19f)](/_/g,'-');}if(this[_0x589a79(0x1a6)][_0x589a79(0x190)][_0x4d661d]===_0x42fb78)return _0x589a79(0x190);if(this[_0x589a79(0x1a6)][_0x589a79(0x193)][_0x4d661d]===_0x42fb78)return'project';if(this[_0x589a79(0x1a6)][_0x589a79(0x186)][_0x4d661d]===_0x42fb78)return _0x589a79(0x172)+this[_0x589a79(0x176)];if(this[_0x589a79(0x1a6)]['global'][_0x4d661d]===_0x42fb78)return'global';return'default';}[a49_0x3b2200(0x1aa)](){const _0x127d5d=a49_0x3b2200,_0x121bc4=a49_0xb97e91[_0x127d5d(0x1a5)](getConfigDir(),_0x127d5d(0x16f));if(!a49_0x30c22d[_0x127d5d(0x178)](_0x121bc4))return{};try{const _0x2a3b6d=a49_0x30c22d[_0x127d5d(0x169)](_0x121bc4,_0x127d5d(0x1a0));return JSON[_0x127d5d(0x199)](_0x2a3b6d);}catch{return{};}}[a49_0x3b2200(0x180)](_0x309566){const _0x760f63=a49_0x3b2200;_0x309566[_0x760f63(0x18a)]=this[_0x760f63(0x18a)],!_0x309566[_0x760f63(0x163)]&&this['database']&&(_0x309566[_0x760f63(0x163)]=this[_0x760f63(0x163)]),!_0x309566[_0x760f63(0x18d)]&&this['parent_segment']&&(_0x309566[_0x760f63(0x18d)]=this[_0x760f63(0x165)]),!_0x309566['segmentPath']&&this['segment_path']&&(_0x309566[_0x760f63(0x185)]=this[_0x760f63(0x189)]),!_0x309566[_0x760f63(0x19c)]&&this[_0x760f63(0x195)]&&(_0x309566['llmProject']=this[_0x760f63(0x195)]),!_0x309566[_0x760f63(0x181)]&&this[_0x760f63(0x17a)]&&(_0x309566[_0x760f63(0x181)]=this[_0x760f63(0x17a)]),!_0x309566[_0x760f63(0x1ab)]&&this['workflow_project']&&(_0x309566['workflowProject']=this['workflow_project']);}[a49_0x3b2200(0x16e)](){const _0x51834d=a49_0x3b2200;return[{'key':_0x51834d(0x18a),'value':this[_0x51834d(0x18a)]},{'key':'database','value':this[_0x51834d(0x163)]},{'key':_0x51834d(0x165),'value':this[_0x51834d(0x165)]},{'key':_0x51834d(0x189),'value':this[_0x51834d(0x189)]},{'key':_0x51834d(0x195),'value':this[_0x51834d(0x195)]},{'key':_0x51834d(0x17a),'value':this[_0x51834d(0x17a)]},{'key':'workflow_project','value':this[_0x51834d(0x191)]},{'key':'profile','value':this[_0x51834d(0x176)]||undefined}];}[a49_0x3b2200(0x168)](){const _0xed0f1c=a49_0x3b2200;console[_0xed0f1c(0x192)](a49_0x4733de[_0xed0f1c(0x18b)](_0xed0f1c(0x171)));for(const {key:_0xf0fdf5,value:_0x383e25}of this[_0xed0f1c(0x16e)]()){_0x383e25&&console[_0xed0f1c(0x192)](a49_0x4733de['cyan'](_0xf0fdf5)+':\x20'+_0x383e25);}}['displayWithSources'](){const _0x4c8ace=a49_0x3b2200;console[_0x4c8ace(0x192)](a49_0x4733de[_0x4c8ace(0x18b)]('[context]'));for(const {key:_0x342b55,value:_0x1ca336}of this[_0x4c8ace(0x16e)]()){if(_0x1ca336){const _0x478b59=_0x342b55===_0x4c8ace(0x186)?'(active)':'('+this[_0x4c8ace(0x16d)](_0x342b55,_0x1ca336)+')';console[_0x4c8ace(0x192)](a49_0x4733de['cyan'](_0x342b55)+':\x20'+_0x1ca336+'\x20'+a49_0x4733de[_0x4c8ace(0x19d)](_0x478b59));}}console[_0x4c8ace(0x192)]('\x0a'+a49_0x4733de[_0x4c8ace(0x18b)](_0x4c8ace(0x1a9)));const _0x1e5d9b=[{'label':_0x4c8ace(0x184),'path':this['configFiles'][_0x4c8ace(0x190)],'extra':_0x4c8ace(0x1a8)+this[_0x4c8ace(0x164)]+')'},{'label':_0x4c8ace(0x17b),'path':this['configFiles'][_0x4c8ace(0x193)]},{'label':_0x4c8ace(0x16c),'path':this[_0x4c8ace(0x170)][_0x4c8ace(0x186)]},{'label':_0x4c8ace(0x19e),'path':this[_0x4c8ace(0x170)]['profileCredentials']},{'label':_0x4c8ace(0x197),'path':this[_0x4c8ace(0x170)]['global']},{'label':_0x4c8ace(0x16b),'path':this['configFiles']['globalCredentials']}];for(const {label:_0x4107a4,path:_0x462a66,extra:_0x541774}of _0x1e5d9b){if(_0x462a66)console[_0x4c8ace(0x192)](a49_0x4733de[_0x4c8ace(0x18e)](_0x4107a4)+':\x20'+_0x462a66+'\x20'+a49_0x4733de[_0x4c8ace(0x16a)]('✓')+(_0x541774?'\x20'+a49_0x4733de[_0x4c8ace(0x19d)](_0x541774):''));else{if(_0x4107a4==='Session')console[_0x4c8ace(0x192)](a49_0x4733de['cyan'](_0x4107a4)+':\x20'+a49_0x4733de[_0x4c8ace(0x19d)](_0x4c8ace(0x182))+'\x20'+a49_0x4733de['dim'](_0x4c8ace(0x1a7)+this[_0x4c8ace(0x164)]+')'));else(_0x4107a4===_0x4c8ace(0x17b)||_0x4107a4===_0x4c8ace(0x197))&&console[_0x4c8ace(0x192)](a49_0x4733de[_0x4c8ace(0x18e)](_0x4107a4)+':\x20'+a49_0x4733de[_0x4c8ace(0x19d)](_0x4c8ace(0x182)));}}}async[a49_0x3b2200(0x18f)](){const _0x46f5e2=a49_0x3b2200;return this['apiKey']=await getAPIKeyAsync(this[_0x46f5e2(0x18a)],this['activeProfile']||undefined),this[_0x46f5e2(0x173)];}static async['createAsync'](_0x336f57){const _0x3d88ec=a49_0x3b2200,_0x2cb42d=new GlobalContext(_0x336f57);return await _0x2cb42d[_0x3d88ec(0x18f)](),_0x2cb42d;}}
|
|
1
|
+
const a49_0x590df6=a49_0x252e;(function(_0x14ba9e,_0x820803){const _0x296c46=a49_0x252e,_0x3d13c6=_0x14ba9e();while(!![]){try{const _0x3ba2f9=-parseInt(_0x296c46(0x17f))/0x1*(-parseInt(_0x296c46(0x173))/0x2)+-parseInt(_0x296c46(0x19b))/0x3*(-parseInt(_0x296c46(0x1a0))/0x4)+parseInt(_0x296c46(0x18b))/0x5+-parseInt(_0x296c46(0x15a))/0x6*(-parseInt(_0x296c46(0x171))/0x7)+parseInt(_0x296c46(0x187))/0x8+parseInt(_0x296c46(0x16d))/0x9*(-parseInt(_0x296c46(0x157))/0xa)+-parseInt(_0x296c46(0x17a))/0xb;if(_0x3ba2f9===_0x820803)break;else _0x3d13c6['push'](_0x3d13c6['shift']());}catch(_0x5ce9c9){_0x3d13c6['push'](_0x3d13c6['shift']());}}}(a49_0x4b22,0xc96cc));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.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 a49_0x5aba86 from'node:fs';function a49_0x4b22(){const _0x596440=['log','[context]','createAsync','4LUEaYY','join','parent_segment','(session:\x20','us01','apiKey','70PKfdZn','Profile\x20Credentials','getSource','1807530ogUxvt','workflowProject','INFO','.json','default','sessionId','llmProject','Session','global','(using\x20session:\x20','segment_path','workflow_project','dim','layers','verbose','cliFlags','loadGlobalConfig','cli','project','894429epAmjt','segmentPath','llm_project','green','14TdblyF','utf-8','124AIRQxt','display','none','injectIntoOptions','.env','assign','parse','34869186cqCMJD','llm_agent','session','Project','logLevel','16204eXdBPz','profile','tdx.json','profileSource','llmAgent','Profile','existsSync','bold','3552144SSiLLP','proxy','cyan','not\x20set','5885150ZTvkGe','activeProfile','Global','parentSegment','getParameters','(active)','env','sessions','configFiles','string','site','profile:\x20','displayWithSources','readFileSync','database','replace','4387269JEyqyr','resolveAPIKeyAsync'];a49_0x4b22=function(){return _0x596440;};return a49_0x4b22();}import*as a49_0x27e80c from'node:path';function a49_0x252e(_0x35b2fc,_0x1e2825){_0x35b2fc=_0x35b2fc-0x156;const _0x4b22d4=a49_0x4b22();let _0x252e0a=_0x4b22d4[_0x35b2fc];return _0x252e0a;}import a49_0x24764c from'chalk';export class GlobalContext{[a49_0x590df6(0x195)];[a49_0x590df6(0x199)];[a49_0x590df6(0x1a2)];[a49_0x590df6(0x164)];[a49_0x590df6(0x16f)];['llm_agent'];[a49_0x590df6(0x165)];[a49_0x590df6(0x156)];[a49_0x590df6(0x188)];[a49_0x590df6(0x168)];[a49_0x590df6(0x17e)];[a49_0x590df6(0x180)];[a49_0x590df6(0x182)]=null;[a49_0x590df6(0x167)];['activeProfile'];[a49_0x590df6(0x15f)];['configFiles'];constructor(_0x5c47e9){const _0x748415=a49_0x590df6;this['sessionId']=getSessionID(_0x5c47e9[_0x748415(0x17c)]);const _0xb6f52b=loadSessionContext(_0x5c47e9[_0x748415(0x17c)]),_0x3a02c5=loadProjectConfig(),_0x559601=this[_0x748415(0x16a)]();if(_0x5c47e9[_0x748415(0x180)])this[_0x748415(0x18c)]=_0x5c47e9[_0x748415(0x180)],this['profileSource']=_0x748415(0x16b);else{if(_0xb6f52b?.['profile'])this[_0x748415(0x18c)]=_0xb6f52b[_0x748415(0x180)],this[_0x748415(0x182)]=_0x748415(0x17c);else{if(_0x559601[_0x748415(0x180)])this[_0x748415(0x18c)]=_0x559601['profile'],this[_0x748415(0x182)]='config';else process.env.TDX_PROFILE?(this[_0x748415(0x18c)]=process.env.TDX_PROFILE,this['profileSource']=_0x748415(0x191)):(this['activeProfile']=null,this[_0x748415(0x182)]=null);}}const _0x4fa71c=this[_0x748415(0x18c)]?loadProfile(this[_0x748415(0x18c)]):null,_0x59da4f=_0x3d16b1=>{if(!_0x3d16b1)return{};const _0x2f860e=_0x3d16b1,_0x24c91d={};for(const [_0x50b73a,_0x4bb987]of Object['entries'](_0x2f860e)){typeof _0x4bb987==='string'&&(_0x24c91d[_0x50b73a]=_0x4bb987);}return _0x24c91d;},_0x40f7ac={},_0x1db243=(_0x31a6d4,_0x9f4a64,_0xcb4151)=>{if(!_0x31a6d4)return![];if(_0xcb4151&&_0x31a6d4===_0xcb4151)return![];const _0x2f5022=_0xb6f52b,_0x122c45=_0x3a02c5,_0x3718d5=_0x4fa71c?.['config'],_0x378494=_0x559601,_0x1df451=_0x2f5022?.[_0x9f4a64],_0x138665=_0x122c45?.[_0x9f4a64],_0x5ba3be=_0x3718d5?.[_0x9f4a64],_0x4bea92=_0x378494[_0x9f4a64];return _0x31a6d4!==_0x1df451&&_0x31a6d4!==_0x138665&&_0x31a6d4!==_0x5ba3be&&_0x31a6d4!==_0x4bea92;},_0x172af7=[{'optionKey':_0x748415(0x195),'contextKey':_0x748415(0x195),'defaultValue':_0x748415(0x1a4)},{'optionKey':_0x748415(0x199),'contextKey':_0x748415(0x199)},{'optionKey':'parentSegment','contextKey':_0x748415(0x1a2)},{'optionKey':_0x748415(0x160),'contextKey':_0x748415(0x16f)},{'optionKey':_0x748415(0x183),'contextKey':_0x748415(0x17b)},{'optionKey':_0x748415(0x180),'contextKey':_0x748415(0x180)}];for(const {optionKey:_0x4acdcb,contextKey:_0x4bb36a,defaultValue:_0x4f1ea1}of _0x172af7){const _0xf6d967=_0x5c47e9[_0x4acdcb];_0x1db243(_0xf6d967,_0x4bb36a,_0x4f1ea1)&&(_0x40f7ac[_0x4bb36a]=_0xf6d967);}this[_0x748415(0x167)]={'cliFlags':_0x40f7ac,'session':_0x59da4f(_0xb6f52b),'project':_0x59da4f(_0x3a02c5),'profile':_0x59da4f(_0x4fa71c?.['config']),'global':_0x59da4f(_0x559601)};const _0x242b02={...this[_0x748415(0x167)]['global'],...this['layers'][_0x748415(0x180)],...this[_0x748415(0x167)][_0x748415(0x16c)]};process.env.TDX_SITE&&!this['layers'][_0x748415(0x17c)][_0x748415(0x195)]&&!this[_0x748415(0x167)][_0x748415(0x169)]['site']&&(_0x242b02['site']=process.env.TDX_SITE);Object[_0x748415(0x178)](_0x242b02,this[_0x748415(0x167)][_0x748415(0x17c)]),Object[_0x748415(0x178)](_0x242b02,this['layers']['cliFlags']);const _0x2baac2=_0x242b02['site']||_0x748415(0x1a4);this[_0x748415(0x195)]=resolveSite(_0x2baac2),this[_0x748415(0x199)]=_0x242b02[_0x748415(0x199)],this[_0x748415(0x1a2)]=_0x242b02[_0x748415(0x1a2)],this[_0x748415(0x164)]=_0x242b02[_0x748415(0x164)],this[_0x748415(0x16f)]=_0x242b02['llm_project'],this[_0x748415(0x17b)]=_0x242b02[_0x748415(0x17b)],this['workflow_project']=_0x242b02['workflow_project'],this[_0x748415(0x168)]=_0x5c47e9[_0x748415(0x168)]||![],this[_0x748415(0x17e)]=_0x5c47e9[_0x748415(0x17e)]??LogLevel[_0x748415(0x15c)],this[_0x748415(0x180)]=this[_0x748415(0x18c)]||undefined,this[_0x748415(0x156)]=getAPIKey(this[_0x748415(0x18c)]||undefined);const _0x29bd15=typeof _0x559601[_0x748415(0x188)]===_0x748415(0x194)?_0x559601[_0x748415(0x188)]:undefined;this[_0x748415(0x188)]=_0x29bd15||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x4381fa=getConfigDir(),_0x53ac9e=a49_0x27e80c[_0x748415(0x1a1)](_0x4381fa,_0x748415(0x192),this[_0x748415(0x15f)]+_0x748415(0x15d)),_0x5eca50=findProjectConfigPath(),_0x4fdaf9=a49_0x27e80c[_0x748415(0x1a1)](_0x4381fa,'tdx.json'),_0x2eb3a8=a49_0x27e80c[_0x748415(0x1a1)](_0x4381fa,_0x748415(0x177));let _0x19a680=null,_0x8b1a28=null;this[_0x748415(0x18c)]&&(_0x19a680=a49_0x27e80c['join'](_0x4381fa,'profiles',this['activeProfile'],_0x748415(0x181)),_0x8b1a28=a49_0x27e80c[_0x748415(0x1a1)](_0x4381fa,'profiles',this[_0x748415(0x18c)],'.env')),this[_0x748415(0x193)]={'session':a49_0x5aba86[_0x748415(0x185)](_0x53ac9e)?_0x53ac9e:null,'project':_0x5eca50,'profile':_0x19a680&&a49_0x5aba86['existsSync'](_0x19a680)?_0x19a680:null,'profileCredentials':_0x8b1a28&&a49_0x5aba86[_0x748415(0x185)](_0x8b1a28)?_0x8b1a28:null,'global':a49_0x5aba86['existsSync'](_0x4fdaf9)?_0x4fdaf9:null,'globalCredentials':a49_0x5aba86[_0x748415(0x185)](_0x2eb3a8)?_0x2eb3a8:null};}['getSource'](_0x3389ac,_0x29d0f2){const _0x1545ed=a49_0x590df6;if(!_0x29d0f2)return _0x1545ed(0x18a);const _0x1f9d4c=_0x29d0f2;if(this['layers'][_0x1545ed(0x169)][_0x3389ac]===_0x1f9d4c){if(_0x3389ac===_0x1545ed(0x195)&&_0x1f9d4c===_0x1545ed(0x1a4)&&!this['layers'][_0x1545ed(0x17c)][_0x1545ed(0x195)]&&!this[_0x1545ed(0x167)][_0x1545ed(0x16c)][_0x1545ed(0x195)]&&!this['layers'][_0x1545ed(0x180)]['site']&&!this[_0x1545ed(0x167)][_0x1545ed(0x162)][_0x1545ed(0x195)])return _0x1545ed(0x15e);return'CLI\x20flag:\x20--'+_0x3389ac[_0x1545ed(0x19a)](/_/g,'-');}if(this[_0x1545ed(0x167)]['session'][_0x3389ac]===_0x1f9d4c)return _0x1545ed(0x17c);if(this['layers'][_0x1545ed(0x16c)][_0x3389ac]===_0x1f9d4c)return _0x1545ed(0x16c);if(this['layers'][_0x1545ed(0x180)][_0x3389ac]===_0x1f9d4c)return _0x1545ed(0x196)+this['activeProfile'];if(this[_0x1545ed(0x167)][_0x1545ed(0x162)][_0x3389ac]===_0x1f9d4c)return _0x1545ed(0x162);return _0x1545ed(0x15e);}[a49_0x590df6(0x16a)](){const _0x1ef9ef=a49_0x590df6,_0x2c775d=a49_0x27e80c[_0x1ef9ef(0x1a1)](getConfigDir(),_0x1ef9ef(0x181));if(!a49_0x5aba86[_0x1ef9ef(0x185)](_0x2c775d))return{};try{const _0x4d2c1=a49_0x5aba86[_0x1ef9ef(0x198)](_0x2c775d,_0x1ef9ef(0x172));return JSON[_0x1ef9ef(0x179)](_0x4d2c1);}catch{return{};}}[a49_0x590df6(0x176)](_0x18107b){const _0x316ca5=a49_0x590df6;_0x18107b[_0x316ca5(0x195)]=this[_0x316ca5(0x195)],!_0x18107b[_0x316ca5(0x199)]&&this[_0x316ca5(0x199)]&&(_0x18107b['database']=this['database']),!_0x18107b[_0x316ca5(0x18e)]&&this[_0x316ca5(0x1a2)]&&(_0x18107b[_0x316ca5(0x18e)]=this[_0x316ca5(0x1a2)]),!_0x18107b[_0x316ca5(0x16e)]&&this[_0x316ca5(0x164)]&&(_0x18107b['segmentPath']=this[_0x316ca5(0x164)]),!_0x18107b[_0x316ca5(0x160)]&&this[_0x316ca5(0x16f)]&&(_0x18107b[_0x316ca5(0x160)]=this[_0x316ca5(0x16f)]),!_0x18107b[_0x316ca5(0x183)]&&this[_0x316ca5(0x17b)]&&(_0x18107b[_0x316ca5(0x183)]=this[_0x316ca5(0x17b)]),!_0x18107b[_0x316ca5(0x15b)]&&this[_0x316ca5(0x165)]&&(_0x18107b[_0x316ca5(0x15b)]=this[_0x316ca5(0x165)]);}[a49_0x590df6(0x18f)](){const _0x3c9cd4=a49_0x590df6;return[{'key':_0x3c9cd4(0x195),'value':this[_0x3c9cd4(0x195)]},{'key':_0x3c9cd4(0x199),'value':this[_0x3c9cd4(0x199)]},{'key':'parent_segment','value':this[_0x3c9cd4(0x1a2)]},{'key':'segment_path','value':this['segment_path']},{'key':_0x3c9cd4(0x16f),'value':this[_0x3c9cd4(0x16f)]},{'key':_0x3c9cd4(0x17b),'value':this['llm_agent']},{'key':'workflow_project','value':this['workflow_project']},{'key':_0x3c9cd4(0x180),'value':this[_0x3c9cd4(0x18c)]||undefined}];}[a49_0x590df6(0x174)](){const _0x4f1899=a49_0x590df6;console[_0x4f1899(0x19d)](a49_0x24764c['bold'](_0x4f1899(0x19e)));for(const {key:_0x1113cc,value:_0x1a892b}of this[_0x4f1899(0x18f)]()){_0x1a892b&&console[_0x4f1899(0x19d)](a49_0x24764c['cyan'](_0x1113cc)+':\x20'+_0x1a892b);}}[a49_0x590df6(0x197)](){const _0x53ec28=a49_0x590df6;console[_0x53ec28(0x19d)](a49_0x24764c[_0x53ec28(0x186)]('[context]'));for(const {key:_0x47abb3,value:_0x4b23af}of this['getParameters']()){if(_0x4b23af){const _0xfdd47b=_0x47abb3===_0x53ec28(0x180)?_0x53ec28(0x190):'('+this[_0x53ec28(0x159)](_0x47abb3,_0x4b23af)+')';console[_0x53ec28(0x19d)](a49_0x24764c['cyan'](_0x47abb3)+':\x20'+_0x4b23af+'\x20'+a49_0x24764c['dim'](_0xfdd47b));}}console['log']('\x0a'+a49_0x24764c[_0x53ec28(0x186)]('[configuration\x20files]'));const _0x269e5f=[{'label':_0x53ec28(0x161),'path':this['configFiles'][_0x53ec28(0x17c)],'extra':_0x53ec28(0x1a3)+this[_0x53ec28(0x15f)]+')'},{'label':_0x53ec28(0x17d),'path':this['configFiles']['project']},{'label':_0x53ec28(0x184),'path':this[_0x53ec28(0x193)][_0x53ec28(0x180)]},{'label':_0x53ec28(0x158),'path':this['configFiles']['profileCredentials']},{'label':_0x53ec28(0x18d),'path':this[_0x53ec28(0x193)][_0x53ec28(0x162)]},{'label':'Global\x20Credentials','path':this[_0x53ec28(0x193)]['globalCredentials']}];for(const {label:_0x3032dc,path:_0x286750,extra:_0x5b9f44}of _0x269e5f){if(_0x286750)console[_0x53ec28(0x19d)](a49_0x24764c['cyan'](_0x3032dc)+':\x20'+_0x286750+'\x20'+a49_0x24764c[_0x53ec28(0x170)]('✓')+(_0x5b9f44?'\x20'+a49_0x24764c['dim'](_0x5b9f44):''));else{if(_0x3032dc===_0x53ec28(0x161))console[_0x53ec28(0x19d)](a49_0x24764c[_0x53ec28(0x189)](_0x3032dc)+':\x20'+a49_0x24764c['dim'](_0x53ec28(0x175))+'\x20'+a49_0x24764c[_0x53ec28(0x166)](_0x53ec28(0x163)+this[_0x53ec28(0x15f)]+')'));else(_0x3032dc==='Project'||_0x3032dc==='Global')&&console[_0x53ec28(0x19d)](a49_0x24764c['cyan'](_0x3032dc)+':\x20'+a49_0x24764c[_0x53ec28(0x166)]('none'));}}}async[a49_0x590df6(0x19c)](){const _0x99f833=a49_0x590df6;return this[_0x99f833(0x156)]=await getAPIKeyAsync(this[_0x99f833(0x195)],this['activeProfile']||undefined),this[_0x99f833(0x156)];}static async[a49_0x590df6(0x19f)](_0x33184e){const _0x2a038d=a49_0x590df6,_0x16767f=new GlobalContext(_0x33184e);return await _0x16767f[_0x2a038d(0x19c)](),_0x16767f;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5b5745,_0x195e08){const _0x1fcb1f=a50_0x1269,_0x4fa3c9=_0x5b5745();while(!![]){try{const _0x5ba03f=parseInt(_0x1fcb1f(0x1ee))/0x1+-parseInt(_0x1fcb1f(0x1fc))/0x2+parseInt(_0x1fcb1f(0x209))/0x3*(-parseInt(_0x1fcb1f(0x204))/0x4)+parseInt(_0x1fcb1f(0x1ff))/0x5+-parseInt(_0x1fcb1f(0x1ef))/0x6+-parseInt(_0x1fcb1f(0x206))/0x7+-parseInt(_0x1fcb1f(0x1f8))/0x8*(-parseInt(_0x1fcb1f(0x1fb))/0x9);if(_0x5ba03f===_0x195e08)break;else _0x4fa3c9['push'](_0x4fa3c9['shift']());}catch(_0x34b87b){_0x4fa3c9['push'](_0x4fa3c9['shift']());}}}(a50_0x5e02,0x49e02));const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;function a50_0x5e02(){const _0x33a503=['System\x20keychain\x20is\x20not\x20available','12188mqlodg','cannot\x20find','1493023nzKnRK','access_denied','restricted','513MelPOl','__keychain_test__','message','getPassword','Entry','could\x20not\x20be\x20found','not_found','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.','-25293','unavailable','175448lpQdVg','3396210eRYHyF','setPassword','deleteCredential','not\x20found','not\x20supported','Warning:\x20','toLowerCase',':api_key','error','569272RpZJtP','-25300','reason','171yhNjXc','402458htoKQl','includes','@napi-rs/keyring','1383575bVULQR','value','profile:','not\x20available'];a50_0x5e02=function(){return _0x33a503;};return a50_0x5e02();}async function getEntryClass(){const _0x3e72fa=a50_0x1269;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x5603f0=await import(_0x3e72fa(0x1fe));return EntryClass=_0x5603f0[_0x3e72fa(0x1e8)],EntryClass;}catch(_0x4b27d8){return keyringLoadError=_0x4b27d8 instanceof Error?_0x4b27d8:new Error(String(_0x4b27d8)),null;}}function getAccountName(_0x23cf7a){const _0x2a795b=a50_0x1269,_0x1af37f=_0x23cf7a||'';return _0x2a795b(0x201)+_0x1af37f+_0x2a795b(0x1f6);}export async function getKeychainAPIKey(_0x184bee){const _0x4e6a97=a50_0x1269,_0x4075fe=await getKeychainAPIKeyWithStatus(_0x184bee);if(_0x4075fe['success'])return _0x4075fe[_0x4e6a97(0x200)];return _0x4075fe[_0x4e6a97(0x1fa)]===_0x4e6a97(0x207)&&console[_0x4e6a97(0x1f7)](_0x4e6a97(0x1f4)+_0x4075fe[_0x4e6a97(0x20b)]),null;}export async function getKeychainAPIKeyWithStatus(_0x43d103){const _0x35dca2=a50_0x1269;try{const _0x8bda9b=await getEntryClass();if(!_0x8bda9b)return{'success':![],'reason':_0x35dca2(0x1ed)};const _0x54a134=getAccountName(_0x43d103),_0x3b9186=new _0x8bda9b(SERVICE_NAME,_0x54a134),_0x50e423=_0x3b9186[_0x35dca2(0x20c)]();if(_0x50e423)return{'success':!![],'value':_0x50e423};return{'success':![],'reason':_0x35dca2(0x1ea)};}catch(_0x2fdf21){const _0x48b765=_0x2fdf21 instanceof Error?_0x2fdf21[_0x35dca2(0x20b)]:String(_0x2fdf21);if(_0x48b765[_0x35dca2(0x1fd)](_0x35dca2(0x1f9))||_0x48b765[_0x35dca2(0x1f5)]()['includes'](_0x35dca2(0x1e9))||_0x48b765[_0x35dca2(0x1f5)]()['includes'](_0x35dca2(0x1f2))||_0x48b765[_0x35dca2(0x1f5)]()[_0x35dca2(0x1fd)]('no\x20matching\x20entry'))return{'success':![],'reason':_0x35dca2(0x1ea)};if(_0x48b765[_0x35dca2(0x1fd)](_0x35dca2(0x1ec))||_0x48b765[_0x35dca2(0x1f5)]()[_0x35dca2(0x1fd)](_0x35dca2(0x208))||_0x48b765['toLowerCase']()[_0x35dca2(0x1fd)]('access'))return{'success':![],'reason':_0x35dca2(0x207),'message':_0x35dca2(0x1eb)};return{'success':![],'reason':_0x35dca2(0x1ed),'message':_0x48b765};}}export async function saveKeychainAPIKey(_0x5d7dff,_0x1d96c2){const _0x320902=a50_0x1269,_0x297c1e=await getEntryClass();if(!_0x297c1e)throw new Error(_0x320902(0x203));const _0x55a236=getAccountName(_0x1d96c2),_0x748cbe=new _0x297c1e(SERVICE_NAME,_0x55a236);_0x748cbe[_0x320902(0x1f0)](_0x5d7dff);}export async function deleteKeychainAPIKey(_0x5a730){const _0x52c8c1=a50_0x1269;try{const _0x4c5bb8=await getEntryClass();if(!_0x4c5bb8)return![];const _0x598ec2=getAccountName(_0x5a730),_0x144727=new _0x4c5bb8(SERVICE_NAME,_0x598ec2);return _0x144727[_0x52c8c1(0x1f1)](),!![];}catch{return![];}}function a50_0x1269(_0x10dcc4,_0x3098c4){_0x10dcc4=_0x10dcc4-0x1e8;const _0x5e02be=a50_0x5e02();let _0x126924=_0x5e02be[_0x10dcc4];return _0x126924;}export async function isKeychainAvailable(){const _0x201f20=a50_0x1269;try{const _0x35c8d0=await getEntryClass();if(!_0x35c8d0)return![];const _0x3704b5=new _0x35c8d0(SERVICE_NAME,_0x201f20(0x20a));return _0x3704b5[_0x201f20(0x20c)](),!![];}catch(_0x5710ad){const _0x1444fa=_0x5710ad instanceof Error?_0x5710ad[_0x201f20(0x20b)]['toLowerCase']():'';if(_0x1444fa['includes'](_0x201f20(0x202))||_0x1444fa['includes'](_0x201f20(0x1f3))||_0x1444fa[_0x201f20(0x1fd)](_0x201f20(0x205)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a51_0x17a0b9=a51_0x53dd;(function(_0x32289d,_0x464945){const _0x46a693=a51_0x53dd,_0x4f25dd=_0x32289d();while(!![]){try{const _0xbd59c7=-parseInt(_0x46a693(0x1b4))/0x1*(parseInt(_0x46a693(0x1e8))/0x2)+-parseInt(_0x46a693(0x1f9))/0x3+parseInt(_0x46a693(0x1d8))/0x4*(parseInt(_0x46a693(0x1f5))/0x5)+-parseInt(_0x46a693(0x200))/0x6+parseInt(_0x46a693(0x1cc))/0x7*(-parseInt(_0x46a693(0x1e7))/0x8)+-parseInt(_0x46a693(0x1cb))/0x9+parseInt(_0x46a693(0x1b7))/0xa;if(_0xbd59c7===_0x464945)break;else _0x4f25dd['push'](_0x4f25dd['shift']());}catch(_0x46f1a8){_0x4f25dd['push'](_0x4f25dd['shift']());}}}(a51_0x43cc,0xdc3fd));import*as a51_0xa66800 from'node:fs';import*as a51_0x234d60 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';function a51_0x43cc(){const _0x1cfca9=['some','parent_segment','\x20\x20mv\x20\x22','rmSync','\x27:\x20config\x20must\x20be\x20an\x20object',',\x20creating\x20new\x20file','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','has','object','message','database','160gObPWO','38sOqLyz','profiles','existsSync','profile','stringify','readdirSync','map','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','length','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x20does\x20not\x20exist','filter','9830zWBBGj','user_info','.env','\x27:\x20unknown\x20config\x20key\x20\x27','4832178swqYih','description','directory','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','warn','Profile\x20\x27','INVALID_PROFILE_CONFIG','7510884oWeKrL','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','isDirectory','56963yAKKFU','user','To\x20migrate:','60013410KsGqlt','\x20\x201.\x20Edit:\x20','find','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','set','llm_project','from','\x22\x20\x22','string','readFileSync','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','.env.','llm_agent','utf-8','site','test',':\x20Invalid\x20JSON\x20syntax','tdx.json','parse','values','11324601lJneiH','53767fCMRre','join','entries','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x20already\x20exists','Warning:\x20Failed\x20to\x20parse\x20','\x27\x20not\x20found\x20in\x20user\x20configuration','name','keys','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','toISOString','Profile\x20','524ZKYild','push','@tdx-studio','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string'];a51_0x43cc=function(){return _0x1cfca9;};return a51_0x43cc();}export const STUDIO_PROFILE_NAME=a51_0x17a0b9(0x1da);export function getProfileParams(_0x5ae829){const _0xed349=a51_0x17a0b9,_0x5749a4={};if(!_0x5ae829)return _0x5749a4;for(const [_0x5b1a5d,_0x3ae56c]of Object[_0xed349(0x1ce)](_0x5ae829)){_0x5b1a5d!==_0xed349(0x1fa)&&_0x3ae56c!==undefined&&(_0x5749a4[_0x5b1a5d]=_0x3ae56c);}return _0x5749a4;}export function getProfilesDir(){return a51_0x234d60['join'](getConfigDir(),'profiles');}function getProfileDir(_0x57590f){return a51_0x234d60['join'](getProfilesDir(),_0x57590f);}function getProfileConfigPath(_0x545e92){const _0x3e2947=a51_0x17a0b9;return a51_0x234d60[_0x3e2947(0x1cd)](getProfileDir(_0x545e92),'tdx.json');}function getProfileEnvPath(_0x5a52d4){const _0x25a5c4=a51_0x17a0b9;return a51_0x234d60[_0x25a5c4(0x1cd)](getProfileDir(_0x5a52d4),_0x25a5c4(0x1f7));}function getGlobalConfigPath(){const _0x5f1eb7=a51_0x17a0b9;return a51_0x234d60[_0x5f1eb7(0x1cd)](getConfigDir(),_0x5f1eb7(0x1c8));}function validateProfileName(_0x1696b3){const _0xb0250c=a51_0x17a0b9;if(/^@?[a-zA-Z0-9_-]+$/[_0xb0250c(0x1c6)](_0x1696b3))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/[_0xb0250c(0x1c6)](_0x1696b3))return;throw new Error('Invalid\x20profile\x20name:\x20'+_0x1696b3+_0xb0250c(0x1d5));}function validateProfileConfig(_0x17f2e4,_0x1f0a02){const _0x2789d2=a51_0x17a0b9;if(typeof _0x17f2e4!==_0x2789d2(0x1e4)||_0x17f2e4===null)throw new SDKError(ErrorCode[_0x2789d2(0x1ff)],'Profile\x20\x27'+_0x1f0a02+_0x2789d2(0x1e0));const _0x1f7516=[_0x2789d2(0x1fa),_0x2789d2(0x1c5),_0x2789d2(0x1e6),_0x2789d2(0x1dd),_0x2789d2(0x1bc),_0x2789d2(0x1c3),_0x2789d2(0x1f6)],_0x152764=_0x17f2e4;for(const _0x4b0b3f of Object[_0x2789d2(0x1d4)](_0x152764)){!_0x1f7516['includes'](_0x4b0b3f)&&console[_0x2789d2(0x1fd)]('Warning:\x20Profile\x20\x27'+_0x1f0a02+_0x2789d2(0x1f8)+_0x4b0b3f+'\x27\x20will\x20be\x20ignored');}if(_0x152764[_0x2789d2(0x1fa)]!==undefined&&typeof _0x152764[_0x2789d2(0x1fa)]!==_0x2789d2(0x1bf))throw new SDKError(ErrorCode[_0x2789d2(0x1ff)],'Profile\x20\x27'+_0x1f0a02+_0x2789d2(0x1cf));if(_0x152764[_0x2789d2(0x1c5)]!==undefined&&typeof _0x152764['site']!==_0x2789d2(0x1bf))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x2789d2(0x1fe)+_0x1f0a02+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x152764[_0x2789d2(0x1e6)]!==undefined&&typeof _0x152764[_0x2789d2(0x1e6)]!==_0x2789d2(0x1bf))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x2789d2(0x1fe)+_0x1f0a02+_0x2789d2(0x1db));if(_0x152764[_0x2789d2(0x1dd)]!==undefined&&typeof _0x152764[_0x2789d2(0x1dd)]!==_0x2789d2(0x1bf))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x2789d2(0x1fe)+_0x1f0a02+_0x2789d2(0x1f1));if(_0x152764[_0x2789d2(0x1bc)]!==undefined&&typeof _0x152764[_0x2789d2(0x1bc)]!==_0x2789d2(0x1bf))throw new SDKError(ErrorCode[_0x2789d2(0x1ff)],'Profile\x20\x27'+_0x1f0a02+_0x2789d2(0x1ef));if(_0x152764[_0x2789d2(0x1c3)]!==undefined&&typeof _0x152764[_0x2789d2(0x1c3)]!==_0x2789d2(0x1bf))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x2789d2(0x1fe)+_0x1f0a02+_0x2789d2(0x1f2));return!![];}function loadProfilesFromTdxJson(_0x2f5686,_0x1f3049){const _0x327475=a51_0x17a0b9;if(!a51_0xa66800['existsSync'](_0x2f5686))return[];try{const _0x21dfab=a51_0xa66800[_0x327475(0x1c0)](_0x2f5686,_0x327475(0x1c4)),_0x364cec=JSON[_0x327475(0x1c9)](_0x21dfab);if(!_0x364cec[_0x327475(0x1e9)]||typeof _0x364cec[_0x327475(0x1e9)]!==_0x327475(0x1e4))return[];const _0x229bc0=[];for(const [_0xce04d7,_0x564c81]of Object[_0x327475(0x1ce)](_0x364cec['profiles'])){try{validateProfileConfig(_0x564c81,_0xce04d7);const _0x73d693=getNewCredentialPath(_0xce04d7),_0x350296=getOldCredentialPath(_0xce04d7),_0x40ccf7=a51_0xa66800['existsSync'](_0x73d693)||a51_0xa66800[_0x327475(0x1ea)](_0x350296);_0x229bc0[_0x327475(0x1d9)]({'name':_0xce04d7,'config':_0x564c81,'metadata':{'name':_0xce04d7,'createdAt':new Date()[_0x327475(0x1d6)]()},'hasCredentials':_0x40ccf7,'scope':_0x1f3049});}catch(_0x574cc1){_0x574cc1 instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x2f5686+':'),console[_0x327475(0x1fd)]('\x20\x20'+_0x574cc1[_0x327475(0x1e5)]+'\x0a'));}}return _0x229bc0;}catch(_0x526201){return _0x526201 instanceof SyntaxError?(console['warn']('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x2f5686+_0x327475(0x1c7)),console[_0x327475(0x1fd)]('Error:\x20'+_0x526201[_0x327475(0x1e5)]+'\x0a')):console[_0x327475(0x1fd)](_0x327475(0x1ba)+_0x2f5686+':\x20'+_0x526201+'\x0a'),[];}}export function getNewCredentialPath(_0x1fd0e6){const _0x13f764=a51_0x17a0b9;return a51_0x234d60[_0x13f764(0x1cd)](getConfigDir(),_0x13f764(0x1c2)+_0x1fd0e6);}function getOldCredentialPath(_0x39a08d){const _0x1ac428=a51_0x17a0b9;return a51_0x234d60[_0x1ac428(0x1cd)](getProfilesDir(),_0x39a08d,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x55e2f7=a51_0x17a0b9,_0x17648c=[],_0x46f7c8=findProjectConfigPath();_0x46f7c8&&_0x17648c['push'](...loadProfilesFromTdxJson(_0x46f7c8,'local'));const _0x38b3f9=a51_0x234d60[_0x55e2f7(0x1cd)](getConfigDir(),_0x55e2f7(0x1c8));return _0x17648c['push'](...loadProfilesFromTdxJson(_0x38b3f9,_0x55e2f7(0x1b5))),_0x17648c;}function loadProfilesFromDirectories(){const _0x2ebaca=a51_0x17a0b9,_0x148e26=getProfilesDir();if(!a51_0xa66800['existsSync'](_0x148e26))return[];try{return a51_0xa66800[_0x2ebaca(0x1ed)](_0x148e26,{'withFileTypes':!![]})['filter'](_0x36b333=>_0x36b333[_0x2ebaca(0x202)]())[_0x2ebaca(0x1ee)](_0x1f18ee=>_0x1f18ee['name'])[_0x2ebaca(0x1f4)](_0x4fabbf=>{const _0x2b7653=_0x2ebaca,_0x48dd0f=getProfileConfigPath(_0x4fabbf),_0x574631=getProfileEnvPath(_0x4fabbf);return a51_0xa66800[_0x2b7653(0x1ea)](_0x48dd0f)||a51_0xa66800[_0x2b7653(0x1ea)](_0x574631);})[_0x2ebaca(0x1ee)](_0x292645=>{const _0x5a2a20=_0x2ebaca,_0xca3b52=loadProfileFromDirectory(_0x292645);if(_0xca3b52)return{..._0xca3b52,'scope':_0x5a2a20(0x1fb)};return null;})['filter'](_0x5995ad=>_0x5995ad!==null);}catch{return[];}}function loadProfileFromDirectory(_0xb6d962){const _0x2f7d58=a51_0x17a0b9,_0x3e84c5=getProfileConfigPath(_0xb6d962),_0xfac821=getOldCredentialPath(_0xb6d962);if(!a51_0xa66800[_0x2f7d58(0x1ea)](_0x3e84c5)&&!a51_0xa66800['existsSync'](_0xfac821))return null;let _0x2eedfd={},_0x5e2a14={'name':_0xb6d962,'createdAt':new Date()['toISOString']()};if(a51_0xa66800[_0x2f7d58(0x1ea)](_0x3e84c5))try{const _0x12bbaf=a51_0xa66800['readFileSync'](_0x3e84c5,_0x2f7d58(0x1c4)),_0xb94d29=JSON[_0x2f7d58(0x1c9)](_0x12bbaf),{metadata:_0x2ce4f0,..._0x4c25cd}=_0xb94d29;_0x2eedfd=_0x4c25cd,_0x2ce4f0&&(_0x5e2a14=_0x2ce4f0);}catch{}return{'name':_0xb6d962,'config':_0x2eedfd,'metadata':_0x5e2a14,'hasCredentials':a51_0xa66800['existsSync'](_0xfac821),'scope':_0x2f7d58(0x1fb)};}export function listProfiles(){const _0x596839=a51_0x17a0b9,_0x253806=loadProfilesFromTdxJsonFiles(),_0x5cb6ef=loadProfilesFromDirectories();if(_0x5cb6ef[_0x596839(0x1f0)]>0x0){const _0x35328e=_0x5cb6ef[_0x596839(0x1ee)](_0x4557b8=>_0x4557b8['name'])[_0x596839(0x1cd)](',\x20'),_0x1b2683=getConfigDir();console[_0x596839(0x1fd)](_0x596839(0x1e2)+_0x35328e),console['warn'](_0x596839(0x1c1)),console[_0x596839(0x1fd)](_0x596839(0x1b8)+a51_0x234d60[_0x596839(0x1cd)](_0x1b2683,_0x596839(0x1c8))),console[_0x596839(0x1fd)](_0x596839(0x201)),console[_0x596839(0x1fd)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x58351c=[..._0x253806,..._0x5cb6ef],_0x3bfefc=new Map();for(const _0x424378 of _0x58351c){!_0x3bfefc[_0x596839(0x1e3)](_0x424378['name'])&&_0x3bfefc[_0x596839(0x1bb)](_0x424378[_0x596839(0x1d3)],_0x424378);}return Array[_0x596839(0x1bd)](_0x3bfefc[_0x596839(0x1ca)]())['sort']((_0x27089f,_0x591c84)=>_0x27089f[_0x596839(0x1d3)]['localeCompare'](_0x591c84[_0x596839(0x1d3)]));}export function profileExists(_0x5224b7){const _0x2c8f3a=a51_0x17a0b9,_0x2309f1=listProfiles();return _0x2309f1[_0x2c8f3a(0x1dc)](_0x1addda=>_0x1addda[_0x2c8f3a(0x1d3)]===_0x5224b7);}export function loadProfile(_0x1df265){const _0x2d7a79=a51_0x17a0b9;validateProfileName(_0x1df265);const _0x596fd6=listProfiles(),_0x23588b=_0x596fd6[_0x2d7a79(0x1b9)](_0x36519d=>_0x36519d[_0x2d7a79(0x1d3)]===_0x1df265);return _0x23588b||null;}export function saveProfile(_0x2c1f86,_0x2d9a12,_0x192a79=![]){saveProfileToUserConfig(_0x2c1f86,_0x2d9a12);}export function deleteProfile(_0x134766){const _0x4e973d=a51_0x17a0b9;validateProfileName(_0x134766);const _0x4b52b4=getProfileDir(_0x134766);if(!a51_0xa66800[_0x4e973d(0x1ea)](_0x4b52b4))throw new Error(_0x4e973d(0x1d7)+_0x134766+_0x4e973d(0x1f3));a51_0xa66800[_0x4e973d(0x1df)](_0x4b52b4,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x514e2b,_0x11ac2c){const _0x4c8fb7=a51_0x17a0b9;validateProfileName(_0x514e2b);const _0x465b4e=getGlobalConfigPath(),_0x2b7092=getConfigDir();!a51_0xa66800[_0x4c8fb7(0x1ea)](_0x2b7092)&&createSecureDirectory(_0x2b7092);let _0x2b7489={};if(a51_0xa66800[_0x4c8fb7(0x1ea)](_0x465b4e))try{const _0x15cc27=a51_0xa66800[_0x4c8fb7(0x1c0)](_0x465b4e,_0x4c8fb7(0x1c4));_0x2b7489=JSON[_0x4c8fb7(0x1c9)](_0x15cc27);}catch{console[_0x4c8fb7(0x1fd)](_0x4c8fb7(0x1d1)+_0x465b4e+',\x20creating\x20new\x20file');}!_0x2b7489[_0x4c8fb7(0x1e9)]&&(_0x2b7489['profiles']={}),_0x2b7489[_0x4c8fb7(0x1e9)][_0x514e2b]=_0x11ac2c,writeSecureFile(_0x465b4e,JSON[_0x4c8fb7(0x1ec)](_0x2b7489,null,0x2));}export function removeProfileFromUserConfig(_0x2320e4){const _0x3787ae=a51_0x17a0b9;validateProfileName(_0x2320e4);const _0x1a088e=getGlobalConfigPath();if(!a51_0xa66800[_0x3787ae(0x1ea)](_0x1a088e))throw new Error(_0x3787ae(0x1fe)+_0x2320e4+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x302b45={};try{const _0x280c31=a51_0xa66800['readFileSync'](_0x1a088e,_0x3787ae(0x1c4));_0x302b45=JSON['parse'](_0x280c31);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0x1a088e);}if(!_0x302b45[_0x3787ae(0x1e9)]||!_0x302b45['profiles'][_0x2320e4])throw new Error(_0x3787ae(0x1fe)+_0x2320e4+_0x3787ae(0x1d2));delete _0x302b45[_0x3787ae(0x1e9)][_0x2320e4],_0x302b45[_0x3787ae(0x1eb)]===_0x2320e4&&delete _0x302b45[_0x3787ae(0x1eb)],writeSecureFile(_0x1a088e,JSON['stringify'](_0x302b45,null,0x2));}function a51_0x53dd(_0x5e16ed,_0x37b933){_0x5e16ed=_0x5e16ed-0x1b4;const _0x43cc4f=a51_0x43cc();let _0x53dd11=_0x43cc4f[_0x5e16ed];return _0x53dd11;}export function getActiveProfile(){const _0x125c19=a51_0x17a0b9,_0x14fbc4=loadSessionContext();if(_0x14fbc4?.[_0x125c19(0x1eb)])return _0x14fbc4[_0x125c19(0x1eb)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x2bcaee=getGlobalConfigPath();if(!a51_0xa66800['existsSync'](_0x2bcaee))return null;try{const _0x4bcb13=a51_0xa66800['readFileSync'](_0x2bcaee,'utf-8'),_0xe6929e=JSON['parse'](_0x4bcb13);return _0xe6929e[_0x125c19(0x1eb)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x24dda5){const _0x1e7ad2=a51_0x17a0b9,_0x38b072=getGlobalConfigPath(),_0x2f3596=getConfigDir();!a51_0xa66800[_0x1e7ad2(0x1ea)](_0x2f3596)&&createSecureDirectory(_0x2f3596);let _0x1d47e2={};if(a51_0xa66800[_0x1e7ad2(0x1ea)](_0x38b072))try{const _0x507132=a51_0xa66800['readFileSync'](_0x38b072,_0x1e7ad2(0x1c4));_0x1d47e2=JSON[_0x1e7ad2(0x1c9)](_0x507132);}catch{console['warn'](_0x1e7ad2(0x1d1)+_0x38b072+_0x1e7ad2(0x1e1));}_0x1d47e2[_0x1e7ad2(0x1c5)]=_0x24dda5,writeSecureFile(_0x38b072,JSON[_0x1e7ad2(0x1ec)](_0x1d47e2,null,0x2));}export function saveActiveProfileToUserConfig(_0xf39528){const _0x4df701=a51_0x17a0b9;validateProfileName(_0xf39528);const _0x544d4e=getGlobalConfigPath(),_0x30a3a9=getConfigDir();!a51_0xa66800['existsSync'](_0x30a3a9)&&createSecureDirectory(_0x30a3a9);let _0x3df698={};if(a51_0xa66800[_0x4df701(0x1ea)](_0x544d4e))try{const _0x19c5e4=a51_0xa66800[_0x4df701(0x1c0)](_0x544d4e,_0x4df701(0x1c4));_0x3df698=JSON[_0x4df701(0x1c9)](_0x19c5e4);}catch{console['warn'](_0x4df701(0x1d1)+_0x544d4e+_0x4df701(0x1e1));}_0x3df698['profile']=_0xf39528,writeSecureFile(_0x544d4e,JSON[_0x4df701(0x1ec)](_0x3df698,null,0x2));}function clearFieldFromUserConfig(_0x4ad31c){const _0x5cd4da=a51_0x17a0b9,_0x3dfc59=getGlobalConfigPath();if(!a51_0xa66800[_0x5cd4da(0x1ea)](_0x3dfc59))return;let _0x2b9a58={};try{const _0x50decf=a51_0xa66800[_0x5cd4da(0x1c0)](_0x3dfc59,_0x5cd4da(0x1c4));_0x2b9a58=JSON[_0x5cd4da(0x1c9)](_0x50decf);}catch{return;}delete _0x2b9a58[_0x4ad31c],writeSecureFile(_0x3dfc59,JSON[_0x5cd4da(0x1ec)](_0x2b9a58,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x265cb3=a51_0x17a0b9;clearFieldFromUserConfig(_0x265cb3(0x1c5));}export function clearActiveProfileFromUserConfig(){const _0x1e175c=a51_0x17a0b9;clearFieldFromUserConfig(_0x1e175c(0x1eb));}export function createProfile(_0x23b540,_0x258759){const _0x5220e2=a51_0x17a0b9;validateProfileName(_0x23b540);if(profileExists(_0x23b540))throw new Error(_0x5220e2(0x1d7)+_0x23b540+_0x5220e2(0x1d0));saveProfile(_0x23b540,_0x258759);}export function saveProfileCredentials(_0x5c60fa,_0x5aefdd){const _0x4928e6=a51_0x17a0b9;validateProfileName(_0x5c60fa);if(!profileExists(_0x5c60fa))throw new Error('Profile\x20'+_0x5c60fa+_0x4928e6(0x1f3));const _0x3c882e=getNewCredentialPath(_0x5c60fa);writeSecureFile(_0x3c882e,_0x5aefdd);}export function loadProfileCredentials(_0x19e661){const _0x2b8b79=a51_0x17a0b9;validateProfileName(_0x19e661);const _0x2e24b3=getNewCredentialPath(_0x19e661);if(a51_0xa66800[_0x2b8b79(0x1ea)](_0x2e24b3))try{return a51_0xa66800[_0x2b8b79(0x1c0)](_0x2e24b3,_0x2b8b79(0x1c4));}catch{}const _0xa268e0=getOldCredentialPath(_0x19e661);if(a51_0xa66800[_0x2b8b79(0x1ea)](_0xa268e0)){console[_0x2b8b79(0x1fd)](_0x2b8b79(0x1fc)+_0x19e661+'\x27'),console[_0x2b8b79(0x1fd)](_0x2b8b79(0x1b6)),console[_0x2b8b79(0x1fd)](_0x2b8b79(0x1de)+_0xa268e0+_0x2b8b79(0x1be)+_0x2e24b3+'\x22'),console['warn']('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a51_0xa66800[_0x2b8b79(0x1c0)](_0xa268e0,'utf-8');}catch{return null;}}return null;}
|
|
1
|
+
const a51_0x2dc202=a51_0x1ce8;(function(_0x31337c,_0x27f6d2){const _0x87185d=a51_0x1ce8,_0x4eb11f=_0x31337c();while(!![]){try{const _0xfa61eb=-parseInt(_0x87185d(0x1bb))/0x1+parseInt(_0x87185d(0x1b4))/0x2*(-parseInt(_0x87185d(0x1a7))/0x3)+parseInt(_0x87185d(0x195))/0x4*(-parseInt(_0x87185d(0x1d6))/0x5)+parseInt(_0x87185d(0x1bf))/0x6*(-parseInt(_0x87185d(0x1de))/0x7)+-parseInt(_0x87185d(0x1b6))/0x8*(-parseInt(_0x87185d(0x1d3))/0x9)+-parseInt(_0x87185d(0x1e0))/0xa+parseInt(_0x87185d(0x1d2))/0xb*(parseInt(_0x87185d(0x198))/0xc);if(_0xfa61eb===_0x27f6d2)break;else _0x4eb11f['push'](_0x4eb11f['shift']());}catch(_0x470756){_0x4eb11f['push'](_0x4eb11f['shift']());}}}(a51_0x442b,0xd7a84));import*as a51_0x43f667 from'node:fs';import*as a51_0x3ecd75 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=a51_0x2dc202(0x1c4);export function getProfileParams(_0x574988){const _0x2bd2fd=a51_0x2dc202,_0x4afd3b={};if(!_0x574988)return _0x4afd3b;for(const [_0x59712c,_0x595f5b]of Object[_0x2bd2fd(0x1c6)](_0x574988)){_0x59712c!==_0x2bd2fd(0x1dd)&&_0x595f5b!==undefined&&(_0x4afd3b[_0x59712c]=_0x595f5b);}return _0x4afd3b;}export function getProfilesDir(){const _0x218a57=a51_0x2dc202;return a51_0x3ecd75[_0x218a57(0x1c0)](getConfigDir(),_0x218a57(0x1c7));}function getProfileDir(_0x574a3f){const _0x457d5c=a51_0x2dc202;return a51_0x3ecd75[_0x457d5c(0x1c0)](getProfilesDir(),_0x574a3f);}function getProfileConfigPath(_0x23dc20){const _0x51712d=a51_0x2dc202;return a51_0x3ecd75[_0x51712d(0x1c0)](getProfileDir(_0x23dc20),_0x51712d(0x1ad));}function getProfileEnvPath(_0x41b3e4){const _0x394f39=a51_0x2dc202;return a51_0x3ecd75[_0x394f39(0x1c0)](getProfileDir(_0x41b3e4),_0x394f39(0x1e1));}function getGlobalConfigPath(){const _0x1b24a1=a51_0x2dc202;return a51_0x3ecd75[_0x1b24a1(0x1c0)](getConfigDir(),'tdx.json');}function validateProfileName(_0x509aa6){const _0x3890e3=a51_0x2dc202;if(/^@?[a-zA-Z0-9_-]+$/[_0x3890e3(0x1bd)](_0x509aa6))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/[_0x3890e3(0x1bd)](_0x509aa6))return;throw new Error(_0x3890e3(0x197)+_0x509aa6+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x3ce8e2,_0x500c08){const _0x192d0e=a51_0x2dc202;if(typeof _0x3ce8e2!==_0x192d0e(0x1d9)||_0x3ce8e2===null)throw new SDKError(ErrorCode[_0x192d0e(0x1d5)],_0x192d0e(0x19d)+_0x500c08+_0x192d0e(0x1cd));const _0x3e17f1=[_0x192d0e(0x1dd),_0x192d0e(0x19a),'database',_0x192d0e(0x1be),_0x192d0e(0x1d1),_0x192d0e(0x19e),_0x192d0e(0x1ce)],_0x17ecce=_0x3ce8e2;for(const _0x1e1e99 of Object['keys'](_0x17ecce)){!_0x3e17f1[_0x192d0e(0x1da)](_0x1e1e99)&&console['warn'](_0x192d0e(0x191)+_0x500c08+_0x192d0e(0x1b7)+_0x1e1e99+'\x27\x20will\x20be\x20ignored');}if(_0x17ecce[_0x192d0e(0x1dd)]!==undefined&&typeof _0x17ecce[_0x192d0e(0x1dd)]!=='string')throw new SDKError(ErrorCode[_0x192d0e(0x1d5)],_0x192d0e(0x19d)+_0x500c08+_0x192d0e(0x1ac));if(_0x17ecce[_0x192d0e(0x19a)]!==undefined&&typeof _0x17ecce[_0x192d0e(0x19a)]!=='string')throw new SDKError(ErrorCode[_0x192d0e(0x1d5)],_0x192d0e(0x19d)+_0x500c08+_0x192d0e(0x1a9));if(_0x17ecce[_0x192d0e(0x1cb)]!==undefined&&typeof _0x17ecce[_0x192d0e(0x1cb)]!==_0x192d0e(0x19b))throw new SDKError(ErrorCode[_0x192d0e(0x1d5)],'Profile\x20\x27'+_0x500c08+_0x192d0e(0x1af));if(_0x17ecce[_0x192d0e(0x1be)]!==undefined&&typeof _0x17ecce[_0x192d0e(0x1be)]!==_0x192d0e(0x19b))throw new SDKError(ErrorCode[_0x192d0e(0x1d5)],'Profile\x20\x27'+_0x500c08+_0x192d0e(0x1e2));if(_0x17ecce[_0x192d0e(0x1d1)]!==undefined&&typeof _0x17ecce[_0x192d0e(0x1d1)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x192d0e(0x19d)+_0x500c08+_0x192d0e(0x1a6));if(_0x17ecce[_0x192d0e(0x19e)]!==undefined&&typeof _0x17ecce['llm_agent']!==_0x192d0e(0x19b))throw new SDKError(ErrorCode[_0x192d0e(0x1d5)],_0x192d0e(0x19d)+_0x500c08+_0x192d0e(0x1df));return!![];}function a51_0x442b(){const _0x598534=['\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','4266747SwUZGx','length','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','set','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','tdx.json','user','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x22\x20\x22','from','profile','stringify','2SCFrtn','name','4848ZpchqG','\x27:\x20unknown\x20config\x20key\x20\x27','parse','\x20does\x20not\x20exist','\x20\x20mv\x20\x22','691904bbVqIU','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','test','parent_segment','605478sXIYfQ','join','filter','Failed\x20to\x20parse\x20','local','@tdx-studio','rmSync','entries','profiles','warn','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','message','database','existsSync','\x27:\x20config\x20must\x20be\x20an\x20object','user_info','find','push','llm_project','33jZiDKp','13041jbWUSV','sort','INVALID_PROFILE_CONFIG','45ldAsXe','Error:\x20','toISOString','object','includes','Profile\x20','readdirSync','description','21rdFgGw','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','4204570RUEddt','.env','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','utf-8','values','Warning:\x20Profile\x20\x27','readFileSync','\x20already\x20exists','some','304816wmnuuL','\x27\x20not\x20found\x20in\x20user\x20configuration','Invalid\x20profile\x20name:\x20','14113692IVzNgn','has','site','string','\x0aWarning:\x20Failed\x20to\x20parse\x20','Profile\x20\x27','llm_agent','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a',',\x20creating\x20new\x20file','directory','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','To\x20migrate:','map'];a51_0x442b=function(){return _0x598534;};return a51_0x442b();}function loadProfilesFromTdxJson(_0x356d2e,_0x3d8ed1){const _0x1300ee=a51_0x2dc202;if(!a51_0x43f667[_0x1300ee(0x1cc)](_0x356d2e))return[];try{const _0x100b42=a51_0x43f667[_0x1300ee(0x192)](_0x356d2e,_0x1300ee(0x1e3)),_0x231457=JSON[_0x1300ee(0x1b8)](_0x100b42);if(!_0x231457['profiles']||typeof _0x231457[_0x1300ee(0x1c7)]!==_0x1300ee(0x1d9))return[];const _0x3e2fa7=[];for(const [_0x2aabd3,_0x561db3]of Object['entries'](_0x231457[_0x1300ee(0x1c7)])){try{validateProfileConfig(_0x561db3,_0x2aabd3);const _0x3ee961=getNewCredentialPath(_0x2aabd3),_0x4f69e1=getOldCredentialPath(_0x2aabd3),_0x244568=a51_0x43f667[_0x1300ee(0x1cc)](_0x3ee961)||a51_0x43f667['existsSync'](_0x4f69e1);_0x3e2fa7[_0x1300ee(0x1d0)]({'name':_0x2aabd3,'config':_0x561db3,'metadata':{'name':_0x2aabd3,'createdAt':new Date()[_0x1300ee(0x1d8)]()},'hasCredentials':_0x244568,'scope':_0x3d8ed1});}catch(_0x105a0e){_0x105a0e instanceof Error&&(console[_0x1300ee(0x1c8)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x356d2e+':'),console[_0x1300ee(0x1c8)]('\x20\x20'+_0x105a0e['message']+'\x0a'));}}return _0x3e2fa7;}catch(_0x1c3075){return _0x1c3075 instanceof SyntaxError?(console[_0x1300ee(0x1c8)](_0x1300ee(0x19c)+_0x356d2e+':\x20Invalid\x20JSON\x20syntax'),console[_0x1300ee(0x1c8)](_0x1300ee(0x1d7)+_0x1c3075[_0x1300ee(0x1ca)]+'\x0a')):console[_0x1300ee(0x1c8)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x356d2e+':\x20'+_0x1c3075+'\x0a'),[];}}export function getNewCredentialPath(_0x5ba817){const _0x580395=a51_0x2dc202;return a51_0x3ecd75[_0x580395(0x1c0)](getConfigDir(),'.env.'+_0x5ba817);}function getOldCredentialPath(_0x3fbe05){const _0x5461f3=a51_0x2dc202;return a51_0x3ecd75[_0x5461f3(0x1c0)](getProfilesDir(),_0x3fbe05,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x7743a1=a51_0x2dc202,_0x3d7a1e=[],_0x495d1d=findProjectConfigPath();_0x495d1d&&_0x3d7a1e[_0x7743a1(0x1d0)](...loadProfilesFromTdxJson(_0x495d1d,_0x7743a1(0x1c3)));const _0xadbe08=a51_0x3ecd75[_0x7743a1(0x1c0)](getConfigDir(),_0x7743a1(0x1ad));return _0x3d7a1e[_0x7743a1(0x1d0)](...loadProfilesFromTdxJson(_0xadbe08,_0x7743a1(0x1ae))),_0x3d7a1e;}function loadProfilesFromDirectories(){const _0x46ec9c=a51_0x2dc202,_0xf30047=getProfilesDir();if(!a51_0x43f667[_0x46ec9c(0x1cc)](_0xf30047))return[];try{return a51_0x43f667[_0x46ec9c(0x1dc)](_0xf30047,{'withFileTypes':!![]})['filter'](_0x48f12b=>_0x48f12b['isDirectory']())[_0x46ec9c(0x1a5)](_0x224c77=>_0x224c77[_0x46ec9c(0x1b5)])[_0x46ec9c(0x1c1)](_0x18d9bc=>{const _0x11fe83=_0x46ec9c,_0x16249d=getProfileConfigPath(_0x18d9bc),_0x523767=getProfileEnvPath(_0x18d9bc);return a51_0x43f667[_0x11fe83(0x1cc)](_0x16249d)||a51_0x43f667['existsSync'](_0x523767);})[_0x46ec9c(0x1a5)](_0x26764f=>{const _0x38bf4d=_0x46ec9c,_0x4b5852=loadProfileFromDirectory(_0x26764f);if(_0x4b5852)return{..._0x4b5852,'scope':_0x38bf4d(0x1a2)};return null;})['filter'](_0x68e17b=>_0x68e17b!==null);}catch{return[];}}function loadProfileFromDirectory(_0x5b22e3){const _0x2a9bbd=a51_0x2dc202,_0x1245fc=getProfileConfigPath(_0x5b22e3),_0x58ede4=getOldCredentialPath(_0x5b22e3);if(!a51_0x43f667[_0x2a9bbd(0x1cc)](_0x1245fc)&&!a51_0x43f667['existsSync'](_0x58ede4))return null;let _0x5610be={},_0x187983={'name':_0x5b22e3,'createdAt':new Date()['toISOString']()};if(a51_0x43f667[_0x2a9bbd(0x1cc)](_0x1245fc))try{const _0x317d27=a51_0x43f667[_0x2a9bbd(0x192)](_0x1245fc,_0x2a9bbd(0x1e3)),_0xff4653=JSON['parse'](_0x317d27),{metadata:_0xc63fb9,..._0x5da9de}=_0xff4653;_0x5610be=_0x5da9de,_0xc63fb9&&(_0x187983=_0xc63fb9);}catch{}return{'name':_0x5b22e3,'config':_0x5610be,'metadata':_0x187983,'hasCredentials':a51_0x43f667[_0x2a9bbd(0x1cc)](_0x58ede4),'scope':_0x2a9bbd(0x1a2)};}export function listProfiles(){const _0xa44de=a51_0x2dc202,_0x5995d2=loadProfilesFromTdxJsonFiles(),_0x1f545b=loadProfilesFromDirectories();if(_0x1f545b[_0xa44de(0x1a8)]>0x0){const _0x49f0b5=_0x1f545b[_0xa44de(0x1a5)](_0x74b738=>_0x74b738[_0xa44de(0x1b5)])[_0xa44de(0x1c0)](',\x20'),_0x20d577=getConfigDir();console[_0xa44de(0x1c8)](_0xa44de(0x19f)+_0x49f0b5),console['warn'](_0xa44de(0x1a3)),console[_0xa44de(0x1c8)]('\x20\x201.\x20Edit:\x20'+a51_0x3ecd75[_0xa44de(0x1c0)](_0x20d577,_0xa44de(0x1ad))),console['warn']('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0xa44de(0x1c8)](_0xa44de(0x1c9));}const _0x57357f=[..._0x5995d2,..._0x1f545b],_0x3062a9=new Map();for(const _0x39afc7 of _0x57357f){!_0x3062a9[_0xa44de(0x199)](_0x39afc7[_0xa44de(0x1b5)])&&_0x3062a9[_0xa44de(0x1ab)](_0x39afc7['name'],_0x39afc7);}return Array[_0xa44de(0x1b1)](_0x3062a9[_0xa44de(0x190)]())[_0xa44de(0x1d4)]((_0x3a16f4,_0x46a606)=>_0x3a16f4[_0xa44de(0x1b5)]['localeCompare'](_0x46a606[_0xa44de(0x1b5)]));}export function profileExists(_0x230455){const _0x21a77a=a51_0x2dc202,_0x3dab7f=listProfiles();return _0x3dab7f[_0x21a77a(0x194)](_0x355221=>_0x355221['name']===_0x230455);}export function loadProfile(_0x4a2ea9){const _0x210081=a51_0x2dc202;validateProfileName(_0x4a2ea9);const _0x163388=listProfiles(),_0x3218fe=_0x163388[_0x210081(0x1cf)](_0x2d41be=>_0x2d41be[_0x210081(0x1b5)]===_0x4a2ea9);return _0x3218fe||null;}export function saveProfile(_0x46cf7d,_0x5929ee,_0x513403=![]){saveProfileToUserConfig(_0x46cf7d,_0x5929ee);}export function deleteProfile(_0x2b3e52){const _0x3240f3=a51_0x2dc202;validateProfileName(_0x2b3e52);const _0x14c54f=getProfileDir(_0x2b3e52);if(!a51_0x43f667[_0x3240f3(0x1cc)](_0x14c54f))throw new Error('Profile\x20'+_0x2b3e52+'\x20does\x20not\x20exist');a51_0x43f667[_0x3240f3(0x1c5)](_0x14c54f,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x10ff9c,_0x27fca2){const _0x68906d=a51_0x2dc202;validateProfileName(_0x10ff9c);const _0x1c31e5=getGlobalConfigPath(),_0x493837=getConfigDir();!a51_0x43f667[_0x68906d(0x1cc)](_0x493837)&&createSecureDirectory(_0x493837);let _0x55529f={};if(a51_0x43f667[_0x68906d(0x1cc)](_0x1c31e5))try{const _0x4d8eba=a51_0x43f667[_0x68906d(0x192)](_0x1c31e5,_0x68906d(0x1e3));_0x55529f=JSON[_0x68906d(0x1b8)](_0x4d8eba);}catch{console[_0x68906d(0x1c8)](_0x68906d(0x1aa)+_0x1c31e5+',\x20creating\x20new\x20file');}!_0x55529f[_0x68906d(0x1c7)]&&(_0x55529f[_0x68906d(0x1c7)]={}),_0x55529f[_0x68906d(0x1c7)][_0x10ff9c]=_0x27fca2,writeSecureFile(_0x1c31e5,JSON[_0x68906d(0x1b3)](_0x55529f,null,0x2));}export function removeProfileFromUserConfig(_0x1ac60d){const _0x2c2530=a51_0x2dc202;validateProfileName(_0x1ac60d);const _0x390832=getGlobalConfigPath();if(!a51_0x43f667[_0x2c2530(0x1cc)](_0x390832))throw new Error(_0x2c2530(0x19d)+_0x1ac60d+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x4233a5={};try{const _0x4758bb=a51_0x43f667['readFileSync'](_0x390832,_0x2c2530(0x1e3));_0x4233a5=JSON[_0x2c2530(0x1b8)](_0x4758bb);}catch{throw new Error(_0x2c2530(0x1c2)+_0x390832);}if(!_0x4233a5['profiles']||!_0x4233a5['profiles'][_0x1ac60d])throw new Error('Profile\x20\x27'+_0x1ac60d+_0x2c2530(0x196));delete _0x4233a5[_0x2c2530(0x1c7)][_0x1ac60d],_0x4233a5['profile']===_0x1ac60d&&delete _0x4233a5['profile'],writeSecureFile(_0x390832,JSON[_0x2c2530(0x1b3)](_0x4233a5,null,0x2));}export function getActiveProfile(){const _0x1a57ce=a51_0x2dc202,_0xe8a892=loadSessionContext();if(_0xe8a892?.[_0x1a57ce(0x1b2)])return _0xe8a892[_0x1a57ce(0x1b2)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x175f96=getGlobalConfigPath();if(!a51_0x43f667[_0x1a57ce(0x1cc)](_0x175f96))return null;try{const _0x554ac5=a51_0x43f667[_0x1a57ce(0x192)](_0x175f96,_0x1a57ce(0x1e3)),_0x974275=JSON[_0x1a57ce(0x1b8)](_0x554ac5);return _0x974275[_0x1a57ce(0x1b2)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x3f0067){const _0x5b0745=a51_0x2dc202,_0x154e63=getGlobalConfigPath(),_0x4aa437=getConfigDir();!a51_0x43f667[_0x5b0745(0x1cc)](_0x4aa437)&&createSecureDirectory(_0x4aa437);let _0x95e80f={};if(a51_0x43f667[_0x5b0745(0x1cc)](_0x154e63))try{const _0x37c045=a51_0x43f667['readFileSync'](_0x154e63,_0x5b0745(0x1e3));_0x95e80f=JSON[_0x5b0745(0x1b8)](_0x37c045);}catch{console[_0x5b0745(0x1c8)](_0x5b0745(0x1aa)+_0x154e63+_0x5b0745(0x1a1));}_0x95e80f['site']=_0x3f0067,writeSecureFile(_0x154e63,JSON[_0x5b0745(0x1b3)](_0x95e80f,null,0x2));}export function saveActiveProfileToUserConfig(_0x5c965e){const _0x20a80d=a51_0x2dc202;validateProfileName(_0x5c965e);const _0x57b3e7=getGlobalConfigPath(),_0x1f44ae=getConfigDir();!a51_0x43f667[_0x20a80d(0x1cc)](_0x1f44ae)&&createSecureDirectory(_0x1f44ae);let _0x2a481e={};if(a51_0x43f667[_0x20a80d(0x1cc)](_0x57b3e7))try{const _0x1573a8=a51_0x43f667[_0x20a80d(0x192)](_0x57b3e7,_0x20a80d(0x1e3));_0x2a481e=JSON[_0x20a80d(0x1b8)](_0x1573a8);}catch{console[_0x20a80d(0x1c8)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x57b3e7+_0x20a80d(0x1a1));}_0x2a481e['profile']=_0x5c965e,writeSecureFile(_0x57b3e7,JSON['stringify'](_0x2a481e,null,0x2));}function clearFieldFromUserConfig(_0x19ce62){const _0x51f790=a51_0x2dc202,_0x5003f4=getGlobalConfigPath();if(!a51_0x43f667['existsSync'](_0x5003f4))return;let _0x4debaf={};try{const _0x46f044=a51_0x43f667[_0x51f790(0x192)](_0x5003f4,_0x51f790(0x1e3));_0x4debaf=JSON['parse'](_0x46f044);}catch{return;}delete _0x4debaf[_0x19ce62],writeSecureFile(_0x5003f4,JSON[_0x51f790(0x1b3)](_0x4debaf,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x3a3390=a51_0x2dc202;clearFieldFromUserConfig(_0x3a3390(0x19a));}export function clearActiveProfileFromUserConfig(){const _0x5091ff=a51_0x2dc202;clearFieldFromUserConfig(_0x5091ff(0x1b2));}export function createProfile(_0x11e5a3,_0x26e9cd){const _0x310770=a51_0x2dc202;validateProfileName(_0x11e5a3);if(profileExists(_0x11e5a3))throw new Error(_0x310770(0x1db)+_0x11e5a3+_0x310770(0x193));saveProfile(_0x11e5a3,_0x26e9cd);}function a51_0x1ce8(_0x4b56ba,_0x3e1383){_0x4b56ba=_0x4b56ba-0x190;const _0x442b52=a51_0x442b();let _0x1ce86e=_0x442b52[_0x4b56ba];return _0x1ce86e;}export function saveProfileCredentials(_0x56654,_0x1db859){const _0x35eb20=a51_0x2dc202;validateProfileName(_0x56654);if(!profileExists(_0x56654))throw new Error(_0x35eb20(0x1db)+_0x56654+_0x35eb20(0x1b9));const _0x48b7d9=getNewCredentialPath(_0x56654);writeSecureFile(_0x48b7d9,_0x1db859);}export function loadProfileCredentials(_0x2c7e09){const _0x5deb5b=a51_0x2dc202;validateProfileName(_0x2c7e09);const _0x35e965=getNewCredentialPath(_0x2c7e09);if(a51_0x43f667[_0x5deb5b(0x1cc)](_0x35e965))try{return a51_0x43f667[_0x5deb5b(0x192)](_0x35e965,_0x5deb5b(0x1e3));}catch{}const _0x2cffc7=getOldCredentialPath(_0x2c7e09);if(a51_0x43f667[_0x5deb5b(0x1cc)](_0x2cffc7)){console[_0x5deb5b(0x1c8)](_0x5deb5b(0x1bc)+_0x2c7e09+'\x27'),console['warn'](_0x5deb5b(0x1a4)),console['warn'](_0x5deb5b(0x1ba)+_0x2cffc7+_0x5deb5b(0x1b0)+_0x35e965+'\x22'),console['warn'](_0x5deb5b(0x1a0));try{return a51_0x43f667['readFileSync'](_0x2cffc7,_0x5deb5b(0x1e3));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a52_0x4b0543=a52_0x1ac9;(function(_0x323a19,_0x155eea){const _0x56e4be=a52_0x1ac9,_0x3b45a8=_0x323a19();while(!![]){try{const _0x1b5aff=-parseInt(_0x56e4be(0x1b6))/0x1+-parseInt(_0x56e4be(0x1b3))/0x2+parseInt(_0x56e4be(0x1ac))/0x3+-parseInt(_0x56e4be(0x1be))/0x4+parseInt(_0x56e4be(0x1b7))/0x5*(-parseInt(_0x56e4be(0x1bd))/0x6)+-parseInt(_0x56e4be(0x1bb))/0x7+-parseInt(_0x56e4be(0x1ae))/0x8*(-parseInt(_0x56e4be(0x1af))/0x9);if(_0x1b5aff===_0x155eea)break;else _0x3b45a8['push'](_0x3b45a8['shift']());}catch(_0x34e41c){_0x3b45a8['push'](_0x3b45a8['shift']());}}}(a52_0x4f04,0xede84));import*as a52_0x4a5875 from'node:fs';import*as a52_0x41ffb5 from'node:path';function a52_0x1ac9(_0x5cb4cf,_0x5e23c3){_0x5cb4cf=_0x5cb4cf-0x1ac;const _0x4f0419=a52_0x4f04();let _0x1ac9fc=_0x4f0419[_0x5cb4cf];return _0x1ac9fc;}const PROJECT_CONFIG_FILENAME=a52_0x4b0543(0x1ca);export function findProjectConfigPath(_0x248c6f){const _0x4f4d32=a52_0x4b0543;let _0x2b36f4=_0x248c6f||process[_0x4f4d32(0x1b4)]();while(!![]){const _0x18d325=a52_0x41ffb5[_0x4f4d32(0x1c4)](_0x2b36f4,PROJECT_CONFIG_FILENAME);if(a52_0x4a5875['existsSync'](_0x18d325))return _0x18d325;const _0x2ea848=a52_0x41ffb5[_0x4f4d32(0x1c3)](_0x2b36f4);if(_0x2ea848===_0x2b36f4)return null;_0x2b36f4=_0x2ea848;}}export function loadProjectConfig(_0x2edd18){const _0x2e5e58=a52_0x4b0543,_0x5f5012=findProjectConfigPath(_0x2edd18);if(!_0x5f5012)return null;try{const _0x4a0535=a52_0x4a5875[_0x2e5e58(0x1b1)](_0x5f5012,_0x2e5e58(0x1c7)),_0x464578=JSON[_0x2e5e58(0x1c6)](_0x4a0535),_0x237903=JSON[_0x2e5e58(0x1c8)](_0x464578);if(_0x237903[_0x2e5e58(0x1c5)]('TD_API_KEY')||_0x237903['includes'](_0x2e5e58(0x1c1))||_0x237903[_0x2e5e58(0x1c5)](_0x2e5e58(0x1bf)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x5f5012+_0x2e5e58(0x1b9)+_0x2e5e58(0x1b2));const {metadata:_0x1cb45e,profile:_0x4b6319,..._0x31d245}=_0x464578;return _0x4b6319&&console['warn'](_0x2e5e58(0x1ba)+_0x5f5012+_0x2e5e58(0x1b8)+_0x2e5e58(0x1c2)),_0x31d245;}catch(_0x1016fc){if(_0x1016fc instanceof Error&&_0x2e5e58(0x1b5)in _0x1016fc&&_0x1016fc[_0x2e5e58(0x1b5)]===_0x2e5e58(0x1bc))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x5f5012+':\x20'+_0x1016fc);}}export function saveProjectConfig(_0x4cf6fb,_0x22290b){const _0x7ac1f2=a52_0x4b0543,_0x53a0b7=_0x22290b||process[_0x7ac1f2(0x1b4)](),_0x185b2a=a52_0x41ffb5[_0x7ac1f2(0x1c4)](_0x53a0b7,PROJECT_CONFIG_FILENAME),_0xc24550=JSON[_0x7ac1f2(0x1c8)](_0x4cf6fb);if(_0xc24550[_0x7ac1f2(0x1c5)](_0x7ac1f2(0x1c0))||_0xc24550[_0x7ac1f2(0x1c5)](_0x7ac1f2(0x1c1))||_0xc24550[_0x7ac1f2(0x1c5)]('api_key'))throw new Error(_0x7ac1f2(0x1ad));if(_0x7ac1f2(0x1b0)in _0x4cf6fb)throw new Error(_0x7ac1f2(0x1c9));a52_0x4a5875['writeFileSync'](_0x185b2a,JSON[_0x7ac1f2(0x1c8)](_0x4cf6fb,null,0x2));}function a52_0x4f04(){const _0x5792c1=['stringify','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','tdx.json','3112902EkapAx','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','344SOLnzw','1325871WvUkKu','profile','readFileSync','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','2943472eqZgpd','cwd','code','1903595nhgBHx','3470npTbxj','\x20is\x20ignored.\x20',').\x20','Warning:\x20\x27profile\x27\x20field\x20in\x20','8332583WuTOYd','ENOENT','5598UxAScF','4738724oKmNUK','api_key','TD_API_KEY','apiKey','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','dirname','join','includes','parse','utf-8'];a52_0x4f04=function(){return _0x5792c1;};return a52_0x4f04();}export function hasProjectConfig(_0x1f0da9){return findProjectConfigPath(_0x1f0da9)!==null;}export function getProjectRoot(_0x3186f4){const _0x2d7398=a52_0x4b0543,_0x2e0f1d=findProjectConfigPath(_0x3186f4);return _0x2e0f1d?a52_0x41ffb5[_0x2d7398(0x1c3)](_0x2e0f1d):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x16db78,_0x3530a4){const _0x32d533=a53_0x1b30,_0x1a6a20=_0x16db78();while(!![]){try{const _0x2d1058=-parseInt(_0x32d533(0x16f))/0x1+parseInt(_0x32d533(0x156))/0x2+-parseInt(_0x32d533(0x14e))/0x3+-parseInt(_0x32d533(0x150))/0x4*(parseInt(_0x32d533(0x170))/0x5)+parseInt(_0x32d533(0x15a))/0x6*(-parseInt(_0x32d533(0x16d))/0x7)+parseInt(_0x32d533(0x153))/0x8*(parseInt(_0x32d533(0x172))/0x9)+parseInt(_0x32d533(0x163))/0xa*(parseInt(_0x32d533(0x169))/0xb);if(_0x2d1058===_0x3530a4)break;else _0x1a6a20['push'](_0x1a6a20['shift']());}catch(_0x1f8e7e){_0x1a6a20['push'](_0x1a6a20['shift']());}}}(a53_0x1e29,0xed836));function a53_0x1b30(_0x54cd7d,_0x36c2d5){_0x54cd7d=_0x54cd7d-0x14e;const _0x1e29db=a53_0x1e29();let _0x1b309c=_0x1e29db[_0x54cd7d];return _0x1b309c;}import*as a53_0x528480 from'node:fs';import*as a53_0x12a6a9 from'node:path';import*as a53_0x41abdb from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x2c7d72=a53_0x1b30,_0x457e9b=process.env.TDX_CONFIG_DIR||a53_0x12a6a9[_0x2c7d72(0x160)](a53_0x41abdb[_0x2c7d72(0x155)](),'.config','tdx');return a53_0x12a6a9['join'](_0x457e9b,_0x2c7d72(0x164));}function getSessionPath(_0xec5583){const _0x2fc746=a53_0x1b30;return a53_0x12a6a9[_0x2fc746(0x160)](getSessionsDir(),_0xec5583+_0x2fc746(0x168));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x4bf408){const _0x53303c=a53_0x1b30;if(_0x4bf408)return _0x4bf408;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x53303c(0x174)]();}export function loadSessionContext(_0x45638a){const _0x3c99b2=a53_0x1b30,_0x276c50=getSessionID(_0x45638a),_0x55ab24=/^\d+$/[_0x3c99b2(0x158)](_0x276c50)?parseInt(_0x276c50,0xa):null;return _0x55ab24!==null?loadSessionContextByPID(_0x55ab24):loadSessionContextByString(_0x276c50);}export function loadSessionContextByPID(_0x490285){const _0x1c2a93=a53_0x1b30,_0x2a8586=getSessionPath(_0x490285);if(!a53_0x528480[_0x1c2a93(0x16c)](_0x2a8586))return null;try{const _0x3a7d88=a53_0x528480[_0x1c2a93(0x159)](_0x2a8586,_0x1c2a93(0x173)),_0x3dc05b=JSON[_0x1c2a93(0x16e)](_0x3a7d88),_0x25f5f5=new Date(_0x3dc05b['createdAt'])[_0x1c2a93(0x15e)](),_0x30311e=Date[_0x1c2a93(0x152)]();if(_0x30311e-_0x25f5f5>SESSION_EXPIRATION_MS)return a53_0x528480[_0x1c2a93(0x167)](_0x2a8586),null;const _0x29ef26=JSON['stringify'](_0x3dc05b);if(_0x29ef26[_0x1c2a93(0x162)](_0x1c2a93(0x166))||_0x29ef26[_0x1c2a93(0x162)]('apiKey')||_0x29ef26[_0x1c2a93(0x162)](_0x1c2a93(0x15c)))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x2a8586+_0x1c2a93(0x15f)),a53_0x528480[_0x1c2a93(0x167)](_0x2a8586),null;return _0x3dc05b;}catch{try{a53_0x528480['unlinkSync'](_0x2a8586);}catch{}return null;}}function a53_0x1e29(){const _0x411931=['apiKey','existsSync','70yNyPJt','parse','214718RpwkBH','265yYGSQG','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','1818FSOxac','utf-8','toString','2864862xYwMZE','toISOString','141172vEwEYD','replace','now','50584ExYXeP','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','homedir','1951320XHjADu','push','test','readFileSync','668394eMCWZi','readdirSync','api_key','sort','getTime','.\x20This\x20is\x20insecure.\x20Removing\x20session.','join','stringify','includes','170YfKoUi','sessions','endsWith','TD_API_KEY','unlinkSync','.json','1859737eVaegO','warn'];a53_0x1e29=function(){return _0x411931;};return a53_0x1e29();}function loadSessionContextByString(_0x23fde7){const _0x227e8b=a53_0x1b30,_0x3e7d1e=a53_0x12a6a9[_0x227e8b(0x160)](getSessionsDir(),_0x23fde7+_0x227e8b(0x168));if(!a53_0x528480[_0x227e8b(0x16c)](_0x3e7d1e))return null;try{const _0x2991bd=a53_0x528480[_0x227e8b(0x159)](_0x3e7d1e,_0x227e8b(0x173)),_0x316c52=JSON[_0x227e8b(0x16e)](_0x2991bd),_0x1a17eb=new Date(_0x316c52['createdAt'])['getTime'](),_0x5ca7d2=Date[_0x227e8b(0x152)]();if(_0x5ca7d2-_0x1a17eb>SESSION_EXPIRATION_MS)return a53_0x528480[_0x227e8b(0x167)](_0x3e7d1e),null;const _0x5ac3cf=JSON['stringify'](_0x316c52);if(_0x5ac3cf[_0x227e8b(0x162)](_0x227e8b(0x166))||_0x5ac3cf[_0x227e8b(0x162)]('apiKey')||_0x5ac3cf[_0x227e8b(0x162)](_0x227e8b(0x15c)))return console[_0x227e8b(0x16a)](_0x227e8b(0x171)+_0x3e7d1e+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a53_0x528480[_0x227e8b(0x167)](_0x3e7d1e),null;return _0x316c52;}catch{try{a53_0x528480[_0x227e8b(0x167)](_0x3e7d1e);}catch{}return null;}}export function saveSessionContext(_0x3c8537,_0x39042e){const _0x22b956=a53_0x1b30,_0x3522ed=getSessionID(_0x39042e),_0x30ab83=/^\d+$/[_0x22b956(0x158)](_0x3522ed)?parseInt(_0x3522ed,0xa):getCurrentSessionPID(),_0x1780c0=a53_0x12a6a9['join'](getSessionsDir(),_0x3522ed+'.json'),_0x1e9297=getSessionsDir();createSecureDirectory(_0x1e9297);const _0x36042c=JSON[_0x22b956(0x161)](_0x3c8537);if(_0x36042c[_0x22b956(0x162)]('TD_API_KEY')||_0x36042c[_0x22b956(0x162)](_0x22b956(0x16b))||_0x36042c[_0x22b956(0x162)](_0x22b956(0x15c)))throw new Error(_0x22b956(0x154));let _0x58094a;const _0x44dd63=/^\d+$/[_0x22b956(0x158)](_0x3522ed)?loadSessionContextByPID(parseInt(_0x3522ed,0xa)):loadSessionContextByString(_0x3522ed);_0x44dd63?_0x58094a={..._0x44dd63,..._0x3c8537,'pid':_0x30ab83,'sessionId':_0x3522ed!==_0x30ab83['toString']()?_0x3522ed:undefined,'updatedAt':new Date()[_0x22b956(0x14f)]()}:_0x58094a={'pid':_0x30ab83,'sessionId':_0x3522ed!==_0x30ab83[_0x22b956(0x174)]()?_0x3522ed:undefined,..._0x3c8537,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x22b956(0x14f)]()},a53_0x528480['writeFileSync'](_0x1780c0,JSON['stringify'](_0x58094a,null,0x2));}export function clearSessionContext(_0x17d969){const _0x21926a=a53_0x1b30,_0x22d3b0=getSessionID(_0x17d969),_0x61a1f7=a53_0x12a6a9['join'](getSessionsDir(),_0x22d3b0+_0x21926a(0x168));a53_0x528480[_0x21926a(0x16c)](_0x61a1f7)&&a53_0x528480['unlinkSync'](_0x61a1f7);}export function clearSessionContextField(_0x3ff6bf,_0x4eaee0){const _0x1f4b2a=a53_0x1b30,_0x3bdcc9=getSessionID(_0x4eaee0),_0x190041=a53_0x12a6a9[_0x1f4b2a(0x160)](getSessionsDir(),_0x3bdcc9+_0x1f4b2a(0x168));if(!a53_0x528480[_0x1f4b2a(0x16c)](_0x190041))return;try{const _0x38e2d1=a53_0x528480[_0x1f4b2a(0x159)](_0x190041,_0x1f4b2a(0x173)),_0x159d89=JSON[_0x1f4b2a(0x16e)](_0x38e2d1);delete _0x159d89[_0x3ff6bf],a53_0x528480['writeFileSync'](_0x190041,JSON['stringify'](_0x159d89,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x59bc75=a53_0x1b30,_0xc7ddc8=getSessionsDir();if(!a53_0x528480[_0x59bc75(0x16c)](_0xc7ddc8))return 0x0;let _0xb2c179=0x0;const _0x5cf65a=Date['now']();try{const _0x5a1a17=a53_0x528480[_0x59bc75(0x15b)](_0xc7ddc8);for(const _0x4c72d3 of _0x5a1a17){if(!_0x4c72d3[_0x59bc75(0x165)](_0x59bc75(0x168)))continue;const _0xa8dde3=a53_0x12a6a9[_0x59bc75(0x160)](_0xc7ddc8,_0x4c72d3),_0x1e149a=_0x4c72d3[_0x59bc75(0x151)](_0x59bc75(0x168),''),_0x35136d=parseInt(_0x1e149a,0xa),_0x1e44aa=!isNaN(_0x35136d);if(_0x1e44aa){if(!isProcessRunning(_0x35136d)){a53_0x528480[_0x59bc75(0x167)](_0xa8dde3),_0xb2c179++;continue;}}try{const _0x51329d=a53_0x528480[_0x59bc75(0x159)](_0xa8dde3,_0x59bc75(0x173)),_0x392c6b=JSON[_0x59bc75(0x16e)](_0x51329d),_0x15f198=new Date(_0x392c6b['createdAt'])['getTime']();_0x5cf65a-_0x15f198>SESSION_EXPIRATION_MS&&(a53_0x528480[_0x59bc75(0x167)](_0xa8dde3),_0xb2c179++);}catch{a53_0x528480[_0x59bc75(0x167)](_0xa8dde3),_0xb2c179++;}}}catch{}return _0xb2c179;}export function listActiveSessions(){const _0x1590f5=a53_0x1b30,_0x14ee16=getSessionsDir();if(!a53_0x528480[_0x1590f5(0x16c)](_0x14ee16))return[];try{const _0x4fa483=a53_0x528480[_0x1590f5(0x15b)](_0x14ee16),_0x4e2976=[];for(const _0x5f0655 of _0x4fa483){if(!_0x5f0655[_0x1590f5(0x165)](_0x1590f5(0x168)))continue;const _0x1ba9f7=_0x5f0655[_0x1590f5(0x151)](_0x1590f5(0x168),''),_0x4f05dc=parseInt(_0x1ba9f7,0xa);!isNaN(_0x4f05dc)&&isProcessRunning(_0x4f05dc)&&_0x4e2976[_0x1590f5(0x157)](_0x4f05dc);}return _0x4e2976[_0x1590f5(0x15d)]((_0x55e6d4,_0xc33f9d)=>_0x55e6d4-_0xc33f9d);}catch{return[];}}
|
package/dist/core/user-cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a54_0x404597=a54_0x9171;(function(_0x5263e0,_0x511786){const _0x5330f6=a54_0x9171,_0xc23507=_0x5263e0();while(!![]){try{const _0x4d9ef8=parseInt(_0x5330f6(0xd0))/0x1+parseInt(_0x5330f6(0xc7))/0x2+parseInt(_0x5330f6(0xcb))/0x3*(parseInt(_0x5330f6(0xc6))/0x4)+-parseInt(_0x5330f6(0xc8))/0x5+parseInt(_0x5330f6(0xcc))/0x6*(parseInt(_0x5330f6(0xd4))/0x7)+parseInt(_0x5330f6(0xcf))/0x8*(parseInt(_0x5330f6(0xd2))/0x9)+-parseInt(_0x5330f6(0xcd))/0xa;if(_0x4d9ef8===_0x511786)break;else _0xc23507['push'](_0xc23507['shift']());}catch(_0x1dbbc7){_0xc23507['push'](_0xc23507['shift']());}}}(a54_0x405a,0xe33cc));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0x404597(0xce),'core/user-cache');function a54_0x9171(_0x39c682,_0x739276){_0x39c682=_0x39c682-0xc5;const _0x405a17=a54_0x405a();let _0x9171ab=_0x405a17[_0x39c682];return _0x9171ab;}export function loadCachedUsers(_0x26e42f){const _0x4b34fa=a54_0x404597,_0x3f382e=userCache[_0x4b34fa(0xd3)](_0x26e42f);return _0x3f382e?.[_0x4b34fa(0xca)]??null;}export function saveCachedUsers(_0x385051,_0x1afbef){const _0x468482=a54_0x404597;userCache[_0x468482(0xc9)](_0x385051,{'users':_0x1afbef,'cachedAt':Date[_0x468482(0xc5)]()});}export function clearUserCache(_0x3acccd){const _0x3a660c=a54_0x404597;userCache[_0x3a660c(0xd1)](_0x3acccd);}function a54_0x405a(){const _0x3bf2f1=['2674346SKWDHG','7596080jeRoqB','write','users','333516kEhOVv','12cThqhE','10079060xbvddh','users-{profile}.json','3470928WSytHh','1297723umQmhu','clear','9xDDDOM','read','194628DyPZhD','now','12rqjMQe'];a54_0x405a=function(){return _0x3bf2f1;};return a54_0x405a();}
|
package/dist/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x14ccdc,_0x460f7e){const _0x13b9ff=a55_0xb89b,_0x136282=_0x14ccdc();while(!![]){try{const _0x1584ff=-parseInt(_0x13b9ff(0x142))/0x1+parseInt(_0x13b9ff(0x140))/0x2*(-parseInt(_0x13b9ff(0x146))/0x3)+-parseInt(_0x13b9ff(0x147))/0x4+parseInt(_0x13b9ff(0x148))/0x5+-parseInt(_0x13b9ff(0x14c))/0x6+-parseInt(_0x13b9ff(0x143))/0x7+parseInt(_0x13b9ff(0x14b))/0x8;if(_0x1584ff===_0x460f7e)break;else _0x136282['push'](_0x136282['shift']());}catch(_0x4f7bfb){_0x136282['push'](_0x136282['shift']());}}}(a55_0x3566,0x32c97));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x4d1fcc=a55_0xb89b;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x18f850=fileURLToPath(import.meta.url),_0x7a0859=dirname(_0x18f850);try{const _0x2a71dc=join(_0x7a0859,'../build-info.json');cachedBuildInfo=JSON[_0x4d1fcc(0x13f)](readFileSync(_0x2a71dc,_0x4d1fcc(0x149)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x3b431f=a55_0xb89b;if(cachedVersion!==null)return cachedVersion;const _0x1a9b98=fileURLToPath(import.meta.url),_0x198eca=dirname(_0x1a9b98),_0x20f742=getBuildInfo();if(_0x20f742['version'])return cachedVersion=_0x20f742['version'],cachedVersion;try{const _0x114302=join(_0x198eca,_0x3b431f(0x14a)),_0x1eeaf1=JSON['parse'](readFileSync(_0x114302,'utf-8'));cachedVersion=_0x1eeaf1[_0x3b431f(0x145)];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x37c0c8=a55_0xb89b,_0x208f71=getVersion();return _0x208f71[_0x37c0c8(0x141)](_0x37c0c8(0x144))||_0x208f71[_0x37c0c8(0x141)]('-');}function a55_0xb89b(_0x1dc2c7,_0x3fdd77){_0x1dc2c7=_0x1dc2c7-0x13f;const _0x356618=a55_0x3566();let _0xb89bcb=_0x356618[_0x1dc2c7];return _0xb89bcb;}function a55_0x3566(){const _0x2ccb51=['parse','118ieYcWg','includes','351487wEuFAu','2428482UZmoYd','.dev','version','5859XzPrvp','1658660oXFsDp','1296745eTPREu','utf-8','../../package.json','10194704avaTJB','584154CAnTiB'];a55_0x3566=function(){return _0x2ccb51;};return a55_0x3566();}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2dc596,_0x4d0dba){var _0x2a316f=a56_0x31a1,_0x6f437=_0x2dc596();while(!![]){try{var _0x238d27=-parseInt(_0x2a316f(0x18e))/0x1*(-parseInt(_0x2a316f(0x18a))/0x2)+parseInt(_0x2a316f(0x18b))/0x3+-parseInt(_0x2a316f(0x189))/0x4*(parseInt(_0x2a316f(0x18c))/0x5)+-parseInt(_0x2a316f(0x193))/0x6+parseInt(_0x2a316f(0x192))/0x7*(-parseInt(_0x2a316f(0x18d))/0x8)+parseInt(_0x2a316f(0x191))/0x9+parseInt(_0x2a316f(0x18f))/0xa*(-parseInt(_0x2a316f(0x190))/0xb);if(_0x238d27===_0x4d0dba)break;else _0x6f437['push'](_0x6f437['shift']());}catch(_0x390d3d){_0x6f437['push'](_0x6f437['shift']());}}}(a56_0x1550,0x73162));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';function a56_0x1550(){var _0x239840=['2669631jkKpDI','5SbxlFF','1174240Cnamay','149JMryjn','95710hnIXqP','11lCKESM','1014345OIaigc','35sAGrTW','1539210megklS','466412OMbqnI','7858EPzQmi'];a56_0x1550=function(){return _0x239840;};return a56_0x1550();}export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';function a56_0x31a1(_0xc97b18,_0x4c0218){_0xc97b18=_0xc97b18-0x189;var _0x1550cd=a56_0x1550();var _0x31a1fa=_0x1550cd[_0xc97b18];return _0x31a1fa;}export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
|
package/dist/mcp/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a57_0x3c3f(_0x5264ff,_0x1d766b){_0x5264ff=_0x5264ff-0x156;const _0x5e26fa=a57_0x5e26();let _0x3c3f67=_0x5e26fa[_0x5264ff];return _0x3c3f67;}(function(_0x32a201,_0x46b45b){const _0x2327cf=a57_0x3c3f,_0x9daecb=_0x32a201();while(!![]){try{const _0x1143d6=-parseInt(_0x2327cf(0x16e))/0x1*(-parseInt(_0x2327cf(0x15b))/0x2)+parseInt(_0x2327cf(0x166))/0x3+-parseInt(_0x2327cf(0x160))/0x4+parseInt(_0x2327cf(0x17d))/0x5+-parseInt(_0x2327cf(0x16b))/0x6*(parseInt(_0x2327cf(0x165))/0x7)+parseInt(_0x2327cf(0x158))/0x8+parseInt(_0x2327cf(0x167))/0x9*(-parseInt(_0x2327cf(0x173))/0xa);if(_0x1143d6===_0x46b45b)break;else _0x9daecb['push'](_0x9daecb['shift']());}catch(_0x5d178d){_0x9daecb['push'](_0x9daecb['shift']());}}}(a57_0x5e26,0x2aeef));function a57_0x5e26(){const _0x14ac62=['examples','registerTool','**\x20(','join','text','tdx_run','Execute\x20any\x20tdx\x20CLI\x20command.\x20Returns\x20JSON\x20output.\x0a\x0aExamples:\x0a-\x20List\x20databases:\x20{\x22args\x22:\x20[\x22databases\x22]}\x0a-\x20Run\x20SQL\x20query:\x20{\x22args\x22:\x20[\x22query\x22,\x20\x22SELECT\x20*\x20FROM\x20mydb.users\x20LIMIT\x2010\x22]}\x0a-\x20List\x20segments:\x20{\x22args\x22:\x20[\x22segments\x22,\x20\x22--recursive\x22]}\x0a-\x20Show\x20job\x20details:\x20{\x22args\x22:\x20[\x22job\x22,\x20\x22show\x22,\x20\x2212345\x22]}\x0a-\x20List\x20tables:\x20{\x22args\x22:\x20[\x22tables\x22,\x20\x22mydb.*\x22]}\x0a\x0aNote:\x20Some\x20commands\x20(auth,\x20profile\x20management,\x20mcp)\x20are\x20blocked\x20for\x20security.','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','695335HNGzVu','close','CDP','tdx','string','success','2603776HfqmIM','enum','Command\x20completed\x20successfully','6434UWBYjj','1.0.0','stdin','Command\x20failed','Utilities','531372cGTsfP','map','length','optional','output','157402rPmBQV','182298BmqXMc','244206TSATPJ','Search\x20for\x20relevant\x20tdx\x20commands\x20based\x20on\x20what\x20you\x20want\x20to\x20do.\x0a\x0aExamples:\x0a-\x20{\x22query\x22:\x20\x22how\x20to\x20run\x20SQL\x20queries\x22}\x0a-\x20{\x22query\x22:\x20\x22list\x20databases\x20and\x20tables\x22}\x0a-\x20{\x22query\x22:\x20\x22manage\x20customer\x20segments\x22,\x20\x22category\x22:\x20\x22CDP\x22}\x0a-\x20{\x22query\x22:\x20\x22workflow\x20logs\x22}\x0a\x0aCategories:\x20Data,\x20CDP,\x20AI,\x20Context,\x20Utilities\x0a\x0aReturns\x20matching\x20commands\x20with\x20descriptions\x20and\x20example\x20usage.','SIGTERM','once','60OHlLlc','Data','category','11CYLEip','Optional\x20filter\x20by\x20category','SIGINT','describe','connect','10Zvbujd','description'];a57_0x5e26=function(){return _0x14ac62;};return a57_0x5e26();}import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x5e51dd={}){const _0x58cacf=a57_0x3c3f,_0x4f76d6=new McpServer({'name':_0x58cacf(0x180),'version':_0x58cacf(0x15c)});return _0x4f76d6[_0x58cacf(0x176)](_0x58cacf(0x17a),{'description':_0x58cacf(0x17b),'inputSchema':{'args':z['array'](z[_0x58cacf(0x156)]())[_0x58cacf(0x171)]('Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])')}},async({args:_0x10c6e1})=>{const _0x534353=_0x58cacf,_0x58f866=await executeTdxRun({'args':_0x10c6e1},_0x5e51dd['env']||{});return _0x58f866[_0x534353(0x157)]?{'content':[{'type':_0x534353(0x179),'text':_0x58f866[_0x534353(0x164)]||_0x534353(0x15a)}]}:{'content':[{'type':_0x534353(0x179),'text':_0x58f866['error']||_0x58f866[_0x534353(0x164)]||_0x534353(0x15e)}],'isError':!![]};}),_0x4f76d6[_0x58cacf(0x176)]('tdx_search',{'description':_0x58cacf(0x168),'inputSchema':{'query':z[_0x58cacf(0x156)]()['describe'](_0x58cacf(0x17c)),'category':z[_0x58cacf(0x159)]([_0x58cacf(0x16c),_0x58cacf(0x17f),'AI','Context',_0x58cacf(0x15f)])[_0x58cacf(0x163)]()['describe'](_0x58cacf(0x16f))}},async({query:_0x32217e,category:_0x32ec65})=>{const _0xa75c8f=_0x58cacf,_0x281658=searchCommands({'query':_0x32217e,'category':_0x32ec65});if(_0x281658[_0xa75c8f(0x162)]===0x0)return{'content':[{'type':_0xa75c8f(0x179),'text':'No\x20commands\x20found\x20matching\x20\x22'+_0x32217e+'\x22'}]};const _0x46490c=_0x281658[_0xa75c8f(0x161)](_0x5ac274=>{const _0x52eb5a=_0xa75c8f,_0x1f75bf=_0x5ac274[_0x52eb5a(0x175)][_0x52eb5a(0x161)](_0x2643ef=>'\x20\x20'+_0x2643ef)[_0x52eb5a(0x178)]('\x0a');return'**'+_0x5ac274['name']+_0x52eb5a(0x177)+_0x5ac274[_0x52eb5a(0x16d)]+')\x0a'+_0x5ac274[_0x52eb5a(0x174)]+'\x0a\x0aExamples:\x0a'+_0x1f75bf;})['join']('\x0a\x0a---\x0a\x0a');return{'content':[{'type':'text','text':_0x46490c}]};}),_0x4f76d6;}export async function startMCPServer(_0x206346={}){const _0x2ce855=a57_0x3c3f,_0x4a9117=createMCPServer(_0x206346),_0x5596c7=new StdioServerTransport();return await _0x4a9117[_0x2ce855(0x172)](_0x5596c7),new Promise(_0x27f72d=>{const _0x1cc287=_0x2ce855;let _0x1dd477=![];const _0x5089bb=async()=>{const _0x363804=a57_0x3c3f;if(_0x1dd477)return;_0x1dd477=!![],await _0x4a9117[_0x363804(0x17e)](),_0x27f72d();};process[_0x1cc287(0x16a)](_0x1cc287(0x170),_0x5089bb),process[_0x1cc287(0x16a)](_0x1cc287(0x169),_0x5089bb),process[_0x1cc287(0x15d)][_0x1cc287(0x16a)]('close',_0x5089bb);});}
|
package/dist/mcp/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a58_0x36d7(_0x5dc739,_0x50a272){_0x5dc739=_0x5dc739-0x185;var _0x13f151=a58_0x13f1();var _0x36d7d4=_0x13f151[_0x5dc739];return _0x36d7d4;}(function(_0x48ad8d,_0x1c6330){var _0x3a7a94=a58_0x36d7,_0x45b027=_0x48ad8d();while(!![]){try{var _0x348f1e=-parseInt(_0x3a7a94(0x187))/0x1*(-parseInt(_0x3a7a94(0x18a))/0x2)+parseInt(_0x3a7a94(0x189))/0x3+-parseInt(_0x3a7a94(0x18e))/0x4*(parseInt(_0x3a7a94(0x18d))/0x5)+-parseInt(_0x3a7a94(0x185))/0x6+parseInt(_0x3a7a94(0x188))/0x7+parseInt(_0x3a7a94(0x186))/0x8*(parseInt(_0x3a7a94(0x18c))/0x9)+-parseInt(_0x3a7a94(0x18b))/0xa;if(_0x348f1e===_0x1c6330)break;else _0x45b027['push'](_0x45b027['shift']());}catch(_0x1685d3){_0x45b027['push'](_0x45b027['shift']());}}}(a58_0x13f1,0xe50e9));function a58_0x13f1(){var _0x5e116c=['120nNWRhi','125328pvuLYA','2683770zsDzOI','103856YOLxBx','19fNXrTr','1487822SIZBNH','2735280hnFRYn','126748cBcaJF','8270500EHfjku','441MdMlAY'];a58_0x13f1=function(){return _0x5e116c;};return a58_0x13f1();}export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a59_0x42ed02=a59_0x353c;(function(_0x56ff73,_0x1b3a89){const _0x4a9c62=a59_0x353c,_0x3483a6=_0x56ff73();while(!![]){try{const _0x35c287=parseInt(_0x4a9c62(0x12d))/0x1+-parseInt(_0x4a9c62(0x121))/0x2*(parseInt(_0x4a9c62(0x124))/0x3)+-parseInt(_0x4a9c62(0x127))/0x4+-parseInt(_0x4a9c62(0x126))/0x5*(parseInt(_0x4a9c62(0x125))/0x6)+-parseInt(_0x4a9c62(0x111))/0x7*(-parseInt(_0x4a9c62(0x116))/0x8)+parseInt(_0x4a9c62(0x110))/0x9*(-parseInt(_0x4a9c62(0x11d))/0xa)+-parseInt(_0x4a9c62(0x10e))/0xb*(-parseInt(_0x4a9c62(0x117))/0xc);if(_0x35c287===_0x1b3a89)break;else _0x3483a6['push'](_0x3483a6['shift']());}catch(_0x4bbf25){_0x3483a6['push'](_0x3483a6['shift']());}}}(a59_0x57be,0xe5a23));function a59_0x353c(_0x2ee839,_0x5344fd){_0x2ee839=_0x2ee839-0x10e;const _0x57befb=a59_0x57be();let _0x353c28=_0x57befb[_0x2ee839];return _0x353c28;}import{spawn}from'child_process';import{dirname,join}from'path';import{existsSync}from'fs';import{z}from'zod';function a59_0x57be(){const _0xeff37e=['646641nohBbF','7MxcGLQ','kill','node','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','data','1798744MWztoE','665400jyGocH','message','PATH','toString','stderr','close','90zNovLe','platform','--json','error','4zcIssI','describe','win32','197277ANYPDk','42198lZTnfE','1105sCmcXU','2565784xdpJJb','string','pipe','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','Failed\x20to\x20spawn\x20tdx:\x20','node.exe','418084yXFClG','true','stdout','649kpbVQq','SIGTERM'];a59_0x57be=function(){return _0xeff37e;};return a59_0x57be();}import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z['object']({'args':z['array'](z[a59_0x42ed02(0x128)]())[a59_0x42ed02(0x122)](a59_0x42ed02(0x12a))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function getNodeBinDir(){const _0x1f4737=a59_0x42ed02,_0x413b40=process['resourcesPath'];if(_0x413b40){const _0x11cc0d=join(_0x413b40,_0x1f4737(0x113)),_0x23bf21=process['platform']==='win32'?_0x1f4737(0x12c):_0x1f4737(0x113);if(existsSync(join(_0x11cc0d,_0x23bf21)))return _0x11cc0d;}return dirname(process['execPath']);}export async function executeTdxRun(_0x8067d,_0x5a3adc){const _0x3e70bc=a59_0x42ed02,{args:_0x44210f}=_0x8067d;if(isBlockedCommand(_0x44210f)){const _0x2965f5=getBlockedReason(_0x44210f);return{'success':![],'output':'','error':_0x2965f5||_0x3e70bc(0x114),'exitCode':0x1};}const _0x3fb1f1=[_0x3e70bc(0x11f),'--no-color',..._0x44210f],_0x2acbe7=getNodeBinDir(),_0x172a58=process[_0x3e70bc(0x11e)]===_0x3e70bc(0x123)?';':':',_0x55f2dd=_0x5a3adc[_0x3e70bc(0x119)]??process.env.PATH??'',_0x242a42=''+_0x2acbe7+_0x172a58+_0x55f2dd;return new Promise(_0x21b5b3=>{const _0xe007ff=_0x3e70bc,_0x44fbb1=spawn('tdx',_0x3fb1f1,{'env':{...process.env,..._0x5a3adc,'PATH':_0x242a42,'CI':_0xe007ff(0x12e)},'stdio':['ignore',_0xe007ff(0x129),'pipe']});let _0x1c09b1='',_0x5b3fb5='',_0x4e037d=![];const _0x11b07c=setTimeout(()=>{const _0x3934ae=_0xe007ff;_0x4e037d=!![],_0x44fbb1[_0x3934ae(0x112)](_0x3934ae(0x10f));},DEFAULT_TIMEOUT_MS);_0x44fbb1[_0xe007ff(0x12f)]['on'](_0xe007ff(0x115),_0x2bf4dd=>{const _0x15afbc=_0xe007ff;_0x1c09b1+=_0x2bf4dd[_0x15afbc(0x11a)]();}),_0x44fbb1[_0xe007ff(0x11b)]['on'](_0xe007ff(0x115),_0x24838a=>{_0x5b3fb5+=_0x24838a['toString']();}),_0x44fbb1['on'](_0xe007ff(0x120),_0x28e233=>{const _0x5bb377=_0xe007ff;clearTimeout(_0x11b07c),_0x21b5b3({'success':![],'output':'','error':_0x5bb377(0x12b)+_0x28e233[_0x5bb377(0x118)],'exitCode':0x1});}),_0x44fbb1['on'](_0xe007ff(0x11c),_0x3e90f8=>{clearTimeout(_0x11b07c);if(_0x4e037d){_0x21b5b3({'success':![],'output':formatOutput(_0x1c09b1),'error':'Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','exitCode':0x7c});return;}const _0xeb5669=_0x3e90f8??0x1,_0x1c4107=_0xeb5669===0x0,_0x13e72c=formatOutput(_0x1c09b1||_0x5b3fb5),_0x5c45b2=!_0x1c4107&&_0x5b3fb5?formatOutput(_0x5b3fb5):undefined;_0x21b5b3({'success':_0x1c4107,'output':_0x13e72c,'error':_0x5c45b2,'exitCode':_0xeb5669});});});}
|