@treasuredata/tdx 0.26.4 → 0.26.6

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 (169) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.js +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-validate-command.js +1 -1
  24. package/dist/commands/llm-command.js +1 -1
  25. package/dist/commands/mcp-command.js +1 -1
  26. package/dist/commands/parent-segment-command.js +1 -1
  27. package/dist/commands/profile-command.js +1 -1
  28. package/dist/commands/profiles-command.js +1 -1
  29. package/dist/commands/query-command.js +1 -1
  30. package/dist/commands/schedule-command.js +1 -1
  31. package/dist/commands/segment-command.js +1 -1
  32. package/dist/commands/segment-create-command.js +1 -1
  33. package/dist/commands/segment-fields-command.js +1 -1
  34. package/dist/commands/segment-pull-command.js +1 -1
  35. package/dist/commands/segment-push-command.js +1 -1
  36. package/dist/commands/segment-update-command.js +1 -1
  37. package/dist/commands/segment-use-command.js +1 -1
  38. package/dist/commands/segment-validate-command.js +1 -1
  39. package/dist/commands/segments.js +1 -1
  40. package/dist/commands/show.js +1 -1
  41. package/dist/commands/status-command.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/unset-command.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/command-output.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/constants.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/core/version.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/mcp/server.js +1 -1
  62. package/dist/mcp/tools/index.js +1 -1
  63. package/dist/mcp/tools/tdx-run.js +1 -1
  64. package/dist/mcp/tools/tdx-search.js +1 -1
  65. package/dist/mcp/utils.js +1 -1
  66. package/dist/proxy/claude-usage-tracker.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/sse-usage-parser.js +1 -1
  69. package/dist/sdk/agent/agent-config.js +1 -1
  70. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  71. package/dist/sdk/agent/agent-yaml.js +1 -1
  72. package/dist/sdk/agent/test/evaluator.js +1 -1
  73. package/dist/sdk/agent/test/executor.js +1 -1
  74. package/dist/sdk/agent/test/index.js +1 -1
  75. package/dist/sdk/agent/test/output.js +1 -1
  76. package/dist/sdk/agent/test/parser.js +1 -1
  77. package/dist/sdk/api.js +1 -1
  78. package/dist/sdk/client/cdp-api-client.js +1 -1
  79. package/dist/sdk/client/endpoints.js +1 -1
  80. package/dist/sdk/client/engage-api-client.js +1 -1
  81. package/dist/sdk/client/http-client.js +1 -1
  82. package/dist/sdk/client/llm-api-client.js +1 -1
  83. package/dist/sdk/client/rate-limiter.js +1 -1
  84. package/dist/sdk/client/td-api-client.js +1 -1
  85. package/dist/sdk/client/trino-api-client.js +1 -1
  86. package/dist/sdk/client/workflow-client.js +1 -1
  87. package/dist/sdk/connection-validator.js +1 -1
  88. package/dist/sdk/connection.js +1 -1
  89. package/dist/sdk/engage.js +1 -1
  90. package/dist/sdk/errors.js +1 -1
  91. package/dist/sdk/index.js +1 -1
  92. package/dist/sdk/io/index.js +1 -1
  93. package/dist/sdk/io/node-filesystem.js +1 -1
  94. package/dist/sdk/job.js +1 -1
  95. package/dist/sdk/journey.js +1 -1
  96. package/dist/sdk/llm/chat-cache.js +1 -1
  97. package/dist/sdk/llm/index.js +1 -1
  98. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  99. package/dist/sdk/llm/model-factors.js +1 -1
  100. package/dist/sdk/personalization.js +1 -1
  101. package/dist/sdk/query/index.js +1 -1
  102. package/dist/sdk/query/sql-parser.js +1 -1
  103. package/dist/sdk/realtime.js +1 -1
  104. package/dist/sdk/schedule.js +1 -1
  105. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  106. package/dist/sdk/segment/fields-display.js +1 -1
  107. package/dist/sdk/segment/file-discovery.js +1 -1
  108. package/dist/sdk/segment/journey-utils.js +1 -1
  109. package/dist/sdk/segment/journey-validator.js +1 -1
  110. package/dist/sdk/segment/journey-yaml.js +1 -1
  111. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  112. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/pull-workflow.js +1 -1
  114. package/dist/sdk/segment/push-recovery.js +1 -1
  115. package/dist/sdk/segment/push-workflow.js +1 -1
  116. package/dist/sdk/segment/resolution-context.js +1 -1
  117. package/dist/sdk/segment/segment-path-parser.js +1 -1
  118. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  119. package/dist/sdk/segment/target-resolution.js +1 -1
  120. package/dist/sdk/segment/tdx-config.js +1 -1
  121. package/dist/sdk/segment/validate-files.js +1 -1
  122. package/dist/sdk/segment/yaml-validator.js +1 -1
  123. package/dist/sdk/segment.js +1 -1
  124. package/dist/sdk/types/index.js +1 -1
  125. package/dist/sdk/types/progress.js +1 -1
  126. package/dist/sdk/user.js +1 -1
  127. package/dist/sdk/util/format-detector.js +1 -1
  128. package/dist/sdk/util/formatters.js +1 -1
  129. package/dist/sdk/util/index.js +1 -1
  130. package/dist/sdk/util/tree-formatter.js +1 -1
  131. package/dist/sdk/workflow/archive-validation.js +1 -1
  132. package/dist/sdk/workflow/clone-workflow.js +1 -1
  133. package/dist/sdk/workflow/index.js +1 -1
  134. package/dist/sdk/workflow/pull-workflow.js +1 -1
  135. package/dist/sdk/workflow/push-workflow.js +1 -1
  136. package/dist/sdk/workflow/tdx-config.js +1 -1
  137. package/dist/sdk/workflow/workflow-utils.js +1 -1
  138. package/dist/test-utils/command-runner.js +1 -1
  139. package/dist/test-utils/factories.js +1 -1
  140. package/dist/test-utils/fixtures.js +1 -1
  141. package/dist/test-utils/http-mock.js +1 -1
  142. package/dist/test-utils/index.js +1 -1
  143. package/dist/utils/async.js +1 -1
  144. package/dist/utils/colors.js +1 -1
  145. package/dist/utils/diff.js +1 -1
  146. package/dist/utils/file-permissions.js +1 -1
  147. package/dist/utils/global-cache.js +1 -1
  148. package/dist/utils/json-loader.js +1 -1
  149. package/dist/utils/local-cache.js +1 -1
  150. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  151. package/dist/utils/logger/formatters/index.js +1 -1
  152. package/dist/utils/logger/handlers/console-handler.js +1 -1
  153. package/dist/utils/logger/handlers/file-handler.js +1 -1
  154. package/dist/utils/logger/handlers/index.js +1 -1
  155. package/dist/utils/logger/handlers/null-handler.js +1 -1
  156. package/dist/utils/logger/index.js +1 -1
  157. package/dist/utils/logger/logger.js +1 -1
  158. package/dist/utils/logger/types.js +1 -1
  159. package/dist/utils/option-validation.js +1 -1
  160. package/dist/utils/port.js +1 -1
  161. package/dist/utils/process.js +1 -1
  162. package/dist/utils/prompt.js +1 -1
  163. package/dist/utils/spinner.js +1 -1
  164. package/dist/utils/sse-parser.js +1 -1
  165. package/dist/utils/string-utils.js +1 -1
  166. package/dist/utils/table-ref-parser.js +1 -1
  167. package/dist/utils/tdx-logger.js +1 -1
  168. package/dist/utils/version-check.js +1 -1
  169. package/package.json +1 -1
