@treasuredata/tdx 0.16.16 → 0.16.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/anthropic-adapter.js +1 -1
  65. package/dist/proxy/claude-usage-tracker.js +1 -1
  66. package/dist/proxy/context-signature.js +1 -1
  67. package/dist/proxy/conversation-utils.js +1 -1
  68. package/dist/proxy/passthrough-server.js +1 -1
  69. package/dist/proxy/server.js +1 -1
  70. package/dist/proxy/session-cache.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/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/endpoints.js +1 -1
  83. package/dist/sdk/client/engage-api-client.js +1 -1
  84. package/dist/sdk/client/http-client.js +1 -1
  85. package/dist/sdk/client/llm-api-client.js +1 -1
  86. package/dist/sdk/client/rate-limiter.js +1 -1
  87. package/dist/sdk/client/td-api-client.js +1 -1
  88. package/dist/sdk/client/trino-api-client.js +1 -1
  89. package/dist/sdk/client/workflow-client.js +1 -1
  90. package/dist/sdk/connection-validator.js +1 -1
  91. package/dist/sdk/connection.js +1 -1
  92. package/dist/sdk/engage.js +1 -1
  93. package/dist/sdk/errors.js +1 -1
  94. package/dist/sdk/index.js +1 -1
  95. package/dist/sdk/io/index.js +1 -1
  96. package/dist/sdk/io/node-filesystem.js +1 -1
  97. package/dist/sdk/job.js +1 -1
  98. package/dist/sdk/journey.js +1 -1
  99. package/dist/sdk/llm/chat-cache.js +1 -1
  100. package/dist/sdk/llm/index.js +1 -1
  101. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  102. package/dist/sdk/llm/model-aliases.js +1 -1
  103. package/dist/sdk/llm/model-factors.js +1 -1
  104. package/dist/sdk/query/index.js +1 -1
  105. package/dist/sdk/query/sql-parser.js +1 -1
  106. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  107. package/dist/sdk/segment/fields-display.js +1 -1
  108. package/dist/sdk/segment/file-discovery.js +1 -1
  109. package/dist/sdk/segment/journey-utils.js +1 -1
  110. package/dist/sdk/segment/journey-yaml.js +1 -1
  111. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  112. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/pull-workflow.js +1 -1
  114. package/dist/sdk/segment/push-workflow.js +1 -1
  115. package/dist/sdk/segment/resolution-context.js +1 -1
  116. package/dist/sdk/segment/segment-path-parser.js +1 -1
  117. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  118. package/dist/sdk/segment/target-resolution.js +1 -1
  119. package/dist/sdk/segment/tdx-config.js +1 -1
  120. package/dist/sdk/segment/validate-files.js +1 -1
  121. package/dist/sdk/segment/yaml-validator.js +1 -1
  122. package/dist/sdk/segment.js +1 -1
  123. package/dist/sdk/types/index.js +1 -1
  124. package/dist/sdk/types/progress.js +1 -1
  125. package/dist/sdk/user.js +1 -1
  126. package/dist/sdk/util/format-detector.js +1 -1
  127. package/dist/sdk/util/formatters.js +1 -1
  128. package/dist/sdk/util/index.js +1 -1
  129. package/dist/sdk/util/tree-formatter.js +1 -1
  130. package/dist/sdk/workflow/clone-workflow.js +1 -1
  131. package/dist/sdk/workflow/index.js +1 -1
  132. package/dist/sdk/workflow/pull-workflow.js +1 -1
  133. package/dist/sdk/workflow/push-workflow.js +1 -1
  134. package/dist/sdk/workflow/tdx-config.js +1 -1
  135. package/dist/sdk/workflow/workflow-utils.js +1 -1
  136. package/dist/test-utils/command-runner.js +1 -1
  137. package/dist/test-utils/factories.js +1 -1
  138. package/dist/test-utils/fixtures.js +1 -1
  139. package/dist/test-utils/http-mock.js +1 -1
  140. package/dist/test-utils/index.js +1 -1
  141. package/dist/utils/async.js +1 -1
  142. package/dist/utils/colors.js +1 -1
  143. package/dist/utils/diff.js +1 -1
  144. package/dist/utils/file-permissions.js +1 -1
  145. package/dist/utils/global-cache.js +1 -1
  146. package/dist/utils/json-loader.js +1 -1
  147. package/dist/utils/local-cache.js +1 -1
  148. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  149. package/dist/utils/logger/formatters/index.js +1 -1
  150. package/dist/utils/logger/handlers/console-handler.js +1 -1
  151. package/dist/utils/logger/handlers/file-handler.js +1 -1
  152. package/dist/utils/logger/handlers/index.js +1 -1
  153. package/dist/utils/logger/handlers/null-handler.js +1 -1
  154. package/dist/utils/logger/index.js +1 -1
  155. package/dist/utils/logger/logger.js +1 -1
  156. package/dist/utils/logger/types.js +1 -1
  157. package/dist/utils/option-validation.js +1 -1
  158. package/dist/utils/port.js +1 -1
  159. package/dist/utils/process.js +1 -1
  160. package/dist/utils/prompt.js +1 -1
  161. package/dist/utils/spinner.js +1 -1
  162. package/dist/utils/sse-parser.js +1 -1
  163. package/dist/utils/string-utils.js +1 -1
  164. package/dist/utils/table-ref-parser.js +1 -1
  165. package/dist/utils/tdx-logger.js +1 -1
  166. package/dist/utils/version-check.js +1 -1
  167. package/package.json +1 -1
