@treasuredata/tdx 0.16.0 → 0.16.2

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 (159) 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/tables.js +1 -1
  40. package/dist/commands/unset-command.js +1 -1
  41. package/dist/commands/use-command.js +1 -1
  42. package/dist/commands/user-command.js +1 -1
  43. package/dist/commands/workflow-command.js +1 -1
  44. package/dist/core/auth.js +1 -1
  45. package/dist/core/command-output.js +1 -1
  46. package/dist/core/config.js +1 -1
  47. package/dist/core/connection-cache.js +1 -1
  48. package/dist/core/constants.js +1 -1
  49. package/dist/core/credential-cache.js +1 -1
  50. package/dist/core/global-context.js +1 -1
  51. package/dist/core/keychain.js +1 -1
  52. package/dist/core/profile.js +1 -1
  53. package/dist/core/project-config.js +1 -1
  54. package/dist/core/session.js +1 -1
  55. package/dist/core/user-cache.js +1 -1
  56. package/dist/core/version.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/mcp/server.js +1 -1
  59. package/dist/mcp/tools/index.js +1 -1
  60. package/dist/mcp/tools/tdx-run.js +1 -1
  61. package/dist/mcp/tools/tdx-search.js +1 -1
  62. package/dist/mcp/utils.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/server.js +1 -1
  69. package/dist/proxy/session-cache.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/api.js +1 -1
  80. package/dist/sdk/claude-agent/claude-agent-client.d.ts +19 -1
  81. package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
  82. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  83. package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
  84. package/dist/sdk/claude-agent/environment.js +1 -1
  85. package/dist/sdk/claude-agent/index.js +1 -1
  86. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  87. package/dist/sdk/claude-agent/types.d.ts +26 -0
  88. package/dist/sdk/claude-agent/types.d.ts.map +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/endpoints.js +1 -1
  91. package/dist/sdk/client/engage-api-client.js +1 -1
  92. package/dist/sdk/client/http-client.js +1 -1
  93. package/dist/sdk/client/llm-api-client.js +1 -1
  94. package/dist/sdk/client/rate-limiter.js +1 -1
  95. package/dist/sdk/client/td-api-client.js +1 -1
  96. package/dist/sdk/client/trino-api-client.js +1 -1
  97. package/dist/sdk/client/workflow-client.js +1 -1
  98. package/dist/sdk/connection-validator.js +1 -1
  99. package/dist/sdk/connection.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.js +1 -1
  109. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  110. package/dist/sdk/llm/model-aliases.js +1 -1
  111. package/dist/sdk/llm/model-factors.js +1 -1
  112. package/dist/sdk/query/index.js +1 -1
  113. package/dist/sdk/query/sql-parser.js +1 -1
  114. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  115. package/dist/sdk/segment/fields-display.js +1 -1
  116. package/dist/sdk/segment/file-discovery.js +1 -1
  117. package/dist/sdk/segment/journey-utils.js +1 -1
  118. package/dist/sdk/segment/journey-yaml.js +1 -1
  119. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  120. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  121. package/dist/sdk/segment/pull-workflow.js +1 -1
  122. package/dist/sdk/segment/push-workflow.js +1 -1
  123. package/dist/sdk/segment/resolution-context.js +1 -1
  124. package/dist/sdk/segment/segment-path-parser.js +1 -1
  125. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  126. package/dist/sdk/segment/target-resolution.js +1 -1
  127. package/dist/sdk/segment/tdx-config.js +1 -1
  128. package/dist/sdk/segment/validate-files.js +1 -1
  129. package/dist/sdk/segment/yaml-validator.js +1 -1
  130. package/dist/sdk/segment.js +1 -1
  131. package/dist/sdk/types/index.js +1 -1
  132. package/dist/sdk/types/progress.js +1 -1
  133. package/dist/sdk/user.js +1 -1
  134. package/dist/sdk/util/format-detector.js +1 -1
  135. package/dist/sdk/util/formatters.js +1 -1
  136. package/dist/sdk/util/index.js +1 -1
  137. package/dist/sdk/util/tree-formatter.js +1 -1
  138. package/dist/sdk/workflow/clone-workflow.js +1 -1
  139. package/dist/sdk/workflow/index.js +1 -1
  140. package/dist/sdk/workflow/pull-workflow.js +1 -1
  141. package/dist/sdk/workflow/push-workflow.js +1 -1
  142. package/dist/sdk/workflow/tdx-config.js +1 -1
  143. package/dist/sdk/workflow/workflow-utils.js +1 -1
  144. package/dist/utils/async.js +1 -1
  145. package/dist/utils/colors.js +1 -1
  146. package/dist/utils/diff.js +1 -1
  147. package/dist/utils/file-permissions.js +1 -1
  148. package/dist/utils/json-loader.js +1 -1
  149. package/dist/utils/option-validation.js +1 -1
  150. package/dist/utils/port.js +1 -1
  151. package/dist/utils/process.js +1 -1
  152. package/dist/utils/prompt.js +1 -1
  153. package/dist/utils/spinner.js +1 -1
  154. package/dist/utils/sse-parser.js +1 -1
  155. package/dist/utils/string-utils.js +1 -1
  156. package/dist/utils/table-ref-parser.js +1 -1
  157. package/dist/utils/tdx-logger.js +1 -1
  158. package/dist/utils/version-check.js +1 -1
  159. package/package.json +1 -1