@@ -1 +1 @@
1
- const a45_0x55fd4d=a45_0x7cf4;(function(_0x8c0570,_0x297b5a){const _0x84e0da=a45_0x7cf4,_0x5334cd=_0x8c0570();while(!![]){try{const _0x1698f4=-parseInt(_0x84e0da(0x14a))/0x1+-parseInt(_0x84e0da(0x15a))/0x2*(-parseInt(_0x84e0da(0x14d))/0x3)+parseInt(_0x84e0da(0x12a))/0x4*(parseInt(_0x84e0da(0x136))/0x5)+parseInt(_0x84e0da(0x147))/0x6+-parseInt(_0x84e0da(0x146))/0x7*(parseInt(_0x84e0da(0x12b))/0x8)+parseInt(_0x84e0da(0x130))/0x9*(-parseInt(_0x84e0da(0x127))/0xa)+parseInt(_0x84e0da(0x150))/0xb;if(_0x1698f4===_0x297b5a)break;else _0x5334cd['push'](_0x5334cd['shift']());}catch(_0x1658b1){_0x5334cd['push'](_0x5334cd['shift']());}}}(a45_0x46ce,0x4b0d9));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x45c0ef from'node:fs';import*as a45_0x187273 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';function a45_0x7cf4(_0x48f891,_0x281be9){_0x48f891=_0x48f891-0x111;const _0x46ce04=a45_0x46ce();let _0x7cf415=_0x46ce04[_0x48f891];return _0x7cf415;}import a45_0x5ec7b5 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x474cab=a45_0x7cf4;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x474cab(0x122),_0x474cab(0x13a));}export function getConfigFile(){const _0x181bed=a45_0x7cf4;return join(getConfigDir(),_0x181bed(0x13e));}export function getConfigFilePath(_0x3f6925){const _0x59382d=a45_0x7cf4,_0x55ccea=getConfigDir();return _0x3f6925?a45_0x187273['join'](_0x55ccea,_0x59382d(0x13b)+_0x3f6925):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project',a45_0x55fd4d(0x14c));export function getLLMProjectCacheFile(_0x40a28e){const _0x55d092=a45_0x55fd4d;return llmProjectCache[_0x55d092(0x148)](_0x40a28e);}function a45_0x46ce(){const _0x1d6113=['⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','.env','stg-jp01','site','keychain','proxy','\x20env\x20var','name','tdx.json','3374aPSyWk','1681560PrtQem','path','filter','237380QPyaiV','read','config/llm-project','487188xrjXsK','stable','account_info','4801863atTdmg','utf-8','slice','TDX_API_KEY_','.json','keychain\x20(profile:\x20','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','config/account-info','warn','dev-eu01','4RYhGYX','accountId','join','yellow','ap02','ap03','trim','stg-ap03','projectId','profile','toUpperCase','stg-us01','match','some','existsSync','TD_API_KEY_','startsWith','apiKeys','endsWith','eu01','.config','Warning:\x20Unknown\x20site\x20\x27','entries','write','toISOString','50XlzGlW','string','clear','735412fswzcR','9096ZNOSDW','jp01','us01','map','release_channel','569628WCorlh','dev-us01','TD_API_KEY','\x27,\x20defaulting\x20to\x20us01','llm_default_agent','next','10lcVKzz','config/llm-agent','parse','readFileSync','tdx','.env.','split'];a45_0x46ce=function(){return _0x1d6113;};return a45_0x46ce();}export function readCachedLLMProject(_0x18a6ea){const _0x53b144=a45_0x55fd4d,_0x4dcf2a=llmProjectCache['read'](_0x18a6ea);if(_0x4dcf2a&&typeof _0x4dcf2a['id']===_0x53b144(0x128)&&typeof _0x4dcf2a[_0x53b144(0x144)]==='string')return _0x4dcf2a;return null;}export function writeCachedLLMProject(_0x122a4a,_0x196e20,_0x12821c){const _0x516ba6=a45_0x55fd4d;try{llmProjectCache[_0x516ba6(0x125)]({'name':_0x122a4a,'id':_0x196e20},_0x12821c);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x55fd4d(0x134),a45_0x55fd4d(0x137));export function getLLMAgentCacheFile(_0x264b8f){const _0x5862f0=a45_0x55fd4d;return llmAgentCache[_0x5862f0(0x148)](_0x264b8f);}export function readCachedLLMAgent(_0x2c28bd){const _0x23bfd1=a45_0x55fd4d,_0x421cc4=llmAgentCache[_0x23bfd1(0x14b)](_0x2c28bd);if(_0x421cc4&&typeof _0x421cc4['id']===_0x23bfd1(0x128)&&typeof _0x421cc4[_0x23bfd1(0x144)]===_0x23bfd1(0x128)&&typeof _0x421cc4[_0x23bfd1(0x116)]===_0x23bfd1(0x128))return _0x421cc4;return null;}export function writeCachedLLMAgent(_0x3a8099,_0x1dc050,_0x1f4b79,_0x4870bf){try{llmAgentCache['write']({'name':_0x3a8099,'id':_0x1dc050,'projectId':_0x1f4b79},_0x4870bf);}catch{}}export function clearCachedLLMAgent(_0x13cbf7){const _0x435ffc=a45_0x55fd4d;try{llmAgentCache[_0x435ffc(0x129)](_0x13cbf7);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0x55fd4d(0x14f),a45_0x55fd4d(0x157),{'suffix':a45_0x55fd4d(0x154)});export function getAccountInfoCacheFile(_0x42a2c3){return accountInfoCache['path'](_0x42a2c3);}export function readCachedAccountInfo(_0x2831ef){const _0x83cad5=a45_0x55fd4d,_0x13b838=accountInfoCache['read'](_0x2831ef);if(_0x13b838&&typeof _0x13b838[_0x83cad5(0x140)]===_0x83cad5(0x128)&&typeof _0x13b838[_0x83cad5(0x15b)]==='number')return _0x13b838;return null;}export function writeCachedAccountInfo(_0x281688,_0x483b20,_0x43b87e){const _0x5d9c75=a45_0x55fd4d;try{accountInfoCache['write']({'site':_0x281688,'accountId':_0x483b20,'cachedAt':new Date()[_0x5d9c75(0x126)]()},_0x43b87e);}catch{}}export function parseEnvFile(_0x234a03){const _0x53e974=a45_0x55fd4d,_0x572374={};for(const _0x2ff558 of _0x234a03[_0x53e974(0x13c)]('\x0a')){const _0x38b023=_0x2ff558[_0x53e974(0x114)]();if(!_0x38b023||_0x38b023[_0x53e974(0x11e)]('#'))continue;const _0x2a322e=_0x38b023[_0x53e974(0x11a)](/^([^=]+)=(.*)$/);if(_0x2a322e){const _0x13be1a=_0x2a322e[0x1][_0x53e974(0x114)]();let _0x142cf6=_0x2a322e[0x2]['trim']();(_0x142cf6['startsWith']('\x22')&&_0x142cf6[_0x53e974(0x120)]('\x22')||_0x142cf6[_0x53e974(0x11e)]('\x27')&&_0x142cf6[_0x53e974(0x120)]('\x27'))&&(_0x142cf6=_0x142cf6[_0x53e974(0x152)](0x1,-0x1)),_0x572374[_0x13be1a]=_0x142cf6;}}return _0x572374;}export function readUserConfig(){const _0x53e545=a45_0x55fd4d,_0x3b577c=getConfigFile();if(!existsSync(_0x3b577c))return{};try{const _0x34cb27=readFileSync(_0x3b577c,_0x53e545(0x151));return parseEnvFile(_0x34cb27);}catch(_0x567e32){return console[_0x53e545(0x158)](_0x53e545(0x156)+_0x3b577c+':',_0x567e32),{};}}export function resolveSite(_0x164f21){const _0x44fca8=a45_0x55fd4d,_0x6d7f73=[_0x44fca8(0x12d),_0x44fca8(0x12c),_0x44fca8(0x121),_0x44fca8(0x112),'ap03',_0x44fca8(0x131),'dev-eu01',_0x44fca8(0x119),_0x44fca8(0x13f),_0x44fca8(0x115)];if(_0x6d7f73['includes'](_0x164f21))return _0x164f21;if(_0x164f21 in SITE_ALIASES)return SITE_ALIASES[_0x164f21];return console[_0x44fca8(0x158)](_0x44fca8(0x123)+_0x164f21+_0x44fca8(0x133)),_0x44fca8(0x12d);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2eaedb){const _0x1a4489=a45_0x55fd4d,_0x1310ee=_0x2eaedb||getActiveProfileName();if(_0x1310ee){const _0x12335b=_0x1a4489(0x153)+normalizeProfileForEnvVar(_0x1310ee);if(process.env[_0x12335b])return process.env[_0x12335b];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x1be4d9){return _0x1be4d9['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x59061d,_0x4716d5){const _0x4dd926=a45_0x55fd4d,_0x5eda3f=_0x4716d5||getActiveProfileName()||undefined;if(_0x5eda3f){const _0x3395d1=_0x4dd926(0x153)+normalizeProfileForEnvVar(_0x5eda3f);if(process.env[_0x3395d1])return{'apiKey':process.env[_0x3395d1],'source':_0x3395d1+_0x4dd926(0x143),'isDeprecated':![]};const _0x3e94b1=getCachedCredential(_0x59061d,_0x5eda3f);if(_0x3e94b1)return{'apiKey':_0x3e94b1,'source':'keychain\x20(profile:\x20'+_0x5eda3f+')','isDeprecated':![]};const _0x37269d=await getKeychainAPIKey(_0x5eda3f);if(_0x37269d)return setCachedCredential(_0x37269d,_0x59061d,_0x5eda3f),{'apiKey':_0x37269d,'source':_0x4dd926(0x155)+_0x5eda3f+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x5eda3f){const _0x48d05d=getCachedCredential(_0x59061d,undefined);if(_0x48d05d)return{'apiKey':_0x48d05d,'source':_0x4dd926(0x141),'isDeprecated':![]};const _0x563e2f=await getKeychainAPIKey(undefined);if(_0x563e2f)return setCachedCredential(_0x563e2f,_0x59061d,undefined),{'apiKey':_0x563e2f,'source':_0x4dd926(0x141),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x232751,_0x3bb3b5){const _0x38030e=await resolveAPIKeyAsync(_0x232751,_0x3bb3b5);return _0x38030e?.['apiKey'];}function cleanupLegacyEnvFile(_0x225fbe){const _0x28a02a=a45_0x55fd4d;if(!existsSync(_0x225fbe))return![];try{const _0x392662=readFileSync(_0x225fbe,_0x28a02a(0x151)),_0x527696=_0x392662['split']('\x0a'),_0x150677=_0x527696[_0x28a02a(0x149)](_0x48caeb=>{const _0x1590c3=_0x28a02a,_0x4be8b7=_0x48caeb[_0x1590c3(0x114)]();if(!_0x4be8b7||_0x4be8b7[_0x1590c3(0x11e)]('#'))return!![];const [_0x3d90f4]=_0x4be8b7['split']('=');return!_0x3d90f4['startsWith'](_0x1590c3(0x132));}),_0x8776b4=_0x150677[_0x28a02a(0x11b)](_0x50f6ca=>{const _0x6eb1dd=_0x28a02a,_0x2b2a75=_0x50f6ca[_0x6eb1dd(0x114)]();return _0x2b2a75&&!_0x2b2a75['startsWith']('#');});if(!_0x8776b4)return unlinkSync(_0x225fbe),!![];return writeFileSync(_0x225fbe,_0x150677[_0x28a02a(0x15c)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x56c832=a45_0x55fd4d;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1f3464=a45_0x187273['join'](getConfigDir(),_0x56c832(0x145));if(!a45_0x45c0ef[_0x56c832(0x11c)](_0x1f3464))return null;try{const _0x2977ab=a45_0x45c0ef['readFileSync'](_0x1f3464,_0x56c832(0x151)),_0xc68ae8=JSON['parse'](_0x2977ab);return _0xc68ae8[_0x56c832(0x117)]||null;}catch{return null;}}export function saveAPIKey(_0x28d417,_0x145a83,_0x15920c){const _0x514afd=a45_0x55fd4d,_0x1a1814=getConfigDir(),_0x2b2167=getConfigFilePath(_0x15920c);!existsSync(_0x1a1814)&&mkdirSync(_0x1a1814,{'recursive':!![],'mode':0x1c0});let _0x530f28={};if(existsSync(_0x2b2167))try{const _0x210839=readFileSync(_0x2b2167,_0x514afd(0x151));_0x530f28=parseEnvFile(_0x210839);}catch(_0x1d923a){console[_0x514afd(0x158)]('Warning:\x20Failed\x20to\x20read\x20'+_0x2b2167+':',_0x1d923a);}const _0x400a91=_0x28d417[_0x514afd(0x118)]()['replace'](/-/g,'_');_0x530f28[_0x514afd(0x11d)+_0x400a91]=_0x145a83;const _0x366fb3=Object[_0x514afd(0x124)](_0x530f28)[_0x514afd(0x12e)](([_0x2fc383,_0x870cf8])=>_0x2fc383+'='+_0x870cf8);writeFileSync(_0x2b2167,_0x366fb3[_0x514afd(0x15c)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x199cb7,_0x54a133,_0x598fd9){const _0x1289d6=a45_0x55fd4d;await saveKeychainAPIKey(_0x199cb7,_0x598fd9),setCachedCredential(_0x199cb7,_0x54a133,_0x598fd9);const _0x8b75f9=getConfigFilePath(_0x598fd9);cleanupLegacyEnvFile(_0x8b75f9)&&console[_0x1289d6(0x158)](a45_0x5ec7b5[_0x1289d6(0x111)](_0x1289d6(0x13d)));}export function loadConfig(){const _0x45b152=a45_0x55fd4d,_0x45b4ae={'apiKeys':{},'defaultSite':_0x45b152(0x12d)},_0x492cdd=['us01',_0x45b152(0x12c),_0x45b152(0x121),_0x45b152(0x112),_0x45b152(0x113),_0x45b152(0x131),_0x45b152(0x159),_0x45b152(0x119),'stg-jp01',_0x45b152(0x115)],_0x4a6f3b=getAPIKey();if(_0x4a6f3b)for(const _0x4dfc0a of _0x492cdd){_0x45b4ae[_0x45b152(0x11f)][_0x4dfc0a]=_0x4a6f3b;}return _0x45b4ae;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x4407f1=a45_0x55fd4d,_0x27d48a=a45_0x187273[_0x4407f1(0x15c)](getConfigDir(),_0x4407f1(0x145));if(!a45_0x45c0ef[_0x4407f1(0x11c)](_0x27d48a))return undefined;try{const _0x3be55b=a45_0x45c0ef[_0x4407f1(0x139)](_0x27d48a,_0x4407f1(0x151)),_0x4e68d5=JSON[_0x4407f1(0x138)](_0x3be55b);return typeof _0x4e68d5[_0x4407f1(0x142)]==='string'?_0x4e68d5['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x29d167=a45_0x55fd4d,_0x5503d5=process.env.TDX_RELEASE_CHANNEL;if(_0x5503d5===_0x29d167(0x135)||_0x5503d5===_0x29d167(0x14e))return _0x5503d5;const _0x2eedd5=a45_0x187273[_0x29d167(0x15c)](getConfigDir(),_0x29d167(0x145));if(!a45_0x45c0ef[_0x29d167(0x11c)](_0x2eedd5))return'stable';try{const _0x170651=a45_0x45c0ef['readFileSync'](_0x2eedd5,_0x29d167(0x151)),_0x3cf886=JSON[_0x29d167(0x138)](_0x170651);if(_0x3cf886['release_channel']===_0x29d167(0x135))return'next';}catch{}return'stable';}export function saveReleaseChannel(_0x5af082){const _0x57245c=a45_0x55fd4d,_0x2aa23b=getConfigDir(),_0x501454=a45_0x187273[_0x57245c(0x15c)](_0x2aa23b,'tdx.json');!existsSync(_0x2aa23b)&&mkdirSync(_0x2aa23b,{'recursive':!![],'mode':0x1c0});let _0x388438={};if(existsSync(_0x501454))try{const _0x5c1014=readFileSync(_0x501454,_0x57245c(0x151));_0x388438=JSON[_0x57245c(0x138)](_0x5c1014);}catch{}_0x388438[_0x57245c(0x12f)]=_0x5af082,writeFileSync(_0x501454,JSON['stringify'](_0x388438,null,0x2),{'mode':0x180});}
1
+ const a45_0x11610b=a45_0x26ec;(function(_0xed23fe,_0xf88b00){const _0x4e1322=a45_0x26ec,_0x55619f=_0xed23fe();while(!![]){try{const _0x22a1e6=parseInt(_0x4e1322(0x11b))/0x1+parseInt(_0x4e1322(0xfd))/0x2+parseInt(_0x4e1322(0x101))/0x3+parseInt(_0x4e1322(0xfb))/0x4*(parseInt(_0x4e1322(0x12c))/0x5)+-parseInt(_0x4e1322(0x129))/0x6+parseInt(_0x4e1322(0x126))/0x7+-parseInt(_0x4e1322(0x11c))/0x8*(parseInt(_0x4e1322(0x102))/0x9);if(_0x22a1e6===_0xf88b00)break;else _0x55619f['push'](_0x55619f['shift']());}catch(_0xc2e371){_0x55619f['push'](_0x55619f['shift']());}}}(a45_0x540c,0x24675));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0xf1a4ad from'node:fs';import*as a45_0x2d315e 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_0x15bff3 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';function a45_0x26ec(_0x210dfb,_0x3fb512){_0x210dfb=_0x210dfb-0xee;const _0x540c5d=a45_0x540c();let _0x26ecfa=_0x540c5d[_0x210dfb];return _0x26ecfa;}export function getConfigDir(){const _0x3a0be0=a45_0x26ec;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x3a0be0(0x10b),'tdx');}export function getConfigFile(){const _0x1c5e50=a45_0x26ec;return join(getConfigDir(),_0x1c5e50(0xf0));}export function getConfigFilePath(_0x1fa244){const _0x49f970=a45_0x26ec,_0x8181a=getConfigDir();return _0x1fa244?a45_0x2d315e[_0x49f970(0x132)](_0x8181a,_0x49f970(0x12e)+_0x1fa244):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0x11610b(0xf4),'config/llm-project');function a45_0x540c(){const _0x563b60=['parse','toUpperCase','245203tpJHsj','928248psBmKy','stringify','release_channel','projectId','string','us01','includes','number','llm_default_agent','TDX_API_KEY\x20env\x20var','997024WVbMpM','existsSync','Warning:\x20Unknown\x20site\x20\x27','766002ZAEypf','clear','ap03','5TQuHwv','read','.env.','startsWith','stg-us01','warn','join','replace','trim','next','write','stg-ap03','map','.env','ap02','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','proxy','llm_default_project','profile','keychain\x20(profile:\x20','some','split','name','entries','324888gKzwYt','.json','513638pGgQlW','filter','dev-us01','eu01','393765QTFDqL','45hbWXIy','yellow','dev-eu01','toISOString','apiKeys','TD_API_KEY','readFileSync','stable','path','.config','tdx.json','stg-jp01','config/llm-agent','keychain','Warning:\x20Failed\x20to\x20read\x20','endsWith','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','jp01','accountId','\x27,\x20defaulting\x20to\x20us01','apiKey','TDX_API_KEY_','utf-8'];a45_0x540c=function(){return _0x563b60;};return a45_0x540c();}export function getLLMProjectCacheFile(_0xad171e){const _0x2f4703=a45_0x11610b;return llmProjectCache[_0x2f4703(0x10a)](_0xad171e);}export function readCachedLLMProject(_0x3d06bc){const _0x266832=a45_0x11610b,_0x16fd6a=llmProjectCache['read'](_0x3d06bc);if(_0x16fd6a&&typeof _0x16fd6a['id']===_0x266832(0x120)&&typeof _0x16fd6a[_0x266832(0xf9)]===_0x266832(0x120))return _0x16fd6a;return null;}export function writeCachedLLMProject(_0x31868f,_0x499bdb,_0xc876f){const _0x49eed9=a45_0x11610b;try{llmProjectCache[_0x49eed9(0x136)]({'name':_0x31868f,'id':_0x499bdb},_0xc876f);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x11610b(0x124),a45_0x11610b(0x10e));export function getLLMAgentCacheFile(_0x32b1d1){const _0x50fde9=a45_0x11610b;return llmAgentCache[_0x50fde9(0x10a)](_0x32b1d1);}export function readCachedLLMAgent(_0x543338){const _0x3e2bd6=a45_0x11610b,_0x34abc4=llmAgentCache['read'](_0x543338);if(_0x34abc4&&typeof _0x34abc4['id']===_0x3e2bd6(0x120)&&typeof _0x34abc4[_0x3e2bd6(0xf9)]===_0x3e2bd6(0x120)&&typeof _0x34abc4[_0x3e2bd6(0x11f)]===_0x3e2bd6(0x120))return _0x34abc4;return null;}export function writeCachedLLMAgent(_0x562f76,_0x3ead88,_0xa5e3a,_0x10ae4c){const _0x10a584=a45_0x11610b;try{llmAgentCache[_0x10a584(0x136)]({'name':_0x562f76,'id':_0x3ead88,'projectId':_0xa5e3a},_0x10ae4c);}catch{}}export function clearCachedLLMAgent(_0x442292){const _0x381a9e=a45_0x11610b;try{llmAgentCache[_0x381a9e(0x12a)](_0x442292);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info','config/account-info',{'suffix':a45_0x11610b(0xfc)});export function getAccountInfoCacheFile(_0x2c4666){return accountInfoCache['path'](_0x2c4666);}export function readCachedAccountInfo(_0x3ce293){const _0x2cb8ce=a45_0x11610b,_0x5e764d=accountInfoCache[_0x2cb8ce(0x12d)](_0x3ce293);if(_0x5e764d&&typeof _0x5e764d['site']===_0x2cb8ce(0x120)&&typeof _0x5e764d[_0x2cb8ce(0x114)]===_0x2cb8ce(0x123))return _0x5e764d;return null;}export function writeCachedAccountInfo(_0x12f2ce,_0x586195,_0x563177){const _0x4cc623=a45_0x11610b;try{accountInfoCache[_0x4cc623(0x136)]({'site':_0x12f2ce,'accountId':_0x586195,'cachedAt':new Date()[_0x4cc623(0x105)]()},_0x563177);}catch{}}export function parseEnvFile(_0x6b6354){const _0x25d720=a45_0x11610b,_0x1cae0e={};for(const _0x5339c9 of _0x6b6354[_0x25d720(0xf8)]('\x0a')){const _0x8326c7=_0x5339c9[_0x25d720(0x134)]();if(!_0x8326c7||_0x8326c7[_0x25d720(0x12f)]('#'))continue;const _0x12764=_0x8326c7['match'](/^([^=]+)=(.*)$/);if(_0x12764){const _0x1f42a4=_0x12764[0x1]['trim']();let _0x526c3e=_0x12764[0x2][_0x25d720(0x134)]();(_0x526c3e['startsWith']('\x22')&&_0x526c3e[_0x25d720(0x111)]('\x22')||_0x526c3e[_0x25d720(0x12f)]('\x27')&&_0x526c3e[_0x25d720(0x111)]('\x27'))&&(_0x526c3e=_0x526c3e['slice'](0x1,-0x1)),_0x1cae0e[_0x1f42a4]=_0x526c3e;}}return _0x1cae0e;}export function readUserConfig(){const _0x21a24d=a45_0x11610b,_0x21ad7e=getConfigFile();if(!existsSync(_0x21ad7e))return{};try{const _0x492646=readFileSync(_0x21ad7e,_0x21a24d(0x118));return parseEnvFile(_0x492646);}catch(_0xb6428a){return console[_0x21a24d(0x131)](_0x21a24d(0xf2)+_0x21ad7e+':',_0xb6428a),{};}}export function resolveSite(_0x4a9e51){const _0x4153a0=a45_0x11610b,_0x2866d3=[_0x4153a0(0x121),_0x4153a0(0x113),_0x4153a0(0x100),_0x4153a0(0xf1),_0x4153a0(0x12b),_0x4153a0(0xff),'dev-eu01',_0x4153a0(0x130),_0x4153a0(0x10d),_0x4153a0(0xee)];if(_0x2866d3[_0x4153a0(0x122)](_0x4a9e51))return _0x4a9e51;if(_0x4a9e51 in SITE_ALIASES)return SITE_ALIASES[_0x4a9e51];return console[_0x4153a0(0x131)](_0x4153a0(0x128)+_0x4a9e51+_0x4153a0(0x115)),_0x4153a0(0x121);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x32c699){const _0x34b890=_0x32c699||getActiveProfileName();if(_0x34b890){const _0x1f3377='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x34b890);if(process.env[_0x1f3377])return process.env[_0x1f3377];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x2290c8){const _0x40b005=a45_0x11610b;return _0x2290c8[_0x40b005(0x11a)]()[_0x40b005(0x133)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x3e9938,_0x2323c0){const _0x465e4b=a45_0x11610b,_0x38b08c=_0x2323c0||getActiveProfileName()||undefined;if(_0x38b08c){const _0x5b6c6d=_0x465e4b(0x117)+normalizeProfileForEnvVar(_0x38b08c);if(process.env[_0x5b6c6d])return{'apiKey':process.env[_0x5b6c6d],'source':_0x5b6c6d+'\x20env\x20var','isDeprecated':![]};const _0xd7cca3=getCachedCredential(_0x3e9938,_0x38b08c);if(_0xd7cca3)return{'apiKey':_0xd7cca3,'source':_0x465e4b(0xf6)+_0x38b08c+')','isDeprecated':![]};const _0x51a155=await getKeychainAPIKey(_0x38b08c);if(_0x51a155)return setCachedCredential(_0x51a155,_0x3e9938,_0x38b08c),{'apiKey':_0x51a155,'source':_0x465e4b(0xf6)+_0x38b08c+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x465e4b(0x125),'isDeprecated':![]};if(!_0x38b08c){const _0x228e9d=getCachedCredential(_0x3e9938,undefined);if(_0x228e9d)return{'apiKey':_0x228e9d,'source':_0x465e4b(0x10f),'isDeprecated':![]};const _0x44444a=await getKeychainAPIKey(undefined);if(_0x44444a)return setCachedCredential(_0x44444a,_0x3e9938,undefined),{'apiKey':_0x44444a,'source':_0x465e4b(0x10f),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x344de6,_0x20940a){const _0x57909d=a45_0x11610b,_0x56455e=await resolveAPIKeyAsync(_0x344de6,_0x20940a);return _0x56455e?.[_0x57909d(0x116)];}function cleanupLegacyEnvFile(_0x2acf62){const _0x255e56=a45_0x11610b;if(!existsSync(_0x2acf62))return![];try{const _0x111fd5=readFileSync(_0x2acf62,'utf-8'),_0x5c82b5=_0x111fd5[_0x255e56(0xf8)]('\x0a'),_0x5c76d2=_0x5c82b5[_0x255e56(0xfe)](_0x4dbd50=>{const _0x367db6=_0x255e56,_0x426d77=_0x4dbd50['trim']();if(!_0x426d77||_0x426d77['startsWith']('#'))return!![];const [_0xbef7eb]=_0x426d77[_0x367db6(0xf8)]('=');return!_0xbef7eb['startsWith'](_0x367db6(0x107));}),_0x37ada5=_0x5c76d2[_0x255e56(0xf7)](_0xe2f1dc=>{const _0x57364b=_0x255e56,_0x31478a=_0xe2f1dc[_0x57364b(0x134)]();return _0x31478a&&!_0x31478a[_0x57364b(0x12f)]('#');});if(!_0x37ada5)return unlinkSync(_0x2acf62),!![];return writeFileSync(_0x2acf62,_0x5c76d2[_0x255e56(0x132)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x286b6e=a45_0x11610b;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x3cfae8=a45_0x2d315e[_0x286b6e(0x132)](getConfigDir(),_0x286b6e(0x10c));if(!a45_0xf1a4ad[_0x286b6e(0x127)](_0x3cfae8))return null;try{const _0x23b093=a45_0xf1a4ad[_0x286b6e(0x108)](_0x3cfae8,'utf-8'),_0x10f4f8=JSON['parse'](_0x23b093);return _0x10f4f8[_0x286b6e(0xf5)]||null;}catch{return null;}}export function saveAPIKey(_0x22f4d6,_0x4d0d99,_0xcc3cbb){const _0x32e88b=a45_0x11610b,_0x1757df=getConfigDir(),_0x539e6e=getConfigFilePath(_0xcc3cbb);!existsSync(_0x1757df)&&mkdirSync(_0x1757df,{'recursive':!![],'mode':0x1c0});let _0x47b24f={};if(existsSync(_0x539e6e))try{const _0x525f06=readFileSync(_0x539e6e,_0x32e88b(0x118));_0x47b24f=parseEnvFile(_0x525f06);}catch(_0x305a83){console[_0x32e88b(0x131)](_0x32e88b(0x110)+_0x539e6e+':',_0x305a83);}const _0x3b4e11=_0x22f4d6[_0x32e88b(0x11a)]()[_0x32e88b(0x133)](/-/g,'_');_0x47b24f['TD_API_KEY_'+_0x3b4e11]=_0x4d0d99;const _0x14683b=Object[_0x32e88b(0xfa)](_0x47b24f)[_0x32e88b(0xef)](([_0x634eb0,_0x2a3233])=>_0x634eb0+'='+_0x2a3233);writeFileSync(_0x539e6e,_0x14683b[_0x32e88b(0x132)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x474852,_0x150416,_0x2cca1b){const _0x28d4e9=a45_0x11610b;await saveKeychainAPIKey(_0x474852,_0x2cca1b),setCachedCredential(_0x474852,_0x150416,_0x2cca1b);const _0x279434=getConfigFilePath(_0x2cca1b);cleanupLegacyEnvFile(_0x279434)&&console[_0x28d4e9(0x131)](a45_0x15bff3[_0x28d4e9(0x103)](_0x28d4e9(0x112)));}export function loadConfig(){const _0x2a7940=a45_0x11610b,_0x55f984={'apiKeys':{},'defaultSite':_0x2a7940(0x121)},_0x2a3ac5=['us01',_0x2a7940(0x113),_0x2a7940(0x100),_0x2a7940(0xf1),_0x2a7940(0x12b),_0x2a7940(0xff),_0x2a7940(0x104),'stg-us01',_0x2a7940(0x10d),_0x2a7940(0xee)],_0x3ff00d=getAPIKey();if(_0x3ff00d)for(const _0x511520 of _0x2a3ac5){_0x55f984[_0x2a7940(0x106)][_0x511520]=_0x3ff00d;}return _0x55f984;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x191cd8=a45_0x11610b,_0x5800ce=a45_0x2d315e[_0x191cd8(0x132)](getConfigDir(),_0x191cd8(0x10c));if(!a45_0xf1a4ad[_0x191cd8(0x127)](_0x5800ce))return undefined;try{const _0x7cc2aa=a45_0xf1a4ad[_0x191cd8(0x108)](_0x5800ce,_0x191cd8(0x118)),_0x116137=JSON['parse'](_0x7cc2aa);return typeof _0x116137['proxy']===_0x191cd8(0x120)?_0x116137[_0x191cd8(0xf3)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x338cc9=a45_0x11610b,_0x2cf24f=process.env.TDX_RELEASE_CHANNEL;if(_0x2cf24f===_0x338cc9(0x135)||_0x2cf24f===_0x338cc9(0x109))return _0x2cf24f;const _0x5f2a2f=a45_0x2d315e['join'](getConfigDir(),'tdx.json');if(!a45_0xf1a4ad['existsSync'](_0x5f2a2f))return _0x338cc9(0x109);try{const _0x989274=a45_0xf1a4ad[_0x338cc9(0x108)](_0x5f2a2f,_0x338cc9(0x118)),_0x300139=JSON[_0x338cc9(0x119)](_0x989274);if(_0x300139['release_channel']===_0x338cc9(0x135))return _0x338cc9(0x135);}catch{}return _0x338cc9(0x109);}export function saveReleaseChannel(_0x4d7525){const _0xcf4a8e=a45_0x11610b,_0xa8db01=getConfigDir(),_0x43ae92=a45_0x2d315e[_0xcf4a8e(0x132)](_0xa8db01,'tdx.json');!existsSync(_0xa8db01)&&mkdirSync(_0xa8db01,{'recursive':!![],'mode':0x1c0});let _0x28fc27={};if(existsSync(_0x43ae92))try{const _0x112631=readFileSync(_0x43ae92,'utf-8');_0x28fc27=JSON[_0xcf4a8e(0x119)](_0x112631);}catch{}_0x28fc27[_0xcf4a8e(0x11e)]=_0x4d7525,writeFileSync(_0x43ae92,JSON[_0xcf4a8e(0x11d)](_0x28fc27,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- function a46_0x2a0a(_0x255f39,_0x4ff85f){_0x255f39=_0x255f39-0x79;const _0x3c2fd3=a46_0x3c2f();let _0x2a0a44=_0x3c2fd3[_0x255f39];return _0x2a0a44;}function a46_0x3c2f(){const _0x3b68a1=['49866RtfSKs','441ijLeSy','581634qJWWVb','18cNFTpX','read','5MyFGSo','3771630IhfIDn','connections','300044LUEnbb','179124XMzJAU','2463152QxHbKE','480884hBhvvC'];a46_0x3c2f=function(){return _0x3b68a1;};return a46_0x3c2f();}(function(_0x4c90db,_0xf62521){const _0x152b87=a46_0x2a0a,_0x14c1f6=_0x4c90db();while(!![]){try{const _0xb51ce6=parseInt(_0x152b87(0x83))/0x1+parseInt(_0x152b87(0x81))/0x2+parseInt(_0x152b87(0x7a))/0x3+-parseInt(_0x152b87(0x80))/0x4*(-parseInt(_0x152b87(0x7d))/0x5)+parseInt(_0x152b87(0x84))/0x6*(-parseInt(_0x152b87(0x79))/0x7)+parseInt(_0x152b87(0x82))/0x8*(parseInt(_0x152b87(0x7b))/0x9)+-parseInt(_0x152b87(0x7e))/0xa;if(_0xb51ce6===_0xf62521)break;else _0x14c1f6['push'](_0x14c1f6['shift']());}catch(_0x8d72b9){_0x14c1f6['push'](_0x14c1f6['shift']());}}}(a46_0x3c2f,0x8757f));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache('connections-{profile}.json','core/connection-cache');export function loadCachedConnections(_0x159db9){const _0x5b78a3=a46_0x2a0a,_0x29b168=connectionCache[_0x5b78a3(0x7c)](_0x159db9);return _0x29b168?.[_0x5b78a3(0x7f)]??null;}export function saveCachedConnections(_0x4d355e,_0xaf1358){connectionCache['write'](_0x4d355e,{'connections':_0xaf1358,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x55a74a){connectionCache['clear'](_0x55a74a);}
1
+ const a46_0x175701=a46_0x3edf;(function(_0x52667b,_0x34307a){const _0x11eb3a=a46_0x3edf,_0x542abd=_0x52667b();while(!![]){try{const _0x2616f0=-parseInt(_0x11eb3a(0x147))/0x1+-parseInt(_0x11eb3a(0x151))/0x2+parseInt(_0x11eb3a(0x146))/0x3*(parseInt(_0x11eb3a(0x148))/0x4)+parseInt(_0x11eb3a(0x145))/0x5*(parseInt(_0x11eb3a(0x150))/0x6)+parseInt(_0x11eb3a(0x14f))/0x7+-parseInt(_0x11eb3a(0x14c))/0x8*(parseInt(_0x11eb3a(0x149))/0x9)+parseInt(_0x11eb3a(0x152))/0xa;if(_0x2616f0===_0x34307a)break;else _0x542abd['push'](_0x542abd['shift']());}catch(_0xf5ff88){_0x542abd['push'](_0x542abd['shift']());}}}(a46_0x1c0b,0x47cea));import{createProfileCache}from'../utils/global-cache.js';function a46_0x1c0b(){const _0x5403dd=['6aizgaq','906042QmSKsg','776720JIuiLc','1697650CDAtcA','1317324yWDiUq','385633PHEgvF','4TlMweP','2736HDLxUi','connections','core/connection-cache','6496VZckBb','clear','connections-{profile}.json','3663198PQdhlt'];a46_0x1c0b=function(){return _0x5403dd;};return a46_0x1c0b();}const connectionCache=createProfileCache(a46_0x175701(0x14e),a46_0x175701(0x14b));function a46_0x3edf(_0xedb7af,_0x1d8a46){_0xedb7af=_0xedb7af-0x145;const _0x1c0b09=a46_0x1c0b();let _0x3edf4e=_0x1c0b09[_0xedb7af];return _0x3edf4e;}export function loadCachedConnections(_0x203fd4){const _0x57c149=a46_0x175701,_0x51dc63=connectionCache['read'](_0x203fd4);return _0x51dc63?.[_0x57c149(0x14a)]??null;}export function saveCachedConnections(_0x54869f,_0x2d3940){connectionCache['write'](_0x54869f,{'connections':_0x2d3940,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x4fc841){const _0x2c3697=a46_0x175701;connectionCache[_0x2c3697(0x14d)](_0x4fc841);}
@@ -1 +1 @@
1
- function a47_0x2d85(_0x4b168a,_0x573861){_0x4b168a=_0x4b168a-0x129;const _0x30b9f7=a47_0x30b9();let _0x2d8552=_0x30b9f7[_0x4b168a];return _0x2d8552;}const a47_0xcb5a1=a47_0x2d85;(function(_0x34ed7f,_0x3bc428){const _0x47e898=a47_0x2d85,_0x401ea1=_0x34ed7f();while(!![]){try{const _0x5844e4=parseInt(_0x47e898(0x13d))/0x1*(parseInt(_0x47e898(0x12d))/0x2)+parseInt(_0x47e898(0x13c))/0x3+-parseInt(_0x47e898(0x13e))/0x4+parseInt(_0x47e898(0x13a))/0x5*(parseInt(_0x47e898(0x137))/0x6)+parseInt(_0x47e898(0x135))/0x7*(-parseInt(_0x47e898(0x130))/0x8)+-parseInt(_0x47e898(0x12c))/0x9+-parseInt(_0x47e898(0x132))/0xa*(-parseInt(_0x47e898(0x129))/0xb);if(_0x5844e4===_0x3bc428)break;else _0x401ea1['push'](_0x401ea1['shift']());}catch(_0x1de475){_0x401ea1['push'](_0x401ea1['shift']());}}}(a47_0x30b9,0x9de71));function a47_0x30b9(){const _0x4dd2bc=['value','us\x20\x20\x20-\x20United\x20States','7900317xOhQXM','1841110OXMIUy','length','other','16UHqbus','ap02','14079790qrJDqh','jp\x20\x20\x20-\x20Japan','eu\x20\x20\x20-\x20Europe','4264694kFHawW','Enter\x20custom\x20site','47466HSTjbL','findIndex','us01','405aDCJhi','push','738894rMtKiy','1dIkNKz','1890228UOoGSO','ap02\x20-\x20Korea','11zUGxhq'];a47_0x30b9=function(){return _0x4dd2bc;};return a47_0x30b9();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x22a040,_0x5448d0){if(_0x22a040===undefined)return _0x5448d0;if(typeof _0x22a040==='number')return _0x22a040;return parseInt(_0x22a040,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a47_0xcb5a1(0x12b),'value':a47_0xcb5a1(0x139)},{'title':a47_0xcb5a1(0x133),'value':'jp01'},{'title':a47_0xcb5a1(0x134),'value':'eu01'},{'title':a47_0xcb5a1(0x13f),'value':a47_0xcb5a1(0x131)}];export function buildSiteChoices(_0x5b2a5f){const _0x6c835=a47_0xcb5a1,_0x3e2246=[...STANDARD_SITE_CHOICES];let _0x13ea9b=_0x3e2246[_0x6c835(0x138)](_0x5b2a1d=>_0x5b2a1d[_0x6c835(0x12a)]===_0x5b2a5f);return _0x13ea9b===-0x1&&_0x5b2a5f!==_0x6c835(0x139)&&(_0x3e2246['push']({'title':_0x5b2a5f,'value':_0x5b2a5f}),_0x13ea9b=_0x3e2246[_0x6c835(0x12e)]-0x1),_0x3e2246[_0x6c835(0x13b)]({'title':_0x6c835(0x136),'value':_0x6c835(0x12f)}),{'choices':_0x3e2246,'initialIndex':_0x13ea9b>=0x0?_0x13ea9b:0x0};}
1
+ const a47_0x220d1f=a47_0x29a6;(function(_0x2f0727,_0x1eb981){const _0x580a7b=a47_0x29a6,_0x549fa3=_0x2f0727();while(!![]){try{const _0x1837bd=parseInt(_0x580a7b(0x7b))/0x1+-parseInt(_0x580a7b(0x66))/0x2*(-parseInt(_0x580a7b(0x71))/0x3)+-parseInt(_0x580a7b(0x7a))/0x4*(parseInt(_0x580a7b(0x65))/0x5)+parseInt(_0x580a7b(0x6e))/0x6*(-parseInt(_0x580a7b(0x6d))/0x7)+parseInt(_0x580a7b(0x70))/0x8*(parseInt(_0x580a7b(0x77))/0x9)+parseInt(_0x580a7b(0x69))/0xa*(parseInt(_0x580a7b(0x68))/0xb)+parseInt(_0x580a7b(0x72))/0xc*(-parseInt(_0x580a7b(0x6b))/0xd);if(_0x1837bd===_0x1eb981)break;else _0x549fa3['push'](_0x549fa3['shift']());}catch(_0x506f43){_0x549fa3['push'](_0x549fa3['shift']());}}}(a47_0x5568,0x68622));function a47_0x5568(){const _0x4e3a1c=['6069KooxFt','786aHBuCn','length','14192aWDPjY','75jHaozV','11078760TBvzXw','Enter\x20custom\x20site','eu01','us01','ap02\x20-\x20Korea','3231ryFWcd','number','other','393628FwCCfr','675640wrOesN','eu\x20\x20\x20-\x20Europe','jp\x20\x20\x20-\x20Japan','push','25KCDZAm','18022TlJFii','ap02','31757dEJqaC','1450ofzHBX','us\x20\x20\x20-\x20United\x20States','13hSrnqn','value'];a47_0x5568=function(){return _0x4e3a1c;};return a47_0x5568();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x26fe62,_0x25ff9d){const _0x3c2df5=a47_0x29a6;if(_0x26fe62===undefined)return _0x25ff9d;if(typeof _0x26fe62===_0x3c2df5(0x78))return _0x26fe62;return parseInt(_0x26fe62,0xa);}function a47_0x29a6(_0x2a6a78,_0x592ce3){_0x2a6a78=_0x2a6a78-0x65;const _0x5568cc=a47_0x5568();let _0x29a6e3=_0x5568cc[_0x2a6a78];return _0x29a6e3;}export const STANDARD_SITE_CHOICES=[{'title':a47_0x220d1f(0x6a),'value':a47_0x220d1f(0x75)},{'title':a47_0x220d1f(0x7d),'value':'jp01'},{'title':a47_0x220d1f(0x7c),'value':a47_0x220d1f(0x74)},{'title':a47_0x220d1f(0x76),'value':a47_0x220d1f(0x67)}];export function buildSiteChoices(_0x2edc48){const _0x58fac8=a47_0x220d1f,_0x195c38=[...STANDARD_SITE_CHOICES];let _0x493fdb=_0x195c38['findIndex'](_0x17af94=>_0x17af94[_0x58fac8(0x6c)]===_0x2edc48);return _0x493fdb===-0x1&&_0x2edc48!==_0x58fac8(0x75)&&(_0x195c38[_0x58fac8(0x7e)]({'title':_0x2edc48,'value':_0x2edc48}),_0x493fdb=_0x195c38[_0x58fac8(0x6f)]-0x1),_0x195c38[_0x58fac8(0x7e)]({'title':_0x58fac8(0x73),'value':_0x58fac8(0x79)}),{'choices':_0x195c38,'initialIndex':_0x493fdb>=0x0?_0x493fdb:0x0};}
@@ -1 +1 @@
1
- (function(_0x48084d,_0x1e96f7){const _0x598455=a48_0x5975,_0x4fe10e=_0x48084d();while(!![]){try{const _0x13107a=parseInt(_0x598455(0xcd))/0x1*(-parseInt(_0x598455(0xd0))/0x2)+-parseInt(_0x598455(0xce))/0x3*(parseInt(_0x598455(0xd2))/0x4)+parseInt(_0x598455(0xdd))/0x5+parseInt(_0x598455(0xdb))/0x6*(parseInt(_0x598455(0xd8))/0x7)+parseInt(_0x598455(0xcf))/0x8*(parseInt(_0x598455(0xdc))/0x9)+parseInt(_0x598455(0xde))/0xa+parseInt(_0x598455(0xd5))/0xb*(parseInt(_0x598455(0xd7))/0xc);if(_0x13107a===_0x1e96f7)break;else _0x4fe10e['push'](_0x4fe10e['shift']());}catch(_0x2d5ab4){_0x4fe10e['push'](_0x4fe10e['shift']());}}}(a48_0x7d2b,0x387c0));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a48_0x5975(_0x30341c,_0x2c78e6){_0x30341c=_0x30341c-0xcc;const _0x7d2b88=a48_0x7d2b();let _0x5975f3=_0x7d2b88[_0x30341c];return _0x5975f3;}function getCacheKey(_0x2a90e5,_0x45d55f){const _0x1b945e=a48_0x5975,_0x669081=_0x2a90e5||_0x1b945e(0xd4),_0x4bedb0=_0x45d55f||_0x1b945e(0xcc);return _0x669081+':'+_0x4bedb0;}function a48_0x7d2b(){const _0x264c01=['1ooQgrU','33YCXSwm','40eGTeGR','350782xAWTWd','get','138324ACHGAa','delete','__default_site__','11SQgbqG','loadedAt','801312rATqBp','385126opPXyM','now','set','18DpAaQm','196119erkOAX','931530pUTjyS','2600510CGNAAS','__default_profile__'];a48_0x7d2b=function(){return _0x264c01;};return a48_0x7d2b();}export function getCachedCredential(_0x11e0f3,_0xca38ab){const _0x1a2040=a48_0x5975,_0x447669=getCacheKey(_0x11e0f3,_0xca38ab),_0x1e596c=cache[_0x1a2040(0xd1)](_0x447669);if(!_0x1e596c)return null;if(Date['now']()-_0x1e596c[_0x1a2040(0xd6)]>CACHE_TTL_MS)return cache[_0x1a2040(0xd3)](_0x447669),null;return _0x1e596c['apiKey'];}export function setCachedCredential(_0x98a1ab,_0x5e1709,_0x4f3acb){const _0x4b4958=a48_0x5975,_0xfb1248=getCacheKey(_0x5e1709,_0x4f3acb);cache[_0x4b4958(0xda)](_0xfb1248,{'apiKey':_0x98a1ab,'loadedAt':Date[_0x4b4958(0xd9)]()});}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x35a540,_0x22d7bb){const _0x213f07=a48_0x5975,_0x30b3f9=getCacheKey(_0x35a540,_0x22d7bb);cache[_0x213f07(0xd3)](_0x30b3f9);}
1
+ (function(_0x496cbe,_0x414a70){const _0x3a3c76=a48_0x1d74,_0x31e7e0=_0x496cbe();while(!![]){try{const _0x14e22a=-parseInt(_0x3a3c76(0x18c))/0x1*(parseInt(_0x3a3c76(0x193))/0x2)+-parseInt(_0x3a3c76(0x197))/0x3*(parseInt(_0x3a3c76(0x194))/0x4)+-parseInt(_0x3a3c76(0x191))/0x5+parseInt(_0x3a3c76(0x192))/0x6+parseInt(_0x3a3c76(0x199))/0x7+-parseInt(_0x3a3c76(0x18b))/0x8+parseInt(_0x3a3c76(0x18d))/0x9;if(_0x14e22a===_0x414a70)break;else _0x31e7e0['push'](_0x31e7e0['shift']());}catch(_0x1f7dcd){_0x31e7e0['push'](_0x31e7e0['shift']());}}}(a48_0x2100,0xa869a));function a48_0x1d74(_0x4d1b48,_0x4f3fed){_0x4d1b48=_0x4d1b48-0x18a;const _0x21005d=a48_0x2100();let _0x1d74ca=_0x21005d[_0x4d1b48];return _0x1d74ca;}function a48_0x2100(){const _0x46551c=['230769zTIDok','loadedAt','3124100XkYFsm','__default_site__','7787368VGcdwn','576593pzwcOk','21536901UYrAJP','get','apiKey','delete','391615MwPtUt','3563520RwynAC','4qjXsfq','28rJcdkP','now','set'];a48_0x2100=function(){return _0x46551c;};return a48_0x2100();}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x37e28f,_0x38a841){const _0x4aa0ef=a48_0x1d74,_0x41bbfa=_0x37e28f||_0x4aa0ef(0x18a),_0x1eeb49=_0x38a841||'__default_profile__';return _0x41bbfa+':'+_0x1eeb49;}export function getCachedCredential(_0x5845d7,_0x104bdd){const _0x158b71=a48_0x1d74,_0x4c7be0=getCacheKey(_0x5845d7,_0x104bdd),_0x2e5986=cache[_0x158b71(0x18e)](_0x4c7be0);if(!_0x2e5986)return null;if(Date[_0x158b71(0x195)]()-_0x2e5986[_0x158b71(0x198)]>CACHE_TTL_MS)return cache[_0x158b71(0x190)](_0x4c7be0),null;return _0x2e5986[_0x158b71(0x18f)];}export function setCachedCredential(_0x229d0f,_0x1611aa,_0x32f548){const _0x3c830e=a48_0x1d74,_0x4de728=getCacheKey(_0x1611aa,_0x32f548);cache[_0x3c830e(0x196)](_0x4de728,{'apiKey':_0x229d0f,'loadedAt':Date[_0x3c830e(0x195)]()});}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x12c921,_0x17ce60){const _0x26fd80=a48_0x1d74,_0x1ffbb1=getCacheKey(_0x12c921,_0x17ce60);cache[_0x26fd80(0x190)](_0x1ffbb1);}
@@ -1 +1 @@
1
- const a49_0x4bab97=a49_0x5837;(function(_0x5f08b0,_0x3b7ed5){const _0x505ce6=a49_0x5837,_0x1de7e1=_0x5f08b0();while(!![]){try{const _0x4a3122=parseInt(_0x505ce6(0x16d))/0x1+-parseInt(_0x505ce6(0x17b))/0x2+-parseInt(_0x505ce6(0x166))/0x3+-parseInt(_0x505ce6(0x175))/0x4+parseInt(_0x505ce6(0x158))/0x5*(parseInt(_0x505ce6(0x1a2))/0x6)+-parseInt(_0x505ce6(0x16c))/0x7*(parseInt(_0x505ce6(0x198))/0x8)+parseInt(_0x505ce6(0x17d))/0x9*(parseInt(_0x505ce6(0x17c))/0xa);if(_0x4a3122===_0x3b7ed5)break;else _0x1de7e1['push'](_0x1de7e1['shift']());}catch(_0x52159b){_0x1de7e1['push'](_0x1de7e1['shift']());}}}(a49_0x5a2d,0xc1024));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';function a49_0x5837(_0x1c8d88,_0x288959){_0x1c8d88=_0x1c8d88-0x157;const _0x5a2d26=a49_0x5a2d();let _0x58379f=_0x5a2d26[_0x1c8d88];return _0x58379f;}import{LogLevel}from'../utils/logger/index.js';import*as a49_0x551701 from'node:fs';import*as a49_0x33c173 from'node:path';function a49_0x5a2d(){const _0x8da33d=['getParameters','cyan','llm_project','10890184xyOlCa','string','getSource','displayWithSources','configFiles','dim','profile:\x20','parentSegment','llmAgent','log','40662DJRDMd','activeProfile','925mmWOwu','session','workflowProject','proxy','(session:\x20','segmentPath','layers','utf-8','profileSource','default','verbose','INFO','globalCredentials','workflow_project','2562573gnqFkU','database','Session','profiles','.json','none','7eeeGLQ','775453rpulDx','segment_path','parent_segment','assign','join','[configuration\x20files]','profile','logLevel','5584004ZOhYve','us01','llmProject','sessionId','Profile\x20Credentials','existsSync','1257326gByxsx','30gvZEgm','9004482gJufxy','bold','replace','llm_agent','config','[context]','cliFlags','Profile','profileCredentials','Project','display','not\x20set','global','resolveAPIKeyAsync','apiKey','Global','site','loadGlobalConfig','project','entries','tdx.json','green','Global\x20Credentials','readFileSync'];a49_0x5a2d=function(){return _0x8da33d;};return a49_0x5a2d();}import a49_0x5c2e4d from'chalk';export class GlobalContext{[a49_0x4bab97(0x18d)];['database'];[a49_0x4bab97(0x16f)];['segment_path'];['llm_project'];[a49_0x4bab97(0x180)];[a49_0x4bab97(0x165)];[a49_0x4bab97(0x18b)];['proxy'];[a49_0x4bab97(0x162)];[a49_0x4bab97(0x174)];[a49_0x4bab97(0x173)];[a49_0x4bab97(0x160)]=null;[a49_0x4bab97(0x15e)];[a49_0x4bab97(0x157)];['sessionId'];[a49_0x4bab97(0x19c)];constructor(_0x497b08){const _0x19d1ba=a49_0x4bab97;this[_0x19d1ba(0x178)]=getSessionID(_0x497b08['session']);const _0x15f9e8=loadSessionContext(_0x497b08[_0x19d1ba(0x159)]),_0x5b2087=loadProjectConfig(),_0x4cee5b=this[_0x19d1ba(0x18e)]();if(_0x497b08['profile'])this['activeProfile']=_0x497b08[_0x19d1ba(0x173)],this['profileSource']='cli';else{if(_0x15f9e8?.[_0x19d1ba(0x173)])this[_0x19d1ba(0x157)]=_0x15f9e8[_0x19d1ba(0x173)],this[_0x19d1ba(0x160)]=_0x19d1ba(0x159);else{if(_0x4cee5b[_0x19d1ba(0x173)])this[_0x19d1ba(0x157)]=_0x4cee5b['profile'],this[_0x19d1ba(0x160)]=_0x19d1ba(0x181);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x19d1ba(0x160)]='env'):(this[_0x19d1ba(0x157)]=null,this[_0x19d1ba(0x160)]=null);}}const _0x513347=this[_0x19d1ba(0x157)]?loadProfile(this[_0x19d1ba(0x157)]):null,_0x16ea80=_0x3097bd=>{const _0x104d7c=_0x19d1ba;if(!_0x3097bd)return{};const _0x4310cf=_0x3097bd,_0x2f6818={};for(const [_0x326ff3,_0x9cab24]of Object[_0x104d7c(0x190)](_0x4310cf)){typeof _0x9cab24===_0x104d7c(0x199)&&(_0x2f6818[_0x326ff3]=_0x9cab24);}return _0x2f6818;},_0x329ec1={},_0xc7c7f1=(_0x3cf45c,_0x1a37a0,_0x450b25)=>{const _0x101918=_0x19d1ba;if(!_0x3cf45c)return![];if(_0x450b25&&_0x3cf45c===_0x450b25)return![];const _0xe32cef=_0x15f9e8,_0x12db6c=_0x5b2087,_0x2384e6=_0x513347?.[_0x101918(0x181)],_0x56e3f1=_0x4cee5b,_0x445b56=_0xe32cef?.[_0x1a37a0],_0x303c5a=_0x12db6c?.[_0x1a37a0],_0x467887=_0x2384e6?.[_0x1a37a0],_0x1cc376=_0x56e3f1[_0x1a37a0];return _0x3cf45c!==_0x445b56&&_0x3cf45c!==_0x303c5a&&_0x3cf45c!==_0x467887&&_0x3cf45c!==_0x1cc376;},_0x2b0fd6=[{'optionKey':'site','contextKey':_0x19d1ba(0x18d),'defaultValue':_0x19d1ba(0x176)},{'optionKey':_0x19d1ba(0x167),'contextKey':_0x19d1ba(0x167)},{'optionKey':_0x19d1ba(0x19f),'contextKey':_0x19d1ba(0x16f)},{'optionKey':_0x19d1ba(0x177),'contextKey':'llm_project'},{'optionKey':_0x19d1ba(0x1a0),'contextKey':'llm_agent'},{'optionKey':_0x19d1ba(0x173),'contextKey':'profile'}];for(const {optionKey:_0x10e50a,contextKey:_0x376fec,defaultValue:_0x272b45}of _0x2b0fd6){const _0x598b19=_0x497b08[_0x10e50a];_0xc7c7f1(_0x598b19,_0x376fec,_0x272b45)&&(_0x329ec1[_0x376fec]=_0x598b19);}this[_0x19d1ba(0x15e)]={'cliFlags':_0x329ec1,'session':_0x16ea80(_0x15f9e8),'project':_0x16ea80(_0x5b2087),'profile':_0x16ea80(_0x513347?.[_0x19d1ba(0x181)]),'global':_0x16ea80(_0x4cee5b)};const _0x37ee88={...this[_0x19d1ba(0x15e)][_0x19d1ba(0x189)],...this[_0x19d1ba(0x15e)][_0x19d1ba(0x173)],...this[_0x19d1ba(0x15e)]['project']};process.env.TDX_SITE&&!this[_0x19d1ba(0x15e)][_0x19d1ba(0x159)]['site']&&!this[_0x19d1ba(0x15e)][_0x19d1ba(0x183)][_0x19d1ba(0x18d)]&&(_0x37ee88[_0x19d1ba(0x18d)]=process.env.TDX_SITE);Object[_0x19d1ba(0x170)](_0x37ee88,this['layers'][_0x19d1ba(0x159)]),Object[_0x19d1ba(0x170)](_0x37ee88,this[_0x19d1ba(0x15e)][_0x19d1ba(0x183)]);const _0x4e0708=_0x37ee88['site']||_0x19d1ba(0x176);this[_0x19d1ba(0x18d)]=resolveSite(_0x4e0708),this[_0x19d1ba(0x167)]=_0x37ee88[_0x19d1ba(0x167)],this[_0x19d1ba(0x16f)]=_0x37ee88[_0x19d1ba(0x16f)],this['segment_path']=_0x37ee88['segment_path'],this[_0x19d1ba(0x197)]=_0x37ee88[_0x19d1ba(0x197)],this[_0x19d1ba(0x180)]=_0x37ee88[_0x19d1ba(0x180)],this[_0x19d1ba(0x165)]=_0x37ee88[_0x19d1ba(0x165)],this[_0x19d1ba(0x162)]=_0x497b08[_0x19d1ba(0x162)]||![],this[_0x19d1ba(0x174)]=_0x497b08[_0x19d1ba(0x174)]??LogLevel[_0x19d1ba(0x163)],this[_0x19d1ba(0x173)]=this[_0x19d1ba(0x157)]||undefined,this[_0x19d1ba(0x18b)]=getAPIKey(this[_0x19d1ba(0x157)]||undefined);const _0x19c8fc=typeof _0x4cee5b['proxy']==='string'?_0x4cee5b[_0x19d1ba(0x15b)]:undefined;this['proxy']=_0x19c8fc||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x70c03b=getConfigDir(),_0x41e891=a49_0x33c173[_0x19d1ba(0x171)](_0x70c03b,'sessions',this[_0x19d1ba(0x178)]+_0x19d1ba(0x16a)),_0xcd3c99=findProjectConfigPath(),_0x167a45=a49_0x33c173['join'](_0x70c03b,'tdx.json'),_0x3e3aa2=a49_0x33c173['join'](_0x70c03b,'.env');let _0x47680b=null,_0x5038b4=null;this['activeProfile']&&(_0x47680b=a49_0x33c173[_0x19d1ba(0x171)](_0x70c03b,_0x19d1ba(0x169),this[_0x19d1ba(0x157)],'tdx.json'),_0x5038b4=a49_0x33c173[_0x19d1ba(0x171)](_0x70c03b,_0x19d1ba(0x169),this[_0x19d1ba(0x157)],'.env')),this[_0x19d1ba(0x19c)]={'session':a49_0x551701[_0x19d1ba(0x17a)](_0x41e891)?_0x41e891:null,'project':_0xcd3c99,'profile':_0x47680b&&a49_0x551701[_0x19d1ba(0x17a)](_0x47680b)?_0x47680b:null,'profileCredentials':_0x5038b4&&a49_0x551701[_0x19d1ba(0x17a)](_0x5038b4)?_0x5038b4:null,'global':a49_0x551701[_0x19d1ba(0x17a)](_0x167a45)?_0x167a45:null,'globalCredentials':a49_0x551701[_0x19d1ba(0x17a)](_0x3e3aa2)?_0x3e3aa2:null};}[a49_0x4bab97(0x19a)](_0x43a0ca,_0x5bfcad){const _0x11f8b3=a49_0x4bab97;if(!_0x5bfcad)return _0x11f8b3(0x188);const _0x515096=_0x5bfcad;if(this[_0x11f8b3(0x15e)][_0x11f8b3(0x183)][_0x43a0ca]===_0x515096){if(_0x43a0ca===_0x11f8b3(0x18d)&&_0x515096===_0x11f8b3(0x176)&&!this[_0x11f8b3(0x15e)][_0x11f8b3(0x159)]['site']&&!this[_0x11f8b3(0x15e)][_0x11f8b3(0x18f)][_0x11f8b3(0x18d)]&&!this[_0x11f8b3(0x15e)][_0x11f8b3(0x173)]['site']&&!this[_0x11f8b3(0x15e)][_0x11f8b3(0x189)][_0x11f8b3(0x18d)])return _0x11f8b3(0x161);return'CLI\x20flag:\x20--'+_0x43a0ca[_0x11f8b3(0x17f)](/_/g,'-');}if(this[_0x11f8b3(0x15e)]['session'][_0x43a0ca]===_0x515096)return _0x11f8b3(0x159);if(this[_0x11f8b3(0x15e)][_0x11f8b3(0x18f)][_0x43a0ca]===_0x515096)return _0x11f8b3(0x18f);if(this[_0x11f8b3(0x15e)][_0x11f8b3(0x173)][_0x43a0ca]===_0x515096)return _0x11f8b3(0x19e)+this['activeProfile'];if(this['layers'][_0x11f8b3(0x189)][_0x43a0ca]===_0x515096)return _0x11f8b3(0x189);return _0x11f8b3(0x161);}['loadGlobalConfig'](){const _0x63b2eb=a49_0x4bab97,_0x5263a0=a49_0x33c173[_0x63b2eb(0x171)](getConfigDir(),_0x63b2eb(0x191));if(!a49_0x551701[_0x63b2eb(0x17a)](_0x5263a0))return{};try{const _0x94edf6=a49_0x551701[_0x63b2eb(0x194)](_0x5263a0,_0x63b2eb(0x15f));return JSON['parse'](_0x94edf6);}catch{return{};}}['injectIntoOptions'](_0x1ce793){const _0x3f4046=a49_0x4bab97;_0x1ce793[_0x3f4046(0x18d)]=this[_0x3f4046(0x18d)],!_0x1ce793['database']&&this[_0x3f4046(0x167)]&&(_0x1ce793[_0x3f4046(0x167)]=this[_0x3f4046(0x167)]),!_0x1ce793['parentSegment']&&this[_0x3f4046(0x16f)]&&(_0x1ce793[_0x3f4046(0x19f)]=this[_0x3f4046(0x16f)]),!_0x1ce793[_0x3f4046(0x15d)]&&this['segment_path']&&(_0x1ce793[_0x3f4046(0x15d)]=this['segment_path']),!_0x1ce793['llmProject']&&this[_0x3f4046(0x197)]&&(_0x1ce793[_0x3f4046(0x177)]=this['llm_project']),!_0x1ce793[_0x3f4046(0x1a0)]&&this[_0x3f4046(0x180)]&&(_0x1ce793[_0x3f4046(0x1a0)]=this[_0x3f4046(0x180)]),!_0x1ce793[_0x3f4046(0x15a)]&&this[_0x3f4046(0x165)]&&(_0x1ce793[_0x3f4046(0x15a)]=this[_0x3f4046(0x165)]);}[a49_0x4bab97(0x195)](){const _0x9cdffc=a49_0x4bab97;return[{'key':_0x9cdffc(0x18d),'value':this[_0x9cdffc(0x18d)]},{'key':_0x9cdffc(0x167),'value':this['database']},{'key':'parent_segment','value':this[_0x9cdffc(0x16f)]},{'key':_0x9cdffc(0x16e),'value':this[_0x9cdffc(0x16e)]},{'key':_0x9cdffc(0x197),'value':this[_0x9cdffc(0x197)]},{'key':_0x9cdffc(0x180),'value':this[_0x9cdffc(0x180)]},{'key':_0x9cdffc(0x165),'value':this[_0x9cdffc(0x165)]},{'key':'profile','value':this[_0x9cdffc(0x157)]||undefined}];}[a49_0x4bab97(0x187)](){const _0x3da3cd=a49_0x4bab97;console['log'](a49_0x5c2e4d[_0x3da3cd(0x17e)]('[context]'));for(const {key:_0x6cb505,value:_0x562798}of this['getParameters']()){_0x562798&&console[_0x3da3cd(0x1a1)](a49_0x5c2e4d[_0x3da3cd(0x196)](_0x6cb505)+':\x20'+_0x562798);}}[a49_0x4bab97(0x19b)](){const _0x1db2c7=a49_0x4bab97;console[_0x1db2c7(0x1a1)](a49_0x5c2e4d[_0x1db2c7(0x17e)](_0x1db2c7(0x182)));for(const {key:_0x4bf25c,value:_0x326d0b}of this[_0x1db2c7(0x195)]()){if(_0x326d0b){const _0x38ba15=_0x4bf25c===_0x1db2c7(0x173)?'(active)':'('+this[_0x1db2c7(0x19a)](_0x4bf25c,_0x326d0b)+')';console['log'](a49_0x5c2e4d[_0x1db2c7(0x196)](_0x4bf25c)+':\x20'+_0x326d0b+'\x20'+a49_0x5c2e4d[_0x1db2c7(0x19d)](_0x38ba15));}}console[_0x1db2c7(0x1a1)]('\x0a'+a49_0x5c2e4d[_0x1db2c7(0x17e)](_0x1db2c7(0x172)));const _0x22047d=[{'label':_0x1db2c7(0x168),'path':this[_0x1db2c7(0x19c)][_0x1db2c7(0x159)],'extra':_0x1db2c7(0x15c)+this['sessionId']+')'},{'label':_0x1db2c7(0x186),'path':this[_0x1db2c7(0x19c)][_0x1db2c7(0x18f)]},{'label':_0x1db2c7(0x184),'path':this[_0x1db2c7(0x19c)][_0x1db2c7(0x173)]},{'label':_0x1db2c7(0x179),'path':this['configFiles'][_0x1db2c7(0x185)]},{'label':'Global','path':this['configFiles'][_0x1db2c7(0x189)]},{'label':_0x1db2c7(0x193),'path':this[_0x1db2c7(0x19c)][_0x1db2c7(0x164)]}];for(const {label:_0x270169,path:_0x5bbb46,extra:_0x34546e}of _0x22047d){if(_0x5bbb46)console['log'](a49_0x5c2e4d['cyan'](_0x270169)+':\x20'+_0x5bbb46+'\x20'+a49_0x5c2e4d[_0x1db2c7(0x192)]('✓')+(_0x34546e?'\x20'+a49_0x5c2e4d[_0x1db2c7(0x19d)](_0x34546e):''));else{if(_0x270169===_0x1db2c7(0x168))console[_0x1db2c7(0x1a1)](a49_0x5c2e4d[_0x1db2c7(0x196)](_0x270169)+':\x20'+a49_0x5c2e4d[_0x1db2c7(0x19d)](_0x1db2c7(0x16b))+'\x20'+a49_0x5c2e4d[_0x1db2c7(0x19d)]('(using\x20session:\x20'+this[_0x1db2c7(0x178)]+')'));else(_0x270169===_0x1db2c7(0x186)||_0x270169===_0x1db2c7(0x18c))&&console[_0x1db2c7(0x1a1)](a49_0x5c2e4d[_0x1db2c7(0x196)](_0x270169)+':\x20'+a49_0x5c2e4d[_0x1db2c7(0x19d)](_0x1db2c7(0x16b)));}}}async['resolveAPIKeyAsync'](){const _0x459321=a49_0x4bab97;return this[_0x459321(0x18b)]=await getAPIKeyAsync(this['site'],this[_0x459321(0x157)]||undefined),this['apiKey'];}static async['createAsync'](_0x2d9c73){const _0x5e1804=a49_0x4bab97,_0x236f61=new GlobalContext(_0x2d9c73);return await _0x236f61[_0x5e1804(0x18a)](),_0x236f61;}}
1
+ function a49_0x4ca2(_0x46b021,_0xe4a76f){_0x46b021=_0x46b021-0xa3;const _0xfdcdd3=a49_0xfdcd();let _0x4ca2af=_0xfdcdd3[_0x46b021];return _0x4ca2af;}const a49_0x4591f1=a49_0x4ca2;(function(_0x40dcba,_0x4f2e28){const _0x47bb02=a49_0x4ca2,_0x3a0b31=_0x40dcba();while(!![]){try{const _0x4204e1=parseInt(_0x47bb02(0xcd))/0x1*(parseInt(_0x47bb02(0xce))/0x2)+-parseInt(_0x47bb02(0xd8))/0x3+-parseInt(_0x47bb02(0xab))/0x4+-parseInt(_0x47bb02(0xd2))/0x5+-parseInt(_0x47bb02(0xb8))/0x6+-parseInt(_0x47bb02(0xd1))/0x7*(parseInt(_0x47bb02(0xd6))/0x8)+parseInt(_0x47bb02(0xd3))/0x9*(parseInt(_0x47bb02(0xbc))/0xa);if(_0x4204e1===_0x4f2e28)break;else _0x3a0b31['push'](_0x3a0b31['shift']());}catch(_0x576244){_0x3a0b31['push'](_0x3a0b31['shift']());}}}(a49_0xfdcd,0xcf70f));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_0x237ac6 from'node:fs';function a49_0xfdcd(){const _0x5867be=['3650250DdBmXc','entries','Profile','profile','10KCAvBJ','createAsync','Session','profileSource','database','site','log','(session:\x20','none','session','tdx.json','Global','[configuration\x20files]','Profile\x20Credentials','llm_agent','configFiles','(using\x20session:\x20','1ggrmeR','1870566CuLMsu','getParameters','apiKey','7hqzuDA','2757695ZikitC','23116851dAqSyO','Project','bold','526984wzlXoX','cyan','3241836UuBXOn','env','sessions','segmentPath','workflow_project','project','not\x20set','resolveAPIKeyAsync','loadGlobalConfig','dim','cli','sessionId','cliFlags','config','segment_path','global','[context]','workflowProject','existsSync','join','display','readFileSync','activeProfile','parent_segment','default','green','.env','globalCredentials','profile:\x20','layers','llm_project','assign','logLevel','1390976RRyvFZ','parentSegment','verbose','string','Global\x20Credentials','getSource','llmAgent','parse','CLI\x20flag:\x20--','llmProject','proxy','us01','INFO'];a49_0xfdcd=function(){return _0x5867be;};return a49_0xfdcd();}import*as a49_0x37e243 from'node:path';import a49_0x10ab9d from'chalk';export class GlobalContext{['site'];[a49_0x4591f1(0xc0)];[a49_0x4591f1(0xef)];['segment_path'];['llm_project'];[a49_0x4591f1(0xca)];[a49_0x4591f1(0xdc)];[a49_0x4591f1(0xd0)];[a49_0x4591f1(0xb5)];[a49_0x4591f1(0xad)];['logLevel'];[a49_0x4591f1(0xbb)];[a49_0x4591f1(0xbf)]=null;[a49_0x4591f1(0xa7)];[a49_0x4591f1(0xee)];[a49_0x4591f1(0xe3)];[a49_0x4591f1(0xcb)];constructor(_0x5bd6e2){const _0x594eb9=a49_0x4591f1;this[_0x594eb9(0xe3)]=getSessionID(_0x5bd6e2[_0x594eb9(0xc5)]);const _0x1cf17d=loadSessionContext(_0x5bd6e2['session']),_0x3de4e1=loadProjectConfig(),_0x1b9d69=this[_0x594eb9(0xe0)]();if(_0x5bd6e2['profile'])this[_0x594eb9(0xee)]=_0x5bd6e2[_0x594eb9(0xbb)],this[_0x594eb9(0xbf)]=_0x594eb9(0xe2);else{if(_0x1cf17d?.[_0x594eb9(0xbb)])this[_0x594eb9(0xee)]=_0x1cf17d[_0x594eb9(0xbb)],this[_0x594eb9(0xbf)]=_0x594eb9(0xc5);else{if(_0x1b9d69['profile'])this[_0x594eb9(0xee)]=_0x1b9d69['profile'],this['profileSource']='config';else process.env.TDX_PROFILE?(this[_0x594eb9(0xee)]=process.env.TDX_PROFILE,this[_0x594eb9(0xbf)]=_0x594eb9(0xd9)):(this['activeProfile']=null,this[_0x594eb9(0xbf)]=null);}}const _0x1def88=this[_0x594eb9(0xee)]?loadProfile(this[_0x594eb9(0xee)]):null,_0x927a1e=_0x33a2df=>{const _0x1ece84=_0x594eb9;if(!_0x33a2df)return{};const _0x622129=_0x33a2df,_0x3d4b03={};for(const [_0x490cd4,_0x3bfdf3]of Object[_0x1ece84(0xb9)](_0x622129)){typeof _0x3bfdf3===_0x1ece84(0xae)&&(_0x3d4b03[_0x490cd4]=_0x3bfdf3);}return _0x3d4b03;},_0x3da16d={},_0x58e945=(_0x3e9290,_0x3d6c38,_0x1cee1e)=>{const _0x22aed5=_0x594eb9;if(!_0x3e9290)return![];if(_0x1cee1e&&_0x3e9290===_0x1cee1e)return![];const _0x45db49=_0x1cf17d,_0x3f607b=_0x3de4e1,_0x3f21a5=_0x1def88?.[_0x22aed5(0xe5)],_0x1904e0=_0x1b9d69,_0x5d378e=_0x45db49?.[_0x3d6c38],_0x308b72=_0x3f607b?.[_0x3d6c38],_0x23b2d9=_0x3f21a5?.[_0x3d6c38],_0x207d92=_0x1904e0[_0x3d6c38];return _0x3e9290!==_0x5d378e&&_0x3e9290!==_0x308b72&&_0x3e9290!==_0x23b2d9&&_0x3e9290!==_0x207d92;},_0xb8fc8e=[{'optionKey':'site','contextKey':'site','defaultValue':'us01'},{'optionKey':_0x594eb9(0xc0),'contextKey':_0x594eb9(0xc0)},{'optionKey':_0x594eb9(0xac),'contextKey':_0x594eb9(0xef)},{'optionKey':_0x594eb9(0xb4),'contextKey':_0x594eb9(0xa8)},{'optionKey':_0x594eb9(0xb1),'contextKey':_0x594eb9(0xca)},{'optionKey':_0x594eb9(0xbb),'contextKey':_0x594eb9(0xbb)}];for(const {optionKey:_0x5d57b5,contextKey:_0x33ca2d,defaultValue:_0x5c2be8}of _0xb8fc8e){const _0x2e19c4=_0x5bd6e2[_0x5d57b5];_0x58e945(_0x2e19c4,_0x33ca2d,_0x5c2be8)&&(_0x3da16d[_0x33ca2d]=_0x2e19c4);}this[_0x594eb9(0xa7)]={'cliFlags':_0x3da16d,'session':_0x927a1e(_0x1cf17d),'project':_0x927a1e(_0x3de4e1),'profile':_0x927a1e(_0x1def88?.['config']),'global':_0x927a1e(_0x1b9d69)};const _0x311ccf={...this[_0x594eb9(0xa7)][_0x594eb9(0xe7)],...this[_0x594eb9(0xa7)][_0x594eb9(0xbb)],...this[_0x594eb9(0xa7)][_0x594eb9(0xdd)]};process.env.TDX_SITE&&!this['layers'][_0x594eb9(0xc5)][_0x594eb9(0xc1)]&&!this[_0x594eb9(0xa7)]['cliFlags'][_0x594eb9(0xc1)]&&(_0x311ccf['site']=process.env.TDX_SITE);Object['assign'](_0x311ccf,this[_0x594eb9(0xa7)][_0x594eb9(0xc5)]),Object[_0x594eb9(0xa9)](_0x311ccf,this['layers'][_0x594eb9(0xe4)]);const _0x5b3786=_0x311ccf[_0x594eb9(0xc1)]||_0x594eb9(0xb6);this[_0x594eb9(0xc1)]=resolveSite(_0x5b3786),this[_0x594eb9(0xc0)]=_0x311ccf['database'],this['parent_segment']=_0x311ccf[_0x594eb9(0xef)],this[_0x594eb9(0xe6)]=_0x311ccf[_0x594eb9(0xe6)],this[_0x594eb9(0xa8)]=_0x311ccf[_0x594eb9(0xa8)],this[_0x594eb9(0xca)]=_0x311ccf[_0x594eb9(0xca)],this['workflow_project']=_0x311ccf[_0x594eb9(0xdc)],this[_0x594eb9(0xad)]=_0x5bd6e2['verbose']||![],this[_0x594eb9(0xaa)]=_0x5bd6e2['logLevel']??LogLevel[_0x594eb9(0xb7)],this['profile']=this[_0x594eb9(0xee)]||undefined,this['apiKey']=getAPIKey(this[_0x594eb9(0xee)]||undefined);const _0x557334=typeof _0x1b9d69[_0x594eb9(0xb5)]==='string'?_0x1b9d69[_0x594eb9(0xb5)]:undefined;this['proxy']=_0x557334||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x3c2905=getConfigDir(),_0x588bdd=a49_0x37e243[_0x594eb9(0xeb)](_0x3c2905,_0x594eb9(0xda),this[_0x594eb9(0xe3)]+'.json'),_0x50c46c=findProjectConfigPath(),_0x1837cf=a49_0x37e243[_0x594eb9(0xeb)](_0x3c2905,_0x594eb9(0xc6)),_0x567355=a49_0x37e243[_0x594eb9(0xeb)](_0x3c2905,_0x594eb9(0xa4));let _0x541dcb=null,_0x416496=null;this[_0x594eb9(0xee)]&&(_0x541dcb=a49_0x37e243[_0x594eb9(0xeb)](_0x3c2905,'profiles',this[_0x594eb9(0xee)],_0x594eb9(0xc6)),_0x416496=a49_0x37e243[_0x594eb9(0xeb)](_0x3c2905,'profiles',this[_0x594eb9(0xee)],'.env')),this[_0x594eb9(0xcb)]={'session':a49_0x237ac6[_0x594eb9(0xea)](_0x588bdd)?_0x588bdd:null,'project':_0x50c46c,'profile':_0x541dcb&&a49_0x237ac6[_0x594eb9(0xea)](_0x541dcb)?_0x541dcb:null,'profileCredentials':_0x416496&&a49_0x237ac6['existsSync'](_0x416496)?_0x416496:null,'global':a49_0x237ac6[_0x594eb9(0xea)](_0x1837cf)?_0x1837cf:null,'globalCredentials':a49_0x237ac6[_0x594eb9(0xea)](_0x567355)?_0x567355:null};}[a49_0x4591f1(0xb0)](_0xfd6bd6,_0x173450){const _0x436727=a49_0x4591f1;if(!_0x173450)return _0x436727(0xde);const _0x3ba5a6=_0x173450;if(this[_0x436727(0xa7)][_0x436727(0xe4)][_0xfd6bd6]===_0x3ba5a6){if(_0xfd6bd6===_0x436727(0xc1)&&_0x3ba5a6===_0x436727(0xb6)&&!this[_0x436727(0xa7)][_0x436727(0xc5)]['site']&&!this[_0x436727(0xa7)]['project']['site']&&!this[_0x436727(0xa7)][_0x436727(0xbb)][_0x436727(0xc1)]&&!this['layers'][_0x436727(0xe7)][_0x436727(0xc1)])return _0x436727(0xf0);return _0x436727(0xb3)+_0xfd6bd6['replace'](/_/g,'-');}if(this[_0x436727(0xa7)][_0x436727(0xc5)][_0xfd6bd6]===_0x3ba5a6)return _0x436727(0xc5);if(this[_0x436727(0xa7)][_0x436727(0xdd)][_0xfd6bd6]===_0x3ba5a6)return _0x436727(0xdd);if(this[_0x436727(0xa7)][_0x436727(0xbb)][_0xfd6bd6]===_0x3ba5a6)return _0x436727(0xa6)+this['activeProfile'];if(this['layers']['global'][_0xfd6bd6]===_0x3ba5a6)return _0x436727(0xe7);return _0x436727(0xf0);}[a49_0x4591f1(0xe0)](){const _0x5b8c8c=a49_0x4591f1,_0x4480a8=a49_0x37e243[_0x5b8c8c(0xeb)](getConfigDir(),'tdx.json');if(!a49_0x237ac6[_0x5b8c8c(0xea)](_0x4480a8))return{};try{const _0x9f70b9=a49_0x237ac6[_0x5b8c8c(0xed)](_0x4480a8,'utf-8');return JSON[_0x5b8c8c(0xb2)](_0x9f70b9);}catch{return{};}}['injectIntoOptions'](_0x2b727d){const _0x576247=a49_0x4591f1;_0x2b727d[_0x576247(0xc1)]=this[_0x576247(0xc1)],!_0x2b727d[_0x576247(0xc0)]&&this[_0x576247(0xc0)]&&(_0x2b727d[_0x576247(0xc0)]=this[_0x576247(0xc0)]),!_0x2b727d[_0x576247(0xac)]&&this[_0x576247(0xef)]&&(_0x2b727d[_0x576247(0xac)]=this['parent_segment']),!_0x2b727d[_0x576247(0xdb)]&&this[_0x576247(0xe6)]&&(_0x2b727d['segmentPath']=this[_0x576247(0xe6)]),!_0x2b727d[_0x576247(0xb4)]&&this[_0x576247(0xa8)]&&(_0x2b727d[_0x576247(0xb4)]=this[_0x576247(0xa8)]),!_0x2b727d[_0x576247(0xb1)]&&this[_0x576247(0xca)]&&(_0x2b727d[_0x576247(0xb1)]=this['llm_agent']),!_0x2b727d['workflowProject']&&this[_0x576247(0xdc)]&&(_0x2b727d[_0x576247(0xe9)]=this[_0x576247(0xdc)]);}[a49_0x4591f1(0xcf)](){const _0x5b066b=a49_0x4591f1;return[{'key':_0x5b066b(0xc1),'value':this['site']},{'key':_0x5b066b(0xc0),'value':this[_0x5b066b(0xc0)]},{'key':_0x5b066b(0xef),'value':this['parent_segment']},{'key':_0x5b066b(0xe6),'value':this[_0x5b066b(0xe6)]},{'key':_0x5b066b(0xa8),'value':this[_0x5b066b(0xa8)]},{'key':'llm_agent','value':this[_0x5b066b(0xca)]},{'key':_0x5b066b(0xdc),'value':this[_0x5b066b(0xdc)]},{'key':'profile','value':this['activeProfile']||undefined}];}[a49_0x4591f1(0xec)](){const _0x3e394e=a49_0x4591f1;console['log'](a49_0x10ab9d['bold'](_0x3e394e(0xe8)));for(const {key:_0x155808,value:_0x2761}of this[_0x3e394e(0xcf)]()){_0x2761&&console['log'](a49_0x10ab9d[_0x3e394e(0xd7)](_0x155808)+':\x20'+_0x2761);}}['displayWithSources'](){const _0x3c0e93=a49_0x4591f1;console['log'](a49_0x10ab9d[_0x3c0e93(0xd5)](_0x3c0e93(0xe8)));for(const {key:_0x3846d7,value:_0x375456}of this[_0x3c0e93(0xcf)]()){if(_0x375456){const _0x57f835=_0x3846d7===_0x3c0e93(0xbb)?'(active)':'('+this['getSource'](_0x3846d7,_0x375456)+')';console[_0x3c0e93(0xc2)](a49_0x10ab9d[_0x3c0e93(0xd7)](_0x3846d7)+':\x20'+_0x375456+'\x20'+a49_0x10ab9d[_0x3c0e93(0xe1)](_0x57f835));}}console['log']('\x0a'+a49_0x10ab9d['bold'](_0x3c0e93(0xc8)));const _0x5bb774=[{'label':_0x3c0e93(0xbe),'path':this[_0x3c0e93(0xcb)][_0x3c0e93(0xc5)],'extra':_0x3c0e93(0xc3)+this[_0x3c0e93(0xe3)]+')'},{'label':'Project','path':this['configFiles'][_0x3c0e93(0xdd)]},{'label':_0x3c0e93(0xba),'path':this['configFiles'][_0x3c0e93(0xbb)]},{'label':_0x3c0e93(0xc9),'path':this['configFiles']['profileCredentials']},{'label':_0x3c0e93(0xc7),'path':this[_0x3c0e93(0xcb)][_0x3c0e93(0xe7)]},{'label':_0x3c0e93(0xaf),'path':this['configFiles'][_0x3c0e93(0xa5)]}];for(const {label:_0x25c06f,path:_0x211cc6,extra:_0x417ee8}of _0x5bb774){if(_0x211cc6)console['log'](a49_0x10ab9d[_0x3c0e93(0xd7)](_0x25c06f)+':\x20'+_0x211cc6+'\x20'+a49_0x10ab9d[_0x3c0e93(0xa3)]('✓')+(_0x417ee8?'\x20'+a49_0x10ab9d[_0x3c0e93(0xe1)](_0x417ee8):''));else{if(_0x25c06f===_0x3c0e93(0xbe))console['log'](a49_0x10ab9d[_0x3c0e93(0xd7)](_0x25c06f)+':\x20'+a49_0x10ab9d[_0x3c0e93(0xe1)](_0x3c0e93(0xc4))+'\x20'+a49_0x10ab9d['dim'](_0x3c0e93(0xcc)+this[_0x3c0e93(0xe3)]+')'));else(_0x25c06f===_0x3c0e93(0xd4)||_0x25c06f===_0x3c0e93(0xc7))&&console[_0x3c0e93(0xc2)](a49_0x10ab9d[_0x3c0e93(0xd7)](_0x25c06f)+':\x20'+a49_0x10ab9d[_0x3c0e93(0xe1)]('none'));}}}async[a49_0x4591f1(0xdf)](){const _0x3ae641=a49_0x4591f1;return this[_0x3ae641(0xd0)]=await getAPIKeyAsync(this['site'],this['activeProfile']||undefined),this[_0x3ae641(0xd0)];}static async[a49_0x4591f1(0xbd)](_0x585001){const _0x14a712=a49_0x4591f1,_0x34f039=new GlobalContext(_0x585001);return await _0x34f039[_0x14a712(0xdf)](),_0x34f039;}}
@@ -1 +1 @@
1
- const a50_0x54baab=a50_0x4e8d;(function(_0x974d85,_0x55d740){const _0x48e322=a50_0x4e8d,_0x5774e2=_0x974d85();while(!![]){try{const _0x3116a1=parseInt(_0x48e322(0xc3))/0x1*(-parseInt(_0x48e322(0xb1))/0x2)+parseInt(_0x48e322(0xc2))/0x3*(-parseInt(_0x48e322(0xc0))/0x4)+-parseInt(_0x48e322(0xbb))/0x5+parseInt(_0x48e322(0xc1))/0x6*(-parseInt(_0x48e322(0xae))/0x7)+-parseInt(_0x48e322(0xbe))/0x8*(parseInt(_0x48e322(0xa0))/0x9)+-parseInt(_0x48e322(0xc5))/0xa*(-parseInt(_0x48e322(0xa7))/0xb)+parseInt(_0x48e322(0xb7))/0xc*(parseInt(_0x48e322(0xb5))/0xd);if(_0x3116a1===_0x55d740)break;else _0x5774e2['push'](_0x5774e2['shift']());}catch(_0x32e70e){_0x5774e2['push'](_0x5774e2['shift']());}}}(a50_0x5722,0x94090));const SERVICE_NAME=a50_0x54baab(0xaf);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x1cd718=await import('@napi-rs/keyring');return EntryClass=_0x1cd718['Entry'],EntryClass;}catch(_0x119eda){return keyringLoadError=_0x119eda instanceof Error?_0x119eda:new Error(String(_0x119eda)),null;}}function getAccountName(_0x5d695d){const _0x1ed0b2=a50_0x54baab,_0x486de5=_0x5d695d||'';return'profile:'+_0x486de5+_0x1ed0b2(0xa8);}export async function getKeychainAPIKey(_0x2d8a33){const _0x2cb693=a50_0x54baab,_0x2bdead=await getKeychainAPIKeyWithStatus(_0x2d8a33);if(_0x2bdead[_0x2cb693(0xb2)])return _0x2bdead[_0x2cb693(0xb4)];return _0x2bdead[_0x2cb693(0xba)]===_0x2cb693(0xa6)&&console[_0x2cb693(0xaa)](_0x2cb693(0xbc)+_0x2bdead['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x5a579f){const _0x20b10d=a50_0x54baab;try{const _0x37c522=await getEntryClass();if(!_0x37c522)return{'success':![],'reason':_0x20b10d(0xac)};const _0x9c4696=getAccountName(_0x5a579f),_0xcb296e=new _0x37c522(SERVICE_NAME,_0x9c4696),_0x293f40=_0xcb296e[_0x20b10d(0x9f)]();if(_0x293f40)return{'success':!![],'value':_0x293f40};return{'success':![],'reason':_0x20b10d(0xc4)};}catch(_0x1db53e){const _0x498c38=_0x1db53e instanceof Error?_0x1db53e['message']:String(_0x1db53e);if(_0x498c38[_0x20b10d(0xa4)](_0x20b10d(0xb8))||_0x498c38[_0x20b10d(0xad)]()['includes'](_0x20b10d(0xa1))||_0x498c38[_0x20b10d(0xad)]()[_0x20b10d(0xa4)](_0x20b10d(0xa2))||_0x498c38['toLowerCase']()[_0x20b10d(0xa4)]('no\x20matching\x20entry'))return{'success':![],'reason':_0x20b10d(0xc4)};if(_0x498c38['includes']('-25293')||_0x498c38[_0x20b10d(0xad)]()[_0x20b10d(0xa4)](_0x20b10d(0xb6))||_0x498c38['toLowerCase']()[_0x20b10d(0xa4)](_0x20b10d(0xa9)))return{'success':![],'reason':_0x20b10d(0xa6),'message':_0x20b10d(0xb0)};return{'success':![],'reason':_0x20b10d(0xac),'message':_0x498c38};}}function a50_0x4e8d(_0x4f0d1e,_0x178cd8){_0x4f0d1e=_0x4f0d1e-0x9f;const _0x5722d1=a50_0x5722();let _0x4e8d5d=_0x5722d1[_0x4f0d1e];return _0x4e8d5d;}function a50_0x5722(){const _0x44cb94=['2048101XXnGYd',':api_key','access','error','setPassword','unavailable','toLowerCase','33873kpFHgS','tdx','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.','261780vsbDQP','success','cannot\x20find','value','44025397yqtZxs','restricted','12OGZkRz','-25300','message','reason','3650360ZqhvJC','Warning:\x20','not\x20supported','1208iwJzuA','System\x20keychain\x20is\x20not\x20available','791316nteTYx','678vThSfJ','15IftEZq','3iQjXaV','not_found','40aFosxA','getPassword','51633Ynnkwm','could\x20not\x20be\x20found','not\x20found','__keychain_test__','includes','deleteCredential','access_denied'];a50_0x5722=function(){return _0x44cb94;};return a50_0x5722();}export async function saveKeychainAPIKey(_0x44eb75,_0x4dd2c7){const _0x4c981b=a50_0x54baab,_0x138c9d=await getEntryClass();if(!_0x138c9d)throw new Error(_0x4c981b(0xbf));const _0x4f9738=getAccountName(_0x4dd2c7),_0x2a5347=new _0x138c9d(SERVICE_NAME,_0x4f9738);_0x2a5347[_0x4c981b(0xab)](_0x44eb75);}export async function deleteKeychainAPIKey(_0x282d0a){const _0x115e13=a50_0x54baab;try{const _0x4c036e=await getEntryClass();if(!_0x4c036e)return![];const _0x4f9e05=getAccountName(_0x282d0a),_0xfb6182=new _0x4c036e(SERVICE_NAME,_0x4f9e05);return _0xfb6182[_0x115e13(0xa5)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x3e77e8=a50_0x54baab;try{const _0x342354=await getEntryClass();if(!_0x342354)return![];const _0xa358f1=new _0x342354(SERVICE_NAME,_0x3e77e8(0xa3));return _0xa358f1[_0x3e77e8(0x9f)](),!![];}catch(_0x5a655f){const _0x21fa01=_0x5a655f instanceof Error?_0x5a655f[_0x3e77e8(0xb9)][_0x3e77e8(0xad)]():'';if(_0x21fa01[_0x3e77e8(0xa4)]('not\x20available')||_0x21fa01[_0x3e77e8(0xa4)](_0x3e77e8(0xbd))||_0x21fa01[_0x3e77e8(0xa4)](_0x3e77e8(0xb3)))return![];return!![];}}
1
+ function a50_0x6c3b(){const _0x16e7ce=['not_found','__keychain_test__','1792782fYjrSr','3662948yfFCDl','419328lppttq','-25300','message','Warning:\x20','profile:','could\x20not\x20be\x20found','access','no\x20matching\x20entry','7484470mUnOTk','tdx','not\x20supported','129593UgpbfL','20116224knuklA','@napi-rs/keyring','toLowerCase','System\x20keychain\x20is\x20not\x20available','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.','includes','deleteCredential','access_denied','cannot\x20find','not\x20found','12IAkvJB','restricted','unavailable','not\x20available','4353213JwjVuf','-25293','error','35bzPHrD'];a50_0x6c3b=function(){return _0x16e7ce;};return a50_0x6c3b();}const a50_0x4e86d3=a50_0x2821;(function(_0x4f6e6f,_0x38150a){const _0x5d06d4=a50_0x2821,_0x40f13d=_0x4f6e6f();while(!![]){try{const _0x47a841=-parseInt(_0x5d06d4(0x1fe))/0x1*(parseInt(_0x5d06d4(0x209))/0x2)+-parseInt(_0x5d06d4(0x1eb))/0x3+parseInt(_0x5d06d4(0x1f2))/0x4+-parseInt(_0x5d06d4(0x1fb))/0x5+-parseInt(_0x5d06d4(0x1f1))/0x6*(-parseInt(_0x5d06d4(0x1ee))/0x7)+-parseInt(_0x5d06d4(0x1f3))/0x8+parseInt(_0x5d06d4(0x1ff))/0x9;if(_0x47a841===_0x38150a)break;else _0x40f13d['push'](_0x40f13d['shift']());}catch(_0x51241e){_0x40f13d['push'](_0x40f13d['shift']());}}}(a50_0x6c3b,0xd3a67));const SERVICE_NAME=a50_0x4e86d3(0x1fc);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x175257=a50_0x4e86d3;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x520267=await import(_0x175257(0x200));return EntryClass=_0x520267['Entry'],EntryClass;}catch(_0x54c7d0){return keyringLoadError=_0x54c7d0 instanceof Error?_0x54c7d0:new Error(String(_0x54c7d0)),null;}}function getAccountName(_0x56494f){const _0x4368dc=a50_0x4e86d3,_0x479775=_0x56494f||'';return _0x4368dc(0x1f7)+_0x479775+':api_key';}export async function getKeychainAPIKey(_0x2aafe3){const _0x125994=a50_0x4e86d3,_0x389eb1=await getKeychainAPIKeyWithStatus(_0x2aafe3);if(_0x389eb1['success'])return _0x389eb1['value'];return _0x389eb1['reason']===_0x125994(0x206)&&console[_0x125994(0x1ed)](_0x125994(0x1f6)+_0x389eb1[_0x125994(0x1f5)]),null;}export async function getKeychainAPIKeyWithStatus(_0x4f332f){const _0x1452e1=a50_0x4e86d3;try{const _0x5af577=await getEntryClass();if(!_0x5af577)return{'success':![],'reason':_0x1452e1(0x1e9)};const _0x293bd7=getAccountName(_0x4f332f),_0x274e80=new _0x5af577(SERVICE_NAME,_0x293bd7),_0x22c861=_0x274e80['getPassword']();if(_0x22c861)return{'success':!![],'value':_0x22c861};return{'success':![],'reason':'not_found'};}catch(_0x1c70bf){const _0x1ba827=_0x1c70bf instanceof Error?_0x1c70bf[_0x1452e1(0x1f5)]:String(_0x1c70bf);if(_0x1ba827['includes'](_0x1452e1(0x1f4))||_0x1ba827['toLowerCase']()[_0x1452e1(0x204)](_0x1452e1(0x1f8))||_0x1ba827[_0x1452e1(0x201)]()[_0x1452e1(0x204)](_0x1452e1(0x208))||_0x1ba827[_0x1452e1(0x201)]()[_0x1452e1(0x204)](_0x1452e1(0x1fa)))return{'success':![],'reason':_0x1452e1(0x1ef)};if(_0x1ba827['includes'](_0x1452e1(0x1ec))||_0x1ba827[_0x1452e1(0x201)]()[_0x1452e1(0x204)](_0x1452e1(0x20a))||_0x1ba827['toLowerCase']()[_0x1452e1(0x204)](_0x1452e1(0x1f9)))return{'success':![],'reason':_0x1452e1(0x206),'message':_0x1452e1(0x203)};return{'success':![],'reason':'unavailable','message':_0x1ba827};}}export async function saveKeychainAPIKey(_0x74292c,_0x125a10){const _0x1e62c2=a50_0x4e86d3,_0x3e30b7=await getEntryClass();if(!_0x3e30b7)throw new Error(_0x1e62c2(0x202));const _0x378119=getAccountName(_0x125a10),_0x4a7eae=new _0x3e30b7(SERVICE_NAME,_0x378119);_0x4a7eae['setPassword'](_0x74292c);}export async function deleteKeychainAPIKey(_0x2e3a53){const _0x1b873d=a50_0x4e86d3;try{const _0x3eeaa2=await getEntryClass();if(!_0x3eeaa2)return![];const _0x5e453d=getAccountName(_0x2e3a53),_0x4be781=new _0x3eeaa2(SERVICE_NAME,_0x5e453d);return _0x4be781[_0x1b873d(0x205)](),!![];}catch{return![];}}function a50_0x2821(_0x574fbf,_0x5a8f1b){_0x574fbf=_0x574fbf-0x1e9;const _0x6c3b21=a50_0x6c3b();let _0x282143=_0x6c3b21[_0x574fbf];return _0x282143;}export async function isKeychainAvailable(){const _0x28d401=a50_0x4e86d3;try{const _0x529236=await getEntryClass();if(!_0x529236)return![];const _0x4fb777=new _0x529236(SERVICE_NAME,_0x28d401(0x1f0));return _0x4fb777['getPassword'](),!![];}catch(_0x381fb0){const _0x5aa746=_0x381fb0 instanceof Error?_0x381fb0[_0x28d401(0x1f5)]['toLowerCase']():'';if(_0x5aa746[_0x28d401(0x204)](_0x28d401(0x1ea))||_0x5aa746[_0x28d401(0x204)](_0x28d401(0x1fd))||_0x5aa746[_0x28d401(0x204)](_0x28d401(0x207)))return![];return!![];}}
@@ -1 +1 @@
1
- const a51_0x2e5ab4=a51_0x5a84;(function(_0x51b0c9,_0x55cd72){const _0x3c3350=a51_0x5a84,_0x5b5989=_0x51b0c9();while(!![]){try{const _0x52c3ce=-parseInt(_0x3c3350(0x192))/0x1*(parseInt(_0x3c3350(0x191))/0x2)+-parseInt(_0x3c3350(0x15e))/0x3*(parseInt(_0x3c3350(0x189))/0x4)+parseInt(_0x3c3350(0x19f))/0x5+parseInt(_0x3c3350(0x1a0))/0x6+parseInt(_0x3c3350(0x16c))/0x7+-parseInt(_0x3c3350(0x1a3))/0x8+parseInt(_0x3c3350(0x16a))/0x9;if(_0x52c3ce===_0x55cd72)break;else _0x5b5989['push'](_0x5b5989['shift']());}catch(_0x3b0e10){_0x5b5989['push'](_0x5b5989['shift']());}}}(a51_0xb388,0x5f613));import*as a51_0x4ed73d from'node:fs';import*as a51_0x30e187 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_0x2e5ab4(0x172);export function getProfileParams(_0x1215c7){const _0x10da19=a51_0x2e5ab4,_0x472163={};if(!_0x1215c7)return _0x472163;for(const [_0x4ae4e9,_0x43e41a]of Object[_0x10da19(0x170)](_0x1215c7)){_0x4ae4e9!==_0x10da19(0x197)&&_0x43e41a!==undefined&&(_0x472163[_0x4ae4e9]=_0x43e41a);}return _0x472163;}export function getProfilesDir(){const _0x4aa395=a51_0x2e5ab4;return a51_0x30e187[_0x4aa395(0x18c)](getConfigDir(),'profiles');}function getProfileDir(_0x49624e){const _0x3e61f9=a51_0x2e5ab4;return a51_0x30e187[_0x3e61f9(0x18c)](getProfilesDir(),_0x49624e);}function getProfileConfigPath(_0x3b1879){const _0x2b5890=a51_0x2e5ab4;return a51_0x30e187[_0x2b5890(0x18c)](getProfileDir(_0x3b1879),_0x2b5890(0x179));}function getProfileEnvPath(_0x5caae4){const _0x30fd5c=a51_0x2e5ab4;return a51_0x30e187[_0x30fd5c(0x18c)](getProfileDir(_0x5caae4),_0x30fd5c(0x1ac));}function getGlobalConfigPath(){const _0x3905e6=a51_0x2e5ab4;return a51_0x30e187['join'](getConfigDir(),_0x3905e6(0x179));}function validateProfileName(_0x570b00){const _0x1bba68=a51_0x2e5ab4;if(/^@?[a-zA-Z0-9_-]+$/['test'](_0x570b00))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/['test'](_0x570b00))return;throw new Error(_0x1bba68(0x18a)+_0x570b00+_0x1bba68(0x17c));}function validateProfileConfig(_0x1566b9,_0x50d5df){const _0x169f5e=a51_0x2e5ab4;if(typeof _0x1566b9!==_0x169f5e(0x193)||_0x1566b9===null)throw new SDKError(ErrorCode[_0x169f5e(0x190)],_0x169f5e(0x176)+_0x50d5df+_0x169f5e(0x16d));const _0x18d539=[_0x169f5e(0x197),'site',_0x169f5e(0x167),_0x169f5e(0x174),'llm_project',_0x169f5e(0x16f),_0x169f5e(0x1a8)],_0x5179f2=_0x1566b9;for(const _0x529b6e of Object[_0x169f5e(0x198)](_0x5179f2)){!_0x18d539['includes'](_0x529b6e)&&console[_0x169f5e(0x1a1)]('Warning:\x20Profile\x20\x27'+_0x50d5df+_0x169f5e(0x1a5)+_0x529b6e+'\x27\x20will\x20be\x20ignored');}if(_0x5179f2['description']!==undefined&&typeof _0x5179f2[_0x169f5e(0x197)]!==_0x169f5e(0x17e))throw new SDKError(ErrorCode[_0x169f5e(0x190)],_0x169f5e(0x176)+_0x50d5df+_0x169f5e(0x17d));if(_0x5179f2[_0x169f5e(0x16b)]!==undefined&&typeof _0x5179f2['site']!==_0x169f5e(0x17e))throw new SDKError(ErrorCode[_0x169f5e(0x190)],_0x169f5e(0x176)+_0x50d5df+_0x169f5e(0x180));if(_0x5179f2[_0x169f5e(0x167)]!==undefined&&typeof _0x5179f2[_0x169f5e(0x167)]!==_0x169f5e(0x17e))throw new SDKError(ErrorCode[_0x169f5e(0x190)],_0x169f5e(0x176)+_0x50d5df+_0x169f5e(0x187));if(_0x5179f2['parent_segment']!==undefined&&typeof _0x5179f2[_0x169f5e(0x174)]!==_0x169f5e(0x17e))throw new SDKError(ErrorCode[_0x169f5e(0x190)],'Profile\x20\x27'+_0x50d5df+_0x169f5e(0x161));if(_0x5179f2[_0x169f5e(0x1a6)]!==undefined&&typeof _0x5179f2[_0x169f5e(0x1a6)]!==_0x169f5e(0x17e))throw new SDKError(ErrorCode[_0x169f5e(0x190)],_0x169f5e(0x176)+_0x50d5df+_0x169f5e(0x1aa));if(_0x5179f2[_0x169f5e(0x16f)]!==undefined&&typeof _0x5179f2[_0x169f5e(0x16f)]!==_0x169f5e(0x17e))throw new SDKError(ErrorCode[_0x169f5e(0x190)],_0x169f5e(0x176)+_0x50d5df+_0x169f5e(0x186));return!![];}function loadProfilesFromTdxJson(_0x17156f,_0x374392){const _0x17248d=a51_0x2e5ab4;if(!a51_0x4ed73d[_0x17248d(0x178)](_0x17156f))return[];try{const _0x27853c=a51_0x4ed73d[_0x17248d(0x196)](_0x17156f,_0x17248d(0x1a9)),_0x22dee5=JSON[_0x17248d(0x160)](_0x27853c);if(!_0x22dee5[_0x17248d(0x18d)]||typeof _0x22dee5[_0x17248d(0x18d)]!==_0x17248d(0x193))return[];const _0x2912f9=[];for(const [_0x4ea5cb,_0x2272e0]of Object[_0x17248d(0x170)](_0x22dee5[_0x17248d(0x18d)])){try{validateProfileConfig(_0x2272e0,_0x4ea5cb);const _0x39305c=getNewCredentialPath(_0x4ea5cb),_0x2c84af=getOldCredentialPath(_0x4ea5cb),_0x34845c=a51_0x4ed73d['existsSync'](_0x39305c)||a51_0x4ed73d['existsSync'](_0x2c84af);_0x2912f9[_0x17248d(0x173)]({'name':_0x4ea5cb,'config':_0x2272e0,'metadata':{'name':_0x4ea5cb,'createdAt':new Date()[_0x17248d(0x184)]()},'hasCredentials':_0x34845c,'scope':_0x374392});}catch(_0xb3ba86){_0xb3ba86 instanceof Error&&(console['warn'](_0x17248d(0x188)+_0x17156f+':'),console[_0x17248d(0x1a1)]('\x20\x20'+_0xb3ba86['message']+'\x0a'));}}return _0x2912f9;}catch(_0x114c28){return _0x114c28 instanceof SyntaxError?(console[_0x17248d(0x1a1)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x17156f+':\x20Invalid\x20JSON\x20syntax'),console['warn']('Error:\x20'+_0x114c28['message']+'\x0a')):console[_0x17248d(0x1a1)](_0x17248d(0x19d)+_0x17156f+':\x20'+_0x114c28+'\x0a'),[];}}function a51_0x5a84(_0x55e162,_0x4ca093){_0x55e162=_0x55e162-0x15e;const _0xb38881=a51_0xb388();let _0x5a84e6=_0xb38881[_0x55e162];return _0x5a84e6;}export function getNewCredentialPath(_0x2d87b0){const _0x3fa4a5=a51_0x2e5ab4;return a51_0x30e187[_0x3fa4a5(0x18c)](getConfigDir(),_0x3fa4a5(0x19e)+_0x2d87b0);}function getOldCredentialPath(_0x53c639){const _0x28899b=a51_0x2e5ab4;return a51_0x30e187[_0x28899b(0x18c)](getProfilesDir(),_0x53c639,_0x28899b(0x1ac));}function loadProfilesFromTdxJsonFiles(){const _0x1d80cc=a51_0x2e5ab4,_0x636bb6=[],_0x1c08c2=findProjectConfigPath();_0x1c08c2&&_0x636bb6[_0x1d80cc(0x173)](...loadProfilesFromTdxJson(_0x1c08c2,_0x1d80cc(0x166)));const _0x2dae16=a51_0x30e187[_0x1d80cc(0x18c)](getConfigDir(),_0x1d80cc(0x179));return _0x636bb6[_0x1d80cc(0x173)](...loadProfilesFromTdxJson(_0x2dae16,'user')),_0x636bb6;}function loadProfilesFromDirectories(){const _0x1b221f=a51_0x2e5ab4,_0x32f9d6=getProfilesDir();if(!a51_0x4ed73d['existsSync'](_0x32f9d6))return[];try{return a51_0x4ed73d[_0x1b221f(0x1a4)](_0x32f9d6,{'withFileTypes':!![]})[_0x1b221f(0x182)](_0xc9e24f=>_0xc9e24f[_0x1b221f(0x17a)]())[_0x1b221f(0x19b)](_0x2ed6b3=>_0x2ed6b3[_0x1b221f(0x175)])[_0x1b221f(0x182)](_0x8d47e9=>{const _0x59a554=_0x1b221f,_0x295042=getProfileConfigPath(_0x8d47e9),_0xb9b296=getProfileEnvPath(_0x8d47e9);return a51_0x4ed73d['existsSync'](_0x295042)||a51_0x4ed73d[_0x59a554(0x178)](_0xb9b296);})['map'](_0x417056=>{const _0xdcd546=_0x1b221f,_0x3ef3d3=loadProfileFromDirectory(_0x417056);if(_0x3ef3d3)return{..._0x3ef3d3,'scope':_0xdcd546(0x1a7)};return null;})[_0x1b221f(0x182)](_0x5b5be4=>_0x5b5be4!==null);}catch{return[];}}function loadProfileFromDirectory(_0x538ea0){const _0x537461=a51_0x2e5ab4,_0xf41fde=getProfileConfigPath(_0x538ea0),_0x33116b=getOldCredentialPath(_0x538ea0);if(!a51_0x4ed73d[_0x537461(0x178)](_0xf41fde)&&!a51_0x4ed73d[_0x537461(0x178)](_0x33116b))return null;let _0xec4397={},_0x1a89a6={'name':_0x538ea0,'createdAt':new Date()[_0x537461(0x184)]()};if(a51_0x4ed73d[_0x537461(0x178)](_0xf41fde))try{const _0x6f6ac9=a51_0x4ed73d[_0x537461(0x196)](_0xf41fde,'utf-8'),_0x90acb6=JSON[_0x537461(0x160)](_0x6f6ac9),{metadata:_0x3708d2,..._0x400b06}=_0x90acb6;_0xec4397=_0x400b06,_0x3708d2&&(_0x1a89a6=_0x3708d2);}catch{}return{'name':_0x538ea0,'config':_0xec4397,'metadata':_0x1a89a6,'hasCredentials':a51_0x4ed73d[_0x537461(0x178)](_0x33116b),'scope':_0x537461(0x1a7)};}export function listProfiles(){const _0x2442da=a51_0x2e5ab4,_0xd4a37f=loadProfilesFromTdxJsonFiles(),_0x3ea706=loadProfilesFromDirectories();if(_0x3ea706[_0x2442da(0x17f)]>0x0){const _0xfac283=_0x3ea706[_0x2442da(0x19b)](_0x3d717f=>_0x3d717f[_0x2442da(0x175)])['join'](',\x20'),_0x53e517=getConfigDir();console['warn'](_0x2442da(0x19a)+_0xfac283),console[_0x2442da(0x1a1)](_0x2442da(0x171)),console[_0x2442da(0x1a1)](_0x2442da(0x177)+a51_0x30e187[_0x2442da(0x18c)](_0x53e517,_0x2442da(0x179))),console['warn'](_0x2442da(0x195)),console[_0x2442da(0x1a1)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x4f7a1d=[..._0xd4a37f,..._0x3ea706],_0x4e77d2=new Map();for(const _0x5f57b0 of _0x4f7a1d){!_0x4e77d2[_0x2442da(0x1a2)](_0x5f57b0['name'])&&_0x4e77d2[_0x2442da(0x17b)](_0x5f57b0[_0x2442da(0x175)],_0x5f57b0);}return Array[_0x2442da(0x19c)](_0x4e77d2[_0x2442da(0x165)]())[_0x2442da(0x18b)]((_0x3d33cf,_0x26a160)=>_0x3d33cf[_0x2442da(0x175)][_0x2442da(0x181)](_0x26a160[_0x2442da(0x175)]));}export function profileExists(_0x448bc1){const _0x513ff8=a51_0x2e5ab4,_0x26fc70=listProfiles();return _0x26fc70[_0x513ff8(0x18f)](_0x426883=>_0x426883[_0x513ff8(0x175)]===_0x448bc1);}export function loadProfile(_0x274d8c){const _0x24d982=a51_0x2e5ab4;validateProfileName(_0x274d8c);const _0x5cfe69=listProfiles(),_0xb2e4e0=_0x5cfe69[_0x24d982(0x1ab)](_0x554e77=>_0x554e77['name']===_0x274d8c);return _0xb2e4e0||null;}function a51_0xb388(){const _0x326215=['\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','string','length','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','localeCompare','filter','stringify','toISOString','\x22\x20\x22','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','4wEgONS','Invalid\x20profile\x20name:\x20','sort','join','profiles','Warning:\x20Failed\x20to\x20parse\x20','some','INVALID_PROFILE_CONFIG','3098FlpAWF','101xnFCWl','object',',\x20creating\x20new\x20file','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','readFileSync','description','keys','\x27\x20not\x20found\x20in\x20user\x20configuration','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','map','from','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','.env.','1488465OHPkxG','948840QMDeAN','warn','has','2453056JqiBTA','readdirSync','\x27:\x20unknown\x20config\x20key\x20\x27','llm_project','directory','user_info','utf-8','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','find','.env','1362537txIDuV','\x20\x20mv\x20\x22','parse','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Failed\x20to\x20parse\x20','rmSync','\x20does\x20not\x20exist','values','local','database','To\x20migrate:','Profile\x20','5477517YPnzhF','site','1704423ajtoqL','\x27:\x20config\x20must\x20be\x20an\x20object','profile','llm_agent','entries','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','@tdx-studio','push','parent_segment','name','Profile\x20\x27','\x20\x201.\x20Edit:\x20','existsSync','tdx.json','isDirectory','set','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.'];a51_0xb388=function(){return _0x326215;};return a51_0xb388();}export function saveProfile(_0x38b2cd,_0xef5667,_0x56f9a6=![]){saveProfileToUserConfig(_0x38b2cd,_0xef5667);}export function deleteProfile(_0x239743){const _0x37b650=a51_0x2e5ab4;validateProfileName(_0x239743);const _0x27d981=getProfileDir(_0x239743);if(!a51_0x4ed73d[_0x37b650(0x178)](_0x27d981))throw new Error(_0x37b650(0x169)+_0x239743+_0x37b650(0x164));a51_0x4ed73d[_0x37b650(0x163)](_0x27d981,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x46374d,_0x3ae456){const _0x1f91fc=a51_0x2e5ab4;validateProfileName(_0x46374d);const _0x1ed324=getGlobalConfigPath(),_0x519077=getConfigDir();!a51_0x4ed73d[_0x1f91fc(0x178)](_0x519077)&&createSecureDirectory(_0x519077);let _0x2b2f8f={};if(a51_0x4ed73d[_0x1f91fc(0x178)](_0x1ed324))try{const _0x24c63f=a51_0x4ed73d[_0x1f91fc(0x196)](_0x1ed324,_0x1f91fc(0x1a9));_0x2b2f8f=JSON[_0x1f91fc(0x160)](_0x24c63f);}catch{console[_0x1f91fc(0x1a1)](_0x1f91fc(0x18e)+_0x1ed324+_0x1f91fc(0x194));}!_0x2b2f8f['profiles']&&(_0x2b2f8f[_0x1f91fc(0x18d)]={}),_0x2b2f8f['profiles'][_0x46374d]=_0x3ae456,writeSecureFile(_0x1ed324,JSON[_0x1f91fc(0x183)](_0x2b2f8f,null,0x2));}export function removeProfileFromUserConfig(_0x59a743){const _0x4899f4=a51_0x2e5ab4;validateProfileName(_0x59a743);const _0x8021e7=getGlobalConfigPath();if(!a51_0x4ed73d[_0x4899f4(0x178)](_0x8021e7))throw new Error(_0x4899f4(0x176)+_0x59a743+_0x4899f4(0x199));let _0x552e64={};try{const _0x2081a0=a51_0x4ed73d[_0x4899f4(0x196)](_0x8021e7,_0x4899f4(0x1a9));_0x552e64=JSON['parse'](_0x2081a0);}catch{throw new Error(_0x4899f4(0x162)+_0x8021e7);}if(!_0x552e64['profiles']||!_0x552e64['profiles'][_0x59a743])throw new Error(_0x4899f4(0x176)+_0x59a743+_0x4899f4(0x199));delete _0x552e64[_0x4899f4(0x18d)][_0x59a743],_0x552e64[_0x4899f4(0x16e)]===_0x59a743&&delete _0x552e64[_0x4899f4(0x16e)],writeSecureFile(_0x8021e7,JSON['stringify'](_0x552e64,null,0x2));}export function getActiveProfile(){const _0x30a17f=a51_0x2e5ab4,_0x20c745=loadSessionContext();if(_0x20c745?.[_0x30a17f(0x16e)])return _0x20c745['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x4cf266=getGlobalConfigPath();if(!a51_0x4ed73d[_0x30a17f(0x178)](_0x4cf266))return null;try{const _0x21343f=a51_0x4ed73d['readFileSync'](_0x4cf266,_0x30a17f(0x1a9)),_0x610e41=JSON['parse'](_0x21343f);return _0x610e41['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x272ed4){const _0x4ee3a2=a51_0x2e5ab4,_0x2bf972=getGlobalConfigPath(),_0x3bd803=getConfigDir();!a51_0x4ed73d[_0x4ee3a2(0x178)](_0x3bd803)&&createSecureDirectory(_0x3bd803);let _0xa60182={};if(a51_0x4ed73d['existsSync'](_0x2bf972))try{const _0x3f8b82=a51_0x4ed73d[_0x4ee3a2(0x196)](_0x2bf972,_0x4ee3a2(0x1a9));_0xa60182=JSON[_0x4ee3a2(0x160)](_0x3f8b82);}catch{console[_0x4ee3a2(0x1a1)](_0x4ee3a2(0x18e)+_0x2bf972+_0x4ee3a2(0x194));}_0xa60182[_0x4ee3a2(0x16b)]=_0x272ed4,writeSecureFile(_0x2bf972,JSON['stringify'](_0xa60182,null,0x2));}export function saveActiveProfileToUserConfig(_0x1eef27){const _0x1921b4=a51_0x2e5ab4;validateProfileName(_0x1eef27);const _0x26064e=getGlobalConfigPath(),_0x3c8cb1=getConfigDir();!a51_0x4ed73d[_0x1921b4(0x178)](_0x3c8cb1)&&createSecureDirectory(_0x3c8cb1);let _0x5f45ad={};if(a51_0x4ed73d[_0x1921b4(0x178)](_0x26064e))try{const _0x9f87a9=a51_0x4ed73d[_0x1921b4(0x196)](_0x26064e,_0x1921b4(0x1a9));_0x5f45ad=JSON[_0x1921b4(0x160)](_0x9f87a9);}catch{console['warn'](_0x1921b4(0x18e)+_0x26064e+',\x20creating\x20new\x20file');}_0x5f45ad[_0x1921b4(0x16e)]=_0x1eef27,writeSecureFile(_0x26064e,JSON[_0x1921b4(0x183)](_0x5f45ad,null,0x2));}function clearFieldFromUserConfig(_0xcb3192){const _0x1533f7=a51_0x2e5ab4,_0x2df8c3=getGlobalConfigPath();if(!a51_0x4ed73d['existsSync'](_0x2df8c3))return;let _0xc8890b={};try{const _0x310878=a51_0x4ed73d['readFileSync'](_0x2df8c3,_0x1533f7(0x1a9));_0xc8890b=JSON[_0x1533f7(0x160)](_0x310878);}catch{return;}delete _0xc8890b[_0xcb3192],writeSecureFile(_0x2df8c3,JSON[_0x1533f7(0x183)](_0xc8890b,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x183704,_0x126433){validateProfileName(_0x183704);if(profileExists(_0x183704))throw new Error('Profile\x20'+_0x183704+'\x20already\x20exists');saveProfile(_0x183704,_0x126433);}export function saveProfileCredentials(_0x127207,_0x42dc9b){const _0x33950d=a51_0x2e5ab4;validateProfileName(_0x127207);if(!profileExists(_0x127207))throw new Error('Profile\x20'+_0x127207+_0x33950d(0x164));const _0x31d71b=getNewCredentialPath(_0x127207);writeSecureFile(_0x31d71b,_0x42dc9b);}export function loadProfileCredentials(_0xb99171){const _0x596579=a51_0x2e5ab4;validateProfileName(_0xb99171);const _0x4c520c=getNewCredentialPath(_0xb99171);if(a51_0x4ed73d[_0x596579(0x178)](_0x4c520c))try{return a51_0x4ed73d[_0x596579(0x196)](_0x4c520c,_0x596579(0x1a9));}catch{}const _0x2dc9cb=getOldCredentialPath(_0xb99171);if(a51_0x4ed73d[_0x596579(0x178)](_0x2dc9cb)){console[_0x596579(0x1a1)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0xb99171+'\x27'),console['warn'](_0x596579(0x168)),console[_0x596579(0x1a1)](_0x596579(0x15f)+_0x2dc9cb+_0x596579(0x185)+_0x4c520c+'\x22'),console[_0x596579(0x1a1)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a51_0x4ed73d[_0x596579(0x196)](_0x2dc9cb,_0x596579(0x1a9));}catch{return null;}}return null;}
1
+ (function(_0x2d2aa4,_0x2c4cd8){const _0x1fbef2=a51_0x10fc,_0x2921b9=_0x2d2aa4();while(!![]){try{const _0x5c5cd0=-parseInt(_0x1fbef2(0x1ad))/0x1+parseInt(_0x1fbef2(0x1b2))/0x2+parseInt(_0x1fbef2(0x1a6))/0x3*(-parseInt(_0x1fbef2(0x197))/0x4)+parseInt(_0x1fbef2(0x171))/0x5*(-parseInt(_0x1fbef2(0x17b))/0x6)+-parseInt(_0x1fbef2(0x16f))/0x7+-parseInt(_0x1fbef2(0x18b))/0x8*(-parseInt(_0x1fbef2(0x19b))/0x9)+parseInt(_0x1fbef2(0x1b7))/0xa*(parseInt(_0x1fbef2(0x19a))/0xb);if(_0x5c5cd0===_0x2c4cd8)break;else _0x2921b9['push'](_0x2921b9['shift']());}catch(_0x3ec646){_0x2921b9['push'](_0x2921b9['shift']());}}}(a51_0x1583,0x85374));import*as a51_0xc8470e from'node:fs';import*as a51_0x383d1d 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='@tdx-studio';export function getProfileParams(_0x42d576){const _0x56c196=a51_0x10fc,_0x49195b={};if(!_0x42d576)return _0x49195b;for(const [_0x578c6b,_0x6419d2]of Object[_0x56c196(0x170)](_0x42d576)){_0x578c6b!=='description'&&_0x6419d2!==undefined&&(_0x49195b[_0x578c6b]=_0x6419d2);}return _0x49195b;}export function getProfilesDir(){const _0x4040a0=a51_0x10fc;return a51_0x383d1d[_0x4040a0(0x193)](getConfigDir(),_0x4040a0(0x186));}function getProfileDir(_0x31af11){return a51_0x383d1d['join'](getProfilesDir(),_0x31af11);}function getProfileConfigPath(_0x4b324c){const _0x5ed565=a51_0x10fc;return a51_0x383d1d[_0x5ed565(0x193)](getProfileDir(_0x4b324c),_0x5ed565(0x1a0));}function a51_0x1583(){const _0x531b8a=['directory','site','user_info','join','Warning:\x20Profile\x20\x27','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','24dbSGkl','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','parent_segment','14146fQqsPV','117xioqTh','llm_agent','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','readFileSync','keys','tdx.json','Profile\x20','string','sort','push','message','148989ZteqLW','profile','Profile\x20\x27','To\x20migrate:','.env','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','396471FQgQTe','user','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','object','stringify','328494BOUwIy','\x27\x20not\x20found\x20in\x20user\x20configuration','set','\x20\x201.\x20Edit:\x20','Failed\x20to\x20parse\x20','8790aUbsKt','filter','toISOString','\x0aWarning:\x20Failed\x20to\x20parse\x20','database','find','parse','2187857gsajbT','entries','2069405bQZbHv','Error:\x20','length','\x27\x20will\x20be\x20ignored','\x20does\x20not\x20exist','INVALID_PROFILE_CONFIG','includes','\x20\x20mv\x20\x22','\x20already\x20exists','\x27:\x20config\x20must\x20be\x20an\x20object','12NSMxAq','warn','test',',\x20creating\x20new\x20file','\x27:\x20unknown\x20config\x20key\x20\x27','name','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','utf-8','map','rmSync','some','profiles','existsSync','llm_project','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','description','668168HigxYe','\x22\x20\x22','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','from','.env.'];a51_0x1583=function(){return _0x531b8a;};return a51_0x1583();}function getProfileEnvPath(_0xfaf45b){const _0x3a066e=a51_0x10fc;return a51_0x383d1d[_0x3a066e(0x193)](getProfileDir(_0xfaf45b),_0x3a066e(0x1aa));}function getGlobalConfigPath(){return a51_0x383d1d['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0xb9c81b){const _0x4f7708=a51_0x10fc;if(/^@?[a-zA-Z0-9_-]+$/['test'](_0xb9c81b))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/[_0x4f7708(0x17d)](_0xb9c81b))return;throw new Error('Invalid\x20profile\x20name:\x20'+_0xb9c81b+_0x4f7708(0x196));}function validateProfileConfig(_0x3de0e0,_0x3289b6){const _0x289248=a51_0x10fc;if(typeof _0x3de0e0!==_0x289248(0x1b0)||_0x3de0e0===null)throw new SDKError(ErrorCode[_0x289248(0x176)],_0x289248(0x1a8)+_0x3289b6+_0x289248(0x17a));const _0x256027=[_0x289248(0x18a),'site',_0x289248(0x1bb),_0x289248(0x199),_0x289248(0x188),_0x289248(0x19c),_0x289248(0x192)],_0x438c9e=_0x3de0e0;for(const _0x23b13f of Object[_0x289248(0x19f)](_0x438c9e)){!_0x256027[_0x289248(0x177)](_0x23b13f)&&console[_0x289248(0x17c)](_0x289248(0x194)+_0x3289b6+_0x289248(0x17f)+_0x23b13f+_0x289248(0x174));}if(_0x438c9e[_0x289248(0x18a)]!==undefined&&typeof _0x438c9e[_0x289248(0x18a)]!==_0x289248(0x1a2))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x3289b6+_0x289248(0x1af));if(_0x438c9e[_0x289248(0x191)]!==undefined&&typeof _0x438c9e[_0x289248(0x191)]!==_0x289248(0x1a2))throw new SDKError(ErrorCode[_0x289248(0x176)],_0x289248(0x1a8)+_0x3289b6+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x438c9e[_0x289248(0x1bb)]!==undefined&&typeof _0x438c9e['database']!==_0x289248(0x1a2))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x289248(0x1a8)+_0x3289b6+_0x289248(0x1ab));if(_0x438c9e[_0x289248(0x199)]!==undefined&&typeof _0x438c9e['parent_segment']!=='string')throw new SDKError(ErrorCode[_0x289248(0x176)],'Profile\x20\x27'+_0x3289b6+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x438c9e[_0x289248(0x188)]!==undefined&&typeof _0x438c9e['llm_project']!==_0x289248(0x1a2))throw new SDKError(ErrorCode[_0x289248(0x176)],_0x289248(0x1a8)+_0x3289b6+_0x289248(0x195));if(_0x438c9e[_0x289248(0x19c)]!==undefined&&typeof _0x438c9e[_0x289248(0x19c)]!=='string')throw new SDKError(ErrorCode[_0x289248(0x176)],_0x289248(0x1a8)+_0x3289b6+_0x289248(0x19d));return!![];}function loadProfilesFromTdxJson(_0x5c1bf8,_0x13000c){const _0x6adfe=a51_0x10fc;if(!a51_0xc8470e[_0x6adfe(0x187)](_0x5c1bf8))return[];try{const _0xfbd9e6=a51_0xc8470e[_0x6adfe(0x19e)](_0x5c1bf8,_0x6adfe(0x182)),_0x311374=JSON[_0x6adfe(0x1bd)](_0xfbd9e6);if(!_0x311374[_0x6adfe(0x186)]||typeof _0x311374['profiles']!==_0x6adfe(0x1b0))return[];const _0x1b1f19=[];for(const [_0x57ce39,_0x31bc00]of Object[_0x6adfe(0x170)](_0x311374[_0x6adfe(0x186)])){try{validateProfileConfig(_0x31bc00,_0x57ce39);const _0x2b993c=getNewCredentialPath(_0x57ce39),_0x2b9f17=getOldCredentialPath(_0x57ce39),_0x2a99f1=a51_0xc8470e[_0x6adfe(0x187)](_0x2b993c)||a51_0xc8470e[_0x6adfe(0x187)](_0x2b9f17);_0x1b1f19['push']({'name':_0x57ce39,'config':_0x31bc00,'metadata':{'name':_0x57ce39,'createdAt':new Date()[_0x6adfe(0x1b9)]()},'hasCredentials':_0x2a99f1,'scope':_0x13000c});}catch(_0x498b43){_0x498b43 instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x5c1bf8+':'),console[_0x6adfe(0x17c)]('\x20\x20'+_0x498b43['message']+'\x0a'));}}return _0x1b1f19;}catch(_0xa81893){return _0xa81893 instanceof SyntaxError?(console[_0x6adfe(0x17c)](_0x6adfe(0x1ba)+_0x5c1bf8+':\x20Invalid\x20JSON\x20syntax'),console[_0x6adfe(0x17c)](_0x6adfe(0x172)+_0xa81893[_0x6adfe(0x1a5)]+'\x0a')):console[_0x6adfe(0x17c)](_0x6adfe(0x198)+_0x5c1bf8+':\x20'+_0xa81893+'\x0a'),[];}}function a51_0x10fc(_0xdd9518,_0x51d380){_0xdd9518=_0xdd9518-0x16f;const _0x158397=a51_0x1583();let _0x10fc4a=_0x158397[_0xdd9518];return _0x10fc4a;}export function getNewCredentialPath(_0xa4b34f){const _0xeafb61=a51_0x10fc;return a51_0x383d1d[_0xeafb61(0x193)](getConfigDir(),_0xeafb61(0x18f)+_0xa4b34f);}function getOldCredentialPath(_0x2c2ea1){const _0x1f01a5=a51_0x10fc;return a51_0x383d1d[_0x1f01a5(0x193)](getProfilesDir(),_0x2c2ea1,_0x1f01a5(0x1aa));}function loadProfilesFromTdxJsonFiles(){const _0x2ab1c6=a51_0x10fc,_0x29901b=[],_0x359f8b=findProjectConfigPath();_0x359f8b&&_0x29901b[_0x2ab1c6(0x1a4)](...loadProfilesFromTdxJson(_0x359f8b,'local'));const _0x579587=a51_0x383d1d['join'](getConfigDir(),_0x2ab1c6(0x1a0));return _0x29901b['push'](...loadProfilesFromTdxJson(_0x579587,_0x2ab1c6(0x1ae))),_0x29901b;}function loadProfilesFromDirectories(){const _0x414566=a51_0x10fc,_0x49ea9d=getProfilesDir();if(!a51_0xc8470e['existsSync'](_0x49ea9d))return[];try{return a51_0xc8470e['readdirSync'](_0x49ea9d,{'withFileTypes':!![]})[_0x414566(0x1b8)](_0xd512da=>_0xd512da['isDirectory']())[_0x414566(0x183)](_0x4324fb=>_0x4324fb[_0x414566(0x180)])[_0x414566(0x1b8)](_0x21c59d=>{const _0x4ca375=_0x414566,_0x428a0c=getProfileConfigPath(_0x21c59d),_0x238e0a=getProfileEnvPath(_0x21c59d);return a51_0xc8470e[_0x4ca375(0x187)](_0x428a0c)||a51_0xc8470e[_0x4ca375(0x187)](_0x238e0a);})[_0x414566(0x183)](_0x40fb80=>{const _0x418971=_0x414566,_0x393240=loadProfileFromDirectory(_0x40fb80);if(_0x393240)return{..._0x393240,'scope':_0x418971(0x190)};return null;})[_0x414566(0x1b8)](_0x169484=>_0x169484!==null);}catch{return[];}}function loadProfileFromDirectory(_0x237703){const _0x54b8d6=a51_0x10fc,_0x1146a7=getProfileConfigPath(_0x237703),_0x4bef41=getOldCredentialPath(_0x237703);if(!a51_0xc8470e['existsSync'](_0x1146a7)&&!a51_0xc8470e[_0x54b8d6(0x187)](_0x4bef41))return null;let _0x9eb4b7={},_0x5e6def={'name':_0x237703,'createdAt':new Date()[_0x54b8d6(0x1b9)]()};if(a51_0xc8470e[_0x54b8d6(0x187)](_0x1146a7))try{const _0x386294=a51_0xc8470e[_0x54b8d6(0x19e)](_0x1146a7,'utf-8'),_0x1696d4=JSON[_0x54b8d6(0x1bd)](_0x386294),{metadata:_0x567b83,..._0x2cb4c9}=_0x1696d4;_0x9eb4b7=_0x2cb4c9,_0x567b83&&(_0x5e6def=_0x567b83);}catch{}return{'name':_0x237703,'config':_0x9eb4b7,'metadata':_0x5e6def,'hasCredentials':a51_0xc8470e[_0x54b8d6(0x187)](_0x4bef41),'scope':_0x54b8d6(0x190)};}export function listProfiles(){const _0x3f28c3=a51_0x10fc,_0x15a2ee=loadProfilesFromTdxJsonFiles(),_0x210612=loadProfilesFromDirectories();if(_0x210612[_0x3f28c3(0x173)]>0x0){const _0x389684=_0x210612[_0x3f28c3(0x183)](_0x534fd3=>_0x534fd3[_0x3f28c3(0x180)])['join'](',\x20'),_0x1eab04=getConfigDir();console[_0x3f28c3(0x17c)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x389684),console[_0x3f28c3(0x17c)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x3f28c3(0x17c)](_0x3f28c3(0x1b5)+a51_0x383d1d[_0x3f28c3(0x193)](_0x1eab04,'tdx.json')),console[_0x3f28c3(0x17c)](_0x3f28c3(0x181)),console[_0x3f28c3(0x17c)](_0x3f28c3(0x18d));}const _0x2859a2=[..._0x15a2ee,..._0x210612],_0x55a239=new Map();for(const _0xdd206e of _0x2859a2){!_0x55a239['has'](_0xdd206e[_0x3f28c3(0x180)])&&_0x55a239[_0x3f28c3(0x1b4)](_0xdd206e[_0x3f28c3(0x180)],_0xdd206e);}return Array[_0x3f28c3(0x18e)](_0x55a239['values']())[_0x3f28c3(0x1a3)]((_0x41d220,_0x929f5d)=>_0x41d220[_0x3f28c3(0x180)]['localeCompare'](_0x929f5d['name']));}export function profileExists(_0x1ba99d){const _0x3ab60f=a51_0x10fc,_0x159013=listProfiles();return _0x159013[_0x3ab60f(0x185)](_0x20a73d=>_0x20a73d[_0x3ab60f(0x180)]===_0x1ba99d);}export function loadProfile(_0x3328ac){const _0x2d6aa2=a51_0x10fc;validateProfileName(_0x3328ac);const _0x34bbbf=listProfiles(),_0x240147=_0x34bbbf[_0x2d6aa2(0x1bc)](_0x29b5f8=>_0x29b5f8[_0x2d6aa2(0x180)]===_0x3328ac);return _0x240147||null;}export function saveProfile(_0xc16628,_0x1c0093,_0x4dc57d=![]){saveProfileToUserConfig(_0xc16628,_0x1c0093);}export function deleteProfile(_0x2354fc){const _0x4a2a84=a51_0x10fc;validateProfileName(_0x2354fc);const _0x5a0e42=getProfileDir(_0x2354fc);if(!a51_0xc8470e['existsSync'](_0x5a0e42))throw new Error(_0x4a2a84(0x1a1)+_0x2354fc+_0x4a2a84(0x175));a51_0xc8470e[_0x4a2a84(0x184)](_0x5a0e42,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1db203,_0x3231d4){const _0x233d4d=a51_0x10fc;validateProfileName(_0x1db203);const _0x36f696=getGlobalConfigPath(),_0x50a6bf=getConfigDir();!a51_0xc8470e[_0x233d4d(0x187)](_0x50a6bf)&&createSecureDirectory(_0x50a6bf);let _0x46f143={};if(a51_0xc8470e['existsSync'](_0x36f696))try{const _0x471330=a51_0xc8470e[_0x233d4d(0x19e)](_0x36f696,_0x233d4d(0x182));_0x46f143=JSON[_0x233d4d(0x1bd)](_0x471330);}catch{console[_0x233d4d(0x17c)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x36f696+',\x20creating\x20new\x20file');}!_0x46f143[_0x233d4d(0x186)]&&(_0x46f143[_0x233d4d(0x186)]={}),_0x46f143['profiles'][_0x1db203]=_0x3231d4,writeSecureFile(_0x36f696,JSON[_0x233d4d(0x1b1)](_0x46f143,null,0x2));}export function removeProfileFromUserConfig(_0x4a3896){const _0x1a49e4=a51_0x10fc;validateProfileName(_0x4a3896);const _0x118ea6=getGlobalConfigPath();if(!a51_0xc8470e[_0x1a49e4(0x187)](_0x118ea6))throw new Error(_0x1a49e4(0x1a8)+_0x4a3896+_0x1a49e4(0x1b3));let _0x208ee1={};try{const _0x433d5e=a51_0xc8470e[_0x1a49e4(0x19e)](_0x118ea6,_0x1a49e4(0x182));_0x208ee1=JSON[_0x1a49e4(0x1bd)](_0x433d5e);}catch{throw new Error(_0x1a49e4(0x1b6)+_0x118ea6);}if(!_0x208ee1[_0x1a49e4(0x186)]||!_0x208ee1[_0x1a49e4(0x186)][_0x4a3896])throw new Error(_0x1a49e4(0x1a8)+_0x4a3896+_0x1a49e4(0x1b3));delete _0x208ee1[_0x1a49e4(0x186)][_0x4a3896],_0x208ee1[_0x1a49e4(0x1a7)]===_0x4a3896&&delete _0x208ee1['profile'],writeSecureFile(_0x118ea6,JSON[_0x1a49e4(0x1b1)](_0x208ee1,null,0x2));}export function getActiveProfile(){const _0x11be21=a51_0x10fc,_0x543204=loadSessionContext();if(_0x543204?.[_0x11be21(0x1a7)])return _0x543204['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x7119b5=getGlobalConfigPath();if(!a51_0xc8470e[_0x11be21(0x187)](_0x7119b5))return null;try{const _0x3afc92=a51_0xc8470e[_0x11be21(0x19e)](_0x7119b5,_0x11be21(0x182)),_0xf3d839=JSON[_0x11be21(0x1bd)](_0x3afc92);return _0xf3d839[_0x11be21(0x1a7)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x4a8cb2){const _0xe7fc0f=a51_0x10fc,_0x4550ca=getGlobalConfigPath(),_0x2a889d=getConfigDir();!a51_0xc8470e[_0xe7fc0f(0x187)](_0x2a889d)&&createSecureDirectory(_0x2a889d);let _0x3067ee={};if(a51_0xc8470e['existsSync'](_0x4550ca))try{const _0x1c7e45=a51_0xc8470e[_0xe7fc0f(0x19e)](_0x4550ca,_0xe7fc0f(0x182));_0x3067ee=JSON[_0xe7fc0f(0x1bd)](_0x1c7e45);}catch{console[_0xe7fc0f(0x17c)](_0xe7fc0f(0x1ac)+_0x4550ca+_0xe7fc0f(0x17e));}_0x3067ee[_0xe7fc0f(0x191)]=_0x4a8cb2,writeSecureFile(_0x4550ca,JSON[_0xe7fc0f(0x1b1)](_0x3067ee,null,0x2));}export function saveActiveProfileToUserConfig(_0xf9ff0){const _0x449728=a51_0x10fc;validateProfileName(_0xf9ff0);const _0x4e82db=getGlobalConfigPath(),_0x354e3b=getConfigDir();!a51_0xc8470e[_0x449728(0x187)](_0x354e3b)&&createSecureDirectory(_0x354e3b);let _0xa8e69d={};if(a51_0xc8470e['existsSync'](_0x4e82db))try{const _0x12884f=a51_0xc8470e[_0x449728(0x19e)](_0x4e82db,'utf-8');_0xa8e69d=JSON['parse'](_0x12884f);}catch{console[_0x449728(0x17c)](_0x449728(0x1ac)+_0x4e82db+',\x20creating\x20new\x20file');}_0xa8e69d['profile']=_0xf9ff0,writeSecureFile(_0x4e82db,JSON[_0x449728(0x1b1)](_0xa8e69d,null,0x2));}function clearFieldFromUserConfig(_0x3e8bc6){const _0x5dbf7a=a51_0x10fc,_0x3a32a1=getGlobalConfigPath();if(!a51_0xc8470e['existsSync'](_0x3a32a1))return;let _0x556d27={};try{const _0x2fa1d6=a51_0xc8470e[_0x5dbf7a(0x19e)](_0x3a32a1,_0x5dbf7a(0x182));_0x556d27=JSON[_0x5dbf7a(0x1bd)](_0x2fa1d6);}catch{return;}delete _0x556d27[_0x3e8bc6],writeSecureFile(_0x3a32a1,JSON[_0x5dbf7a(0x1b1)](_0x556d27,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x309972,_0x21a99e){const _0x1dc0cc=a51_0x10fc;validateProfileName(_0x309972);if(profileExists(_0x309972))throw new Error(_0x1dc0cc(0x1a1)+_0x309972+_0x1dc0cc(0x179));saveProfile(_0x309972,_0x21a99e);}export function saveProfileCredentials(_0x2e6eab,_0x489a30){const _0x57a3a0=a51_0x10fc;validateProfileName(_0x2e6eab);if(!profileExists(_0x2e6eab))throw new Error(_0x57a3a0(0x1a1)+_0x2e6eab+_0x57a3a0(0x175));const _0x25e537=getNewCredentialPath(_0x2e6eab);writeSecureFile(_0x25e537,_0x489a30);}export function loadProfileCredentials(_0x1aa2b9){const _0x3022ce=a51_0x10fc;validateProfileName(_0x1aa2b9);const _0x3d9517=getNewCredentialPath(_0x1aa2b9);if(a51_0xc8470e['existsSync'](_0x3d9517))try{return a51_0xc8470e[_0x3022ce(0x19e)](_0x3d9517,_0x3022ce(0x182));}catch{}const _0x18c364=getOldCredentialPath(_0x1aa2b9);if(a51_0xc8470e[_0x3022ce(0x187)](_0x18c364)){console[_0x3022ce(0x17c)](_0x3022ce(0x189)+_0x1aa2b9+'\x27'),console[_0x3022ce(0x17c)](_0x3022ce(0x1a9)),console[_0x3022ce(0x17c)](_0x3022ce(0x178)+_0x18c364+_0x3022ce(0x18c)+_0x3d9517+'\x22'),console[_0x3022ce(0x17c)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a51_0xc8470e[_0x3022ce(0x19e)](_0x18c364,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- (function(_0x48ed4e,_0x815bd9){const _0x37e67d=a52_0x5912,_0x353cab=_0x48ed4e();while(!![]){try{const _0x3d60db=parseInt(_0x37e67d(0x9b))/0x1+parseInt(_0x37e67d(0x9c))/0x2*(parseInt(_0x37e67d(0xa7))/0x3)+-parseInt(_0x37e67d(0xa4))/0x4*(parseInt(_0x37e67d(0xaa))/0x5)+-parseInt(_0x37e67d(0x93))/0x6+parseInt(_0x37e67d(0xab))/0x7*(-parseInt(_0x37e67d(0x97))/0x8)+parseInt(_0x37e67d(0xad))/0x9*(parseInt(_0x37e67d(0xa8))/0xa)+parseInt(_0x37e67d(0x94))/0xb;if(_0x3d60db===_0x815bd9)break;else _0x353cab['push'](_0x353cab['shift']());}catch(_0x39a1f1){_0x353cab['push'](_0x353cab['shift']());}}}(a52_0x428a,0x2943f));function a52_0x5912(_0x4aefeb,_0xe27394){_0x4aefeb=_0x4aefeb-0x92;const _0x428a0b=a52_0x428a();let _0x5912d1=_0x428a0b[_0x4aefeb];return _0x5912d1;}import*as a52_0x4412c2 from'node:fs';import*as a52_0x1149d1 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';function a52_0x428a(){const _0x1393fe=['apiKey','readFileSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','ENOENT','1617294VVTPLX','2057363ZXblmd','utf-8','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','8QSwtmt','api_key','dirname','parse','106623AtyeCD','95900SRrmfe','warn','profile','includes','stringify','existsSync','join','TD_API_KEY','4iSuXAj','code','writeFileSync','6SpfSsV','7890BvMPVe',').\x20','50595psyKet','1182202tdnVZz','cwd','2601UPlIHm','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'];a52_0x428a=function(){return _0x1393fe;};return a52_0x428a();}export function findProjectConfigPath(_0x340a00){const _0x24b1d8=a52_0x5912;let _0x397038=_0x340a00||process[_0x24b1d8(0xac)]();while(!![]){const _0x2f2c9e=a52_0x1149d1[_0x24b1d8(0xa2)](_0x397038,PROJECT_CONFIG_FILENAME);if(a52_0x4412c2[_0x24b1d8(0xa1)](_0x2f2c9e))return _0x2f2c9e;const _0x4d835f=a52_0x1149d1[_0x24b1d8(0x99)](_0x397038);if(_0x4d835f===_0x397038)return null;_0x397038=_0x4d835f;}}export function loadProjectConfig(_0x39b57a){const _0x35bfc9=a52_0x5912,_0xf715b4=findProjectConfigPath(_0x39b57a);if(!_0xf715b4)return null;try{const _0x5e516e=a52_0x4412c2[_0x35bfc9(0xb0)](_0xf715b4,_0x35bfc9(0x95)),_0x2905e7=JSON[_0x35bfc9(0x9a)](_0x5e516e),_0x29f16a=JSON[_0x35bfc9(0xa0)](_0x2905e7);if(_0x29f16a[_0x35bfc9(0x9f)](_0x35bfc9(0xa3))||_0x29f16a[_0x35bfc9(0x9f)]('apiKey')||_0x29f16a[_0x35bfc9(0x9f)](_0x35bfc9(0x98)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0xf715b4+_0x35bfc9(0xa9)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x57744a,profile:_0x42d5cd,..._0x1ab91c}=_0x2905e7;return _0x42d5cd&&console[_0x35bfc9(0x9d)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0xf715b4+'\x20is\x20ignored.\x20'+_0x35bfc9(0xae)),_0x1ab91c;}catch(_0x992c63){if(_0x992c63 instanceof Error&&_0x35bfc9(0xa5)in _0x992c63&&_0x992c63[_0x35bfc9(0xa5)]===_0x35bfc9(0x92))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0xf715b4+':\x20'+_0x992c63);}}export function saveProjectConfig(_0x3f8e43,_0x234288){const _0x2f1d8d=a52_0x5912,_0x4a46ec=_0x234288||process['cwd'](),_0x2e13b0=a52_0x1149d1[_0x2f1d8d(0xa2)](_0x4a46ec,PROJECT_CONFIG_FILENAME),_0x8dbfb2=JSON[_0x2f1d8d(0xa0)](_0x3f8e43);if(_0x8dbfb2[_0x2f1d8d(0x9f)]('TD_API_KEY')||_0x8dbfb2[_0x2f1d8d(0x9f)](_0x2f1d8d(0xaf))||_0x8dbfb2[_0x2f1d8d(0x9f)](_0x2f1d8d(0x98)))throw new Error(_0x2f1d8d(0xb1));if(_0x2f1d8d(0x9e)in _0x3f8e43)throw new Error(_0x2f1d8d(0x96));a52_0x4412c2[_0x2f1d8d(0xa6)](_0x2e13b0,JSON[_0x2f1d8d(0xa0)](_0x3f8e43,null,0x2));}export function hasProjectConfig(_0x27eef9){return findProjectConfigPath(_0x27eef9)!==null;}export function getProjectRoot(_0x2fa0d9){const _0x1280dd=findProjectConfigPath(_0x2fa0d9);return _0x1280dd?a52_0x1149d1['dirname'](_0x1280dd):null;}
1
+ const a52_0x5d9e36=a52_0x41be;function a52_0x41be(_0x15673b,_0x38a9e5){_0x15673b=_0x15673b-0x188;const _0x210a22=a52_0x210a();let _0x41be25=_0x210a22[_0x15673b];return _0x41be25;}(function(_0x572aaa,_0x51dd72){const _0x22afeb=a52_0x41be,_0x2fa7b3=_0x572aaa();while(!![]){try{const _0x106cd8=parseInt(_0x22afeb(0x18b))/0x1*(-parseInt(_0x22afeb(0x195))/0x2)+parseInt(_0x22afeb(0x1a5))/0x3+parseInt(_0x22afeb(0x197))/0x4*(-parseInt(_0x22afeb(0x191))/0x5)+parseInt(_0x22afeb(0x19a))/0x6*(parseInt(_0x22afeb(0x188))/0x7)+-parseInt(_0x22afeb(0x1a4))/0x8+parseInt(_0x22afeb(0x1a0))/0x9+parseInt(_0x22afeb(0x19b))/0xa;if(_0x106cd8===_0x51dd72)break;else _0x2fa7b3['push'](_0x2fa7b3['shift']());}catch(_0x592346){_0x2fa7b3['push'](_0x2fa7b3['shift']());}}}(a52_0x210a,0xc1a35));import*as a52_0x4d8555 from'node:fs';function a52_0x210a(){const _0x261d18=['3815739dLOQgj','existsSync','stringify','tdx.json','6236688KUpNjC','2711607fKEKKr','2961KnlBrn','includes','\x20is\x20ignored.\x20','41aODAMR','code','TD_API_KEY','Warning:\x20\x27profile\x27\x20field\x20in\x20','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','profile','10tHjbBR','writeFileSync','readFileSync','cwd','49066nDdpSK','dirname','1763512BrCXqz','apiKey','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','2028MTUVec','19895220HXSwIj','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','join','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','utf-8'];a52_0x210a=function(){return _0x261d18;};return a52_0x210a();}import*as a52_0x5c83e4 from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x5d9e36(0x1a3);export function findProjectConfigPath(_0x19aa00){const _0x4b17d3=a52_0x5d9e36;let _0x2f7ba5=_0x19aa00||process['cwd']();while(!![]){const _0x4f52a6=a52_0x5c83e4['join'](_0x2f7ba5,PROJECT_CONFIG_FILENAME);if(a52_0x4d8555[_0x4b17d3(0x1a1)](_0x4f52a6))return _0x4f52a6;const _0x50e416=a52_0x5c83e4[_0x4b17d3(0x196)](_0x2f7ba5);if(_0x50e416===_0x2f7ba5)return null;_0x2f7ba5=_0x50e416;}}export function loadProjectConfig(_0x8ac5d8){const _0x57a779=a52_0x5d9e36,_0x52cf9c=findProjectConfigPath(_0x8ac5d8);if(!_0x52cf9c)return null;try{const _0x38236f=a52_0x4d8555[_0x57a779(0x193)](_0x52cf9c,_0x57a779(0x19f)),_0x6cc97e=JSON['parse'](_0x38236f),_0x18264e=JSON[_0x57a779(0x1a2)](_0x6cc97e);if(_0x18264e[_0x57a779(0x189)](_0x57a779(0x18d))||_0x18264e[_0x57a779(0x189)](_0x57a779(0x198))||_0x18264e['includes']('api_key'))throw new Error(_0x57a779(0x18f)+_0x52cf9c+').\x20'+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x4336e9,profile:_0x18bf09,..._0x19d282}=_0x6cc97e;return _0x18bf09&&console['warn'](_0x57a779(0x18e)+_0x52cf9c+_0x57a779(0x18a)+_0x57a779(0x199)),_0x19d282;}catch(_0x57a65b){if(_0x57a65b instanceof Error&&_0x57a779(0x18c)in _0x57a65b&&_0x57a65b[_0x57a779(0x18c)]==='ENOENT')return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x52cf9c+':\x20'+_0x57a65b);}}export function saveProjectConfig(_0x2fac49,_0x4fee18){const _0x2ea797=a52_0x5d9e36,_0x4e1220=_0x4fee18||process[_0x2ea797(0x194)](),_0x2bb08a=a52_0x5c83e4[_0x2ea797(0x19d)](_0x4e1220,PROJECT_CONFIG_FILENAME),_0x2b5c9e=JSON[_0x2ea797(0x1a2)](_0x2fac49);if(_0x2b5c9e[_0x2ea797(0x189)](_0x2ea797(0x18d))||_0x2b5c9e['includes'](_0x2ea797(0x198))||_0x2b5c9e[_0x2ea797(0x189)]('api_key'))throw new Error(_0x2ea797(0x19e));if(_0x2ea797(0x190)in _0x2fac49)throw new Error(_0x2ea797(0x19c));a52_0x4d8555[_0x2ea797(0x192)](_0x2bb08a,JSON['stringify'](_0x2fac49,null,0x2));}export function hasProjectConfig(_0x1c38e5){return findProjectConfigPath(_0x1c38e5)!==null;}export function getProjectRoot(_0x1d1ec8){const _0x53b6ca=a52_0x5d9e36,_0x35155f=findProjectConfigPath(_0x1d1ec8);return _0x35155f?a52_0x5c83e4[_0x53b6ca(0x196)](_0x35155f):null;}
@@ -1 +1 @@
1
- (function(_0x2003cf,_0x27e2d0){const _0x2820a2=a53_0x18c2,_0x4bdd93=_0x2003cf();while(!![]){try{const _0x1bc4b0=parseInt(_0x2820a2(0x205))/0x1*(-parseInt(_0x2820a2(0x206))/0x2)+parseInt(_0x2820a2(0x210))/0x3*(-parseInt(_0x2820a2(0x20a))/0x4)+-parseInt(_0x2820a2(0x211))/0x5*(parseInt(_0x2820a2(0x1fc))/0x6)+parseInt(_0x2820a2(0x209))/0x7+-parseInt(_0x2820a2(0x208))/0x8*(parseInt(_0x2820a2(0x1fd))/0x9)+-parseInt(_0x2820a2(0x1f4))/0xa+-parseInt(_0x2820a2(0x1ef))/0xb*(-parseInt(_0x2820a2(0x20d))/0xc);if(_0x1bc4b0===_0x27e2d0)break;else _0x4bdd93['push'](_0x4bdd93['shift']());}catch(_0x228373){_0x4bdd93['push'](_0x4bdd93['shift']());}}}(a53_0x75ae,0x398f5));import*as a53_0x4adc51 from'node:fs';import*as a53_0x878858 from'node:path';function a53_0x75ae(){const _0x2f860a=['getTime','4506fKzUfi','5FBJLSu','TD_API_KEY','.config','toString','unlinkSync','toISOString','homedir','33zIeZIk','endsWith','warn','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','replace','269100nuxlfe','api_key','parse','readdirSync','test','createdAt','apiKey','existsSync','265830rNiTZh','140202XSRnLT','utf-8','.json','tdx','readFileSync','now','includes','writeFileSync','196199WneKmR','2IBwtSd','stringify','144rvbHYq','43561IfJBZB','228dZGXBH','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','sessions','3451896jrztBD','join'];a53_0x75ae=function(){return _0x2f860a;};return a53_0x75ae();}import*as a53_0x58cc34 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 _0x1003df=a53_0x18c2,_0x15ec9f=process.env.TDX_CONFIG_DIR||a53_0x878858[_0x1003df(0x20e)](a53_0x58cc34[_0x1003df(0x1ee)](),_0x1003df(0x213),_0x1003df(0x200));return a53_0x878858[_0x1003df(0x20e)](_0x15ec9f,_0x1003df(0x20c));}function getSessionPath(_0x584c92){const _0x4899d6=a53_0x18c2;return a53_0x878858[_0x4899d6(0x20e)](getSessionsDir(),_0x584c92+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x3c5699){const _0x1edc7e=a53_0x18c2;if(_0x3c5699)return _0x3c5699;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x1edc7e(0x214)]();}export function loadSessionContext(_0x347383){const _0x5cceb4=a53_0x18c2,_0x581555=getSessionID(_0x347383),_0x467308=/^\d+$/[_0x5cceb4(0x1f8)](_0x581555)?parseInt(_0x581555,0xa):null;return _0x467308!==null?loadSessionContextByPID(_0x467308):loadSessionContextByString(_0x581555);}export function loadSessionContextByPID(_0x5758a4){const _0x141cf4=a53_0x18c2,_0x1571c3=getSessionPath(_0x5758a4);if(!a53_0x4adc51[_0x141cf4(0x1fb)](_0x1571c3))return null;try{const _0x4e20ca=a53_0x4adc51[_0x141cf4(0x201)](_0x1571c3,_0x141cf4(0x1fe)),_0x2182bf=JSON['parse'](_0x4e20ca),_0x32d0ca=new Date(_0x2182bf[_0x141cf4(0x1f9)])[_0x141cf4(0x20f)](),_0x3b5241=Date[_0x141cf4(0x202)]();if(_0x3b5241-_0x32d0ca>SESSION_EXPIRATION_MS)return a53_0x4adc51[_0x141cf4(0x215)](_0x1571c3),null;const _0x52347e=JSON[_0x141cf4(0x207)](_0x2182bf);if(_0x52347e[_0x141cf4(0x203)](_0x141cf4(0x212))||_0x52347e[_0x141cf4(0x203)](_0x141cf4(0x1fa))||_0x52347e[_0x141cf4(0x203)](_0x141cf4(0x1f5)))return console[_0x141cf4(0x1f1)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x1571c3+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a53_0x4adc51[_0x141cf4(0x215)](_0x1571c3),null;return _0x2182bf;}catch{try{a53_0x4adc51[_0x141cf4(0x215)](_0x1571c3);}catch{}return null;}}function loadSessionContextByString(_0x29fbbe){const _0x211539=a53_0x18c2,_0x5e8155=a53_0x878858[_0x211539(0x20e)](getSessionsDir(),_0x29fbbe+_0x211539(0x1ff));if(!a53_0x4adc51[_0x211539(0x1fb)](_0x5e8155))return null;try{const _0x3e0b1c=a53_0x4adc51[_0x211539(0x201)](_0x5e8155,'utf-8'),_0x168186=JSON[_0x211539(0x1f6)](_0x3e0b1c),_0x140423=new Date(_0x168186[_0x211539(0x1f9)])[_0x211539(0x20f)](),_0x541c4a=Date[_0x211539(0x202)]();if(_0x541c4a-_0x140423>SESSION_EXPIRATION_MS)return a53_0x4adc51[_0x211539(0x215)](_0x5e8155),null;const _0x1b0cbe=JSON[_0x211539(0x207)](_0x168186);if(_0x1b0cbe[_0x211539(0x203)](_0x211539(0x212))||_0x1b0cbe[_0x211539(0x203)](_0x211539(0x1fa))||_0x1b0cbe['includes'](_0x211539(0x1f5)))return console[_0x211539(0x1f1)](_0x211539(0x1f2)+_0x5e8155+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a53_0x4adc51['unlinkSync'](_0x5e8155),null;return _0x168186;}catch{try{a53_0x4adc51['unlinkSync'](_0x5e8155);}catch{}return null;}}export function saveSessionContext(_0x5985f3,_0xd253a3){const _0x1b1eeb=a53_0x18c2,_0x204975=getSessionID(_0xd253a3),_0x3c7b7c=/^\d+$/[_0x1b1eeb(0x1f8)](_0x204975)?parseInt(_0x204975,0xa):getCurrentSessionPID(),_0x5eeaff=a53_0x878858[_0x1b1eeb(0x20e)](getSessionsDir(),_0x204975+_0x1b1eeb(0x1ff)),_0x52bd86=getSessionsDir();createSecureDirectory(_0x52bd86);const _0x3f300c=JSON['stringify'](_0x5985f3);if(_0x3f300c[_0x1b1eeb(0x203)](_0x1b1eeb(0x212))||_0x3f300c[_0x1b1eeb(0x203)](_0x1b1eeb(0x1fa))||_0x3f300c[_0x1b1eeb(0x203)]('api_key'))throw new Error(_0x1b1eeb(0x20b));let _0x122a96;const _0x2a9809=/^\d+$/['test'](_0x204975)?loadSessionContextByPID(parseInt(_0x204975,0xa)):loadSessionContextByString(_0x204975);_0x2a9809?_0x122a96={..._0x2a9809,..._0x5985f3,'pid':_0x3c7b7c,'sessionId':_0x204975!==_0x3c7b7c[_0x1b1eeb(0x214)]()?_0x204975:undefined,'updatedAt':new Date()['toISOString']()}:_0x122a96={'pid':_0x3c7b7c,'sessionId':_0x204975!==_0x3c7b7c[_0x1b1eeb(0x214)]()?_0x204975:undefined,..._0x5985f3,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x1b1eeb(0x216)]()},a53_0x4adc51[_0x1b1eeb(0x204)](_0x5eeaff,JSON[_0x1b1eeb(0x207)](_0x122a96,null,0x2));}function a53_0x18c2(_0x1ea1b8,_0x2b20c9){_0x1ea1b8=_0x1ea1b8-0x1ee;const _0x75ae2f=a53_0x75ae();let _0x18c22f=_0x75ae2f[_0x1ea1b8];return _0x18c22f;}export function clearSessionContext(_0x5e41ea){const _0x1c6486=a53_0x18c2,_0x499c91=getSessionID(_0x5e41ea),_0x1ef856=a53_0x878858[_0x1c6486(0x20e)](getSessionsDir(),_0x499c91+_0x1c6486(0x1ff));a53_0x4adc51['existsSync'](_0x1ef856)&&a53_0x4adc51[_0x1c6486(0x215)](_0x1ef856);}export function clearSessionContextField(_0x46fe90,_0x2dab42){const _0x276e12=a53_0x18c2,_0x3fd52e=getSessionID(_0x2dab42),_0x1a6f8c=a53_0x878858[_0x276e12(0x20e)](getSessionsDir(),_0x3fd52e+'.json');if(!a53_0x4adc51[_0x276e12(0x1fb)](_0x1a6f8c))return;try{const _0x3c3e3b=a53_0x4adc51[_0x276e12(0x201)](_0x1a6f8c,'utf-8'),_0x5e141f=JSON['parse'](_0x3c3e3b);delete _0x5e141f[_0x46fe90],a53_0x4adc51[_0x276e12(0x204)](_0x1a6f8c,JSON[_0x276e12(0x207)](_0x5e141f,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x358480=a53_0x18c2,_0x112780=getSessionsDir();if(!a53_0x4adc51['existsSync'](_0x112780))return 0x0;let _0x493d12=0x0;const _0x2927ec=Date[_0x358480(0x202)]();try{const _0x11e6db=a53_0x4adc51['readdirSync'](_0x112780);for(const _0xee5c45 of _0x11e6db){if(!_0xee5c45[_0x358480(0x1f0)](_0x358480(0x1ff)))continue;const _0x4cd534=a53_0x878858[_0x358480(0x20e)](_0x112780,_0xee5c45),_0xc4e179=_0xee5c45[_0x358480(0x1f3)]('.json',''),_0x515e26=parseInt(_0xc4e179,0xa),_0x484bbe=!isNaN(_0x515e26);if(_0x484bbe){if(!isProcessRunning(_0x515e26)){a53_0x4adc51[_0x358480(0x215)](_0x4cd534),_0x493d12++;continue;}}try{const _0x38794e=a53_0x4adc51[_0x358480(0x201)](_0x4cd534,'utf-8'),_0x1cf0c7=JSON[_0x358480(0x1f6)](_0x38794e),_0xdee878=new Date(_0x1cf0c7[_0x358480(0x1f9)])[_0x358480(0x20f)]();_0x2927ec-_0xdee878>SESSION_EXPIRATION_MS&&(a53_0x4adc51[_0x358480(0x215)](_0x4cd534),_0x493d12++);}catch{a53_0x4adc51[_0x358480(0x215)](_0x4cd534),_0x493d12++;}}}catch{}return _0x493d12;}export function listActiveSessions(){const _0x5508b1=a53_0x18c2,_0x2c09c9=getSessionsDir();if(!a53_0x4adc51[_0x5508b1(0x1fb)](_0x2c09c9))return[];try{const _0x2b32f9=a53_0x4adc51[_0x5508b1(0x1f7)](_0x2c09c9),_0x3d38f9=[];for(const _0x54030c of _0x2b32f9){if(!_0x54030c['endsWith'](_0x5508b1(0x1ff)))continue;const _0x494127=_0x54030c['replace'](_0x5508b1(0x1ff),''),_0x567252=parseInt(_0x494127,0xa);!isNaN(_0x567252)&&isProcessRunning(_0x567252)&&_0x3d38f9['push'](_0x567252);}return _0x3d38f9['sort']((_0x23ac35,_0x52d710)=>_0x23ac35-_0x52d710);}catch{return[];}}
1
+ (function(_0x27077c,_0x414f32){const _0x25b0a7=a53_0x1f4a,_0x41713d=_0x27077c();while(!![]){try{const _0x6057e8=parseInt(_0x25b0a7(0x140))/0x1*(-parseInt(_0x25b0a7(0x127))/0x2)+-parseInt(_0x25b0a7(0x129))/0x3*(-parseInt(_0x25b0a7(0x131))/0x4)+-parseInt(_0x25b0a7(0x12c))/0x5*(-parseInt(_0x25b0a7(0x11b))/0x6)+-parseInt(_0x25b0a7(0x130))/0x7*(-parseInt(_0x25b0a7(0x13b))/0x8)+parseInt(_0x25b0a7(0x120))/0x9+parseInt(_0x25b0a7(0x11f))/0xa+-parseInt(_0x25b0a7(0x11e))/0xb;if(_0x6057e8===_0x414f32)break;else _0x41713d['push'](_0x41713d['shift']());}catch(_0x586d34){_0x41713d['push'](_0x41713d['shift']());}}}(a53_0x5c7f,0x6a304));import*as a53_0x36b910 from'node:fs';import*as a53_0x2afda3 from'node:path';import*as a53_0xa97afd 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 _0x329775=a53_0x1f4a,_0x159a5e=process.env.TDX_CONFIG_DIR||a53_0x2afda3['join'](a53_0xa97afd['homedir'](),_0x329775(0x134),_0x329775(0x125));return a53_0x2afda3['join'](_0x159a5e,_0x329775(0x11c));}function getSessionPath(_0x270a14){const _0x15a176=a53_0x1f4a;return a53_0x2afda3[_0x15a176(0x121)](getSessionsDir(),_0x270a14+_0x15a176(0x128));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x162d35){const _0x3e917c=a53_0x1f4a;if(_0x162d35)return _0x162d35;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x3e917c(0x135)]();}export function loadSessionContext(_0x28aedc){const _0x47d8d2=a53_0x1f4a,_0x1dde3f=getSessionID(_0x28aedc),_0x520d53=/^\d+$/[_0x47d8d2(0x11d)](_0x1dde3f)?parseInt(_0x1dde3f,0xa):null;return _0x520d53!==null?loadSessionContextByPID(_0x520d53):loadSessionContextByString(_0x1dde3f);}export function loadSessionContextByPID(_0x41205a){const _0x2e038d=a53_0x1f4a,_0x399652=getSessionPath(_0x41205a);if(!a53_0x36b910['existsSync'](_0x399652))return null;try{const _0x3c508d=a53_0x36b910[_0x2e038d(0x138)](_0x399652,'utf-8'),_0x5552fd=JSON[_0x2e038d(0x13a)](_0x3c508d),_0x2f899a=new Date(_0x5552fd['createdAt'])[_0x2e038d(0x132)](),_0x990516=Date[_0x2e038d(0x119)]();if(_0x990516-_0x2f899a>SESSION_EXPIRATION_MS)return a53_0x36b910[_0x2e038d(0x122)](_0x399652),null;const _0x1fdbaa=JSON[_0x2e038d(0x12e)](_0x5552fd);if(_0x1fdbaa['includes'](_0x2e038d(0x12b))||_0x1fdbaa[_0x2e038d(0x133)](_0x2e038d(0x13c))||_0x1fdbaa[_0x2e038d(0x133)](_0x2e038d(0x118)))return console[_0x2e038d(0x139)](_0x2e038d(0x117)+_0x399652+_0x2e038d(0x123)),a53_0x36b910[_0x2e038d(0x122)](_0x399652),null;return _0x5552fd;}catch{try{a53_0x36b910['unlinkSync'](_0x399652);}catch{}return null;}}function loadSessionContextByString(_0x41e39f){const _0xa1291a=a53_0x1f4a,_0x203dab=a53_0x2afda3[_0xa1291a(0x121)](getSessionsDir(),_0x41e39f+_0xa1291a(0x128));if(!a53_0x36b910[_0xa1291a(0x12f)](_0x203dab))return null;try{const _0x515b57=a53_0x36b910['readFileSync'](_0x203dab,_0xa1291a(0x13e)),_0x2775e8=JSON[_0xa1291a(0x13a)](_0x515b57),_0x451c44=new Date(_0x2775e8['createdAt'])[_0xa1291a(0x132)](),_0x52b30e=Date['now']();if(_0x52b30e-_0x451c44>SESSION_EXPIRATION_MS)return a53_0x36b910[_0xa1291a(0x122)](_0x203dab),null;const _0x52aa30=JSON[_0xa1291a(0x12e)](_0x2775e8);if(_0x52aa30[_0xa1291a(0x133)](_0xa1291a(0x12b))||_0x52aa30[_0xa1291a(0x133)](_0xa1291a(0x13c))||_0x52aa30['includes'](_0xa1291a(0x118)))return console[_0xa1291a(0x139)](_0xa1291a(0x117)+_0x203dab+_0xa1291a(0x123)),a53_0x36b910[_0xa1291a(0x122)](_0x203dab),null;return _0x2775e8;}catch{try{a53_0x36b910[_0xa1291a(0x122)](_0x203dab);}catch{}return null;}}export function saveSessionContext(_0x1da0fd,_0x4418a4){const _0x2c5a3c=a53_0x1f4a,_0x476ca4=getSessionID(_0x4418a4),_0x2c6b3f=/^\d+$/[_0x2c5a3c(0x11d)](_0x476ca4)?parseInt(_0x476ca4,0xa):getCurrentSessionPID(),_0x260e8c=a53_0x2afda3['join'](getSessionsDir(),_0x476ca4+'.json'),_0x58a9ec=getSessionsDir();createSecureDirectory(_0x58a9ec);const _0x584563=JSON['stringify'](_0x1da0fd);if(_0x584563[_0x2c5a3c(0x133)](_0x2c5a3c(0x12b))||_0x584563['includes'](_0x2c5a3c(0x13c))||_0x584563[_0x2c5a3c(0x133)](_0x2c5a3c(0x118)))throw new Error(_0x2c5a3c(0x136));let _0x4bcc02;const _0x186f63=/^\d+$/['test'](_0x476ca4)?loadSessionContextByPID(parseInt(_0x476ca4,0xa)):loadSessionContextByString(_0x476ca4);_0x186f63?_0x4bcc02={..._0x186f63,..._0x1da0fd,'pid':_0x2c6b3f,'sessionId':_0x476ca4!==_0x2c6b3f['toString']()?_0x476ca4:undefined,'updatedAt':new Date()[_0x2c5a3c(0x11a)]()}:_0x4bcc02={'pid':_0x2c6b3f,'sessionId':_0x476ca4!==_0x2c6b3f[_0x2c5a3c(0x135)]()?_0x476ca4:undefined,..._0x1da0fd,'createdAt':new Date()[_0x2c5a3c(0x11a)](),'updatedAt':new Date()['toISOString']()},a53_0x36b910[_0x2c5a3c(0x13d)](_0x260e8c,JSON[_0x2c5a3c(0x12e)](_0x4bcc02,null,0x2));}function a53_0x5c7f(){const _0x415aaf=['now','toISOString','1130706SjzqWr','sessions','test','18955904xJDpEA','2868640uTRPpw','4641408sWhJCv','join','unlinkSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','push','tdx','createdAt','182kCaHBT','.json','196797stmfxa','replace','TD_API_KEY','5aFwSzr','readdirSync','stringify','existsSync','58583sogeBu','52ZlGzuu','getTime','includes','.config','toString','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','endsWith','readFileSync','warn','parse','504mddiFH','apiKey','writeFileSync','utf-8','sort','2339fFNPGL','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','api_key'];a53_0x5c7f=function(){return _0x415aaf;};return a53_0x5c7f();}export function clearSessionContext(_0x46f90f){const _0x31a1d3=a53_0x1f4a,_0x2e00a1=getSessionID(_0x46f90f),_0xed276a=a53_0x2afda3['join'](getSessionsDir(),_0x2e00a1+_0x31a1d3(0x128));a53_0x36b910[_0x31a1d3(0x12f)](_0xed276a)&&a53_0x36b910[_0x31a1d3(0x122)](_0xed276a);}export function clearSessionContextField(_0x307b15,_0x11b2cb){const _0x3d6143=a53_0x1f4a,_0x263a1b=getSessionID(_0x11b2cb),_0x1aee21=a53_0x2afda3['join'](getSessionsDir(),_0x263a1b+_0x3d6143(0x128));if(!a53_0x36b910[_0x3d6143(0x12f)](_0x1aee21))return;try{const _0x4b2dc6=a53_0x36b910[_0x3d6143(0x138)](_0x1aee21,'utf-8'),_0x8ac36c=JSON[_0x3d6143(0x13a)](_0x4b2dc6);delete _0x8ac36c[_0x307b15],a53_0x36b910[_0x3d6143(0x13d)](_0x1aee21,JSON['stringify'](_0x8ac36c,null,0x2));}catch{}}function a53_0x1f4a(_0x758a45,_0x56c8b5){_0x758a45=_0x758a45-0x117;const _0x5c7fe4=a53_0x5c7f();let _0x1f4afe=_0x5c7fe4[_0x758a45];return _0x1f4afe;}export function cleanExpiredSessions(){const _0x50acf7=a53_0x1f4a,_0xf44c6f=getSessionsDir();if(!a53_0x36b910[_0x50acf7(0x12f)](_0xf44c6f))return 0x0;let _0x5ea694=0x0;const _0x358277=Date['now']();try{const _0x2a12bb=a53_0x36b910[_0x50acf7(0x12d)](_0xf44c6f);for(const _0x3a14a6 of _0x2a12bb){if(!_0x3a14a6[_0x50acf7(0x137)](_0x50acf7(0x128)))continue;const _0x1f51b5=a53_0x2afda3['join'](_0xf44c6f,_0x3a14a6),_0x1c08c3=_0x3a14a6[_0x50acf7(0x12a)](_0x50acf7(0x128),''),_0x1790f2=parseInt(_0x1c08c3,0xa),_0x1c5159=!isNaN(_0x1790f2);if(_0x1c5159){if(!isProcessRunning(_0x1790f2)){a53_0x36b910[_0x50acf7(0x122)](_0x1f51b5),_0x5ea694++;continue;}}try{const _0x4536b4=a53_0x36b910[_0x50acf7(0x138)](_0x1f51b5,_0x50acf7(0x13e)),_0x2cc350=JSON['parse'](_0x4536b4),_0x9777ff=new Date(_0x2cc350[_0x50acf7(0x126)])[_0x50acf7(0x132)]();_0x358277-_0x9777ff>SESSION_EXPIRATION_MS&&(a53_0x36b910[_0x50acf7(0x122)](_0x1f51b5),_0x5ea694++);}catch{a53_0x36b910[_0x50acf7(0x122)](_0x1f51b5),_0x5ea694++;}}}catch{}return _0x5ea694;}export function listActiveSessions(){const _0x498a06=a53_0x1f4a,_0x23ef20=getSessionsDir();if(!a53_0x36b910[_0x498a06(0x12f)](_0x23ef20))return[];try{const _0x18a7b9=a53_0x36b910[_0x498a06(0x12d)](_0x23ef20),_0x3bd4ee=[];for(const _0xf1d3 of _0x18a7b9){if(!_0xf1d3['endsWith'](_0x498a06(0x128)))continue;const _0x3ac992=_0xf1d3[_0x498a06(0x12a)](_0x498a06(0x128),''),_0x12b85b=parseInt(_0x3ac992,0xa);!isNaN(_0x12b85b)&&isProcessRunning(_0x12b85b)&&_0x3bd4ee[_0x498a06(0x124)](_0x12b85b);}return _0x3bd4ee[_0x498a06(0x13f)]((_0x559497,_0x3260b3)=>_0x559497-_0x3260b3);}catch{return[];}}
@@ -1 +1 @@
1
- const a54_0x567b27=a54_0x381f;function a54_0x381f(_0x3ee06a,_0x3f5a8a){_0x3ee06a=_0x3ee06a-0x12b;const _0x52b85d=a54_0x52b8();let _0x381f11=_0x52b85d[_0x3ee06a];return _0x381f11;}(function(_0x2480b5,_0x2fc686){const _0x4f18bc=a54_0x381f,_0x5871d0=_0x2480b5();while(!![]){try{const _0x544aa2=-parseInt(_0x4f18bc(0x138))/0x1*(-parseInt(_0x4f18bc(0x12e))/0x2)+parseInt(_0x4f18bc(0x134))/0x3+parseInt(_0x4f18bc(0x136))/0x4+parseInt(_0x4f18bc(0x130))/0x5*(parseInt(_0x4f18bc(0x133))/0x6)+parseInt(_0x4f18bc(0x132))/0x7*(parseInt(_0x4f18bc(0x13b))/0x8)+parseInt(_0x4f18bc(0x137))/0x9+parseInt(_0x4f18bc(0x12c))/0xa*(-parseInt(_0x4f18bc(0x13a))/0xb);if(_0x544aa2===_0x2fc686)break;else _0x5871d0['push'](_0x5871d0['shift']());}catch(_0xd1da69){_0x5871d0['push'](_0x5871d0['shift']());}}}(a54_0x52b8,0xd4337));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0x567b27(0x12d),a54_0x567b27(0x12b));export function loadCachedUsers(_0x4810be){const _0xb67a6=a54_0x567b27,_0x2144d1=userCache[_0xb67a6(0x139)](_0x4810be);return _0x2144d1?.[_0xb67a6(0x131)]??null;}export function saveCachedUsers(_0x5a8920,_0x1342b9){const _0x35d1d2=a54_0x567b27;userCache[_0x35d1d2(0x135)](_0x5a8920,{'users':_0x1342b9,'cachedAt':Date[_0x35d1d2(0x12f)]()});}function a54_0x52b8(){const _0x3cb5d2=['99QejYCQ','8jfZsgE','core/user-cache','4167050RGqIan','users-{profile}.json','2854lYnRmK','now','121735pRhNHN','users','3494253hQmaPB','294AHnEtm','2495781GnriNf','write','4528660VRYyjD','8206866PiYaRB','36mxrIVu','read'];a54_0x52b8=function(){return _0x3cb5d2;};return a54_0x52b8();}export function clearUserCache(_0xedcdb){userCache['clear'](_0xedcdb);}
1
+ function a54_0xa1e9(_0x214dd5,_0x2a5a3f){_0x214dd5=_0x214dd5-0x73;const _0x56162c=a54_0x5616();let _0xa1e911=_0x56162c[_0x214dd5];return _0xa1e911;}const a54_0x5dac5c=a54_0xa1e9;(function(_0x3a36f3,_0x11e4c5){const _0x313b25=a54_0xa1e9,_0x3d1a47=_0x3a36f3();while(!![]){try{const _0x50c26c=parseInt(_0x313b25(0x7b))/0x1+-parseInt(_0x313b25(0x74))/0x2+-parseInt(_0x313b25(0x77))/0x3+-parseInt(_0x313b25(0x7c))/0x4+parseInt(_0x313b25(0x78))/0x5+-parseInt(_0x313b25(0x73))/0x6*(parseInt(_0x313b25(0x7f))/0x7)+-parseInt(_0x313b25(0x75))/0x8*(-parseInt(_0x313b25(0x76))/0x9);if(_0x50c26c===_0x11e4c5)break;else _0x3d1a47['push'](_0x3d1a47['shift']());}catch(_0x456123){_0x3d1a47['push'](_0x3d1a47['shift']());}}}(a54_0x5616,0x6fb8e));function a54_0x5616(){const _0x11b54e=['write','100922plvXDw','2189504amvzmI','clear','core/user-cache','21287FtuZcF','now','402HGUKlq','1577940qerONA','1856GxWitk','74709UHXAZB','1765389MtpFdA','2797080XltcwY','users-{profile}.json'];a54_0x5616=function(){return _0x11b54e;};return a54_0x5616();}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0x5dac5c(0x79),a54_0x5dac5c(0x7e));export function loadCachedUsers(_0x401b4b){const _0x524dd6=userCache['read'](_0x401b4b);return _0x524dd6?.['users']??null;}export function saveCachedUsers(_0x4f1560,_0x4eac09){const _0x106645=a54_0x5dac5c;userCache[_0x106645(0x7a)](_0x4f1560,{'users':_0x4eac09,'cachedAt':Date[_0x106645(0x80)]()});}export function clearUserCache(_0x2dff49){const _0x3a61e1=a54_0x5dac5c;userCache[_0x3a61e1(0x7d)](_0x2dff49);}
@@ -1 +1 @@
1
- function a55_0xae8b(){const _0x39b9ca=['parse','10DLnyye','1475160hdFXoT','6358278lRfHAk','utf-8','.dev','1387936YZbBhD','672580dGlpAp','../build-info.json','26811RuNqqA','11022824VVycqQ','includes','24165576oSdsNP','version','7fdGFIY','652xAHCuT'];a55_0xae8b=function(){return _0x39b9ca;};return a55_0xae8b();}(function(_0x1b189b,_0x5d30c1){const _0x3e9c60=a55_0x13d4,_0x210b3c=_0x1b189b();while(!![]){try{const _0x105ae5=-parseInt(_0x3e9c60(0x163))/0x1+parseInt(_0x3e9c60(0x167))/0x2+parseInt(_0x3e9c60(0x16a))/0x3*(parseInt(_0x3e9c60(0x160))/0x4)+-parseInt(_0x3e9c60(0x168))/0x5+-parseInt(_0x3e9c60(0x164))/0x6+-parseInt(_0x3e9c60(0x15f))/0x7*(parseInt(_0x3e9c60(0x15b))/0x8)+-parseInt(_0x3e9c60(0x15d))/0x9*(-parseInt(_0x3e9c60(0x162))/0xa);if(_0x105ae5===_0x5d30c1)break;else _0x210b3c['push'](_0x210b3c['shift']());}catch(_0x52fcea){_0x210b3c['push'](_0x210b3c['shift']());}}}(a55_0xae8b,0xc0829));function a55_0x13d4(_0x2d4e7e,_0x153828){_0x2d4e7e=_0x2d4e7e-0x15b;const _0xae8b2=a55_0xae8b();let _0x13d497=_0xae8b2[_0x2d4e7e];return _0x13d497;}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x50dc3f=a55_0x13d4;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x417ab6=fileURLToPath(import.meta.url),_0x53d6e8=dirname(_0x417ab6);try{const _0x23a12b=join(_0x53d6e8,_0x50dc3f(0x169));cachedBuildInfo=JSON[_0x50dc3f(0x161)](readFileSync(_0x23a12b,_0x50dc3f(0x165)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0xa10a6c=a55_0x13d4;if(cachedVersion!==null)return cachedVersion;const _0xa43c5b=fileURLToPath(import.meta.url),_0x18dba3=dirname(_0xa43c5b),_0x5380c3=getBuildInfo();if(_0x5380c3[_0xa10a6c(0x15e)])return cachedVersion=_0x5380c3['version'],cachedVersion;try{const _0x79c29e=join(_0x18dba3,'../../package.json'),_0x5613ad=JSON[_0xa10a6c(0x161)](readFileSync(_0x79c29e,_0xa10a6c(0x165)));cachedVersion=_0x5613ad[_0xa10a6c(0x15e)];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x2d1f98=a55_0x13d4,_0x4e1c67=getVersion();return _0x4e1c67[_0x2d1f98(0x15c)](_0x2d1f98(0x166))||_0x4e1c67[_0x2d1f98(0x15c)]('-');}
1
+ function a55_0x22d8(){const _0x3bc145=['4PHFdkN','.dev','4820xfHkvT','134ygWWqo','../../package.json','10103027NQSPKh','version','1382286WrUsXt','1337udXjTa','0.0.0','1079975nsrGAn','utf-8','419103MjdvHB','includes','7912YgVaWa','parse','70RfbxSq','457233HvWibF'];a55_0x22d8=function(){return _0x3bc145;};return a55_0x22d8();}(function(_0xddcd98,_0x1fc1e){const _0x5770ed=a55_0x3d4b,_0x3b5c70=_0xddcd98();while(!![]){try{const _0x116459=parseInt(_0x5770ed(0x187))/0x1*(-parseInt(_0x5770ed(0x186))/0x2)+parseInt(_0x5770ed(0x183))/0x3+parseInt(_0x5770ed(0x184))/0x4*(parseInt(_0x5770ed(0x18e))/0x5)+-parseInt(_0x5770ed(0x18b))/0x6+-parseInt(_0x5770ed(0x18c))/0x7*(parseInt(_0x5770ed(0x180))/0x8)+-parseInt(_0x5770ed(0x190))/0x9*(parseInt(_0x5770ed(0x182))/0xa)+parseInt(_0x5770ed(0x189))/0xb;if(_0x116459===_0x1fc1e)break;else _0x3b5c70['push'](_0x3b5c70['shift']());}catch(_0x2c1fff){_0x3b5c70['push'](_0x3b5c70['shift']());}}}(a55_0x22d8,0x35632));function a55_0x3d4b(_0x52e9f1,_0x996131){_0x52e9f1=_0x52e9f1-0x180;const _0x22d883=a55_0x22d8();let _0x3d4bb8=_0x22d883[_0x52e9f1];return _0x3d4bb8;}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x20c256=a55_0x3d4b;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x40c601=fileURLToPath(import.meta.url),_0x103eaf=dirname(_0x40c601);try{const _0x5c608b=join(_0x103eaf,'../build-info.json');cachedBuildInfo=JSON[_0x20c256(0x181)](readFileSync(_0x5c608b,_0x20c256(0x18f)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x5c3c63=a55_0x3d4b;if(cachedVersion!==null)return cachedVersion;const _0x8e926b=fileURLToPath(import.meta.url),_0x4a6c0e=dirname(_0x8e926b),_0x5ec455=getBuildInfo();if(_0x5ec455['version'])return cachedVersion=_0x5ec455[_0x5c3c63(0x18a)],cachedVersion;try{const _0x8bdc01=join(_0x4a6c0e,_0x5c3c63(0x188)),_0x3ab590=JSON[_0x5c3c63(0x181)](readFileSync(_0x8bdc01,_0x5c3c63(0x18f)));cachedVersion=_0x3ab590[_0x5c3c63(0x18a)];}catch{cachedVersion=_0x5c3c63(0x18d);}return cachedVersion;}export function isDevVersion(){const _0x35f517=a55_0x3d4b,_0x2726f5=getVersion();return _0x2726f5[_0x35f517(0x191)](_0x35f517(0x185))||_0x2726f5[_0x35f517(0x191)]('-');}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x42ce17,_0x1ce05f){var _0x5ba48d=a56_0x3b50,_0x4ae7df=_0x42ce17();while(!![]){try{var _0x506ef8=-parseInt(_0x5ba48d(0x1d6))/0x1*(parseInt(_0x5ba48d(0x1da))/0x2)+-parseInt(_0x5ba48d(0x1d7))/0x3+parseInt(_0x5ba48d(0x1dd))/0x4*(parseInt(_0x5ba48d(0x1db))/0x5)+-parseInt(_0x5ba48d(0x1d8))/0x6+parseInt(_0x5ba48d(0x1dc))/0x7*(parseInt(_0x5ba48d(0x1d9))/0x8)+parseInt(_0x5ba48d(0x1de))/0x9+-parseInt(_0x5ba48d(0x1d5))/0xa;if(_0x506ef8===_0x1ce05f)break;else _0x4ae7df['push'](_0x4ae7df['shift']());}catch(_0x16b51d){_0x4ae7df['push'](_0x4ae7df['shift']());}}}(a56_0x497b,0xeb908));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';function a56_0x497b(){var _0x386f3a=['3194nsTWRJ','1538205nicSTl','528546psHROW','28072hdeetF','1066AqfWwx','6130QdXbpe','3556xzCwLS','3736QjFqqn','5851881utlPpi','3097650eZlYEZ'];a56_0x497b=function(){return _0x386f3a;};return a56_0x497b();}export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';function a56_0x3b50(_0x5f2df0,_0x2e8af5){_0x5f2df0=_0x5f2df0-0x1d5;var _0x497baa=a56_0x497b();var _0x3b50c6=_0x497baa[_0x5f2df0];return _0x3b50c6;}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 a56_0xafe5(){var _0x20b392=['504264hvgZya','1974912UVlIqm','4842222hfoPiB','891224CaknMK','142750YvnOQz','469224kUvzUF','45mBxXBF','231185vMONQz','276psiOMj'];a56_0xafe5=function(){return _0x20b392;};return a56_0xafe5();}(function(_0x5590a1,_0x4a9d0d){var _0x463a00=a56_0x2928,_0x2ea2bc=_0x5590a1();while(!![]){try{var _0x54dafe=parseInt(_0x463a00(0x1da))/0x1+-parseInt(_0x463a00(0x1dc))/0x2+-parseInt(_0x463a00(0x1e1))/0x3+-parseInt(_0x463a00(0x1dd))/0x4+-parseInt(_0x463a00(0x1e0))/0x5*(-parseInt(_0x463a00(0x1db))/0x6)+parseInt(_0x463a00(0x1de))/0x7+-parseInt(_0x463a00(0x1df))/0x8*(parseInt(_0x463a00(0x1d9))/0x9);if(_0x54dafe===_0x4a9d0d)break;else _0x2ea2bc['push'](_0x2ea2bc['shift']());}catch(_0x54a350){_0x2ea2bc['push'](_0x2ea2bc['shift']());}}}(a56_0xafe5,0xbdaf4));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';function a56_0x2928(_0x92b783,_0x1a1dce){_0x92b783=_0x92b783-0x1d9;var _0xafe55b=a56_0xafe5();var _0x2928e4=_0xafe55b[_0x92b783];return _0x2928e4;}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 +1 @@
1
- (function(_0x478af7,_0x1f64b1){const _0x46a841=a57_0x14e7,_0xc913a0=_0x478af7();while(!![]){try{const _0x4558f0=-parseInt(_0x46a841(0x183))/0x1+parseInt(_0x46a841(0x18c))/0x2+-parseInt(_0x46a841(0x18d))/0x3+-parseInt(_0x46a841(0x180))/0x4*(parseInt(_0x46a841(0x192))/0x5)+parseInt(_0x46a841(0x18b))/0x6+parseInt(_0x46a841(0x195))/0x7+-parseInt(_0x46a841(0x188))/0x8*(-parseInt(_0x46a841(0x184))/0x9);if(_0x4558f0===_0x1f64b1)break;else _0xc913a0['push'](_0xc913a0['shift']());}catch(_0x3f94fa){_0xc913a0['push'](_0xc913a0['shift']());}}}(a57_0x59bf,0x4cb2f));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';function a57_0x14e7(_0x58ba82,_0x477302){_0x58ba82=_0x58ba82-0x170;const _0x59bf2b=a57_0x59bf();let _0x14e75b=_0x59bf2b[_0x58ba82];return _0x14e75b;}function a57_0x59bf(){const _0x533c2e=['once','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','describe','map','1825308XhnuDR','length','SIGTERM','243101UNpCVi','242847mzWIds','close','\x0a\x0a---\x0a\x0a','Data','40hUQRVb','Command\x20failed','stdin','3010428JjvMxR','828364favOji','810783OysQva','text','description','enum','optional','5mBBPSY','output','Context','1631091MoNfyd','**\x20(','SIGINT','category','tdx_run','Command\x20completed\x20successfully','1.0.0','string','connect','tdx_search','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.','array','join','env','registerTool','tdx','Utilities','success'];a57_0x59bf=function(){return _0x533c2e;};return a57_0x59bf();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x381cf5={}){const _0x812136=a57_0x14e7,_0x1daed8=new McpServer({'name':_0x812136(0x179),'version':_0x812136(0x170)});return _0x1daed8[_0x812136(0x178)](_0x812136(0x199),{'description':_0x812136(0x174),'inputSchema':{'args':z[_0x812136(0x175)](z[_0x812136(0x171)]())[_0x812136(0x17e)](_0x812136(0x17d))}},async({args:_0x41edef})=>{const _0x5a70bb=_0x812136,_0xf7fcf6=await executeTdxRun({'args':_0x41edef},_0x381cf5[_0x5a70bb(0x177)]||{});return _0xf7fcf6[_0x5a70bb(0x17b)]?{'content':[{'type':'text','text':_0xf7fcf6['output']||_0x5a70bb(0x19a)}]}:{'content':[{'type':_0x5a70bb(0x18e),'text':_0xf7fcf6['error']||_0xf7fcf6[_0x5a70bb(0x193)]||_0x5a70bb(0x189)}],'isError':!![]};}),_0x1daed8[_0x812136(0x178)](_0x812136(0x173),{'description':'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.','inputSchema':{'query':z[_0x812136(0x171)]()[_0x812136(0x17e)]('Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)'),'category':z[_0x812136(0x190)]([_0x812136(0x187),'CDP','AI',_0x812136(0x194),_0x812136(0x17a)])[_0x812136(0x191)]()[_0x812136(0x17e)]('Optional\x20filter\x20by\x20category')}},async({query:_0x56fb9d,category:_0x131ef1})=>{const _0x11242a=_0x812136,_0x58f297=searchCommands({'query':_0x56fb9d,'category':_0x131ef1});if(_0x58f297[_0x11242a(0x181)]===0x0)return{'content':[{'type':'text','text':'No\x20commands\x20found\x20matching\x20\x22'+_0x56fb9d+'\x22'}]};const _0x149646=_0x58f297[_0x11242a(0x17f)](_0x3f79e3=>{const _0x2e71e6=_0x11242a,_0x4a8582=_0x3f79e3['examples'][_0x2e71e6(0x17f)](_0x53086b=>'\x20\x20'+_0x53086b)['join']('\x0a');return'**'+_0x3f79e3['name']+_0x2e71e6(0x196)+_0x3f79e3[_0x2e71e6(0x198)]+')\x0a'+_0x3f79e3[_0x2e71e6(0x18f)]+'\x0a\x0aExamples:\x0a'+_0x4a8582;})[_0x11242a(0x176)](_0x11242a(0x186));return{'content':[{'type':'text','text':_0x149646}]};}),_0x1daed8;}export async function startMCPServer(_0xdf725d={}){const _0x19cc90=a57_0x14e7,_0x5648db=createMCPServer(_0xdf725d),_0x53f86d=new StdioServerTransport();return await _0x5648db[_0x19cc90(0x172)](_0x53f86d),new Promise(_0x21a47b=>{const _0x26f0b5=_0x19cc90;let _0x44f919=![];const _0x34b21b=async()=>{const _0x8f3877=a57_0x14e7;if(_0x44f919)return;_0x44f919=!![],await _0x5648db[_0x8f3877(0x185)](),_0x21a47b();};process[_0x26f0b5(0x17c)](_0x26f0b5(0x197),_0x34b21b),process[_0x26f0b5(0x17c)](_0x26f0b5(0x182),_0x34b21b),process[_0x26f0b5(0x18a)][_0x26f0b5(0x17c)](_0x26f0b5(0x185),_0x34b21b);});}
1
+ (function(_0xba1f2d,_0x396df6){const _0x225768=a57_0x35fe,_0x38b5b1=_0xba1f2d();while(!![]){try{const _0x258146=-parseInt(_0x225768(0x184))/0x1*(parseInt(_0x225768(0x182))/0x2)+parseInt(_0x225768(0x19d))/0x3*(-parseInt(_0x225768(0x191))/0x4)+-parseInt(_0x225768(0x17c))/0x5+-parseInt(_0x225768(0x194))/0x6*(parseInt(_0x225768(0x1a2))/0x7)+parseInt(_0x225768(0x19b))/0x8+-parseInt(_0x225768(0x17a))/0x9*(parseInt(_0x225768(0x17b))/0xa)+parseInt(_0x225768(0x18b))/0xb;if(_0x258146===_0x396df6)break;else _0x38b5b1['push'](_0x38b5b1['shift']());}catch(_0x22f314){_0x38b5b1['push'](_0x38b5b1['shift']());}}}(a57_0x1459,0xaa174));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a57_0x1459(){const _0xd3cab=['enum','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','Data','68593dzoIup','string','describe','Command\x20failed','1.0.0','23319tXyHlY','1790RXYROh','4526580AZRmOd','output','tdx','array','\x0a\x0aExamples:\x0a','registerTool','126RIHKhX','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.','1787qOifHW','Utilities','SIGTERM','join','close','stdin','map','42766801JXhCvp','text','optional','No\x20commands\x20found\x20matching\x20\x22','once','connect','5237084tosVIM','Command\x20completed\x20successfully','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','552KegRAC','CDP','error','description','env','Optional\x20filter\x20by\x20category','length','4010128vNXsbo','tdx_run','3TbJPCe','**\x20('];a57_0x1459=function(){return _0xd3cab;};return a57_0x1459();}import{z}from'zod';function a57_0x35fe(_0x5593e1,_0x201182){_0x5593e1=_0x5593e1-0x17a;const _0x14599b=a57_0x1459();let _0x35fea0=_0x14599b[_0x5593e1];return _0x35fea0;}import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x1e74ec={}){const _0x5247ea=a57_0x35fe,_0x3433f6=new McpServer({'name':_0x5247ea(0x17e),'version':_0x5247ea(0x1a6)});return _0x3433f6[_0x5247ea(0x181)](_0x5247ea(0x19c),{'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[_0x5247ea(0x17f)](z['string']())[_0x5247ea(0x1a4)](_0x5247ea(0x1a0))}},async({args:_0x36cfb1})=>{const _0x25c53f=_0x5247ea,_0x5d0cfa=await executeTdxRun({'args':_0x36cfb1},_0x1e74ec[_0x25c53f(0x198)]||{});return _0x5d0cfa['success']?{'content':[{'type':_0x25c53f(0x18c),'text':_0x5d0cfa[_0x25c53f(0x17d)]||_0x25c53f(0x192)}]}:{'content':[{'type':_0x25c53f(0x18c),'text':_0x5d0cfa[_0x25c53f(0x196)]||_0x5d0cfa['output']||_0x25c53f(0x1a5)}],'isError':!![]};}),_0x3433f6[_0x5247ea(0x181)]('tdx_search',{'description':_0x5247ea(0x183),'inputSchema':{'query':z[_0x5247ea(0x1a3)]()['describe'](_0x5247ea(0x193)),'category':z[_0x5247ea(0x19f)]([_0x5247ea(0x1a1),_0x5247ea(0x195),'AI','Context',_0x5247ea(0x185)])[_0x5247ea(0x18d)]()['describe'](_0x5247ea(0x199))}},async({query:_0xa8df7,category:_0x395fc8})=>{const _0x25c77d=_0x5247ea,_0x38232c=searchCommands({'query':_0xa8df7,'category':_0x395fc8});if(_0x38232c[_0x25c77d(0x19a)]===0x0)return{'content':[{'type':_0x25c77d(0x18c),'text':_0x25c77d(0x18e)+_0xa8df7+'\x22'}]};const _0x182b06=_0x38232c[_0x25c77d(0x18a)](_0x102dd1=>{const _0x2d5725=_0x25c77d,_0x4530a0=_0x102dd1['examples']['map'](_0x515446=>'\x20\x20'+_0x515446)[_0x2d5725(0x187)]('\x0a');return'**'+_0x102dd1['name']+_0x2d5725(0x19e)+_0x102dd1['category']+')\x0a'+_0x102dd1[_0x2d5725(0x197)]+_0x2d5725(0x180)+_0x4530a0;})[_0x25c77d(0x187)]('\x0a\x0a---\x0a\x0a');return{'content':[{'type':_0x25c77d(0x18c),'text':_0x182b06}]};}),_0x3433f6;}export async function startMCPServer(_0x1917a9={}){const _0x4b0be9=a57_0x35fe,_0x51a4cb=createMCPServer(_0x1917a9),_0x1aafb8=new StdioServerTransport();return await _0x51a4cb[_0x4b0be9(0x190)](_0x1aafb8),new Promise(_0x7a613e=>{const _0x264d39=_0x4b0be9;let _0x3a93aa=![];const _0x3e5573=async()=>{const _0x48dbd7=a57_0x35fe;if(_0x3a93aa)return;_0x3a93aa=!![],await _0x51a4cb[_0x48dbd7(0x188)](),_0x7a613e();};process[_0x264d39(0x18f)]('SIGINT',_0x3e5573),process[_0x264d39(0x18f)](_0x264d39(0x186),_0x3e5573),process[_0x264d39(0x189)][_0x264d39(0x18f)](_0x264d39(0x188),_0x3e5573);});}
@@ -1 +1 @@
1
- (function(_0x3a37c5,_0x55f06d){var _0x2bdc37=a58_0x40ac,_0x25217c=_0x3a37c5();while(!![]){try{var _0x113537=parseInt(_0x2bdc37(0x165))/0x1+-parseInt(_0x2bdc37(0x163))/0x2*(-parseInt(_0x2bdc37(0x164))/0x3)+-parseInt(_0x2bdc37(0x15b))/0x4+parseInt(_0x2bdc37(0x161))/0x5*(parseInt(_0x2bdc37(0x162))/0x6)+parseInt(_0x2bdc37(0x15c))/0x7*(parseInt(_0x2bdc37(0x15d))/0x8)+parseInt(_0x2bdc37(0x160))/0x9*(parseInt(_0x2bdc37(0x15e))/0xa)+-parseInt(_0x2bdc37(0x15f))/0xb;if(_0x113537===_0x55f06d)break;else _0x25217c['push'](_0x25217c['shift']());}catch(_0x233284){_0x25217c['push'](_0x25217c['shift']());}}}(a58_0x2f6e,0xa0060));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';function a58_0x2f6e(){var _0x5bec48=['10HjGDIS','2482674wkcITB','1046CqXyqs','7167xTWCoQ','1221160lltFcd','1331708xZLQYQ','6020819OozvNv','8pTDQPN','1903140gjZwwb','47429613jAAXFG','54SeuuaP'];a58_0x2f6e=function(){return _0x5bec48;};return a58_0x2f6e();}function a58_0x40ac(_0x4cb87d,_0x287939){_0x4cb87d=_0x4cb87d-0x15b;var _0x2f6ee2=a58_0x2f6e();var _0x40ac62=_0x2f6ee2[_0x4cb87d];return _0x40ac62;}export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
1
+ function a58_0x5037(){var _0xd8d615=['2145645eiNosE','45343YrKUZi','13092xxOphc','6645VIKNwi','133212idIBbn','2980803EDrdyb','20zKzeKM','445xKkwsL','142hvnlWd','2735592GDEDLj'];a58_0x5037=function(){return _0xd8d615;};return a58_0x5037();}(function(_0xa20d8e,_0x12d2ed){var _0x5156c1=a58_0x1ed2,_0xa9cff7=_0xa20d8e();while(!![]){try{var _0xf3fb40=parseInt(_0x5156c1(0xd2))/0x1+parseInt(_0x5156c1(0xd9))/0x2*(-parseInt(_0x5156c1(0xd4))/0x3)+-parseInt(_0x5156c1(0xd5))/0x4+parseInt(_0x5156c1(0xd8))/0x5*(-parseInt(_0x5156c1(0xd3))/0x6)+parseInt(_0x5156c1(0xd6))/0x7+-parseInt(_0x5156c1(0xda))/0x8+parseInt(_0x5156c1(0xdb))/0x9*(parseInt(_0x5156c1(0xd7))/0xa);if(_0xf3fb40===_0x12d2ed)break;else _0xa9cff7['push'](_0xa9cff7['shift']());}catch(_0x4fd318){_0xa9cff7['push'](_0xa9cff7['shift']());}}}(a58_0x5037,0x36053));function a58_0x1ed2(_0x3d39e1,_0x169662){_0x3d39e1=_0x3d39e1-0xd2;var _0x5037b1=a58_0x5037();var _0x1ed2b0=_0x5037b1[_0x3d39e1];return _0x1ed2b0;}export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
@@ -1 +1 @@
1
- function a59_0x4a49(){const _0x4e86ce=['stdout','win32','116XjwvDx','kill','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','stderr','node.exe','execPath','error','4084140lIjWCS','message','--json','object','node','--no-color','ignore','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','pipe','array','7kmrybQ','20TvuXPT','data','272140ppmpgm','294940UjPCDG','true','SIGTERM','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','1034289iXxLwN','toString','20926ROTNzZ','resourcesPath','2059125teCNmf','8623288mbmEtY','PATH','Failed\x20to\x20spawn\x20tdx:\x20','tdx','44IgpDhi','platform'];a59_0x4a49=function(){return _0x4e86ce;};return a59_0x4a49();}function a59_0x1d84(_0x3f9a2e,_0x589977){_0x3f9a2e=_0x3f9a2e-0x141;const _0x4a4945=a59_0x4a49();let _0x1d844d=_0x4a4945[_0x3f9a2e];return _0x1d844d;}const a59_0x2effc2=a59_0x1d84;(function(_0x15e350,_0x573d0b){const _0x5df74d=a59_0x1d84,_0x2bd457=_0x15e350();while(!![]){try{const _0x1a5d88=-parseInt(_0x5df74d(0x164))/0x1*(-parseInt(_0x5df74d(0x159))/0x2)+-parseInt(_0x5df74d(0x15b))/0x3+-parseInt(_0x5df74d(0x150))/0x4*(-parseInt(_0x5df74d(0x152))/0x5)+-parseInt(_0x5df74d(0x145))/0x6*(parseInt(_0x5df74d(0x14f))/0x7)+parseInt(_0x5df74d(0x15c))/0x8+-parseInt(_0x5df74d(0x157))/0x9+parseInt(_0x5df74d(0x153))/0xa*(-parseInt(_0x5df74d(0x160))/0xb);if(_0x1a5d88===_0x573d0b)break;else _0x2bd457['push'](_0x2bd457['shift']());}catch(_0x4d3c5a){_0x2bd457['push'](_0x2bd457['shift']());}}}(a59_0x4a49,0xeb4d5));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_0x2effc2(0x148)]({'args':z[a59_0x2effc2(0x14e)](z['string']())['describe'](a59_0x2effc2(0x156))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function getNodeBinDir(){const _0xa0a6c0=a59_0x2effc2,_0x8e4625=process[_0xa0a6c0(0x15a)];if(_0x8e4625){const _0x590d3d=join(_0x8e4625,'node'),_0x5723ad=process[_0xa0a6c0(0x161)]===_0xa0a6c0(0x163)?_0xa0a6c0(0x142):_0xa0a6c0(0x149);if(existsSync(join(_0x590d3d,_0x5723ad)))return _0x590d3d;}return dirname(process[_0xa0a6c0(0x143)]);}export async function executeTdxRun(_0x470ca7,_0x20bbe2){const _0x7a832b=a59_0x2effc2,{args:_0x58a3a5}=_0x470ca7;if(isBlockedCommand(_0x58a3a5)){const _0xd63532=getBlockedReason(_0x58a3a5);return{'success':![],'output':'','error':_0xd63532||_0x7a832b(0x166),'exitCode':0x1};}const _0x422109=[_0x7a832b(0x147),_0x7a832b(0x14a),..._0x58a3a5],_0x576781=getNodeBinDir(),_0x5e12b0=process[_0x7a832b(0x161)]===_0x7a832b(0x163)?';':':',_0x2afea6=_0x20bbe2[_0x7a832b(0x15d)]??process.env.PATH??'',_0x49879b=''+_0x576781+_0x5e12b0+_0x2afea6;return new Promise(_0x160429=>{const _0x137694=_0x7a832b,_0x18be91=spawn(_0x137694(0x15f),_0x422109,{'env':{...process.env,..._0x20bbe2,'PATH':_0x49879b,'CI':_0x137694(0x154)},'stdio':[_0x137694(0x14b),_0x137694(0x14d),_0x137694(0x14d)]});let _0x256552='',_0x4d33d6='',_0x381147=![];const _0x45cc8d=setTimeout(()=>{const _0x330a38=_0x137694;_0x381147=!![],_0x18be91[_0x330a38(0x165)](_0x330a38(0x155));},DEFAULT_TIMEOUT_MS);_0x18be91[_0x137694(0x162)]['on'](_0x137694(0x151),_0x2b9601=>{_0x256552+=_0x2b9601['toString']();}),_0x18be91[_0x137694(0x141)]['on'](_0x137694(0x151),_0x206d44=>{const _0x5b5925=_0x137694;_0x4d33d6+=_0x206d44[_0x5b5925(0x158)]();}),_0x18be91['on'](_0x137694(0x144),_0x51ec37=>{const _0x483330=_0x137694;clearTimeout(_0x45cc8d),_0x160429({'success':![],'output':'','error':_0x483330(0x15e)+_0x51ec37[_0x483330(0x146)],'exitCode':0x1});}),_0x18be91['on']('close',_0x2ebf37=>{const _0x152bb6=_0x137694;clearTimeout(_0x45cc8d);if(_0x381147){_0x160429({'success':![],'output':formatOutput(_0x256552),'error':_0x152bb6(0x14c),'exitCode':0x7c});return;}const _0x1823ba=_0x2ebf37??0x1,_0x439499=_0x1823ba===0x0,_0x5d3d8d=formatOutput(_0x256552||_0x4d33d6),_0x37d4c8=!_0x439499&&_0x4d33d6?formatOutput(_0x4d33d6):undefined;_0x160429({'success':_0x439499,'output':_0x5d3d8d,'error':_0x37d4c8,'exitCode':_0x1823ba});});});}
1
+ const a59_0x29a8e7=a59_0x2645;(function(_0x1ecb75,_0x18761c){const _0x1ea220=a59_0x2645,_0xba0df7=_0x1ecb75();while(!![]){try{const _0x2de213=parseInt(_0x1ea220(0xc3))/0x1*(parseInt(_0x1ea220(0xc0))/0x2)+parseInt(_0x1ea220(0xd5))/0x3+parseInt(_0x1ea220(0xd9))/0x4+-parseInt(_0x1ea220(0xb7))/0x5*(-parseInt(_0x1ea220(0xb8))/0x6)+-parseInt(_0x1ea220(0xda))/0x7*(-parseInt(_0x1ea220(0xbf))/0x8)+-parseInt(_0x1ea220(0xd7))/0x9*(-parseInt(_0x1ea220(0xca))/0xa)+parseInt(_0x1ea220(0xc8))/0xb*(-parseInt(_0x1ea220(0xbd))/0xc);if(_0x2de213===_0x18761c)break;else _0xba0df7['push'](_0xba0df7['shift']());}catch(_0x3226fd){_0xba0df7['push'](_0xba0df7['shift']());}}}(a59_0x13ad,0x4360e));import{spawn}from'child_process';import{dirname,join}from'path';function a59_0x2645(_0xae8a2a,_0x27d44e){_0xae8a2a=_0xae8a2a-0xb5;const _0x13add9=a59_0x13ad();let _0x264541=_0x13add9[_0xae8a2a];return _0x264541;}import{existsSync}from'fs';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';function a59_0x13ad(){const _0x451a74=['67416zfFswH','70dDeYhL','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','2771KTYYGa','message','platform','PATH','object','517lYxnxK','resourcesPath','4870KCBZDb','SIGTERM','--no-color','array','node.exe','--json','kill','node','data','true','ignore','1324221exOOmJ','stdout','351mmWrzw','toString','192732fdfbNH','42qWyJxW','Failed\x20to\x20spawn\x20tdx:\x20','win32','5AioPpy','1147386dSqqOA','tdx','pipe','stderr','describe','145884ezhtDk','close'];a59_0x13ad=function(){return _0x451a74;};return a59_0x13ad();}export const TdxRunInputSchema=z[a59_0x29a8e7(0xc7)]({'args':z[a59_0x29a8e7(0xcd)](z['string']())[a59_0x29a8e7(0xbc)](a59_0x29a8e7(0xc1))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function getNodeBinDir(){const _0x33f150=a59_0x29a8e7,_0x49aa4a=process[_0x33f150(0xc9)];if(_0x49aa4a){const _0x3fdd41=join(_0x49aa4a,_0x33f150(0xd1)),_0x5c43b6=process[_0x33f150(0xc5)]==='win32'?_0x33f150(0xce):_0x33f150(0xd1);if(existsSync(join(_0x3fdd41,_0x5c43b6)))return _0x3fdd41;}return dirname(process['execPath']);}export async function executeTdxRun(_0x1b5853,_0x29865c){const _0x462b35=a59_0x29a8e7,{args:_0x2e70fa}=_0x1b5853;if(isBlockedCommand(_0x2e70fa)){const _0x1fc101=getBlockedReason(_0x2e70fa);return{'success':![],'output':'','error':_0x1fc101||_0x462b35(0xc2),'exitCode':0x1};}const _0x569660=[_0x462b35(0xcf),_0x462b35(0xcc),..._0x2e70fa],_0xefc554=getNodeBinDir(),_0x31df5d=process[_0x462b35(0xc5)]===_0x462b35(0xb6)?';':':',_0x5d5778=_0x29865c[_0x462b35(0xc6)]??process.env.PATH??'',_0x28a76d=''+_0xefc554+_0x31df5d+_0x5d5778;return new Promise(_0x3c2d29=>{const _0x4f0b16=_0x462b35,_0x1cc4ff=spawn(_0x4f0b16(0xb9),_0x569660,{'env':{...process.env,..._0x29865c,'PATH':_0x28a76d,'CI':_0x4f0b16(0xd3)},'stdio':[_0x4f0b16(0xd4),_0x4f0b16(0xba),_0x4f0b16(0xba)]});let _0x39330f='',_0x590d43='',_0x243fee=![];const _0xe23c14=setTimeout(()=>{const _0x2672e5=_0x4f0b16;_0x243fee=!![],_0x1cc4ff[_0x2672e5(0xd0)](_0x2672e5(0xcb));},DEFAULT_TIMEOUT_MS);_0x1cc4ff[_0x4f0b16(0xd6)]['on']('data',_0x25908b=>{_0x39330f+=_0x25908b['toString']();}),_0x1cc4ff[_0x4f0b16(0xbb)]['on'](_0x4f0b16(0xd2),_0x40bd6d=>{const _0x2498cd=_0x4f0b16;_0x590d43+=_0x40bd6d[_0x2498cd(0xd8)]();}),_0x1cc4ff['on']('error',_0x53634c=>{const _0x2fd6bf=_0x4f0b16;clearTimeout(_0xe23c14),_0x3c2d29({'success':![],'output':'','error':_0x2fd6bf(0xb5)+_0x53634c[_0x2fd6bf(0xc4)],'exitCode':0x1});}),_0x1cc4ff['on'](_0x4f0b16(0xbe),_0x31d068=>{clearTimeout(_0xe23c14);if(_0x243fee){_0x3c2d29({'success':![],'output':formatOutput(_0x39330f),'error':'Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','exitCode':0x7c});return;}const _0x2f4863=_0x31d068??0x1,_0x6ec734=_0x2f4863===0x0,_0x344988=formatOutput(_0x39330f||_0x590d43),_0x142b2b=!_0x6ec734&&_0x590d43?formatOutput(_0x590d43):undefined;_0x3c2d29({'success':_0x6ec734,'output':_0x344988,'error':_0x142b2b,'exitCode':_0x2f4863});});});}