@@ -1 +1 @@
1
- const a45_0x635fb3=a45_0x3e13;(function(_0x4fb1ca,_0x2386f4){const _0x3bd27b=a45_0x3e13,_0x449218=_0x4fb1ca();while(!![]){try{const _0x289eaf=-parseInt(_0x3bd27b(0x7f))/0x1+-parseInt(_0x3bd27b(0xba))/0x2*(parseInt(_0x3bd27b(0x91))/0x3)+-parseInt(_0x3bd27b(0x7d))/0x4*(-parseInt(_0x3bd27b(0x7e))/0x5)+-parseInt(_0x3bd27b(0xb5))/0x6+parseInt(_0x3bd27b(0xbc))/0x7*(-parseInt(_0x3bd27b(0x9d))/0x8)+-parseInt(_0x3bd27b(0xcd))/0x9+-parseInt(_0x3bd27b(0x99))/0xa*(-parseInt(_0x3bd27b(0x87))/0xb);if(_0x289eaf===_0x2386f4)break;else _0x449218['push'](_0x449218['shift']());}catch(_0x41595e){_0x449218['push'](_0x449218['shift']());}}}(a45_0x5f3e,0x85d08));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x287cda from'node:fs';import*as a45_0x51e5ab from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x2f165f from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x362099=a45_0x3e13;return process['env'][_0x362099(0xa1)]||join(homedir(),_0x362099(0x7c),_0x362099(0xb6));}export function getConfigFile(){const _0x42a385=a45_0x3e13;return join(getConfigDir(),_0x42a385(0xb1));}export function getConfigFilePath(_0x3a44c9){const _0x297933=a45_0x3e13,_0x15f964=getConfigDir();return _0x3a44c9?a45_0x51e5ab[_0x297933(0x95)](_0x15f964,_0x297933(0x80)+_0x3a44c9):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}function a45_0x3e13(_0x19ecaf,_0x3089a4){_0x19ecaf=_0x19ecaf-0x79;const _0x5f3e77=a45_0x5f3e();let _0x3e138f=_0x5f3e77[_0x19ecaf];return _0x3e138f;}function a45_0x5f3e(){const _0x55b3af=['keychain\x20(profile:\x20','filter','env','8620695bvpqYe','legacy\x20.env\x20file','dev-us01','toUpperCase','clear','profile','Warning:\x20Unknown\x20site\x20\x27','.config','3380pgbZHt','4055HhpLvc','563244cCfMQG','.env.','keychain','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','split','utf-8','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','config/llm-project','11DckVTF','toISOString','name','startsWith','stg-jp01','ap02','TDX_API_KEY_','read','eu01','TDX_API_KEY\x20env\x20var','3kJcdUp','parse','\x20env\x20var','yellow','join','TD_API_KEY_','apiKeys','llm_default_project','34506140ohwrYA','projectId','jp01','includes','16208WhHFmr','slice','Warning:\x20Failed\x20to\x20load\x20','existsSync','TDX_CONFIG_DIR','config/llm-agent','isDeprecated','some','TD_API_KEY','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','TD_API_KEY\x20env\x20var\x20(deprecated)','trim','Warning:\x20Failed\x20to\x20read\x20','legacy\x20.env\x20file\x20(profile:\x20','site','TDX_API_KEY','replace','apiKey','accountId','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','.env','readFileSync','tdx.json','ap03','2182926fxnNtM','tdx','dev-eu01','llm_default_agent','map','1999726yZcBVJ','path','2429zEkeSO','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','match','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','source','us01','stg-us01','string','account_info','write','warn','endsWith','stg-ap03','.json'];a45_0x5f3e=function(){return _0x55b3af;};return a45_0x5f3e();}const llmProjectCache=createOptionalProfileCache(a45_0x635fb3(0x98),a45_0x635fb3(0x86));export function getLLMProjectCacheFile(_0x55ccb7){const _0x38519a=a45_0x635fb3;return llmProjectCache[_0x38519a(0xbb)](_0x55ccb7);}export function readCachedLLMProject(_0x535107){const _0x42689a=a45_0x635fb3,_0x3cc6e3=llmProjectCache[_0x42689a(0x8e)](_0x535107);if(_0x3cc6e3&&typeof _0x3cc6e3['id']===_0x42689a(0xc3)&&typeof _0x3cc6e3['name']===_0x42689a(0xc3))return _0x3cc6e3;return null;}export function writeCachedLLMProject(_0x525eff,_0x45ac62,_0x289d17){try{llmProjectCache['write']({'name':_0x525eff,'id':_0x45ac62},_0x289d17);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x635fb3(0xb8),a45_0x635fb3(0xa2));export function getLLMAgentCacheFile(_0x3dd9d1){const _0x161e4d=a45_0x635fb3;return llmAgentCache[_0x161e4d(0xbb)](_0x3dd9d1);}export function readCachedLLMAgent(_0x3c2318){const _0x2e5c32=a45_0x635fb3,_0x2b28fc=llmAgentCache[_0x2e5c32(0x8e)](_0x3c2318);if(_0x2b28fc&&typeof _0x2b28fc['id']===_0x2e5c32(0xc3)&&typeof _0x2b28fc[_0x2e5c32(0x89)]==='string'&&typeof _0x2b28fc[_0x2e5c32(0x9a)]==='string')return _0x2b28fc;return null;}export function writeCachedLLMAgent(_0x5e7e82,_0x279549,_0x1b7cbf,_0x133287){const _0x5f3571=a45_0x635fb3;try{llmAgentCache[_0x5f3571(0xc5)]({'name':_0x5e7e82,'id':_0x279549,'projectId':_0x1b7cbf},_0x133287);}catch{}}export function clearCachedLLMAgent(_0x34ee84){const _0x3b576d=a45_0x635fb3;try{llmAgentCache[_0x3b576d(0x79)](_0x34ee84);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0x635fb3(0xc4),'config/account-info',{'suffix':a45_0x635fb3(0xc9)});export function getAccountInfoCacheFile(_0x4ae2af){const _0x27632f=a45_0x635fb3;return accountInfoCache[_0x27632f(0xbb)](_0x4ae2af);}export function readCachedAccountInfo(_0x5de798){const _0x58b8c2=a45_0x635fb3,_0x1fddf3=accountInfoCache[_0x58b8c2(0x8e)](_0x5de798);if(_0x1fddf3&&typeof _0x1fddf3[_0x58b8c2(0xab)]===_0x58b8c2(0xc3)&&typeof _0x1fddf3[_0x58b8c2(0xaf)]==='number')return _0x1fddf3;return null;}export function writeCachedAccountInfo(_0x23a27b,_0x523846,_0x3821e2){const _0x971090=a45_0x635fb3;try{accountInfoCache[_0x971090(0xc5)]({'site':_0x23a27b,'accountId':_0x523846,'cachedAt':new Date()[_0x971090(0x88)]()},_0x3821e2);}catch{}}export function parseEnvFile(_0x177a9c){const _0x405982=a45_0x635fb3,_0x3e3caf={};for(const _0x289739 of _0x177a9c[_0x405982(0x83)]('\x0a')){const _0x4c3435=_0x289739[_0x405982(0xa8)]();if(!_0x4c3435||_0x4c3435[_0x405982(0x8a)]('#'))continue;const _0x48e9d6=_0x4c3435[_0x405982(0xbe)](/^([^=]+)=(.*)$/);if(_0x48e9d6){const _0x312066=_0x48e9d6[0x1][_0x405982(0xa8)]();let _0x33abd7=_0x48e9d6[0x2][_0x405982(0xa8)]();(_0x33abd7[_0x405982(0x8a)]('\x22')&&_0x33abd7[_0x405982(0xc7)]('\x22')||_0x33abd7[_0x405982(0x8a)]('\x27')&&_0x33abd7[_0x405982(0xc7)]('\x27'))&&(_0x33abd7=_0x33abd7[_0x405982(0x9e)](0x1,-0x1)),_0x3e3caf[_0x312066]=_0x33abd7;}}return _0x3e3caf;}export function readUserConfig(){const _0x329e97=a45_0x635fb3,_0x1993b3=getConfigFile();if(!existsSync(_0x1993b3))return{};try{const _0x4a82a6=readFileSync(_0x1993b3,'utf-8');return parseEnvFile(_0x4a82a6);}catch(_0x5909a2){return console['warn'](_0x329e97(0x82)+_0x1993b3+':',_0x5909a2),{};}}export function resolveSite(_0x1ad763){const _0x19e6ae=a45_0x635fb3,_0x10ad36=[_0x19e6ae(0xc1),_0x19e6ae(0x9b),_0x19e6ae(0x8f),'ap02',_0x19e6ae(0xb4),_0x19e6ae(0xcf),_0x19e6ae(0xb7),_0x19e6ae(0xc2),'stg-jp01',_0x19e6ae(0xc8)];if(_0x10ad36[_0x19e6ae(0x9c)](_0x1ad763))return _0x1ad763;if(_0x1ad763 in SITE_ALIASES)return SITE_ALIASES[_0x1ad763];return console['warn'](_0x19e6ae(0x7b)+_0x1ad763+'\x27,\x20defaulting\x20to\x20us01'),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x1c8910,_0x197e34){const _0x281bda=a45_0x635fb3,_0x384435=_0x197e34||getActiveProfileName();if(_0x384435){const _0x507246=_0x281bda(0x8d)+normalizeProfileForEnvVar(_0x384435);if(process[_0x281bda(0xcc)][_0x507246])return process[_0x281bda(0xcc)][_0x507246];}if(process[_0x281bda(0xcc)][_0x281bda(0xac)])return process[_0x281bda(0xcc)]['TDX_API_KEY'];if(process[_0x281bda(0xcc)][_0x281bda(0xa5)])return process[_0x281bda(0xcc)][_0x281bda(0xa5)];const _0x3f2dcb=_0x1c8910[_0x281bda(0xd0)]()[_0x281bda(0xad)](/-/g,'_'),_0x5889db='TD_API_KEY_'+_0x3f2dcb;if(_0x384435){const _0x516b1f=loadProfileEnv(_0x384435);if(_0x516b1f){if(_0x516b1f[_0x5889db])return _0x516b1f[_0x5889db];if(_0x516b1f[_0x281bda(0xa5)])return _0x516b1f[_0x281bda(0xa5)];}}const _0x120dcf=loadUserConfigOnce();if(_0x120dcf[_0x5889db])return _0x120dcf[_0x5889db];if(_0x120dcf['TD_API_KEY'])return _0x120dcf[_0x281bda(0xa5)];return undefined;}export function normalizeProfileForEnvVar(_0x1517c1){const _0x660cdf=a45_0x635fb3;return _0x1517c1[_0x660cdf(0xd0)]()[_0x660cdf(0xad)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x42e2cb,_0x1bd6a9){const _0x250158=a45_0x635fb3,_0x226a11=_0x1bd6a9||getActiveProfileName()||undefined;if(_0x226a11){const _0x181b99=_0x250158(0x8d)+normalizeProfileForEnvVar(_0x226a11);if(process[_0x250158(0xcc)][_0x181b99])return{'apiKey':process[_0x250158(0xcc)][_0x181b99],'source':_0x181b99+_0x250158(0x93),'isDeprecated':![]};const _0x6d0771=getCachedCredential(_0x42e2cb,_0x226a11);if(_0x6d0771)return{'apiKey':_0x6d0771,'source':_0x250158(0xca)+_0x226a11+')','isDeprecated':![]};const _0x16bff4=await getKeychainAPIKey(_0x226a11);if(_0x16bff4)return setCachedCredential(_0x16bff4,_0x42e2cb,_0x226a11),{'apiKey':_0x16bff4,'source':_0x250158(0xca)+_0x226a11+')','isDeprecated':![]};}if(process[_0x250158(0xcc)][_0x250158(0xac)])return{'apiKey':process[_0x250158(0xcc)][_0x250158(0xac)],'source':_0x250158(0x90),'isDeprecated':![]};if(!_0x226a11){const _0x445bf7=getCachedCredential(_0x42e2cb,undefined);if(_0x445bf7)return{'apiKey':_0x445bf7,'source':_0x250158(0x81),'isDeprecated':![]};const _0x2b6726=await getKeychainAPIKey(undefined);if(_0x2b6726)return setCachedCredential(_0x2b6726,_0x42e2cb,undefined),{'apiKey':_0x2b6726,'source':_0x250158(0x81),'isDeprecated':![]};}if(process['env'][_0x250158(0xa5)])return{'apiKey':process[_0x250158(0xcc)][_0x250158(0xa5)],'source':_0x250158(0xa7),'isDeprecated':!![]};const _0x2ee6bd=getLegacyEnvAPIKey(_0x42e2cb,_0x226a11);if(_0x2ee6bd){const _0x537119=await isKeychainAvailable();if(_0x537119)try{await saveKeychainAPIKey(_0x2ee6bd,_0x226a11),setCachedCredential(_0x2ee6bd,_0x42e2cb,_0x226a11);const _0x21318a=getConfigFilePath(_0x226a11);cleanupLegacyEnvFile(_0x21318a)&&console[_0x250158(0xc6)](a45_0x2f165f[_0x250158(0x94)](_0x250158(0xb0)));}catch(_0x558bd9){console['warn'](a45_0x2f165f[_0x250158(0x94)](_0x250158(0xa6)+_0x558bd9));}const _0x202ceb=_0x226a11?_0x250158(0xaa)+_0x226a11+')':_0x250158(0xce);return{'apiKey':_0x2ee6bd,'source':_0x202ceb,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x169109,_0x3d2a18,_0x36dbc5=!![]){const _0x2562e8=a45_0x635fb3,_0x207f35=await resolveAPIKeyAsync(_0x169109,_0x3d2a18);if(!_0x207f35)return undefined;if(_0x36dbc5&&_0x207f35[_0x2562e8(0xa3)]&&_0x207f35[_0x2562e8(0xc0)][_0x2562e8(0x9c)](_0x2562e8(0xa5))){const _0x383ed6=_0x3d2a18||getActiveProfileName()||undefined,_0x57921f=_0x383ed6?_0x2562e8(0x8d)+normalizeProfileForEnvVar(_0x383ed6):'TDX_API_KEY_<PROFILE>';console[_0x2562e8(0xc6)](a45_0x2f165f[_0x2562e8(0x94)](_0x2562e8(0x85)+(_0x2562e8(0xbd)+_0x57921f+').')));}return _0x207f35[_0x2562e8(0xae)];}function getLegacyEnvAPIKey(_0x4834d4,_0x4ccb7f){const _0xf17769=a45_0x635fb3,_0xd2781b=_0x4834d4[_0xf17769(0xd0)]()[_0xf17769(0xad)](/-/g,'_'),_0x540bd5=_0xf17769(0x96)+_0xd2781b;if(_0x4ccb7f){const _0x2145ec=loadProfileEnv(_0x4ccb7f);if(_0x2145ec){if(_0x2145ec[_0x540bd5])return _0x2145ec[_0x540bd5];if(_0x2145ec['TD_API_KEY'])return _0x2145ec[_0xf17769(0xa5)];}}const _0x20a914=loadUserConfigOnce();if(_0x20a914[_0x540bd5])return _0x20a914[_0x540bd5];if(_0x20a914[_0xf17769(0xa5)])return _0x20a914[_0xf17769(0xa5)];return undefined;}function cleanupLegacyEnvFile(_0x4acbeb){const _0x266bcf=a45_0x635fb3;if(!existsSync(_0x4acbeb))return![];try{const _0x16413a=readFileSync(_0x4acbeb,_0x266bcf(0x84)),_0x52e21f=_0x16413a['split']('\x0a'),_0x5cd581=_0x52e21f[_0x266bcf(0xcb)](_0x4345d0=>{const _0x21f5ee=_0x266bcf,_0x3a8f01=_0x4345d0[_0x21f5ee(0xa8)]();if(!_0x3a8f01||_0x3a8f01[_0x21f5ee(0x8a)]('#'))return!![];const [_0x72f63d]=_0x3a8f01[_0x21f5ee(0x83)]('=');return!_0x72f63d['startsWith'](_0x21f5ee(0xa5));}),_0x471ec8=_0x5cd581[_0x266bcf(0xa4)](_0x24871a=>{const _0x1eb595=_0x266bcf,_0x6cc179=_0x24871a['trim']();return _0x6cc179&&!_0x6cc179[_0x1eb595(0x8a)]('#');});if(!_0x471ec8)return unlinkSync(_0x4acbeb),!![];return writeFileSync(_0x4acbeb,_0x5cd581[_0x266bcf(0x95)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x38c4d1){const _0x46b3bc=a45_0x635fb3,_0x4dcfc9=a45_0x51e5ab['join'](getConfigDir(),_0x46b3bc(0x80)+_0x38c4d1);if(a45_0x287cda[_0x46b3bc(0xa0)](_0x4dcfc9)){validateSecureFilePermissions(_0x4dcfc9);try{const _0x215b60=a45_0x287cda[_0x46b3bc(0xb2)](_0x4dcfc9,'utf-8');return parseEnvFile(_0x215b60);}catch(_0x583d2d){console[_0x46b3bc(0xc6)]('Warning:\x20Failed\x20to\x20load\x20'+_0x4dcfc9+':\x20'+_0x583d2d);}}const _0x2c019c=a45_0x51e5ab[_0x46b3bc(0x95)](getConfigDir(),'profiles',_0x38c4d1,'.env');if(a45_0x287cda[_0x46b3bc(0xa0)](_0x2c019c)){validateSecureFilePermissions(_0x2c019c);try{const _0x4b72eb=a45_0x287cda['readFileSync'](_0x2c019c,_0x46b3bc(0x84));return parseEnvFile(_0x4b72eb);}catch(_0x309945){return console['warn'](_0x46b3bc(0x9f)+_0x2c019c+':\x20'+_0x309945),null;}}return null;}function getActiveProfileName(){const _0x4ba593=a45_0x635fb3,_0x5ac6fc=a45_0x51e5ab[_0x4ba593(0x95)](getConfigDir(),_0x4ba593(0xb3));if(!a45_0x287cda[_0x4ba593(0xa0)](_0x5ac6fc))return null;try{const _0x2a4218=a45_0x287cda[_0x4ba593(0xb2)](_0x5ac6fc,'utf-8'),_0x152139=JSON[_0x4ba593(0x92)](_0x2a4218);return _0x152139[_0x4ba593(0x7a)]||null;}catch{return null;}}export function saveAPIKey(_0x478474,_0x12bc49,_0xfa3a31){const _0x42db28=a45_0x635fb3,_0x45bfe3=getConfigDir(),_0x25fb7b=getConfigFilePath(_0xfa3a31);!existsSync(_0x45bfe3)&&mkdirSync(_0x45bfe3,{'recursive':!![],'mode':0x1c0});let _0x4dfc45={};if(existsSync(_0x25fb7b))try{const _0xcfae0f=readFileSync(_0x25fb7b,'utf-8');_0x4dfc45=parseEnvFile(_0xcfae0f);}catch(_0x2f8fae){console['warn'](_0x42db28(0xa9)+_0x25fb7b+':',_0x2f8fae);}const _0x27e7b8=_0x478474[_0x42db28(0xd0)]()[_0x42db28(0xad)](/-/g,'_');_0x4dfc45['TD_API_KEY_'+_0x27e7b8]=_0x12bc49;const _0x241338=Object['entries'](_0x4dfc45)[_0x42db28(0xb9)](([_0x4f3fa5,_0x32307a])=>_0x4f3fa5+'='+_0x32307a);writeFileSync(_0x25fb7b,_0x241338[_0x42db28(0x95)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x39aae9,_0x464281,_0x212360){const _0x1b4900=a45_0x635fb3;await saveKeychainAPIKey(_0x39aae9,_0x212360),setCachedCredential(_0x39aae9,_0x464281,_0x212360);const _0x52073c=getConfigFilePath(_0x212360);cleanupLegacyEnvFile(_0x52073c)&&console[_0x1b4900(0xc6)](a45_0x2f165f[_0x1b4900(0x94)](_0x1b4900(0xbf)));}export function loadConfig(){const _0x48176e=a45_0x635fb3,_0x63f5e2={'apiKeys':{},'defaultSite':'us01'},_0x2086dd=[_0x48176e(0xc1),_0x48176e(0x9b),'eu01',_0x48176e(0x8c),_0x48176e(0xb4),_0x48176e(0xcf),'dev-eu01','stg-us01',_0x48176e(0x8b),'stg-ap03'];for(const _0x1e8afe of _0x2086dd){const _0x8eae19=getAPIKey(_0x1e8afe);_0x8eae19&&(_0x63f5e2[_0x48176e(0x97)][_0x1e8afe]=_0x8eae19);}return _0x63f5e2;}
1
+ function a45_0x64bc(_0x5454b8,_0x34f17b){_0x5454b8=_0x5454b8-0x87;const _0x253c60=a45_0x253c();let _0x64bc27=_0x253c60[_0x5454b8];return _0x64bc27;}const a45_0x23de55=a45_0x64bc;(function(_0x185a97,_0x2ce5e0){const _0x4210f7=a45_0x64bc,_0x22c1b3=_0x185a97();while(!![]){try{const _0x4e6f21=-parseInt(_0x4210f7(0xad))/0x1*(-parseInt(_0x4210f7(0x99))/0x2)+-parseInt(_0x4210f7(0xa1))/0x3*(-parseInt(_0x4210f7(0xc5))/0x4)+parseInt(_0x4210f7(0xba))/0x5+parseInt(_0x4210f7(0x8b))/0x6+parseInt(_0x4210f7(0xc7))/0x7+-parseInt(_0x4210f7(0xa9))/0x8*(-parseInt(_0x4210f7(0xc3))/0x9)+-parseInt(_0x4210f7(0xc2))/0xa*(parseInt(_0x4210f7(0xc9))/0xb);if(_0x4e6f21===_0x2ce5e0)break;else _0x22c1b3['push'](_0x22c1b3['shift']());}catch(_0x50fd31){_0x22c1b3['push'](_0x22c1b3['shift']());}}}(a45_0x253c,0xaeda3));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x47fa58 from'node:fs';import*as a45_0x1b770d from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x5e871a from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x2306d0=a45_0x64bc;return process[_0x2306d0(0x89)][_0x2306d0(0xce)]||join(homedir(),_0x2306d0(0x90),_0x2306d0(0xa3));}export function getConfigFile(){const _0x1af82e=a45_0x64bc;return join(getConfigDir(),_0x1af82e(0x87));}export function getConfigFilePath(_0x2cd3f3){const _0xd06447=a45_0x64bc,_0xe87a3=getConfigDir();return _0x2cd3f3?a45_0x1b770d[_0xd06447(0xbb)](_0xe87a3,_0xd06447(0xcf)+_0x2cd3f3):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0x23de55(0xca),a45_0x23de55(0x96));export function getLLMProjectCacheFile(_0x6dcc2b){return llmProjectCache['path'](_0x6dcc2b);}export function readCachedLLMProject(_0xd13ce5){const _0x38454a=a45_0x23de55,_0x1d0cf1=llmProjectCache[_0x38454a(0x8a)](_0xd13ce5);if(_0x1d0cf1&&typeof _0x1d0cf1['id']===_0x38454a(0x9c)&&typeof _0x1d0cf1['name']===_0x38454a(0x9c))return _0x1d0cf1;return null;}export function writeCachedLLMProject(_0x4e780b,_0x37598d,_0x136ded){const _0x450dc9=a45_0x23de55;try{llmProjectCache[_0x450dc9(0xa2)]({'name':_0x4e780b,'id':_0x37598d},_0x136ded);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x23de55(0xcc),a45_0x23de55(0xb0));export function getLLMAgentCacheFile(_0x565fd1){const _0x3ccaa1=a45_0x23de55;return llmAgentCache[_0x3ccaa1(0xc4)](_0x565fd1);}export function readCachedLLMAgent(_0x272503){const _0x7a0b7d=a45_0x23de55,_0x4b1743=llmAgentCache[_0x7a0b7d(0x8a)](_0x272503);if(_0x4b1743&&typeof _0x4b1743['id']===_0x7a0b7d(0x9c)&&typeof _0x4b1743[_0x7a0b7d(0xc6)]===_0x7a0b7d(0x9c)&&typeof _0x4b1743['projectId']===_0x7a0b7d(0x9c))return _0x4b1743;return null;}export function writeCachedLLMAgent(_0x3fbf73,_0x57ba38,_0x178ca4,_0x5e9e37){const _0x2a0a55=a45_0x23de55;try{llmAgentCache[_0x2a0a55(0xa2)]({'name':_0x3fbf73,'id':_0x57ba38,'projectId':_0x178ca4},_0x5e9e37);}catch{}}export function clearCachedLLMAgent(_0x283f33){const _0x291928=a45_0x23de55;try{llmAgentCache[_0x291928(0xa5)](_0x283f33);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0x23de55(0x95),a45_0x23de55(0xb5),{'suffix':a45_0x23de55(0xae)});export function getAccountInfoCacheFile(_0x3bd17c){return accountInfoCache['path'](_0x3bd17c);}export function readCachedAccountInfo(_0x33d4cc){const _0x58caf0=a45_0x23de55,_0x4a97b7=accountInfoCache[_0x58caf0(0x8a)](_0x33d4cc);if(_0x4a97b7&&typeof _0x4a97b7[_0x58caf0(0xc0)]===_0x58caf0(0x9c)&&typeof _0x4a97b7[_0x58caf0(0x91)]===_0x58caf0(0xbf))return _0x4a97b7;return null;}export function writeCachedAccountInfo(_0x21ea4f,_0x9260e9,_0x3aa136){try{accountInfoCache['write']({'site':_0x21ea4f,'accountId':_0x9260e9,'cachedAt':new Date()['toISOString']()},_0x3aa136);}catch{}}export function parseEnvFile(_0x52f0e2){const _0x148064=a45_0x23de55,_0x4c09bd={};for(const _0x4ac076 of _0x52f0e2[_0x148064(0xbd)]('\x0a')){const _0x1d3cdb=_0x4ac076[_0x148064(0x92)]();if(!_0x1d3cdb||_0x1d3cdb[_0x148064(0x8e)]('#'))continue;const _0x561e63=_0x1d3cdb[_0x148064(0xa7)](/^([^=]+)=(.*)$/);if(_0x561e63){const _0x4c40b7=_0x561e63[0x1]['trim']();let _0x32d0a9=_0x561e63[0x2][_0x148064(0x92)]();(_0x32d0a9['startsWith']('\x22')&&_0x32d0a9['endsWith']('\x22')||_0x32d0a9['startsWith']('\x27')&&_0x32d0a9[_0x148064(0xaf)]('\x27'))&&(_0x32d0a9=_0x32d0a9[_0x148064(0xb2)](0x1,-0x1)),_0x4c09bd[_0x4c40b7]=_0x32d0a9;}}return _0x4c09bd;}export function readUserConfig(){const _0x392e1e=a45_0x23de55,_0x3c0807=getConfigFile();if(!existsSync(_0x3c0807))return{};try{const _0x22d721=readFileSync(_0x3c0807,_0x392e1e(0xb4));return parseEnvFile(_0x22d721);}catch(_0x396f4f){return console[_0x392e1e(0xd3)](_0x392e1e(0xab)+_0x3c0807+':',_0x396f4f),{};}}export function resolveSite(_0x5eb3e4){const _0x1602cd=a45_0x23de55,_0x4c2ac2=[_0x1602cd(0xb3),_0x1602cd(0xac),'eu01',_0x1602cd(0x9f),_0x1602cd(0xa4),_0x1602cd(0x88),_0x1602cd(0xb6),'stg-us01','stg-jp01',_0x1602cd(0xb9)];if(_0x4c2ac2[_0x1602cd(0x98)](_0x5eb3e4))return _0x5eb3e4;if(_0x5eb3e4 in SITE_ALIASES)return SITE_ALIASES[_0x5eb3e4];return console[_0x1602cd(0xd3)](_0x1602cd(0xb8)+_0x5eb3e4+_0x1602cd(0xd7)),_0x1602cd(0xb3);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0xa2d812,_0x56c7a0){const _0x4d9788=a45_0x23de55,_0x3cc355=_0x56c7a0||getActiveProfileName();if(_0x3cc355){const _0xe16165=_0x4d9788(0xcb)+normalizeProfileForEnvVar(_0x3cc355);if(process[_0x4d9788(0x89)][_0xe16165])return process[_0x4d9788(0x89)][_0xe16165];}if(process[_0x4d9788(0x89)][_0x4d9788(0xd6)])return process[_0x4d9788(0x89)]['TDX_API_KEY'];if(process[_0x4d9788(0x89)][_0x4d9788(0xd4)])return process[_0x4d9788(0x89)][_0x4d9788(0xd4)];const _0x582932=_0xa2d812['toUpperCase']()['replace'](/-/g,'_'),_0x5a1b6b=_0x4d9788(0xaa)+_0x582932;if(_0x3cc355){const _0x40458b=loadProfileEnv(_0x3cc355);if(_0x40458b){if(_0x40458b[_0x5a1b6b])return _0x40458b[_0x5a1b6b];if(_0x40458b[_0x4d9788(0xd4)])return _0x40458b['TD_API_KEY'];}}const _0x429870=loadUserConfigOnce();if(_0x429870[_0x5a1b6b])return _0x429870[_0x5a1b6b];if(_0x429870[_0x4d9788(0xd4)])return _0x429870[_0x4d9788(0xd4)];return undefined;}export function normalizeProfileForEnvVar(_0x2268ec){const _0x12de80=a45_0x23de55;return _0x2268ec[_0x12de80(0x97)]()[_0x12de80(0xa0)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x54e9c9,_0xf274b1){const _0x3214d7=a45_0x23de55,_0x780e12=_0xf274b1||getActiveProfileName()||undefined;if(_0x780e12){const _0x536fab=_0x3214d7(0xcb)+normalizeProfileForEnvVar(_0x780e12);if(process[_0x3214d7(0x89)][_0x536fab])return{'apiKey':process['env'][_0x536fab],'source':_0x536fab+_0x3214d7(0x94),'isDeprecated':![]};const _0x8faed8=getCachedCredential(_0x54e9c9,_0x780e12);if(_0x8faed8)return{'apiKey':_0x8faed8,'source':_0x3214d7(0x9b)+_0x780e12+')','isDeprecated':![]};const _0x26424c=await getKeychainAPIKey(_0x780e12);if(_0x26424c)return setCachedCredential(_0x26424c,_0x54e9c9,_0x780e12),{'apiKey':_0x26424c,'source':_0x3214d7(0x9b)+_0x780e12+')','isDeprecated':![]};}if(process[_0x3214d7(0x89)][_0x3214d7(0xd6)])return{'apiKey':process[_0x3214d7(0x89)][_0x3214d7(0xd6)],'source':_0x3214d7(0xb1),'isDeprecated':![]};if(!_0x780e12){const _0x3fc52f=getCachedCredential(_0x54e9c9,undefined);if(_0x3fc52f)return{'apiKey':_0x3fc52f,'source':_0x3214d7(0xc8),'isDeprecated':![]};const _0x39476c=await getKeychainAPIKey(undefined);if(_0x39476c)return setCachedCredential(_0x39476c,_0x54e9c9,undefined),{'apiKey':_0x39476c,'source':_0x3214d7(0xc8),'isDeprecated':![]};}if(process[_0x3214d7(0x89)][_0x3214d7(0xd4)])return{'apiKey':process[_0x3214d7(0x89)][_0x3214d7(0xd4)],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x466a5b=getLegacyEnvAPIKey(_0x54e9c9,_0x780e12);if(_0x466a5b){const _0x22f25c=await isKeychainAvailable();if(_0x22f25c)try{await saveKeychainAPIKey(_0x466a5b,_0x780e12),setCachedCredential(_0x466a5b,_0x54e9c9,_0x780e12);const _0x168a65=getConfigFilePath(_0x780e12);cleanupLegacyEnvFile(_0x168a65)&&console['warn'](a45_0x5e871a[_0x3214d7(0xd1)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x2505be){console['warn'](a45_0x5e871a[_0x3214d7(0xd1)](_0x3214d7(0x9d)+_0x2505be));}const _0x59c6e1=_0x780e12?'legacy\x20.env\x20file\x20(profile:\x20'+_0x780e12+')':'legacy\x20.env\x20file';return{'apiKey':_0x466a5b,'source':_0x59c6e1,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x26a1c1,_0x3983e5,_0x5e61a7=!![]){const _0x5c70ea=a45_0x23de55,_0x181e56=await resolveAPIKeyAsync(_0x26a1c1,_0x3983e5);if(!_0x181e56)return undefined;if(_0x5e61a7&&_0x181e56['isDeprecated']&&_0x181e56[_0x5c70ea(0x8f)][_0x5c70ea(0x98)](_0x5c70ea(0xd4))){const _0x486d94=_0x3983e5||getActiveProfileName()||undefined,_0x2027f4=_0x486d94?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x486d94):_0x5c70ea(0xb7);console[_0x5c70ea(0xd3)](a45_0x5e871a[_0x5c70ea(0xd1)]('Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a'+(_0x5c70ea(0xa8)+_0x2027f4+').')));}return _0x181e56[_0x5c70ea(0x9a)];}function getLegacyEnvAPIKey(_0x520dd8,_0x349f0c){const _0x4421ed=a45_0x23de55,_0x4b3e29=_0x520dd8[_0x4421ed(0x97)]()[_0x4421ed(0xa0)](/-/g,'_'),_0x53d730=_0x4421ed(0xaa)+_0x4b3e29;if(_0x349f0c){const _0x3c1ce0=loadProfileEnv(_0x349f0c);if(_0x3c1ce0){if(_0x3c1ce0[_0x53d730])return _0x3c1ce0[_0x53d730];if(_0x3c1ce0[_0x4421ed(0xd4)])return _0x3c1ce0[_0x4421ed(0xd4)];}}const _0x124b37=loadUserConfigOnce();if(_0x124b37[_0x53d730])return _0x124b37[_0x53d730];if(_0x124b37['TD_API_KEY'])return _0x124b37[_0x4421ed(0xd4)];return undefined;}function cleanupLegacyEnvFile(_0x116396){const _0x17b7cc=a45_0x23de55;if(!existsSync(_0x116396))return![];try{const _0x520b4a=readFileSync(_0x116396,_0x17b7cc(0xb4)),_0x423a59=_0x520b4a[_0x17b7cc(0xbd)]('\x0a'),_0x3084b1=_0x423a59[_0x17b7cc(0xc1)](_0x2fe3d4=>{const _0x1a9a3a=_0x17b7cc,_0x5148ff=_0x2fe3d4[_0x1a9a3a(0x92)]();if(!_0x5148ff||_0x5148ff[_0x1a9a3a(0x8e)]('#'))return!![];const [_0x217dc1]=_0x5148ff['split']('=');return!_0x217dc1['startsWith'](_0x1a9a3a(0xd4));}),_0x1db0ea=_0x3084b1['some'](_0x419020=>{const _0x5b8d3b=_0x17b7cc,_0x3d66d0=_0x419020[_0x5b8d3b(0x92)]();return _0x3d66d0&&!_0x3d66d0[_0x5b8d3b(0x8e)]('#');});if(!_0x1db0ea)return unlinkSync(_0x116396),!![];return writeFileSync(_0x116396,_0x3084b1['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function a45_0x253c(){const _0x274ea8=['existsSync','TDX_API_KEY','\x27,\x20defaulting\x20to\x20us01','entries','map','.env','dev-us01','env','read','5828226LXgtZo','Warning:\x20Failed\x20to\x20read\x20','profile','startsWith','source','.config','accountId','trim','tdx.json','\x20env\x20var','account_info','config/llm-project','toUpperCase','includes','444DgPQbD','apiKey','keychain\x20(profile:\x20','string','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','apiKeys','ap02','replace','6qogHik','write','tdx','ap03','clear','readFileSync','match','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','10643312GBMBOr','TD_API_KEY_','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','jp01','617oRxinG','.json','endsWith','config/llm-agent','TDX_API_KEY\x20env\x20var','slice','us01','utf-8','config/account-info','dev-eu01','TDX_API_KEY_<PROFILE>','Warning:\x20Unknown\x20site\x20\x27','stg-ap03','1690260swqrst','join','stg-jp01','split','Warning:\x20Failed\x20to\x20load\x20','number','site','filter','10rBTPIJ','9WVGNcT','path','626264hyAKes','name','8054221vQxDIl','keychain','38767861kiyrip','llm_default_project','TDX_API_KEY_','llm_default_agent','stg-us01','TDX_CONFIG_DIR','.env.','parse','yellow','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','warn','TD_API_KEY'];a45_0x253c=function(){return _0x274ea8;};return a45_0x253c();}function loadProfileEnv(_0x2e0536){const _0xbf0dd8=a45_0x23de55,_0x3cf742=a45_0x1b770d[_0xbf0dd8(0xbb)](getConfigDir(),_0xbf0dd8(0xcf)+_0x2e0536);if(a45_0x47fa58['existsSync'](_0x3cf742)){validateSecureFilePermissions(_0x3cf742);try{const _0x362d90=a45_0x47fa58[_0xbf0dd8(0xa6)](_0x3cf742,_0xbf0dd8(0xb4));return parseEnvFile(_0x362d90);}catch(_0x2a3747){console[_0xbf0dd8(0xd3)](_0xbf0dd8(0xbe)+_0x3cf742+':\x20'+_0x2a3747);}}const _0x45cc03=a45_0x1b770d[_0xbf0dd8(0xbb)](getConfigDir(),'profiles',_0x2e0536,_0xbf0dd8(0x87));if(a45_0x47fa58[_0xbf0dd8(0xd5)](_0x45cc03)){validateSecureFilePermissions(_0x45cc03);try{const _0x2b24fc=a45_0x47fa58[_0xbf0dd8(0xa6)](_0x45cc03,'utf-8');return parseEnvFile(_0x2b24fc);}catch(_0x4b0794){return console[_0xbf0dd8(0xd3)](_0xbf0dd8(0xbe)+_0x45cc03+':\x20'+_0x4b0794),null;}}return null;}function getActiveProfileName(){const _0x75711=a45_0x23de55,_0x438a5d=a45_0x1b770d[_0x75711(0xbb)](getConfigDir(),_0x75711(0x93));if(!a45_0x47fa58[_0x75711(0xd5)](_0x438a5d))return null;try{const _0x48724f=a45_0x47fa58[_0x75711(0xa6)](_0x438a5d,'utf-8'),_0x3a0af1=JSON[_0x75711(0xd0)](_0x48724f);return _0x3a0af1[_0x75711(0x8d)]||null;}catch{return null;}}export function saveAPIKey(_0x43dc94,_0x470fee,_0x572b5c){const _0x3cd219=a45_0x23de55,_0x3e8fbf=getConfigDir(),_0x39355c=getConfigFilePath(_0x572b5c);!existsSync(_0x3e8fbf)&&mkdirSync(_0x3e8fbf,{'recursive':!![],'mode':0x1c0});let _0x5bfdd7={};if(existsSync(_0x39355c))try{const _0x33dd6d=readFileSync(_0x39355c,_0x3cd219(0xb4));_0x5bfdd7=parseEnvFile(_0x33dd6d);}catch(_0x31a4b3){console[_0x3cd219(0xd3)](_0x3cd219(0x8c)+_0x39355c+':',_0x31a4b3);}const _0x2217cf=_0x43dc94[_0x3cd219(0x97)]()[_0x3cd219(0xa0)](/-/g,'_');_0x5bfdd7[_0x3cd219(0xaa)+_0x2217cf]=_0x470fee;const _0x319240=Object[_0x3cd219(0xd8)](_0x5bfdd7)[_0x3cd219(0xd9)](([_0x57790b,_0x2a7ede])=>_0x57790b+'='+_0x2a7ede);writeFileSync(_0x39355c,_0x319240[_0x3cd219(0xbb)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x157c66,_0xf7afd6,_0xab4649){const _0x3a8a6d=a45_0x23de55;await saveKeychainAPIKey(_0x157c66,_0xab4649),setCachedCredential(_0x157c66,_0xf7afd6,_0xab4649);const _0x4d44c3=getConfigFilePath(_0xab4649);cleanupLegacyEnvFile(_0x4d44c3)&&console[_0x3a8a6d(0xd3)](a45_0x5e871a[_0x3a8a6d(0xd1)](_0x3a8a6d(0xd2)));}export function loadConfig(){const _0x49350d=a45_0x23de55,_0x245d67={'apiKeys':{},'defaultSite':_0x49350d(0xb3)},_0x36f4cf=[_0x49350d(0xb3),_0x49350d(0xac),'eu01',_0x49350d(0x9f),_0x49350d(0xa4),_0x49350d(0x88),_0x49350d(0xb6),_0x49350d(0xcd),_0x49350d(0xbc),_0x49350d(0xb9)];for(const _0xce009e of _0x36f4cf){const _0x56c57e=getAPIKey(_0xce009e);_0x56c57e&&(_0x245d67[_0x49350d(0x9e)][_0xce009e]=_0x56c57e);}return _0x245d67;}
@@ -1 +1 @@
1
- const a46_0x2d8e06=a46_0xc114;function a46_0xc114(_0x4b863c,_0x4e1c13){_0x4b863c=_0x4b863c-0xd7;const _0x248bff=a46_0x248b();let _0xc1143b=_0x248bff[_0x4b863c];return _0xc1143b;}(function(_0x1d4fa2,_0x4c1362){const _0x45ea81=a46_0xc114,_0x52fd0a=_0x1d4fa2();while(!![]){try{const _0x240692=parseInt(_0x45ea81(0xdb))/0x1+-parseInt(_0x45ea81(0xde))/0x2+parseInt(_0x45ea81(0xe0))/0x3*(parseInt(_0x45ea81(0xd9))/0x4)+parseInt(_0x45ea81(0xda))/0x5*(parseInt(_0x45ea81(0xe8))/0x6)+-parseInt(_0x45ea81(0xdf))/0x7+parseInt(_0x45ea81(0xe7))/0x8*(parseInt(_0x45ea81(0xe2))/0x9)+parseInt(_0x45ea81(0xdd))/0xa*(parseInt(_0x45ea81(0xe5))/0xb);if(_0x240692===_0x4c1362)break;else _0x52fd0a['push'](_0x52fd0a['shift']());}catch(_0x55d19e){_0x52fd0a['push'](_0x52fd0a['shift']());}}}(a46_0x248b,0xc0208));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a46_0x2d8e06(0xd8),a46_0x2d8e06(0xe1));function a46_0x248b(){const _0x2b171f=['connections','now','33ZyzyrU','read','60064iPxvdf','251562pyhowE','clear','connections-{profile}.json','4lLUdOx','35KmHhGG','346122UtnZBw','write','4929480meDHuB','2121996ghBYsE','7963662XPPjzQ','2533911IkNBBU','core/connection-cache','27bHmEsh'];a46_0x248b=function(){return _0x2b171f;};return a46_0x248b();}export function loadCachedConnections(_0x15ef6c){const _0x1368a7=a46_0x2d8e06,_0x1a6ef8=connectionCache[_0x1368a7(0xe6)](_0x15ef6c);return _0x1a6ef8?.[_0x1368a7(0xe3)]??null;}export function saveCachedConnections(_0x31efc1,_0x5bda64){const _0x1be731=a46_0x2d8e06;connectionCache[_0x1be731(0xdc)](_0x31efc1,{'connections':_0x5bda64,'cachedAt':Date[_0x1be731(0xe4)]()});}export function clearConnectionCache(_0x3c081d){const _0x76966e=a46_0x2d8e06;connectionCache[_0x76966e(0xd7)](_0x3c081d);}
1
+ const a46_0x57a3dd=a46_0x5000;function a46_0x36ad(){const _0x40b2fa=['connections-{profile}.json','1123988XZeWCm','3089891vMMiIk','connections','27034065zldeSi','1696604ZetidX','1402517dFZrIW','5040255lmOYFs','core/connection-cache','10012608ZMlrou','clear','write','6tRBrRo','18peTGSG'];a46_0x36ad=function(){return _0x40b2fa;};return a46_0x36ad();}function a46_0x5000(_0x19d2a8,_0x254cee){_0x19d2a8=_0x19d2a8-0x1bb;const _0x36ad82=a46_0x36ad();let _0x5000a1=_0x36ad82[_0x19d2a8];return _0x5000a1;}(function(_0x99e802,_0x3bbb00){const _0x6eccbd=a46_0x5000,_0x32b579=_0x99e802();while(!![]){try{const _0x113284=-parseInt(_0x6eccbd(0x1c5))/0x1+-parseInt(_0x6eccbd(0x1c0))/0x2*(-parseInt(_0x6eccbd(0x1bd))/0x3)+parseInt(_0x6eccbd(0x1c4))/0x4+parseInt(_0x6eccbd(0x1c6))/0x5+parseInt(_0x6eccbd(0x1be))/0x6*(parseInt(_0x6eccbd(0x1c1))/0x7)+parseInt(_0x6eccbd(0x1c8))/0x8+-parseInt(_0x6eccbd(0x1c3))/0x9;if(_0x113284===_0x3bbb00)break;else _0x32b579['push'](_0x32b579['shift']());}catch(_0x41b1f9){_0x32b579['push'](_0x32b579['shift']());}}}(a46_0x36ad,0xb12c7));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a46_0x57a3dd(0x1bf),a46_0x57a3dd(0x1c7));export function loadCachedConnections(_0x7c5d6b){const _0x11b301=a46_0x57a3dd,_0x3afb03=connectionCache['read'](_0x7c5d6b);return _0x3afb03?.[_0x11b301(0x1c2)]??null;}export function saveCachedConnections(_0x1e29d6,_0x4c6012){const _0x354761=a46_0x57a3dd;connectionCache[_0x354761(0x1bc)](_0x1e29d6,{'connections':_0x4c6012,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x3789ef){const _0x455c86=a46_0x57a3dd;connectionCache[_0x455c86(0x1bb)](_0x3789ef);}
@@ -1 +1 @@
1
- function a47_0x4e6f(){const _0x3aee72=['1686009hojOKi','Enter\x20custom\x20site','findIndex','ap02\x20-\x20Korea','jp\x20\x20\x20-\x20Japan','length','other','9219330PjybGo','1123534XFbElm','3422652wVofLE','5eMjvZr','133CymRVt','1410546KuQiVf','225VTHWcf','jp01','904EFxrUy','eu\x20\x20\x20-\x20Europe','608170bsUYAX','us01','value','number','push','ap02'];a47_0x4e6f=function(){return _0x3aee72;};return a47_0x4e6f();}const a47_0x3b1fa4=a47_0x3ecc;(function(_0x43d798,_0x2484a8){const _0x1f3d1d=a47_0x3ecc,_0xdf35d6=_0x43d798();while(!![]){try{const _0x13a386=parseInt(_0x1f3d1d(0x1cc))/0x1+parseInt(_0x1f3d1d(0x1d4))/0x2+-parseInt(_0x1f3d1d(0x1d8))/0x3+parseInt(_0x1f3d1d(0x1d5))/0x4*(-parseInt(_0x1f3d1d(0x1d6))/0x5)+-parseInt(_0x1f3d1d(0x1d3))/0x6+parseInt(_0x1f3d1d(0x1d7))/0x7*(-parseInt(_0x1f3d1d(0x1db))/0x8)+-parseInt(_0x1f3d1d(0x1d9))/0x9*(-parseInt(_0x1f3d1d(0x1dd))/0xa);if(_0x13a386===_0x2484a8)break;else _0xdf35d6['push'](_0xdf35d6['shift']());}catch(_0x4e5735){_0xdf35d6['push'](_0xdf35d6['shift']());}}}(a47_0x4e6f,0xdc9e6));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;function a47_0x3ecc(_0x7c80dc,_0x170e36){_0x7c80dc=_0x7c80dc-0x1c7;const _0x4e6f39=a47_0x4e6f();let _0x3ecc9d=_0x4e6f39[_0x7c80dc];return _0x3ecc9d;}export function resolveLimit(_0x2cc6a8,_0x48f2ab){const _0x18a5ab=a47_0x3ecc;if(_0x2cc6a8===undefined)return _0x48f2ab;if(typeof _0x2cc6a8===_0x18a5ab(0x1c9))return _0x2cc6a8;return parseInt(_0x2cc6a8,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a47_0x3b1fa4(0x1c7)},{'title':a47_0x3b1fa4(0x1d0),'value':a47_0x3b1fa4(0x1da)},{'title':a47_0x3b1fa4(0x1dc),'value':'eu01'},{'title':a47_0x3b1fa4(0x1cf),'value':a47_0x3b1fa4(0x1cb)}];export function buildSiteChoices(_0x52b34d){const _0x1947cf=a47_0x3b1fa4,_0x2c141c=[...STANDARD_SITE_CHOICES];let _0x57c545=_0x2c141c[_0x1947cf(0x1ce)](_0x556fb3=>_0x556fb3[_0x1947cf(0x1c8)]===_0x52b34d);return _0x57c545===-0x1&&_0x52b34d!==_0x1947cf(0x1c7)&&(_0x2c141c[_0x1947cf(0x1ca)]({'title':_0x52b34d,'value':_0x52b34d}),_0x57c545=_0x2c141c[_0x1947cf(0x1d1)]-0x1),_0x2c141c[_0x1947cf(0x1ca)]({'title':_0x1947cf(0x1cd),'value':_0x1947cf(0x1d2)}),{'choices':_0x2c141c,'initialIndex':_0x57c545>=0x0?_0x57c545:0x0};}
1
+ const a47_0x2d02e9=a47_0x5664;(function(_0x4113d8,_0x599652){const _0xdfe932=a47_0x5664,_0x5d9c69=_0x4113d8();while(!![]){try{const _0x168add=-parseInt(_0xdfe932(0x7f))/0x1+-parseInt(_0xdfe932(0x80))/0x2*(-parseInt(_0xdfe932(0x84))/0x3)+-parseInt(_0xdfe932(0x85))/0x4*(parseInt(_0xdfe932(0x8b))/0x5)+parseInt(_0xdfe932(0x89))/0x6*(parseInt(_0xdfe932(0x91))/0x7)+-parseInt(_0xdfe932(0x7e))/0x8+-parseInt(_0xdfe932(0x93))/0x9+parseInt(_0xdfe932(0x92))/0xa*(parseInt(_0xdfe932(0x88))/0xb);if(_0x168add===_0x599652)break;else _0x5d9c69['push'](_0x5d9c69['shift']());}catch(_0x5b7400){_0x5d9c69['push'](_0x5d9c69['shift']());}}}(a47_0x5d47,0xc8fee));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x2ac152,_0x23b919){const _0x26e4c9=a47_0x5664;if(_0x2ac152===undefined)return _0x23b919;if(typeof _0x2ac152===_0x26e4c9(0x8e))return _0x2ac152;return parseInt(_0x2ac152,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a47_0x2d02e9(0x8d),'value':a47_0x2d02e9(0x82)},{'title':a47_0x2d02e9(0x7d),'value':a47_0x2d02e9(0x81)},{'title':a47_0x2d02e9(0x8f),'value':'eu01'},{'title':a47_0x2d02e9(0x8a),'value':a47_0x2d02e9(0x8c)}];function a47_0x5664(_0x422af7,_0x43a9a5){_0x422af7=_0x422af7-0x7d;const _0x5d4780=a47_0x5d47();let _0x5664b3=_0x5d4780[_0x422af7];return _0x5664b3;}function a47_0x5d47(){const _0x468438=['push','7osyDKs','2523440KqlDYK','6714999cknJRe','jp\x20\x20\x20-\x20Japan','7457280WeYwVy','1402894hCjHkJ','134540ozamBG','jp01','us01','findIndex','45JHiTSx','25676FQGFDf','other','value','88jZHtAt','8302452lPkEBn','ap02\x20-\x20Korea','395RKvRcQ','ap02','us\x20\x20\x20-\x20United\x20States','number','eu\x20\x20\x20-\x20Europe'];a47_0x5d47=function(){return _0x468438;};return a47_0x5d47();}export function buildSiteChoices(_0x413742){const _0x556739=a47_0x2d02e9,_0x1a7a82=[...STANDARD_SITE_CHOICES];let _0x99a9c7=_0x1a7a82[_0x556739(0x83)](_0x2877a6=>_0x2877a6[_0x556739(0x87)]===_0x413742);return _0x99a9c7===-0x1&&_0x413742!==_0x556739(0x82)&&(_0x1a7a82[_0x556739(0x90)]({'title':_0x413742,'value':_0x413742}),_0x99a9c7=_0x1a7a82['length']-0x1),_0x1a7a82[_0x556739(0x90)]({'title':'Enter\x20custom\x20site','value':_0x556739(0x86)}),{'choices':_0x1a7a82,'initialIndex':_0x99a9c7>=0x0?_0x99a9c7:0x0};}
@@ -1 +1 @@
1
- function a48_0x2314(_0x1e0019,_0x4ba1b3){_0x1e0019=_0x1e0019-0x79;const _0x18fc13=a48_0x18fc();let _0x2314ff=_0x18fc13[_0x1e0019];return _0x2314ff;}(function(_0xc17da9,_0x9f4225){const _0x50f89b=a48_0x2314,_0xe9a5e2=_0xc17da9();while(!![]){try{const _0x47c922=parseInt(_0x50f89b(0x86))/0x1+-parseInt(_0x50f89b(0x80))/0x2+parseInt(_0x50f89b(0x81))/0x3+parseInt(_0x50f89b(0x7b))/0x4+parseInt(_0x50f89b(0x7d))/0x5+parseInt(_0x50f89b(0x7c))/0x6+-parseInt(_0x50f89b(0x85))/0x7;if(_0x47c922===_0x9f4225)break;else _0xe9a5e2['push'](_0xe9a5e2['shift']());}catch(_0x312ae5){_0xe9a5e2['push'](_0xe9a5e2['shift']());}}}(a48_0x18fc,0xae944));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x33230e,_0x588e48){const _0x42fb95=a48_0x2314,_0x49dbf4=_0x33230e||_0x42fb95(0x7a),_0x1a98f1=_0x588e48||_0x42fb95(0x7e);return _0x49dbf4+':'+_0x1a98f1;}export function getCachedCredential(_0x2f637f,_0x143fc9){const _0x4a0bd3=a48_0x2314,_0x94ba8=getCacheKey(_0x2f637f,_0x143fc9),_0x237658=cache[_0x4a0bd3(0x79)](_0x94ba8);if(!_0x237658)return null;if(Date['now']()-_0x237658[_0x4a0bd3(0x7f)]>CACHE_TTL_MS)return cache['delete'](_0x94ba8),null;return _0x237658[_0x4a0bd3(0x87)];}function a48_0x18fc(){const _0x5e961d=['apiKey','set','get','__default_site__','762456ZZRcPX','3141882minmFA','6318185XUYXED','__default_profile__','loadedAt','1286328xtKmIV','1611213XsWxwL','delete','clear','now','13182848lnsRPE','726535XSdFip'];a48_0x18fc=function(){return _0x5e961d;};return a48_0x18fc();}export function setCachedCredential(_0x11542f,_0x581aee,_0x47c6ee){const _0x4b1fa7=a48_0x2314,_0x3bd0d4=getCacheKey(_0x581aee,_0x47c6ee);cache[_0x4b1fa7(0x88)](_0x3bd0d4,{'apiKey':_0x11542f,'loadedAt':Date[_0x4b1fa7(0x84)]()});}export function clearCredentialCache(){const _0x3515b8=a48_0x2314;cache[_0x3515b8(0x83)]();}export function clearCachedCredential(_0x2b4b3e,_0xb8b6a7){const _0x2eede0=a48_0x2314,_0x3afac3=getCacheKey(_0x2b4b3e,_0xb8b6a7);cache[_0x2eede0(0x82)](_0x3afac3);}
1
+ (function(_0x3c8df6,_0x2354d1){const _0x4f0c62=a48_0x11ad,_0x43d3ad=_0x3c8df6();while(!![]){try{const _0x3303de=parseInt(_0x4f0c62(0x1a6))/0x1+-parseInt(_0x4f0c62(0x1a2))/0x2+-parseInt(_0x4f0c62(0x197))/0x3*(parseInt(_0x4f0c62(0x19c))/0x4)+parseInt(_0x4f0c62(0x1a5))/0x5+parseInt(_0x4f0c62(0x199))/0x6*(-parseInt(_0x4f0c62(0x1a1))/0x7)+parseInt(_0x4f0c62(0x19a))/0x8+-parseInt(_0x4f0c62(0x19d))/0x9*(parseInt(_0x4f0c62(0x19f))/0xa);if(_0x3303de===_0x2354d1)break;else _0x43d3ad['push'](_0x43d3ad['shift']());}catch(_0x4bc51e){_0x43d3ad['push'](_0x43d3ad['shift']());}}}(a48_0x1d84,0x31629));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5c0cbd,_0xd0421c){const _0x2265fb=a48_0x11ad,_0x44faf6=_0x5c0cbd||_0x2265fb(0x1a3),_0x4aad6f=_0xd0421c||_0x2265fb(0x19e);return _0x44faf6+':'+_0x4aad6f;}function a48_0x1d84(){const _0x8601d0=['7NMpGzJ','586184IbwYpa','__default_site__','now','547340gMCqnw','387434JbUUJE','set','3021JhBCCw','get','1807062smfLLM','2778120iXYGWn','delete','68CtErsJ','54BQlSzC','__default_profile__','50830aJAwmv','apiKey'];a48_0x1d84=function(){return _0x8601d0;};return a48_0x1d84();}export function getCachedCredential(_0x3ae2b4,_0x5cd587){const _0x9b8c04=a48_0x11ad,_0x4a6a44=getCacheKey(_0x3ae2b4,_0x5cd587),_0x5e4232=cache[_0x9b8c04(0x198)](_0x4a6a44);if(!_0x5e4232)return null;if(Date[_0x9b8c04(0x1a4)]()-_0x5e4232['loadedAt']>CACHE_TTL_MS)return cache['delete'](_0x4a6a44),null;return _0x5e4232[_0x9b8c04(0x1a0)];}export function setCachedCredential(_0x4f5741,_0x59778f,_0x2bf70f){const _0x173716=a48_0x11ad,_0x4f4671=getCacheKey(_0x59778f,_0x2bf70f);cache[_0x173716(0x1a7)](_0x4f4671,{'apiKey':_0x4f5741,'loadedAt':Date[_0x173716(0x1a4)]()});}function a48_0x11ad(_0x50d0ce,_0x34db53){_0x50d0ce=_0x50d0ce-0x197;const _0x1d8406=a48_0x1d84();let _0x11adb4=_0x1d8406[_0x50d0ce];return _0x11adb4;}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x51df9f,_0x3dcfd6){const _0x598ef6=a48_0x11ad,_0x267838=getCacheKey(_0x51df9f,_0x3dcfd6);cache[_0x598ef6(0x19b)](_0x267838);}
@@ -1 +1 @@
1
- function a49_0x55ac(_0x2fbf4f,_0x568197){_0x2fbf4f=_0x2fbf4f-0x165;const _0x5d7970=a49_0x5d79();let _0x55acf0=_0x5d7970[_0x2fbf4f];return _0x55acf0;}const a49_0x53dfdf=a49_0x55ac;(function(_0x158dce,_0x2291a3){const _0x3406ff=a49_0x55ac,_0x2b8f19=_0x158dce();while(!![]){try{const _0x3ef040=parseInt(_0x3406ff(0x17d))/0x1*(parseInt(_0x3406ff(0x181))/0x2)+parseInt(_0x3406ff(0x1ac))/0x3*(parseInt(_0x3406ff(0x168))/0x4)+-parseInt(_0x3406ff(0x16a))/0x5+parseInt(_0x3406ff(0x1a6))/0x6+parseInt(_0x3406ff(0x178))/0x7*(parseInt(_0x3406ff(0x1ab))/0x8)+parseInt(_0x3406ff(0x19e))/0x9*(-parseInt(_0x3406ff(0x17e))/0xa)+-parseInt(_0x3406ff(0x1a4))/0xb*(parseInt(_0x3406ff(0x18a))/0xc);if(_0x3ef040===_0x2291a3)break;else _0x2b8f19['push'](_0x2b8f19['shift']());}catch(_0x238ed8){_0x2b8f19['push'](_0x2b8f19['shift']());}}}(a49_0x5d79,0x76970));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a49_0x68ace5 from'node:fs';import*as a49_0x4732f2 from'node:path';import a49_0xba30ea from'chalk';function a49_0x5d79(){const _0x51ef24=['parse','green','2117244rHAbQY','config','Session','cliFlags','profiles','llmAgent','toString','env','getParameters','utf-8','sessionId','logLevel','string','[context]','display','configFiles','existsSync','workflowProject','(using\x20session:\x20','Global','225qIDAWo','verbose','bold','apiKey','.json','us01','33PFNQhr','profile','3094188Kvmmzp','layers','(active)','globalCredentials','global','1477808iQqiaf','1925922czQcFx','segmentPath','activeProfile','database','not\x20set','site','createAsync','tdx.json','llmProject','none','4WgozxF','injectIntoOptions','4221695eICDJN','Profile\x20Credentials','(session:\x20','assign','segment_path','TDX_SITE','entries','loadGlobalConfig','llm_project','workflow_project','profile:\x20','default','project','parentSegment','35GciJrR','join','dim','getSource','llm_agent','2791wvzbQP','130070ePdAHg','.env','log','74AnyJWn','resolveAPIKeyAsync','session','parent_segment','sessions','cyan','Project'];a49_0x5d79=function(){return _0x51ef24;};return a49_0x5d79();}export class GlobalContext{[a49_0x53dfdf(0x1b1)];[a49_0x53dfdf(0x1af)];[a49_0x53dfdf(0x184)];[a49_0x53dfdf(0x16e)];[a49_0x53dfdf(0x172)];[a49_0x53dfdf(0x17c)];[a49_0x53dfdf(0x173)];[a49_0x53dfdf(0x1a1)];[a49_0x53dfdf(0x19f)];[a49_0x53dfdf(0x195)];[a49_0x53dfdf(0x1a5)];['layers'];['activeProfile'];[a49_0x53dfdf(0x194)];[a49_0x53dfdf(0x199)];constructor(_0xc1dd2b){const _0x511d06=a49_0x53dfdf;this[_0x511d06(0x194)]=_0xc1dd2b['session']||getCurrentSessionPID()[_0x511d06(0x190)]();const _0x34b596=loadSessionContext(_0xc1dd2b[_0x511d06(0x183)]),_0x1ea686=loadProjectConfig(),_0x210ccb=this[_0x511d06(0x171)]();this['activeProfile']=_0xc1dd2b['profile']||_0x34b596?.[_0x511d06(0x1a5)]||_0x210ccb[_0x511d06(0x1a5)]||getActiveProfile();const _0x3a53ac=this['activeProfile']?loadProfile(this[_0x511d06(0x1ae)]):null,_0x549b9c=_0x111e95=>{const _0x3da3e4=_0x511d06;if(!_0x111e95)return{};const _0x227444=_0x111e95,_0x28a976={};for(const [_0x17c6ba,_0x325369]of Object[_0x3da3e4(0x170)](_0x227444)){typeof _0x325369===_0x3da3e4(0x196)&&(_0x28a976[_0x17c6ba]=_0x325369);}return _0x28a976;},_0x1ccbc1={},_0x3006de=(_0x55771e,_0x46fda5,_0x5140fb)=>{const _0xd305f7=_0x511d06;if(!_0x55771e)return![];if(_0x5140fb&&_0x55771e===_0x5140fb)return![];const _0x3984bf=_0x34b596,_0x4f2296=_0x1ea686,_0x4b82fa=_0x3a53ac?.[_0xd305f7(0x18b)],_0x1c7afd=_0x210ccb,_0x59c3b3=_0x3984bf?.[_0x46fda5],_0x317a12=_0x4f2296?.[_0x46fda5],_0x517ed1=_0x4b82fa?.[_0x46fda5],_0x3acf0c=_0x1c7afd[_0x46fda5];return _0x55771e!==_0x59c3b3&&_0x55771e!==_0x317a12&&_0x55771e!==_0x517ed1&&_0x55771e!==_0x3acf0c;},_0x2243d6=[{'optionKey':_0x511d06(0x1b1),'contextKey':_0x511d06(0x1b1),'defaultValue':'us01'},{'optionKey':_0x511d06(0x1af),'contextKey':_0x511d06(0x1af)},{'optionKey':'parentSegment','contextKey':_0x511d06(0x184)},{'optionKey':_0x511d06(0x166),'contextKey':_0x511d06(0x172)},{'optionKey':_0x511d06(0x18f),'contextKey':_0x511d06(0x17c)},{'optionKey':_0x511d06(0x1a5),'contextKey':_0x511d06(0x1a5)}];for(const {optionKey:_0x4baa56,contextKey:_0x7107bf,defaultValue:_0x26ab14}of _0x2243d6){const _0x1c2af6=_0xc1dd2b[_0x4baa56];_0x3006de(_0x1c2af6,_0x7107bf,_0x26ab14)&&(_0x1ccbc1[_0x7107bf]=_0x1c2af6);}this['layers']={'cliFlags':_0x1ccbc1,'session':_0x549b9c(_0x34b596),'project':_0x549b9c(_0x1ea686),'profile':_0x549b9c(_0x3a53ac?.['config']),'global':_0x549b9c(_0x210ccb)};const _0x46fb09={...this['layers']['global'],...this[_0x511d06(0x1a7)]['profile'],...this[_0x511d06(0x1a7)]['project']};process[_0x511d06(0x191)][_0x511d06(0x16f)]&&!this[_0x511d06(0x1a7)][_0x511d06(0x183)]['site']&&!this[_0x511d06(0x1a7)][_0x511d06(0x18d)][_0x511d06(0x1b1)]&&(_0x46fb09[_0x511d06(0x1b1)]=process['env']['TDX_SITE']);Object['assign'](_0x46fb09,this[_0x511d06(0x1a7)][_0x511d06(0x183)]),Object[_0x511d06(0x16d)](_0x46fb09,this[_0x511d06(0x1a7)]['cliFlags']);const _0x5ade9f=_0x46fb09[_0x511d06(0x1b1)]||_0x511d06(0x1a3);this['site']=resolveSite(_0x5ade9f),this[_0x511d06(0x1af)]=_0x46fb09[_0x511d06(0x1af)],this[_0x511d06(0x184)]=_0x46fb09['parent_segment'],this['segment_path']=_0x46fb09['segment_path'],this[_0x511d06(0x172)]=_0x46fb09[_0x511d06(0x172)],this[_0x511d06(0x17c)]=_0x46fb09[_0x511d06(0x17c)],this[_0x511d06(0x173)]=_0x46fb09[_0x511d06(0x173)],this[_0x511d06(0x19f)]=_0xc1dd2b[_0x511d06(0x19f)]||![],this['logLevel']=_0xc1dd2b[_0x511d06(0x195)]??LogLevel['INFO'],this[_0x511d06(0x1a5)]=this['activeProfile']||undefined,this[_0x511d06(0x1a1)]=getAPIKey(this[_0x511d06(0x1b1)],this[_0x511d06(0x1ae)]||undefined);const _0x1c8510=getConfigDir(),_0x3e1025=a49_0x4732f2[_0x511d06(0x179)](_0x1c8510,_0x511d06(0x185),this[_0x511d06(0x194)]+_0x511d06(0x1a2)),_0x2d00f5=findProjectConfigPath(),_0x4cdde6=a49_0x4732f2['join'](_0x1c8510,'tdx.json'),_0x3477cc=a49_0x4732f2[_0x511d06(0x179)](_0x1c8510,_0x511d06(0x17f));let _0x36ed6f=null,_0x3d45b3=null;this[_0x511d06(0x1ae)]&&(_0x36ed6f=a49_0x4732f2[_0x511d06(0x179)](_0x1c8510,_0x511d06(0x18e),this['activeProfile'],_0x511d06(0x165)),_0x3d45b3=a49_0x4732f2['join'](_0x1c8510,_0x511d06(0x18e),this[_0x511d06(0x1ae)],_0x511d06(0x17f))),this[_0x511d06(0x199)]={'session':a49_0x68ace5[_0x511d06(0x19a)](_0x3e1025)?_0x3e1025:null,'project':_0x2d00f5,'profile':_0x36ed6f&&a49_0x68ace5['existsSync'](_0x36ed6f)?_0x36ed6f:null,'profileCredentials':_0x3d45b3&&a49_0x68ace5[_0x511d06(0x19a)](_0x3d45b3)?_0x3d45b3:null,'global':a49_0x68ace5[_0x511d06(0x19a)](_0x4cdde6)?_0x4cdde6:null,'globalCredentials':a49_0x68ace5[_0x511d06(0x19a)](_0x3477cc)?_0x3477cc:null};}[a49_0x53dfdf(0x17b)](_0xb6470b,_0x52fa21){const _0x309759=a49_0x53dfdf;if(!_0x52fa21)return _0x309759(0x1b0);const _0x4dcdcf=_0x52fa21;if(this[_0x309759(0x1a7)][_0x309759(0x18d)][_0xb6470b]===_0x4dcdcf){if(_0xb6470b===_0x309759(0x1b1)&&_0x4dcdcf===_0x309759(0x1a3)&&!this[_0x309759(0x1a7)][_0x309759(0x183)][_0x309759(0x1b1)]&&!this[_0x309759(0x1a7)][_0x309759(0x176)][_0x309759(0x1b1)]&&!this[_0x309759(0x1a7)][_0x309759(0x1a5)][_0x309759(0x1b1)]&&!this[_0x309759(0x1a7)][_0x309759(0x1aa)][_0x309759(0x1b1)])return _0x309759(0x175);return'CLI\x20flag:\x20--'+_0xb6470b['replace'](/_/g,'-');}if(this[_0x309759(0x1a7)]['session'][_0xb6470b]===_0x4dcdcf)return _0x309759(0x183);if(this[_0x309759(0x1a7)][_0x309759(0x176)][_0xb6470b]===_0x4dcdcf)return'project';if(this[_0x309759(0x1a7)][_0x309759(0x1a5)][_0xb6470b]===_0x4dcdcf)return _0x309759(0x174)+this[_0x309759(0x1ae)];if(this[_0x309759(0x1a7)][_0x309759(0x1aa)][_0xb6470b]===_0x4dcdcf)return _0x309759(0x1aa);return'default';}[a49_0x53dfdf(0x171)](){const _0x5692e0=a49_0x53dfdf,_0x2143e=a49_0x4732f2[_0x5692e0(0x179)](getConfigDir(),_0x5692e0(0x165));if(!a49_0x68ace5['existsSync'](_0x2143e))return{};try{const _0x3b4f32=a49_0x68ace5['readFileSync'](_0x2143e,_0x5692e0(0x193));return JSON[_0x5692e0(0x188)](_0x3b4f32);}catch{return{};}}[a49_0x53dfdf(0x169)](_0x435e9a){const _0x4b074a=a49_0x53dfdf;_0x435e9a['site']=this[_0x4b074a(0x1b1)],!_0x435e9a['database']&&this[_0x4b074a(0x1af)]&&(_0x435e9a['database']=this['database']),!_0x435e9a[_0x4b074a(0x177)]&&this[_0x4b074a(0x184)]&&(_0x435e9a['parentSegment']=this[_0x4b074a(0x184)]),!_0x435e9a[_0x4b074a(0x1ad)]&&this['segment_path']&&(_0x435e9a[_0x4b074a(0x1ad)]=this[_0x4b074a(0x16e)]),!_0x435e9a[_0x4b074a(0x166)]&&this[_0x4b074a(0x172)]&&(_0x435e9a[_0x4b074a(0x166)]=this[_0x4b074a(0x172)]),!_0x435e9a[_0x4b074a(0x18f)]&&this[_0x4b074a(0x17c)]&&(_0x435e9a[_0x4b074a(0x18f)]=this[_0x4b074a(0x17c)]),!_0x435e9a[_0x4b074a(0x19b)]&&this[_0x4b074a(0x173)]&&(_0x435e9a[_0x4b074a(0x19b)]=this['workflow_project']);}[a49_0x53dfdf(0x192)](){const _0x49c0c2=a49_0x53dfdf;return[{'key':_0x49c0c2(0x1b1),'value':this[_0x49c0c2(0x1b1)]},{'key':_0x49c0c2(0x1af),'value':this['database']},{'key':_0x49c0c2(0x184),'value':this['parent_segment']},{'key':_0x49c0c2(0x16e),'value':this[_0x49c0c2(0x16e)]},{'key':_0x49c0c2(0x172),'value':this[_0x49c0c2(0x172)]},{'key':'llm_agent','value':this[_0x49c0c2(0x17c)]},{'key':_0x49c0c2(0x173),'value':this[_0x49c0c2(0x173)]},{'key':_0x49c0c2(0x1a5),'value':this[_0x49c0c2(0x1ae)]||undefined}];}[a49_0x53dfdf(0x198)](){const _0x4bcdf9=a49_0x53dfdf;console[_0x4bcdf9(0x180)](a49_0xba30ea[_0x4bcdf9(0x1a0)]('[context]'));for(const {key:_0x67716c,value:_0x2105b0}of this['getParameters']()){_0x2105b0&&console[_0x4bcdf9(0x180)](a49_0xba30ea[_0x4bcdf9(0x186)](_0x67716c)+':\x20'+_0x2105b0);}}['displayWithSources'](){const _0x99d1da=a49_0x53dfdf;console[_0x99d1da(0x180)](a49_0xba30ea[_0x99d1da(0x1a0)](_0x99d1da(0x197)));for(const {key:_0x2bd107,value:_0x22b709}of this[_0x99d1da(0x192)]()){if(_0x22b709){const _0x5bf93e=_0x2bd107===_0x99d1da(0x1a5)?_0x99d1da(0x1a8):'('+this[_0x99d1da(0x17b)](_0x2bd107,_0x22b709)+')';console[_0x99d1da(0x180)](a49_0xba30ea[_0x99d1da(0x186)](_0x2bd107)+':\x20'+_0x22b709+'\x20'+a49_0xba30ea[_0x99d1da(0x17a)](_0x5bf93e));}}console[_0x99d1da(0x180)]('\x0a'+a49_0xba30ea[_0x99d1da(0x1a0)]('[configuration\x20files]'));const _0x2bda97=[{'label':_0x99d1da(0x18c),'path':this[_0x99d1da(0x199)][_0x99d1da(0x183)],'extra':_0x99d1da(0x16c)+this['sessionId']+')'},{'label':'Project','path':this[_0x99d1da(0x199)]['project']},{'label':'Profile','path':this['configFiles'][_0x99d1da(0x1a5)]},{'label':_0x99d1da(0x16b),'path':this[_0x99d1da(0x199)]['profileCredentials']},{'label':_0x99d1da(0x19d),'path':this[_0x99d1da(0x199)][_0x99d1da(0x1aa)]},{'label':'Global\x20Credentials','path':this[_0x99d1da(0x199)][_0x99d1da(0x1a9)]}];for(const {label:_0xc5833,path:_0x4f9163,extra:_0x4d2bd3}of _0x2bda97){if(_0x4f9163)console[_0x99d1da(0x180)](a49_0xba30ea[_0x99d1da(0x186)](_0xc5833)+':\x20'+_0x4f9163+'\x20'+a49_0xba30ea[_0x99d1da(0x189)]('✓')+(_0x4d2bd3?'\x20'+a49_0xba30ea[_0x99d1da(0x17a)](_0x4d2bd3):''));else{if(_0xc5833==='Session')console[_0x99d1da(0x180)](a49_0xba30ea[_0x99d1da(0x186)](_0xc5833)+':\x20'+a49_0xba30ea[_0x99d1da(0x17a)]('none')+'\x20'+a49_0xba30ea[_0x99d1da(0x17a)](_0x99d1da(0x19c)+this[_0x99d1da(0x194)]+')'));else(_0xc5833===_0x99d1da(0x187)||_0xc5833===_0x99d1da(0x19d))&&console[_0x99d1da(0x180)](a49_0xba30ea[_0x99d1da(0x186)](_0xc5833)+':\x20'+a49_0xba30ea[_0x99d1da(0x17a)](_0x99d1da(0x167)));}}}async[a49_0x53dfdf(0x182)](){const _0x43add2=a49_0x53dfdf;return this['apiKey']=await getAPIKeyAsync(this[_0x43add2(0x1b1)],this[_0x43add2(0x1ae)]||undefined),this['apiKey'];}static async[a49_0x53dfdf(0x1b2)](_0x4ca3e0){const _0x195333=new GlobalContext(_0x4ca3e0);return await _0x195333['resolveAPIKeyAsync'](),_0x195333;}}
1
+ const a49_0x4fe215=a49_0x5095;(function(_0x54d9a9,_0x131cb8){const _0x1650e7=a49_0x5095,_0x1fc73f=_0x54d9a9();while(!![]){try{const _0x1741ed=-parseInt(_0x1650e7(0xeb))/0x1*(parseInt(_0x1650e7(0xe5))/0x2)+parseInt(_0x1650e7(0xd3))/0x3*(parseInt(_0x1650e7(0x105))/0x4)+-parseInt(_0x1650e7(0xec))/0x5*(-parseInt(_0x1650e7(0x10a))/0x6)+parseInt(_0x1650e7(0xfa))/0x7*(parseInt(_0x1650e7(0x109))/0x8)+parseInt(_0x1650e7(0xd4))/0x9*(parseInt(_0x1650e7(0x102))/0xa)+-parseInt(_0x1650e7(0x103))/0xb+-parseInt(_0x1650e7(0xf7))/0xc*(parseInt(_0x1650e7(0xd7))/0xd);if(_0x1741ed===_0x131cb8)break;else _0x1fc73f['push'](_0x1fc73f['shift']());}catch(_0x2a2722){_0x1fc73f['push'](_0x1fc73f['shift']());}}}(a49_0x4777,0x33a5b));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a49_0x5095(_0x5b2b99,_0x18b929){_0x5b2b99=_0x5b2b99-0xc7;const _0x4777af=a49_0x4777();let _0x509577=_0x4777af[_0x5b2b99];return _0x509577;}import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a49_0x4777(){const _0x99b5bc=['none','globalCredentials','segment_path','replace','log','entries','displayWithSources','layers','parent_segment','activeProfile','Session','parse','join','394YzITmI','utf-8','(active)','dim','bold','green','1979GtXvzL','274935jzwTuO','[context]','global','not\x20set','TDX_SITE','Project','llmAgent','profiles','(using\x20session:\x20','Global\x20Credentials','string','2040ZFsypW','us01','llm_project','1775557CQIoGd','existsSync','workflow_project','apiKey','sessions','Global','project','loadGlobalConfig','248960Kupnmu','635800eiSXwQ','injectIntoOptions','8tzivnk','readFileSync','site','llm_agent','8ykiIId','42ZshzvL','getParameters','sessionId','(session:\x20','.env','profileCredentials','createAsync','workflowProject','database','config','verbose','display','Profile\x20Credentials','cyan','toString','logLevel','parentSegment','tdx.json','.json','profile','getSource','session','configFiles','default','cliFlags','env','segmentPath','381198qjTbCA','72mqgKoq','llmProject','resolveAPIKeyAsync','33085TldLQn'];a49_0x4777=function(){return _0x99b5bc;};return a49_0x4777();}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a49_0xd91771 from'node:fs';import*as a49_0x53a7c5 from'node:path';import a49_0xaff8c9 from'chalk';export class GlobalContext{['site'];[a49_0x4fe215(0x112)];['parent_segment'];[a49_0x4fe215(0xda)];['llm_project'];[a49_0x4fe215(0x108)];[a49_0x4fe215(0xfc)];['apiKey'];[a49_0x4fe215(0x114)];[a49_0x4fe215(0xc7)];[a49_0x4fe215(0xcb)];[a49_0x4fe215(0xdf)];['activeProfile'];[a49_0x4fe215(0x10c)];['configFiles'];constructor(_0x3a704b){const _0xb31bda=a49_0x4fe215;this[_0xb31bda(0x10c)]=_0x3a704b['session']||getCurrentSessionPID()[_0xb31bda(0x118)]();const _0x1b5ada=loadSessionContext(_0x3a704b['session']),_0x266279=loadProjectConfig(),_0x261410=this['loadGlobalConfig']();this[_0xb31bda(0xe1)]=_0x3a704b[_0xb31bda(0xcb)]||_0x1b5ada?.[_0xb31bda(0xcb)]||_0x261410[_0xb31bda(0xcb)]||getActiveProfile();const _0x1d91aa=this[_0xb31bda(0xe1)]?loadProfile(this[_0xb31bda(0xe1)]):null,_0x395355=_0x21a54a=>{const _0x389c1b=_0xb31bda;if(!_0x21a54a)return{};const _0x102b3a=_0x21a54a,_0x33ac3b={};for(const [_0x2bfefd,_0x124868]of Object[_0x389c1b(0xdd)](_0x102b3a)){typeof _0x124868===_0x389c1b(0xf6)&&(_0x33ac3b[_0x2bfefd]=_0x124868);}return _0x33ac3b;},_0x5096a7={},_0x35968e=(_0x1954d7,_0x59ef4c,_0x13d944)=>{const _0x145ad7=_0xb31bda;if(!_0x1954d7)return![];if(_0x13d944&&_0x1954d7===_0x13d944)return![];const _0x888946=_0x1b5ada,_0x10cf77=_0x266279,_0x4194fd=_0x1d91aa?.[_0x145ad7(0x113)],_0x691c82=_0x261410,_0x436d67=_0x888946?.[_0x59ef4c],_0x3aaed8=_0x10cf77?.[_0x59ef4c],_0x35228a=_0x4194fd?.[_0x59ef4c],_0x1d8701=_0x691c82[_0x59ef4c];return _0x1954d7!==_0x436d67&&_0x1954d7!==_0x3aaed8&&_0x1954d7!==_0x35228a&&_0x1954d7!==_0x1d8701;},_0xad9982=[{'optionKey':_0xb31bda(0x107),'contextKey':_0xb31bda(0x107),'defaultValue':_0xb31bda(0xf8)},{'optionKey':'database','contextKey':_0xb31bda(0x112)},{'optionKey':_0xb31bda(0xc8),'contextKey':_0xb31bda(0xe0)},{'optionKey':_0xb31bda(0xd5),'contextKey':_0xb31bda(0xf9)},{'optionKey':_0xb31bda(0xf2),'contextKey':'llm_agent'},{'optionKey':'profile','contextKey':'profile'}];for(const {optionKey:_0x24fe4e,contextKey:_0x323075,defaultValue:_0x9886ac}of _0xad9982){const _0x18ee42=_0x3a704b[_0x24fe4e];_0x35968e(_0x18ee42,_0x323075,_0x9886ac)&&(_0x5096a7[_0x323075]=_0x18ee42);}this[_0xb31bda(0xdf)]={'cliFlags':_0x5096a7,'session':_0x395355(_0x1b5ada),'project':_0x395355(_0x266279),'profile':_0x395355(_0x1d91aa?.[_0xb31bda(0x113)]),'global':_0x395355(_0x261410)};const _0x2abf9a={...this[_0xb31bda(0xdf)]['global'],...this[_0xb31bda(0xdf)][_0xb31bda(0xcb)],...this['layers'][_0xb31bda(0x100)]};process[_0xb31bda(0xd1)][_0xb31bda(0xf0)]&&!this[_0xb31bda(0xdf)][_0xb31bda(0xcd)][_0xb31bda(0x107)]&&!this[_0xb31bda(0xdf)][_0xb31bda(0xd0)][_0xb31bda(0x107)]&&(_0x2abf9a[_0xb31bda(0x107)]=process[_0xb31bda(0xd1)][_0xb31bda(0xf0)]);Object['assign'](_0x2abf9a,this['layers']['session']),Object['assign'](_0x2abf9a,this[_0xb31bda(0xdf)][_0xb31bda(0xd0)]);const _0x21fd6f=_0x2abf9a[_0xb31bda(0x107)]||_0xb31bda(0xf8);this[_0xb31bda(0x107)]=resolveSite(_0x21fd6f),this[_0xb31bda(0x112)]=_0x2abf9a[_0xb31bda(0x112)],this['parent_segment']=_0x2abf9a[_0xb31bda(0xe0)],this[_0xb31bda(0xda)]=_0x2abf9a[_0xb31bda(0xda)],this[_0xb31bda(0xf9)]=_0x2abf9a['llm_project'],this[_0xb31bda(0x108)]=_0x2abf9a[_0xb31bda(0x108)],this['workflow_project']=_0x2abf9a[_0xb31bda(0xfc)],this[_0xb31bda(0x114)]=_0x3a704b[_0xb31bda(0x114)]||![],this[_0xb31bda(0xc7)]=_0x3a704b[_0xb31bda(0xc7)]??LogLevel['INFO'],this['profile']=this[_0xb31bda(0xe1)]||undefined,this[_0xb31bda(0xfd)]=getAPIKey(this['site'],this[_0xb31bda(0xe1)]||undefined);const _0x3e577c=getConfigDir(),_0x301ff9=a49_0x53a7c5[_0xb31bda(0xe4)](_0x3e577c,_0xb31bda(0xfe),this[_0xb31bda(0x10c)]+_0xb31bda(0xca)),_0x2c3219=findProjectConfigPath(),_0x172747=a49_0x53a7c5['join'](_0x3e577c,_0xb31bda(0xc9)),_0x3c3965=a49_0x53a7c5['join'](_0x3e577c,'.env');let _0x2c2972=null,_0x1fa720=null;this[_0xb31bda(0xe1)]&&(_0x2c2972=a49_0x53a7c5['join'](_0x3e577c,_0xb31bda(0xf3),this[_0xb31bda(0xe1)],_0xb31bda(0xc9)),_0x1fa720=a49_0x53a7c5[_0xb31bda(0xe4)](_0x3e577c,_0xb31bda(0xf3),this['activeProfile'],_0xb31bda(0x10e))),this[_0xb31bda(0xce)]={'session':a49_0xd91771['existsSync'](_0x301ff9)?_0x301ff9:null,'project':_0x2c3219,'profile':_0x2c2972&&a49_0xd91771[_0xb31bda(0xfb)](_0x2c2972)?_0x2c2972:null,'profileCredentials':_0x1fa720&&a49_0xd91771[_0xb31bda(0xfb)](_0x1fa720)?_0x1fa720:null,'global':a49_0xd91771['existsSync'](_0x172747)?_0x172747:null,'globalCredentials':a49_0xd91771[_0xb31bda(0xfb)](_0x3c3965)?_0x3c3965:null};}[a49_0x4fe215(0xcc)](_0x297a77,_0x591883){const _0x327b99=a49_0x4fe215;if(!_0x591883)return _0x327b99(0xef);const _0x454e34=_0x591883;if(this['layers'][_0x327b99(0xd0)][_0x297a77]===_0x454e34){if(_0x297a77===_0x327b99(0x107)&&_0x454e34===_0x327b99(0xf8)&&!this[_0x327b99(0xdf)]['session']['site']&&!this[_0x327b99(0xdf)][_0x327b99(0x100)][_0x327b99(0x107)]&&!this[_0x327b99(0xdf)]['profile'][_0x327b99(0x107)]&&!this['layers'][_0x327b99(0xee)][_0x327b99(0x107)])return _0x327b99(0xcf);return'CLI\x20flag:\x20--'+_0x297a77[_0x327b99(0xdb)](/_/g,'-');}if(this[_0x327b99(0xdf)][_0x327b99(0xcd)][_0x297a77]===_0x454e34)return _0x327b99(0xcd);if(this[_0x327b99(0xdf)]['project'][_0x297a77]===_0x454e34)return _0x327b99(0x100);if(this['layers'][_0x327b99(0xcb)][_0x297a77]===_0x454e34)return'profile:\x20'+this[_0x327b99(0xe1)];if(this[_0x327b99(0xdf)]['global'][_0x297a77]===_0x454e34)return'global';return'default';}[a49_0x4fe215(0x101)](){const _0xffb657=a49_0x4fe215,_0x2a8d38=a49_0x53a7c5[_0xffb657(0xe4)](getConfigDir(),_0xffb657(0xc9));if(!a49_0xd91771[_0xffb657(0xfb)](_0x2a8d38))return{};try{const _0x4915df=a49_0xd91771[_0xffb657(0x106)](_0x2a8d38,_0xffb657(0xe6));return JSON[_0xffb657(0xe3)](_0x4915df);}catch{return{};}}[a49_0x4fe215(0x104)](_0x3ea140){const _0x3bc2f0=a49_0x4fe215;_0x3ea140['site']=this[_0x3bc2f0(0x107)],!_0x3ea140[_0x3bc2f0(0x112)]&&this[_0x3bc2f0(0x112)]&&(_0x3ea140['database']=this[_0x3bc2f0(0x112)]),!_0x3ea140['parentSegment']&&this[_0x3bc2f0(0xe0)]&&(_0x3ea140[_0x3bc2f0(0xc8)]=this['parent_segment']),!_0x3ea140[_0x3bc2f0(0xd2)]&&this['segment_path']&&(_0x3ea140[_0x3bc2f0(0xd2)]=this[_0x3bc2f0(0xda)]),!_0x3ea140[_0x3bc2f0(0xd5)]&&this[_0x3bc2f0(0xf9)]&&(_0x3ea140[_0x3bc2f0(0xd5)]=this[_0x3bc2f0(0xf9)]),!_0x3ea140[_0x3bc2f0(0xf2)]&&this[_0x3bc2f0(0x108)]&&(_0x3ea140[_0x3bc2f0(0xf2)]=this['llm_agent']),!_0x3ea140[_0x3bc2f0(0x111)]&&this[_0x3bc2f0(0xfc)]&&(_0x3ea140[_0x3bc2f0(0x111)]=this[_0x3bc2f0(0xfc)]);}[a49_0x4fe215(0x10b)](){const _0x4d4204=a49_0x4fe215;return[{'key':_0x4d4204(0x107),'value':this['site']},{'key':'database','value':this[_0x4d4204(0x112)]},{'key':_0x4d4204(0xe0),'value':this[_0x4d4204(0xe0)]},{'key':_0x4d4204(0xda),'value':this['segment_path']},{'key':_0x4d4204(0xf9),'value':this[_0x4d4204(0xf9)]},{'key':_0x4d4204(0x108),'value':this[_0x4d4204(0x108)]},{'key':'workflow_project','value':this[_0x4d4204(0xfc)]},{'key':'profile','value':this[_0x4d4204(0xe1)]||undefined}];}[a49_0x4fe215(0x115)](){const _0x9403a5=a49_0x4fe215;console[_0x9403a5(0xdc)](a49_0xaff8c9[_0x9403a5(0xe9)](_0x9403a5(0xed)));for(const {key:_0x245aeb,value:_0x4edd36}of this[_0x9403a5(0x10b)]()){_0x4edd36&&console[_0x9403a5(0xdc)](a49_0xaff8c9['cyan'](_0x245aeb)+':\x20'+_0x4edd36);}}[a49_0x4fe215(0xde)](){const _0x499ab7=a49_0x4fe215;console['log'](a49_0xaff8c9['bold'](_0x499ab7(0xed)));for(const {key:_0x3142ca,value:_0x2f886f}of this[_0x499ab7(0x10b)]()){if(_0x2f886f){const _0x5b7144=_0x3142ca===_0x499ab7(0xcb)?_0x499ab7(0xe7):'('+this['getSource'](_0x3142ca,_0x2f886f)+')';console[_0x499ab7(0xdc)](a49_0xaff8c9[_0x499ab7(0x117)](_0x3142ca)+':\x20'+_0x2f886f+'\x20'+a49_0xaff8c9['dim'](_0x5b7144));}}console[_0x499ab7(0xdc)]('\x0a'+a49_0xaff8c9[_0x499ab7(0xe9)]('[configuration\x20files]'));const _0x1100e3=[{'label':'Session','path':this['configFiles']['session'],'extra':_0x499ab7(0x10d)+this[_0x499ab7(0x10c)]+')'},{'label':_0x499ab7(0xf1),'path':this[_0x499ab7(0xce)]['project']},{'label':'Profile','path':this['configFiles'][_0x499ab7(0xcb)]},{'label':_0x499ab7(0x116),'path':this[_0x499ab7(0xce)][_0x499ab7(0x10f)]},{'label':_0x499ab7(0xff),'path':this[_0x499ab7(0xce)][_0x499ab7(0xee)]},{'label':_0x499ab7(0xf5),'path':this[_0x499ab7(0xce)][_0x499ab7(0xd9)]}];for(const {label:_0x24997d,path:_0x204f14,extra:_0x17d6ef}of _0x1100e3){if(_0x204f14)console[_0x499ab7(0xdc)](a49_0xaff8c9[_0x499ab7(0x117)](_0x24997d)+':\x20'+_0x204f14+'\x20'+a49_0xaff8c9[_0x499ab7(0xea)]('✓')+(_0x17d6ef?'\x20'+a49_0xaff8c9[_0x499ab7(0xe8)](_0x17d6ef):''));else{if(_0x24997d===_0x499ab7(0xe2))console[_0x499ab7(0xdc)](a49_0xaff8c9['cyan'](_0x24997d)+':\x20'+a49_0xaff8c9[_0x499ab7(0xe8)]('none')+'\x20'+a49_0xaff8c9['dim'](_0x499ab7(0xf4)+this[_0x499ab7(0x10c)]+')'));else(_0x24997d==='Project'||_0x24997d===_0x499ab7(0xff))&&console[_0x499ab7(0xdc)](a49_0xaff8c9[_0x499ab7(0x117)](_0x24997d)+':\x20'+a49_0xaff8c9['dim'](_0x499ab7(0xd8)));}}}async['resolveAPIKeyAsync'](){const _0x1692cb=a49_0x4fe215;return this['apiKey']=await getAPIKeyAsync(this[_0x1692cb(0x107)],this[_0x1692cb(0xe1)]||undefined),this[_0x1692cb(0xfd)];}static async[a49_0x4fe215(0x110)](_0x162b3){const _0x5bb72d=a49_0x4fe215,_0x68131c=new GlobalContext(_0x162b3);return await _0x68131c[_0x5bb72d(0xd6)](),_0x68131c;}}
@@ -1 +1 @@
1
- const a50_0x148992=a50_0x2797;(function(_0x118009,_0x44205b){const _0x3659df=a50_0x2797,_0x5c50ca=_0x118009();while(!![]){try{const _0x177f27=-parseInt(_0x3659df(0xf2))/0x1*(parseInt(_0x3659df(0xec))/0x2)+parseInt(_0x3659df(0xdf))/0x3*(parseInt(_0x3659df(0xed))/0x4)+parseInt(_0x3659df(0xe3))/0x5*(parseInt(_0x3659df(0xf1))/0x6)+-parseInt(_0x3659df(0xf8))/0x7+-parseInt(_0x3659df(0xfc))/0x8*(parseInt(_0x3659df(0xe4))/0x9)+-parseInt(_0x3659df(0xf7))/0xa+parseInt(_0x3659df(0xf5))/0xb;if(_0x177f27===_0x44205b)break;else _0x5c50ca['push'](_0x5c50ca['shift']());}catch(_0x112efd){_0x5c50ca['push'](_0x5c50ca['shift']());}}}(a50_0x572d,0x878a1));const SERVICE_NAME=a50_0x148992(0x103);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1e0b99=a50_0x148992;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x1021c3=await import(_0x1e0b99(0xe5));return EntryClass=_0x1021c3[_0x1e0b99(0xfb)],EntryClass;}catch(_0x23d1d0){return keyringLoadError=_0x23d1d0 instanceof Error?_0x23d1d0:new Error(String(_0x23d1d0)),null;}}function getAccountName(_0x5630f5){const _0x334bbe=a50_0x148992,_0x38970f=_0x5630f5||'';return _0x334bbe(0x102)+_0x38970f+_0x334bbe(0xea);}function a50_0x572d(){const _0x54be9b=['-25293','1884iJfSep','777671kdxKOR','System\x20keychain\x20is\x20not\x20available','toLowerCase','24623731oxugXO','error','8951500gAnoSg','2560712oHDZAI','restricted','unavailable','Entry','2011544aobjQZ','value','not\x20available','getPassword','not_found','-25300','profile:','tdx','229974sJUdIz','access','not\x20found','could\x20not\x20be\x20found','10345vduFHc','27LzuFzp','@napi-rs/keyring','includes','message','deleteCredential','cannot\x20find',':api_key','success','2XGQiXC','24MTEnOE','no\x20matching\x20entry','not\x20supported'];a50_0x572d=function(){return _0x54be9b;};return a50_0x572d();}export async function getKeychainAPIKey(_0x380a6b){const _0x3a5f46=a50_0x148992,_0x2c273c=await getKeychainAPIKeyWithStatus(_0x380a6b);if(_0x2c273c[_0x3a5f46(0xeb)])return _0x2c273c[_0x3a5f46(0xfd)];return _0x2c273c['reason']==='access_denied'&&console[_0x3a5f46(0xf6)]('Warning:\x20'+_0x2c273c[_0x3a5f46(0xe7)]),null;}export async function getKeychainAPIKeyWithStatus(_0x401d7f){const _0x42e0c4=a50_0x148992;try{const _0x49c4df=await getEntryClass();if(!_0x49c4df)return{'success':![],'reason':_0x42e0c4(0xfa)};const _0x6c3c12=getAccountName(_0x401d7f),_0x177a0d=new _0x49c4df(SERVICE_NAME,_0x6c3c12),_0x28ac5e=_0x177a0d[_0x42e0c4(0xff)]();if(_0x28ac5e)return{'success':!![],'value':_0x28ac5e};return{'success':![],'reason':_0x42e0c4(0x100)};}catch(_0x194faf){const _0x2fac36=_0x194faf instanceof Error?_0x194faf[_0x42e0c4(0xe7)]:String(_0x194faf);if(_0x2fac36[_0x42e0c4(0xe6)](_0x42e0c4(0x101))||_0x2fac36[_0x42e0c4(0xf4)]()[_0x42e0c4(0xe6)](_0x42e0c4(0xe2))||_0x2fac36['toLowerCase']()[_0x42e0c4(0xe6)](_0x42e0c4(0xe1))||_0x2fac36[_0x42e0c4(0xf4)]()[_0x42e0c4(0xe6)](_0x42e0c4(0xee)))return{'success':![],'reason':_0x42e0c4(0x100)};if(_0x2fac36['includes'](_0x42e0c4(0xf0))||_0x2fac36['toLowerCase']()[_0x42e0c4(0xe6)](_0x42e0c4(0xf9))||_0x2fac36['toLowerCase']()['includes'](_0x42e0c4(0xe0)))return{'success':![],'reason':'access_denied','message':'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.'};return{'success':![],'reason':_0x42e0c4(0xfa),'message':_0x2fac36};}}export async function saveKeychainAPIKey(_0xd2f529,_0x4338b0){const _0x973bc2=a50_0x148992,_0x28a561=await getEntryClass();if(!_0x28a561)throw new Error(_0x973bc2(0xf3));const _0x927ac3=getAccountName(_0x4338b0),_0x3d8ad5=new _0x28a561(SERVICE_NAME,_0x927ac3);_0x3d8ad5['setPassword'](_0xd2f529);}function a50_0x2797(_0x30cabf,_0x330247){_0x30cabf=_0x30cabf-0xdf;const _0x572de8=a50_0x572d();let _0x279731=_0x572de8[_0x30cabf];return _0x279731;}export async function deleteKeychainAPIKey(_0x2d6127){const _0x2078f6=a50_0x148992;try{const _0x9f4a88=await getEntryClass();if(!_0x9f4a88)return![];const _0x143bcf=getAccountName(_0x2d6127),_0x100a31=new _0x9f4a88(SERVICE_NAME,_0x143bcf);return _0x100a31[_0x2078f6(0xe8)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x49b260=a50_0x148992;try{const _0x2c3955=await getEntryClass();if(!_0x2c3955)return![];const _0x2bb00f=new _0x2c3955(SERVICE_NAME,'__keychain_test__');return _0x2bb00f['getPassword'](),!![];}catch(_0x5c6f35){const _0x2f4d66=_0x5c6f35 instanceof Error?_0x5c6f35[_0x49b260(0xe7)][_0x49b260(0xf4)]():'';if(_0x2f4d66['includes'](_0x49b260(0xfe))||_0x2f4d66['includes'](_0x49b260(0xef))||_0x2f4d66[_0x49b260(0xe6)](_0x49b260(0xe9)))return![];return!![];}}
1
+ (function(_0x468dd4,_0x1f1ded){const _0x3bc232=a50_0x4a01,_0x1a51b0=_0x468dd4();while(!![]){try{const _0x1b8bc8=parseInt(_0x3bc232(0x1fe))/0x1*(-parseInt(_0x3bc232(0x1f5))/0x2)+-parseInt(_0x3bc232(0x1eb))/0x3*(-parseInt(_0x3bc232(0x1fd))/0x4)+parseInt(_0x3bc232(0x1ed))/0x5+-parseInt(_0x3bc232(0x1e3))/0x6*(-parseInt(_0x3bc232(0x1e2))/0x7)+-parseInt(_0x3bc232(0x1fc))/0x8+-parseInt(_0x3bc232(0x1ff))/0x9*(-parseInt(_0x3bc232(0x1f9))/0xa)+-parseInt(_0x3bc232(0x1ee))/0xb;if(_0x1b8bc8===_0x1f1ded)break;else _0x1a51b0['push'](_0x1a51b0['shift']());}catch(_0x4dc855){_0x1a51b0['push'](_0x1a51b0['shift']());}}}(a50_0x19dd,0x7348c));const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;function a50_0x19dd(){const _0x35a78e=['could\x20not\x20be\x20found','1400306fVHPRD','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.','access_denied','3619790NHpCMZ','reason','not\x20supported','5741472vaMhas','65432WQWHwl','1CgAcyM','18WGldTo','2137037vhQRFs','12MOixxw','Warning:\x20','System\x20keychain\x20is\x20not\x20available','value','__keychain_test__','includes','-25293','@napi-rs/keyring','123bmPWPK','deleteCredential','139170LOOJWf','1573121jZbFJl','getPassword','message','error','toLowerCase','access'];a50_0x19dd=function(){return _0x35a78e;};return a50_0x19dd();}async function getEntryClass(){const _0x5a3f1b=a50_0x4a01;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x4060e8=await import(_0x5a3f1b(0x1ea));return EntryClass=_0x4060e8['Entry'],EntryClass;}catch(_0x608b48){return keyringLoadError=_0x608b48 instanceof Error?_0x608b48:new Error(String(_0x608b48)),null;}}function getAccountName(_0x23a200){const _0x3f27ce=_0x23a200||'';return'profile:'+_0x3f27ce+':api_key';}export async function getKeychainAPIKey(_0x2def21){const _0x7e02a4=a50_0x4a01,_0x4ff3aa=await getKeychainAPIKeyWithStatus(_0x2def21);if(_0x4ff3aa[_0x7e02a4(0x1f6)])return _0x4ff3aa[_0x7e02a4(0x1e6)];return _0x4ff3aa[_0x7e02a4(0x1fa)]==='access_denied'&&console[_0x7e02a4(0x1f1)](_0x7e02a4(0x1e4)+_0x4ff3aa[_0x7e02a4(0x1f0)]),null;}export async function getKeychainAPIKeyWithStatus(_0x12ab40){const _0x24c183=a50_0x4a01;try{const _0x1bc85f=await getEntryClass();if(!_0x1bc85f)return{'success':![],'reason':'unavailable'};const _0x341588=getAccountName(_0x12ab40),_0x4c7e2b=new _0x1bc85f(SERVICE_NAME,_0x341588),_0x2bbff9=_0x4c7e2b['getPassword']();if(_0x2bbff9)return{'success':!![],'value':_0x2bbff9};return{'success':![],'reason':'not_found'};}catch(_0x44a902){const _0x44a6cd=_0x44a902 instanceof Error?_0x44a902[_0x24c183(0x1f0)]:String(_0x44a902);if(_0x44a6cd[_0x24c183(0x1e8)]('-25300')||_0x44a6cd['toLowerCase']()['includes'](_0x24c183(0x1f4))||_0x44a6cd['toLowerCase']()[_0x24c183(0x1e8)]('not\x20found')||_0x44a6cd[_0x24c183(0x1f2)]()[_0x24c183(0x1e8)]('no\x20matching\x20entry'))return{'success':![],'reason':'not_found'};if(_0x44a6cd['includes'](_0x24c183(0x1e9))||_0x44a6cd[_0x24c183(0x1f2)]()[_0x24c183(0x1e8)]('restricted')||_0x44a6cd[_0x24c183(0x1f2)]()[_0x24c183(0x1e8)](_0x24c183(0x1f3)))return{'success':![],'reason':_0x24c183(0x1f8),'message':_0x24c183(0x1f7)};return{'success':![],'reason':'unavailable','message':_0x44a6cd};}}export async function saveKeychainAPIKey(_0x3ecd8f,_0x493273){const _0x7117c1=a50_0x4a01,_0x22dc9f=await getEntryClass();if(!_0x22dc9f)throw new Error(_0x7117c1(0x1e5));const _0x835e27=getAccountName(_0x493273),_0x51369b=new _0x22dc9f(SERVICE_NAME,_0x835e27);_0x51369b['setPassword'](_0x3ecd8f);}export async function deleteKeychainAPIKey(_0x17ea4c){const _0x178d23=a50_0x4a01;try{const _0x5a3a38=await getEntryClass();if(!_0x5a3a38)return![];const _0x37056c=getAccountName(_0x17ea4c),_0x1eb45b=new _0x5a3a38(SERVICE_NAME,_0x37056c);return _0x1eb45b[_0x178d23(0x1ec)](),!![];}catch{return![];}}function a50_0x4a01(_0x32e902,_0x6aea33){_0x32e902=_0x32e902-0x1e2;const _0x19dda2=a50_0x19dd();let _0x4a01d2=_0x19dda2[_0x32e902];return _0x4a01d2;}export async function isKeychainAvailable(){const _0x4ab3c5=a50_0x4a01;try{const _0x23fba0=await getEntryClass();if(!_0x23fba0)return![];const _0x4d5341=new _0x23fba0(SERVICE_NAME,_0x4ab3c5(0x1e7));return _0x4d5341[_0x4ab3c5(0x1ef)](),!![];}catch(_0x246d53){const _0x4d9249=_0x246d53 instanceof Error?_0x246d53[_0x4ab3c5(0x1f0)][_0x4ab3c5(0x1f2)]():'';if(_0x4d9249[_0x4ab3c5(0x1e8)]('not\x20available')||_0x4d9249[_0x4ab3c5(0x1e8)](_0x4ab3c5(0x1fb))||_0x4d9249[_0x4ab3c5(0x1e8)]('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x3f76d7,_0x25b2fd){const _0x27e1b6=a51_0x1305,_0x41189f=_0x3f76d7();while(!![]){try{const _0x2ce847=-parseInt(_0x27e1b6(0x1d4))/0x1+-parseInt(_0x27e1b6(0x1b0))/0x2*(parseInt(_0x27e1b6(0x1c6))/0x3)+-parseInt(_0x27e1b6(0x1ac))/0x4*(parseInt(_0x27e1b6(0x1a3))/0x5)+-parseInt(_0x27e1b6(0x1c0))/0x6+-parseInt(_0x27e1b6(0x1b8))/0x7*(parseInt(_0x27e1b6(0x1bf))/0x8)+-parseInt(_0x27e1b6(0x1bc))/0x9+parseInt(_0x27e1b6(0x190))/0xa;if(_0x2ce847===_0x25b2fd)break;else _0x41189f['push'](_0x41189f['shift']());}catch(_0x3e0fd5){_0x41189f['push'](_0x41189f['shift']());}}}(a51_0x2c5d,0xb5d91));function a51_0x2c5d(){const _0x49e549=['\x20\x20mv\x20\x22','some','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','tdx.json','has','398940otRZzu','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a',',\x20creating\x20new\x20file','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','string','sort','Warning:\x20Profile\x20\x27','filter','\x27:\x20unknown\x20config\x20key\x20\x27','Failed\x20to\x20parse\x20','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','profile','65960130UdRFdK','Profile\x20\x27','utf-8','existsSync','test','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','isDirectory','\x22\x20\x22','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x20does\x20not\x20exist','keys','from','length','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','warn','\x20already\x20exists','llm_agent','parse','site','65635ysAess','Invalid\x20profile\x20name:\x20','push','\x27:\x20config\x20must\x20be\x20an\x20object','Warning:\x20Failed\x20to\x20parse\x20','env','Error:\x20','readFileSync','\x20\x201.\x20Edit:\x20','356pprdLe','.env','stringify','database','8wJxcOS','object','\x0aWarning:\x20Failed\x20to\x20parse\x20','directory','includes','entries','values','Profile\x20','1211yENTvG','description','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','local','8402733jueBgT','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','To\x20migrate:','39056JvtVqo','6096276WkVywy','rmSync','profiles','\x27\x20will\x20be\x20ignored','join','find','1117239CIuYHs','.env.','set','map','toISOString','llm_project','parent_segment','name'];a51_0x2c5d=function(){return _0x49e549;};return a51_0x2c5d();}import*as a51_0x5ceae7 from'node:fs';import*as a51_0x3f0cb6 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME='@tdx-studio';export function getProfileParams(_0x1ba1c5){const _0x24204d=a51_0x1305,_0x3227ba={};if(!_0x1ba1c5)return _0x3227ba;for(const [_0x49e7f9,_0x4e21bf]of Object[_0x24204d(0x1b5)](_0x1ba1c5)){_0x49e7f9!==_0x24204d(0x1b9)&&_0x4e21bf!==undefined&&(_0x3227ba[_0x49e7f9]=_0x4e21bf);}return _0x3227ba;}export function getProfilesDir(){const _0x426077=a51_0x1305;return a51_0x3f0cb6[_0x426077(0x1c4)](getConfigDir(),_0x426077(0x1c2));}function getProfileDir(_0x496c95){const _0x4d1292=a51_0x1305;return a51_0x3f0cb6[_0x4d1292(0x1c4)](getProfilesDir(),_0x496c95);}function getProfileConfigPath(_0x29be16){const _0x332ceb=a51_0x1305;return a51_0x3f0cb6[_0x332ceb(0x1c4)](getProfileDir(_0x29be16),_0x332ceb(0x1d2));}function getProfileEnvPath(_0x3672de){const _0x2f6fce=a51_0x1305;return a51_0x3f0cb6[_0x2f6fce(0x1c4)](getProfileDir(_0x3672de),_0x2f6fce(0x1ad));}function a51_0x1305(_0x163fc1,_0x4ec89e){_0x163fc1=_0x163fc1-0x190;const _0x2c5d9d=a51_0x2c5d();let _0x1305ff=_0x2c5d9d[_0x163fc1];return _0x1305ff;}function getGlobalConfigPath(){const _0x120881=a51_0x1305;return a51_0x3f0cb6[_0x120881(0x1c4)](getConfigDir(),_0x120881(0x1d2));}function validateProfileName(_0xf5f812){const _0x3781a9=a51_0x1305;if(!/^@?[a-zA-Z0-9_-]+$/[_0x3781a9(0x194)](_0xf5f812))throw new Error(_0x3781a9(0x1a4)+_0xf5f812+_0x3781a9(0x1d5));}function validateProfileConfig(_0x152785,_0x21b54d){const _0x24853d=a51_0x1305;if(typeof _0x152785!==_0x24853d(0x1b1)||_0x152785===null)throw new Error(_0x24853d(0x191)+_0x21b54d+_0x24853d(0x1a6));const _0x51cf5d=[_0x24853d(0x1b9),_0x24853d(0x1a2),_0x24853d(0x1af),'parent_segment',_0x24853d(0x1cb),_0x24853d(0x1a0)],_0x44c8aa=_0x152785;for(const _0x24c347 of Object[_0x24853d(0x19a)](_0x44c8aa)){!_0x51cf5d[_0x24853d(0x1b4)](_0x24c347)&&console[_0x24853d(0x19e)](_0x24853d(0x1dc)+_0x21b54d+_0x24853d(0x1de)+_0x24c347+_0x24853d(0x1c3));}if(_0x44c8aa['description']!==undefined&&typeof _0x44c8aa['description']!==_0x24853d(0x1da))throw new Error(_0x24853d(0x191)+_0x21b54d+_0x24853d(0x195));if(_0x44c8aa[_0x24853d(0x1a2)]!==undefined&&typeof _0x44c8aa[_0x24853d(0x1a2)]!==_0x24853d(0x1da))throw new Error('Profile\x20\x27'+_0x21b54d+_0x24853d(0x1d1));if(_0x44c8aa[_0x24853d(0x1af)]!==undefined&&typeof _0x44c8aa['database']!==_0x24853d(0x1da))throw new Error(_0x24853d(0x191)+_0x21b54d+_0x24853d(0x1e0));if(_0x44c8aa[_0x24853d(0x1cc)]!==undefined&&typeof _0x44c8aa[_0x24853d(0x1cc)]!==_0x24853d(0x1da))throw new Error('Profile\x20\x27'+_0x21b54d+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x44c8aa['llm_project']!==undefined&&typeof _0x44c8aa[_0x24853d(0x1cb)]!==_0x24853d(0x1da))throw new Error(_0x24853d(0x191)+_0x21b54d+_0x24853d(0x198));if(_0x44c8aa[_0x24853d(0x1a0)]!==undefined&&typeof _0x44c8aa[_0x24853d(0x1a0)]!==_0x24853d(0x1da))throw new Error(_0x24853d(0x191)+_0x21b54d+_0x24853d(0x1d9));return!![];}function loadProfilesFromTdxJson(_0x597589,_0x797e26){const _0x16df21=a51_0x1305;if(!a51_0x5ceae7[_0x16df21(0x193)](_0x597589))return[];try{const _0x4aa0e7=a51_0x5ceae7[_0x16df21(0x1aa)](_0x597589,_0x16df21(0x192)),_0x4e6feb=JSON[_0x16df21(0x1a1)](_0x4aa0e7);if(!_0x4e6feb[_0x16df21(0x1c2)]||typeof _0x4e6feb[_0x16df21(0x1c2)]!==_0x16df21(0x1b1))return[];const _0xb6275d=[];for(const [_0x38c072,_0x221277]of Object['entries'](_0x4e6feb['profiles'])){try{validateProfileConfig(_0x221277,_0x38c072);const _0x4f7aa4=getNewCredentialPath(_0x38c072),_0x531016=getOldCredentialPath(_0x38c072),_0xeb8d9d=a51_0x5ceae7['existsSync'](_0x4f7aa4)||a51_0x5ceae7['existsSync'](_0x531016);_0xb6275d[_0x16df21(0x1a5)]({'name':_0x38c072,'config':_0x221277,'metadata':{'name':_0x38c072,'createdAt':new Date()['toISOString']()},'hasCredentials':_0xeb8d9d,'scope':_0x797e26});}catch(_0x2d7c0e){_0x2d7c0e instanceof Error&&(console[_0x16df21(0x19e)](_0x16df21(0x1d6)+_0x597589+':'),console['warn']('\x20\x20'+_0x2d7c0e['message']+'\x0a'));}}return _0xb6275d;}catch(_0x4051c1){return _0x4051c1 instanceof SyntaxError?(console[_0x16df21(0x19e)](_0x16df21(0x1b2)+_0x597589+':\x20Invalid\x20JSON\x20syntax'),console[_0x16df21(0x19e)](_0x16df21(0x1a9)+_0x4051c1['message']+'\x0a')):console[_0x16df21(0x19e)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x597589+':\x20'+_0x4051c1+'\x0a'),[];}}export function getNewCredentialPath(_0x312520){const _0x2951e4=a51_0x1305;return a51_0x3f0cb6[_0x2951e4(0x1c4)](getConfigDir(),_0x2951e4(0x1c7)+_0x312520);}function getOldCredentialPath(_0x41724a){const _0x1825d1=a51_0x1305;return a51_0x3f0cb6[_0x1825d1(0x1c4)](getProfilesDir(),_0x41724a,_0x1825d1(0x1ad));}function loadProfilesFromTdxJsonFiles(){const _0x20cdb5=a51_0x1305,_0x2835f2=[],_0x2996f4=findProjectConfigPath();_0x2996f4&&_0x2835f2[_0x20cdb5(0x1a5)](...loadProfilesFromTdxJson(_0x2996f4,_0x20cdb5(0x1bb)));const _0x162392=a51_0x3f0cb6[_0x20cdb5(0x1c4)](getConfigDir(),_0x20cdb5(0x1d2));return _0x2835f2[_0x20cdb5(0x1a5)](...loadProfilesFromTdxJson(_0x162392,'user')),_0x2835f2;}function loadProfilesFromDirectories(){const _0x4e1545=a51_0x1305,_0x503b2b=getProfilesDir();if(!a51_0x5ceae7[_0x4e1545(0x193)](_0x503b2b))return[];try{return a51_0x5ceae7['readdirSync'](_0x503b2b,{'withFileTypes':!![]})[_0x4e1545(0x1dd)](_0x3e65a6=>_0x3e65a6[_0x4e1545(0x196)]())['map'](_0x518b04=>_0x518b04[_0x4e1545(0x1cd)])['filter'](_0x1659f9=>{const _0x4a294b=_0x4e1545,_0xd524b0=getProfileConfigPath(_0x1659f9),_0x4ba9b9=getProfileEnvPath(_0x1659f9);return a51_0x5ceae7[_0x4a294b(0x193)](_0xd524b0)||a51_0x5ceae7['existsSync'](_0x4ba9b9);})['map'](_0x3923af=>{const _0x513e6e=loadProfileFromDirectory(_0x3923af);if(_0x513e6e)return{..._0x513e6e,'scope':'directory'};return null;})[_0x4e1545(0x1dd)](_0x5347b8=>_0x5347b8!==null);}catch{return[];}}function loadProfileFromDirectory(_0x5d213d){const _0x9f64d6=a51_0x1305,_0x57e95c=getProfileConfigPath(_0x5d213d),_0x287620=getOldCredentialPath(_0x5d213d);if(!a51_0x5ceae7[_0x9f64d6(0x193)](_0x57e95c)&&!a51_0x5ceae7['existsSync'](_0x287620))return null;let _0x23105f={},_0x547b42={'name':_0x5d213d,'createdAt':new Date()[_0x9f64d6(0x1ca)]()};if(a51_0x5ceae7[_0x9f64d6(0x193)](_0x57e95c))try{const _0x5f2162=a51_0x5ceae7[_0x9f64d6(0x1aa)](_0x57e95c,'utf-8'),_0x5be23e=JSON[_0x9f64d6(0x1a1)](_0x5f2162),{metadata:_0x5cb7d3,..._0x2383ce}=_0x5be23e;_0x23105f=_0x2383ce,_0x5cb7d3&&(_0x547b42=_0x5cb7d3);}catch{}return{'name':_0x5d213d,'config':_0x23105f,'metadata':_0x547b42,'hasCredentials':a51_0x5ceae7[_0x9f64d6(0x193)](_0x287620),'scope':_0x9f64d6(0x1b3)};}export function listProfiles(){const _0x2aee70=a51_0x1305,_0x55df9f=loadProfilesFromTdxJsonFiles(),_0x4c4440=loadProfilesFromDirectories();if(_0x4c4440[_0x2aee70(0x19c)]>0x0){const _0x286eec=_0x4c4440[_0x2aee70(0x1c9)](_0x2860c7=>_0x2860c7[_0x2aee70(0x1cd)])['join'](',\x20'),_0x258919=getConfigDir();console['warn'](_0x2aee70(0x19d)+_0x286eec),console[_0x2aee70(0x19e)](_0x2aee70(0x1bd)),console['warn'](_0x2aee70(0x1ab)+a51_0x3f0cb6[_0x2aee70(0x1c4)](_0x258919,'tdx.json')),console[_0x2aee70(0x19e)](_0x2aee70(0x1d0)),console['warn'](_0x2aee70(0x1ba));}const _0x10c312=[..._0x55df9f,..._0x4c4440],_0x4f707d=new Map();for(const _0x205a14 of _0x10c312){!_0x4f707d[_0x2aee70(0x1d3)](_0x205a14['name'])&&_0x4f707d[_0x2aee70(0x1c8)](_0x205a14[_0x2aee70(0x1cd)],_0x205a14);}return Array[_0x2aee70(0x19b)](_0x4f707d[_0x2aee70(0x1b6)]())[_0x2aee70(0x1db)]((_0x5c17bd,_0x143a5a)=>_0x5c17bd[_0x2aee70(0x1cd)]['localeCompare'](_0x143a5a[_0x2aee70(0x1cd)]));}export function profileExists(_0xc9a1f0){const _0x298b42=a51_0x1305,_0x782f9b=listProfiles();return _0x782f9b[_0x298b42(0x1cf)](_0x225dae=>_0x225dae['name']===_0xc9a1f0);}export function loadProfile(_0x5ca218){const _0x42fb95=a51_0x1305;validateProfileName(_0x5ca218);const _0x30e95c=listProfiles(),_0x37d3e1=_0x30e95c[_0x42fb95(0x1c5)](_0x5fda2=>_0x5fda2[_0x42fb95(0x1cd)]===_0x5ca218);return _0x37d3e1||null;}export function saveProfile(_0x11da05,_0x49778d,_0x1fdd60=![]){saveProfileToUserConfig(_0x11da05,_0x49778d);}export function deleteProfile(_0x3b8d0d){const _0x4f74a8=a51_0x1305;validateProfileName(_0x3b8d0d);const _0x2735b8=getProfileDir(_0x3b8d0d);if(!a51_0x5ceae7['existsSync'](_0x2735b8))throw new Error(_0x4f74a8(0x1b7)+_0x3b8d0d+_0x4f74a8(0x199));a51_0x5ceae7[_0x4f74a8(0x1c1)](_0x2735b8,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x16f6c8,_0x3c00f3){const _0x4e4f5d=a51_0x1305;validateProfileName(_0x16f6c8);const _0xfb6718=getGlobalConfigPath(),_0x3f1732=getConfigDir();!a51_0x5ceae7['existsSync'](_0x3f1732)&&createSecureDirectory(_0x3f1732);let _0x133372={};if(a51_0x5ceae7[_0x4e4f5d(0x193)](_0xfb6718))try{const _0x4ef6eb=a51_0x5ceae7[_0x4e4f5d(0x1aa)](_0xfb6718,'utf-8');_0x133372=JSON['parse'](_0x4ef6eb);}catch{console[_0x4e4f5d(0x19e)](_0x4e4f5d(0x1a7)+_0xfb6718+_0x4e4f5d(0x1d8));}!_0x133372[_0x4e4f5d(0x1c2)]&&(_0x133372['profiles']={}),_0x133372[_0x4e4f5d(0x1c2)][_0x16f6c8]=_0x3c00f3,writeSecureFile(_0xfb6718,JSON[_0x4e4f5d(0x1ae)](_0x133372,null,0x2));}export function removeProfileFromUserConfig(_0x143aa9){const _0x52fd08=a51_0x1305;validateProfileName(_0x143aa9);const _0x5979d6=getGlobalConfigPath();if(!a51_0x5ceae7[_0x52fd08(0x193)](_0x5979d6))throw new Error(_0x52fd08(0x191)+_0x143aa9+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x3990ed={};try{const _0x2b549b=a51_0x5ceae7[_0x52fd08(0x1aa)](_0x5979d6,_0x52fd08(0x192));_0x3990ed=JSON[_0x52fd08(0x1a1)](_0x2b549b);}catch{throw new Error(_0x52fd08(0x1df)+_0x5979d6);}if(!_0x3990ed[_0x52fd08(0x1c2)]||!_0x3990ed[_0x52fd08(0x1c2)][_0x143aa9])throw new Error(_0x52fd08(0x191)+_0x143aa9+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x3990ed[_0x52fd08(0x1c2)][_0x143aa9],_0x3990ed[_0x52fd08(0x1e1)]===_0x143aa9&&delete _0x3990ed[_0x52fd08(0x1e1)],writeSecureFile(_0x5979d6,JSON[_0x52fd08(0x1ae)](_0x3990ed,null,0x2));}export function getActiveProfile(){const _0x5154bc=a51_0x1305,_0x1fec53=loadSessionContext();if(_0x1fec53?.[_0x5154bc(0x1e1)])return _0x1fec53[_0x5154bc(0x1e1)];if(process[_0x5154bc(0x1a8)]['TDX_PROFILE'])return process['env']['TDX_PROFILE'];const _0xc1d7b3=getGlobalConfigPath();if(!a51_0x5ceae7['existsSync'](_0xc1d7b3))return null;try{const _0x3a4e98=a51_0x5ceae7[_0x5154bc(0x1aa)](_0xc1d7b3,_0x5154bc(0x192)),_0x351f34=JSON[_0x5154bc(0x1a1)](_0x3a4e98);return _0x351f34[_0x5154bc(0x1e1)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x2bb017){const _0x16cf3f=a51_0x1305,_0x22b277=getGlobalConfigPath(),_0x4b916e=getConfigDir();!a51_0x5ceae7[_0x16cf3f(0x193)](_0x4b916e)&&createSecureDirectory(_0x4b916e);let _0x31a704={};if(a51_0x5ceae7[_0x16cf3f(0x193)](_0x22b277))try{const _0x5b330c=a51_0x5ceae7[_0x16cf3f(0x1aa)](_0x22b277,_0x16cf3f(0x192));_0x31a704=JSON[_0x16cf3f(0x1a1)](_0x5b330c);}catch{console[_0x16cf3f(0x19e)](_0x16cf3f(0x1a7)+_0x22b277+',\x20creating\x20new\x20file');}_0x31a704['site']=_0x2bb017,writeSecureFile(_0x22b277,JSON[_0x16cf3f(0x1ae)](_0x31a704,null,0x2));}export function saveActiveProfileToUserConfig(_0x4fe389){const _0x4d30e8=a51_0x1305;validateProfileName(_0x4fe389);const _0x45f1ab=getGlobalConfigPath(),_0x462afe=getConfigDir();!a51_0x5ceae7['existsSync'](_0x462afe)&&createSecureDirectory(_0x462afe);let _0x3dd1e9={};if(a51_0x5ceae7['existsSync'](_0x45f1ab))try{const _0x145bd6=a51_0x5ceae7[_0x4d30e8(0x1aa)](_0x45f1ab,'utf-8');_0x3dd1e9=JSON[_0x4d30e8(0x1a1)](_0x145bd6);}catch{console[_0x4d30e8(0x19e)](_0x4d30e8(0x1a7)+_0x45f1ab+_0x4d30e8(0x1d8));}_0x3dd1e9['profile']=_0x4fe389,writeSecureFile(_0x45f1ab,JSON[_0x4d30e8(0x1ae)](_0x3dd1e9,null,0x2));}function clearFieldFromUserConfig(_0x19a3d9){const _0x2be86d=a51_0x1305,_0x4013a3=getGlobalConfigPath();if(!a51_0x5ceae7[_0x2be86d(0x193)](_0x4013a3))return;let _0x488053={};try{const _0x345bff=a51_0x5ceae7['readFileSync'](_0x4013a3,'utf-8');_0x488053=JSON[_0x2be86d(0x1a1)](_0x345bff);}catch{return;}delete _0x488053[_0x19a3d9],writeSecureFile(_0x4013a3,JSON[_0x2be86d(0x1ae)](_0x488053,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x4a957f,_0x319839){const _0x293c28=a51_0x1305;validateProfileName(_0x4a957f);if(profileExists(_0x4a957f))throw new Error(_0x293c28(0x1b7)+_0x4a957f+_0x293c28(0x19f));saveProfile(_0x4a957f,_0x319839);}export function saveProfileCredentials(_0x182caa,_0x4f759e){const _0x31d3e2=a51_0x1305;validateProfileName(_0x182caa);if(!profileExists(_0x182caa))throw new Error(_0x31d3e2(0x1b7)+_0x182caa+'\x20does\x20not\x20exist');const _0x300d28=getNewCredentialPath(_0x182caa);writeSecureFile(_0x300d28,_0x4f759e);}export function loadProfileCredentials(_0x2c1feb){const _0x10346c=a51_0x1305;validateProfileName(_0x2c1feb);const _0x4deb71=getNewCredentialPath(_0x2c1feb);if(a51_0x5ceae7[_0x10346c(0x193)](_0x4deb71))try{return a51_0x5ceae7[_0x10346c(0x1aa)](_0x4deb71,_0x10346c(0x192));}catch{}const _0xffa3e0=getOldCredentialPath(_0x2c1feb);if(a51_0x5ceae7[_0x10346c(0x193)](_0xffa3e0)){console[_0x10346c(0x19e)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x2c1feb+'\x27'),console[_0x10346c(0x19e)](_0x10346c(0x1be)),console['warn'](_0x10346c(0x1ce)+_0xffa3e0+_0x10346c(0x197)+_0x4deb71+'\x22'),console[_0x10346c(0x19e)](_0x10346c(0x1d7));try{return a51_0x5ceae7[_0x10346c(0x1aa)](_0xffa3e0,_0x10346c(0x192));}catch{return null;}}return null;}
1
+ (function(_0x3ee5f3,_0x1f6773){const _0x5c95f3=a51_0x2d64,_0x4f86b3=_0x3ee5f3();while(!![]){try{const _0x5b87a6=-parseInt(_0x5c95f3(0xcd))/0x1*(parseInt(_0x5c95f3(0xed))/0x2)+parseInt(_0x5c95f3(0xcc))/0x3*(-parseInt(_0x5c95f3(0xd2))/0x4)+-parseInt(_0x5c95f3(0xc0))/0x5+-parseInt(_0x5c95f3(0xd6))/0x6+parseInt(_0x5c95f3(0x100))/0x7*(-parseInt(_0x5c95f3(0xd8))/0x8)+parseInt(_0x5c95f3(0x10a))/0x9*(parseInt(_0x5c95f3(0xf6))/0xa)+-parseInt(_0x5c95f3(0xe9))/0xb*(-parseInt(_0x5c95f3(0xc7))/0xc);if(_0x5b87a6===_0x1f6773)break;else _0x4f86b3['push'](_0x4f86b3['shift']());}catch(_0x5c0b92){_0x4f86b3['push'](_0x4f86b3['shift']());}}}(a51_0x1dd0,0xbe488));import*as a51_0x4b8739 from'node:fs';import*as a51_0x2cce9f from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME='@tdx-studio';export function getProfileParams(_0x1744b4){const _0x457d4e=a51_0x2d64,_0xf30e01={};if(!_0x1744b4)return _0xf30e01;for(const [_0x4cbec9,_0x4cd602]of Object['entries'](_0x1744b4)){_0x4cbec9!==_0x457d4e(0xdc)&&_0x4cd602!==undefined&&(_0xf30e01[_0x4cbec9]=_0x4cd602);}return _0xf30e01;}export function getProfilesDir(){return a51_0x2cce9f['join'](getConfigDir(),'profiles');}function getProfileDir(_0xc12313){const _0x246f79=a51_0x2d64;return a51_0x2cce9f[_0x246f79(0xf4)](getProfilesDir(),_0xc12313);}function getProfileConfigPath(_0x577f5d){const _0x4736ed=a51_0x2d64;return a51_0x2cce9f[_0x4736ed(0xf4)](getProfileDir(_0x577f5d),'tdx.json');}function a51_0x2d64(_0x5449e2,_0x5263e8){_0x5449e2=_0x5449e2-0xbd;const _0x1dd01c=a51_0x1dd0();let _0x2d64db=_0x1dd01c[_0x5449e2];return _0x2d64db;}function getProfileEnvPath(_0x2d1619){const _0x25b986=a51_0x2d64;return a51_0x2cce9f[_0x25b986(0xf4)](getProfileDir(_0x2d1619),_0x25b986(0xde));}function getGlobalConfigPath(){const _0x10a01e=a51_0x2d64;return a51_0x2cce9f[_0x10a01e(0xf4)](getConfigDir(),'tdx.json');}function validateProfileName(_0x552f9e){const _0xd63b0c=a51_0x2d64;if(!/^@?[a-zA-Z0-9_-]+$/['test'](_0x552f9e))throw new Error(_0xd63b0c(0x104)+_0x552f9e+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x407e43,_0x54c820){const _0x46c7e7=a51_0x2d64;if(typeof _0x407e43!==_0x46c7e7(0xc5)||_0x407e43===null)throw new Error('Profile\x20\x27'+_0x54c820+_0x46c7e7(0x108));const _0x5bef19=[_0x46c7e7(0xdc),_0x46c7e7(0xc4),_0x46c7e7(0xc1),_0x46c7e7(0xee),_0x46c7e7(0xdd),_0x46c7e7(0x105)],_0x1db209=_0x407e43;for(const _0x59f9a4 of Object[_0x46c7e7(0xd9)](_0x1db209)){!_0x5bef19[_0x46c7e7(0xd4)](_0x59f9a4)&&console[_0x46c7e7(0xc6)](_0x46c7e7(0xeb)+_0x54c820+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x59f9a4+_0x46c7e7(0xe5));}if(_0x1db209['description']!==undefined&&typeof _0x1db209[_0x46c7e7(0xdc)]!==_0x46c7e7(0xfc))throw new Error(_0x46c7e7(0xf7)+_0x54c820+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x1db209['site']!==undefined&&typeof _0x1db209[_0x46c7e7(0xc4)]!==_0x46c7e7(0xfc))throw new Error('Profile\x20\x27'+_0x54c820+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x1db209[_0x46c7e7(0xc1)]!==undefined&&typeof _0x1db209[_0x46c7e7(0xc1)]!==_0x46c7e7(0xfc))throw new Error('Profile\x20\x27'+_0x54c820+_0x46c7e7(0xe0));if(_0x1db209[_0x46c7e7(0xee)]!==undefined&&typeof _0x1db209[_0x46c7e7(0xee)]!=='string')throw new Error(_0x46c7e7(0xf7)+_0x54c820+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x1db209[_0x46c7e7(0xdd)]!==undefined&&typeof _0x1db209[_0x46c7e7(0xdd)]!==_0x46c7e7(0xfc))throw new Error(_0x46c7e7(0xf7)+_0x54c820+_0x46c7e7(0xd7));if(_0x1db209[_0x46c7e7(0x105)]!==undefined&&typeof _0x1db209['llm_agent']!==_0x46c7e7(0xfc))throw new Error(_0x46c7e7(0xf7)+_0x54c820+_0x46c7e7(0xdf));return!![];}function loadProfilesFromTdxJson(_0x5186cd,_0x2e53d0){const _0x39cd19=a51_0x2d64;if(!a51_0x4b8739['existsSync'](_0x5186cd))return[];try{const _0x535ce9=a51_0x4b8739[_0x39cd19(0xe7)](_0x5186cd,_0x39cd19(0xfd)),_0x4a9d4c=JSON['parse'](_0x535ce9);if(!_0x4a9d4c[_0x39cd19(0x102)]||typeof _0x4a9d4c[_0x39cd19(0x102)]!==_0x39cd19(0xc5))return[];const _0x4f5ff3=[];for(const [_0x4d4e7e,_0x5c24fd]of Object[_0x39cd19(0xff)](_0x4a9d4c[_0x39cd19(0x102)])){try{validateProfileConfig(_0x5c24fd,_0x4d4e7e);const _0x4bb2e2=getNewCredentialPath(_0x4d4e7e),_0x123a4a=getOldCredentialPath(_0x4d4e7e),_0x33d1a6=a51_0x4b8739[_0x39cd19(0xc9)](_0x4bb2e2)||a51_0x4b8739[_0x39cd19(0xc9)](_0x123a4a);_0x4f5ff3[_0x39cd19(0xe8)]({'name':_0x4d4e7e,'config':_0x5c24fd,'metadata':{'name':_0x4d4e7e,'createdAt':new Date()[_0x39cd19(0xbf)]()},'hasCredentials':_0x33d1a6,'scope':_0x2e53d0});}catch(_0x57ed71){_0x57ed71 instanceof Error&&(console[_0x39cd19(0xc6)](_0x39cd19(0xcb)+_0x5186cd+':'),console[_0x39cd19(0xc6)]('\x20\x20'+_0x57ed71[_0x39cd19(0xd3)]+'\x0a'));}}return _0x4f5ff3;}catch(_0x58bbdf){return _0x58bbdf instanceof SyntaxError?(console[_0x39cd19(0xc6)](_0x39cd19(0xca)+_0x5186cd+_0x39cd19(0xe2)),console['warn'](_0x39cd19(0xd0)+_0x58bbdf[_0x39cd19(0xd3)]+'\x0a')):console[_0x39cd19(0xc6)](_0x39cd19(0xf2)+_0x5186cd+':\x20'+_0x58bbdf+'\x0a'),[];}}export function getNewCredentialPath(_0x1fa5fc){const _0x2302e4=a51_0x2d64;return a51_0x2cce9f[_0x2302e4(0xf4)](getConfigDir(),'.env.'+_0x1fa5fc);}function getOldCredentialPath(_0x4a9009){const _0x230e71=a51_0x2d64;return a51_0x2cce9f[_0x230e71(0xf4)](getProfilesDir(),_0x4a9009,_0x230e71(0xde));}function loadProfilesFromTdxJsonFiles(){const _0x54241c=a51_0x2d64,_0x4d53e5=[],_0x2743be=findProjectConfigPath();_0x2743be&&_0x4d53e5[_0x54241c(0xe8)](...loadProfilesFromTdxJson(_0x2743be,'local'));const _0x136e3b=a51_0x2cce9f[_0x54241c(0xf4)](getConfigDir(),_0x54241c(0xda));return _0x4d53e5[_0x54241c(0xe8)](...loadProfilesFromTdxJson(_0x136e3b,_0x54241c(0x109))),_0x4d53e5;}function loadProfilesFromDirectories(){const _0x2d3c3b=a51_0x2d64,_0x5bd3fb=getProfilesDir();if(!a51_0x4b8739[_0x2d3c3b(0xc9)](_0x5bd3fb))return[];try{return a51_0x4b8739[_0x2d3c3b(0xc8)](_0x5bd3fb,{'withFileTypes':!![]})['filter'](_0x33a3ca=>_0x33a3ca[_0x2d3c3b(0xc2)]())[_0x2d3c3b(0xf8)](_0x1c4a5e=>_0x1c4a5e['name'])[_0x2d3c3b(0xf3)](_0x36bb60=>{const _0x4861f3=_0x2d3c3b,_0x5cc6e8=getProfileConfigPath(_0x36bb60),_0xd5a660=getProfileEnvPath(_0x36bb60);return a51_0x4b8739[_0x4861f3(0xc9)](_0x5cc6e8)||a51_0x4b8739[_0x4861f3(0xc9)](_0xd5a660);})['map'](_0x40cc85=>{const _0x50c29c=_0x2d3c3b,_0x1d79fb=loadProfileFromDirectory(_0x40cc85);if(_0x1d79fb)return{..._0x1d79fb,'scope':_0x50c29c(0xfa)};return null;})[_0x2d3c3b(0xf3)](_0x113bab=>_0x113bab!==null);}catch{return[];}}function loadProfileFromDirectory(_0xc46480){const _0x3d5fd6=a51_0x2d64,_0x449c01=getProfileConfigPath(_0xc46480),_0x1ebfb9=getOldCredentialPath(_0xc46480);if(!a51_0x4b8739[_0x3d5fd6(0xc9)](_0x449c01)&&!a51_0x4b8739[_0x3d5fd6(0xc9)](_0x1ebfb9))return null;let _0x1a3dbd={},_0xbc365c={'name':_0xc46480,'createdAt':new Date()[_0x3d5fd6(0xbf)]()};if(a51_0x4b8739['existsSync'](_0x449c01))try{const _0x4295b6=a51_0x4b8739['readFileSync'](_0x449c01,_0x3d5fd6(0xfd)),_0x3dc565=JSON[_0x3d5fd6(0xc3)](_0x4295b6),{metadata:_0x2455a6,..._0x31bf65}=_0x3dc565;_0x1a3dbd=_0x31bf65,_0x2455a6&&(_0xbc365c=_0x2455a6);}catch{}return{'name':_0xc46480,'config':_0x1a3dbd,'metadata':_0xbc365c,'hasCredentials':a51_0x4b8739[_0x3d5fd6(0xc9)](_0x1ebfb9),'scope':_0x3d5fd6(0xfa)};}export function listProfiles(){const _0x516d0d=a51_0x2d64,_0x1fd9e7=loadProfilesFromTdxJsonFiles(),_0x3be58d=loadProfilesFromDirectories();if(_0x3be58d[_0x516d0d(0xe1)]>0x0){const _0x5563a1=_0x3be58d[_0x516d0d(0xf8)](_0x3f1ae9=>_0x3f1ae9[_0x516d0d(0xf9)])[_0x516d0d(0xf4)](',\x20'),_0x35f08b=getConfigDir();console[_0x516d0d(0xc6)](_0x516d0d(0xf5)+_0x5563a1),console[_0x516d0d(0xc6)](_0x516d0d(0xf0)),console[_0x516d0d(0xc6)](_0x516d0d(0xe3)+a51_0x2cce9f[_0x516d0d(0xf4)](_0x35f08b,_0x516d0d(0xda))),console['warn'](_0x516d0d(0xfe)),console[_0x516d0d(0xc6)](_0x516d0d(0xe6));}const _0x3b0491=[..._0x1fd9e7,..._0x3be58d],_0x447aad=new Map();for(const _0x5a2a3f of _0x3b0491){!_0x447aad[_0x516d0d(0x103)](_0x5a2a3f['name'])&&_0x447aad[_0x516d0d(0x107)](_0x5a2a3f['name'],_0x5a2a3f);}return Array[_0x516d0d(0xea)](_0x447aad['values']())[_0x516d0d(0x106)]((_0xfea243,_0x506b89)=>_0xfea243[_0x516d0d(0xf9)][_0x516d0d(0x101)](_0x506b89[_0x516d0d(0xf9)]));}export function profileExists(_0x99bc3){const _0x1ecda6=a51_0x2d64,_0x994cd1=listProfiles();return _0x994cd1['some'](_0x5df3e5=>_0x5df3e5[_0x1ecda6(0xf9)]===_0x99bc3);}export function loadProfile(_0x27496d){const _0x1891bb=a51_0x2d64;validateProfileName(_0x27496d);const _0x4ed30f=listProfiles(),_0x7b569d=_0x4ed30f['find'](_0x433f44=>_0x433f44[_0x1891bb(0xf9)]===_0x27496d);return _0x7b569d||null;}export function saveProfile(_0x30fd78,_0x3aae2e,_0x6a5aa9=![]){saveProfileToUserConfig(_0x30fd78,_0x3aae2e);}export function deleteProfile(_0x27291b){const _0x1c85ec=a51_0x2d64;validateProfileName(_0x27291b);const _0x293bb0=getProfileDir(_0x27291b);if(!a51_0x4b8739[_0x1c85ec(0xc9)](_0x293bb0))throw new Error(_0x1c85ec(0xbd)+_0x27291b+_0x1c85ec(0xcf));a51_0x4b8739['rmSync'](_0x293bb0,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x483633,_0x52e27c){const _0x9f7c0f=a51_0x2d64;validateProfileName(_0x483633);const _0x5bf0d3=getGlobalConfigPath(),_0x567871=getConfigDir();!a51_0x4b8739[_0x9f7c0f(0xc9)](_0x567871)&&createSecureDirectory(_0x567871);let _0x42507f={};if(a51_0x4b8739['existsSync'](_0x5bf0d3))try{const _0x586818=a51_0x4b8739[_0x9f7c0f(0xe7)](_0x5bf0d3,_0x9f7c0f(0xfd));_0x42507f=JSON[_0x9f7c0f(0xc3)](_0x586818);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x5bf0d3+_0x9f7c0f(0xd1));}!_0x42507f[_0x9f7c0f(0x102)]&&(_0x42507f['profiles']={}),_0x42507f['profiles'][_0x483633]=_0x52e27c,writeSecureFile(_0x5bf0d3,JSON[_0x9f7c0f(0xec)](_0x42507f,null,0x2));}export function removeProfileFromUserConfig(_0x369357){const _0x430a07=a51_0x2d64;validateProfileName(_0x369357);const _0x5a1d2d=getGlobalConfigPath();if(!a51_0x4b8739[_0x430a07(0xc9)](_0x5a1d2d))throw new Error(_0x430a07(0xf7)+_0x369357+_0x430a07(0xce));let _0x5d3fc3={};try{const _0x1bcc79=a51_0x4b8739[_0x430a07(0xe7)](_0x5a1d2d,_0x430a07(0xfd));_0x5d3fc3=JSON[_0x430a07(0xc3)](_0x1bcc79);}catch{throw new Error(_0x430a07(0xfb)+_0x5a1d2d);}if(!_0x5d3fc3[_0x430a07(0x102)]||!_0x5d3fc3[_0x430a07(0x102)][_0x369357])throw new Error(_0x430a07(0xf7)+_0x369357+_0x430a07(0xce));delete _0x5d3fc3[_0x430a07(0x102)][_0x369357],_0x5d3fc3['profile']===_0x369357&&delete _0x5d3fc3[_0x430a07(0xe4)],writeSecureFile(_0x5a1d2d,JSON['stringify'](_0x5d3fc3,null,0x2));}export function getActiveProfile(){const _0x4aac32=a51_0x2d64,_0x2f7e31=loadSessionContext();if(_0x2f7e31?.['profile'])return _0x2f7e31['profile'];if(process[_0x4aac32(0xbe)]['TDX_PROFILE'])return process['env']['TDX_PROFILE'];const _0x2a0289=getGlobalConfigPath();if(!a51_0x4b8739['existsSync'](_0x2a0289))return null;try{const _0x3f9e9b=a51_0x4b8739[_0x4aac32(0xe7)](_0x2a0289,_0x4aac32(0xfd)),_0x5e57a2=JSON[_0x4aac32(0xc3)](_0x3f9e9b);return _0x5e57a2[_0x4aac32(0xe4)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x50ec7b){const _0x16194b=a51_0x2d64,_0x2a7eff=getGlobalConfigPath(),_0x39a97d=getConfigDir();!a51_0x4b8739[_0x16194b(0xc9)](_0x39a97d)&&createSecureDirectory(_0x39a97d);let _0x27ff20={};if(a51_0x4b8739[_0x16194b(0xc9)](_0x2a7eff))try{const _0x2376df=a51_0x4b8739[_0x16194b(0xe7)](_0x2a7eff,'utf-8');_0x27ff20=JSON['parse'](_0x2376df);}catch{console[_0x16194b(0xc6)](_0x16194b(0xf1)+_0x2a7eff+_0x16194b(0xd1));}_0x27ff20[_0x16194b(0xc4)]=_0x50ec7b,writeSecureFile(_0x2a7eff,JSON[_0x16194b(0xec)](_0x27ff20,null,0x2));}export function saveActiveProfileToUserConfig(_0x18f889){const _0x3d5d66=a51_0x2d64;validateProfileName(_0x18f889);const _0x1fb502=getGlobalConfigPath(),_0x39faee=getConfigDir();!a51_0x4b8739[_0x3d5d66(0xc9)](_0x39faee)&&createSecureDirectory(_0x39faee);let _0x1e6e9c={};if(a51_0x4b8739[_0x3d5d66(0xc9)](_0x1fb502))try{const _0x5146bd=a51_0x4b8739['readFileSync'](_0x1fb502,_0x3d5d66(0xfd));_0x1e6e9c=JSON[_0x3d5d66(0xc3)](_0x5146bd);}catch{console[_0x3d5d66(0xc6)](_0x3d5d66(0xf1)+_0x1fb502+',\x20creating\x20new\x20file');}_0x1e6e9c['profile']=_0x18f889,writeSecureFile(_0x1fb502,JSON[_0x3d5d66(0xec)](_0x1e6e9c,null,0x2));}function clearFieldFromUserConfig(_0x357443){const _0x57f23a=a51_0x2d64,_0x1b94eb=getGlobalConfigPath();if(!a51_0x4b8739[_0x57f23a(0xc9)](_0x1b94eb))return;let _0x192d5c={};try{const _0xf67a0e=a51_0x4b8739[_0x57f23a(0xe7)](_0x1b94eb,_0x57f23a(0xfd));_0x192d5c=JSON['parse'](_0xf67a0e);}catch{return;}delete _0x192d5c[_0x357443],writeSecureFile(_0x1b94eb,JSON[_0x57f23a(0xec)](_0x192d5c,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x3ead29=a51_0x2d64;clearFieldFromUserConfig(_0x3ead29(0xc4));}export function clearActiveProfileFromUserConfig(){const _0x27b4f3=a51_0x2d64;clearFieldFromUserConfig(_0x27b4f3(0xe4));}export function createProfile(_0x1c0b01,_0x156234){const _0x5783a6=a51_0x2d64;validateProfileName(_0x1c0b01);if(profileExists(_0x1c0b01))throw new Error(_0x5783a6(0xbd)+_0x1c0b01+_0x5783a6(0xd5));saveProfile(_0x1c0b01,_0x156234);}export function saveProfileCredentials(_0x5003f0,_0x466e72){const _0x3d637f=a51_0x2d64;validateProfileName(_0x5003f0);if(!profileExists(_0x5003f0))throw new Error(_0x3d637f(0xbd)+_0x5003f0+_0x3d637f(0xcf));const _0x1b381b=getNewCredentialPath(_0x5003f0);writeSecureFile(_0x1b381b,_0x466e72);}function a51_0x1dd0(){const _0x30f08d=['object','warn','24zXQeOE','readdirSync','existsSync','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','3486786YtwsPl','25qaaArW','\x27\x20not\x20found\x20in\x20user\x20configuration','\x20does\x20not\x20exist','Error:\x20',',\x20creating\x20new\x20file','4MhCWfQ','message','includes','\x20already\x20exists','6256926JESiWL','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','4770992qgDjKY','keys','tdx.json','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','description','llm_project','.env','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','length',':\x20Invalid\x20JSON\x20syntax','\x20\x201.\x20Edit:\x20','profile','\x27\x20will\x20be\x20ignored','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','readFileSync','push','25880426NDlheY','from','Warning:\x20Profile\x20\x27','stringify','65570YIRACa','parent_segment','To\x20migrate:','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','Warning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','filter','join','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','430rTFnzT','Profile\x20\x27','map','name','directory','Failed\x20to\x20parse\x20','string','utf-8','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','entries','7ZSQSum','localeCompare','profiles','has','Invalid\x20profile\x20name:\x20','llm_agent','sort','set','\x27:\x20config\x20must\x20be\x20an\x20object','user','156771ponLNF','Profile\x20','env','toISOString','5270335WyLZdw','database','isDirectory','parse','site'];a51_0x1dd0=function(){return _0x30f08d;};return a51_0x1dd0();}export function loadProfileCredentials(_0x2c935e){const _0x57f5d5=a51_0x2d64;validateProfileName(_0x2c935e);const _0x1d2a41=getNewCredentialPath(_0x2c935e);if(a51_0x4b8739[_0x57f5d5(0xc9)](_0x1d2a41))try{return a51_0x4b8739[_0x57f5d5(0xe7)](_0x1d2a41,'utf-8');}catch{}const _0x2bc8c9=getOldCredentialPath(_0x2c935e);if(a51_0x4b8739['existsSync'](_0x2bc8c9)){console['warn']('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x2c935e+'\x27'),console['warn'](_0x57f5d5(0xef)),console[_0x57f5d5(0xc6)]('\x20\x20mv\x20\x22'+_0x2bc8c9+'\x22\x20\x22'+_0x1d2a41+'\x22'),console['warn'](_0x57f5d5(0xdb));try{return a51_0x4b8739[_0x57f5d5(0xe7)](_0x2bc8c9,_0x57f5d5(0xfd));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a52_0x47ad78=a52_0x4cc6;(function(_0x4942e1,_0x579c59){const _0x7fc138=a52_0x4cc6,_0x1fec7a=_0x4942e1();while(!![]){try{const _0x32cdc6=-parseInt(_0x7fc138(0x1cd))/0x1+parseInt(_0x7fc138(0x1c2))/0x2+parseInt(_0x7fc138(0x1bf))/0x3*(parseInt(_0x7fc138(0x1b6))/0x4)+-parseInt(_0x7fc138(0x1be))/0x5+-parseInt(_0x7fc138(0x1b4))/0x6+-parseInt(_0x7fc138(0x1bb))/0x7+-parseInt(_0x7fc138(0x1c1))/0x8*(-parseInt(_0x7fc138(0x1b7))/0x9);if(_0x32cdc6===_0x579c59)break;else _0x1fec7a['push'](_0x1fec7a['shift']());}catch(_0x40357f){_0x1fec7a['push'](_0x1fec7a['shift']());}}}(a52_0x5178,0x57abf));function a52_0x4cc6(_0xa3214e,_0x5a3552){_0xa3214e=_0xa3214e-0x1b2;const _0x517804=a52_0x5178();let _0x4cc613=_0x517804[_0xa3214e];return _0x4cc613;}import*as a52_0x54465e from'node:fs';import*as a52_0x5cd83d from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x47ad78(0x1ca);function a52_0x5178(){const _0x233c43=['parse','418024hqEPNp','167346NWikPE','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','code','includes','apiKey','Warning:\x20\x27profile\x27\x20field\x20in\x20','existsSync','readFileSync','tdx.json','stringify','writeFileSync','350318lnQSYW','ENOENT','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','join','cwd','2814240qEXYqp','TD_API_KEY','2428iSabZr','369pahIeX','api_key','utf-8','Failed\x20to\x20load\x20project\x20config\x20from\x20','4767147yTRmKn','dirname','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','2312350KLNpjZ','474mEEsxD'];a52_0x5178=function(){return _0x233c43;};return a52_0x5178();}export function findProjectConfigPath(_0x287e67){const _0x48573a=a52_0x47ad78;let _0x500e60=_0x287e67||process[_0x48573a(0x1b3)]();while(!![]){const _0x82f77d=a52_0x5cd83d[_0x48573a(0x1b2)](_0x500e60,PROJECT_CONFIG_FILENAME);if(a52_0x54465e[_0x48573a(0x1c8)](_0x82f77d))return _0x82f77d;const _0x3b625a=a52_0x5cd83d[_0x48573a(0x1bc)](_0x500e60);if(_0x3b625a===_0x500e60)return null;_0x500e60=_0x3b625a;}}export function loadProjectConfig(_0x21262e){const _0x4f8f02=a52_0x47ad78,_0x4f290f=findProjectConfigPath(_0x21262e);if(!_0x4f290f)return null;try{const _0x1c09f3=a52_0x54465e[_0x4f8f02(0x1c9)](_0x4f290f,_0x4f8f02(0x1b9)),_0x10340a=JSON[_0x4f8f02(0x1c0)](_0x1c09f3),_0x541eac=JSON[_0x4f8f02(0x1cb)](_0x10340a);if(_0x541eac[_0x4f8f02(0x1c5)](_0x4f8f02(0x1b5))||_0x541eac[_0x4f8f02(0x1c5)](_0x4f8f02(0x1c6))||_0x541eac['includes'](_0x4f8f02(0x1b8)))throw new Error(_0x4f8f02(0x1c3)+_0x4f290f+').\x20'+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x385319,profile:_0x48e6ab,..._0x1b13b0}=_0x10340a;return _0x48e6ab&&console['warn'](_0x4f8f02(0x1c7)+_0x4f290f+'\x20is\x20ignored.\x20'+_0x4f8f02(0x1cf)),_0x1b13b0;}catch(_0x19b5cf){if(_0x19b5cf instanceof Error&&_0x4f8f02(0x1c4)in _0x19b5cf&&_0x19b5cf['code']===_0x4f8f02(0x1ce))return null;throw new Error(_0x4f8f02(0x1ba)+_0x4f290f+':\x20'+_0x19b5cf);}}export function saveProjectConfig(_0x2a1810,_0x460b4e){const _0x286d89=a52_0x47ad78,_0x297b95=_0x460b4e||process[_0x286d89(0x1b3)](),_0x4ed0ef=a52_0x5cd83d[_0x286d89(0x1b2)](_0x297b95,PROJECT_CONFIG_FILENAME),_0x2b3d97=JSON[_0x286d89(0x1cb)](_0x2a1810);if(_0x2b3d97[_0x286d89(0x1c5)](_0x286d89(0x1b5))||_0x2b3d97[_0x286d89(0x1c5)]('apiKey')||_0x2b3d97['includes'](_0x286d89(0x1b8)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if('profile'in _0x2a1810)throw new Error(_0x286d89(0x1bd));a52_0x54465e[_0x286d89(0x1cc)](_0x4ed0ef,JSON[_0x286d89(0x1cb)](_0x2a1810,null,0x2));}export function hasProjectConfig(_0x273d69){return findProjectConfigPath(_0x273d69)!==null;}export function getProjectRoot(_0x134fde){const _0x40882b=findProjectConfigPath(_0x134fde);return _0x40882b?a52_0x5cd83d['dirname'](_0x40882b):null;}
1
+ const a52_0x23500a=a52_0x9e36;function a52_0x9e36(_0x580661,_0x153114){_0x580661=_0x580661-0x71;const _0x5f3480=a52_0x5f34();let _0x9e3670=_0x5f3480[_0x580661];return _0x9e3670;}(function(_0x242945,_0x1d2a1d){const _0x3cb02b=a52_0x9e36,_0x5998eb=_0x242945();while(!![]){try{const _0x120841=-parseInt(_0x3cb02b(0x75))/0x1*(parseInt(_0x3cb02b(0x82))/0x2)+parseInt(_0x3cb02b(0x7f))/0x3*(-parseInt(_0x3cb02b(0x77))/0x4)+parseInt(_0x3cb02b(0x79))/0x5*(parseInt(_0x3cb02b(0x89))/0x6)+-parseInt(_0x3cb02b(0x88))/0x7+-parseInt(_0x3cb02b(0x7a))/0x8*(parseInt(_0x3cb02b(0x7c))/0x9)+parseInt(_0x3cb02b(0x7e))/0xa+parseInt(_0x3cb02b(0x86))/0xb;if(_0x120841===_0x1d2a1d)break;else _0x5998eb['push'](_0x5998eb['shift']());}catch(_0x51818a){_0x5998eb['push'](_0x5998eb['shift']());}}}(a52_0x5f34,0xa0049));import*as a52_0x2427b4 from'node:fs';import*as a52_0x1d702c from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x23500a(0x73);export function findProjectConfigPath(_0x31302e){const _0xccf53f=a52_0x23500a;let _0x31944c=_0x31302e||process[_0xccf53f(0x76)]();while(!![]){const _0x103290=a52_0x1d702c[_0xccf53f(0x81)](_0x31944c,PROJECT_CONFIG_FILENAME);if(a52_0x2427b4['existsSync'](_0x103290))return _0x103290;const _0x43aa60=a52_0x1d702c[_0xccf53f(0x8b)](_0x31944c);if(_0x43aa60===_0x31944c)return null;_0x31944c=_0x43aa60;}}function a52_0x5f34(){const _0x424bd9=['2439430iGPQAn','19158bQlZuB','Failed\x20to\x20load\x20project\x20config\x20from\x20','dirname','Warning:\x20\x27profile\x27\x20field\x20in\x20','stringify','warn','tdx.json','apiKey','35dMyZGe','cwd','52gtUqiW','TD_API_KEY','1615toAnGb','73960DjRLjB','code','135jApXaA','utf-8','10729940plFPzK','257661CDwkVX','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','join','55874eiXCpa','api_key','ENOENT','\x20is\x20ignored.\x20','12458501HYUsKh','includes'];a52_0x5f34=function(){return _0x424bd9;};return a52_0x5f34();}export function loadProjectConfig(_0x385c7c){const _0x59a071=a52_0x23500a,_0x6198ed=findProjectConfigPath(_0x385c7c);if(!_0x6198ed)return null;try{const _0x2f9340=a52_0x2427b4['readFileSync'](_0x6198ed,_0x59a071(0x7d)),_0x4a57ee=JSON['parse'](_0x2f9340),_0x342cc4=JSON[_0x59a071(0x71)](_0x4a57ee);if(_0x342cc4[_0x59a071(0x87)](_0x59a071(0x78))||_0x342cc4['includes'](_0x59a071(0x74))||_0x342cc4[_0x59a071(0x87)](_0x59a071(0x83)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x6198ed+').\x20'+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x6572d2,profile:_0x445c34,..._0x2f5c27}=_0x4a57ee;return _0x445c34&&console[_0x59a071(0x72)](_0x59a071(0x8c)+_0x6198ed+_0x59a071(0x85)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x2f5c27;}catch(_0x3c9ef3){if(_0x3c9ef3 instanceof Error&&_0x59a071(0x7b)in _0x3c9ef3&&_0x3c9ef3[_0x59a071(0x7b)]===_0x59a071(0x84))return null;throw new Error(_0x59a071(0x8a)+_0x6198ed+':\x20'+_0x3c9ef3);}}export function saveProjectConfig(_0x51d93f,_0x2f5d5b){const _0x2dc114=a52_0x23500a,_0x39fe8d=_0x2f5d5b||process['cwd'](),_0x1d3831=a52_0x1d702c[_0x2dc114(0x81)](_0x39fe8d,PROJECT_CONFIG_FILENAME),_0x436ea1=JSON[_0x2dc114(0x71)](_0x51d93f);if(_0x436ea1[_0x2dc114(0x87)](_0x2dc114(0x78))||_0x436ea1[_0x2dc114(0x87)]('apiKey')||_0x436ea1[_0x2dc114(0x87)](_0x2dc114(0x83)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if('profile'in _0x51d93f)throw new Error(_0x2dc114(0x80));a52_0x2427b4['writeFileSync'](_0x1d3831,JSON[_0x2dc114(0x71)](_0x51d93f,null,0x2));}export function hasProjectConfig(_0x6698b8){return findProjectConfigPath(_0x6698b8)!==null;}export function getProjectRoot(_0x55f7c8){const _0x592574=findProjectConfigPath(_0x55f7c8);return _0x592574?a52_0x1d702c['dirname'](_0x592574):null;}
@@ -1 +1 @@
1
- (function(_0x154b32,_0x5f4340){const _0x23bfe2=a53_0x15d2,_0x1a71c9=_0x154b32();while(!![]){try{const _0xfdb433=parseInt(_0x23bfe2(0xe6))/0x1*(parseInt(_0x23bfe2(0xd1))/0x2)+parseInt(_0x23bfe2(0xde))/0x3*(parseInt(_0x23bfe2(0xe2))/0x4)+parseInt(_0x23bfe2(0xd9))/0x5+parseInt(_0x23bfe2(0xe5))/0x6*(-parseInt(_0x23bfe2(0xc1))/0x7)+-parseInt(_0x23bfe2(0xc3))/0x8+-parseInt(_0x23bfe2(0xdc))/0x9*(parseInt(_0x23bfe2(0xd4))/0xa)+parseInt(_0x23bfe2(0xd5))/0xb;if(_0xfdb433===_0x5f4340)break;else _0x1a71c9['push'](_0x1a71c9['shift']());}catch(_0x6a8dc){_0x1a71c9['push'](_0x1a71c9['shift']());}}}(a53_0x4fd8,0x1bd16));function a53_0x4fd8(){const _0x405b3b=['replace','toString','homedir','sort','endsWith','existsSync','.config','.\x20This\x20is\x20insecure.\x20Removing\x20session.','toISOString','join','tdx','readFileSync','413102ZxIYSw','getTime','push','1990BHUzfH','2293291efYsDh','utf-8','.json','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','265115kYhodO','warn','unlinkSync','5346iHIDMX','now','1011rWMEoM','test','readdirSync','TDX_CONFIG_DIR','184qPHfjc','writeFileSync','apiKey','6GNtmjf','1Zfzqwh','TD_API_KEY','env','parse','stringify','includes','1330679wmhRuO','api_key','490496zPgONr','createdAt'];a53_0x4fd8=function(){return _0x405b3b;};return a53_0x4fd8();}import*as a53_0x2b1699 from'node:fs';import*as a53_0x406fb2 from'node:path';import*as a53_0x334448 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 _0x3324df=a53_0x15d2,_0x303df1=process[_0x3324df(0xe8)][_0x3324df(0xe1)]||a53_0x406fb2[_0x3324df(0xce)](a53_0x334448[_0x3324df(0xc7)](),_0x3324df(0xcb),_0x3324df(0xcf));return a53_0x406fb2[_0x3324df(0xce)](_0x303df1,'sessions');}function getSessionPath(_0x22bb24){const _0x168b78=a53_0x15d2;return a53_0x406fb2[_0x168b78(0xce)](getSessionsDir(),_0x22bb24+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x438f8f){const _0x719c89=a53_0x15d2;if(_0x438f8f)return _0x438f8f;return getCurrentSessionPID()[_0x719c89(0xc6)]();}export function loadSessionContext(_0x195e32){const _0x5f39b5=a53_0x15d2,_0x531bbe=_0x195e32||getCurrentSessionPID()[_0x5f39b5(0xc6)](),_0x3baa31=/^\d+$/[_0x5f39b5(0xdf)](_0x531bbe)?parseInt(_0x531bbe,0xa):null;return _0x3baa31!==null?loadSessionContextByPID(_0x3baa31):loadSessionContextByString(_0x531bbe);}export function loadSessionContextByPID(_0x2ebff1){const _0x178393=a53_0x15d2,_0x450bdc=getSessionPath(_0x2ebff1);if(!a53_0x2b1699[_0x178393(0xca)](_0x450bdc))return null;try{const _0x4d7ab0=a53_0x2b1699[_0x178393(0xd0)](_0x450bdc,_0x178393(0xd6)),_0x1cdfb3=JSON[_0x178393(0xe9)](_0x4d7ab0),_0x3558ed=new Date(_0x1cdfb3[_0x178393(0xc4)])[_0x178393(0xd2)](),_0x5a2abd=Date['now']();if(_0x5a2abd-_0x3558ed>SESSION_EXPIRATION_MS)return a53_0x2b1699[_0x178393(0xdb)](_0x450bdc),null;const _0x7d54e6=JSON[_0x178393(0xbf)](_0x1cdfb3);if(_0x7d54e6[_0x178393(0xc0)](_0x178393(0xe7))||_0x7d54e6[_0x178393(0xc0)](_0x178393(0xe4))||_0x7d54e6[_0x178393(0xc0)](_0x178393(0xc2)))return console[_0x178393(0xda)](_0x178393(0xd8)+_0x450bdc+_0x178393(0xcc)),a53_0x2b1699[_0x178393(0xdb)](_0x450bdc),null;return _0x1cdfb3;}catch{try{a53_0x2b1699[_0x178393(0xdb)](_0x450bdc);}catch{}return null;}}function a53_0x15d2(_0x1d08dd,_0x1a5b85){_0x1d08dd=_0x1d08dd-0xbf;const _0x4fd861=a53_0x4fd8();let _0x15d25a=_0x4fd861[_0x1d08dd];return _0x15d25a;}function loadSessionContextByString(_0x4ed3bd){const _0x5bb5d7=a53_0x15d2,_0x4882fa=a53_0x406fb2[_0x5bb5d7(0xce)](getSessionsDir(),_0x4ed3bd+_0x5bb5d7(0xd7));if(!a53_0x2b1699[_0x5bb5d7(0xca)](_0x4882fa))return null;try{const _0x1a2cbf=a53_0x2b1699[_0x5bb5d7(0xd0)](_0x4882fa,'utf-8'),_0x585a58=JSON[_0x5bb5d7(0xe9)](_0x1a2cbf),_0x118250=new Date(_0x585a58[_0x5bb5d7(0xc4)])['getTime'](),_0xfa4cf1=Date[_0x5bb5d7(0xdd)]();if(_0xfa4cf1-_0x118250>SESSION_EXPIRATION_MS)return a53_0x2b1699[_0x5bb5d7(0xdb)](_0x4882fa),null;const _0x244f03=JSON['stringify'](_0x585a58);if(_0x244f03[_0x5bb5d7(0xc0)](_0x5bb5d7(0xe7))||_0x244f03[_0x5bb5d7(0xc0)](_0x5bb5d7(0xe4))||_0x244f03[_0x5bb5d7(0xc0)]('api_key'))return console[_0x5bb5d7(0xda)](_0x5bb5d7(0xd8)+_0x4882fa+_0x5bb5d7(0xcc)),a53_0x2b1699[_0x5bb5d7(0xdb)](_0x4882fa),null;return _0x585a58;}catch{try{a53_0x2b1699[_0x5bb5d7(0xdb)](_0x4882fa);}catch{}return null;}}export function saveSessionContext(_0x63c08,_0x282807){const _0x35965a=a53_0x15d2,_0x2ec34d=_0x282807||getCurrentSessionPID()[_0x35965a(0xc6)](),_0xa2bde0=/^\d+$/[_0x35965a(0xdf)](_0x2ec34d)?parseInt(_0x2ec34d,0xa):getCurrentSessionPID(),_0x324e18=a53_0x406fb2[_0x35965a(0xce)](getSessionsDir(),_0x2ec34d+'.json'),_0x4497e5=getSessionsDir();createSecureDirectory(_0x4497e5);const _0x403320=JSON[_0x35965a(0xbf)](_0x63c08);if(_0x403320[_0x35965a(0xc0)](_0x35965a(0xe7))||_0x403320['includes']('apiKey')||_0x403320[_0x35965a(0xc0)](_0x35965a(0xc2)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x298f7d;const _0x598969=/^\d+$/['test'](_0x2ec34d)?loadSessionContextByPID(parseInt(_0x2ec34d,0xa)):loadSessionContextByString(_0x2ec34d);_0x598969?_0x298f7d={..._0x598969,..._0x63c08,'pid':_0xa2bde0,'sessionId':_0x2ec34d!==_0xa2bde0['toString']()?_0x2ec34d:undefined,'updatedAt':new Date()[_0x35965a(0xcd)]()}:_0x298f7d={'pid':_0xa2bde0,'sessionId':_0x2ec34d!==_0xa2bde0[_0x35965a(0xc6)]()?_0x2ec34d:undefined,..._0x63c08,'createdAt':new Date()[_0x35965a(0xcd)](),'updatedAt':new Date()[_0x35965a(0xcd)]()},a53_0x2b1699['writeFileSync'](_0x324e18,JSON[_0x35965a(0xbf)](_0x298f7d,null,0x2));}export function clearSessionContext(_0x252ebf){const _0x5863af=a53_0x15d2,_0x6e46bd=_0x252ebf||getCurrentSessionPID()[_0x5863af(0xc6)](),_0x2efc54=a53_0x406fb2[_0x5863af(0xce)](getSessionsDir(),_0x6e46bd+_0x5863af(0xd7));a53_0x2b1699[_0x5863af(0xca)](_0x2efc54)&&a53_0x2b1699[_0x5863af(0xdb)](_0x2efc54);}export function clearSessionContextField(_0x4cd298,_0x204420){const _0x167a0f=a53_0x15d2,_0x14d8f5=_0x204420||getCurrentSessionPID()[_0x167a0f(0xc6)](),_0x48e406=a53_0x406fb2[_0x167a0f(0xce)](getSessionsDir(),_0x14d8f5+_0x167a0f(0xd7));if(!a53_0x2b1699[_0x167a0f(0xca)](_0x48e406))return;try{const _0x2c7b1a=a53_0x2b1699[_0x167a0f(0xd0)](_0x48e406,_0x167a0f(0xd6)),_0x102297=JSON[_0x167a0f(0xe9)](_0x2c7b1a);delete _0x102297[_0x4cd298],a53_0x2b1699[_0x167a0f(0xe3)](_0x48e406,JSON['stringify'](_0x102297,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x2a2a70=a53_0x15d2,_0x5b97df=getSessionsDir();if(!a53_0x2b1699[_0x2a2a70(0xca)](_0x5b97df))return 0x0;let _0x34e4b1=0x0;const _0x301975=Date[_0x2a2a70(0xdd)]();try{const _0x4be444=a53_0x2b1699['readdirSync'](_0x5b97df);for(const _0x16b0d0 of _0x4be444){if(!_0x16b0d0['endsWith'](_0x2a2a70(0xd7)))continue;const _0x115a1e=a53_0x406fb2[_0x2a2a70(0xce)](_0x5b97df,_0x16b0d0),_0x208a9a=_0x16b0d0[_0x2a2a70(0xc5)]('.json',''),_0x352607=parseInt(_0x208a9a,0xa),_0x40e7e9=!isNaN(_0x352607);if(_0x40e7e9){if(!isProcessRunning(_0x352607)){a53_0x2b1699[_0x2a2a70(0xdb)](_0x115a1e),_0x34e4b1++;continue;}}try{const _0x396070=a53_0x2b1699['readFileSync'](_0x115a1e,_0x2a2a70(0xd6)),_0x108a2a=JSON[_0x2a2a70(0xe9)](_0x396070),_0x520442=new Date(_0x108a2a[_0x2a2a70(0xc4)])[_0x2a2a70(0xd2)]();_0x301975-_0x520442>SESSION_EXPIRATION_MS&&(a53_0x2b1699[_0x2a2a70(0xdb)](_0x115a1e),_0x34e4b1++);}catch{a53_0x2b1699[_0x2a2a70(0xdb)](_0x115a1e),_0x34e4b1++;}}}catch{}return _0x34e4b1;}export function listActiveSessions(){const _0x33f536=a53_0x15d2,_0x18868c=getSessionsDir();if(!a53_0x2b1699[_0x33f536(0xca)](_0x18868c))return[];try{const _0x54aa98=a53_0x2b1699[_0x33f536(0xe0)](_0x18868c),_0x4c9bd1=[];for(const _0x56eaad of _0x54aa98){if(!_0x56eaad[_0x33f536(0xc9)](_0x33f536(0xd7)))continue;const _0x54608c=_0x56eaad[_0x33f536(0xc5)](_0x33f536(0xd7),''),_0x468d63=parseInt(_0x54608c,0xa);!isNaN(_0x468d63)&&isProcessRunning(_0x468d63)&&_0x4c9bd1[_0x33f536(0xd3)](_0x468d63);}return _0x4c9bd1[_0x33f536(0xc8)]((_0x558cb9,_0x40b48d)=>_0x558cb9-_0x40b48d);}catch{return[];}}
1
+ (function(_0x3c4620,_0x4e34b1){const _0x4097ee=a53_0x46db,_0x36065c=_0x3c4620();while(!![]){try{const _0x8c1005=-parseInt(_0x4097ee(0x175))/0x1*(-parseInt(_0x4097ee(0x166))/0x2)+-parseInt(_0x4097ee(0x16e))/0x3*(-parseInt(_0x4097ee(0x18f))/0x4)+parseInt(_0x4097ee(0x181))/0x5+-parseInt(_0x4097ee(0x177))/0x6+-parseInt(_0x4097ee(0x180))/0x7*(-parseInt(_0x4097ee(0x16a))/0x8)+parseInt(_0x4097ee(0x18d))/0x9*(-parseInt(_0x4097ee(0x16f))/0xa)+parseInt(_0x4097ee(0x188))/0xb*(parseInt(_0x4097ee(0x178))/0xc);if(_0x8c1005===_0x4e34b1)break;else _0x36065c['push'](_0x36065c['shift']());}catch(_0x5b7578){_0x36065c['push'](_0x36065c['shift']());}}}(a53_0x13a0,0x27949));function a53_0x13a0(){const _0x334a57=['test','.config','createdAt','api_key','TDX_CONFIG_DIR','.\x20This\x20is\x20insecure.\x20Removing\x20session.','11JhGCYI','endsWith','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','readdirSync','sort','207ZqtSII','replace','308ZCfOwL','readFileSync','2VliIJF','homedir','join','warn','89576rhXUlN','unlinkSync','existsSync','includes','729QuAdaZ','64820wkhueK','getTime','toString','now','sessions','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','99692bbtjki','toISOString','889530iaxRCQ','927948pZeltZ','apiKey','utf-8','TD_API_KEY','.json','parse','writeFileSync','stringify','35NzVXHH','1038725DyqTEP'];a53_0x13a0=function(){return _0x334a57;};return a53_0x13a0();}import*as a53_0x336535 from'node:fs';import*as a53_0x5e3e6b from'node:path';function a53_0x46db(_0x1a9195,_0x183682){_0x1a9195=_0x1a9195-0x165;const _0x13a0ae=a53_0x13a0();let _0x46db7f=_0x13a0ae[_0x1a9195];return _0x46db7f;}import*as a53_0x446f01 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 _0x3b9ca5=a53_0x46db,_0x31aba7=process['env'][_0x3b9ca5(0x186)]||a53_0x5e3e6b[_0x3b9ca5(0x168)](a53_0x446f01[_0x3b9ca5(0x167)](),_0x3b9ca5(0x183),'tdx');return a53_0x5e3e6b[_0x3b9ca5(0x168)](_0x31aba7,_0x3b9ca5(0x173));}function getSessionPath(_0x3865b7){const _0x473cdb=a53_0x46db;return a53_0x5e3e6b['join'](getSessionsDir(),_0x3865b7+_0x473cdb(0x17c));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x495dac){const _0x4dd3b5=a53_0x46db;if(_0x495dac)return _0x495dac;return getCurrentSessionPID()[_0x4dd3b5(0x171)]();}export function loadSessionContext(_0x93d09e){const _0x322b10=a53_0x46db,_0x5a5acb=_0x93d09e||getCurrentSessionPID()['toString'](),_0x177994=/^\d+$/[_0x322b10(0x182)](_0x5a5acb)?parseInt(_0x5a5acb,0xa):null;return _0x177994!==null?loadSessionContextByPID(_0x177994):loadSessionContextByString(_0x5a5acb);}export function loadSessionContextByPID(_0x2460a0){const _0x45d12c=a53_0x46db,_0x4ed23d=getSessionPath(_0x2460a0);if(!a53_0x336535[_0x45d12c(0x16c)](_0x4ed23d))return null;try{const _0x2efc74=a53_0x336535[_0x45d12c(0x165)](_0x4ed23d,_0x45d12c(0x17a)),_0x3aeaf5=JSON[_0x45d12c(0x17d)](_0x2efc74),_0x556e09=new Date(_0x3aeaf5['createdAt'])[_0x45d12c(0x170)](),_0x1906cc=Date[_0x45d12c(0x172)]();if(_0x1906cc-_0x556e09>SESSION_EXPIRATION_MS)return a53_0x336535[_0x45d12c(0x16b)](_0x4ed23d),null;const _0x9ac41a=JSON['stringify'](_0x3aeaf5);if(_0x9ac41a[_0x45d12c(0x16d)]('TD_API_KEY')||_0x9ac41a['includes'](_0x45d12c(0x179))||_0x9ac41a['includes'](_0x45d12c(0x185)))return console[_0x45d12c(0x169)](_0x45d12c(0x18a)+_0x4ed23d+_0x45d12c(0x187)),a53_0x336535['unlinkSync'](_0x4ed23d),null;return _0x3aeaf5;}catch{try{a53_0x336535[_0x45d12c(0x16b)](_0x4ed23d);}catch{}return null;}}function loadSessionContextByString(_0x126462){const _0x404b42=a53_0x46db,_0x145504=a53_0x5e3e6b[_0x404b42(0x168)](getSessionsDir(),_0x126462+'.json');if(!a53_0x336535['existsSync'](_0x145504))return null;try{const _0x58980d=a53_0x336535[_0x404b42(0x165)](_0x145504,_0x404b42(0x17a)),_0x572349=JSON['parse'](_0x58980d),_0x5e5c96=new Date(_0x572349[_0x404b42(0x184)])[_0x404b42(0x170)](),_0x467693=Date[_0x404b42(0x172)]();if(_0x467693-_0x5e5c96>SESSION_EXPIRATION_MS)return a53_0x336535['unlinkSync'](_0x145504),null;const _0x5982bb=JSON['stringify'](_0x572349);if(_0x5982bb['includes'](_0x404b42(0x17b))||_0x5982bb[_0x404b42(0x16d)]('apiKey')||_0x5982bb[_0x404b42(0x16d)](_0x404b42(0x185)))return console[_0x404b42(0x169)](_0x404b42(0x18a)+_0x145504+_0x404b42(0x187)),a53_0x336535['unlinkSync'](_0x145504),null;return _0x572349;}catch{try{a53_0x336535[_0x404b42(0x16b)](_0x145504);}catch{}return null;}}export function saveSessionContext(_0x478b41,_0x4afa86){const _0x1a86ac=a53_0x46db,_0x2cc63e=_0x4afa86||getCurrentSessionPID()['toString'](),_0x49f44f=/^\d+$/[_0x1a86ac(0x182)](_0x2cc63e)?parseInt(_0x2cc63e,0xa):getCurrentSessionPID(),_0x4c800f=a53_0x5e3e6b[_0x1a86ac(0x168)](getSessionsDir(),_0x2cc63e+_0x1a86ac(0x17c)),_0x3da283=getSessionsDir();createSecureDirectory(_0x3da283);const _0xf295b0=JSON['stringify'](_0x478b41);if(_0xf295b0['includes'](_0x1a86ac(0x17b))||_0xf295b0[_0x1a86ac(0x16d)]('apiKey')||_0xf295b0[_0x1a86ac(0x16d)](_0x1a86ac(0x185)))throw new Error(_0x1a86ac(0x174));let _0x29904e;const _0x2778d8=/^\d+$/[_0x1a86ac(0x182)](_0x2cc63e)?loadSessionContextByPID(parseInt(_0x2cc63e,0xa)):loadSessionContextByString(_0x2cc63e);_0x2778d8?_0x29904e={..._0x2778d8,..._0x478b41,'pid':_0x49f44f,'sessionId':_0x2cc63e!==_0x49f44f[_0x1a86ac(0x171)]()?_0x2cc63e:undefined,'updatedAt':new Date()['toISOString']()}:_0x29904e={'pid':_0x49f44f,'sessionId':_0x2cc63e!==_0x49f44f[_0x1a86ac(0x171)]()?_0x2cc63e:undefined,..._0x478b41,'createdAt':new Date()[_0x1a86ac(0x176)](),'updatedAt':new Date()['toISOString']()},a53_0x336535[_0x1a86ac(0x17e)](_0x4c800f,JSON[_0x1a86ac(0x17f)](_0x29904e,null,0x2));}export function clearSessionContext(_0x16164d){const _0xfe46fc=a53_0x46db,_0x4cc8ef=_0x16164d||getCurrentSessionPID()[_0xfe46fc(0x171)](),_0x51cf01=a53_0x5e3e6b['join'](getSessionsDir(),_0x4cc8ef+_0xfe46fc(0x17c));a53_0x336535[_0xfe46fc(0x16c)](_0x51cf01)&&a53_0x336535[_0xfe46fc(0x16b)](_0x51cf01);}export function clearSessionContextField(_0x41f4b3,_0x2f75c3){const _0xb838b9=a53_0x46db,_0x6d531f=_0x2f75c3||getCurrentSessionPID()['toString'](),_0x334ee2=a53_0x5e3e6b[_0xb838b9(0x168)](getSessionsDir(),_0x6d531f+_0xb838b9(0x17c));if(!a53_0x336535['existsSync'](_0x334ee2))return;try{const _0x84e3ad=a53_0x336535[_0xb838b9(0x165)](_0x334ee2,'utf-8'),_0x225034=JSON[_0xb838b9(0x17d)](_0x84e3ad);delete _0x225034[_0x41f4b3],a53_0x336535[_0xb838b9(0x17e)](_0x334ee2,JSON[_0xb838b9(0x17f)](_0x225034,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x2ddada=a53_0x46db,_0x2a5c79=getSessionsDir();if(!a53_0x336535['existsSync'](_0x2a5c79))return 0x0;let _0x4dd48d=0x0;const _0x5780f1=Date['now']();try{const _0x440e8d=a53_0x336535[_0x2ddada(0x18b)](_0x2a5c79);for(const _0x5ae051 of _0x440e8d){if(!_0x5ae051[_0x2ddada(0x189)](_0x2ddada(0x17c)))continue;const _0xe65915=a53_0x5e3e6b[_0x2ddada(0x168)](_0x2a5c79,_0x5ae051),_0x35b719=_0x5ae051[_0x2ddada(0x18e)](_0x2ddada(0x17c),''),_0x33809c=parseInt(_0x35b719,0xa),_0xf906d8=!isNaN(_0x33809c);if(_0xf906d8){if(!isProcessRunning(_0x33809c)){a53_0x336535[_0x2ddada(0x16b)](_0xe65915),_0x4dd48d++;continue;}}try{const _0x47ca5f=a53_0x336535[_0x2ddada(0x165)](_0xe65915,'utf-8'),_0x3fb42d=JSON[_0x2ddada(0x17d)](_0x47ca5f),_0x4d833b=new Date(_0x3fb42d[_0x2ddada(0x184)])[_0x2ddada(0x170)]();_0x5780f1-_0x4d833b>SESSION_EXPIRATION_MS&&(a53_0x336535[_0x2ddada(0x16b)](_0xe65915),_0x4dd48d++);}catch{a53_0x336535[_0x2ddada(0x16b)](_0xe65915),_0x4dd48d++;}}}catch{}return _0x4dd48d;}export function listActiveSessions(){const _0x599a23=a53_0x46db,_0x47241c=getSessionsDir();if(!a53_0x336535[_0x599a23(0x16c)](_0x47241c))return[];try{const _0x4bee95=a53_0x336535[_0x599a23(0x18b)](_0x47241c),_0x1f419b=[];for(const _0x5c22f5 of _0x4bee95){if(!_0x5c22f5['endsWith'](_0x599a23(0x17c)))continue;const _0x17329b=_0x5c22f5[_0x599a23(0x18e)](_0x599a23(0x17c),''),_0x1d3efe=parseInt(_0x17329b,0xa);!isNaN(_0x1d3efe)&&isProcessRunning(_0x1d3efe)&&_0x1f419b['push'](_0x1d3efe);}return _0x1f419b[_0x599a23(0x18c)]((_0x57c3cd,_0x43f72e)=>_0x57c3cd-_0x43f72e);}catch{return[];}}
@@ -1 +1 @@
1
- const a54_0x2fcbf4=a54_0x4b7c;(function(_0x4a599d,_0x47eba1){const _0x517be0=a54_0x4b7c,_0x481491=_0x4a599d();while(!![]){try{const _0x14116d=-parseInt(_0x517be0(0xe3))/0x1*(parseInt(_0x517be0(0xe9))/0x2)+parseInt(_0x517be0(0xe2))/0x3+-parseInt(_0x517be0(0xf1))/0x4*(parseInt(_0x517be0(0xf0))/0x5)+parseInt(_0x517be0(0xe4))/0x6+parseInt(_0x517be0(0xeb))/0x7+-parseInt(_0x517be0(0xe7))/0x8*(parseInt(_0x517be0(0xe8))/0x9)+-parseInt(_0x517be0(0xea))/0xa;if(_0x14116d===_0x47eba1)break;else _0x481491['push'](_0x481491['shift']());}catch(_0x583382){_0x481491['push'](_0x481491['shift']());}}}(a54_0x1622,0x2e34c));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0x2fcbf4(0xed),a54_0x2fcbf4(0xec));export function loadCachedUsers(_0x3c90ea){const _0x5edafd=a54_0x2fcbf4,_0x4f15fa=userCache['read'](_0x3c90ea);return _0x4f15fa?.[_0x5edafd(0xe6)]??null;}export function saveCachedUsers(_0x3ad4b8,_0x167f96){const _0x4376c1=a54_0x2fcbf4;userCache[_0x4376c1(0xee)](_0x3ad4b8,{'users':_0x167f96,'cachedAt':Date[_0x4376c1(0xe5)]()});}function a54_0x4b7c(_0x533e9d,_0x432567){_0x533e9d=_0x533e9d-0xe2;const _0x162229=a54_0x1622();let _0x4b7caf=_0x162229[_0x533e9d];return _0x4b7caf;}function a54_0x1622(){const _0x55ec11=['334910yoNICx','2228646DSSWqd','core/user-cache','users-{profile}.json','write','clear','11425gOOeXW','628impPHV','1006923vzoveS','41627Aiqhqe','1002402APAgsl','now','users','83880wYZMoX','27TlvVCv','10oXhNuv'];a54_0x1622=function(){return _0x55ec11;};return a54_0x1622();}export function clearUserCache(_0x253604){const _0x527bfe=a54_0x2fcbf4;userCache[_0x527bfe(0xef)](_0x253604);}
1
+ const a54_0xe62a1d=a54_0x3000;(function(_0x128124,_0x1ab8a3){const _0x24771a=a54_0x3000,_0x43a4b3=_0x128124();while(!![]){try{const _0x47cb88=-parseInt(_0x24771a(0x1c2))/0x1+-parseInt(_0x24771a(0x1bc))/0x2*(parseInt(_0x24771a(0x1bf))/0x3)+-parseInt(_0x24771a(0x1bd))/0x4+-parseInt(_0x24771a(0x1c1))/0x5*(-parseInt(_0x24771a(0x1c7))/0x6)+-parseInt(_0x24771a(0x1c5))/0x7+-parseInt(_0x24771a(0x1c0))/0x8+parseInt(_0x24771a(0x1c6))/0x9*(parseInt(_0x24771a(0x1bb))/0xa);if(_0x47cb88===_0x1ab8a3)break;else _0x43a4b3['push'](_0x43a4b3['shift']());}catch(_0xe637f0){_0x43a4b3['push'](_0x43a4b3['shift']());}}}(a54_0x3fc4,0x7ea00));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0xe62a1d(0x1be),'core/user-cache');function a54_0x3fc4(){const _0x191d8f=['5240256sdDrjA','18AyEZlZ','1206906lbNNMD','13718890QNitRa','145394zJOpZG','2560900VzTixf','users-{profile}.json','21HVHncw','6280808oyCluA','15GYfgHc','145762UwIGAJ','now','read'];a54_0x3fc4=function(){return _0x191d8f;};return a54_0x3fc4();}function a54_0x3000(_0x2148f6,_0x9250b){_0x2148f6=_0x2148f6-0x1bb;const _0x3fc4a5=a54_0x3fc4();let _0x3000c0=_0x3fc4a5[_0x2148f6];return _0x3000c0;}export function loadCachedUsers(_0x2982f1){const _0x4e6af=a54_0xe62a1d,_0x115b5c=userCache[_0x4e6af(0x1c4)](_0x2982f1);return _0x115b5c?.['users']??null;}export function saveCachedUsers(_0x523645,_0x2a2e0b){const _0x388d41=a54_0xe62a1d;userCache['write'](_0x523645,{'users':_0x2a2e0b,'cachedAt':Date[_0x388d41(0x1c3)]()});}export function clearUserCache(_0x316654){userCache['clear'](_0x316654);}
@@ -1 +1 @@
1
- (function(_0x5c67af,_0x241a15){const _0x437aba=a55_0x19b2,_0x524c67=_0x5c67af();while(!![]){try{const _0x185b28=-parseInt(_0x437aba(0x1b9))/0x1*(parseInt(_0x437aba(0x1bc))/0x2)+-parseInt(_0x437aba(0x1bd))/0x3*(parseInt(_0x437aba(0x1b0))/0x4)+parseInt(_0x437aba(0x1b5))/0x5+parseInt(_0x437aba(0x1b2))/0x6*(-parseInt(_0x437aba(0x1b1))/0x7)+parseInt(_0x437aba(0x1bb))/0x8*(-parseInt(_0x437aba(0x1b7))/0x9)+-parseInt(_0x437aba(0x1be))/0xa+parseInt(_0x437aba(0x1b3))/0xb*(parseInt(_0x437aba(0x1af))/0xc);if(_0x185b28===_0x241a15)break;else _0x524c67['push'](_0x524c67['shift']());}catch(_0x47366e){_0x524c67['push'](_0x524c67['shift']());}}}(a55_0x14cf,0x60c19));import{readFileSync}from'fs';function a55_0x14cf(){const _0x25c1bb=['117aERSWG','0.0.0','36599UeCbGg','../build-info.json','368848HNmDqn','16GRNFMF','52263hpFzaw','2002200zjsKdT','version','parse','92172YdKwYE','172wzPzlr','4921WWMvyL','186JvjCWu','3135uUUUzu','../../package.json','352570akPNYF','includes'];a55_0x14cf=function(){return _0x25c1bb;};return a55_0x14cf();}import{fileURLToPath}from'url';function a55_0x19b2(_0x3760ce,_0x2a21fa){_0x3760ce=_0x3760ce-0x1ae;const _0x14cf44=a55_0x14cf();let _0x19b2de=_0x14cf44[_0x3760ce];return _0x19b2de;}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0xf7a664=a55_0x19b2;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x478913=fileURLToPath(import.meta.url),_0x3ca287=dirname(_0x478913);try{const _0x1659e5=join(_0x3ca287,_0xf7a664(0x1ba));cachedBuildInfo=JSON['parse'](readFileSync(_0x1659e5,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x24828d=a55_0x19b2;if(cachedVersion!==null)return cachedVersion;const _0x402718=fileURLToPath(import.meta.url),_0x43c674=dirname(_0x402718),_0x11d43b=getBuildInfo();if(_0x11d43b['version'])return cachedVersion=_0x11d43b[_0x24828d(0x1bf)],cachedVersion;try{const _0x56271c=join(_0x43c674,_0x24828d(0x1b4)),_0x4e4192=JSON[_0x24828d(0x1ae)](readFileSync(_0x56271c,'utf-8'));cachedVersion=_0x4e4192[_0x24828d(0x1bf)];}catch{cachedVersion=_0x24828d(0x1b8);}return cachedVersion;}export function isDevVersion(){const _0x401b57=a55_0x19b2,_0x5be27e=getVersion();return _0x5be27e[_0x401b57(0x1b6)]('.dev')||_0x5be27e['includes']('-');}
1
+ (function(_0x23d0fc,_0x3e3bfc){const _0x9bf453=a55_0x2ffc,_0xf873d3=_0x23d0fc();while(!![]){try{const _0x2d9fbd=parseInt(_0x9bf453(0x78))/0x1*(parseInt(_0x9bf453(0x75))/0x2)+-parseInt(_0x9bf453(0x82))/0x3+parseInt(_0x9bf453(0x80))/0x4+-parseInt(_0x9bf453(0x7d))/0x5+-parseInt(_0x9bf453(0x7c))/0x6+-parseInt(_0x9bf453(0x84))/0x7+parseInt(_0x9bf453(0x81))/0x8;if(_0x2d9fbd===_0x3e3bfc)break;else _0xf873d3['push'](_0xf873d3['shift']());}catch(_0x4f1cb8){_0xf873d3['push'](_0xf873d3['shift']());}}}(a55_0x4093,0x57027));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x165c12=a55_0x2ffc;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x1551ac=fileURLToPath(import.meta.url),_0x309386=dirname(_0x1551ac);try{const _0x48be54=join(_0x309386,_0x165c12(0x77));cachedBuildInfo=JSON[_0x165c12(0x7b)](readFileSync(_0x48be54,_0x165c12(0x83)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x845859=a55_0x2ffc;if(cachedVersion!==null)return cachedVersion;const _0x247b63=fileURLToPath(import.meta.url),_0x542926=dirname(_0x247b63),_0x3b2172=getBuildInfo();if(_0x3b2172['version'])return cachedVersion=_0x3b2172[_0x845859(0x7e)],cachedVersion;try{const _0x93afb4=join(_0x542926,_0x845859(0x7f)),_0xb69eb1=JSON['parse'](readFileSync(_0x93afb4,_0x845859(0x83)));cachedVersion=_0xb69eb1[_0x845859(0x7e)];}catch{cachedVersion=_0x845859(0x7a);}return cachedVersion;}export function isDevVersion(){const _0x350d28=a55_0x2ffc,_0x1dd194=getVersion();return _0x1dd194[_0x350d28(0x79)](_0x350d28(0x76))||_0x1dd194[_0x350d28(0x79)]('-');}function a55_0x2ffc(_0x524d3e,_0x4e1dc7){_0x524d3e=_0x524d3e-0x75;const _0x409357=a55_0x4093();let _0x2ffc0a=_0x409357[_0x524d3e];return _0x2ffc0a;}function a55_0x4093(){const _0x259036=['6012NTwzqq','.dev','../build-info.json','71clpObY','includes','0.0.0','parse','2075400aXcZkr','2462990hqMIUY','version','../../package.json','1945068SgvKcO','10396128nvclol','1010688XDTbeu','utf-8','3271968PeKrJO'];a55_0x4093=function(){return _0x259036;};return a55_0x4093();}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x2bdf6e,_0x2baa3a){var _0x47243e=a56_0x22a5,_0x1ecaec=_0x2bdf6e();while(!![]){try{var _0x4ff146=parseInt(_0x47243e(0x10b))/0x1*(-parseInt(_0x47243e(0x104))/0x2)+parseInt(_0x47243e(0x105))/0x3+-parseInt(_0x47243e(0x106))/0x4+parseInt(_0x47243e(0x109))/0x5*(parseInt(_0x47243e(0x10d))/0x6)+-parseInt(_0x47243e(0x107))/0x7*(parseInt(_0x47243e(0x103))/0x8)+-parseInt(_0x47243e(0x10c))/0x9*(-parseInt(_0x47243e(0x102))/0xa)+parseInt(_0x47243e(0x108))/0xb*(parseInt(_0x47243e(0x10a))/0xc);if(_0x4ff146===_0x2baa3a)break;else _0x1ecaec['push'](_0x1ecaec['shift']());}catch(_0x58612a){_0x1ecaec['push'](_0x1ecaec['shift']());}}}(a56_0x8cfd,0x7e46c));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';function a56_0x22a5(_0x3bebd5,_0x1a9ff8){_0x3bebd5=_0x3bebd5-0x102;var _0x8cfd18=a56_0x8cfd();var _0x22a53a=_0x8cfd18[_0x3bebd5];return _0x22a53a;}export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';function a56_0x8cfd(){var _0x214773=['15526968erVMrt','5ZJxosj','126awVnvf','209124NqyRum','462420QQduQf','8YgpChN','257338iVKWVC','223455WVruRb','3157732hqJzAr','4608093evICdd','11bidFYT','85fZkbWv'];a56_0x8cfd=function(){return _0x214773;};return a56_0x8cfd();}export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x2fe112,_0x26165a){var _0x1ac939=a56_0x4d52,_0x58a7d4=_0x2fe112();while(!![]){try{var _0x4c44e7=-parseInt(_0x1ac939(0x140))/0x1*(-parseInt(_0x1ac939(0x141))/0x2)+parseInt(_0x1ac939(0x139))/0x3*(parseInt(_0x1ac939(0x13e))/0x4)+-parseInt(_0x1ac939(0x13d))/0x5+parseInt(_0x1ac939(0x13b))/0x6*(parseInt(_0x1ac939(0x13f))/0x7)+parseInt(_0x1ac939(0x13c))/0x8*(parseInt(_0x1ac939(0x144))/0x9)+parseInt(_0x1ac939(0x13a))/0xa*(-parseInt(_0x1ac939(0x138))/0xb)+parseInt(_0x1ac939(0x143))/0xc*(-parseInt(_0x1ac939(0x142))/0xd);if(_0x4c44e7===_0x26165a)break;else _0x58a7d4['push'](_0x58a7d4['shift']());}catch(_0x2a661e){_0x58a7d4['push'](_0x58a7d4['shift']());}}}(a56_0x1a0e,0xe7616));function a56_0x1a0e(){var _0xdbab46=['1157UpJidI','86748sXZRme','9BYsLhc','10866614wKZAiU','939LaHDAb','10XXZAGK','204KqChEn','8598728vTRfbO','982085YSfKjj','4388aeioWN','177695BZJSrM','19PjcrdO','52012zlaOBm'];a56_0x1a0e=function(){return _0xdbab46;};return a56_0x1a0e();}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';export*from'./sdk/types/trino.js';function a56_0x4d52(_0x3cbf94,_0x3c3eec){_0x3cbf94=_0x3cbf94-0x138;var _0x1a0e7c=a56_0x1a0e();var _0x4d526c=_0x1a0e7c[_0x3cbf94];return _0x4d526c;}export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
@@ -1 +1 @@
1
- (function(_0x46dcc5,_0x43d200){const _0x1044af=a57_0x351f,_0x5dfb1e=_0x46dcc5();while(!![]){try{const _0x3f91bf=-parseInt(_0x1044af(0x9c))/0x1*(parseInt(_0x1044af(0x98))/0x2)+-parseInt(_0x1044af(0x91))/0x3*(-parseInt(_0x1044af(0xa3))/0x4)+-parseInt(_0x1044af(0xae))/0x5*(-parseInt(_0x1044af(0xa5))/0x6)+-parseInt(_0x1044af(0x8c))/0x7*(-parseInt(_0x1044af(0x9f))/0x8)+-parseInt(_0x1044af(0xb1))/0x9+parseInt(_0x1044af(0xab))/0xa+-parseInt(_0x1044af(0xa0))/0xb;if(_0x3f91bf===_0x43d200)break;else _0x5dfb1e['push'](_0x5dfb1e['shift']());}catch(_0x4d260f){_0x5dfb1e['push'](_0x5dfb1e['shift']());}}}(a57_0x4cf4,0x4a6da));function a57_0x351f(_0x232ad3,_0x303244){_0x232ad3=_0x232ad3-0x87;const _0x4cf443=a57_0x4cf4();let _0x351fbc=_0x4cf443[_0x232ad3];return _0x351fbc;}function a57_0x4cf4(){const _0x5dae50=['70PDTruU','Command\x20failed','category','197280OeCRPf','env','text','1.0.0','stdin','\x0a\x0a---\x0a\x0a','**\x20(','No\x20commands\x20found\x20matching\x20\x22','1695638PukyPi','describe','optional','output','string','511509oSvMls','examples','connect','CDP','description','map','tdx_run','5606HAgDeS','Data','Utilities','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.','74JypyLO','tdx_search','Execute\x20any\x20tdx\x20CLI\x20command.\x20Returns\x20JSON\x20output.\x0a\x0aExamples:\x0a-\x20List\x20databases:\x20{\x22args\x22:\x20[\x22databases\x22]}\x0a-\x20Run\x20SQL\x20query:\x20{\x22args\x22:\x20[\x22query\x22,\x20\x22SELECT\x20*\x20FROM\x20mydb.users\x20LIMIT\x2010\x22]}\x0a-\x20List\x20segments:\x20{\x22args\x22:\x20[\x22segments\x22,\x20\x22--recursive\x22]}\x0a-\x20Show\x20job\x20details:\x20{\x22args\x22:\x20[\x22job\x22,\x20\x22show\x22,\x20\x2212345\x22]}\x0a-\x20List\x20tables:\x20{\x22args\x22:\x20[\x22tables\x22,\x20\x22mydb.*\x22]}\x0a\x0aNote:\x20Some\x20commands\x20(auth,\x20profile\x20management,\x20mcp)\x20are\x20blocked\x20for\x20security.','16Hrrtvo','13034505EoZbuS','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','registerTool','12vTMjBG','once','245382ulLEXX','Optional\x20filter\x20by\x20category','error','length','close','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','1506200muSKQa','Context','success'];a57_0x4cf4=function(){return _0x5dae50;};return a57_0x4cf4();}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(_0x1e12a7={}){const _0x537b03=a57_0x351f,_0x426f84=new McpServer({'name':'tdx','version':_0x537b03(0x87)});return _0x426f84[_0x537b03(0xa2)](_0x537b03(0x97),{'description':_0x537b03(0x9e),'inputSchema':{'args':z['array'](z['string']())[_0x537b03(0x8d)](_0x537b03(0xa1))}},async({args:_0x8e7db3})=>{const _0x35c975=_0x537b03,_0x4270a5=await executeTdxRun({'args':_0x8e7db3},_0x1e12a7[_0x35c975(0xb2)]||{});return _0x4270a5[_0x35c975(0xad)]?{'content':[{'type':_0x35c975(0xb3),'text':_0x4270a5[_0x35c975(0x8f)]||'Command\x20completed\x20successfully'}]}:{'content':[{'type':'text','text':_0x4270a5[_0x35c975(0xa7)]||_0x4270a5['output']||_0x35c975(0xaf)}],'isError':!![]};}),_0x426f84[_0x537b03(0xa2)](_0x537b03(0x9d),{'description':_0x537b03(0x9b),'inputSchema':{'query':z[_0x537b03(0x90)]()[_0x537b03(0x8d)](_0x537b03(0xaa)),'category':z['enum']([_0x537b03(0x99),_0x537b03(0x94),'AI',_0x537b03(0xac),_0x537b03(0x9a)])[_0x537b03(0x8e)]()['describe'](_0x537b03(0xa6))}},async({query:_0x196f37,category:_0x4e80c4})=>{const _0xa85372=_0x537b03,_0x1e9466=searchCommands({'query':_0x196f37,'category':_0x4e80c4});if(_0x1e9466[_0xa85372(0xa8)]===0x0)return{'content':[{'type':_0xa85372(0xb3),'text':_0xa85372(0x8b)+_0x196f37+'\x22'}]};const _0x19a6c0=_0x1e9466['map'](_0x427762=>{const _0x1b4314=_0xa85372,_0x2fcf36=_0x427762[_0x1b4314(0x92)][_0x1b4314(0x96)](_0x564cb0=>'\x20\x20'+_0x564cb0)['join']('\x0a');return'**'+_0x427762['name']+_0x1b4314(0x8a)+_0x427762[_0x1b4314(0xb0)]+')\x0a'+_0x427762[_0x1b4314(0x95)]+'\x0a\x0aExamples:\x0a'+_0x2fcf36;})['join'](_0xa85372(0x89));return{'content':[{'type':_0xa85372(0xb3),'text':_0x19a6c0}]};}),_0x426f84;}export async function startMCPServer(_0x16e6e1={}){const _0x541b8b=a57_0x351f,_0x2aa871=createMCPServer(_0x16e6e1),_0x1aa0c1=new StdioServerTransport();return await _0x2aa871[_0x541b8b(0x93)](_0x1aa0c1),new Promise(_0x43901a=>{const _0xcdb569=_0x541b8b;let _0x50d83b=![];const _0x322965=async()=>{const _0xae7a16=a57_0x351f;if(_0x50d83b)return;_0x50d83b=!![],await _0x2aa871[_0xae7a16(0xa9)](),_0x43901a();};process[_0xcdb569(0xa4)]('SIGINT',_0x322965),process[_0xcdb569(0xa4)]('SIGTERM',_0x322965),process[_0xcdb569(0x88)]['once'](_0xcdb569(0xa9),_0x322965);});}
1
+ (function(_0x429172,_0x2eabf9){const _0x592ab3=a57_0x3d15,_0x49b2b3=_0x429172();while(!![]){try{const _0x286b2a=-parseInt(_0x592ab3(0x19e))/0x1*(-parseInt(_0x592ab3(0x1b9))/0x2)+-parseInt(_0x592ab3(0x1a7))/0x3*(-parseInt(_0x592ab3(0x19a))/0x4)+parseInt(_0x592ab3(0x18f))/0x5*(parseInt(_0x592ab3(0x1a1))/0x6)+parseInt(_0x592ab3(0x1b8))/0x7+parseInt(_0x592ab3(0x195))/0x8*(parseInt(_0x592ab3(0x1aa))/0x9)+parseInt(_0x592ab3(0x1b3))/0xa+parseInt(_0x592ab3(0x1b5))/0xb*(-parseInt(_0x592ab3(0x1b2))/0xc);if(_0x286b2a===_0x2eabf9)break;else _0x49b2b3['push'](_0x49b2b3['shift']());}catch(_0x3adf29){_0x49b2b3['push'](_0x49b2b3['shift']());}}}(a57_0x3ca0,0x37415));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(_0x929fca={}){const _0x36b7cb=a57_0x3d15,_0x52e8ff=new McpServer({'name':_0x36b7cb(0x194),'version':_0x36b7cb(0x1af)});return _0x52e8ff[_0x36b7cb(0x19b)]('tdx_run',{'description':_0x36b7cb(0x1a0),'inputSchema':{'args':z[_0x36b7cb(0x193)](z[_0x36b7cb(0x1bb)]())[_0x36b7cb(0x1b6)]('Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])')}},async({args:_0x575e74})=>{const _0x1b58f4=_0x36b7cb,_0x548ed3=await executeTdxRun({'args':_0x575e74},_0x929fca[_0x1b58f4(0x19d)]||{});return _0x548ed3[_0x1b58f4(0x198)]?{'content':[{'type':_0x1b58f4(0x1a5),'text':_0x548ed3[_0x1b58f4(0x1ba)]||'Command\x20completed\x20successfully'}]}:{'content':[{'type':_0x1b58f4(0x1a5),'text':_0x548ed3[_0x1b58f4(0x19f)]||_0x548ed3[_0x1b58f4(0x1ba)]||_0x1b58f4(0x1ad)}],'isError':!![]};}),_0x52e8ff['registerTool']('tdx_search',{'description':'Search\x20for\x20relevant\x20tdx\x20commands\x20based\x20on\x20what\x20you\x20want\x20to\x20do.\x0a\x0aExamples:\x0a-\x20{\x22query\x22:\x20\x22how\x20to\x20run\x20SQL\x20queries\x22}\x0a-\x20{\x22query\x22:\x20\x22list\x20databases\x20and\x20tables\x22}\x0a-\x20{\x22query\x22:\x20\x22manage\x20customer\x20segments\x22,\x20\x22category\x22:\x20\x22CDP\x22}\x0a-\x20{\x22query\x22:\x20\x22workflow\x20logs\x22}\x0a\x0aCategories:\x20Data,\x20CDP,\x20AI,\x20Context,\x20Utilities\x0a\x0aReturns\x20matching\x20commands\x20with\x20descriptions\x20and\x20example\x20usage.','inputSchema':{'query':z['string']()[_0x36b7cb(0x1b6)](_0x36b7cb(0x1a3)),'category':z[_0x36b7cb(0x1a6)](['Data',_0x36b7cb(0x191),'AI',_0x36b7cb(0x190),_0x36b7cb(0x19c)])['optional']()[_0x36b7cb(0x1b6)](_0x36b7cb(0x192))}},async({query:_0x26395a,category:_0x2fa253})=>{const _0x462988=_0x36b7cb,_0x3bf7fd=searchCommands({'query':_0x26395a,'category':_0x2fa253});if(_0x3bf7fd[_0x462988(0x1ab)]===0x0)return{'content':[{'type':_0x462988(0x1a5),'text':_0x462988(0x1a8)+_0x26395a+'\x22'}]};const _0x57cb93=_0x3bf7fd['map'](_0xb62aff=>{const _0x2d2c57=_0x462988,_0x4b2ae7=_0xb62aff['examples'][_0x2d2c57(0x1ac)](_0x3e70ee=>'\x20\x20'+_0x3e70ee)[_0x2d2c57(0x1a9)]('\x0a');return'**'+_0xb62aff[_0x2d2c57(0x1a2)]+_0x2d2c57(0x1b0)+_0xb62aff['category']+')\x0a'+_0xb62aff[_0x2d2c57(0x197)]+_0x2d2c57(0x1ae)+_0x4b2ae7;})['join'](_0x462988(0x199));return{'content':[{'type':_0x462988(0x1a5),'text':_0x57cb93}]};}),_0x52e8ff;}export async function startMCPServer(_0x2207bf={}){const _0x37102d=a57_0x3d15,_0x1526b2=createMCPServer(_0x2207bf),_0xd8f911=new StdioServerTransport();return await _0x1526b2[_0x37102d(0x1b4)](_0xd8f911),new Promise(_0xccd73a=>{const _0x3df3dd=_0x37102d;let _0x42e0bd=![];const _0x31b098=async()=>{const _0x51667e=a57_0x3d15;if(_0x42e0bd)return;_0x42e0bd=!![],await _0x1526b2[_0x51667e(0x196)](),_0xccd73a();};process[_0x3df3dd(0x1b7)](_0x3df3dd(0x1a4),_0x31b098),process[_0x3df3dd(0x1b7)]('SIGTERM',_0x31b098),process[_0x3df3dd(0x1b1)]['once'](_0x3df3dd(0x196),_0x31b098);});}function a57_0x3d15(_0x13cbf6,_0x14ccba){_0x13cbf6=_0x13cbf6-0x18f;const _0x3ca0d5=a57_0x3ca0();let _0x3d1594=_0x3ca0d5[_0x13cbf6];return _0x3d1594;}function a57_0x3ca0(){const _0x565e89=['11780153wCwnHV','describe','once','2043188CoNjzQ','487856LjyfkG','output','string','5vWoMhu','Context','CDP','Optional\x20filter\x20by\x20category','array','tdx','144136NEDieI','close','description','success','\x0a\x0a---\x0a\x0a','180oBnwaS','registerTool','Utilities','env','1OdQegP','error','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.','1493418hXDxmI','name','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','SIGINT','text','enum','8022LfjqmF','No\x20commands\x20found\x20matching\x20\x22','join','63faElfK','length','map','Command\x20failed','\x0a\x0aExamples:\x0a','1.0.0','**\x20(','stdin','12TVVgzE','2660840yhUJQP','connect'];a57_0x3ca0=function(){return _0x565e89;};return a57_0x3ca0();}
@@ -1 +1 @@
1
- (function(_0x5f0137,_0x354b18){var _0x57ca82=a58_0x4407,_0x4474d1=_0x5f0137();while(!![]){try{var _0x3e435a=-parseInt(_0x57ca82(0x1b1))/0x1*(-parseInt(_0x57ca82(0x1b6))/0x2)+-parseInt(_0x57ca82(0x1af))/0x3+-parseInt(_0x57ca82(0x1b0))/0x4*(parseInt(_0x57ca82(0x1b4))/0x5)+parseInt(_0x57ca82(0x1b3))/0x6+parseInt(_0x57ca82(0x1b5))/0x7*(-parseInt(_0x57ca82(0x1b2))/0x8)+-parseInt(_0x57ca82(0x1b7))/0x9+parseInt(_0x57ca82(0x1ae))/0xa;if(_0x3e435a===_0x354b18)break;else _0x4474d1['push'](_0x4474d1['shift']());}catch(_0x20445f){_0x4474d1['push'](_0x4474d1['shift']());}}}(a58_0x474e,0x2d205));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';function a58_0x4407(_0x131379,_0xbd1c37){_0x131379=_0x131379-0x1ae;var _0x474eb2=a58_0x474e();var _0x440730=_0x474eb2[_0x131379];return _0x440730;}function a58_0x474e(){var _0x47ad8b=['10690Hdiyyx','3934KfoWif','627164qdAfCZ','1383669iHQACi','4986000fGIjGm','1021944GHZEdN','176kolpsM','1OdxwsI','1816ozeCoa','532140KapPWW'];a58_0x474e=function(){return _0x47ad8b;};return a58_0x474e();}
1
+ (function(_0x273f71,_0x134c29){var _0x2b4cf2=a58_0x1e66,_0x45122c=_0x273f71();while(!![]){try{var _0x3913dd=parseInt(_0x2b4cf2(0x194))/0x1+parseInt(_0x2b4cf2(0x190))/0x2*(-parseInt(_0x2b4cf2(0x197))/0x3)+-parseInt(_0x2b4cf2(0x18f))/0x4*(parseInt(_0x2b4cf2(0x193))/0x5)+-parseInt(_0x2b4cf2(0x191))/0x6+-parseInt(_0x2b4cf2(0x192))/0x7+parseInt(_0x2b4cf2(0x195))/0x8+parseInt(_0x2b4cf2(0x196))/0x9;if(_0x3913dd===_0x134c29)break;else _0x45122c['push'](_0x45122c['shift']());}catch(_0x3816fa){_0x45122c['push'](_0x45122c['shift']());}}}(a58_0x1e4b,0x5e724));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';function a58_0x1e66(_0xecce5,_0x59279e){_0xecce5=_0xecce5-0x18f;var _0x1e4b48=a58_0x1e4b();var _0x1e664d=_0x1e4b48[_0xecce5];return _0x1e664d;}export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';function a58_0x1e4b(){var _0x4bc474=['407050QRDdnv','3035chHJUL','356081PkvHpc','966776nrmLZq','4539393jYHEyM','108543KcuPAa','248TxnTru','26aCuzjP','169896riAFFp'];a58_0x1e4b=function(){return _0x4bc474;};return a58_0x1e4b();}
@@ -1 +1 @@
1
- function a59_0x46bc(_0x524332,_0x4e6815){_0x524332=_0x524332-0x18b;const _0x4859ee=a59_0x4859();let _0x46bcc2=_0x4859ee[_0x524332];return _0x46bcc2;}const a59_0x514f37=a59_0x46bc;(function(_0x23a65c,_0x3f7b8d){const _0x1752e9=a59_0x46bc,_0x17b62c=_0x23a65c();while(!![]){try{const _0x3b3647=-parseInt(_0x1752e9(0x194))/0x1+parseInt(_0x1752e9(0x18f))/0x2+-parseInt(_0x1752e9(0x18d))/0x3*(-parseInt(_0x1752e9(0x1a0))/0x4)+parseInt(_0x1752e9(0x1a4))/0x5*(-parseInt(_0x1752e9(0x1a5))/0x6)+-parseInt(_0x1752e9(0x19d))/0x7+-parseInt(_0x1752e9(0x19c))/0x8+-parseInt(_0x1752e9(0x1ab))/0x9*(-parseInt(_0x1752e9(0x191))/0xa);if(_0x3b3647===_0x3f7b8d)break;else _0x17b62c['push'](_0x17b62c['shift']());}catch(_0x324741){_0x17b62c['push'](_0x17b62c['shift']());}}}(a59_0x4859,0x289fd));import{spawn}from'child_process';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a59_0x514f37(0x1aa)]({'args':z[a59_0x514f37(0x198)](z[a59_0x514f37(0x19a)]())[a59_0x514f37(0x1a6)](a59_0x514f37(0x1a8))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;export async function executeTdxRun(_0x2164e4,_0x1f77de){const _0x3942d4=a59_0x514f37,{args:_0x7a84c7}=_0x2164e4;if(isBlockedCommand(_0x7a84c7)){const _0x1a4e32=getBlockedReason(_0x7a84c7);return{'success':![],'output':'','error':_0x1a4e32||_0x3942d4(0x196),'exitCode':0x1};}const _0x357d0e=[_0x3942d4(0x192),'--no-color',..._0x7a84c7];return new Promise(_0x50fac5=>{const _0x1406d3=_0x3942d4,_0x420f71=spawn(_0x1406d3(0x18b),_0x357d0e,{'env':{...process[_0x1406d3(0x18e)],..._0x1f77de,'CI':_0x1406d3(0x1a9)},'stdio':[_0x1406d3(0x197),_0x1406d3(0x1a2),'pipe']});let _0x1a0b0d='',_0x58aecd='',_0x2cd39a=![];const _0x2e7884=setTimeout(()=>{const _0x2a7bda=_0x1406d3;_0x2cd39a=!![],_0x420f71[_0x2a7bda(0x1a1)](_0x2a7bda(0x18c));},DEFAULT_TIMEOUT_MS);_0x420f71[_0x1406d3(0x19b)]['on'](_0x1406d3(0x19f),_0x49e00c=>{const _0xb59a98=_0x1406d3;_0x1a0b0d+=_0x49e00c[_0xb59a98(0x199)]();}),_0x420f71[_0x1406d3(0x1a3)]['on'](_0x1406d3(0x19f),_0x3aba07=>{_0x58aecd+=_0x3aba07['toString']();}),_0x420f71['on'](_0x1406d3(0x1a7),_0x5e2685=>{const _0x557852=_0x1406d3;clearTimeout(_0x2e7884),_0x50fac5({'success':![],'output':'','error':_0x557852(0x190)+_0x5e2685[_0x557852(0x195)],'exitCode':0x1});}),_0x420f71['on'](_0x1406d3(0x19e),_0x399129=>{const _0x3197f8=_0x1406d3;clearTimeout(_0x2e7884);if(_0x2cd39a){_0x50fac5({'success':![],'output':formatOutput(_0x1a0b0d),'error':_0x3197f8(0x193),'exitCode':0x7c});return;}const _0x4f116f=_0x399129??0x1,_0x223e81=_0x4f116f===0x0,_0x348a6d=formatOutput(_0x1a0b0d||_0x58aecd),_0x4613d8=!_0x223e81&&_0x58aecd?formatOutput(_0x58aecd):undefined;_0x50fac5({'success':_0x223e81,'output':_0x348a6d,'error':_0x4613d8,'exitCode':_0x4f116f});});});}function a59_0x4859(){const _0x28528f=['328153bvUwtF','close','data','4Xkmwhk','kill','pipe','stderr','154685tAADxF','54GFPwCw','describe','error','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','true','object','9QmzbDF','tdx','SIGTERM','860673MAgwbR','env','597380ioQOPZ','Failed\x20to\x20spawn\x20tdx:\x20','1986060RCyuuu','--json','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','32027fcmKXF','message','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','ignore','array','toString','string','stdout','2083608MkPRBB'];a59_0x4859=function(){return _0x28528f;};return a59_0x4859();}
1
+ const a59_0x5a0d3f=a59_0x45b7;function a59_0x45b7(_0x22d94e,_0x30e250){_0x22d94e=_0x22d94e-0x87;const _0xbb234f=a59_0xbb23();let _0x45b748=_0xbb234f[_0x22d94e];return _0x45b748;}(function(_0x19a546,_0x1a016d){const _0x160ff5=a59_0x45b7,_0x334691=_0x19a546();while(!![]){try{const _0x23079e=parseInt(_0x160ff5(0x90))/0x1*(parseInt(_0x160ff5(0xa5))/0x2)+-parseInt(_0x160ff5(0x95))/0x3*(-parseInt(_0x160ff5(0x8b))/0x4)+-parseInt(_0x160ff5(0x99))/0x5*(-parseInt(_0x160ff5(0x8a))/0x6)+-parseInt(_0x160ff5(0xa1))/0x7+-parseInt(_0x160ff5(0x9e))/0x8+-parseInt(_0x160ff5(0x93))/0x9+parseInt(_0x160ff5(0x9a))/0xa*(parseInt(_0x160ff5(0x94))/0xb);if(_0x23079e===_0x1a016d)break;else _0x334691['push'](_0x334691['shift']());}catch(_0x1f1657){_0x334691['push'](_0x334691['shift']());}}}(a59_0xbb23,0xbd677));function a59_0xbb23(){const _0x4e353d=['This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','data','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','1624165SvQxSg','80jLrYsF','env','object','--json','11517312bDiNQS','--no-color','ignore','6340670QtDZRX','message','stdout','stderr','2SEiPTg','kill','pipe','describe','6VZrvia','4MhAWQr','SIGTERM','true','array','string','720684ibiFCp','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','toString','11984193sDZLZu','3515160CLDzsB','2552559EHIGto'];a59_0xbb23=function(){return _0x4e353d;};return a59_0xbb23();}import{spawn}from'child_process';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a59_0x5a0d3f(0x9c)]({'args':z[a59_0x5a0d3f(0x8e)](z[a59_0x5a0d3f(0x8f)]())[a59_0x5a0d3f(0x89)](a59_0x5a0d3f(0x98))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;export async function executeTdxRun(_0x966234,_0x2bc4d6){const _0x174257=a59_0x5a0d3f,{args:_0x312f53}=_0x966234;if(isBlockedCommand(_0x312f53)){const _0xcc914=getBlockedReason(_0x312f53);return{'success':![],'output':'','error':_0xcc914||_0x174257(0x96),'exitCode':0x1};}const _0x5be28a=[_0x174257(0x9d),_0x174257(0x9f),..._0x312f53];return new Promise(_0x3bd535=>{const _0x2d94d4=_0x174257,_0x3d59df=spawn('tdx',_0x5be28a,{'env':{...process[_0x2d94d4(0x9b)],..._0x2bc4d6,'CI':_0x2d94d4(0x8d)},'stdio':[_0x2d94d4(0xa0),'pipe',_0x2d94d4(0x88)]});let _0x360556='',_0x4f6d89='',_0x2bf5a7=![];const _0x339763=setTimeout(()=>{const _0x1cf80a=_0x2d94d4;_0x2bf5a7=!![],_0x3d59df[_0x1cf80a(0x87)](_0x1cf80a(0x8c));},DEFAULT_TIMEOUT_MS);_0x3d59df[_0x2d94d4(0xa3)]['on'](_0x2d94d4(0x97),_0x4fa574=>{const _0x150029=_0x2d94d4;_0x360556+=_0x4fa574[_0x150029(0x92)]();}),_0x3d59df[_0x2d94d4(0xa4)]['on'](_0x2d94d4(0x97),_0x45c795=>{const _0xe00ead=_0x2d94d4;_0x4f6d89+=_0x45c795[_0xe00ead(0x92)]();}),_0x3d59df['on']('error',_0x1054f3=>{const _0x4850bf=_0x2d94d4;clearTimeout(_0x339763),_0x3bd535({'success':![],'output':'','error':'Failed\x20to\x20spawn\x20tdx:\x20'+_0x1054f3[_0x4850bf(0xa2)],'exitCode':0x1});}),_0x3d59df['on']('close',_0x459ca4=>{const _0xb10669=_0x2d94d4;clearTimeout(_0x339763);if(_0x2bf5a7){_0x3bd535({'success':![],'output':formatOutput(_0x360556),'error':_0xb10669(0x91),'exitCode':0x7c});return;}const _0x474f39=_0x459ca4??0x1,_0x4ec36d=_0x474f39===0x0,_0x188fcd=formatOutput(_0x360556||_0x4f6d89),_0x343565=!_0x4ec36d&&_0x4f6d89?formatOutput(_0x4f6d89):undefined;_0x3bd535({'success':_0x4ec36d,'output':_0x188fcd,'error':_0x343565,'exitCode':_0x474f39});});});}