@treasuredata/tdx 0.29.2 → 0.29.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segment-validate-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/status-command.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/unset-command.js +1 -1
  46. package/dist/commands/upgrade-command.js +1 -1
  47. package/dist/commands/use-command.js +1 -1
  48. package/dist/commands/user-command.js +1 -1
  49. package/dist/commands/workflow-command.js +1 -1
  50. package/dist/core/auth.js +1 -1
  51. package/dist/core/command-output.js +1 -1
  52. package/dist/core/config.js +1 -1
  53. package/dist/core/connection-cache.js +1 -1
  54. package/dist/core/constants.js +1 -1
  55. package/dist/core/credential-cache.js +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/keychain.js +1 -1
  58. package/dist/core/profile.js +1 -1
  59. package/dist/core/project-config.js +1 -1
  60. package/dist/core/session.js +1 -1
  61. package/dist/core/user-cache.js +1 -1
  62. package/dist/core/version.js +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/mcp/server.js +1 -1
  65. package/dist/mcp/tools/index.js +1 -1
  66. package/dist/mcp/tools/tdx-run.js +1 -1
  67. package/dist/mcp/tools/tdx-search.js +1 -1
  68. package/dist/mcp/utils.js +1 -1
  69. package/dist/proxy/claude-usage-tracker.js +1 -1
  70. package/dist/proxy/passthrough-server.js +1 -1
  71. package/dist/proxy/sse-usage-parser.js +1 -1
  72. package/dist/sdk/agent/agent-config.js +1 -1
  73. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  74. package/dist/sdk/agent/agent-yaml.js +1 -1
  75. package/dist/sdk/agent/test/evaluator.js +1 -1
  76. package/dist/sdk/agent/test/executor.js +1 -1
  77. package/dist/sdk/agent/test/index.js +1 -1
  78. package/dist/sdk/agent/test/output.js +1 -1
  79. package/dist/sdk/agent/test/parser.js +1 -1
  80. package/dist/sdk/agent/tool-target-registry.js +1 -1
  81. package/dist/sdk/api.js +1 -1
  82. package/dist/sdk/client/cdp-api-client.js +1 -1
  83. package/dist/sdk/client/delivery-api-client.js +1 -1
  84. package/dist/sdk/client/endpoints.js +1 -1
  85. package/dist/sdk/client/engage-api-client.js +1 -1
  86. package/dist/sdk/client/http-client.js +1 -1
  87. package/dist/sdk/client/llm-api-client.js +1 -1
  88. package/dist/sdk/client/rate-limiter.js +1 -1
  89. package/dist/sdk/client/td-api-client.js +1 -1
  90. package/dist/sdk/client/trino-api-client.js +1 -1
  91. package/dist/sdk/client/workflow-client.js +1 -1
  92. package/dist/sdk/connection-validator.js +1 -1
  93. package/dist/sdk/connection.js +1 -1
  94. package/dist/sdk/delivery.js +1 -1
  95. package/dist/sdk/engage/campaign-pull.js +1 -1
  96. package/dist/sdk/engage/campaign-push.js +1 -1
  97. package/dist/sdk/engage/campaign-validator.js +1 -1
  98. package/dist/sdk/engage/campaign-yaml.js +1 -1
  99. package/dist/sdk/engage/types/campaign-def.js +1 -1
  100. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  101. package/dist/sdk/engage.js +1 -1
  102. package/dist/sdk/errors.js +1 -1
  103. package/dist/sdk/index.js +1 -1
  104. package/dist/sdk/io/index.js +1 -1
  105. package/dist/sdk/io/node-filesystem.js +1 -1
  106. package/dist/sdk/job.js +1 -1
  107. package/dist/sdk/journey.js +1 -1
  108. package/dist/sdk/llm/chat-cache.js +1 -1
  109. package/dist/sdk/llm/index.js +1 -1
  110. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  111. package/dist/sdk/llm/model-factors.js +1 -1
  112. package/dist/sdk/personalization.js +1 -1
  113. package/dist/sdk/query/index.js +1 -1
  114. package/dist/sdk/query/sql-parser.js +1 -1
  115. package/dist/sdk/realtime.js +1 -1
  116. package/dist/sdk/schedule.js +1 -1
  117. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  118. package/dist/sdk/segment/fields-display.js +1 -1
  119. package/dist/sdk/segment/file-discovery.js +1 -1
  120. package/dist/sdk/segment/journey-utils.js +1 -1
  121. package/dist/sdk/segment/journey-validator.js +1 -1
  122. package/dist/sdk/segment/journey-yaml.js +1 -1
  123. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  124. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  125. package/dist/sdk/segment/pull-workflow.js +1 -1
  126. package/dist/sdk/segment/push-recovery.js +1 -1
  127. package/dist/sdk/segment/push-workflow.js +1 -1
  128. package/dist/sdk/segment/resolution-context.js +1 -1
  129. package/dist/sdk/segment/segment-path-parser.js +1 -1
  130. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  131. package/dist/sdk/segment/segment-validator.js +1 -1
  132. package/dist/sdk/segment/target-resolution.js +1 -1
  133. package/dist/sdk/segment/tdx-config.js +1 -1
  134. package/dist/sdk/segment/types/activation-schema.js +1 -1
  135. package/dist/sdk/segment/types/journey-def.js +1 -1
  136. package/dist/sdk/segment/types/journey-schema.js +1 -1
  137. package/dist/sdk/segment/types/segment-def.js +1 -1
  138. package/dist/sdk/segment/types/segment-schema.js +1 -1
  139. package/dist/sdk/segment/validate-files.js +1 -1
  140. package/dist/sdk/segment/yaml-validator.js +1 -1
  141. package/dist/sdk/segment.js +1 -1
  142. package/dist/sdk/types/index.js +1 -1
  143. package/dist/sdk/types/progress.js +1 -1
  144. package/dist/sdk/user.js +1 -1
  145. package/dist/sdk/util/format-detector.js +1 -1
  146. package/dist/sdk/util/formatters.js +1 -1
  147. package/dist/sdk/util/index.js +1 -1
  148. package/dist/sdk/util/tree-formatter.js +1 -1
  149. package/dist/sdk/workflow/archive-validation.js +1 -1
  150. package/dist/sdk/workflow/clone-workflow.js +1 -1
  151. package/dist/sdk/workflow/index.js +1 -1
  152. package/dist/sdk/workflow/pull-workflow.js +1 -1
  153. package/dist/sdk/workflow/push-workflow.js +1 -1
  154. package/dist/sdk/workflow/tdx-config.js +1 -1
  155. package/dist/sdk/workflow/workflow-utils.js +1 -1
  156. package/dist/test-utils/command-runner.js +1 -1
  157. package/dist/test-utils/factories.js +1 -1
  158. package/dist/test-utils/fixtures.js +1 -1
  159. package/dist/test-utils/http-mock.js +1 -1
  160. package/dist/test-utils/index.js +1 -1
  161. package/dist/utils/async.js +1 -1
  162. package/dist/utils/colors.js +1 -1
  163. package/dist/utils/diff.js +1 -1
  164. package/dist/utils/file-permissions.js +1 -1
  165. package/dist/utils/file-reader.js +1 -1
  166. package/dist/utils/global-cache.js +1 -1
  167. package/dist/utils/json-loader.js +1 -1
  168. package/dist/utils/local-cache.js +1 -1
  169. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  170. package/dist/utils/logger/formatters/index.js +1 -1
  171. package/dist/utils/logger/handlers/console-handler.js +1 -1
  172. package/dist/utils/logger/handlers/file-handler.js +1 -1
  173. package/dist/utils/logger/handlers/index.js +1 -1
  174. package/dist/utils/logger/handlers/null-handler.js +1 -1
  175. package/dist/utils/logger/index.js +1 -1
  176. package/dist/utils/logger/logger.js +1 -1
  177. package/dist/utils/logger/types.js +1 -1
  178. package/dist/utils/option-validation.js +1 -1
  179. package/dist/utils/process.js +1 -1
  180. package/dist/utils/prompt.js +1 -1
  181. package/dist/utils/spinner.js +1 -1
  182. package/dist/utils/sse-parser.js +1 -1
  183. package/dist/utils/string-utils.js +1 -1
  184. package/dist/utils/table-ref-parser.js +1 -1
  185. package/dist/utils/tdx-logger.js +1 -1
  186. package/dist/utils/version-check.js +1 -1
  187. package/package.json +1 -1