@@ -1 +1 @@
1
- function a44_0xc35d(_0x8b1ea1,_0x2dfc0e){_0x8b1ea1=_0x8b1ea1-0x131;const _0x13e8bf=a44_0x13e8();let _0xc35d56=_0x13e8bf[_0x8b1ea1];return _0xc35d56;}(function(_0x3f3962,_0x5e5dc5){const _0x248839=a44_0xc35d,_0x386972=_0x3f3962();while(!![]){try{const _0x27fa53=parseInt(_0x248839(0x143))/0x1+parseInt(_0x248839(0x14f))/0x2*(parseInt(_0x248839(0x156))/0x3)+parseInt(_0x248839(0x17e))/0x4+-parseInt(_0x248839(0x17a))/0x5+-parseInt(_0x248839(0x16b))/0x6*(-parseInt(_0x248839(0x15e))/0x7)+parseInt(_0x248839(0x14e))/0x8*(parseInt(_0x248839(0x176))/0x9)+-parseInt(_0x248839(0x13d))/0xa;if(_0x27fa53===_0x5e5dc5)break;else _0x386972['push'](_0x386972['shift']());}catch(_0x559af3){_0x386972['push'](_0x386972['shift']());}}}(a44_0x13e8,0xd535d));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a44_0x4172b6 from'node:fs';import*as a44_0xbc509c 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 a44_0x4b0e26 from'chalk';export function getConfigDir(){const _0x2c1e4b=a44_0xc35d;return process['env'][_0x2c1e4b(0x161)]||join(homedir(),_0x2c1e4b(0x142),'tdx');}export function getConfigFile(){const _0xae5c0f=a44_0xc35d;return join(getConfigDir(),_0xae5c0f(0x173));}export function getConfigFilePath(_0x2037db){const _0x4b5290=a44_0xc35d,_0x1aca81=getConfigDir();return _0x2037db?a44_0xbc509c[_0x4b5290(0x158)](_0x1aca81,_0x4b5290(0x138)+_0x2037db):getConfigFile();}export function getCacheDir(){const _0x434d82=a44_0xc35d;return process[_0x434d82(0x148)][_0x434d82(0x182)]||join(homedir(),'.cache',_0x434d82(0x133));}export function getLLMProjectCacheFile(_0x4ccbe8){const _0x5b475f=a44_0xc35d,_0x405e23=_0x4ccbe8?_0x5b475f(0x17f)+_0x4ccbe8:_0x5b475f(0x13c);return join(getCacheDir(),_0x405e23);}export function readCachedLLMProject(_0x4dec49){const _0x5cd16c=a44_0xc35d;try{const _0x3a3dd8=getLLMProjectCacheFile(_0x4dec49);if(!existsSync(_0x3a3dd8))return null;const _0x266c8c=readFileSync(_0x3a3dd8,'utf-8')[_0x5cd16c(0x150)]();try{const _0x2ced63=JSON['parse'](_0x266c8c);if(_0x2ced63&&typeof _0x2ced63['id']==='string'&&typeof _0x2ced63[_0x5cd16c(0x132)]===_0x5cd16c(0x170))return _0x2ced63;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x29feff,_0x1e62f0,_0x451346){const _0x5c340f=a44_0xc35d;try{const _0x1bc22e=getCacheDir(),_0x569ac1=getLLMProjectCacheFile(_0x451346);!existsSync(_0x1bc22e)&&mkdirSync(_0x1bc22e,{'recursive':!![]});const _0x4abf21={'name':_0x29feff,'id':_0x1e62f0};writeFileSync(_0x569ac1,JSON[_0x5c340f(0x15c)](_0x4abf21),_0x5c340f(0x15a));}catch{}}export function getLLMAgentCacheFile(_0x34ef62){const _0x569511=a44_0xc35d,_0x3e63dd=_0x34ef62?_0x569511(0x144)+_0x34ef62:_0x569511(0x14d);return join(getCacheDir(),_0x3e63dd);}export function readCachedLLMAgent(_0x37f03e){const _0x16cae4=a44_0xc35d;try{const _0x2e8575=getLLMAgentCacheFile(_0x37f03e);if(!existsSync(_0x2e8575))return null;const _0xc99102=readFileSync(_0x2e8575,_0x16cae4(0x15a))[_0x16cae4(0x150)]();try{const _0xa2c2c0=JSON[_0x16cae4(0x16c)](_0xc99102);if(_0xa2c2c0&&typeof _0xa2c2c0['id']===_0x16cae4(0x170)&&typeof _0xa2c2c0[_0x16cae4(0x132)]===_0x16cae4(0x170)&&typeof _0xa2c2c0[_0x16cae4(0x146)]==='string')return _0xa2c2c0;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x1b9b0b,_0x2afad4,_0x5f5c93,_0x4a195c){const _0x58d4c3=a44_0xc35d;try{const _0x15eefe=getCacheDir(),_0x548c06=getLLMAgentCacheFile(_0x4a195c);!existsSync(_0x15eefe)&&mkdirSync(_0x15eefe,{'recursive':!![]});const _0x3cd5ce={'name':_0x1b9b0b,'id':_0x2afad4,'projectId':_0x5f5c93};writeFileSync(_0x548c06,JSON['stringify'](_0x3cd5ce),_0x58d4c3(0x15a));}catch{}}export function clearCachedLLMAgent(_0x21b029){try{const _0x5a48cc=getLLMAgentCacheFile(_0x21b029);existsSync(_0x5a48cc)&&unlinkSync(_0x5a48cc);}catch{}}export function getAccountInfoCacheFile(_0x2aa6f6){const _0x47c34c=a44_0xc35d,_0x640ade=_0x2aa6f6?_0x47c34c(0x155)+_0x2aa6f6+_0x47c34c(0x135):_0x47c34c(0x16d);return join(getCacheDir(),_0x640ade);}export function readCachedAccountInfo(_0x470239){const _0x423d97=a44_0xc35d;try{const _0x1bc14e=getAccountInfoCacheFile(_0x470239);if(!existsSync(_0x1bc14e))return null;const _0x1f2ce3=readFileSync(_0x1bc14e,_0x423d97(0x15a))[_0x423d97(0x150)](),_0x168776=JSON[_0x423d97(0x16c)](_0x1f2ce3);if(_0x168776&&typeof _0x168776[_0x423d97(0x15b)]===_0x423d97(0x170)&&typeof _0x168776[_0x423d97(0x180)]===_0x423d97(0x14a))return _0x168776;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x7dd59e,_0x570c95,_0x78e483){const _0x3c4ce9=a44_0xc35d;try{const _0x4a5aa3=getCacheDir(),_0x505514=getAccountInfoCacheFile(_0x78e483);!existsSync(_0x4a5aa3)&&mkdirSync(_0x4a5aa3,{'recursive':!![]});const _0x5e0e81={'site':_0x7dd59e,'accountId':_0x570c95,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x505514,JSON[_0x3c4ce9(0x15c)](_0x5e0e81),_0x3c4ce9(0x15a));}catch{}}export function parseEnvFile(_0x19725b){const _0x3348b7=a44_0xc35d,_0x4b6d5f={};for(const _0x23d422 of _0x19725b[_0x3348b7(0x184)]('\x0a')){const _0x337024=_0x23d422[_0x3348b7(0x150)]();if(!_0x337024||_0x337024['startsWith']('#'))continue;const _0x3a951f=_0x337024['match'](/^([^=]+)=(.*)$/);if(_0x3a951f){const _0x20e668=_0x3a951f[0x1][_0x3348b7(0x150)]();let _0x428b76=_0x3a951f[0x2]['trim']();(_0x428b76[_0x3348b7(0x15f)]('\x22')&&_0x428b76[_0x3348b7(0x179)]('\x22')||_0x428b76[_0x3348b7(0x15f)]('\x27')&&_0x428b76[_0x3348b7(0x179)]('\x27'))&&(_0x428b76=_0x428b76[_0x3348b7(0x145)](0x1,-0x1)),_0x4b6d5f[_0x20e668]=_0x428b76;}}return _0x4b6d5f;}function a44_0x13e8(){const _0x538d33=['env','legacy\x20.env\x20file\x20(profile:\x20','number','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','Warning:\x20Failed\x20to\x20load\x20','llm_default_agent','1168UBveRT','2wmKBiX','trim','existsSync','TD_API_KEY_','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','warn','account_info.','1286775VINTYS','ap03','join','includes','utf-8','site','stringify','eu01','91VsqkJU','startsWith','TD_API_KEY','TDX_CONFIG_DIR','yellow','tdx.json','\x27,\x20defaulting\x20to\x20us01','keychain\x20(profile:\x20','TDX_API_KEY_','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','jp01','some','profiles','329514yEQKII','parse','account_info.json','map','apiKey','string','dev-us01','TDX_API_KEY','.env','stg-jp01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','11997UzZgEs','toUpperCase','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','endsWith','8434775ADmWZb','us01','Warning:\x20Failed\x20to\x20read\x20','TD_API_KEY\x20env\x20var\x20(deprecated)','5303696ClWBdy','llm_default_project.','accountId','stg-ap03','TDX_CACHE_DIR','entries','split','dev-eu01','Warning:\x20Unknown\x20site\x20\x27','name','tdx','isDeprecated','.json','ap02','keychain','.env.','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','filter','readFileSync','llm_default_project','9007250ewQnNi','legacy\x20.env\x20file','replace','TDX_API_KEY_<PROFILE>','\x20env\x20var','.config','797575SkzimB','llm_default_agent.','slice','projectId','TDX_API_KEY\x20env\x20var'];a44_0x13e8=function(){return _0x538d33;};return a44_0x13e8();}export function readUserConfig(){const _0xbfe0c4=a44_0xc35d,_0x96d920=getConfigFile();if(!existsSync(_0x96d920))return{};try{const _0x5bb7f3=readFileSync(_0x96d920,_0xbfe0c4(0x15a));return parseEnvFile(_0x5bb7f3);}catch(_0x3ba0a2){return console[_0xbfe0c4(0x154)](_0xbfe0c4(0x175)+_0x96d920+':',_0x3ba0a2),{};}}export function resolveSite(_0x3a7dd6){const _0x35a76f=a44_0xc35d,_0x2f56d3=['us01','jp01',_0x35a76f(0x15d),_0x35a76f(0x136),_0x35a76f(0x157),_0x35a76f(0x171),_0x35a76f(0x185),'stg-us01',_0x35a76f(0x174),_0x35a76f(0x181)];if(_0x2f56d3[_0x35a76f(0x159)](_0x3a7dd6))return _0x3a7dd6;if(_0x3a7dd6 in SITE_ALIASES)return SITE_ALIASES[_0x3a7dd6];return console[_0x35a76f(0x154)](_0x35a76f(0x131)+_0x3a7dd6+_0x35a76f(0x164)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x4cc4de,_0x58d43f){const _0x1f110e=a44_0xc35d,_0x4640ec=_0x58d43f||getActiveProfileName();if(_0x4640ec){const _0x5f586d=_0x1f110e(0x166)+normalizeProfileForEnvVar(_0x4640ec);if(process[_0x1f110e(0x148)][_0x5f586d])return process[_0x1f110e(0x148)][_0x5f586d];}if(process[_0x1f110e(0x148)][_0x1f110e(0x172)])return process['env'][_0x1f110e(0x172)];if(process[_0x1f110e(0x148)][_0x1f110e(0x160)])return process[_0x1f110e(0x148)][_0x1f110e(0x160)];const _0x3667e6=_0x4cc4de[_0x1f110e(0x177)]()['replace'](/-/g,'_'),_0x41766b=_0x1f110e(0x152)+_0x3667e6;if(_0x4640ec){const _0x44de2b=loadProfileEnv(_0x4640ec);if(_0x44de2b){if(_0x44de2b[_0x41766b])return _0x44de2b[_0x41766b];if(_0x44de2b[_0x1f110e(0x160)])return _0x44de2b[_0x1f110e(0x160)];}}const _0x39771b=loadUserConfigOnce();if(_0x39771b[_0x41766b])return _0x39771b[_0x41766b];if(_0x39771b['TD_API_KEY'])return _0x39771b['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x4d71a7){const _0x224dc1=a44_0xc35d;return _0x4d71a7[_0x224dc1(0x177)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x15a9df,_0x587dc6){const _0x3be6ca=a44_0xc35d,_0x3cc945=_0x587dc6||getActiveProfileName()||undefined;if(_0x3cc945){const _0x28b6dc=_0x3be6ca(0x166)+normalizeProfileForEnvVar(_0x3cc945);if(process[_0x3be6ca(0x148)][_0x28b6dc])return{'apiKey':process[_0x3be6ca(0x148)][_0x28b6dc],'source':_0x28b6dc+_0x3be6ca(0x141),'isDeprecated':![]};const _0x17d47f=getCachedCredential(_0x15a9df,_0x3cc945);if(_0x17d47f)return{'apiKey':_0x17d47f,'source':_0x3be6ca(0x165)+_0x3cc945+')','isDeprecated':![]};const _0x38bad6=await getKeychainAPIKey(_0x3cc945);if(_0x38bad6)return setCachedCredential(_0x38bad6,_0x15a9df,_0x3cc945),{'apiKey':_0x38bad6,'source':_0x3be6ca(0x165)+_0x3cc945+')','isDeprecated':![]};}if(process['env'][_0x3be6ca(0x172)])return{'apiKey':process['env'][_0x3be6ca(0x172)],'source':_0x3be6ca(0x147),'isDeprecated':![]};if(!_0x3cc945){const _0x5d86f6=getCachedCredential(_0x15a9df,undefined);if(_0x5d86f6)return{'apiKey':_0x5d86f6,'source':'keychain','isDeprecated':![]};const _0x450dd1=await getKeychainAPIKey(undefined);if(_0x450dd1)return setCachedCredential(_0x450dd1,_0x15a9df,undefined),{'apiKey':_0x450dd1,'source':_0x3be6ca(0x137),'isDeprecated':![]};}if(process[_0x3be6ca(0x148)][_0x3be6ca(0x160)])return{'apiKey':process[_0x3be6ca(0x148)][_0x3be6ca(0x160)],'source':_0x3be6ca(0x17d),'isDeprecated':!![]};const _0x595095=getLegacyEnvAPIKey(_0x15a9df,_0x3cc945);if(_0x595095){const _0x2c9fd7=await isKeychainAvailable();if(_0x2c9fd7)try{await saveKeychainAPIKey(_0x595095,_0x3cc945),setCachedCredential(_0x595095,_0x15a9df,_0x3cc945);const _0x56008f=getConfigFilePath(_0x3cc945);cleanupLegacyEnvFile(_0x56008f)&&console[_0x3be6ca(0x154)](a44_0x4b0e26[_0x3be6ca(0x162)](_0x3be6ca(0x14b)));}catch(_0x2c0980){console[_0x3be6ca(0x154)](a44_0x4b0e26[_0x3be6ca(0x162)](_0x3be6ca(0x178)+_0x2c0980));}const _0x546bc6=_0x3cc945?_0x3be6ca(0x149)+_0x3cc945+')':_0x3be6ca(0x13e);return{'apiKey':_0x595095,'source':_0x546bc6,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x55916a,_0x2bfef4,_0xcfadc9=!![]){const _0x4fc539=a44_0xc35d,_0x1bda70=await resolveAPIKeyAsync(_0x55916a,_0x2bfef4);if(!_0x1bda70)return undefined;if(_0xcfadc9&&_0x1bda70[_0x4fc539(0x134)]&&_0x1bda70['source'][_0x4fc539(0x159)](_0x4fc539(0x160))){const _0x1e3f4e=_0x2bfef4||getActiveProfileName()||undefined,_0x35350e=_0x1e3f4e?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x1e3f4e):_0x4fc539(0x140);console[_0x4fc539(0x154)](a44_0x4b0e26[_0x4fc539(0x162)](_0x4fc539(0x153)+(_0x4fc539(0x139)+_0x35350e+').')));}return _0x1bda70[_0x4fc539(0x16f)];}function getLegacyEnvAPIKey(_0x4378cd,_0x2e02a4){const _0x32d61b=a44_0xc35d,_0x258da2=_0x4378cd[_0x32d61b(0x177)]()[_0x32d61b(0x13f)](/-/g,'_'),_0x520213=_0x32d61b(0x152)+_0x258da2;if(_0x2e02a4){const _0x58f165=loadProfileEnv(_0x2e02a4);if(_0x58f165){if(_0x58f165[_0x520213])return _0x58f165[_0x520213];if(_0x58f165[_0x32d61b(0x160)])return _0x58f165['TD_API_KEY'];}}const _0x2d0b7b=loadUserConfigOnce();if(_0x2d0b7b[_0x520213])return _0x2d0b7b[_0x520213];if(_0x2d0b7b['TD_API_KEY'])return _0x2d0b7b[_0x32d61b(0x160)];return undefined;}function cleanupLegacyEnvFile(_0x13a261){const _0x29ed09=a44_0xc35d;if(!existsSync(_0x13a261))return![];try{const _0x22d4d6=readFileSync(_0x13a261,_0x29ed09(0x15a)),_0x57c682=_0x22d4d6[_0x29ed09(0x184)]('\x0a'),_0x3a13eb=_0x57c682[_0x29ed09(0x13a)](_0x3701e7=>{const _0x33acd0=_0x29ed09,_0x4083cd=_0x3701e7['trim']();if(!_0x4083cd||_0x4083cd[_0x33acd0(0x15f)]('#'))return!![];const [_0x54fd27]=_0x4083cd[_0x33acd0(0x184)]('=');return!_0x54fd27['startsWith'](_0x33acd0(0x160));}),_0x14eea6=_0x3a13eb[_0x29ed09(0x169)](_0x4636de=>{const _0x10c1f6=_0x29ed09,_0x5644ed=_0x4636de[_0x10c1f6(0x150)]();return _0x5644ed&&!_0x5644ed[_0x10c1f6(0x15f)]('#');});if(!_0x14eea6)return unlinkSync(_0x13a261),!![];return writeFileSync(_0x13a261,_0x3a13eb[_0x29ed09(0x158)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x14ea4d){const _0x44e966=a44_0xc35d,_0x4209f4=a44_0xbc509c['join'](getConfigDir(),_0x44e966(0x138)+_0x14ea4d);if(a44_0x4172b6['existsSync'](_0x4209f4)){validateSecureFilePermissions(_0x4209f4);try{const _0x3f83a3=a44_0x4172b6['readFileSync'](_0x4209f4,_0x44e966(0x15a));return parseEnvFile(_0x3f83a3);}catch(_0x12dfc4){console[_0x44e966(0x154)](_0x44e966(0x14c)+_0x4209f4+':\x20'+_0x12dfc4);}}const _0x42d1fc=a44_0xbc509c[_0x44e966(0x158)](getConfigDir(),_0x44e966(0x16a),_0x14ea4d,_0x44e966(0x173));if(a44_0x4172b6[_0x44e966(0x151)](_0x42d1fc)){validateSecureFilePermissions(_0x42d1fc);try{const _0x2ace9a=a44_0x4172b6[_0x44e966(0x13b)](_0x42d1fc,'utf-8');return parseEnvFile(_0x2ace9a);}catch(_0x45c32d){return console[_0x44e966(0x154)]('Warning:\x20Failed\x20to\x20load\x20'+_0x42d1fc+':\x20'+_0x45c32d),null;}}return null;}function getActiveProfileName(){const _0x2b82c1=a44_0xc35d,_0x522ce8=a44_0xbc509c[_0x2b82c1(0x158)](getConfigDir(),_0x2b82c1(0x163));if(!a44_0x4172b6[_0x2b82c1(0x151)](_0x522ce8))return null;try{const _0x145377=a44_0x4172b6[_0x2b82c1(0x13b)](_0x522ce8,_0x2b82c1(0x15a)),_0x5d264c=JSON['parse'](_0x145377);return _0x5d264c['profile']||null;}catch{return null;}}export function saveAPIKey(_0x1ebc89,_0xa837bb,_0x223359){const _0x2eac64=a44_0xc35d,_0x1a7de2=getConfigDir(),_0x33956a=getConfigFilePath(_0x223359);!existsSync(_0x1a7de2)&&mkdirSync(_0x1a7de2,{'recursive':!![],'mode':0x1c0});let _0x49d794={};if(existsSync(_0x33956a))try{const _0x29af10=readFileSync(_0x33956a,_0x2eac64(0x15a));_0x49d794=parseEnvFile(_0x29af10);}catch(_0x50bf81){console['warn'](_0x2eac64(0x17c)+_0x33956a+':',_0x50bf81);}const _0x17a220=_0x1ebc89[_0x2eac64(0x177)]()['replace'](/-/g,'_');_0x49d794['TD_API_KEY_'+_0x17a220]=_0xa837bb;const _0x4b7413=Object[_0x2eac64(0x183)](_0x49d794)[_0x2eac64(0x16e)](([_0x174585,_0x57400b])=>_0x174585+'='+_0x57400b);writeFileSync(_0x33956a,_0x4b7413['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x38e342,_0xb3dd31,_0x5633a5){const _0x4a140d=a44_0xc35d;await saveKeychainAPIKey(_0x38e342,_0x5633a5),setCachedCredential(_0x38e342,_0xb3dd31,_0x5633a5);const _0xecc927=getConfigFilePath(_0x5633a5);cleanupLegacyEnvFile(_0xecc927)&&console[_0x4a140d(0x154)](a44_0x4b0e26[_0x4a140d(0x162)](_0x4a140d(0x167)));}export function loadConfig(){const _0x3149a1=a44_0xc35d,_0x33b322={'apiKeys':{},'defaultSite':_0x3149a1(0x17b)},_0x4da4eb=[_0x3149a1(0x17b),_0x3149a1(0x168),_0x3149a1(0x15d),_0x3149a1(0x136),_0x3149a1(0x157),'dev-us01','dev-eu01','stg-us01',_0x3149a1(0x174),_0x3149a1(0x181)];for(const _0x5b307a of _0x4da4eb){const _0x5dcc86=getAPIKey(_0x5b307a);_0x5dcc86&&(_0x33b322['apiKeys'][_0x5b307a]=_0x5dcc86);}return _0x33b322;}
1
+ (function(_0x261440,_0x5d5eaf){const _0x53bf7f=a44_0x447e,_0x3a720e=_0x261440();while(!![]){try{const _0x5dedfd=parseInt(_0x53bf7f(0x190))/0x1*(parseInt(_0x53bf7f(0x164))/0x2)+-parseInt(_0x53bf7f(0x154))/0x3*(parseInt(_0x53bf7f(0x176))/0x4)+parseInt(_0x53bf7f(0x18f))/0x5+-parseInt(_0x53bf7f(0x156))/0x6*(parseInt(_0x53bf7f(0x18d))/0x7)+parseInt(_0x53bf7f(0x152))/0x8*(parseInt(_0x53bf7f(0x198))/0x9)+parseInt(_0x53bf7f(0x150))/0xa+-parseInt(_0x53bf7f(0x17e))/0xb*(parseInt(_0x53bf7f(0x14c))/0xc);if(_0x5dedfd===_0x5d5eaf)break;else _0x3a720e['push'](_0x3a720e['shift']());}catch(_0xbd4a57){_0x3a720e['push'](_0x3a720e['shift']());}}}(a44_0x2b40,0xa4bbe));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a44_0x317642 from'node:fs';import*as a44_0x5b00c5 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';function a44_0x447e(_0xca025e,_0x3ef099){_0xca025e=_0xca025e-0x148;const _0x2b40de=a44_0x2b40();let _0x447e84=_0x2b40de[_0xca025e];return _0x447e84;}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a44_0x37c8bd from'chalk';export function getConfigDir(){const _0x5833b9=a44_0x447e;return process['env']['TDX_CONFIG_DIR']||join(homedir(),'.config',_0x5833b9(0x165));}export function getConfigFile(){const _0xc07a5f=a44_0x447e;return join(getConfigDir(),_0xc07a5f(0x15a));}export function getConfigFilePath(_0x426cf3){const _0x31ee1b=a44_0x447e,_0x48a91d=getConfigDir();return _0x426cf3?a44_0x5b00c5[_0x31ee1b(0x193)](_0x48a91d,'.env.'+_0x426cf3):getConfigFile();}export function getCacheDir(){const _0x56f224=a44_0x447e;return process['env']['TDX_CACHE_DIR']||join(homedir(),_0x56f224(0x168),_0x56f224(0x165));}export function getLLMProjectCacheFile(_0x2521d4){const _0x2f3b8f=a44_0x447e,_0x2f3ba2=_0x2521d4?_0x2f3b8f(0x14a)+_0x2521d4:_0x2f3b8f(0x15e);return join(getCacheDir(),_0x2f3ba2);}export function readCachedLLMProject(_0x369fbe){const _0x48efa=a44_0x447e;try{const _0x2fb26d=getLLMProjectCacheFile(_0x369fbe);if(!existsSync(_0x2fb26d))return null;const _0x213ae6=readFileSync(_0x2fb26d,_0x48efa(0x161))[_0x48efa(0x181)]();try{const _0x33529b=JSON[_0x48efa(0x166)](_0x213ae6);if(_0x33529b&&typeof _0x33529b['id']===_0x48efa(0x19b)&&typeof _0x33529b[_0x48efa(0x179)]==='string')return _0x33529b;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x274430,_0x35f155,_0x446117){const _0x534aa4=a44_0x447e;try{const _0x218262=getCacheDir(),_0x54b832=getLLMProjectCacheFile(_0x446117);!existsSync(_0x218262)&&mkdirSync(_0x218262,{'recursive':!![]});const _0x5efaaf={'name':_0x274430,'id':_0x35f155};writeFileSync(_0x54b832,JSON['stringify'](_0x5efaaf),_0x534aa4(0x161));}catch{}}export function getLLMAgentCacheFile(_0xd5162c){const _0x537622=a44_0x447e,_0x44d61c=_0xd5162c?_0x537622(0x199)+_0xd5162c:_0x537622(0x153);return join(getCacheDir(),_0x44d61c);}export function readCachedLLMAgent(_0x8f7f35){const _0x1d29ac=a44_0x447e;try{const _0x5a2172=getLLMAgentCacheFile(_0x8f7f35);if(!existsSync(_0x5a2172))return null;const _0x2e2878=readFileSync(_0x5a2172,_0x1d29ac(0x161))['trim']();try{const _0x357533=JSON['parse'](_0x2e2878);if(_0x357533&&typeof _0x357533['id']===_0x1d29ac(0x19b)&&typeof _0x357533[_0x1d29ac(0x179)]==='string'&&typeof _0x357533[_0x1d29ac(0x17c)]===_0x1d29ac(0x19b))return _0x357533;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x865f81,_0x417937,_0x4cbb0e,_0x14101e){const _0x4b4ef1=a44_0x447e;try{const _0x43fa9c=getCacheDir(),_0x56d0e4=getLLMAgentCacheFile(_0x14101e);!existsSync(_0x43fa9c)&&mkdirSync(_0x43fa9c,{'recursive':!![]});const _0x2d0fd3={'name':_0x865f81,'id':_0x417937,'projectId':_0x4cbb0e};writeFileSync(_0x56d0e4,JSON[_0x4b4ef1(0x171)](_0x2d0fd3),'utf-8');}catch{}}export function clearCachedLLMAgent(_0x71a90d){try{const _0x2fdefd=getLLMAgentCacheFile(_0x71a90d);existsSync(_0x2fdefd)&&unlinkSync(_0x2fdefd);}catch{}}export function getAccountInfoCacheFile(_0x472830){const _0x4e8934=_0x472830?'account_info.'+_0x472830+'.json':'account_info.json';return join(getCacheDir(),_0x4e8934);}export function readCachedAccountInfo(_0x414c9e){const _0x5f0cc=a44_0x447e;try{const _0x582fff=getAccountInfoCacheFile(_0x414c9e);if(!existsSync(_0x582fff))return null;const _0x2947d3=readFileSync(_0x582fff,'utf-8')[_0x5f0cc(0x181)](),_0x410986=JSON[_0x5f0cc(0x166)](_0x2947d3);if(_0x410986&&typeof _0x410986[_0x5f0cc(0x16e)]==='string'&&typeof _0x410986[_0x5f0cc(0x17d)]===_0x5f0cc(0x174))return _0x410986;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x3bcd33,_0x2ba5b0,_0x15284e){const _0x3d6a43=a44_0x447e;try{const _0x3ec967=getCacheDir(),_0x1572bb=getAccountInfoCacheFile(_0x15284e);!existsSync(_0x3ec967)&&mkdirSync(_0x3ec967,{'recursive':!![]});const _0x2d5f32={'site':_0x3bcd33,'accountId':_0x2ba5b0,'cachedAt':new Date()[_0x3d6a43(0x169)]()};writeFileSync(_0x1572bb,JSON[_0x3d6a43(0x171)](_0x2d5f32),_0x3d6a43(0x161));}catch{}}export function parseEnvFile(_0x8080af){const _0x33f7f5=a44_0x447e,_0x40f772={};for(const _0x58cc3f of _0x8080af['split']('\x0a')){const _0x4c2f8d=_0x58cc3f['trim']();if(!_0x4c2f8d||_0x4c2f8d[_0x33f7f5(0x185)]('#'))continue;const _0x39fa5e=_0x4c2f8d[_0x33f7f5(0x178)](/^([^=]+)=(.*)$/);if(_0x39fa5e){const _0x288a0c=_0x39fa5e[0x1][_0x33f7f5(0x181)]();let _0x4f4ed2=_0x39fa5e[0x2][_0x33f7f5(0x181)]();(_0x4f4ed2[_0x33f7f5(0x185)]('\x22')&&_0x4f4ed2[_0x33f7f5(0x18c)]('\x22')||_0x4f4ed2[_0x33f7f5(0x185)]('\x27')&&_0x4f4ed2[_0x33f7f5(0x18c)]('\x27'))&&(_0x4f4ed2=_0x4f4ed2[_0x33f7f5(0x151)](0x1,-0x1)),_0x40f772[_0x288a0c]=_0x4f4ed2;}}return _0x40f772;}export function readUserConfig(){const _0x12b01b=a44_0x447e,_0x5d7a71=getConfigFile();if(!existsSync(_0x5d7a71))return{};try{const _0x3d141=readFileSync(_0x5d7a71,_0x12b01b(0x161));return parseEnvFile(_0x3d141);}catch(_0x29b637){return console['warn']('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x5d7a71+':',_0x29b637),{};}}export function resolveSite(_0x26f570){const _0x1f89c6=a44_0x447e,_0x2aa38b=['us01',_0x1f89c6(0x18e),'eu01',_0x1f89c6(0x189),_0x1f89c6(0x173),_0x1f89c6(0x160),_0x1f89c6(0x187),'stg-us01',_0x1f89c6(0x182),_0x1f89c6(0x170)];if(_0x2aa38b['includes'](_0x26f570))return _0x26f570;if(_0x26f570 in SITE_ALIASES)return SITE_ALIASES[_0x26f570];return console[_0x1f89c6(0x15b)]('Warning:\x20Unknown\x20site\x20\x27'+_0x26f570+_0x1f89c6(0x157)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x518ea6,_0x318af3){const _0x1c0b9c=a44_0x447e,_0xaff957=_0x318af3||getActiveProfileName();if(_0xaff957){const _0x3f80e1=_0x1c0b9c(0x167)+normalizeProfileForEnvVar(_0xaff957);if(process['env'][_0x3f80e1])return process['env'][_0x3f80e1];}if(process[_0x1c0b9c(0x15d)][_0x1c0b9c(0x16d)])return process[_0x1c0b9c(0x15d)]['TDX_API_KEY'];if(process[_0x1c0b9c(0x15d)]['TD_API_KEY'])return process[_0x1c0b9c(0x15d)][_0x1c0b9c(0x15c)];const _0x3dbc88=_0x518ea6['toUpperCase']()[_0x1c0b9c(0x158)](/-/g,'_'),_0x5d6b62='TD_API_KEY_'+_0x3dbc88;if(_0xaff957){const _0x11856a=loadProfileEnv(_0xaff957);if(_0x11856a){if(_0x11856a[_0x5d6b62])return _0x11856a[_0x5d6b62];if(_0x11856a[_0x1c0b9c(0x15c)])return _0x11856a[_0x1c0b9c(0x15c)];}}const _0x2e0f5b=loadUserConfigOnce();if(_0x2e0f5b[_0x5d6b62])return _0x2e0f5b[_0x5d6b62];if(_0x2e0f5b[_0x1c0b9c(0x15c)])return _0x2e0f5b[_0x1c0b9c(0x15c)];return undefined;}export function normalizeProfileForEnvVar(_0x53bb1c){const _0x2aff59=a44_0x447e;return _0x53bb1c[_0x2aff59(0x191)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x3584d6,_0x361073){const _0x2d94ef=a44_0x447e,_0x37deef=_0x361073||getActiveProfileName()||undefined;if(_0x37deef){const _0x1fd985=_0x2d94ef(0x167)+normalizeProfileForEnvVar(_0x37deef);if(process[_0x2d94ef(0x15d)][_0x1fd985])return{'apiKey':process[_0x2d94ef(0x15d)][_0x1fd985],'source':_0x1fd985+_0x2d94ef(0x16f),'isDeprecated':![]};const _0xb10c16=getCachedCredential(_0x3584d6,_0x37deef);if(_0xb10c16)return{'apiKey':_0xb10c16,'source':'keychain\x20(profile:\x20'+_0x37deef+')','isDeprecated':![]};const _0x3ec093=await getKeychainAPIKey(_0x37deef);if(_0x3ec093)return setCachedCredential(_0x3ec093,_0x3584d6,_0x37deef),{'apiKey':_0x3ec093,'source':_0x2d94ef(0x15f)+_0x37deef+')','isDeprecated':![]};}if(process[_0x2d94ef(0x15d)][_0x2d94ef(0x16d)])return{'apiKey':process[_0x2d94ef(0x15d)][_0x2d94ef(0x16d)],'source':_0x2d94ef(0x17a),'isDeprecated':![]};if(!_0x37deef){const _0x5da7fe=getCachedCredential(_0x3584d6,undefined);if(_0x5da7fe)return{'apiKey':_0x5da7fe,'source':_0x2d94ef(0x163),'isDeprecated':![]};const _0x566d96=await getKeychainAPIKey(undefined);if(_0x566d96)return setCachedCredential(_0x566d96,_0x3584d6,undefined),{'apiKey':_0x566d96,'source':_0x2d94ef(0x163),'isDeprecated':![]};}if(process[_0x2d94ef(0x15d)][_0x2d94ef(0x15c)])return{'apiKey':process[_0x2d94ef(0x15d)][_0x2d94ef(0x15c)],'source':_0x2d94ef(0x177),'isDeprecated':!![]};const _0x366917=getLegacyEnvAPIKey(_0x3584d6,_0x37deef);if(_0x366917){const _0x406cda=await isKeychainAvailable();if(_0x406cda)try{await saveKeychainAPIKey(_0x366917,_0x37deef),setCachedCredential(_0x366917,_0x3584d6,_0x37deef);const _0x64e28b=getConfigFilePath(_0x37deef);cleanupLegacyEnvFile(_0x64e28b)&&console[_0x2d94ef(0x15b)](a44_0x37c8bd['yellow'](_0x2d94ef(0x16b)));}catch(_0x29ad40){console[_0x2d94ef(0x15b)](a44_0x37c8bd[_0x2d94ef(0x180)](_0x2d94ef(0x149)+_0x29ad40));}const _0x373d5a=_0x37deef?_0x2d94ef(0x18b)+_0x37deef+')':_0x2d94ef(0x16c);return{'apiKey':_0x366917,'source':_0x373d5a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x3803e2,_0x2582d5,_0x189897=!![]){const _0x33e2d4=a44_0x447e,_0x56d6f1=await resolveAPIKeyAsync(_0x3803e2,_0x2582d5);if(!_0x56d6f1)return undefined;if(_0x189897&&_0x56d6f1[_0x33e2d4(0x14b)]&&_0x56d6f1[_0x33e2d4(0x16a)][_0x33e2d4(0x148)]('TD_API_KEY')){const _0x2a5cc9=_0x2582d5||getActiveProfileName()||undefined,_0x12daa1=_0x2a5cc9?_0x33e2d4(0x167)+normalizeProfileForEnvVar(_0x2a5cc9):_0x33e2d4(0x14d);console[_0x33e2d4(0x15b)](a44_0x37c8bd['yellow']('Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a'+(_0x33e2d4(0x195)+_0x12daa1+').')));}return _0x56d6f1[_0x33e2d4(0x17b)];}function getLegacyEnvAPIKey(_0x557b38,_0x6d9c1c){const _0x3fb99c=a44_0x447e,_0xf70af8=_0x557b38[_0x3fb99c(0x191)]()['replace'](/-/g,'_'),_0x556650=_0x3fb99c(0x172)+_0xf70af8;if(_0x6d9c1c){const _0x418c26=loadProfileEnv(_0x6d9c1c);if(_0x418c26){if(_0x418c26[_0x556650])return _0x418c26[_0x556650];if(_0x418c26['TD_API_KEY'])return _0x418c26[_0x3fb99c(0x15c)];}}const _0x3d548f=loadUserConfigOnce();if(_0x3d548f[_0x556650])return _0x3d548f[_0x556650];if(_0x3d548f[_0x3fb99c(0x15c)])return _0x3d548f[_0x3fb99c(0x15c)];return undefined;}function cleanupLegacyEnvFile(_0x3b513a){const _0x5ec883=a44_0x447e;if(!existsSync(_0x3b513a))return![];try{const _0x5dc09d=readFileSync(_0x3b513a,'utf-8'),_0x3a6f6d=_0x5dc09d[_0x5ec883(0x184)]('\x0a'),_0x219b76=_0x3a6f6d[_0x5ec883(0x14f)](_0x2f522d=>{const _0x258ad4=_0x5ec883,_0x47567f=_0x2f522d[_0x258ad4(0x181)]();if(!_0x47567f||_0x47567f[_0x258ad4(0x185)]('#'))return!![];const [_0x1eec81]=_0x47567f[_0x258ad4(0x184)]('=');return!_0x1eec81[_0x258ad4(0x185)](_0x258ad4(0x15c));}),_0x5c7a4a=_0x219b76[_0x5ec883(0x19a)](_0x2b50fd=>{const _0x45975f=_0x5ec883,_0x48ce39=_0x2b50fd[_0x45975f(0x181)]();return _0x48ce39&&!_0x48ce39[_0x45975f(0x185)]('#');});if(!_0x5c7a4a)return unlinkSync(_0x3b513a),!![];return writeFileSync(_0x3b513a,_0x219b76[_0x5ec883(0x193)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x5a1086){const _0x131431=a44_0x447e,_0x3c5a14=a44_0x5b00c5['join'](getConfigDir(),_0x131431(0x196)+_0x5a1086);if(a44_0x317642['existsSync'](_0x3c5a14)){validateSecureFilePermissions(_0x3c5a14);try{const _0x16b611=a44_0x317642[_0x131431(0x194)](_0x3c5a14,'utf-8');return parseEnvFile(_0x16b611);}catch(_0x37a510){console[_0x131431(0x15b)]('Warning:\x20Failed\x20to\x20load\x20'+_0x3c5a14+':\x20'+_0x37a510);}}const _0xf863cd=a44_0x5b00c5[_0x131431(0x193)](getConfigDir(),_0x131431(0x188),_0x5a1086,_0x131431(0x15a));if(a44_0x317642[_0x131431(0x17f)](_0xf863cd)){validateSecureFilePermissions(_0xf863cd);try{const _0x16b5a0=a44_0x317642[_0x131431(0x194)](_0xf863cd,_0x131431(0x161));return parseEnvFile(_0x16b5a0);}catch(_0x2edf08){return console[_0x131431(0x15b)](_0x131431(0x197)+_0xf863cd+':\x20'+_0x2edf08),null;}}return null;}function a44_0x2b40(){const _0xf8bfe0=['ap02','stg-us01','legacy\x20.env\x20file\x20(profile:\x20','endsWith','161sWJCOY','jp01','4544470DIySml','901733dEtNXR','toUpperCase','apiKeys','join','readFileSync','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','.env.','Warning:\x20Failed\x20to\x20load\x20','50013RWzZjF','llm_default_agent.','some','string','includes','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','llm_default_project.','isDeprecated','312xIJiNV','TDX_API_KEY_<PROFILE>','profile','filter','11327370WFuszP','slice','1864VkZvzp','llm_default_agent','189XRDTtM','Warning:\x20Failed\x20to\x20read\x20','204930njKHrA','\x27,\x20defaulting\x20to\x20us01','replace','entries','.env','warn','TD_API_KEY','env','llm_default_project','keychain\x20(profile:\x20','dev-us01','utf-8','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','keychain','2RIjUuO','tdx','parse','TDX_API_KEY_','.cache','toISOString','source','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','legacy\x20.env\x20file','TDX_API_KEY','site','\x20env\x20var','stg-ap03','stringify','TD_API_KEY_','ap03','number','eu01','53528ByvMEK','TD_API_KEY\x20env\x20var\x20(deprecated)','match','name','TDX_API_KEY\x20env\x20var','apiKey','projectId','accountId','818554RIGaRJ','existsSync','yellow','trim','stg-jp01','us01','split','startsWith','map','dev-eu01','profiles'];a44_0x2b40=function(){return _0xf8bfe0;};return a44_0x2b40();}function getActiveProfileName(){const _0x41fe5c=a44_0x447e,_0x3ffeec=a44_0x5b00c5[_0x41fe5c(0x193)](getConfigDir(),'tdx.json');if(!a44_0x317642[_0x41fe5c(0x17f)](_0x3ffeec))return null;try{const _0x494f2b=a44_0x317642[_0x41fe5c(0x194)](_0x3ffeec,_0x41fe5c(0x161)),_0x2f6e62=JSON[_0x41fe5c(0x166)](_0x494f2b);return _0x2f6e62[_0x41fe5c(0x14e)]||null;}catch{return null;}}export function saveAPIKey(_0x20f82e,_0x2340d7,_0x5abaca){const _0x4ecdda=a44_0x447e,_0x59b080=getConfigDir(),_0x5bf621=getConfigFilePath(_0x5abaca);!existsSync(_0x59b080)&&mkdirSync(_0x59b080,{'recursive':!![],'mode':0x1c0});let _0x12a8e8={};if(existsSync(_0x5bf621))try{const _0x28f648=readFileSync(_0x5bf621,_0x4ecdda(0x161));_0x12a8e8=parseEnvFile(_0x28f648);}catch(_0x5dfe65){console['warn'](_0x4ecdda(0x155)+_0x5bf621+':',_0x5dfe65);}const _0x445407=_0x20f82e[_0x4ecdda(0x191)]()[_0x4ecdda(0x158)](/-/g,'_');_0x12a8e8[_0x4ecdda(0x172)+_0x445407]=_0x2340d7;const _0x4a58cb=Object[_0x4ecdda(0x159)](_0x12a8e8)[_0x4ecdda(0x186)](([_0x4c569d,_0x4ee2d5])=>_0x4c569d+'='+_0x4ee2d5);writeFileSync(_0x5bf621,_0x4a58cb[_0x4ecdda(0x193)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x4b0229,_0x47f501,_0x10489f){const _0x9cea7c=a44_0x447e;await saveKeychainAPIKey(_0x4b0229,_0x10489f),setCachedCredential(_0x4b0229,_0x47f501,_0x10489f);const _0x404145=getConfigFilePath(_0x10489f);cleanupLegacyEnvFile(_0x404145)&&console[_0x9cea7c(0x15b)](a44_0x37c8bd['yellow'](_0x9cea7c(0x162)));}export function loadConfig(){const _0x4d5a91=a44_0x447e,_0x79693a={'apiKeys':{},'defaultSite':_0x4d5a91(0x183)},_0x580d0e=['us01','jp01',_0x4d5a91(0x175),_0x4d5a91(0x189),_0x4d5a91(0x173),_0x4d5a91(0x160),'dev-eu01',_0x4d5a91(0x18a),_0x4d5a91(0x182),_0x4d5a91(0x170)];for(const _0x1d7314 of _0x580d0e){const _0x5f1657=getAPIKey(_0x1d7314);_0x5f1657&&(_0x79693a[_0x4d5a91(0x192)][_0x1d7314]=_0x5f1657);}return _0x79693a;}
@@ -1 +1 @@
1
- (function(_0x14e040,_0x5de39d){const _0x4f469f=a45_0x5aed,_0xabd657=_0x14e040();while(!![]){try{const _0x86704b=parseInt(_0x4f469f(0x12e))/0x1*(-parseInt(_0x4f469f(0x13b))/0x2)+parseInt(_0x4f469f(0x12f))/0x3*(parseInt(_0x4f469f(0x135))/0x4)+parseInt(_0x4f469f(0x12c))/0x5+parseInt(_0x4f469f(0x134))/0x6*(-parseInt(_0x4f469f(0x133))/0x7)+-parseInt(_0x4f469f(0x12d))/0x8+parseInt(_0x4f469f(0x137))/0x9+parseInt(_0x4f469f(0x131))/0xa;if(_0x86704b===_0x5de39d)break;else _0xabd657['push'](_0xabd657['shift']());}catch(_0x5ccfb5){_0xabd657['push'](_0xabd657['shift']());}}}(a45_0x4480,0x8de5b));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x3eed85){const _0x55c190=a45_0x5aed,_0x4ea9f7=_0x3eed85||_0x55c190(0x13a);return join(getCacheDir(),_0x55c190(0x136)+_0x4ea9f7+_0x55c190(0x130));}function a45_0x5aed(_0x8f98fb,_0x5616c4){_0x8f98fb=_0x8f98fb-0x12c;const _0x448069=a45_0x4480();let _0x5aed90=_0x448069[_0x8f98fb];return _0x5aed90;}export function loadCachedConnections(_0x33a2b8){const _0x5bc9de=a45_0x5aed,_0x456e5b=getCacheFilePath(_0x33a2b8);if(!existsSync(_0x456e5b))return null;try{const _0x4a8899=readFileSync(_0x456e5b,'utf-8'),_0x1cd915=JSON[_0x5bc9de(0x138)](_0x4a8899);return _0x1cd915['connections'];}catch{return null;}}function a45_0x4480(){const _0x3264f3=['.json','23065580nayZQt','stringify','7528514yFnQYk','6XvSmou','4QKxwtP','connections-','2289069gFsYch','parse','utf-8','default','315334nrhekE','417105oalSMn','5532472KWKswT','6aJdEBL','1949862ZTqQbM'];a45_0x4480=function(){return _0x3264f3;};return a45_0x4480();}export function saveCachedConnections(_0x4718d0,_0x30f0ae){const _0x3ef09d=a45_0x5aed,_0x3515cd=getCacheDir();!existsSync(_0x3515cd)&&mkdirSync(_0x3515cd,{'recursive':!![]});const _0x544a25=getCacheFilePath(_0x4718d0),_0x499ad6={'connections':_0x30f0ae,'cachedAt':Date['now']()};writeFileSync(_0x544a25,JSON[_0x3ef09d(0x132)](_0x499ad6,null,0x2),_0x3ef09d(0x139));}export function clearConnectionCache(_0x27bc29){const _0x49ccf7=getCacheFilePath(_0x27bc29);if(existsSync(_0x49ccf7))try{unlinkSync(_0x49ccf7);}catch{}}
1
+ function a45_0x24e5(){const _0x4868ea=['2TxKImc','parse','connections','12sBoEvF','utf-8','1290546lxKPLf','4166918ARHEBJ','771978SidjHX','3595fDdrMz','.json','6260456wolPzJ','857859nWDwvT','13353373diEMrN','10kRAXEv','stringify','24BpqEfC'];a45_0x24e5=function(){return _0x4868ea;};return a45_0x24e5();}(function(_0xf51e25,_0x5a9e3b){const _0x4aa251=a45_0x4aa5,_0x4b16a6=_0xf51e25();while(!![]){try{const _0x44dfb4=parseInt(_0x4aa251(0x1bf))/0x1*(parseInt(_0x4aa251(0x1b4))/0x2)+-parseInt(_0x4aa251(0x1bb))/0x3*(-parseInt(_0x4aa251(0x1b7))/0x4)+parseInt(_0x4aa251(0x1bc))/0x5*(-parseInt(_0x4aa251(0x1c3))/0x6)+-parseInt(_0x4aa251(0x1ba))/0x7+parseInt(_0x4aa251(0x1be))/0x8+-parseInt(_0x4aa251(0x1b9))/0x9+-parseInt(_0x4aa251(0x1c1))/0xa*(parseInt(_0x4aa251(0x1c0))/0xb);if(_0x44dfb4===_0x5a9e3b)break;else _0x4b16a6['push'](_0x4b16a6['shift']());}catch(_0xd61d4b){_0x4b16a6['push'](_0x4b16a6['shift']());}}}(a45_0x24e5,0x6f8cb));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x50a274){const _0xb3c5=a45_0x4aa5,_0x2377b1=_0x50a274||'default';return join(getCacheDir(),'connections-'+_0x2377b1+_0xb3c5(0x1bd));}export function loadCachedConnections(_0x7743fc){const _0xe2e6b4=a45_0x4aa5,_0x1e7826=getCacheFilePath(_0x7743fc);if(!existsSync(_0x1e7826))return null;try{const _0x3a4bc5=readFileSync(_0x1e7826,_0xe2e6b4(0x1b8)),_0x4c7d3e=JSON[_0xe2e6b4(0x1b5)](_0x3a4bc5);return _0x4c7d3e[_0xe2e6b4(0x1b6)];}catch{return null;}}function a45_0x4aa5(_0x15618a,_0x302b55){_0x15618a=_0x15618a-0x1b4;const _0x24e54d=a45_0x24e5();let _0x4aa507=_0x24e54d[_0x15618a];return _0x4aa507;}export function saveCachedConnections(_0x19d333,_0x46863b){const _0x4f97dc=a45_0x4aa5,_0x5e3109=getCacheDir();!existsSync(_0x5e3109)&&mkdirSync(_0x5e3109,{'recursive':!![]});const _0x497d23=getCacheFilePath(_0x19d333),_0x42e900={'connections':_0x46863b,'cachedAt':Date['now']()};writeFileSync(_0x497d23,JSON[_0x4f97dc(0x1c2)](_0x42e900,null,0x2),'utf-8');}export function clearConnectionCache(_0x4eb338){const _0x547efa=getCacheFilePath(_0x4eb338);if(existsSync(_0x547efa))try{unlinkSync(_0x547efa);}catch{}}
@@ -1 +1 @@
1
- function a46_0x1913(_0x3efb49,_0x93178f){_0x3efb49=_0x3efb49-0x163;const _0x13e76f=a46_0x13e7();let _0x19130c=_0x13e76f[_0x3efb49];return _0x19130c;}function a46_0x13e7(){const _0x9a0fd9=['number','7621083HfsQSR','354pYbWMf','76179YHkzHF','1305360rdglKr','1219840sJDado','1071516thCBHI','8JEDjxk','317811oHehsp','120455YRjTfi'];a46_0x13e7=function(){return _0x9a0fd9;};return a46_0x13e7();}(function(_0x41bfb7,_0x154496){const _0x4abd70=a46_0x1913,_0x42a83c=_0x41bfb7();while(!![]){try{const _0x4a8651=parseInt(_0x4abd70(0x169))/0x1+parseInt(_0x4abd70(0x167))/0x2+-parseInt(_0x4abd70(0x164))/0x3+parseInt(_0x4abd70(0x166))/0x4+-parseInt(_0x4abd70(0x16a))/0x5*(parseInt(_0x4abd70(0x163))/0x6)+parseInt(_0x4abd70(0x165))/0x7+-parseInt(_0x4abd70(0x168))/0x8*(-parseInt(_0x4abd70(0x16c))/0x9);if(_0x4a8651===_0x154496)break;else _0x42a83c['push'](_0x42a83c['shift']());}catch(_0x5f27a0){_0x42a83c['push'](_0x42a83c['shift']());}}}(a46_0x13e7,0xb5e4a));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x315983,_0x1437f3){const _0x2937e0=a46_0x1913;if(_0x315983===undefined)return _0x1437f3;if(typeof _0x315983===_0x2937e0(0x16b))return _0x315983;return parseInt(_0x315983,0xa);}
1
+ (function(_0x160dae,_0x5c6176){const _0x4ca5e2=a46_0x3de9,_0x4bd438=_0x160dae();while(!![]){try{const _0x7bb57=-parseInt(_0x4ca5e2(0x18a))/0x1+parseInt(_0x4ca5e2(0x18b))/0x2*(-parseInt(_0x4ca5e2(0x18c))/0x3)+parseInt(_0x4ca5e2(0x18d))/0x4+-parseInt(_0x4ca5e2(0x18f))/0x5+parseInt(_0x4ca5e2(0x188))/0x6+parseInt(_0x4ca5e2(0x189))/0x7*(parseInt(_0x4ca5e2(0x18e))/0x8)+-parseInt(_0x4ca5e2(0x191))/0x9;if(_0x7bb57===_0x5c6176)break;else _0x4bd438['push'](_0x4bd438['shift']());}catch(_0x310516){_0x4bd438['push'](_0x4bd438['shift']());}}}(a46_0x3424,0x6940f));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;function a46_0x3424(){const _0x46dc79=['3128968gUvNWy','104XWyWkm','61110jKqRJC','number','3260520ToBkgw','1423902Ipijrx','454958OvjusH','710994GoBoam','695732xPJUZo','3ytwfkQ'];a46_0x3424=function(){return _0x46dc79;};return a46_0x3424();}export const DEFAULT_LLM_LIMIT=0x32;function a46_0x3de9(_0x4835c8,_0x15b285){_0x4835c8=_0x4835c8-0x188;const _0x34241d=a46_0x3424();let _0x3de997=_0x34241d[_0x4835c8];return _0x3de997;}export function resolveLimit(_0x546356,_0x44539c){const _0x1e163d=a46_0x3de9;if(_0x546356===undefined)return _0x44539c;if(typeof _0x546356===_0x1e163d(0x190))return _0x546356;return parseInt(_0x546356,0xa);}
@@ -1 +1 @@
1
- (function(_0x1737a8,_0x597c0a){const _0x35e130=a47_0x247f,_0x33b8b8=_0x1737a8();while(!![]){try{const _0xba0682=-parseInt(_0x35e130(0x1d4))/0x1*(-parseInt(_0x35e130(0x1cb))/0x2)+parseInt(_0x35e130(0x1d6))/0x3+-parseInt(_0x35e130(0x1ca))/0x4+-parseInt(_0x35e130(0x1d3))/0x5*(-parseInt(_0x35e130(0x1ce))/0x6)+-parseInt(_0x35e130(0x1d7))/0x7*(parseInt(_0x35e130(0x1d2))/0x8)+parseInt(_0x35e130(0x1d1))/0x9+parseInt(_0x35e130(0x1cd))/0xa;if(_0xba0682===_0x597c0a)break;else _0x33b8b8['push'](_0x33b8b8['shift']());}catch(_0x128278){_0x33b8b8['push'](_0x33b8b8['shift']());}}}(a47_0x294e,0x4b779));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a47_0x294e(){const _0x151001=['789620vuxLEN','7ywgkkW','__default_profile__','644463gCHOeS','3886043RDwmkV','clear','1801880FeXGsc','26788FqtICZ','now','5692310WjZDNA','6trkYlf','delete','set','2510982kYXTXh','8zbAGIT'];a47_0x294e=function(){return _0x151001;};return a47_0x294e();}function a47_0x247f(_0x4e1584,_0x291443){_0x4e1584=_0x4e1584-0x1ca;const _0x294ede=a47_0x294e();let _0x247f9=_0x294ede[_0x4e1584];return _0x247f9;}function getCacheKey(_0x165755,_0x3d0f49){const _0x20aba4=a47_0x247f,_0x1107a4=_0x165755||'__default_site__',_0x4473e9=_0x3d0f49||_0x20aba4(0x1d5);return _0x1107a4+':'+_0x4473e9;}export function getCachedCredential(_0x1fef0d,_0x4d330f){const _0x5e8aa4=a47_0x247f,_0x21f62c=getCacheKey(_0x1fef0d,_0x4d330f),_0x4c0725=cache['get'](_0x21f62c);if(!_0x4c0725)return null;if(Date['now']()-_0x4c0725['loadedAt']>CACHE_TTL_MS)return cache[_0x5e8aa4(0x1cf)](_0x21f62c),null;return _0x4c0725['apiKey'];}export function setCachedCredential(_0x1bd9f3,_0x5789a2,_0x5cb3b0){const _0x435a6f=a47_0x247f,_0x1016a2=getCacheKey(_0x5789a2,_0x5cb3b0);cache[_0x435a6f(0x1d0)](_0x1016a2,{'apiKey':_0x1bd9f3,'loadedAt':Date[_0x435a6f(0x1cc)]()});}export function clearCredentialCache(){const _0x1806f9=a47_0x247f;cache[_0x1806f9(0x1d8)]();}export function clearCachedCredential(_0x501458,_0x23fa8e){const _0x37cefd=a47_0x247f,_0x209977=getCacheKey(_0x501458,_0x23fa8e);cache[_0x37cefd(0x1cf)](_0x209977);}
1
+ (function(_0x3dcda7,_0x5d75b2){const _0x10b424=a47_0x8375,_0x49cd7b=_0x3dcda7();while(!![]){try{const _0xce4500=-parseInt(_0x10b424(0x196))/0x1*(-parseInt(_0x10b424(0x195))/0x2)+parseInt(_0x10b424(0x19a))/0x3+-parseInt(_0x10b424(0x199))/0x4+parseInt(_0x10b424(0x19c))/0x5*(parseInt(_0x10b424(0x192))/0x6)+parseInt(_0x10b424(0x194))/0x7*(parseInt(_0x10b424(0x19d))/0x8)+-parseInt(_0x10b424(0x197))/0x9+-parseInt(_0x10b424(0x19b))/0xa;if(_0xce4500===_0x5d75b2)break;else _0x49cd7b['push'](_0x49cd7b['shift']());}catch(_0x105ae9){_0x49cd7b['push'](_0x49cd7b['shift']());}}}(a47_0x3ddd,0xd2611));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5137d6,_0x15a73f){const _0x336653=a47_0x8375,_0x19f05f=_0x5137d6||'__default_site__',_0x4e5ab4=_0x15a73f||_0x336653(0x19f);return _0x19f05f+':'+_0x4e5ab4;}function a47_0x3ddd(){const _0xea8ce4=['817208JLzPYq','60550Wwgufx','17YTCdam','5078196JGujBe','delete','4837476KztqHu','4224312qAHFjr','9545020cLmCBp','475UCZRlo','8mfZhKF','now','__default_profile__','loadedAt','apiKey','97914ZQQUqL','clear'];a47_0x3ddd=function(){return _0xea8ce4;};return a47_0x3ddd();}function a47_0x8375(_0x4ed1b4,_0x5d8ab6){_0x4ed1b4=_0x4ed1b4-0x191;const _0x3ddd10=a47_0x3ddd();let _0x83754f=_0x3ddd10[_0x4ed1b4];return _0x83754f;}export function getCachedCredential(_0x3ea644,_0xa4d8c){const _0x300147=a47_0x8375,_0x324ddb=getCacheKey(_0x3ea644,_0xa4d8c),_0x589111=cache['get'](_0x324ddb);if(!_0x589111)return null;if(Date[_0x300147(0x19e)]()-_0x589111[_0x300147(0x1a0)]>CACHE_TTL_MS)return cache[_0x300147(0x198)](_0x324ddb),null;return _0x589111[_0x300147(0x191)];}export function setCachedCredential(_0x115211,_0x39fa80,_0x1e860d){const _0x1d5e23=a47_0x8375,_0x1ab6d5=getCacheKey(_0x39fa80,_0x1e860d);cache['set'](_0x1ab6d5,{'apiKey':_0x115211,'loadedAt':Date[_0x1d5e23(0x19e)]()});}export function clearCredentialCache(){const _0x269bc5=a47_0x8375;cache[_0x269bc5(0x193)]();}export function clearCachedCredential(_0x792be,_0x5e76fc){const _0x515589=a47_0x8375,_0x1a6c52=getCacheKey(_0x792be,_0x5e76fc);cache[_0x515589(0x198)](_0x1a6c52);}
@@ -1 +1 @@
1
- const a48_0x1fc5d1=a48_0x343f;(function(_0x4c668c,_0x457f19){const _0x48c5f3=a48_0x343f,_0x407aee=_0x4c668c();while(!![]){try{const _0x7b0a59=-parseInt(_0x48c5f3(0xa1))/0x1*(parseInt(_0x48c5f3(0xbe))/0x2)+parseInt(_0x48c5f3(0xd2))/0x3*(parseInt(_0x48c5f3(0xc3))/0x4)+parseInt(_0x48c5f3(0xbb))/0x5*(-parseInt(_0x48c5f3(0x93))/0x6)+parseInt(_0x48c5f3(0xb7))/0x7*(-parseInt(_0x48c5f3(0xc7))/0x8)+parseInt(_0x48c5f3(0xaf))/0x9+-parseInt(_0x48c5f3(0xca))/0xa+parseInt(_0x48c5f3(0xa0))/0xb;if(_0x7b0a59===_0x457f19)break;else _0x407aee['push'](_0x407aee['shift']());}catch(_0x1b3aa9){_0x407aee['push'](_0x407aee['shift']());}}}(a48_0x21da,0xa94a8));function a48_0x21da(){const _0x29eeb8=['[context]','Session','170136cJJgfM','llm_project','assign','Profile\x20Credentials','join','cliFlags','entries','(session:\x20','49Ysgkhu','\x0a[configuration\x20files]','not\x20set','.env','2122035xqxDGM','profileCredentials','Profile','560fHhVTp','session','segmentPath','Global','workflowProject','109860VLKJjF','parentSegment','env','llm_agent','1355688BXnKbP','createAsync','verbose','10230030kHjuXs','(active)','sessionId','global','sessions',':\x20none','configFiles','existsSync','24hQFdyH','profile','parent_segment','apiKey','site','loadGlobalConfig','config','llmProject','INFO','layers','12pNLlcT','TDX_SITE','activeProfile','workflow_project','profile:\x20','database','project','Global\x20Credentials','string','parse','globalCredentials','profiles','default','39254116nubWCs','199NaUpNN','tdx.json','llmAgent','segment_path','log','getSource','display','logLevel','getParameters','displayWithSources','us01','resolveAPIKeyAsync'];a48_0x21da=function(){return _0x29eeb8;};return a48_0x21da();}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';function a48_0x343f(_0x2e8ac9,_0x154740){_0x2e8ac9=_0x2e8ac9-0x91;const _0x21da2c=a48_0x21da();let _0x343f9b=_0x21da2c[_0x2e8ac9];return _0x343f9b;}import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x470e79 from'node:fs';import*as a48_0xd2a5f1 from'node:path';export class GlobalContext{[a48_0x1fc5d1(0xd6)];[a48_0x1fc5d1(0x98)];[a48_0x1fc5d1(0xd4)];['segment_path'];[a48_0x1fc5d1(0xb0)];[a48_0x1fc5d1(0xc6)];[a48_0x1fc5d1(0x96)];[a48_0x1fc5d1(0xd5)];[a48_0x1fc5d1(0xc9)];[a48_0x1fc5d1(0xa8)];[a48_0x1fc5d1(0xd3)];[a48_0x1fc5d1(0x92)];[a48_0x1fc5d1(0x95)];[a48_0x1fc5d1(0xcc)];[a48_0x1fc5d1(0xd0)];constructor(_0x364357){const _0x55ca58=a48_0x1fc5d1;this[_0x55ca58(0xcc)]=_0x364357[_0x55ca58(0xbf)]||getCurrentSessionPID()['toString']();const _0x295c6c=loadSessionContext(_0x364357[_0x55ca58(0xbf)]),_0x35c2d9=loadProjectConfig(),_0x12f1e5=this[_0x55ca58(0xd7)]();this['activeProfile']=_0x364357[_0x55ca58(0xd3)]||_0x295c6c?.[_0x55ca58(0xd3)]||_0x12f1e5[_0x55ca58(0xd3)]||getActiveProfile();const _0x5874ad=this['activeProfile']?loadProfile(this[_0x55ca58(0x95)]):null,_0x3bcd11=_0x500f1f=>{const _0x2068ac=_0x55ca58;if(!_0x500f1f)return{};const _0x2b8bee=_0x500f1f,_0x52f316={};for(const [_0xa3e55e,_0x391403]of Object[_0x2068ac(0xb5)](_0x2b8bee)){typeof _0x391403===_0x2068ac(0x9b)&&(_0x52f316[_0xa3e55e]=_0x391403);}return _0x52f316;},_0x50c54c={};if(_0x364357[_0x55ca58(0xd6)]&&_0x364357[_0x55ca58(0xd6)]!==_0x55ca58(0xab))_0x50c54c[_0x55ca58(0xd6)]=_0x364357[_0x55ca58(0xd6)];const _0x2227a7=_0x295c6c?.[_0x55ca58(0x98)],_0x50271e=_0x35c2d9?.[_0x55ca58(0x98)],_0x2c8510=_0x5874ad?.[_0x55ca58(0xd8)]?.[_0x55ca58(0x98)],_0x42cd8f=_0x12f1e5[_0x55ca58(0x98)];_0x364357[_0x55ca58(0x98)]&&(_0x364357['database']!==_0x2227a7&&_0x364357[_0x55ca58(0x98)]!==_0x50271e&&_0x364357[_0x55ca58(0x98)]!==_0x2c8510&&_0x364357[_0x55ca58(0x98)]!==_0x42cd8f)&&(_0x50c54c[_0x55ca58(0x98)]=_0x364357[_0x55ca58(0x98)]);if(_0x364357[_0x55ca58(0xc4)])_0x50c54c[_0x55ca58(0xd4)]=_0x364357[_0x55ca58(0xc4)];if(_0x364357[_0x55ca58(0xd9)])_0x50c54c[_0x55ca58(0xb0)]=_0x364357[_0x55ca58(0xd9)];if(_0x364357[_0x55ca58(0xa3)])_0x50c54c[_0x55ca58(0xc6)]=_0x364357[_0x55ca58(0xa3)];if(_0x364357[_0x55ca58(0xd3)])_0x50c54c[_0x55ca58(0xd3)]=_0x364357[_0x55ca58(0xd3)];this['layers']={'cliFlags':_0x50c54c,'session':_0x3bcd11(_0x295c6c),'project':_0x3bcd11(_0x35c2d9),'profile':_0x3bcd11(_0x5874ad?.[_0x55ca58(0xd8)]),'global':_0x3bcd11(_0x12f1e5)};const _0xf3087={...this[_0x55ca58(0x92)][_0x55ca58(0xcd)],...this[_0x55ca58(0x92)][_0x55ca58(0xd3)],...this[_0x55ca58(0x92)][_0x55ca58(0x99)]};process['env'][_0x55ca58(0x94)]&&!this[_0x55ca58(0x92)][_0x55ca58(0xbf)]['site']&&!this['layers']['cliFlags'][_0x55ca58(0xd6)]&&(_0xf3087[_0x55ca58(0xd6)]=process[_0x55ca58(0xc5)][_0x55ca58(0x94)]);Object[_0x55ca58(0xb1)](_0xf3087,this['layers'][_0x55ca58(0xbf)]),Object[_0x55ca58(0xb1)](_0xf3087,this[_0x55ca58(0x92)][_0x55ca58(0xb4)]);const _0x5e3629=_0xf3087[_0x55ca58(0xd6)]||_0x55ca58(0xab);this['site']=resolveSite(_0x5e3629),this[_0x55ca58(0x98)]=_0xf3087[_0x55ca58(0x98)],this[_0x55ca58(0xd4)]=_0xf3087['parent_segment'],this[_0x55ca58(0xa4)]=_0xf3087[_0x55ca58(0xa4)],this[_0x55ca58(0xb0)]=_0xf3087['llm_project'],this[_0x55ca58(0xc6)]=_0xf3087[_0x55ca58(0xc6)],this[_0x55ca58(0x96)]=_0xf3087[_0x55ca58(0x96)],this[_0x55ca58(0xc9)]=_0x364357[_0x55ca58(0xc9)]||![],this['logLevel']=_0x364357[_0x55ca58(0xa8)]??LogLevel[_0x55ca58(0x91)],this[_0x55ca58(0xd3)]=this[_0x55ca58(0x95)]||undefined,this[_0x55ca58(0xd5)]=getAPIKey(this[_0x55ca58(0xd6)],this[_0x55ca58(0x95)]||undefined);const _0x1717f3=getConfigDir(),_0x2170ab=a48_0xd2a5f1['join'](_0x1717f3,_0x55ca58(0xce),this[_0x55ca58(0xcc)]+'.json'),_0x11bcc1=findProjectConfigPath(),_0x175e38=a48_0xd2a5f1['join'](_0x1717f3,_0x55ca58(0xa2)),_0x437aab=a48_0xd2a5f1['join'](_0x1717f3,'.env');let _0x2ed089=null,_0x1ba9b9=null;this[_0x55ca58(0x95)]&&(_0x2ed089=a48_0xd2a5f1[_0x55ca58(0xb3)](_0x1717f3,'profiles',this[_0x55ca58(0x95)],'tdx.json'),_0x1ba9b9=a48_0xd2a5f1['join'](_0x1717f3,_0x55ca58(0x9e),this[_0x55ca58(0x95)],_0x55ca58(0xba))),this[_0x55ca58(0xd0)]={'session':a48_0x470e79[_0x55ca58(0xd1)](_0x2170ab)?_0x2170ab:null,'project':_0x11bcc1,'profile':_0x2ed089&&a48_0x470e79[_0x55ca58(0xd1)](_0x2ed089)?_0x2ed089:null,'profileCredentials':_0x1ba9b9&&a48_0x470e79[_0x55ca58(0xd1)](_0x1ba9b9)?_0x1ba9b9:null,'global':a48_0x470e79[_0x55ca58(0xd1)](_0x175e38)?_0x175e38:null,'globalCredentials':a48_0x470e79[_0x55ca58(0xd1)](_0x437aab)?_0x437aab:null};}[a48_0x1fc5d1(0xa6)](_0xb4c45c,_0x56e268){const _0x5174c4=a48_0x1fc5d1;if(!_0x56e268)return _0x5174c4(0xb9);const _0x3019f1=_0x56e268;if(this[_0x5174c4(0x92)][_0x5174c4(0xb4)][_0xb4c45c]===_0x3019f1){if(_0xb4c45c===_0x5174c4(0xd6)&&_0x3019f1===_0x5174c4(0xab)&&!this[_0x5174c4(0x92)][_0x5174c4(0xbf)][_0x5174c4(0xd6)]&&!this[_0x5174c4(0x92)]['project'][_0x5174c4(0xd6)]&&!this[_0x5174c4(0x92)][_0x5174c4(0xd3)][_0x5174c4(0xd6)]&&!this[_0x5174c4(0x92)][_0x5174c4(0xcd)][_0x5174c4(0xd6)])return _0x5174c4(0x9f);return'CLI\x20flag:\x20--'+_0xb4c45c['replace'](/_/g,'-');}if(this['layers'][_0x5174c4(0xbf)][_0xb4c45c]===_0x3019f1)return _0x5174c4(0xbf);if(this['layers'][_0x5174c4(0x99)][_0xb4c45c]===_0x3019f1)return _0x5174c4(0x99);if(this[_0x5174c4(0x92)]['profile'][_0xb4c45c]===_0x3019f1)return _0x5174c4(0x97)+this[_0x5174c4(0x95)];if(this[_0x5174c4(0x92)]['global'][_0xb4c45c]===_0x3019f1)return'global';return _0x5174c4(0x9f);}[a48_0x1fc5d1(0xd7)](){const _0x4916a2=a48_0x1fc5d1,_0x530720=a48_0xd2a5f1['join'](getConfigDir(),_0x4916a2(0xa2));if(!a48_0x470e79[_0x4916a2(0xd1)](_0x530720))return{};try{const _0x422f60=a48_0x470e79['readFileSync'](_0x530720,'utf-8');return JSON[_0x4916a2(0x9c)](_0x422f60);}catch{return{};}}['injectIntoOptions'](_0x171615){const _0x348ce7=a48_0x1fc5d1;_0x171615[_0x348ce7(0xd6)]=this['site'],!_0x171615[_0x348ce7(0x98)]&&this['database']&&(_0x171615['database']=this['database']),!_0x171615['parentSegment']&&this[_0x348ce7(0xd4)]&&(_0x171615['parentSegment']=this[_0x348ce7(0xd4)]),!_0x171615[_0x348ce7(0xc0)]&&this[_0x348ce7(0xa4)]&&(_0x171615[_0x348ce7(0xc0)]=this[_0x348ce7(0xa4)]),!_0x171615[_0x348ce7(0xd9)]&&this[_0x348ce7(0xb0)]&&(_0x171615['llmProject']=this[_0x348ce7(0xb0)]),!_0x171615[_0x348ce7(0xa3)]&&this[_0x348ce7(0xc6)]&&(_0x171615[_0x348ce7(0xa3)]=this[_0x348ce7(0xc6)]),!_0x171615[_0x348ce7(0xc2)]&&this['workflow_project']&&(_0x171615['workflowProject']=this[_0x348ce7(0x96)]);}[a48_0x1fc5d1(0xa9)](){const _0x4e9880=a48_0x1fc5d1;return[{'key':_0x4e9880(0xd6),'value':this['site']},{'key':'database','value':this[_0x4e9880(0x98)]},{'key':_0x4e9880(0xd4),'value':this[_0x4e9880(0xd4)]},{'key':_0x4e9880(0xa4),'value':this[_0x4e9880(0xa4)]},{'key':_0x4e9880(0xb0),'value':this[_0x4e9880(0xb0)]},{'key':_0x4e9880(0xc6),'value':this[_0x4e9880(0xc6)]},{'key':_0x4e9880(0x96),'value':this[_0x4e9880(0x96)]},{'key':_0x4e9880(0xd3),'value':this[_0x4e9880(0x95)]||undefined}];}[a48_0x1fc5d1(0xa7)](){const _0x1825ca=a48_0x1fc5d1;console[_0x1825ca(0xa5)](_0x1825ca(0xad));for(const {key:_0x2e528f,value:_0x41cba1}of this[_0x1825ca(0xa9)]()){_0x41cba1&&console[_0x1825ca(0xa5)](_0x2e528f+':\x20'+_0x41cba1);}}[a48_0x1fc5d1(0xaa)](){const _0x175564=a48_0x1fc5d1;console[_0x175564(0xa5)]('[context]');for(const {key:_0x4bfc79,value:_0x148f74}of this[_0x175564(0xa9)]()){if(_0x148f74){const _0x2d01f5=_0x4bfc79==='profile'?_0x175564(0xcb):'('+this[_0x175564(0xa6)](_0x4bfc79,_0x148f74)+')';console['log'](_0x4bfc79+':\x20'+_0x148f74+'\x20'+_0x2d01f5);}}console['log'](_0x175564(0xb8));const _0xd327ce=[{'label':_0x175564(0xae),'path':this[_0x175564(0xd0)][_0x175564(0xbf)],'extra':_0x175564(0xb6)+this[_0x175564(0xcc)]+')'},{'label':'Project','path':this[_0x175564(0xd0)][_0x175564(0x99)]},{'label':_0x175564(0xbd),'path':this[_0x175564(0xd0)][_0x175564(0xd3)]},{'label':_0x175564(0xb2),'path':this['configFiles'][_0x175564(0xbc)]},{'label':'Global','path':this[_0x175564(0xd0)]['global']},{'label':_0x175564(0x9a),'path':this[_0x175564(0xd0)][_0x175564(0x9d)]}];for(const {label:_0x522efc,path:_0x3b24e3,extra:_0x350737}of _0xd327ce){if(_0x3b24e3)console[_0x175564(0xa5)](_0x522efc+':\x20'+_0x3b24e3+'\x20✓'+(_0x350737?'\x20'+_0x350737:''));else{if(_0x522efc===_0x175564(0xae))console['log'](_0x522efc+':\x20none\x20(using\x20session:\x20'+this[_0x175564(0xcc)]+')');else(_0x522efc==='Project'||_0x522efc===_0x175564(0xc1))&&console[_0x175564(0xa5)](_0x522efc+_0x175564(0xcf));}}}async[a48_0x1fc5d1(0xac)](){const _0x4d27e7=a48_0x1fc5d1;return this[_0x4d27e7(0xd5)]=await getAPIKeyAsync(this['site'],this[_0x4d27e7(0x95)]||undefined),this[_0x4d27e7(0xd5)];}static async[a48_0x1fc5d1(0xc8)](_0x4ab1b1){const _0x3d119c=a48_0x1fc5d1,_0x28e8c0=new GlobalContext(_0x4ab1b1);return await _0x28e8c0[_0x3d119c(0xac)](),_0x28e8c0;}}
1
+ const a48_0x432606=a48_0x445f;function a48_0x5d45(){const _0x4ac3f1=['Global','llm_agent','us01','parent_segment','(session:\x20','profile:\x20','Profile\x20Credentials','site','loadGlobalConfig','existsSync','.env','readFileSync','verbose','parse','124585cQidMF','CLI\x20flag:\x20--',':\x20none\x20(using\x20session:\x20','26734776BkuLUQ',':\x20none','sessions','1727193eHoEhb','replace','Project','database','INFO','displayWithSources','display','profileCredentials','profiles','utf-8','TDX_SITE','llmProject','assign','resolveAPIKeyAsync','toString','workflowProject','apiKey','10971936KBNcvj','2111606FjzCZV','workflow_project','segmentPath','sessionId','getSource','tdx.json','[context]','getParameters','2307476YbOFpd','.json','llmAgent','not\x20set','log','Session','string','project','global','llm_project','Profile','join','1252084MhdWcP','layers','env','logLevel','\x0a[configuration\x20files]','default','injectIntoOptions','profile','(active)','configFiles','session','parentSegment','1GLqKGc','segment_path','activeProfile'];a48_0x5d45=function(){return _0x4ac3f1;};return a48_0x5d45();}(function(_0xa8a7ab,_0x37b6cd){const _0x140ca6=a48_0x445f,_0x1a4fae=_0xa8a7ab();while(!![]){try{const _0x2aa209=-parseInt(_0x140ca6(0x1b2))/0x1*(parseInt(_0x140ca6(0x19a))/0x2)+parseInt(_0x140ca6(0x180))/0x3+parseInt(_0x140ca6(0x1a6))/0x4+parseInt(_0x140ca6(0x17a))/0x5+-parseInt(_0x140ca6(0x191))/0x6+-parseInt(_0x140ca6(0x192))/0x7+parseInt(_0x140ca6(0x17d))/0x8;if(_0x2aa209===_0x37b6cd)break;else _0x1a4fae['push'](_0x1a4fae['shift']());}catch(_0x324249){_0x1a4fae['push'](_0x1a4fae['shift']());}}}(a48_0x5d45,0xed2c8));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/tdx-logger.js';import*as a48_0x44b38c from'node:fs';import*as a48_0x55f5f8 from'node:path';function a48_0x445f(_0xbbd14a,_0x44528c){_0xbbd14a=_0xbbd14a-0x171;const _0x5d4532=a48_0x5d45();let _0x445f7a=_0x5d4532[_0xbbd14a];return _0x445f7a;}export class GlobalContext{[a48_0x432606(0x173)];[a48_0x432606(0x183)];[a48_0x432606(0x1b8)];['segment_path'];['llm_project'];[a48_0x432606(0x1b6)];[a48_0x432606(0x193)];[a48_0x432606(0x190)];[a48_0x432606(0x178)];[a48_0x432606(0x1a9)];[a48_0x432606(0x1ad)];[a48_0x432606(0x1a7)];[a48_0x432606(0x1b4)];[a48_0x432606(0x195)];['configFiles'];constructor(_0x45f279){const _0x5ea71c=a48_0x432606;this[_0x5ea71c(0x195)]=_0x45f279[_0x5ea71c(0x1b0)]||getCurrentSessionPID()[_0x5ea71c(0x18e)]();const _0xa14665=loadSessionContext(_0x45f279['session']),_0x16b08b=loadProjectConfig(),_0x37ece0=this[_0x5ea71c(0x174)]();this[_0x5ea71c(0x1b4)]=_0x45f279[_0x5ea71c(0x1ad)]||_0xa14665?.[_0x5ea71c(0x1ad)]||_0x37ece0['profile']||getActiveProfile();const _0x496694=this[_0x5ea71c(0x1b4)]?loadProfile(this[_0x5ea71c(0x1b4)]):null,_0x4306ab=_0x936e5c=>{const _0x31d29b=_0x5ea71c;if(!_0x936e5c)return{};const _0x980db8=_0x936e5c,_0x2e9cb4={};for(const [_0x322b3a,_0x45a769]of Object['entries'](_0x980db8)){typeof _0x45a769===_0x31d29b(0x1a0)&&(_0x2e9cb4[_0x322b3a]=_0x45a769);}return _0x2e9cb4;},_0x92c7ab={};if(_0x45f279['site']&&_0x45f279['site']!==_0x5ea71c(0x1b7))_0x92c7ab[_0x5ea71c(0x173)]=_0x45f279[_0x5ea71c(0x173)];const _0x28e46a=_0xa14665?.['database'],_0x1f5139=_0x16b08b?.['database'],_0x49bfc7=_0x496694?.['config']?.[_0x5ea71c(0x183)],_0x44a61c=_0x37ece0['database'];_0x45f279[_0x5ea71c(0x183)]&&(_0x45f279[_0x5ea71c(0x183)]!==_0x28e46a&&_0x45f279[_0x5ea71c(0x183)]!==_0x1f5139&&_0x45f279[_0x5ea71c(0x183)]!==_0x49bfc7&&_0x45f279[_0x5ea71c(0x183)]!==_0x44a61c)&&(_0x92c7ab[_0x5ea71c(0x183)]=_0x45f279[_0x5ea71c(0x183)]);if(_0x45f279[_0x5ea71c(0x1b1)])_0x92c7ab[_0x5ea71c(0x1b8)]=_0x45f279[_0x5ea71c(0x1b1)];if(_0x45f279[_0x5ea71c(0x18b)])_0x92c7ab[_0x5ea71c(0x1a3)]=_0x45f279[_0x5ea71c(0x18b)];if(_0x45f279['llmAgent'])_0x92c7ab[_0x5ea71c(0x1b6)]=_0x45f279[_0x5ea71c(0x19c)];if(_0x45f279[_0x5ea71c(0x1ad)])_0x92c7ab[_0x5ea71c(0x1ad)]=_0x45f279[_0x5ea71c(0x1ad)];this[_0x5ea71c(0x1a7)]={'cliFlags':_0x92c7ab,'session':_0x4306ab(_0xa14665),'project':_0x4306ab(_0x16b08b),'profile':_0x4306ab(_0x496694?.['config']),'global':_0x4306ab(_0x37ece0)};const _0x2feaf9={...this[_0x5ea71c(0x1a7)][_0x5ea71c(0x1a2)],...this[_0x5ea71c(0x1a7)][_0x5ea71c(0x1ad)],...this[_0x5ea71c(0x1a7)][_0x5ea71c(0x1a1)]};process[_0x5ea71c(0x1a8)][_0x5ea71c(0x18a)]&&!this[_0x5ea71c(0x1a7)][_0x5ea71c(0x1b0)][_0x5ea71c(0x173)]&&!this[_0x5ea71c(0x1a7)]['cliFlags']['site']&&(_0x2feaf9['site']=process['env']['TDX_SITE']);Object[_0x5ea71c(0x18c)](_0x2feaf9,this['layers'][_0x5ea71c(0x1b0)]),Object[_0x5ea71c(0x18c)](_0x2feaf9,this[_0x5ea71c(0x1a7)]['cliFlags']);const _0x53a7c9=_0x2feaf9['site']||_0x5ea71c(0x1b7);this['site']=resolveSite(_0x53a7c9),this[_0x5ea71c(0x183)]=_0x2feaf9[_0x5ea71c(0x183)],this['parent_segment']=_0x2feaf9[_0x5ea71c(0x1b8)],this['segment_path']=_0x2feaf9[_0x5ea71c(0x1b3)],this[_0x5ea71c(0x1a3)]=_0x2feaf9[_0x5ea71c(0x1a3)],this['llm_agent']=_0x2feaf9[_0x5ea71c(0x1b6)],this['workflow_project']=_0x2feaf9[_0x5ea71c(0x193)],this[_0x5ea71c(0x178)]=_0x45f279['verbose']||![],this[_0x5ea71c(0x1a9)]=_0x45f279[_0x5ea71c(0x1a9)]??LogLevel[_0x5ea71c(0x184)],this[_0x5ea71c(0x1ad)]=this[_0x5ea71c(0x1b4)]||undefined,this[_0x5ea71c(0x190)]=getAPIKey(this['site'],this[_0x5ea71c(0x1b4)]||undefined);const _0x56d12d=getConfigDir(),_0x4ae3fe=a48_0x55f5f8[_0x5ea71c(0x1a5)](_0x56d12d,_0x5ea71c(0x17f),this[_0x5ea71c(0x195)]+_0x5ea71c(0x19b)),_0x37672c=findProjectConfigPath(),_0x50af85=a48_0x55f5f8[_0x5ea71c(0x1a5)](_0x56d12d,_0x5ea71c(0x197)),_0x5e8ba8=a48_0x55f5f8['join'](_0x56d12d,_0x5ea71c(0x176));let _0x2a25ad=null,_0x1de0f2=null;this[_0x5ea71c(0x1b4)]&&(_0x2a25ad=a48_0x55f5f8[_0x5ea71c(0x1a5)](_0x56d12d,_0x5ea71c(0x188),this[_0x5ea71c(0x1b4)],'tdx.json'),_0x1de0f2=a48_0x55f5f8[_0x5ea71c(0x1a5)](_0x56d12d,_0x5ea71c(0x188),this['activeProfile'],_0x5ea71c(0x176))),this[_0x5ea71c(0x1af)]={'session':a48_0x44b38c[_0x5ea71c(0x175)](_0x4ae3fe)?_0x4ae3fe:null,'project':_0x37672c,'profile':_0x2a25ad&&a48_0x44b38c[_0x5ea71c(0x175)](_0x2a25ad)?_0x2a25ad:null,'profileCredentials':_0x1de0f2&&a48_0x44b38c['existsSync'](_0x1de0f2)?_0x1de0f2:null,'global':a48_0x44b38c[_0x5ea71c(0x175)](_0x50af85)?_0x50af85:null,'globalCredentials':a48_0x44b38c[_0x5ea71c(0x175)](_0x5e8ba8)?_0x5e8ba8:null};}[a48_0x432606(0x196)](_0x592e61,_0x22b83b){const _0x189995=a48_0x432606;if(!_0x22b83b)return _0x189995(0x19d);const _0xb0ba8=_0x22b83b;if(this['layers']['cliFlags'][_0x592e61]===_0xb0ba8){if(_0x592e61===_0x189995(0x173)&&_0xb0ba8===_0x189995(0x1b7)&&!this[_0x189995(0x1a7)][_0x189995(0x1b0)]['site']&&!this[_0x189995(0x1a7)][_0x189995(0x1a1)][_0x189995(0x173)]&&!this[_0x189995(0x1a7)]['profile'][_0x189995(0x173)]&&!this[_0x189995(0x1a7)]['global']['site'])return _0x189995(0x1ab);return _0x189995(0x17b)+_0x592e61[_0x189995(0x181)](/_/g,'-');}if(this[_0x189995(0x1a7)][_0x189995(0x1b0)][_0x592e61]===_0xb0ba8)return _0x189995(0x1b0);if(this[_0x189995(0x1a7)]['project'][_0x592e61]===_0xb0ba8)return _0x189995(0x1a1);if(this[_0x189995(0x1a7)][_0x189995(0x1ad)][_0x592e61]===_0xb0ba8)return _0x189995(0x171)+this['activeProfile'];if(this[_0x189995(0x1a7)]['global'][_0x592e61]===_0xb0ba8)return _0x189995(0x1a2);return _0x189995(0x1ab);}[a48_0x432606(0x174)](){const _0x5ba1df=a48_0x432606,_0x1f888c=a48_0x55f5f8[_0x5ba1df(0x1a5)](getConfigDir(),'tdx.json');if(!a48_0x44b38c[_0x5ba1df(0x175)](_0x1f888c))return{};try{const _0x533a1e=a48_0x44b38c[_0x5ba1df(0x177)](_0x1f888c,_0x5ba1df(0x189));return JSON[_0x5ba1df(0x179)](_0x533a1e);}catch{return{};}}[a48_0x432606(0x1ac)](_0x35b93a){const _0x3bd0b6=a48_0x432606;_0x35b93a[_0x3bd0b6(0x173)]=this['site'],!_0x35b93a['database']&&this['database']&&(_0x35b93a[_0x3bd0b6(0x183)]=this['database']),!_0x35b93a[_0x3bd0b6(0x1b1)]&&this[_0x3bd0b6(0x1b8)]&&(_0x35b93a[_0x3bd0b6(0x1b1)]=this[_0x3bd0b6(0x1b8)]),!_0x35b93a[_0x3bd0b6(0x194)]&&this['segment_path']&&(_0x35b93a[_0x3bd0b6(0x194)]=this[_0x3bd0b6(0x1b3)]),!_0x35b93a['llmProject']&&this[_0x3bd0b6(0x1a3)]&&(_0x35b93a['llmProject']=this[_0x3bd0b6(0x1a3)]),!_0x35b93a[_0x3bd0b6(0x19c)]&&this[_0x3bd0b6(0x1b6)]&&(_0x35b93a['llmAgent']=this[_0x3bd0b6(0x1b6)]),!_0x35b93a[_0x3bd0b6(0x18f)]&&this[_0x3bd0b6(0x193)]&&(_0x35b93a[_0x3bd0b6(0x18f)]=this['workflow_project']);}[a48_0x432606(0x199)](){const _0x216806=a48_0x432606;return[{'key':_0x216806(0x173),'value':this[_0x216806(0x173)]},{'key':_0x216806(0x183),'value':this[_0x216806(0x183)]},{'key':_0x216806(0x1b8),'value':this['parent_segment']},{'key':_0x216806(0x1b3),'value':this[_0x216806(0x1b3)]},{'key':_0x216806(0x1a3),'value':this['llm_project']},{'key':'llm_agent','value':this[_0x216806(0x1b6)]},{'key':_0x216806(0x193),'value':this['workflow_project']},{'key':_0x216806(0x1ad),'value':this[_0x216806(0x1b4)]||undefined}];}[a48_0x432606(0x186)](){const _0x1ef96f=a48_0x432606;console['log'](_0x1ef96f(0x198));for(const {key:_0xcb5a5b,value:_0x53ee96}of this['getParameters']()){_0x53ee96&&console['log'](_0xcb5a5b+':\x20'+_0x53ee96);}}[a48_0x432606(0x185)](){const _0x2e5589=a48_0x432606;console['log'](_0x2e5589(0x198));for(const {key:_0xd5d249,value:_0x4782bb}of this[_0x2e5589(0x199)]()){if(_0x4782bb){const _0x40c8bb=_0xd5d249==='profile'?_0x2e5589(0x1ae):'('+this[_0x2e5589(0x196)](_0xd5d249,_0x4782bb)+')';console[_0x2e5589(0x19e)](_0xd5d249+':\x20'+_0x4782bb+'\x20'+_0x40c8bb);}}console[_0x2e5589(0x19e)](_0x2e5589(0x1aa));const _0x4fe13a=[{'label':_0x2e5589(0x19f),'path':this[_0x2e5589(0x1af)][_0x2e5589(0x1b0)],'extra':_0x2e5589(0x1b9)+this['sessionId']+')'},{'label':_0x2e5589(0x182),'path':this[_0x2e5589(0x1af)]['project']},{'label':_0x2e5589(0x1a4),'path':this[_0x2e5589(0x1af)][_0x2e5589(0x1ad)]},{'label':_0x2e5589(0x172),'path':this[_0x2e5589(0x1af)][_0x2e5589(0x187)]},{'label':_0x2e5589(0x1b5),'path':this[_0x2e5589(0x1af)][_0x2e5589(0x1a2)]},{'label':'Global\x20Credentials','path':this[_0x2e5589(0x1af)]['globalCredentials']}];for(const {label:_0x36b8e6,path:_0x43fe4d,extra:_0x410055}of _0x4fe13a){if(_0x43fe4d)console['log'](_0x36b8e6+':\x20'+_0x43fe4d+'\x20✓'+(_0x410055?'\x20'+_0x410055:''));else{if(_0x36b8e6===_0x2e5589(0x19f))console[_0x2e5589(0x19e)](_0x36b8e6+_0x2e5589(0x17c)+this[_0x2e5589(0x195)]+')');else(_0x36b8e6==='Project'||_0x36b8e6===_0x2e5589(0x1b5))&&console[_0x2e5589(0x19e)](_0x36b8e6+_0x2e5589(0x17e));}}}async['resolveAPIKeyAsync'](){const _0x4356d1=a48_0x432606;return this[_0x4356d1(0x190)]=await getAPIKeyAsync(this[_0x4356d1(0x173)],this[_0x4356d1(0x1b4)]||undefined),this['apiKey'];}static async['createAsync'](_0x257e7b){const _0x4a0fc1=a48_0x432606,_0x2bfe12=new GlobalContext(_0x257e7b);return await _0x2bfe12[_0x4a0fc1(0x18d)](),_0x2bfe12;}}
@@ -1 +1 @@
1
- (function(_0x300227,_0x3e82c6){const _0x9cfc6a=a49_0x4f78,_0x532d15=_0x300227();while(!![]){try{const _0x29cce0=-parseInt(_0x9cfc6a(0x123))/0x1+-parseInt(_0x9cfc6a(0x109))/0x2+-parseInt(_0x9cfc6a(0x104))/0x3+-parseInt(_0x9cfc6a(0x11b))/0x4+parseInt(_0x9cfc6a(0x11a))/0x5*(parseInt(_0x9cfc6a(0x10a))/0x6)+-parseInt(_0x9cfc6a(0x10d))/0x7*(parseInt(_0x9cfc6a(0x10e))/0x8)+parseInt(_0x9cfc6a(0x114))/0x9*(parseInt(_0x9cfc6a(0x110))/0xa);if(_0x29cce0===_0x3e82c6)break;else _0x532d15['push'](_0x532d15['shift']());}catch(_0x2377c5){_0x532d15['push'](_0x532d15['shift']());}}}(a49_0xe37b,0x7f741));const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;async function getKeyring(){if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x4d3b9b=await import('@zowe/secrets-for-zowe-sdk');return keyringModule=_0x4d3b9b['keyring'],keyringModule;}catch(_0x59d983){return keyringLoadError=_0x59d983 instanceof Error?_0x59d983:new Error(String(_0x59d983)),null;}}function getAccountName(_0x592b2b){const _0x3209d2=a49_0x4f78,_0x47b464=_0x592b2b||'';return _0x3209d2(0x113)+_0x47b464+_0x3209d2(0x119);}function a49_0xe37b(){const _0x1a82f9=['not_found','access','133dOwYGU','164008CDejas','access_denied','10FbAcqA','cannot\x20find','toLowerCase','profile:','21983301bBaBHO','System\x20keychain\x20is\x20not\x20available','setPassword','-25300','not\x20supported',':api_key','5LBElfh','2869360JPPAMH','message','getPassword','reason','includes','success','could\x20not\x20be\x20found','not\x20available','77667whmCyk','not\x20found','320742fCJiIM','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.','value','error','deletePassword','1933822OcnEte','2026866FNEgfU'];a49_0xe37b=function(){return _0x1a82f9;};return a49_0xe37b();}export async function getKeychainAPIKey(_0x15ee56){const _0x4ef3f7=a49_0x4f78,_0x259fd7=await getKeychainAPIKeyWithStatus(_0x15ee56);if(_0x259fd7[_0x4ef3f7(0x120)])return _0x259fd7[_0x4ef3f7(0x106)];return _0x259fd7[_0x4ef3f7(0x11e)]===_0x4ef3f7(0x10f)&&console[_0x4ef3f7(0x107)]('Warning:\x20'+_0x259fd7[_0x4ef3f7(0x11c)]),null;}export async function getKeychainAPIKeyWithStatus(_0x17c049){const _0x4e846f=a49_0x4f78;try{const _0x386516=await getKeyring();if(!_0x386516)return{'success':![],'reason':'unavailable'};const _0x493785=getAccountName(_0x17c049),_0x43acaa=await _0x386516['getPassword'](SERVICE_NAME,_0x493785);if(_0x43acaa)return{'success':!![],'value':_0x43acaa};return{'success':![],'reason':'not_found'};}catch(_0x4eaa6e){const _0x5cab97=_0x4eaa6e instanceof Error?_0x4eaa6e[_0x4e846f(0x11c)]:String(_0x4eaa6e);if(_0x5cab97[_0x4e846f(0x11f)](_0x4e846f(0x117))||_0x5cab97['toLowerCase']()[_0x4e846f(0x11f)](_0x4e846f(0x121))||_0x5cab97[_0x4e846f(0x112)]()[_0x4e846f(0x11f)](_0x4e846f(0x103)))return{'success':![],'reason':_0x4e846f(0x10b)};if(_0x5cab97[_0x4e846f(0x11f)]('-25293')||_0x5cab97[_0x4e846f(0x112)]()[_0x4e846f(0x11f)]('restricted')||_0x5cab97[_0x4e846f(0x112)]()[_0x4e846f(0x11f)](_0x4e846f(0x10c)))return{'success':![],'reason':'access_denied','message':_0x4e846f(0x105)};return{'success':![],'reason':'unavailable','message':_0x5cab97};}}function a49_0x4f78(_0x4163ce,_0x367347){_0x4163ce=_0x4163ce-0x103;const _0xe37b89=a49_0xe37b();let _0x4f78d1=_0xe37b89[_0x4163ce];return _0x4f78d1;}export async function saveKeychainAPIKey(_0xee4baf,_0x531e20){const _0x5127b2=a49_0x4f78,_0x53d73e=await getKeyring();if(!_0x53d73e)throw new Error(_0x5127b2(0x115));const _0x3f460f=getAccountName(_0x531e20);await _0x53d73e[_0x5127b2(0x116)](SERVICE_NAME,_0x3f460f,_0xee4baf);}export async function deleteKeychainAPIKey(_0x4174d9){const _0x2bc041=a49_0x4f78;try{const _0x4470a7=await getKeyring();if(!_0x4470a7)return![];const _0x1936ae=getAccountName(_0x4174d9);return await _0x4470a7[_0x2bc041(0x108)](SERVICE_NAME,_0x1936ae);}catch{return![];}}export async function isKeychainAvailable(){const _0x18947b=a49_0x4f78;try{const _0x13f563=await getKeyring();if(!_0x13f563)return![];return await _0x13f563[_0x18947b(0x11d)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x4d7157){const _0x194a5f=_0x4d7157 instanceof Error?_0x4d7157[_0x18947b(0x11c)][_0x18947b(0x112)]():'';if(_0x194a5f[_0x18947b(0x11f)](_0x18947b(0x122))||_0x194a5f[_0x18947b(0x11f)](_0x18947b(0x118))||_0x194a5f[_0x18947b(0x11f)](_0x18947b(0x111)))return![];return!![];}}
1
+ const a49_0x210d64=a49_0x17b9;(function(_0x5c3d26,_0x2f0ba9){const _0x1e65a4=a49_0x17b9,_0x29cad8=_0x5c3d26();while(!![]){try{const _0x567e2c=parseInt(_0x1e65a4(0x13a))/0x1*(parseInt(_0x1e65a4(0x129))/0x2)+parseInt(_0x1e65a4(0x135))/0x3+parseInt(_0x1e65a4(0x136))/0x4+parseInt(_0x1e65a4(0x11e))/0x5+parseInt(_0x1e65a4(0x123))/0x6*(parseInt(_0x1e65a4(0x13d))/0x7)+-parseInt(_0x1e65a4(0x120))/0x8*(parseInt(_0x1e65a4(0x13f))/0x9)+parseInt(_0x1e65a4(0x130))/0xa*(-parseInt(_0x1e65a4(0x137))/0xb);if(_0x567e2c===_0x2f0ba9)break;else _0x29cad8['push'](_0x29cad8['shift']());}catch(_0x53d543){_0x29cad8['push'](_0x29cad8['shift']());}}}(a49_0x4c32,0x30a81));const SERVICE_NAME=a49_0x210d64(0x12e);function a49_0x17b9(_0x136703,_0x32291c){_0x136703=_0x136703-0x11a;const _0x4c3251=a49_0x4c32();let _0x17b965=_0x4c3251[_0x136703];return _0x17b965;}let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x55e8de=a49_0x210d64;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x1990cd=await import(_0x55e8de(0x128));return keyringModule=_0x1990cd[_0x55e8de(0x121)],keyringModule;}catch(_0x5e8f9d){return keyringLoadError=_0x5e8f9d instanceof Error?_0x5e8f9d:new Error(String(_0x5e8f9d)),null;}}function getAccountName(_0x2e680b){const _0x212d63=a49_0x210d64,_0x3e3b42=_0x2e680b||'';return _0x212d63(0x12b)+_0x3e3b42+_0x212d63(0x11a);}function a49_0x4c32(){const _0xf7b9f2=['includes','reason','@zowe/secrets-for-zowe-sdk','104cucyoP','restricted','profile:','__keychain_test__','not\x20supported','tdx','message','46940tHgnti','not\x20found','deletePassword','unavailable','access','1027587AKheGt','719236qbuozz','1529ysSHio','access_denied','could\x20not\x20be\x20found','30VmLbVN','cannot\x20find','toLowerCase','2309118qGZkXa','System\x20keychain\x20is\x20not\x20available','3090915hJQcbn',':api_key','getPassword','not\x20available','Warning:\x20','1707130uIMimR','setPassword','8huaiEL','keyring','error','6YaKjue','-25300','not_found'];a49_0x4c32=function(){return _0xf7b9f2;};return a49_0x4c32();}export async function getKeychainAPIKey(_0x18973d){const _0x578f7d=a49_0x210d64,_0x11138b=await getKeychainAPIKeyWithStatus(_0x18973d);if(_0x11138b['success'])return _0x11138b['value'];return _0x11138b[_0x578f7d(0x127)]===_0x578f7d(0x138)&&console[_0x578f7d(0x122)](_0x578f7d(0x11d)+_0x11138b[_0x578f7d(0x12f)]),null;}export async function getKeychainAPIKeyWithStatus(_0x184590){const _0x58fef1=a49_0x210d64;try{const _0x1024c1=await getKeyring();if(!_0x1024c1)return{'success':![],'reason':_0x58fef1(0x133)};const _0x1cfead=getAccountName(_0x184590),_0x34244c=await _0x1024c1[_0x58fef1(0x11b)](SERVICE_NAME,_0x1cfead);if(_0x34244c)return{'success':!![],'value':_0x34244c};return{'success':![],'reason':'not_found'};}catch(_0x2a4d4d){const _0x2b8251=_0x2a4d4d instanceof Error?_0x2a4d4d[_0x58fef1(0x12f)]:String(_0x2a4d4d);if(_0x2b8251[_0x58fef1(0x126)](_0x58fef1(0x124))||_0x2b8251[_0x58fef1(0x13c)]()[_0x58fef1(0x126)](_0x58fef1(0x139))||_0x2b8251[_0x58fef1(0x13c)]()[_0x58fef1(0x126)](_0x58fef1(0x131)))return{'success':![],'reason':_0x58fef1(0x125)};if(_0x2b8251[_0x58fef1(0x126)]('-25293')||_0x2b8251['toLowerCase']()[_0x58fef1(0x126)](_0x58fef1(0x12a))||_0x2b8251[_0x58fef1(0x13c)]()['includes'](_0x58fef1(0x134)))return{'success':![],'reason':_0x58fef1(0x138),'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':'unavailable','message':_0x2b8251};}}export async function saveKeychainAPIKey(_0x311b94,_0xd9912d){const _0x5ef9d3=a49_0x210d64,_0x44b335=await getKeyring();if(!_0x44b335)throw new Error(_0x5ef9d3(0x13e));const _0x46f9f1=getAccountName(_0xd9912d);await _0x44b335[_0x5ef9d3(0x11f)](SERVICE_NAME,_0x46f9f1,_0x311b94);}export async function deleteKeychainAPIKey(_0x268536){const _0x291e73=a49_0x210d64;try{const _0x4aedbc=await getKeyring();if(!_0x4aedbc)return![];const _0x275c8b=getAccountName(_0x268536);return await _0x4aedbc[_0x291e73(0x132)](SERVICE_NAME,_0x275c8b);}catch{return![];}}export async function isKeychainAvailable(){const _0x3d057a=a49_0x210d64;try{const _0x57876d=await getKeyring();if(!_0x57876d)return![];return await _0x57876d[_0x3d057a(0x11b)](SERVICE_NAME,_0x3d057a(0x12c)),!![];}catch(_0x2baeb3){const _0x314541=_0x2baeb3 instanceof Error?_0x2baeb3[_0x3d057a(0x12f)]['toLowerCase']():'';if(_0x314541[_0x3d057a(0x126)](_0x3d057a(0x11c))||_0x314541[_0x3d057a(0x126)](_0x3d057a(0x12d))||_0x314541[_0x3d057a(0x126)](_0x3d057a(0x13b)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x2cc239,_0x1a2b1a){const _0x798ea1=a50_0x32a8,_0x494d80=_0x2cc239();while(!![]){try{const _0x572096=parseInt(_0x798ea1(0xb0))/0x1*(-parseInt(_0x798ea1(0xdd))/0x2)+-parseInt(_0x798ea1(0x95))/0x3+-parseInt(_0x798ea1(0xdc))/0x4*(parseInt(_0x798ea1(0xc1))/0x5)+-parseInt(_0x798ea1(0xd3))/0x6+-parseInt(_0x798ea1(0xc3))/0x7*(-parseInt(_0x798ea1(0xc8))/0x8)+parseInt(_0x798ea1(0xb9))/0x9+parseInt(_0x798ea1(0xa6))/0xa*(parseInt(_0x798ea1(0xba))/0xb);if(_0x572096===_0x1a2b1a)break;else _0x494d80['push'](_0x494d80['shift']());}catch(_0x3ca684){_0x494d80['push'](_0x494d80['shift']());}}}(a50_0x32a0,0xb3df7));import*as a50_0x4a7f16 from'node:fs';import*as a50_0x1bc81c 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 function getProfileParams(_0xcaf7c1){const _0x29ea7c=a50_0x32a8,_0x3e9e29={};if(!_0xcaf7c1)return _0x3e9e29;for(const [_0x1c368b,_0x4f965f]of Object['entries'](_0xcaf7c1)){_0x1c368b!==_0x29ea7c(0xc9)&&_0x4f965f!==undefined&&(_0x3e9e29[_0x1c368b]=_0x4f965f);}return _0x3e9e29;}export function getProfilesDir(){const _0x150aa7=a50_0x32a8;return a50_0x1bc81c[_0x150aa7(0xaf)](getConfigDir(),'profiles');}function getProfileDir(_0x1a9870){const _0x10d804=a50_0x32a8;return a50_0x1bc81c[_0x10d804(0xaf)](getProfilesDir(),_0x1a9870);}function getProfileConfigPath(_0x16a73e){const _0x4ebbd4=a50_0x32a8;return a50_0x1bc81c[_0x4ebbd4(0xaf)](getProfileDir(_0x16a73e),_0x4ebbd4(0x91));}function a50_0x32a8(_0x2fceb4,_0x168c6a){_0x2fceb4=_0x2fceb4-0x91;const _0x32a0a0=a50_0x32a0();let _0x32a8a6=_0x32a0a0[_0x2fceb4];return _0x32a8a6;}function getProfileEnvPath(_0x5e8131){const _0xc20425=a50_0x32a8;return a50_0x1bc81c[_0xc20425(0xaf)](getProfileDir(_0x5e8131),'.env');}function getGlobalConfigPath(){const _0x45e4b5=a50_0x32a8;return a50_0x1bc81c[_0x45e4b5(0xaf)](getConfigDir(),_0x45e4b5(0x91));}function validateProfileName(_0xf29f41){const _0x947dd6=a50_0x32a8;if(!/^[a-zA-Z0-9_-]+$/[_0x947dd6(0xd0)](_0xf29f41))throw new Error(_0x947dd6(0x94)+_0xf29f41+_0x947dd6(0x9d));}function validateProfileConfig(_0x487de9,_0x2ab793){const _0x55bcfb=a50_0x32a8;if(typeof _0x487de9!=='object'||_0x487de9===null)throw new Error(_0x55bcfb(0xcf)+_0x2ab793+_0x55bcfb(0xa3));const _0x418260=[_0x55bcfb(0xc9),_0x55bcfb(0xb5),_0x55bcfb(0x9b),_0x55bcfb(0x9e),_0x55bcfb(0xb4),'llm_agent'],_0x4e3449=_0x487de9;for(const _0x15d336 of Object['keys'](_0x4e3449)){!_0x418260[_0x55bcfb(0xae)](_0x15d336)&&console['warn'](_0x55bcfb(0xcd)+_0x2ab793+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x15d336+_0x55bcfb(0xa9));}if(_0x4e3449[_0x55bcfb(0xc9)]!==undefined&&typeof _0x4e3449['description']!=='string')throw new Error(_0x55bcfb(0xcf)+_0x2ab793+_0x55bcfb(0xb8));if(_0x4e3449['site']!==undefined&&typeof _0x4e3449['site']!==_0x55bcfb(0xcb))throw new Error(_0x55bcfb(0xcf)+_0x2ab793+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x4e3449['database']!==undefined&&typeof _0x4e3449[_0x55bcfb(0x9b)]!==_0x55bcfb(0xcb))throw new Error(_0x55bcfb(0xcf)+_0x2ab793+_0x55bcfb(0xc5));if(_0x4e3449[_0x55bcfb(0x9e)]!==undefined&&typeof _0x4e3449[_0x55bcfb(0x9e)]!==_0x55bcfb(0xcb))throw new Error('Profile\x20\x27'+_0x2ab793+_0x55bcfb(0x92));if(_0x4e3449['llm_project']!==undefined&&typeof _0x4e3449[_0x55bcfb(0xb4)]!==_0x55bcfb(0xcb))throw new Error(_0x55bcfb(0xcf)+_0x2ab793+_0x55bcfb(0xe0));if(_0x4e3449[_0x55bcfb(0xda)]!==undefined&&typeof _0x4e3449['llm_agent']!==_0x55bcfb(0xcb))throw new Error(_0x55bcfb(0xcf)+_0x2ab793+_0x55bcfb(0xa7));return!![];}function loadProfilesFromTdxJson(_0x55aed8,_0x3bb643){const _0x32646b=a50_0x32a8;if(!a50_0x4a7f16[_0x32646b(0xdf)](_0x55aed8))return[];try{const _0x593dff=a50_0x4a7f16['readFileSync'](_0x55aed8,_0x32646b(0xa4)),_0x1088aa=JSON[_0x32646b(0xd5)](_0x593dff);if(!_0x1088aa[_0x32646b(0xb6)]||typeof _0x1088aa[_0x32646b(0xb6)]!==_0x32646b(0xa8))return[];const _0x1136be=[];for(const [_0x3ec8d6,_0x555c32]of Object[_0x32646b(0xc6)](_0x1088aa['profiles'])){try{validateProfileConfig(_0x555c32,_0x3ec8d6);const _0x36d385=getNewCredentialPath(_0x3ec8d6),_0x2c3165=getOldCredentialPath(_0x3ec8d6),_0x3260ac=a50_0x4a7f16[_0x32646b(0xdf)](_0x36d385)||a50_0x4a7f16[_0x32646b(0xdf)](_0x2c3165);_0x1136be[_0x32646b(0x99)]({'name':_0x3ec8d6,'config':_0x555c32,'metadata':{'name':_0x3ec8d6,'createdAt':new Date()[_0x32646b(0x98)]()},'hasCredentials':_0x3260ac,'scope':_0x3bb643});}catch(_0x5cb1a7){_0x5cb1a7 instanceof Error&&(console[_0x32646b(0xca)](_0x32646b(0xd6)+_0x55aed8+':'),console['warn']('\x20\x20'+_0x5cb1a7[_0x32646b(0xb3)]+'\x0a'));}}return _0x1136be;}catch(_0x3fab9c){return _0x3fab9c instanceof SyntaxError?(console[_0x32646b(0xca)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x55aed8+_0x32646b(0xd1)),console[_0x32646b(0xca)]('Error:\x20'+_0x3fab9c[_0x32646b(0xb3)]+'\x0a')):console[_0x32646b(0xca)](_0x32646b(0xc0)+_0x55aed8+':\x20'+_0x3fab9c+'\x0a'),[];}}export function getNewCredentialPath(_0x1d293d){const _0x2d11d0=a50_0x32a8;return a50_0x1bc81c[_0x2d11d0(0xaf)](getConfigDir(),_0x2d11d0(0xb2)+_0x1d293d);}function getOldCredentialPath(_0x27afbf){const _0x419e0a=a50_0x32a8;return a50_0x1bc81c['join'](getProfilesDir(),_0x27afbf,_0x419e0a(0xd7));}function loadProfilesFromTdxJsonFiles(){const _0x27388c=a50_0x32a8,_0x53b8bf=[],_0x487e5e=findProjectConfigPath();_0x487e5e&&_0x53b8bf[_0x27388c(0x99)](...loadProfilesFromTdxJson(_0x487e5e,_0x27388c(0xa5)));const _0x236ce0=a50_0x1bc81c[_0x27388c(0xaf)](getConfigDir(),_0x27388c(0x91));return _0x53b8bf['push'](...loadProfilesFromTdxJson(_0x236ce0,'user')),_0x53b8bf;}function loadProfilesFromDirectories(){const _0x4bdff6=a50_0x32a8,_0x4c5076=getProfilesDir();if(!a50_0x4a7f16['existsSync'](_0x4c5076))return[];try{return a50_0x4a7f16['readdirSync'](_0x4c5076,{'withFileTypes':!![]})[_0x4bdff6(0xde)](_0x3f6405=>_0x3f6405[_0x4bdff6(0xa0)]())[_0x4bdff6(0xbd)](_0x336b43=>_0x336b43['name'])[_0x4bdff6(0xde)](_0x3c5e87=>{const _0x536512=_0x4bdff6,_0x5c1a5b=getProfileConfigPath(_0x3c5e87),_0x3ba382=getProfileEnvPath(_0x3c5e87);return a50_0x4a7f16[_0x536512(0xdf)](_0x5c1a5b)||a50_0x4a7f16[_0x536512(0xdf)](_0x3ba382);})['map'](_0x24dfa2=>{const _0x433e49=loadProfileFromDirectory(_0x24dfa2);if(_0x433e49)return{..._0x433e49,'scope':'directory'};return null;})[_0x4bdff6(0xde)](_0xfd780=>_0xfd780!==null);}catch{return[];}}function loadProfileFromDirectory(_0x404b33){const _0x3d91d8=a50_0x32a8,_0x91c21f=getProfileConfigPath(_0x404b33),_0x5f3745=getOldCredentialPath(_0x404b33);if(!a50_0x4a7f16[_0x3d91d8(0xdf)](_0x91c21f)&&!a50_0x4a7f16[_0x3d91d8(0xdf)](_0x5f3745))return null;let _0x41fd58={},_0x29bf95={'name':_0x404b33,'createdAt':new Date()['toISOString']()};if(a50_0x4a7f16[_0x3d91d8(0xdf)](_0x91c21f))try{const _0x3934ca=a50_0x4a7f16['readFileSync'](_0x91c21f,'utf-8'),_0x5195b7=JSON[_0x3d91d8(0xd5)](_0x3934ca),{metadata:_0x551fa3,..._0x296eea}=_0x5195b7;_0x41fd58=_0x296eea,_0x551fa3&&(_0x29bf95=_0x551fa3);}catch{}return{'name':_0x404b33,'config':_0x41fd58,'metadata':_0x29bf95,'hasCredentials':a50_0x4a7f16['existsSync'](_0x5f3745),'scope':_0x3d91d8(0xa1)};}export function listProfiles(){const _0x2acb47=a50_0x32a8,_0x5d7d92=loadProfilesFromTdxJsonFiles(),_0x455166=loadProfilesFromDirectories();if(_0x455166[_0x2acb47(0xcc)]>0x0){const _0x4dc547=_0x455166[_0x2acb47(0xbd)](_0x31b0e5=>_0x31b0e5['name'])[_0x2acb47(0xaf)](',\x20'),_0x26ab00=getConfigDir();console[_0x2acb47(0xca)](_0x2acb47(0xad)+_0x4dc547),console[_0x2acb47(0xca)](_0x2acb47(0xd8)),console['warn']('\x20\x201.\x20Edit:\x20'+a50_0x1bc81c['join'](_0x26ab00,_0x2acb47(0x91))),console[_0x2acb47(0xca)](_0x2acb47(0xbf)),console[_0x2acb47(0xca)](_0x2acb47(0xdb));}const _0x17c202=[..._0x5d7d92,..._0x455166],_0x1ef147=new Map();for(const _0x228bdd of _0x17c202){!_0x1ef147[_0x2acb47(0xaa)](_0x228bdd[_0x2acb47(0xab)])&&_0x1ef147['set'](_0x228bdd['name'],_0x228bdd);}return Array['from'](_0x1ef147[_0x2acb47(0xd9)]())[_0x2acb47(0xc4)]((_0xd335a6,_0x5baab1)=>_0xd335a6[_0x2acb47(0xab)][_0x2acb47(0xac)](_0x5baab1['name']));}export function profileExists(_0x321592){const _0x3fe84e=a50_0x32a8,_0x135396=listProfiles();return _0x135396[_0x3fe84e(0xbc)](_0x353f53=>_0x353f53['name']===_0x321592);}export function loadProfile(_0x3fa2f2){const _0x239efb=a50_0x32a8;validateProfileName(_0x3fa2f2);const _0x7ae8d0=listProfiles(),_0x3b536f=_0x7ae8d0[_0x239efb(0xbe)](_0x2fd988=>_0x2fd988[_0x239efb(0xab)]===_0x3fa2f2);return _0x3b536f||null;}export function saveProfile(_0xf248eb,_0x5ef598,_0x31dba1=![]){saveProfileToUserConfig(_0xf248eb,_0x5ef598);}function a50_0x32a0(){const _0x3a80a0=['sort','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','entries',',\x20creating\x20new\x20file','864944oyteaF','description','warn','string','length','Warning:\x20Profile\x20\x27','TDX_PROFILE','Profile\x20\x27','test',':\x20Invalid\x20JSON\x20syntax','stringify','7339644OqxGky','rmSync','parse','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','.env','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','values','llm_agent','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','1172rZMYDE','29094MXXTDu','filter','existsSync','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','tdx.json','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x27\x20not\x20found\x20in\x20user\x20configuration','Invalid\x20profile\x20name:\x20','1697469HPvIlL','readFileSync','\x20does\x20not\x20exist','toISOString','push','Profile\x20','database','Failed\x20to\x20parse\x20','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','parent_segment','Warning:\x20Failed\x20to\x20parse\x20','isDirectory','directory','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20config\x20must\x20be\x20an\x20object','utf-8','local','2930DKNQQo','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','object','\x27\x20will\x20be\x20ignored','has','name','localeCompare','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','includes','join','25jqcOFg','env','.env.','message','llm_project','site','profiles','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','7586262ytojpD','57728PIHpcS','profile','some','map','find','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','6075AUWedC','\x22\x20\x22','56bswCGF'];a50_0x32a0=function(){return _0x3a80a0;};return a50_0x32a0();}export function deleteProfile(_0x554818){const _0x22a852=a50_0x32a8;validateProfileName(_0x554818);const _0x208582=getProfileDir(_0x554818);if(!a50_0x4a7f16['existsSync'](_0x208582))throw new Error(_0x22a852(0x9a)+_0x554818+'\x20does\x20not\x20exist');a50_0x4a7f16[_0x22a852(0xd4)](_0x208582,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x349490,_0x2834c4){const _0x1357bf=a50_0x32a8;validateProfileName(_0x349490);const _0x437ce7=getGlobalConfigPath(),_0x37e1ed=getConfigDir();!a50_0x4a7f16[_0x1357bf(0xdf)](_0x37e1ed)&&createSecureDirectory(_0x37e1ed);let _0x27e9fc={};if(a50_0x4a7f16[_0x1357bf(0xdf)](_0x437ce7))try{const _0x1d4cb7=a50_0x4a7f16[_0x1357bf(0x96)](_0x437ce7,'utf-8');_0x27e9fc=JSON[_0x1357bf(0xd5)](_0x1d4cb7);}catch{console[_0x1357bf(0xca)](_0x1357bf(0x9f)+_0x437ce7+_0x1357bf(0xc7));}!_0x27e9fc[_0x1357bf(0xb6)]&&(_0x27e9fc[_0x1357bf(0xb6)]={}),_0x27e9fc[_0x1357bf(0xb6)][_0x349490]=_0x2834c4,writeSecureFile(_0x437ce7,JSON['stringify'](_0x27e9fc,null,0x2));}export function removeProfileFromUserConfig(_0x40c8c9){const _0x5212bc=a50_0x32a8;validateProfileName(_0x40c8c9);const _0x1e51ab=getGlobalConfigPath();if(!a50_0x4a7f16['existsSync'](_0x1e51ab))throw new Error(_0x5212bc(0xcf)+_0x40c8c9+_0x5212bc(0x93));let _0x51f8f1={};try{const _0x180a68=a50_0x4a7f16['readFileSync'](_0x1e51ab,_0x5212bc(0xa4));_0x51f8f1=JSON['parse'](_0x180a68);}catch{throw new Error(_0x5212bc(0x9c)+_0x1e51ab);}if(!_0x51f8f1['profiles']||!_0x51f8f1[_0x5212bc(0xb6)][_0x40c8c9])throw new Error(_0x5212bc(0xcf)+_0x40c8c9+_0x5212bc(0x93));delete _0x51f8f1['profiles'][_0x40c8c9],_0x51f8f1[_0x5212bc(0xbb)]===_0x40c8c9&&delete _0x51f8f1[_0x5212bc(0xbb)],writeSecureFile(_0x1e51ab,JSON[_0x5212bc(0xd2)](_0x51f8f1,null,0x2));}export function getActiveProfile(){const _0xea1750=a50_0x32a8,_0x4d59b8=loadSessionContext();if(_0x4d59b8?.[_0xea1750(0xbb)])return _0x4d59b8[_0xea1750(0xbb)];if(process[_0xea1750(0xb1)]['TDX_PROFILE'])return process['env'][_0xea1750(0xce)];const _0x2964fa=getGlobalConfigPath();if(!a50_0x4a7f16[_0xea1750(0xdf)](_0x2964fa))return null;try{const _0x2396a9=a50_0x4a7f16[_0xea1750(0x96)](_0x2964fa,_0xea1750(0xa4)),_0x2a29d4=JSON[_0xea1750(0xd5)](_0x2396a9);return _0x2a29d4[_0xea1750(0xbb)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x459b05){const _0x1f24a3=a50_0x32a8,_0x110631=getGlobalConfigPath(),_0x2e3682=getConfigDir();!a50_0x4a7f16[_0x1f24a3(0xdf)](_0x2e3682)&&createSecureDirectory(_0x2e3682);let _0x1451f1={};if(a50_0x4a7f16[_0x1f24a3(0xdf)](_0x110631))try{const _0x4fafc=a50_0x4a7f16['readFileSync'](_0x110631,_0x1f24a3(0xa4));_0x1451f1=JSON[_0x1f24a3(0xd5)](_0x4fafc);}catch{console['warn'](_0x1f24a3(0x9f)+_0x110631+',\x20creating\x20new\x20file');}_0x1451f1[_0x1f24a3(0xb5)]=_0x459b05,writeSecureFile(_0x110631,JSON[_0x1f24a3(0xd2)](_0x1451f1,null,0x2));}export function saveActiveProfileToUserConfig(_0x146e53){const _0x44bb60=a50_0x32a8;validateProfileName(_0x146e53);const _0x9fa64a=getGlobalConfigPath(),_0x30a0f7=getConfigDir();!a50_0x4a7f16[_0x44bb60(0xdf)](_0x30a0f7)&&createSecureDirectory(_0x30a0f7);let _0x226f4e={};if(a50_0x4a7f16[_0x44bb60(0xdf)](_0x9fa64a))try{const _0x259314=a50_0x4a7f16[_0x44bb60(0x96)](_0x9fa64a,_0x44bb60(0xa4));_0x226f4e=JSON[_0x44bb60(0xd5)](_0x259314);}catch{console[_0x44bb60(0xca)](_0x44bb60(0x9f)+_0x9fa64a+_0x44bb60(0xc7));}_0x226f4e[_0x44bb60(0xbb)]=_0x146e53,writeSecureFile(_0x9fa64a,JSON[_0x44bb60(0xd2)](_0x226f4e,null,0x2));}function clearFieldFromUserConfig(_0x11b6fa){const _0x48d931=a50_0x32a8,_0xc84a01=getGlobalConfigPath();if(!a50_0x4a7f16['existsSync'](_0xc84a01))return;let _0x76e44e={};try{const _0x5d6c0f=a50_0x4a7f16[_0x48d931(0x96)](_0xc84a01,_0x48d931(0xa4));_0x76e44e=JSON[_0x48d931(0xd5)](_0x5d6c0f);}catch{return;}delete _0x76e44e[_0x11b6fa],writeSecureFile(_0xc84a01,JSON[_0x48d931(0xd2)](_0x76e44e,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x114ebe=a50_0x32a8;clearFieldFromUserConfig(_0x114ebe(0xb5));}export function clearActiveProfileFromUserConfig(){const _0x79670e=a50_0x32a8;clearFieldFromUserConfig(_0x79670e(0xbb));}export function createProfile(_0x2dfe77,_0xf0cff7){const _0x298e7c=a50_0x32a8;validateProfileName(_0x2dfe77);if(profileExists(_0x2dfe77))throw new Error(_0x298e7c(0x9a)+_0x2dfe77+'\x20already\x20exists');saveProfile(_0x2dfe77,_0xf0cff7);}export function saveProfileCredentials(_0x19bff0,_0x2e53cc){const _0x5d2dff=a50_0x32a8;validateProfileName(_0x19bff0);if(!profileExists(_0x19bff0))throw new Error(_0x5d2dff(0x9a)+_0x19bff0+_0x5d2dff(0x97));const _0x50590b=getNewCredentialPath(_0x19bff0);writeSecureFile(_0x50590b,_0x2e53cc);}export function loadProfileCredentials(_0x2b489a){const _0x1972aa=a50_0x32a8;validateProfileName(_0x2b489a);const _0x591a8e=getNewCredentialPath(_0x2b489a);if(a50_0x4a7f16[_0x1972aa(0xdf)](_0x591a8e))try{return a50_0x4a7f16[_0x1972aa(0x96)](_0x591a8e,_0x1972aa(0xa4));}catch{}const _0x58436c=getOldCredentialPath(_0x2b489a);if(a50_0x4a7f16[_0x1972aa(0xdf)](_0x58436c)){console[_0x1972aa(0xca)](_0x1972aa(0xa2)+_0x2b489a+'\x27'),console['warn']('To\x20migrate:'),console[_0x1972aa(0xca)]('\x20\x20mv\x20\x22'+_0x58436c+_0x1972aa(0xc2)+_0x591a8e+'\x22'),console[_0x1972aa(0xca)](_0x1972aa(0xb7));try{return a50_0x4a7f16[_0x1972aa(0x96)](_0x58436c,_0x1972aa(0xa4));}catch{return null;}}return null;}
1
+ (function(_0x723e2b,_0x131f77){const _0x1875f0=a50_0x2db0,_0x5615cb=_0x723e2b();while(!![]){try{const _0x1b1bc7=parseInt(_0x1875f0(0xd7))/0x1+parseInt(_0x1875f0(0xab))/0x2+parseInt(_0x1875f0(0xba))/0x3+-parseInt(_0x1875f0(0xb5))/0x4*(-parseInt(_0x1875f0(0xbb))/0x5)+parseInt(_0x1875f0(0xc0))/0x6+-parseInt(_0x1875f0(0xbe))/0x7+-parseInt(_0x1875f0(0xbc))/0x8;if(_0x1b1bc7===_0x131f77)break;else _0x5615cb['push'](_0x5615cb['shift']());}catch(_0x232bd9){_0x5615cb['push'](_0x5615cb['shift']());}}}(a50_0xaf0c,0x59aa6));import*as a50_0x268b8c from'node:fs';import*as a50_0x5ed16c 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 function getProfileParams(_0x5133bf){const _0x52425b=a50_0x2db0,_0x59d1a1={};if(!_0x5133bf)return _0x59d1a1;for(const [_0x490d25,_0x3c056c]of Object[_0x52425b(0xb6)](_0x5133bf)){_0x490d25!==_0x52425b(0xd0)&&_0x3c056c!==undefined&&(_0x59d1a1[_0x490d25]=_0x3c056c);}return _0x59d1a1;}export function getProfilesDir(){const _0x45ded5=a50_0x2db0;return a50_0x5ed16c[_0x45ded5(0xd8)](getConfigDir(),'profiles');}function getProfileDir(_0x537141){const _0x2f33a5=a50_0x2db0;return a50_0x5ed16c[_0x2f33a5(0xd8)](getProfilesDir(),_0x537141);}function getProfileConfigPath(_0x3e8eca){const _0x4c5983=a50_0x2db0;return a50_0x5ed16c[_0x4c5983(0xd8)](getProfileDir(_0x3e8eca),'tdx.json');}function getProfileEnvPath(_0x38785a){const _0x302bff=a50_0x2db0;return a50_0x5ed16c[_0x302bff(0xd8)](getProfileDir(_0x38785a),_0x302bff(0xe0));}function getGlobalConfigPath(){const _0x552ddc=a50_0x2db0;return a50_0x5ed16c[_0x552ddc(0xd8)](getConfigDir(),_0x552ddc(0xc8));}function validateProfileName(_0x235ddd){const _0x5803b9=a50_0x2db0;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x235ddd))throw new Error('Invalid\x20profile\x20name:\x20'+_0x235ddd+_0x5803b9(0xca));}function validateProfileConfig(_0x5858e1,_0x24b280){const _0x202295=a50_0x2db0;if(typeof _0x5858e1!==_0x202295(0xaf)||_0x5858e1===null)throw new Error(_0x202295(0xb4)+_0x24b280+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x4565bf=[_0x202295(0xd0),_0x202295(0xc2),'database',_0x202295(0xa5),_0x202295(0xaa),_0x202295(0xd4)],_0x4e49be=_0x5858e1;for(const _0x5b8a88 of Object[_0x202295(0x99)](_0x4e49be)){!_0x4565bf[_0x202295(0xdf)](_0x5b8a88)&&console[_0x202295(0xc7)]('Warning:\x20Profile\x20\x27'+_0x24b280+_0x202295(0xa2)+_0x5b8a88+_0x202295(0xae));}if(_0x4e49be[_0x202295(0xd0)]!==undefined&&typeof _0x4e49be['description']!==_0x202295(0xcb))throw new Error('Profile\x20\x27'+_0x24b280+_0x202295(0xc4));if(_0x4e49be['site']!==undefined&&typeof _0x4e49be[_0x202295(0xc2)]!==_0x202295(0xcb))throw new Error('Profile\x20\x27'+_0x24b280+_0x202295(0xb7));if(_0x4e49be['database']!==undefined&&typeof _0x4e49be[_0x202295(0xc5)]!==_0x202295(0xcb))throw new Error(_0x202295(0xb4)+_0x24b280+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x4e49be['parent_segment']!==undefined&&typeof _0x4e49be[_0x202295(0xa5)]!==_0x202295(0xcb))throw new Error(_0x202295(0xb4)+_0x24b280+_0x202295(0xa4));if(_0x4e49be[_0x202295(0xaa)]!==undefined&&typeof _0x4e49be[_0x202295(0xaa)]!==_0x202295(0xcb))throw new Error(_0x202295(0xb4)+_0x24b280+_0x202295(0xcd));if(_0x4e49be['llm_agent']!==undefined&&typeof _0x4e49be[_0x202295(0xd4)]!==_0x202295(0xcb))throw new Error('Profile\x20\x27'+_0x24b280+_0x202295(0xad));return!![];}function loadProfilesFromTdxJson(_0x29f960,_0xd0eaf9){const _0x29d207=a50_0x2db0;if(!a50_0x268b8c[_0x29d207(0xe5)](_0x29f960))return[];try{const _0x355c83=a50_0x268b8c[_0x29d207(0xb8)](_0x29f960,_0x29d207(0xce)),_0xfac4a5=JSON[_0x29d207(0x9a)](_0x355c83);if(!_0xfac4a5[_0x29d207(0x9e)]||typeof _0xfac4a5['profiles']!=='object')return[];const _0x46d3e1=[];for(const [_0x534164,_0x3501ee]of Object[_0x29d207(0xb6)](_0xfac4a5[_0x29d207(0x9e)])){try{validateProfileConfig(_0x3501ee,_0x534164);const _0x4e0fa0=getNewCredentialPath(_0x534164),_0x593452=getOldCredentialPath(_0x534164),_0x5d18a2=a50_0x268b8c[_0x29d207(0xe5)](_0x4e0fa0)||a50_0x268b8c['existsSync'](_0x593452);_0x46d3e1['push']({'name':_0x534164,'config':_0x3501ee,'metadata':{'name':_0x534164,'createdAt':new Date()[_0x29d207(0xdd)]()},'hasCredentials':_0x5d18a2,'scope':_0xd0eaf9});}catch(_0x21d4ca){_0x21d4ca instanceof Error&&(console[_0x29d207(0xc7)](_0x29d207(0xb0)+_0x29f960+':'),console['warn']('\x20\x20'+_0x21d4ca[_0x29d207(0xc3)]+'\x0a'));}}return _0x46d3e1;}catch(_0x6acbdb){return _0x6acbdb instanceof SyntaxError?(console['warn'](_0x29d207(0xe4)+_0x29f960+_0x29d207(0xe3)),console['warn'](_0x29d207(0xc9)+_0x6acbdb['message']+'\x0a')):console['warn'](_0x29d207(0xd5)+_0x29f960+':\x20'+_0x6acbdb+'\x0a'),[];}}export function getNewCredentialPath(_0x3c6ced){const _0x1dd7a9=a50_0x2db0;return a50_0x5ed16c[_0x1dd7a9(0xd8)](getConfigDir(),_0x1dd7a9(0xdb)+_0x3c6ced);}function getOldCredentialPath(_0x31e26e){const _0x30016c=a50_0x2db0;return a50_0x5ed16c['join'](getProfilesDir(),_0x31e26e,_0x30016c(0xe0));}function loadProfilesFromTdxJsonFiles(){const _0x1bf166=a50_0x2db0,_0x563566=[],_0x531527=findProjectConfigPath();_0x531527&&_0x563566['push'](...loadProfilesFromTdxJson(_0x531527,_0x1bf166(0x9b)));const _0x51ef41=a50_0x5ed16c['join'](getConfigDir(),_0x1bf166(0xc8));return _0x563566['push'](...loadProfilesFromTdxJson(_0x51ef41,'user')),_0x563566;}function loadProfilesFromDirectories(){const _0x1d77ab=a50_0x2db0,_0x34efc4=getProfilesDir();if(!a50_0x268b8c[_0x1d77ab(0xe5)](_0x34efc4))return[];try{return a50_0x268b8c[_0x1d77ab(0xa8)](_0x34efc4,{'withFileTypes':!![]})['filter'](_0x1375a5=>_0x1375a5[_0x1d77ab(0xc1)]())[_0x1d77ab(0xb1)](_0x24cef1=>_0x24cef1['name'])[_0x1d77ab(0xcc)](_0x5a31f8=>{const _0x12bc07=_0x1d77ab,_0x439c67=getProfileConfigPath(_0x5a31f8),_0x4dfddf=getProfileEnvPath(_0x5a31f8);return a50_0x268b8c[_0x12bc07(0xe5)](_0x439c67)||a50_0x268b8c[_0x12bc07(0xe5)](_0x4dfddf);})[_0x1d77ab(0xb1)](_0x4e7c55=>{const _0x181dc8=_0x1d77ab,_0x5e2baa=loadProfileFromDirectory(_0x4e7c55);if(_0x5e2baa)return{..._0x5e2baa,'scope':_0x181dc8(0xb2)};return null;})[_0x1d77ab(0xcc)](_0x208354=>_0x208354!==null);}catch{return[];}}function loadProfileFromDirectory(_0x348f3b){const _0x1c3f77=a50_0x2db0,_0x1af1a3=getProfileConfigPath(_0x348f3b),_0x47e2c4=getOldCredentialPath(_0x348f3b);if(!a50_0x268b8c[_0x1c3f77(0xe5)](_0x1af1a3)&&!a50_0x268b8c['existsSync'](_0x47e2c4))return null;let _0x4987cf={},_0x431080={'name':_0x348f3b,'createdAt':new Date()[_0x1c3f77(0xdd)]()};if(a50_0x268b8c[_0x1c3f77(0xe5)](_0x1af1a3))try{const _0x2612fa=a50_0x268b8c[_0x1c3f77(0xb8)](_0x1af1a3,_0x1c3f77(0xce)),_0x252bd0=JSON[_0x1c3f77(0x9a)](_0x2612fa),{metadata:_0x39418f,..._0x174e10}=_0x252bd0;_0x4987cf=_0x174e10,_0x39418f&&(_0x431080=_0x39418f);}catch{}return{'name':_0x348f3b,'config':_0x4987cf,'metadata':_0x431080,'hasCredentials':a50_0x268b8c[_0x1c3f77(0xe5)](_0x47e2c4),'scope':_0x1c3f77(0xb2)};}export function listProfiles(){const _0x30863a=a50_0x2db0,_0x21ae98=loadProfilesFromTdxJsonFiles(),_0x595d15=loadProfilesFromDirectories();if(_0x595d15[_0x30863a(0xe2)]>0x0){const _0x51d600=_0x595d15[_0x30863a(0xb1)](_0x8d96ac=>_0x8d96ac[_0x30863a(0xb3)])[_0x30863a(0xd8)](',\x20'),_0x23de3a=getConfigDir();console['warn'](_0x30863a(0xd2)+_0x51d600),console[_0x30863a(0xc7)](_0x30863a(0xbd)),console[_0x30863a(0xc7)](_0x30863a(0xe6)+a50_0x5ed16c[_0x30863a(0xd8)](_0x23de3a,_0x30863a(0xc8))),console[_0x30863a(0xc7)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x30863a(0xc7)](_0x30863a(0xbf));}const _0x300045=[..._0x21ae98,..._0x595d15],_0x53d6fc=new Map();for(const _0x249f4d of _0x300045){!_0x53d6fc[_0x30863a(0xa1)](_0x249f4d[_0x30863a(0xb3)])&&_0x53d6fc[_0x30863a(0xdc)](_0x249f4d[_0x30863a(0xb3)],_0x249f4d);}return Array[_0x30863a(0xac)](_0x53d6fc[_0x30863a(0xc6)]())['sort']((_0x52fd0b,_0x5c7df7)=>_0x52fd0b[_0x30863a(0xb3)]['localeCompare'](_0x5c7df7[_0x30863a(0xb3)]));}export function profileExists(_0x19b0dc){const _0x496848=a50_0x2db0,_0x5b979e=listProfiles();return _0x5b979e[_0x496848(0xa6)](_0x132960=>_0x132960[_0x496848(0xb3)]===_0x19b0dc);}export function loadProfile(_0x5343cf){const _0x4744f1=a50_0x2db0;validateProfileName(_0x5343cf);const _0x1f3f21=listProfiles(),_0x348189=_0x1f3f21[_0x4744f1(0xa7)](_0xb9b494=>_0xb9b494['name']===_0x5343cf);return _0x348189||null;}export function saveProfile(_0x244b1a,_0x450f17,_0x1581f0=![]){saveProfileToUserConfig(_0x244b1a,_0x450f17);}export function deleteProfile(_0xb8065c){const _0x1151a5=a50_0x2db0;validateProfileName(_0xb8065c);const _0x5dec55=getProfileDir(_0xb8065c);if(!a50_0x268b8c[_0x1151a5(0xe5)](_0x5dec55))throw new Error('Profile\x20'+_0xb8065c+'\x20does\x20not\x20exist');a50_0x268b8c[_0x1151a5(0xd6)](_0x5dec55,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0xea80ac,_0x482526){const _0x13e602=a50_0x2db0;validateProfileName(_0xea80ac);const _0x31e242=getGlobalConfigPath(),_0x2da29c=getConfigDir();!a50_0x268b8c[_0x13e602(0xe5)](_0x2da29c)&&createSecureDirectory(_0x2da29c);let _0x4f8ec5={};if(a50_0x268b8c[_0x13e602(0xe5)](_0x31e242))try{const _0x3b1082=a50_0x268b8c[_0x13e602(0xb8)](_0x31e242,_0x13e602(0xce));_0x4f8ec5=JSON['parse'](_0x3b1082);}catch{console[_0x13e602(0xc7)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x31e242+_0x13e602(0x9d));}!_0x4f8ec5[_0x13e602(0x9e)]&&(_0x4f8ec5[_0x13e602(0x9e)]={}),_0x4f8ec5[_0x13e602(0x9e)][_0xea80ac]=_0x482526,writeSecureFile(_0x31e242,JSON[_0x13e602(0xde)](_0x4f8ec5,null,0x2));}function a50_0x2db0(_0x369087,_0x146fc8){_0x369087=_0x369087-0x99;const _0xaf0cfa=a50_0xaf0c();let _0x2db055=_0xaf0cfa[_0x369087];return _0x2db055;}export function removeProfileFromUserConfig(_0x52684c){const _0x11f14a=a50_0x2db0;validateProfileName(_0x52684c);const _0x55ca4d=getGlobalConfigPath();if(!a50_0x268b8c[_0x11f14a(0xe5)](_0x55ca4d))throw new Error(_0x11f14a(0xb4)+_0x52684c+_0x11f14a(0xa0));let _0x4fe62b={};try{const _0x2c24cd=a50_0x268b8c[_0x11f14a(0xb8)](_0x55ca4d,'utf-8');_0x4fe62b=JSON[_0x11f14a(0x9a)](_0x2c24cd);}catch{throw new Error(_0x11f14a(0xd9)+_0x55ca4d);}if(!_0x4fe62b[_0x11f14a(0x9e)]||!_0x4fe62b[_0x11f14a(0x9e)][_0x52684c])throw new Error('Profile\x20\x27'+_0x52684c+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x4fe62b['profiles'][_0x52684c],_0x4fe62b['profile']===_0x52684c&&delete _0x4fe62b[_0x11f14a(0x9f)],writeSecureFile(_0x55ca4d,JSON['stringify'](_0x4fe62b,null,0x2));}export function getActiveProfile(){const _0x5d1045=a50_0x2db0,_0x46b71b=loadSessionContext();if(_0x46b71b?.[_0x5d1045(0x9f)])return _0x46b71b[_0x5d1045(0x9f)];if(process[_0x5d1045(0xcf)][_0x5d1045(0xd1)])return process[_0x5d1045(0xcf)][_0x5d1045(0xd1)];const _0x35aebf=getGlobalConfigPath();if(!a50_0x268b8c['existsSync'](_0x35aebf))return null;try{const _0x15bc78=a50_0x268b8c[_0x5d1045(0xb8)](_0x35aebf,_0x5d1045(0xce)),_0x940b07=JSON[_0x5d1045(0x9a)](_0x15bc78);return _0x940b07[_0x5d1045(0x9f)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x4ae83c){const _0x52dc99=a50_0x2db0,_0x2faf2a=getGlobalConfigPath(),_0x14ef5b=getConfigDir();!a50_0x268b8c[_0x52dc99(0xe5)](_0x14ef5b)&&createSecureDirectory(_0x14ef5b);let _0x70432a={};if(a50_0x268b8c[_0x52dc99(0xe5)](_0x2faf2a))try{const _0x471c88=a50_0x268b8c[_0x52dc99(0xb8)](_0x2faf2a,_0x52dc99(0xce));_0x70432a=JSON['parse'](_0x471c88);}catch{console[_0x52dc99(0xc7)](_0x52dc99(0x9c)+_0x2faf2a+_0x52dc99(0x9d));}_0x70432a[_0x52dc99(0xc2)]=_0x4ae83c,writeSecureFile(_0x2faf2a,JSON['stringify'](_0x70432a,null,0x2));}function a50_0xaf0c(){const _0x24b7ef=['Error:\x20','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','string','filter','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','utf-8','env','description','TDX_PROFILE','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x20\x20mv\x20\x22','llm_agent','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','rmSync','289892cDVYOC','join','Failed\x20to\x20parse\x20','\x22\x20\x22','.env.','set','toISOString','stringify','includes','.env','Profile\x20','length',':\x20Invalid\x20JSON\x20syntax','\x0aWarning:\x20Failed\x20to\x20parse\x20','existsSync','\x20\x201.\x20Edit:\x20','keys','parse','local','Warning:\x20Failed\x20to\x20parse\x20',',\x20creating\x20new\x20file','profiles','profile','\x27\x20not\x20found\x20in\x20user\x20configuration','has','\x27:\x20unknown\x20config\x20key\x20\x27','To\x20migrate:','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','parent_segment','some','find','readdirSync','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','llm_project','825784iMeRbR','from','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x27\x20will\x20be\x20ignored','object','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','map','directory','name','Profile\x20\x27','1456900TiRLBy','entries','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','readFileSync','\x20already\x20exists','1597656nPNuFR','10vgSQFQ','14503760sogAJz','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','791469yWOFCf','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','1977126EwtDaE','isDirectory','site','message','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','database','values','warn','tdx.json'];a50_0xaf0c=function(){return _0x24b7ef;};return a50_0xaf0c();}export function saveActiveProfileToUserConfig(_0x15d8c3){const _0x127741=a50_0x2db0;validateProfileName(_0x15d8c3);const _0x4977d6=getGlobalConfigPath(),_0x769d44=getConfigDir();!a50_0x268b8c[_0x127741(0xe5)](_0x769d44)&&createSecureDirectory(_0x769d44);let _0x5d65e9={};if(a50_0x268b8c[_0x127741(0xe5)](_0x4977d6))try{const _0xe5c4c9=a50_0x268b8c[_0x127741(0xb8)](_0x4977d6,_0x127741(0xce));_0x5d65e9=JSON[_0x127741(0x9a)](_0xe5c4c9);}catch{console[_0x127741(0xc7)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x4977d6+',\x20creating\x20new\x20file');}_0x5d65e9['profile']=_0x15d8c3,writeSecureFile(_0x4977d6,JSON[_0x127741(0xde)](_0x5d65e9,null,0x2));}function clearFieldFromUserConfig(_0x2ea701){const _0x5a4fb4=a50_0x2db0,_0x58a8fe=getGlobalConfigPath();if(!a50_0x268b8c['existsSync'](_0x58a8fe))return;let _0x4b74bd={};try{const _0x4a275a=a50_0x268b8c[_0x5a4fb4(0xb8)](_0x58a8fe,_0x5a4fb4(0xce));_0x4b74bd=JSON[_0x5a4fb4(0x9a)](_0x4a275a);}catch{return;}delete _0x4b74bd[_0x2ea701],writeSecureFile(_0x58a8fe,JSON[_0x5a4fb4(0xde)](_0x4b74bd,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x510c0e=a50_0x2db0;clearFieldFromUserConfig(_0x510c0e(0xc2));}export function clearActiveProfileFromUserConfig(){const _0x1bbaad=a50_0x2db0;clearFieldFromUserConfig(_0x1bbaad(0x9f));}export function createProfile(_0x213e41,_0x832110){const _0x1ff718=a50_0x2db0;validateProfileName(_0x213e41);if(profileExists(_0x213e41))throw new Error(_0x1ff718(0xe1)+_0x213e41+_0x1ff718(0xb9));saveProfile(_0x213e41,_0x832110);}export function saveProfileCredentials(_0x1ecdf0,_0x30fb06){const _0x3d9649=a50_0x2db0;validateProfileName(_0x1ecdf0);if(!profileExists(_0x1ecdf0))throw new Error(_0x3d9649(0xe1)+_0x1ecdf0+'\x20does\x20not\x20exist');const _0xce6c32=getNewCredentialPath(_0x1ecdf0);writeSecureFile(_0xce6c32,_0x30fb06);}export function loadProfileCredentials(_0x4f1196){const _0x40e68c=a50_0x2db0;validateProfileName(_0x4f1196);const _0x24ef4c=getNewCredentialPath(_0x4f1196);if(a50_0x268b8c[_0x40e68c(0xe5)](_0x24ef4c))try{return a50_0x268b8c['readFileSync'](_0x24ef4c,_0x40e68c(0xce));}catch{}const _0x2c83d8=getOldCredentialPath(_0x4f1196);if(a50_0x268b8c[_0x40e68c(0xe5)](_0x2c83d8)){console[_0x40e68c(0xc7)](_0x40e68c(0xa9)+_0x4f1196+'\x27'),console[_0x40e68c(0xc7)](_0x40e68c(0xa3)),console[_0x40e68c(0xc7)](_0x40e68c(0xd3)+_0x2c83d8+_0x40e68c(0xda)+_0x24ef4c+'\x22'),console['warn']('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a50_0x268b8c[_0x40e68c(0xb8)](_0x2c83d8,_0x40e68c(0xce));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a51_0x1f6725=a51_0x35a7;(function(_0x455351,_0x38a8e1){const _0x4a32c4=a51_0x35a7,_0x11ca01=_0x455351();while(!![]){try{const _0x67d7cd=parseInt(_0x4a32c4(0x1e5))/0x1+-parseInt(_0x4a32c4(0x1f6))/0x2+-parseInt(_0x4a32c4(0x1ed))/0x3*(parseInt(_0x4a32c4(0x1e2))/0x4)+-parseInt(_0x4a32c4(0x1ec))/0x5*(-parseInt(_0x4a32c4(0x1de))/0x6)+parseInt(_0x4a32c4(0x1ef))/0x7*(-parseInt(_0x4a32c4(0x1e7))/0x8)+parseInt(_0x4a32c4(0x1f5))/0x9*(-parseInt(_0x4a32c4(0x1f8))/0xa)+parseInt(_0x4a32c4(0x1dc))/0xb*(parseInt(_0x4a32c4(0x1eb))/0xc);if(_0x67d7cd===_0x38a8e1)break;else _0x11ca01['push'](_0x11ca01['shift']());}catch(_0x39bd14){_0x11ca01['push'](_0x11ca01['shift']());}}}(a51_0x46f6,0xbb5d8));function a51_0x35a7(_0x59fd4d,_0x4047f6){_0x59fd4d=_0x59fd4d-0x1db;const _0x46f68a=a51_0x46f6();let _0x35a784=_0x46f68a[_0x59fd4d];return _0x35a784;}function a51_0x46f6(){const _0x358cd4=['Failed\x20to\x20load\x20project\x20config\x20from\x20','stringify','1307637YEyXYV','\x20is\x20ignored.\x20','8533104rkYyLN','dirname','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','tdx.json','318096QuGOxe','28555acaGIv','15WImLwa','TD_API_KEY','7TLErnr','includes','api_key','profile','readFileSync','apiKey','1001043aurxFl','2610016GSuNeu','ENOENT','90jydXcn','utf-8','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','join','1243svGqFX','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','6NPzEtO','parse','code','cwd','134892TaaEYg'];a51_0x46f6=function(){return _0x358cd4;};return a51_0x46f6();}import*as a51_0x12f12d from'node:fs';import*as a51_0x1214dd from'node:path';const PROJECT_CONFIG_FILENAME=a51_0x1f6725(0x1ea);export function findProjectConfigPath(_0x3cac56){const _0x4eb394=a51_0x1f6725;let _0x58229b=_0x3cac56||process[_0x4eb394(0x1e1)]();while(!![]){const _0x164e91=a51_0x1214dd[_0x4eb394(0x1db)](_0x58229b,PROJECT_CONFIG_FILENAME);if(a51_0x12f12d['existsSync'](_0x164e91))return _0x164e91;const _0x1b3512=a51_0x1214dd[_0x4eb394(0x1e8)](_0x58229b);if(_0x1b3512===_0x58229b)return null;_0x58229b=_0x1b3512;}}export function loadProjectConfig(_0x27f966){const _0x5e0c6f=a51_0x1f6725,_0x41adbb=findProjectConfigPath(_0x27f966);if(!_0x41adbb)return null;try{const _0xe8946e=a51_0x12f12d[_0x5e0c6f(0x1f3)](_0x41adbb,_0x5e0c6f(0x1f9)),_0x390e85=JSON[_0x5e0c6f(0x1df)](_0xe8946e),_0x2abc91=JSON[_0x5e0c6f(0x1e4)](_0x390e85);if(_0x2abc91[_0x5e0c6f(0x1f0)]('TD_API_KEY')||_0x2abc91['includes'](_0x5e0c6f(0x1f4))||_0x2abc91[_0x5e0c6f(0x1f0)](_0x5e0c6f(0x1f1)))throw new Error(_0x5e0c6f(0x1fa)+_0x41adbb+').\x20'+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x517c12,profile:_0x182026,..._0x1ed8a3}=_0x390e85;return _0x182026&&console['warn']('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x41adbb+_0x5e0c6f(0x1e6)+_0x5e0c6f(0x1e9)),_0x1ed8a3;}catch(_0x2ec1be){if(_0x2ec1be instanceof Error&&_0x5e0c6f(0x1e0)in _0x2ec1be&&_0x2ec1be[_0x5e0c6f(0x1e0)]===_0x5e0c6f(0x1f7))return null;throw new Error(_0x5e0c6f(0x1e3)+_0x41adbb+':\x20'+_0x2ec1be);}}export function saveProjectConfig(_0x3ac3ce,_0x38bd9f){const _0x3a35f0=a51_0x1f6725,_0x295022=_0x38bd9f||process[_0x3a35f0(0x1e1)](),_0x31a443=a51_0x1214dd[_0x3a35f0(0x1db)](_0x295022,PROJECT_CONFIG_FILENAME),_0x351c18=JSON[_0x3a35f0(0x1e4)](_0x3ac3ce);if(_0x351c18[_0x3a35f0(0x1f0)](_0x3a35f0(0x1ee))||_0x351c18[_0x3a35f0(0x1f0)]('apiKey')||_0x351c18[_0x3a35f0(0x1f0)]('api_key'))throw new Error(_0x3a35f0(0x1dd));if(_0x3a35f0(0x1f2)in _0x3ac3ce)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a51_0x12f12d['writeFileSync'](_0x31a443,JSON[_0x3a35f0(0x1e4)](_0x3ac3ce,null,0x2));}export function hasProjectConfig(_0x181051){return findProjectConfigPath(_0x181051)!==null;}export function getProjectRoot(_0x98fe91){const _0x3ed4ef=a51_0x1f6725,_0x56fcc5=findProjectConfigPath(_0x98fe91);return _0x56fcc5?a51_0x1214dd[_0x3ed4ef(0x1e8)](_0x56fcc5):null;}
1
+ (function(_0x5b9950,_0x3afdf0){const _0x314d7b=a51_0x1c2a,_0x3d85de=_0x5b9950();while(!![]){try{const _0x536ee7=-parseInt(_0x314d7b(0xb2))/0x1*(-parseInt(_0x314d7b(0xb4))/0x2)+parseInt(_0x314d7b(0xa9))/0x3+parseInt(_0x314d7b(0xa2))/0x4+parseInt(_0x314d7b(0xbb))/0x5+parseInt(_0x314d7b(0xa0))/0x6*(parseInt(_0x314d7b(0xa6))/0x7)+-parseInt(_0x314d7b(0xad))/0x8*(-parseInt(_0x314d7b(0xa8))/0x9)+-parseInt(_0x314d7b(0xba))/0xa*(parseInt(_0x314d7b(0xb3))/0xb);if(_0x536ee7===_0x3afdf0)break;else _0x3d85de['push'](_0x3d85de['shift']());}catch(_0xb78f99){_0x3d85de['push'](_0x3d85de['shift']());}}}(a51_0x4f15,0x47602));import*as a51_0x3c48c2 from'node:fs';import*as a51_0x4c4f77 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x20d49f){const _0x1df8fa=a51_0x1c2a;let _0x1b7fa4=_0x20d49f||process[_0x1df8fa(0xa5)]();while(!![]){const _0x157632=a51_0x4c4f77['join'](_0x1b7fa4,PROJECT_CONFIG_FILENAME);if(a51_0x3c48c2['existsSync'](_0x157632))return _0x157632;const _0x5a9271=a51_0x4c4f77[_0x1df8fa(0xbc)](_0x1b7fa4);if(_0x5a9271===_0x1b7fa4)return null;_0x1b7fa4=_0x5a9271;}}export function loadProjectConfig(_0x4f72c3){const _0x36fbb7=a51_0x1c2a,_0x20795c=findProjectConfigPath(_0x4f72c3);if(!_0x20795c)return null;try{const _0x1fe281=a51_0x3c48c2[_0x36fbb7(0xa7)](_0x20795c,_0x36fbb7(0xb1)),_0x1ef98d=JSON[_0x36fbb7(0x9f)](_0x1fe281),_0x3ce68a=JSON[_0x36fbb7(0xac)](_0x1ef98d);if(_0x3ce68a[_0x36fbb7(0xa3)]('TD_API_KEY')||_0x3ce68a[_0x36fbb7(0xa3)](_0x36fbb7(0xae))||_0x3ce68a[_0x36fbb7(0xa3)](_0x36fbb7(0xb7)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x20795c+_0x36fbb7(0xa1)+_0x36fbb7(0xb9));const {metadata:_0x550f57,profile:_0x549353,..._0x338e7e}=_0x1ef98d;return _0x549353&&console['warn'](_0x36fbb7(0xb0)+_0x20795c+'\x20is\x20ignored.\x20'+_0x36fbb7(0xab)),_0x338e7e;}catch(_0x105f6b){if(_0x105f6b instanceof Error&&_0x36fbb7(0xaf)in _0x105f6b&&_0x105f6b[_0x36fbb7(0xaf)]===_0x36fbb7(0xb6))return null;throw new Error(_0x36fbb7(0xb5)+_0x20795c+':\x20'+_0x105f6b);}}function a51_0x1c2a(_0x42cdaa,_0x20c6c0){_0x42cdaa=_0x42cdaa-0x9f;const _0x4f15c4=a51_0x4f15();let _0x1c2a4f=_0x4f15c4[_0x42cdaa];return _0x1c2a4f;}function a51_0x4f15(){const _0xd3de8d=['119LlQUuj','readFileSync','4769181ixvaWU','485742acUEPd','writeFileSync','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','stringify','8qTObDO','apiKey','code','Warning:\x20\x27profile\x27\x20field\x20in\x20','utf-8','47147bRPMwO','180499zWOSLW','20INVCkK','Failed\x20to\x20load\x20project\x20config\x20from\x20','ENOENT','api_key','TD_API_KEY','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','1070Kwlhdh','2704995RpBDlY','dirname','profile','parse','92538RAtQDQ',').\x20','326536GrmQEV','includes','join','cwd'];a51_0x4f15=function(){return _0xd3de8d;};return a51_0x4f15();}export function saveProjectConfig(_0x46ec7c,_0x334ee7){const _0x2a8e04=a51_0x1c2a,_0x4bbbad=_0x334ee7||process['cwd'](),_0x509348=a51_0x4c4f77[_0x2a8e04(0xa4)](_0x4bbbad,PROJECT_CONFIG_FILENAME),_0x387895=JSON[_0x2a8e04(0xac)](_0x46ec7c);if(_0x387895[_0x2a8e04(0xa3)](_0x2a8e04(0xb8))||_0x387895[_0x2a8e04(0xa3)](_0x2a8e04(0xae))||_0x387895[_0x2a8e04(0xa3)]('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x2a8e04(0xbd)in _0x46ec7c)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a51_0x3c48c2[_0x2a8e04(0xaa)](_0x509348,JSON[_0x2a8e04(0xac)](_0x46ec7c,null,0x2));}export function hasProjectConfig(_0x3e1c3b){return findProjectConfigPath(_0x3e1c3b)!==null;}export function getProjectRoot(_0x3693fe){const _0xebb98d=a51_0x1c2a,_0x527728=findProjectConfigPath(_0x3693fe);return _0x527728?a51_0x4c4f77[_0xebb98d(0xbc)](_0x527728):null;}
@@ -1 +1 @@
1
- (function(_0x28e64f,_0x4b7687){const _0x3452df=a52_0x5c53,_0x1c89a7=_0x28e64f();while(!![]){try{const _0x4071a2=parseInt(_0x3452df(0x18f))/0x1+parseInt(_0x3452df(0x1a9))/0x2+parseInt(_0x3452df(0x194))/0x3*(parseInt(_0x3452df(0x191))/0x4)+-parseInt(_0x3452df(0x197))/0x5*(-parseInt(_0x3452df(0x1ac))/0x6)+parseInt(_0x3452df(0x1b0))/0x7*(parseInt(_0x3452df(0x19c))/0x8)+-parseInt(_0x3452df(0x19e))/0x9*(parseInt(_0x3452df(0x1af))/0xa)+parseInt(_0x3452df(0x1b1))/0xb*(-parseInt(_0x3452df(0x18c))/0xc);if(_0x4071a2===_0x4b7687)break;else _0x1c89a7['push'](_0x1c89a7['shift']());}catch(_0x580e13){_0x1c89a7['push'](_0x1c89a7['shift']());}}}(a52_0x4e44,0x53434));import*as a52_0xf42a32 from'node:fs';import*as a52_0x68e4f4 from'node:path';import*as a52_0x19ea48 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 _0x39c345=a52_0x5c53,_0x31b38c=process[_0x39c345(0x1ab)][_0x39c345(0x1ad)]||a52_0x68e4f4[_0x39c345(0x1b2)](a52_0x19ea48[_0x39c345(0x1a2)](),_0x39c345(0x198),_0x39c345(0x192));return a52_0x68e4f4[_0x39c345(0x1b2)](_0x31b38c,'sessions');}function getSessionPath(_0x86d7af){const _0x343e6d=a52_0x5c53;return a52_0x68e4f4[_0x343e6d(0x1b2)](getSessionsDir(),_0x86d7af+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x39d9ce){const _0x4fad80=a52_0x5c53;if(_0x39d9ce)return _0x39d9ce;return getCurrentSessionPID()[_0x4fad80(0x1a1)]();}export function loadSessionContext(_0x435cb7){const _0x3bcbf5=_0x435cb7||getCurrentSessionPID()['toString'](),_0x4a0692=/^\d+$/['test'](_0x3bcbf5)?parseInt(_0x3bcbf5,0xa):null;return _0x4a0692!==null?loadSessionContextByPID(_0x4a0692):loadSessionContextByString(_0x3bcbf5);}export function loadSessionContextByPID(_0xbcee69){const _0x2883f8=a52_0x5c53,_0x43d1df=getSessionPath(_0xbcee69);if(!a52_0xf42a32[_0x2883f8(0x199)](_0x43d1df))return null;try{const _0x561600=a52_0xf42a32['readFileSync'](_0x43d1df,_0x2883f8(0x19f)),_0x40bd3c=JSON[_0x2883f8(0x188)](_0x561600),_0x42d3f1=new Date(_0x40bd3c['createdAt'])['getTime'](),_0x27d86d=Date[_0x2883f8(0x19b)]();if(_0x27d86d-_0x42d3f1>SESSION_EXPIRATION_MS)return a52_0xf42a32[_0x2883f8(0x196)](_0x43d1df),null;const _0x55ddce=JSON[_0x2883f8(0x1a0)](_0x40bd3c);if(_0x55ddce[_0x2883f8(0x18e)](_0x2883f8(0x1a7))||_0x55ddce['includes'](_0x2883f8(0x1aa))||_0x55ddce[_0x2883f8(0x18e)]('api_key'))return console[_0x2883f8(0x1ae)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x43d1df+_0x2883f8(0x18d)),a52_0xf42a32[_0x2883f8(0x196)](_0x43d1df),null;return _0x40bd3c;}catch{try{a52_0xf42a32[_0x2883f8(0x196)](_0x43d1df);}catch{}return null;}}function loadSessionContextByString(_0x34edd4){const _0x5de1de=a52_0x5c53,_0x59f359=a52_0x68e4f4[_0x5de1de(0x1b2)](getSessionsDir(),_0x34edd4+_0x5de1de(0x189));if(!a52_0xf42a32[_0x5de1de(0x199)](_0x59f359))return null;try{const _0x1f05a8=a52_0xf42a32[_0x5de1de(0x1a8)](_0x59f359,_0x5de1de(0x19f)),_0x32add0=JSON[_0x5de1de(0x188)](_0x1f05a8),_0x705a19=new Date(_0x32add0['createdAt'])[_0x5de1de(0x19a)](),_0x55ef6e=Date[_0x5de1de(0x19b)]();if(_0x55ef6e-_0x705a19>SESSION_EXPIRATION_MS)return a52_0xf42a32['unlinkSync'](_0x59f359),null;const _0x3edc8c=JSON[_0x5de1de(0x1a0)](_0x32add0);if(_0x3edc8c[_0x5de1de(0x18e)]('TD_API_KEY')||_0x3edc8c[_0x5de1de(0x18e)]('apiKey')||_0x3edc8c[_0x5de1de(0x18e)](_0x5de1de(0x190)))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x59f359+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a52_0xf42a32[_0x5de1de(0x196)](_0x59f359),null;return _0x32add0;}catch{try{a52_0xf42a32[_0x5de1de(0x196)](_0x59f359);}catch{}return null;}}export function saveSessionContext(_0x38b080,_0x47e004){const _0x109db2=a52_0x5c53,_0x4b39b3=_0x47e004||getCurrentSessionPID()[_0x109db2(0x1a1)](),_0x3bc977=/^\d+$/['test'](_0x4b39b3)?parseInt(_0x4b39b3,0xa):getCurrentSessionPID(),_0x24325d=a52_0x68e4f4[_0x109db2(0x1b2)](getSessionsDir(),_0x4b39b3+'.json'),_0x5be2a3=getSessionsDir();createSecureDirectory(_0x5be2a3);const _0x1fcc49=JSON[_0x109db2(0x1a0)](_0x38b080);if(_0x1fcc49[_0x109db2(0x18e)](_0x109db2(0x1a7))||_0x1fcc49[_0x109db2(0x18e)](_0x109db2(0x1aa))||_0x1fcc49[_0x109db2(0x18e)](_0x109db2(0x190)))throw new Error(_0x109db2(0x18a));let _0x393bfa;const _0x56fecf=/^\d+$/['test'](_0x4b39b3)?loadSessionContextByPID(parseInt(_0x4b39b3,0xa)):loadSessionContextByString(_0x4b39b3);_0x56fecf?_0x393bfa={..._0x56fecf,..._0x38b080,'pid':_0x3bc977,'sessionId':_0x4b39b3!==_0x3bc977[_0x109db2(0x1a1)]()?_0x4b39b3:undefined,'updatedAt':new Date()['toISOString']()}:_0x393bfa={'pid':_0x3bc977,'sessionId':_0x4b39b3!==_0x3bc977[_0x109db2(0x1a1)]()?_0x4b39b3:undefined,..._0x38b080,'createdAt':new Date()[_0x109db2(0x1a4)](),'updatedAt':new Date()[_0x109db2(0x1a4)]()},a52_0xf42a32[_0x109db2(0x18b)](_0x24325d,JSON[_0x109db2(0x1a0)](_0x393bfa,null,0x2));}export function clearSessionContext(_0x902c9d){const _0x415fc0=a52_0x5c53,_0x59ad25=_0x902c9d||getCurrentSessionPID()[_0x415fc0(0x1a1)](),_0x152993=a52_0x68e4f4[_0x415fc0(0x1b2)](getSessionsDir(),_0x59ad25+_0x415fc0(0x189));a52_0xf42a32[_0x415fc0(0x199)](_0x152993)&&a52_0xf42a32[_0x415fc0(0x196)](_0x152993);}function a52_0x5c53(_0x2f2516,_0x1ffc0){_0x2f2516=_0x2f2516-0x188;const _0x4e4405=a52_0x4e44();let _0x5c5300=_0x4e4405[_0x2f2516];return _0x5c5300;}export function clearSessionContextField(_0x82790c,_0x19b852){const _0x274a97=a52_0x5c53,_0x33e7de=_0x19b852||getCurrentSessionPID()[_0x274a97(0x1a1)](),_0x527066=a52_0x68e4f4['join'](getSessionsDir(),_0x33e7de+_0x274a97(0x189));if(!a52_0xf42a32[_0x274a97(0x199)](_0x527066))return;try{const _0x396c39=a52_0xf42a32['readFileSync'](_0x527066,_0x274a97(0x19f)),_0x5b4644=JSON[_0x274a97(0x188)](_0x396c39);delete _0x5b4644[_0x82790c],a52_0xf42a32[_0x274a97(0x18b)](_0x527066,JSON['stringify'](_0x5b4644,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x2a087a=a52_0x5c53,_0x1c97bc=getSessionsDir();if(!a52_0xf42a32[_0x2a087a(0x199)](_0x1c97bc))return 0x0;let _0x520a69=0x0;const _0x1229f5=Date['now']();try{const _0x3d1601=a52_0xf42a32[_0x2a087a(0x195)](_0x1c97bc);for(const _0x28b87a of _0x3d1601){if(!_0x28b87a['endsWith'](_0x2a087a(0x189)))continue;const _0x354c4c=a52_0x68e4f4[_0x2a087a(0x1b2)](_0x1c97bc,_0x28b87a),_0x2c0713=_0x28b87a[_0x2a087a(0x1a3)]('.json',''),_0x2aaa52=parseInt(_0x2c0713,0xa),_0x52c321=!isNaN(_0x2aaa52);if(_0x52c321){if(!isProcessRunning(_0x2aaa52)){a52_0xf42a32[_0x2a087a(0x196)](_0x354c4c),_0x520a69++;continue;}}try{const _0x3bf1b8=a52_0xf42a32[_0x2a087a(0x1a8)](_0x354c4c,_0x2a087a(0x19f)),_0x26feb7=JSON[_0x2a087a(0x188)](_0x3bf1b8),_0xfdc277=new Date(_0x26feb7[_0x2a087a(0x193)])[_0x2a087a(0x19a)]();_0x1229f5-_0xfdc277>SESSION_EXPIRATION_MS&&(a52_0xf42a32[_0x2a087a(0x196)](_0x354c4c),_0x520a69++);}catch{a52_0xf42a32[_0x2a087a(0x196)](_0x354c4c),_0x520a69++;}}}catch{}return _0x520a69;}export function listActiveSessions(){const _0x2ced72=a52_0x5c53,_0x257e4a=getSessionsDir();if(!a52_0xf42a32[_0x2ced72(0x199)](_0x257e4a))return[];try{const _0x4619ed=a52_0xf42a32[_0x2ced72(0x195)](_0x257e4a),_0x2db64a=[];for(const _0x17a269 of _0x4619ed){if(!_0x17a269[_0x2ced72(0x1a6)](_0x2ced72(0x189)))continue;const _0x3438bb=_0x17a269[_0x2ced72(0x1a3)](_0x2ced72(0x189),''),_0x3effd1=parseInt(_0x3438bb,0xa);!isNaN(_0x3effd1)&&isProcessRunning(_0x3effd1)&&_0x2db64a[_0x2ced72(0x1a5)](_0x3effd1);}return _0x2db64a[_0x2ced72(0x19d)]((_0x81a932,_0x548dab)=>_0x81a932-_0x548dab);}catch{return[];}}function a52_0x4e44(){const _0x3613b3=['warn','230nQAAfS','49rVNssm','9565633vbNbeO','join','parse','.json','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','writeFileSync','12FsGyjS','.\x20This\x20is\x20insecure.\x20Removing\x20session.','includes','458468SiZlAB','api_key','7352dkZGff','tdx','createdAt','699fdxJhX','readdirSync','unlinkSync','425720GRcCAV','.config','existsSync','getTime','now','3064cJqHRs','sort','47052BCpaJh','utf-8','stringify','toString','homedir','replace','toISOString','push','endsWith','TD_API_KEY','readFileSync','372112xgPiIo','apiKey','env','18fUKLsP','TDX_CONFIG_DIR'];a52_0x4e44=function(){return _0x3613b3;};return a52_0x4e44();}
1
+ function a52_0x1da6(_0x51ec3b,_0x149a67){_0x51ec3b=_0x51ec3b-0x126;const _0x3ec74e=a52_0x3ec7();let _0x1da69f=_0x3ec74e[_0x51ec3b];return _0x1da69f;}(function(_0x575100,_0x23cad0){const _0xdcffe0=a52_0x1da6,_0x41e388=_0x575100();while(!![]){try{const _0x360f88=-parseInt(_0xdcffe0(0x12c))/0x1*(-parseInt(_0xdcffe0(0x146))/0x2)+-parseInt(_0xdcffe0(0x12e))/0x3+-parseInt(_0xdcffe0(0x142))/0x4+parseInt(_0xdcffe0(0x134))/0x5*(parseInt(_0xdcffe0(0x13e))/0x6)+parseInt(_0xdcffe0(0x130))/0x7+-parseInt(_0xdcffe0(0x14b))/0x8*(-parseInt(_0xdcffe0(0x148))/0x9)+-parseInt(_0xdcffe0(0x131))/0xa;if(_0x360f88===_0x23cad0)break;else _0x41e388['push'](_0x41e388['shift']());}catch(_0x454957){_0x41e388['push'](_0x41e388['shift']());}}}(a52_0x3ec7,0x6d880));import*as a52_0x2d499c from'node:fs';import*as a52_0x585e20 from'node:path';import*as a52_0x2b5643 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 _0x32bd84=a52_0x1da6,_0x57fd3e=process[_0x32bd84(0x139)]['TDX_CONFIG_DIR']||a52_0x585e20[_0x32bd84(0x143)](a52_0x2b5643['homedir'](),'.config',_0x32bd84(0x12b));return a52_0x585e20[_0x32bd84(0x143)](_0x57fd3e,_0x32bd84(0x127));}function getSessionPath(_0xffe943){const _0x2c2796=a52_0x1da6;return a52_0x585e20[_0x2c2796(0x143)](getSessionsDir(),_0xffe943+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x11f96d){const _0x492cc=a52_0x1da6;if(_0x11f96d)return _0x11f96d;return getCurrentSessionPID()[_0x492cc(0x144)]();}export function loadSessionContext(_0x2e0717){const _0x1b4b5a=a52_0x1da6,_0x352a07=_0x2e0717||getCurrentSessionPID()[_0x1b4b5a(0x144)](),_0x11189b=/^\d+$/['test'](_0x352a07)?parseInt(_0x352a07,0xa):null;return _0x11189b!==null?loadSessionContextByPID(_0x11189b):loadSessionContextByString(_0x352a07);}export function loadSessionContextByPID(_0x5cbf46){const _0x560752=a52_0x1da6,_0x22d414=getSessionPath(_0x5cbf46);if(!a52_0x2d499c[_0x560752(0x129)](_0x22d414))return null;try{const _0x1409ed=a52_0x2d499c[_0x560752(0x13a)](_0x22d414,_0x560752(0x147)),_0x4f4d45=JSON[_0x560752(0x14d)](_0x1409ed),_0x4c53fb=new Date(_0x4f4d45[_0x560752(0x137)])[_0x560752(0x13d)](),_0x12aa60=Date['now']();if(_0x12aa60-_0x4c53fb>SESSION_EXPIRATION_MS)return a52_0x2d499c[_0x560752(0x141)](_0x22d414),null;const _0x1664ef=JSON[_0x560752(0x145)](_0x4f4d45);if(_0x1664ef[_0x560752(0x149)](_0x560752(0x12f))||_0x1664ef[_0x560752(0x149)](_0x560752(0x14c))||_0x1664ef['includes']('api_key'))return console[_0x560752(0x14e)](_0x560752(0x138)+_0x22d414+_0x560752(0x136)),a52_0x2d499c[_0x560752(0x141)](_0x22d414),null;return _0x4f4d45;}catch{try{a52_0x2d499c[_0x560752(0x141)](_0x22d414);}catch{}return null;}}function loadSessionContextByString(_0x30484a){const _0x3320ff=a52_0x1da6,_0x15edd0=a52_0x585e20['join'](getSessionsDir(),_0x30484a+_0x3320ff(0x12d));if(!a52_0x2d499c[_0x3320ff(0x129)](_0x15edd0))return null;try{const _0x1258e3=a52_0x2d499c[_0x3320ff(0x13a)](_0x15edd0,_0x3320ff(0x147)),_0x17a6e6=JSON[_0x3320ff(0x14d)](_0x1258e3),_0x3b6c9b=new Date(_0x17a6e6['createdAt'])[_0x3320ff(0x13d)](),_0x421807=Date[_0x3320ff(0x132)]();if(_0x421807-_0x3b6c9b>SESSION_EXPIRATION_MS)return a52_0x2d499c['unlinkSync'](_0x15edd0),null;const _0x28ec46=JSON['stringify'](_0x17a6e6);if(_0x28ec46[_0x3320ff(0x149)](_0x3320ff(0x12f))||_0x28ec46[_0x3320ff(0x149)]('apiKey')||_0x28ec46[_0x3320ff(0x149)](_0x3320ff(0x14a)))return console[_0x3320ff(0x14e)](_0x3320ff(0x138)+_0x15edd0+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a52_0x2d499c[_0x3320ff(0x141)](_0x15edd0),null;return _0x17a6e6;}catch{try{a52_0x2d499c[_0x3320ff(0x141)](_0x15edd0);}catch{}return null;}}export function saveSessionContext(_0x22d099,_0x13e2f7){const _0x1655d7=a52_0x1da6,_0x5e765a=_0x13e2f7||getCurrentSessionPID()[_0x1655d7(0x144)](),_0x364753=/^\d+$/['test'](_0x5e765a)?parseInt(_0x5e765a,0xa):getCurrentSessionPID(),_0x4e4fa1=a52_0x585e20[_0x1655d7(0x143)](getSessionsDir(),_0x5e765a+_0x1655d7(0x12d)),_0x19ef2a=getSessionsDir();createSecureDirectory(_0x19ef2a);const _0xb0bbbb=JSON[_0x1655d7(0x145)](_0x22d099);if(_0xb0bbbb[_0x1655d7(0x149)]('TD_API_KEY')||_0xb0bbbb[_0x1655d7(0x149)]('apiKey')||_0xb0bbbb[_0x1655d7(0x149)](_0x1655d7(0x14a)))throw new Error(_0x1655d7(0x126));let _0x1a7ace;const _0x53f781=/^\d+$/[_0x1655d7(0x13f)](_0x5e765a)?loadSessionContextByPID(parseInt(_0x5e765a,0xa)):loadSessionContextByString(_0x5e765a);_0x53f781?_0x1a7ace={..._0x53f781,..._0x22d099,'pid':_0x364753,'sessionId':_0x5e765a!==_0x364753[_0x1655d7(0x144)]()?_0x5e765a:undefined,'updatedAt':new Date()['toISOString']()}:_0x1a7ace={'pid':_0x364753,'sessionId':_0x5e765a!==_0x364753[_0x1655d7(0x144)]()?_0x5e765a:undefined,..._0x22d099,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x1655d7(0x12a)]()},a52_0x2d499c[_0x1655d7(0x140)](_0x4e4fa1,JSON['stringify'](_0x1a7ace,null,0x2));}export function clearSessionContext(_0x1575fd){const _0x152121=a52_0x1da6,_0x4b6418=_0x1575fd||getCurrentSessionPID()[_0x152121(0x144)](),_0x345802=a52_0x585e20['join'](getSessionsDir(),_0x4b6418+'.json');a52_0x2d499c['existsSync'](_0x345802)&&a52_0x2d499c[_0x152121(0x141)](_0x345802);}export function clearSessionContextField(_0xba453,_0x1f07e8){const _0x4aea83=a52_0x1da6,_0x1aa559=_0x1f07e8||getCurrentSessionPID()['toString'](),_0x26bc3b=a52_0x585e20[_0x4aea83(0x143)](getSessionsDir(),_0x1aa559+_0x4aea83(0x12d));if(!a52_0x2d499c[_0x4aea83(0x129)](_0x26bc3b))return;try{const _0x47109b=a52_0x2d499c[_0x4aea83(0x13a)](_0x26bc3b,_0x4aea83(0x147)),_0x593e22=JSON[_0x4aea83(0x14d)](_0x47109b);delete _0x593e22[_0xba453],a52_0x2d499c[_0x4aea83(0x140)](_0x26bc3b,JSON['stringify'](_0x593e22,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x3fcdcc=a52_0x1da6,_0x5882b5=getSessionsDir();if(!a52_0x2d499c[_0x3fcdcc(0x129)](_0x5882b5))return 0x0;let _0x2e6a0f=0x0;const _0x14aa80=Date[_0x3fcdcc(0x132)]();try{const _0x45e4c4=a52_0x2d499c['readdirSync'](_0x5882b5);for(const _0x46e51c of _0x45e4c4){if(!_0x46e51c[_0x3fcdcc(0x133)](_0x3fcdcc(0x12d)))continue;const _0x5dc6da=a52_0x585e20[_0x3fcdcc(0x143)](_0x5882b5,_0x46e51c),_0x288bde=_0x46e51c[_0x3fcdcc(0x13b)]('.json',''),_0x1bc30b=parseInt(_0x288bde,0xa),_0x408d3e=!isNaN(_0x1bc30b);if(_0x408d3e){if(!isProcessRunning(_0x1bc30b)){a52_0x2d499c['unlinkSync'](_0x5dc6da),_0x2e6a0f++;continue;}}try{const _0x228497=a52_0x2d499c[_0x3fcdcc(0x13a)](_0x5dc6da,'utf-8'),_0x1ab9d4=JSON[_0x3fcdcc(0x14d)](_0x228497),_0x403f08=new Date(_0x1ab9d4[_0x3fcdcc(0x137)])[_0x3fcdcc(0x13d)]();_0x14aa80-_0x403f08>SESSION_EXPIRATION_MS&&(a52_0x2d499c['unlinkSync'](_0x5dc6da),_0x2e6a0f++);}catch{a52_0x2d499c['unlinkSync'](_0x5dc6da),_0x2e6a0f++;}}}catch{}return _0x2e6a0f;}function a52_0x3ec7(){const _0x41c2de=['.\x20This\x20is\x20insecure.\x20Removing\x20session.','createdAt','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','env','readFileSync','replace','sort','getTime','112314KtszRz','test','writeFileSync','unlinkSync','60776DDBLeS','join','toString','stringify','802ituxDl','utf-8','2169OhJMbe','includes','api_key','576qTILsq','apiKey','parse','warn','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','sessions','readdirSync','existsSync','toISOString','tdx','1495mONZBS','.json','67845PlUfGF','TD_API_KEY','5842109Fsvqyb','16950260GlKLSl','now','endsWith','195epqnLk','push'];a52_0x3ec7=function(){return _0x41c2de;};return a52_0x3ec7();}export function listActiveSessions(){const _0x5c6024=a52_0x1da6,_0x47dbbb=getSessionsDir();if(!a52_0x2d499c[_0x5c6024(0x129)](_0x47dbbb))return[];try{const _0x30947f=a52_0x2d499c[_0x5c6024(0x128)](_0x47dbbb),_0x5cddb0=[];for(const _0x402fcd of _0x30947f){if(!_0x402fcd['endsWith'](_0x5c6024(0x12d)))continue;const _0x3f879f=_0x402fcd[_0x5c6024(0x13b)](_0x5c6024(0x12d),''),_0x2c78fa=parseInt(_0x3f879f,0xa);!isNaN(_0x2c78fa)&&isProcessRunning(_0x2c78fa)&&_0x5cddb0[_0x5c6024(0x135)](_0x2c78fa);}return _0x5cddb0[_0x5c6024(0x13c)]((_0x552fc4,_0x59cda7)=>_0x552fc4-_0x59cda7);}catch{return[];}}
@@ -1 +1 @@
1
- function a53_0x158c(){const _0x3739c5=['328860SZUWOw','users','3297486UocWLk','users-','parse','stringify','default','utf-8','3396428YxxjAE','2607016ycffnF','3880130PVkEiy','.json','5XdmPSY','2MlcKSF','now','9XfJXNo','4746008bzpCcA','31613rpRdPy'];a53_0x158c=function(){return _0x3739c5;};return a53_0x158c();}(function(_0x167eb5,_0x2aa638){const _0x3d50eb=a53_0x6740,_0x10d925=_0x167eb5();while(!![]){try{const _0x5c85a0=-parseInt(_0x3d50eb(0x19b))/0x1*(-parseInt(_0x3d50eb(0x197))/0x2)+-parseInt(_0x3d50eb(0x19c))/0x3+-parseInt(_0x3d50eb(0x1a5))/0x4*(-parseInt(_0x3d50eb(0x1a8))/0x5)+parseInt(_0x3d50eb(0x19e))/0x6+-parseInt(_0x3d50eb(0x1a4))/0x7+-parseInt(_0x3d50eb(0x19a))/0x8*(parseInt(_0x3d50eb(0x199))/0x9)+parseInt(_0x3d50eb(0x1a6))/0xa;if(_0x5c85a0===_0x2aa638)break;else _0x10d925['push'](_0x10d925['shift']());}catch(_0x367a1d){_0x10d925['push'](_0x10d925['shift']());}}}(a53_0x158c,0x69af6));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x58b0aa){const _0x4dc581=a53_0x6740,_0x5303ee=_0x58b0aa||_0x4dc581(0x1a2);return join(getCacheDir(),_0x4dc581(0x19f)+_0x5303ee+_0x4dc581(0x1a7));}export function loadCachedUsers(_0x1fb512){const _0x3644d3=a53_0x6740,_0x3ede09=getCacheFilePath(_0x1fb512);if(!existsSync(_0x3ede09))return null;try{const _0x631ba2=readFileSync(_0x3ede09,_0x3644d3(0x1a3)),_0xcafdcf=JSON[_0x3644d3(0x1a0)](_0x631ba2);return _0xcafdcf[_0x3644d3(0x19d)];}catch{return null;}}export function saveCachedUsers(_0x5633b2,_0x51b46e){const _0x592442=a53_0x6740,_0x518858=getCacheDir();!existsSync(_0x518858)&&mkdirSync(_0x518858,{'recursive':!![]});const _0x381da1=getCacheFilePath(_0x5633b2),_0x2fe5c5={'users':_0x51b46e,'cachedAt':Date[_0x592442(0x198)]()};writeFileSync(_0x381da1,JSON[_0x592442(0x1a1)](_0x2fe5c5,null,0x2),_0x592442(0x1a3));}function a53_0x6740(_0x3d56f0,_0x2987d0){_0x3d56f0=_0x3d56f0-0x197;const _0x158c4c=a53_0x158c();let _0x67406e=_0x158c4c[_0x3d56f0];return _0x67406e;}export function clearUserCache(_0x368345){const _0xeb4e6e=getCacheFilePath(_0x368345);if(existsSync(_0xeb4e6e))try{unlinkSync(_0xeb4e6e);}catch{}}
1
+ (function(_0x1f0f8f,_0x12ac57){const _0x27bc18=a53_0x3461,_0x4695b0=_0x1f0f8f();while(!![]){try{const _0x1f6498=parseInt(_0x27bc18(0x14b))/0x1+parseInt(_0x27bc18(0x14f))/0x2*(-parseInt(_0x27bc18(0x155))/0x3)+-parseInt(_0x27bc18(0x150))/0x4+-parseInt(_0x27bc18(0x14c))/0x5*(-parseInt(_0x27bc18(0x149))/0x6)+-parseInt(_0x27bc18(0x147))/0x7*(-parseInt(_0x27bc18(0x14a))/0x8)+parseInt(_0x27bc18(0x151))/0x9*(parseInt(_0x27bc18(0x14e))/0xa)+parseInt(_0x27bc18(0x148))/0xb;if(_0x1f6498===_0x12ac57)break;else _0x4695b0['push'](_0x4695b0['shift']());}catch(_0x160f38){_0x4695b0['push'](_0x4695b0['shift']());}}}(a53_0x8470,0x43557));function a53_0x8470(){const _0x4375b3=['286870mGkVFx','122CHpXGa','2165248txzkBo','72xCIUWO','users','default','.json','19761VloQVj','stringify','utf-8','10577IUeDtz','346203xAqKrx','1895802gbUehh','2224hZBduo','221924IhTtZx','5iZCKMl','now'];a53_0x8470=function(){return _0x4375b3;};return a53_0x8470();}import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';function a53_0x3461(_0x47c99f,_0x2b7863){_0x47c99f=_0x47c99f-0x145;const _0x847072=a53_0x8470();let _0x3461a7=_0x847072[_0x47c99f];return _0x3461a7;}import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x4f9657){const _0x2adaf4=a53_0x3461,_0x22fcd0=_0x4f9657||_0x2adaf4(0x153);return join(getCacheDir(),'users-'+_0x22fcd0+_0x2adaf4(0x154));}export function loadCachedUsers(_0x7e4f75){const _0x182ccc=a53_0x3461,_0xaf7382=getCacheFilePath(_0x7e4f75);if(!existsSync(_0xaf7382))return null;try{const _0x15af0f=readFileSync(_0xaf7382,_0x182ccc(0x146)),_0x189b27=JSON['parse'](_0x15af0f);return _0x189b27[_0x182ccc(0x152)];}catch{return null;}}export function saveCachedUsers(_0x8ae03,_0x5c8a0a){const _0x759980=a53_0x3461,_0x4e1b76=getCacheDir();!existsSync(_0x4e1b76)&&mkdirSync(_0x4e1b76,{'recursive':!![]});const _0x58a21a=getCacheFilePath(_0x8ae03),_0x41cae4={'users':_0x5c8a0a,'cachedAt':Date[_0x759980(0x14d)]()};writeFileSync(_0x58a21a,JSON[_0x759980(0x145)](_0x41cae4,null,0x2),_0x759980(0x146));}export function clearUserCache(_0x5da70a){const _0x5eecd7=getCacheFilePath(_0x5da70a);if(existsSync(_0x5eecd7))try{unlinkSync(_0x5eecd7);}catch{}}
@@ -1 +1 @@
1
- (function(_0x215ea5,_0x162ea0){const _0xe65c92=a54_0x48ec,_0x5a40c9=_0x215ea5();while(!![]){try{const _0x54eaf9=-parseInt(_0xe65c92(0x1dc))/0x1+parseInt(_0xe65c92(0x1da))/0x2+-parseInt(_0xe65c92(0x1df))/0x3*(-parseInt(_0xe65c92(0x1d7))/0x4)+-parseInt(_0xe65c92(0x1db))/0x5+parseInt(_0xe65c92(0x1d9))/0x6*(-parseInt(_0xe65c92(0x1dd))/0x7)+parseInt(_0xe65c92(0x1e3))/0x8+-parseInt(_0xe65c92(0x1e1))/0x9*(parseInt(_0xe65c92(0x1d5))/0xa);if(_0x54eaf9===_0x162ea0)break;else _0x5a40c9['push'](_0x5a40c9['shift']());}catch(_0x562a60){_0x5a40c9['push'](_0x5a40c9['shift']());}}}(a54_0x61de,0x2a258));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a54_0x48ec(_0x12c215,_0x3e23bd){_0x12c215=_0x12c215-0x1d5;const _0x61de55=a54_0x61de();let _0x48eccb=_0x61de55[_0x12c215];return _0x48eccb;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x2da6c7=a54_0x48ec;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x5b0508=fileURLToPath(import.meta.url),_0x4e7711=dirname(_0x5b0508);try{const _0x3cbe3a=join(_0x4e7711,_0x2da6c7(0x1d8));cachedBuildInfo=JSON['parse'](readFileSync(_0x3cbe3a,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x3184b3=a54_0x48ec;if(cachedVersion!==null)return cachedVersion;const _0x32baa6=fileURLToPath(import.meta.url),_0x3facab=dirname(_0x32baa6),_0x3cd421=getBuildInfo();if(_0x3cd421['version'])return cachedVersion=_0x3cd421[_0x3184b3(0x1e0)],cachedVersion;try{const _0x2dc3df=join(_0x3facab,'../../package.json'),_0x899c42=JSON[_0x3184b3(0x1e2)](readFileSync(_0x2dc3df,'utf-8'));cachedVersion=_0x899c42['version'];}catch{cachedVersion=_0x3184b3(0x1de);}return cachedVersion;}export function isDevVersion(){const _0x5c256c=a54_0x48ec,_0x11d376=getVersion();return _0x11d376[_0x5c256c(0x1d6)]('.dev')||_0x11d376[_0x5c256c(0x1d6)]('-');}function a54_0x61de(){const _0x20b657=['parse','2530656wiOpYj','20vaJvHH','includes','4PpXxFG','../build-info.json','20190AsSGTQ','222882aPKrhw','340995CgsjDD','3477GHFgop','693SuqEpl','0.0.0','964182JyKBOS','version','772758BaKxUd'];a54_0x61de=function(){return _0x20b657;};return a54_0x61de();}
1
+ (function(_0x45371c,_0x42d847){const _0x23ed4c=a54_0x9576,_0x51c841=_0x45371c();while(!![]){try{const _0x48e976=-parseInt(_0x23ed4c(0x84))/0x1*(parseInt(_0x23ed4c(0x83))/0x2)+parseInt(_0x23ed4c(0x86))/0x3*(parseInt(_0x23ed4c(0x8e))/0x4)+-parseInt(_0x23ed4c(0x7f))/0x5*(parseInt(_0x23ed4c(0x8c))/0x6)+parseInt(_0x23ed4c(0x87))/0x7+parseInt(_0x23ed4c(0x80))/0x8*(-parseInt(_0x23ed4c(0x90))/0x9)+parseInt(_0x23ed4c(0x89))/0xa*(parseInt(_0x23ed4c(0x8a))/0xb)+parseInt(_0x23ed4c(0x85))/0xc*(-parseInt(_0x23ed4c(0x8f))/0xd);if(_0x48e976===_0x42d847)break;else _0x51c841['push'](_0x51c841['shift']());}catch(_0xbc3184){_0x51c841['push'](_0x51c841['shift']());}}}(a54_0x9e79,0x8f361));function a54_0x9576(_0x37b7d2,_0x13eca7){_0x37b7d2=_0x37b7d2-0x7e;const _0x9e7930=a54_0x9e79();let _0x95769f=_0x9e7930[_0x37b7d2];return _0x95769f;}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x4278e3=a54_0x9576;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x18c890=fileURLToPath(import.meta.url),_0xb4df8c=dirname(_0x18c890);try{const _0x14b412=join(_0xb4df8c,'../build-info.json');cachedBuildInfo=JSON[_0x4278e3(0x88)](readFileSync(_0x14b412,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x2088a5=a54_0x9576;if(cachedVersion!==null)return cachedVersion;const _0x4b9c53=fileURLToPath(import.meta.url),_0x371ebc=dirname(_0x4b9c53),_0x26979c=getBuildInfo();if(_0x26979c['version'])return cachedVersion=_0x26979c[_0x2088a5(0x7e)],cachedVersion;try{const _0x462a6d=join(_0x371ebc,_0x2088a5(0x82)),_0x34fac7=JSON[_0x2088a5(0x88)](readFileSync(_0x462a6d,_0x2088a5(0x81)));cachedVersion=_0x34fac7[_0x2088a5(0x7e)];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x53c1bc=a54_0x9576,_0x1a53c8=getVersion();return _0x1a53c8['includes'](_0x53c1bc(0x8d))||_0x1a53c8[_0x53c1bc(0x8b)]('-');}function a54_0x9e79(){const _0x55834e=['version','85RkeBfA','64QXvbmu','utf-8','../../package.json','734546eZkrap','2RPPlCb','1524mNiMEw','3NFEzEq','5805562XvmhUO','parse','80hUthPH','1604317pFEBBX','includes','109374CamAqc','.dev','2983612eVtnxq','66703BWsYid','516798xHcSIe'];a54_0x9e79=function(){return _0x55834e;};return a54_0x9e79();}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x19b34e,_0x449c62){var _0x33c5f9=a55_0x2f71,_0x32c6dc=_0x19b34e();while(!![]){try{var _0x57c283=-parseInt(_0x33c5f9(0x1ac))/0x1*(-parseInt(_0x33c5f9(0x1b1))/0x2)+-parseInt(_0x33c5f9(0x1b3))/0x3+-parseInt(_0x33c5f9(0x1af))/0x4*(-parseInt(_0x33c5f9(0x1a9))/0x5)+parseInt(_0x33c5f9(0x1b2))/0x6+parseInt(_0x33c5f9(0x1aa))/0x7*(-parseInt(_0x33c5f9(0x1ad))/0x8)+parseInt(_0x33c5f9(0x1ab))/0x9+-parseInt(_0x33c5f9(0x1ae))/0xa*(parseInt(_0x33c5f9(0x1b0))/0xb);if(_0x57c283===_0x449c62)break;else _0x32c6dc['push'](_0x32c6dc['shift']());}catch(_0x13450a){_0x32c6dc['push'](_0x32c6dc['shift']());}}}(a55_0x5c62,0xf101c));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';function a55_0x2f71(_0x54f386,_0x5eb2f3){_0x54f386=_0x54f386-0x1a9;var _0x5c628a=a55_0x5c62();var _0x2f7166=_0x5c628a[_0x54f386];return _0x2f7166;}export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';function a55_0x5c62(){var _0x55b3fb=['871518WnMePb','2436567ZlpWLz','65Bjdcpz','10005079XJkFij','5892894VugtCA','4944WJlQxB','8bAEnyd','10RqtNUU','509228kjzAWw','11122584YGSXlH','722osYnox'];a55_0x5c62=function(){return _0x55b3fb;};return a55_0x5c62();}
1
+ (function(_0x416ed9,_0x47eabd){var _0x5f275b=a55_0x38c6,_0x511675=_0x416ed9();while(!![]){try{var _0x3c46ce=-parseInt(_0x5f275b(0xe2))/0x1+-parseInt(_0x5f275b(0xe3))/0x2+parseInt(_0x5f275b(0xe1))/0x3+parseInt(_0x5f275b(0xe6))/0x4+-parseInt(_0x5f275b(0xe7))/0x5+parseInt(_0x5f275b(0xe4))/0x6+parseInt(_0x5f275b(0xe5))/0x7*(parseInt(_0x5f275b(0xe8))/0x8);if(_0x3c46ce===_0x47eabd)break;else _0x511675['push'](_0x511675['shift']());}catch(_0x2c747e){_0x511675['push'](_0x511675['shift']());}}}(a55_0x3179,0xc0a88));export*from'./sdk/types/index.js';function a55_0x38c6(_0x11a6ed,_0x2e8618){_0x11a6ed=_0x11a6ed-0xe1;var _0x3179e2=a55_0x3179();var _0x38c60c=_0x3179e2[_0x11a6ed];return _0x38c60c;}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 a55_0x3179(){var _0x3a2b25=['1026600sAXLpO','5864260eYDVOe','8QYhfAl','4083015dWbZoy','797912ASZxbw','865434OHxCdI','6459912qqBJtJ','3488114cZUbTV'];a55_0x3179=function(){return _0x3a2b25;};return a55_0x3179();}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 a56_0x3ab0(_0x5007b6,_0x484c88){_0x5007b6=_0x5007b6-0x15b;const _0x1ceb72=a56_0x1ceb();let _0x3ab073=_0x1ceb72[_0x5007b6];return _0x3ab073;}(function(_0x1501d3,_0x512d6d){const _0x38c49d=a56_0x3ab0,_0x3ac252=_0x1501d3();while(!![]){try{const _0x29922b=parseInt(_0x38c49d(0x15f))/0x1*(-parseInt(_0x38c49d(0x178))/0x2)+parseInt(_0x38c49d(0x16a))/0x3+parseInt(_0x38c49d(0x177))/0x4+-parseInt(_0x38c49d(0x17b))/0x5+parseInt(_0x38c49d(0x179))/0x6*(parseInt(_0x38c49d(0x180))/0x7)+-parseInt(_0x38c49d(0x161))/0x8*(parseInt(_0x38c49d(0x17d))/0x9)+parseInt(_0x38c49d(0x171))/0xa*(parseInt(_0x38c49d(0x185))/0xb);if(_0x29922b===_0x512d6d)break;else _0x3ac252['push'](_0x3ac252['shift']());}catch(_0x367a97){_0x3ac252['push'](_0x3ac252['shift']());}}}(a56_0x1ceb,0x671b7));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';function a56_0x1ceb(){const _0x2b2caa=['Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','array','env','12719410zypvGC','text','close','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','examples','registerTool','2454176PWdsOA','2ncbhiL','3579294lcgFXd','SIGTERM','4146775wSaSLh','Optional\x20filter\x20by\x20category','9awVKEs','stdin','category','7uOPHca','name','Command\x20completed\x20successfully','optional','output','11JwaJZV','tdx_run','No\x20commands\x20found\x20matching\x20\x22','error','\x0a\x0a---\x0a\x0a','join','once','description','649758DCdaiN','Utilities','5150504enssXy','1.0.0','Command\x20failed','describe','SIGINT','Context','enum','Data','length','189657hCBEbv','tdx','connect','\x0a\x0aExamples:\x0a'];a56_0x1ceb=function(){return _0x2b2caa;};return a56_0x1ceb();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x227815={}){const _0x1bb396=a56_0x3ab0,_0x11ca4a=new McpServer({'name':_0x1bb396(0x16b),'version':_0x1bb396(0x162)});return _0x11ca4a[_0x1bb396(0x176)](_0x1bb396(0x186),{'description':'Execute\x20any\x20tdx\x20CLI\x20command.\x20Returns\x20JSON\x20output.\x0a\x0aExamples:\x0a-\x20List\x20databases:\x20{\x22args\x22:\x20[\x22databases\x22]}\x0a-\x20Run\x20SQL\x20query:\x20{\x22args\x22:\x20[\x22query\x22,\x20\x22SELECT\x20*\x20FROM\x20mydb.users\x20LIMIT\x2010\x22]}\x0a-\x20List\x20segments:\x20{\x22args\x22:\x20[\x22segments\x22,\x20\x22--recursive\x22]}\x0a-\x20Show\x20job\x20details:\x20{\x22args\x22:\x20[\x22job\x22,\x20\x22show\x22,\x20\x2212345\x22]}\x0a-\x20List\x20tables:\x20{\x22args\x22:\x20[\x22tables\x22,\x20\x22mydb.*\x22]}\x0a\x0aNote:\x20Some\x20commands\x20(auth,\x20profile\x20management,\x20mcp)\x20are\x20blocked\x20for\x20security.','inputSchema':{'args':z[_0x1bb396(0x16f)](z['string']())[_0x1bb396(0x164)](_0x1bb396(0x174))}},async({args:_0x46a898})=>{const _0x865a54=_0x1bb396,_0x10d067=await executeTdxRun({'args':_0x46a898},_0x227815[_0x865a54(0x170)]||{});return _0x10d067['success']?{'content':[{'type':_0x865a54(0x172),'text':_0x10d067[_0x865a54(0x184)]||_0x865a54(0x182)}]}:{'content':[{'type':_0x865a54(0x172),'text':_0x10d067[_0x865a54(0x188)]||_0x10d067['output']||_0x865a54(0x163)}],'isError':!![]};}),_0x11ca4a[_0x1bb396(0x176)]('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']()[_0x1bb396(0x164)](_0x1bb396(0x16e)),'category':z[_0x1bb396(0x167)]([_0x1bb396(0x168),'CDP','AI',_0x1bb396(0x166),_0x1bb396(0x160)])[_0x1bb396(0x183)]()[_0x1bb396(0x164)](_0x1bb396(0x17c))}},async({query:_0x698922,category:_0x2cdd2a})=>{const _0x230d12=_0x1bb396,_0x4c0d09=searchCommands({'query':_0x698922,'category':_0x2cdd2a});if(_0x4c0d09[_0x230d12(0x169)]===0x0)return{'content':[{'type':_0x230d12(0x172),'text':_0x230d12(0x187)+_0x698922+'\x22'}]};const _0x591c66=_0x4c0d09['map'](_0xd3f82d=>{const _0x5ca2f0=_0x230d12,_0x2a3e07=_0xd3f82d[_0x5ca2f0(0x175)]['map'](_0x150f48=>'\x20\x20'+_0x150f48)[_0x5ca2f0(0x15c)]('\x0a');return'**'+_0xd3f82d[_0x5ca2f0(0x181)]+'**\x20('+_0xd3f82d[_0x5ca2f0(0x17f)]+')\x0a'+_0xd3f82d[_0x5ca2f0(0x15e)]+_0x5ca2f0(0x16d)+_0x2a3e07;})['join'](_0x230d12(0x15b));return{'content':[{'type':_0x230d12(0x172),'text':_0x591c66}]};}),_0x11ca4a;}export async function startMCPServer(_0x189201={}){const _0x223933=a56_0x3ab0,_0x341413=createMCPServer(_0x189201),_0x3bb636=new StdioServerTransport();return await _0x341413[_0x223933(0x16c)](_0x3bb636),new Promise(_0x42dad4=>{const _0x592f73=_0x223933;let _0x14907a=![];const _0x4ad9d4=async()=>{const _0x2a2445=a56_0x3ab0;if(_0x14907a)return;_0x14907a=!![],await _0x341413[_0x2a2445(0x173)](),_0x42dad4();};process[_0x592f73(0x15d)](_0x592f73(0x165),_0x4ad9d4),process['once'](_0x592f73(0x17a),_0x4ad9d4),process[_0x592f73(0x17e)]['once'](_0x592f73(0x173),_0x4ad9d4);});}
1
+ (function(_0x2fe02d,_0x3ecb76){const _0x5ba4fa=a56_0x748b,_0x170275=_0x2fe02d();while(!![]){try{const _0x1fa3ae=parseInt(_0x5ba4fa(0x103))/0x1*(parseInt(_0x5ba4fa(0xfc))/0x2)+-parseInt(_0x5ba4fa(0x129))/0x3+-parseInt(_0x5ba4fa(0x10b))/0x4+parseInt(_0x5ba4fa(0x11e))/0x5+-parseInt(_0x5ba4fa(0x107))/0x6*(-parseInt(_0x5ba4fa(0x120))/0x7)+-parseInt(_0x5ba4fa(0x117))/0x8*(-parseInt(_0x5ba4fa(0x11b))/0x9)+-parseInt(_0x5ba4fa(0x128))/0xa;if(_0x1fa3ae===_0x3ecb76)break;else _0x170275['push'](_0x170275['shift']());}catch(_0x19ce52){_0x170275['push'](_0x170275['shift']());}}}(a56_0x15e1,0x94a75));function a56_0x15e1(){const _0x53e192=['length','\x0a\x0a---\x0a\x0a','3965350rTgLdE','name','5334581YxCFEx','Command\x20completed\x20successfully','array','description','success','\x0a\x0aExamples:\x0a','SIGTERM','SIGINT','5323540JquqsO','1208916STWfDa','optional','error','1768TQHyHM','tdx_run','CDP','No\x20commands\x20found\x20matching\x20\x22','enum','tdx','close','757TsEfrI','string','join','Optional\x20filter\x20by\x20category','6WwIWjj','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','once','Data','2763652uaaiFn','Context','map','tdx_search','connect','output','examples','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.','Command\x20failed','describe','text','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','86264CGfSKH','stdin','registerTool','**\x20(','9PxghZE'];a56_0x15e1=function(){return _0x53e192;};return a56_0x15e1();}import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';function a56_0x748b(_0x3ac23d,_0x41379c){_0x3ac23d=_0x3ac23d-0xfa;const _0x15e15a=a56_0x15e1();let _0x748b18=_0x15e15a[_0x3ac23d];return _0x748b18;}export function createMCPServer(_0x2da081={}){const _0x233524=a56_0x748b,_0x3cdc18=new McpServer({'name':_0x233524(0x101),'version':'1.0.0'});return _0x3cdc18[_0x233524(0x119)](_0x233524(0xfd),{'description':_0x233524(0x112),'inputSchema':{'args':z[_0x233524(0x122)](z[_0x233524(0x104)]())[_0x233524(0x114)](_0x233524(0x116))}},async({args:_0x5bf440})=>{const _0xb24f13=_0x233524,_0x30ab5d=await executeTdxRun({'args':_0x5bf440},_0x2da081['env']||{});return _0x30ab5d[_0xb24f13(0x124)]?{'content':[{'type':'text','text':_0x30ab5d[_0xb24f13(0x110)]||_0xb24f13(0x121)}]}:{'content':[{'type':_0xb24f13(0x115),'text':_0x30ab5d[_0xb24f13(0xfb)]||_0x30ab5d[_0xb24f13(0x110)]||_0xb24f13(0x113)}],'isError':!![]};}),_0x3cdc18[_0x233524(0x119)](_0x233524(0x10e),{'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[_0x233524(0x104)]()[_0x233524(0x114)](_0x233524(0x108)),'category':z[_0x233524(0x100)]([_0x233524(0x10a),_0x233524(0xfe),'AI',_0x233524(0x10c),'Utilities'])[_0x233524(0xfa)]()[_0x233524(0x114)](_0x233524(0x106))}},async({query:_0x51b915,category:_0x4c15b0})=>{const _0x5ecc0d=_0x233524,_0x1bca86=searchCommands({'query':_0x51b915,'category':_0x4c15b0});if(_0x1bca86[_0x5ecc0d(0x11c)]===0x0)return{'content':[{'type':_0x5ecc0d(0x115),'text':_0x5ecc0d(0xff)+_0x51b915+'\x22'}]};const _0x24a9ab=_0x1bca86[_0x5ecc0d(0x10d)](_0x1d4107=>{const _0x1a12e7=_0x5ecc0d,_0x4aebe6=_0x1d4107[_0x1a12e7(0x111)][_0x1a12e7(0x10d)](_0x18c6b1=>'\x20\x20'+_0x18c6b1)[_0x1a12e7(0x105)]('\x0a');return'**'+_0x1d4107[_0x1a12e7(0x11f)]+_0x1a12e7(0x11a)+_0x1d4107['category']+')\x0a'+_0x1d4107[_0x1a12e7(0x123)]+_0x1a12e7(0x125)+_0x4aebe6;})[_0x5ecc0d(0x105)](_0x5ecc0d(0x11d));return{'content':[{'type':_0x5ecc0d(0x115),'text':_0x24a9ab}]};}),_0x3cdc18;}export async function startMCPServer(_0xeb80f9={}){const _0x2923e5=a56_0x748b,_0x5b9761=createMCPServer(_0xeb80f9),_0x4923df=new StdioServerTransport();return await _0x5b9761[_0x2923e5(0x10f)](_0x4923df),new Promise(_0x501bd5=>{const _0x564e8b=_0x2923e5;let _0x732ee6=![];const _0x236953=async()=>{const _0x2e7053=a56_0x748b;if(_0x732ee6)return;_0x732ee6=!![],await _0x5b9761[_0x2e7053(0x102)](),_0x501bd5();};process[_0x564e8b(0x109)](_0x564e8b(0x127),_0x236953),process[_0x564e8b(0x109)](_0x564e8b(0x126),_0x236953),process[_0x564e8b(0x118)][_0x564e8b(0x109)](_0x564e8b(0x102),_0x236953);});}
@@ -1 +1 @@
1
- function a57_0x22a3(){var _0x5a0dc5=['5foXPxT','601576iuvhnp','2762046cxvNEw','354128kTyvIy','561342HammQm','11184048CbZQjn','1032204MapWPj','284448kanXHX'];a57_0x22a3=function(){return _0x5a0dc5;};return a57_0x22a3();}(function(_0x3137ff,_0x5aa073){var _0xd8fab2=a57_0x6a71,_0x397dd8=_0x3137ff();while(!![]){try{var _0x189a4c=-parseInt(_0xd8fab2(0x114))/0x1+-parseInt(_0xd8fab2(0x115))/0x2+-parseInt(_0xd8fab2(0x118))/0x3+parseInt(_0xd8fab2(0x11a))/0x4*(parseInt(_0xd8fab2(0x119))/0x5)+-parseInt(_0xd8fab2(0x117))/0x6+-parseInt(_0xd8fab2(0x11b))/0x7+parseInt(_0xd8fab2(0x116))/0x8;if(_0x189a4c===_0x5aa073)break;else _0x397dd8['push'](_0x397dd8['shift']());}catch(_0x4929bb){_0x397dd8['push'](_0x397dd8['shift']());}}}(a57_0x22a3,0x3d90d));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';function a57_0x6a71(_0x37e327,_0x332927){_0x37e327=_0x37e327-0x114;var _0x22a3c4=a57_0x22a3();var _0x6a71b1=_0x22a3c4[_0x37e327];return _0x6a71b1;}export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
1
+ function a57_0x97e5(){var _0x42fe9b=['16079rMpodx','2675870djZlPm','36091zaunqU','868690EvkQFe','2796RJoPLI','1975455eWZlNc','1DKUkTg','4LJXnhE','55287uuOxbD','948uwZPLa','903897gflinJ','56gBdCse'];a57_0x97e5=function(){return _0x42fe9b;};return a57_0x97e5();}(function(_0x1d52d1,_0x1413e2){var _0x4fc360=a57_0x4f88,_0xba422b=_0x1d52d1();while(!![]){try{var _0x33f220=-parseInt(_0x4fc360(0x10b))/0x1*(parseInt(_0x4fc360(0x114))/0x2)+-parseInt(_0x4fc360(0x10f))/0x3+-parseInt(_0x4fc360(0x10c))/0x4*(parseInt(_0x4fc360(0x10a))/0x5)+parseInt(_0x4fc360(0x10e))/0x6*(parseInt(_0x4fc360(0x111))/0x7)+-parseInt(_0x4fc360(0x110))/0x8*(parseInt(_0x4fc360(0x10d))/0x9)+parseInt(_0x4fc360(0x112))/0xa+parseInt(_0x4fc360(0x113))/0xb*(parseInt(_0x4fc360(0x115))/0xc);if(_0x33f220===_0x1413e2)break;else _0xba422b['push'](_0xba422b['shift']());}catch(_0x526cf5){_0xba422b['push'](_0xba422b['shift']());}}}(a57_0x97e5,0x36042));function a57_0x4f88(_0x4c5ff8,_0x278c50){_0x4c5ff8=_0x4c5ff8-0x10a;var _0x97e5a9=a57_0x97e5();var _0x4f880a=_0x97e5a9[_0x4c5ff8];return _0x4f880a;}export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
@@ -1 +1 @@
1
- const a58_0x5f01ab=a58_0x3905;(function(_0x3c9fb8,_0x1fed0a){const _0x529e8d=a58_0x3905,_0x11cc49=_0x3c9fb8();while(!![]){try{const _0x24ab6b=-parseInt(_0x529e8d(0x73))/0x1+parseInt(_0x529e8d(0x8d))/0x2*(parseInt(_0x529e8d(0x77))/0x3)+-parseInt(_0x529e8d(0x7b))/0x4+-parseInt(_0x529e8d(0x8b))/0x5+-parseInt(_0x529e8d(0x8c))/0x6*(-parseInt(_0x529e8d(0x75))/0x7)+-parseInt(_0x529e8d(0x7d))/0x8+parseInt(_0x529e8d(0x85))/0x9*(parseInt(_0x529e8d(0x79))/0xa);if(_0x24ab6b===_0x1fed0a)break;else _0x11cc49['push'](_0x11cc49['shift']());}catch(_0x504f13){_0x11cc49['push'](_0x11cc49['shift']());}}}(a58_0x8a3a,0xca819));import{spawn}from'child_process';function a58_0x3905(_0x3beb76,_0x1b0cec){_0x3beb76=_0x3beb76-0x72;const _0x8a3a5e=a58_0x8a3a();let _0x390581=_0x8a3a5e[_0x3beb76];return _0x390581;}import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';function a58_0x8a3a(){const _0x50e461=['Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','7730982MlwuUB','stdout','true','pipe','Failed\x20to\x20spawn\x20tdx:\x20','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','3550400SkOqXa','14010Lsvhvu','187744JOFFRR','object','describe','kill','stderr','1256507ajyWkL','error','2807JeqVQb','message','6nmPbgX','data','40zXrIlf','array','3427824SrDlCB','--json','7256504bmeRUe','toString','close','env','tdx','SIGTERM','string'];a58_0x8a3a=function(){return _0x50e461;};return a58_0x8a3a();}export const TdxRunInputSchema=z[a58_0x5f01ab(0x8e)]({'args':z[a58_0x5f01ab(0x7a)](z[a58_0x5f01ab(0x83)]())[a58_0x5f01ab(0x8f)](a58_0x5f01ab(0x84))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;export async function executeTdxRun(_0x39f0cc,_0x1e1f56){const _0x1b9eb7=a58_0x5f01ab,{args:_0x314aa8}=_0x39f0cc;if(isBlockedCommand(_0x314aa8)){const _0x17ebc2=getBlockedReason(_0x314aa8);return{'success':![],'output':'','error':_0x17ebc2||'This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','exitCode':0x1};}const _0x5d03da=[_0x1b9eb7(0x7c),'--no-color',..._0x314aa8];return new Promise(_0x1da284=>{const _0x2e9bfe=_0x1b9eb7,_0x641b2b=spawn(_0x2e9bfe(0x81),_0x5d03da,{'env':{...process[_0x2e9bfe(0x80)],..._0x1e1f56,'CI':_0x2e9bfe(0x87)},'stdio':['ignore',_0x2e9bfe(0x88),_0x2e9bfe(0x88)]});let _0x4d08c9='',_0x230c7e='',_0xefb7c7=![];const _0x58d37b=setTimeout(()=>{const _0x1a3181=_0x2e9bfe;_0xefb7c7=!![],_0x641b2b[_0x1a3181(0x90)](_0x1a3181(0x82));},DEFAULT_TIMEOUT_MS);_0x641b2b[_0x2e9bfe(0x86)]['on'](_0x2e9bfe(0x78),_0x1e471d=>{const _0x5a7cd9=_0x2e9bfe;_0x4d08c9+=_0x1e471d[_0x5a7cd9(0x7e)]();}),_0x641b2b[_0x2e9bfe(0x72)]['on'](_0x2e9bfe(0x78),_0x34b63b=>{const _0x7a4fcd=_0x2e9bfe;_0x230c7e+=_0x34b63b[_0x7a4fcd(0x7e)]();}),_0x641b2b['on'](_0x2e9bfe(0x74),_0x5dfb4f=>{const _0x256c99=_0x2e9bfe;clearTimeout(_0x58d37b),_0x1da284({'success':![],'output':'','error':_0x256c99(0x89)+_0x5dfb4f[_0x256c99(0x76)],'exitCode':0x1});}),_0x641b2b['on'](_0x2e9bfe(0x7f),_0x4e7def=>{const _0x10aff7=_0x2e9bfe;clearTimeout(_0x58d37b);if(_0xefb7c7){_0x1da284({'success':![],'output':formatOutput(_0x4d08c9),'error':_0x10aff7(0x8a),'exitCode':0x7c});return;}const _0x15db43=_0x4e7def??0x1,_0x26cd31=_0x15db43===0x0,_0x24a90b=formatOutput(_0x4d08c9||_0x230c7e),_0x3abcf7=!_0x26cd31&&_0x230c7e?formatOutput(_0x230c7e):undefined;_0x1da284({'success':_0x26cd31,'output':_0x24a90b,'error':_0x3abcf7,'exitCode':_0x15db43});});});}
1
+ const a58_0x44d1c7=a58_0x41b2;(function(_0x167ce1,_0x37a352){const _0x3f6caf=a58_0x41b2,_0x437d93=_0x167ce1();while(!![]){try{const _0x58e040=-parseInt(_0x3f6caf(0x151))/0x1*(parseInt(_0x3f6caf(0x159))/0x2)+parseInt(_0x3f6caf(0x166))/0x3*(-parseInt(_0x3f6caf(0x16a))/0x4)+parseInt(_0x3f6caf(0x14f))/0x5+parseInt(_0x3f6caf(0x160))/0x6+-parseInt(_0x3f6caf(0x15c))/0x7*(parseInt(_0x3f6caf(0x15a))/0x8)+parseInt(_0x3f6caf(0x157))/0x9+parseInt(_0x3f6caf(0x158))/0xa;if(_0x58e040===_0x37a352)break;else _0x437d93['push'](_0x437d93['shift']());}catch(_0x1a56f2){_0x437d93['push'](_0x437d93['shift']());}}}(a58_0x8b35,0x58b62));import{spawn}from'child_process';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a58_0x44d1c7(0x167)]({'args':z[a58_0x44d1c7(0x15d)](z[a58_0x44d1c7(0x16b)]())[a58_0x44d1c7(0x153)](a58_0x44d1c7(0x165))});function a58_0x8b35(){const _0x546b58=['Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','3sKdwzu','object','data','toString','2548252oVtCgX','string','close','2847165sQBrhU','kill','216901FqUxlV','stderr','describe','ignore','SIGTERM','error','823554COgXvQ','7206600OnbyMI','6MhfhLd','24RQuCSW','--json','176603FYkAhm','array','Failed\x20to\x20spawn\x20tdx:\x20','true','2071296xASDOA','message','pipe','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','env'];a58_0x8b35=function(){return _0x546b58;};return a58_0x8b35();}const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function a58_0x41b2(_0x3a6ee7,_0x47882f){_0x3a6ee7=_0x3a6ee7-0x14f;const _0x8b3552=a58_0x8b35();let _0x41b2d9=_0x8b3552[_0x3a6ee7];return _0x41b2d9;}export async function executeTdxRun(_0x5a78b5,_0x53aa7b){const _0x3943a3=a58_0x44d1c7,{args:_0x163eec}=_0x5a78b5;if(isBlockedCommand(_0x163eec)){const _0x565cf2=getBlockedReason(_0x163eec);return{'success':![],'output':'','error':_0x565cf2||_0x3943a3(0x163),'exitCode':0x1};}const _0x5d6d3c=[_0x3943a3(0x15b),'--no-color',..._0x163eec];return new Promise(_0x17cb47=>{const _0x3ba147=_0x3943a3,_0x9dbade=spawn('tdx',_0x5d6d3c,{'env':{...process[_0x3ba147(0x164)],..._0x53aa7b,'CI':_0x3ba147(0x15f)},'stdio':[_0x3ba147(0x154),'pipe',_0x3ba147(0x162)]});let _0x500a02='',_0x566c6c='',_0x35c439=![];const _0x4ff88e=setTimeout(()=>{const _0x1eb498=_0x3ba147;_0x35c439=!![],_0x9dbade[_0x1eb498(0x150)](_0x1eb498(0x155));},DEFAULT_TIMEOUT_MS);_0x9dbade['stdout']['on'](_0x3ba147(0x168),_0x17d471=>{_0x500a02+=_0x17d471['toString']();}),_0x9dbade[_0x3ba147(0x152)]['on'](_0x3ba147(0x168),_0x5f4f5c=>{const _0x4f9102=_0x3ba147;_0x566c6c+=_0x5f4f5c[_0x4f9102(0x169)]();}),_0x9dbade['on'](_0x3ba147(0x156),_0x56b901=>{const _0x30a8c5=_0x3ba147;clearTimeout(_0x4ff88e),_0x17cb47({'success':![],'output':'','error':_0x30a8c5(0x15e)+_0x56b901[_0x30a8c5(0x161)],'exitCode':0x1});}),_0x9dbade['on'](_0x3ba147(0x16c),_0x5097c9=>{clearTimeout(_0x4ff88e);if(_0x35c439){_0x17cb47({'success':![],'output':formatOutput(_0x500a02),'error':'Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','exitCode':0x7c});return;}const _0x1990e3=_0x5097c9??0x1,_0x3a81df=_0x1990e3===0x0,_0x12ddf9=formatOutput(_0x500a02||_0x566c6c),_0x2b4eb8=!_0x3a81df&&_0x566c6c?formatOutput(_0x566c6c):undefined;_0x17cb47({'success':_0x3a81df,'output':_0x12ddf9,'error':_0x2b4eb8,'exitCode':_0x1990e3});});});}