@treasuredata/tdx 0.26.1 → 0.26.3

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.
Files changed (167) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/mcp-command.js +1 -1
  24. package/dist/commands/parent-segment-command.js +1 -1
  25. package/dist/commands/profile-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/schedule-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/passthrough-server.js +1 -1
  66. package/dist/proxy/sse-usage-parser.js +1 -1
  67. package/dist/sdk/agent/agent-config.js +1 -1
  68. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.js +1 -1
  70. package/dist/sdk/agent/test/evaluator.js +1 -1
  71. package/dist/sdk/agent/test/executor.js +1 -1
  72. package/dist/sdk/agent/test/index.js +1 -1
  73. package/dist/sdk/agent/test/output.js +1 -1
  74. package/dist/sdk/agent/test/parser.js +1 -1
  75. package/dist/sdk/api.js +1 -1
  76. package/dist/sdk/client/cdp-api-client.js +1 -1
  77. package/dist/sdk/client/endpoints.js +1 -1
  78. package/dist/sdk/client/engage-api-client.js +1 -1
  79. package/dist/sdk/client/http-client.js +1 -1
  80. package/dist/sdk/client/llm-api-client.js +1 -1
  81. package/dist/sdk/client/rate-limiter.js +1 -1
  82. package/dist/sdk/client/td-api-client.js +1 -1
  83. package/dist/sdk/client/trino-api-client.js +1 -1
  84. package/dist/sdk/client/workflow-client.js +1 -1
  85. package/dist/sdk/connection-validator.js +1 -1
  86. package/dist/sdk/connection.js +1 -1
  87. package/dist/sdk/engage.js +1 -1
  88. package/dist/sdk/errors.js +1 -1
  89. package/dist/sdk/index.js +1 -1
  90. package/dist/sdk/io/index.js +1 -1
  91. package/dist/sdk/io/node-filesystem.js +1 -1
  92. package/dist/sdk/job.js +1 -1
  93. package/dist/sdk/journey.js +1 -1
  94. package/dist/sdk/llm/chat-cache.js +1 -1
  95. package/dist/sdk/llm/index.js +1 -1
  96. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  97. package/dist/sdk/llm/model-factors.js +1 -1
  98. package/dist/sdk/personalization.js +1 -1
  99. package/dist/sdk/query/index.js +1 -1
  100. package/dist/sdk/query/sql-parser.js +1 -1
  101. package/dist/sdk/realtime.js +1 -1
  102. package/dist/sdk/schedule.js +1 -1
  103. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  104. package/dist/sdk/segment/fields-display.js +1 -1
  105. package/dist/sdk/segment/file-discovery.js +1 -1
  106. package/dist/sdk/segment/journey-utils.js +1 -1
  107. package/dist/sdk/segment/journey-validator.js +1 -1
  108. package/dist/sdk/segment/journey-yaml.js +1 -1
  109. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  110. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  111. package/dist/sdk/segment/pull-workflow.js +1 -1
  112. package/dist/sdk/segment/push-recovery.js +1 -1
  113. package/dist/sdk/segment/push-workflow.js +1 -1
  114. package/dist/sdk/segment/resolution-context.js +1 -1
  115. package/dist/sdk/segment/segment-path-parser.js +1 -1
  116. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  117. package/dist/sdk/segment/target-resolution.js +1 -1
  118. package/dist/sdk/segment/tdx-config.js +1 -1
  119. package/dist/sdk/segment/validate-files.js +1 -1
  120. package/dist/sdk/segment/yaml-validator.js +1 -1
  121. package/dist/sdk/segment.js +1 -1
  122. package/dist/sdk/types/index.js +1 -1
  123. package/dist/sdk/types/progress.js +1 -1
  124. package/dist/sdk/user.js +1 -1
  125. package/dist/sdk/util/format-detector.js +1 -1
  126. package/dist/sdk/util/formatters.js +1 -1
  127. package/dist/sdk/util/index.js +1 -1
  128. package/dist/sdk/util/tree-formatter.js +1 -1
  129. package/dist/sdk/workflow/archive-validation.js +1 -1
  130. package/dist/sdk/workflow/clone-workflow.js +1 -1
  131. package/dist/sdk/workflow/index.js +1 -1
  132. package/dist/sdk/workflow/pull-workflow.js +1 -1
  133. package/dist/sdk/workflow/push-workflow.js +1 -1
  134. package/dist/sdk/workflow/tdx-config.js +1 -1
  135. package/dist/sdk/workflow/workflow-utils.js +1 -1
  136. package/dist/test-utils/command-runner.js +1 -1
  137. package/dist/test-utils/factories.js +1 -1
  138. package/dist/test-utils/fixtures.js +1 -1
  139. package/dist/test-utils/http-mock.js +1 -1
  140. package/dist/test-utils/index.js +1 -1
  141. package/dist/utils/async.js +1 -1
  142. package/dist/utils/colors.js +1 -1
  143. package/dist/utils/diff.js +1 -1
  144. package/dist/utils/file-permissions.js +1 -1
  145. package/dist/utils/global-cache.js +1 -1
  146. package/dist/utils/json-loader.js +1 -1
  147. package/dist/utils/local-cache.js +1 -1
  148. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  149. package/dist/utils/logger/formatters/index.js +1 -1
  150. package/dist/utils/logger/handlers/console-handler.js +1 -1
  151. package/dist/utils/logger/handlers/file-handler.js +1 -1
  152. package/dist/utils/logger/handlers/index.js +1 -1
  153. package/dist/utils/logger/handlers/null-handler.js +1 -1
  154. package/dist/utils/logger/index.js +1 -1
  155. package/dist/utils/logger/logger.js +1 -1
  156. package/dist/utils/logger/types.js +1 -1
  157. package/dist/utils/option-validation.js +1 -1
  158. package/dist/utils/port.js +1 -1
  159. package/dist/utils/process.js +1 -1
  160. package/dist/utils/prompt.js +1 -1
  161. package/dist/utils/spinner.js +1 -1
  162. package/dist/utils/sse-parser.js +1 -1
  163. package/dist/utils/string-utils.js +1 -1
  164. package/dist/utils/table-ref-parser.js +1 -1
  165. package/dist/utils/tdx-logger.js +1 -1
  166. package/dist/utils/version-check.js +1 -1
  167. package/package.json +1 -1