@@ -1 +1 @@
1
- const a50_0x45e526=a50_0x481d;(function(_0xa57209,_0x4d8baa){const _0x5e9b84=a50_0x481d,_0x2d53fc=_0xa57209();while(!![]){try{const _0xf1f034=parseInt(_0x5e9b84(0x1e5))/0x1+parseInt(_0x5e9b84(0x1f5))/0x2*(parseInt(_0x5e9b84(0x1d9))/0x3)+-parseInt(_0x5e9b84(0x1e2))/0x4+-parseInt(_0x5e9b84(0x1e3))/0x5+-parseInt(_0x5e9b84(0x1ca))/0x6*(-parseInt(_0x5e9b84(0x1db))/0x7)+parseInt(_0x5e9b84(0x1e9))/0x8+parseInt(_0x5e9b84(0x200))/0x9*(-parseInt(_0x5e9b84(0x1f0))/0xa);if(_0xf1f034===_0x4d8baa)break;else _0x2d53fc['push'](_0x2d53fc['shift']());}catch(_0x3cf166){_0x2d53fc['push'](_0x2d53fc['shift']());}}}(a50_0x4761,0xcd75b));function a50_0x4761(){const _0x165d7c=['readFileSync','startsWith','TD_API_KEY','parse','entries','dev-eu01','keychain','write','apiKey','path','next','apiKeys','endsWith','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','\x27,\x20defaulting\x20to\x20us01','6BTLUHO','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','site','stg-ap01','split','filter','ap01','toUpperCase','stringify','replace','stg-ap03','clear','warn','TDX_API_KEY_','stable','3pvWEDi','existsSync','2686943sRIbPN','trim','release_channel','string','Warning:\x20Unknown\x20site\x20\x27','map','tdx','127940RCXbDw','637185SxlOua','ap02','1543164YEJmWv','read','.json','.env','3406256xIXCft','stg-us01','llm_default_agent','TDX_API_KEY\x20env\x20var','number','match','Warning:\x20Failed\x20to\x20read\x20','130GVLqzV','tdx.json','accountId','eu01','dev-us01','2013274hSVjNM','yellow','.config','us01','keychain\x20(profile:\x20','\x20env\x20var','proxy','TD_API_KEY_','profile','toISOString','slice','1632771XmSYWY','config/account-info','name','join','ap03','utf-8'];a50_0x4761=function(){return _0x165d7c;};return a50_0x4761();}import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a50_0x66ebd6 from'node:fs';import*as a50_0x1ea0ae 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 a50_0x183fdd from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x3177ce=a50_0x481d;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x3177ce(0x1f7),_0x3177ce(0x1e1));}export function getConfigFile(){const _0x1443d2=a50_0x481d;return join(getConfigDir(),_0x1443d2(0x1e8));}export function getConfigFilePath(_0x5b71ff){const _0x3d74f7=a50_0x481d,_0xea4aff=getConfigDir();return _0x5b71ff?a50_0x1ea0ae[_0x3d74f7(0x1b8)](_0xea4aff,'.env.'+_0x5b71ff):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project','config/llm-project');export function getLLMProjectCacheFile(_0x58aa0e){const _0x2252da=a50_0x481d;return llmProjectCache[_0x2252da(0x1c4)](_0x58aa0e);}export function readCachedLLMProject(_0x959b1d){const _0x41563e=a50_0x481d,_0x363652=llmProjectCache['read'](_0x959b1d);if(_0x363652&&typeof _0x363652['id']===_0x41563e(0x1de)&&typeof _0x363652[_0x41563e(0x1b7)]===_0x41563e(0x1de))return _0x363652;return null;}export function writeCachedLLMProject(_0x1740f2,_0x31ddf3,_0x5a2290){const _0x43d47c=a50_0x481d;try{llmProjectCache[_0x43d47c(0x1c2)]({'name':_0x1740f2,'id':_0x31ddf3},_0x5a2290);}catch{}}const llmAgentCache=createOptionalProfileCache(a50_0x45e526(0x1eb),'config/llm-agent');export function getLLMAgentCacheFile(_0x5852d5){const _0x56da51=a50_0x45e526;return llmAgentCache[_0x56da51(0x1c4)](_0x5852d5);}export function readCachedLLMAgent(_0x1ab2ff){const _0xf38a0e=a50_0x45e526,_0x3a4a20=llmAgentCache[_0xf38a0e(0x1e6)](_0x1ab2ff);if(_0x3a4a20&&typeof _0x3a4a20['id']===_0xf38a0e(0x1de)&&typeof _0x3a4a20['name']===_0xf38a0e(0x1de)&&typeof _0x3a4a20['projectId']===_0xf38a0e(0x1de))return _0x3a4a20;return null;}export function writeCachedLLMAgent(_0x55c8d2,_0x163659,_0x3038a6,_0x2f6019){const _0x317dd4=a50_0x45e526;try{llmAgentCache[_0x317dd4(0x1c2)]({'name':_0x55c8d2,'id':_0x163659,'projectId':_0x3038a6},_0x2f6019);}catch{}}export function clearCachedLLMAgent(_0x2fbb9e){const _0x33a12c=a50_0x45e526;try{llmAgentCache[_0x33a12c(0x1d5)](_0x2fbb9e);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a50_0x45e526(0x201),{'suffix':a50_0x45e526(0x1e7)});export function getAccountInfoCacheFile(_0x152aad){const _0x107fdf=a50_0x45e526;return accountInfoCache[_0x107fdf(0x1c4)](_0x152aad);}export function readCachedAccountInfo(_0x2dd358){const _0x8da3ea=a50_0x45e526,_0x58dc4d=accountInfoCache[_0x8da3ea(0x1e6)](_0x2dd358);if(_0x58dc4d&&typeof _0x58dc4d[_0x8da3ea(0x1cc)]===_0x8da3ea(0x1de)&&typeof _0x58dc4d[_0x8da3ea(0x1f2)]===_0x8da3ea(0x1ed))return _0x58dc4d;return null;}export function writeCachedAccountInfo(_0x545ad9,_0x28599e,_0x433eab){const _0x4df5f4=a50_0x45e526;try{accountInfoCache[_0x4df5f4(0x1c2)]({'site':_0x545ad9,'accountId':_0x28599e,'cachedAt':new Date()[_0x4df5f4(0x1fe)]()},_0x433eab);}catch{}}export function parseEnvFile(_0x54c445){const _0x4f01af=a50_0x45e526,_0x3cff94={};for(const _0x2cc7d0 of _0x54c445[_0x4f01af(0x1ce)]('\x0a')){const _0x14881d=_0x2cc7d0[_0x4f01af(0x1dc)]();if(!_0x14881d||_0x14881d[_0x4f01af(0x1bc)]('#'))continue;const _0x9b9a04=_0x14881d[_0x4f01af(0x1ee)](/^([^=]+)=(.*)$/);if(_0x9b9a04){const _0x3e898b=_0x9b9a04[0x1][_0x4f01af(0x1dc)]();let _0x37ac41=_0x9b9a04[0x2]['trim']();(_0x37ac41[_0x4f01af(0x1bc)]('\x22')&&_0x37ac41[_0x4f01af(0x1c7)]('\x22')||_0x37ac41['startsWith']('\x27')&&_0x37ac41[_0x4f01af(0x1c7)]('\x27'))&&(_0x37ac41=_0x37ac41[_0x4f01af(0x1ff)](0x1,-0x1)),_0x3cff94[_0x3e898b]=_0x37ac41;}}return _0x3cff94;}export function readUserConfig(){const _0x4f5e03=a50_0x45e526,_0x36ab8e=getConfigFile();if(!existsSync(_0x36ab8e))return{};try{const _0x3f1ed9=readFileSync(_0x36ab8e,'utf-8');return parseEnvFile(_0x3f1ed9);}catch(_0x304159){return console['warn'](_0x4f5e03(0x1cb)+_0x36ab8e+':',_0x304159),{};}}export function resolveSite(_0x48d567){const _0x435f91=a50_0x45e526,_0xd6db2a=[_0x435f91(0x1f8),_0x435f91(0x1d0),_0x435f91(0x1f3),_0x435f91(0x1e4),_0x435f91(0x1b9),_0x435f91(0x1f4),_0x435f91(0x1c0),_0x435f91(0x1ea),'stg-ap01',_0x435f91(0x1d4)];if(_0xd6db2a['includes'](_0x48d567))return _0x48d567;if(_0x48d567 in SITE_ALIASES)return SITE_ALIASES[_0x48d567];return console[_0x435f91(0x1d6)](_0x435f91(0x1df)+_0x48d567+_0x435f91(0x1c9)),_0x435f91(0x1f8);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x17d860){const _0x238fb3=a50_0x45e526,_0x3501dc=_0x17d860||getActiveProfileName();if(_0x3501dc){const _0x14dbe5=_0x238fb3(0x1d7)+normalizeProfileForEnvVar(_0x3501dc);if(process.env[_0x14dbe5])return process.env[_0x14dbe5];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}function a50_0x481d(_0x3e7852,_0x223e34){_0x3e7852=_0x3e7852-0x1b7;const _0x4761d1=a50_0x4761();let _0x481d0d=_0x4761d1[_0x3e7852];return _0x481d0d;}export function normalizeProfileForEnvVar(_0x3031d1){const _0x5bcae2=a50_0x45e526;return _0x3031d1[_0x5bcae2(0x1d1)]()[_0x5bcae2(0x1d3)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x5f2945,_0x292a4b){const _0x56db9c=a50_0x45e526,_0x4f0b25=_0x292a4b||getActiveProfileName()||undefined;if(_0x4f0b25){const _0x1aa8cb=_0x56db9c(0x1d7)+normalizeProfileForEnvVar(_0x4f0b25);if(process.env[_0x1aa8cb])return{'apiKey':process.env[_0x1aa8cb],'source':_0x1aa8cb+_0x56db9c(0x1fa),'isDeprecated':![]};const _0x2dc1c8=getCachedCredential(_0x5f2945,_0x4f0b25);if(_0x2dc1c8)return{'apiKey':_0x2dc1c8,'source':_0x56db9c(0x1f9)+_0x4f0b25+')','isDeprecated':![]};const _0x5dae5f=await getKeychainAPIKey(_0x4f0b25);if(_0x5dae5f)return setCachedCredential(_0x5dae5f,_0x5f2945,_0x4f0b25),{'apiKey':_0x5dae5f,'source':_0x56db9c(0x1f9)+_0x4f0b25+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x56db9c(0x1ec),'isDeprecated':![]};if(!_0x4f0b25){const _0x582b58=getCachedCredential(_0x5f2945,undefined);if(_0x582b58)return{'apiKey':_0x582b58,'source':_0x56db9c(0x1c1),'isDeprecated':![]};const _0x518667=await getKeychainAPIKey(undefined);if(_0x518667)return setCachedCredential(_0x518667,_0x5f2945,undefined),{'apiKey':_0x518667,'source':_0x56db9c(0x1c1),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x57debb,_0x333cc1){const _0x92377b=a50_0x45e526,_0x52edaf=await resolveAPIKeyAsync(_0x57debb,_0x333cc1);return _0x52edaf?.[_0x92377b(0x1c3)];}function cleanupLegacyEnvFile(_0x2528b7){const _0x344a15=a50_0x45e526;if(!existsSync(_0x2528b7))return![];try{const _0x38315a=readFileSync(_0x2528b7,_0x344a15(0x1ba)),_0x1b47f5=_0x38315a[_0x344a15(0x1ce)]('\x0a'),_0x3d7890=_0x1b47f5[_0x344a15(0x1cf)](_0x4367fc=>{const _0x34acb8=_0x344a15,_0x53efd9=_0x4367fc['trim']();if(!_0x53efd9||_0x53efd9[_0x34acb8(0x1bc)]('#'))return!![];const [_0x35770b]=_0x53efd9[_0x34acb8(0x1ce)]('=');return!_0x35770b[_0x34acb8(0x1bc)](_0x34acb8(0x1bd));}),_0x19fd19=_0x3d7890['some'](_0x48f15c=>{const _0x53798a=_0x344a15,_0x144061=_0x48f15c['trim']();return _0x144061&&!_0x144061[_0x53798a(0x1bc)]('#');});if(!_0x19fd19)return unlinkSync(_0x2528b7),!![];return writeFileSync(_0x2528b7,_0x3d7890['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x1bd2a2=a50_0x45e526;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x531b82=a50_0x1ea0ae[_0x1bd2a2(0x1b8)](getConfigDir(),_0x1bd2a2(0x1f1));if(!a50_0x66ebd6['existsSync'](_0x531b82))return null;try{const _0x356e77=a50_0x66ebd6['readFileSync'](_0x531b82,'utf-8'),_0x4b7326=JSON['parse'](_0x356e77);return _0x4b7326[_0x1bd2a2(0x1fd)]||null;}catch{return null;}}export function saveAPIKey(_0x47b101,_0x2e6709,_0x297033){const _0x536823=a50_0x45e526,_0x182dec=getConfigDir(),_0x141b2b=getConfigFilePath(_0x297033);!existsSync(_0x182dec)&&mkdirSync(_0x182dec,{'recursive':!![],'mode':0x1c0});let _0x5b54cb={};if(existsSync(_0x141b2b))try{const _0x2b2793=readFileSync(_0x141b2b,_0x536823(0x1ba));_0x5b54cb=parseEnvFile(_0x2b2793);}catch(_0x42eb8a){console[_0x536823(0x1d6)](_0x536823(0x1ef)+_0x141b2b+':',_0x42eb8a);}const _0x451be2=_0x47b101[_0x536823(0x1d1)]()[_0x536823(0x1d3)](/-/g,'_');_0x5b54cb[_0x536823(0x1fc)+_0x451be2]=_0x2e6709;const _0x3cbdc1=Object[_0x536823(0x1bf)](_0x5b54cb)[_0x536823(0x1e0)](([_0x377a09,_0x12d74f])=>_0x377a09+'='+_0x12d74f);writeFileSync(_0x141b2b,_0x3cbdc1[_0x536823(0x1b8)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x527b6d,_0x47a5bc,_0x195b60){const _0xffd1b2=a50_0x45e526;await saveKeychainAPIKey(_0x527b6d,_0x195b60),setCachedCredential(_0x527b6d,_0x47a5bc,_0x195b60);const _0x50764c=getConfigFilePath(_0x195b60);cleanupLegacyEnvFile(_0x50764c)&&console[_0xffd1b2(0x1d6)](a50_0x183fdd[_0xffd1b2(0x1f6)](_0xffd1b2(0x1c8)));}export function loadConfig(){const _0x5551fc=a50_0x45e526,_0x24d7ba={'apiKeys':{},'defaultSite':_0x5551fc(0x1f8)},_0x13ac04=[_0x5551fc(0x1f8),'ap01',_0x5551fc(0x1f3),'ap02',_0x5551fc(0x1b9),'dev-us01',_0x5551fc(0x1c0),_0x5551fc(0x1ea),_0x5551fc(0x1cd),'stg-ap03'],_0x2ab18b=getAPIKey();if(_0x2ab18b)for(const _0x4d645c of _0x13ac04){_0x24d7ba[_0x5551fc(0x1c6)][_0x4d645c]=_0x2ab18b;}return _0x24d7ba;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x10ba41=a50_0x45e526,_0x595cf0=a50_0x1ea0ae[_0x10ba41(0x1b8)](getConfigDir(),_0x10ba41(0x1f1));if(!a50_0x66ebd6[_0x10ba41(0x1da)](_0x595cf0))return undefined;try{const _0x2529fd=a50_0x66ebd6['readFileSync'](_0x595cf0,_0x10ba41(0x1ba)),_0x436fd1=JSON[_0x10ba41(0x1be)](_0x2529fd);return typeof _0x436fd1[_0x10ba41(0x1fb)]===_0x10ba41(0x1de)?_0x436fd1[_0x10ba41(0x1fb)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x4f2f5e=a50_0x45e526,_0x3aec70=process.env.TDX_RELEASE_CHANNEL;if(_0x3aec70===_0x4f2f5e(0x1c5)||_0x3aec70===_0x4f2f5e(0x1d8))return _0x3aec70;const _0xcef6cc=a50_0x1ea0ae[_0x4f2f5e(0x1b8)](getConfigDir(),_0x4f2f5e(0x1f1));if(!a50_0x66ebd6['existsSync'](_0xcef6cc))return _0x4f2f5e(0x1d8);try{const _0x4f5c2b=a50_0x66ebd6[_0x4f2f5e(0x1bb)](_0xcef6cc,_0x4f2f5e(0x1ba)),_0x4fd45e=JSON[_0x4f2f5e(0x1be)](_0x4f5c2b);if(_0x4fd45e[_0x4f2f5e(0x1dd)]===_0x4f2f5e(0x1c5))return'next';}catch{}return _0x4f2f5e(0x1d8);}export function saveReleaseChannel(_0x106ca1){const _0x4ccddd=a50_0x45e526,_0x2aaa07=getConfigDir(),_0x2051f4=a50_0x1ea0ae[_0x4ccddd(0x1b8)](_0x2aaa07,_0x4ccddd(0x1f1));!existsSync(_0x2aaa07)&&mkdirSync(_0x2aaa07,{'recursive':!![],'mode':0x1c0});let _0x70cec={};if(existsSync(_0x2051f4))try{const _0x9faf2c=readFileSync(_0x2051f4,_0x4ccddd(0x1ba));_0x70cec=JSON[_0x4ccddd(0x1be)](_0x9faf2c);}catch{}_0x70cec[_0x4ccddd(0x1dd)]=_0x106ca1,writeFileSync(_0x2051f4,JSON[_0x4ccddd(0x1d2)](_0x70cec,null,0x2),{'mode':0x180});}
1
+ const a50_0xe1439b=a50_0x3338;(function(_0x2e32c8,_0x3d2ba0){const _0x1d6abc=a50_0x3338,_0x4ff8ec=_0x2e32c8();while(!![]){try{const _0x3f1f06=-parseInt(_0x1d6abc(0x154))/0x1+-parseInt(_0x1d6abc(0x124))/0x2*(parseInt(_0x1d6abc(0x13f))/0x3)+parseInt(_0x1d6abc(0x137))/0x4*(-parseInt(_0x1d6abc(0x119))/0x5)+-parseInt(_0x1d6abc(0x12f))/0x6*(-parseInt(_0x1d6abc(0x117))/0x7)+parseInt(_0x1d6abc(0x120))/0x8*(-parseInt(_0x1d6abc(0x12e))/0x9)+parseInt(_0x1d6abc(0x14c))/0xa+-parseInt(_0x1d6abc(0x127))/0xb*(-parseInt(_0x1d6abc(0x14e))/0xc);if(_0x3f1f06===_0x3d2ba0)break;else _0x4ff8ec['push'](_0x4ff8ec['shift']());}catch(_0x37095a){_0x4ff8ec['push'](_0x4ff8ec['shift']());}}}(a50_0x234e,0xc0cc4));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a50_0x4bb9d2 from'node:fs';import*as a50_0x49b5c8 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 a50_0x20cecc from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x2413a2=a50_0x3338;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x2413a2(0x114),_0x2413a2(0x153));}function a50_0x234e(){const _0x380792=['warn','dev-us01','config/llm-project','us01','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','release_channel','match','startsWith','toUpperCase','Warning:\x20Failed\x20to\x20read\x20','1570770oBDUIz','existsSync','169476iJTYAo','readFileSync','stable','proxy','number','tdx','477017QMmdMu','split','write','join','.config','path','stringify','14fFfChY','utf-8','21245hyEEyV','ap03','ap01','endsWith','dev-eu01','eu01','map','146584oJazTn','projectId','keychain','tdx.json','8uvkFIL','clear','parse','1133zPqqRM','TDX_API_KEY\x20env\x20var','accountId','trim','keychain\x20(profile:\x20','TDX_API_KEY_','next','171NzKqOs','1584174RtUINh','.env','account_info','apiKey','slice','replace','read','\x27,\x20defaulting\x20to\x20us01','488KfxYYf','string','toISOString','name','stg-us01','stg-ap03','entries','ap02','4929vdalxp','stg-ap01','config/llm-agent'];a50_0x234e=function(){return _0x380792;};return a50_0x234e();}export function getConfigFile(){const _0xa091a0=a50_0x3338;return join(getConfigDir(),_0xa091a0(0x130));}export function getConfigFilePath(_0x165f9d){const _0xfc50d4=a50_0x3338,_0x2c56e9=getConfigDir();return _0x165f9d?a50_0x49b5c8[_0xfc50d4(0x113)](_0x2c56e9,'.env.'+_0x165f9d):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project',a50_0xe1439b(0x144));export function getLLMProjectCacheFile(_0x48d889){const _0xca2e65=a50_0xe1439b;return llmProjectCache[_0xca2e65(0x115)](_0x48d889);}export function readCachedLLMProject(_0x30a68a){const _0x29a467=a50_0xe1439b,_0x5475a4=llmProjectCache['read'](_0x30a68a);if(_0x5475a4&&typeof _0x5475a4['id']===_0x29a467(0x138)&&typeof _0x5475a4['name']==='string')return _0x5475a4;return null;}export function writeCachedLLMProject(_0x5145ed,_0x44d5f6,_0x36e506){const _0x9b6b9f=a50_0xe1439b;try{llmProjectCache[_0x9b6b9f(0x156)]({'name':_0x5145ed,'id':_0x44d5f6},_0x36e506);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a50_0xe1439b(0x141));export function getLLMAgentCacheFile(_0x37d674){const _0x6745d7=a50_0xe1439b;return llmAgentCache[_0x6745d7(0x115)](_0x37d674);}export function readCachedLLMAgent(_0x232eb9){const _0x301dda=a50_0xe1439b,_0x339606=llmAgentCache[_0x301dda(0x135)](_0x232eb9);if(_0x339606&&typeof _0x339606['id']==='string'&&typeof _0x339606[_0x301dda(0x13a)]===_0x301dda(0x138)&&typeof _0x339606[_0x301dda(0x121)]===_0x301dda(0x138))return _0x339606;return null;}export function writeCachedLLMAgent(_0x525d39,_0x1bba96,_0x25f9e1,_0xd2fccc){try{llmAgentCache['write']({'name':_0x525d39,'id':_0x1bba96,'projectId':_0x25f9e1},_0xd2fccc);}catch{}}export function clearCachedLLMAgent(_0x23b9d9){const _0x1b7fe9=a50_0xe1439b;try{llmAgentCache[_0x1b7fe9(0x125)](_0x23b9d9);}catch{}}function a50_0x3338(_0x13739,_0x2ef82f){_0x13739=_0x13739-0x113;const _0x234e50=a50_0x234e();let _0x333890=_0x234e50[_0x13739];return _0x333890;}const accountInfoCache=createOptionalProfileCache(a50_0xe1439b(0x131),'config/account-info',{'suffix':'.json'});export function getAccountInfoCacheFile(_0x150f6e){const _0x439243=a50_0xe1439b;return accountInfoCache[_0x439243(0x115)](_0x150f6e);}export function readCachedAccountInfo(_0x3b6bd9){const _0x57d89a=a50_0xe1439b,_0x3270a9=accountInfoCache[_0x57d89a(0x135)](_0x3b6bd9);if(_0x3270a9&&typeof _0x3270a9['site']==='string'&&typeof _0x3270a9[_0x57d89a(0x129)]===_0x57d89a(0x152))return _0x3270a9;return null;}export function writeCachedAccountInfo(_0x5352b5,_0x27ddfb,_0x5ca06f){const _0x1c3d7d=a50_0xe1439b;try{accountInfoCache[_0x1c3d7d(0x156)]({'site':_0x5352b5,'accountId':_0x27ddfb,'cachedAt':new Date()[_0x1c3d7d(0x139)]()},_0x5ca06f);}catch{}}export function parseEnvFile(_0x5df1fd){const _0x51dfee=a50_0xe1439b,_0xceb13f={};for(const _0x15b5c7 of _0x5df1fd[_0x51dfee(0x155)]('\x0a')){const _0x5ce4d7=_0x15b5c7['trim']();if(!_0x5ce4d7||_0x5ce4d7[_0x51dfee(0x149)]('#'))continue;const _0x5e772f=_0x5ce4d7[_0x51dfee(0x148)](/^([^=]+)=(.*)$/);if(_0x5e772f){const _0x317264=_0x5e772f[0x1][_0x51dfee(0x12a)]();let _0x449434=_0x5e772f[0x2][_0x51dfee(0x12a)]();(_0x449434['startsWith']('\x22')&&_0x449434['endsWith']('\x22')||_0x449434['startsWith']('\x27')&&_0x449434[_0x51dfee(0x11c)]('\x27'))&&(_0x449434=_0x449434[_0x51dfee(0x133)](0x1,-0x1)),_0xceb13f[_0x317264]=_0x449434;}}return _0xceb13f;}export function readUserConfig(){const _0x170ffa=a50_0xe1439b,_0x2f653c=getConfigFile();if(!existsSync(_0x2f653c))return{};try{const _0x15412c=readFileSync(_0x2f653c,_0x170ffa(0x118));return parseEnvFile(_0x15412c);}catch(_0x15937f){return console[_0x170ffa(0x142)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x2f653c+':',_0x15937f),{};}}export function resolveSite(_0x3ede19){const _0x363ce6=a50_0xe1439b,_0x565148=[_0x363ce6(0x145),_0x363ce6(0x11b),_0x363ce6(0x11e),_0x363ce6(0x13e),_0x363ce6(0x11a),_0x363ce6(0x143),_0x363ce6(0x11d),'stg-us01',_0x363ce6(0x140),_0x363ce6(0x13c)];if(_0x565148['includes'](_0x3ede19))return _0x3ede19;if(_0x3ede19 in SITE_ALIASES)return SITE_ALIASES[_0x3ede19];return console[_0x363ce6(0x142)]('Warning:\x20Unknown\x20site\x20\x27'+_0x3ede19+_0x363ce6(0x136)),_0x363ce6(0x145);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x1de3a7){const _0x59545e=a50_0xe1439b,_0x9d12cc=_0x1de3a7||getActiveProfileName();if(_0x9d12cc){const _0xa3e1e6=_0x59545e(0x12c)+normalizeProfileForEnvVar(_0x9d12cc);if(process.env[_0xa3e1e6])return process.env[_0xa3e1e6];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x1a8472){const _0x491d98=a50_0xe1439b;return _0x1a8472[_0x491d98(0x14a)]()[_0x491d98(0x134)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x513d3f,_0x138ab6){const _0x4739f0=a50_0xe1439b,_0x12c79d=_0x138ab6||getActiveProfileName()||undefined;if(_0x12c79d){const _0x39c605=_0x4739f0(0x12c)+normalizeProfileForEnvVar(_0x12c79d);if(process.env[_0x39c605])return{'apiKey':process.env[_0x39c605],'source':_0x39c605+'\x20env\x20var','isDeprecated':![]};const _0x44678b=getCachedCredential(_0x513d3f,_0x12c79d);if(_0x44678b)return{'apiKey':_0x44678b,'source':_0x4739f0(0x12b)+_0x12c79d+')','isDeprecated':![]};const _0x5a3076=await getKeychainAPIKey(_0x12c79d);if(_0x5a3076)return setCachedCredential(_0x5a3076,_0x513d3f,_0x12c79d),{'apiKey':_0x5a3076,'source':_0x4739f0(0x12b)+_0x12c79d+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x4739f0(0x128),'isDeprecated':![]};if(!_0x12c79d){const _0x31469b=getCachedCredential(_0x513d3f,undefined);if(_0x31469b)return{'apiKey':_0x31469b,'source':_0x4739f0(0x122),'isDeprecated':![]};const _0x17fe8e=await getKeychainAPIKey(undefined);if(_0x17fe8e)return setCachedCredential(_0x17fe8e,_0x513d3f,undefined),{'apiKey':_0x17fe8e,'source':_0x4739f0(0x122),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x252c3f,_0x488264){const _0xbe8cf7=a50_0xe1439b,_0x14fff1=await resolveAPIKeyAsync(_0x252c3f,_0x488264);return _0x14fff1?.[_0xbe8cf7(0x132)];}function cleanupLegacyEnvFile(_0x53c3c5){const _0x422d92=a50_0xe1439b;if(!existsSync(_0x53c3c5))return![];try{const _0x5af64a=readFileSync(_0x53c3c5,_0x422d92(0x118)),_0x3c8bca=_0x5af64a[_0x422d92(0x155)]('\x0a'),_0x89217b=_0x3c8bca['filter'](_0x5c71c8=>{const _0xb7a6e0=_0x422d92,_0x5bf66e=_0x5c71c8['trim']();if(!_0x5bf66e||_0x5bf66e[_0xb7a6e0(0x149)]('#'))return!![];const [_0x3d9112]=_0x5bf66e['split']('=');return!_0x3d9112[_0xb7a6e0(0x149)]('TD_API_KEY');}),_0x5f1156=_0x89217b['some'](_0x2339db=>{const _0xbd6d5d=_0x422d92,_0xe54e1c=_0x2339db['trim']();return _0xe54e1c&&!_0xe54e1c[_0xbd6d5d(0x149)]('#');});if(!_0x5f1156)return unlinkSync(_0x53c3c5),!![];return writeFileSync(_0x53c3c5,_0x89217b[_0x422d92(0x113)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x128c46=a50_0xe1439b;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1cd7d9=a50_0x49b5c8['join'](getConfigDir(),_0x128c46(0x123));if(!a50_0x4bb9d2[_0x128c46(0x14d)](_0x1cd7d9))return null;try{const _0x332bf8=a50_0x4bb9d2[_0x128c46(0x14f)](_0x1cd7d9,'utf-8'),_0x679bb6=JSON[_0x128c46(0x126)](_0x332bf8);return _0x679bb6['profile']||null;}catch{return null;}}export function saveAPIKey(_0x5f0791,_0x156fb1,_0x1cd66a){const _0x39103d=a50_0xe1439b,_0x6018ca=getConfigDir(),_0x47800d=getConfigFilePath(_0x1cd66a);!existsSync(_0x6018ca)&&mkdirSync(_0x6018ca,{'recursive':!![],'mode':0x1c0});let _0x2a13da={};if(existsSync(_0x47800d))try{const _0x299e8f=readFileSync(_0x47800d,'utf-8');_0x2a13da=parseEnvFile(_0x299e8f);}catch(_0xd8e88c){console['warn'](_0x39103d(0x14b)+_0x47800d+':',_0xd8e88c);}const _0x928384=_0x5f0791[_0x39103d(0x14a)]()[_0x39103d(0x134)](/-/g,'_');_0x2a13da['TD_API_KEY_'+_0x928384]=_0x156fb1;const _0x3b8c3e=Object[_0x39103d(0x13d)](_0x2a13da)[_0x39103d(0x11f)](([_0x2ef89b,_0x117dc7])=>_0x2ef89b+'='+_0x117dc7);writeFileSync(_0x47800d,_0x3b8c3e[_0x39103d(0x113)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0xca8a1f,_0x5435e0,_0xf17daa){const _0x20eaa5=a50_0xe1439b;await saveKeychainAPIKey(_0xca8a1f,_0xf17daa),setCachedCredential(_0xca8a1f,_0x5435e0,_0xf17daa);const _0x5bb68f=getConfigFilePath(_0xf17daa);cleanupLegacyEnvFile(_0x5bb68f)&&console[_0x20eaa5(0x142)](a50_0x20cecc['yellow'](_0x20eaa5(0x146)));}export function loadConfig(){const _0x454587=a50_0xe1439b,_0x112a19={'apiKeys':{},'defaultSite':'us01'},_0x2046b0=[_0x454587(0x145),_0x454587(0x11b),'eu01',_0x454587(0x13e),_0x454587(0x11a),_0x454587(0x143),_0x454587(0x11d),_0x454587(0x13b),'stg-ap01','stg-ap03'],_0x4a3e93=getAPIKey();if(_0x4a3e93)for(const _0x1e1f25 of _0x2046b0){_0x112a19['apiKeys'][_0x1e1f25]=_0x4a3e93;}return _0x112a19;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x3df45f=a50_0xe1439b,_0x5f8f50=a50_0x49b5c8[_0x3df45f(0x113)](getConfigDir(),_0x3df45f(0x123));if(!a50_0x4bb9d2[_0x3df45f(0x14d)](_0x5f8f50))return undefined;try{const _0xde2335=a50_0x4bb9d2[_0x3df45f(0x14f)](_0x5f8f50,_0x3df45f(0x118)),_0x40fa05=JSON[_0x3df45f(0x126)](_0xde2335);return typeof _0x40fa05[_0x3df45f(0x151)]===_0x3df45f(0x138)?_0x40fa05['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x7a513c=a50_0xe1439b,_0x5625df=process.env.TDX_RELEASE_CHANNEL;if(_0x5625df===_0x7a513c(0x12d)||_0x5625df===_0x7a513c(0x150))return _0x5625df;const _0x331848=a50_0x49b5c8[_0x7a513c(0x113)](getConfigDir(),_0x7a513c(0x123));if(!a50_0x4bb9d2[_0x7a513c(0x14d)](_0x331848))return'stable';try{const _0x5ab889=a50_0x4bb9d2[_0x7a513c(0x14f)](_0x331848,_0x7a513c(0x118)),_0x1b06e8=JSON['parse'](_0x5ab889);if(_0x1b06e8[_0x7a513c(0x147)]===_0x7a513c(0x12d))return _0x7a513c(0x12d);}catch{}return _0x7a513c(0x150);}export function saveReleaseChannel(_0x175de7){const _0x82f85a=a50_0xe1439b,_0x129a2c=getConfigDir(),_0x2b1956=a50_0x49b5c8[_0x82f85a(0x113)](_0x129a2c,'tdx.json');!existsSync(_0x129a2c)&&mkdirSync(_0x129a2c,{'recursive':!![],'mode':0x1c0});let _0x11ca4d={};if(existsSync(_0x2b1956))try{const _0x1cc300=readFileSync(_0x2b1956,_0x82f85a(0x118));_0x11ca4d=JSON[_0x82f85a(0x126)](_0x1cc300);}catch{}_0x11ca4d[_0x82f85a(0x147)]=_0x175de7,writeFileSync(_0x2b1956,JSON[_0x82f85a(0x116)](_0x11ca4d,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a51_0x403ff4=a51_0x2af2;function a51_0x2af2(_0x2fb1d6,_0x2964b6){_0x2fb1d6=_0x2fb1d6-0xd3;const _0x29358d=a51_0x2935();let _0x2af2f2=_0x29358d[_0x2fb1d6];return _0x2af2f2;}(function(_0x3a860c,_0x511e8f){const _0x233c6f=a51_0x2af2,_0x56e4e9=_0x3a860c();while(!![]){try{const _0x28acda=-parseInt(_0x233c6f(0xe2))/0x1*(-parseInt(_0x233c6f(0xe4))/0x2)+parseInt(_0x233c6f(0xe0))/0x3*(-parseInt(_0x233c6f(0xd4))/0x4)+-parseInt(_0x233c6f(0xd5))/0x5*(parseInt(_0x233c6f(0xda))/0x6)+-parseInt(_0x233c6f(0xd3))/0x7*(parseInt(_0x233c6f(0xdd))/0x8)+parseInt(_0x233c6f(0xd7))/0x9*(-parseInt(_0x233c6f(0xd9))/0xa)+-parseInt(_0x233c6f(0xe1))/0xb+parseInt(_0x233c6f(0xdb))/0xc*(parseInt(_0x233c6f(0xdc))/0xd);if(_0x28acda===_0x511e8f)break;else _0x56e4e9['push'](_0x56e4e9['shift']());}catch(_0x6075e9){_0x56e4e9['push'](_0x56e4e9['shift']());}}}(a51_0x2935,0xd2684));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a51_0x403ff4(0xd6),a51_0x403ff4(0xde));export function loadCachedConnections(_0x48e468){const _0xf9b54f=a51_0x403ff4,_0xfabb52=connectionCache[_0xf9b54f(0xe3)](_0x48e468);return _0xfabb52?.['connections']??null;}export function saveCachedConnections(_0x438442,_0x2d6d0d){const _0x5e4e71=a51_0x403ff4;connectionCache[_0x5e4e71(0xdf)](_0x438442,{'connections':_0x2d6d0d,'cachedAt':Date[_0x5e4e71(0xd8)]()});}export function clearConnectionCache(_0xf5ea89){connectionCache['clear'](_0xf5ea89);}function a51_0x2935(){const _0x56ae46=['14796093cOASxi','24QaHqBu','core/connection-cache','write','17652GUPVaD','8929987NoOMks','29fJwNDk','read','24896peMaDS','3251213GoWRBx','652Shpbbq','2395LTHIrt','connections-{profile}.json','6452982CEpVWw','now','10DfjfWw','2136QCqJjR','48ZiiuvK'];a51_0x2935=function(){return _0x56ae46;};return a51_0x2935();}
1
+ const a51_0xa6441b=a51_0x4ea4;(function(_0x5a7a9b,_0x499fb8){const _0x475822=a51_0x4ea4,_0x559b71=_0x5a7a9b();while(!![]){try{const _0x72ed72=-parseInt(_0x475822(0xc7))/0x1*(parseInt(_0x475822(0xc2))/0x2)+-parseInt(_0x475822(0xbd))/0x3*(parseInt(_0x475822(0xc6))/0x4)+-parseInt(_0x475822(0xbf))/0x5*(-parseInt(_0x475822(0xbc))/0x6)+parseInt(_0x475822(0xbb))/0x7+-parseInt(_0x475822(0xb7))/0x8*(-parseInt(_0x475822(0xc4))/0x9)+parseInt(_0x475822(0xc3))/0xa+parseInt(_0x475822(0xc0))/0xb*(parseInt(_0x475822(0xb6))/0xc);if(_0x72ed72===_0x499fb8)break;else _0x559b71['push'](_0x559b71['shift']());}catch(_0x1e8e1a){_0x559b71['push'](_0x559b71['shift']());}}}(a51_0x582d,0x3c7ed));function a51_0x4ea4(_0x21fb8f,_0x52104d){_0x21fb8f=_0x21fb8f-0xb6;const _0x582da4=a51_0x582d();let _0x4ea479=_0x582da4[_0x21fb8f];return _0x4ea479;}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a51_0xa6441b(0xba),a51_0xa6441b(0xb9));export function loadCachedConnections(_0x38fd5b){const _0x7813a8=a51_0xa6441b,_0x3518fc=connectionCache[_0x7813a8(0xc1)](_0x38fd5b);return _0x3518fc?.['connections']??null;}export function saveCachedConnections(_0x21b998,_0x41bea8){const _0x2b943d=a51_0xa6441b;connectionCache[_0x2b943d(0xb8)](_0x21b998,{'connections':_0x41bea8,'cachedAt':Date[_0x2b943d(0xc5)]()});}function a51_0x582d(){const _0x3cde08=['now','2888asNDNX','345698MhcFZs','358464ZfQfqN','176gfBBdY','write','core/connection-cache','connections-{profile}.json','296387zEDFCq','678yfIQfA','555GvzIRe','clear','1975OhsuCh','77nngxxF','read','2zgrDwv','3129250qhxlMA','48294EBSmoR'];a51_0x582d=function(){return _0x3cde08;};return a51_0x582d();}export function clearConnectionCache(_0x33f65e){const _0x20879f=a51_0xa6441b;connectionCache[_0x20879f(0xbe)](_0x33f65e);}
@@ -1 +1 @@
1
- const a52_0xd2f748=a52_0x5dc4;(function(_0x4fe678,_0x521715){const _0x5222a0=a52_0x5dc4,_0xda5d33=_0x4fe678();while(!![]){try{const _0x6878=-parseInt(_0x5222a0(0x111))/0x1*(-parseInt(_0x5222a0(0x128))/0x2)+-parseInt(_0x5222a0(0x127))/0x3*(parseInt(_0x5222a0(0x114))/0x4)+parseInt(_0x5222a0(0x120))/0x5+-parseInt(_0x5222a0(0x112))/0x6+parseInt(_0x5222a0(0x11b))/0x7+-parseInt(_0x5222a0(0x126))/0x8*(parseInt(_0x5222a0(0x116))/0x9)+-parseInt(_0x5222a0(0x118))/0xa*(-parseInt(_0x5222a0(0x113))/0xb);if(_0x6878===_0x521715)break;else _0xda5d33['push'](_0xda5d33['shift']());}catch(_0x1f7b2b){_0xda5d33['push'](_0xda5d33['shift']());}}}(a52_0x107e,0x9a5c6));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;function a52_0x107e(){const _0x2aaf50=['1503usDqAX','number','10InOeYM','value','ap02\x20-\x20Korea','1493331SllHwK','findIndex','eu\x20\x20\x20-\x20Europe','other','ap01','321400pbvMRL','Enter\x20custom\x20site','eu01','ap02','us01','push','8136nmKSQa','3SCAPZm','716CIwxYF','us\x20\x20\x20-\x20United\x20States','3097qdlhRv','6240174iyeknE','17897638MkotKp','4685068gkelte','jp\x20\x20\x20-\x20Japan'];a52_0x107e=function(){return _0x2aaf50;};return a52_0x107e();}export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x266fc4,_0x3858fc){const _0x43d3da=a52_0x5dc4;if(_0x266fc4===undefined)return _0x3858fc;if(typeof _0x266fc4===_0x43d3da(0x117))return _0x266fc4;return parseInt(_0x266fc4,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a52_0xd2f748(0x110),'value':'us01'},{'title':a52_0xd2f748(0x115),'value':a52_0xd2f748(0x11f)},{'title':a52_0xd2f748(0x11d),'value':a52_0xd2f748(0x122)},{'title':a52_0xd2f748(0x11a),'value':a52_0xd2f748(0x123)}];function a52_0x5dc4(_0x597ca6,_0x16add7){_0x597ca6=_0x597ca6-0x110;const _0x107e65=a52_0x107e();let _0x5dc440=_0x107e65[_0x597ca6];return _0x5dc440;}export function buildSiteChoices(_0x57df5b){const _0x1b4620=a52_0xd2f748,_0x39e375=[...STANDARD_SITE_CHOICES];let _0x7e9d35=_0x39e375[_0x1b4620(0x11c)](_0x1907fe=>_0x1907fe[_0x1b4620(0x119)]===_0x57df5b);return _0x7e9d35===-0x1&&_0x57df5b!==_0x1b4620(0x124)&&(_0x39e375[_0x1b4620(0x125)]({'title':_0x57df5b,'value':_0x57df5b}),_0x7e9d35=_0x39e375['length']-0x1),_0x39e375[_0x1b4620(0x125)]({'title':_0x1b4620(0x121),'value':_0x1b4620(0x11e)}),{'choices':_0x39e375,'initialIndex':_0x7e9d35>=0x0?_0x7e9d35:0x0};}
1
+ function a52_0x5c24(_0x3bec23,_0x57fe46){_0x3bec23=_0x3bec23-0x1a5;const _0xf48e65=a52_0xf48e();let _0x5c24a6=_0xf48e65[_0x3bec23];return _0x5c24a6;}function a52_0xf48e(){const _0x507e0d=['2jftpzn','3890368RubhKI','number','627290NGKpPj','jp\x20\x20\x20-\x20Japan','length','188097FRFFjJ','eu\x20\x20\x20-\x20Europe','ap02\x20-\x20Korea','eu01','857549zqxzIB','1919032fgUKCg','us01','us\x20\x20\x20-\x20United\x20States','586392PZYTKo','985713YShwHR','ap01','ap02','value','push'];a52_0xf48e=function(){return _0x507e0d;};return a52_0xf48e();}const a52_0x54b276=a52_0x5c24;(function(_0x3d7dec,_0x322217){const _0x593f76=a52_0x5c24,_0x2ae5a6=_0x3d7dec();while(!![]){try{const _0x22b93c=-parseInt(_0x593f76(0x1b8))/0x1+-parseInt(_0x593f76(0x1b2))/0x2*(-parseInt(_0x593f76(0x1ad))/0x3)+-parseInt(_0x593f76(0x1a9))/0x4+-parseInt(_0x593f76(0x1b5))/0x5+parseInt(_0x593f76(0x1ac))/0x6+parseInt(_0x593f76(0x1a8))/0x7+parseInt(_0x593f76(0x1b3))/0x8;if(_0x22b93c===_0x322217)break;else _0x2ae5a6['push'](_0x2ae5a6['shift']());}catch(_0x3d702c){_0x2ae5a6['push'](_0x2ae5a6['shift']());}}}(a52_0xf48e,0x3b081));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x1248c0,_0xe2a187){const _0x4231f0=a52_0x5c24;if(_0x1248c0===undefined)return _0xe2a187;if(typeof _0x1248c0===_0x4231f0(0x1b4))return _0x1248c0;return parseInt(_0x1248c0,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a52_0x54b276(0x1ab),'value':'us01'},{'title':a52_0x54b276(0x1b6),'value':a52_0x54b276(0x1ae)},{'title':a52_0x54b276(0x1a5),'value':a52_0x54b276(0x1a7)},{'title':a52_0x54b276(0x1a6),'value':a52_0x54b276(0x1af)}];export function buildSiteChoices(_0x3f64e0){const _0x2720b0=a52_0x54b276,_0x5b1937=[...STANDARD_SITE_CHOICES];let _0x38fe5d=_0x5b1937['findIndex'](_0x40b48e=>_0x40b48e[_0x2720b0(0x1b0)]===_0x3f64e0);return _0x38fe5d===-0x1&&_0x3f64e0!==_0x2720b0(0x1aa)&&(_0x5b1937[_0x2720b0(0x1b1)]({'title':_0x3f64e0,'value':_0x3f64e0}),_0x38fe5d=_0x5b1937[_0x2720b0(0x1b7)]-0x1),_0x5b1937[_0x2720b0(0x1b1)]({'title':'Enter\x20custom\x20site','value':'other'}),{'choices':_0x5b1937,'initialIndex':_0x38fe5d>=0x0?_0x38fe5d:0x0};}
@@ -1 +1 @@
1
- (function(_0x5050ad,_0x37ee54){const _0x148d53=a53_0x21c9,_0x2acff5=_0x5050ad();while(!![]){try{const _0x11b17f=-parseInt(_0x148d53(0x9b))/0x1+-parseInt(_0x148d53(0x9a))/0x2+parseInt(_0x148d53(0x9e))/0x3+parseInt(_0x148d53(0x98))/0x4*(parseInt(_0x148d53(0x96))/0x5)+-parseInt(_0x148d53(0xa0))/0x6+parseInt(_0x148d53(0xa2))/0x7+parseInt(_0x148d53(0x9d))/0x8*(parseInt(_0x148d53(0x9c))/0x9);if(_0x11b17f===_0x37ee54)break;else _0x2acff5['push'](_0x2acff5['shift']());}catch(_0x27b9b6){_0x2acff5['push'](_0x2acff5['shift']());}}}(a53_0x353b,0x5d114));function a53_0x21c9(_0x500d92,_0x93a75d){_0x500d92=_0x500d92-0x93;const _0x353bf2=a53_0x353b();let _0x21c961=_0x353bf2[_0x500d92];return _0x21c961;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3e32db,_0x2c5712){const _0x4e8b2f=a53_0x21c9,_0x535cf9=_0x3e32db||_0x4e8b2f(0x9f),_0x5ad3be=_0x2c5712||_0x4e8b2f(0xa4);return _0x535cf9+':'+_0x5ad3be;}export function getCachedCredential(_0xdeac7e,_0x24874f){const _0x285a27=a53_0x21c9,_0x14745a=getCacheKey(_0xdeac7e,_0x24874f),_0x2b2519=cache[_0x285a27(0xa3)](_0x14745a);if(!_0x2b2519)return null;if(Date[_0x285a27(0xa1)]()-_0x2b2519[_0x285a27(0x99)]>CACHE_TTL_MS)return cache[_0x285a27(0x95)](_0x14745a),null;return _0x2b2519[_0x285a27(0x94)];}export function setCachedCredential(_0x3e01ef,_0x5c8d27,_0x3e9c5a){const _0x1a94c3=a53_0x21c9,_0x3bedce=getCacheKey(_0x5c8d27,_0x3e9c5a);cache[_0x1a94c3(0x97)](_0x3bedce,{'apiKey':_0x3e01ef,'loadedAt':Date[_0x1a94c3(0xa1)]()});}function a53_0x353b(){const _0x4937e0=['896655mZFzor','__default_site__','4053492CVLqsq','now','4861486WvnLAm','get','__default_profile__','clear','apiKey','delete','285415kXoxZG','set','40KFhnrW','loadedAt','654332GehHpo','717601XyXdkT','603oOMgRm','64160jaBeSh'];a53_0x353b=function(){return _0x4937e0;};return a53_0x353b();}export function clearCredentialCache(){const _0x3031c4=a53_0x21c9;cache[_0x3031c4(0x93)]();}export function clearCachedCredential(_0x23daf8,_0x38c5a2){const _0x23795a=a53_0x21c9,_0x856542=getCacheKey(_0x23daf8,_0x38c5a2);cache[_0x23795a(0x95)](_0x856542);}
1
+ (function(_0x56bccb,_0x18e6f6){const _0x4e22c6=a53_0x384c,_0x231651=_0x56bccb();while(!![]){try{const _0x68beff=-parseInt(_0x4e22c6(0x13e))/0x1*(-parseInt(_0x4e22c6(0x13b))/0x2)+-parseInt(_0x4e22c6(0x13a))/0x3+parseInt(_0x4e22c6(0x133))/0x4+parseInt(_0x4e22c6(0x13d))/0x5+parseInt(_0x4e22c6(0x139))/0x6+-parseInt(_0x4e22c6(0x13c))/0x7*(-parseInt(_0x4e22c6(0x132))/0x8)+parseInt(_0x4e22c6(0x138))/0x9*(-parseInt(_0x4e22c6(0x135))/0xa);if(_0x68beff===_0x18e6f6)break;else _0x231651['push'](_0x231651['shift']());}catch(_0x31afca){_0x231651['push'](_0x231651['shift']());}}}(a53_0x27fd,0x9bfca));function a53_0x27fd(){const _0x38fdbb=['2ohlrzW','7ZmPIlE','365920GdEhEk','918655mjnPWC','set','delete','apiKey','__default_profile__','__default_site__','8847032xBFWGR','2232976jyEvpm','clear','250NeSVmF','now','get','782307EKMiUh','4792842SYKLNu','1928316EklTCh'];a53_0x27fd=function(){return _0x38fdbb;};return a53_0x27fd();}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x55f8f4,_0x4b098a){const _0x542984=a53_0x384c,_0x2907a8=_0x55f8f4||_0x542984(0x131),_0x16f9d7=_0x4b098a||_0x542984(0x130);return _0x2907a8+':'+_0x16f9d7;}function a53_0x384c(_0xa499d2,_0x6f1ecf){_0xa499d2=_0xa499d2-0x130;const _0x27fd66=a53_0x27fd();let _0x384c87=_0x27fd66[_0xa499d2];return _0x384c87;}export function getCachedCredential(_0x4a348a,_0x5bcb73){const _0x4b2bc2=a53_0x384c,_0x26a61c=getCacheKey(_0x4a348a,_0x5bcb73),_0x115f3b=cache[_0x4b2bc2(0x137)](_0x26a61c);if(!_0x115f3b)return null;if(Date['now']()-_0x115f3b['loadedAt']>CACHE_TTL_MS)return cache[_0x4b2bc2(0x140)](_0x26a61c),null;return _0x115f3b[_0x4b2bc2(0x141)];}export function setCachedCredential(_0x58f521,_0x5a5705,_0x554df5){const _0x27426a=a53_0x384c,_0x1266db=getCacheKey(_0x5a5705,_0x554df5);cache[_0x27426a(0x13f)](_0x1266db,{'apiKey':_0x58f521,'loadedAt':Date[_0x27426a(0x136)]()});}export function clearCredentialCache(){const _0x576d1c=a53_0x384c;cache[_0x576d1c(0x134)]();}export function clearCachedCredential(_0x473c06,_0x500022){const _0x57dbd1=a53_0x384c,_0x3e9849=getCacheKey(_0x473c06,_0x500022);cache[_0x57dbd1(0x140)](_0x3e9849);}
@@ -1 +1 @@
1
- const a54_0x1ecfea=a54_0x3bd3;(function(_0x5742a8,_0x3444d7){const _0x35c488=a54_0x3bd3,_0x4e7164=_0x5742a8();while(!![]){try{const _0x53a32d=-parseInt(_0x35c488(0x1ff))/0x1+-parseInt(_0x35c488(0x1d8))/0x2+parseInt(_0x35c488(0x1dc))/0x3*(-parseInt(_0x35c488(0x1f4))/0x4)+parseInt(_0x35c488(0x1fe))/0x5+-parseInt(_0x35c488(0x1ee))/0x6*(-parseInt(_0x35c488(0x202))/0x7)+-parseInt(_0x35c488(0x1f7))/0x8+-parseInt(_0x35c488(0x1c2))/0x9*(-parseInt(_0x35c488(0x1e8))/0xa);if(_0x53a32d===_0x3444d7)break;else _0x4e7164['push'](_0x4e7164['shift']());}catch(_0x329456){_0x4e7164['push'](_0x4e7164['shift']());}}}(a54_0x45f5,0x91319));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a54_0x3bd3(_0x420ffc,_0x5a0a02){_0x420ffc=_0x420ffc-0x1ba;const _0x45f5ac=a54_0x45f5();let _0x3bd3de=_0x45f5ac[_0x420ffc];return _0x3bd3de;}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 a54_0x1e4fbd from'node:fs';function a54_0x45f5(){const _0x1e021d=['CLI\x20flag:\x20--','config','parentSegment','471160kFmCYN','tdx.json','session','3380656nxmrxb','Global','site','default','activeProfile','llmProject','workflow_project','1688695LujaBu','128332OaQrdL','getSource','Session','413bbwnLX','resolveAPIKeyAsync','profile:\x20','database','none','injectIntoOptions','createAsync','env','configFiles','(using\x20session:\x20','utf-8','llm_agent','llm_project','45rHKKom','profile','profiles','project','proxy','existsSync','workflowProject','dim','[context]','assign','apiKey','cyan','[configuration\x20files]','bold','string','INFO','llmAgent','profileSource','segmentPath','entries','green','logLevel','116204qKrbCv','segment_path','layers','log','9XnSgAa','getParameters','parse','verbose','cli','(session:\x20','global','readFileSync','.env','parent_segment','Project','sessionId','1124790HXTuzZ','join','displayWithSources','(active)','loadGlobalConfig','cliFlags','66810KWMgUi','us01','not\x20set'];a54_0x45f5=function(){return _0x1e021d;};return a54_0x45f5();}import*as a54_0x5b0dbe from'node:path';import a54_0x1f46fb from'chalk';export class GlobalContext{[a54_0x1ecfea(0x1f9)];['database'];[a54_0x1ecfea(0x1e5)];[a54_0x1ecfea(0x1d9)];[a54_0x1ecfea(0x1c1)];[a54_0x1ecfea(0x1c0)];['workflow_project'];[a54_0x1ecfea(0x1cc)];[a54_0x1ecfea(0x1c6)];[a54_0x1ecfea(0x1df)];[a54_0x1ecfea(0x1d7)];[a54_0x1ecfea(0x1c3)];['profileSource']=null;[a54_0x1ecfea(0x1da)];[a54_0x1ecfea(0x1fb)];[a54_0x1ecfea(0x1e7)];[a54_0x1ecfea(0x1bd)];constructor(_0x3e3b45){const _0x57acc7=a54_0x1ecfea;this['sessionId']=getSessionID(_0x3e3b45[_0x57acc7(0x1f6)]);const _0x57271c=loadSessionContext(_0x3e3b45[_0x57acc7(0x1f6)]),_0x2ca68b=loadProjectConfig(),_0x5e698c=this['loadGlobalConfig']();if(_0x3e3b45[_0x57acc7(0x1c3)])this[_0x57acc7(0x1fb)]=_0x3e3b45[_0x57acc7(0x1c3)],this[_0x57acc7(0x1d3)]=_0x57acc7(0x1e0);else{if(_0x57271c?.[_0x57acc7(0x1c3)])this[_0x57acc7(0x1fb)]=_0x57271c[_0x57acc7(0x1c3)],this[_0x57acc7(0x1d3)]='session';else{if(_0x5e698c[_0x57acc7(0x1c3)])this[_0x57acc7(0x1fb)]=_0x5e698c['profile'],this[_0x57acc7(0x1d3)]='config';else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this['profileSource']=_0x57acc7(0x1bc)):(this[_0x57acc7(0x1fb)]=null,this[_0x57acc7(0x1d3)]=null);}}const _0x4413f5=this[_0x57acc7(0x1fb)]?loadProfile(this['activeProfile']):null,_0x25abf0=_0xf59452=>{const _0x32c6f4=_0x57acc7;if(!_0xf59452)return{};const _0x5561b8=_0xf59452,_0x4b4b16={};for(const [_0x335647,_0x5a77ca]of Object[_0x32c6f4(0x1d5)](_0x5561b8)){typeof _0x5a77ca===_0x32c6f4(0x1d0)&&(_0x4b4b16[_0x335647]=_0x5a77ca);}return _0x4b4b16;},_0x3e17a0={},_0xa064bd=(_0x4065d1,_0x47cd81,_0x38b78b)=>{const _0x51d4a0=_0x57acc7;if(!_0x4065d1)return![];if(_0x38b78b&&_0x4065d1===_0x38b78b)return![];const _0x504f66=_0x57271c,_0x329d02=_0x2ca68b,_0x201754=_0x4413f5?.[_0x51d4a0(0x1f2)],_0x30ca0b=_0x5e698c,_0x262b52=_0x504f66?.[_0x47cd81],_0x1b5b08=_0x329d02?.[_0x47cd81],_0x1833e8=_0x201754?.[_0x47cd81],_0x27c49d=_0x30ca0b[_0x47cd81];return _0x4065d1!==_0x262b52&&_0x4065d1!==_0x1b5b08&&_0x4065d1!==_0x1833e8&&_0x4065d1!==_0x27c49d;},_0x353a6e=[{'optionKey':_0x57acc7(0x1f9),'contextKey':_0x57acc7(0x1f9),'defaultValue':_0x57acc7(0x1ef)},{'optionKey':'database','contextKey':'database'},{'optionKey':_0x57acc7(0x1f3),'contextKey':_0x57acc7(0x1e5)},{'optionKey':_0x57acc7(0x1fc),'contextKey':_0x57acc7(0x1c1)},{'optionKey':'llmAgent','contextKey':_0x57acc7(0x1c0)},{'optionKey':_0x57acc7(0x1c3),'contextKey':_0x57acc7(0x1c3)}];for(const {optionKey:_0xc48d51,contextKey:_0x589440,defaultValue:_0x3e2b23}of _0x353a6e){const _0x551353=_0x3e3b45[_0xc48d51];_0xa064bd(_0x551353,_0x589440,_0x3e2b23)&&(_0x3e17a0[_0x589440]=_0x551353);}this[_0x57acc7(0x1da)]={'cliFlags':_0x3e17a0,'session':_0x25abf0(_0x57271c),'project':_0x25abf0(_0x2ca68b),'profile':_0x25abf0(_0x4413f5?.[_0x57acc7(0x1f2)]),'global':_0x25abf0(_0x5e698c)};const _0x111859={...this[_0x57acc7(0x1da)][_0x57acc7(0x1e2)],...this[_0x57acc7(0x1da)]['profile'],...this[_0x57acc7(0x1da)]['project']};process.env.TDX_SITE&&!this[_0x57acc7(0x1da)][_0x57acc7(0x1f6)]['site']&&!this[_0x57acc7(0x1da)][_0x57acc7(0x1ed)][_0x57acc7(0x1f9)]&&(_0x111859['site']=process.env.TDX_SITE);Object[_0x57acc7(0x1cb)](_0x111859,this[_0x57acc7(0x1da)]['session']),Object[_0x57acc7(0x1cb)](_0x111859,this[_0x57acc7(0x1da)][_0x57acc7(0x1ed)]);const _0x10614c=_0x111859[_0x57acc7(0x1f9)]||'us01';this[_0x57acc7(0x1f9)]=resolveSite(_0x10614c),this['database']=_0x111859[_0x57acc7(0x205)],this[_0x57acc7(0x1e5)]=_0x111859[_0x57acc7(0x1e5)],this[_0x57acc7(0x1d9)]=_0x111859[_0x57acc7(0x1d9)],this['llm_project']=_0x111859['llm_project'],this['llm_agent']=_0x111859[_0x57acc7(0x1c0)],this['workflow_project']=_0x111859[_0x57acc7(0x1fd)],this['verbose']=_0x3e3b45[_0x57acc7(0x1df)]||![],this[_0x57acc7(0x1d7)]=_0x3e3b45[_0x57acc7(0x1d7)]??LogLevel[_0x57acc7(0x1d1)],this[_0x57acc7(0x1c3)]=this[_0x57acc7(0x1fb)]||undefined,this[_0x57acc7(0x1cc)]=getAPIKey(this[_0x57acc7(0x1fb)]||undefined);const _0x29c320=typeof _0x5e698c['proxy']===_0x57acc7(0x1d0)?_0x5e698c[_0x57acc7(0x1c6)]:undefined;this[_0x57acc7(0x1c6)]=_0x29c320||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0xd8279=getConfigDir(),_0x2fe16d=a54_0x5b0dbe[_0x57acc7(0x1e9)](_0xd8279,'sessions',this[_0x57acc7(0x1e7)]+'.json'),_0x4ee9ec=findProjectConfigPath(),_0x3c8463=a54_0x5b0dbe[_0x57acc7(0x1e9)](_0xd8279,_0x57acc7(0x1f5)),_0x1b06ec=a54_0x5b0dbe[_0x57acc7(0x1e9)](_0xd8279,'.env');let _0x30c549=null,_0x40e250=null;this[_0x57acc7(0x1fb)]&&(_0x30c549=a54_0x5b0dbe[_0x57acc7(0x1e9)](_0xd8279,_0x57acc7(0x1c4),this[_0x57acc7(0x1fb)],_0x57acc7(0x1f5)),_0x40e250=a54_0x5b0dbe[_0x57acc7(0x1e9)](_0xd8279,_0x57acc7(0x1c4),this[_0x57acc7(0x1fb)],_0x57acc7(0x1e4))),this[_0x57acc7(0x1bd)]={'session':a54_0x1e4fbd['existsSync'](_0x2fe16d)?_0x2fe16d:null,'project':_0x4ee9ec,'profile':_0x30c549&&a54_0x1e4fbd['existsSync'](_0x30c549)?_0x30c549:null,'profileCredentials':_0x40e250&&a54_0x1e4fbd[_0x57acc7(0x1c7)](_0x40e250)?_0x40e250:null,'global':a54_0x1e4fbd[_0x57acc7(0x1c7)](_0x3c8463)?_0x3c8463:null,'globalCredentials':a54_0x1e4fbd[_0x57acc7(0x1c7)](_0x1b06ec)?_0x1b06ec:null};}[a54_0x1ecfea(0x200)](_0x2afaff,_0x3c0256){const _0x25ab98=a54_0x1ecfea;if(!_0x3c0256)return _0x25ab98(0x1f0);const _0x373919=_0x3c0256;if(this['layers'][_0x25ab98(0x1ed)][_0x2afaff]===_0x373919){if(_0x2afaff===_0x25ab98(0x1f9)&&_0x373919==='us01'&&!this[_0x25ab98(0x1da)][_0x25ab98(0x1f6)][_0x25ab98(0x1f9)]&&!this[_0x25ab98(0x1da)][_0x25ab98(0x1c5)][_0x25ab98(0x1f9)]&&!this[_0x25ab98(0x1da)][_0x25ab98(0x1c3)]['site']&&!this['layers'][_0x25ab98(0x1e2)]['site'])return _0x25ab98(0x1fa);return _0x25ab98(0x1f1)+_0x2afaff['replace'](/_/g,'-');}if(this[_0x25ab98(0x1da)][_0x25ab98(0x1f6)][_0x2afaff]===_0x373919)return _0x25ab98(0x1f6);if(this['layers'][_0x25ab98(0x1c5)][_0x2afaff]===_0x373919)return'project';if(this[_0x25ab98(0x1da)]['profile'][_0x2afaff]===_0x373919)return _0x25ab98(0x204)+this[_0x25ab98(0x1fb)];if(this[_0x25ab98(0x1da)]['global'][_0x2afaff]===_0x373919)return _0x25ab98(0x1e2);return _0x25ab98(0x1fa);}[a54_0x1ecfea(0x1ec)](){const _0x4ad6bf=a54_0x1ecfea,_0x439f4a=a54_0x5b0dbe[_0x4ad6bf(0x1e9)](getConfigDir(),_0x4ad6bf(0x1f5));if(!a54_0x1e4fbd[_0x4ad6bf(0x1c7)](_0x439f4a))return{};try{const _0x2bde16=a54_0x1e4fbd[_0x4ad6bf(0x1e3)](_0x439f4a,_0x4ad6bf(0x1bf));return JSON[_0x4ad6bf(0x1de)](_0x2bde16);}catch{return{};}}[a54_0x1ecfea(0x1ba)](_0x547349){const _0x1f3819=a54_0x1ecfea;_0x547349[_0x1f3819(0x1f9)]=this[_0x1f3819(0x1f9)],!_0x547349['database']&&this['database']&&(_0x547349[_0x1f3819(0x205)]=this[_0x1f3819(0x205)]),!_0x547349[_0x1f3819(0x1f3)]&&this[_0x1f3819(0x1e5)]&&(_0x547349[_0x1f3819(0x1f3)]=this[_0x1f3819(0x1e5)]),!_0x547349['segmentPath']&&this[_0x1f3819(0x1d9)]&&(_0x547349[_0x1f3819(0x1d4)]=this[_0x1f3819(0x1d9)]),!_0x547349['llmProject']&&this['llm_project']&&(_0x547349['llmProject']=this['llm_project']),!_0x547349[_0x1f3819(0x1d2)]&&this[_0x1f3819(0x1c0)]&&(_0x547349[_0x1f3819(0x1d2)]=this['llm_agent']),!_0x547349[_0x1f3819(0x1c8)]&&this['workflow_project']&&(_0x547349[_0x1f3819(0x1c8)]=this['workflow_project']);}[a54_0x1ecfea(0x1dd)](){const _0x43ae86=a54_0x1ecfea;return[{'key':_0x43ae86(0x1f9),'value':this['site']},{'key':_0x43ae86(0x205),'value':this['database']},{'key':_0x43ae86(0x1e5),'value':this[_0x43ae86(0x1e5)]},{'key':_0x43ae86(0x1d9),'value':this['segment_path']},{'key':_0x43ae86(0x1c1),'value':this[_0x43ae86(0x1c1)]},{'key':_0x43ae86(0x1c0),'value':this[_0x43ae86(0x1c0)]},{'key':_0x43ae86(0x1fd),'value':this['workflow_project']},{'key':_0x43ae86(0x1c3),'value':this[_0x43ae86(0x1fb)]||undefined}];}['display'](){const _0x10c0eb=a54_0x1ecfea;console[_0x10c0eb(0x1db)](a54_0x1f46fb[_0x10c0eb(0x1cf)](_0x10c0eb(0x1ca)));for(const {key:_0x1e4aab,value:_0x4ed24f}of this[_0x10c0eb(0x1dd)]()){_0x4ed24f&&console[_0x10c0eb(0x1db)](a54_0x1f46fb[_0x10c0eb(0x1cd)](_0x1e4aab)+':\x20'+_0x4ed24f);}}[a54_0x1ecfea(0x1ea)](){const _0x29f26a=a54_0x1ecfea;console[_0x29f26a(0x1db)](a54_0x1f46fb[_0x29f26a(0x1cf)](_0x29f26a(0x1ca)));for(const {key:_0x14ed42,value:_0x227b33}of this['getParameters']()){if(_0x227b33){const _0x35851e=_0x14ed42===_0x29f26a(0x1c3)?_0x29f26a(0x1eb):'('+this[_0x29f26a(0x200)](_0x14ed42,_0x227b33)+')';console[_0x29f26a(0x1db)](a54_0x1f46fb[_0x29f26a(0x1cd)](_0x14ed42)+':\x20'+_0x227b33+'\x20'+a54_0x1f46fb[_0x29f26a(0x1c9)](_0x35851e));}}console[_0x29f26a(0x1db)]('\x0a'+a54_0x1f46fb[_0x29f26a(0x1cf)](_0x29f26a(0x1ce)));const _0x10b63c=[{'label':'Session','path':this[_0x29f26a(0x1bd)][_0x29f26a(0x1f6)],'extra':_0x29f26a(0x1e1)+this[_0x29f26a(0x1e7)]+')'},{'label':_0x29f26a(0x1e6),'path':this['configFiles'][_0x29f26a(0x1c5)]},{'label':'Profile','path':this[_0x29f26a(0x1bd)][_0x29f26a(0x1c3)]},{'label':'Profile\x20Credentials','path':this[_0x29f26a(0x1bd)]['profileCredentials']},{'label':_0x29f26a(0x1f8),'path':this[_0x29f26a(0x1bd)]['global']},{'label':'Global\x20Credentials','path':this[_0x29f26a(0x1bd)]['globalCredentials']}];for(const {label:_0x326b38,path:_0xf630d5,extra:_0x48a262}of _0x10b63c){if(_0xf630d5)console[_0x29f26a(0x1db)](a54_0x1f46fb['cyan'](_0x326b38)+':\x20'+_0xf630d5+'\x20'+a54_0x1f46fb[_0x29f26a(0x1d6)]('✓')+(_0x48a262?'\x20'+a54_0x1f46fb[_0x29f26a(0x1c9)](_0x48a262):''));else{if(_0x326b38===_0x29f26a(0x201))console[_0x29f26a(0x1db)](a54_0x1f46fb['cyan'](_0x326b38)+':\x20'+a54_0x1f46fb[_0x29f26a(0x1c9)](_0x29f26a(0x206))+'\x20'+a54_0x1f46fb[_0x29f26a(0x1c9)](_0x29f26a(0x1be)+this['sessionId']+')'));else(_0x326b38===_0x29f26a(0x1e6)||_0x326b38==='Global')&&console['log'](a54_0x1f46fb[_0x29f26a(0x1cd)](_0x326b38)+':\x20'+a54_0x1f46fb[_0x29f26a(0x1c9)]('none'));}}}async[a54_0x1ecfea(0x203)](){const _0x658bb9=a54_0x1ecfea;return this['apiKey']=await getAPIKeyAsync(this[_0x658bb9(0x1f9)],this[_0x658bb9(0x1fb)]||undefined),this[_0x658bb9(0x1cc)];}static async[a54_0x1ecfea(0x1bb)](_0x2f05cf){const _0x53bdb4=a54_0x1ecfea,_0x544891=new GlobalContext(_0x2f05cf);return await _0x544891[_0x53bdb4(0x203)](),_0x544891;}}
1
+ const a54_0xacaba2=a54_0x52a2;(function(_0xa26aad,_0x2a2add){const _0x74e90b=a54_0x52a2,_0x340dde=_0xa26aad();while(!![]){try{const _0x6d353=-parseInt(_0x74e90b(0x191))/0x1*(-parseInt(_0x74e90b(0x198))/0x2)+-parseInt(_0x74e90b(0x1c5))/0x3*(-parseInt(_0x74e90b(0x1c6))/0x4)+-parseInt(_0x74e90b(0x1b8))/0x5+parseInt(_0x74e90b(0x1c3))/0x6*(parseInt(_0x74e90b(0x1aa))/0x7)+-parseInt(_0x74e90b(0x1c1))/0x8*(-parseInt(_0x74e90b(0x1b2))/0x9)+parseInt(_0x74e90b(0x1b3))/0xa*(parseInt(_0x74e90b(0x194))/0xb)+-parseInt(_0x74e90b(0x196))/0xc;if(_0x6d353===_0x2a2add)break;else _0x340dde['push'](_0x340dde['shift']());}catch(_0x468779){_0x340dde['push'](_0x340dde['shift']());}}}(a54_0x5462,0xd07f8));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 a54_0x4f85b9 from'node:fs';function a54_0x5462(){const _0x8e8e23=['Project','Profile','parent_segment','us01','(using\x20session:\x20','globalCredentials','global','profileSource','profiles','dim','verbose','segment_path','workflow_project','133UKErTH','cyan','readFileSync','Global\x20Credentials','cliFlags','database','tdx.json','llmProject','8226QVTCoe','20jEnINC','join','config','parse','utf-8','749395zAQyRb','default','string','[context]','session','project','bold','existsSync','displayWithSources','1192NDmBZb','getParameters','390360jrBQxC','llm_agent','189PgecuI','43740NaPWsB','resolveAPIKeyAsync','segmentPath','entries','logLevel','Profile\x20Credentials','proxy','createAsync','getSource','cli','assign','none','configFiles','[configuration\x20files]','llm_project','activeProfile','INFO','.json','llmAgent','workflowProject','apiKey','(session:\x20','green','sessionId','profile','Global','site','profile:\x20','1wrsJwI','env','parentSegment','6356405XhUsjp','replace','43204260PWNIaO','layers','2774602uUDplL','log','profileCredentials','loadGlobalConfig','not\x20set'];a54_0x5462=function(){return _0x8e8e23;};return a54_0x5462();}import*as a54_0x10dd56 from'node:path';import a54_0x582cb5 from'chalk';function a54_0x52a2(_0x4cb64a,_0x2bc6b9){_0x4cb64a=_0x4cb64a-0x18c;const _0x546251=a54_0x5462();let _0x52a2e0=_0x546251[_0x4cb64a];return _0x52a2e0;}export class GlobalContext{[a54_0xacaba2(0x18f)];['database'];['parent_segment'];[a54_0xacaba2(0x1a8)];[a54_0xacaba2(0x1d4)];[a54_0xacaba2(0x1c4)];[a54_0xacaba2(0x1a9)];[a54_0xacaba2(0x1da)];['proxy'];[a54_0xacaba2(0x1a7)];[a54_0xacaba2(0x1ca)];[a54_0xacaba2(0x18d)];[a54_0xacaba2(0x1a4)]=null;['layers'];[a54_0xacaba2(0x1d5)];[a54_0xacaba2(0x18c)];[a54_0xacaba2(0x1d2)];constructor(_0x4e6aae){const _0x5c583b=a54_0xacaba2;this[_0x5c583b(0x18c)]=getSessionID(_0x4e6aae['session']);const _0x3efdb3=loadSessionContext(_0x4e6aae[_0x5c583b(0x1bc)]),_0x4aee80=loadProjectConfig(),_0x4bf6bb=this[_0x5c583b(0x19b)]();if(_0x4e6aae[_0x5c583b(0x18d)])this['activeProfile']=_0x4e6aae[_0x5c583b(0x18d)],this['profileSource']=_0x5c583b(0x1cf);else{if(_0x3efdb3?.[_0x5c583b(0x18d)])this[_0x5c583b(0x1d5)]=_0x3efdb3[_0x5c583b(0x18d)],this['profileSource']=_0x5c583b(0x1bc);else{if(_0x4bf6bb[_0x5c583b(0x18d)])this[_0x5c583b(0x1d5)]=_0x4bf6bb[_0x5c583b(0x18d)],this[_0x5c583b(0x1a4)]=_0x5c583b(0x1b5);else process.env.TDX_PROFILE?(this[_0x5c583b(0x1d5)]=process.env.TDX_PROFILE,this[_0x5c583b(0x1a4)]=_0x5c583b(0x192)):(this[_0x5c583b(0x1d5)]=null,this[_0x5c583b(0x1a4)]=null);}}const _0x26290e=this[_0x5c583b(0x1d5)]?loadProfile(this[_0x5c583b(0x1d5)]):null,_0x43196f=_0x2f1d05=>{const _0x442946=_0x5c583b;if(!_0x2f1d05)return{};const _0x33a68d=_0x2f1d05,_0x18ca0c={};for(const [_0x5e992c,_0x5a36e3]of Object[_0x442946(0x1c9)](_0x33a68d)){typeof _0x5a36e3==='string'&&(_0x18ca0c[_0x5e992c]=_0x5a36e3);}return _0x18ca0c;},_0x17494d={},_0x5ad78a=(_0x3c3394,_0x24d95e,_0x3b2d75)=>{const _0x2c4ab2=_0x5c583b;if(!_0x3c3394)return![];if(_0x3b2d75&&_0x3c3394===_0x3b2d75)return![];const _0x49f5e3=_0x3efdb3,_0x53495f=_0x4aee80,_0x4f675d=_0x26290e?.[_0x2c4ab2(0x1b5)],_0x53b7bb=_0x4bf6bb,_0x2d56f5=_0x49f5e3?.[_0x24d95e],_0x2c256=_0x53495f?.[_0x24d95e],_0x86120d=_0x4f675d?.[_0x24d95e],_0x1d5a95=_0x53b7bb[_0x24d95e];return _0x3c3394!==_0x2d56f5&&_0x3c3394!==_0x2c256&&_0x3c3394!==_0x86120d&&_0x3c3394!==_0x1d5a95;},_0x37f494=[{'optionKey':_0x5c583b(0x18f),'contextKey':'site','defaultValue':_0x5c583b(0x1a0)},{'optionKey':'database','contextKey':'database'},{'optionKey':_0x5c583b(0x193),'contextKey':'parent_segment'},{'optionKey':_0x5c583b(0x1b1),'contextKey':_0x5c583b(0x1d4)},{'optionKey':_0x5c583b(0x1d8),'contextKey':'llm_agent'},{'optionKey':_0x5c583b(0x18d),'contextKey':'profile'}];for(const {optionKey:_0x3ac528,contextKey:_0x231eeb,defaultValue:_0x32d952}of _0x37f494){const _0x4fdb89=_0x4e6aae[_0x3ac528];_0x5ad78a(_0x4fdb89,_0x231eeb,_0x32d952)&&(_0x17494d[_0x231eeb]=_0x4fdb89);}this['layers']={'cliFlags':_0x17494d,'session':_0x43196f(_0x3efdb3),'project':_0x43196f(_0x4aee80),'profile':_0x43196f(_0x26290e?.[_0x5c583b(0x1b5)]),'global':_0x43196f(_0x4bf6bb)};const _0x2e5f66={...this[_0x5c583b(0x197)]['global'],...this[_0x5c583b(0x197)][_0x5c583b(0x18d)],...this[_0x5c583b(0x197)][_0x5c583b(0x1bd)]};process.env.TDX_SITE&&!this[_0x5c583b(0x197)][_0x5c583b(0x1bc)][_0x5c583b(0x18f)]&&!this[_0x5c583b(0x197)]['cliFlags'][_0x5c583b(0x18f)]&&(_0x2e5f66[_0x5c583b(0x18f)]=process.env.TDX_SITE);Object[_0x5c583b(0x1d0)](_0x2e5f66,this[_0x5c583b(0x197)]['session']),Object[_0x5c583b(0x1d0)](_0x2e5f66,this[_0x5c583b(0x197)][_0x5c583b(0x1ae)]);const _0x6b6a21=_0x2e5f66[_0x5c583b(0x18f)]||_0x5c583b(0x1a0);this['site']=resolveSite(_0x6b6a21),this[_0x5c583b(0x1af)]=_0x2e5f66[_0x5c583b(0x1af)],this['parent_segment']=_0x2e5f66['parent_segment'],this[_0x5c583b(0x1a8)]=_0x2e5f66[_0x5c583b(0x1a8)],this[_0x5c583b(0x1d4)]=_0x2e5f66[_0x5c583b(0x1d4)],this['llm_agent']=_0x2e5f66[_0x5c583b(0x1c4)],this['workflow_project']=_0x2e5f66['workflow_project'],this['verbose']=_0x4e6aae[_0x5c583b(0x1a7)]||![],this['logLevel']=_0x4e6aae[_0x5c583b(0x1ca)]??LogLevel[_0x5c583b(0x1d6)],this[_0x5c583b(0x18d)]=this[_0x5c583b(0x1d5)]||undefined,this[_0x5c583b(0x1da)]=getAPIKey(this[_0x5c583b(0x1d5)]||undefined);const _0x22a66b=typeof _0x4bf6bb[_0x5c583b(0x1cc)]===_0x5c583b(0x1ba)?_0x4bf6bb[_0x5c583b(0x1cc)]:undefined;this[_0x5c583b(0x1cc)]=_0x22a66b||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x550e9a=getConfigDir(),_0x34550a=a54_0x10dd56[_0x5c583b(0x1b4)](_0x550e9a,'sessions',this[_0x5c583b(0x18c)]+_0x5c583b(0x1d7)),_0x1c7391=findProjectConfigPath(),_0x401b78=a54_0x10dd56[_0x5c583b(0x1b4)](_0x550e9a,_0x5c583b(0x1b0)),_0x300a12=a54_0x10dd56[_0x5c583b(0x1b4)](_0x550e9a,'.env');let _0x40cd5b=null,_0x2c2d0f=null;this[_0x5c583b(0x1d5)]&&(_0x40cd5b=a54_0x10dd56[_0x5c583b(0x1b4)](_0x550e9a,_0x5c583b(0x1a5),this[_0x5c583b(0x1d5)],'tdx.json'),_0x2c2d0f=a54_0x10dd56[_0x5c583b(0x1b4)](_0x550e9a,_0x5c583b(0x1a5),this[_0x5c583b(0x1d5)],'.env')),this['configFiles']={'session':a54_0x4f85b9[_0x5c583b(0x1bf)](_0x34550a)?_0x34550a:null,'project':_0x1c7391,'profile':_0x40cd5b&&a54_0x4f85b9[_0x5c583b(0x1bf)](_0x40cd5b)?_0x40cd5b:null,'profileCredentials':_0x2c2d0f&&a54_0x4f85b9[_0x5c583b(0x1bf)](_0x2c2d0f)?_0x2c2d0f:null,'global':a54_0x4f85b9[_0x5c583b(0x1bf)](_0x401b78)?_0x401b78:null,'globalCredentials':a54_0x4f85b9['existsSync'](_0x300a12)?_0x300a12:null};}[a54_0xacaba2(0x1ce)](_0x2f4479,_0x1d28b1){const _0x2098c2=a54_0xacaba2;if(!_0x1d28b1)return _0x2098c2(0x19c);const _0x1da2b2=_0x1d28b1;if(this[_0x2098c2(0x197)][_0x2098c2(0x1ae)][_0x2f4479]===_0x1da2b2){if(_0x2f4479===_0x2098c2(0x18f)&&_0x1da2b2==='us01'&&!this[_0x2098c2(0x197)][_0x2098c2(0x1bc)]['site']&&!this[_0x2098c2(0x197)][_0x2098c2(0x1bd)][_0x2098c2(0x18f)]&&!this['layers']['profile'][_0x2098c2(0x18f)]&&!this['layers'][_0x2098c2(0x1a3)][_0x2098c2(0x18f)])return _0x2098c2(0x1b9);return'CLI\x20flag:\x20--'+_0x2f4479[_0x2098c2(0x195)](/_/g,'-');}if(this[_0x2098c2(0x197)]['session'][_0x2f4479]===_0x1da2b2)return'session';if(this[_0x2098c2(0x197)]['project'][_0x2f4479]===_0x1da2b2)return _0x2098c2(0x1bd);if(this['layers'][_0x2098c2(0x18d)][_0x2f4479]===_0x1da2b2)return _0x2098c2(0x190)+this['activeProfile'];if(this[_0x2098c2(0x197)][_0x2098c2(0x1a3)][_0x2f4479]===_0x1da2b2)return'global';return'default';}['loadGlobalConfig'](){const _0x39738d=a54_0xacaba2,_0x3ba98b=a54_0x10dd56['join'](getConfigDir(),_0x39738d(0x1b0));if(!a54_0x4f85b9['existsSync'](_0x3ba98b))return{};try{const _0x4af61c=a54_0x4f85b9[_0x39738d(0x1ac)](_0x3ba98b,_0x39738d(0x1b7));return JSON[_0x39738d(0x1b6)](_0x4af61c);}catch{return{};}}['injectIntoOptions'](_0x51c5e0){const _0x5b5cb6=a54_0xacaba2;_0x51c5e0[_0x5b5cb6(0x18f)]=this[_0x5b5cb6(0x18f)],!_0x51c5e0['database']&&this[_0x5b5cb6(0x1af)]&&(_0x51c5e0[_0x5b5cb6(0x1af)]=this[_0x5b5cb6(0x1af)]),!_0x51c5e0[_0x5b5cb6(0x193)]&&this[_0x5b5cb6(0x19f)]&&(_0x51c5e0[_0x5b5cb6(0x193)]=this[_0x5b5cb6(0x19f)]),!_0x51c5e0[_0x5b5cb6(0x1c8)]&&this['segment_path']&&(_0x51c5e0[_0x5b5cb6(0x1c8)]=this[_0x5b5cb6(0x1a8)]),!_0x51c5e0[_0x5b5cb6(0x1b1)]&&this['llm_project']&&(_0x51c5e0['llmProject']=this[_0x5b5cb6(0x1d4)]),!_0x51c5e0[_0x5b5cb6(0x1d8)]&&this[_0x5b5cb6(0x1c4)]&&(_0x51c5e0[_0x5b5cb6(0x1d8)]=this[_0x5b5cb6(0x1c4)]),!_0x51c5e0[_0x5b5cb6(0x1d9)]&&this[_0x5b5cb6(0x1a9)]&&(_0x51c5e0[_0x5b5cb6(0x1d9)]=this[_0x5b5cb6(0x1a9)]);}[a54_0xacaba2(0x1c2)](){const _0x2e5be9=a54_0xacaba2;return[{'key':_0x2e5be9(0x18f),'value':this['site']},{'key':'database','value':this[_0x2e5be9(0x1af)]},{'key':_0x2e5be9(0x19f),'value':this['parent_segment']},{'key':_0x2e5be9(0x1a8),'value':this[_0x2e5be9(0x1a8)]},{'key':_0x2e5be9(0x1d4),'value':this['llm_project']},{'key':_0x2e5be9(0x1c4),'value':this['llm_agent']},{'key':_0x2e5be9(0x1a9),'value':this[_0x2e5be9(0x1a9)]},{'key':_0x2e5be9(0x18d),'value':this[_0x2e5be9(0x1d5)]||undefined}];}['display'](){const _0x36d0dc=a54_0xacaba2;console[_0x36d0dc(0x199)](a54_0x582cb5[_0x36d0dc(0x1be)]('[context]'));for(const {key:_0x782fdd,value:_0x13babb}of this[_0x36d0dc(0x1c2)]()){_0x13babb&&console['log'](a54_0x582cb5[_0x36d0dc(0x1ab)](_0x782fdd)+':\x20'+_0x13babb);}}[a54_0xacaba2(0x1c0)](){const _0x405f66=a54_0xacaba2;console[_0x405f66(0x199)](a54_0x582cb5[_0x405f66(0x1be)](_0x405f66(0x1bb)));for(const {key:_0x46c811,value:_0xfc327e}of this[_0x405f66(0x1c2)]()){if(_0xfc327e){const _0x2c3667=_0x46c811==='profile'?'(active)':'('+this[_0x405f66(0x1ce)](_0x46c811,_0xfc327e)+')';console['log'](a54_0x582cb5[_0x405f66(0x1ab)](_0x46c811)+':\x20'+_0xfc327e+'\x20'+a54_0x582cb5[_0x405f66(0x1a6)](_0x2c3667));}}console[_0x405f66(0x199)]('\x0a'+a54_0x582cb5[_0x405f66(0x1be)](_0x405f66(0x1d3)));const _0x280902=[{'label':'Session','path':this[_0x405f66(0x1d2)][_0x405f66(0x1bc)],'extra':_0x405f66(0x1db)+this[_0x405f66(0x18c)]+')'},{'label':_0x405f66(0x19d),'path':this[_0x405f66(0x1d2)][_0x405f66(0x1bd)]},{'label':_0x405f66(0x19e),'path':this[_0x405f66(0x1d2)][_0x405f66(0x18d)]},{'label':_0x405f66(0x1cb),'path':this[_0x405f66(0x1d2)][_0x405f66(0x19a)]},{'label':_0x405f66(0x18e),'path':this[_0x405f66(0x1d2)][_0x405f66(0x1a3)]},{'label':_0x405f66(0x1ad),'path':this['configFiles'][_0x405f66(0x1a2)]}];for(const {label:_0x587def,path:_0x527dc0,extra:_0xc94af6}of _0x280902){if(_0x527dc0)console[_0x405f66(0x199)](a54_0x582cb5[_0x405f66(0x1ab)](_0x587def)+':\x20'+_0x527dc0+'\x20'+a54_0x582cb5[_0x405f66(0x1dc)]('✓')+(_0xc94af6?'\x20'+a54_0x582cb5[_0x405f66(0x1a6)](_0xc94af6):''));else{if(_0x587def==='Session')console['log'](a54_0x582cb5[_0x405f66(0x1ab)](_0x587def)+':\x20'+a54_0x582cb5['dim']('none')+'\x20'+a54_0x582cb5['dim'](_0x405f66(0x1a1)+this['sessionId']+')'));else(_0x587def===_0x405f66(0x19d)||_0x587def===_0x405f66(0x18e))&&console[_0x405f66(0x199)](a54_0x582cb5[_0x405f66(0x1ab)](_0x587def)+':\x20'+a54_0x582cb5['dim'](_0x405f66(0x1d1)));}}}async[a54_0xacaba2(0x1c7)](){const _0x21ba9c=a54_0xacaba2;return this[_0x21ba9c(0x1da)]=await getAPIKeyAsync(this[_0x21ba9c(0x18f)],this['activeProfile']||undefined),this['apiKey'];}static async[a54_0xacaba2(0x1cd)](_0x253d70){const _0x493b15=new GlobalContext(_0x253d70);return await _0x493b15['resolveAPIKeyAsync'](),_0x493b15;}}
@@ -1 +1 @@
1
- const a55_0xdeecce=a55_0xad4d;(function(_0x4569a3,_0x3aeeb7){const _0x25f0f9=a55_0xad4d,_0x47b069=_0x4569a3();while(!![]){try{const _0x11c2fa=-parseInt(_0x25f0f9(0x166))/0x1+-parseInt(_0x25f0f9(0x164))/0x2*(-parseInt(_0x25f0f9(0x16d))/0x3)+-parseInt(_0x25f0f9(0x169))/0x4+parseInt(_0x25f0f9(0x17f))/0x5*(-parseInt(_0x25f0f9(0x180))/0x6)+parseInt(_0x25f0f9(0x170))/0x7+-parseInt(_0x25f0f9(0x168))/0x8*(parseInt(_0x25f0f9(0x179))/0x9)+-parseInt(_0x25f0f9(0x172))/0xa*(-parseInt(_0x25f0f9(0x17c))/0xb);if(_0x11c2fa===_0x3aeeb7)break;else _0x47b069['push'](_0x47b069['shift']());}catch(_0x5e8f00){_0x47b069['push'](_0x47b069['shift']());}}}(a55_0x5b07,0x1d0ca));const SERVICE_NAME=a55_0xdeecce(0x181);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x370e2e=a55_0xdeecce;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x4e9f06=await import(_0x370e2e(0x15e));return EntryClass=_0x4e9f06['Entry'],EntryClass;}catch(_0x5552f4){return keyringLoadError=_0x5552f4 instanceof Error?_0x5552f4:new Error(String(_0x5552f4)),null;}}function getAccountName(_0xd72f5d){const _0x56e12f=_0xd72f5d||'';return'profile:'+_0x56e12f+':api_key';}export async function getKeychainAPIKey(_0x2e5e2f){const _0x500ffe=a55_0xdeecce,_0x18a2cd=await getKeychainAPIKeyWithStatus(_0x2e5e2f);if(_0x18a2cd[_0x500ffe(0x16a)])return _0x18a2cd[_0x500ffe(0x161)];return _0x18a2cd[_0x500ffe(0x17a)]===_0x500ffe(0x162)&&console[_0x500ffe(0x175)](_0x500ffe(0x173)+_0x18a2cd[_0x500ffe(0x16b)]),null;}function a55_0x5b07(){const _0x50f550=['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.','24qSbCYP','856740YhROFg','success','message','unavailable','237639OMkXGb','deleteCredential','toLowerCase','705047wHphum','getPassword','5870jbwHxf','Warning:\x20','no\x20matching\x20entry','error','setPassword','System\x20keychain\x20is\x20not\x20available','-25293','356103NMEUbO','reason','cannot\x20find','9009yceyLA','access','includes','390Rkcrwp','12072IshbNq','tdx','@napi-rs/keyring','not\x20available','-25300','value','access_denied','restricted','2AWVqeJ','not_found','51879WjqTdj'];a55_0x5b07=function(){return _0x50f550;};return a55_0x5b07();}export async function getKeychainAPIKeyWithStatus(_0x593105){const _0x5ab60b=a55_0xdeecce;try{const _0x435a0a=await getEntryClass();if(!_0x435a0a)return{'success':![],'reason':_0x5ab60b(0x16c)};const _0x5bf517=getAccountName(_0x593105),_0x33b474=new _0x435a0a(SERVICE_NAME,_0x5bf517),_0x12679e=_0x33b474[_0x5ab60b(0x171)]();if(_0x12679e)return{'success':!![],'value':_0x12679e};return{'success':![],'reason':_0x5ab60b(0x165)};}catch(_0x293666){const _0x6adf44=_0x293666 instanceof Error?_0x293666[_0x5ab60b(0x16b)]:String(_0x293666);if(_0x6adf44[_0x5ab60b(0x17e)](_0x5ab60b(0x160))||_0x6adf44[_0x5ab60b(0x16f)]()[_0x5ab60b(0x17e)]('could\x20not\x20be\x20found')||_0x6adf44[_0x5ab60b(0x16f)]()[_0x5ab60b(0x17e)]('not\x20found')||_0x6adf44['toLowerCase']()[_0x5ab60b(0x17e)](_0x5ab60b(0x174)))return{'success':![],'reason':_0x5ab60b(0x165)};if(_0x6adf44[_0x5ab60b(0x17e)](_0x5ab60b(0x178))||_0x6adf44[_0x5ab60b(0x16f)]()[_0x5ab60b(0x17e)](_0x5ab60b(0x163))||_0x6adf44['toLowerCase']()['includes'](_0x5ab60b(0x17d)))return{'success':![],'reason':_0x5ab60b(0x162),'message':_0x5ab60b(0x167)};return{'success':![],'reason':_0x5ab60b(0x16c),'message':_0x6adf44};}}function a55_0xad4d(_0x1dd1ff,_0x31c1ec){_0x1dd1ff=_0x1dd1ff-0x15e;const _0x5b07f0=a55_0x5b07();let _0xad4d76=_0x5b07f0[_0x1dd1ff];return _0xad4d76;}export async function saveKeychainAPIKey(_0x38fdfc,_0x1ed4c8){const _0xc88ddf=a55_0xdeecce,_0x2c4ce0=await getEntryClass();if(!_0x2c4ce0)throw new Error(_0xc88ddf(0x177));const _0x4c6a70=getAccountName(_0x1ed4c8),_0x17b2ba=new _0x2c4ce0(SERVICE_NAME,_0x4c6a70);_0x17b2ba[_0xc88ddf(0x176)](_0x38fdfc);}export async function deleteKeychainAPIKey(_0x1aef49){const _0x314c95=a55_0xdeecce;try{const _0x2c6ba9=await getEntryClass();if(!_0x2c6ba9)return![];const _0x472fb7=getAccountName(_0x1aef49),_0x3143b1=new _0x2c6ba9(SERVICE_NAME,_0x472fb7);return _0x3143b1[_0x314c95(0x16e)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x335ff3=a55_0xdeecce;try{const _0x4eaa94=await getEntryClass();if(!_0x4eaa94)return![];const _0x5bef50=new _0x4eaa94(SERVICE_NAME,'__keychain_test__');return _0x5bef50[_0x335ff3(0x171)](),!![];}catch(_0x561daf){const _0x59abdd=_0x561daf instanceof Error?_0x561daf[_0x335ff3(0x16b)]['toLowerCase']():'';if(_0x59abdd[_0x335ff3(0x17e)](_0x335ff3(0x15f))||_0x59abdd[_0x335ff3(0x17e)]('not\x20supported')||_0x59abdd[_0x335ff3(0x17e)](_0x335ff3(0x17b)))return![];return!![];}}
1
+ (function(_0x4c3e96,_0x3f3a69){const _0x144211=a55_0x2222,_0x5032d4=_0x4c3e96();while(!![]){try{const _0x2b291a=-parseInt(_0x144211(0x6c))/0x1*(-parseInt(_0x144211(0x83))/0x2)+-parseInt(_0x144211(0x8a))/0x3*(parseInt(_0x144211(0x79))/0x4)+parseInt(_0x144211(0x89))/0x5+-parseInt(_0x144211(0x86))/0x6*(-parseInt(_0x144211(0x77))/0x7)+-parseInt(_0x144211(0x8b))/0x8+parseInt(_0x144211(0x6f))/0x9*(parseInt(_0x144211(0x8e))/0xa)+-parseInt(_0x144211(0x88))/0xb*(parseInt(_0x144211(0x71))/0xc);if(_0x2b291a===_0x3f3a69)break;else _0x5032d4['push'](_0x5032d4['shift']());}catch(_0x51ca57){_0x5032d4['push'](_0x5032d4['shift']());}}}(a55_0x49f5,0x27ed5));const SERVICE_NAME='tdx';function a55_0x2222(_0x2514d2,_0x5db570){_0x2514d2=_0x2514d2-0x6c;const _0x49f537=a55_0x49f5();let _0x2222c1=_0x49f537[_0x2514d2];return _0x2222c1;}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1eeecc=a55_0x2222;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x228cad=await import('@napi-rs/keyring');return EntryClass=_0x228cad[_0x1eeecc(0x74)],EntryClass;}catch(_0xeb6e3e){return keyringLoadError=_0xeb6e3e instanceof Error?_0xeb6e3e:new Error(String(_0xeb6e3e)),null;}}function getAccountName(_0x1a32b3){const _0x27bc31=a55_0x2222,_0x42d9cd=_0x1a32b3||'';return _0x27bc31(0x8c)+_0x42d9cd+_0x27bc31(0x75);}export async function getKeychainAPIKey(_0x4032ad){const _0x11d0a7=a55_0x2222,_0x57560b=await getKeychainAPIKeyWithStatus(_0x4032ad);if(_0x57560b[_0x11d0a7(0x6d)])return _0x57560b[_0x11d0a7(0x72)];return _0x57560b[_0x11d0a7(0x81)]===_0x11d0a7(0x7f)&&console[_0x11d0a7(0x87)](_0x11d0a7(0x78)+_0x57560b[_0x11d0a7(0x70)]),null;}export async function getKeychainAPIKeyWithStatus(_0x4a01af){const _0x407678=a55_0x2222;try{const _0x30a783=await getEntryClass();if(!_0x30a783)return{'success':![],'reason':_0x407678(0x82)};const _0x1008b1=getAccountName(_0x4a01af),_0x654225=new _0x30a783(SERVICE_NAME,_0x1008b1),_0x3c7be8=_0x654225[_0x407678(0x8d)]();if(_0x3c7be8)return{'success':!![],'value':_0x3c7be8};return{'success':![],'reason':_0x407678(0x7d)};}catch(_0x2899b4){const _0x39b3a7=_0x2899b4 instanceof Error?_0x2899b4[_0x407678(0x70)]:String(_0x2899b4);if(_0x39b3a7[_0x407678(0x85)](_0x407678(0x7c))||_0x39b3a7[_0x407678(0x7a)]()[_0x407678(0x85)]('could\x20not\x20be\x20found')||_0x39b3a7[_0x407678(0x7a)]()[_0x407678(0x85)](_0x407678(0x84))||_0x39b3a7[_0x407678(0x7a)]()[_0x407678(0x85)](_0x407678(0x7e)))return{'success':![],'reason':_0x407678(0x7d)};if(_0x39b3a7[_0x407678(0x85)]('-25293')||_0x39b3a7[_0x407678(0x7a)]()['includes'](_0x407678(0x7b))||_0x39b3a7[_0x407678(0x7a)]()[_0x407678(0x85)](_0x407678(0x73)))return{'success':![],'reason':_0x407678(0x7f),'message':_0x407678(0x6e)};return{'success':![],'reason':'unavailable','message':_0x39b3a7};}}export async function saveKeychainAPIKey(_0x25aea0,_0x3af903){const _0x18b857=a55_0x2222,_0x58d104=await getEntryClass();if(!_0x58d104)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x540a06=getAccountName(_0x3af903),_0xfd9230=new _0x58d104(SERVICE_NAME,_0x540a06);_0xfd9230[_0x18b857(0x8f)](_0x25aea0);}function a55_0x49f5(){const _0x2ecb2d=['9ROMYpK','1523296FSORGf','profile:','getPassword','1993940UWgEeA','setPassword','389lnOJzu','success','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','9ZuxrWA','message','573960hmYvdC','value','access','Entry',':api_key','not\x20available','7gsCCfF','Warning:\x20','355156nlwAPN','toLowerCase','restricted','-25300','not_found','no\x20matching\x20entry','access_denied','deleteCredential','reason','unavailable','1622nvCiyh','not\x20found','includes','1494414EXlIRh','error','55VQIAgJ','477640ZynUxL'];a55_0x49f5=function(){return _0x2ecb2d;};return a55_0x49f5();}export async function deleteKeychainAPIKey(_0x115db1){const _0x333f02=a55_0x2222;try{const _0x397978=await getEntryClass();if(!_0x397978)return![];const _0x29b251=getAccountName(_0x115db1),_0x87c67c=new _0x397978(SERVICE_NAME,_0x29b251);return _0x87c67c[_0x333f02(0x80)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x5c436a=a55_0x2222;try{const _0x7cf233=await getEntryClass();if(!_0x7cf233)return![];const _0x1cec3f=new _0x7cf233(SERVICE_NAME,'__keychain_test__');return _0x1cec3f[_0x5c436a(0x8d)](),!![];}catch(_0x499f91){const _0x392600=_0x499f91 instanceof Error?_0x499f91['message']['toLowerCase']():'';if(_0x392600['includes'](_0x5c436a(0x76))||_0x392600[_0x5c436a(0x85)]('not\x20supported')||_0x392600[_0x5c436a(0x85)]('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- const a56_0xf15402=a56_0x8480;function a56_0x3166(){const _0x384bd3=['Invalid\x20profile\x20name:\x20','from','\x20\x201.\x20Edit:\x20','stringify','toISOString','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x27\x20not\x20found\x20in\x20user\x20configuration','INVALID_PROFILE_CONFIG','name','10857834AfAxBi','3155444gVHXdD','isDirectory','profiles','\x20\x20mv\x20\x22','24575080dwiJtx','parent_segment','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','@tdx-studio','27nPzKNI','Warning:\x20Profile\x20\x27','12etNmGl','sort','\x0aWarning:\x20Failed\x20to\x20parse\x20','parse','rmSync','keys','Warning:\x20Failed\x20to\x20parse\x20','tdx.json','2969615clfHxT','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','map','string','directory','filter','local','.env','Profile\x20\x27','push','profile','35258QeKjVL','Profile\x20','existsSync','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','object','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','test','readFileSync','entries','warn','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x20does\x20not\x20exist','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','message','llm_agent',',\x20creating\x20new\x20file','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','join','values','user_info','llm_project','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','7omTSeQ','set','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','description','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','To\x20migrate:','readdirSync','utf-8','database','.env.','has','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x27:\x20unknown\x20config\x20key\x20\x27','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','2579600wPsKhi','site','includes','3659097TDJqoe'];a56_0x3166=function(){return _0x384bd3;};return a56_0x3166();}(function(_0x476047,_0x56a371){const _0x77197d=a56_0x8480,_0x1b2f8f=_0x476047();while(!![]){try{const _0x5ddb7e=parseInt(_0x77197d(0x11a))/0x1*(parseInt(_0x77197d(0x12f))/0x2)+parseInt(_0x77197d(0x157))/0x3+-parseInt(_0x77197d(0x162))/0x4+parseInt(_0x77197d(0x124))/0x5*(-parseInt(_0x77197d(0x11c))/0x6)+parseInt(_0x77197d(0x145))/0x7*(-parseInt(_0x77197d(0x154))/0x8)+-parseInt(_0x77197d(0x161))/0x9+parseInt(_0x77197d(0x166))/0xa;if(_0x5ddb7e===_0x56a371)break;else _0x1b2f8f['push'](_0x1b2f8f['shift']());}catch(_0x21a993){_0x1b2f8f['push'](_0x1b2f8f['shift']());}}}(a56_0x3166,0x9e1b7));import*as a56_0x16a455 from'node:fs';import*as a56_0x546625 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=a56_0xf15402(0x119);export function getProfileParams(_0x3e39f7){const _0xe3d45c=a56_0xf15402,_0x57a467={};if(!_0x3e39f7)return _0x57a467;for(const [_0x35b910,_0x20db30]of Object[_0xe3d45c(0x137)](_0x3e39f7)){_0x35b910!=='description'&&_0x20db30!==undefined&&(_0x57a467[_0x35b910]=_0x20db30);}return _0x57a467;}export function getProfilesDir(){const _0xc1701a=a56_0xf15402;return a56_0x546625[_0xc1701a(0x140)](getConfigDir(),'profiles');}function getProfileDir(_0x532fda){const _0x520cb7=a56_0xf15402;return a56_0x546625[_0x520cb7(0x140)](getProfilesDir(),_0x532fda);}function getProfileConfigPath(_0x4c72ff){const _0x412118=a56_0xf15402;return a56_0x546625[_0x412118(0x140)](getProfileDir(_0x4c72ff),_0x412118(0x123));}function getProfileEnvPath(_0x204315){const _0x55549c=a56_0xf15402;return a56_0x546625[_0x55549c(0x140)](getProfileDir(_0x204315),_0x55549c(0x12b));}function getGlobalConfigPath(){const _0x19016b=a56_0xf15402;return a56_0x546625['join'](getConfigDir(),_0x19016b(0x123));}function validateProfileName(_0x4336f2){const _0x435952=a56_0xf15402;if(/^@?[a-zA-Z0-9_-]+$/[_0x435952(0x135)](_0x4336f2))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/['test'](_0x4336f2))return;throw new Error(_0x435952(0x158)+_0x4336f2+_0x435952(0x147));}function validateProfileConfig(_0x4a6edb,_0x2cdbd6){const _0x17e621=a56_0xf15402;if(typeof _0x4a6edb!==_0x17e621(0x133)||_0x4a6edb===null)throw new SDKError(ErrorCode[_0x17e621(0x15f)],_0x17e621(0x12c)+_0x2cdbd6+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x2ce151=['description','site',_0x17e621(0x14e),_0x17e621(0x167),_0x17e621(0x143),'llm_agent',_0x17e621(0x142)],_0x26ee46=_0x4a6edb;for(const _0x576c28 of Object[_0x17e621(0x121)](_0x26ee46)){!_0x2ce151[_0x17e621(0x156)](_0x576c28)&&console[_0x17e621(0x138)](_0x17e621(0x11b)+_0x2cdbd6+_0x17e621(0x152)+_0x576c28+'\x27\x20will\x20be\x20ignored');}if(_0x26ee46[_0x17e621(0x149)]!==undefined&&typeof _0x26ee46[_0x17e621(0x149)]!==_0x17e621(0x127))throw new SDKError(ErrorCode[_0x17e621(0x15f)],_0x17e621(0x12c)+_0x2cdbd6+_0x17e621(0x134));if(_0x26ee46[_0x17e621(0x155)]!==undefined&&typeof _0x26ee46[_0x17e621(0x155)]!==_0x17e621(0x127))throw new SDKError(ErrorCode[_0x17e621(0x15f)],_0x17e621(0x12c)+_0x2cdbd6+_0x17e621(0x151));if(_0x26ee46[_0x17e621(0x14e)]!==undefined&&typeof _0x26ee46[_0x17e621(0x14e)]!==_0x17e621(0x127))throw new SDKError(ErrorCode[_0x17e621(0x15f)],_0x17e621(0x12c)+_0x2cdbd6+_0x17e621(0x14a));if(_0x26ee46[_0x17e621(0x167)]!==undefined&&typeof _0x26ee46[_0x17e621(0x167)]!==_0x17e621(0x127))throw new SDKError(ErrorCode[_0x17e621(0x15f)],_0x17e621(0x12c)+_0x2cdbd6+_0x17e621(0x144));if(_0x26ee46[_0x17e621(0x143)]!==undefined&&typeof _0x26ee46[_0x17e621(0x143)]!==_0x17e621(0x127))throw new SDKError(ErrorCode[_0x17e621(0x15f)],_0x17e621(0x12c)+_0x2cdbd6+_0x17e621(0x13f));if(_0x26ee46[_0x17e621(0x13d)]!==undefined&&typeof _0x26ee46[_0x17e621(0x13d)]!==_0x17e621(0x127))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x17e621(0x12c)+_0x2cdbd6+_0x17e621(0x139));return!![];}function loadProfilesFromTdxJson(_0x1114ed,_0x35719f){const _0x4245ea=a56_0xf15402;if(!a56_0x16a455[_0x4245ea(0x131)](_0x1114ed))return[];try{const _0x26d34c=a56_0x16a455[_0x4245ea(0x136)](_0x1114ed,'utf-8'),_0x23507a=JSON[_0x4245ea(0x11f)](_0x26d34c);if(!_0x23507a[_0x4245ea(0x164)]||typeof _0x23507a['profiles']!==_0x4245ea(0x133))return[];const _0x1c5641=[];for(const [_0xffd196,_0x5499b0]of Object[_0x4245ea(0x137)](_0x23507a['profiles'])){try{validateProfileConfig(_0x5499b0,_0xffd196);const _0x680b60=getNewCredentialPath(_0xffd196),_0x25fb52=getOldCredentialPath(_0xffd196),_0x49e089=a56_0x16a455[_0x4245ea(0x131)](_0x680b60)||a56_0x16a455['existsSync'](_0x25fb52);_0x1c5641[_0x4245ea(0x12d)]({'name':_0xffd196,'config':_0x5499b0,'metadata':{'name':_0xffd196,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x49e089,'scope':_0x35719f});}catch(_0x158231){_0x158231 instanceof Error&&(console[_0x4245ea(0x138)](_0x4245ea(0x13b)+_0x1114ed+':'),console[_0x4245ea(0x138)]('\x20\x20'+_0x158231[_0x4245ea(0x13c)]+'\x0a'));}}return _0x1c5641;}catch(_0x5e2847){return _0x5e2847 instanceof SyntaxError?(console['warn'](_0x4245ea(0x11e)+_0x1114ed+':\x20Invalid\x20JSON\x20syntax'),console[_0x4245ea(0x138)]('Error:\x20'+_0x5e2847[_0x4245ea(0x13c)]+'\x0a')):console[_0x4245ea(0x138)](_0x4245ea(0x15d)+_0x1114ed+':\x20'+_0x5e2847+'\x0a'),[];}}export function getNewCredentialPath(_0x12ce9b){const _0xed4337=a56_0xf15402;return a56_0x546625['join'](getConfigDir(),_0xed4337(0x14f)+_0x12ce9b);}function getOldCredentialPath(_0x12a92c){const _0x5a09fa=a56_0xf15402;return a56_0x546625[_0x5a09fa(0x140)](getProfilesDir(),_0x12a92c,_0x5a09fa(0x12b));}function loadProfilesFromTdxJsonFiles(){const _0x21a346=a56_0xf15402,_0x4f12a5=[],_0x13a3bf=findProjectConfigPath();_0x13a3bf&&_0x4f12a5[_0x21a346(0x12d)](...loadProfilesFromTdxJson(_0x13a3bf,_0x21a346(0x12a)));const _0x35c307=a56_0x546625[_0x21a346(0x140)](getConfigDir(),'tdx.json');return _0x4f12a5['push'](...loadProfilesFromTdxJson(_0x35c307,'user')),_0x4f12a5;}function loadProfilesFromDirectories(){const _0x5b0dec=a56_0xf15402,_0x28c70b=getProfilesDir();if(!a56_0x16a455[_0x5b0dec(0x131)](_0x28c70b))return[];try{return a56_0x16a455[_0x5b0dec(0x14c)](_0x28c70b,{'withFileTypes':!![]})['filter'](_0x2349cf=>_0x2349cf[_0x5b0dec(0x163)]())[_0x5b0dec(0x126)](_0x36affa=>_0x36affa[_0x5b0dec(0x160)])[_0x5b0dec(0x129)](_0x1d1289=>{const _0x2a588d=_0x5b0dec,_0x1b9cca=getProfileConfigPath(_0x1d1289),_0x39c2cd=getProfileEnvPath(_0x1d1289);return a56_0x16a455['existsSync'](_0x1b9cca)||a56_0x16a455[_0x2a588d(0x131)](_0x39c2cd);})[_0x5b0dec(0x126)](_0x27b190=>{const _0x70775a=_0x5b0dec,_0x32a7c6=loadProfileFromDirectory(_0x27b190);if(_0x32a7c6)return{..._0x32a7c6,'scope':_0x70775a(0x128)};return null;})[_0x5b0dec(0x129)](_0x2ad76=>_0x2ad76!==null);}catch{return[];}}function loadProfileFromDirectory(_0x54034a){const _0x1c595e=a56_0xf15402,_0x1b0383=getProfileConfigPath(_0x54034a),_0x495724=getOldCredentialPath(_0x54034a);if(!a56_0x16a455[_0x1c595e(0x131)](_0x1b0383)&&!a56_0x16a455['existsSync'](_0x495724))return null;let _0x195a72={},_0x2ba23c={'name':_0x54034a,'createdAt':new Date()[_0x1c595e(0x15c)]()};if(a56_0x16a455[_0x1c595e(0x131)](_0x1b0383))try{const _0x15befb=a56_0x16a455[_0x1c595e(0x136)](_0x1b0383,_0x1c595e(0x14d)),_0x3eeff3=JSON[_0x1c595e(0x11f)](_0x15befb),{metadata:_0x3c9041,..._0x212b4d}=_0x3eeff3;_0x195a72=_0x212b4d,_0x3c9041&&(_0x2ba23c=_0x3c9041);}catch{}return{'name':_0x54034a,'config':_0x195a72,'metadata':_0x2ba23c,'hasCredentials':a56_0x16a455[_0x1c595e(0x131)](_0x495724),'scope':_0x1c595e(0x128)};}export function listProfiles(){const _0x29f4ed=a56_0xf15402,_0x2577c9=loadProfilesFromTdxJsonFiles(),_0x5ff489=loadProfilesFromDirectories();if(_0x5ff489['length']>0x0){const _0x5c226c=_0x5ff489[_0x29f4ed(0x126)](_0x423c8d=>_0x423c8d[_0x29f4ed(0x160)])[_0x29f4ed(0x140)](',\x20'),_0x353898=getConfigDir();console[_0x29f4ed(0x138)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x5c226c),console[_0x29f4ed(0x138)](_0x29f4ed(0x168)),console[_0x29f4ed(0x138)](_0x29f4ed(0x15a)+a56_0x546625[_0x29f4ed(0x140)](_0x353898,_0x29f4ed(0x123))),console[_0x29f4ed(0x138)](_0x29f4ed(0x132)),console[_0x29f4ed(0x138)](_0x29f4ed(0x125));}const _0x32c336=[..._0x2577c9,..._0x5ff489],_0x4f6c72=new Map();for(const _0x58bb6d of _0x32c336){!_0x4f6c72[_0x29f4ed(0x150)](_0x58bb6d[_0x29f4ed(0x160)])&&_0x4f6c72[_0x29f4ed(0x146)](_0x58bb6d[_0x29f4ed(0x160)],_0x58bb6d);}return Array[_0x29f4ed(0x159)](_0x4f6c72[_0x29f4ed(0x141)]())[_0x29f4ed(0x11d)]((_0x4b0b6d,_0x2c3204)=>_0x4b0b6d[_0x29f4ed(0x160)]['localeCompare'](_0x2c3204[_0x29f4ed(0x160)]));}export function profileExists(_0x2053f6){const _0x2491ba=a56_0xf15402,_0x44b6b9=listProfiles();return _0x44b6b9['some'](_0x4bb0d2=>_0x4bb0d2[_0x2491ba(0x160)]===_0x2053f6);}export function loadProfile(_0x179814){const _0x172c2e=a56_0xf15402;validateProfileName(_0x179814);const _0x581f9d=listProfiles(),_0x487ac2=_0x581f9d['find'](_0x23f926=>_0x23f926[_0x172c2e(0x160)]===_0x179814);return _0x487ac2||null;}export function saveProfile(_0x59bf6c,_0x4ebf01,_0x4c1ad7=![]){saveProfileToUserConfig(_0x59bf6c,_0x4ebf01);}export function deleteProfile(_0x4c421f){const _0x5b53d0=a56_0xf15402;validateProfileName(_0x4c421f);const _0x19a64e=getProfileDir(_0x4c421f);if(!a56_0x16a455[_0x5b53d0(0x131)](_0x19a64e))throw new Error('Profile\x20'+_0x4c421f+_0x5b53d0(0x13a));a56_0x16a455[_0x5b53d0(0x120)](_0x19a64e,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x2a568c,_0x1bd81f){const _0x3f2b97=a56_0xf15402;validateProfileName(_0x2a568c);const _0x2742dc=getGlobalConfigPath(),_0x12dd4d=getConfigDir();!a56_0x16a455[_0x3f2b97(0x131)](_0x12dd4d)&&createSecureDirectory(_0x12dd4d);let _0x3104b0={};if(a56_0x16a455[_0x3f2b97(0x131)](_0x2742dc))try{const _0x39c5d0=a56_0x16a455[_0x3f2b97(0x136)](_0x2742dc,_0x3f2b97(0x14d));_0x3104b0=JSON['parse'](_0x39c5d0);}catch{console['warn'](_0x3f2b97(0x122)+_0x2742dc+',\x20creating\x20new\x20file');}!_0x3104b0['profiles']&&(_0x3104b0['profiles']={}),_0x3104b0[_0x3f2b97(0x164)][_0x2a568c]=_0x1bd81f,writeSecureFile(_0x2742dc,JSON[_0x3f2b97(0x15b)](_0x3104b0,null,0x2));}function a56_0x8480(_0x2b8f55,_0x2aa834){_0x2b8f55=_0x2b8f55-0x119;const _0x3166b2=a56_0x3166();let _0x84804c=_0x3166b2[_0x2b8f55];return _0x84804c;}export function removeProfileFromUserConfig(_0x59e8c3){const _0x3d9466=a56_0xf15402;validateProfileName(_0x59e8c3);const _0x34792d=getGlobalConfigPath();if(!a56_0x16a455[_0x3d9466(0x131)](_0x34792d))throw new Error(_0x3d9466(0x12c)+_0x59e8c3+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x31d41d={};try{const _0x2ec360=a56_0x16a455['readFileSync'](_0x34792d,_0x3d9466(0x14d));_0x31d41d=JSON['parse'](_0x2ec360);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0x34792d);}if(!_0x31d41d[_0x3d9466(0x164)]||!_0x31d41d[_0x3d9466(0x164)][_0x59e8c3])throw new Error(_0x3d9466(0x12c)+_0x59e8c3+_0x3d9466(0x15e));delete _0x31d41d[_0x3d9466(0x164)][_0x59e8c3],_0x31d41d['profile']===_0x59e8c3&&delete _0x31d41d['profile'],writeSecureFile(_0x34792d,JSON[_0x3d9466(0x15b)](_0x31d41d,null,0x2));}export function getActiveProfile(){const _0x5d47e5=a56_0xf15402,_0x4af444=loadSessionContext();if(_0x4af444?.[_0x5d47e5(0x12e)])return _0x4af444[_0x5d47e5(0x12e)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1e2c74=getGlobalConfigPath();if(!a56_0x16a455['existsSync'](_0x1e2c74))return null;try{const _0x38a752=a56_0x16a455[_0x5d47e5(0x136)](_0x1e2c74,'utf-8'),_0x24ef4b=JSON[_0x5d47e5(0x11f)](_0x38a752);return _0x24ef4b[_0x5d47e5(0x12e)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x4b6a82){const _0x41a6fd=a56_0xf15402,_0x2896e6=getGlobalConfigPath(),_0x274fef=getConfigDir();!a56_0x16a455[_0x41a6fd(0x131)](_0x274fef)&&createSecureDirectory(_0x274fef);let _0x38760e={};if(a56_0x16a455[_0x41a6fd(0x131)](_0x2896e6))try{const _0x1d8cf1=a56_0x16a455[_0x41a6fd(0x136)](_0x2896e6,'utf-8');_0x38760e=JSON[_0x41a6fd(0x11f)](_0x1d8cf1);}catch{console[_0x41a6fd(0x138)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x2896e6+_0x41a6fd(0x13e));}_0x38760e[_0x41a6fd(0x155)]=_0x4b6a82,writeSecureFile(_0x2896e6,JSON['stringify'](_0x38760e,null,0x2));}export function saveActiveProfileToUserConfig(_0x1e0e94){const _0x4f0882=a56_0xf15402;validateProfileName(_0x1e0e94);const _0x548983=getGlobalConfigPath(),_0x2dbf2a=getConfigDir();!a56_0x16a455['existsSync'](_0x2dbf2a)&&createSecureDirectory(_0x2dbf2a);let _0x1e7857={};if(a56_0x16a455[_0x4f0882(0x131)](_0x548983))try{const _0x27fcd9=a56_0x16a455[_0x4f0882(0x136)](_0x548983,_0x4f0882(0x14d));_0x1e7857=JSON['parse'](_0x27fcd9);}catch{console[_0x4f0882(0x138)](_0x4f0882(0x122)+_0x548983+_0x4f0882(0x13e));}_0x1e7857[_0x4f0882(0x12e)]=_0x1e0e94,writeSecureFile(_0x548983,JSON[_0x4f0882(0x15b)](_0x1e7857,null,0x2));}function clearFieldFromUserConfig(_0x27e85a){const _0x47d59c=a56_0xf15402,_0x2794f2=getGlobalConfigPath();if(!a56_0x16a455[_0x47d59c(0x131)](_0x2794f2))return;let _0x3f7c82={};try{const _0x14d96a=a56_0x16a455[_0x47d59c(0x136)](_0x2794f2,_0x47d59c(0x14d));_0x3f7c82=JSON[_0x47d59c(0x11f)](_0x14d96a);}catch{return;}delete _0x3f7c82[_0x27e85a],writeSecureFile(_0x2794f2,JSON[_0x47d59c(0x15b)](_0x3f7c82,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x21c79b=a56_0xf15402;clearFieldFromUserConfig(_0x21c79b(0x155));}export function clearActiveProfileFromUserConfig(){const _0x3bc9ba=a56_0xf15402;clearFieldFromUserConfig(_0x3bc9ba(0x12e));}export function createProfile(_0x479a4b,_0x2f73d4){const _0x2dc9bb=a56_0xf15402;validateProfileName(_0x479a4b);if(profileExists(_0x479a4b))throw new Error(_0x2dc9bb(0x130)+_0x479a4b+'\x20already\x20exists');saveProfile(_0x479a4b,_0x2f73d4);}export function saveProfileCredentials(_0x3f1fa7,_0x2c55ca){const _0x4abb78=a56_0xf15402;validateProfileName(_0x3f1fa7);if(!profileExists(_0x3f1fa7))throw new Error('Profile\x20'+_0x3f1fa7+_0x4abb78(0x13a));const _0x58f5ee=getNewCredentialPath(_0x3f1fa7);writeSecureFile(_0x58f5ee,_0x2c55ca);}export function loadProfileCredentials(_0x309370){const _0x2de96b=a56_0xf15402;validateProfileName(_0x309370);const _0x3cbeee=getNewCredentialPath(_0x309370);if(a56_0x16a455[_0x2de96b(0x131)](_0x3cbeee))try{return a56_0x16a455[_0x2de96b(0x136)](_0x3cbeee,_0x2de96b(0x14d));}catch{}const _0x3e6b08=getOldCredentialPath(_0x309370);if(a56_0x16a455[_0x2de96b(0x131)](_0x3e6b08)){console[_0x2de96b(0x138)](_0x2de96b(0x148)+_0x309370+'\x27'),console[_0x2de96b(0x138)](_0x2de96b(0x14b)),console[_0x2de96b(0x138)](_0x2de96b(0x165)+_0x3e6b08+'\x22\x20\x22'+_0x3cbeee+'\x22'),console[_0x2de96b(0x138)](_0x2de96b(0x153));try{return a56_0x16a455[_0x2de96b(0x136)](_0x3e6b08,'utf-8');}catch{return null;}}return null;}
1
+ const a56_0x323c63=a56_0x93d0;(function(_0x4fe1d2,_0x12537f){const _0x2f3c5a=a56_0x93d0,_0x540116=_0x4fe1d2();while(!![]){try{const _0x5812c2=-parseInt(_0x2f3c5a(0xe6))/0x1+-parseInt(_0x2f3c5a(0xbd))/0x2+parseInt(_0x2f3c5a(0xbc))/0x3*(-parseInt(_0x2f3c5a(0xce))/0x4)+-parseInt(_0x2f3c5a(0xe2))/0x5*(-parseInt(_0x2f3c5a(0xe4))/0x6)+-parseInt(_0x2f3c5a(0xd5))/0x7+-parseInt(_0x2f3c5a(0xb3))/0x8*(parseInt(_0x2f3c5a(0xae))/0x9)+parseInt(_0x2f3c5a(0xc8))/0xa;if(_0x5812c2===_0x12537f)break;else _0x540116['push'](_0x540116['shift']());}catch(_0x408d9e){_0x540116['push'](_0x540116['shift']());}}}(a56_0x2913,0x88eda));import*as a56_0x511fed from'node:fs';import*as a56_0x10c310 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=a56_0x323c63(0xda);export function getProfileParams(_0x39d493){const _0x187dca=a56_0x323c63,_0x33c424={};if(!_0x39d493)return _0x33c424;for(const [_0x2c1c43,_0x423728]of Object[_0x187dca(0xbb)](_0x39d493)){_0x2c1c43!==_0x187dca(0xb5)&&_0x423728!==undefined&&(_0x33c424[_0x2c1c43]=_0x423728);}return _0x33c424;}export function getProfilesDir(){const _0x320cbe=a56_0x323c63;return a56_0x10c310['join'](getConfigDir(),_0x320cbe(0xe7));}function getProfileDir(_0x1d12fa){const _0xda6845=a56_0x323c63;return a56_0x10c310[_0xda6845(0xe8)](getProfilesDir(),_0x1d12fa);}function a56_0x93d0(_0x44dd28,_0x409b4a){_0x44dd28=_0x44dd28-0xac;const _0x2913c0=a56_0x2913();let _0x93d009=_0x2913c0[_0x44dd28];return _0x93d009;}function getProfileConfigPath(_0x18a7ae){const _0x16e219=a56_0x323c63;return a56_0x10c310[_0x16e219(0xe8)](getProfileDir(_0x18a7ae),_0x16e219(0xf9));}function getProfileEnvPath(_0x219e54){const _0x39b9c0=a56_0x323c63;return a56_0x10c310[_0x39b9c0(0xe8)](getProfileDir(_0x219e54),_0x39b9c0(0xf1));}function getGlobalConfigPath(){const _0x40ec31=a56_0x323c63;return a56_0x10c310[_0x40ec31(0xe8)](getConfigDir(),'tdx.json');}function validateProfileName(_0x17d829){const _0x94367f=a56_0x323c63;if(/^@?[a-zA-Z0-9_-]+$/[_0x94367f(0xdb)](_0x17d829))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/[_0x94367f(0xdb)](_0x17d829))return;throw new Error(_0x94367f(0xc5)+_0x17d829+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function a56_0x2913(){const _0x5d8cc6=['7476184tYPKfb','keys','description','database','\x20does\x20not\x20exist','\x0aWarning:\x20Failed\x20to\x20parse\x20','readdirSync','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','entries','672eIlQGO','155168ILGLXn','parent_segment','stringify','directory','isDirectory','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x20\x201.\x20Edit:\x20','message','Invalid\x20profile\x20name:\x20','user','values','29768190adrEHk','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Error:\x20','map','llm_project','9508XoXnkM',':\x20Invalid\x20JSON\x20syntax','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','name','Profile\x20','Profile\x20\x27','set','4835453GlNLZH','warn','find','utf-8','user_info','@tdx-studio','test','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','includes','\x27\x20will\x20be\x20ignored','sort','\x27:\x20config\x20must\x20be\x20an\x20object','755405vLpvZm','string','30Objsbw','\x27:\x20unknown\x20config\x20key\x20\x27','936032LFVGua','profiles','join','readFileSync','profile','object','Warning:\x20Failed\x20to\x20parse\x20','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x27\x20not\x20found\x20in\x20user\x20configuration','filter','.env',',\x20creating\x20new\x20file','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','push','Failed\x20to\x20parse\x20','parse','existsSync','from','tdx.json','site','rmSync','Warning:\x20Profile\x20\x27','INVALID_PROFILE_CONFIG','9kzfLWq','\x22\x20\x22','\x20already\x20exists','toISOString','llm_agent'];a56_0x2913=function(){return _0x5d8cc6;};return a56_0x2913();}function validateProfileConfig(_0x52f84b,_0x3bbf45){const _0x178c89=a56_0x323c63;if(typeof _0x52f84b!==_0x178c89(0xeb)||_0x52f84b===null)throw new SDKError(ErrorCode[_0x178c89(0xad)],'Profile\x20\x27'+_0x3bbf45+_0x178c89(0xe1));const _0x5a0f11=[_0x178c89(0xb5),_0x178c89(0xfa),'database',_0x178c89(0xbe),'llm_project',_0x178c89(0xb2),_0x178c89(0xd9)],_0x109f8f=_0x52f84b;for(const _0x13fbe6 of Object[_0x178c89(0xb4)](_0x109f8f)){!_0x5a0f11[_0x178c89(0xde)](_0x13fbe6)&&console[_0x178c89(0xd6)](_0x178c89(0xac)+_0x3bbf45+_0x178c89(0xe5)+_0x13fbe6+_0x178c89(0xdf));}if(_0x109f8f[_0x178c89(0xb5)]!==undefined&&typeof _0x109f8f['description']!==_0x178c89(0xe3))throw new SDKError(ErrorCode[_0x178c89(0xad)],_0x178c89(0xd3)+_0x3bbf45+_0x178c89(0xf3));if(_0x109f8f[_0x178c89(0xfa)]!==undefined&&typeof _0x109f8f['site']!==_0x178c89(0xe3))throw new SDKError(ErrorCode[_0x178c89(0xad)],_0x178c89(0xd3)+_0x3bbf45+_0x178c89(0xca));if(_0x109f8f[_0x178c89(0xb6)]!==undefined&&typeof _0x109f8f[_0x178c89(0xb6)]!==_0x178c89(0xe3))throw new SDKError(ErrorCode[_0x178c89(0xad)],'Profile\x20\x27'+_0x3bbf45+_0x178c89(0xdc));if(_0x109f8f[_0x178c89(0xbe)]!==undefined&&typeof _0x109f8f[_0x178c89(0xbe)]!=='string')throw new SDKError(ErrorCode[_0x178c89(0xad)],_0x178c89(0xd3)+_0x3bbf45+_0x178c89(0xc9));if(_0x109f8f[_0x178c89(0xcd)]!==undefined&&typeof _0x109f8f[_0x178c89(0xcd)]!==_0x178c89(0xe3))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x3bbf45+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x109f8f[_0x178c89(0xb2)]!==undefined&&typeof _0x109f8f[_0x178c89(0xb2)]!==_0x178c89(0xe3))throw new SDKError(ErrorCode[_0x178c89(0xad)],_0x178c89(0xd3)+_0x3bbf45+_0x178c89(0xc2));return!![];}function loadProfilesFromTdxJson(_0x497ad1,_0x182c60){const _0x504e4c=a56_0x323c63;if(!a56_0x511fed[_0x504e4c(0xf7)](_0x497ad1))return[];try{const _0xd5823d=a56_0x511fed['readFileSync'](_0x497ad1,_0x504e4c(0xd8)),_0x1ed016=JSON[_0x504e4c(0xf6)](_0xd5823d);if(!_0x1ed016['profiles']||typeof _0x1ed016[_0x504e4c(0xe7)]!==_0x504e4c(0xeb))return[];const _0xa82108=[];for(const [_0x268180,_0x72fb88]of Object[_0x504e4c(0xbb)](_0x1ed016[_0x504e4c(0xe7)])){try{validateProfileConfig(_0x72fb88,_0x268180);const _0x1feddc=getNewCredentialPath(_0x268180),_0x320de8=getOldCredentialPath(_0x268180),_0x42b1bd=a56_0x511fed['existsSync'](_0x1feddc)||a56_0x511fed[_0x504e4c(0xf7)](_0x320de8);_0xa82108[_0x504e4c(0xf4)]({'name':_0x268180,'config':_0x72fb88,'metadata':{'name':_0x268180,'createdAt':new Date()[_0x504e4c(0xb1)]()},'hasCredentials':_0x42b1bd,'scope':_0x182c60});}catch(_0x2991c7){_0x2991c7 instanceof Error&&(console[_0x504e4c(0xd6)](_0x504e4c(0xba)+_0x497ad1+':'),console['warn']('\x20\x20'+_0x2991c7['message']+'\x0a'));}}return _0xa82108;}catch(_0x3fe4bb){return _0x3fe4bb instanceof SyntaxError?(console[_0x504e4c(0xd6)](_0x504e4c(0xb8)+_0x497ad1+_0x504e4c(0xcf)),console[_0x504e4c(0xd6)](_0x504e4c(0xcb)+_0x3fe4bb[_0x504e4c(0xc4)]+'\x0a')):console['warn']('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x497ad1+':\x20'+_0x3fe4bb+'\x0a'),[];}}export function getNewCredentialPath(_0x50904e){return a56_0x10c310['join'](getConfigDir(),'.env.'+_0x50904e);}function getOldCredentialPath(_0x2b1ef3){const _0x3c82fe=a56_0x323c63;return a56_0x10c310[_0x3c82fe(0xe8)](getProfilesDir(),_0x2b1ef3,_0x3c82fe(0xf1));}function loadProfilesFromTdxJsonFiles(){const _0x9debae=a56_0x323c63,_0x583fa1=[],_0x1bb5ed=findProjectConfigPath();_0x1bb5ed&&_0x583fa1[_0x9debae(0xf4)](...loadProfilesFromTdxJson(_0x1bb5ed,'local'));const _0x408c4e=a56_0x10c310[_0x9debae(0xe8)](getConfigDir(),'tdx.json');return _0x583fa1[_0x9debae(0xf4)](...loadProfilesFromTdxJson(_0x408c4e,_0x9debae(0xc6))),_0x583fa1;}function loadProfilesFromDirectories(){const _0x1017d6=a56_0x323c63,_0x510d32=getProfilesDir();if(!a56_0x511fed[_0x1017d6(0xf7)](_0x510d32))return[];try{return a56_0x511fed[_0x1017d6(0xb9)](_0x510d32,{'withFileTypes':!![]})['filter'](_0x2de75b=>_0x2de75b[_0x1017d6(0xc1)]())[_0x1017d6(0xcc)](_0x365546=>_0x365546[_0x1017d6(0xd1)])[_0x1017d6(0xf0)](_0x28a7a4=>{const _0x2fc0bb=_0x1017d6,_0x172a76=getProfileConfigPath(_0x28a7a4),_0x186c67=getProfileEnvPath(_0x28a7a4);return a56_0x511fed[_0x2fc0bb(0xf7)](_0x172a76)||a56_0x511fed[_0x2fc0bb(0xf7)](_0x186c67);})[_0x1017d6(0xcc)](_0x571dd9=>{const _0x20f250=loadProfileFromDirectory(_0x571dd9);if(_0x20f250)return{..._0x20f250,'scope':'directory'};return null;})['filter'](_0x1e9906=>_0x1e9906!==null);}catch{return[];}}function loadProfileFromDirectory(_0x36fe4a){const _0x4761d5=a56_0x323c63,_0x18f728=getProfileConfigPath(_0x36fe4a),_0x11e808=getOldCredentialPath(_0x36fe4a);if(!a56_0x511fed[_0x4761d5(0xf7)](_0x18f728)&&!a56_0x511fed[_0x4761d5(0xf7)](_0x11e808))return null;let _0x340dd1={},_0x4c7209={'name':_0x36fe4a,'createdAt':new Date()['toISOString']()};if(a56_0x511fed['existsSync'](_0x18f728))try{const _0x52c7a8=a56_0x511fed['readFileSync'](_0x18f728,_0x4761d5(0xd8)),_0x3a989f=JSON['parse'](_0x52c7a8),{metadata:_0x4b57bc,..._0x249000}=_0x3a989f;_0x340dd1=_0x249000,_0x4b57bc&&(_0x4c7209=_0x4b57bc);}catch{}return{'name':_0x36fe4a,'config':_0x340dd1,'metadata':_0x4c7209,'hasCredentials':a56_0x511fed[_0x4761d5(0xf7)](_0x11e808),'scope':_0x4761d5(0xc0)};}export function listProfiles(){const _0x13b0e4=a56_0x323c63,_0x558bc6=loadProfilesFromTdxJsonFiles(),_0x195741=loadProfilesFromDirectories();if(_0x195741['length']>0x0){const _0x50b33c=_0x195741[_0x13b0e4(0xcc)](_0x143c92=>_0x143c92[_0x13b0e4(0xd1)])[_0x13b0e4(0xe8)](',\x20'),_0x5dc50f=getConfigDir();console[_0x13b0e4(0xd6)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x50b33c),console[_0x13b0e4(0xd6)](_0x13b0e4(0xed)),console[_0x13b0e4(0xd6)](_0x13b0e4(0xc3)+a56_0x10c310[_0x13b0e4(0xe8)](_0x5dc50f,_0x13b0e4(0xf9))),console[_0x13b0e4(0xd6)](_0x13b0e4(0xdd)),console[_0x13b0e4(0xd6)](_0x13b0e4(0xee));}const _0x4fb3ea=[..._0x558bc6,..._0x195741],_0xb45dc6=new Map();for(const _0x4eff41 of _0x4fb3ea){!_0xb45dc6['has'](_0x4eff41[_0x13b0e4(0xd1)])&&_0xb45dc6[_0x13b0e4(0xd4)](_0x4eff41[_0x13b0e4(0xd1)],_0x4eff41);}return Array[_0x13b0e4(0xf8)](_0xb45dc6[_0x13b0e4(0xc7)]())[_0x13b0e4(0xe0)]((_0x6d737d,_0x260aa8)=>_0x6d737d['name']['localeCompare'](_0x260aa8[_0x13b0e4(0xd1)]));}export function profileExists(_0x4d84ea){const _0x3b80f8=a56_0x323c63,_0x3132a0=listProfiles();return _0x3132a0['some'](_0x501164=>_0x501164[_0x3b80f8(0xd1)]===_0x4d84ea);}export function loadProfile(_0x519876){const _0x49ac9a=a56_0x323c63;validateProfileName(_0x519876);const _0x19f3a1=listProfiles(),_0x49a1ca=_0x19f3a1[_0x49ac9a(0xd7)](_0x54dab7=>_0x54dab7[_0x49ac9a(0xd1)]===_0x519876);return _0x49a1ca||null;}export function saveProfile(_0x46b054,_0x1c7f7d,_0x2bc1a4=![]){saveProfileToUserConfig(_0x46b054,_0x1c7f7d);}export function deleteProfile(_0x2289ef){const _0x16a1a3=a56_0x323c63;validateProfileName(_0x2289ef);const _0x247c6c=getProfileDir(_0x2289ef);if(!a56_0x511fed[_0x16a1a3(0xf7)](_0x247c6c))throw new Error(_0x16a1a3(0xd2)+_0x2289ef+_0x16a1a3(0xb7));a56_0x511fed[_0x16a1a3(0xfb)](_0x247c6c,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4a6af4,_0x323fbc){const _0x3ef5de=a56_0x323c63;validateProfileName(_0x4a6af4);const _0x2b0456=getGlobalConfigPath(),_0x51b185=getConfigDir();!a56_0x511fed[_0x3ef5de(0xf7)](_0x51b185)&&createSecureDirectory(_0x51b185);let _0x33e574={};if(a56_0x511fed[_0x3ef5de(0xf7)](_0x2b0456))try{const _0x59a33b=a56_0x511fed['readFileSync'](_0x2b0456,_0x3ef5de(0xd8));_0x33e574=JSON[_0x3ef5de(0xf6)](_0x59a33b);}catch{console[_0x3ef5de(0xd6)](_0x3ef5de(0xec)+_0x2b0456+_0x3ef5de(0xf2));}!_0x33e574[_0x3ef5de(0xe7)]&&(_0x33e574[_0x3ef5de(0xe7)]={}),_0x33e574[_0x3ef5de(0xe7)][_0x4a6af4]=_0x323fbc,writeSecureFile(_0x2b0456,JSON[_0x3ef5de(0xbf)](_0x33e574,null,0x2));}export function removeProfileFromUserConfig(_0x36c06e){const _0x6ec1e9=a56_0x323c63;validateProfileName(_0x36c06e);const _0x38bfa0=getGlobalConfigPath();if(!a56_0x511fed[_0x6ec1e9(0xf7)](_0x38bfa0))throw new Error(_0x6ec1e9(0xd3)+_0x36c06e+_0x6ec1e9(0xef));let _0x25982e={};try{const _0x2e5d84=a56_0x511fed[_0x6ec1e9(0xe9)](_0x38bfa0,_0x6ec1e9(0xd8));_0x25982e=JSON[_0x6ec1e9(0xf6)](_0x2e5d84);}catch{throw new Error(_0x6ec1e9(0xf5)+_0x38bfa0);}if(!_0x25982e[_0x6ec1e9(0xe7)]||!_0x25982e[_0x6ec1e9(0xe7)][_0x36c06e])throw new Error(_0x6ec1e9(0xd3)+_0x36c06e+_0x6ec1e9(0xef));delete _0x25982e[_0x6ec1e9(0xe7)][_0x36c06e],_0x25982e[_0x6ec1e9(0xea)]===_0x36c06e&&delete _0x25982e['profile'],writeSecureFile(_0x38bfa0,JSON[_0x6ec1e9(0xbf)](_0x25982e,null,0x2));}export function getActiveProfile(){const _0x539a65=a56_0x323c63,_0x2d37b0=loadSessionContext();if(_0x2d37b0?.['profile'])return _0x2d37b0[_0x539a65(0xea)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x2dac64=getGlobalConfigPath();if(!a56_0x511fed[_0x539a65(0xf7)](_0x2dac64))return null;try{const _0x178543=a56_0x511fed['readFileSync'](_0x2dac64,_0x539a65(0xd8)),_0xf1207f=JSON['parse'](_0x178543);return _0xf1207f['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x468ea9){const _0x389ca7=a56_0x323c63,_0x1ff58f=getGlobalConfigPath(),_0x49d534=getConfigDir();!a56_0x511fed['existsSync'](_0x49d534)&&createSecureDirectory(_0x49d534);let _0x32f18d={};if(a56_0x511fed[_0x389ca7(0xf7)](_0x1ff58f))try{const _0x778836=a56_0x511fed[_0x389ca7(0xe9)](_0x1ff58f,_0x389ca7(0xd8));_0x32f18d=JSON[_0x389ca7(0xf6)](_0x778836);}catch{console[_0x389ca7(0xd6)](_0x389ca7(0xec)+_0x1ff58f+_0x389ca7(0xf2));}_0x32f18d['site']=_0x468ea9,writeSecureFile(_0x1ff58f,JSON['stringify'](_0x32f18d,null,0x2));}export function saveActiveProfileToUserConfig(_0x4fe012){const _0x5d0267=a56_0x323c63;validateProfileName(_0x4fe012);const _0x444c20=getGlobalConfigPath(),_0x50dd46=getConfigDir();!a56_0x511fed[_0x5d0267(0xf7)](_0x50dd46)&&createSecureDirectory(_0x50dd46);let _0x31608a={};if(a56_0x511fed[_0x5d0267(0xf7)](_0x444c20))try{const _0x2e692e=a56_0x511fed[_0x5d0267(0xe9)](_0x444c20,'utf-8');_0x31608a=JSON[_0x5d0267(0xf6)](_0x2e692e);}catch{console['warn'](_0x5d0267(0xec)+_0x444c20+',\x20creating\x20new\x20file');}_0x31608a['profile']=_0x4fe012,writeSecureFile(_0x444c20,JSON[_0x5d0267(0xbf)](_0x31608a,null,0x2));}function clearFieldFromUserConfig(_0x1e568a){const _0x5a3703=a56_0x323c63,_0x2c79e6=getGlobalConfigPath();if(!a56_0x511fed[_0x5a3703(0xf7)](_0x2c79e6))return;let _0x59a6c9={};try{const _0x27ab40=a56_0x511fed['readFileSync'](_0x2c79e6,_0x5a3703(0xd8));_0x59a6c9=JSON[_0x5a3703(0xf6)](_0x27ab40);}catch{return;}delete _0x59a6c9[_0x1e568a],writeSecureFile(_0x2c79e6,JSON[_0x5a3703(0xbf)](_0x59a6c9,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x27beae=a56_0x323c63;clearFieldFromUserConfig(_0x27beae(0xfa));}export function clearActiveProfileFromUserConfig(){const _0x436793=a56_0x323c63;clearFieldFromUserConfig(_0x436793(0xea));}export function createProfile(_0x182ddb,_0x387957){const _0x58b9a8=a56_0x323c63;validateProfileName(_0x182ddb);if(profileExists(_0x182ddb))throw new Error(_0x58b9a8(0xd2)+_0x182ddb+_0x58b9a8(0xb0));saveProfile(_0x182ddb,_0x387957);}export function saveProfileCredentials(_0x1c1c84,_0x19a3fc){const _0x44965a=a56_0x323c63;validateProfileName(_0x1c1c84);if(!profileExists(_0x1c1c84))throw new Error(_0x44965a(0xd2)+_0x1c1c84+_0x44965a(0xb7));const _0x27c054=getNewCredentialPath(_0x1c1c84);writeSecureFile(_0x27c054,_0x19a3fc);}export function loadProfileCredentials(_0x3859ac){const _0x295f74=a56_0x323c63;validateProfileName(_0x3859ac);const _0x3d8df4=getNewCredentialPath(_0x3859ac);if(a56_0x511fed['existsSync'](_0x3d8df4))try{return a56_0x511fed[_0x295f74(0xe9)](_0x3d8df4,_0x295f74(0xd8));}catch{}const _0x29a363=getOldCredentialPath(_0x3859ac);if(a56_0x511fed[_0x295f74(0xf7)](_0x29a363)){console[_0x295f74(0xd6)](_0x295f74(0xd0)+_0x3859ac+'\x27'),console[_0x295f74(0xd6)]('To\x20migrate:'),console[_0x295f74(0xd6)]('\x20\x20mv\x20\x22'+_0x29a363+_0x295f74(0xaf)+_0x3d8df4+'\x22'),console[_0x295f74(0xd6)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a56_0x511fed['readFileSync'](_0x29a363,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a57_0x2e8f59=a57_0x2dfc;function a57_0x2d7c(){const _0x443079=['1rHwCIX','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','198YzszhI','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','api_key','profile','code','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','\x20is\x20ignored.\x20','291458vreZUC','stringify','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','1462937rCnqtH','cwd','Failed\x20to\x20load\x20project\x20config\x20from\x20','join','TD_API_KEY','6022530TrqGqO',').\x20','writeFileSync','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','32crSiAt','243420JahTjv','5259848CRZirk','654993cVYrWi','includes','existsSync','ENOENT','apiKey','551550gbhAGK','readFileSync','dirname','tdx.json'];a57_0x2d7c=function(){return _0x443079;};return a57_0x2d7c();}(function(_0x13f3f6,_0x2e44c4){const _0x5e66d2=a57_0x2dfc,_0x5a77fa=_0x13f3f6();while(!![]){try{const _0x4a52dc=-parseInt(_0x5e66d2(0xcb))/0x1*(-parseInt(_0x5e66d2(0xd4))/0x2)+parseInt(_0x5e66d2(0xe3))/0x3+-parseInt(_0x5e66d2(0xe2))/0x4+-parseInt(_0x5e66d2(0xe1))/0x5*(-parseInt(_0x5e66d2(0xcd))/0x6)+parseInt(_0x5e66d2(0xd7))/0x7*(parseInt(_0x5e66d2(0xe0))/0x8)+-parseInt(_0x5e66d2(0xdc))/0x9+parseInt(_0x5e66d2(0xc7))/0xa;if(_0x4a52dc===_0x2e44c4)break;else _0x5a77fa['push'](_0x5a77fa['shift']());}catch(_0x534ab3){_0x5a77fa['push'](_0x5a77fa['shift']());}}}(a57_0x2d7c,0xd6433));import*as a57_0x5cab70 from'node:fs';import*as a57_0x3f007f from'node:path';const PROJECT_CONFIG_FILENAME=a57_0x2e8f59(0xca);function a57_0x2dfc(_0x5d1b51,_0x4c8090){_0x5d1b51=_0x5d1b51-0xc4;const _0x2d7cd0=a57_0x2d7c();let _0x2dfc60=_0x2d7cd0[_0x5d1b51];return _0x2dfc60;}export function findProjectConfigPath(_0x27c381){const _0x1b6c31=a57_0x2e8f59;let _0x2be207=_0x27c381||process[_0x1b6c31(0xd8)]();while(!![]){const _0x2c32d2=a57_0x3f007f[_0x1b6c31(0xda)](_0x2be207,PROJECT_CONFIG_FILENAME);if(a57_0x5cab70[_0x1b6c31(0xc4)](_0x2c32d2))return _0x2c32d2;const _0x3206f5=a57_0x3f007f[_0x1b6c31(0xc9)](_0x2be207);if(_0x3206f5===_0x2be207)return null;_0x2be207=_0x3206f5;}}export function loadProjectConfig(_0x5a7380){const _0x1fd08c=a57_0x2e8f59,_0x2a8d58=findProjectConfigPath(_0x5a7380);if(!_0x2a8d58)return null;try{const _0x8319b5=a57_0x5cab70[_0x1fd08c(0xc8)](_0x2a8d58,'utf-8'),_0x27dbf5=JSON['parse'](_0x8319b5),_0x2ac981=JSON[_0x1fd08c(0xd5)](_0x27dbf5);if(_0x2ac981[_0x1fd08c(0xe4)](_0x1fd08c(0xdb))||_0x2ac981[_0x1fd08c(0xe4)](_0x1fd08c(0xc6))||_0x2ac981['includes'](_0x1fd08c(0xcf)))throw new Error(_0x1fd08c(0xd2)+_0x2a8d58+_0x1fd08c(0xdd)+_0x1fd08c(0xd6));const {metadata:_0x1680b5,profile:_0x5d1cbf,..._0x132f43}=_0x27dbf5;return _0x5d1cbf&&console['warn']('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x2a8d58+_0x1fd08c(0xd3)+_0x1fd08c(0xce)),_0x132f43;}catch(_0x1136f0){if(_0x1136f0 instanceof Error&&'code'in _0x1136f0&&_0x1136f0[_0x1fd08c(0xd1)]===_0x1fd08c(0xc5))return null;throw new Error(_0x1fd08c(0xd9)+_0x2a8d58+':\x20'+_0x1136f0);}}export function saveProjectConfig(_0x98973b,_0x4ae353){const _0x58f2e8=a57_0x2e8f59,_0x13356e=_0x4ae353||process[_0x58f2e8(0xd8)](),_0x1483c5=a57_0x3f007f[_0x58f2e8(0xda)](_0x13356e,PROJECT_CONFIG_FILENAME),_0x22e704=JSON[_0x58f2e8(0xd5)](_0x98973b);if(_0x22e704[_0x58f2e8(0xe4)](_0x58f2e8(0xdb))||_0x22e704['includes'](_0x58f2e8(0xc6))||_0x22e704[_0x58f2e8(0xe4)](_0x58f2e8(0xcf)))throw new Error(_0x58f2e8(0xcc));if(_0x58f2e8(0xd0)in _0x98973b)throw new Error(_0x58f2e8(0xdf));a57_0x5cab70[_0x58f2e8(0xde)](_0x1483c5,JSON[_0x58f2e8(0xd5)](_0x98973b,null,0x2));}export function hasProjectConfig(_0xbfd560){return findProjectConfigPath(_0xbfd560)!==null;}export function getProjectRoot(_0x10c371){const _0x17f13c=a57_0x2e8f59,_0x5e7b8b=findProjectConfigPath(_0x10c371);return _0x5e7b8b?a57_0x3f007f[_0x17f13c(0xc9)](_0x5e7b8b):null;}
1
+ const a57_0x12fedc=a57_0x433f;function a57_0x426f(){const _0x5143d0=['2226nhvSvT','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.',').\x20','18iyQBMw','3ayKDXK','utf-8','TD_API_KEY','651721QktRuS','writeFileSync','stringify','9364092CQXgYu','code','5459224SXdAbp','24qfUtVe','profile','tdx.json','api_key','Warning:\x20\x27profile\x27\x20field\x20in\x20','6937780qWWWqf','6588790dtXfyK','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','ENOENT','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','Failed\x20to\x20load\x20project\x20config\x20from\x20','\x20is\x20ignored.\x20','131WHFpqL','includes','join','apiKey','readFileSync','existsSync','cwd','18606698sVYQni'];a57_0x426f=function(){return _0x5143d0;};return a57_0x426f();}(function(_0x21a36b,_0x551f2c){const _0x51d63c=a57_0x433f,_0x5bae27=_0x21a36b();while(!![]){try{const _0x3f053f=-parseInt(_0x51d63c(0x1d4))/0x1*(parseInt(_0x51d63c(0x1dc))/0x2)+-parseInt(_0x51d63c(0x1e0))/0x3*(-parseInt(_0x51d63c(0x1c6))/0x4)+parseInt(_0x51d63c(0x1cc))/0x5+parseInt(_0x51d63c(0x1c4))/0x6+parseInt(_0x51d63c(0x1c1))/0x7*(-parseInt(_0x51d63c(0x1c7))/0x8)+-parseInt(_0x51d63c(0x1df))/0x9*(parseInt(_0x51d63c(0x1cd))/0xa)+-parseInt(_0x51d63c(0x1db))/0xb;if(_0x3f053f===_0x551f2c)break;else _0x5bae27['push'](_0x5bae27['shift']());}catch(_0x448229){_0x5bae27['push'](_0x5bae27['shift']());}}}(a57_0x426f,0xd6840));import*as a57_0x51e8b2 from'node:fs';import*as a57_0xc4a898 from'node:path';const PROJECT_CONFIG_FILENAME=a57_0x12fedc(0x1c9);export function findProjectConfigPath(_0x4d6886){const _0x3b8118=a57_0x12fedc;let _0x140be2=_0x4d6886||process[_0x3b8118(0x1da)]();while(!![]){const _0x13f238=a57_0xc4a898['join'](_0x140be2,PROJECT_CONFIG_FILENAME);if(a57_0x51e8b2[_0x3b8118(0x1d9)](_0x13f238))return _0x13f238;const _0x7f9c55=a57_0xc4a898['dirname'](_0x140be2);if(_0x7f9c55===_0x140be2)return null;_0x140be2=_0x7f9c55;}}export function loadProjectConfig(_0x23a433){const _0x51f9a2=a57_0x12fedc,_0x38c0ea=findProjectConfigPath(_0x23a433);if(!_0x38c0ea)return null;try{const _0x17562e=a57_0x51e8b2[_0x51f9a2(0x1d8)](_0x38c0ea,_0x51f9a2(0x1e1)),_0x5c7d69=JSON['parse'](_0x17562e),_0x59c3f3=JSON[_0x51f9a2(0x1c3)](_0x5c7d69);if(_0x59c3f3['includes']('TD_API_KEY')||_0x59c3f3[_0x51f9a2(0x1d5)]('apiKey')||_0x59c3f3['includes'](_0x51f9a2(0x1ca)))throw new Error(_0x51f9a2(0x1d1)+_0x38c0ea+_0x51f9a2(0x1de)+_0x51f9a2(0x1dd));const {metadata:_0x1ecbbe,profile:_0x5b8d78,..._0x44a41a}=_0x5c7d69;return _0x5b8d78&&console['warn'](_0x51f9a2(0x1cb)+_0x38c0ea+_0x51f9a2(0x1d3)+_0x51f9a2(0x1ce)),_0x44a41a;}catch(_0x39e917){if(_0x39e917 instanceof Error&&_0x51f9a2(0x1c5)in _0x39e917&&_0x39e917[_0x51f9a2(0x1c5)]===_0x51f9a2(0x1d0))return null;throw new Error(_0x51f9a2(0x1d2)+_0x38c0ea+':\x20'+_0x39e917);}}export function saveProjectConfig(_0x16794a,_0x126f6f){const _0x5262ce=a57_0x12fedc,_0x25bb07=_0x126f6f||process[_0x5262ce(0x1da)](),_0x2b63d2=a57_0xc4a898[_0x5262ce(0x1d6)](_0x25bb07,PROJECT_CONFIG_FILENAME),_0x42e15b=JSON[_0x5262ce(0x1c3)](_0x16794a);if(_0x42e15b[_0x5262ce(0x1d5)](_0x5262ce(0x1e2))||_0x42e15b[_0x5262ce(0x1d5)](_0x5262ce(0x1d7))||_0x42e15b['includes'](_0x5262ce(0x1ca)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x5262ce(0x1c8)in _0x16794a)throw new Error(_0x5262ce(0x1cf));a57_0x51e8b2[_0x5262ce(0x1c2)](_0x2b63d2,JSON[_0x5262ce(0x1c3)](_0x16794a,null,0x2));}export function hasProjectConfig(_0x3b9b54){return findProjectConfigPath(_0x3b9b54)!==null;}function a57_0x433f(_0x357e36,_0x244217){_0x357e36=_0x357e36-0x1c1;const _0x426ff5=a57_0x426f();let _0x433f45=_0x426ff5[_0x357e36];return _0x433f45;}export function getProjectRoot(_0x1c871b){const _0x1d0d2a=findProjectConfigPath(_0x1c871b);return _0x1d0d2a?a57_0xc4a898['dirname'](_0x1d0d2a):null;}
@@ -1 +1 @@
1
- (function(_0x22464c,_0xef9032){const _0x4df7d0=a58_0x5a31,_0x19b558=_0x22464c();while(!![]){try{const _0x44eeb7=-parseInt(_0x4df7d0(0x193))/0x1*(-parseInt(_0x4df7d0(0x17b))/0x2)+parseInt(_0x4df7d0(0x180))/0x3*(-parseInt(_0x4df7d0(0x192))/0x4)+-parseInt(_0x4df7d0(0x189))/0x5+parseInt(_0x4df7d0(0x18c))/0x6*(parseInt(_0x4df7d0(0x181))/0x7)+parseInt(_0x4df7d0(0x175))/0x8*(parseInt(_0x4df7d0(0x174))/0x9)+-parseInt(_0x4df7d0(0x18d))/0xa*(-parseInt(_0x4df7d0(0x17d))/0xb)+-parseInt(_0x4df7d0(0x16f))/0xc*(parseInt(_0x4df7d0(0x177))/0xd);if(_0x44eeb7===_0xef9032)break;else _0x19b558['push'](_0x19b558['shift']());}catch(_0x43a4a4){_0x19b558['push'](_0x19b558['shift']());}}}(a58_0x540d,0x31855));import*as a58_0x49dbbe from'node:fs';import*as a58_0x3cdc93 from'node:path';import*as a58_0x55e36f 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 _0x2520d9=a58_0x5a31,_0x3760d4=process.env.TDX_CONFIG_DIR||a58_0x3cdc93[_0x2520d9(0x188)](a58_0x55e36f[_0x2520d9(0x182)](),'.config',_0x2520d9(0x184));return a58_0x3cdc93[_0x2520d9(0x188)](_0x3760d4,_0x2520d9(0x196));}function getSessionPath(_0x5f3aaf){const _0x4f3787=a58_0x5a31;return a58_0x3cdc93[_0x4f3787(0x188)](getSessionsDir(),_0x5f3aaf+_0x4f3787(0x17a));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x19131c){const _0x963f2f=a58_0x5a31;if(_0x19131c)return _0x19131c;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x963f2f(0x179)]();}export function loadSessionContext(_0x57d4aa){const _0x3b595f=a58_0x5a31,_0x3ab69c=getSessionID(_0x57d4aa),_0x46741e=/^\d+$/[_0x3b595f(0x186)](_0x3ab69c)?parseInt(_0x3ab69c,0xa):null;return _0x46741e!==null?loadSessionContextByPID(_0x46741e):loadSessionContextByString(_0x3ab69c);}function a58_0x5a31(_0xa64e7c,_0x1fb744){_0xa64e7c=_0xa64e7c-0x16e;const _0x540dfa=a58_0x540d();let _0x5a315e=_0x540dfa[_0xa64e7c];return _0x5a315e;}function a58_0x540d(){const _0x3b5119=['1793627NTQnrd','warn','readdirSync','3XsDvTx','2123597JnvnLD','homedir','includes','tdx','api_key','test','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','join','1531390xfgvzU','TD_API_KEY','readFileSync','6MKWDyG','10VHFQfU','createdAt','stringify','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','toISOString','11636zlxccj','79TVxLjM','push','apiKey','sessions','writeFileSync','endsWith','525648nItLOj','unlinkSync','getTime','parse','existsSync','63sjZlNj','21128gAOYKa','now','104tdCJwj','replace','toString','.json','9558UeEicW','utf-8'];a58_0x540d=function(){return _0x3b5119;};return a58_0x540d();}export function loadSessionContextByPID(_0xba416a){const _0x44bd84=a58_0x5a31,_0x4e94b0=getSessionPath(_0xba416a);if(!a58_0x49dbbe[_0x44bd84(0x173)](_0x4e94b0))return null;try{const _0xc04066=a58_0x49dbbe[_0x44bd84(0x18b)](_0x4e94b0,_0x44bd84(0x17c)),_0x405462=JSON[_0x44bd84(0x172)](_0xc04066),_0x5c8721=new Date(_0x405462[_0x44bd84(0x18e)])[_0x44bd84(0x171)](),_0xd87c71=Date['now']();if(_0xd87c71-_0x5c8721>SESSION_EXPIRATION_MS)return a58_0x49dbbe[_0x44bd84(0x170)](_0x4e94b0),null;const _0x3cf86a=JSON[_0x44bd84(0x18f)](_0x405462);if(_0x3cf86a[_0x44bd84(0x183)](_0x44bd84(0x18a))||_0x3cf86a[_0x44bd84(0x183)]('apiKey')||_0x3cf86a[_0x44bd84(0x183)](_0x44bd84(0x185)))return console[_0x44bd84(0x17e)](_0x44bd84(0x190)+_0x4e94b0+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a58_0x49dbbe[_0x44bd84(0x170)](_0x4e94b0),null;return _0x405462;}catch{try{a58_0x49dbbe['unlinkSync'](_0x4e94b0);}catch{}return null;}}function loadSessionContextByString(_0xd92906){const _0x4d9186=a58_0x5a31,_0x6bdead=a58_0x3cdc93['join'](getSessionsDir(),_0xd92906+_0x4d9186(0x17a));if(!a58_0x49dbbe[_0x4d9186(0x173)](_0x6bdead))return null;try{const _0x3f6392=a58_0x49dbbe[_0x4d9186(0x18b)](_0x6bdead,_0x4d9186(0x17c)),_0x55ad59=JSON[_0x4d9186(0x172)](_0x3f6392),_0x3520d5=new Date(_0x55ad59[_0x4d9186(0x18e)])['getTime'](),_0x4a5cbf=Date['now']();if(_0x4a5cbf-_0x3520d5>SESSION_EXPIRATION_MS)return a58_0x49dbbe[_0x4d9186(0x170)](_0x6bdead),null;const _0x4a253a=JSON[_0x4d9186(0x18f)](_0x55ad59);if(_0x4a253a['includes'](_0x4d9186(0x18a))||_0x4a253a[_0x4d9186(0x183)](_0x4d9186(0x195))||_0x4a253a[_0x4d9186(0x183)](_0x4d9186(0x185)))return console[_0x4d9186(0x17e)](_0x4d9186(0x190)+_0x6bdead+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a58_0x49dbbe[_0x4d9186(0x170)](_0x6bdead),null;return _0x55ad59;}catch{try{a58_0x49dbbe[_0x4d9186(0x170)](_0x6bdead);}catch{}return null;}}export function saveSessionContext(_0x4973d7,_0x8e7b84){const _0x26c723=a58_0x5a31,_0x46317f=getSessionID(_0x8e7b84),_0x4abfb9=/^\d+$/[_0x26c723(0x186)](_0x46317f)?parseInt(_0x46317f,0xa):getCurrentSessionPID(),_0x1f85cf=a58_0x3cdc93[_0x26c723(0x188)](getSessionsDir(),_0x46317f+_0x26c723(0x17a)),_0x51a5cf=getSessionsDir();createSecureDirectory(_0x51a5cf);const _0x2380b0=JSON[_0x26c723(0x18f)](_0x4973d7);if(_0x2380b0[_0x26c723(0x183)]('TD_API_KEY')||_0x2380b0[_0x26c723(0x183)]('apiKey')||_0x2380b0['includes'](_0x26c723(0x185)))throw new Error(_0x26c723(0x187));let _0x11ab34;const _0x20f616=/^\d+$/[_0x26c723(0x186)](_0x46317f)?loadSessionContextByPID(parseInt(_0x46317f,0xa)):loadSessionContextByString(_0x46317f);_0x20f616?_0x11ab34={..._0x20f616,..._0x4973d7,'pid':_0x4abfb9,'sessionId':_0x46317f!==_0x4abfb9[_0x26c723(0x179)]()?_0x46317f:undefined,'updatedAt':new Date()[_0x26c723(0x191)]()}:_0x11ab34={'pid':_0x4abfb9,'sessionId':_0x46317f!==_0x4abfb9[_0x26c723(0x179)]()?_0x46317f:undefined,..._0x4973d7,'createdAt':new Date()[_0x26c723(0x191)](),'updatedAt':new Date()[_0x26c723(0x191)]()},a58_0x49dbbe['writeFileSync'](_0x1f85cf,JSON[_0x26c723(0x18f)](_0x11ab34,null,0x2));}export function clearSessionContext(_0x10339b){const _0x2accb0=a58_0x5a31,_0x69d44c=getSessionID(_0x10339b),_0x170911=a58_0x3cdc93[_0x2accb0(0x188)](getSessionsDir(),_0x69d44c+_0x2accb0(0x17a));a58_0x49dbbe[_0x2accb0(0x173)](_0x170911)&&a58_0x49dbbe['unlinkSync'](_0x170911);}export function clearSessionContextField(_0x57af3b,_0xdc0808){const _0x5230a9=a58_0x5a31,_0xaa826=getSessionID(_0xdc0808),_0x53cdf1=a58_0x3cdc93['join'](getSessionsDir(),_0xaa826+_0x5230a9(0x17a));if(!a58_0x49dbbe[_0x5230a9(0x173)](_0x53cdf1))return;try{const _0x4792b5=a58_0x49dbbe['readFileSync'](_0x53cdf1,_0x5230a9(0x17c)),_0xecab33=JSON['parse'](_0x4792b5);delete _0xecab33[_0x57af3b],a58_0x49dbbe[_0x5230a9(0x197)](_0x53cdf1,JSON[_0x5230a9(0x18f)](_0xecab33,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x241a90=a58_0x5a31,_0x409b53=getSessionsDir();if(!a58_0x49dbbe[_0x241a90(0x173)](_0x409b53))return 0x0;let _0x42ab49=0x0;const _0x4cd6ad=Date[_0x241a90(0x176)]();try{const _0x398770=a58_0x49dbbe[_0x241a90(0x17f)](_0x409b53);for(const _0x2ee5c6 of _0x398770){if(!_0x2ee5c6[_0x241a90(0x16e)](_0x241a90(0x17a)))continue;const _0x2fe083=a58_0x3cdc93[_0x241a90(0x188)](_0x409b53,_0x2ee5c6),_0x4f9b13=_0x2ee5c6[_0x241a90(0x178)](_0x241a90(0x17a),''),_0x32d348=parseInt(_0x4f9b13,0xa),_0xdf9089=!isNaN(_0x32d348);if(_0xdf9089){if(!isProcessRunning(_0x32d348)){a58_0x49dbbe[_0x241a90(0x170)](_0x2fe083),_0x42ab49++;continue;}}try{const _0x1ce02a=a58_0x49dbbe['readFileSync'](_0x2fe083,_0x241a90(0x17c)),_0xc2efd0=JSON[_0x241a90(0x172)](_0x1ce02a),_0x55d719=new Date(_0xc2efd0[_0x241a90(0x18e)])['getTime']();_0x4cd6ad-_0x55d719>SESSION_EXPIRATION_MS&&(a58_0x49dbbe[_0x241a90(0x170)](_0x2fe083),_0x42ab49++);}catch{a58_0x49dbbe[_0x241a90(0x170)](_0x2fe083),_0x42ab49++;}}}catch{}return _0x42ab49;}export function listActiveSessions(){const _0x56a5c4=a58_0x5a31,_0x41b00d=getSessionsDir();if(!a58_0x49dbbe[_0x56a5c4(0x173)](_0x41b00d))return[];try{const _0x54142a=a58_0x49dbbe[_0x56a5c4(0x17f)](_0x41b00d),_0x2352d4=[];for(const _0x4ab2ef of _0x54142a){if(!_0x4ab2ef[_0x56a5c4(0x16e)](_0x56a5c4(0x17a)))continue;const _0x1534d6=_0x4ab2ef[_0x56a5c4(0x178)](_0x56a5c4(0x17a),''),_0x513778=parseInt(_0x1534d6,0xa);!isNaN(_0x513778)&&isProcessRunning(_0x513778)&&_0x2352d4[_0x56a5c4(0x194)](_0x513778);}return _0x2352d4['sort']((_0x132d75,_0xf82473)=>_0x132d75-_0xf82473);}catch{return[];}}
1
+ (function(_0x51ffee,_0x16e0c1){const _0x11f371=a58_0x1141,_0x330b55=_0x51ffee();while(!![]){try{const _0x280ba1=parseInt(_0x11f371(0x1d8))/0x1*(parseInt(_0x11f371(0x1df))/0x2)+parseInt(_0x11f371(0x1d0))/0x3+-parseInt(_0x11f371(0x1db))/0x4+-parseInt(_0x11f371(0x1d2))/0x5+-parseInt(_0x11f371(0x1da))/0x6*(-parseInt(_0x11f371(0x1f3))/0x7)+parseInt(_0x11f371(0x1ef))/0x8*(-parseInt(_0x11f371(0x1d3))/0x9)+parseInt(_0x11f371(0x1e4))/0xa;if(_0x280ba1===_0x16e0c1)break;else _0x330b55['push'](_0x330b55['shift']());}catch(_0x465459){_0x330b55['push'](_0x330b55['shift']());}}}(a58_0x4cc9,0x5dd46));import*as a58_0x241720 from'node:fs';import*as a58_0x22d66f from'node:path';import*as a58_0x246ef7 from'node:os';function a58_0x4cc9(){const _0x122045=['now','parse','push','1208268TKwDhN','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','3281580FMCcOn','279DYwXQv','replace','apiKey','.json','unlinkSync','516VVHwjb','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','6oeOlDa','2989560Uvcrul','getTime','stringify','test','2946KUNxAg','toString','readFileSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','sort','6758990oXwdbl','.config','utf-8','includes','warn','TD_API_KEY','sessions','join','existsSync','createdAt','endsWith','72752LkgagS','readdirSync','writeFileSync','toISOString','1618561QfYGvq','api_key','tdx'];a58_0x4cc9=function(){return _0x122045;};return a58_0x4cc9();}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 _0x4d3033=a58_0x1141,_0x5afb4e=process.env.TDX_CONFIG_DIR||a58_0x22d66f[_0x4d3033(0x1eb)](a58_0x246ef7['homedir'](),_0x4d3033(0x1e5),_0x4d3033(0x1f5));return a58_0x22d66f[_0x4d3033(0x1eb)](_0x5afb4e,_0x4d3033(0x1ea));}function getSessionPath(_0x4651ca){const _0x1b3f68=a58_0x1141;return a58_0x22d66f[_0x1b3f68(0x1eb)](getSessionsDir(),_0x4651ca+_0x1b3f68(0x1d6));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x4b1654){if(_0x4b1654)return _0x4b1654;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x49b6c6){const _0x1c62c2=a58_0x1141,_0x15dd32=getSessionID(_0x49b6c6),_0x36dde9=/^\d+$/[_0x1c62c2(0x1de)](_0x15dd32)?parseInt(_0x15dd32,0xa):null;return _0x36dde9!==null?loadSessionContextByPID(_0x36dde9):loadSessionContextByString(_0x15dd32);}function a58_0x1141(_0x12c2d9,_0x5f2414){_0x12c2d9=_0x12c2d9-0x1d0;const _0x4cc9c8=a58_0x4cc9();let _0x1141fc=_0x4cc9c8[_0x12c2d9];return _0x1141fc;}export function loadSessionContextByPID(_0x5ae96b){const _0x3e054d=a58_0x1141,_0x315ec4=getSessionPath(_0x5ae96b);if(!a58_0x241720[_0x3e054d(0x1ec)](_0x315ec4))return null;try{const _0x129480=a58_0x241720[_0x3e054d(0x1e1)](_0x315ec4,_0x3e054d(0x1e6)),_0x3feb1a=JSON[_0x3e054d(0x1f7)](_0x129480),_0x4b22d9=new Date(_0x3feb1a['createdAt'])[_0x3e054d(0x1dc)](),_0x194050=Date[_0x3e054d(0x1f6)]();if(_0x194050-_0x4b22d9>SESSION_EXPIRATION_MS)return a58_0x241720[_0x3e054d(0x1d7)](_0x315ec4),null;const _0x1ff6ac=JSON[_0x3e054d(0x1dd)](_0x3feb1a);if(_0x1ff6ac['includes']('TD_API_KEY')||_0x1ff6ac[_0x3e054d(0x1e7)](_0x3e054d(0x1d5))||_0x1ff6ac[_0x3e054d(0x1e7)]('api_key'))return console[_0x3e054d(0x1e8)](_0x3e054d(0x1d9)+_0x315ec4+_0x3e054d(0x1e2)),a58_0x241720[_0x3e054d(0x1d7)](_0x315ec4),null;return _0x3feb1a;}catch{try{a58_0x241720['unlinkSync'](_0x315ec4);}catch{}return null;}}function loadSessionContextByString(_0x3dd34a){const _0x46d6c3=a58_0x1141,_0x2b4c24=a58_0x22d66f[_0x46d6c3(0x1eb)](getSessionsDir(),_0x3dd34a+_0x46d6c3(0x1d6));if(!a58_0x241720[_0x46d6c3(0x1ec)](_0x2b4c24))return null;try{const _0x3942ac=a58_0x241720[_0x46d6c3(0x1e1)](_0x2b4c24,'utf-8'),_0x5d779c=JSON[_0x46d6c3(0x1f7)](_0x3942ac),_0x268a3e=new Date(_0x5d779c[_0x46d6c3(0x1ed)])[_0x46d6c3(0x1dc)](),_0x58d2ca=Date[_0x46d6c3(0x1f6)]();if(_0x58d2ca-_0x268a3e>SESSION_EXPIRATION_MS)return a58_0x241720[_0x46d6c3(0x1d7)](_0x2b4c24),null;const _0x500ee4=JSON[_0x46d6c3(0x1dd)](_0x5d779c);if(_0x500ee4[_0x46d6c3(0x1e7)]('TD_API_KEY')||_0x500ee4[_0x46d6c3(0x1e7)]('apiKey')||_0x500ee4[_0x46d6c3(0x1e7)]('api_key'))return console[_0x46d6c3(0x1e8)](_0x46d6c3(0x1d9)+_0x2b4c24+_0x46d6c3(0x1e2)),a58_0x241720['unlinkSync'](_0x2b4c24),null;return _0x5d779c;}catch{try{a58_0x241720[_0x46d6c3(0x1d7)](_0x2b4c24);}catch{}return null;}}export function saveSessionContext(_0x3e4a82,_0xd7d857){const _0x5c3d59=a58_0x1141,_0x2061d0=getSessionID(_0xd7d857),_0x300f2c=/^\d+$/[_0x5c3d59(0x1de)](_0x2061d0)?parseInt(_0x2061d0,0xa):getCurrentSessionPID(),_0x33df57=a58_0x22d66f['join'](getSessionsDir(),_0x2061d0+_0x5c3d59(0x1d6)),_0x47ec89=getSessionsDir();createSecureDirectory(_0x47ec89);const _0x52e1d6=JSON[_0x5c3d59(0x1dd)](_0x3e4a82);if(_0x52e1d6[_0x5c3d59(0x1e7)](_0x5c3d59(0x1e9))||_0x52e1d6[_0x5c3d59(0x1e7)](_0x5c3d59(0x1d5))||_0x52e1d6[_0x5c3d59(0x1e7)](_0x5c3d59(0x1f4)))throw new Error(_0x5c3d59(0x1d1));let _0x4a059e;const _0x1db6a5=/^\d+$/[_0x5c3d59(0x1de)](_0x2061d0)?loadSessionContextByPID(parseInt(_0x2061d0,0xa)):loadSessionContextByString(_0x2061d0);_0x1db6a5?_0x4a059e={..._0x1db6a5,..._0x3e4a82,'pid':_0x300f2c,'sessionId':_0x2061d0!==_0x300f2c[_0x5c3d59(0x1e0)]()?_0x2061d0:undefined,'updatedAt':new Date()[_0x5c3d59(0x1f2)]()}:_0x4a059e={'pid':_0x300f2c,'sessionId':_0x2061d0!==_0x300f2c[_0x5c3d59(0x1e0)]()?_0x2061d0:undefined,..._0x3e4a82,'createdAt':new Date()[_0x5c3d59(0x1f2)](),'updatedAt':new Date()['toISOString']()},a58_0x241720['writeFileSync'](_0x33df57,JSON[_0x5c3d59(0x1dd)](_0x4a059e,null,0x2));}export function clearSessionContext(_0x429b87){const _0x26970e=a58_0x1141,_0x206b7a=getSessionID(_0x429b87),_0x4dd5ac=a58_0x22d66f[_0x26970e(0x1eb)](getSessionsDir(),_0x206b7a+_0x26970e(0x1d6));a58_0x241720['existsSync'](_0x4dd5ac)&&a58_0x241720[_0x26970e(0x1d7)](_0x4dd5ac);}export function clearSessionContextField(_0x4b4417,_0x22fae8){const _0x4a010d=a58_0x1141,_0x29d8b5=getSessionID(_0x22fae8),_0x350201=a58_0x22d66f['join'](getSessionsDir(),_0x29d8b5+'.json');if(!a58_0x241720[_0x4a010d(0x1ec)](_0x350201))return;try{const _0xea80c4=a58_0x241720['readFileSync'](_0x350201,'utf-8'),_0x609e69=JSON['parse'](_0xea80c4);delete _0x609e69[_0x4b4417],a58_0x241720[_0x4a010d(0x1f1)](_0x350201,JSON[_0x4a010d(0x1dd)](_0x609e69,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x50814c=a58_0x1141,_0x187626=getSessionsDir();if(!a58_0x241720['existsSync'](_0x187626))return 0x0;let _0x199c0e=0x0;const _0x50b120=Date[_0x50814c(0x1f6)]();try{const _0x8c95e=a58_0x241720['readdirSync'](_0x187626);for(const _0x33deb2 of _0x8c95e){if(!_0x33deb2[_0x50814c(0x1ee)](_0x50814c(0x1d6)))continue;const _0xc9c0b0=a58_0x22d66f[_0x50814c(0x1eb)](_0x187626,_0x33deb2),_0xff5e75=_0x33deb2[_0x50814c(0x1d4)](_0x50814c(0x1d6),''),_0x27ff5e=parseInt(_0xff5e75,0xa),_0x197f03=!isNaN(_0x27ff5e);if(_0x197f03){if(!isProcessRunning(_0x27ff5e)){a58_0x241720[_0x50814c(0x1d7)](_0xc9c0b0),_0x199c0e++;continue;}}try{const _0x34d429=a58_0x241720[_0x50814c(0x1e1)](_0xc9c0b0,_0x50814c(0x1e6)),_0x4c0251=JSON['parse'](_0x34d429),_0x9bc4dd=new Date(_0x4c0251[_0x50814c(0x1ed)])[_0x50814c(0x1dc)]();_0x50b120-_0x9bc4dd>SESSION_EXPIRATION_MS&&(a58_0x241720[_0x50814c(0x1d7)](_0xc9c0b0),_0x199c0e++);}catch{a58_0x241720[_0x50814c(0x1d7)](_0xc9c0b0),_0x199c0e++;}}}catch{}return _0x199c0e;}export function listActiveSessions(){const _0x50473d=a58_0x1141,_0x4feb58=getSessionsDir();if(!a58_0x241720[_0x50473d(0x1ec)](_0x4feb58))return[];try{const _0x480dc4=a58_0x241720[_0x50473d(0x1f0)](_0x4feb58),_0x589724=[];for(const _0x5432b6 of _0x480dc4){if(!_0x5432b6[_0x50473d(0x1ee)]('.json'))continue;const _0x8d545e=_0x5432b6[_0x50473d(0x1d4)](_0x50473d(0x1d6),''),_0x33531a=parseInt(_0x8d545e,0xa);!isNaN(_0x33531a)&&isProcessRunning(_0x33531a)&&_0x589724[_0x50473d(0x1f8)](_0x33531a);}return _0x589724[_0x50473d(0x1e3)]((_0x33c019,_0x330875)=>_0x33c019-_0x330875);}catch{return[];}}
@@ -1 +1 @@
1
- function a59_0x360a(){const _0x287ca0=['core/user-cache','write','1506682xvvVAz','4734450ZrJikF','4ugahvI','now','3014994vZtIqg','4522068ycHiLa','users','4096488BSISdH','read','1071063ZWMajT','users-{profile}.json','3114258GQDytz'];a59_0x360a=function(){return _0x287ca0;};return a59_0x360a();}const a59_0x36d27c=a59_0x40b6;(function(_0x227892,_0x5910de){const _0x5a2602=a59_0x40b6,_0x44d11b=_0x227892();while(!![]){try{const _0x50e7bc=parseInt(_0x5a2602(0x7f))/0x1+-parseInt(_0x5a2602(0x84))/0x2+parseInt(_0x5a2602(0x88))/0x3*(parseInt(_0x5a2602(0x86))/0x4)+parseInt(_0x5a2602(0x85))/0x5+-parseInt(_0x5a2602(0x89))/0x6+-parseInt(_0x5a2602(0x81))/0x7+-parseInt(_0x5a2602(0x8b))/0x8;if(_0x50e7bc===_0x5910de)break;else _0x44d11b['push'](_0x44d11b['shift']());}catch(_0x3fc42b){_0x44d11b['push'](_0x44d11b['shift']());}}}(a59_0x360a,0x88781));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a59_0x36d27c(0x80),a59_0x36d27c(0x82));function a59_0x40b6(_0xbd462a,_0xe7056e){_0xbd462a=_0xbd462a-0x7f;const _0x360a14=a59_0x360a();let _0x40b637=_0x360a14[_0xbd462a];return _0x40b637;}export function loadCachedUsers(_0x45046a){const _0x178db8=a59_0x36d27c,_0x477dcc=userCache[_0x178db8(0x8c)](_0x45046a);return _0x477dcc?.[_0x178db8(0x8a)]??null;}export function saveCachedUsers(_0x4c2c91,_0x2886c6){const _0xf34fb3=a59_0x36d27c;userCache[_0xf34fb3(0x83)](_0x4c2c91,{'users':_0x2886c6,'cachedAt':Date[_0xf34fb3(0x87)]()});}export function clearUserCache(_0x25494f){userCache['clear'](_0x25494f);}
1
+ const a59_0x503dd6=a59_0x10d9;(function(_0x9de7d1,_0x3a6992){const _0x2446c3=a59_0x10d9,_0x1153a3=_0x9de7d1();while(!![]){try{const _0x5c6920=-parseInt(_0x2446c3(0x1d1))/0x1*(parseInt(_0x2446c3(0x1d2))/0x2)+-parseInt(_0x2446c3(0x1da))/0x3*(parseInt(_0x2446c3(0x1d5))/0x4)+parseInt(_0x2446c3(0x1db))/0x5*(parseInt(_0x2446c3(0x1cf))/0x6)+parseInt(_0x2446c3(0x1d8))/0x7+parseInt(_0x2446c3(0x1d0))/0x8+-parseInt(_0x2446c3(0x1df))/0x9*(-parseInt(_0x2446c3(0x1de))/0xa)+-parseInt(_0x2446c3(0x1d9))/0xb;if(_0x5c6920===_0x3a6992)break;else _0x1153a3['push'](_0x1153a3['shift']());}catch(_0xbc7373){_0x1153a3['push'](_0x1153a3['shift']());}}}(a59_0x33f9,0xe1084));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a59_0x503dd6(0x1d4),a59_0x503dd6(0x1dd));function a59_0x10d9(_0x41062e,_0x3bb70a){_0x41062e=_0x41062e-0x1cf;const _0x33f9f9=a59_0x33f9();let _0x10d99f=_0x33f9f9[_0x41062e];return _0x10d99f;}export function loadCachedUsers(_0x1f1811){const _0x36a2e2=a59_0x503dd6,_0x226d4d=userCache['read'](_0x1f1811);return _0x226d4d?.[_0x36a2e2(0x1d3)]??null;}export function saveCachedUsers(_0x4aa58d,_0xd07bad){const _0x58612c=a59_0x503dd6;userCache[_0x58612c(0x1d6)](_0x4aa58d,{'users':_0xd07bad,'cachedAt':Date[_0x58612c(0x1d7)]()});}export function clearUserCache(_0xd5c14e){const _0x24f6dc=a59_0x503dd6;userCache[_0x24f6dc(0x1dc)](_0xd5c14e);}function a59_0x33f9(){const _0x502d6d=['3598137HpOclK','40938GHnAQE','8057168ioXpmA','1702119UYyeLi','2IZRryJ','users','users-{profile}.json','397456VioEzr','write','now','11702670kGHSsU','22437184NyDfSG','24lWsDYk','865PwagYh','clear','core/user-cache','40CNLdkM'];a59_0x33f9=function(){return _0x502d6d;};return a59_0x33f9();}
@@ -1 +1 @@
1
- (function(_0x577491,_0x35df67){const _0x49a273=a60_0x4949,_0x1c0ae4=_0x577491();while(!![]){try{const _0x3ce6e4=-parseInt(_0x49a273(0xba))/0x1+-parseInt(_0x49a273(0xc1))/0x2*(-parseInt(_0x49a273(0xc2))/0x3)+parseInt(_0x49a273(0xb9))/0x4+parseInt(_0x49a273(0xbb))/0x5*(-parseInt(_0x49a273(0xbf))/0x6)+parseInt(_0x49a273(0xc0))/0x7*(-parseInt(_0x49a273(0xbc))/0x8)+parseInt(_0x49a273(0xb7))/0x9+parseInt(_0x49a273(0xbe))/0xa*(parseInt(_0x49a273(0xb5))/0xb);if(_0x3ce6e4===_0x35df67)break;else _0x1c0ae4['push'](_0x1c0ae4['shift']());}catch(_0x53f89e){_0x1c0ae4['push'](_0x1c0ae4['shift']());}}}(a60_0x565b,0x9dc05));import{readFileSync}from'fs';import{fileURLToPath}from'url';function a60_0x565b(){const _0x50991b=['18739EWsnXa','186288rmQvcK','27RIIOMg','utf-8','parse','20548AVhoat','../../package.json','11010798uxNbtm','../build-info.json','840236opBtCi','1277248PZWcNP','79505FWXjSE','448uGGEam','includes','640UvHGBe','120HcQhiP'];a60_0x565b=function(){return _0x50991b;};return a60_0x565b();}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x16dd95=a60_0x4949;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x44dc93=fileURLToPath(import.meta.url),_0x261710=dirname(_0x44dc93);try{const _0x47888a=join(_0x261710,_0x16dd95(0xb8));cachedBuildInfo=JSON['parse'](readFileSync(_0x47888a,_0x16dd95(0xc3)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x4c5504=a60_0x4949;if(cachedVersion!==null)return cachedVersion;const _0x18c829=fileURLToPath(import.meta.url),_0x61f373=dirname(_0x18c829),_0x10b138=getBuildInfo();if(_0x10b138['version'])return cachedVersion=_0x10b138['version'],cachedVersion;try{const _0x97eaf6=join(_0x61f373,_0x4c5504(0xb6)),_0x27b5de=JSON[_0x4c5504(0xb4)](readFileSync(_0x97eaf6,'utf-8'));cachedVersion=_0x27b5de['version'];}catch{cachedVersion='0.0.0';}return cachedVersion;}function a60_0x4949(_0x5f10f5,_0x1d487d){_0x5f10f5=_0x5f10f5-0xb4;const _0x565bc0=a60_0x565b();let _0x494960=_0x565bc0[_0x5f10f5];return _0x494960;}export function isDevVersion(){const _0x1668a7=a60_0x4949,_0x1594d5=getVersion();return _0x1594d5[_0x1668a7(0xbd)]('.dev')||_0x1594d5[_0x1668a7(0xbd)]('-');}
1
+ (function(_0xf99cd4,_0x1e4627){const _0x107239=a60_0x51c6,_0x2003c0=_0xf99cd4();while(!![]){try{const _0x4a6cff=-parseInt(_0x107239(0x9f))/0x1+-parseInt(_0x107239(0x95))/0x2+-parseInt(_0x107239(0xa3))/0x3+-parseInt(_0x107239(0x9c))/0x4*(parseInt(_0x107239(0x9e))/0x5)+parseInt(_0x107239(0x9a))/0x6*(-parseInt(_0x107239(0x9d))/0x7)+-parseInt(_0x107239(0x98))/0x8*(-parseInt(_0x107239(0x97))/0x9)+parseInt(_0x107239(0xa0))/0xa;if(_0x4a6cff===_0x1e4627)break;else _0x2003c0['push'](_0x2003c0['shift']());}catch(_0x420565){_0x2003c0['push'](_0x2003c0['shift']());}}}(a60_0x4d9d,0x6dd7f));function a60_0x4d9d(){const _0x5b041c=['1334064orRowE','includes','2300877fuFucK','24suPfmf','version','21558SlCMIX','parse','4izMcjF','924UmSdnG','3463505tsBkTE','571902oAxqfb','26819800xiJTBy','utf-8','../../package.json','1779327LRzOab'];a60_0x4d9d=function(){return _0x5b041c;};return a60_0x4d9d();}import{readFileSync}from'fs';import{fileURLToPath}from'url';function a60_0x51c6(_0x46f9df,_0x5c6ccd){_0x46f9df=_0x46f9df-0x95;const _0x4d9d43=a60_0x4d9d();let _0x51c696=_0x4d9d43[_0x46f9df];return _0x51c696;}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x41095f=a60_0x51c6;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x416197=fileURLToPath(import.meta.url),_0x5cbf60=dirname(_0x416197);try{const _0x3010f4=join(_0x5cbf60,'../build-info.json');cachedBuildInfo=JSON[_0x41095f(0x9b)](readFileSync(_0x3010f4,_0x41095f(0xa1)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x2a088a=a60_0x51c6;if(cachedVersion!==null)return cachedVersion;const _0x1b132d=fileURLToPath(import.meta.url),_0x1fa518=dirname(_0x1b132d),_0xbff675=getBuildInfo();if(_0xbff675[_0x2a088a(0x99)])return cachedVersion=_0xbff675[_0x2a088a(0x99)],cachedVersion;try{const _0x2039bb=join(_0x1fa518,_0x2a088a(0xa2)),_0x446a58=JSON[_0x2a088a(0x9b)](readFileSync(_0x2039bb,_0x2a088a(0xa1)));cachedVersion=_0x446a58[_0x2a088a(0x99)];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x41c006=a60_0x51c6,_0x2eda36=getVersion();return _0x2eda36[_0x41c006(0x96)]('.dev')||_0x2eda36[_0x41c006(0x96)]('-');}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x3f5bcd,_0x35fbc4){var _0x3240a3=a61_0x3d11,_0x45496f=_0x3f5bcd();while(!![]){try{var _0x115eb0=-parseInt(_0x3240a3(0x1c9))/0x1*(-parseInt(_0x3240a3(0x1ce))/0x2)+parseInt(_0x3240a3(0x1cd))/0x3*(-parseInt(_0x3240a3(0x1c8))/0x4)+-parseInt(_0x3240a3(0x1d2))/0x5*(parseInt(_0x3240a3(0x1cf))/0x6)+-parseInt(_0x3240a3(0x1c7))/0x7+parseInt(_0x3240a3(0x1ca))/0x8*(parseInt(_0x3240a3(0x1cc))/0x9)+parseInt(_0x3240a3(0x1d0))/0xa*(-parseInt(_0x3240a3(0x1d1))/0xb)+parseInt(_0x3240a3(0x1cb))/0xc;if(_0x115eb0===_0x35fbc4)break;else _0x45496f['push'](_0x45496f['shift']());}catch(_0x149f6b){_0x45496f['push'](_0x45496f['shift']());}}}(a61_0x197f,0xa6657));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';function a61_0x197f(){var _0x44c9e9=['12044952laRDmY','824679oncxpE','15423VlNvFB','898eCAvUr','498nUJZBc','1390lEpSBL','22484ZXdikl','55685EsiHHN','1917286CsWAaZ','668rbUVgT','1639KPPHhR','112gNayxz'];a61_0x197f=function(){return _0x44c9e9;};return a61_0x197f();}export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';function a61_0x3d11(_0x238543,_0x283289){_0x238543=_0x238543-0x1c7;var _0x197f42=a61_0x197f();var _0x3d1140=_0x197f42[_0x238543];return _0x3d1140;}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(_0x2b66b5,_0x5667b7){var _0x1c0a47=a61_0x4a27,_0x3ed384=_0x2b66b5();while(!![]){try{var _0x58e0e7=parseInt(_0x1c0a47(0xc6))/0x1*(parseInt(_0x1c0a47(0xc8))/0x2)+-parseInt(_0x1c0a47(0xc9))/0x3+-parseInt(_0x1c0a47(0xc3))/0x4+-parseInt(_0x1c0a47(0xc5))/0x5+parseInt(_0x1c0a47(0xca))/0x6*(parseInt(_0x1c0a47(0xc7))/0x7)+-parseInt(_0x1c0a47(0xc4))/0x8+parseInt(_0x1c0a47(0xcb))/0x9;if(_0x58e0e7===_0x5667b7)break;else _0x3ed384['push'](_0x3ed384['shift']());}catch(_0x343ad4){_0x3ed384['push'](_0x3ed384['shift']());}}}(a61_0x57b0,0x4514f));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';function a61_0x57b0(){var _0x229b62=['1866650aGEkyE','8438KMCwLH','40369MOSOHN','4CEqEqk','905652wECxSp','474zeHYfA','7364988iANOoJ','789852poiueW','1081320hjWKrr'];a61_0x57b0=function(){return _0x229b62;};return a61_0x57b0();}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';function a61_0x4a27(_0x74f495,_0x16fa6a){_0x74f495=_0x74f495-0xc3;var _0x57b0c2=a61_0x57b0();var _0x4a2767=_0x57b0c2[_0x74f495];return _0x4a2767;}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(_0x459bb0,_0x422b8e){const _0x3af28d=a62_0x3334,_0x4aab51=_0x459bb0();while(!![]){try{const _0x4840cd=parseInt(_0x3af28d(0x208))/0x1*(parseInt(_0x3af28d(0x1fb))/0x2)+-parseInt(_0x3af28d(0x1f2))/0x3+parseInt(_0x3af28d(0x209))/0x4+-parseInt(_0x3af28d(0x20f))/0x5*(-parseInt(_0x3af28d(0x1f1))/0x6)+-parseInt(_0x3af28d(0x1fc))/0x7+-parseInt(_0x3af28d(0x214))/0x8*(-parseInt(_0x3af28d(0x206))/0x9)+parseInt(_0x3af28d(0x1ea))/0xa*(parseInt(_0x3af28d(0x207))/0xb);if(_0x4840cd===_0x422b8e)break;else _0x4aab51['push'](_0x4aab51['shift']());}catch(_0x2cc149){_0x4aab51['push'](_0x4aab51['shift']());}}}(a62_0x284d,0xd0fe5));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a62_0x3334(_0xfa7d89,_0x2616ae){_0xfa7d89=_0xfa7d89-0x1ea;const _0x284d77=a62_0x284d();let _0x33349c=_0x284d77[_0xfa7d89];return _0x33349c;}import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x3d926e={}){const _0x5b17d6=a62_0x3334,_0x48fedd=new McpServer({'name':_0x5b17d6(0x1ff),'version':_0x5b17d6(0x1ef)});return _0x48fedd[_0x5b17d6(0x205)](_0x5b17d6(0x1f9),{'description':_0x5b17d6(0x21a),'inputSchema':{'args':z[_0x5b17d6(0x202)](z[_0x5b17d6(0x1fe)]())['describe'](_0x5b17d6(0x20b))}},async({args:_0x39f859})=>{const _0x5ae3fc=_0x5b17d6,_0x219cb0=await executeTdxRun({'args':_0x39f859},_0x3d926e[_0x5ae3fc(0x1f0)]||{});return _0x219cb0[_0x5ae3fc(0x20d)]?{'content':[{'type':_0x5ae3fc(0x1ed),'text':_0x219cb0[_0x5ae3fc(0x210)]||_0x5ae3fc(0x1f7)}]}:{'content':[{'type':_0x5ae3fc(0x1ed),'text':_0x219cb0[_0x5ae3fc(0x20e)]||_0x219cb0[_0x5ae3fc(0x210)]||_0x5ae3fc(0x216)}],'isError':!![]};}),_0x48fedd[_0x5b17d6(0x205)](_0x5b17d6(0x1fd),{'description':_0x5b17d6(0x1ee),'inputSchema':{'query':z['string']()[_0x5b17d6(0x21b)](_0x5b17d6(0x1ec)),'category':z[_0x5b17d6(0x1eb)]([_0x5b17d6(0x1f4),_0x5b17d6(0x215),'AI',_0x5b17d6(0x20a),_0x5b17d6(0x1f6)])['optional']()['describe'](_0x5b17d6(0x219))}},async({query:_0x52f387,category:_0xd4563d})=>{const _0x2654d8=_0x5b17d6,_0x41cec1=searchCommands({'query':_0x52f387,'category':_0xd4563d});if(_0x41cec1[_0x2654d8(0x203)]===0x0)return{'content':[{'type':_0x2654d8(0x1ed),'text':_0x2654d8(0x20c)+_0x52f387+'\x22'}]};const _0x4869ee=_0x41cec1['map'](_0x30a77c=>{const _0x40ad48=_0x2654d8,_0x2f8c64=_0x30a77c[_0x40ad48(0x213)]['map'](_0xe2c129=>'\x20\x20'+_0xe2c129)['join']('\x0a');return'**'+_0x30a77c[_0x40ad48(0x204)]+_0x40ad48(0x217)+_0x30a77c['category']+')\x0a'+_0x30a77c[_0x40ad48(0x212)]+_0x40ad48(0x1fa)+_0x2f8c64;})[_0x2654d8(0x200)](_0x2654d8(0x1f3));return{'content':[{'type':_0x2654d8(0x1ed),'text':_0x4869ee}]};}),_0x48fedd;}export async function startMCPServer(_0xfbc18={}){const _0x567c99=a62_0x3334,_0x18cd83=createMCPServer(_0xfbc18),_0x3089b6=new StdioServerTransport();return await _0x18cd83[_0x567c99(0x201)](_0x3089b6),new Promise(_0x35075e=>{const _0x5b987f=_0x567c99;let _0x475d8d=![];const _0x41466e=async()=>{if(_0x475d8d)return;_0x475d8d=!![],await _0x18cd83['close'](),_0x35075e();};process[_0x5b987f(0x1f8)](_0x5b987f(0x211),_0x41466e),process[_0x5b987f(0x1f8)](_0x5b987f(0x1f5),_0x41466e),process[_0x5b987f(0x218)][_0x5b987f(0x1f8)]('close',_0x41466e);});}function a62_0x284d(){const _0x4ab533=['1089izWyYh','44VEQfSQ','2463mukwWs','4961128EEpgGw','Context','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','No\x20commands\x20found\x20matching\x20\x22','success','error','10mSUdGe','output','SIGINT','description','examples','14312NRmjOy','CDP','Command\x20failed','**\x20(','stdin','Optional\x20filter\x20by\x20category','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.','describe','1859510eejjvE','enum','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','text','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.','1.0.0','env','720642lKnmqK','4254315OhDtDb','\x0a\x0a---\x0a\x0a','Data','SIGTERM','Utilities','Command\x20completed\x20successfully','once','tdx_run','\x0a\x0aExamples:\x0a','608hjSWSd','6407653yROFdY','tdx_search','string','tdx','join','connect','array','length','name','registerTool'];a62_0x284d=function(){return _0x4ab533;};return a62_0x284d();}
1
+ (function(_0x23cd8a,_0x2e834e){const _0x242d8d=a62_0x80b2,_0x591cdd=_0x23cd8a();while(!![]){try{const _0x559a07=parseInt(_0x242d8d(0x110))/0x1*(parseInt(_0x242d8d(0x11c))/0x2)+parseInt(_0x242d8d(0x120))/0x3+parseInt(_0x242d8d(0x12f))/0x4*(parseInt(_0x242d8d(0x12a))/0x5)+-parseInt(_0x242d8d(0x137))/0x6*(parseInt(_0x242d8d(0x134))/0x7)+parseInt(_0x242d8d(0x122))/0x8+-parseInt(_0x242d8d(0x11f))/0x9*(-parseInt(_0x242d8d(0x10f))/0xa)+-parseInt(_0x242d8d(0x127))/0xb;if(_0x559a07===_0x2e834e)break;else _0x591cdd['push'](_0x591cdd['shift']());}catch(_0x3d26ee){_0x591cdd['push'](_0x591cdd['shift']());}}}(a62_0x4a2e,0xb57d4));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x4f8387={}){const _0x1a41e3=a62_0x80b2,_0x1552c4=new McpServer({'name':_0x1a41e3(0x128),'version':_0x1a41e3(0x11b)});return _0x1552c4[_0x1a41e3(0x119)](_0x1a41e3(0x126),{'description':_0x1a41e3(0x111),'inputSchema':{'args':z[_0x1a41e3(0x12e)](z[_0x1a41e3(0x114)]())[_0x1a41e3(0x131)]('Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])')}},async({args:_0x146490})=>{const _0x5c51a9=_0x1a41e3,_0x1ccb6a=await executeTdxRun({'args':_0x146490},_0x4f8387[_0x5c51a9(0x113)]||{});return _0x1ccb6a['success']?{'content':[{'type':_0x5c51a9(0x12c),'text':_0x1ccb6a[_0x5c51a9(0x12b)]||_0x5c51a9(0x139)}]}:{'content':[{'type':_0x5c51a9(0x12c),'text':_0x1ccb6a[_0x5c51a9(0x135)]||_0x1ccb6a[_0x5c51a9(0x12b)]||_0x5c51a9(0x121)}],'isError':!![]};}),_0x1552c4['registerTool'](_0x1a41e3(0x10e),{'description':_0x1a41e3(0x116),'inputSchema':{'query':z[_0x1a41e3(0x114)]()[_0x1a41e3(0x131)]('Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)'),'category':z[_0x1a41e3(0x11e)]([_0x1a41e3(0x123),_0x1a41e3(0x11a),'AI','Context',_0x1a41e3(0x117)])[_0x1a41e3(0x115)]()[_0x1a41e3(0x131)](_0x1a41e3(0x136))}},async({query:_0x3ad94f,category:_0x24e73a})=>{const _0x18f956=_0x1a41e3,_0x1745e7=searchCommands({'query':_0x3ad94f,'category':_0x24e73a});if(_0x1745e7['length']===0x0)return{'content':[{'type':_0x18f956(0x12c),'text':_0x18f956(0x138)+_0x3ad94f+'\x22'}]};const _0x1557a3=_0x1745e7['map'](_0x56a322=>{const _0x455899=_0x18f956,_0x5391a7=_0x56a322['examples'][_0x455899(0x130)](_0x24eccf=>'\x20\x20'+_0x24eccf)[_0x455899(0x112)]('\x0a');return'**'+_0x56a322[_0x455899(0x11d)]+_0x455899(0x129)+_0x56a322[_0x455899(0x124)]+')\x0a'+_0x56a322[_0x455899(0x132)]+'\x0a\x0aExamples:\x0a'+_0x5391a7;})[_0x18f956(0x112)](_0x18f956(0x12d));return{'content':[{'type':_0x18f956(0x12c),'text':_0x1557a3}]};}),_0x1552c4;}function a62_0x4a2e(){const _0x5a2810=['19328947bHHPAm','tdx','**\x20(','45uNVgHh','output','text','\x0a\x0a---\x0a\x0a','array','416588ClayGp','map','describe','description','stdin','28nwYQUr','error','Optional\x20filter\x20by\x20category','1439994ePUMYN','No\x20commands\x20found\x20matching\x20\x22','Command\x20completed\x20successfully','once','tdx_search','1830pbRbjr','38vZJbem','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.','join','env','string','optional','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.','Utilities','close','registerTool','CDP','1.0.0','18608tkTbHL','name','enum','47709ZjEsil','1610229WqGGSp','Command\x20failed','5302816tpWzUm','Data','category','SIGINT','tdx_run'];a62_0x4a2e=function(){return _0x5a2810;};return a62_0x4a2e();}function a62_0x80b2(_0x448e55,_0x26ab57){_0x448e55=_0x448e55-0x10e;const _0x4a2ed3=a62_0x4a2e();let _0x80b2e=_0x4a2ed3[_0x448e55];return _0x80b2e;}export async function startMCPServer(_0x33ce58={}){const _0x1e355e=createMCPServer(_0x33ce58),_0x43306b=new StdioServerTransport();return await _0x1e355e['connect'](_0x43306b),new Promise(_0x129f8f=>{const _0x2f1f1d=a62_0x80b2;let _0x71701=![];const _0x52e642=async()=>{const _0x4db78e=a62_0x80b2;if(_0x71701)return;_0x71701=!![],await _0x1e355e[_0x4db78e(0x118)](),_0x129f8f();};process[_0x2f1f1d(0x13a)](_0x2f1f1d(0x125),_0x52e642),process[_0x2f1f1d(0x13a)]('SIGTERM',_0x52e642),process[_0x2f1f1d(0x133)][_0x2f1f1d(0x13a)](_0x2f1f1d(0x118),_0x52e642);});}
@@ -1 +1 @@
1
- function a63_0x2aa7(){var _0x559e7d=['679170qBSkmz','1324348tIimSF','844509aqjMHl','405457UhUuRR','850896xsPKRQ','3194506HZZYrH','6178002VvGRQh'];a63_0x2aa7=function(){return _0x559e7d;};return a63_0x2aa7();}(function(_0x23559c,_0xcc2178){var _0x275c08=a63_0x4964,_0x2d5c87=_0x23559c();while(!![]){try{var _0x512d7c=-parseInt(_0x275c08(0xc5))/0x1+-parseInt(_0x275c08(0xca))/0x2+parseInt(_0x275c08(0xcb))/0x3+parseInt(_0x275c08(0xc6))/0x4+-parseInt(_0x275c08(0xc9))/0x5+parseInt(_0x275c08(0xc8))/0x6+parseInt(_0x275c08(0xc7))/0x7;if(_0x512d7c===_0xcc2178)break;else _0x2d5c87['push'](_0x2d5c87['shift']());}catch(_0x1cc4e8){_0x2d5c87['push'](_0x2d5c87['shift']());}}}(a63_0x2aa7,0xbda53));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';function a63_0x4964(_0x4733af,_0x3f7fda){_0x4733af=_0x4733af-0xc5;var _0x2aa7f1=a63_0x2aa7();var _0x4964dd=_0x2aa7f1[_0x4733af];return _0x4964dd;}export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
1
+ (function(_0x28a21c,_0x25557a){var _0x291dec=a63_0x3aa1,_0x2941c7=_0x28a21c();while(!![]){try{var _0x2bee9f=-parseInt(_0x291dec(0xb9))/0x1*(-parseInt(_0x291dec(0xb1))/0x2)+-parseInt(_0x291dec(0xb5))/0x3+-parseInt(_0x291dec(0xae))/0x4*(-parseInt(_0x291dec(0xb7))/0x5)+parseInt(_0x291dec(0xb8))/0x6+-parseInt(_0x291dec(0xb3))/0x7*(parseInt(_0x291dec(0xb6))/0x8)+-parseInt(_0x291dec(0xaf))/0x9*(parseInt(_0x291dec(0xb0))/0xa)+parseInt(_0x291dec(0xb4))/0xb*(-parseInt(_0x291dec(0xb2))/0xc);if(_0x2bee9f===_0x25557a)break;else _0x2941c7['push'](_0x2941c7['shift']());}catch(_0x1d3aac){_0x2941c7['push'](_0x2941c7['shift']());}}}(a63_0xb25a,0x31dfc));function a63_0x3aa1(_0x45d2f7,_0x1bb1bf){_0x45d2f7=_0x45d2f7-0xae;var _0xb25a97=a63_0xb25a();var _0x3aa100=_0xb25a97[_0x45d2f7];return _0x3aa100;}function a63_0xb25a(){var _0x58ddc4=['92873syhtVc','203853SxeTQV','1187896sAHdPl','3845iiIIuG','2252928MwgSfq','505mgmdKW','1344JKxtcl','36SQYUuR','926380HsEjaL','824gibpYG','72NYKUbg','7XAQNPk'];a63_0xb25a=function(){return _0x58ddc4;};return a63_0xb25a();}export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
@@ -1 +1 @@
1
- const a64_0x262719=a64_0x21c0;function a64_0x11e5(){const _0xfd4312=['node.exe','613305rZCEMh','11136grGGmJ','true','message','string','84182rSoaTL','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','win32','data','212031qtIkdp','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','kill','resourcesPath','close','describe','node','stdout','4820520MCDkgk','174ExqwUb','toString','--no-color','1072ITdnEV','1779478EGGvip','ignore','tdx','pipe','stderr','3524652hcyWGz','PATH'];a64_0x11e5=function(){return _0xfd4312;};return a64_0x11e5();}(function(_0x304c1c,_0x4c8efa){const _0x474660=a64_0x21c0,_0x5f1973=_0x304c1c();while(!![]){try{const _0x53c1cb=parseInt(_0x474660(0x10b))/0x1+parseInt(_0x474660(0x103))/0x2+-parseInt(_0x474660(0x10c))/0x3+parseInt(_0x474660(0x108))/0x4+parseInt(_0x474660(0xfe))/0x5+-parseInt(_0x474660(0xff))/0x6*(-parseInt(_0x474660(0x110))/0x7)+-parseInt(_0x474660(0x102))/0x8*(parseInt(_0x474660(0x114))/0x9);if(_0x53c1cb===_0x4c8efa)break;else _0x5f1973['push'](_0x5f1973['shift']());}catch(_0x4bfcc3){_0x5f1973['push'](_0x5f1973['shift']());}}}(a64_0x11e5,0x82f7f));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['object']({'args':z['array'](z[a64_0x262719(0x10f)]())[a64_0x262719(0x119)](a64_0x262719(0x115))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function a64_0x21c0(_0x4f0c8f,_0x2f0cf6){_0x4f0c8f=_0x4f0c8f-0xfe;const _0x11e5f7=a64_0x11e5();let _0x21c007=_0x11e5f7[_0x4f0c8f];return _0x21c007;}function getNodeBinDir(){const _0x156da2=a64_0x262719,_0x2073ae=process[_0x156da2(0x117)];if(_0x2073ae){const _0x46d77f=join(_0x2073ae,_0x156da2(0x11a)),_0xce4e0b=process['platform']==='win32'?_0x156da2(0x10a):_0x156da2(0x11a);if(existsSync(join(_0x46d77f,_0xce4e0b)))return _0x46d77f;}return dirname(process['execPath']);}export async function executeTdxRun(_0x568569,_0x4d1e2b){const _0x17b99e=a64_0x262719,{args:_0x1df720}=_0x568569;if(isBlockedCommand(_0x1df720)){const _0x5e2121=getBlockedReason(_0x1df720);return{'success':![],'output':'','error':_0x5e2121||'This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','exitCode':0x1};}const _0x4abfd3=['--json',_0x17b99e(0x101),..._0x1df720],_0x2cc119=getNodeBinDir(),_0x477e48=process['platform']===_0x17b99e(0x112)?';':':',_0x30410b=_0x4d1e2b[_0x17b99e(0x109)]??process.env.PATH??'',_0x21ce78=''+_0x2cc119+_0x477e48+_0x30410b;return new Promise(_0x1f3f33=>{const _0x5ba8ac=_0x17b99e,_0x191880=spawn(_0x5ba8ac(0x105),_0x4abfd3,{'env':{...process.env,..._0x4d1e2b,'PATH':_0x21ce78,'CI':_0x5ba8ac(0x10d)},'stdio':[_0x5ba8ac(0x104),'pipe',_0x5ba8ac(0x106)]});let _0x242b8f='',_0x334f57='',_0x17dfe6=![];const _0x18f017=setTimeout(()=>{const _0xd55aa0=_0x5ba8ac;_0x17dfe6=!![],_0x191880[_0xd55aa0(0x116)]('SIGTERM');},DEFAULT_TIMEOUT_MS);_0x191880[_0x5ba8ac(0x11b)]['on'](_0x5ba8ac(0x113),_0x5b2694=>{const _0xda7414=_0x5ba8ac;_0x242b8f+=_0x5b2694[_0xda7414(0x100)]();}),_0x191880[_0x5ba8ac(0x107)]['on']('data',_0x33838b=>{_0x334f57+=_0x33838b['toString']();}),_0x191880['on']('error',_0x334217=>{const _0x1e0a2d=_0x5ba8ac;clearTimeout(_0x18f017),_0x1f3f33({'success':![],'output':'','error':'Failed\x20to\x20spawn\x20tdx:\x20'+_0x334217[_0x1e0a2d(0x10e)],'exitCode':0x1});}),_0x191880['on'](_0x5ba8ac(0x118),_0x50dd72=>{const _0x1df672=_0x5ba8ac;clearTimeout(_0x18f017);if(_0x17dfe6){_0x1f3f33({'success':![],'output':formatOutput(_0x242b8f),'error':_0x1df672(0x111),'exitCode':0x7c});return;}const _0x3cbd3b=_0x50dd72??0x1,_0x2afa64=_0x3cbd3b===0x0,_0x9f9ad6=formatOutput(_0x242b8f||_0x334f57),_0x1c4c15=!_0x2afa64&&_0x334f57?formatOutput(_0x334f57):undefined;_0x1f3f33({'success':_0x2afa64,'output':_0x9f9ad6,'error':_0x1c4c15,'exitCode':_0x3cbd3b});});});}
1
+ const a64_0x2332ea=a64_0x1626;(function(_0x13b274,_0x584f09){const _0x2a0256=a64_0x1626,_0x600238=_0x13b274();while(!![]){try{const _0x295880=parseInt(_0x2a0256(0x92))/0x1*(-parseInt(_0x2a0256(0xa6))/0x2)+-parseInt(_0x2a0256(0xae))/0x3+parseInt(_0x2a0256(0xa0))/0x4*(-parseInt(_0x2a0256(0xa5))/0x5)+-parseInt(_0x2a0256(0x98))/0x6*(parseInt(_0x2a0256(0xad))/0x7)+-parseInt(_0x2a0256(0x95))/0x8*(-parseInt(_0x2a0256(0xa9))/0x9)+parseInt(_0x2a0256(0xa8))/0xa+parseInt(_0x2a0256(0x9b))/0xb;if(_0x295880===_0x584f09)break;else _0x600238['push'](_0x600238['shift']());}catch(_0x31f281){_0x600238['push'](_0x600238['shift']());}}}(a64_0x210e,0x6d12b));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[a64_0x2332ea(0x97)]({'args':z['array'](z[a64_0x2332ea(0xa1)]())['describe'](a64_0x2332ea(0x96))});function a64_0x1626(_0x32224d,_0x184e31){_0x32224d=_0x32224d-0x8d;const _0x210e22=a64_0x210e();let _0x1626c6=_0x210e22[_0x32224d];return _0x1626c6;}const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function getNodeBinDir(){const _0x2a0c05=a64_0x2332ea,_0x184adc=process[_0x2a0c05(0x99)];if(_0x184adc){const _0x2a4633=join(_0x184adc,_0x2a0c05(0x9f)),_0x3a6019=process[_0x2a0c05(0x9e)]===_0x2a0c05(0x93)?_0x2a0c05(0xa4):'node';if(existsSync(join(_0x2a4633,_0x3a6019)))return _0x2a4633;}return dirname(process['execPath']);}function a64_0x210e(){const _0x1ec9a8=['Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','toString','SIGTERM','3715KUlXdh','win32','--json','16zVjBCc','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','object','24hPeizD','resourcesPath','--no-color','19591484CiVSUT','kill','PATH','platform','node','275804gKqoBS','string','stdout','ignore','node.exe','25wnLJsw','394bCKxNP','close','667200DSoJzQ','1133874DIvLUk','error','pipe','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','165137OMItIS','1445997ytdoKK','stderr','Failed\x20to\x20spawn\x20tdx:\x20','true','data'];a64_0x210e=function(){return _0x1ec9a8;};return a64_0x210e();}export async function executeTdxRun(_0x3d8a00,_0x13d9c5){const _0x5870b3=a64_0x2332ea,{args:_0x23ec1}=_0x3d8a00;if(isBlockedCommand(_0x23ec1)){const _0x35b87b=getBlockedReason(_0x23ec1);return{'success':![],'output':'','error':_0x35b87b||_0x5870b3(0xac),'exitCode':0x1};}const _0x3ec59c=[_0x5870b3(0x94),_0x5870b3(0x9a),..._0x23ec1],_0x52c8f0=getNodeBinDir(),_0x10ab89=process[_0x5870b3(0x9e)]===_0x5870b3(0x93)?';':':',_0x30bd68=_0x13d9c5[_0x5870b3(0x9d)]??process.env.PATH??'',_0x505b9b=''+_0x52c8f0+_0x10ab89+_0x30bd68;return new Promise(_0x3fefcd=>{const _0x1d1fe9=_0x5870b3,_0x57c65c=spawn('tdx',_0x3ec59c,{'env':{...process.env,..._0x13d9c5,'PATH':_0x505b9b,'CI':_0x1d1fe9(0x8d)},'stdio':[_0x1d1fe9(0xa3),_0x1d1fe9(0xab),_0x1d1fe9(0xab)]});let _0x54dc98='',_0x43f860='',_0x14e0cd=![];const _0x2f86b4=setTimeout(()=>{const _0x5c089c=_0x1d1fe9;_0x14e0cd=!![],_0x57c65c[_0x5c089c(0x9c)](_0x5c089c(0x91));},DEFAULT_TIMEOUT_MS);_0x57c65c[_0x1d1fe9(0xa2)]['on'](_0x1d1fe9(0x8e),_0xffd75f=>{const _0x4f45a3=_0x1d1fe9;_0x54dc98+=_0xffd75f[_0x4f45a3(0x90)]();}),_0x57c65c[_0x1d1fe9(0xaf)]['on'](_0x1d1fe9(0x8e),_0x50b966=>{const _0x2711ec=_0x1d1fe9;_0x43f860+=_0x50b966[_0x2711ec(0x90)]();}),_0x57c65c['on'](_0x1d1fe9(0xaa),_0x668b85=>{const _0x4123a6=_0x1d1fe9;clearTimeout(_0x2f86b4),_0x3fefcd({'success':![],'output':'','error':_0x4123a6(0xb0)+_0x668b85['message'],'exitCode':0x1});}),_0x57c65c['on'](_0x1d1fe9(0xa7),_0xddfd34=>{const _0x195ad5=_0x1d1fe9;clearTimeout(_0x2f86b4);if(_0x14e0cd){_0x3fefcd({'success':![],'output':formatOutput(_0x54dc98),'error':_0x195ad5(0x8f),'exitCode':0x7c});return;}const _0x54a821=_0xddfd34??0x1,_0xa0f6d7=_0x54a821===0x0,_0x4bebe4=formatOutput(_0x54dc98||_0x43f860),_0x4f01d8=!_0xa0f6d7&&_0x43f860?formatOutput(_0x43f860):undefined;_0x3fefcd({'success':_0xa0f6d7,'output':_0x4bebe4,'error':_0x4f01d8,'exitCode':_0x54a821});});});}