@treasuredata/tdx 0.16.8 → 0.16.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/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/llm-proxy.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/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/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.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/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/system-prompts.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.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.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/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/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/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a45_0x4398(){const _0x445a4a=['ap02','2QdlfEO','config/account-info','TDX_API_KEY_<PROFILE>','jp01','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','join','readFileSync','\x27,\x20defaulting\x20to\x20us01','split','.env.','dev-us01','.json','config/llm-project','us01','dev-eu01','5214084oixVPN','replace','.config','TDX_API_KEY_','tdx.json','isDeprecated','clear','existsSync','stg-jp01','stg-us01','13silRjU','1384405ZOiVzQ','toISOString','7SRAQku','site','8nEqFwh','projectId','keychain','Warning:\x20Failed\x20to\x20load\x20','1314906RqXoTR','141228dHJsGe','warn','toUpperCase','entries','trim','yellow','llm_default_project','slice','startsWith','TDX_API_KEY','apiKey','TDX_API_KEY\x20env\x20var','some','tdx','path','utf-8','TD_API_KEY','filter','ap03','keychain\x20(profile:\x20','6PgHyAy','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','env','name','string','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','config/llm-agent','legacy\x20.env\x20file','120867JmKMZP','Warning:\x20Failed\x20to\x20read\x20','10KTumKY','stg-ap03','source','number','map','2716439JSgUhL','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','Warning:\x20Unknown\x20site\x20\x27','.env','includes','TD_API_KEY_','TD_API_KEY\x20env\x20var\x20(deprecated)','write','75852uKAGGc','read'];a45_0x4398=function(){return _0x445a4a;};return a45_0x4398();}const a45_0x1fdcc9=a45_0x1c21;(function(_0x8437ce,_0x2a788e){const _0x5b17cd=a45_0x1c21,_0xbb8918=_0x8437ce();while(!![]){try{const _0xcf9a2a=parseInt(_0x5b17cd(0xf1))/0x1*(-parseInt(_0x5b17cd(0x103))/0x2)+-parseInt(_0x5b17cd(0xe9))/0x3*(-parseInt(_0x5b17cd(0x100))/0x4)+parseInt(_0x5b17cd(0xcc))/0x5+parseInt(_0x5b17cd(0xd4))/0x6*(-parseInt(_0x5b17cd(0xce))/0x7)+-parseInt(_0x5b17cd(0xd0))/0x8*(-parseInt(_0x5b17cd(0xd5))/0x9)+-parseInt(_0x5b17cd(0xf3))/0xa*(parseInt(_0x5b17cd(0xf8))/0xb)+-parseInt(_0x5b17cd(0x112))/0xc*(-parseInt(_0x5b17cd(0xcb))/0xd);if(_0xcf9a2a===_0x2a788e)break;else _0xbb8918['push'](_0xbb8918['shift']());}catch(_0xb1deb9){_0xbb8918['push'](_0xbb8918['shift']());}}}(a45_0x4398,0x2b777));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x1a26d1 from'node:fs';import*as a45_0x41fe3f from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x4cd80b from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0xf0c799=a45_0x1c21;return process[_0xf0c799(0xeb)]['TDX_CONFIG_DIR']||join(homedir(),_0xf0c799(0x114),_0xf0c799(0xe2));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x390693){const _0x127e01=a45_0x1c21,_0x4cbcf5=getConfigDir();return _0x390693?a45_0x41fe3f['join'](_0x4cbcf5,_0x127e01(0x10c)+_0x390693):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0x1fdcc9(0xdb),a45_0x1fdcc9(0x10f));export function getLLMProjectCacheFile(_0x440535){return llmProjectCache['path'](_0x440535);}export function readCachedLLMProject(_0x478f38){const _0x3020bd=a45_0x1fdcc9,_0x379015=llmProjectCache[_0x3020bd(0x101)](_0x478f38);if(_0x379015&&typeof _0x379015['id']===_0x3020bd(0xed)&&typeof _0x379015[_0x3020bd(0xec)]===_0x3020bd(0xed))return _0x379015;return null;}export function writeCachedLLMProject(_0x4fa4fa,_0x45a191,_0x56b3e5){const _0x55d028=a45_0x1fdcc9;try{llmProjectCache[_0x55d028(0xff)]({'name':_0x4fa4fa,'id':_0x45a191},_0x56b3e5);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a45_0x1fdcc9(0xef));export function getLLMAgentCacheFile(_0x3da3d3){return llmAgentCache['path'](_0x3da3d3);}export function readCachedLLMAgent(_0x5d4769){const _0x55c99e=a45_0x1fdcc9,_0x5c27fe=llmAgentCache[_0x55c99e(0x101)](_0x5d4769);if(_0x5c27fe&&typeof _0x5c27fe['id']===_0x55c99e(0xed)&&typeof _0x5c27fe['name']===_0x55c99e(0xed)&&typeof _0x5c27fe[_0x55c99e(0xd1)]===_0x55c99e(0xed))return _0x5c27fe;return null;}export function writeCachedLLMAgent(_0x518a2b,_0x5ac3c1,_0x2cdc48,_0x277017){const _0x3e533c=a45_0x1fdcc9;try{llmAgentCache[_0x3e533c(0xff)]({'name':_0x518a2b,'id':_0x5ac3c1,'projectId':_0x2cdc48},_0x277017);}catch{}}export function clearCachedLLMAgent(_0x34aae1){const _0x573454=a45_0x1fdcc9;try{llmAgentCache[_0x573454(0x118)](_0x34aae1);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a45_0x1fdcc9(0x104),{'suffix':a45_0x1fdcc9(0x10e)});function a45_0x1c21(_0x57a451,_0x1ad0c0){_0x57a451=_0x57a451-0xc9;const _0x439860=a45_0x4398();let _0x1c2183=_0x439860[_0x57a451];return _0x1c2183;}export function getAccountInfoCacheFile(_0x18b59b){const _0x347f14=a45_0x1fdcc9;return accountInfoCache[_0x347f14(0xe3)](_0x18b59b);}export function readCachedAccountInfo(_0x9e032){const _0x342ff5=a45_0x1fdcc9,_0xa3f204=accountInfoCache[_0x342ff5(0x101)](_0x9e032);if(_0xa3f204&&typeof _0xa3f204[_0x342ff5(0xcf)]==='string'&&typeof _0xa3f204['accountId']===_0x342ff5(0xf6))return _0xa3f204;return null;}export function writeCachedAccountInfo(_0x47c672,_0x1e4b90,_0x2214f8){const _0x347c4e=a45_0x1fdcc9;try{accountInfoCache[_0x347c4e(0xff)]({'site':_0x47c672,'accountId':_0x1e4b90,'cachedAt':new Date()[_0x347c4e(0xcd)]()},_0x2214f8);}catch{}}export function parseEnvFile(_0x424c4a){const _0x21ffe6=a45_0x1fdcc9,_0x30dfa5={};for(const _0x184155 of _0x424c4a[_0x21ffe6(0x10b)]('\x0a')){const _0x2483e5=_0x184155['trim']();if(!_0x2483e5||_0x2483e5[_0x21ffe6(0xdd)]('#'))continue;const _0x3dc0f5=_0x2483e5['match'](/^([^=]+)=(.*)$/);if(_0x3dc0f5){const _0x1c52fc=_0x3dc0f5[0x1][_0x21ffe6(0xd9)]();let _0x1fb526=_0x3dc0f5[0x2][_0x21ffe6(0xd9)]();(_0x1fb526[_0x21ffe6(0xdd)]('\x22')&&_0x1fb526['endsWith']('\x22')||_0x1fb526[_0x21ffe6(0xdd)]('\x27')&&_0x1fb526['endsWith']('\x27'))&&(_0x1fb526=_0x1fb526[_0x21ffe6(0xdc)](0x1,-0x1)),_0x30dfa5[_0x1c52fc]=_0x1fb526;}}return _0x30dfa5;}export function readUserConfig(){const _0x2205c5=a45_0x1fdcc9,_0x334dfd=getConfigFile();if(!existsSync(_0x334dfd))return{};try{const _0x479dcd=readFileSync(_0x334dfd,_0x2205c5(0xe4));return parseEnvFile(_0x479dcd);}catch(_0x21728e){return console[_0x2205c5(0xd6)](_0x2205c5(0xf9)+_0x334dfd+':',_0x21728e),{};}}export function resolveSite(_0x5c7936){const _0x2458e4=a45_0x1fdcc9,_0x3f54da=[_0x2458e4(0x110),_0x2458e4(0x106),'eu01',_0x2458e4(0x102),_0x2458e4(0xe7),_0x2458e4(0x10d),_0x2458e4(0x111),_0x2458e4(0xca),_0x2458e4(0xc9),_0x2458e4(0xf4)];if(_0x3f54da[_0x2458e4(0xfc)](_0x5c7936))return _0x5c7936;if(_0x5c7936 in SITE_ALIASES)return SITE_ALIASES[_0x5c7936];return console[_0x2458e4(0xd6)](_0x2458e4(0xfa)+_0x5c7936+_0x2458e4(0x10a)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x3410b8,_0x584304){const _0x411c9d=a45_0x1fdcc9,_0x366c49=_0x584304||getActiveProfileName();if(_0x366c49){const _0x26c0d4=_0x411c9d(0x115)+normalizeProfileForEnvVar(_0x366c49);if(process['env'][_0x26c0d4])return process[_0x411c9d(0xeb)][_0x26c0d4];}if(process[_0x411c9d(0xeb)]['TDX_API_KEY'])return process[_0x411c9d(0xeb)][_0x411c9d(0xde)];if(process[_0x411c9d(0xeb)]['TD_API_KEY'])return process['env'][_0x411c9d(0xe5)];const _0x7b5f0=_0x3410b8[_0x411c9d(0xd7)]()[_0x411c9d(0x113)](/-/g,'_'),_0x11ff2c=_0x411c9d(0xfd)+_0x7b5f0;if(_0x366c49){const _0x5ac038=loadProfileEnv(_0x366c49);if(_0x5ac038){if(_0x5ac038[_0x11ff2c])return _0x5ac038[_0x11ff2c];if(_0x5ac038[_0x411c9d(0xe5)])return _0x5ac038['TD_API_KEY'];}}const _0x2e29ed=loadUserConfigOnce();if(_0x2e29ed[_0x11ff2c])return _0x2e29ed[_0x11ff2c];if(_0x2e29ed[_0x411c9d(0xe5)])return _0x2e29ed[_0x411c9d(0xe5)];return undefined;}export function normalizeProfileForEnvVar(_0x4a17b5){const _0x79a7e9=a45_0x1fdcc9;return _0x4a17b5[_0x79a7e9(0xd7)]()[_0x79a7e9(0x113)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x5903d6,_0xf23fdb){const _0x5dbff7=a45_0x1fdcc9,_0x52cf3e=_0xf23fdb||getActiveProfileName()||undefined;if(_0x52cf3e){const _0x3b75ad=_0x5dbff7(0x115)+normalizeProfileForEnvVar(_0x52cf3e);if(process[_0x5dbff7(0xeb)][_0x3b75ad])return{'apiKey':process[_0x5dbff7(0xeb)][_0x3b75ad],'source':_0x3b75ad+'\x20env\x20var','isDeprecated':![]};const _0x41cdcf=getCachedCredential(_0x5903d6,_0x52cf3e);if(_0x41cdcf)return{'apiKey':_0x41cdcf,'source':_0x5dbff7(0xe8)+_0x52cf3e+')','isDeprecated':![]};const _0x1faf1c=await getKeychainAPIKey(_0x52cf3e);if(_0x1faf1c)return setCachedCredential(_0x1faf1c,_0x5903d6,_0x52cf3e),{'apiKey':_0x1faf1c,'source':'keychain\x20(profile:\x20'+_0x52cf3e+')','isDeprecated':![]};}if(process['env'][_0x5dbff7(0xde)])return{'apiKey':process[_0x5dbff7(0xeb)][_0x5dbff7(0xde)],'source':_0x5dbff7(0xe0),'isDeprecated':![]};if(!_0x52cf3e){const _0x4228b3=getCachedCredential(_0x5903d6,undefined);if(_0x4228b3)return{'apiKey':_0x4228b3,'source':_0x5dbff7(0xd2),'isDeprecated':![]};const _0xc8b4ed=await getKeychainAPIKey(undefined);if(_0xc8b4ed)return setCachedCredential(_0xc8b4ed,_0x5903d6,undefined),{'apiKey':_0xc8b4ed,'source':_0x5dbff7(0xd2),'isDeprecated':![]};}if(process['env']['TD_API_KEY'])return{'apiKey':process[_0x5dbff7(0xeb)][_0x5dbff7(0xe5)],'source':_0x5dbff7(0xfe),'isDeprecated':!![]};const _0x27271a=getLegacyEnvAPIKey(_0x5903d6,_0x52cf3e);if(_0x27271a){const _0x343c53=await isKeychainAvailable();if(_0x343c53)try{await saveKeychainAPIKey(_0x27271a,_0x52cf3e),setCachedCredential(_0x27271a,_0x5903d6,_0x52cf3e);const _0x1fc314=getConfigFilePath(_0x52cf3e);cleanupLegacyEnvFile(_0x1fc314)&&console[_0x5dbff7(0xd6)](a45_0x4cd80b['yellow']('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x334798){console['warn'](a45_0x4cd80b[_0x5dbff7(0xda)]('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x334798));}const _0x5b7a33=_0x52cf3e?'legacy\x20.env\x20file\x20(profile:\x20'+_0x52cf3e+')':_0x5dbff7(0xf0);return{'apiKey':_0x27271a,'source':_0x5b7a33,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x19c30f,_0x532073,_0x493654=!![]){const _0x53cc31=a45_0x1fdcc9,_0x59bf40=await resolveAPIKeyAsync(_0x19c30f,_0x532073);if(!_0x59bf40)return undefined;if(_0x493654&&_0x59bf40[_0x53cc31(0x117)]&&_0x59bf40[_0x53cc31(0xf5)][_0x53cc31(0xfc)](_0x53cc31(0xe5))){const _0x3e2031=_0x532073||getActiveProfileName()||undefined,_0xdeb43c=_0x3e2031?_0x53cc31(0x115)+normalizeProfileForEnvVar(_0x3e2031):_0x53cc31(0x105);console[_0x53cc31(0xd6)](a45_0x4cd80b[_0x53cc31(0xda)](_0x53cc31(0xee)+(_0x53cc31(0x107)+_0xdeb43c+').')));}return _0x59bf40[_0x53cc31(0xdf)];}function getLegacyEnvAPIKey(_0x54448e,_0x4ab736){const _0x26f57a=a45_0x1fdcc9,_0x2f68de=_0x54448e[_0x26f57a(0xd7)]()[_0x26f57a(0x113)](/-/g,'_'),_0x3cfaa4=_0x26f57a(0xfd)+_0x2f68de;if(_0x4ab736){const _0x28eeb1=loadProfileEnv(_0x4ab736);if(_0x28eeb1){if(_0x28eeb1[_0x3cfaa4])return _0x28eeb1[_0x3cfaa4];if(_0x28eeb1[_0x26f57a(0xe5)])return _0x28eeb1['TD_API_KEY'];}}const _0x10f5a4=loadUserConfigOnce();if(_0x10f5a4[_0x3cfaa4])return _0x10f5a4[_0x3cfaa4];if(_0x10f5a4[_0x26f57a(0xe5)])return _0x10f5a4[_0x26f57a(0xe5)];return undefined;}function cleanupLegacyEnvFile(_0xd95156){const _0x245f33=a45_0x1fdcc9;if(!existsSync(_0xd95156))return![];try{const _0x4af7e5=readFileSync(_0xd95156,_0x245f33(0xe4)),_0x5b3237=_0x4af7e5[_0x245f33(0x10b)]('\x0a'),_0x30501d=_0x5b3237[_0x245f33(0xe6)](_0x376c41=>{const _0x392abc=_0x245f33,_0x4e320b=_0x376c41[_0x392abc(0xd9)]();if(!_0x4e320b||_0x4e320b[_0x392abc(0xdd)]('#'))return!![];const [_0x296dfe]=_0x4e320b[_0x392abc(0x10b)]('=');return!_0x296dfe[_0x392abc(0xdd)](_0x392abc(0xe5));}),_0x2ed942=_0x30501d[_0x245f33(0xe1)](_0x3448ed=>{const _0x3841b0=_0x245f33,_0x55b752=_0x3448ed[_0x3841b0(0xd9)]();return _0x55b752&&!_0x55b752[_0x3841b0(0xdd)]('#');});if(!_0x2ed942)return unlinkSync(_0xd95156),!![];return writeFileSync(_0xd95156,_0x30501d['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x41a95f){const _0x96da5=a45_0x1fdcc9,_0x2b6f27=a45_0x41fe3f[_0x96da5(0x108)](getConfigDir(),_0x96da5(0x10c)+_0x41a95f);if(a45_0x1a26d1['existsSync'](_0x2b6f27)){validateSecureFilePermissions(_0x2b6f27);try{const _0x34e36e=a45_0x1a26d1[_0x96da5(0x109)](_0x2b6f27,_0x96da5(0xe4));return parseEnvFile(_0x34e36e);}catch(_0x489251){console[_0x96da5(0xd6)]('Warning:\x20Failed\x20to\x20load\x20'+_0x2b6f27+':\x20'+_0x489251);}}const _0x444611=a45_0x41fe3f[_0x96da5(0x108)](getConfigDir(),'profiles',_0x41a95f,_0x96da5(0xfb));if(a45_0x1a26d1[_0x96da5(0x119)](_0x444611)){validateSecureFilePermissions(_0x444611);try{const _0x58b26b=a45_0x1a26d1['readFileSync'](_0x444611,_0x96da5(0xe4));return parseEnvFile(_0x58b26b);}catch(_0x154b9a){return console[_0x96da5(0xd6)](_0x96da5(0xd3)+_0x444611+':\x20'+_0x154b9a),null;}}return null;}function getActiveProfileName(){const _0x487dcd=a45_0x1fdcc9,_0x1a74e7=a45_0x41fe3f['join'](getConfigDir(),_0x487dcd(0x116));if(!a45_0x1a26d1['existsSync'](_0x1a74e7))return null;try{const _0x3790e9=a45_0x1a26d1[_0x487dcd(0x109)](_0x1a74e7,'utf-8'),_0x4e36f6=JSON['parse'](_0x3790e9);return _0x4e36f6['profile']||null;}catch{return null;}}export function saveAPIKey(_0x136785,_0x4fc6af,_0x46f22b){const _0x273166=a45_0x1fdcc9,_0x4f742d=getConfigDir(),_0x522ce1=getConfigFilePath(_0x46f22b);!existsSync(_0x4f742d)&&mkdirSync(_0x4f742d,{'recursive':!![],'mode':0x1c0});let _0x45df78={};if(existsSync(_0x522ce1))try{const _0x497d83=readFileSync(_0x522ce1,'utf-8');_0x45df78=parseEnvFile(_0x497d83);}catch(_0x163a5f){console['warn'](_0x273166(0xf2)+_0x522ce1+':',_0x163a5f);}const _0x5bf55f=_0x136785[_0x273166(0xd7)]()[_0x273166(0x113)](/-/g,'_');_0x45df78[_0x273166(0xfd)+_0x5bf55f]=_0x4fc6af;const _0x355d3e=Object[_0x273166(0xd8)](_0x45df78)[_0x273166(0xf7)](([_0x1ea44b,_0x493c2e])=>_0x1ea44b+'='+_0x493c2e);writeFileSync(_0x522ce1,_0x355d3e[_0x273166(0x108)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x1c0cf4,_0x46394e,_0x16e24a){const _0x20d27f=a45_0x1fdcc9;await saveKeychainAPIKey(_0x1c0cf4,_0x16e24a),setCachedCredential(_0x1c0cf4,_0x46394e,_0x16e24a);const _0x5c9614=getConfigFilePath(_0x16e24a);cleanupLegacyEnvFile(_0x5c9614)&&console[_0x20d27f(0xd6)](a45_0x4cd80b[_0x20d27f(0xda)](_0x20d27f(0xea)));}export function loadConfig(){const _0x3f6d06=a45_0x1fdcc9,_0x4b9d2b={'apiKeys':{},'defaultSite':_0x3f6d06(0x110)},_0x43db81=[_0x3f6d06(0x110),'jp01','eu01','ap02',_0x3f6d06(0xe7),_0x3f6d06(0x10d),'dev-eu01','stg-us01',_0x3f6d06(0xc9),_0x3f6d06(0xf4)];for(const _0x3070ad of _0x43db81){const _0x46f7f4=getAPIKey(_0x3070ad);_0x46f7f4&&(_0x4b9d2b['apiKeys'][_0x3070ad]=_0x46f7f4);}return _0x4b9d2b;}
|
|
1
|
+
const a45_0x40c703=a45_0x5518;(function(_0x945b01,_0x2d0b14){const _0x351dd7=a45_0x5518,_0x48fc95=_0x945b01();while(!![]){try{const _0x413d77=parseInt(_0x351dd7(0xe9))/0x1+-parseInt(_0x351dd7(0xf5))/0x2*(parseInt(_0x351dd7(0xca))/0x3)+-parseInt(_0x351dd7(0xc7))/0x4+parseInt(_0x351dd7(0xe2))/0x5+-parseInt(_0x351dd7(0xf7))/0x6+-parseInt(_0x351dd7(0x105))/0x7+parseInt(_0x351dd7(0xda))/0x8;if(_0x413d77===_0x2d0b14)break;else _0x48fc95['push'](_0x48fc95['shift']());}catch(_0x50a474){_0x48fc95['push'](_0x48fc95['shift']());}}}(a45_0x577d,0x87f4f));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x2edfe9 from'node:fs';import*as a45_0x4022a0 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x550571 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x2c56c8=a45_0x5518;return process[_0x2c56c8(0xdb)][_0x2c56c8(0xe8)]||join(homedir(),_0x2c56c8(0xe3),_0x2c56c8(0xde));}export function getConfigFile(){const _0x4a7313=a45_0x5518;return join(getConfigDir(),_0x4a7313(0x101));}export function getConfigFilePath(_0x42726f){const _0x342fd2=a45_0x5518,_0x1ff3c3=getConfigDir();return _0x42726f?a45_0x4022a0['join'](_0x1ff3c3,_0x342fd2(0xf4)+_0x42726f):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0x40c703(0x10e),a45_0x40c703(0xd0));export function getLLMProjectCacheFile(_0x4a9bd7){const _0xbe7353=a45_0x40c703;return llmProjectCache[_0xbe7353(0xd7)](_0x4a9bd7);}export function readCachedLLMProject(_0x2f473c){const _0x5f1f51=a45_0x40c703,_0x138290=llmProjectCache['read'](_0x2f473c);if(_0x138290&&typeof _0x138290['id']===_0x5f1f51(0xed)&&typeof _0x138290[_0x5f1f51(0x102)]===_0x5f1f51(0xed))return _0x138290;return null;}export function writeCachedLLMProject(_0x3f762f,_0x167d5d,_0x1b8449){const _0xa8ab6d=a45_0x40c703;try{llmProjectCache[_0xa8ab6d(0x108)]({'name':_0x3f762f,'id':_0x167d5d},_0x1b8449);}catch{}}function a45_0x577d(){const _0x40387d=['ap02','23825320IlbXGg','env','join','site','tdx','trim','jp01','filter','417750XycFxH','.config','utf-8','profile','map','config/account-info','TDX_CONFIG_DIR','286109JSnVGl','entries','TD_API_KEY_','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','string','some','TD_API_KEY\x20env\x20var\x20(deprecated)','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','Warning:\x20Failed\x20to\x20load\x20','toUpperCase','TDX_API_KEY_','.env.','18Xrfobo','keychain','4288998QUeNNa','toISOString','dev-us01','config/llm-agent','account_info','llm_default_agent','keychain\x20(profile:\x20','.json','us01','parse','.env','name','slice','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','6687737TzoLDd','legacy\x20.env\x20file\x20(profile:\x20','split','write','stg-ap03','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','legacy\x20.env\x20file','\x20env\x20var','number','llm_default_project','includes','clear','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','\x27,\x20defaulting\x20to\x20us01','stg-us01','projectId','tdx.json','TDX_API_KEY\x20env\x20var','apiKeys','existsSync','TD_API_KEY','replace','match','1196732daUHpz','TDX_API_KEY','endsWith','273846GjCmua','ap03','warn','readFileSync','startsWith','dev-eu01','config/llm-project','Warning:\x20Unknown\x20site\x20\x27','isDeprecated','stg-jp01','read','apiKey','accountId','path','Warning:\x20Failed\x20to\x20read\x20'];a45_0x577d=function(){return _0x40387d;};return a45_0x577d();}const llmAgentCache=createOptionalProfileCache(a45_0x40c703(0xfc),a45_0x40c703(0xfa));export function getLLMAgentCacheFile(_0x86ed0e){const _0xfbe051=a45_0x40c703;return llmAgentCache[_0xfbe051(0xd7)](_0x86ed0e);}export function readCachedLLMAgent(_0x36e44c){const _0xaf8b79=a45_0x40c703,_0xeed369=llmAgentCache[_0xaf8b79(0xd4)](_0x36e44c);if(_0xeed369&&typeof _0xeed369['id']==='string'&&typeof _0xeed369[_0xaf8b79(0x102)]===_0xaf8b79(0xed)&&typeof _0xeed369[_0xaf8b79(0x114)]===_0xaf8b79(0xed))return _0xeed369;return null;}export function writeCachedLLMAgent(_0x495e9b,_0x445380,_0x3ae9a0,_0x29bd05){const _0xb79666=a45_0x40c703;try{llmAgentCache[_0xb79666(0x108)]({'name':_0x495e9b,'id':_0x445380,'projectId':_0x3ae9a0},_0x29bd05);}catch{}}export function clearCachedLLMAgent(_0x500b5e){const _0x19e618=a45_0x40c703;try{llmAgentCache[_0x19e618(0x110)](_0x500b5e);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0x40c703(0xfb),a45_0x40c703(0xe7),{'suffix':a45_0x40c703(0xfe)});export function getAccountInfoCacheFile(_0x37cb4e){const _0x421ca8=a45_0x40c703;return accountInfoCache[_0x421ca8(0xd7)](_0x37cb4e);}export function readCachedAccountInfo(_0x5eb76a){const _0x4e6934=a45_0x40c703,_0x1d8701=accountInfoCache[_0x4e6934(0xd4)](_0x5eb76a);if(_0x1d8701&&typeof _0x1d8701[_0x4e6934(0xdd)]==='string'&&typeof _0x1d8701[_0x4e6934(0xd6)]===_0x4e6934(0x10d))return _0x1d8701;return null;}export function writeCachedAccountInfo(_0x420f70,_0x462fcb,_0xb6ad13){const _0x5c90a6=a45_0x40c703;try{accountInfoCache[_0x5c90a6(0x108)]({'site':_0x420f70,'accountId':_0x462fcb,'cachedAt':new Date()[_0x5c90a6(0xf8)]()},_0xb6ad13);}catch{}}export function parseEnvFile(_0xf04520){const _0x336750=a45_0x40c703,_0x5f0d0e={};for(const _0x39ab2d of _0xf04520[_0x336750(0x107)]('\x0a')){const _0x14d0a5=_0x39ab2d[_0x336750(0xdf)]();if(!_0x14d0a5||_0x14d0a5['startsWith']('#'))continue;const _0x38bbe1=_0x14d0a5[_0x336750(0xc6)](/^([^=]+)=(.*)$/);if(_0x38bbe1){const _0x46e72c=_0x38bbe1[0x1][_0x336750(0xdf)]();let _0x5b86f9=_0x38bbe1[0x2]['trim']();(_0x5b86f9[_0x336750(0xce)]('\x22')&&_0x5b86f9[_0x336750(0xc9)]('\x22')||_0x5b86f9[_0x336750(0xce)]('\x27')&&_0x5b86f9[_0x336750(0xc9)]('\x27'))&&(_0x5b86f9=_0x5b86f9[_0x336750(0x103)](0x1,-0x1)),_0x5f0d0e[_0x46e72c]=_0x5b86f9;}}return _0x5f0d0e;}export function readUserConfig(){const _0x5325a3=a45_0x40c703,_0x584869=getConfigFile();if(!existsSync(_0x584869))return{};try{const _0x167b1c=readFileSync(_0x584869,_0x5325a3(0xe4));return parseEnvFile(_0x167b1c);}catch(_0x22f4ce){return console['warn'](_0x5325a3(0x10a)+_0x584869+':',_0x22f4ce),{};}}export function resolveSite(_0x2404ec){const _0x509a8c=a45_0x40c703,_0x315385=[_0x509a8c(0xff),_0x509a8c(0xe0),'eu01',_0x509a8c(0xd9),_0x509a8c(0xcb),'dev-us01',_0x509a8c(0xcf),_0x509a8c(0x113),_0x509a8c(0xd3),_0x509a8c(0x109)];if(_0x315385[_0x509a8c(0x10f)](_0x2404ec))return _0x2404ec;if(_0x2404ec in SITE_ALIASES)return SITE_ALIASES[_0x2404ec];return console[_0x509a8c(0xcc)](_0x509a8c(0xd1)+_0x2404ec+_0x509a8c(0x112)),_0x509a8c(0xff);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x104a69,_0x197571){const _0x5a6f27=a45_0x40c703,_0x21b020=_0x197571||getActiveProfileName();if(_0x21b020){const _0x1a76cc=_0x5a6f27(0xf3)+normalizeProfileForEnvVar(_0x21b020);if(process[_0x5a6f27(0xdb)][_0x1a76cc])return process[_0x5a6f27(0xdb)][_0x1a76cc];}if(process[_0x5a6f27(0xdb)]['TDX_API_KEY'])return process[_0x5a6f27(0xdb)][_0x5a6f27(0xc8)];if(process[_0x5a6f27(0xdb)][_0x5a6f27(0x119)])return process[_0x5a6f27(0xdb)][_0x5a6f27(0x119)];const _0x2bab0d=_0x104a69[_0x5a6f27(0xf2)]()['replace'](/-/g,'_'),_0x44ad67=_0x5a6f27(0xeb)+_0x2bab0d;if(_0x21b020){const _0x1a09cf=loadProfileEnv(_0x21b020);if(_0x1a09cf){if(_0x1a09cf[_0x44ad67])return _0x1a09cf[_0x44ad67];if(_0x1a09cf[_0x5a6f27(0x119)])return _0x1a09cf[_0x5a6f27(0x119)];}}const _0x4b44c4=loadUserConfigOnce();if(_0x4b44c4[_0x44ad67])return _0x4b44c4[_0x44ad67];if(_0x4b44c4[_0x5a6f27(0x119)])return _0x4b44c4[_0x5a6f27(0x119)];return undefined;}function a45_0x5518(_0x5ce239,_0x470928){_0x5ce239=_0x5ce239-0xc6;const _0x577d71=a45_0x577d();let _0x551823=_0x577d71[_0x5ce239];return _0x551823;}export function normalizeProfileForEnvVar(_0x5ac1f6){const _0x383eed=a45_0x40c703;return _0x5ac1f6[_0x383eed(0xf2)]()[_0x383eed(0x11a)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x5aac2e,_0xc7767c){const _0x21059f=a45_0x40c703,_0x1bbc10=_0xc7767c||getActiveProfileName()||undefined;if(_0x1bbc10){const _0x44235a='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x1bbc10);if(process['env'][_0x44235a])return{'apiKey':process[_0x21059f(0xdb)][_0x44235a],'source':_0x44235a+_0x21059f(0x10c),'isDeprecated':![]};const _0xabe4a8=getCachedCredential(_0x5aac2e,_0x1bbc10);if(_0xabe4a8)return{'apiKey':_0xabe4a8,'source':_0x21059f(0xfd)+_0x1bbc10+')','isDeprecated':![]};const _0x512f2d=await getKeychainAPIKey(_0x1bbc10);if(_0x512f2d)return setCachedCredential(_0x512f2d,_0x5aac2e,_0x1bbc10),{'apiKey':_0x512f2d,'source':'keychain\x20(profile:\x20'+_0x1bbc10+')','isDeprecated':![]};}if(process[_0x21059f(0xdb)][_0x21059f(0xc8)])return{'apiKey':process[_0x21059f(0xdb)]['TDX_API_KEY'],'source':_0x21059f(0x116),'isDeprecated':![]};if(!_0x1bbc10){const _0x1d001b=getCachedCredential(_0x5aac2e,undefined);if(_0x1d001b)return{'apiKey':_0x1d001b,'source':'keychain','isDeprecated':![]};const _0x277761=await getKeychainAPIKey(undefined);if(_0x277761)return setCachedCredential(_0x277761,_0x5aac2e,undefined),{'apiKey':_0x277761,'source':_0x21059f(0xf6),'isDeprecated':![]};}if(process[_0x21059f(0xdb)][_0x21059f(0x119)])return{'apiKey':process['env'][_0x21059f(0x119)],'source':_0x21059f(0xef),'isDeprecated':!![]};const _0x31d0b5=getLegacyEnvAPIKey(_0x5aac2e,_0x1bbc10);if(_0x31d0b5){const _0x17afb3=await isKeychainAvailable();if(_0x17afb3)try{await saveKeychainAPIKey(_0x31d0b5,_0x1bbc10),setCachedCredential(_0x31d0b5,_0x5aac2e,_0x1bbc10);const _0x47d633=getConfigFilePath(_0x1bbc10);cleanupLegacyEnvFile(_0x47d633)&&console[_0x21059f(0xcc)](a45_0x550571['yellow'](_0x21059f(0xec)));}catch(_0x176b97){console[_0x21059f(0xcc)](a45_0x550571['yellow'](_0x21059f(0x104)+_0x176b97));}const _0x1e41c6=_0x1bbc10?_0x21059f(0x106)+_0x1bbc10+')':_0x21059f(0x10b);return{'apiKey':_0x31d0b5,'source':_0x1e41c6,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x1c814a,_0x32ac3b,_0x3d7e6c=!![]){const _0xe7d13d=a45_0x40c703,_0x341a9b=await resolveAPIKeyAsync(_0x1c814a,_0x32ac3b);if(!_0x341a9b)return undefined;if(_0x3d7e6c&&_0x341a9b[_0xe7d13d(0xd2)]&&_0x341a9b['source'][_0xe7d13d(0x10f)](_0xe7d13d(0x119))){const _0x1e1032=_0x32ac3b||getActiveProfileName()||undefined,_0x486aae=_0x1e1032?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x1e1032):'TDX_API_KEY_<PROFILE>';console[_0xe7d13d(0xcc)](a45_0x550571['yellow'](_0xe7d13d(0x111)+(_0xe7d13d(0xf0)+_0x486aae+').')));}return _0x341a9b[_0xe7d13d(0xd5)];}function getLegacyEnvAPIKey(_0x10e639,_0x5a91fe){const _0x3be590=a45_0x40c703,_0x1058d9=_0x10e639[_0x3be590(0xf2)]()['replace'](/-/g,'_'),_0x3aec3f=_0x3be590(0xeb)+_0x1058d9;if(_0x5a91fe){const _0x39bdc2=loadProfileEnv(_0x5a91fe);if(_0x39bdc2){if(_0x39bdc2[_0x3aec3f])return _0x39bdc2[_0x3aec3f];if(_0x39bdc2['TD_API_KEY'])return _0x39bdc2[_0x3be590(0x119)];}}const _0x22f32d=loadUserConfigOnce();if(_0x22f32d[_0x3aec3f])return _0x22f32d[_0x3aec3f];if(_0x22f32d[_0x3be590(0x119)])return _0x22f32d[_0x3be590(0x119)];return undefined;}function cleanupLegacyEnvFile(_0x528c37){const _0x43086c=a45_0x40c703;if(!existsSync(_0x528c37))return![];try{const _0x5626b0=readFileSync(_0x528c37,_0x43086c(0xe4)),_0x16267f=_0x5626b0[_0x43086c(0x107)]('\x0a'),_0x48d20b=_0x16267f[_0x43086c(0xe1)](_0x5e6cd6=>{const _0x3f2855=_0x43086c,_0x9caf7c=_0x5e6cd6[_0x3f2855(0xdf)]();if(!_0x9caf7c||_0x9caf7c[_0x3f2855(0xce)]('#'))return!![];const [_0x246dc]=_0x9caf7c[_0x3f2855(0x107)]('=');return!_0x246dc[_0x3f2855(0xce)]('TD_API_KEY');}),_0x42b8d1=_0x48d20b[_0x43086c(0xee)](_0x115bb2=>{const _0x19a6f0=_0x43086c,_0x29ee1d=_0x115bb2[_0x19a6f0(0xdf)]();return _0x29ee1d&&!_0x29ee1d[_0x19a6f0(0xce)]('#');});if(!_0x42b8d1)return unlinkSync(_0x528c37),!![];return writeFileSync(_0x528c37,_0x48d20b[_0x43086c(0xdc)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0xa562b5){const _0x51f2c6=a45_0x40c703,_0x35cb1c=a45_0x4022a0[_0x51f2c6(0xdc)](getConfigDir(),_0x51f2c6(0xf4)+_0xa562b5);if(a45_0x2edfe9[_0x51f2c6(0x118)](_0x35cb1c)){validateSecureFilePermissions(_0x35cb1c);try{const _0x496705=a45_0x2edfe9[_0x51f2c6(0xcd)](_0x35cb1c,_0x51f2c6(0xe4));return parseEnvFile(_0x496705);}catch(_0x3689a8){console[_0x51f2c6(0xcc)]('Warning:\x20Failed\x20to\x20load\x20'+_0x35cb1c+':\x20'+_0x3689a8);}}const _0x291f8d=a45_0x4022a0[_0x51f2c6(0xdc)](getConfigDir(),'profiles',_0xa562b5,_0x51f2c6(0x101));if(a45_0x2edfe9[_0x51f2c6(0x118)](_0x291f8d)){validateSecureFilePermissions(_0x291f8d);try{const _0x4654da=a45_0x2edfe9[_0x51f2c6(0xcd)](_0x291f8d,_0x51f2c6(0xe4));return parseEnvFile(_0x4654da);}catch(_0xd334f0){return console[_0x51f2c6(0xcc)](_0x51f2c6(0xf1)+_0x291f8d+':\x20'+_0xd334f0),null;}}return null;}function getActiveProfileName(){const _0x40f1f1=a45_0x40c703,_0x251b00=a45_0x4022a0[_0x40f1f1(0xdc)](getConfigDir(),_0x40f1f1(0x115));if(!a45_0x2edfe9[_0x40f1f1(0x118)](_0x251b00))return null;try{const _0x326bc9=a45_0x2edfe9[_0x40f1f1(0xcd)](_0x251b00,'utf-8'),_0x46e95b=JSON[_0x40f1f1(0x100)](_0x326bc9);return _0x46e95b[_0x40f1f1(0xe5)]||null;}catch{return null;}}export function saveAPIKey(_0x283044,_0x10ec2c,_0x4ecc96){const _0x228415=a45_0x40c703,_0xb00ff0=getConfigDir(),_0x47bbdd=getConfigFilePath(_0x4ecc96);!existsSync(_0xb00ff0)&&mkdirSync(_0xb00ff0,{'recursive':!![],'mode':0x1c0});let _0x13e9da={};if(existsSync(_0x47bbdd))try{const _0xc67b06=readFileSync(_0x47bbdd,'utf-8');_0x13e9da=parseEnvFile(_0xc67b06);}catch(_0x3a3416){console[_0x228415(0xcc)](_0x228415(0xd8)+_0x47bbdd+':',_0x3a3416);}const _0x16bc43=_0x283044[_0x228415(0xf2)]()[_0x228415(0x11a)](/-/g,'_');_0x13e9da[_0x228415(0xeb)+_0x16bc43]=_0x10ec2c;const _0x40790b=Object[_0x228415(0xea)](_0x13e9da)[_0x228415(0xe6)](([_0x22544d,_0x5e4dd1])=>_0x22544d+'='+_0x5e4dd1);writeFileSync(_0x47bbdd,_0x40790b[_0x228415(0xdc)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x4c8171,_0x5aaaf3,_0x3b72a2){const _0x4e01ea=a45_0x40c703;await saveKeychainAPIKey(_0x4c8171,_0x3b72a2),setCachedCredential(_0x4c8171,_0x5aaaf3,_0x3b72a2);const _0x240f44=getConfigFilePath(_0x3b72a2);cleanupLegacyEnvFile(_0x240f44)&&console[_0x4e01ea(0xcc)](a45_0x550571['yellow']('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x3d1fe1=a45_0x40c703,_0x15092e={'apiKeys':{},'defaultSite':_0x3d1fe1(0xff)},_0x4fde1a=[_0x3d1fe1(0xff),'jp01','eu01',_0x3d1fe1(0xd9),_0x3d1fe1(0xcb),_0x3d1fe1(0xf9),_0x3d1fe1(0xcf),'stg-us01','stg-jp01','stg-ap03'];for(const _0x54bba4 of _0x4fde1a){const _0x249a36=getAPIKey(_0x54bba4);_0x249a36&&(_0x15092e[_0x3d1fe1(0x117)][_0x54bba4]=_0x249a36);}return _0x15092e;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a46_0x3d83f5=a46_0x5aba;(function(_0x1c5403,_0x2c6bdc){const _0x1371de=a46_0x5aba,_0x34b23f=_0x1c5403();while(!![]){try{const _0x5ed095=parseInt(_0x1371de(0x151))/0x1*(-parseInt(_0x1371de(0x14f))/0x2)+parseInt(_0x1371de(0x159))/0x3*(parseInt(_0x1371de(0x15c))/0x4)+-parseInt(_0x1371de(0x14e))/0x5*(parseInt(_0x1371de(0x157))/0x6)+-parseInt(_0x1371de(0x158))/0x7*(parseInt(_0x1371de(0x150))/0x8)+-parseInt(_0x1371de(0x14d))/0x9+parseInt(_0x1371de(0x14c))/0xa+parseInt(_0x1371de(0x153))/0xb;if(_0x5ed095===_0x2c6bdc)break;else _0x34b23f['push'](_0x34b23f['shift']());}catch(_0x245f0f){_0x34b23f['push'](_0x34b23f['shift']());}}}(a46_0x3824,0xa8161));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a46_0x3d83f5(0x154),a46_0x3d83f5(0x155));function a46_0x5aba(_0x5f3aa8,_0x3f6f0d){_0x5f3aa8=_0x5f3aa8-0x14b;const _0x38246d=a46_0x3824();let _0x5aba33=_0x38246d[_0x5f3aa8];return _0x5aba33;}function a46_0x3824(){const _0x3e0eef=['write','connections','4fNunao','read','5140960noMLWA','10462788HVPkjN','50SBLRIX','73734AnQkiz','24KVvGIT','11SMHPSQ','clear','28438608GnbVFV','connections-{profile}.json','core/connection-cache','now','425634wWDRKZ','895643UOqegd','751089SzkRsE'];a46_0x3824=function(){return _0x3e0eef;};return a46_0x3824();}export function loadCachedConnections(_0x243628){const _0x4a19e6=a46_0x3d83f5,_0x57298f=connectionCache[_0x4a19e6(0x14b)](_0x243628);return _0x57298f?.[_0x4a19e6(0x15b)]??null;}export function saveCachedConnections(_0x4a5c07,_0x28f268){const _0x149e3e=a46_0x3d83f5;connectionCache[_0x149e3e(0x15a)](_0x4a5c07,{'connections':_0x28f268,'cachedAt':Date[_0x149e3e(0x156)]()});}export function clearConnectionCache(_0x361aa6){const _0x3ad028=a46_0x3d83f5;connectionCache[_0x3ad028(0x152)](_0x361aa6);}
|
package/dist/core/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a47_0xc7d773=a47_0x479c;(function(_0x37c0ad,_0x4f00ad){const _0x19da89=a47_0x479c,_0x1eb9fe=_0x37c0ad();while(!![]){try{const _0x4bee58=parseInt(_0x19da89(0x1f2))/0x1*(-parseInt(_0x19da89(0x1e8))/0x2)+-parseInt(_0x19da89(0x1ef))/0x3+parseInt(_0x19da89(0x1e3))/0x4+-parseInt(_0x19da89(0x1f0))/0x5+parseInt(_0x19da89(0x1f3))/0x6+-parseInt(_0x19da89(0x1ee))/0x7*(parseInt(_0x19da89(0x1f6))/0x8)+-parseInt(_0x19da89(0x1e2))/0x9*(parseInt(_0x19da89(0x1e4))/0xa);if(_0x4bee58===_0x4f00ad)break;else _0x1eb9fe['push'](_0x1eb9fe['shift']());}catch(_0xdb3072){_0x1eb9fe['push'](_0x1eb9fe['shift']());}}}(a47_0x2f6b,0xa909f));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;function a47_0x479c(_0x2fb053,_0x2a0b99){_0x2fb053=_0x2fb053-0x1e1;const _0x2f6b2f=a47_0x2f6b();let _0x479ce3=_0x2f6b2f[_0x2fb053];return _0x479ce3;}export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x13b34c,_0x61a310){const _0x32b00f=a47_0x479c;if(_0x13b34c===undefined)return _0x61a310;if(typeof _0x13b34c===_0x32b00f(0x1e6))return _0x13b34c;return parseInt(_0x13b34c,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a47_0xc7d773(0x1eb),'value':'us01'},{'title':a47_0xc7d773(0x1f5),'value':'jp01'},{'title':a47_0xc7d773(0x1e1),'value':'eu01'},{'title':a47_0xc7d773(0x1ed),'value':a47_0xc7d773(0x1e9)}];function a47_0x2f6b(){const _0x403f0d=['ap02\x20-\x20Korea','87262lvGJls','22350QXbZrn','6735385SfwvTg','findIndex','1uQPeoI','6230982OZZEOF','Enter\x20custom\x20site','jp\x20\x20\x20-\x20Japan','64EjkKcS','eu\x20\x20\x20-\x20Europe','19611nyWuXY','4676040kalLwl','10QSRYVO','push','number','value','117380OnEVdx','ap02','us01','us\x20\x20\x20-\x20United\x20States','other'];a47_0x2f6b=function(){return _0x403f0d;};return a47_0x2f6b();}export function buildSiteChoices(_0x71261e){const _0x179e78=a47_0xc7d773,_0x2daf6=[...STANDARD_SITE_CHOICES];let _0x413a43=_0x2daf6[_0x179e78(0x1f1)](_0x57ce13=>_0x57ce13[_0x179e78(0x1e7)]===_0x71261e);return _0x413a43===-0x1&&_0x71261e!==_0x179e78(0x1ea)&&(_0x2daf6[_0x179e78(0x1e5)]({'title':_0x71261e,'value':_0x71261e}),_0x413a43=_0x2daf6['length']-0x1),_0x2daf6[_0x179e78(0x1e5)]({'title':_0x179e78(0x1f4),'value':_0x179e78(0x1ec)}),{'choices':_0x2daf6,'initialIndex':_0x413a43>=0x0?_0x413a43:0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x469990,_0x1d0964){const _0x4d8039=a48_0x323e,_0x4e83b8=_0x469990();while(!![]){try{const _0x3cbcd4=-parseInt(_0x4d8039(0x147))/0x1*(-parseInt(_0x4d8039(0x154))/0x2)+-parseInt(_0x4d8039(0x150))/0x3*(-parseInt(_0x4d8039(0x14d))/0x4)+parseInt(_0x4d8039(0x14f))/0x5*(-parseInt(_0x4d8039(0x152))/0x6)+-parseInt(_0x4d8039(0x14e))/0x7+-parseInt(_0x4d8039(0x156))/0x8*(parseInt(_0x4d8039(0x146))/0x9)+parseInt(_0x4d8039(0x151))/0xa+parseInt(_0x4d8039(0x153))/0xb*(parseInt(_0x4d8039(0x149))/0xc);if(_0x3cbcd4===_0x1d0964)break;else _0x4e83b8['push'](_0x4e83b8['shift']());}catch(_0x4261ca){_0x4e83b8['push'](_0x4e83b8['shift']());}}}(a48_0x1c64,0xb066d));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x365001,_0x304847){const _0x1741c2=a48_0x323e,_0x181b13=_0x365001||_0x1741c2(0x155),_0x59f2cc=_0x304847||_0x1741c2(0x14a);return _0x181b13+':'+_0x59f2cc;}export function getCachedCredential(_0x263e0d,_0x561471){const _0x49b176=a48_0x323e,_0x4cf935=getCacheKey(_0x263e0d,_0x561471),_0x53a052=cache['get'](_0x4cf935);if(!_0x53a052)return null;if(Date[_0x49b176(0x14c)]()-_0x53a052['loadedAt']>CACHE_TTL_MS)return cache[_0x49b176(0x14b)](_0x4cf935),null;return _0x53a052[_0x49b176(0x145)];}function a48_0x1c64(){const _0x52169e=['delete','now','2536792sCtEDp','5579903rsgIcL','80AYsGoY','3zoaZZD','10994170qofWvA','449034cbbsge','22ILWHLA','34282fDzVtc','__default_site__','8bIgHRS','apiKey','2774583VlZDcb','40HsNlch','clear','3636756HNWRMv','__default_profile__'];a48_0x1c64=function(){return _0x52169e;};return a48_0x1c64();}export function setCachedCredential(_0x1eaa79,_0x39f53d,_0x525443){const _0xec7d3b=a48_0x323e,_0x25c578=getCacheKey(_0x39f53d,_0x525443);cache['set'](_0x25c578,{'apiKey':_0x1eaa79,'loadedAt':Date[_0xec7d3b(0x14c)]()});}export function clearCredentialCache(){const _0x136f3c=a48_0x323e;cache[_0x136f3c(0x148)]();}function a48_0x323e(_0x308e9d,_0xc6017f){_0x308e9d=_0x308e9d-0x145;const _0x1c649c=a48_0x1c64();let _0x323e7d=_0x1c649c[_0x308e9d];return _0x323e7d;}export function clearCachedCredential(_0x3db128,_0x4fa9e7){const _0xd640f3=a48_0x323e,_0x53065a=getCacheKey(_0x3db128,_0x4fa9e7);cache[_0xd640f3(0x14b)](_0x53065a);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a49_0x300dd0=a49_0x2733;(function(_0x300769,_0x1d6a5c){const _0x11f323=a49_0x2733,_0x20a2fd=_0x300769();while(!![]){try{const _0x16dc9c=parseInt(_0x11f323(0x16d))/0x1*(-parseInt(_0x11f323(0x157))/0x2)+-parseInt(_0x11f323(0x173))/0x3*(-parseInt(_0x11f323(0x171))/0x4)+parseInt(_0x11f323(0x191))/0x5*(-parseInt(_0x11f323(0x15f))/0x6)+parseInt(_0x11f323(0x175))/0x7+-parseInt(_0x11f323(0x152))/0x8+-parseInt(_0x11f323(0x180))/0x9*(-parseInt(_0x11f323(0x17d))/0xa)+-parseInt(_0x11f323(0x165))/0xb*(parseInt(_0x11f323(0x176))/0xc);if(_0x16dc9c===_0x1d6a5c)break;else _0x20a2fd['push'](_0x20a2fd['shift']());}catch(_0x3aeea8){_0x20a2fd['push'](_0x20a2fd['shift']());}}}(a49_0x4ae0,0xd4011));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a49_0x2733(_0x35b996,_0x5d41ee){_0x35b996=_0x35b996-0x146;const _0x4ae03d=a49_0x4ae0();let _0x273384=_0x4ae03d[_0x35b996];return _0x273384;}import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a49_0x80c142 from'node:fs';import*as a49_0x330cc0 from'node:path';function a49_0x4ae0(){const _0x54cf65=['profile','66oywtEy','[context]','profiles','segment_path','globalCredentials','project','Global\x20Credentials','profileCredentials','138877gUIqyW','workflowProject','getSource','.json','20Evxjyv','profile:\x20','612606WLMUDS','us01','7255710imIgwC','1192836wIpegh','Profile','.env','default','site','apiKey','verbose','13066960vVTCYc','logLevel','replace','9CCdgTw','sessionId','none','displayWithSources','resolveAPIKeyAsync','Session','segmentPath','loadGlobalConfig','utf-8','database','parentSegment','[configuration\x20files]','llm_project','toString','Global','bold','llm_agent','15dcIvXV','tdx.json','dim','log','TDX_SITE','workflow_project','cliFlags','CLI\x20flag:\x20--','cyan','sessions','display','existsSync','llmAgent','join','INFO','createAsync','1849032moSntS','llmProject','assign','(active)','injectIntoOptions','22WzKNOm','global','parent_segment','session','string','configFiles','config','getParameters','281346MrQmdm','layers','entries','not\x20set','activeProfile'];a49_0x4ae0=function(){return _0x54cf65;};return a49_0x4ae0();}import a49_0x50a9ad from'chalk';export class GlobalContext{[a49_0x300dd0(0x17a)];[a49_0x300dd0(0x189)];[a49_0x300dd0(0x159)];[a49_0x300dd0(0x168)];[a49_0x300dd0(0x18c)];[a49_0x300dd0(0x190)];[a49_0x300dd0(0x147)];[a49_0x300dd0(0x17b)];['verbose'];[a49_0x300dd0(0x17e)];['profile'];[a49_0x300dd0(0x160)];[a49_0x300dd0(0x163)];[a49_0x300dd0(0x181)];[a49_0x300dd0(0x15c)];constructor(_0xdc94c7){const _0x6bec05=a49_0x300dd0;this[_0x6bec05(0x181)]=_0xdc94c7[_0x6bec05(0x15a)]||getCurrentSessionPID()[_0x6bec05(0x18d)]();const _0x269841=loadSessionContext(_0xdc94c7[_0x6bec05(0x15a)]),_0x414f57=loadProjectConfig(),_0x1eada8=this[_0x6bec05(0x187)]();this[_0x6bec05(0x163)]=_0xdc94c7[_0x6bec05(0x164)]||_0x269841?.[_0x6bec05(0x164)]||_0x1eada8[_0x6bec05(0x164)]||getActiveProfile();const _0x93372=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x18dec4=_0x4fceb1=>{const _0x53a7dc=_0x6bec05;if(!_0x4fceb1)return{};const _0x4b5dee=_0x4fceb1,_0x77e808={};for(const [_0x4919c3,_0x1b1b53]of Object[_0x53a7dc(0x161)](_0x4b5dee)){typeof _0x1b1b53===_0x53a7dc(0x15b)&&(_0x77e808[_0x4919c3]=_0x1b1b53);}return _0x77e808;},_0x167c34={},_0x58315a=(_0x5c4a88,_0x4cbf8a,_0x495186)=>{const _0x42e70a=_0x6bec05;if(!_0x5c4a88)return![];if(_0x495186&&_0x5c4a88===_0x495186)return![];const _0x46dc1c=_0x269841,_0x46e493=_0x414f57,_0x4e7582=_0x93372?.[_0x42e70a(0x15d)],_0x7ebefd=_0x1eada8,_0x54fc38=_0x46dc1c?.[_0x4cbf8a],_0x430adf=_0x46e493?.[_0x4cbf8a],_0x248cf6=_0x4e7582?.[_0x4cbf8a],_0x1f1686=_0x7ebefd[_0x4cbf8a];return _0x5c4a88!==_0x54fc38&&_0x5c4a88!==_0x430adf&&_0x5c4a88!==_0x248cf6&&_0x5c4a88!==_0x1f1686;},_0x3b3d66=[{'optionKey':_0x6bec05(0x17a),'contextKey':_0x6bec05(0x17a),'defaultValue':_0x6bec05(0x174)},{'optionKey':_0x6bec05(0x189),'contextKey':_0x6bec05(0x189)},{'optionKey':_0x6bec05(0x18a),'contextKey':_0x6bec05(0x159)},{'optionKey':_0x6bec05(0x153),'contextKey':_0x6bec05(0x18c)},{'optionKey':_0x6bec05(0x14e),'contextKey':'llm_agent'},{'optionKey':_0x6bec05(0x164),'contextKey':_0x6bec05(0x164)}];for(const {optionKey:_0x5ceb51,contextKey:_0x37d950,defaultValue:_0x20cb34}of _0x3b3d66){const _0x574a08=_0xdc94c7[_0x5ceb51];_0x58315a(_0x574a08,_0x37d950,_0x20cb34)&&(_0x167c34[_0x37d950]=_0x574a08);}this[_0x6bec05(0x160)]={'cliFlags':_0x167c34,'session':_0x18dec4(_0x269841),'project':_0x18dec4(_0x414f57),'profile':_0x18dec4(_0x93372?.[_0x6bec05(0x15d)]),'global':_0x18dec4(_0x1eada8)};const _0x10bd3a={...this['layers'][_0x6bec05(0x158)],...this[_0x6bec05(0x160)]['profile'],...this[_0x6bec05(0x160)][_0x6bec05(0x16a)]};process['env']['TDX_SITE']&&!this[_0x6bec05(0x160)][_0x6bec05(0x15a)][_0x6bec05(0x17a)]&&!this[_0x6bec05(0x160)]['cliFlags'][_0x6bec05(0x17a)]&&(_0x10bd3a[_0x6bec05(0x17a)]=process['env'][_0x6bec05(0x146)]);Object[_0x6bec05(0x154)](_0x10bd3a,this[_0x6bec05(0x160)][_0x6bec05(0x15a)]),Object[_0x6bec05(0x154)](_0x10bd3a,this[_0x6bec05(0x160)][_0x6bec05(0x148)]);const _0x51b0ef=_0x10bd3a[_0x6bec05(0x17a)]||'us01';this['site']=resolveSite(_0x51b0ef),this[_0x6bec05(0x189)]=_0x10bd3a[_0x6bec05(0x189)],this[_0x6bec05(0x159)]=_0x10bd3a[_0x6bec05(0x159)],this['segment_path']=_0x10bd3a[_0x6bec05(0x168)],this[_0x6bec05(0x18c)]=_0x10bd3a[_0x6bec05(0x18c)],this[_0x6bec05(0x190)]=_0x10bd3a['llm_agent'],this[_0x6bec05(0x147)]=_0x10bd3a['workflow_project'],this[_0x6bec05(0x17c)]=_0xdc94c7['verbose']||![],this['logLevel']=_0xdc94c7[_0x6bec05(0x17e)]??LogLevel[_0x6bec05(0x150)],this[_0x6bec05(0x164)]=this[_0x6bec05(0x163)]||undefined,this[_0x6bec05(0x17b)]=getAPIKey(this[_0x6bec05(0x17a)],this[_0x6bec05(0x163)]||undefined);const _0x1ca86e=getConfigDir(),_0xc326e7=a49_0x330cc0[_0x6bec05(0x14f)](_0x1ca86e,_0x6bec05(0x14b),this['sessionId']+_0x6bec05(0x170)),_0x5f52b9=findProjectConfigPath(),_0x1f815a=a49_0x330cc0[_0x6bec05(0x14f)](_0x1ca86e,_0x6bec05(0x192)),_0x2350f7=a49_0x330cc0['join'](_0x1ca86e,'.env');let _0x192560=null,_0x110b6c=null;this['activeProfile']&&(_0x192560=a49_0x330cc0['join'](_0x1ca86e,_0x6bec05(0x167),this[_0x6bec05(0x163)],'tdx.json'),_0x110b6c=a49_0x330cc0[_0x6bec05(0x14f)](_0x1ca86e,_0x6bec05(0x167),this['activeProfile'],_0x6bec05(0x178))),this[_0x6bec05(0x15c)]={'session':a49_0x80c142[_0x6bec05(0x14d)](_0xc326e7)?_0xc326e7:null,'project':_0x5f52b9,'profile':_0x192560&&a49_0x80c142[_0x6bec05(0x14d)](_0x192560)?_0x192560:null,'profileCredentials':_0x110b6c&&a49_0x80c142['existsSync'](_0x110b6c)?_0x110b6c:null,'global':a49_0x80c142[_0x6bec05(0x14d)](_0x1f815a)?_0x1f815a:null,'globalCredentials':a49_0x80c142['existsSync'](_0x2350f7)?_0x2350f7:null};}[a49_0x300dd0(0x16f)](_0x4916e7,_0x14c4e2){const _0x3092cf=a49_0x300dd0;if(!_0x14c4e2)return _0x3092cf(0x162);const _0x4a460b=_0x14c4e2;if(this['layers'][_0x3092cf(0x148)][_0x4916e7]===_0x4a460b){if(_0x4916e7===_0x3092cf(0x17a)&&_0x4a460b==='us01'&&!this[_0x3092cf(0x160)]['session'][_0x3092cf(0x17a)]&&!this['layers'][_0x3092cf(0x16a)]['site']&&!this[_0x3092cf(0x160)][_0x3092cf(0x164)]['site']&&!this[_0x3092cf(0x160)][_0x3092cf(0x158)][_0x3092cf(0x17a)])return _0x3092cf(0x179);return _0x3092cf(0x149)+_0x4916e7[_0x3092cf(0x17f)](/_/g,'-');}if(this[_0x3092cf(0x160)]['session'][_0x4916e7]===_0x4a460b)return'session';if(this[_0x3092cf(0x160)][_0x3092cf(0x16a)][_0x4916e7]===_0x4a460b)return _0x3092cf(0x16a);if(this[_0x3092cf(0x160)][_0x3092cf(0x164)][_0x4916e7]===_0x4a460b)return _0x3092cf(0x172)+this[_0x3092cf(0x163)];if(this['layers'][_0x3092cf(0x158)][_0x4916e7]===_0x4a460b)return _0x3092cf(0x158);return _0x3092cf(0x179);}[a49_0x300dd0(0x187)](){const _0x108405=a49_0x300dd0,_0x3a2ce1=a49_0x330cc0['join'](getConfigDir(),_0x108405(0x192));if(!a49_0x80c142[_0x108405(0x14d)](_0x3a2ce1))return{};try{const _0x34e39a=a49_0x80c142['readFileSync'](_0x3a2ce1,_0x108405(0x188));return JSON['parse'](_0x34e39a);}catch{return{};}}[a49_0x300dd0(0x156)](_0x54437c){const _0x383fed=a49_0x300dd0;_0x54437c[_0x383fed(0x17a)]=this[_0x383fed(0x17a)],!_0x54437c[_0x383fed(0x189)]&&this[_0x383fed(0x189)]&&(_0x54437c['database']=this[_0x383fed(0x189)]),!_0x54437c[_0x383fed(0x18a)]&&this['parent_segment']&&(_0x54437c[_0x383fed(0x18a)]=this[_0x383fed(0x159)]),!_0x54437c['segmentPath']&&this[_0x383fed(0x168)]&&(_0x54437c[_0x383fed(0x186)]=this[_0x383fed(0x168)]),!_0x54437c[_0x383fed(0x153)]&&this[_0x383fed(0x18c)]&&(_0x54437c[_0x383fed(0x153)]=this[_0x383fed(0x18c)]),!_0x54437c[_0x383fed(0x14e)]&&this[_0x383fed(0x190)]&&(_0x54437c[_0x383fed(0x14e)]=this[_0x383fed(0x190)]),!_0x54437c[_0x383fed(0x16e)]&&this[_0x383fed(0x147)]&&(_0x54437c[_0x383fed(0x16e)]=this[_0x383fed(0x147)]);}[a49_0x300dd0(0x15e)](){const _0x89f936=a49_0x300dd0;return[{'key':'site','value':this['site']},{'key':'database','value':this[_0x89f936(0x189)]},{'key':_0x89f936(0x159),'value':this[_0x89f936(0x159)]},{'key':_0x89f936(0x168),'value':this['segment_path']},{'key':_0x89f936(0x18c),'value':this[_0x89f936(0x18c)]},{'key':_0x89f936(0x190),'value':this['llm_agent']},{'key':_0x89f936(0x147),'value':this[_0x89f936(0x147)]},{'key':_0x89f936(0x164),'value':this[_0x89f936(0x163)]||undefined}];}[a49_0x300dd0(0x14c)](){const _0x88cc78=a49_0x300dd0;console[_0x88cc78(0x194)](a49_0x50a9ad[_0x88cc78(0x18f)](_0x88cc78(0x166)));for(const {key:_0x1518a9,value:_0x5a0894}of this['getParameters']()){_0x5a0894&&console[_0x88cc78(0x194)](a49_0x50a9ad[_0x88cc78(0x14a)](_0x1518a9)+':\x20'+_0x5a0894);}}[a49_0x300dd0(0x183)](){const _0x484671=a49_0x300dd0;console[_0x484671(0x194)](a49_0x50a9ad[_0x484671(0x18f)](_0x484671(0x166)));for(const {key:_0x25b2d0,value:_0x26842a}of this[_0x484671(0x15e)]()){if(_0x26842a){const _0x574fdb=_0x25b2d0===_0x484671(0x164)?_0x484671(0x155):'('+this['getSource'](_0x25b2d0,_0x26842a)+')';console[_0x484671(0x194)](a49_0x50a9ad['cyan'](_0x25b2d0)+':\x20'+_0x26842a+'\x20'+a49_0x50a9ad[_0x484671(0x193)](_0x574fdb));}}console[_0x484671(0x194)]('\x0a'+a49_0x50a9ad['bold'](_0x484671(0x18b)));const _0x170ebe=[{'label':_0x484671(0x185),'path':this[_0x484671(0x15c)][_0x484671(0x15a)],'extra':'(session:\x20'+this['sessionId']+')'},{'label':'Project','path':this[_0x484671(0x15c)][_0x484671(0x16a)]},{'label':_0x484671(0x177),'path':this[_0x484671(0x15c)]['profile']},{'label':'Profile\x20Credentials','path':this['configFiles'][_0x484671(0x16c)]},{'label':_0x484671(0x18e),'path':this[_0x484671(0x15c)][_0x484671(0x158)]},{'label':_0x484671(0x16b),'path':this[_0x484671(0x15c)][_0x484671(0x169)]}];for(const {label:_0x144e84,path:_0x41e679,extra:_0x6666a1}of _0x170ebe){if(_0x41e679)console[_0x484671(0x194)](a49_0x50a9ad[_0x484671(0x14a)](_0x144e84)+':\x20'+_0x41e679+'\x20'+a49_0x50a9ad['green']('✓')+(_0x6666a1?'\x20'+a49_0x50a9ad['dim'](_0x6666a1):''));else{if(_0x144e84===_0x484671(0x185))console[_0x484671(0x194)](a49_0x50a9ad[_0x484671(0x14a)](_0x144e84)+':\x20'+a49_0x50a9ad[_0x484671(0x193)]('none')+'\x20'+a49_0x50a9ad['dim']('(using\x20session:\x20'+this[_0x484671(0x181)]+')'));else(_0x144e84==='Project'||_0x144e84===_0x484671(0x18e))&&console['log'](a49_0x50a9ad['cyan'](_0x144e84)+':\x20'+a49_0x50a9ad[_0x484671(0x193)](_0x484671(0x182)));}}}async[a49_0x300dd0(0x184)](){const _0x3fc0fa=a49_0x300dd0;return this['apiKey']=await getAPIKeyAsync(this[_0x3fc0fa(0x17a)],this[_0x3fc0fa(0x163)]||undefined),this[_0x3fc0fa(0x17b)];}static async[a49_0x300dd0(0x151)](_0x2b8d14){const _0x5d28ea=a49_0x300dd0,_0x33ff4e=new GlobalContext(_0x2b8d14);return await _0x33ff4e[_0x5d28ea(0x184)](),_0x33ff4e;}}
|
|
1
|
+
const a49_0x166b0b=a49_0x55b5;(function(_0x11442e,_0xd80c54){const _0x18050e=a49_0x55b5,_0x5d8888=_0x11442e();while(!![]){try{const _0x48dada=parseInt(_0x18050e(0xa1))/0x1*(parseInt(_0x18050e(0x93))/0x2)+parseInt(_0x18050e(0x94))/0x3+parseInt(_0x18050e(0xcf))/0x4*(-parseInt(_0x18050e(0xba))/0x5)+parseInt(_0x18050e(0xad))/0x6*(-parseInt(_0x18050e(0xcd))/0x7)+-parseInt(_0x18050e(0xdd))/0x8*(parseInt(_0x18050e(0xd9))/0x9)+parseInt(_0x18050e(0xa5))/0xa+parseInt(_0x18050e(0xce))/0xb;if(_0x48dada===_0xd80c54)break;else _0x5d8888['push'](_0x5d8888['shift']());}catch(_0x2f8a37){_0x5d8888['push'](_0x5d8888['shift']());}}}(a49_0x39c2,0x7794b));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a49_0x55b5(_0x176e23,_0x4703a3){_0x176e23=_0x176e23-0x8f;const _0x39c24e=a49_0x39c2();let _0x55b57a=_0x39c24e[_0x176e23];return _0x55b57a;}import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a49_0x1fdbe9 from'node:fs';import*as a49_0x5a575b from'node:path';import a49_0x51a75b from'chalk';function a49_0x39c2(){const _0x5068fe=['42WYtyra','11818884EwmxlU','298388WuuTtA','parentSegment','parse','Global','Profile','verbose','toString','cliFlags','site','cyan','54EZesKx','bold','llmAgent','loadGlobalConfig','1089344exepAA','Project','CLI\x20flag:\x20--','sessionId','.json','env','logLevel','12046IQUtKD','1014447zGsJXZ','Global\x20Credentials','llmProject','not\x20set','us01','global','string','profiles','createAsync','(using\x20session:\x20','displayWithSources','workflowProject','green','30xdcbOZ','utf-8','display','segmentPath','5966910VXGbjL','getSource','log','activeProfile','profile','dim','configFiles','resolveAPIKeyAsync','808566fdjFiJ','config','[context]','existsSync','replace','none','llm_project','apiKey','.env','workflow_project','project','[configuration\x20files]','session','5Bxvdib','parent_segment','llm_agent','TDX_SITE','tdx.json','sessions','assign','Session','Profile\x20Credentials','(active)','profile:\x20','layers','default','getParameters','join','profileCredentials','entries','database','segment_path'];a49_0x39c2=function(){return _0x5068fe;};return a49_0x39c2();}export class GlobalContext{['site'];[a49_0x166b0b(0xcb)];[a49_0x166b0b(0xbb)];[a49_0x166b0b(0xcc)];[a49_0x166b0b(0xb3)];[a49_0x166b0b(0xbc)];[a49_0x166b0b(0xb6)];[a49_0x166b0b(0xb4)];[a49_0x166b0b(0xd4)];[a49_0x166b0b(0x92)];[a49_0x166b0b(0xa9)];[a49_0x166b0b(0xc5)];[a49_0x166b0b(0xa8)];['sessionId'];[a49_0x166b0b(0xab)];constructor(_0x2f43c9){const _0x106ed1=a49_0x166b0b;this[_0x106ed1(0x8f)]=_0x2f43c9['session']||getCurrentSessionPID()[_0x106ed1(0xd5)]();const _0x4b963e=loadSessionContext(_0x2f43c9[_0x106ed1(0xb9)]),_0x5a118b=loadProjectConfig(),_0x8bcac2=this['loadGlobalConfig']();this[_0x106ed1(0xa8)]=_0x2f43c9[_0x106ed1(0xa9)]||_0x4b963e?.[_0x106ed1(0xa9)]||_0x8bcac2[_0x106ed1(0xa9)]||getActiveProfile();const _0x2a6b29=this[_0x106ed1(0xa8)]?loadProfile(this['activeProfile']):null,_0x10c55a=_0x263237=>{const _0x16335c=_0x106ed1;if(!_0x263237)return{};const _0x4eb2a8=_0x263237,_0x18abed={};for(const [_0x600c6,_0x1f38f8]of Object[_0x16335c(0xca)](_0x4eb2a8)){typeof _0x1f38f8===_0x16335c(0x9a)&&(_0x18abed[_0x600c6]=_0x1f38f8);}return _0x18abed;},_0x2e52c1={},_0x1f05de=(_0x5c69d1,_0x263b0d,_0x3b7d0e)=>{if(!_0x5c69d1)return![];if(_0x3b7d0e&&_0x5c69d1===_0x3b7d0e)return![];const _0x3e22e8=_0x4b963e,_0x4a1ae5=_0x5a118b,_0x45ab1f=_0x2a6b29?.['config'],_0x4cccc2=_0x8bcac2,_0x30f0f8=_0x3e22e8?.[_0x263b0d],_0x517a97=_0x4a1ae5?.[_0x263b0d],_0x3481d9=_0x45ab1f?.[_0x263b0d],_0x35ab2e=_0x4cccc2[_0x263b0d];return _0x5c69d1!==_0x30f0f8&&_0x5c69d1!==_0x517a97&&_0x5c69d1!==_0x3481d9&&_0x5c69d1!==_0x35ab2e;},_0x54aaa0=[{'optionKey':_0x106ed1(0xd7),'contextKey':_0x106ed1(0xd7),'defaultValue':_0x106ed1(0x98)},{'optionKey':_0x106ed1(0xcb),'contextKey':_0x106ed1(0xcb)},{'optionKey':_0x106ed1(0xd0),'contextKey':_0x106ed1(0xbb)},{'optionKey':_0x106ed1(0x96),'contextKey':_0x106ed1(0xb3)},{'optionKey':_0x106ed1(0xdb),'contextKey':'llm_agent'},{'optionKey':'profile','contextKey':'profile'}];for(const {optionKey:_0x5a1262,contextKey:_0x50494d,defaultValue:_0x4ebc73}of _0x54aaa0){const _0x272125=_0x2f43c9[_0x5a1262];_0x1f05de(_0x272125,_0x50494d,_0x4ebc73)&&(_0x2e52c1[_0x50494d]=_0x272125);}this[_0x106ed1(0xc5)]={'cliFlags':_0x2e52c1,'session':_0x10c55a(_0x4b963e),'project':_0x10c55a(_0x5a118b),'profile':_0x10c55a(_0x2a6b29?.[_0x106ed1(0xae)]),'global':_0x10c55a(_0x8bcac2)};const _0x2f736f={...this[_0x106ed1(0xc5)][_0x106ed1(0x99)],...this['layers'][_0x106ed1(0xa9)],...this[_0x106ed1(0xc5)][_0x106ed1(0xb7)]};process[_0x106ed1(0x91)][_0x106ed1(0xbd)]&&!this[_0x106ed1(0xc5)]['session'][_0x106ed1(0xd7)]&&!this[_0x106ed1(0xc5)][_0x106ed1(0xd6)]['site']&&(_0x2f736f[_0x106ed1(0xd7)]=process[_0x106ed1(0x91)][_0x106ed1(0xbd)]);Object[_0x106ed1(0xc0)](_0x2f736f,this[_0x106ed1(0xc5)][_0x106ed1(0xb9)]),Object[_0x106ed1(0xc0)](_0x2f736f,this['layers'][_0x106ed1(0xd6)]);const _0x35e02a=_0x2f736f[_0x106ed1(0xd7)]||_0x106ed1(0x98);this[_0x106ed1(0xd7)]=resolveSite(_0x35e02a),this[_0x106ed1(0xcb)]=_0x2f736f[_0x106ed1(0xcb)],this['parent_segment']=_0x2f736f[_0x106ed1(0xbb)],this[_0x106ed1(0xcc)]=_0x2f736f[_0x106ed1(0xcc)],this[_0x106ed1(0xb3)]=_0x2f736f[_0x106ed1(0xb3)],this[_0x106ed1(0xbc)]=_0x2f736f['llm_agent'],this[_0x106ed1(0xb6)]=_0x2f736f['workflow_project'],this[_0x106ed1(0xd4)]=_0x2f43c9[_0x106ed1(0xd4)]||![],this[_0x106ed1(0x92)]=_0x2f43c9[_0x106ed1(0x92)]??LogLevel['INFO'],this[_0x106ed1(0xa9)]=this[_0x106ed1(0xa8)]||undefined,this[_0x106ed1(0xb4)]=getAPIKey(this[_0x106ed1(0xd7)],this['activeProfile']||undefined);const _0x3afa44=getConfigDir(),_0x36bf09=a49_0x5a575b[_0x106ed1(0xc8)](_0x3afa44,_0x106ed1(0xbf),this['sessionId']+_0x106ed1(0x90)),_0x1ba6e2=findProjectConfigPath(),_0x89e3c0=a49_0x5a575b[_0x106ed1(0xc8)](_0x3afa44,'tdx.json'),_0x143d80=a49_0x5a575b[_0x106ed1(0xc8)](_0x3afa44,_0x106ed1(0xb5));let _0x4a4e23=null,_0x4c730b=null;this['activeProfile']&&(_0x4a4e23=a49_0x5a575b[_0x106ed1(0xc8)](_0x3afa44,_0x106ed1(0x9b),this[_0x106ed1(0xa8)],_0x106ed1(0xbe)),_0x4c730b=a49_0x5a575b[_0x106ed1(0xc8)](_0x3afa44,_0x106ed1(0x9b),this[_0x106ed1(0xa8)],_0x106ed1(0xb5))),this[_0x106ed1(0xab)]={'session':a49_0x1fdbe9[_0x106ed1(0xb0)](_0x36bf09)?_0x36bf09:null,'project':_0x1ba6e2,'profile':_0x4a4e23&&a49_0x1fdbe9['existsSync'](_0x4a4e23)?_0x4a4e23:null,'profileCredentials':_0x4c730b&&a49_0x1fdbe9[_0x106ed1(0xb0)](_0x4c730b)?_0x4c730b:null,'global':a49_0x1fdbe9[_0x106ed1(0xb0)](_0x89e3c0)?_0x89e3c0:null,'globalCredentials':a49_0x1fdbe9['existsSync'](_0x143d80)?_0x143d80:null};}[a49_0x166b0b(0xa6)](_0x330612,_0x29d785){const _0x3163d1=a49_0x166b0b;if(!_0x29d785)return _0x3163d1(0x97);const _0x2d7b44=_0x29d785;if(this['layers']['cliFlags'][_0x330612]===_0x2d7b44){if(_0x330612===_0x3163d1(0xd7)&&_0x2d7b44===_0x3163d1(0x98)&&!this[_0x3163d1(0xc5)][_0x3163d1(0xb9)][_0x3163d1(0xd7)]&&!this['layers'][_0x3163d1(0xb7)][_0x3163d1(0xd7)]&&!this['layers']['profile'][_0x3163d1(0xd7)]&&!this['layers'][_0x3163d1(0x99)]['site'])return _0x3163d1(0xc6);return _0x3163d1(0xdf)+_0x330612[_0x3163d1(0xb1)](/_/g,'-');}if(this['layers'][_0x3163d1(0xb9)][_0x330612]===_0x2d7b44)return _0x3163d1(0xb9);if(this[_0x3163d1(0xc5)][_0x3163d1(0xb7)][_0x330612]===_0x2d7b44)return _0x3163d1(0xb7);if(this['layers']['profile'][_0x330612]===_0x2d7b44)return _0x3163d1(0xc4)+this['activeProfile'];if(this['layers'][_0x3163d1(0x99)][_0x330612]===_0x2d7b44)return _0x3163d1(0x99);return _0x3163d1(0xc6);}[a49_0x166b0b(0xdc)](){const _0x18ead6=a49_0x166b0b,_0x642b6=a49_0x5a575b['join'](getConfigDir(),_0x18ead6(0xbe));if(!a49_0x1fdbe9[_0x18ead6(0xb0)](_0x642b6))return{};try{const _0x17cede=a49_0x1fdbe9['readFileSync'](_0x642b6,_0x18ead6(0xa2));return JSON[_0x18ead6(0xd1)](_0x17cede);}catch{return{};}}['injectIntoOptions'](_0x26bcba){const _0x49f68b=a49_0x166b0b;_0x26bcba[_0x49f68b(0xd7)]=this[_0x49f68b(0xd7)],!_0x26bcba[_0x49f68b(0xcb)]&&this[_0x49f68b(0xcb)]&&(_0x26bcba[_0x49f68b(0xcb)]=this[_0x49f68b(0xcb)]),!_0x26bcba['parentSegment']&&this[_0x49f68b(0xbb)]&&(_0x26bcba['parentSegment']=this[_0x49f68b(0xbb)]),!_0x26bcba[_0x49f68b(0xa4)]&&this[_0x49f68b(0xcc)]&&(_0x26bcba[_0x49f68b(0xa4)]=this[_0x49f68b(0xcc)]),!_0x26bcba[_0x49f68b(0x96)]&&this[_0x49f68b(0xb3)]&&(_0x26bcba[_0x49f68b(0x96)]=this[_0x49f68b(0xb3)]),!_0x26bcba['llmAgent']&&this[_0x49f68b(0xbc)]&&(_0x26bcba[_0x49f68b(0xdb)]=this[_0x49f68b(0xbc)]),!_0x26bcba['workflowProject']&&this['workflow_project']&&(_0x26bcba[_0x49f68b(0x9f)]=this[_0x49f68b(0xb6)]);}[a49_0x166b0b(0xc7)](){const _0x1b7eb4=a49_0x166b0b;return[{'key':_0x1b7eb4(0xd7),'value':this[_0x1b7eb4(0xd7)]},{'key':_0x1b7eb4(0xcb),'value':this['database']},{'key':_0x1b7eb4(0xbb),'value':this[_0x1b7eb4(0xbb)]},{'key':_0x1b7eb4(0xcc),'value':this[_0x1b7eb4(0xcc)]},{'key':_0x1b7eb4(0xb3),'value':this['llm_project']},{'key':'llm_agent','value':this['llm_agent']},{'key':_0x1b7eb4(0xb6),'value':this['workflow_project']},{'key':_0x1b7eb4(0xa9),'value':this[_0x1b7eb4(0xa8)]||undefined}];}[a49_0x166b0b(0xa3)](){const _0x1dbc02=a49_0x166b0b;console['log'](a49_0x51a75b[_0x1dbc02(0xda)](_0x1dbc02(0xaf)));for(const {key:_0x4429fc,value:_0x5c2714}of this[_0x1dbc02(0xc7)]()){_0x5c2714&&console[_0x1dbc02(0xa7)](a49_0x51a75b['cyan'](_0x4429fc)+':\x20'+_0x5c2714);}}[a49_0x166b0b(0x9e)](){const _0x262b33=a49_0x166b0b;console[_0x262b33(0xa7)](a49_0x51a75b[_0x262b33(0xda)](_0x262b33(0xaf)));for(const {key:_0x367e0f,value:_0x17fcff}of this[_0x262b33(0xc7)]()){if(_0x17fcff){const _0x459f8f=_0x367e0f==='profile'?_0x262b33(0xc3):'('+this['getSource'](_0x367e0f,_0x17fcff)+')';console[_0x262b33(0xa7)](a49_0x51a75b[_0x262b33(0xd8)](_0x367e0f)+':\x20'+_0x17fcff+'\x20'+a49_0x51a75b[_0x262b33(0xaa)](_0x459f8f));}}console[_0x262b33(0xa7)]('\x0a'+a49_0x51a75b[_0x262b33(0xda)](_0x262b33(0xb8)));const _0x393d05=[{'label':_0x262b33(0xc1),'path':this['configFiles'][_0x262b33(0xb9)],'extra':'(session:\x20'+this[_0x262b33(0x8f)]+')'},{'label':_0x262b33(0xde),'path':this[_0x262b33(0xab)]['project']},{'label':_0x262b33(0xd3),'path':this[_0x262b33(0xab)][_0x262b33(0xa9)]},{'label':_0x262b33(0xc2),'path':this[_0x262b33(0xab)][_0x262b33(0xc9)]},{'label':_0x262b33(0xd2),'path':this['configFiles'][_0x262b33(0x99)]},{'label':_0x262b33(0x95),'path':this['configFiles']['globalCredentials']}];for(const {label:_0x3a05c9,path:_0x57a8c9,extra:_0x250042}of _0x393d05){if(_0x57a8c9)console[_0x262b33(0xa7)](a49_0x51a75b[_0x262b33(0xd8)](_0x3a05c9)+':\x20'+_0x57a8c9+'\x20'+a49_0x51a75b[_0x262b33(0xa0)]('✓')+(_0x250042?'\x20'+a49_0x51a75b[_0x262b33(0xaa)](_0x250042):''));else{if(_0x3a05c9==='Session')console[_0x262b33(0xa7)](a49_0x51a75b[_0x262b33(0xd8)](_0x3a05c9)+':\x20'+a49_0x51a75b['dim']('none')+'\x20'+a49_0x51a75b['dim'](_0x262b33(0x9d)+this[_0x262b33(0x8f)]+')'));else(_0x3a05c9==='Project'||_0x3a05c9===_0x262b33(0xd2))&&console[_0x262b33(0xa7)](a49_0x51a75b['cyan'](_0x3a05c9)+':\x20'+a49_0x51a75b[_0x262b33(0xaa)](_0x262b33(0xb2)));}}}async[a49_0x166b0b(0xac)](){const _0x454910=a49_0x166b0b;return this[_0x454910(0xb4)]=await getAPIKeyAsync(this[_0x454910(0xd7)],this[_0x454910(0xa8)]||undefined),this['apiKey'];}static async[a49_0x166b0b(0x9c)](_0x1414de){const _0xc9ac66=a49_0x166b0b,_0x125108=new GlobalContext(_0x1414de);return await _0x125108[_0xc9ac66(0xac)](),_0x125108;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a50_0x40c2(_0x206b90,_0x1df0de){_0x206b90=_0x206b90-0x167;const _0x4df895=a50_0x4df8();let _0x40c28e=_0x4df895[_0x206b90];return _0x40c28e;}(function(_0xf77f65,_0x212186){const _0xf23d15=a50_0x40c2,_0x5a2489=_0xf77f65();while(!![]){try{const _0x457b6a=-parseInt(_0xf23d15(0x174))/0x1*(parseInt(_0xf23d15(0x181))/0x2)+parseInt(_0xf23d15(0x167))/0x3*(-parseInt(_0xf23d15(0x17f))/0x4)+parseInt(_0xf23d15(0x16c))/0x5+parseInt(_0xf23d15(0x176))/0x6+parseInt(_0xf23d15(0x16d))/0x7+parseInt(_0xf23d15(0x16a))/0x8*(parseInt(_0xf23d15(0x17e))/0x9)+parseInt(_0xf23d15(0x17b))/0xa*(parseInt(_0xf23d15(0x186))/0xb);if(_0x457b6a===_0x212186)break;else _0x5a2489['push'](_0x5a2489['shift']());}catch(_0x3d5068){_0x5a2489['push'](_0x5a2489['shift']());}}}(a50_0x4df8,0x9c40e));function a50_0x4df8(){const _0x5efc27=['profile:','3944230OlsDyI','2721089rYuqGW','error','@napi-rs/keyring','no\x20matching\x20entry','unavailable','not_found','includes','1232333aFuFTn','__keychain_test__','1928814dKcjaJ','could\x20not\x20be\x20found',':api_key','setPassword','cannot\x20find','170IfFrLe','getPassword','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.','11601uxNZHU','99348bIFSzN','restricted','2YbjQQX','deleteCredential','value','access_denied','message','305470HqrpIM','success','toLowerCase','reason','63vSqLrg','-25293','not\x20available','2624SmMsZx'];a50_0x4df8=function(){return _0x5efc27;};return a50_0x4df8();}const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0xbe27c2=a50_0x40c2;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x2a4856=await import(_0xbe27c2(0x16f));return EntryClass=_0x2a4856['Entry'],EntryClass;}catch(_0x434354){return keyringLoadError=_0x434354 instanceof Error?_0x434354:new Error(String(_0x434354)),null;}}function getAccountName(_0x17d5c2){const _0x3a4be7=a50_0x40c2,_0xa979b4=_0x17d5c2||'';return _0x3a4be7(0x16b)+_0xa979b4+_0x3a4be7(0x178);}export async function getKeychainAPIKey(_0x472f62){const _0x5a3b1c=a50_0x40c2,_0x41d7b7=await getKeychainAPIKeyWithStatus(_0x472f62);if(_0x41d7b7[_0x5a3b1c(0x187)])return _0x41d7b7[_0x5a3b1c(0x183)];return _0x41d7b7[_0x5a3b1c(0x189)]===_0x5a3b1c(0x184)&&console[_0x5a3b1c(0x16e)]('Warning:\x20'+_0x41d7b7[_0x5a3b1c(0x185)]),null;}export async function getKeychainAPIKeyWithStatus(_0x53cad2){const _0x354a8d=a50_0x40c2;try{const _0x41a942=await getEntryClass();if(!_0x41a942)return{'success':![],'reason':_0x354a8d(0x171)};const _0x262082=getAccountName(_0x53cad2),_0x4f4ea4=new _0x41a942(SERVICE_NAME,_0x262082),_0x5190e1=_0x4f4ea4[_0x354a8d(0x17c)]();if(_0x5190e1)return{'success':!![],'value':_0x5190e1};return{'success':![],'reason':_0x354a8d(0x172)};}catch(_0x295463){const _0x431abe=_0x295463 instanceof Error?_0x295463[_0x354a8d(0x185)]:String(_0x295463);if(_0x431abe['includes']('-25300')||_0x431abe[_0x354a8d(0x188)]()[_0x354a8d(0x173)](_0x354a8d(0x177))||_0x431abe[_0x354a8d(0x188)]()[_0x354a8d(0x173)]('not\x20found')||_0x431abe[_0x354a8d(0x188)]()[_0x354a8d(0x173)](_0x354a8d(0x170)))return{'success':![],'reason':_0x354a8d(0x172)};if(_0x431abe[_0x354a8d(0x173)](_0x354a8d(0x168))||_0x431abe['toLowerCase']()[_0x354a8d(0x173)](_0x354a8d(0x180))||_0x431abe['toLowerCase']()[_0x354a8d(0x173)]('access'))return{'success':![],'reason':_0x354a8d(0x184),'message':_0x354a8d(0x17d)};return{'success':![],'reason':_0x354a8d(0x171),'message':_0x431abe};}}export async function saveKeychainAPIKey(_0x69a7b6,_0x58923a){const _0x51cfd5=a50_0x40c2,_0x388ee1=await getEntryClass();if(!_0x388ee1)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x1df09b=getAccountName(_0x58923a),_0x4a0ae9=new _0x388ee1(SERVICE_NAME,_0x1df09b);_0x4a0ae9[_0x51cfd5(0x179)](_0x69a7b6);}export async function deleteKeychainAPIKey(_0x1a8b05){const _0xf493aa=a50_0x40c2;try{const _0x1e83fd=await getEntryClass();if(!_0x1e83fd)return![];const _0x561077=getAccountName(_0x1a8b05),_0x96af03=new _0x1e83fd(SERVICE_NAME,_0x561077);return _0x96af03[_0xf493aa(0x182)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x3d2162=a50_0x40c2;try{const _0x2a70f7=await getEntryClass();if(!_0x2a70f7)return![];const _0x3ef17a=new _0x2a70f7(SERVICE_NAME,_0x3d2162(0x175));return _0x3ef17a[_0x3d2162(0x17c)](),!![];}catch(_0x41b7fa){const _0x95566c=_0x41b7fa instanceof Error?_0x41b7fa['message'][_0x3d2162(0x188)]():'';if(_0x95566c[_0x3d2162(0x173)](_0x3d2162(0x169))||_0x95566c[_0x3d2162(0x173)]('not\x20supported')||_0x95566c[_0x3d2162(0x173)](_0x3d2162(0x17a)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a51_0x3d69c9=a51_0x21b4;(function(_0xd567c4,_0x37a9ce){const _0x578b46=a51_0x21b4,_0x17d625=_0xd567c4();while(!![]){try{const _0x4437a5=-parseInt(_0x578b46(0xbb))/0x1+parseInt(_0x578b46(0xb8))/0x2+parseInt(_0x578b46(0xfb))/0x3*(parseInt(_0x578b46(0xb7))/0x4)+-parseInt(_0x578b46(0xc6))/0x5*(-parseInt(_0x578b46(0xc8))/0x6)+-parseInt(_0x578b46(0xde))/0x7+parseInt(_0x578b46(0xee))/0x8*(parseInt(_0x578b46(0xbd))/0x9)+-parseInt(_0x578b46(0xe6))/0xa*(parseInt(_0x578b46(0xbc))/0xb);if(_0x4437a5===_0x37a9ce)break;else _0x17d625['push'](_0x17d625['shift']());}catch(_0x2b9d5d){_0x17d625['push'](_0x17d625['shift']());}}}(a51_0xb88e,0xef664));import*as a51_0x128d94 from'node:fs';import*as a51_0x527d49 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a51_0x3d69c9(0x103);export function getProfileParams(_0x542bba){const _0x248a3d=a51_0x3d69c9,_0x4dfcda={};if(!_0x542bba)return _0x4dfcda;for(const [_0x4af949,_0x37cd57]of Object[_0x248a3d(0x107)](_0x542bba)){_0x4af949!==_0x248a3d(0xb4)&&_0x37cd57!==undefined&&(_0x4dfcda[_0x4af949]=_0x37cd57);}return _0x4dfcda;}function a51_0xb88e(){const _0x3dcef1=['site','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','existsSync','3cygjSs','find','isDirectory','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','llm_agent','map','llm_project','@tdx-studio','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','local',':\x20Invalid\x20JSON\x20syntax','entries','set','has','Profile\x20\x27','description','filter','stringify','7337284HZTxqn','1703958tVjahi','message','directory','913711ptifdQ','5620406QkjebA','18kkxbbd','Invalid\x20profile\x20name:\x20','Warning:\x20Profile\x20\x27','some','parent_segment','length','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','parse','\x20\x201.\x20Edit:\x20','40IHReNo','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','916248XRTVVR','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','user','\x27\x20will\x20be\x20ignored','Warning:\x20Failed\x20to\x20parse\x20','localeCompare','sort','utf-8','toISOString','env','readdirSync','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','from','object','\x27\x20not\x20found\x20in\x20user\x20configuration','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x27:\x20config\x20must\x20be\x20an\x20object',',\x20creating\x20new\x20file','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','.env','11695131eowczt','profiles','join','TDX_PROFILE','keys','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','database','readFileSync','40uOQgJM','\x22\x20\x22','To\x20migrate:','warn','values','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','Profile\x20','\x20\x20mv\x20\x22','6803376IlVvJO','\x20does\x20not\x20exist','string','name','profile','tdx.json','push','includes','.env.'];a51_0xb88e=function(){return _0x3dcef1;};return a51_0xb88e();}export function getProfilesDir(){const _0x162232=a51_0x3d69c9;return a51_0x527d49[_0x162232(0xe0)](getConfigDir(),_0x162232(0xdf));}function getProfileDir(_0x243bee){const _0x4a9d18=a51_0x3d69c9;return a51_0x527d49[_0x4a9d18(0xe0)](getProfilesDir(),_0x243bee);}function getProfileConfigPath(_0x32d971){const _0x2c2dfd=a51_0x3d69c9;return a51_0x527d49[_0x2c2dfd(0xe0)](getProfileDir(_0x32d971),_0x2c2dfd(0xf3));}function getProfileEnvPath(_0x255779){const _0x13d777=a51_0x3d69c9;return a51_0x527d49[_0x13d777(0xe0)](getProfileDir(_0x255779),_0x13d777(0xdd));}function getGlobalConfigPath(){const _0x49a447=a51_0x3d69c9;return a51_0x527d49[_0x49a447(0xe0)](getConfigDir(),_0x49a447(0xf3));}function validateProfileName(_0x6ba28b){const _0x2e783c=a51_0x3d69c9;if(!/^@?[a-zA-Z0-9_-]+$/['test'](_0x6ba28b))throw new Error(_0x2e783c(0xbe)+_0x6ba28b+_0x2e783c(0xf8));}function validateProfileConfig(_0x5a22dc,_0x6f249a){const _0x179da5=a51_0x3d69c9;if(typeof _0x5a22dc!==_0x179da5(0xd6)||_0x5a22dc===null)throw new Error(_0x179da5(0xb3)+_0x6f249a+_0x179da5(0xda));const _0x6675e3=[_0x179da5(0xb4),_0x179da5(0xf7),_0x179da5(0xe4),'parent_segment',_0x179da5(0x102),_0x179da5(0x100)],_0x18e2eb=_0x5a22dc;for(const _0x386e15 of Object[_0x179da5(0xe2)](_0x18e2eb)){!_0x6675e3[_0x179da5(0xf5)](_0x386e15)&&console[_0x179da5(0xe9)](_0x179da5(0xbf)+_0x6f249a+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x386e15+_0x179da5(0xcc));}if(_0x18e2eb[_0x179da5(0xb4)]!==undefined&&typeof _0x18e2eb[_0x179da5(0xb4)]!==_0x179da5(0xf0))throw new Error(_0x179da5(0xb3)+_0x6f249a+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x18e2eb[_0x179da5(0xf7)]!==undefined&&typeof _0x18e2eb[_0x179da5(0xf7)]!==_0x179da5(0xf0))throw new Error(_0x179da5(0xb3)+_0x6f249a+_0x179da5(0xc3));if(_0x18e2eb[_0x179da5(0xe4)]!==undefined&&typeof _0x18e2eb[_0x179da5(0xe4)]!==_0x179da5(0xf0))throw new Error(_0x179da5(0xb3)+_0x6f249a+_0x179da5(0xc7));if(_0x18e2eb['parent_segment']!==undefined&&typeof _0x18e2eb[_0x179da5(0xc1)]!==_0x179da5(0xf0))throw new Error('Profile\x20\x27'+_0x6f249a+_0x179da5(0x104));if(_0x18e2eb['llm_project']!==undefined&&typeof _0x18e2eb[_0x179da5(0x102)]!=='string')throw new Error(_0x179da5(0xb3)+_0x6f249a+_0x179da5(0xfe));if(_0x18e2eb['llm_agent']!==undefined&&typeof _0x18e2eb[_0x179da5(0x100)]!=='string')throw new Error('Profile\x20\x27'+_0x6f249a+_0x179da5(0xeb));return!![];}function loadProfilesFromTdxJson(_0x23f157,_0x2ff0d3){const _0x5e551f=a51_0x3d69c9;if(!a51_0x128d94[_0x5e551f(0xfa)](_0x23f157))return[];try{const _0x588c12=a51_0x128d94[_0x5e551f(0xe5)](_0x23f157,'utf-8'),_0x14e9a6=JSON[_0x5e551f(0xc4)](_0x588c12);if(!_0x14e9a6[_0x5e551f(0xdf)]||typeof _0x14e9a6['profiles']!==_0x5e551f(0xd6))return[];const _0x4f2dff=[];for(const [_0x41469a,_0x5a7144]of Object['entries'](_0x14e9a6[_0x5e551f(0xdf)])){try{validateProfileConfig(_0x5a7144,_0x41469a);const _0x5390e1=getNewCredentialPath(_0x41469a),_0x580aa0=getOldCredentialPath(_0x41469a),_0x3873d5=a51_0x128d94[_0x5e551f(0xfa)](_0x5390e1)||a51_0x128d94[_0x5e551f(0xfa)](_0x580aa0);_0x4f2dff[_0x5e551f(0xf4)]({'name':_0x41469a,'config':_0x5a7144,'metadata':{'name':_0x41469a,'createdAt':new Date()[_0x5e551f(0xd1)]()},'hasCredentials':_0x3873d5,'scope':_0x2ff0d3});}catch(_0x310a06){_0x310a06 instanceof Error&&(console['warn'](_0x5e551f(0xd9)+_0x23f157+':'),console[_0x5e551f(0xe9)]('\x20\x20'+_0x310a06['message']+'\x0a'));}}return _0x4f2dff;}catch(_0x3fdc1c){return _0x3fdc1c instanceof SyntaxError?(console['warn'](_0x5e551f(0xd8)+_0x23f157+_0x5e551f(0x106)),console[_0x5e551f(0xe9)]('Error:\x20'+_0x3fdc1c[_0x5e551f(0xb9)]+'\x0a')):console['warn'](_0x5e551f(0xf9)+_0x23f157+':\x20'+_0x3fdc1c+'\x0a'),[];}}export function getNewCredentialPath(_0x51201e){const _0x5b8535=a51_0x3d69c9;return a51_0x527d49[_0x5b8535(0xe0)](getConfigDir(),_0x5b8535(0xf6)+_0x51201e);}function getOldCredentialPath(_0x482ce7){const _0x4a6c62=a51_0x3d69c9;return a51_0x527d49[_0x4a6c62(0xe0)](getProfilesDir(),_0x482ce7,_0x4a6c62(0xdd));}function loadProfilesFromTdxJsonFiles(){const _0x2d035f=a51_0x3d69c9,_0x49851e=[],_0x1cd53a=findProjectConfigPath();_0x1cd53a&&_0x49851e['push'](...loadProfilesFromTdxJson(_0x1cd53a,_0x2d035f(0x105)));const _0x2f8c96=a51_0x527d49[_0x2d035f(0xe0)](getConfigDir(),'tdx.json');return _0x49851e[_0x2d035f(0xf4)](...loadProfilesFromTdxJson(_0x2f8c96,_0x2d035f(0xcb))),_0x49851e;}function loadProfilesFromDirectories(){const _0x2202a8=a51_0x3d69c9,_0x27751a=getProfilesDir();if(!a51_0x128d94[_0x2202a8(0xfa)](_0x27751a))return[];try{return a51_0x128d94[_0x2202a8(0xd3)](_0x27751a,{'withFileTypes':!![]})[_0x2202a8(0xb5)](_0x33904f=>_0x33904f[_0x2202a8(0xfd)]())[_0x2202a8(0x101)](_0x1d6b3f=>_0x1d6b3f[_0x2202a8(0xf1)])[_0x2202a8(0xb5)](_0x109ac1=>{const _0x3e85f8=_0x2202a8,_0xe91489=getProfileConfigPath(_0x109ac1),_0x5d8ce1=getProfileEnvPath(_0x109ac1);return a51_0x128d94[_0x3e85f8(0xfa)](_0xe91489)||a51_0x128d94[_0x3e85f8(0xfa)](_0x5d8ce1);})[_0x2202a8(0x101)](_0x47c519=>{const _0x21c178=loadProfileFromDirectory(_0x47c519);if(_0x21c178)return{..._0x21c178,'scope':'directory'};return null;})['filter'](_0x8de0f9=>_0x8de0f9!==null);}catch{return[];}}function loadProfileFromDirectory(_0xdc1976){const _0x573ce9=a51_0x3d69c9,_0xbddd0=getProfileConfigPath(_0xdc1976),_0x2c70ef=getOldCredentialPath(_0xdc1976);if(!a51_0x128d94[_0x573ce9(0xfa)](_0xbddd0)&&!a51_0x128d94[_0x573ce9(0xfa)](_0x2c70ef))return null;let _0x2115a8={},_0x2d368c={'name':_0xdc1976,'createdAt':new Date()[_0x573ce9(0xd1)]()};if(a51_0x128d94[_0x573ce9(0xfa)](_0xbddd0))try{const _0x5263a0=a51_0x128d94[_0x573ce9(0xe5)](_0xbddd0,_0x573ce9(0xd0)),_0x6dfd18=JSON['parse'](_0x5263a0),{metadata:_0x4561d3,..._0x2b421e}=_0x6dfd18;_0x2115a8=_0x2b421e,_0x4561d3&&(_0x2d368c=_0x4561d3);}catch{}return{'name':_0xdc1976,'config':_0x2115a8,'metadata':_0x2d368c,'hasCredentials':a51_0x128d94[_0x573ce9(0xfa)](_0x2c70ef),'scope':_0x573ce9(0xba)};}export function listProfiles(){const _0xd3e352=a51_0x3d69c9,_0x553022=loadProfilesFromTdxJsonFiles(),_0x207465=loadProfilesFromDirectories();if(_0x207465[_0xd3e352(0xc2)]>0x0){const _0x90a75f=_0x207465[_0xd3e352(0x101)](_0xb9b6a1=>_0xb9b6a1[_0xd3e352(0xf1)])[_0xd3e352(0xe0)](',\x20'),_0x35c186=getConfigDir();console[_0xd3e352(0xe9)](_0xd3e352(0xca)+_0x90a75f),console['warn'](_0xd3e352(0xd4)),console['warn'](_0xd3e352(0xc5)+a51_0x527d49[_0xd3e352(0xe0)](_0x35c186,_0xd3e352(0xf3))),console['warn'](_0xd3e352(0xc9)),console['warn'](_0xd3e352(0xe3));}const _0x2e4f41=[..._0x553022,..._0x207465],_0x22be1b=new Map();for(const _0x1896ab of _0x2e4f41){!_0x22be1b[_0xd3e352(0x109)](_0x1896ab[_0xd3e352(0xf1)])&&_0x22be1b[_0xd3e352(0x108)](_0x1896ab[_0xd3e352(0xf1)],_0x1896ab);}return Array[_0xd3e352(0xd5)](_0x22be1b[_0xd3e352(0xea)]())[_0xd3e352(0xcf)]((_0x5bfcc1,_0x3bf532)=>_0x5bfcc1[_0xd3e352(0xf1)][_0xd3e352(0xce)](_0x3bf532['name']));}export function profileExists(_0x4b4422){const _0x21c350=a51_0x3d69c9,_0x53c7bd=listProfiles();return _0x53c7bd[_0x21c350(0xc0)](_0x4bc4d0=>_0x4bc4d0['name']===_0x4b4422);}function a51_0x21b4(_0x36ed05,_0x1f5efa){_0x36ed05=_0x36ed05-0xb3;const _0xb88e6a=a51_0xb88e();let _0x21b430=_0xb88e6a[_0x36ed05];return _0x21b430;}export function loadProfile(_0x186505){const _0x291141=a51_0x3d69c9;validateProfileName(_0x186505);const _0x18291f=listProfiles(),_0x453163=_0x18291f[_0x291141(0xfc)](_0x41a1bf=>_0x41a1bf[_0x291141(0xf1)]===_0x186505);return _0x453163||null;}export function saveProfile(_0x2a147e,_0xb171ff,_0x26e2d8=![]){saveProfileToUserConfig(_0x2a147e,_0xb171ff);}export function deleteProfile(_0x3ee65e){const _0x216278=a51_0x3d69c9;validateProfileName(_0x3ee65e);const _0x10e808=getProfileDir(_0x3ee65e);if(!a51_0x128d94['existsSync'](_0x10e808))throw new Error(_0x216278(0xec)+_0x3ee65e+'\x20does\x20not\x20exist');a51_0x128d94['rmSync'](_0x10e808,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x162fed,_0x58375f){const _0x24bae4=a51_0x3d69c9;validateProfileName(_0x162fed);const _0x81c74e=getGlobalConfigPath(),_0x5a2770=getConfigDir();!a51_0x128d94['existsSync'](_0x5a2770)&&createSecureDirectory(_0x5a2770);let _0x47fa28={};if(a51_0x128d94[_0x24bae4(0xfa)](_0x81c74e))try{const _0x33ec84=a51_0x128d94['readFileSync'](_0x81c74e,_0x24bae4(0xd0));_0x47fa28=JSON[_0x24bae4(0xc4)](_0x33ec84);}catch{console[_0x24bae4(0xe9)](_0x24bae4(0xcd)+_0x81c74e+',\x20creating\x20new\x20file');}!_0x47fa28['profiles']&&(_0x47fa28[_0x24bae4(0xdf)]={}),_0x47fa28[_0x24bae4(0xdf)][_0x162fed]=_0x58375f,writeSecureFile(_0x81c74e,JSON[_0x24bae4(0xb6)](_0x47fa28,null,0x2));}export function removeProfileFromUserConfig(_0x2fa20e){const _0x2ec822=a51_0x3d69c9;validateProfileName(_0x2fa20e);const _0xa1c9ec=getGlobalConfigPath();if(!a51_0x128d94[_0x2ec822(0xfa)](_0xa1c9ec))throw new Error(_0x2ec822(0xb3)+_0x2fa20e+_0x2ec822(0xd7));let _0xc2753b={};try{const _0x23496c=a51_0x128d94[_0x2ec822(0xe5)](_0xa1c9ec,_0x2ec822(0xd0));_0xc2753b=JSON[_0x2ec822(0xc4)](_0x23496c);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0xa1c9ec);}if(!_0xc2753b[_0x2ec822(0xdf)]||!_0xc2753b[_0x2ec822(0xdf)][_0x2fa20e])throw new Error(_0x2ec822(0xb3)+_0x2fa20e+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0xc2753b[_0x2ec822(0xdf)][_0x2fa20e],_0xc2753b['profile']===_0x2fa20e&&delete _0xc2753b[_0x2ec822(0xf2)],writeSecureFile(_0xa1c9ec,JSON[_0x2ec822(0xb6)](_0xc2753b,null,0x2));}export function getActiveProfile(){const _0x300828=a51_0x3d69c9,_0x39569c=loadSessionContext();if(_0x39569c?.[_0x300828(0xf2)])return _0x39569c[_0x300828(0xf2)];if(process[_0x300828(0xd2)][_0x300828(0xe1)])return process[_0x300828(0xd2)][_0x300828(0xe1)];const _0x1c4a27=getGlobalConfigPath();if(!a51_0x128d94[_0x300828(0xfa)](_0x1c4a27))return null;try{const _0x19a9fd=a51_0x128d94[_0x300828(0xe5)](_0x1c4a27,_0x300828(0xd0)),_0x4b3f20=JSON[_0x300828(0xc4)](_0x19a9fd);return _0x4b3f20[_0x300828(0xf2)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x4c4fff){const _0x37ed7f=a51_0x3d69c9,_0x174900=getGlobalConfigPath(),_0x25842b=getConfigDir();!a51_0x128d94[_0x37ed7f(0xfa)](_0x25842b)&&createSecureDirectory(_0x25842b);let _0x23ce25={};if(a51_0x128d94[_0x37ed7f(0xfa)](_0x174900))try{const _0x31de50=a51_0x128d94[_0x37ed7f(0xe5)](_0x174900,'utf-8');_0x23ce25=JSON[_0x37ed7f(0xc4)](_0x31de50);}catch{console['warn'](_0x37ed7f(0xcd)+_0x174900+_0x37ed7f(0xdb));}_0x23ce25[_0x37ed7f(0xf7)]=_0x4c4fff,writeSecureFile(_0x174900,JSON[_0x37ed7f(0xb6)](_0x23ce25,null,0x2));}export function saveActiveProfileToUserConfig(_0x47750f){const _0x573a9c=a51_0x3d69c9;validateProfileName(_0x47750f);const _0x32548a=getGlobalConfigPath(),_0x5984f9=getConfigDir();!a51_0x128d94[_0x573a9c(0xfa)](_0x5984f9)&&createSecureDirectory(_0x5984f9);let _0x532430={};if(a51_0x128d94['existsSync'](_0x32548a))try{const _0x274a51=a51_0x128d94['readFileSync'](_0x32548a,'utf-8');_0x532430=JSON[_0x573a9c(0xc4)](_0x274a51);}catch{console[_0x573a9c(0xe9)](_0x573a9c(0xcd)+_0x32548a+_0x573a9c(0xdb));}_0x532430['profile']=_0x47750f,writeSecureFile(_0x32548a,JSON[_0x573a9c(0xb6)](_0x532430,null,0x2));}function clearFieldFromUserConfig(_0x13fb44){const _0x1543d6=a51_0x3d69c9,_0x3d2223=getGlobalConfigPath();if(!a51_0x128d94[_0x1543d6(0xfa)](_0x3d2223))return;let _0x4b9e15={};try{const _0x2365da=a51_0x128d94[_0x1543d6(0xe5)](_0x3d2223,_0x1543d6(0xd0));_0x4b9e15=JSON[_0x1543d6(0xc4)](_0x2365da);}catch{return;}delete _0x4b9e15[_0x13fb44],writeSecureFile(_0x3d2223,JSON[_0x1543d6(0xb6)](_0x4b9e15,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x316e81=a51_0x3d69c9;clearFieldFromUserConfig(_0x316e81(0xf2));}export function createProfile(_0x1505a5,_0xa449d9){const _0x521889=a51_0x3d69c9;validateProfileName(_0x1505a5);if(profileExists(_0x1505a5))throw new Error(_0x521889(0xec)+_0x1505a5+'\x20already\x20exists');saveProfile(_0x1505a5,_0xa449d9);}export function saveProfileCredentials(_0x437199,_0x7fa91d){const _0xd5048d=a51_0x3d69c9;validateProfileName(_0x437199);if(!profileExists(_0x437199))throw new Error(_0xd5048d(0xec)+_0x437199+_0xd5048d(0xef));const _0x5e5253=getNewCredentialPath(_0x437199);writeSecureFile(_0x5e5253,_0x7fa91d);}export function loadProfileCredentials(_0x3a0c53){const _0x6055f9=a51_0x3d69c9;validateProfileName(_0x3a0c53);const _0x437769=getNewCredentialPath(_0x3a0c53);if(a51_0x128d94['existsSync'](_0x437769))try{return a51_0x128d94[_0x6055f9(0xe5)](_0x437769,_0x6055f9(0xd0));}catch{}const _0x28b484=getOldCredentialPath(_0x3a0c53);if(a51_0x128d94['existsSync'](_0x28b484)){console[_0x6055f9(0xe9)](_0x6055f9(0xff)+_0x3a0c53+'\x27'),console[_0x6055f9(0xe9)](_0x6055f9(0xe8)),console[_0x6055f9(0xe9)](_0x6055f9(0xed)+_0x28b484+_0x6055f9(0xe7)+_0x437769+'\x22'),console[_0x6055f9(0xe9)](_0x6055f9(0xdc));try{return a51_0x128d94[_0x6055f9(0xe5)](_0x28b484,'utf-8');}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x512fb9,_0x242f37){const _0x47d8bd=a51_0x56b6,_0x830c2a=_0x512fb9();while(!![]){try{const _0x4758e0=parseInt(_0x47d8bd(0x18a))/0x1*(parseInt(_0x47d8bd(0x187))/0x2)+-parseInt(_0x47d8bd(0x186))/0x3+-parseInt(_0x47d8bd(0x193))/0x4+parseInt(_0x47d8bd(0x177))/0x5*(parseInt(_0x47d8bd(0x194))/0x6)+-parseInt(_0x47d8bd(0x195))/0x7+parseInt(_0x47d8bd(0x184))/0x8*(parseInt(_0x47d8bd(0x16b))/0x9)+-parseInt(_0x47d8bd(0x196))/0xa;if(_0x4758e0===_0x242f37)break;else _0x830c2a['push'](_0x830c2a['shift']());}catch(_0x312858){_0x830c2a['push'](_0x830c2a['shift']());}}}(a51_0xc588,0xe5fc9));import*as a51_0x7a7172 from'node:fs';import*as a51_0xf03c9d from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';function a51_0x56b6(_0x39ac58,_0x484400){_0x39ac58=_0x39ac58-0x16a;const _0xc588bd=a51_0xc588();let _0x56b68c=_0xc588bd[_0x39ac58];return _0x56b68c;}import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME='@tdx-studio';export function getProfileParams(_0x16a609){const _0x52c5c1=a51_0x56b6,_0x1415da={};if(!_0x16a609)return _0x1415da;for(const [_0x45c4d0,_0x115324]of Object['entries'](_0x16a609)){_0x45c4d0!==_0x52c5c1(0x1b7)&&_0x115324!==undefined&&(_0x1415da[_0x45c4d0]=_0x115324);}return _0x1415da;}export function getProfilesDir(){const _0x3729a5=a51_0x56b6;return a51_0xf03c9d[_0x3729a5(0x18b)](getConfigDir(),'profiles');}function getProfileDir(_0x17dfea){const _0x3b1fc0=a51_0x56b6;return a51_0xf03c9d[_0x3b1fc0(0x18b)](getProfilesDir(),_0x17dfea);}function getProfileConfigPath(_0x4e4223){const _0x28af6a=a51_0x56b6;return a51_0xf03c9d[_0x28af6a(0x18b)](getProfileDir(_0x4e4223),_0x28af6a(0x171));}function getProfileEnvPath(_0x3f2044){const _0x20c91b=a51_0x56b6;return a51_0xf03c9d[_0x20c91b(0x18b)](getProfileDir(_0x3f2044),'.env');}function getGlobalConfigPath(){const _0xd33e3d=a51_0x56b6;return a51_0xf03c9d[_0xd33e3d(0x18b)](getConfigDir(),_0xd33e3d(0x171));}function validateProfileName(_0x4aa7bb){const _0x40eec1=a51_0x56b6;if(!/^@?[a-zA-Z0-9_-]+$/[_0x40eec1(0x182)](_0x4aa7bb))throw new Error('Invalid\x20profile\x20name:\x20'+_0x4aa7bb+_0x40eec1(0x18e));}function validateProfileConfig(_0x34ceb9,_0x3c3a12){const _0x314ca6=a51_0x56b6;if(typeof _0x34ceb9!==_0x314ca6(0x199)||_0x34ceb9===null)throw new Error('Profile\x20\x27'+_0x3c3a12+_0x314ca6(0x16a));const _0x3ffe1b=[_0x314ca6(0x1b7),_0x314ca6(0x1a8),_0x314ca6(0x19e),_0x314ca6(0x1a9),_0x314ca6(0x174),_0x314ca6(0x16d)],_0x190e05=_0x34ceb9;for(const _0x69b84d of Object[_0x314ca6(0x197)](_0x190e05)){!_0x3ffe1b[_0x314ca6(0x19c)](_0x69b84d)&&console['warn']('Warning:\x20Profile\x20\x27'+_0x3c3a12+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x69b84d+_0x314ca6(0x181));}if(_0x190e05[_0x314ca6(0x1b7)]!==undefined&&typeof _0x190e05[_0x314ca6(0x1b7)]!=='string')throw new Error('Profile\x20\x27'+_0x3c3a12+_0x314ca6(0x1a6));if(_0x190e05[_0x314ca6(0x1a8)]!==undefined&&typeof _0x190e05[_0x314ca6(0x1a8)]!==_0x314ca6(0x170))throw new Error(_0x314ca6(0x18f)+_0x3c3a12+_0x314ca6(0x178));if(_0x190e05['database']!==undefined&&typeof _0x190e05[_0x314ca6(0x19e)]!==_0x314ca6(0x170))throw new Error(_0x314ca6(0x18f)+_0x3c3a12+_0x314ca6(0x19f));if(_0x190e05[_0x314ca6(0x1a9)]!==undefined&&typeof _0x190e05[_0x314ca6(0x1a9)]!==_0x314ca6(0x170))throw new Error(_0x314ca6(0x18f)+_0x3c3a12+_0x314ca6(0x1b6));if(_0x190e05['llm_project']!==undefined&&typeof _0x190e05[_0x314ca6(0x174)]!=='string')throw new Error(_0x314ca6(0x18f)+_0x3c3a12+_0x314ca6(0x188));if(_0x190e05[_0x314ca6(0x16d)]!==undefined&&typeof _0x190e05[_0x314ca6(0x16d)]!==_0x314ca6(0x170))throw new Error('Profile\x20\x27'+_0x3c3a12+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x4395fd,_0x44b02a){const _0x1ffb22=a51_0x56b6;if(!a51_0x7a7172[_0x1ffb22(0x1a3)](_0x4395fd))return[];try{const _0xb15229=a51_0x7a7172[_0x1ffb22(0x1ac)](_0x4395fd,_0x1ffb22(0x16f)),_0x5828be=JSON[_0x1ffb22(0x17c)](_0xb15229);if(!_0x5828be[_0x1ffb22(0x16e)]||typeof _0x5828be[_0x1ffb22(0x16e)]!==_0x1ffb22(0x199))return[];const _0x3354ee=[];for(const [_0x39262f,_0x22520d]of Object[_0x1ffb22(0x179)](_0x5828be[_0x1ffb22(0x16e)])){try{validateProfileConfig(_0x22520d,_0x39262f);const _0x4cabcf=getNewCredentialPath(_0x39262f),_0x302713=getOldCredentialPath(_0x39262f),_0x2dd861=a51_0x7a7172[_0x1ffb22(0x1a3)](_0x4cabcf)||a51_0x7a7172['existsSync'](_0x302713);_0x3354ee[_0x1ffb22(0x17d)]({'name':_0x39262f,'config':_0x22520d,'metadata':{'name':_0x39262f,'createdAt':new Date()[_0x1ffb22(0x18c)]()},'hasCredentials':_0x2dd861,'scope':_0x44b02a});}catch(_0x359439){_0x359439 instanceof Error&&(console[_0x1ffb22(0x1a4)](_0x1ffb22(0x1a0)+_0x4395fd+':'),console[_0x1ffb22(0x1a4)]('\x20\x20'+_0x359439[_0x1ffb22(0x1ae)]+'\x0a'));}}return _0x3354ee;}catch(_0x220afa){return _0x220afa instanceof SyntaxError?(console['warn'](_0x1ffb22(0x192)+_0x4395fd+':\x20Invalid\x20JSON\x20syntax'),console['warn'](_0x1ffb22(0x1b5)+_0x220afa[_0x1ffb22(0x1ae)]+'\x0a')):console[_0x1ffb22(0x1a4)](_0x1ffb22(0x189)+_0x4395fd+':\x20'+_0x220afa+'\x0a'),[];}}export function getNewCredentialPath(_0x6b8918){const _0x55a91e=a51_0x56b6;return a51_0xf03c9d['join'](getConfigDir(),_0x55a91e(0x17b)+_0x6b8918);}function getOldCredentialPath(_0x261d36){const _0x208254=a51_0x56b6;return a51_0xf03c9d[_0x208254(0x18b)](getProfilesDir(),_0x261d36,_0x208254(0x190));}function loadProfilesFromTdxJsonFiles(){const _0x231264=a51_0x56b6,_0x57afbe=[],_0x18e898=findProjectConfigPath();_0x18e898&&_0x57afbe[_0x231264(0x17d)](...loadProfilesFromTdxJson(_0x18e898,_0x231264(0x19a)));const _0x351e64=a51_0xf03c9d['join'](getConfigDir(),_0x231264(0x171));return _0x57afbe[_0x231264(0x17d)](...loadProfilesFromTdxJson(_0x351e64,_0x231264(0x1b8))),_0x57afbe;}function loadProfilesFromDirectories(){const _0x45e4be=a51_0x56b6,_0x3e9521=getProfilesDir();if(!a51_0x7a7172[_0x45e4be(0x1a3)](_0x3e9521))return[];try{return a51_0x7a7172[_0x45e4be(0x1b3)](_0x3e9521,{'withFileTypes':!![]})['filter'](_0x399891=>_0x399891[_0x45e4be(0x1b2)]())[_0x45e4be(0x175)](_0x44ed33=>_0x44ed33['name'])[_0x45e4be(0x1ab)](_0x397008=>{const _0x2c9226=_0x45e4be,_0x324964=getProfileConfigPath(_0x397008),_0x1be273=getProfileEnvPath(_0x397008);return a51_0x7a7172[_0x2c9226(0x1a3)](_0x324964)||a51_0x7a7172[_0x2c9226(0x1a3)](_0x1be273);})[_0x45e4be(0x175)](_0x4a05c4=>{const _0x46d7f7=_0x45e4be,_0x5b07c8=loadProfileFromDirectory(_0x4a05c4);if(_0x5b07c8)return{..._0x5b07c8,'scope':_0x46d7f7(0x18d)};return null;})['filter'](_0x5ccd5e=>_0x5ccd5e!==null);}catch{return[];}}function loadProfileFromDirectory(_0x244940){const _0x16fce5=a51_0x56b6,_0x3f6ec2=getProfileConfigPath(_0x244940),_0x413679=getOldCredentialPath(_0x244940);if(!a51_0x7a7172['existsSync'](_0x3f6ec2)&&!a51_0x7a7172[_0x16fce5(0x1a3)](_0x413679))return null;let _0x58ba2e={},_0x55622b={'name':_0x244940,'createdAt':new Date()['toISOString']()};if(a51_0x7a7172['existsSync'](_0x3f6ec2))try{const _0x217491=a51_0x7a7172[_0x16fce5(0x1ac)](_0x3f6ec2,_0x16fce5(0x16f)),_0x4053c2=JSON[_0x16fce5(0x17c)](_0x217491),{metadata:_0x2e90d3,..._0x5ef112}=_0x4053c2;_0x58ba2e=_0x5ef112,_0x2e90d3&&(_0x55622b=_0x2e90d3);}catch{}return{'name':_0x244940,'config':_0x58ba2e,'metadata':_0x55622b,'hasCredentials':a51_0x7a7172[_0x16fce5(0x1a3)](_0x413679),'scope':_0x16fce5(0x18d)};}export function listProfiles(){const _0x5f045d=a51_0x56b6,_0x2ce7c8=loadProfilesFromTdxJsonFiles(),_0x538c77=loadProfilesFromDirectories();if(_0x538c77['length']>0x0){const _0x3d3dee=_0x538c77[_0x5f045d(0x175)](_0xb90137=>_0xb90137[_0x5f045d(0x191)])[_0x5f045d(0x18b)](',\x20'),_0x1062d2=getConfigDir();console['warn'](_0x5f045d(0x198)+_0x3d3dee),console[_0x5f045d(0x1a4)](_0x5f045d(0x1a1)),console['warn']('\x20\x201.\x20Edit:\x20'+a51_0xf03c9d[_0x5f045d(0x18b)](_0x1062d2,_0x5f045d(0x171))),console[_0x5f045d(0x1a4)](_0x5f045d(0x183)),console['warn']('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x4e0eab=[..._0x2ce7c8,..._0x538c77],_0x269de7=new Map();for(const _0x42b388 of _0x4e0eab){!_0x269de7[_0x5f045d(0x1a7)](_0x42b388[_0x5f045d(0x191)])&&_0x269de7['set'](_0x42b388[_0x5f045d(0x191)],_0x42b388);}return Array[_0x5f045d(0x19d)](_0x269de7[_0x5f045d(0x1ad)]())[_0x5f045d(0x176)]((_0x54022b,_0x453f1f)=>_0x54022b['name'][_0x5f045d(0x1b9)](_0x453f1f[_0x5f045d(0x191)]));}export function profileExists(_0x1bc0db){const _0x2e280f=a51_0x56b6,_0x1005fa=listProfiles();return _0x1005fa[_0x2e280f(0x1b4)](_0x296fd3=>_0x296fd3[_0x2e280f(0x191)]===_0x1bc0db);}export function loadProfile(_0x21b377){const _0x1d1b7f=a51_0x56b6;validateProfileName(_0x21b377);const _0x5d1392=listProfiles(),_0x55afed=_0x5d1392['find'](_0x393ac8=>_0x393ac8[_0x1d1b7f(0x191)]===_0x21b377);return _0x55afed||null;}export function saveProfile(_0x37e378,_0x2be5e1,_0x1ccaa8=![]){saveProfileToUserConfig(_0x37e378,_0x2be5e1);}export function deleteProfile(_0x19f20a){const _0x560496=a51_0x56b6;validateProfileName(_0x19f20a);const _0x5da31c=getProfileDir(_0x19f20a);if(!a51_0x7a7172[_0x560496(0x1a3)](_0x5da31c))throw new Error('Profile\x20'+_0x19f20a+_0x560496(0x172));a51_0x7a7172[_0x560496(0x1b1)](_0x5da31c,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x371600,_0x4d0fe1){const _0x40b121=a51_0x56b6;validateProfileName(_0x371600);const _0x2371b1=getGlobalConfigPath(),_0x308890=getConfigDir();!a51_0x7a7172[_0x40b121(0x1a3)](_0x308890)&&createSecureDirectory(_0x308890);let _0x1090f1={};if(a51_0x7a7172['existsSync'](_0x2371b1))try{const _0x4fa701=a51_0x7a7172[_0x40b121(0x1ac)](_0x2371b1,_0x40b121(0x16f));_0x1090f1=JSON[_0x40b121(0x17c)](_0x4fa701);}catch{console[_0x40b121(0x1a4)](_0x40b121(0x17e)+_0x2371b1+_0x40b121(0x1a5));}!_0x1090f1['profiles']&&(_0x1090f1[_0x40b121(0x16e)]={}),_0x1090f1[_0x40b121(0x16e)][_0x371600]=_0x4d0fe1,writeSecureFile(_0x2371b1,JSON[_0x40b121(0x1aa)](_0x1090f1,null,0x2));}export function removeProfileFromUserConfig(_0x22c79f){const _0x330b25=a51_0x56b6;validateProfileName(_0x22c79f);const _0x514612=getGlobalConfigPath();if(!a51_0x7a7172['existsSync'](_0x514612))throw new Error(_0x330b25(0x18f)+_0x22c79f+_0x330b25(0x17a));let _0x45e3aa={};try{const _0x546329=a51_0x7a7172[_0x330b25(0x1ac)](_0x514612,_0x330b25(0x16f));_0x45e3aa=JSON['parse'](_0x546329);}catch{throw new Error(_0x330b25(0x1b0)+_0x514612);}if(!_0x45e3aa[_0x330b25(0x16e)]||!_0x45e3aa[_0x330b25(0x16e)][_0x22c79f])throw new Error(_0x330b25(0x18f)+_0x22c79f+_0x330b25(0x17a));delete _0x45e3aa[_0x330b25(0x16e)][_0x22c79f],_0x45e3aa[_0x330b25(0x173)]===_0x22c79f&&delete _0x45e3aa['profile'],writeSecureFile(_0x514612,JSON[_0x330b25(0x1aa)](_0x45e3aa,null,0x2));}export function getActiveProfile(){const _0x26739c=a51_0x56b6,_0x76ad3a=loadSessionContext();if(_0x76ad3a?.[_0x26739c(0x173)])return _0x76ad3a['profile'];if(process[_0x26739c(0x1af)]['TDX_PROFILE'])return process['env'][_0x26739c(0x1a2)];const _0x268c41=getGlobalConfigPath();if(!a51_0x7a7172[_0x26739c(0x1a3)](_0x268c41))return null;try{const _0x145c88=a51_0x7a7172[_0x26739c(0x1ac)](_0x268c41,'utf-8'),_0x852f74=JSON[_0x26739c(0x17c)](_0x145c88);return _0x852f74['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x46a3cd){const _0x41142e=a51_0x56b6,_0x4522e5=getGlobalConfigPath(),_0x10811a=getConfigDir();!a51_0x7a7172['existsSync'](_0x10811a)&&createSecureDirectory(_0x10811a);let _0x432c0c={};if(a51_0x7a7172[_0x41142e(0x1a3)](_0x4522e5))try{const _0x3389b0=a51_0x7a7172[_0x41142e(0x1ac)](_0x4522e5,_0x41142e(0x16f));_0x432c0c=JSON['parse'](_0x3389b0);}catch{console[_0x41142e(0x1a4)](_0x41142e(0x17e)+_0x4522e5+_0x41142e(0x1a5));}_0x432c0c[_0x41142e(0x1a8)]=_0x46a3cd,writeSecureFile(_0x4522e5,JSON['stringify'](_0x432c0c,null,0x2));}export function saveActiveProfileToUserConfig(_0x51e6db){const _0x24eb2e=a51_0x56b6;validateProfileName(_0x51e6db);const _0x742673=getGlobalConfigPath(),_0x439d4c=getConfigDir();!a51_0x7a7172[_0x24eb2e(0x1a3)](_0x439d4c)&&createSecureDirectory(_0x439d4c);let _0xda90e8={};if(a51_0x7a7172[_0x24eb2e(0x1a3)](_0x742673))try{const _0x4901d0=a51_0x7a7172[_0x24eb2e(0x1ac)](_0x742673,_0x24eb2e(0x16f));_0xda90e8=JSON[_0x24eb2e(0x17c)](_0x4901d0);}catch{console[_0x24eb2e(0x1a4)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x742673+_0x24eb2e(0x1a5));}_0xda90e8[_0x24eb2e(0x173)]=_0x51e6db,writeSecureFile(_0x742673,JSON[_0x24eb2e(0x1aa)](_0xda90e8,null,0x2));}function clearFieldFromUserConfig(_0x181419){const _0x239b29=a51_0x56b6,_0x535f8b=getGlobalConfigPath();if(!a51_0x7a7172[_0x239b29(0x1a3)](_0x535f8b))return;let _0x512748={};try{const _0x461a10=a51_0x7a7172[_0x239b29(0x1ac)](_0x535f8b,_0x239b29(0x16f));_0x512748=JSON['parse'](_0x461a10);}catch{return;}delete _0x512748[_0x181419],writeSecureFile(_0x535f8b,JSON[_0x239b29(0x1aa)](_0x512748,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x475a21=a51_0x56b6;clearFieldFromUserConfig(_0x475a21(0x1a8));}export function clearActiveProfileFromUserConfig(){const _0x6a66a7=a51_0x56b6;clearFieldFromUserConfig(_0x6a66a7(0x173));}export function createProfile(_0x2c01fd,_0x1a758d){validateProfileName(_0x2c01fd);if(profileExists(_0x2c01fd))throw new Error('Profile\x20'+_0x2c01fd+'\x20already\x20exists');saveProfile(_0x2c01fd,_0x1a758d);}export function saveProfileCredentials(_0x3291f2,_0x487eb5){const _0x183435=a51_0x56b6;validateProfileName(_0x3291f2);if(!profileExists(_0x3291f2))throw new Error(_0x183435(0x17f)+_0x3291f2+_0x183435(0x172));const _0x5d684=getNewCredentialPath(_0x3291f2);writeSecureFile(_0x5d684,_0x487eb5);}function a51_0xc588(){const _0x38c2d0=['rmSync','isDirectory','readdirSync','some','Error:\x20','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','description','user','localeCompare','\x27:\x20config\x20must\x20be\x20an\x20object','714348SOvIox','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','llm_agent','profiles','utf-8','string','tdx.json','\x20does\x20not\x20exist','profile','llm_project','map','sort','44635iHLMNO','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','entries','\x27\x20not\x20found\x20in\x20user\x20configuration','.env.','parse','push','Warning:\x20Failed\x20to\x20parse\x20','Profile\x20','\x22\x20\x22','\x27\x20will\x20be\x20ignored','test','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','64eECmUV','To\x20migrate:','1623048AbtVUL','2941418bYlisE','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','1mlbyMC','join','toISOString','directory','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','Profile\x20\x27','.env','name','\x0aWarning:\x20Failed\x20to\x20parse\x20','161128dvgWhM','426qKtmeP','917511xucnST','10851060jZoWpj','keys','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','object','local','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','includes','from','database','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','TDX_PROFILE','existsSync','warn',',\x20creating\x20new\x20file','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','has','site','parent_segment','stringify','filter','readFileSync','values','message','env','Failed\x20to\x20parse\x20'];a51_0xc588=function(){return _0x38c2d0;};return a51_0xc588();}export function loadProfileCredentials(_0xb318b3){const _0x5e903f=a51_0x56b6;validateProfileName(_0xb318b3);const _0x1dca89=getNewCredentialPath(_0xb318b3);if(a51_0x7a7172[_0x5e903f(0x1a3)](_0x1dca89))try{return a51_0x7a7172[_0x5e903f(0x1ac)](_0x1dca89,_0x5e903f(0x16f));}catch{}const _0x4c44a5=getOldCredentialPath(_0xb318b3);if(a51_0x7a7172[_0x5e903f(0x1a3)](_0x4c44a5)){console['warn'](_0x5e903f(0x16c)+_0xb318b3+'\x27'),console[_0x5e903f(0x1a4)](_0x5e903f(0x185)),console[_0x5e903f(0x1a4)]('\x20\x20mv\x20\x22'+_0x4c44a5+_0x5e903f(0x180)+_0x1dca89+'\x22'),console[_0x5e903f(0x1a4)](_0x5e903f(0x19b));try{return a51_0x7a7172[_0x5e903f(0x1ac)](_0x4c44a5,_0x5e903f(0x16f));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a52_0x5f3fd1=a52_0x2fe1;function a52_0xf00e(){const _0x2daed7=['includes','1299006mribMQ','code','dirname','ENOENT','cwd',').\x20','TD_API_KEY','apiKey','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','88UCkdFu','78bFupTV','stringify','warn','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','741230BGAveA','profile','6036005wbUNjZ','1466062fGtEGc','\x20is\x20ignored.\x20','39149253tIZiMo','parse','2319612vtHIYc','7EiBgNL','readFileSync','153028QQuVqQ','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','Failed\x20to\x20load\x20project\x20config\x20from\x20','utf-8','existsSync','writeFileSync','Warning:\x20\x27profile\x27\x20field\x20in\x20','1fGNuQz','tdx.json'];a52_0xf00e=function(){return _0x2daed7;};return a52_0xf00e();}(function(_0x239c30,_0x2bd1de){const _0x697941=a52_0x2fe1,_0x4b19e5=_0x239c30();while(!![]){try{const _0xcc01c8=-parseInt(_0x697941(0x1ea))/0x1*(-parseInt(_0x697941(0x1dc))/0x2)+parseInt(_0x697941(0x1d5))/0x3*(-parseInt(_0x697941(0x1e3))/0x4)+-parseInt(_0x697941(0x1db))/0x5+parseInt(_0x697941(0x1e0))/0x6*(parseInt(_0x697941(0x1e1))/0x7)+-parseInt(_0x697941(0x1d4))/0x8*(parseInt(_0x697941(0x1ed))/0x9)+parseInt(_0x697941(0x1d9))/0xa+parseInt(_0x697941(0x1de))/0xb;if(_0xcc01c8===_0x2bd1de)break;else _0x4b19e5['push'](_0x4b19e5['shift']());}catch(_0x261490){_0x4b19e5['push'](_0x4b19e5['shift']());}}}(a52_0xf00e,0xeb296));import*as a52_0x35aab0 from'node:fs';import*as a52_0x46eee5 from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x5f3fd1(0x1eb);export function findProjectConfigPath(_0x2beb88){const _0x803f0d=a52_0x5f3fd1;let _0x5b8550=_0x2beb88||process['cwd']();while(!![]){const _0x11f76f=a52_0x46eee5['join'](_0x5b8550,PROJECT_CONFIG_FILENAME);if(a52_0x35aab0[_0x803f0d(0x1e7)](_0x11f76f))return _0x11f76f;const _0x48c8cc=a52_0x46eee5[_0x803f0d(0x1ef)](_0x5b8550);if(_0x48c8cc===_0x5b8550)return null;_0x5b8550=_0x48c8cc;}}export function loadProjectConfig(_0x5443f9){const _0x2d12be=a52_0x5f3fd1,_0x1da25c=findProjectConfigPath(_0x5443f9);if(!_0x1da25c)return null;try{const _0x1697d2=a52_0x35aab0[_0x2d12be(0x1e2)](_0x1da25c,_0x2d12be(0x1e6)),_0x567fcd=JSON[_0x2d12be(0x1df)](_0x1697d2),_0x186fb6=JSON[_0x2d12be(0x1d6)](_0x567fcd);if(_0x186fb6['includes'](_0x2d12be(0x1f3))||_0x186fb6[_0x2d12be(0x1ec)]('apiKey')||_0x186fb6[_0x2d12be(0x1ec)]('api_key'))throw new Error(_0x2d12be(0x1d8)+_0x1da25c+_0x2d12be(0x1f2)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x43af9a,profile:_0x407476,..._0x4ec275}=_0x567fcd;return _0x407476&&console[_0x2d12be(0x1d7)](_0x2d12be(0x1e9)+_0x1da25c+_0x2d12be(0x1dd)+_0x2d12be(0x1e4)),_0x4ec275;}catch(_0x5af7f0){if(_0x5af7f0 instanceof Error&&_0x2d12be(0x1ee)in _0x5af7f0&&_0x5af7f0[_0x2d12be(0x1ee)]===_0x2d12be(0x1f0))return null;throw new Error(_0x2d12be(0x1e5)+_0x1da25c+':\x20'+_0x5af7f0);}}function a52_0x2fe1(_0x43bd36,_0x1bc346){_0x43bd36=_0x43bd36-0x1d4;const _0xf00e1d=a52_0xf00e();let _0x2fe119=_0xf00e1d[_0x43bd36];return _0x2fe119;}export function saveProjectConfig(_0x551098,_0x5b91e9){const _0x437203=a52_0x5f3fd1,_0x3efb9e=_0x5b91e9||process[_0x437203(0x1f1)](),_0x63c07f=a52_0x46eee5['join'](_0x3efb9e,PROJECT_CONFIG_FILENAME),_0x361e88=JSON[_0x437203(0x1d6)](_0x551098);if(_0x361e88[_0x437203(0x1ec)]('TD_API_KEY')||_0x361e88[_0x437203(0x1ec)](_0x437203(0x1f4))||_0x361e88[_0x437203(0x1ec)]('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x437203(0x1da)in _0x551098)throw new Error(_0x437203(0x1f5));a52_0x35aab0[_0x437203(0x1e8)](_0x63c07f,JSON['stringify'](_0x551098,null,0x2));}export function hasProjectConfig(_0x45fa34){return findProjectConfigPath(_0x45fa34)!==null;}export function getProjectRoot(_0x5686db){const _0x2416ff=a52_0x5f3fd1,_0x3eea99=findProjectConfigPath(_0x5686db);return _0x3eea99?a52_0x46eee5[_0x2416ff(0x1ef)](_0x3eea99):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x19a6cb,_0x5573ee){const _0x1ba4f2=a53_0x405f,_0x45f21b=_0x19a6cb();while(!![]){try{const _0x1f3786=-parseInt(_0x1ba4f2(0x1ef))/0x1+parseInt(_0x1ba4f2(0x1e3))/0x2+parseInt(_0x1ba4f2(0x1de))/0x3+parseInt(_0x1ba4f2(0x1ec))/0x4+-parseInt(_0x1ba4f2(0x1e8))/0x5+parseInt(_0x1ba4f2(0x1f6))/0x6+-parseInt(_0x1ba4f2(0x1ed))/0x7;if(_0x1f3786===_0x5573ee)break;else _0x45f21b['push'](_0x45f21b['shift']());}catch(_0x4c9dd3){_0x45f21b['push'](_0x45f21b['shift']());}}}(a53_0x1963,0x60b1f));function a53_0x1963(){const _0x49a597=['stringify','env','unlinkSync','.json','613925RQtjAK','toString','join','getTime','1301612qDyAhX','4988095YQTuPL','utf-8','84952zVUUIW','toISOString','existsSync','now','includes','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','warn','1542126JKxkCo','.\x20This\x20is\x20insecure.\x20Removing\x20session.','test','replace','TDX_CONFIG_DIR','readdirSync','createdAt','parse','writeFileSync','api_key','endsWith','sort','tdx','readFileSync','1048680xXusnG','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','sessions','TD_API_KEY','apiKey','768802njxRdA'];a53_0x1963=function(){return _0x49a597;};return a53_0x1963();}import*as a53_0x1eb1a0 from'node:fs';import*as a53_0x4ce02f from'node:path';import*as a53_0x3fda3a from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';function a53_0x405f(_0x5382e4,_0x50b1fc){_0x5382e4=_0x5382e4-0x1d2;const _0x1963cb=a53_0x1963();let _0x405f78=_0x1963cb[_0x5382e4];return _0x405f78;}import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x40b9df=a53_0x405f,_0x541200=process[_0x40b9df(0x1e5)][_0x40b9df(0x1d4)]||a53_0x4ce02f[_0x40b9df(0x1ea)](a53_0x3fda3a['homedir'](),'.config',_0x40b9df(0x1dc));return a53_0x4ce02f[_0x40b9df(0x1ea)](_0x541200,_0x40b9df(0x1e0));}function getSessionPath(_0x392bd3){return a53_0x4ce02f['join'](getSessionsDir(),_0x392bd3+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0xdcf044){const _0x7dd8a4=a53_0x405f;if(_0xdcf044)return _0xdcf044;return getCurrentSessionPID()[_0x7dd8a4(0x1e9)]();}export function loadSessionContext(_0x552d19){const _0x1eeb37=a53_0x405f,_0x6e7fb=_0x552d19||getCurrentSessionPID()[_0x1eeb37(0x1e9)](),_0x5abb6d=/^\d+$/['test'](_0x6e7fb)?parseInt(_0x6e7fb,0xa):null;return _0x5abb6d!==null?loadSessionContextByPID(_0x5abb6d):loadSessionContextByString(_0x6e7fb);}export function loadSessionContextByPID(_0x71a245){const _0x3f5711=a53_0x405f,_0x18b85e=getSessionPath(_0x71a245);if(!a53_0x1eb1a0[_0x3f5711(0x1f1)](_0x18b85e))return null;try{const _0x555e59=a53_0x1eb1a0[_0x3f5711(0x1dd)](_0x18b85e,'utf-8'),_0x406876=JSON[_0x3f5711(0x1d7)](_0x555e59),_0x2ee59b=new Date(_0x406876[_0x3f5711(0x1d6)])['getTime'](),_0x17d720=Date[_0x3f5711(0x1f2)]();if(_0x17d720-_0x2ee59b>SESSION_EXPIRATION_MS)return a53_0x1eb1a0[_0x3f5711(0x1e6)](_0x18b85e),null;const _0x489c01=JSON['stringify'](_0x406876);if(_0x489c01[_0x3f5711(0x1f3)](_0x3f5711(0x1e1))||_0x489c01[_0x3f5711(0x1f3)](_0x3f5711(0x1e2))||_0x489c01['includes'](_0x3f5711(0x1d9)))return console['warn'](_0x3f5711(0x1df)+_0x18b85e+_0x3f5711(0x1f7)),a53_0x1eb1a0[_0x3f5711(0x1e6)](_0x18b85e),null;return _0x406876;}catch{try{a53_0x1eb1a0[_0x3f5711(0x1e6)](_0x18b85e);}catch{}return null;}}function loadSessionContextByString(_0x1a3f2c){const _0x5bd4b5=a53_0x405f,_0x242079=a53_0x4ce02f[_0x5bd4b5(0x1ea)](getSessionsDir(),_0x1a3f2c+'.json');if(!a53_0x1eb1a0[_0x5bd4b5(0x1f1)](_0x242079))return null;try{const _0x35fb14=a53_0x1eb1a0['readFileSync'](_0x242079,_0x5bd4b5(0x1ee)),_0x22a33b=JSON[_0x5bd4b5(0x1d7)](_0x35fb14),_0x2bd409=new Date(_0x22a33b['createdAt'])['getTime'](),_0x46159c=Date[_0x5bd4b5(0x1f2)]();if(_0x46159c-_0x2bd409>SESSION_EXPIRATION_MS)return a53_0x1eb1a0[_0x5bd4b5(0x1e6)](_0x242079),null;const _0x3b8bf1=JSON['stringify'](_0x22a33b);if(_0x3b8bf1[_0x5bd4b5(0x1f3)](_0x5bd4b5(0x1e1))||_0x3b8bf1[_0x5bd4b5(0x1f3)](_0x5bd4b5(0x1e2))||_0x3b8bf1[_0x5bd4b5(0x1f3)](_0x5bd4b5(0x1d9)))return console[_0x5bd4b5(0x1f5)](_0x5bd4b5(0x1df)+_0x242079+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a53_0x1eb1a0[_0x5bd4b5(0x1e6)](_0x242079),null;return _0x22a33b;}catch{try{a53_0x1eb1a0[_0x5bd4b5(0x1e6)](_0x242079);}catch{}return null;}}export function saveSessionContext(_0x2da33c,_0x52be96){const _0x2fca73=a53_0x405f,_0x20fa64=_0x52be96||getCurrentSessionPID()[_0x2fca73(0x1e9)](),_0x1f3c59=/^\d+$/[_0x2fca73(0x1d2)](_0x20fa64)?parseInt(_0x20fa64,0xa):getCurrentSessionPID(),_0x4b5f20=a53_0x4ce02f[_0x2fca73(0x1ea)](getSessionsDir(),_0x20fa64+_0x2fca73(0x1e7)),_0x3c1873=getSessionsDir();createSecureDirectory(_0x3c1873);const _0x57d38d=JSON[_0x2fca73(0x1e4)](_0x2da33c);if(_0x57d38d[_0x2fca73(0x1f3)](_0x2fca73(0x1e1))||_0x57d38d[_0x2fca73(0x1f3)](_0x2fca73(0x1e2))||_0x57d38d[_0x2fca73(0x1f3)]('api_key'))throw new Error(_0x2fca73(0x1f4));let _0x2bd711;const _0x996fa6=/^\d+$/[_0x2fca73(0x1d2)](_0x20fa64)?loadSessionContextByPID(parseInt(_0x20fa64,0xa)):loadSessionContextByString(_0x20fa64);_0x996fa6?_0x2bd711={..._0x996fa6,..._0x2da33c,'pid':_0x1f3c59,'sessionId':_0x20fa64!==_0x1f3c59[_0x2fca73(0x1e9)]()?_0x20fa64:undefined,'updatedAt':new Date()[_0x2fca73(0x1f0)]()}:_0x2bd711={'pid':_0x1f3c59,'sessionId':_0x20fa64!==_0x1f3c59[_0x2fca73(0x1e9)]()?_0x20fa64:undefined,..._0x2da33c,'createdAt':new Date()[_0x2fca73(0x1f0)](),'updatedAt':new Date()[_0x2fca73(0x1f0)]()},a53_0x1eb1a0[_0x2fca73(0x1d8)](_0x4b5f20,JSON[_0x2fca73(0x1e4)](_0x2bd711,null,0x2));}export function clearSessionContext(_0x32829b){const _0x4e6f12=a53_0x405f,_0xc8d627=_0x32829b||getCurrentSessionPID()['toString'](),_0x187c9b=a53_0x4ce02f['join'](getSessionsDir(),_0xc8d627+_0x4e6f12(0x1e7));a53_0x1eb1a0[_0x4e6f12(0x1f1)](_0x187c9b)&&a53_0x1eb1a0[_0x4e6f12(0x1e6)](_0x187c9b);}export function clearSessionContextField(_0x1156b6,_0x1c6722){const _0x17bc31=a53_0x405f,_0x523431=_0x1c6722||getCurrentSessionPID()[_0x17bc31(0x1e9)](),_0x3a8713=a53_0x4ce02f['join'](getSessionsDir(),_0x523431+'.json');if(!a53_0x1eb1a0['existsSync'](_0x3a8713))return;try{const _0x340310=a53_0x1eb1a0['readFileSync'](_0x3a8713,_0x17bc31(0x1ee)),_0x4d1475=JSON[_0x17bc31(0x1d7)](_0x340310);delete _0x4d1475[_0x1156b6],a53_0x1eb1a0[_0x17bc31(0x1d8)](_0x3a8713,JSON[_0x17bc31(0x1e4)](_0x4d1475,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x108c78=a53_0x405f,_0x48f799=getSessionsDir();if(!a53_0x1eb1a0[_0x108c78(0x1f1)](_0x48f799))return 0x0;let _0x128b88=0x0;const _0x3896d1=Date[_0x108c78(0x1f2)]();try{const _0x2090b0=a53_0x1eb1a0[_0x108c78(0x1d5)](_0x48f799);for(const _0x441589 of _0x2090b0){if(!_0x441589[_0x108c78(0x1da)](_0x108c78(0x1e7)))continue;const _0x416bcf=a53_0x4ce02f['join'](_0x48f799,_0x441589),_0x40e9f3=_0x441589[_0x108c78(0x1d3)]('.json',''),_0x433485=parseInt(_0x40e9f3,0xa),_0x477190=!isNaN(_0x433485);if(_0x477190){if(!isProcessRunning(_0x433485)){a53_0x1eb1a0[_0x108c78(0x1e6)](_0x416bcf),_0x128b88++;continue;}}try{const _0x548499=a53_0x1eb1a0['readFileSync'](_0x416bcf,'utf-8'),_0x3ffc35=JSON[_0x108c78(0x1d7)](_0x548499),_0x36c186=new Date(_0x3ffc35[_0x108c78(0x1d6)])[_0x108c78(0x1eb)]();_0x3896d1-_0x36c186>SESSION_EXPIRATION_MS&&(a53_0x1eb1a0[_0x108c78(0x1e6)](_0x416bcf),_0x128b88++);}catch{a53_0x1eb1a0[_0x108c78(0x1e6)](_0x416bcf),_0x128b88++;}}}catch{}return _0x128b88;}export function listActiveSessions(){const _0x28af2e=a53_0x405f,_0x1a0e1e=getSessionsDir();if(!a53_0x1eb1a0[_0x28af2e(0x1f1)](_0x1a0e1e))return[];try{const _0x95c9b3=a53_0x1eb1a0[_0x28af2e(0x1d5)](_0x1a0e1e),_0x5e4e67=[];for(const _0x276e75 of _0x95c9b3){if(!_0x276e75['endsWith'](_0x28af2e(0x1e7)))continue;const _0x3c61e0=_0x276e75[_0x28af2e(0x1d3)](_0x28af2e(0x1e7),''),_0x40f326=parseInt(_0x3c61e0,0xa);!isNaN(_0x40f326)&&isProcessRunning(_0x40f326)&&_0x5e4e67['push'](_0x40f326);}return _0x5e4e67[_0x28af2e(0x1db)]((_0x232f23,_0x2cfec0)=>_0x232f23-_0x2cfec0);}catch{return[];}}
|
package/dist/core/user-cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a54_0x1f2174=a54_0x5a6a;function a54_0x592b(){const _0x287e2c=['1298844RUMYhI','151795cahjUu','42aicCXX','core/user-cache','224664fYMmkM','165215IEYrVl','read','903028fJazlz','users-{profile}.json','343474HEFbLY','1803536rhUclC','1pWRmfK','clear'];a54_0x592b=function(){return _0x287e2c;};return a54_0x592b();}function a54_0x5a6a(_0x35eea0,_0x500d04){_0x35eea0=_0x35eea0-0x19e;const _0x592bb1=a54_0x592b();let _0x5a6a67=_0x592bb1[_0x35eea0];return _0x5a6a67;}(function(_0x2c72a1,_0xacff8d){const _0x5058f7=a54_0x5a6a,_0x22e329=_0x2c72a1();while(!![]){try{const _0x3bfd14=-parseInt(_0x5058f7(0x1a9))/0x1*(-parseInt(_0x5058f7(0x1a7))/0x2)+-parseInt(_0x5058f7(0x1a2))/0x3+parseInt(_0x5058f7(0x1a5))/0x4+parseInt(_0x5058f7(0x1a3))/0x5+parseInt(_0x5058f7(0x1a0))/0x6*(-parseInt(_0x5058f7(0x19f))/0x7)+-parseInt(_0x5058f7(0x1a8))/0x8+parseInt(_0x5058f7(0x19e))/0x9;if(_0x3bfd14===_0xacff8d)break;else _0x22e329['push'](_0x22e329['shift']());}catch(_0x4abf51){_0x22e329['push'](_0x22e329['shift']());}}}(a54_0x592b,0x1df68));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0x1f2174(0x1a6),a54_0x1f2174(0x1a1));export function loadCachedUsers(_0x597409){const _0x2b2857=a54_0x1f2174,_0x5534fb=userCache[_0x2b2857(0x1a4)](_0x597409);return _0x5534fb?.['users']??null;}export function saveCachedUsers(_0xb8e1c,_0x5deac5){userCache['write'](_0xb8e1c,{'users':_0x5deac5,'cachedAt':Date['now']()});}export function clearUserCache(_0x5c3e82){const _0x159a93=a54_0x1f2174;userCache[_0x159a93(0x1aa)](_0x5c3e82);}
|
package/dist/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2e238b,_0x5c4650){const _0x2e9ccb=a55_0x2ec7,_0x5a0571=_0x2e238b();while(!![]){try{const _0x55ecb4=parseInt(_0x2e9ccb(0xd9))/0x1+parseInt(_0x2e9ccb(0xd4))/0x2+parseInt(_0x2e9ccb(0xd7))/0x3+parseInt(_0x2e9ccb(0xe2))/0x4+-parseInt(_0x2e9ccb(0xdd))/0x5*(-parseInt(_0x2e9ccb(0xd8))/0x6)+-parseInt(_0x2e9ccb(0xdb))/0x7*(-parseInt(_0x2e9ccb(0xd5))/0x8)+-parseInt(_0x2e9ccb(0xe1))/0x9;if(_0x55ecb4===_0x5c4650)break;else _0x5a0571['push'](_0x5a0571['shift']());}catch(_0x2d4782){_0x5a0571['push'](_0x5a0571['shift']());}}}(a55_0x218c,0x72f54));function a55_0x2ec7(_0x356bf0,_0x475629){_0x356bf0=_0x356bf0-0xd4;const _0x218cac=a55_0x218c();let _0x2ec73d=_0x218cac[_0x356bf0];return _0x2ec73d;}function a55_0x218c(){const _0x5e079c=['873098eqszsk','16XKRVey','utf-8','1999089nEfVZG','402216KXtkJM','586259JARWGP','../../package.json','6111HeaVTS','includes','70GJYOfk','version','parse','.dev','21534300HMnbAI','936588TSiUcQ'];a55_0x218c=function(){return _0x5e079c;};return a55_0x218c();}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x508b0b=a55_0x2ec7;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x5717ce=fileURLToPath(import.meta.url),_0x2c1efc=dirname(_0x5717ce);try{const _0x426d96=join(_0x2c1efc,'../build-info.json');cachedBuildInfo=JSON[_0x508b0b(0xdf)](readFileSync(_0x426d96,_0x508b0b(0xd6)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x5000f2=a55_0x2ec7;if(cachedVersion!==null)return cachedVersion;const _0x1128e2=fileURLToPath(import.meta.url),_0x15b7e3=dirname(_0x1128e2),_0x3d8e8f=getBuildInfo();if(_0x3d8e8f[_0x5000f2(0xde)])return cachedVersion=_0x3d8e8f[_0x5000f2(0xde)],cachedVersion;try{const _0x4cf5a4=join(_0x15b7e3,_0x5000f2(0xda)),_0x421730=JSON[_0x5000f2(0xdf)](readFileSync(_0x4cf5a4,_0x5000f2(0xd6)));cachedVersion=_0x421730[_0x5000f2(0xde)];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x2700f2=a55_0x2ec7,_0x10c501=getVersion();return _0x10c501[_0x2700f2(0xdc)](_0x2700f2(0xe0))||_0x10c501[_0x2700f2(0xdc)]('-');}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x42ef6c,_0x38fd84){var _0x50b755=a56_0x51c6,_0x38e4da=_0x42ef6c();while(!![]){try{var _0x4068ad=parseInt(_0x50b755(0x15d))/0x1*(-parseInt(_0x50b755(0x166))/0x2)+parseInt(_0x50b755(0x15c))/0x3*(-parseInt(_0x50b755(0x165))/0x4)+-parseInt(_0x50b755(0x15a))/0x5*(parseInt(_0x50b755(0x15e))/0x6)+parseInt(_0x50b755(0x162))/0x7+-parseInt(_0x50b755(0x161))/0x8*(parseInt(_0x50b755(0x163))/0x9)+parseInt(_0x50b755(0x15b))/0xa*(-parseInt(_0x50b755(0x160))/0xb)+-parseInt(_0x50b755(0x15f))/0xc*(-parseInt(_0x50b755(0x164))/0xd);if(_0x4068ad===_0x38fd84)break;else _0x38e4da['push'](_0x38e4da['shift']());}catch(_0x5ab26d){_0x38e4da['push'](_0x38e4da['shift']());}}}(a56_0x5ccb,0x794d8));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';function a56_0x51c6(_0x1f888f,_0x23a376){_0x1f888f=_0x1f888f-0x15a;var _0x5ccbc2=a56_0x5ccb();var _0x51c666=_0x5ccbc2[_0x1f888f];return _0x51c666;}export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';function a56_0x5ccb(){var _0x1718fa=['1578KleUun','3192ewRsbU','297gwvkls','328XEEJBs','3121062iITSoj','94788pOInrX','121732JPqmsk','1496wvFoHA','6UMnSBI','10265fylnBj','197170NKGBKX','6165QVuSHP','55718VeXxGc'];a56_0x5ccb=function(){return _0x1718fa;};return a56_0x5ccb();}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';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
|
package/dist/mcp/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a57_0xdb43(){const _0x265b43=['Command\x20failed','No\x20commands\x20found\x20matching\x20\x22','1240742KCjmqo','describe','SIGTERM','1112713lKZlZV','12297681qPlkWZ','Data','description','enum','Utilities','1788717tVZeDF','8219696QbGUGt','map','once','Context','category','output','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','3RQsLaa','optional','name','text','tdx_run','SIGINT','Command\x20completed\x20successfully','1081516WybBGT','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','string','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.','join','7971395nldfrR','connect','env','success','\x0a\x0a---\x0a\x0a','registerTool','CDP','examples','36Zfolix','error'];a57_0xdb43=function(){return _0x265b43;};return a57_0xdb43();}(function(_0x1efe46,_0x579324){const _0x3b003d=a57_0x5385,_0x9ee79=_0x1efe46();while(!![]){try{const _0x47ede8=-parseInt(_0x3b003d(0x1c3))/0x1+-parseInt(_0x3b003d(0x1c0))/0x2+parseInt(_0x3b003d(0x1d1))/0x3*(parseInt(_0x3b003d(0x1d8))/0x4)+-parseInt(_0x3b003d(0x1dd))/0x5+parseInt(_0x3b003d(0x1e5))/0x6*(parseInt(_0x3b003d(0x1c9))/0x7)+parseInt(_0x3b003d(0x1ca))/0x8+parseInt(_0x3b003d(0x1c4))/0x9;if(_0x47ede8===_0x579324)break;else _0x9ee79['push'](_0x9ee79['shift']());}catch(_0x2f93c1){_0x9ee79['push'](_0x9ee79['shift']());}}}(a57_0xdb43,0xd46b9));function a57_0x5385(_0x4c0792,_0x3b71a7){_0x4c0792=_0x4c0792-0x1bd;const _0xdb43b5=a57_0xdb43();let _0x53856d=_0xdb43b5[_0x4c0792];return _0x53856d;}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(_0x2fabe2={}){const _0x33ce84=a57_0x5385,_0x40ddb4=new McpServer({'name':'tdx','version':'1.0.0'});return _0x40ddb4[_0x33ce84(0x1e2)](_0x33ce84(0x1d5),{'description':'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.','inputSchema':{'args':z['array'](z[_0x33ce84(0x1da)]())['describe'](_0x33ce84(0x1d9))}},async({args:_0x1c6208})=>{const _0x468d1c=_0x33ce84,_0x11f584=await executeTdxRun({'args':_0x1c6208},_0x2fabe2[_0x468d1c(0x1df)]||{});return _0x11f584[_0x468d1c(0x1e0)]?{'content':[{'type':_0x468d1c(0x1d4),'text':_0x11f584[_0x468d1c(0x1cf)]||_0x468d1c(0x1d7)}]}:{'content':[{'type':_0x468d1c(0x1d4),'text':_0x11f584[_0x468d1c(0x1bd)]||_0x11f584[_0x468d1c(0x1cf)]||_0x468d1c(0x1be)}],'isError':!![]};}),_0x40ddb4[_0x33ce84(0x1e2)]('tdx_search',{'description':_0x33ce84(0x1db),'inputSchema':{'query':z[_0x33ce84(0x1da)]()[_0x33ce84(0x1c1)](_0x33ce84(0x1d0)),'category':z[_0x33ce84(0x1c7)]([_0x33ce84(0x1c5),_0x33ce84(0x1e3),'AI',_0x33ce84(0x1cd),_0x33ce84(0x1c8)])[_0x33ce84(0x1d2)]()['describe']('Optional\x20filter\x20by\x20category')}},async({query:_0x311e33,category:_0x54de3e})=>{const _0x3a6236=_0x33ce84,_0x257061=searchCommands({'query':_0x311e33,'category':_0x54de3e});if(_0x257061['length']===0x0)return{'content':[{'type':_0x3a6236(0x1d4),'text':_0x3a6236(0x1bf)+_0x311e33+'\x22'}]};const _0x21289b=_0x257061[_0x3a6236(0x1cb)](_0x4fccdf=>{const _0xb60802=_0x3a6236,_0x577430=_0x4fccdf[_0xb60802(0x1e4)][_0xb60802(0x1cb)](_0x5bcf92=>'\x20\x20'+_0x5bcf92)[_0xb60802(0x1dc)]('\x0a');return'**'+_0x4fccdf[_0xb60802(0x1d3)]+'**\x20('+_0x4fccdf[_0xb60802(0x1ce)]+')\x0a'+_0x4fccdf[_0xb60802(0x1c6)]+'\x0a\x0aExamples:\x0a'+_0x577430;})[_0x3a6236(0x1dc)](_0x3a6236(0x1e1));return{'content':[{'type':_0x3a6236(0x1d4),'text':_0x21289b}]};}),_0x40ddb4;}export async function startMCPServer(_0x344d89={}){const _0x23c950=a57_0x5385,_0x30fed9=createMCPServer(_0x344d89),_0x1fa1e9=new StdioServerTransport();return await _0x30fed9[_0x23c950(0x1de)](_0x1fa1e9),new Promise(_0x489fe4=>{const _0x5d710a=_0x23c950;let _0x13ccfd=![];const _0xd00500=async()=>{if(_0x13ccfd)return;_0x13ccfd=!![],await _0x30fed9['close'](),_0x489fe4();};process[_0x5d710a(0x1cc)](_0x5d710a(0x1d6),_0xd00500),process[_0x5d710a(0x1cc)](_0x5d710a(0x1c2),_0xd00500),process['stdin']['once']('close',_0xd00500);});}
|
package/dist/mcp/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a58_0x1ff7(){var _0x14ea76=['609711EffLjW','821175SieexN','85344cfiPmV','665785AUksST','8MYRQZa','6894552zuGFlf','8947710ZUOfCq','12NTIXQc','1709400rgdPuE'];a58_0x1ff7=function(){return _0x14ea76;};return a58_0x1ff7();}function a58_0x4688(_0x381d69,_0x274b4a){_0x381d69=_0x381d69-0x6d;var _0x1ff7e1=a58_0x1ff7();var _0x4688be=_0x1ff7e1[_0x381d69];return _0x4688be;}(function(_0x77001a,_0x5d4740){var _0x27b21e=a58_0x4688,_0xb9e96b=_0x77001a();while(!![]){try{var _0x18bf66=-parseInt(_0x27b21e(0x75))/0x1+-parseInt(_0x27b21e(0x70))/0x2*(-parseInt(_0x27b21e(0x6d))/0x3)+parseInt(_0x27b21e(0x74))/0x4+-parseInt(_0x27b21e(0x6f))/0x5*(parseInt(_0x27b21e(0x73))/0x6)+parseInt(_0x27b21e(0x71))/0x7+parseInt(_0x27b21e(0x6e))/0x8+-parseInt(_0x27b21e(0x72))/0x9;if(_0x18bf66===_0x5d4740)break;else _0xb9e96b['push'](_0xb9e96b['shift']());}catch(_0x41d443){_0xb9e96b['push'](_0xb9e96b['shift']());}}}(a58_0x1ff7,0x9e1d7));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a59_0x5e0490=a59_0x181d;(function(_0x3206bc,_0x170a01){const _0x5ddc89=a59_0x181d,_0x538bc3=_0x3206bc();while(!![]){try{const _0x7aac0d=parseInt(_0x5ddc89(0x1a0))/0x1+-parseInt(_0x5ddc89(0x192))/0x2+parseInt(_0x5ddc89(0x19a))/0x3*(-parseInt(_0x5ddc89(0x18d))/0x4)+parseInt(_0x5ddc89(0x197))/0x5*(-parseInt(_0x5ddc89(0x19b))/0x6)+parseInt(_0x5ddc89(0x18b))/0x7+parseInt(_0x5ddc89(0x194))/0x8+parseInt(_0x5ddc89(0x18c))/0x9;if(_0x7aac0d===_0x170a01)break;else _0x538bc3['push'](_0x538bc3['shift']());}catch(_0x14d07f){_0x538bc3['push'](_0x538bc3['shift']());}}}(a59_0x7a8b,0x1c1e4));import{spawn}from'child_process';function a59_0x7a8b(){const _0x17868f=['This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','tdx','ignore','283528bvPIEX','3991041BsduNJ','44nyEjsa','SIGTERM','pipe','close','stderr','153324lXNwHL','string','282080SdaKgn','stdout','describe','19855wOBuDt','kill','--json','37203MUCfKG','342aZroVw','data','toString','--no-color','array','35379isNuwo','true'];a59_0x7a8b=function(){return _0x17868f;};return a59_0x7a8b();}function a59_0x181d(_0xdfe899,_0x51173d){_0xdfe899=_0xdfe899-0x18a;const _0x7a8b4e=a59_0x7a8b();let _0x181d9d=_0x7a8b4e[_0xdfe899];return _0x181d9d;}import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z['object']({'args':z[a59_0x5e0490(0x19f)](z[a59_0x5e0490(0x193)]())[a59_0x5e0490(0x196)](a59_0x5e0490(0x1a4))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;export async function executeTdxRun(_0x194048,_0x26ed5d){const _0x22c9ad=a59_0x5e0490,{args:_0x3c79bb}=_0x194048;if(isBlockedCommand(_0x3c79bb)){const _0x48e7a3=getBlockedReason(_0x3c79bb);return{'success':![],'output':'','error':_0x48e7a3||_0x22c9ad(0x1a2),'exitCode':0x1};}const _0x2f75ee=[_0x22c9ad(0x199),_0x22c9ad(0x19e),..._0x3c79bb];return new Promise(_0x3b92b5=>{const _0x579514=_0x22c9ad,_0x3a83f8=spawn(_0x579514(0x1a5),_0x2f75ee,{'env':{...process['env'],..._0x26ed5d,'CI':_0x579514(0x1a1)},'stdio':[_0x579514(0x18a),'pipe',_0x579514(0x18f)]});let _0x5bccc9='',_0x20b7f8='',_0x5493d8=![];const _0x573fcb=setTimeout(()=>{const _0xf23d6f=_0x579514;_0x5493d8=!![],_0x3a83f8[_0xf23d6f(0x198)](_0xf23d6f(0x18e));},DEFAULT_TIMEOUT_MS);_0x3a83f8[_0x579514(0x195)]['on'](_0x579514(0x19c),_0x39d7e9=>{const _0x12f6ba=_0x579514;_0x5bccc9+=_0x39d7e9[_0x12f6ba(0x19d)]();}),_0x3a83f8[_0x579514(0x191)]['on'](_0x579514(0x19c),_0x1251ee=>{const _0x5a5bed=_0x579514;_0x20b7f8+=_0x1251ee[_0x5a5bed(0x19d)]();}),_0x3a83f8['on']('error',_0x2ef2e5=>{clearTimeout(_0x573fcb),_0x3b92b5({'success':![],'output':'','error':'Failed\x20to\x20spawn\x20tdx:\x20'+_0x2ef2e5['message'],'exitCode':0x1});}),_0x3a83f8['on'](_0x579514(0x190),_0x57ef62=>{const _0x4f2e7d=_0x579514;clearTimeout(_0x573fcb);if(_0x5493d8){_0x3b92b5({'success':![],'output':formatOutput(_0x5bccc9),'error':_0x4f2e7d(0x1a3),'exitCode':0x7c});return;}const _0x5c719f=_0x57ef62??0x1,_0x28ee4a=_0x5c719f===0x0,_0x1d1bff=formatOutput(_0x5bccc9||_0x20b7f8),_0x2cdc7e=!_0x28ee4a&&_0x20b7f8?formatOutput(_0x20b7f8):undefined;_0x3b92b5({'success':_0x28ee4a,'output':_0x1d1bff,'error':_0x2cdc7e,'exitCode':_0x5c719f});});});}
|