@@ -1 +1 @@
1
- const a45_0x4b72b3=a45_0x3668;(function(_0x278626,_0x53f127){const _0x12e336=a45_0x3668,_0x18e2e4=_0x278626();while(!![]){try{const _0x298fc1=parseInt(_0x12e336(0x196))/0x1+-parseInt(_0x12e336(0x1a7))/0x2*(parseInt(_0x12e336(0x164))/0x3)+-parseInt(_0x12e336(0x167))/0x4+parseInt(_0x12e336(0x174))/0x5*(parseInt(_0x12e336(0x170))/0x6)+parseInt(_0x12e336(0x191))/0x7+-parseInt(_0x12e336(0x197))/0x8*(parseInt(_0x12e336(0x16b))/0x9)+-parseInt(_0x12e336(0x1a2))/0xa;if(_0x298fc1===_0x53f127)break;else _0x18e2e4['push'](_0x18e2e4['shift']());}catch(_0x231d2d){_0x18e2e4['push'](_0x18e2e4['shift']());}}}(a45_0xb228,0x6a74d));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x4fe878 from'node:fs';import*as a45_0x17c7f0 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x42c9c3 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x53ee69=a45_0x3668;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x53ee69(0x16e),'tdx');}function a45_0x3668(_0x306817,_0x220ceb){_0x306817=_0x306817-0x162;const _0xb228b9=a45_0xb228();let _0x3668a7=_0xb228b9[_0x306817];return _0x3668a7;}export function getConfigFile(){const _0x3e76ac=a45_0x3668;return join(getConfigDir(),_0x3e76ac(0x18d));}export function getConfigFilePath(_0xd9d88){const _0x381798=getConfigDir();return _0xd9d88?a45_0x17c7f0['join'](_0x381798,'.env.'+_0xd9d88):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0x4b72b3(0x1a4),a45_0x4b72b3(0x1a5));export function getLLMProjectCacheFile(_0xe28f37){return llmProjectCache['path'](_0xe28f37);}export function readCachedLLMProject(_0x1ee037){const _0x53bcca=a45_0x4b72b3,_0x4250b0=llmProjectCache['read'](_0x1ee037);if(_0x4250b0&&typeof _0x4250b0['id']===_0x53bcca(0x17f)&&typeof _0x4250b0['name']===_0x53bcca(0x17f))return _0x4250b0;return null;}export function writeCachedLLMProject(_0x1f0a56,_0x3681c0,_0x4dab0f){const _0x2a304d=a45_0x4b72b3;try{llmProjectCache[_0x2a304d(0x166)]({'name':_0x1f0a56,'id':_0x3681c0},_0x4dab0f);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x4b72b3(0x190),a45_0x4b72b3(0x176));export function getLLMAgentCacheFile(_0x44a5e7){const _0x580458=a45_0x4b72b3;return llmAgentCache[_0x580458(0x19d)](_0x44a5e7);}export function readCachedLLMAgent(_0x4e3374){const _0x262b65=a45_0x4b72b3,_0x4b426a=llmAgentCache[_0x262b65(0x16a)](_0x4e3374);if(_0x4b426a&&typeof _0x4b426a['id']===_0x262b65(0x17f)&&typeof _0x4b426a[_0x262b65(0x163)]==='string'&&typeof _0x4b426a[_0x262b65(0x172)]===_0x262b65(0x17f))return _0x4b426a;return null;}export function writeCachedLLMAgent(_0x5b7ffa,_0x193636,_0x4b5bcf,_0x1ab137){try{llmAgentCache['write']({'name':_0x5b7ffa,'id':_0x193636,'projectId':_0x4b5bcf},_0x1ab137);}catch{}}export function clearCachedLLMAgent(_0x2800a4){const _0xf240f9=a45_0x4b72b3;try{llmAgentCache[_0xf240f9(0x18a)](_0x2800a4);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0x4b72b3(0x188),a45_0x4b72b3(0x193),{'suffix':a45_0x4b72b3(0x181)});export function getAccountInfoCacheFile(_0x4d5999){const _0x29eba2=a45_0x4b72b3;return accountInfoCache[_0x29eba2(0x19d)](_0x4d5999);}export function readCachedAccountInfo(_0x537c37){const _0x17df68=a45_0x4b72b3,_0x22cefa=accountInfoCache[_0x17df68(0x16a)](_0x537c37);if(_0x22cefa&&typeof _0x22cefa[_0x17df68(0x168)]===_0x17df68(0x17f)&&typeof _0x22cefa[_0x17df68(0x19b)]===_0x17df68(0x19f))return _0x22cefa;return null;}export function writeCachedAccountInfo(_0x58f348,_0x2ef274,_0x5f3340){const _0x419d16=a45_0x4b72b3;try{accountInfoCache['write']({'site':_0x58f348,'accountId':_0x2ef274,'cachedAt':new Date()[_0x419d16(0x165)]()},_0x5f3340);}catch{}}export function parseEnvFile(_0x38a762){const _0x52e7a6=a45_0x4b72b3,_0x2e39cc={};for(const _0x404d04 of _0x38a762[_0x52e7a6(0x182)]('\x0a')){const _0x5d8cf0=_0x404d04[_0x52e7a6(0x1a6)]();if(!_0x5d8cf0||_0x5d8cf0[_0x52e7a6(0x16f)]('#'))continue;const _0x38dec8=_0x5d8cf0[_0x52e7a6(0x183)](/^([^=]+)=(.*)$/);if(_0x38dec8){const _0x2384ce=_0x38dec8[0x1][_0x52e7a6(0x1a6)]();let _0x1fcfa7=_0x38dec8[0x2]['trim']();(_0x1fcfa7[_0x52e7a6(0x16f)]('\x22')&&_0x1fcfa7[_0x52e7a6(0x17d)]('\x22')||_0x1fcfa7['startsWith']('\x27')&&_0x1fcfa7[_0x52e7a6(0x17d)]('\x27'))&&(_0x1fcfa7=_0x1fcfa7[_0x52e7a6(0x19c)](0x1,-0x1)),_0x2e39cc[_0x2384ce]=_0x1fcfa7;}}return _0x2e39cc;}export function readUserConfig(){const _0x373f2a=a45_0x4b72b3,_0x5d02f5=getConfigFile();if(!existsSync(_0x5d02f5))return{};try{const _0x27348e=readFileSync(_0x5d02f5,'utf-8');return parseEnvFile(_0x27348e);}catch(_0x3ca116){return console[_0x373f2a(0x1a8)](_0x373f2a(0x17e)+_0x5d02f5+':',_0x3ca116),{};}}export function resolveSite(_0x2e5a15){const _0x2fc4b4=a45_0x4b72b3,_0x1089cd=[_0x2fc4b4(0x1a1),_0x2fc4b4(0x177),_0x2fc4b4(0x162),_0x2fc4b4(0x173),'ap03','dev-us01','dev-eu01','stg-us01',_0x2fc4b4(0x1a9),_0x2fc4b4(0x18e)];if(_0x1089cd[_0x2fc4b4(0x198)](_0x2e5a15))return _0x2e5a15;if(_0x2e5a15 in SITE_ALIASES)return SITE_ALIASES[_0x2e5a15];return console[_0x2fc4b4(0x1a8)]('Warning:\x20Unknown\x20site\x20\x27'+_0x2e5a15+'\x27,\x20defaulting\x20to\x20us01'),_0x2fc4b4(0x1a1);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x13b1de){const _0x5086c7=a45_0x4b72b3,_0x4b5d3c=_0x13b1de||getActiveProfileName();if(_0x4b5d3c){const _0x3f6a24=_0x5086c7(0x17c)+normalizeProfileForEnvVar(_0x4b5d3c);if(process.env[_0x3f6a24])return process.env[_0x3f6a24];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x3b9e60){const _0x57c526=a45_0x4b72b3;return _0x3b9e60[_0x57c526(0x18b)]()[_0x57c526(0x175)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x5ea3fb,_0x49ba81){const _0x1e8e27=a45_0x4b72b3,_0x4a0924=_0x49ba81||getActiveProfileName()||undefined;if(_0x4a0924){const _0x5ee66c='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x4a0924);if(process.env[_0x5ee66c])return{'apiKey':process.env[_0x5ee66c],'source':_0x5ee66c+_0x1e8e27(0x1a3),'isDeprecated':![]};const _0xb139aa=getCachedCredential(_0x5ea3fb,_0x4a0924);if(_0xb139aa)return{'apiKey':_0xb139aa,'source':'keychain\x20(profile:\x20'+_0x4a0924+')','isDeprecated':![]};const _0x2f35c9=await getKeychainAPIKey(_0x4a0924);if(_0x2f35c9)return setCachedCredential(_0x2f35c9,_0x5ea3fb,_0x4a0924),{'apiKey':_0x2f35c9,'source':_0x1e8e27(0x16d)+_0x4a0924+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x1e8e27(0x194),'isDeprecated':![]};if(!_0x4a0924){const _0xeb64b8=getCachedCredential(_0x5ea3fb,undefined);if(_0xeb64b8)return{'apiKey':_0xeb64b8,'source':_0x1e8e27(0x18c),'isDeprecated':![]};const _0x58830a=await getKeychainAPIKey(undefined);if(_0x58830a)return setCachedCredential(_0x58830a,_0x5ea3fb,undefined),{'apiKey':_0x58830a,'source':_0x1e8e27(0x18c),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x763834,_0x25ae94){const _0x351790=await resolveAPIKeyAsync(_0x763834,_0x25ae94);return _0x351790?.['apiKey'];}function cleanupLegacyEnvFile(_0x578594){const _0x2b8882=a45_0x4b72b3;if(!existsSync(_0x578594))return![];try{const _0x26db64=readFileSync(_0x578594,_0x2b8882(0x179)),_0xe17748=_0x26db64['split']('\x0a'),_0x58c992=_0xe17748[_0x2b8882(0x171)](_0x4fe225=>{const _0x383613=_0x2b8882,_0x544ede=_0x4fe225[_0x383613(0x1a6)]();if(!_0x544ede||_0x544ede['startsWith']('#'))return!![];const [_0x41525e]=_0x544ede['split']('=');return!_0x41525e[_0x383613(0x16f)](_0x383613(0x16c));}),_0x397937=_0x58c992['some'](_0x54c751=>{const _0x46f8d3=_0x2b8882,_0x763286=_0x54c751[_0x46f8d3(0x1a6)]();return _0x763286&&!_0x763286[_0x46f8d3(0x16f)]('#');});if(!_0x397937)return unlinkSync(_0x578594),!![];return writeFileSync(_0x578594,_0x58c992['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function a45_0xb228(){const _0x30d2a5=['stg-ap03','entries','llm_default_agent','3024378JnBTbF','dev-us01','config/account-info','TDX_API_KEY\x20env\x20var','map','281542mtRRkT','1264AiNlSO','includes','join','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','accountId','slice','path','parse','number','existsSync','us01','231930TpLWrP','\x20env\x20var','llm_default_project','config/llm-project','trim','54wpsoLy','warn','stg-jp01','release_channel','eu01','name','21126gjVkdj','toISOString','write','1263116clFNWB','site','readFileSync','read','7974skkhkZ','TD_API_KEY','keychain\x20(profile:\x20','.config','startsWith','906zPngBz','filter','projectId','ap02','12965FmLDhb','replace','config/llm-agent','jp01','proxy','utf-8','tdx.json','stg-us01','TDX_API_KEY_','endsWith','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','string','Warning:\x20Failed\x20to\x20read\x20','.json','split','match','next','TD_API_KEY_','apiKeys','stable','account_info','yellow','clear','toUpperCase','keychain','.env'];a45_0xb228=function(){return _0x30d2a5;};return a45_0xb228();}function getActiveProfileName(){const _0x1d710a=a45_0x4b72b3;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x538b46=a45_0x17c7f0['join'](getConfigDir(),_0x1d710a(0x17a));if(!a45_0x4fe878[_0x1d710a(0x1a0)](_0x538b46))return null;try{const _0x1dc4a7=a45_0x4fe878[_0x1d710a(0x169)](_0x538b46,_0x1d710a(0x179)),_0x2a5b4c=JSON[_0x1d710a(0x19e)](_0x1dc4a7);return _0x2a5b4c['profile']||null;}catch{return null;}}export function saveAPIKey(_0xf8feae,_0x16ff90,_0x39b248){const _0x5f44b6=a45_0x4b72b3,_0x53b96f=getConfigDir(),_0x32e8f2=getConfigFilePath(_0x39b248);!existsSync(_0x53b96f)&&mkdirSync(_0x53b96f,{'recursive':!![],'mode':0x1c0});let _0x4824b4={};if(existsSync(_0x32e8f2))try{const _0x5ef5a2=readFileSync(_0x32e8f2,'utf-8');_0x4824b4=parseEnvFile(_0x5ef5a2);}catch(_0x486c51){console['warn'](_0x5f44b6(0x180)+_0x32e8f2+':',_0x486c51);}const _0x39c33e=_0xf8feae[_0x5f44b6(0x18b)]()[_0x5f44b6(0x175)](/-/g,'_');_0x4824b4[_0x5f44b6(0x185)+_0x39c33e]=_0x16ff90;const _0x57bda7=Object[_0x5f44b6(0x18f)](_0x4824b4)[_0x5f44b6(0x195)](([_0x3ac065,_0x17edd6])=>_0x3ac065+'='+_0x17edd6);writeFileSync(_0x32e8f2,_0x57bda7[_0x5f44b6(0x199)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x4e8f57,_0x35f446,_0x487e1b){const _0x4ab352=a45_0x4b72b3;await saveKeychainAPIKey(_0x4e8f57,_0x487e1b),setCachedCredential(_0x4e8f57,_0x35f446,_0x487e1b);const _0x55fbb6=getConfigFilePath(_0x487e1b);cleanupLegacyEnvFile(_0x55fbb6)&&console[_0x4ab352(0x1a8)](a45_0x42c9c3[_0x4ab352(0x189)](_0x4ab352(0x19a)));}export function loadConfig(){const _0x53e554=a45_0x4b72b3,_0x3b3922={'apiKeys':{},'defaultSite':_0x53e554(0x1a1)},_0x4aa179=['us01','jp01',_0x53e554(0x162),_0x53e554(0x173),'ap03',_0x53e554(0x192),'dev-eu01',_0x53e554(0x17b),'stg-jp01',_0x53e554(0x18e)],_0x2b5c96=getAPIKey();if(_0x2b5c96)for(const _0x5180cb of _0x4aa179){_0x3b3922[_0x53e554(0x186)][_0x5180cb]=_0x2b5c96;}return _0x3b3922;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x5d90c9=a45_0x4b72b3,_0x2d838b=a45_0x17c7f0[_0x5d90c9(0x199)](getConfigDir(),_0x5d90c9(0x17a));if(!a45_0x4fe878[_0x5d90c9(0x1a0)](_0x2d838b))return undefined;try{const _0x2fabb7=a45_0x4fe878[_0x5d90c9(0x169)](_0x2d838b,_0x5d90c9(0x179)),_0x5773e2=JSON[_0x5d90c9(0x19e)](_0x2fabb7);return typeof _0x5773e2[_0x5d90c9(0x178)]===_0x5d90c9(0x17f)?_0x5773e2[_0x5d90c9(0x178)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x1a9b06=a45_0x4b72b3,_0x3a2868=process.env.TDX_RELEASE_CHANNEL;if(_0x3a2868===_0x1a9b06(0x184)||_0x3a2868==='stable')return _0x3a2868;const _0xf47fb6=a45_0x17c7f0['join'](getConfigDir(),_0x1a9b06(0x17a));if(!a45_0x4fe878['existsSync'](_0xf47fb6))return'stable';try{const _0x501a00=a45_0x4fe878[_0x1a9b06(0x169)](_0xf47fb6,_0x1a9b06(0x179)),_0xb107ef=JSON[_0x1a9b06(0x19e)](_0x501a00);if(_0xb107ef[_0x1a9b06(0x1aa)]==='next')return _0x1a9b06(0x184);}catch{}return _0x1a9b06(0x187);}export function saveReleaseChannel(_0x464906){const _0x162dcc=a45_0x4b72b3,_0x588010=getConfigDir(),_0x491b4e=a45_0x17c7f0[_0x162dcc(0x199)](_0x588010,_0x162dcc(0x17a));!existsSync(_0x588010)&&mkdirSync(_0x588010,{'recursive':!![],'mode':0x1c0});let _0x1dea3d={};if(existsSync(_0x491b4e))try{const _0x4cbd62=readFileSync(_0x491b4e,'utf-8');_0x1dea3d=JSON[_0x162dcc(0x19e)](_0x4cbd62);}catch{}_0x1dea3d['release_channel']=_0x464906,writeFileSync(_0x491b4e,JSON['stringify'](_0x1dea3d,null,0x2),{'mode':0x180});}
1
+ const a45_0x51d330=a45_0x383c;(function(_0x1e1ce2,_0x8d9727){const _0x2cb648=a45_0x383c,_0x2a3c76=_0x1e1ce2();while(!![]){try{const _0x419f2d=parseInt(_0x2cb648(0x108))/0x1*(-parseInt(_0x2cb648(0xfe))/0x2)+-parseInt(_0x2cb648(0xd5))/0x3+parseInt(_0x2cb648(0x11a))/0x4*(-parseInt(_0x2cb648(0xe3))/0x5)+-parseInt(_0x2cb648(0x109))/0x6+parseInt(_0x2cb648(0x102))/0x7*(parseInt(_0x2cb648(0xee))/0x8)+parseInt(_0x2cb648(0xe8))/0x9+parseInt(_0x2cb648(0xfc))/0xa;if(_0x419f2d===_0x8d9727)break;else _0x2a3c76['push'](_0x2a3c76['shift']());}catch(_0xa46c0f){_0x2a3c76['push'](_0x2a3c76['shift']());}}}(a45_0x5e47,0x3a745));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0xdc6576 from'node:fs';import*as a45_0x498061 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x3a92e6 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x38966c=a45_0x383c;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x38966c(0x118),_0x38966c(0xf1));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x4b9240){const _0x4560c2=a45_0x383c,_0xcadab6=getConfigDir();return _0x4b9240?a45_0x498061[_0x4560c2(0xea)](_0xcadab6,_0x4560c2(0x119)+_0x4b9240):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0x51d330(0x11b),'config/llm-project');export function getLLMProjectCacheFile(_0x2f9ecb){const _0x46f11a=a45_0x51d330;return llmProjectCache[_0x46f11a(0xe9)](_0x2f9ecb);}export function readCachedLLMProject(_0x17d22b){const _0x5c1d7e=a45_0x51d330,_0x3af83a=llmProjectCache[_0x5c1d7e(0xd9)](_0x17d22b);if(_0x3af83a&&typeof _0x3af83a['id']===_0x5c1d7e(0xfd)&&typeof _0x3af83a['name']===_0x5c1d7e(0xfd))return _0x3af83a;return null;}export function writeCachedLLMProject(_0x16ea5d,_0x3c666b,_0x45e52b){try{llmProjectCache['write']({'name':_0x16ea5d,'id':_0x3c666b},_0x45e52b);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x51d330(0x113),a45_0x51d330(0xe6));export function getLLMAgentCacheFile(_0x1355db){const _0x1b0eed=a45_0x51d330;return llmAgentCache[_0x1b0eed(0xe9)](_0x1355db);}export function readCachedLLMAgent(_0x23c0aa){const _0x158f87=a45_0x51d330,_0x5a1353=llmAgentCache[_0x158f87(0xd9)](_0x23c0aa);if(_0x5a1353&&typeof _0x5a1353['id']===_0x158f87(0xfd)&&typeof _0x5a1353[_0x158f87(0xf7)]===_0x158f87(0xfd)&&typeof _0x5a1353['projectId']===_0x158f87(0xfd))return _0x5a1353;return null;}export function writeCachedLLMAgent(_0x12f102,_0x44bd19,_0x37b151,_0x3d4a94){const _0x5ebc67=a45_0x51d330;try{llmAgentCache[_0x5ebc67(0xd6)]({'name':_0x12f102,'id':_0x44bd19,'projectId':_0x37b151},_0x3d4a94);}catch{}}export function clearCachedLLMAgent(_0x9a03b3){const _0x6ff221=a45_0x51d330;try{llmAgentCache[_0x6ff221(0x110)](_0x9a03b3);}catch{}}function a45_0x383c(_0x161a57,_0x543364){_0x161a57=_0x161a57-0xd5;const _0x5e47c9=a45_0x5e47();let _0x383c7c=_0x5e47c9[_0x161a57];return _0x383c7c;}const accountInfoCache=createOptionalProfileCache(a45_0x51d330(0x10a),a45_0x51d330(0x10b),{'suffix':'.json'});export function getAccountInfoCacheFile(_0xf5fbd3){const _0x135360=a45_0x51d330;return accountInfoCache[_0x135360(0xe9)](_0xf5fbd3);}export function readCachedAccountInfo(_0x2e7bd7){const _0x59f751=a45_0x51d330,_0xf50f36=accountInfoCache[_0x59f751(0xd9)](_0x2e7bd7);if(_0xf50f36&&typeof _0xf50f36['site']===_0x59f751(0xfd)&&typeof _0xf50f36[_0x59f751(0xf9)]===_0x59f751(0x111))return _0xf50f36;return null;}export function writeCachedAccountInfo(_0x2c7a04,_0x4a2b5f,_0x3f98da){const _0x5215fd=a45_0x51d330;try{accountInfoCache[_0x5215fd(0xd6)]({'site':_0x2c7a04,'accountId':_0x4a2b5f,'cachedAt':new Date()['toISOString']()},_0x3f98da);}catch{}}export function parseEnvFile(_0x72230c){const _0x1f0946=a45_0x51d330,_0x3de697={};for(const _0x530136 of _0x72230c['split']('\x0a')){const _0x3044c6=_0x530136['trim']();if(!_0x3044c6||_0x3044c6[_0x1f0946(0xfa)]('#'))continue;const _0x58381d=_0x3044c6[_0x1f0946(0xfb)](/^([^=]+)=(.*)$/);if(_0x58381d){const _0x55690c=_0x58381d[0x1][_0x1f0946(0x117)]();let _0x1b6cbf=_0x58381d[0x2][_0x1f0946(0x117)]();(_0x1b6cbf[_0x1f0946(0xfa)]('\x22')&&_0x1b6cbf[_0x1f0946(0x106)]('\x22')||_0x1b6cbf[_0x1f0946(0xfa)]('\x27')&&_0x1b6cbf['endsWith']('\x27'))&&(_0x1b6cbf=_0x1b6cbf[_0x1f0946(0xff)](0x1,-0x1)),_0x3de697[_0x55690c]=_0x1b6cbf;}}return _0x3de697;}export function readUserConfig(){const _0x77b8b1=a45_0x51d330,_0x27bd0f=getConfigFile();if(!existsSync(_0x27bd0f))return{};try{const _0x117e43=readFileSync(_0x27bd0f,'utf-8');return parseEnvFile(_0x117e43);}catch(_0x1bce38){return console[_0x77b8b1(0x112)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x27bd0f+':',_0x1bce38),{};}}export function resolveSite(_0x57ca55){const _0x5c816a=a45_0x51d330,_0x23840f=['us01',_0x5c816a(0xe2),'eu01','ap02','ap03','dev-us01',_0x5c816a(0x104),'stg-us01','stg-jp01',_0x5c816a(0xde)];if(_0x23840f[_0x5c816a(0x105)](_0x57ca55))return _0x57ca55;if(_0x57ca55 in SITE_ALIASES)return SITE_ALIASES[_0x57ca55];return console[_0x5c816a(0x112)](_0x5c816a(0x11c)+_0x57ca55+_0x5c816a(0xed)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x3e0c64){const _0x254c73=a45_0x51d330,_0x300568=_0x3e0c64||getActiveProfileName();if(_0x300568){const _0x124349=_0x254c73(0xe1)+normalizeProfileForEnvVar(_0x300568);if(process.env[_0x124349])return process.env[_0x124349];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x2c065b){const _0x8e3bb3=a45_0x51d330;return _0x2c065b['toUpperCase']()[_0x8e3bb3(0xf5)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x5a2e6e,_0x41ff91){const _0x19214=a45_0x51d330,_0x3ad97e=_0x41ff91||getActiveProfileName()||undefined;if(_0x3ad97e){const _0x59f814=_0x19214(0xe1)+normalizeProfileForEnvVar(_0x3ad97e);if(process.env[_0x59f814])return{'apiKey':process.env[_0x59f814],'source':_0x59f814+'\x20env\x20var','isDeprecated':![]};const _0x5ed27a=getCachedCredential(_0x5a2e6e,_0x3ad97e);if(_0x5ed27a)return{'apiKey':_0x5ed27a,'source':_0x19214(0x10d)+_0x3ad97e+')','isDeprecated':![]};const _0x4e14aa=await getKeychainAPIKey(_0x3ad97e);if(_0x4e14aa)return setCachedCredential(_0x4e14aa,_0x5a2e6e,_0x3ad97e),{'apiKey':_0x4e14aa,'source':_0x19214(0x10d)+_0x3ad97e+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x3ad97e){const _0x3e811f=getCachedCredential(_0x5a2e6e,undefined);if(_0x3e811f)return{'apiKey':_0x3e811f,'source':'keychain','isDeprecated':![]};const _0x231427=await getKeychainAPIKey(undefined);if(_0x231427)return setCachedCredential(_0x231427,_0x5a2e6e,undefined),{'apiKey':_0x231427,'source':_0x19214(0xf4),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0xc72dc4,_0x5a2d40){const _0x129de1=a45_0x51d330,_0x41f51f=await resolveAPIKeyAsync(_0xc72dc4,_0x5a2d40);return _0x41f51f?.[_0x129de1(0xdd)];}function cleanupLegacyEnvFile(_0x24d0a6){const _0x10f193=a45_0x51d330;if(!existsSync(_0x24d0a6))return![];try{const _0x152ac1=readFileSync(_0x24d0a6,_0x10f193(0xf2)),_0x51b664=_0x152ac1[_0x10f193(0xe4)]('\x0a'),_0x5d9a07=_0x51b664[_0x10f193(0xf8)](_0x5d7379=>{const _0x15ccc9=_0x10f193,_0x197e40=_0x5d7379[_0x15ccc9(0x117)]();if(!_0x197e40||_0x197e40[_0x15ccc9(0xfa)]('#'))return!![];const [_0x4494f0]=_0x197e40['split']('=');return!_0x4494f0[_0x15ccc9(0xfa)](_0x15ccc9(0x114));}),_0x5653d5=_0x5d9a07[_0x10f193(0xe0)](_0x57658e=>{const _0x183ce3=_0x10f193,_0x2b6532=_0x57658e[_0x183ce3(0x117)]();return _0x2b6532&&!_0x2b6532['startsWith']('#');});if(!_0x5653d5)return unlinkSync(_0x24d0a6),!![];return writeFileSync(_0x24d0a6,_0x5d9a07[_0x10f193(0xea)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x3543fa=a45_0x51d330;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x49bc6b=a45_0x498061['join'](getConfigDir(),_0x3543fa(0xd7));if(!a45_0xdc6576[_0x3543fa(0xd8)](_0x49bc6b))return null;try{const _0x564095=a45_0xdc6576[_0x3543fa(0xec)](_0x49bc6b,'utf-8'),_0x435967=JSON[_0x3543fa(0x10c)](_0x564095);return _0x435967[_0x3543fa(0x10e)]||null;}catch{return null;}}export function saveAPIKey(_0x212b25,_0x48c0a8,_0x5572bd){const _0x14a0cf=a45_0x51d330,_0x1dd920=getConfigDir(),_0x3a5dd6=getConfigFilePath(_0x5572bd);!existsSync(_0x1dd920)&&mkdirSync(_0x1dd920,{'recursive':!![],'mode':0x1c0});let _0x18f907={};if(existsSync(_0x3a5dd6))try{const _0x231147=readFileSync(_0x3a5dd6,_0x14a0cf(0xf2));_0x18f907=parseEnvFile(_0x231147);}catch(_0x23b7e3){console[_0x14a0cf(0x112)](_0x14a0cf(0x107)+_0x3a5dd6+':',_0x23b7e3);}const _0x369fb7=_0x212b25[_0x14a0cf(0xdc)]()[_0x14a0cf(0xf5)](/-/g,'_');_0x18f907[_0x14a0cf(0xf6)+_0x369fb7]=_0x48c0a8;const _0x104acb=Object[_0x14a0cf(0xda)](_0x18f907)[_0x14a0cf(0x116)](([_0x2eda28,_0x35da48])=>_0x2eda28+'='+_0x35da48);writeFileSync(_0x3a5dd6,_0x104acb[_0x14a0cf(0xea)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x1ae425,_0x1189aa,_0x2d7dd2){const _0x2fae51=a45_0x51d330;await saveKeychainAPIKey(_0x1ae425,_0x2d7dd2),setCachedCredential(_0x1ae425,_0x1189aa,_0x2d7dd2);const _0x1dff0b=getConfigFilePath(_0x2d7dd2);cleanupLegacyEnvFile(_0x1dff0b)&&console[_0x2fae51(0x112)](a45_0x3a92e6[_0x2fae51(0xe7)](_0x2fae51(0xeb)));}export function loadConfig(){const _0x4bd9d0=a45_0x51d330,_0x3d5a4a={'apiKeys':{},'defaultSite':'us01'},_0x4111a6=[_0x4bd9d0(0x11d),_0x4bd9d0(0xe2),_0x4bd9d0(0x115),_0x4bd9d0(0xef),_0x4bd9d0(0xe5),_0x4bd9d0(0x10f),_0x4bd9d0(0x104),_0x4bd9d0(0x103),_0x4bd9d0(0xf3),_0x4bd9d0(0xde)],_0xa86036=getAPIKey();if(_0xa86036)for(const _0x214522 of _0x4111a6){_0x3d5a4a[_0x4bd9d0(0xdf)][_0x214522]=_0xa86036;}return _0x3d5a4a;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}function a45_0x5e47(){const _0x512647=['yellow','1238337ixkzXo','path','join','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','readFileSync','\x27,\x20defaulting\x20to\x20us01','4576uSpXeJ','ap02','stable','tdx','utf-8','stg-jp01','keychain','replace','TD_API_KEY_','name','filter','accountId','startsWith','match','3000360aEJeFE','string','146cLOTTm','slice','release_channel','proxy','5803CQJtUG','stg-us01','dev-eu01','includes','endsWith','Warning:\x20Failed\x20to\x20read\x20','1723OZpDqO','2277348czZEBg','account_info','config/account-info','parse','keychain\x20(profile:\x20','profile','dev-us01','clear','number','warn','llm_default_agent','TD_API_KEY','eu01','map','trim','.config','.env.','582164duEKKL','llm_default_project','Warning:\x20Unknown\x20site\x20\x27','us01','64530nhpaWp','write','tdx.json','existsSync','read','entries','next','toUpperCase','apiKey','stg-ap03','apiKeys','some','TDX_API_KEY_','jp01','5yyFSpV','split','ap03','config/llm-agent'];a45_0x5e47=function(){return _0x512647;};return a45_0x5e47();}export function loadGlobalProxy(){const _0x48b274=a45_0x51d330,_0x283bca=a45_0x498061[_0x48b274(0xea)](getConfigDir(),'tdx.json');if(!a45_0xdc6576['existsSync'](_0x283bca))return undefined;try{const _0x8a2356=a45_0xdc6576[_0x48b274(0xec)](_0x283bca,'utf-8'),_0x36204e=JSON['parse'](_0x8a2356);return typeof _0x36204e['proxy']===_0x48b274(0xfd)?_0x36204e[_0x48b274(0x101)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x3e667c=a45_0x51d330,_0x203816=process.env.TDX_RELEASE_CHANNEL;if(_0x203816==='next'||_0x203816===_0x3e667c(0xf0))return _0x203816;const _0x4d0d12=a45_0x498061[_0x3e667c(0xea)](getConfigDir(),_0x3e667c(0xd7));if(!a45_0xdc6576[_0x3e667c(0xd8)](_0x4d0d12))return'stable';try{const _0x157522=a45_0xdc6576['readFileSync'](_0x4d0d12,_0x3e667c(0xf2)),_0x264819=JSON[_0x3e667c(0x10c)](_0x157522);if(_0x264819[_0x3e667c(0x100)]===_0x3e667c(0xdb))return _0x3e667c(0xdb);}catch{}return'stable';}export function saveReleaseChannel(_0x1f9607){const _0xa044d2=a45_0x51d330,_0x58c821=getConfigDir(),_0x1e8b34=a45_0x498061[_0xa044d2(0xea)](_0x58c821,'tdx.json');!existsSync(_0x58c821)&&mkdirSync(_0x58c821,{'recursive':!![],'mode':0x1c0});let _0x3436c1={};if(existsSync(_0x1e8b34))try{const _0x3617c9=readFileSync(_0x1e8b34,_0xa044d2(0xf2));_0x3436c1=JSON[_0xa044d2(0x10c)](_0x3617c9);}catch{}_0x3436c1[_0xa044d2(0x100)]=_0x1f9607,writeFileSync(_0x1e8b34,JSON['stringify'](_0x3436c1,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a46_0x3cd9dc=a46_0x4a23;(function(_0x33957f,_0x3abfed){const _0x565c7d=a46_0x4a23,_0x4c6914=_0x33957f();while(!![]){try{const _0x5e1c17=parseInt(_0x565c7d(0x15d))/0x1+parseInt(_0x565c7d(0x15e))/0x2*(-parseInt(_0x565c7d(0x167))/0x3)+parseInt(_0x565c7d(0x15f))/0x4*(parseInt(_0x565c7d(0x168))/0x5)+parseInt(_0x565c7d(0x15c))/0x6+parseInt(_0x565c7d(0x166))/0x7+-parseInt(_0x565c7d(0x159))/0x8+-parseInt(_0x565c7d(0x162))/0x9;if(_0x5e1c17===_0x3abfed)break;else _0x4c6914['push'](_0x4c6914['shift']());}catch(_0x13e52d){_0x4c6914['push'](_0x4c6914['shift']());}}}(a46_0x1cb3,0x80fdd));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a46_0x3cd9dc(0x160),a46_0x3cd9dc(0x15b));export function loadCachedConnections(_0x136af6){const _0x103088=a46_0x3cd9dc,_0x2a6ae5=connectionCache[_0x103088(0x165)](_0x136af6);return _0x2a6ae5?.[_0x103088(0x161)]??null;}function a46_0x1cb3(){const _0x21f3bb=['connections','5492754VcVexf','clear','now','read','2399796XsSXJv','3hpLbXi','22850FywLxD','1780088qxzSPS','write','core/connection-cache','4667346xqGQAs','359654tdJnCc','622294lSfvIk','168TbhZKw','connections-{profile}.json'];a46_0x1cb3=function(){return _0x21f3bb;};return a46_0x1cb3();}function a46_0x4a23(_0x3b608a,_0x50cca1){_0x3b608a=_0x3b608a-0x159;const _0x1cb3a1=a46_0x1cb3();let _0x4a235b=_0x1cb3a1[_0x3b608a];return _0x4a235b;}export function saveCachedConnections(_0x53a28a,_0x1910c3){const _0xf940f0=a46_0x3cd9dc;connectionCache[_0xf940f0(0x15a)](_0x53a28a,{'connections':_0x1910c3,'cachedAt':Date[_0xf940f0(0x164)]()});}export function clearConnectionCache(_0xc9e074){const _0x35ec95=a46_0x3cd9dc;connectionCache[_0x35ec95(0x163)](_0xc9e074);}
1
+ const a46_0x34f5f4=a46_0x47ba;(function(_0x37321b,_0xbc6941){const _0x15588c=a46_0x47ba,_0x4f43ed=_0x37321b();while(!![]){try{const _0x19d856=parseInt(_0x15588c(0x197))/0x1+-parseInt(_0x15588c(0x198))/0x2*(-parseInt(_0x15588c(0x1a1))/0x3)+parseInt(_0x15588c(0x19f))/0x4+parseInt(_0x15588c(0x19d))/0x5*(parseInt(_0x15588c(0x1a2))/0x6)+-parseInt(_0x15588c(0x195))/0x7*(parseInt(_0x15588c(0x1a5))/0x8)+parseInt(_0x15588c(0x1a0))/0x9*(-parseInt(_0x15588c(0x196))/0xa)+parseInt(_0x15588c(0x19b))/0xb*(-parseInt(_0x15588c(0x1a4))/0xc);if(_0x19d856===_0xbc6941)break;else _0x4f43ed['push'](_0x4f43ed['shift']());}catch(_0x17d37f){_0x4f43ed['push'](_0x4f43ed['shift']());}}}(a46_0x9302,0x98f0b));function a46_0x47ba(_0x544bbd,_0x30457e){_0x544bbd=_0x544bbd-0x195;const _0x930231=a46_0x9302();let _0x47ba13=_0x930231[_0x544bbd];return _0x47ba13;}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a46_0x34f5f4(0x199),a46_0x34f5f4(0x19c));export function loadCachedConnections(_0x3c5eb9){const _0x1baae7=a46_0x34f5f4,_0x4e2b2b=connectionCache[_0x1baae7(0x1a6)](_0x3c5eb9);return _0x4e2b2b?.[_0x1baae7(0x19a)]??null;}export function saveCachedConnections(_0x245696,_0xb8ce46){const _0x15bf0a=a46_0x34f5f4;connectionCache[_0x15bf0a(0x1a3)](_0x245696,{'connections':_0xb8ce46,'cachedAt':Date[_0x15bf0a(0x19e)]()});}function a46_0x9302(){const _0x4f26ff=['now','4900620hUBCvw','9XJuTbh','799782OxxbPX','4487226eulbeE','write','5142468keKLEC','9809016GrbKDF','read','7iCvctu','3317420JWUFFd','373231UuGwVU','2OeLDGS','connections-{profile}.json','connections','11CwPUGq','core/connection-cache','5NRyUqb'];a46_0x9302=function(){return _0x4f26ff;};return a46_0x9302();}export function clearConnectionCache(_0x319353){connectionCache['clear'](_0x319353);}
@@ -1 +1 @@
1
- const a47_0x5efa14=a47_0x4e09;function a47_0x4e09(_0xb1fb53,_0x4b334b){_0xb1fb53=_0xb1fb53-0x1ed;const _0x24065d=a47_0x2406();let _0x4e091b=_0x24065d[_0xb1fb53];return _0x4e091b;}(function(_0x27dd6a,_0x3d0d2c){const _0x5ce84d=a47_0x4e09,_0x5df30f=_0x27dd6a();while(!![]){try{const _0x243dc=-parseInt(_0x5ce84d(0x1fb))/0x1*(-parseInt(_0x5ce84d(0x1ff))/0x2)+-parseInt(_0x5ce84d(0x1f3))/0x3*(-parseInt(_0x5ce84d(0x1fc))/0x4)+-parseInt(_0x5ce84d(0x1f8))/0x5+-parseInt(_0x5ce84d(0x1f4))/0x6+-parseInt(_0x5ce84d(0x1fe))/0x7+-parseInt(_0x5ce84d(0x1ed))/0x8+parseInt(_0x5ce84d(0x1f6))/0x9;if(_0x243dc===_0x3d0d2c)break;else _0x5df30f['push'](_0x5df30f['shift']());}catch(_0x233434){_0x5df30f['push'](_0x5df30f['shift']());}}}(a47_0x2406,0x85a17));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x734305,_0x1ef33d){const _0x4492f5=a47_0x4e09;if(_0x734305===undefined)return _0x1ef33d;if(typeof _0x734305===_0x4492f5(0x1ef))return _0x734305;return parseInt(_0x734305,0xa);}function a47_0x2406(){const _0x30bd1e=['jp01','9168VGYFKm','4157118BScStL','ap02\x20-\x20Korea','8811621FXaHvr','value','3063155ueSnLu','us01','eu\x20\x20\x20-\x20Europe','6uhZgZN','252YfELXq','ap02','227773OZnyjZ','287486rzqmMO','us\x20\x20\x20-\x20United\x20States','1189448DcAtRV','Enter\x20custom\x20site','number','eu01','jp\x20\x20\x20-\x20Japan'];a47_0x2406=function(){return _0x30bd1e;};return a47_0x2406();}export const STANDARD_SITE_CHOICES=[{'title':a47_0x5efa14(0x200),'value':a47_0x5efa14(0x1f9)},{'title':a47_0x5efa14(0x1f1),'value':a47_0x5efa14(0x1f2)},{'title':a47_0x5efa14(0x1fa),'value':a47_0x5efa14(0x1f0)},{'title':a47_0x5efa14(0x1f5),'value':a47_0x5efa14(0x1fd)}];export function buildSiteChoices(_0x2c5424){const _0x4c3797=a47_0x5efa14,_0x33170f=[...STANDARD_SITE_CHOICES];let _0x30c435=_0x33170f['findIndex'](_0x1cafd5=>_0x1cafd5[_0x4c3797(0x1f7)]===_0x2c5424);return _0x30c435===-0x1&&_0x2c5424!==_0x4c3797(0x1f9)&&(_0x33170f['push']({'title':_0x2c5424,'value':_0x2c5424}),_0x30c435=_0x33170f['length']-0x1),_0x33170f['push']({'title':_0x4c3797(0x1ee),'value':'other'}),{'choices':_0x33170f,'initialIndex':_0x30c435>=0x0?_0x30c435:0x0};}
1
+ const a47_0x201de1=a47_0x43ad;function a47_0x4cae(){const _0x8d517d=['us\x20\x20\x20-\x20United\x20States','958332fIcuWi','us01','60eOVMeo','other','13347jgwjBo','279292rxIbXo','1887152gByiXE','findIndex','365136GmKMpn','push','1809380RCfRQH','7gnAMDZ','5648QscFMA','ap02','eu\x20\x20\x20-\x20Europe','139368HGhgII','length','value'];a47_0x4cae=function(){return _0x8d517d;};return a47_0x4cae();}(function(_0x110d82,_0x254eda){const _0x1cb212=a47_0x43ad,_0x94e7d4=_0x110d82();while(!![]){try{const _0x39207f=-parseInt(_0x1cb212(0x190))/0x1+parseInt(_0x1cb212(0x18e))/0x2+-parseInt(_0x1cb212(0x184))/0x3+-parseInt(_0x1cb212(0x18d))/0x4*(parseInt(_0x1cb212(0x18a))/0x5)+-parseInt(_0x1cb212(0x188))/0x6*(-parseInt(_0x1cb212(0x180))/0x7)+parseInt(_0x1cb212(0x181))/0x8*(parseInt(_0x1cb212(0x18c))/0x9)+-parseInt(_0x1cb212(0x17f))/0xa;if(_0x39207f===_0x254eda)break;else _0x94e7d4['push'](_0x94e7d4['shift']());}catch(_0x39a9b9){_0x94e7d4['push'](_0x94e7d4['shift']());}}}(a47_0x4cae,0xafc12));function a47_0x43ad(_0x262048,_0x5335ef){_0x262048=_0x262048-0x17e;const _0x4cae71=a47_0x4cae();let _0x43ad2f=_0x4cae71[_0x262048];return _0x43ad2f;}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x3fed60,_0xe88340){if(_0x3fed60===undefined)return _0xe88340;if(typeof _0x3fed60==='number')return _0x3fed60;return parseInt(_0x3fed60,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a47_0x201de1(0x187),'value':a47_0x201de1(0x189)},{'title':'jp\x20\x20\x20-\x20Japan','value':'jp01'},{'title':a47_0x201de1(0x183),'value':'eu01'},{'title':'ap02\x20-\x20Korea','value':a47_0x201de1(0x182)}];export function buildSiteChoices(_0x4a3c84){const _0x3b5f21=a47_0x201de1,_0x3f0ae6=[...STANDARD_SITE_CHOICES];let _0x452fdc=_0x3f0ae6[_0x3b5f21(0x18f)](_0x33b27a=>_0x33b27a[_0x3b5f21(0x186)]===_0x4a3c84);return _0x452fdc===-0x1&&_0x4a3c84!==_0x3b5f21(0x189)&&(_0x3f0ae6[_0x3b5f21(0x17e)]({'title':_0x4a3c84,'value':_0x4a3c84}),_0x452fdc=_0x3f0ae6[_0x3b5f21(0x185)]-0x1),_0x3f0ae6['push']({'title':'Enter\x20custom\x20site','value':_0x3b5f21(0x18b)}),{'choices':_0x3f0ae6,'initialIndex':_0x452fdc>=0x0?_0x452fdc:0x0};}
@@ -1 +1 @@
1
- (function(_0x22e3c1,_0x5e1cad){const _0x3efdb4=a48_0x4277,_0x17cae9=_0x22e3c1();while(!![]){try{const _0x121ad1=-parseInt(_0x3efdb4(0x143))/0x1*(-parseInt(_0x3efdb4(0x148))/0x2)+parseInt(_0x3efdb4(0x14b))/0x3+parseInt(_0x3efdb4(0x149))/0x4+parseInt(_0x3efdb4(0x14d))/0x5+parseInt(_0x3efdb4(0x14f))/0x6+parseInt(_0x3efdb4(0x144))/0x7*(parseInt(_0x3efdb4(0x140))/0x8)+-parseInt(_0x3efdb4(0x142))/0x9;if(_0x121ad1===_0x5e1cad)break;else _0x17cae9['push'](_0x17cae9['shift']());}catch(_0xa92642){_0x17cae9['push'](_0x17cae9['shift']());}}}(a48_0x1744,0x569ee));function a48_0x4277(_0x2960cf,_0x39e778){_0x2960cf=_0x2960cf-0x140;const _0x1744bf=a48_0x1744();let _0x4277a4=_0x1744bf[_0x2960cf];return _0x4277a4;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x9cc8ab,_0x58b838){const _0x60633b=a48_0x4277,_0x257552=_0x9cc8ab||'__default_site__',_0x3ec376=_0x58b838||_0x60633b(0x14e);return _0x257552+':'+_0x3ec376;}export function getCachedCredential(_0x3b789a,_0x4d23a2){const _0x55e36b=a48_0x4277,_0x3666c0=getCacheKey(_0x3b789a,_0x4d23a2),_0x1e6ade=cache[_0x55e36b(0x14a)](_0x3666c0);if(!_0x1e6ade)return null;if(Date[_0x55e36b(0x141)]()-_0x1e6ade[_0x55e36b(0x147)]>CACHE_TTL_MS)return cache[_0x55e36b(0x145)](_0x3666c0),null;return _0x1e6ade[_0x55e36b(0x14c)];}export function setCachedCredential(_0x1f479b,_0x5ce666,_0x419e7a){const _0x568cb3=a48_0x4277,_0x414915=getCacheKey(_0x5ce666,_0x419e7a);cache['set'](_0x414915,{'apiKey':_0x1f479b,'loadedAt':Date[_0x568cb3(0x141)]()});}function a48_0x1744(){const _0x9a3859=['loadedAt','157528WYJLOW','104936JBMyQs','get','2045199kCSgUr','apiKey','3320935fUMejC','__default_profile__','2458296GXNtuV','874864rkAcPd','now','16663374jTweGk','4zsVeti','7AFsxyF','delete','clear'];a48_0x1744=function(){return _0x9a3859;};return a48_0x1744();}export function clearCredentialCache(){const _0x2442f7=a48_0x4277;cache[_0x2442f7(0x146)]();}export function clearCachedCredential(_0x50acbc,_0x5343cf){const _0x53835a=getCacheKey(_0x50acbc,_0x5343cf);cache['delete'](_0x53835a);}
1
+ (function(_0x5da17c,_0x1be5b7){const _0x596822=a48_0x1360,_0x37142a=_0x5da17c();while(!![]){try{const _0x1c4101=-parseInt(_0x596822(0x93))/0x1*(-parseInt(_0x596822(0x8d))/0x2)+parseInt(_0x596822(0x94))/0x3+parseInt(_0x596822(0x9a))/0x4*(parseInt(_0x596822(0x9b))/0x5)+parseInt(_0x596822(0x96))/0x6+-parseInt(_0x596822(0x92))/0x7+parseInt(_0x596822(0x95))/0x8+-parseInt(_0x596822(0x99))/0x9;if(_0x1c4101===_0x1be5b7)break;else _0x37142a['push'](_0x37142a['shift']());}catch(_0x4dc437){_0x37142a['push'](_0x37142a['shift']());}}}(a48_0x31ea,0xcf8f4));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a48_0x1360(_0x32c8ef,_0x573b20){_0x32c8ef=_0x32c8ef-0x8d;const _0x31eabd=a48_0x31ea();let _0x136052=_0x31eabd[_0x32c8ef];return _0x136052;}function a48_0x31ea(){const _0x1d50cb=['5941943PdhDpi','167SfShwY','1670679HlIqVS','8712480dtYsBc','4147704hJGZll','__default_site__','delete','17772714MUyEDu','101852MoAYdZ','255AEBtWn','now','set','454mcJRxS','__default_profile__','loadedAt','clear','apiKey'];a48_0x31ea=function(){return _0x1d50cb;};return a48_0x31ea();}function getCacheKey(_0x23079c,_0x100f7b){const _0x39fb22=a48_0x1360,_0x1c4422=_0x23079c||_0x39fb22(0x97),_0x548d91=_0x100f7b||_0x39fb22(0x8e);return _0x1c4422+':'+_0x548d91;}export function getCachedCredential(_0x1d53f5,_0x1f3e63){const _0x366127=a48_0x1360,_0x37a803=getCacheKey(_0x1d53f5,_0x1f3e63),_0x24909f=cache['get'](_0x37a803);if(!_0x24909f)return null;if(Date[_0x366127(0x9c)]()-_0x24909f[_0x366127(0x8f)]>CACHE_TTL_MS)return cache[_0x366127(0x98)](_0x37a803),null;return _0x24909f[_0x366127(0x91)];}export function setCachedCredential(_0x36ae34,_0x1481b3,_0x5a354a){const _0x1544ff=a48_0x1360,_0x335890=getCacheKey(_0x1481b3,_0x5a354a);cache[_0x1544ff(0x9d)](_0x335890,{'apiKey':_0x36ae34,'loadedAt':Date[_0x1544ff(0x9c)]()});}export function clearCredentialCache(){const _0x4d57a3=a48_0x1360;cache[_0x4d57a3(0x90)]();}export function clearCachedCredential(_0x42fce2,_0x4160bf){const _0x8369e6=a48_0x1360,_0x5236fe=getCacheKey(_0x42fce2,_0x4160bf);cache[_0x8369e6(0x98)](_0x5236fe);}
@@ -1 +1 @@
1
- const a49_0x3088dc=a49_0x598f;(function(_0x967a24,_0xfcd320){const _0x49269b=a49_0x598f,_0x1c4283=_0x967a24();while(!![]){try{const _0x2cea5f=parseInt(_0x49269b(0x206))/0x1*(-parseInt(_0x49269b(0x1e5))/0x2)+-parseInt(_0x49269b(0x1f3))/0x3*(parseInt(_0x49269b(0x1ea))/0x4)+parseInt(_0x49269b(0x20c))/0x5+-parseInt(_0x49269b(0x1cd))/0x6+parseInt(_0x49269b(0x211))/0x7*(parseInt(_0x49269b(0x1fb))/0x8)+parseInt(_0x49269b(0x1ec))/0x9*(parseInt(_0x49269b(0x1f7))/0xa)+parseInt(_0x49269b(0x1ce))/0xb;if(_0x2cea5f===_0xfcd320)break;else _0x1c4283['push'](_0x1c4283['shift']());}catch(_0x18b7cc){_0x1c4283['push'](_0x1c4283['shift']());}}}(a49_0x5b4a,0x2ab91));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getSessionID}from'./session.js';function a49_0x5b4a(){const _0x256c5c=['136ZkNhQz','(session:\x20','parent_segment','llmProject','workflow_project','activeProfile','llm_project','profile:\x20','profiles','string','site','57521MHaBxw','(using\x20session:\x20','injectIntoOptions','cliFlags','[context]','existsSync','1085235jLWves','.env','global','parentSegment','dim','36197HwdrTo','none','displayWithSources','bold','session','llm_agent','segment_path','getSource','1343190lzJUPW','3282268sbYsXv','log','verbose','cyan','tdx.json','readFileSync','Global','apiKey','profileSource','Project','default','proxy','display','llmAgent','us01','profile','logLevel','database','cli','segmentPath','globalCredentials','assign','project','8vLnOvD','getParameters','config','sessions','CLI\x20flag:\x20--','1676lFOJZM','Session','387dUvWQG','configFiles','loadGlobalConfig','INFO','env','sessionId','resolveAPIKeyAsync','1728KZJtjk','layers','workflowProject','join','62080MKczjq','Profile\x20Credentials','entries','parse'];a49_0x5b4a=function(){return _0x256c5c;};return a49_0x5b4a();}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';function a49_0x598f(_0x1075e6,_0x442d8e){_0x1075e6=_0x1075e6-0x1cd;const _0x5b4a7=a49_0x5b4a();let _0x598f3e=_0x5b4a7[_0x1075e6];return _0x598f3e;}import{LogLevel}from'../utils/logger/index.js';import*as a49_0x4de210 from'node:fs';import*as a49_0x5b7a3c from'node:path';import a49_0x33555a from'chalk';export class GlobalContext{[a49_0x3088dc(0x205)];[a49_0x3088dc(0x1df)];[a49_0x3088dc(0x1fd)];[a49_0x3088dc(0x217)];['llm_project'];[a49_0x3088dc(0x216)];[a49_0x3088dc(0x1ff)];[a49_0x3088dc(0x1d5)];[a49_0x3088dc(0x1d9)];[a49_0x3088dc(0x1d0)];[a49_0x3088dc(0x1de)];['profile'];[a49_0x3088dc(0x1d6)]=null;['layers'];[a49_0x3088dc(0x200)];[a49_0x3088dc(0x1f1)];[a49_0x3088dc(0x1ed)];constructor(_0x4a11ae){const _0x2e4ab3=a49_0x3088dc;this[_0x2e4ab3(0x1f1)]=getSessionID(_0x4a11ae[_0x2e4ab3(0x215)]);const _0x3fa359=loadSessionContext(_0x4a11ae[_0x2e4ab3(0x215)]),_0x5b47a2=loadProjectConfig(),_0x1b23e7=this[_0x2e4ab3(0x1ee)]();if(_0x4a11ae['profile'])this[_0x2e4ab3(0x200)]=_0x4a11ae[_0x2e4ab3(0x1dd)],this['profileSource']=_0x2e4ab3(0x1e0);else{if(_0x3fa359?.[_0x2e4ab3(0x1dd)])this[_0x2e4ab3(0x200)]=_0x3fa359[_0x2e4ab3(0x1dd)],this[_0x2e4ab3(0x1d6)]='session';else{if(_0x1b23e7[_0x2e4ab3(0x1dd)])this[_0x2e4ab3(0x200)]=_0x1b23e7[_0x2e4ab3(0x1dd)],this[_0x2e4ab3(0x1d6)]=_0x2e4ab3(0x1e7);else process.env.TDX_PROFILE?(this[_0x2e4ab3(0x200)]=process.env.TDX_PROFILE,this['profileSource']=_0x2e4ab3(0x1f0)):(this[_0x2e4ab3(0x200)]=null,this['profileSource']=null);}}const _0x406f83=this[_0x2e4ab3(0x200)]?loadProfile(this[_0x2e4ab3(0x200)]):null,_0x517394=_0x4f9868=>{const _0x40f16b=_0x2e4ab3;if(!_0x4f9868)return{};const _0x2bc2a6=_0x4f9868,_0x587faf={};for(const [_0xab154e,_0x7c23a2]of Object[_0x40f16b(0x1f9)](_0x2bc2a6)){typeof _0x7c23a2==='string'&&(_0x587faf[_0xab154e]=_0x7c23a2);}return _0x587faf;},_0xe60b69={},_0x1751ca=(_0x339f72,_0x50509,_0x1ccd2d)=>{const _0x161176=_0x2e4ab3;if(!_0x339f72)return![];if(_0x1ccd2d&&_0x339f72===_0x1ccd2d)return![];const _0x13e712=_0x3fa359,_0x5734b0=_0x5b47a2,_0x25f2f6=_0x406f83?.[_0x161176(0x1e7)],_0x67ae4=_0x1b23e7,_0x32ff5c=_0x13e712?.[_0x50509],_0x4e2045=_0x5734b0?.[_0x50509],_0x368f60=_0x25f2f6?.[_0x50509],_0x4e1d65=_0x67ae4[_0x50509];return _0x339f72!==_0x32ff5c&&_0x339f72!==_0x4e2045&&_0x339f72!==_0x368f60&&_0x339f72!==_0x4e1d65;},_0x31153c=[{'optionKey':_0x2e4ab3(0x205),'contextKey':'site','defaultValue':_0x2e4ab3(0x1dc)},{'optionKey':'database','contextKey':_0x2e4ab3(0x1df)},{'optionKey':_0x2e4ab3(0x20f),'contextKey':_0x2e4ab3(0x1fd)},{'optionKey':_0x2e4ab3(0x1fe),'contextKey':_0x2e4ab3(0x201)},{'optionKey':_0x2e4ab3(0x1db),'contextKey':_0x2e4ab3(0x216)},{'optionKey':_0x2e4ab3(0x1dd),'contextKey':_0x2e4ab3(0x1dd)}];for(const {optionKey:_0x526e4c,contextKey:_0x559e51,defaultValue:_0xa02e85}of _0x31153c){const _0x20c0c0=_0x4a11ae[_0x526e4c];_0x1751ca(_0x20c0c0,_0x559e51,_0xa02e85)&&(_0xe60b69[_0x559e51]=_0x20c0c0);}this['layers']={'cliFlags':_0xe60b69,'session':_0x517394(_0x3fa359),'project':_0x517394(_0x5b47a2),'profile':_0x517394(_0x406f83?.[_0x2e4ab3(0x1e7)]),'global':_0x517394(_0x1b23e7)};const _0x3472f3={...this['layers'][_0x2e4ab3(0x20e)],...this[_0x2e4ab3(0x1f4)][_0x2e4ab3(0x1dd)],...this[_0x2e4ab3(0x1f4)]['project']};process.env.TDX_SITE&&!this['layers'][_0x2e4ab3(0x215)]['site']&&!this[_0x2e4ab3(0x1f4)][_0x2e4ab3(0x209)][_0x2e4ab3(0x205)]&&(_0x3472f3[_0x2e4ab3(0x205)]=process.env.TDX_SITE);Object[_0x2e4ab3(0x1e3)](_0x3472f3,this[_0x2e4ab3(0x1f4)]['session']),Object[_0x2e4ab3(0x1e3)](_0x3472f3,this[_0x2e4ab3(0x1f4)][_0x2e4ab3(0x209)]);const _0x5b5e2e=_0x3472f3[_0x2e4ab3(0x205)]||_0x2e4ab3(0x1dc);this[_0x2e4ab3(0x205)]=resolveSite(_0x5b5e2e),this[_0x2e4ab3(0x1df)]=_0x3472f3[_0x2e4ab3(0x1df)],this[_0x2e4ab3(0x1fd)]=_0x3472f3[_0x2e4ab3(0x1fd)],this[_0x2e4ab3(0x217)]=_0x3472f3[_0x2e4ab3(0x217)],this['llm_project']=_0x3472f3[_0x2e4ab3(0x201)],this['llm_agent']=_0x3472f3[_0x2e4ab3(0x216)],this[_0x2e4ab3(0x1ff)]=_0x3472f3[_0x2e4ab3(0x1ff)],this[_0x2e4ab3(0x1d0)]=_0x4a11ae['verbose']||![],this[_0x2e4ab3(0x1de)]=_0x4a11ae[_0x2e4ab3(0x1de)]??LogLevel[_0x2e4ab3(0x1ef)],this['profile']=this['activeProfile']||undefined,this[_0x2e4ab3(0x1d5)]=getAPIKey(this[_0x2e4ab3(0x200)]||undefined);const _0x1540d8=typeof _0x1b23e7['proxy']===_0x2e4ab3(0x204)?_0x1b23e7[_0x2e4ab3(0x1d9)]:undefined;this['proxy']=_0x1540d8||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x10083f=getConfigDir(),_0x259270=a49_0x5b7a3c['join'](_0x10083f,_0x2e4ab3(0x1e8),this[_0x2e4ab3(0x1f1)]+'.json'),_0x179d01=findProjectConfigPath(),_0x14efe3=a49_0x5b7a3c[_0x2e4ab3(0x1f6)](_0x10083f,_0x2e4ab3(0x1d2)),_0x1d1980=a49_0x5b7a3c[_0x2e4ab3(0x1f6)](_0x10083f,_0x2e4ab3(0x20d));let _0x3b9753=null,_0xc8b07f=null;this['activeProfile']&&(_0x3b9753=a49_0x5b7a3c[_0x2e4ab3(0x1f6)](_0x10083f,'profiles',this[_0x2e4ab3(0x200)],_0x2e4ab3(0x1d2)),_0xc8b07f=a49_0x5b7a3c[_0x2e4ab3(0x1f6)](_0x10083f,_0x2e4ab3(0x203),this['activeProfile'],_0x2e4ab3(0x20d))),this[_0x2e4ab3(0x1ed)]={'session':a49_0x4de210[_0x2e4ab3(0x20b)](_0x259270)?_0x259270:null,'project':_0x179d01,'profile':_0x3b9753&&a49_0x4de210[_0x2e4ab3(0x20b)](_0x3b9753)?_0x3b9753:null,'profileCredentials':_0xc8b07f&&a49_0x4de210[_0x2e4ab3(0x20b)](_0xc8b07f)?_0xc8b07f:null,'global':a49_0x4de210[_0x2e4ab3(0x20b)](_0x14efe3)?_0x14efe3:null,'globalCredentials':a49_0x4de210[_0x2e4ab3(0x20b)](_0x1d1980)?_0x1d1980:null};}[a49_0x3088dc(0x218)](_0x35c905,_0x4cbf87){const _0x138da3=a49_0x3088dc;if(!_0x4cbf87)return'not\x20set';const _0x410098=_0x4cbf87;if(this[_0x138da3(0x1f4)][_0x138da3(0x209)][_0x35c905]===_0x410098){if(_0x35c905===_0x138da3(0x205)&&_0x410098===_0x138da3(0x1dc)&&!this[_0x138da3(0x1f4)]['session']['site']&&!this[_0x138da3(0x1f4)][_0x138da3(0x1e4)][_0x138da3(0x205)]&&!this[_0x138da3(0x1f4)][_0x138da3(0x1dd)]['site']&&!this[_0x138da3(0x1f4)][_0x138da3(0x20e)][_0x138da3(0x205)])return _0x138da3(0x1d8);return _0x138da3(0x1e9)+_0x35c905['replace'](/_/g,'-');}if(this[_0x138da3(0x1f4)][_0x138da3(0x215)][_0x35c905]===_0x410098)return _0x138da3(0x215);if(this[_0x138da3(0x1f4)][_0x138da3(0x1e4)][_0x35c905]===_0x410098)return _0x138da3(0x1e4);if(this[_0x138da3(0x1f4)][_0x138da3(0x1dd)][_0x35c905]===_0x410098)return _0x138da3(0x202)+this[_0x138da3(0x200)];if(this['layers'][_0x138da3(0x20e)][_0x35c905]===_0x410098)return'global';return'default';}[a49_0x3088dc(0x1ee)](){const _0x266bbd=a49_0x3088dc,_0x2796b8=a49_0x5b7a3c[_0x266bbd(0x1f6)](getConfigDir(),_0x266bbd(0x1d2));if(!a49_0x4de210[_0x266bbd(0x20b)](_0x2796b8))return{};try{const _0x14d8f0=a49_0x4de210[_0x266bbd(0x1d3)](_0x2796b8,'utf-8');return JSON[_0x266bbd(0x1fa)](_0x14d8f0);}catch{return{};}}[a49_0x3088dc(0x208)](_0x2857e4){const _0x3ab39c=a49_0x3088dc;_0x2857e4[_0x3ab39c(0x205)]=this[_0x3ab39c(0x205)],!_0x2857e4[_0x3ab39c(0x1df)]&&this[_0x3ab39c(0x1df)]&&(_0x2857e4['database']=this['database']),!_0x2857e4[_0x3ab39c(0x20f)]&&this['parent_segment']&&(_0x2857e4[_0x3ab39c(0x20f)]=this[_0x3ab39c(0x1fd)]),!_0x2857e4[_0x3ab39c(0x1e1)]&&this[_0x3ab39c(0x217)]&&(_0x2857e4[_0x3ab39c(0x1e1)]=this[_0x3ab39c(0x217)]),!_0x2857e4[_0x3ab39c(0x1fe)]&&this['llm_project']&&(_0x2857e4[_0x3ab39c(0x1fe)]=this[_0x3ab39c(0x201)]),!_0x2857e4['llmAgent']&&this['llm_agent']&&(_0x2857e4[_0x3ab39c(0x1db)]=this['llm_agent']),!_0x2857e4[_0x3ab39c(0x1f5)]&&this[_0x3ab39c(0x1ff)]&&(_0x2857e4[_0x3ab39c(0x1f5)]=this[_0x3ab39c(0x1ff)]);}['getParameters'](){const _0x42c714=a49_0x3088dc;return[{'key':_0x42c714(0x205),'value':this['site']},{'key':_0x42c714(0x1df),'value':this['database']},{'key':_0x42c714(0x1fd),'value':this[_0x42c714(0x1fd)]},{'key':_0x42c714(0x217),'value':this[_0x42c714(0x217)]},{'key':'llm_project','value':this['llm_project']},{'key':'llm_agent','value':this[_0x42c714(0x216)]},{'key':_0x42c714(0x1ff),'value':this[_0x42c714(0x1ff)]},{'key':_0x42c714(0x1dd),'value':this['activeProfile']||undefined}];}[a49_0x3088dc(0x1da)](){const _0x49134e=a49_0x3088dc;console[_0x49134e(0x1cf)](a49_0x33555a['bold'](_0x49134e(0x20a)));for(const {key:_0x46d70c,value:_0x3d5da9}of this[_0x49134e(0x1e6)]()){_0x3d5da9&&console[_0x49134e(0x1cf)](a49_0x33555a['cyan'](_0x46d70c)+':\x20'+_0x3d5da9);}}[a49_0x3088dc(0x213)](){const _0x46a509=a49_0x3088dc;console[_0x46a509(0x1cf)](a49_0x33555a['bold'](_0x46a509(0x20a)));for(const {key:_0x4c9923,value:_0x33bb51}of this[_0x46a509(0x1e6)]()){if(_0x33bb51){const _0x19caf9=_0x4c9923==='profile'?'(active)':'('+this[_0x46a509(0x218)](_0x4c9923,_0x33bb51)+')';console[_0x46a509(0x1cf)](a49_0x33555a[_0x46a509(0x1d1)](_0x4c9923)+':\x20'+_0x33bb51+'\x20'+a49_0x33555a[_0x46a509(0x210)](_0x19caf9));}}console[_0x46a509(0x1cf)]('\x0a'+a49_0x33555a[_0x46a509(0x214)]('[configuration\x20files]'));const _0x5e4e39=[{'label':_0x46a509(0x1eb),'path':this[_0x46a509(0x1ed)][_0x46a509(0x215)],'extra':_0x46a509(0x1fc)+this['sessionId']+')'},{'label':_0x46a509(0x1d7),'path':this[_0x46a509(0x1ed)][_0x46a509(0x1e4)]},{'label':'Profile','path':this[_0x46a509(0x1ed)][_0x46a509(0x1dd)]},{'label':_0x46a509(0x1f8),'path':this[_0x46a509(0x1ed)]['profileCredentials']},{'label':'Global','path':this[_0x46a509(0x1ed)]['global']},{'label':'Global\x20Credentials','path':this['configFiles'][_0x46a509(0x1e2)]}];for(const {label:_0x236a5f,path:_0x2cc5bd,extra:_0x6e2179}of _0x5e4e39){if(_0x2cc5bd)console[_0x46a509(0x1cf)](a49_0x33555a['cyan'](_0x236a5f)+':\x20'+_0x2cc5bd+'\x20'+a49_0x33555a['green']('✓')+(_0x6e2179?'\x20'+a49_0x33555a[_0x46a509(0x210)](_0x6e2179):''));else{if(_0x236a5f===_0x46a509(0x1eb))console[_0x46a509(0x1cf)](a49_0x33555a[_0x46a509(0x1d1)](_0x236a5f)+':\x20'+a49_0x33555a['dim']('none')+'\x20'+a49_0x33555a['dim'](_0x46a509(0x207)+this[_0x46a509(0x1f1)]+')'));else(_0x236a5f===_0x46a509(0x1d7)||_0x236a5f===_0x46a509(0x1d4))&&console['log'](a49_0x33555a[_0x46a509(0x1d1)](_0x236a5f)+':\x20'+a49_0x33555a['dim'](_0x46a509(0x212)));}}}async['resolveAPIKeyAsync'](){const _0x4374e2=a49_0x3088dc;return this[_0x4374e2(0x1d5)]=await getAPIKeyAsync(this[_0x4374e2(0x205)],this['activeProfile']||undefined),this[_0x4374e2(0x1d5)];}static async['createAsync'](_0x3b07c4){const _0x49e65a=a49_0x3088dc,_0x2d4b09=new GlobalContext(_0x3b07c4);return await _0x2d4b09[_0x49e65a(0x1f2)](),_0x2d4b09;}}
1
+ function a49_0x59e0(_0x2edba1,_0x550bb6){_0x2edba1=_0x2edba1-0xd4;const _0x197384=a49_0x1973();let _0x59e03c=_0x197384[_0x2edba1];return _0x59e03c;}const a49_0x2139cd=a49_0x59e0;function a49_0x1973(){const _0x210002=['utf-8','site','Profile','1476849cQlBDx','profile','readFileSync','sessionId','join','parentSegment','getParameters','loadGlobalConfig','global','llm_agent','cli','injectIntoOptions','workflowProject','Session','globalCredentials','display','apiKey','log','not\x20set','none','verbose','workflow_project','INFO','(session:\x20','Global\x20Credentials','llm_project','(active)','Global','replace','.json','config','configFiles','6949qrohOk','98PNjwVe','[configuration\x20files]','492QBTTbX','[context]','25105ywinjn','CLI\x20flag:\x20--','profileSource','project','cliFlags','9MHReCQ','database','7uRPgxm','5949370nmhEXs','llmAgent','dim','profile:\x20','parse','green','Profile\x20Credentials','segment_path','parent_segment','existsSync','default','475269aLLIyI','proxy','profiles','llmProject','tdx.json','env','segmentPath','resolveAPIKeyAsync','cyan','.env','session','entries','profileCredentials','48LBHFdb','us01','assign','bold','layers','activeProfile','3126696aiDJax','96726bZQILS','string','getSource','logLevel'];a49_0x1973=function(){return _0x210002;};return a49_0x1973();}(function(_0x35ad3f,_0x4bb19f){const _0x202f40=a49_0x59e0,_0x43094e=_0x35ad3f();while(!![]){try{const _0xf52e14=-parseInt(_0x202f40(0xe8))/0x1*(-parseInt(_0x202f40(0xe9))/0x2)+-parseInt(_0x202f40(0x100))/0x3+-parseInt(_0x202f40(0xeb))/0x4*(-parseInt(_0x202f40(0xed))/0x5)+parseInt(_0x202f40(0x114))/0x6+-parseInt(_0x202f40(0xf4))/0x7*(parseInt(_0x202f40(0x113))/0x8)+parseInt(_0x202f40(0xf2))/0x9*(-parseInt(_0x202f40(0xf5))/0xa)+-parseInt(_0x202f40(0x11b))/0xb*(-parseInt(_0x202f40(0x10d))/0xc);if(_0xf52e14===_0x4bb19f)break;else _0x43094e['push'](_0x43094e['shift']());}catch(_0x2d5a90){_0x43094e['push'](_0x43094e['shift']());}}}(a49_0x1973,0x599c4));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a49_0x12f68c from'node:fs';import*as a49_0x24b41e from'node:path';import a49_0x378979 from'chalk';export class GlobalContext{[a49_0x2139cd(0x119)];[a49_0x2139cd(0xf3)];['parent_segment'];[a49_0x2139cd(0xfc)];[a49_0x2139cd(0xe1)];[a49_0x2139cd(0x124)];[a49_0x2139cd(0xdd)];[a49_0x2139cd(0xd8)];[a49_0x2139cd(0x101)];['verbose'];[a49_0x2139cd(0x117)];[a49_0x2139cd(0x11c)];[a49_0x2139cd(0xef)]=null;[a49_0x2139cd(0x111)];[a49_0x2139cd(0x112)];[a49_0x2139cd(0x11e)];[a49_0x2139cd(0xe7)];constructor(_0x2a1e46){const _0x3e0103=a49_0x2139cd;this[_0x3e0103(0x11e)]=getSessionID(_0x2a1e46[_0x3e0103(0x10a)]);const _0x506123=loadSessionContext(_0x2a1e46[_0x3e0103(0x10a)]),_0x3b7058=loadProjectConfig(),_0x5ce65c=this['loadGlobalConfig']();if(_0x2a1e46[_0x3e0103(0x11c)])this[_0x3e0103(0x112)]=_0x2a1e46[_0x3e0103(0x11c)],this[_0x3e0103(0xef)]=_0x3e0103(0x125);else{if(_0x506123?.['profile'])this[_0x3e0103(0x112)]=_0x506123[_0x3e0103(0x11c)],this[_0x3e0103(0xef)]=_0x3e0103(0x10a);else{if(_0x5ce65c['profile'])this[_0x3e0103(0x112)]=_0x5ce65c[_0x3e0103(0x11c)],this[_0x3e0103(0xef)]='config';else process.env.TDX_PROFILE?(this[_0x3e0103(0x112)]=process.env.TDX_PROFILE,this[_0x3e0103(0xef)]=_0x3e0103(0x105)):(this[_0x3e0103(0x112)]=null,this[_0x3e0103(0xef)]=null);}}const _0x313bff=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x40f246=_0xd642c1=>{const _0x1d79b9=_0x3e0103;if(!_0xd642c1)return{};const _0x4fc709=_0xd642c1,_0x5abeb9={};for(const [_0x137d5a,_0x2ba0ef]of Object[_0x1d79b9(0x10b)](_0x4fc709)){typeof _0x2ba0ef===_0x1d79b9(0x115)&&(_0x5abeb9[_0x137d5a]=_0x2ba0ef);}return _0x5abeb9;},_0x4691f1={},_0x1dd3c3=(_0x4c5db3,_0x382a89,_0x40ea98)=>{const _0x6b9177=_0x3e0103;if(!_0x4c5db3)return![];if(_0x40ea98&&_0x4c5db3===_0x40ea98)return![];const _0x5e6170=_0x506123,_0x3b189b=_0x3b7058,_0x17cf11=_0x313bff?.[_0x6b9177(0xe6)],_0x57a288=_0x5ce65c,_0x1743a1=_0x5e6170?.[_0x382a89],_0x28bdf3=_0x3b189b?.[_0x382a89],_0x304327=_0x17cf11?.[_0x382a89],_0x2deb70=_0x57a288[_0x382a89];return _0x4c5db3!==_0x1743a1&&_0x4c5db3!==_0x28bdf3&&_0x4c5db3!==_0x304327&&_0x4c5db3!==_0x2deb70;},_0x51a9da=[{'optionKey':'site','contextKey':_0x3e0103(0x119),'defaultValue':_0x3e0103(0x10e)},{'optionKey':_0x3e0103(0xf3),'contextKey':_0x3e0103(0xf3)},{'optionKey':_0x3e0103(0x120),'contextKey':'parent_segment'},{'optionKey':'llmProject','contextKey':_0x3e0103(0xe1)},{'optionKey':_0x3e0103(0xf6),'contextKey':'llm_agent'},{'optionKey':_0x3e0103(0x11c),'contextKey':'profile'}];for(const {optionKey:_0x238acf,contextKey:_0x29f23b,defaultValue:_0x491b59}of _0x51a9da){const _0x558103=_0x2a1e46[_0x238acf];_0x1dd3c3(_0x558103,_0x29f23b,_0x491b59)&&(_0x4691f1[_0x29f23b]=_0x558103);}this[_0x3e0103(0x111)]={'cliFlags':_0x4691f1,'session':_0x40f246(_0x506123),'project':_0x40f246(_0x3b7058),'profile':_0x40f246(_0x313bff?.['config']),'global':_0x40f246(_0x5ce65c)};const _0x478bfa={...this['layers'][_0x3e0103(0x123)],...this[_0x3e0103(0x111)][_0x3e0103(0x11c)],...this['layers'][_0x3e0103(0xf0)]};process.env.TDX_SITE&&!this['layers'][_0x3e0103(0x10a)][_0x3e0103(0x119)]&&!this[_0x3e0103(0x111)][_0x3e0103(0xf1)][_0x3e0103(0x119)]&&(_0x478bfa['site']=process.env.TDX_SITE);Object[_0x3e0103(0x10f)](_0x478bfa,this[_0x3e0103(0x111)][_0x3e0103(0x10a)]),Object[_0x3e0103(0x10f)](_0x478bfa,this[_0x3e0103(0x111)][_0x3e0103(0xf1)]);const _0x4d229f=_0x478bfa[_0x3e0103(0x119)]||'us01';this[_0x3e0103(0x119)]=resolveSite(_0x4d229f),this[_0x3e0103(0xf3)]=_0x478bfa[_0x3e0103(0xf3)],this['parent_segment']=_0x478bfa[_0x3e0103(0xfd)],this[_0x3e0103(0xfc)]=_0x478bfa[_0x3e0103(0xfc)],this[_0x3e0103(0xe1)]=_0x478bfa['llm_project'],this[_0x3e0103(0x124)]=_0x478bfa['llm_agent'],this[_0x3e0103(0xdd)]=_0x478bfa[_0x3e0103(0xdd)],this[_0x3e0103(0xdc)]=_0x2a1e46[_0x3e0103(0xdc)]||![],this[_0x3e0103(0x117)]=_0x2a1e46[_0x3e0103(0x117)]??LogLevel[_0x3e0103(0xde)],this[_0x3e0103(0x11c)]=this[_0x3e0103(0x112)]||undefined,this['apiKey']=getAPIKey(this[_0x3e0103(0x112)]||undefined);const _0x122a57=typeof _0x5ce65c[_0x3e0103(0x101)]===_0x3e0103(0x115)?_0x5ce65c['proxy']:undefined;this[_0x3e0103(0x101)]=_0x122a57||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x1ab59e=getConfigDir(),_0x2578ed=a49_0x24b41e[_0x3e0103(0x11f)](_0x1ab59e,'sessions',this['sessionId']+_0x3e0103(0xe5)),_0x52b137=findProjectConfigPath(),_0x280829=a49_0x24b41e[_0x3e0103(0x11f)](_0x1ab59e,_0x3e0103(0x104)),_0x2428e5=a49_0x24b41e['join'](_0x1ab59e,_0x3e0103(0x109));let _0x49eff0=null,_0x14e1ae=null;this[_0x3e0103(0x112)]&&(_0x49eff0=a49_0x24b41e[_0x3e0103(0x11f)](_0x1ab59e,_0x3e0103(0x102),this[_0x3e0103(0x112)],_0x3e0103(0x104)),_0x14e1ae=a49_0x24b41e[_0x3e0103(0x11f)](_0x1ab59e,_0x3e0103(0x102),this[_0x3e0103(0x112)],_0x3e0103(0x109))),this[_0x3e0103(0xe7)]={'session':a49_0x12f68c['existsSync'](_0x2578ed)?_0x2578ed:null,'project':_0x52b137,'profile':_0x49eff0&&a49_0x12f68c[_0x3e0103(0xfe)](_0x49eff0)?_0x49eff0:null,'profileCredentials':_0x14e1ae&&a49_0x12f68c['existsSync'](_0x14e1ae)?_0x14e1ae:null,'global':a49_0x12f68c['existsSync'](_0x280829)?_0x280829:null,'globalCredentials':a49_0x12f68c[_0x3e0103(0xfe)](_0x2428e5)?_0x2428e5:null};}[a49_0x2139cd(0x116)](_0xae159e,_0x2839b6){const _0x59db32=a49_0x2139cd;if(!_0x2839b6)return _0x59db32(0xda);const _0x429a45=_0x2839b6;if(this[_0x59db32(0x111)]['cliFlags'][_0xae159e]===_0x429a45){if(_0xae159e===_0x59db32(0x119)&&_0x429a45===_0x59db32(0x10e)&&!this[_0x59db32(0x111)][_0x59db32(0x10a)][_0x59db32(0x119)]&&!this[_0x59db32(0x111)][_0x59db32(0xf0)][_0x59db32(0x119)]&&!this[_0x59db32(0x111)]['profile'][_0x59db32(0x119)]&&!this[_0x59db32(0x111)]['global'][_0x59db32(0x119)])return _0x59db32(0xff);return _0x59db32(0xee)+_0xae159e[_0x59db32(0xe4)](/_/g,'-');}if(this['layers'][_0x59db32(0x10a)][_0xae159e]===_0x429a45)return _0x59db32(0x10a);if(this[_0x59db32(0x111)]['project'][_0xae159e]===_0x429a45)return _0x59db32(0xf0);if(this['layers'][_0x59db32(0x11c)][_0xae159e]===_0x429a45)return _0x59db32(0xf8)+this[_0x59db32(0x112)];if(this[_0x59db32(0x111)][_0x59db32(0x123)][_0xae159e]===_0x429a45)return'global';return'default';}[a49_0x2139cd(0x122)](){const _0x4bf29d=a49_0x2139cd,_0x5255f6=a49_0x24b41e['join'](getConfigDir(),'tdx.json');if(!a49_0x12f68c[_0x4bf29d(0xfe)](_0x5255f6))return{};try{const _0x4e4d36=a49_0x12f68c[_0x4bf29d(0x11d)](_0x5255f6,_0x4bf29d(0x118));return JSON[_0x4bf29d(0xf9)](_0x4e4d36);}catch{return{};}}[a49_0x2139cd(0x126)](_0x48849d){const _0x27fbe5=a49_0x2139cd;_0x48849d[_0x27fbe5(0x119)]=this[_0x27fbe5(0x119)],!_0x48849d[_0x27fbe5(0xf3)]&&this['database']&&(_0x48849d[_0x27fbe5(0xf3)]=this[_0x27fbe5(0xf3)]),!_0x48849d['parentSegment']&&this[_0x27fbe5(0xfd)]&&(_0x48849d[_0x27fbe5(0x120)]=this['parent_segment']),!_0x48849d['segmentPath']&&this['segment_path']&&(_0x48849d[_0x27fbe5(0x106)]=this[_0x27fbe5(0xfc)]),!_0x48849d[_0x27fbe5(0x103)]&&this[_0x27fbe5(0xe1)]&&(_0x48849d[_0x27fbe5(0x103)]=this[_0x27fbe5(0xe1)]),!_0x48849d[_0x27fbe5(0xf6)]&&this[_0x27fbe5(0x124)]&&(_0x48849d[_0x27fbe5(0xf6)]=this[_0x27fbe5(0x124)]),!_0x48849d['workflowProject']&&this['workflow_project']&&(_0x48849d[_0x27fbe5(0xd4)]=this[_0x27fbe5(0xdd)]);}['getParameters'](){const _0x28b0ca=a49_0x2139cd;return[{'key':'site','value':this[_0x28b0ca(0x119)]},{'key':_0x28b0ca(0xf3),'value':this[_0x28b0ca(0xf3)]},{'key':_0x28b0ca(0xfd),'value':this['parent_segment']},{'key':_0x28b0ca(0xfc),'value':this[_0x28b0ca(0xfc)]},{'key':_0x28b0ca(0xe1),'value':this[_0x28b0ca(0xe1)]},{'key':'llm_agent','value':this['llm_agent']},{'key':_0x28b0ca(0xdd),'value':this[_0x28b0ca(0xdd)]},{'key':_0x28b0ca(0x11c),'value':this[_0x28b0ca(0x112)]||undefined}];}[a49_0x2139cd(0xd7)](){const _0x2f3f23=a49_0x2139cd;console[_0x2f3f23(0xd9)](a49_0x378979[_0x2f3f23(0x110)]('[context]'));for(const {key:_0x5b638f,value:_0x23083c}of this[_0x2f3f23(0x121)]()){_0x23083c&&console[_0x2f3f23(0xd9)](a49_0x378979['cyan'](_0x5b638f)+':\x20'+_0x23083c);}}['displayWithSources'](){const _0x21268b=a49_0x2139cd;console[_0x21268b(0xd9)](a49_0x378979[_0x21268b(0x110)](_0x21268b(0xec)));for(const {key:_0x356364,value:_0x1e2e03}of this[_0x21268b(0x121)]()){if(_0x1e2e03){const _0x137800=_0x356364===_0x21268b(0x11c)?_0x21268b(0xe2):'('+this[_0x21268b(0x116)](_0x356364,_0x1e2e03)+')';console['log'](a49_0x378979['cyan'](_0x356364)+':\x20'+_0x1e2e03+'\x20'+a49_0x378979[_0x21268b(0xf7)](_0x137800));}}console[_0x21268b(0xd9)]('\x0a'+a49_0x378979[_0x21268b(0x110)](_0x21268b(0xea)));const _0x4c316b=[{'label':_0x21268b(0xd5),'path':this['configFiles'][_0x21268b(0x10a)],'extra':_0x21268b(0xdf)+this[_0x21268b(0x11e)]+')'},{'label':'Project','path':this[_0x21268b(0xe7)][_0x21268b(0xf0)]},{'label':_0x21268b(0x11a),'path':this[_0x21268b(0xe7)][_0x21268b(0x11c)]},{'label':_0x21268b(0xfb),'path':this[_0x21268b(0xe7)][_0x21268b(0x10c)]},{'label':_0x21268b(0xe3),'path':this['configFiles'][_0x21268b(0x123)]},{'label':_0x21268b(0xe0),'path':this[_0x21268b(0xe7)][_0x21268b(0xd6)]}];for(const {label:_0xbcba11,path:_0x5b7707,extra:_0x2b9bfb}of _0x4c316b){if(_0x5b7707)console[_0x21268b(0xd9)](a49_0x378979[_0x21268b(0x108)](_0xbcba11)+':\x20'+_0x5b7707+'\x20'+a49_0x378979[_0x21268b(0xfa)]('✓')+(_0x2b9bfb?'\x20'+a49_0x378979[_0x21268b(0xf7)](_0x2b9bfb):''));else{if(_0xbcba11===_0x21268b(0xd5))console[_0x21268b(0xd9)](a49_0x378979['cyan'](_0xbcba11)+':\x20'+a49_0x378979[_0x21268b(0xf7)]('none')+'\x20'+a49_0x378979[_0x21268b(0xf7)]('(using\x20session:\x20'+this[_0x21268b(0x11e)]+')'));else(_0xbcba11==='Project'||_0xbcba11===_0x21268b(0xe3))&&console[_0x21268b(0xd9)](a49_0x378979['cyan'](_0xbcba11)+':\x20'+a49_0x378979['dim'](_0x21268b(0xdb)));}}}async[a49_0x2139cd(0x107)](){const _0x2f8282=a49_0x2139cd;return this[_0x2f8282(0xd8)]=await getAPIKeyAsync(this[_0x2f8282(0x119)],this[_0x2f8282(0x112)]||undefined),this['apiKey'];}static async['createAsync'](_0x2e9ae6){const _0x591f8a=a49_0x2139cd,_0x4bad86=new GlobalContext(_0x2e9ae6);return await _0x4bad86[_0x591f8a(0x107)](),_0x4bad86;}}
@@ -1 +1 @@
1
- (function(_0x42ab1f,_0x403769){const _0x58d8cc=a50_0xcc5c,_0x220228=_0x42ab1f();while(!![]){try{const _0x3d72eb=parseInt(_0x58d8cc(0xaa))/0x1+-parseInt(_0x58d8cc(0xc6))/0x2+-parseInt(_0x58d8cc(0xa6))/0x3*(-parseInt(_0x58d8cc(0xc0))/0x4)+parseInt(_0x58d8cc(0xa7))/0x5+-parseInt(_0x58d8cc(0xac))/0x6*(parseInt(_0x58d8cc(0xb1))/0x7)+parseInt(_0x58d8cc(0xb9))/0x8*(-parseInt(_0x58d8cc(0xb5))/0x9)+parseInt(_0x58d8cc(0xb2))/0xa;if(_0x3d72eb===_0x403769)break;else _0x220228['push'](_0x220228['shift']());}catch(_0x10338c){_0x220228['push'](_0x220228['shift']());}}}(a50_0xde0e,0xa5fca));const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;function a50_0xde0e(){const _0x2704ab=['cannot\x20find','getPassword','565173jzZIFH','-25293',':api_key','error','8XbQtGb','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.','deleteCredential','not_found','Warning:\x20','access_denied','unavailable','32468mnBuZj','includes','reason','@napi-rs/keyring','value','toLowerCase','2397356nlJfSS','restricted','not\x20available','18KFrVNg','4944110QplMet','access','__keychain_test__','1268048ISyEOM','setPassword','3559728bftBaw','Entry','message','-25300','success','7vVdjIi','2290730tdHowu'];a50_0xde0e=function(){return _0x2704ab;};return a50_0xde0e();}async function getEntryClass(){const _0x51e88a=a50_0xcc5c;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x47f7f0=await import(_0x51e88a(0xc3));return EntryClass=_0x47f7f0[_0x51e88a(0xad)],EntryClass;}catch(_0x3fefa9){return keyringLoadError=_0x3fefa9 instanceof Error?_0x3fefa9:new Error(String(_0x3fefa9)),null;}}function getAccountName(_0x53a654){const _0x31ef49=a50_0xcc5c,_0x57e425=_0x53a654||'';return'profile:'+_0x57e425+_0x31ef49(0xb7);}export async function getKeychainAPIKey(_0x48dbe7){const _0xe9b313=a50_0xcc5c,_0x58b1c3=await getKeychainAPIKeyWithStatus(_0x48dbe7);if(_0x58b1c3[_0xe9b313(0xb0)])return _0x58b1c3[_0xe9b313(0xc4)];return _0x58b1c3[_0xe9b313(0xc2)]==='access_denied'&&console[_0xe9b313(0xb8)](_0xe9b313(0xbd)+_0x58b1c3[_0xe9b313(0xae)]),null;}export async function getKeychainAPIKeyWithStatus(_0x98b7c1){const _0x23ca9d=a50_0xcc5c;try{const _0x3acf3a=await getEntryClass();if(!_0x3acf3a)return{'success':![],'reason':'unavailable'};const _0x2f0b2b=getAccountName(_0x98b7c1),_0x261594=new _0x3acf3a(SERVICE_NAME,_0x2f0b2b),_0x2f1bf8=_0x261594[_0x23ca9d(0xb4)]();if(_0x2f1bf8)return{'success':!![],'value':_0x2f1bf8};return{'success':![],'reason':_0x23ca9d(0xbc)};}catch(_0x368ece){const _0x24d1ee=_0x368ece instanceof Error?_0x368ece[_0x23ca9d(0xae)]:String(_0x368ece);if(_0x24d1ee[_0x23ca9d(0xc1)](_0x23ca9d(0xaf))||_0x24d1ee[_0x23ca9d(0xc5)]()[_0x23ca9d(0xc1)]('could\x20not\x20be\x20found')||_0x24d1ee[_0x23ca9d(0xc5)]()[_0x23ca9d(0xc1)]('not\x20found')||_0x24d1ee['toLowerCase']()[_0x23ca9d(0xc1)]('no\x20matching\x20entry'))return{'success':![],'reason':_0x23ca9d(0xbc)};if(_0x24d1ee[_0x23ca9d(0xc1)](_0x23ca9d(0xb6))||_0x24d1ee[_0x23ca9d(0xc5)]()[_0x23ca9d(0xc1)](_0x23ca9d(0xa4))||_0x24d1ee['toLowerCase']()[_0x23ca9d(0xc1)](_0x23ca9d(0xa8)))return{'success':![],'reason':_0x23ca9d(0xbe),'message':_0x23ca9d(0xba)};return{'success':![],'reason':_0x23ca9d(0xbf),'message':_0x24d1ee};}}export async function saveKeychainAPIKey(_0x4516e5,_0x5de2a6){const _0x44cc69=a50_0xcc5c,_0x1e1871=await getEntryClass();if(!_0x1e1871)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x3d8c39=getAccountName(_0x5de2a6),_0x1d57d4=new _0x1e1871(SERVICE_NAME,_0x3d8c39);_0x1d57d4[_0x44cc69(0xab)](_0x4516e5);}function a50_0xcc5c(_0x4db713,_0x51050c){_0x4db713=_0x4db713-0xa4;const _0xde0e1a=a50_0xde0e();let _0xcc5c5b=_0xde0e1a[_0x4db713];return _0xcc5c5b;}export async function deleteKeychainAPIKey(_0xa1ef9b){const _0x179213=a50_0xcc5c;try{const _0x8eb2d6=await getEntryClass();if(!_0x8eb2d6)return![];const _0x1fe6ae=getAccountName(_0xa1ef9b),_0x38647b=new _0x8eb2d6(SERVICE_NAME,_0x1fe6ae);return _0x38647b[_0x179213(0xbb)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x19f48c=a50_0xcc5c;try{const _0x3d302d=await getEntryClass();if(!_0x3d302d)return![];const _0x3de5a2=new _0x3d302d(SERVICE_NAME,_0x19f48c(0xa9));return _0x3de5a2[_0x19f48c(0xb4)](),!![];}catch(_0x9a5358){const _0x2df3ee=_0x9a5358 instanceof Error?_0x9a5358[_0x19f48c(0xae)][_0x19f48c(0xc5)]():'';if(_0x2df3ee[_0x19f48c(0xc1)](_0x19f48c(0xa5))||_0x2df3ee[_0x19f48c(0xc1)]('not\x20supported')||_0x2df3ee[_0x19f48c(0xc1)](_0x19f48c(0xb3)))return![];return!![];}}
1
+ function a50_0x174d(){const _0x2d6905=['toLowerCase','access_denied','393666oYSGbq','Entry','14WZzVpJ','includes','could\x20not\x20be\x20found','Warning:\x20','not\x20supported','no\x20matching\x20entry','setPassword','7045576miTeAs','1652136FuMCGH','tdx','access','not_found','value','deleteCredential','2012250LUddgq','success','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.',':api_key','profile:','getPassword','-25300','2329164SGlHDJ','not\x20found','138JvwlYd','3844791rItHMu','not\x20available','13270dlXHih','System\x20keychain\x20is\x20not\x20available','reason','-25293','message'];a50_0x174d=function(){return _0x2d6905;};return a50_0x174d();}function a50_0x5bd4(_0x2ed7df,_0x3cfd2a){_0x2ed7df=_0x2ed7df-0xb0;const _0x174dc3=a50_0x174d();let _0x5bd49f=_0x174dc3[_0x2ed7df];return _0x5bd49f;}const a50_0x4300df=a50_0x5bd4;(function(_0xbfb9c3,_0x4987c4){const _0x44b9f3=a50_0x5bd4,_0x49088e=_0xbfb9c3();while(!![]){try{const _0x2d62d2=-parseInt(_0x44b9f3(0xb4))/0x1+parseInt(_0x44b9f3(0xd0))/0x2*(parseInt(_0x44b9f3(0xcd))/0x3)+parseInt(_0x44b9f3(0xbe))/0x4+-parseInt(_0x44b9f3(0xc4))/0x5+-parseInt(_0x44b9f3(0xcb))/0x6*(parseInt(_0x44b9f3(0xb6))/0x7)+parseInt(_0x44b9f3(0xbd))/0x8+parseInt(_0x44b9f3(0xce))/0x9;if(_0x2d62d2===_0x4987c4)break;else _0x49088e['push'](_0x49088e['shift']());}catch(_0x1fcb03){_0x49088e['push'](_0x49088e['shift']());}}}(a50_0x174d,0x6ec04));const SERVICE_NAME=a50_0x4300df(0xbf);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x507ef2=a50_0x4300df;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x5121b7=await import('@napi-rs/keyring');return EntryClass=_0x5121b7[_0x507ef2(0xb5)],EntryClass;}catch(_0x68e239){return keyringLoadError=_0x68e239 instanceof Error?_0x68e239:new Error(String(_0x68e239)),null;}}function getAccountName(_0x3120cb){const _0x9772ee=a50_0x4300df,_0x42a9f7=_0x3120cb||'';return _0x9772ee(0xc8)+_0x42a9f7+_0x9772ee(0xc7);}export async function getKeychainAPIKey(_0x769aea){const _0x22597c=a50_0x4300df,_0xfe66f8=await getKeychainAPIKeyWithStatus(_0x769aea);if(_0xfe66f8[_0x22597c(0xc5)])return _0xfe66f8[_0x22597c(0xc2)];return _0xfe66f8[_0x22597c(0xd2)]===_0x22597c(0xb3)&&console['error'](_0x22597c(0xb9)+_0xfe66f8[_0x22597c(0xb1)]),null;}export async function getKeychainAPIKeyWithStatus(_0x1f870e){const _0x538881=a50_0x4300df;try{const _0x406aef=await getEntryClass();if(!_0x406aef)return{'success':![],'reason':'unavailable'};const _0x2a498a=getAccountName(_0x1f870e),_0x3c29ca=new _0x406aef(SERVICE_NAME,_0x2a498a),_0x3ee17a=_0x3c29ca['getPassword']();if(_0x3ee17a)return{'success':!![],'value':_0x3ee17a};return{'success':![],'reason':_0x538881(0xc1)};}catch(_0x46b4e9){const _0x1f3765=_0x46b4e9 instanceof Error?_0x46b4e9[_0x538881(0xb1)]:String(_0x46b4e9);if(_0x1f3765[_0x538881(0xb7)](_0x538881(0xca))||_0x1f3765[_0x538881(0xb2)]()[_0x538881(0xb7)](_0x538881(0xb8))||_0x1f3765['toLowerCase']()[_0x538881(0xb7)](_0x538881(0xcc))||_0x1f3765[_0x538881(0xb2)]()[_0x538881(0xb7)](_0x538881(0xbb)))return{'success':![],'reason':_0x538881(0xc1)};if(_0x1f3765[_0x538881(0xb7)](_0x538881(0xb0))||_0x1f3765[_0x538881(0xb2)]()[_0x538881(0xb7)]('restricted')||_0x1f3765[_0x538881(0xb2)]()[_0x538881(0xb7)](_0x538881(0xc0)))return{'success':![],'reason':'access_denied','message':_0x538881(0xc6)};return{'success':![],'reason':'unavailable','message':_0x1f3765};}}export async function saveKeychainAPIKey(_0x20749a,_0x12b9b3){const _0x3f56bf=a50_0x4300df,_0x10a745=await getEntryClass();if(!_0x10a745)throw new Error(_0x3f56bf(0xd1));const _0x4204a3=getAccountName(_0x12b9b3),_0xd586a=new _0x10a745(SERVICE_NAME,_0x4204a3);_0xd586a[_0x3f56bf(0xbc)](_0x20749a);}export async function deleteKeychainAPIKey(_0x2506b6){const _0x28fda3=a50_0x4300df;try{const _0x486d2a=await getEntryClass();if(!_0x486d2a)return![];const _0x17677b=getAccountName(_0x2506b6),_0x4371c7=new _0x486d2a(SERVICE_NAME,_0x17677b);return _0x4371c7[_0x28fda3(0xc3)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x1f8107=a50_0x4300df;try{const _0x3a2f47=await getEntryClass();if(!_0x3a2f47)return![];const _0x30dc31=new _0x3a2f47(SERVICE_NAME,'__keychain_test__');return _0x30dc31[_0x1f8107(0xc9)](),!![];}catch(_0x3dddd6){const _0x27a22b=_0x3dddd6 instanceof Error?_0x3dddd6[_0x1f8107(0xb1)][_0x1f8107(0xb2)]():'';if(_0x27a22b[_0x1f8107(0xb7)](_0x1f8107(0xcf))||_0x27a22b['includes'](_0x1f8107(0xba))||_0x27a22b[_0x1f8107(0xb7)]('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- const a51_0x428462=a51_0xbd09;(function(_0x1a2d2b,_0x5e2936){const _0x258d74=a51_0xbd09,_0x2bbded=_0x1a2d2b();while(!![]){try{const _0x3a5fe1=-parseInt(_0x258d74(0xea))/0x1*(parseInt(_0x258d74(0xf2))/0x2)+-parseInt(_0x258d74(0xdb))/0x3+parseInt(_0x258d74(0xdf))/0x4+parseInt(_0x258d74(0xc7))/0x5*(-parseInt(_0x258d74(0xdd))/0x6)+-parseInt(_0x258d74(0xd2))/0x7+parseInt(_0x258d74(0xd6))/0x8+parseInt(_0x258d74(0xee))/0x9;if(_0x3a5fe1===_0x5e2936)break;else _0x2bbded['push'](_0x2bbded['shift']());}catch(_0x387e3a){_0x2bbded['push'](_0x2bbded['shift']());}}}(a51_0x484e,0xa5602));import*as a51_0x125267 from'node:fs';import*as a51_0x257dd4 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a51_0x428462(0xf9);export function getProfileParams(_0x3e0cce){const _0x23660e=a51_0x428462,_0x17c836={};if(!_0x3e0cce)return _0x17c836;for(const [_0x400de2,_0x57792b]of Object[_0x23660e(0xd4)](_0x3e0cce)){_0x400de2!=='description'&&_0x57792b!==undefined&&(_0x17c836[_0x400de2]=_0x57792b);}return _0x17c836;}export function getProfilesDir(){const _0x48d319=a51_0x428462;return a51_0x257dd4[_0x48d319(0xff)](getConfigDir(),_0x48d319(0x10e));}function getProfileDir(_0x3fb973){const _0x3596de=a51_0x428462;return a51_0x257dd4[_0x3596de(0xff)](getProfilesDir(),_0x3fb973);}function getProfileConfigPath(_0x2407ef){const _0x2dd53f=a51_0x428462;return a51_0x257dd4[_0x2dd53f(0xff)](getProfileDir(_0x2407ef),_0x2dd53f(0xe8));}function a51_0x484e(){const _0x4ce216=['test','name','isDirectory','@tdx-studio','Profile\x20','site','\x20\x20mv\x20\x22','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','localeCompare','join','.env.','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Profile\x20\x27','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','description','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','map','\x27:\x20unknown\x20config\x20key\x20\x27','llm_agent','values','object','\x22\x20\x22','profiles','To\x20migrate:','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','push','.env','readdirSync',':\x20Invalid\x20JSON\x20syntax','string','warn','2271530PAzoAd','local','parse','filter','database','\x27\x20will\x20be\x20ignored','stringify','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','utf-8','existsSync','INVALID_PROFILE_CONFIG','6981191lcDCnR','user_info','entries','llm_project','622256MQGbYr','includes','readFileSync','some','\x20already\x20exists','3378753AWRGOD','Error:\x20','12QveyxZ','message','2401132ONsHjO','find',',\x20creating\x20new\x20file','\x0aWarning:\x20Failed\x20to\x20parse\x20','from','Failed\x20to\x20parse\x20','\x20does\x20not\x20exist','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','toISOString','tdx.json','profile','312788cEADOm','has','\x27\x20not\x20found\x20in\x20user\x20configuration','length','32913585RFYuNu','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Invalid\x20profile\x20name:\x20','Warning:\x20Profile\x20\x27','4wXrOtu','directory','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20'];a51_0x484e=function(){return _0x4ce216;};return a51_0x484e();}function getProfileEnvPath(_0x48506c){const _0x7c09c0=a51_0x428462;return a51_0x257dd4['join'](getProfileDir(_0x48506c),_0x7c09c0(0xc2));}function a51_0xbd09(_0x197c0d,_0x3600e3){_0x197c0d=_0x197c0d-0xc0;const _0x484ebe=a51_0x484e();let _0xbd0905=_0x484ebe[_0x197c0d];return _0xbd0905;}function getGlobalConfigPath(){const _0xbebeb4=a51_0x428462;return a51_0x257dd4['join'](getConfigDir(),_0xbebeb4(0xe8));}function validateProfileName(_0x3c2afe){const _0x12244d=a51_0x428462;if(/^@?[a-zA-Z0-9_-]+$/[_0x12244d(0xf6)](_0x3c2afe))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/[_0x12244d(0xf6)](_0x3c2afe))return;throw new Error(_0x12244d(0xf0)+_0x3c2afe+_0x12244d(0xfd));}function validateProfileConfig(_0x3146b1,_0x4d20c2){const _0x5201e1=a51_0x428462;if(typeof _0x3146b1!==_0x5201e1(0x10c)||_0x3146b1===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5201e1(0x104)+_0x4d20c2+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x193cb9=[_0x5201e1(0x106),_0x5201e1(0xfb),'database','parent_segment',_0x5201e1(0xd5),_0x5201e1(0x10a),_0x5201e1(0xd3)],_0x41db32=_0x3146b1;for(const _0x149588 of Object['keys'](_0x41db32)){!_0x193cb9[_0x5201e1(0xd7)](_0x149588)&&console[_0x5201e1(0xc6)](_0x5201e1(0xf1)+_0x4d20c2+_0x5201e1(0x109)+_0x149588+_0x5201e1(0xcc));}if(_0x41db32[_0x5201e1(0x106)]!==undefined&&typeof _0x41db32[_0x5201e1(0x106)]!==_0x5201e1(0xc5))throw new SDKError(ErrorCode[_0x5201e1(0xd1)],_0x5201e1(0x104)+_0x4d20c2+_0x5201e1(0xf4));if(_0x41db32[_0x5201e1(0xfb)]!==undefined&&typeof _0x41db32['site']!=='string')throw new SDKError(ErrorCode[_0x5201e1(0xd1)],_0x5201e1(0x104)+_0x4d20c2+_0x5201e1(0xef));if(_0x41db32[_0x5201e1(0xcb)]!==undefined&&typeof _0x41db32[_0x5201e1(0xcb)]!==_0x5201e1(0xc5))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5201e1(0x104)+_0x4d20c2+_0x5201e1(0xc0));if(_0x41db32['parent_segment']!==undefined&&typeof _0x41db32['parent_segment']!==_0x5201e1(0xc5))throw new SDKError(ErrorCode[_0x5201e1(0xd1)],_0x5201e1(0x104)+_0x4d20c2+_0x5201e1(0xce));if(_0x41db32[_0x5201e1(0xd5)]!==undefined&&typeof _0x41db32[_0x5201e1(0xd5)]!==_0x5201e1(0xc5))throw new SDKError(ErrorCode[_0x5201e1(0xd1)],_0x5201e1(0x104)+_0x4d20c2+_0x5201e1(0xe6));if(_0x41db32[_0x5201e1(0x10a)]!==undefined&&typeof _0x41db32['llm_agent']!==_0x5201e1(0xc5))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5201e1(0x104)+_0x4d20c2+_0x5201e1(0x107));return!![];}function loadProfilesFromTdxJson(_0x2c667a,_0x47e963){const _0x3b841a=a51_0x428462;if(!a51_0x125267[_0x3b841a(0xd0)](_0x2c667a))return[];try{const _0xb9d823=a51_0x125267[_0x3b841a(0xd8)](_0x2c667a,_0x3b841a(0xcf)),_0x55b27c=JSON[_0x3b841a(0xc9)](_0xb9d823);if(!_0x55b27c['profiles']||typeof _0x55b27c[_0x3b841a(0x10e)]!==_0x3b841a(0x10c))return[];const _0x36dd1b=[];for(const [_0x47bd21,_0xdc6ada]of Object[_0x3b841a(0xd4)](_0x55b27c[_0x3b841a(0x10e)])){try{validateProfileConfig(_0xdc6ada,_0x47bd21);const _0x42a267=getNewCredentialPath(_0x47bd21),_0x3b2a02=getOldCredentialPath(_0x47bd21),_0x31bd80=a51_0x125267[_0x3b841a(0xd0)](_0x42a267)||a51_0x125267[_0x3b841a(0xd0)](_0x3b2a02);_0x36dd1b[_0x3b841a(0xc1)]({'name':_0x47bd21,'config':_0xdc6ada,'metadata':{'name':_0x47bd21,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x31bd80,'scope':_0x47e963});}catch(_0x23934b){_0x23934b instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x2c667a+':'),console[_0x3b841a(0xc6)]('\x20\x20'+_0x23934b[_0x3b841a(0xde)]+'\x0a'));}}return _0x36dd1b;}catch(_0xc2bdc9){return _0xc2bdc9 instanceof SyntaxError?(console[_0x3b841a(0xc6)](_0x3b841a(0xe2)+_0x2c667a+_0x3b841a(0xc4)),console[_0x3b841a(0xc6)](_0x3b841a(0xdc)+_0xc2bdc9[_0x3b841a(0xde)]+'\x0a')):console[_0x3b841a(0xc6)](_0x3b841a(0x101)+_0x2c667a+':\x20'+_0xc2bdc9+'\x0a'),[];}}export function getNewCredentialPath(_0x46169b){const _0x111f98=a51_0x428462;return a51_0x257dd4['join'](getConfigDir(),_0x111f98(0x100)+_0x46169b);}function getOldCredentialPath(_0xe60732){const _0x5c7ed4=a51_0x428462;return a51_0x257dd4[_0x5c7ed4(0xff)](getProfilesDir(),_0xe60732,_0x5c7ed4(0xc2));}function loadProfilesFromTdxJsonFiles(){const _0x1da443=a51_0x428462,_0x1c1029=[],_0x34444b=findProjectConfigPath();_0x34444b&&_0x1c1029[_0x1da443(0xc1)](...loadProfilesFromTdxJson(_0x34444b,_0x1da443(0xc8)));const _0x3ced55=a51_0x257dd4[_0x1da443(0xff)](getConfigDir(),_0x1da443(0xe8));return _0x1c1029['push'](...loadProfilesFromTdxJson(_0x3ced55,'user')),_0x1c1029;}function loadProfilesFromDirectories(){const _0x16be00=a51_0x428462,_0x387b78=getProfilesDir();if(!a51_0x125267[_0x16be00(0xd0)](_0x387b78))return[];try{return a51_0x125267[_0x16be00(0xc3)](_0x387b78,{'withFileTypes':!![]})[_0x16be00(0xca)](_0x3edd04=>_0x3edd04[_0x16be00(0xf8)]())[_0x16be00(0x108)](_0xcde843=>_0xcde843['name'])[_0x16be00(0xca)](_0x13644f=>{const _0x10355d=_0x16be00,_0x270ffb=getProfileConfigPath(_0x13644f),_0x24fe98=getProfileEnvPath(_0x13644f);return a51_0x125267[_0x10355d(0xd0)](_0x270ffb)||a51_0x125267['existsSync'](_0x24fe98);})[_0x16be00(0x108)](_0x233c54=>{const _0x8d9c8=_0x16be00,_0x16b69b=loadProfileFromDirectory(_0x233c54);if(_0x16b69b)return{..._0x16b69b,'scope':_0x8d9c8(0xf3)};return null;})[_0x16be00(0xca)](_0x5187e4=>_0x5187e4!==null);}catch{return[];}}function loadProfileFromDirectory(_0x9b1d47){const _0x5a9f33=a51_0x428462,_0x2cbe3d=getProfileConfigPath(_0x9b1d47),_0x32209e=getOldCredentialPath(_0x9b1d47);if(!a51_0x125267[_0x5a9f33(0xd0)](_0x2cbe3d)&&!a51_0x125267[_0x5a9f33(0xd0)](_0x32209e))return null;let _0x453c4d={},_0x2de0fc={'name':_0x9b1d47,'createdAt':new Date()[_0x5a9f33(0xe7)]()};if(a51_0x125267[_0x5a9f33(0xd0)](_0x2cbe3d))try{const _0x1b2ea6=a51_0x125267['readFileSync'](_0x2cbe3d,_0x5a9f33(0xcf)),_0x4a811a=JSON[_0x5a9f33(0xc9)](_0x1b2ea6),{metadata:_0x5cdd9b,..._0x38a059}=_0x4a811a;_0x453c4d=_0x38a059,_0x5cdd9b&&(_0x2de0fc=_0x5cdd9b);}catch{}return{'name':_0x9b1d47,'config':_0x453c4d,'metadata':_0x2de0fc,'hasCredentials':a51_0x125267[_0x5a9f33(0xd0)](_0x32209e),'scope':_0x5a9f33(0xf3)};}export function listProfiles(){const _0x18500a=a51_0x428462,_0x190824=loadProfilesFromTdxJsonFiles(),_0x1d4290=loadProfilesFromDirectories();if(_0x1d4290[_0x18500a(0xed)]>0x0){const _0x4d745e=_0x1d4290[_0x18500a(0x108)](_0x23cb31=>_0x23cb31[_0x18500a(0xf7)])['join'](',\x20'),_0x34c301=getConfigDir();console[_0x18500a(0xc6)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x4d745e),console['warn'](_0x18500a(0x105)),console[_0x18500a(0xc6)]('\x20\x201.\x20Edit:\x20'+a51_0x257dd4[_0x18500a(0xff)](_0x34c301,'tdx.json')),console[_0x18500a(0xc6)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console['warn'](_0x18500a(0x102));}const _0x588e0a=[..._0x190824,..._0x1d4290],_0x52186f=new Map();for(const _0x2f66c0 of _0x588e0a){!_0x52186f[_0x18500a(0xeb)](_0x2f66c0[_0x18500a(0xf7)])&&_0x52186f['set'](_0x2f66c0[_0x18500a(0xf7)],_0x2f66c0);}return Array[_0x18500a(0xe3)](_0x52186f[_0x18500a(0x10b)]())['sort']((_0x1b7542,_0x3887e6)=>_0x1b7542[_0x18500a(0xf7)][_0x18500a(0xfe)](_0x3887e6[_0x18500a(0xf7)]));}export function profileExists(_0x536a44){const _0x2ced0a=a51_0x428462,_0x4fa411=listProfiles();return _0x4fa411[_0x2ced0a(0xd9)](_0x48da6e=>_0x48da6e[_0x2ced0a(0xf7)]===_0x536a44);}export function loadProfile(_0x4dc319){const _0x9687be=a51_0x428462;validateProfileName(_0x4dc319);const _0x27e5fd=listProfiles(),_0x3a3fe0=_0x27e5fd[_0x9687be(0xe0)](_0x305524=>_0x305524[_0x9687be(0xf7)]===_0x4dc319);return _0x3a3fe0||null;}export function saveProfile(_0xc164be,_0x3cdac8,_0x334aeb=![]){saveProfileToUserConfig(_0xc164be,_0x3cdac8);}export function deleteProfile(_0x166850){const _0x418d62=a51_0x428462;validateProfileName(_0x166850);const _0x46a6f1=getProfileDir(_0x166850);if(!a51_0x125267[_0x418d62(0xd0)](_0x46a6f1))throw new Error(_0x418d62(0xfa)+_0x166850+_0x418d62(0xe5));a51_0x125267['rmSync'](_0x46a6f1,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1e05ae,_0x503ca9){const _0x5e7d45=a51_0x428462;validateProfileName(_0x1e05ae);const _0x14f540=getGlobalConfigPath(),_0x445acc=getConfigDir();!a51_0x125267[_0x5e7d45(0xd0)](_0x445acc)&&createSecureDirectory(_0x445acc);let _0x5b86c0={};if(a51_0x125267['existsSync'](_0x14f540))try{const _0x33f8e9=a51_0x125267[_0x5e7d45(0xd8)](_0x14f540,_0x5e7d45(0xcf));_0x5b86c0=JSON[_0x5e7d45(0xc9)](_0x33f8e9);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x14f540+_0x5e7d45(0xe1));}!_0x5b86c0['profiles']&&(_0x5b86c0[_0x5e7d45(0x10e)]={}),_0x5b86c0[_0x5e7d45(0x10e)][_0x1e05ae]=_0x503ca9,writeSecureFile(_0x14f540,JSON[_0x5e7d45(0xcd)](_0x5b86c0,null,0x2));}export function removeProfileFromUserConfig(_0x499b8f){const _0x1acc48=a51_0x428462;validateProfileName(_0x499b8f);const _0x17e202=getGlobalConfigPath();if(!a51_0x125267[_0x1acc48(0xd0)](_0x17e202))throw new Error(_0x1acc48(0x104)+_0x499b8f+_0x1acc48(0xec));let _0x133a15={};try{const _0x16bbb7=a51_0x125267['readFileSync'](_0x17e202,'utf-8');_0x133a15=JSON[_0x1acc48(0xc9)](_0x16bbb7);}catch{throw new Error(_0x1acc48(0xe4)+_0x17e202);}if(!_0x133a15[_0x1acc48(0x10e)]||!_0x133a15['profiles'][_0x499b8f])throw new Error(_0x1acc48(0x104)+_0x499b8f+_0x1acc48(0xec));delete _0x133a15['profiles'][_0x499b8f],_0x133a15[_0x1acc48(0xe9)]===_0x499b8f&&delete _0x133a15[_0x1acc48(0xe9)],writeSecureFile(_0x17e202,JSON[_0x1acc48(0xcd)](_0x133a15,null,0x2));}export function getActiveProfile(){const _0x3a23eb=a51_0x428462,_0x390ce4=loadSessionContext();if(_0x390ce4?.['profile'])return _0x390ce4[_0x3a23eb(0xe9)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x7fe354=getGlobalConfigPath();if(!a51_0x125267[_0x3a23eb(0xd0)](_0x7fe354))return null;try{const _0x208408=a51_0x125267['readFileSync'](_0x7fe354,_0x3a23eb(0xcf)),_0x594732=JSON[_0x3a23eb(0xc9)](_0x208408);return _0x594732[_0x3a23eb(0xe9)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x1300b7){const _0x2ae31f=a51_0x428462,_0x5efcf9=getGlobalConfigPath(),_0x2c20f3=getConfigDir();!a51_0x125267[_0x2ae31f(0xd0)](_0x2c20f3)&&createSecureDirectory(_0x2c20f3);let _0x14217f={};if(a51_0x125267[_0x2ae31f(0xd0)](_0x5efcf9))try{const _0x413a06=a51_0x125267[_0x2ae31f(0xd8)](_0x5efcf9,_0x2ae31f(0xcf));_0x14217f=JSON[_0x2ae31f(0xc9)](_0x413a06);}catch{console[_0x2ae31f(0xc6)](_0x2ae31f(0xf5)+_0x5efcf9+_0x2ae31f(0xe1));}_0x14217f['site']=_0x1300b7,writeSecureFile(_0x5efcf9,JSON[_0x2ae31f(0xcd)](_0x14217f,null,0x2));}export function saveActiveProfileToUserConfig(_0x42b91b){const _0x2f9e87=a51_0x428462;validateProfileName(_0x42b91b);const _0x416312=getGlobalConfigPath(),_0x4c7edc=getConfigDir();!a51_0x125267[_0x2f9e87(0xd0)](_0x4c7edc)&&createSecureDirectory(_0x4c7edc);let _0x59d2ab={};if(a51_0x125267[_0x2f9e87(0xd0)](_0x416312))try{const _0x12d75f=a51_0x125267[_0x2f9e87(0xd8)](_0x416312,_0x2f9e87(0xcf));_0x59d2ab=JSON['parse'](_0x12d75f);}catch{console[_0x2f9e87(0xc6)](_0x2f9e87(0xf5)+_0x416312+_0x2f9e87(0xe1));}_0x59d2ab[_0x2f9e87(0xe9)]=_0x42b91b,writeSecureFile(_0x416312,JSON[_0x2f9e87(0xcd)](_0x59d2ab,null,0x2));}function clearFieldFromUserConfig(_0x52516e){const _0x197a58=a51_0x428462,_0x5ec1ff=getGlobalConfigPath();if(!a51_0x125267[_0x197a58(0xd0)](_0x5ec1ff))return;let _0x2a87f8={};try{const _0x1bd783=a51_0x125267['readFileSync'](_0x5ec1ff,'utf-8');_0x2a87f8=JSON[_0x197a58(0xc9)](_0x1bd783);}catch{return;}delete _0x2a87f8[_0x52516e],writeSecureFile(_0x5ec1ff,JSON[_0x197a58(0xcd)](_0x2a87f8,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x276f2f,_0x26eeaa){const _0x339d54=a51_0x428462;validateProfileName(_0x276f2f);if(profileExists(_0x276f2f))throw new Error('Profile\x20'+_0x276f2f+_0x339d54(0xda));saveProfile(_0x276f2f,_0x26eeaa);}export function saveProfileCredentials(_0x1ab9be,_0x57b49c){validateProfileName(_0x1ab9be);if(!profileExists(_0x1ab9be))throw new Error('Profile\x20'+_0x1ab9be+'\x20does\x20not\x20exist');const _0xf83662=getNewCredentialPath(_0x1ab9be);writeSecureFile(_0xf83662,_0x57b49c);}export function loadProfileCredentials(_0xebb520){const _0x3176d9=a51_0x428462;validateProfileName(_0xebb520);const _0x15df33=getNewCredentialPath(_0xebb520);if(a51_0x125267['existsSync'](_0x15df33))try{return a51_0x125267[_0x3176d9(0xd8)](_0x15df33,_0x3176d9(0xcf));}catch{}const _0x39bdba=getOldCredentialPath(_0xebb520);if(a51_0x125267[_0x3176d9(0xd0)](_0x39bdba)){console['warn'](_0x3176d9(0x103)+_0xebb520+'\x27'),console[_0x3176d9(0xc6)](_0x3176d9(0x10f)),console[_0x3176d9(0xc6)](_0x3176d9(0xfc)+_0x39bdba+_0x3176d9(0x10d)+_0x15df33+'\x22'),console[_0x3176d9(0xc6)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a51_0x125267['readFileSync'](_0x39bdba,_0x3176d9(0xcf));}catch{return null;}}return null;}
1
+ const a51_0x7ce1d9=a51_0x8ab7;(function(_0x329cf7,_0x3f733d){const _0x50bbd1=a51_0x8ab7,_0x3510f1=_0x329cf7();while(!![]){try{const _0x1c6c58=parseInt(_0x50bbd1(0xec))/0x1*(-parseInt(_0x50bbd1(0xdd))/0x2)+-parseInt(_0x50bbd1(0xe7))/0x3*(-parseInt(_0x50bbd1(0x112))/0x4)+-parseInt(_0x50bbd1(0xf7))/0x5*(parseInt(_0x50bbd1(0x10e))/0x6)+-parseInt(_0x50bbd1(0xfc))/0x7*(parseInt(_0x50bbd1(0xf5))/0x8)+parseInt(_0x50bbd1(0xe5))/0x9*(parseInt(_0x50bbd1(0x111))/0xa)+parseInt(_0x50bbd1(0xdc))/0xb+-parseInt(_0x50bbd1(0xc6))/0xc*(-parseInt(_0x50bbd1(0xf2))/0xd);if(_0x1c6c58===_0x3f733d)break;else _0x3510f1['push'](_0x3510f1['shift']());}catch(_0xecaab2){_0x3510f1['push'](_0x3510f1['shift']());}}}(a51_0xf61b,0x9d2e8));import*as a51_0x445d07 from'node:fs';import*as a51_0x2d73a4 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';function a51_0x8ab7(_0x3ed8fc,_0xbdb301){_0x3ed8fc=_0x3ed8fc-0xc5;const _0xf61bd2=a51_0xf61b();let _0x8ab7f9=_0xf61bd2[_0x3ed8fc];return _0x8ab7f9;}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_0x7ce1d9(0xff);export function getProfileParams(_0x16bd90){const _0x23e90b=a51_0x7ce1d9,_0x5a87d8={};if(!_0x16bd90)return _0x5a87d8;for(const [_0x2d05bc,_0x337aed]of Object['entries'](_0x16bd90)){_0x2d05bc!==_0x23e90b(0xf1)&&_0x337aed!==undefined&&(_0x5a87d8[_0x2d05bc]=_0x337aed);}return _0x5a87d8;}export function getProfilesDir(){const _0x14e1eb=a51_0x7ce1d9;return a51_0x2d73a4[_0x14e1eb(0xef)](getConfigDir(),_0x14e1eb(0x108));}function getProfileDir(_0xe9acff){const _0x3da42d=a51_0x7ce1d9;return a51_0x2d73a4[_0x3da42d(0xef)](getProfilesDir(),_0xe9acff);}function getProfileConfigPath(_0x1a3c3f){const _0x3819a0=a51_0x7ce1d9;return a51_0x2d73a4[_0x3819a0(0xef)](getProfileDir(_0x1a3c3f),'tdx.json');}function a51_0xf61b(){const _0x563c95=['string','.env','@tdx-studio','directory','name','parent_segment','llm_project','set','length','database','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','profiles','\x27:\x20config\x20must\x20be\x20an\x20object','user_info','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','push','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','6cYQLVi','existsSync','\x20already\x20exists','130vpTXor','689132kQIBZi','\x27\x20not\x20found\x20in\x20user\x20configuration','local','Invalid\x20profile\x20name:\x20','\x20\x201.\x20Edit:\x20','1152oIGlAh','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','readFileSync','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','warn','utf-8','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','To\x20migrate:','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','test','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','includes','tdx.json','rmSync','INVALID_PROFILE_CONFIG','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','site','profile','Warning:\x20Profile\x20\x27','Warning:\x20Failed\x20to\x20parse\x20','.env.','from','3949484Sfdpwg','503166SZzJZa','Profile\x20\x27',',\x20creating\x20new\x20file','toISOString','object','find','Failed\x20to\x20parse\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','642555yjdIwQ','map','21IgmUKt','llm_agent','message','parse','\x0aWarning:\x20Failed\x20to\x20parse\x20','5YxkTkN','localeCompare','keys','join','has','description','100399bUZFmj','Error:\x20',':\x20Invalid\x20JSON\x20syntax','9584oSRNXi','\x20does\x20not\x20exist','6298795sFyguw','Profile\x20','values','stringify','filter','427XpXQvX'];a51_0xf61b=function(){return _0x563c95;};return a51_0xf61b();}function getProfileEnvPath(_0x5bf692){const _0x54d47b=a51_0x7ce1d9;return a51_0x2d73a4[_0x54d47b(0xef)](getProfileDir(_0x5bf692),_0x54d47b(0xfe));}function getGlobalConfigPath(){const _0x115dd2=a51_0x7ce1d9;return a51_0x2d73a4[_0x115dd2(0xef)](getConfigDir(),_0x115dd2(0xd2));}function validateProfileName(_0x1fff3a){const _0x4fccdd=a51_0x7ce1d9;if(/^@?[a-zA-Z0-9_-]+$/[_0x4fccdd(0xcf)](_0x1fff3a))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/['test'](_0x1fff3a))return;throw new Error(_0x4fccdd(0x115)+_0x1fff3a+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x4ae176,_0x5df8cd){const _0x8812b0=a51_0x7ce1d9;if(typeof _0x4ae176!==_0x8812b0(0xe1)||_0x4ae176===null)throw new SDKError(ErrorCode[_0x8812b0(0xd4)],_0x8812b0(0xde)+_0x5df8cd+_0x8812b0(0x109));const _0x29e27=[_0x8812b0(0xf1),'site',_0x8812b0(0x106),_0x8812b0(0x102),_0x8812b0(0x103),_0x8812b0(0xe8),_0x8812b0(0x10a)],_0x1222bc=_0x4ae176;for(const _0x1ce66c of Object[_0x8812b0(0xee)](_0x1222bc)){!_0x29e27[_0x8812b0(0xd1)](_0x1ce66c)&&console[_0x8812b0(0xca)](_0x8812b0(0xd8)+_0x5df8cd+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x1ce66c+'\x27\x20will\x20be\x20ignored');}if(_0x1222bc[_0x8812b0(0xf1)]!==undefined&&typeof _0x1222bc[_0x8812b0(0xf1)]!==_0x8812b0(0xfd))throw new SDKError(ErrorCode[_0x8812b0(0xd4)],_0x8812b0(0xde)+_0x5df8cd+_0x8812b0(0xe4));if(_0x1222bc[_0x8812b0(0xd6)]!==undefined&&typeof _0x1222bc[_0x8812b0(0xd6)]!==_0x8812b0(0xfd))throw new SDKError(ErrorCode[_0x8812b0(0xd4)],'Profile\x20\x27'+_0x5df8cd+_0x8812b0(0x10b));if(_0x1222bc[_0x8812b0(0x106)]!==undefined&&typeof _0x1222bc[_0x8812b0(0x106)]!==_0x8812b0(0xfd))throw new SDKError(ErrorCode[_0x8812b0(0xd4)],_0x8812b0(0xde)+_0x5df8cd+_0x8812b0(0xd0));if(_0x1222bc[_0x8812b0(0x102)]!==undefined&&typeof _0x1222bc[_0x8812b0(0x102)]!==_0x8812b0(0xfd))throw new SDKError(ErrorCode[_0x8812b0(0xd4)],_0x8812b0(0xde)+_0x5df8cd+_0x8812b0(0xcc));if(_0x1222bc[_0x8812b0(0x103)]!==undefined&&typeof _0x1222bc[_0x8812b0(0x103)]!==_0x8812b0(0xfd))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x5df8cd+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x1222bc['llm_agent']!==undefined&&typeof _0x1222bc[_0x8812b0(0xe8)]!==_0x8812b0(0xfd))throw new SDKError(ErrorCode[_0x8812b0(0xd4)],_0x8812b0(0xde)+_0x5df8cd+_0x8812b0(0x107));return!![];}function loadProfilesFromTdxJson(_0x58d986,_0x126ccc){const _0x49a558=a51_0x7ce1d9;if(!a51_0x445d07[_0x49a558(0x10f)](_0x58d986))return[];try{const _0x4de2af=a51_0x445d07['readFileSync'](_0x58d986,_0x49a558(0xcb)),_0x4f8a92=JSON[_0x49a558(0xea)](_0x4de2af);if(!_0x4f8a92[_0x49a558(0x108)]||typeof _0x4f8a92[_0x49a558(0x108)]!==_0x49a558(0xe1))return[];const _0x2499e2=[];for(const [_0x23256f,_0x357e13]of Object['entries'](_0x4f8a92[_0x49a558(0x108)])){try{validateProfileConfig(_0x357e13,_0x23256f);const _0x3017a1=getNewCredentialPath(_0x23256f),_0x4748c6=getOldCredentialPath(_0x23256f),_0x31e99e=a51_0x445d07[_0x49a558(0x10f)](_0x3017a1)||a51_0x445d07[_0x49a558(0x10f)](_0x4748c6);_0x2499e2['push']({'name':_0x23256f,'config':_0x357e13,'metadata':{'name':_0x23256f,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x31e99e,'scope':_0x126ccc});}catch(_0x6fc0d2){_0x6fc0d2 instanceof Error&&(console['warn'](_0x49a558(0x10d)+_0x58d986+':'),console['warn']('\x20\x20'+_0x6fc0d2[_0x49a558(0xe9)]+'\x0a'));}}return _0x2499e2;}catch(_0x26fd9e){return _0x26fd9e instanceof SyntaxError?(console[_0x49a558(0xca)](_0x49a558(0xeb)+_0x58d986+_0x49a558(0xf4)),console[_0x49a558(0xca)](_0x49a558(0xf3)+_0x26fd9e[_0x49a558(0xe9)]+'\x0a')):console[_0x49a558(0xca)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x58d986+':\x20'+_0x26fd9e+'\x0a'),[];}}export function getNewCredentialPath(_0x4c958b){const _0x13aadf=a51_0x7ce1d9;return a51_0x2d73a4[_0x13aadf(0xef)](getConfigDir(),_0x13aadf(0xda)+_0x4c958b);}function getOldCredentialPath(_0x141f57){const _0x41b79f=a51_0x7ce1d9;return a51_0x2d73a4[_0x41b79f(0xef)](getProfilesDir(),_0x141f57,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x338dc8=a51_0x7ce1d9,_0x35a970=[],_0x560bea=findProjectConfigPath();_0x560bea&&_0x35a970[_0x338dc8(0x10c)](...loadProfilesFromTdxJson(_0x560bea,_0x338dc8(0x114)));const _0x271e3d=a51_0x2d73a4[_0x338dc8(0xef)](getConfigDir(),_0x338dc8(0xd2));return _0x35a970['push'](...loadProfilesFromTdxJson(_0x271e3d,'user')),_0x35a970;}function loadProfilesFromDirectories(){const _0x482013=a51_0x7ce1d9,_0x57b148=getProfilesDir();if(!a51_0x445d07['existsSync'](_0x57b148))return[];try{return a51_0x445d07['readdirSync'](_0x57b148,{'withFileTypes':!![]})[_0x482013(0xfb)](_0x5e6708=>_0x5e6708['isDirectory']())[_0x482013(0xe6)](_0x21d565=>_0x21d565['name'])[_0x482013(0xfb)](_0x28ebcc=>{const _0x1abe20=_0x482013,_0x1b4b9a=getProfileConfigPath(_0x28ebcc),_0x29b7ec=getProfileEnvPath(_0x28ebcc);return a51_0x445d07[_0x1abe20(0x10f)](_0x1b4b9a)||a51_0x445d07[_0x1abe20(0x10f)](_0x29b7ec);})[_0x482013(0xe6)](_0x28b788=>{const _0xf1e36=_0x482013,_0x560422=loadProfileFromDirectory(_0x28b788);if(_0x560422)return{..._0x560422,'scope':_0xf1e36(0x100)};return null;})[_0x482013(0xfb)](_0x589f23=>_0x589f23!==null);}catch{return[];}}function loadProfileFromDirectory(_0x59f72f){const _0x253750=a51_0x7ce1d9,_0x26859b=getProfileConfigPath(_0x59f72f),_0x41757f=getOldCredentialPath(_0x59f72f);if(!a51_0x445d07[_0x253750(0x10f)](_0x26859b)&&!a51_0x445d07['existsSync'](_0x41757f))return null;let _0x2318b7={},_0x10d3b0={'name':_0x59f72f,'createdAt':new Date()[_0x253750(0xe0)]()};if(a51_0x445d07['existsSync'](_0x26859b))try{const _0x2738fa=a51_0x445d07[_0x253750(0xc8)](_0x26859b,_0x253750(0xcb)),_0x4c7872=JSON['parse'](_0x2738fa),{metadata:_0x17639f,..._0x515b36}=_0x4c7872;_0x2318b7=_0x515b36,_0x17639f&&(_0x10d3b0=_0x17639f);}catch{}return{'name':_0x59f72f,'config':_0x2318b7,'metadata':_0x10d3b0,'hasCredentials':a51_0x445d07[_0x253750(0x10f)](_0x41757f),'scope':_0x253750(0x100)};}export function listProfiles(){const _0x1a72e0=a51_0x7ce1d9,_0x5e7124=loadProfilesFromTdxJsonFiles(),_0x1bc29d=loadProfilesFromDirectories();if(_0x1bc29d[_0x1a72e0(0x105)]>0x0){const _0x3fe36f=_0x1bc29d[_0x1a72e0(0xe6)](_0x19cc8e=>_0x19cc8e[_0x1a72e0(0x101)])[_0x1a72e0(0xef)](',\x20'),_0xada819=getConfigDir();console[_0x1a72e0(0xca)](_0x1a72e0(0xce)+_0x3fe36f),console[_0x1a72e0(0xca)](_0x1a72e0(0xc9)),console[_0x1a72e0(0xca)](_0x1a72e0(0xc5)+a51_0x2d73a4[_0x1a72e0(0xef)](_0xada819,_0x1a72e0(0xd2))),console[_0x1a72e0(0xca)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x1a72e0(0xca)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x3f20cd=[..._0x5e7124,..._0x1bc29d],_0x1b3e34=new Map();for(const _0x1c2b66 of _0x3f20cd){!_0x1b3e34[_0x1a72e0(0xf0)](_0x1c2b66['name'])&&_0x1b3e34[_0x1a72e0(0x104)](_0x1c2b66['name'],_0x1c2b66);}return Array[_0x1a72e0(0xdb)](_0x1b3e34[_0x1a72e0(0xf9)]())['sort']((_0xcda0e4,_0x160bab)=>_0xcda0e4['name'][_0x1a72e0(0xed)](_0x160bab[_0x1a72e0(0x101)]));}export function profileExists(_0x51d333){const _0x378767=a51_0x7ce1d9,_0x469958=listProfiles();return _0x469958['some'](_0x336240=>_0x336240[_0x378767(0x101)]===_0x51d333);}export function loadProfile(_0x590509){const _0x419008=a51_0x7ce1d9;validateProfileName(_0x590509);const _0x17f53e=listProfiles(),_0x150fb6=_0x17f53e[_0x419008(0xe2)](_0x249877=>_0x249877['name']===_0x590509);return _0x150fb6||null;}export function saveProfile(_0x4baec8,_0x500bca,_0x19307b=![]){saveProfileToUserConfig(_0x4baec8,_0x500bca);}export function deleteProfile(_0x3478aa){const _0x6d172a=a51_0x7ce1d9;validateProfileName(_0x3478aa);const _0x141145=getProfileDir(_0x3478aa);if(!a51_0x445d07['existsSync'](_0x141145))throw new Error(_0x6d172a(0xf8)+_0x3478aa+_0x6d172a(0xf6));a51_0x445d07[_0x6d172a(0xd3)](_0x141145,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x518b85,_0x306bb2){const _0x3716af=a51_0x7ce1d9;validateProfileName(_0x518b85);const _0x7f942=getGlobalConfigPath(),_0x4d30da=getConfigDir();!a51_0x445d07[_0x3716af(0x10f)](_0x4d30da)&&createSecureDirectory(_0x4d30da);let _0x588db6={};if(a51_0x445d07[_0x3716af(0x10f)](_0x7f942))try{const _0x54211d=a51_0x445d07[_0x3716af(0xc8)](_0x7f942,_0x3716af(0xcb));_0x588db6=JSON[_0x3716af(0xea)](_0x54211d);}catch{console[_0x3716af(0xca)](_0x3716af(0xd9)+_0x7f942+',\x20creating\x20new\x20file');}!_0x588db6[_0x3716af(0x108)]&&(_0x588db6[_0x3716af(0x108)]={}),_0x588db6['profiles'][_0x518b85]=_0x306bb2,writeSecureFile(_0x7f942,JSON['stringify'](_0x588db6,null,0x2));}export function removeProfileFromUserConfig(_0x43de6f){const _0x4d3336=a51_0x7ce1d9;validateProfileName(_0x43de6f);const _0x515d2d=getGlobalConfigPath();if(!a51_0x445d07[_0x4d3336(0x10f)](_0x515d2d))throw new Error(_0x4d3336(0xde)+_0x43de6f+_0x4d3336(0x113));let _0x411c31={};try{const _0x150470=a51_0x445d07[_0x4d3336(0xc8)](_0x515d2d,_0x4d3336(0xcb));_0x411c31=JSON['parse'](_0x150470);}catch{throw new Error(_0x4d3336(0xe3)+_0x515d2d);}if(!_0x411c31[_0x4d3336(0x108)]||!_0x411c31[_0x4d3336(0x108)][_0x43de6f])throw new Error(_0x4d3336(0xde)+_0x43de6f+_0x4d3336(0x113));delete _0x411c31[_0x4d3336(0x108)][_0x43de6f],_0x411c31[_0x4d3336(0xd7)]===_0x43de6f&&delete _0x411c31[_0x4d3336(0xd7)],writeSecureFile(_0x515d2d,JSON[_0x4d3336(0xfa)](_0x411c31,null,0x2));}export function getActiveProfile(){const _0x33d5ff=a51_0x7ce1d9,_0x2fd38c=loadSessionContext();if(_0x2fd38c?.[_0x33d5ff(0xd7)])return _0x2fd38c[_0x33d5ff(0xd7)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x54495c=getGlobalConfigPath();if(!a51_0x445d07[_0x33d5ff(0x10f)](_0x54495c))return null;try{const _0x1f7352=a51_0x445d07[_0x33d5ff(0xc8)](_0x54495c,'utf-8'),_0x4e8471=JSON[_0x33d5ff(0xea)](_0x1f7352);return _0x4e8471[_0x33d5ff(0xd7)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x552143){const _0x3a3dbe=a51_0x7ce1d9,_0x52f3ef=getGlobalConfigPath(),_0x9b07fd=getConfigDir();!a51_0x445d07[_0x3a3dbe(0x10f)](_0x9b07fd)&&createSecureDirectory(_0x9b07fd);let _0x103ba2={};if(a51_0x445d07[_0x3a3dbe(0x10f)](_0x52f3ef))try{const _0x7f2092=a51_0x445d07[_0x3a3dbe(0xc8)](_0x52f3ef,_0x3a3dbe(0xcb));_0x103ba2=JSON[_0x3a3dbe(0xea)](_0x7f2092);}catch{console[_0x3a3dbe(0xca)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x52f3ef+_0x3a3dbe(0xdf));}_0x103ba2[_0x3a3dbe(0xd6)]=_0x552143,writeSecureFile(_0x52f3ef,JSON[_0x3a3dbe(0xfa)](_0x103ba2,null,0x2));}export function saveActiveProfileToUserConfig(_0x2c7f05){const _0x40f310=a51_0x7ce1d9;validateProfileName(_0x2c7f05);const _0x3b0efe=getGlobalConfigPath(),_0x4d4e17=getConfigDir();!a51_0x445d07[_0x40f310(0x10f)](_0x4d4e17)&&createSecureDirectory(_0x4d4e17);let _0x2876fa={};if(a51_0x445d07[_0x40f310(0x10f)](_0x3b0efe))try{const _0x38dc9e=a51_0x445d07[_0x40f310(0xc8)](_0x3b0efe,'utf-8');_0x2876fa=JSON['parse'](_0x38dc9e);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x3b0efe+',\x20creating\x20new\x20file');}_0x2876fa[_0x40f310(0xd7)]=_0x2c7f05,writeSecureFile(_0x3b0efe,JSON['stringify'](_0x2876fa,null,0x2));}function clearFieldFromUserConfig(_0x35e026){const _0x53f1e7=a51_0x7ce1d9,_0x12c088=getGlobalConfigPath();if(!a51_0x445d07[_0x53f1e7(0x10f)](_0x12c088))return;let _0x68aa0f={};try{const _0x45f995=a51_0x445d07[_0x53f1e7(0xc8)](_0x12c088,_0x53f1e7(0xcb));_0x68aa0f=JSON[_0x53f1e7(0xea)](_0x45f995);}catch{return;}delete _0x68aa0f[_0x35e026],writeSecureFile(_0x12c088,JSON[_0x53f1e7(0xfa)](_0x68aa0f,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0xd504f7=a51_0x7ce1d9;clearFieldFromUserConfig(_0xd504f7(0xd7));}export function createProfile(_0xbb6291,_0xaa47f6){const _0x20d94d=a51_0x7ce1d9;validateProfileName(_0xbb6291);if(profileExists(_0xbb6291))throw new Error('Profile\x20'+_0xbb6291+_0x20d94d(0x110));saveProfile(_0xbb6291,_0xaa47f6);}export function saveProfileCredentials(_0x206bc8,_0x9f55b9){const _0x1f0f68=a51_0x7ce1d9;validateProfileName(_0x206bc8);if(!profileExists(_0x206bc8))throw new Error(_0x1f0f68(0xf8)+_0x206bc8+_0x1f0f68(0xf6));const _0x3a562f=getNewCredentialPath(_0x206bc8);writeSecureFile(_0x3a562f,_0x9f55b9);}export function loadProfileCredentials(_0x23537e){const _0x940892=a51_0x7ce1d9;validateProfileName(_0x23537e);const _0x58ce87=getNewCredentialPath(_0x23537e);if(a51_0x445d07[_0x940892(0x10f)](_0x58ce87))try{return a51_0x445d07[_0x940892(0xc8)](_0x58ce87,_0x940892(0xcb));}catch{}const _0x3f1e1d=getOldCredentialPath(_0x23537e);if(a51_0x445d07['existsSync'](_0x3f1e1d)){console[_0x940892(0xca)](_0x940892(0xc7)+_0x23537e+'\x27'),console[_0x940892(0xca)](_0x940892(0xcd)),console[_0x940892(0xca)]('\x20\x20mv\x20\x22'+_0x3f1e1d+'\x22\x20\x22'+_0x58ce87+'\x22'),console[_0x940892(0xca)](_0x940892(0xd5));try{return a51_0x445d07[_0x940892(0xc8)](_0x3f1e1d,_0x940892(0xcb));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- (function(_0x6b69a2,_0x4d8d30){const _0xa0616f=a52_0x490d,_0x561f0d=_0x6b69a2();while(!![]){try{const _0x2489d4=parseInt(_0xa0616f(0x9d))/0x1*(parseInt(_0xa0616f(0x98))/0x2)+parseInt(_0xa0616f(0x88))/0x3+-parseInt(_0xa0616f(0x87))/0x4*(parseInt(_0xa0616f(0x8d))/0x5)+parseInt(_0xa0616f(0x8a))/0x6*(-parseInt(_0xa0616f(0x92))/0x7)+-parseInt(_0xa0616f(0x83))/0x8*(parseInt(_0xa0616f(0x8f))/0x9)+-parseInt(_0xa0616f(0x8b))/0xa+-parseInt(_0xa0616f(0x7e))/0xb*(-parseInt(_0xa0616f(0x8c))/0xc);if(_0x2489d4===_0x4d8d30)break;else _0x561f0d['push'](_0x561f0d['shift']());}catch(_0xb6dda4){_0x561f0d['push'](_0x561f0d['shift']());}}}(a52_0x18de,0xd9120));import*as a52_0x405552 from'node:fs';function a52_0x490d(_0x147d7c,_0x5b69d2){_0x147d7c=_0x147d7c-0x7e;const _0x18de2a=a52_0x18de();let _0x490dc7=_0x18de2a[_0x147d7c];return _0x490dc7;}import*as a52_0x4035a5 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x273a40){const _0x485e9d=a52_0x490d;let _0x4e2498=_0x273a40||process['cwd']();while(!![]){const _0x1cc1bf=a52_0x4035a5['join'](_0x4e2498,PROJECT_CONFIG_FILENAME);if(a52_0x405552['existsSync'](_0x1cc1bf))return _0x1cc1bf;const _0x50df44=a52_0x4035a5[_0x485e9d(0x9e)](_0x4e2498);if(_0x50df44===_0x4e2498)return null;_0x4e2498=_0x50df44;}}function a52_0x18de(){const _0x5c9ab0=['join','1HecdFA','dirname','ENOENT','includes','8371BcupMK','apiKey','stringify','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','Failed\x20to\x20load\x20project\x20config\x20from\x20','13177064lARFvC','readFileSync','TD_API_KEY','api_key','667868joJXpf','3959658fRVqEk','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','1536ykPvEI','10572200KYMPAI','26232tNZCys','10fgwfso','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','9uMxcTo','cwd','profile','19978DjqXLF','warn','\x20is\x20ignored.\x20','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8','code','3349198QYbJzp',').\x20','Warning:\x20\x27profile\x27\x20field\x20in\x20','writeFileSync'];a52_0x18de=function(){return _0x5c9ab0;};return a52_0x18de();}export function loadProjectConfig(_0x16cfaa){const _0x55bc98=a52_0x490d,_0x44bc8e=findProjectConfigPath(_0x16cfaa);if(!_0x44bc8e)return null;try{const _0x687918=a52_0x405552[_0x55bc98(0x84)](_0x44bc8e,_0x55bc98(0x96)),_0x109205=JSON['parse'](_0x687918),_0xe8242b=JSON[_0x55bc98(0x80)](_0x109205);if(_0xe8242b[_0x55bc98(0xa0)](_0x55bc98(0x85))||_0xe8242b[_0x55bc98(0xa0)](_0x55bc98(0x7f))||_0xe8242b[_0x55bc98(0xa0)](_0x55bc98(0x86)))throw new Error(_0x55bc98(0x95)+_0x44bc8e+_0x55bc98(0x99)+_0x55bc98(0x8e));const {metadata:_0x2f9112,profile:_0x33f1cc,..._0x597d93}=_0x109205;return _0x33f1cc&&console[_0x55bc98(0x93)](_0x55bc98(0x9a)+_0x44bc8e+_0x55bc98(0x94)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x597d93;}catch(_0x5a02a5){if(_0x5a02a5 instanceof Error&&_0x55bc98(0x97)in _0x5a02a5&&_0x5a02a5['code']===_0x55bc98(0x9f))return null;throw new Error(_0x55bc98(0x82)+_0x44bc8e+':\x20'+_0x5a02a5);}}export function saveProjectConfig(_0x3bbd49,_0xbbe405){const _0xe30612=a52_0x490d,_0x1cb437=_0xbbe405||process[_0xe30612(0x90)](),_0x1c0958=a52_0x4035a5[_0xe30612(0x9c)](_0x1cb437,PROJECT_CONFIG_FILENAME),_0x4922ad=JSON[_0xe30612(0x80)](_0x3bbd49);if(_0x4922ad['includes']('TD_API_KEY')||_0x4922ad[_0xe30612(0xa0)](_0xe30612(0x7f))||_0x4922ad['includes'](_0xe30612(0x86)))throw new Error(_0xe30612(0x81));if(_0xe30612(0x91)in _0x3bbd49)throw new Error(_0xe30612(0x89));a52_0x405552[_0xe30612(0x9b)](_0x1c0958,JSON['stringify'](_0x3bbd49,null,0x2));}export function hasProjectConfig(_0x699512){return findProjectConfigPath(_0x699512)!==null;}export function getProjectRoot(_0x510432){const _0x24f535=a52_0x490d,_0x4a86dd=findProjectConfigPath(_0x510432);return _0x4a86dd?a52_0x4035a5[_0x24f535(0x9e)](_0x4a86dd):null;}
1
+ const a52_0x5c2002=a52_0xe4e5;(function(_0x56f365,_0x1679a7){const _0x442628=a52_0xe4e5,_0x1ac145=_0x56f365();while(!![]){try{const _0x5a36ed=parseInt(_0x442628(0x197))/0x1*(parseInt(_0x442628(0x195))/0x2)+parseInt(_0x442628(0x190))/0x3+parseInt(_0x442628(0x182))/0x4*(parseInt(_0x442628(0x17b))/0x5)+parseInt(_0x442628(0x18d))/0x6*(-parseInt(_0x442628(0x17f))/0x7)+-parseInt(_0x442628(0x18a))/0x8+parseInt(_0x442628(0x184))/0x9+-parseInt(_0x442628(0x183))/0xa;if(_0x5a36ed===_0x1679a7)break;else _0x1ac145['push'](_0x1ac145['shift']());}catch(_0x22e576){_0x1ac145['push'](_0x1ac145['shift']());}}}(a52_0x4aa2,0xa4708));function a52_0x4aa2(){const _0x31847e=['Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','56xSTZGw','apiKey','parse','371068cXwddq','19096650MygDHi','4015494OozVRR','ENOENT',').\x20','existsSync','writeFileSync','TD_API_KEY','999792ZbrmDx','warn','tdx.json','898152PxheEO','code','api_key','3210909iaSmoX','join','\x20is\x20ignored.\x20','Warning:\x20\x27profile\x27\x20field\x20in\x20','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','96DeYqRE','includes','22719LnyOTq','dirname','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','readFileSync','70GbbAHU','cwd','stringify'];a52_0x4aa2=function(){return _0x31847e;};return a52_0x4aa2();}import*as a52_0x47f029 from'node:fs';import*as a52_0x13e824 from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x5c2002(0x18c);export function findProjectConfigPath(_0x583bc0){const _0x4b1bc2=a52_0x5c2002;let _0x450ada=_0x583bc0||process[_0x4b1bc2(0x17c)]();while(!![]){const _0xa9f2fd=a52_0x13e824[_0x4b1bc2(0x191)](_0x450ada,PROJECT_CONFIG_FILENAME);if(a52_0x47f029[_0x4b1bc2(0x187)](_0xa9f2fd))return _0xa9f2fd;const _0x4b8ca7=a52_0x13e824[_0x4b1bc2(0x178)](_0x450ada);if(_0x4b8ca7===_0x450ada)return null;_0x450ada=_0x4b8ca7;}}export function loadProjectConfig(_0x3c56a1){const _0x1b16fb=a52_0x5c2002,_0x46f368=findProjectConfigPath(_0x3c56a1);if(!_0x46f368)return null;try{const _0x16f9df=a52_0x47f029[_0x1b16fb(0x17a)](_0x46f368,'utf-8'),_0x955e80=JSON[_0x1b16fb(0x181)](_0x16f9df),_0x4db6c3=JSON[_0x1b16fb(0x17d)](_0x955e80);if(_0x4db6c3['includes'](_0x1b16fb(0x189))||_0x4db6c3[_0x1b16fb(0x196)]('apiKey')||_0x4db6c3[_0x1b16fb(0x196)](_0x1b16fb(0x18f)))throw new Error(_0x1b16fb(0x17e)+_0x46f368+_0x1b16fb(0x186)+_0x1b16fb(0x179));const {metadata:_0x85539e,profile:_0x5dced8,..._0x197c57}=_0x955e80;return _0x5dced8&&console[_0x1b16fb(0x18b)](_0x1b16fb(0x193)+_0x46f368+_0x1b16fb(0x192)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x197c57;}catch(_0x43559a){if(_0x43559a instanceof Error&&_0x1b16fb(0x18e)in _0x43559a&&_0x43559a[_0x1b16fb(0x18e)]===_0x1b16fb(0x185))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x46f368+':\x20'+_0x43559a);}}function a52_0xe4e5(_0x10700c,_0x12d9e4){_0x10700c=_0x10700c-0x178;const _0x4aa2f4=a52_0x4aa2();let _0xe4e5b4=_0x4aa2f4[_0x10700c];return _0xe4e5b4;}export function saveProjectConfig(_0x2021e9,_0x1cbb48){const _0x2d6e28=a52_0x5c2002,_0x11b33e=_0x1cbb48||process['cwd'](),_0x54d9fe=a52_0x13e824['join'](_0x11b33e,PROJECT_CONFIG_FILENAME),_0x46a386=JSON['stringify'](_0x2021e9);if(_0x46a386['includes'](_0x2d6e28(0x189))||_0x46a386['includes'](_0x2d6e28(0x180))||_0x46a386[_0x2d6e28(0x196)]('api_key'))throw new Error(_0x2d6e28(0x194));if('profile'in _0x2021e9)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a52_0x47f029[_0x2d6e28(0x188)](_0x54d9fe,JSON['stringify'](_0x2021e9,null,0x2));}export function hasProjectConfig(_0x4cbe06){return findProjectConfigPath(_0x4cbe06)!==null;}export function getProjectRoot(_0x347dee){const _0x3807d5=a52_0x5c2002,_0x13e4c0=findProjectConfigPath(_0x347dee);return _0x13e4c0?a52_0x13e824[_0x3807d5(0x178)](_0x13e4c0):null;}
@@ -1 +1 @@
1
- (function(_0x5123b2,_0x4a62f4){const _0x60813d=a53_0x3f38,_0x3fdb2b=_0x5123b2();while(!![]){try{const _0x3061a6=parseInt(_0x60813d(0x136))/0x1+-parseInt(_0x60813d(0x152))/0x2*(-parseInt(_0x60813d(0x15c))/0x3)+-parseInt(_0x60813d(0x153))/0x4*(-parseInt(_0x60813d(0x15b))/0x5)+-parseInt(_0x60813d(0x145))/0x6*(parseInt(_0x60813d(0x13c))/0x7)+-parseInt(_0x60813d(0x157))/0x8+-parseInt(_0x60813d(0x138))/0x9+parseInt(_0x60813d(0x155))/0xa*(parseInt(_0x60813d(0x15a))/0xb);if(_0x3061a6===_0x4a62f4)break;else _0x3fdb2b['push'](_0x3fdb2b['shift']());}catch(_0x1ddc94){_0x3fdb2b['push'](_0x3fdb2b['shift']());}}}(a53_0x3b2f,0x74f1f));import*as a53_0x684bca from'node:fs';import*as a53_0x1ba34b from'node:path';import*as a53_0x2e7b26 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x427d3e=a53_0x3f38,_0x235f6f=process.env.TDX_CONFIG_DIR||a53_0x1ba34b[_0x427d3e(0x137)](a53_0x2e7b26[_0x427d3e(0x151)](),_0x427d3e(0x159),_0x427d3e(0x14f));return a53_0x1ba34b[_0x427d3e(0x137)](_0x235f6f,_0x427d3e(0x13d));}function getSessionPath(_0x2adef2){const _0x325ce6=a53_0x3f38;return a53_0x1ba34b[_0x325ce6(0x137)](getSessionsDir(),_0x2adef2+_0x325ce6(0x135));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x12cc7e){const _0x12dc35=a53_0x3f38;if(_0x12cc7e)return _0x12cc7e;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x12dc35(0x140)]();}function a53_0x3f38(_0x34acb1,_0x14c3ef){_0x34acb1=_0x34acb1-0x134;const _0x3b2f7e=a53_0x3b2f();let _0x3f3899=_0x3b2f7e[_0x34acb1];return _0x3f3899;}export function loadSessionContext(_0x3d85f8){const _0x3e543b=getSessionID(_0x3d85f8),_0x1818a7=/^\d+$/['test'](_0x3e543b)?parseInt(_0x3e543b,0xa):null;return _0x1818a7!==null?loadSessionContextByPID(_0x1818a7):loadSessionContextByString(_0x3e543b);}function a53_0x3b2f(){const _0xc7201c=['TD_API_KEY','warn','writeFileSync','tdx','readFileSync','homedir','1066022Ceehto','575032RmSoVA','createdAt','190DMlEPh','parse','3776480MktbiM','push','.config','169433XWHSqw','5VKDcRw','3NsUUzx','unlinkSync','getTime','.json','596358MValld','join','5152338LluTxY','.\x20This\x20is\x20insecure.\x20Removing\x20session.','api_key','test','7aaScJk','sessions','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','now','toString','toISOString','utf-8','includes','existsSync','253410mdyylU','stringify','sort','replace','endsWith','apiKey','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'];a53_0x3b2f=function(){return _0xc7201c;};return a53_0x3b2f();}export function loadSessionContextByPID(_0x4cdb02){const _0x1efa08=a53_0x3f38,_0x317e16=getSessionPath(_0x4cdb02);if(!a53_0x684bca['existsSync'](_0x317e16))return null;try{const _0x5dfba4=a53_0x684bca['readFileSync'](_0x317e16,_0x1efa08(0x142)),_0x169329=JSON['parse'](_0x5dfba4),_0x124dd8=new Date(_0x169329[_0x1efa08(0x154)])['getTime'](),_0xeff228=Date[_0x1efa08(0x13f)]();if(_0xeff228-_0x124dd8>SESSION_EXPIRATION_MS)return a53_0x684bca[_0x1efa08(0x15d)](_0x317e16),null;const _0x21c453=JSON[_0x1efa08(0x146)](_0x169329);if(_0x21c453[_0x1efa08(0x143)]('TD_API_KEY')||_0x21c453[_0x1efa08(0x143)]('apiKey')||_0x21c453[_0x1efa08(0x143)](_0x1efa08(0x13a)))return console[_0x1efa08(0x14d)](_0x1efa08(0x14b)+_0x317e16+_0x1efa08(0x139)),a53_0x684bca[_0x1efa08(0x15d)](_0x317e16),null;return _0x169329;}catch{try{a53_0x684bca[_0x1efa08(0x15d)](_0x317e16);}catch{}return null;}}function loadSessionContextByString(_0x242dca){const _0x4f0337=a53_0x3f38,_0x294547=a53_0x1ba34b['join'](getSessionsDir(),_0x242dca+'.json');if(!a53_0x684bca[_0x4f0337(0x144)](_0x294547))return null;try{const _0x434dbd=a53_0x684bca[_0x4f0337(0x150)](_0x294547,_0x4f0337(0x142)),_0x33c1cb=JSON['parse'](_0x434dbd),_0x153476=new Date(_0x33c1cb[_0x4f0337(0x154)])[_0x4f0337(0x134)](),_0x41269f=Date[_0x4f0337(0x13f)]();if(_0x41269f-_0x153476>SESSION_EXPIRATION_MS)return a53_0x684bca[_0x4f0337(0x15d)](_0x294547),null;const _0x5b9b90=JSON[_0x4f0337(0x146)](_0x33c1cb);if(_0x5b9b90[_0x4f0337(0x143)](_0x4f0337(0x14c))||_0x5b9b90[_0x4f0337(0x143)](_0x4f0337(0x14a))||_0x5b9b90[_0x4f0337(0x143)](_0x4f0337(0x13a)))return console['warn'](_0x4f0337(0x14b)+_0x294547+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a53_0x684bca[_0x4f0337(0x15d)](_0x294547),null;return _0x33c1cb;}catch{try{a53_0x684bca[_0x4f0337(0x15d)](_0x294547);}catch{}return null;}}export function saveSessionContext(_0x3a6a8a,_0x462ea3){const _0x346d5a=a53_0x3f38,_0x54eeb9=getSessionID(_0x462ea3),_0xc48fbe=/^\d+$/[_0x346d5a(0x13b)](_0x54eeb9)?parseInt(_0x54eeb9,0xa):getCurrentSessionPID(),_0x184f88=a53_0x1ba34b['join'](getSessionsDir(),_0x54eeb9+'.json'),_0x3dabae=getSessionsDir();createSecureDirectory(_0x3dabae);const _0xbb14b=JSON['stringify'](_0x3a6a8a);if(_0xbb14b[_0x346d5a(0x143)](_0x346d5a(0x14c))||_0xbb14b[_0x346d5a(0x143)]('apiKey')||_0xbb14b[_0x346d5a(0x143)](_0x346d5a(0x13a)))throw new Error(_0x346d5a(0x13e));let _0x15ada9;const _0x1a0988=/^\d+$/['test'](_0x54eeb9)?loadSessionContextByPID(parseInt(_0x54eeb9,0xa)):loadSessionContextByString(_0x54eeb9);_0x1a0988?_0x15ada9={..._0x1a0988,..._0x3a6a8a,'pid':_0xc48fbe,'sessionId':_0x54eeb9!==_0xc48fbe['toString']()?_0x54eeb9:undefined,'updatedAt':new Date()[_0x346d5a(0x141)]()}:_0x15ada9={'pid':_0xc48fbe,'sessionId':_0x54eeb9!==_0xc48fbe[_0x346d5a(0x140)]()?_0x54eeb9:undefined,..._0x3a6a8a,'createdAt':new Date()[_0x346d5a(0x141)](),'updatedAt':new Date()[_0x346d5a(0x141)]()},a53_0x684bca[_0x346d5a(0x14e)](_0x184f88,JSON['stringify'](_0x15ada9,null,0x2));}export function clearSessionContext(_0x42ce0f){const _0x29f847=a53_0x3f38,_0x2d7768=getSessionID(_0x42ce0f),_0x170ccf=a53_0x1ba34b['join'](getSessionsDir(),_0x2d7768+_0x29f847(0x135));a53_0x684bca['existsSync'](_0x170ccf)&&a53_0x684bca[_0x29f847(0x15d)](_0x170ccf);}export function clearSessionContextField(_0xb8fde0,_0x42a01a){const _0x1168e3=a53_0x3f38,_0x3b66b0=getSessionID(_0x42a01a),_0x33b453=a53_0x1ba34b['join'](getSessionsDir(),_0x3b66b0+_0x1168e3(0x135));if(!a53_0x684bca[_0x1168e3(0x144)](_0x33b453))return;try{const _0x299ed9=a53_0x684bca[_0x1168e3(0x150)](_0x33b453,_0x1168e3(0x142)),_0x5528b4=JSON[_0x1168e3(0x156)](_0x299ed9);delete _0x5528b4[_0xb8fde0],a53_0x684bca[_0x1168e3(0x14e)](_0x33b453,JSON[_0x1168e3(0x146)](_0x5528b4,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x566625=a53_0x3f38,_0x5be8e7=getSessionsDir();if(!a53_0x684bca[_0x566625(0x144)](_0x5be8e7))return 0x0;let _0x2b9461=0x0;const _0x1660a7=Date[_0x566625(0x13f)]();try{const _0x34a227=a53_0x684bca['readdirSync'](_0x5be8e7);for(const _0x6c55ee of _0x34a227){if(!_0x6c55ee[_0x566625(0x149)](_0x566625(0x135)))continue;const _0x3cc621=a53_0x1ba34b['join'](_0x5be8e7,_0x6c55ee),_0x26b5c9=_0x6c55ee[_0x566625(0x148)](_0x566625(0x135),''),_0x173222=parseInt(_0x26b5c9,0xa),_0x3000df=!isNaN(_0x173222);if(_0x3000df){if(!isProcessRunning(_0x173222)){a53_0x684bca[_0x566625(0x15d)](_0x3cc621),_0x2b9461++;continue;}}try{const _0x4e698c=a53_0x684bca[_0x566625(0x150)](_0x3cc621,_0x566625(0x142)),_0x159379=JSON[_0x566625(0x156)](_0x4e698c),_0x4566eb=new Date(_0x159379[_0x566625(0x154)])['getTime']();_0x1660a7-_0x4566eb>SESSION_EXPIRATION_MS&&(a53_0x684bca[_0x566625(0x15d)](_0x3cc621),_0x2b9461++);}catch{a53_0x684bca[_0x566625(0x15d)](_0x3cc621),_0x2b9461++;}}}catch{}return _0x2b9461;}export function listActiveSessions(){const _0x2ae19f=a53_0x3f38,_0x371217=getSessionsDir();if(!a53_0x684bca[_0x2ae19f(0x144)](_0x371217))return[];try{const _0x533946=a53_0x684bca['readdirSync'](_0x371217),_0x33d1da=[];for(const _0x1653e5 of _0x533946){if(!_0x1653e5[_0x2ae19f(0x149)](_0x2ae19f(0x135)))continue;const _0xe4fea7=_0x1653e5[_0x2ae19f(0x148)](_0x2ae19f(0x135),''),_0x3fee30=parseInt(_0xe4fea7,0xa);!isNaN(_0x3fee30)&&isProcessRunning(_0x3fee30)&&_0x33d1da[_0x2ae19f(0x158)](_0x3fee30);}return _0x33d1da[_0x2ae19f(0x147)]((_0x4e417a,_0xdb2fd5)=>_0x4e417a-_0xdb2fd5);}catch{return[];}}
1
+ (function(_0xf3a1ee,_0x5b9ce0){const _0x6b81b4=a53_0x4afd,_0x643993=_0xf3a1ee();while(!![]){try{const _0x3cf08f=parseInt(_0x6b81b4(0x176))/0x1+parseInt(_0x6b81b4(0x16f))/0x2+parseInt(_0x6b81b4(0x17c))/0x3*(-parseInt(_0x6b81b4(0x17d))/0x4)+parseInt(_0x6b81b4(0x167))/0x5*(-parseInt(_0x6b81b4(0x161))/0x6)+parseInt(_0x6b81b4(0x16e))/0x7+parseInt(_0x6b81b4(0x189))/0x8*(-parseInt(_0x6b81b4(0x16b))/0x9)+-parseInt(_0x6b81b4(0x17e))/0xa*(-parseInt(_0x6b81b4(0x18a))/0xb);if(_0x3cf08f===_0x5b9ce0)break;else _0x643993['push'](_0x643993['shift']());}catch(_0x56cca7){_0x643993['push'](_0x643993['shift']());}}}(a53_0x55f6,0xe6085));import*as a53_0x4b4f79 from'node:fs';import*as a53_0x42fad2 from'node:path';import*as a53_0x4a7c8d from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x3f37ef=a53_0x4afd,_0x37781c=process.env.TDX_CONFIG_DIR||a53_0x42fad2[_0x3f37ef(0x16c)](a53_0x4a7c8d[_0x3f37ef(0x185)](),_0x3f37ef(0x184),_0x3f37ef(0x170));return a53_0x42fad2[_0x3f37ef(0x16c)](_0x37781c,_0x3f37ef(0x17a));}function getSessionPath(_0x5df8ea){const _0x492e47=a53_0x4afd;return a53_0x42fad2[_0x492e47(0x16c)](getSessionsDir(),_0x5df8ea+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x142b1b){if(_0x142b1b)return _0x142b1b;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x3403a0){const _0x45e466=a53_0x4afd,_0x5c320d=getSessionID(_0x3403a0),_0x28cc90=/^\d+$/[_0x45e466(0x165)](_0x5c320d)?parseInt(_0x5c320d,0xa):null;return _0x28cc90!==null?loadSessionContextByPID(_0x28cc90):loadSessionContextByString(_0x5c320d);}export function loadSessionContextByPID(_0x3ce94e){const _0x39c240=a53_0x4afd,_0xf92b74=getSessionPath(_0x3ce94e);if(!a53_0x4b4f79['existsSync'](_0xf92b74))return null;try{const _0x28d6db=a53_0x4b4f79[_0x39c240(0x171)](_0xf92b74,_0x39c240(0x166)),_0x2c8b67=JSON['parse'](_0x28d6db),_0x134a54=new Date(_0x2c8b67['createdAt'])[_0x39c240(0x174)](),_0x39549c=Date[_0x39c240(0x177)]();if(_0x39549c-_0x134a54>SESSION_EXPIRATION_MS)return a53_0x4b4f79[_0x39c240(0x164)](_0xf92b74),null;const _0x137ca3=JSON[_0x39c240(0x162)](_0x2c8b67);if(_0x137ca3[_0x39c240(0x180)]('TD_API_KEY')||_0x137ca3[_0x39c240(0x180)](_0x39c240(0x17f))||_0x137ca3[_0x39c240(0x180)]('api_key'))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0xf92b74+_0x39c240(0x168)),a53_0x4b4f79[_0x39c240(0x164)](_0xf92b74),null;return _0x2c8b67;}catch{try{a53_0x4b4f79['unlinkSync'](_0xf92b74);}catch{}return null;}}function loadSessionContextByString(_0x677fd7){const _0x3949f7=a53_0x4afd,_0x5c0ae9=a53_0x42fad2['join'](getSessionsDir(),_0x677fd7+_0x3949f7(0x172));if(!a53_0x4b4f79[_0x3949f7(0x188)](_0x5c0ae9))return null;try{const _0x1d16c2=a53_0x4b4f79[_0x3949f7(0x171)](_0x5c0ae9,_0x3949f7(0x166)),_0x46942f=JSON['parse'](_0x1d16c2),_0x35c48c=new Date(_0x46942f['createdAt'])[_0x3949f7(0x174)](),_0x201155=Date['now']();if(_0x201155-_0x35c48c>SESSION_EXPIRATION_MS)return a53_0x4b4f79[_0x3949f7(0x164)](_0x5c0ae9),null;const _0x303696=JSON[_0x3949f7(0x162)](_0x46942f);if(_0x303696['includes'](_0x3949f7(0x183))||_0x303696[_0x3949f7(0x180)](_0x3949f7(0x17f))||_0x303696[_0x3949f7(0x180)](_0x3949f7(0x16a)))return console[_0x3949f7(0x169)](_0x3949f7(0x179)+_0x5c0ae9+_0x3949f7(0x168)),a53_0x4b4f79['unlinkSync'](_0x5c0ae9),null;return _0x46942f;}catch{try{a53_0x4b4f79[_0x3949f7(0x164)](_0x5c0ae9);}catch{}return null;}}export function saveSessionContext(_0x237f1b,_0x2e82aa){const _0x3dc82c=a53_0x4afd,_0x5d5796=getSessionID(_0x2e82aa),_0x35abe6=/^\d+$/['test'](_0x5d5796)?parseInt(_0x5d5796,0xa):getCurrentSessionPID(),_0x2e765c=a53_0x42fad2[_0x3dc82c(0x16c)](getSessionsDir(),_0x5d5796+_0x3dc82c(0x172)),_0x3c22d2=getSessionsDir();createSecureDirectory(_0x3c22d2);const _0x2ad5c5=JSON[_0x3dc82c(0x162)](_0x237f1b);if(_0x2ad5c5[_0x3dc82c(0x180)]('TD_API_KEY')||_0x2ad5c5['includes'](_0x3dc82c(0x17f))||_0x2ad5c5['includes'](_0x3dc82c(0x16a)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x3ec5b4;const _0x50b538=/^\d+$/['test'](_0x5d5796)?loadSessionContextByPID(parseInt(_0x5d5796,0xa)):loadSessionContextByString(_0x5d5796);_0x50b538?_0x3ec5b4={..._0x50b538,..._0x237f1b,'pid':_0x35abe6,'sessionId':_0x5d5796!==_0x35abe6[_0x3dc82c(0x175)]()?_0x5d5796:undefined,'updatedAt':new Date()['toISOString']()}:_0x3ec5b4={'pid':_0x35abe6,'sessionId':_0x5d5796!==_0x35abe6[_0x3dc82c(0x175)]()?_0x5d5796:undefined,..._0x237f1b,'createdAt':new Date()[_0x3dc82c(0x182)](),'updatedAt':new Date()[_0x3dc82c(0x182)]()},a53_0x4b4f79[_0x3dc82c(0x186)](_0x2e765c,JSON['stringify'](_0x3ec5b4,null,0x2));}function a53_0x4afd(_0x565802,_0x350dc3){_0x565802=_0x565802-0x161;const _0x55f6e8=a53_0x55f6();let _0x4afdeb=_0x55f6e8[_0x565802];return _0x4afdeb;}function a53_0x55f6(){const _0x3d12e5=['homedir','writeFileSync','createdAt','existsSync','94928aDBNZE','2651yEyHHv','78FBegiJ','stringify','sort','unlinkSync','test','utf-8','353735itrHxx','.\x20This\x20is\x20insecure.\x20Removing\x20session.','warn','api_key','1377AnefLt','join','replace','7473256DvNDOG','3750118rjYsGZ','tdx','readFileSync','.json','parse','getTime','toString','80359SOImyx','now','readdirSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','sessions','endsWith','36jYMuMl','522220XvBCug','92160ISRmBE','apiKey','includes','push','toISOString','TD_API_KEY','.config'];a53_0x55f6=function(){return _0x3d12e5;};return a53_0x55f6();}export function clearSessionContext(_0x303727){const _0x267bbb=a53_0x4afd,_0x2b66c9=getSessionID(_0x303727),_0x25086e=a53_0x42fad2[_0x267bbb(0x16c)](getSessionsDir(),_0x2b66c9+_0x267bbb(0x172));a53_0x4b4f79[_0x267bbb(0x188)](_0x25086e)&&a53_0x4b4f79['unlinkSync'](_0x25086e);}export function clearSessionContextField(_0x3d5a27,_0x53fd89){const _0x442afa=a53_0x4afd,_0x29e777=getSessionID(_0x53fd89),_0x4292df=a53_0x42fad2[_0x442afa(0x16c)](getSessionsDir(),_0x29e777+_0x442afa(0x172));if(!a53_0x4b4f79[_0x442afa(0x188)](_0x4292df))return;try{const _0x219e9b=a53_0x4b4f79[_0x442afa(0x171)](_0x4292df,'utf-8'),_0x22e095=JSON[_0x442afa(0x173)](_0x219e9b);delete _0x22e095[_0x3d5a27],a53_0x4b4f79[_0x442afa(0x186)](_0x4292df,JSON['stringify'](_0x22e095,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x10fbed=a53_0x4afd,_0x309bbd=getSessionsDir();if(!a53_0x4b4f79[_0x10fbed(0x188)](_0x309bbd))return 0x0;let _0x3bbbe7=0x0;const _0x3c53bb=Date['now']();try{const _0x2dba57=a53_0x4b4f79[_0x10fbed(0x178)](_0x309bbd);for(const _0x2beb73 of _0x2dba57){if(!_0x2beb73[_0x10fbed(0x17b)](_0x10fbed(0x172)))continue;const _0x1ecdc1=a53_0x42fad2['join'](_0x309bbd,_0x2beb73),_0x2157e6=_0x2beb73[_0x10fbed(0x16d)]('.json',''),_0x2ed5af=parseInt(_0x2157e6,0xa),_0x5a8dbd=!isNaN(_0x2ed5af);if(_0x5a8dbd){if(!isProcessRunning(_0x2ed5af)){a53_0x4b4f79[_0x10fbed(0x164)](_0x1ecdc1),_0x3bbbe7++;continue;}}try{const _0xc5fc6=a53_0x4b4f79[_0x10fbed(0x171)](_0x1ecdc1,'utf-8'),_0x163b4f=JSON[_0x10fbed(0x173)](_0xc5fc6),_0x44e67d=new Date(_0x163b4f[_0x10fbed(0x187)])[_0x10fbed(0x174)]();_0x3c53bb-_0x44e67d>SESSION_EXPIRATION_MS&&(a53_0x4b4f79['unlinkSync'](_0x1ecdc1),_0x3bbbe7++);}catch{a53_0x4b4f79['unlinkSync'](_0x1ecdc1),_0x3bbbe7++;}}}catch{}return _0x3bbbe7;}export function listActiveSessions(){const _0x6a031f=a53_0x4afd,_0x297b2d=getSessionsDir();if(!a53_0x4b4f79['existsSync'](_0x297b2d))return[];try{const _0x2fcdbb=a53_0x4b4f79[_0x6a031f(0x178)](_0x297b2d),_0x5d3ab0=[];for(const _0x4b8eb8 of _0x2fcdbb){if(!_0x4b8eb8[_0x6a031f(0x17b)](_0x6a031f(0x172)))continue;const _0x25cd12=_0x4b8eb8['replace'](_0x6a031f(0x172),''),_0x5bc567=parseInt(_0x25cd12,0xa);!isNaN(_0x5bc567)&&isProcessRunning(_0x5bc567)&&_0x5d3ab0[_0x6a031f(0x181)](_0x5bc567);}return _0x5d3ab0[_0x6a031f(0x163)]((_0x3d1d3d,_0x4e2f55)=>_0x3d1d3d-_0x4e2f55);}catch{return[];}}
@@ -1 +1 @@
1
- const a54_0x2ad628=a54_0x5f23;(function(_0x676fe2,_0x3496ff){const _0x17ea25=a54_0x5f23,_0x2c57ed=_0x676fe2();while(!![]){try{const _0x255c1a=-parseInt(_0x17ea25(0xd4))/0x1*(parseInt(_0x17ea25(0xd6))/0x2)+-parseInt(_0x17ea25(0xdb))/0x3*(-parseInt(_0x17ea25(0xe0))/0x4)+-parseInt(_0x17ea25(0xdc))/0x5*(-parseInt(_0x17ea25(0xd2))/0x6)+-parseInt(_0x17ea25(0xd0))/0x7*(parseInt(_0x17ea25(0xd9))/0x8)+-parseInt(_0x17ea25(0xda))/0x9*(-parseInt(_0x17ea25(0xdd))/0xa)+-parseInt(_0x17ea25(0xd8))/0xb+parseInt(_0x17ea25(0xd3))/0xc;if(_0x255c1a===_0x3496ff)break;else _0x2c57ed['push'](_0x2c57ed['shift']());}catch(_0x257a47){_0x2c57ed['push'](_0x2c57ed['shift']());}}}(a54_0x5b10,0x8ba0e));function a54_0x5f23(_0x2cfd02,_0x3a537a){_0x2cfd02=_0x2cfd02-0xd0;const _0x5b10e9=a54_0x5b10();let _0x5f23ad=_0x5b10e9[_0x2cfd02];return _0x5f23ad;}function a54_0x5b10(){const _0x5ab83c=['96740fFNZkD','users','core/user-cache','2232472nWcDlM','1926589noUUCu','clear','56796zYilPR','18174504sYhLwU','1EvgOOW','write','2193182TIgDYn','users-{profile}.json','7976100foqiea','24HLHmxq','873bvlsNE','3cWLEHb','110gjEyYW'];a54_0x5b10=function(){return _0x5ab83c;};return a54_0x5b10();}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0x2ad628(0xd7),a54_0x2ad628(0xdf));export function loadCachedUsers(_0x44f684){const _0x8c2391=a54_0x2ad628,_0x5f4bdf=userCache['read'](_0x44f684);return _0x5f4bdf?.[_0x8c2391(0xde)]??null;}export function saveCachedUsers(_0x165018,_0x3421b2){const _0xa96b28=a54_0x2ad628;userCache[_0xa96b28(0xd5)](_0x165018,{'users':_0x3421b2,'cachedAt':Date['now']()});}export function clearUserCache(_0x507ed3){const _0x4cd48c=a54_0x2ad628;userCache[_0x4cd48c(0xd1)](_0x507ed3);}
1
+ const a54_0x2af161=a54_0x40b3;(function(_0x27b340,_0x586d24){const _0x841096=a54_0x40b3,_0x24a527=_0x27b340();while(!![]){try{const _0x1e82fd=parseInt(_0x841096(0x195))/0x1*(parseInt(_0x841096(0x18f))/0x2)+parseInt(_0x841096(0x193))/0x3*(parseInt(_0x841096(0x199))/0x4)+parseInt(_0x841096(0x19a))/0x5+-parseInt(_0x841096(0x18e))/0x6*(parseInt(_0x841096(0x192))/0x7)+-parseInt(_0x841096(0x190))/0x8+parseInt(_0x841096(0x18d))/0x9*(-parseInt(_0x841096(0x191))/0xa)+parseInt(_0x841096(0x198))/0xb;if(_0x1e82fd===_0x586d24)break;else _0x24a527['push'](_0x24a527['shift']());}catch(_0x24435f){_0x24a527['push'](_0x24a527['shift']());}}}(a54_0x13d7,0xd8562));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0x2af161(0x194),'core/user-cache');function a54_0x40b3(_0x583cc5,_0x20e3ea){_0x583cc5=_0x583cc5-0x18d;const _0x13d787=a54_0x13d7();let _0x40b388=_0x13d787[_0x583cc5];return _0x40b388;}function a54_0x13d7(){const _0x3c74ad=['users-{profile}.json','337202UUbmwn','write','clear','13706099iDRfRs','738600qrlVZt','6775795VWVDok','12635811FgRahR','1292922HXWaAc','8riuQRN','13769480uCClhB','10YMAGli','28BMGfRy','15PPeRfb'];a54_0x13d7=function(){return _0x3c74ad;};return a54_0x13d7();}export function loadCachedUsers(_0x39c4aa){const _0x45e75c=userCache['read'](_0x39c4aa);return _0x45e75c?.['users']??null;}export function saveCachedUsers(_0x2060d0,_0x22b0d8){const _0x574d1a=a54_0x2af161;userCache[_0x574d1a(0x196)](_0x2060d0,{'users':_0x22b0d8,'cachedAt':Date['now']()});}export function clearUserCache(_0x3b8488){const _0xf47c53=a54_0x2af161;userCache[_0xf47c53(0x197)](_0x3b8488);}
@@ -1 +1 @@
1
- (function(_0x46b136,_0xfae3fd){const _0x10f546=a55_0x13d2,_0x4abf83=_0x46b136();while(!![]){try{const _0x36969e=parseInt(_0x10f546(0xb2))/0x1*(parseInt(_0x10f546(0xc2))/0x2)+-parseInt(_0x10f546(0xbc))/0x3*(parseInt(_0x10f546(0xb6))/0x4)+parseInt(_0x10f546(0xbd))/0x5+parseInt(_0x10f546(0xc0))/0x6*(parseInt(_0x10f546(0xaf))/0x7)+-parseInt(_0x10f546(0xb7))/0x8+parseInt(_0x10f546(0xc1))/0x9*(-parseInt(_0x10f546(0xba))/0xa)+-parseInt(_0x10f546(0xb1))/0xb*(-parseInt(_0x10f546(0xb8))/0xc);if(_0x36969e===_0xfae3fd)break;else _0x4abf83['push'](_0x4abf83['shift']());}catch(_0x6b5679){_0x4abf83['push'](_0x4abf83['shift']());}}}(a55_0x3c4d,0x45fac));import{readFileSync}from'fs';import{fileURLToPath}from'url';function a55_0x3c4d(){const _0x1d9a69=['457992EeJnKi','parse','2110ksPYnh','../build-info.json','2694RlXzXF','1341185lmIgxx','../../package.json','.dev','11862hLBwOe','16083iayiwy','2OnmZJX','266qtjYhN','utf-8','165wZCliw','432931ihQxLI','includes','version','0.0.0','1552FzMaIU','2693336nJmbqJ'];a55_0x3c4d=function(){return _0x1d9a69;};return a55_0x3c4d();}import{dirname,join}from'path';function a55_0x13d2(_0x46f621,_0xfaf671){_0x46f621=_0x46f621-0xaf;const _0x3c4d3b=a55_0x3c4d();let _0x13d25d=_0x3c4d3b[_0x46f621];return _0x13d25d;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x4f12c9=a55_0x13d2;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x2890a9=fileURLToPath(import.meta.url),_0x2d3feb=dirname(_0x2890a9);try{const _0x2c134d=join(_0x2d3feb,_0x4f12c9(0xbb));cachedBuildInfo=JSON[_0x4f12c9(0xb9)](readFileSync(_0x2c134d,_0x4f12c9(0xb0)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x3e3c41=a55_0x13d2;if(cachedVersion!==null)return cachedVersion;const _0x561b17=fileURLToPath(import.meta.url),_0x4c40fd=dirname(_0x561b17),_0x1f7253=getBuildInfo();if(_0x1f7253[_0x3e3c41(0xb4)])return cachedVersion=_0x1f7253[_0x3e3c41(0xb4)],cachedVersion;try{const _0x5d7494=join(_0x4c40fd,_0x3e3c41(0xbe)),_0x5137e4=JSON[_0x3e3c41(0xb9)](readFileSync(_0x5d7494,_0x3e3c41(0xb0)));cachedVersion=_0x5137e4['version'];}catch{cachedVersion=_0x3e3c41(0xb5);}return cachedVersion;}export function isDevVersion(){const _0x3c3693=a55_0x13d2,_0x162fa5=getVersion();return _0x162fa5[_0x3c3693(0xb3)](_0x3c3693(0xbf))||_0x162fa5['includes']('-');}
1
+ (function(_0x1fc997,_0x1b3b11){const _0x28c118=a55_0x2a4e,_0x4aebde=_0x1fc997();while(!![]){try{const _0x378846=-parseInt(_0x28c118(0x98))/0x1+-parseInt(_0x28c118(0x95))/0x2+parseInt(_0x28c118(0x9a))/0x3+-parseInt(_0x28c118(0x8c))/0x4*(-parseInt(_0x28c118(0x94))/0x5)+parseInt(_0x28c118(0x96))/0x6*(-parseInt(_0x28c118(0x9b))/0x7)+parseInt(_0x28c118(0x8b))/0x8+-parseInt(_0x28c118(0x8d))/0x9*(-parseInt(_0x28c118(0x9c))/0xa);if(_0x378846===_0x1b3b11)break;else _0x4aebde['push'](_0x4aebde['shift']());}catch(_0x242309){_0x4aebde['push'](_0x4aebde['shift']());}}}(a55_0x4c7f,0xb7d7c));function a55_0x4c7f(){const _0x2d41f2=['includes','utf-8','../build-info.json','.dev','parse','265BCEDGo','1197608RpCpuz','12dfiyyw','../../package.json','1447015NHiUzb','0.0.0','3945270vJfuTh','1105573fmXqiI','10ORtKaC','2620968qOMLZs','34876zZPzvg','9089091mhONOE','version'];a55_0x4c7f=function(){return _0x2d41f2;};return a55_0x4c7f();}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a55_0x2a4e(_0x304307,_0x3286e3){_0x304307=_0x304307-0x8b;const _0x4c7f60=a55_0x4c7f();let _0x2a4e26=_0x4c7f60[_0x304307];return _0x2a4e26;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x15c6d0=a55_0x2a4e;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x2cc805=fileURLToPath(import.meta.url),_0x2aed1f=dirname(_0x2cc805);try{const _0x1d81f5=join(_0x2aed1f,_0x15c6d0(0x91));cachedBuildInfo=JSON[_0x15c6d0(0x93)](readFileSync(_0x1d81f5,_0x15c6d0(0x90)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0xaf3eb2=a55_0x2a4e;if(cachedVersion!==null)return cachedVersion;const _0x5995ae=fileURLToPath(import.meta.url),_0xb79b66=dirname(_0x5995ae),_0x379ebc=getBuildInfo();if(_0x379ebc[_0xaf3eb2(0x8e)])return cachedVersion=_0x379ebc['version'],cachedVersion;try{const _0xb17b88=join(_0xb79b66,_0xaf3eb2(0x97)),_0x154c13=JSON['parse'](readFileSync(_0xb17b88,_0xaf3eb2(0x90)));cachedVersion=_0x154c13[_0xaf3eb2(0x8e)];}catch{cachedVersion=_0xaf3eb2(0x99);}return cachedVersion;}export function isDevVersion(){const _0x3c5eb8=a55_0x2a4e,_0x54eca9=getVersion();return _0x54eca9[_0x3c5eb8(0x8f)](_0x3c5eb8(0x92))||_0x54eca9[_0x3c5eb8(0x8f)]('-');}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x4d4541,_0x54646b){var _0x5c3ad5=a56_0x13cb,_0x2959fd=_0x4d4541();while(!![]){try{var _0x5a8167=parseInt(_0x5c3ad5(0x1de))/0x1+-parseInt(_0x5c3ad5(0x1e4))/0x2*(-parseInt(_0x5c3ad5(0x1dd))/0x3)+-parseInt(_0x5c3ad5(0x1df))/0x4+-parseInt(_0x5c3ad5(0x1e0))/0x5+parseInt(_0x5c3ad5(0x1e2))/0x6+parseInt(_0x5c3ad5(0x1e3))/0x7*(parseInt(_0x5c3ad5(0x1e1))/0x8)+-parseInt(_0x5c3ad5(0x1e5))/0x9;if(_0x5a8167===_0x54646b)break;else _0x2959fd['push'](_0x2959fd['shift']());}catch(_0x1e09fd){_0x2959fd['push'](_0x2959fd['shift']());}}}(a56_0x11ce,0x33c1f));export*from'./sdk/types/index.js';export*from'./core/config.js';function a56_0x11ce(){var _0x3d4310=['849448ZXhdVK','108714sYXClg','21yVWLXb','128lLfitl','2185164inDQtf','15282wPzznq','320255kcqzqN','681204QkkEMB','1789185wXUyBJ'];a56_0x11ce=function(){return _0x3d4310;};return a56_0x11ce();}export*from'./core/auth.js';function a56_0x13cb(_0x306399,_0x5b9114){_0x306399=_0x306399-0x1dd;var _0x11ce7e=a56_0x11ce();var _0x13cb3f=_0x11ce7e[_0x306399];return _0x13cb3f;}export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x125508,_0x45bbaa){var _0x5b8b13=a56_0x5a4f,_0x28d0d8=_0x125508();while(!![]){try{var _0x3f087e=parseInt(_0x5b8b13(0x1a6))/0x1*(-parseInt(_0x5b8b13(0x1a4))/0x2)+parseInt(_0x5b8b13(0x1a5))/0x3*(-parseInt(_0x5b8b13(0x1a9))/0x4)+parseInt(_0x5b8b13(0x1a2))/0x5+parseInt(_0x5b8b13(0x1aa))/0x6*(parseInt(_0x5b8b13(0x1a8))/0x7)+parseInt(_0x5b8b13(0x1a3))/0x8+-parseInt(_0x5b8b13(0x1a7))/0x9+-parseInt(_0x5b8b13(0x1ab))/0xa*(-parseInt(_0x5b8b13(0x1ac))/0xb);if(_0x3f087e===_0x45bbaa)break;else _0x28d0d8['push'](_0x28d0d8['shift']());}catch(_0x17807d){_0x28d0d8['push'](_0x28d0d8['shift']());}}}(a56_0x3abc,0x54d2c));export*from'./sdk/types/index.js';export*from'./core/config.js';function a56_0x5a4f(_0x3298b9,_0x55b9f8){_0x3298b9=_0x3298b9-0x1a2;var _0x3abcf3=a56_0x3abc();var _0x5a4ff9=_0x3abcf3[_0x3298b9];return _0x5a4ff9;}export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';function a56_0x3abc(){var _0x28f917=['3BzZKIA','1IKEvAR','5502600lNDjkA','2989jLWThq','2232096cXbfWY','9576ZobSkW','10798670gTMllR','11cBLnpR','117630rwSzUo','2485296VqNZhZ','1157374NBMVXe'];a56_0x3abc=function(){return _0x28f917;};return a56_0x3abc();}
@@ -1 +1 @@
1
- (function(_0x3571cc,_0x5b356e){const _0x5959c6=a57_0x4ecb,_0x1da453=_0x3571cc();while(!![]){try{const _0x43a6d4=-parseInt(_0x5959c6(0x15a))/0x1+-parseInt(_0x5959c6(0x13a))/0x2+parseInt(_0x5959c6(0x15d))/0x3+parseInt(_0x5959c6(0x150))/0x4*(-parseInt(_0x5959c6(0x14d))/0x5)+parseInt(_0x5959c6(0x14c))/0x6+-parseInt(_0x5959c6(0x131))/0x7+-parseInt(_0x5959c6(0x13c))/0x8*(-parseInt(_0x5959c6(0x13d))/0x9);if(_0x43a6d4===_0x5b356e)break;else _0x1da453['push'](_0x1da453['shift']());}catch(_0x5e0b0e){_0x1da453['push'](_0x1da453['shift']());}}}(a57_0x9ca1,0x6c8bf));function a57_0x4ecb(_0x216813,_0x5bd371){_0x216813=_0x216813-0x131;const _0x9ca11c=a57_0x9ca1();let _0x4ecb1b=_0x9ca11c[_0x216813];return _0x4ecb1b;}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(_0x1720fb={}){const _0x49237c=a57_0x4ecb,_0x172ad4=new McpServer({'name':'tdx','version':'1.0.0'});return _0x172ad4['registerTool'](_0x49237c(0x136),{'description':_0x49237c(0x15b),'inputSchema':{'args':z[_0x49237c(0x133)](z[_0x49237c(0x147)]())[_0x49237c(0x14b)]('Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])')}},async({args:_0x431cd2})=>{const _0x400969=_0x49237c,_0x215890=await executeTdxRun({'args':_0x431cd2},_0x1720fb[_0x400969(0x146)]||{});return _0x215890[_0x400969(0x141)]?{'content':[{'type':'text','text':_0x215890[_0x400969(0x140)]||'Command\x20completed\x20successfully'}]}:{'content':[{'type':'text','text':_0x215890[_0x400969(0x137)]||_0x215890[_0x400969(0x140)]||_0x400969(0x153)}],'isError':!![]};}),_0x172ad4[_0x49237c(0x148)]('tdx_search',{'description':_0x49237c(0x158),'inputSchema':{'query':z['string']()['describe'](_0x49237c(0x151)),'category':z[_0x49237c(0x13e)]([_0x49237c(0x145),'CDP','AI',_0x49237c(0x156),_0x49237c(0x154)])[_0x49237c(0x159)]()[_0x49237c(0x14b)](_0x49237c(0x132))}},async({query:_0x10bc29,category:_0x2791c0})=>{const _0xed18a6=_0x49237c,_0x50f6df=searchCommands({'query':_0x10bc29,'category':_0x2791c0});if(_0x50f6df[_0xed18a6(0x155)]===0x0)return{'content':[{'type':_0xed18a6(0x15c),'text':_0xed18a6(0x139)+_0x10bc29+'\x22'}]};const _0x2f62fc=_0x50f6df['map'](_0x4cf088=>{const _0x3ff350=_0xed18a6,_0x428246=_0x4cf088[_0x3ff350(0x157)][_0x3ff350(0x14a)](_0x4b0938=>'\x20\x20'+_0x4b0938)[_0x3ff350(0x13b)]('\x0a');return'**'+_0x4cf088[_0x3ff350(0x144)]+_0x3ff350(0x135)+_0x4cf088[_0x3ff350(0x142)]+')\x0a'+_0x4cf088[_0x3ff350(0x138)]+'\x0a\x0aExamples:\x0a'+_0x428246;})[_0xed18a6(0x13b)](_0xed18a6(0x134));return{'content':[{'type':'text','text':_0x2f62fc}]};}),_0x172ad4;}function a57_0x9ca1(){const _0x4984b2=['144604iHvldm','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','once','Command\x20failed','Utilities','length','Context','examples','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.','optional','274678MqKEEE','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.','text','1073844ufESAo','4951877xPTsWt','Optional\x20filter\x20by\x20category','array','\x0a\x0a---\x0a\x0a','**\x20(','tdx_run','error','description','No\x20commands\x20found\x20matching\x20\x22','1673582uGpmrU','join','3480HxQykc','28395pzHTbM','enum','SIGINT','output','success','category','close','name','Data','env','string','registerTool','stdin','map','describe','4500120vEHmxl','30WtTECl','SIGTERM','connect'];a57_0x9ca1=function(){return _0x4984b2;};return a57_0x9ca1();}export async function startMCPServer(_0x38ba54={}){const _0xb63e65=a57_0x4ecb,_0x10188a=createMCPServer(_0x38ba54),_0x3528b1=new StdioServerTransport();return await _0x10188a[_0xb63e65(0x14f)](_0x3528b1),new Promise(_0xb2ca48=>{const _0x5803a8=_0xb63e65;let _0x45e197=![];const _0x252bf6=async()=>{const _0x70edd4=a57_0x4ecb;if(_0x45e197)return;_0x45e197=!![],await _0x10188a[_0x70edd4(0x143)](),_0xb2ca48();};process['once'](_0x5803a8(0x13f),_0x252bf6),process[_0x5803a8(0x152)](_0x5803a8(0x14e),_0x252bf6),process[_0x5803a8(0x149)][_0x5803a8(0x152)]('close',_0x252bf6);});}
1
+ (function(_0x43d5fa,_0x1c094b){const _0xb4a1c5=a57_0x31f7,_0x369035=_0x43d5fa();while(!![]){try{const _0x3ed437=parseInt(_0xb4a1c5(0x16a))/0x1*(parseInt(_0xb4a1c5(0x15f))/0x2)+parseInt(_0xb4a1c5(0x169))/0x3+parseInt(_0xb4a1c5(0x17c))/0x4*(-parseInt(_0xb4a1c5(0x15e))/0x5)+-parseInt(_0xb4a1c5(0x180))/0x6*(-parseInt(_0xb4a1c5(0x188))/0x7)+-parseInt(_0xb4a1c5(0x171))/0x8*(-parseInt(_0xb4a1c5(0x184))/0x9)+-parseInt(_0xb4a1c5(0x183))/0xa+-parseInt(_0xb4a1c5(0x175))/0xb;if(_0x3ed437===_0x1c094b)break;else _0x369035['push'](_0x369035['shift']());}catch(_0x5af335){_0x369035['push'](_0x369035['shift']());}}}(a57_0x7fea,0x4ad2d));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';function a57_0x7fea(){const _0x366d07=['join','344VidbZy','Context','tdx','registerTool','3440706Yuodst','map','once','6118400dtGidh','1415574LxeoDS','SIGTERM','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','array','7OGdWSB','Command\x20completed\x20successfully','No\x20commands\x20found\x20matching\x20\x22','Command\x20failed','10705eKVqOE','632cjbhfX','Data','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.','tdx_run','close','Utilities','text','stdin','env','describe','325653ZdJgDQ','1231ksgSjs','1.0.0','**\x20(','Optional\x20filter\x20by\x20category','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','examples','\x0a\x0a---\x0a\x0a','16dnsLEZ','SIGINT','tdx_search','success','3114397ureBqN','enum','CDP','length','string','description'];a57_0x7fea=function(){return _0x366d07;};return a57_0x7fea();}function a57_0x31f7(_0x439332,_0x40a13c){_0x439332=_0x439332-0x15d;const _0x7fea01=a57_0x7fea();let _0x31f736=_0x7fea01[_0x439332];return _0x31f736;}export function createMCPServer(_0x42de2e={}){const _0x2c6138=a57_0x31f7,_0x42fef3=new McpServer({'name':_0x2c6138(0x17e),'version':_0x2c6138(0x16b)});return _0x42fef3[_0x2c6138(0x17f)](_0x2c6138(0x162),{'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[_0x2c6138(0x187)](z[_0x2c6138(0x179)]())[_0x2c6138(0x168)](_0x2c6138(0x16e))}},async({args:_0x2b57c8})=>{const _0x2eff2d=_0x2c6138,_0x10d04c=await executeTdxRun({'args':_0x2b57c8},_0x42de2e[_0x2eff2d(0x167)]||{});return _0x10d04c[_0x2eff2d(0x174)]?{'content':[{'type':_0x2eff2d(0x165),'text':_0x10d04c['output']||_0x2eff2d(0x189)}]}:{'content':[{'type':'text','text':_0x10d04c['error']||_0x10d04c['output']||_0x2eff2d(0x15d)}],'isError':!![]};}),_0x42fef3[_0x2c6138(0x17f)](_0x2c6138(0x173),{'description':_0x2c6138(0x161),'inputSchema':{'query':z[_0x2c6138(0x179)]()[_0x2c6138(0x168)](_0x2c6138(0x186)),'category':z[_0x2c6138(0x176)]([_0x2c6138(0x160),_0x2c6138(0x177),'AI',_0x2c6138(0x17d),_0x2c6138(0x164)])['optional']()[_0x2c6138(0x168)](_0x2c6138(0x16d))}},async({query:_0x381c39,category:_0x3d5fda})=>{const _0x3cedaf=_0x2c6138,_0x3ca7a0=searchCommands({'query':_0x381c39,'category':_0x3d5fda});if(_0x3ca7a0[_0x3cedaf(0x178)]===0x0)return{'content':[{'type':_0x3cedaf(0x165),'text':_0x3cedaf(0x18a)+_0x381c39+'\x22'}]};const _0x120e29=_0x3ca7a0[_0x3cedaf(0x181)](_0x3dfe5b=>{const _0x3949e5=_0x3cedaf,_0x1b26af=_0x3dfe5b[_0x3949e5(0x16f)][_0x3949e5(0x181)](_0x149d08=>'\x20\x20'+_0x149d08)[_0x3949e5(0x17b)]('\x0a');return'**'+_0x3dfe5b['name']+_0x3949e5(0x16c)+_0x3dfe5b['category']+')\x0a'+_0x3dfe5b[_0x3949e5(0x17a)]+'\x0a\x0aExamples:\x0a'+_0x1b26af;})[_0x3cedaf(0x17b)](_0x3cedaf(0x170));return{'content':[{'type':_0x3cedaf(0x165),'text':_0x120e29}]};}),_0x42fef3;}export async function startMCPServer(_0x560a93={}){const _0x619140=createMCPServer(_0x560a93),_0xdc8cdf=new StdioServerTransport();return await _0x619140['connect'](_0xdc8cdf),new Promise(_0x3678cd=>{const _0x136217=a57_0x31f7;let _0x414177=![];const _0x26acd0=async()=>{if(_0x414177)return;_0x414177=!![],await _0x619140['close'](),_0x3678cd();};process[_0x136217(0x182)](_0x136217(0x172),_0x26acd0),process[_0x136217(0x182)](_0x136217(0x185),_0x26acd0),process[_0x136217(0x166)]['once'](_0x136217(0x163),_0x26acd0);});}
@@ -1 +1 @@
1
- (function(_0x43c3ba,_0x5ce215){var _0x1fafb9=a58_0x1c1a,_0x251807=_0x43c3ba();while(!![]){try{var _0x4cdbb1=-parseInt(_0x1fafb9(0xfe))/0x1+-parseInt(_0x1fafb9(0xff))/0x2*(-parseInt(_0x1fafb9(0xfd))/0x3)+parseInt(_0x1fafb9(0xfb))/0x4+-parseInt(_0x1fafb9(0xfc))/0x5+parseInt(_0x1fafb9(0xf9))/0x6+-parseInt(_0x1fafb9(0xfa))/0x7+-parseInt(_0x1fafb9(0xf8))/0x8;if(_0x4cdbb1===_0x5ce215)break;else _0x251807['push'](_0x251807['shift']());}catch(_0x552a8e){_0x251807['push'](_0x251807['shift']());}}}(a58_0x48e9,0x8081d));function a58_0x1c1a(_0x5300bd,_0x2e3c09){_0x5300bd=_0x5300bd-0xf8;var _0x48e90a=a58_0x48e9();var _0x1c1a48=_0x48e90a[_0x5300bd];return _0x1c1a48;}export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';function a58_0x48e9(){var _0x5be0c0=['3hdPFRB','69552jirygx','2034722QAyciu','13794304mdXZQs','6157350LHkBBu','1863953SsDBVd','2497480JaubZi','407360oyOKfn'];a58_0x48e9=function(){return _0x5be0c0;};return a58_0x48e9();}
1
+ function a58_0x46a7(_0x285fa5,_0x17e29e){_0x285fa5=_0x285fa5-0xf2;var _0x33ab93=a58_0x33ab();var _0x46a7ea=_0x33ab93[_0x285fa5];return _0x46a7ea;}(function(_0x114d30,_0x3a93ab){var _0xb6be50=a58_0x46a7,_0x125c71=_0x114d30();while(!![]){try{var _0x59ca57=-parseInt(_0xb6be50(0xf6))/0x1+parseInt(_0xb6be50(0xf3))/0x2*(-parseInt(_0xb6be50(0xfa))/0x3)+-parseInt(_0xb6be50(0xf2))/0x4+parseInt(_0xb6be50(0xf5))/0x5*(-parseInt(_0xb6be50(0xf9))/0x6)+-parseInt(_0xb6be50(0xf7))/0x7+parseInt(_0xb6be50(0xf4))/0x8+parseInt(_0xb6be50(0xf8))/0x9;if(_0x59ca57===_0x3a93ab)break;else _0x125c71['push'](_0x125c71['shift']());}catch(_0xb64e75){_0x125c71['push'](_0x125c71['shift']());}}}(a58_0x33ab,0x84696));function a58_0x33ab(){var _0x16fec2=['675071rGVzjb','399931bLzavc','20838861CTmiMN','18adXhpL','117nfejDo','1555196lZUVds','19298lenPRf','3896784ygBFTP','1271425jwsIzu'];a58_0x33ab=function(){return _0x16fec2;};return a58_0x33ab();}export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
@@ -1 +1 @@
1
- function a59_0x5330(){const _0x77824=['67460ZxYhDN','11814525thzivp','win32','string','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','node','data','pipe','PATH','execPath','stderr','Failed\x20to\x20spawn\x20tdx:\x20','stdout','kill','resourcesPath','105Mwbdqm','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','3272BVzezL','--no-color','object','7190220NnSYgT','2QWyQRx','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','664931GLAffM','describe','--json','13825ZhVnjI','780396ALtvXI','toString','2755725QRRAMS','ignore','close'];a59_0x5330=function(){return _0x77824;};return a59_0x5330();}const a59_0x492fc5=a59_0x4e5e;(function(_0x40fa23,_0x570a58){const _0xc4a880=a59_0x4e5e,_0x49a307=_0x40fa23();while(!![]){try{const _0x134e71=-parseInt(_0xc4a880(0x14c))/0x1*(-parseInt(_0xc4a880(0x14a))/0x2)+-parseInt(_0xc4a880(0x164))/0x3*(parseInt(_0xc4a880(0x155))/0x4)+parseInt(_0xc4a880(0x152))/0x5+-parseInt(_0xc4a880(0x150))/0x6+parseInt(_0xc4a880(0x14f))/0x7*(parseInt(_0xc4a880(0x146))/0x8)+-parseInt(_0xc4a880(0x156))/0x9+parseInt(_0xc4a880(0x149))/0xa;if(_0x134e71===_0x570a58)break;else _0x49a307['push'](_0x49a307['shift']());}catch(_0x93377d){_0x49a307['push'](_0x49a307['shift']());}}}(a59_0x5330,0xad4af));import{spawn}from'child_process';import{dirname,join}from'path';import{existsSync}from'fs';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a59_0x492fc5(0x148)]({'args':z['array'](z[a59_0x492fc5(0x158)]())[a59_0x492fc5(0x14d)](a59_0x492fc5(0x165))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function a59_0x4e5e(_0x3a2a7c,_0x107956){_0x3a2a7c=_0x3a2a7c-0x146;const _0x533012=a59_0x5330();let _0x4e5e28=_0x533012[_0x3a2a7c];return _0x4e5e28;}function getNodeBinDir(){const _0x4cd1f1=a59_0x492fc5,_0x272123=process[_0x4cd1f1(0x163)];if(_0x272123){const _0x555b0f=join(_0x272123,_0x4cd1f1(0x15a)),_0x18e834=process['platform']===_0x4cd1f1(0x157)?'node.exe':_0x4cd1f1(0x15a);if(existsSync(join(_0x555b0f,_0x18e834)))return _0x555b0f;}return dirname(process[_0x4cd1f1(0x15e)]);}export async function executeTdxRun(_0x412497,_0x62ad0){const _0x4abc1d=a59_0x492fc5,{args:_0x2630eb}=_0x412497;if(isBlockedCommand(_0x2630eb)){const _0x100e12=getBlockedReason(_0x2630eb);return{'success':![],'output':'','error':_0x100e12||_0x4abc1d(0x14b),'exitCode':0x1};}const _0x4a6373=[_0x4abc1d(0x14e),_0x4abc1d(0x147),..._0x2630eb],_0x4688dd=getNodeBinDir(),_0x50a4fd=process['platform']==='win32'?';':':',_0x32a90b=_0x62ad0[_0x4abc1d(0x15d)]??process.env.PATH??'',_0x2d3ae1=''+_0x4688dd+_0x50a4fd+_0x32a90b;return new Promise(_0x544681=>{const _0x2046ec=_0x4abc1d,_0x40964e=spawn('tdx',_0x4a6373,{'env':{...process.env,..._0x62ad0,'PATH':_0x2d3ae1,'CI':'true'},'stdio':[_0x2046ec(0x153),_0x2046ec(0x15c),_0x2046ec(0x15c)]});let _0x35e3ba='',_0x1af62c='',_0x4771dc=![];const _0x9b9e30=setTimeout(()=>{const _0x12d16a=_0x2046ec;_0x4771dc=!![],_0x40964e[_0x12d16a(0x162)]('SIGTERM');},DEFAULT_TIMEOUT_MS);_0x40964e[_0x2046ec(0x161)]['on'](_0x2046ec(0x15b),_0x1490ce=>{const _0x24401a=_0x2046ec;_0x35e3ba+=_0x1490ce[_0x24401a(0x151)]();}),_0x40964e[_0x2046ec(0x15f)]['on'](_0x2046ec(0x15b),_0x158cb4=>{const _0x3edb9a=_0x2046ec;_0x1af62c+=_0x158cb4[_0x3edb9a(0x151)]();}),_0x40964e['on']('error',_0x1bbba8=>{const _0xde05dd=_0x2046ec;clearTimeout(_0x9b9e30),_0x544681({'success':![],'output':'','error':_0xde05dd(0x160)+_0x1bbba8['message'],'exitCode':0x1});}),_0x40964e['on'](_0x2046ec(0x154),_0x40fe2e=>{const _0x55d6c4=_0x2046ec;clearTimeout(_0x9b9e30);if(_0x4771dc){_0x544681({'success':![],'output':formatOutput(_0x35e3ba),'error':_0x55d6c4(0x159),'exitCode':0x7c});return;}const _0x1dd5c7=_0x40fe2e??0x1,_0x2882d3=_0x1dd5c7===0x0,_0x4a77dc=formatOutput(_0x35e3ba||_0x1af62c),_0x488db6=!_0x2882d3&&_0x1af62c?formatOutput(_0x1af62c):undefined;_0x544681({'success':_0x2882d3,'output':_0x4a77dc,'error':_0x488db6,'exitCode':_0x1dd5c7});});});}
1
+ const a59_0xb51ff0=a59_0x3b06;(function(_0x558e82,_0x5608f3){const _0x3f24bd=a59_0x3b06,_0x55e549=_0x558e82();while(!![]){try{const _0x365f87=-parseInt(_0x3f24bd(0xed))/0x1*(-parseInt(_0x3f24bd(0xf0))/0x2)+-parseInt(_0x3f24bd(0x110))/0x3+parseInt(_0x3f24bd(0x109))/0x4*(-parseInt(_0x3f24bd(0x102))/0x5)+parseInt(_0x3f24bd(0x10f))/0x6*(-parseInt(_0x3f24bd(0x111))/0x7)+-parseInt(_0x3f24bd(0xf1))/0x8+-parseInt(_0x3f24bd(0xfe))/0x9*(parseInt(_0x3f24bd(0x113))/0xa)+parseInt(_0x3f24bd(0x107))/0xb*(parseInt(_0x3f24bd(0x10e))/0xc);if(_0x365f87===_0x5608f3)break;else _0x55e549['push'](_0x55e549['shift']());}catch(_0x4309f1){_0x55e549['push'](_0x55e549['shift']());}}}(a59_0x44a4,0x4b8e5));import{spawn}from'child_process';import{dirname,join}from'path';function a59_0x3b06(_0x4858ef,_0x528e55){_0x4858ef=_0x4858ef-0xed;const _0x44a4d9=a59_0x44a4();let _0x3b06ff=_0x44a4d9[_0x4858ef];return _0x3b06ff;}function a59_0x44a4(){const _0x56d581=['6sGtbSe','1167387HdsIxH','4020191uqRCtm','node','790390kdHqMK','54415nZGsms','pipe','close','14LTlvth','734416CHhmEp','kill','--no-color','execPath','SIGTERM','message','string','win32','platform','PATH','stdout','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','resourcesPath','9ZnhDea','ignore','array','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','5NoYtVP','Failed\x20to\x20spawn\x20tdx:\x20','true','object','toString','3073631FWLgDu','tdx','219316hpqHtS','describe','--json','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','stderr','48UbPfYB'];a59_0x44a4=function(){return _0x56d581;};return a59_0x44a4();}import{existsSync}from'fs';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a59_0xb51ff0(0x105)]({'args':z[a59_0xb51ff0(0x100)](z[a59_0xb51ff0(0xf7)]())[a59_0xb51ff0(0x10a)](a59_0xb51ff0(0x10c))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function getNodeBinDir(){const _0x2ac55d=a59_0xb51ff0,_0x5bc0b9=process[_0x2ac55d(0xfd)];if(_0x5bc0b9){const _0x3fdbcf=join(_0x5bc0b9,_0x2ac55d(0x112)),_0x236f5b=process[_0x2ac55d(0xf9)]===_0x2ac55d(0xf8)?'node.exe':'node';if(existsSync(join(_0x3fdbcf,_0x236f5b)))return _0x3fdbcf;}return dirname(process[_0x2ac55d(0xf4)]);}export async function executeTdxRun(_0x2dc7b3,_0x5c38d8){const _0x19616=a59_0xb51ff0,{args:_0x52d65e}=_0x2dc7b3;if(isBlockedCommand(_0x52d65e)){const _0x1a1077=getBlockedReason(_0x52d65e);return{'success':![],'output':'','error':_0x1a1077||_0x19616(0x101),'exitCode':0x1};}const _0x3f7852=[_0x19616(0x10b),_0x19616(0xf3),..._0x52d65e],_0x12e5dc=getNodeBinDir(),_0x451c83=process[_0x19616(0xf9)]==='win32'?';':':',_0x47c0e3=_0x5c38d8[_0x19616(0xfa)]??process.env.PATH??'',_0x375627=''+_0x12e5dc+_0x451c83+_0x47c0e3;return new Promise(_0x22d894=>{const _0x1a5c4c=_0x19616,_0x3e0003=spawn(_0x1a5c4c(0x108),_0x3f7852,{'env':{...process.env,..._0x5c38d8,'PATH':_0x375627,'CI':_0x1a5c4c(0x104)},'stdio':[_0x1a5c4c(0xff),_0x1a5c4c(0xee),'pipe']});let _0x500e88='',_0x3b991c='',_0x45cbb7=![];const _0x4c13cb=setTimeout(()=>{const _0x3a6f49=_0x1a5c4c;_0x45cbb7=!![],_0x3e0003[_0x3a6f49(0xf2)](_0x3a6f49(0xf5));},DEFAULT_TIMEOUT_MS);_0x3e0003[_0x1a5c4c(0xfb)]['on']('data',_0x1d1dde=>{_0x500e88+=_0x1d1dde['toString']();}),_0x3e0003[_0x1a5c4c(0x10d)]['on']('data',_0xdbb071=>{const _0x9f366a=_0x1a5c4c;_0x3b991c+=_0xdbb071[_0x9f366a(0x106)]();}),_0x3e0003['on']('error',_0x25bfce=>{const _0x237f29=_0x1a5c4c;clearTimeout(_0x4c13cb),_0x22d894({'success':![],'output':'','error':_0x237f29(0x103)+_0x25bfce[_0x237f29(0xf6)],'exitCode':0x1});}),_0x3e0003['on'](_0x1a5c4c(0xef),_0xb280fa=>{const _0x4d1a32=_0x1a5c4c;clearTimeout(_0x4c13cb);if(_0x45cbb7){_0x22d894({'success':![],'output':formatOutput(_0x500e88),'error':_0x4d1a32(0xfc),'exitCode':0x7c});return;}const _0x543fbf=_0xb280fa??0x1,_0x622825=_0x543fbf===0x0,_0x5a736b=formatOutput(_0x500e88||_0x3b991c),_0x5d6cfe=!_0x622825&&_0x3b991c?formatOutput(_0x3b991c):undefined;_0x22d894({'success':_0x622825,'output':_0x5a736b,'error':_0x5d6cfe,'exitCode':_0x543fbf});});});}