@treasuredata/tdx 0.16.1 → 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(_0x503520,_0x3f2fca){const _0x1268eb=a44_0x1f31,_0x396255=_0x503520();while(!![]){try{const _0x4348fc=parseInt(_0x1268eb(0x1b9))/0x1*(parseInt(_0x1268eb(0x194))/0x2)+parseInt(_0x1268eb(0x18d))/0x3+parseInt(_0x1268eb(0x195))/0x4+parseInt(_0x1268eb(0x1a1))/0x5*(parseInt(_0x1268eb(0x1cd))/0x6)+-parseInt(_0x1268eb(0x1c9))/0x7*(parseInt(_0x1268eb(0x1ab))/0x8)+-parseInt(_0x1268eb(0x1d3))/0x9+parseInt(_0x1268eb(0x1d0))/0xa*(-parseInt(_0x1268eb(0x190))/0xb);if(_0x4348fc===_0x3f2fca)break;else _0x396255['push'](_0x396255['shift']());}catch(_0x3a1aea){_0x396255['push'](_0x396255['shift']());}}}(a44_0x29f8,0xcddc4));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a44_0x515250 from'node:fs';import*as a44_0xcc7739 from'node:path';function a44_0x1f31(_0x2feb7b,_0x10be27){_0x2feb7b=_0x2feb7b-0x185;const _0x29f894=a44_0x29f8();let _0x1f318d=_0x29f894[_0x2feb7b];return _0x1f318d;}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_0x421bb4 from'chalk';export function getConfigDir(){const _0x5ea839=a44_0x1f31;return process['env'][_0x5ea839(0x1bf)]||join(homedir(),_0x5ea839(0x191),_0x5ea839(0x1b8));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0xe0b791){const _0xcc34ce=a44_0x1f31,_0xe73243=getConfigDir();return _0xe0b791?a44_0xcc7739[_0xcc34ce(0x198)](_0xe73243,'.env.'+_0xe0b791):getConfigFile();}export function getCacheDir(){const _0x327b1e=a44_0x1f31;return process[_0x327b1e(0x185)][_0x327b1e(0x1c5)]||join(homedir(),_0x327b1e(0x1cc),'tdx');}export function getLLMProjectCacheFile(_0x2d919e){const _0x43655f=a44_0x1f31,_0x44f9e6=_0x2d919e?_0x43655f(0x1ad)+_0x2d919e:'llm_default_project';return join(getCacheDir(),_0x44f9e6);}export function readCachedLLMProject(_0x17afda){const _0x1433ab=a44_0x1f31;try{const _0x439123=getLLMProjectCacheFile(_0x17afda);if(!existsSync(_0x439123))return null;const _0x56c2e2=readFileSync(_0x439123,_0x1433ab(0x1c7))['trim']();try{const _0x196742=JSON[_0x1433ab(0x19a)](_0x56c2e2);if(_0x196742&&typeof _0x196742['id']===_0x1433ab(0x1a5)&&typeof _0x196742[_0x1433ab(0x1c4)]===_0x1433ab(0x1a5))return _0x196742;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x5220d1,_0x59d604,_0xd34b5f){const _0x1a9b3f=a44_0x1f31;try{const _0x1867fb=getCacheDir(),_0x298f93=getLLMProjectCacheFile(_0xd34b5f);!existsSync(_0x1867fb)&&mkdirSync(_0x1867fb,{'recursive':!![]});const _0x7b5f27={'name':_0x5220d1,'id':_0x59d604};writeFileSync(_0x298f93,JSON[_0x1a9b3f(0x1d4)](_0x7b5f27),_0x1a9b3f(0x1c7));}catch{}}export function getLLMAgentCacheFile(_0xcac970){const _0x119296=a44_0x1f31,_0x3c125e=_0xcac970?_0x119296(0x19e)+_0xcac970:_0x119296(0x1af);return join(getCacheDir(),_0x3c125e);}export function readCachedLLMAgent(_0x3bf073){const _0x412148=a44_0x1f31;try{const _0x235f84=getLLMAgentCacheFile(_0x3bf073);if(!existsSync(_0x235f84))return null;const _0x41d9b9=readFileSync(_0x235f84,_0x412148(0x1c7))[_0x412148(0x1cf)]();try{const _0x53b485=JSON[_0x412148(0x19a)](_0x41d9b9);if(_0x53b485&&typeof _0x53b485['id']===_0x412148(0x1a5)&&typeof _0x53b485[_0x412148(0x1c4)]==='string'&&typeof _0x53b485[_0x412148(0x1aa)]===_0x412148(0x1a5))return _0x53b485;}catch{}return null;}catch{return null;}}function a44_0x29f8(){const _0x194b0f=['TDX_API_KEY\x20env\x20var','legacy\x20.env\x20file\x20(profile:\x20','TDX_API_KEY_','\x27,\x20defaulting\x20to\x20us01','TDX_CONFIG_DIR','tdx.json','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','yellow','dev-eu01','name','TDX_CACHE_DIR','existsSync','utf-8','stg-us01','876141kVswTN','jp01','readFileSync','.cache','6KwHOmR','toISOString','trim','807490HfDTkD','toUpperCase','includes','13783761cFlrSc','stringify','stg-jp01','filter','endsWith','env','split','TDX_API_KEY','ap03','\x20env\x20var','legacy\x20.env\x20file','site','startsWith','1275456eMpHnZ','keychain\x20(profile:\x20','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','11RitzHz','.config','TD_API_KEY','profile','274KIkwDv','5643020vpluDN','.env.','number','join','isDeprecated','parse','Warning:\x20Failed\x20to\x20read\x20','ap02','.env','llm_default_agent.','Warning:\x20Unknown\x20site\x20\x27','replace','3314060rDnpmj','accountId','eu01','.json','string','warn','TD_API_KEY_','apiKey','us01','projectId','8BlcBtD','Warning:\x20Failed\x20to\x20load\x20','llm_default_project.','stg-ap03','llm_default_agent','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','TDX_API_KEY_<PROFILE>','TD_API_KEY\x20env\x20var\x20(deprecated)','slice','dev-us01','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','account_info.','match','tdx','598ZqExVD','entries'];a44_0x29f8=function(){return _0x194b0f;};return a44_0x29f8();}export function writeCachedLLMAgent(_0x2692a3,_0x937397,_0x5a2f95,_0x1d62b8){const _0x4a4e0d=a44_0x1f31;try{const _0x36f609=getCacheDir(),_0x17239c=getLLMAgentCacheFile(_0x1d62b8);!existsSync(_0x36f609)&&mkdirSync(_0x36f609,{'recursive':!![]});const _0x1bae97={'name':_0x2692a3,'id':_0x937397,'projectId':_0x5a2f95};writeFileSync(_0x17239c,JSON[_0x4a4e0d(0x1d4)](_0x1bae97),_0x4a4e0d(0x1c7));}catch{}}export function clearCachedLLMAgent(_0x5a96c2){try{const _0x4f9037=getLLMAgentCacheFile(_0x5a96c2);existsSync(_0x4f9037)&&unlinkSync(_0x4f9037);}catch{}}export function getAccountInfoCacheFile(_0x51bdad){const _0x344c91=a44_0x1f31,_0x5a835c=_0x51bdad?_0x344c91(0x1b6)+_0x51bdad+_0x344c91(0x1a4):'account_info.json';return join(getCacheDir(),_0x5a835c);}export function readCachedAccountInfo(_0x350390){const _0x576032=a44_0x1f31;try{const _0x1e061d=getAccountInfoCacheFile(_0x350390);if(!existsSync(_0x1e061d))return null;const _0x568bcc=readFileSync(_0x1e061d,_0x576032(0x1c7))['trim'](),_0x100e08=JSON[_0x576032(0x19a)](_0x568bcc);if(_0x100e08&&typeof _0x100e08[_0x576032(0x18b)]===_0x576032(0x1a5)&&typeof _0x100e08[_0x576032(0x1a2)]===_0x576032(0x197))return _0x100e08;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x27bccf,_0x4eb449,_0x1cd41d){const _0x3f764c=a44_0x1f31;try{const _0x394162=getCacheDir(),_0x64e589=getAccountInfoCacheFile(_0x1cd41d);!existsSync(_0x394162)&&mkdirSync(_0x394162,{'recursive':!![]});const _0x5e88d0={'site':_0x27bccf,'accountId':_0x4eb449,'cachedAt':new Date()[_0x3f764c(0x1ce)]()};writeFileSync(_0x64e589,JSON[_0x3f764c(0x1d4)](_0x5e88d0),_0x3f764c(0x1c7));}catch{}}export function parseEnvFile(_0x20517a){const _0x5cf46e=a44_0x1f31,_0x1e06cf={};for(const _0x5b78d0 of _0x20517a[_0x5cf46e(0x186)]('\x0a')){const _0x10373b=_0x5b78d0[_0x5cf46e(0x1cf)]();if(!_0x10373b||_0x10373b[_0x5cf46e(0x18c)]('#'))continue;const _0x27e786=_0x10373b[_0x5cf46e(0x1b7)](/^([^=]+)=(.*)$/);if(_0x27e786){const _0x2386fd=_0x27e786[0x1][_0x5cf46e(0x1cf)]();let _0x4d81a4=_0x27e786[0x2][_0x5cf46e(0x1cf)]();(_0x4d81a4[_0x5cf46e(0x18c)]('\x22')&&_0x4d81a4[_0x5cf46e(0x1d7)]('\x22')||_0x4d81a4[_0x5cf46e(0x18c)]('\x27')&&_0x4d81a4[_0x5cf46e(0x1d7)]('\x27'))&&(_0x4d81a4=_0x4d81a4[_0x5cf46e(0x1b3)](0x1,-0x1)),_0x1e06cf[_0x2386fd]=_0x4d81a4;}}return _0x1e06cf;}export function readUserConfig(){const _0x14bec4=a44_0x1f31,_0xa0ef6b=getConfigFile();if(!existsSync(_0xa0ef6b))return{};try{const _0xefeca1=readFileSync(_0xa0ef6b,_0x14bec4(0x1c7));return parseEnvFile(_0xefeca1);}catch(_0x1f3981){return console[_0x14bec4(0x1a6)](_0x14bec4(0x18f)+_0xa0ef6b+':',_0x1f3981),{};}}export function resolveSite(_0x2d7cbc){const _0x2abd6c=a44_0x1f31,_0x42f575=['us01','jp01',_0x2abd6c(0x1a3),_0x2abd6c(0x19c),_0x2abd6c(0x188),_0x2abd6c(0x1b4),_0x2abd6c(0x1c3),_0x2abd6c(0x1c8),_0x2abd6c(0x1d5),_0x2abd6c(0x1ae)];if(_0x42f575[_0x2abd6c(0x1d2)](_0x2d7cbc))return _0x2d7cbc;if(_0x2d7cbc in SITE_ALIASES)return SITE_ALIASES[_0x2d7cbc];return console[_0x2abd6c(0x1a6)](_0x2abd6c(0x19f)+_0x2d7cbc+_0x2abd6c(0x1be)),_0x2abd6c(0x1a9);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x128d8d,_0x1577ee){const _0x27c084=a44_0x1f31,_0x4f8f0b=_0x1577ee||getActiveProfileName();if(_0x4f8f0b){const _0xbf6f1b='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x4f8f0b);if(process[_0x27c084(0x185)][_0xbf6f1b])return process['env'][_0xbf6f1b];}if(process[_0x27c084(0x185)][_0x27c084(0x187)])return process['env'][_0x27c084(0x187)];if(process[_0x27c084(0x185)][_0x27c084(0x192)])return process['env'][_0x27c084(0x192)];const _0x42521c=_0x128d8d[_0x27c084(0x1d1)]()[_0x27c084(0x1a0)](/-/g,'_'),_0x360eaf=_0x27c084(0x1a7)+_0x42521c;if(_0x4f8f0b){const _0x3b0ce1=loadProfileEnv(_0x4f8f0b);if(_0x3b0ce1){if(_0x3b0ce1[_0x360eaf])return _0x3b0ce1[_0x360eaf];if(_0x3b0ce1[_0x27c084(0x192)])return _0x3b0ce1[_0x27c084(0x192)];}}const _0xaa00ad=loadUserConfigOnce();if(_0xaa00ad[_0x360eaf])return _0xaa00ad[_0x360eaf];if(_0xaa00ad[_0x27c084(0x192)])return _0xaa00ad[_0x27c084(0x192)];return undefined;}export function normalizeProfileForEnvVar(_0x39a448){return _0x39a448['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x292789,_0x502218){const _0x40eaef=a44_0x1f31,_0x5bf851=_0x502218||getActiveProfileName()||undefined;if(_0x5bf851){const _0x24d578=_0x40eaef(0x1bd)+normalizeProfileForEnvVar(_0x5bf851);if(process['env'][_0x24d578])return{'apiKey':process['env'][_0x24d578],'source':_0x24d578+_0x40eaef(0x189),'isDeprecated':![]};const _0x31463f=getCachedCredential(_0x292789,_0x5bf851);if(_0x31463f)return{'apiKey':_0x31463f,'source':_0x40eaef(0x18e)+_0x5bf851+')','isDeprecated':![]};const _0x266189=await getKeychainAPIKey(_0x5bf851);if(_0x266189)return setCachedCredential(_0x266189,_0x292789,_0x5bf851),{'apiKey':_0x266189,'source':_0x40eaef(0x18e)+_0x5bf851+')','isDeprecated':![]};}if(process[_0x40eaef(0x185)][_0x40eaef(0x187)])return{'apiKey':process['env']['TDX_API_KEY'],'source':_0x40eaef(0x1bb),'isDeprecated':![]};if(!_0x5bf851){const _0x1f2930=getCachedCredential(_0x292789,undefined);if(_0x1f2930)return{'apiKey':_0x1f2930,'source':'keychain','isDeprecated':![]};const _0x26cc66=await getKeychainAPIKey(undefined);if(_0x26cc66)return setCachedCredential(_0x26cc66,_0x292789,undefined),{'apiKey':_0x26cc66,'source':'keychain','isDeprecated':![]};}if(process[_0x40eaef(0x185)][_0x40eaef(0x192)])return{'apiKey':process['env'][_0x40eaef(0x192)],'source':_0x40eaef(0x1b2),'isDeprecated':!![]};const _0x1641fd=getLegacyEnvAPIKey(_0x292789,_0x5bf851);if(_0x1641fd){const _0x5e75eb=await isKeychainAvailable();if(_0x5e75eb)try{await saveKeychainAPIKey(_0x1641fd,_0x5bf851),setCachedCredential(_0x1641fd,_0x292789,_0x5bf851);const _0x3e1485=getConfigFilePath(_0x5bf851);cleanupLegacyEnvFile(_0x3e1485)&&console[_0x40eaef(0x1a6)](a44_0x421bb4[_0x40eaef(0x1c2)](_0x40eaef(0x1c1)));}catch(_0x24bcc3){console[_0x40eaef(0x1a6)](a44_0x421bb4[_0x40eaef(0x1c2)](_0x40eaef(0x1b0)+_0x24bcc3));}const _0x7c399b=_0x5bf851?_0x40eaef(0x1bc)+_0x5bf851+')':_0x40eaef(0x18a);return{'apiKey':_0x1641fd,'source':_0x7c399b,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x47520d,_0x1ffc64,_0x207c3f=!![]){const _0x227b49=a44_0x1f31,_0x3ef7ff=await resolveAPIKeyAsync(_0x47520d,_0x1ffc64);if(!_0x3ef7ff)return undefined;if(_0x207c3f&&_0x3ef7ff[_0x227b49(0x199)]&&_0x3ef7ff['source'][_0x227b49(0x1d2)](_0x227b49(0x192))){const _0x3208df=_0x1ffc64||getActiveProfileName()||undefined,_0x16647e=_0x3208df?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x3208df):_0x227b49(0x1b1);console[_0x227b49(0x1a6)](a44_0x421bb4['yellow'](_0x227b49(0x1b5)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x16647e+').')));}return _0x3ef7ff[_0x227b49(0x1a8)];}function getLegacyEnvAPIKey(_0xf14adb,_0x861dec){const _0x2c968d=a44_0x1f31,_0x3ac6b3=_0xf14adb[_0x2c968d(0x1d1)]()['replace'](/-/g,'_'),_0x1aec49='TD_API_KEY_'+_0x3ac6b3;if(_0x861dec){const _0xd0fda8=loadProfileEnv(_0x861dec);if(_0xd0fda8){if(_0xd0fda8[_0x1aec49])return _0xd0fda8[_0x1aec49];if(_0xd0fda8['TD_API_KEY'])return _0xd0fda8[_0x2c968d(0x192)];}}const _0xc91293=loadUserConfigOnce();if(_0xc91293[_0x1aec49])return _0xc91293[_0x1aec49];if(_0xc91293[_0x2c968d(0x192)])return _0xc91293['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0x3361c0){const _0x51c11a=a44_0x1f31;if(!existsSync(_0x3361c0))return![];try{const _0x1dee09=readFileSync(_0x3361c0,_0x51c11a(0x1c7)),_0x143e9d=_0x1dee09[_0x51c11a(0x186)]('\x0a'),_0x2a89e8=_0x143e9d[_0x51c11a(0x1d6)](_0x530818=>{const _0x462914=_0x51c11a,_0x19476a=_0x530818['trim']();if(!_0x19476a||_0x19476a[_0x462914(0x18c)]('#'))return!![];const [_0x5da6f1]=_0x19476a[_0x462914(0x186)]('=');return!_0x5da6f1[_0x462914(0x18c)](_0x462914(0x192));}),_0x1e6a5b=_0x2a89e8['some'](_0x3dcb65=>{const _0x54cf76=_0x51c11a,_0x1c7460=_0x3dcb65[_0x54cf76(0x1cf)]();return _0x1c7460&&!_0x1c7460['startsWith']('#');});if(!_0x1e6a5b)return unlinkSync(_0x3361c0),!![];return writeFileSync(_0x3361c0,_0x2a89e8[_0x51c11a(0x198)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x54f058){const _0x59690c=a44_0x1f31,_0x18ab0d=a44_0xcc7739['join'](getConfigDir(),_0x59690c(0x196)+_0x54f058);if(a44_0x515250[_0x59690c(0x1c6)](_0x18ab0d)){validateSecureFilePermissions(_0x18ab0d);try{const _0x3b271b=a44_0x515250[_0x59690c(0x1cb)](_0x18ab0d,'utf-8');return parseEnvFile(_0x3b271b);}catch(_0x5456f4){console[_0x59690c(0x1a6)](_0x59690c(0x1ac)+_0x18ab0d+':\x20'+_0x5456f4);}}const _0x480041=a44_0xcc7739[_0x59690c(0x198)](getConfigDir(),'profiles',_0x54f058,_0x59690c(0x19d));if(a44_0x515250[_0x59690c(0x1c6)](_0x480041)){validateSecureFilePermissions(_0x480041);try{const _0x8ab395=a44_0x515250[_0x59690c(0x1cb)](_0x480041,_0x59690c(0x1c7));return parseEnvFile(_0x8ab395);}catch(_0x569e97){return console['warn'](_0x59690c(0x1ac)+_0x480041+':\x20'+_0x569e97),null;}}return null;}function getActiveProfileName(){const _0x5bb284=a44_0x1f31,_0x584eba=a44_0xcc7739[_0x5bb284(0x198)](getConfigDir(),_0x5bb284(0x1c0));if(!a44_0x515250[_0x5bb284(0x1c6)](_0x584eba))return null;try{const _0xa15c36=a44_0x515250[_0x5bb284(0x1cb)](_0x584eba,_0x5bb284(0x1c7)),_0x18e0cd=JSON['parse'](_0xa15c36);return _0x18e0cd[_0x5bb284(0x193)]||null;}catch{return null;}}export function saveAPIKey(_0x32d7ce,_0x3452b9,_0xbd1894){const _0x33372d=a44_0x1f31,_0x64beb7=getConfigDir(),_0xb7114c=getConfigFilePath(_0xbd1894);!existsSync(_0x64beb7)&&mkdirSync(_0x64beb7,{'recursive':!![],'mode':0x1c0});let _0x58b28e={};if(existsSync(_0xb7114c))try{const _0x5713f0=readFileSync(_0xb7114c,_0x33372d(0x1c7));_0x58b28e=parseEnvFile(_0x5713f0);}catch(_0x2fea19){console[_0x33372d(0x1a6)](_0x33372d(0x19b)+_0xb7114c+':',_0x2fea19);}const _0x4a71b7=_0x32d7ce[_0x33372d(0x1d1)]()[_0x33372d(0x1a0)](/-/g,'_');_0x58b28e[_0x33372d(0x1a7)+_0x4a71b7]=_0x3452b9;const _0x4ea1ba=Object[_0x33372d(0x1ba)](_0x58b28e)['map'](([_0x459f80,_0xc71768])=>_0x459f80+'='+_0xc71768);writeFileSync(_0xb7114c,_0x4ea1ba[_0x33372d(0x198)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x285e11,_0xcd3604,_0x1e2c25){const _0x51e831=a44_0x1f31;await saveKeychainAPIKey(_0x285e11,_0x1e2c25),setCachedCredential(_0x285e11,_0xcd3604,_0x1e2c25);const _0xfa407e=getConfigFilePath(_0x1e2c25);cleanupLegacyEnvFile(_0xfa407e)&&console[_0x51e831(0x1a6)](a44_0x421bb4[_0x51e831(0x1c2)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0xedbd5d=a44_0x1f31,_0x3966c5={'apiKeys':{},'defaultSite':'us01'},_0x110781=['us01',_0xedbd5d(0x1ca),'eu01',_0xedbd5d(0x19c),'ap03',_0xedbd5d(0x1b4),_0xedbd5d(0x1c3),_0xedbd5d(0x1c8),_0xedbd5d(0x1d5),_0xedbd5d(0x1ae)];for(const _0x43aa43 of _0x110781){const _0xb41d4a=getAPIKey(_0x43aa43);_0xb41d4a&&(_0x3966c5['apiKeys'][_0x43aa43]=_0xb41d4a);}return _0x3966c5;}
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(_0x47290a,_0x16f145){const _0x5bcf1b=a45_0x2699,_0x3c6abc=_0x47290a();while(!![]){try{const _0x5a33f5=parseInt(_0x5bcf1b(0x1aa))/0x1+-parseInt(_0x5bcf1b(0x1b1))/0x2*(-parseInt(_0x5bcf1b(0x1b2))/0x3)+-parseInt(_0x5bcf1b(0x1a5))/0x4+parseInt(_0x5bcf1b(0x1a8))/0x5*(-parseInt(_0x5bcf1b(0x1a4))/0x6)+parseInt(_0x5bcf1b(0x1a6))/0x7*(parseInt(_0x5bcf1b(0x1af))/0x8)+-parseInt(_0x5bcf1b(0x1b3))/0x9*(parseInt(_0x5bcf1b(0x1a9))/0xa)+parseInt(_0x5bcf1b(0x1ad))/0xb*(-parseInt(_0x5bcf1b(0x1ac))/0xc);if(_0x5a33f5===_0x16f145)break;else _0x3c6abc['push'](_0x3c6abc['shift']());}catch(_0xc0872f){_0x3c6abc['push'](_0x3c6abc['shift']());}}}(a45_0x18a6,0x3ec9a));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';function a45_0x2699(_0xe12488,_0x2af52f){_0xe12488=_0xe12488-0x1a3;const _0x18a64a=a45_0x18a6();let _0x2699da=_0x18a64a[_0xe12488];return _0x2699da;}import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x246853){const _0x8afb14=a45_0x2699,_0xafaa36=_0x246853||'default';return join(getCacheDir(),_0x8afb14(0x1ae)+_0xafaa36+_0x8afb14(0x1b0));}export function loadCachedConnections(_0x373d82){const _0x29cdff=a45_0x2699,_0x1c4761=getCacheFilePath(_0x373d82);if(!existsSync(_0x1c4761))return null;try{const _0x28e996=readFileSync(_0x1c4761,_0x29cdff(0x1b4)),_0x4f3b77=JSON['parse'](_0x28e996);return _0x4f3b77[_0x29cdff(0x1a3)];}catch{return null;}}export function saveCachedConnections(_0x13865c,_0x58c7ac){const _0x4910ca=a45_0x2699,_0x3f463a=getCacheDir();!existsSync(_0x3f463a)&&mkdirSync(_0x3f463a,{'recursive':!![]});const _0x23f2a9=getCacheFilePath(_0x13865c),_0x2971cd={'connections':_0x58c7ac,'cachedAt':Date[_0x4910ca(0x1ab)]()};writeFileSync(_0x23f2a9,JSON[_0x4910ca(0x1a7)](_0x2971cd,null,0x2),_0x4910ca(0x1b4));}function a45_0x18a6(){const _0x66bb5=['2719838gusvDu','connections-','8ouKSud','.json','758402OhdouX','3lbTQQr','4797fKCfSy','utf-8','connections','83382VxATjS','1509416rLiSog','3318728AjvmeO','stringify','5ufqjMo','1790sGwDxj','385047mLUJvN','now','24GjEurH'];a45_0x18a6=function(){return _0x66bb5;};return a45_0x18a6();}export function clearConnectionCache(_0x57ad5e){const _0x39a2c3=getCacheFilePath(_0x57ad5e);if(existsSync(_0x39a2c3))try{unlinkSync(_0x39a2c3);}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(_0xaa3e8c,_0x3b5656){const _0x3048cb=a46_0x2181,_0x43d600=_0xaa3e8c();while(!![]){try{const _0x3a371b=parseInt(_0x3048cb(0x1f3))/0x1+parseInt(_0x3048cb(0x1f5))/0x2*(parseInt(_0x3048cb(0x1fc))/0x3)+parseInt(_0x3048cb(0x1fe))/0x4*(parseInt(_0x3048cb(0x1f4))/0x5)+-parseInt(_0x3048cb(0x1fb))/0x6+parseInt(_0x3048cb(0x1f6))/0x7*(parseInt(_0x3048cb(0x1fd))/0x8)+parseInt(_0x3048cb(0x1f9))/0x9*(parseInt(_0x3048cb(0x1f7))/0xa)+-parseInt(_0x3048cb(0x1f8))/0xb;if(_0x3a371b===_0x3b5656)break;else _0x43d600['push'](_0x43d600['shift']());}catch(_0x1c06fb){_0x43d600['push'](_0x43d600['shift']());}}}(a46_0x2f5e,0x39381));function a46_0x2f5e(){const _0x5d757e=['9YTQBAF','number','485388SQFoCD','54HclsAE','25304bpYeaX','5816gGLJrm','88442kTYTGM','660QTyszR','17814mJKjDr','133ubfeCv','2295550moIsrz','4565891DfXnFA'];a46_0x2f5e=function(){return _0x5d757e;};return a46_0x2f5e();}function a46_0x2181(_0x30ade2,_0x1c195f){_0x30ade2=_0x30ade2-0x1f3;const _0x2f5e3d=a46_0x2f5e();let _0x21811a=_0x2f5e3d[_0x30ade2];return _0x21811a;}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0xb12bce,_0xdc8f13){const _0x428da9=a46_0x2181;if(_0xb12bce===undefined)return _0xdc8f13;if(typeof _0xb12bce===_0x428da9(0x1fa))return _0xb12bce;return parseInt(_0xb12bce,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(_0x5174bf,_0x1aa46a){const _0x2afafd=a47_0x5b45,_0x32576a=_0x5174bf();while(!![]){try{const _0x811163=-parseInt(_0x2afafd(0x164))/0x1*(parseInt(_0x2afafd(0x170))/0x2)+-parseInt(_0x2afafd(0x169))/0x3*(-parseInt(_0x2afafd(0x16a))/0x4)+parseInt(_0x2afafd(0x16f))/0x5+-parseInt(_0x2afafd(0x16e))/0x6+-parseInt(_0x2afafd(0x171))/0x7*(parseInt(_0x2afafd(0x165))/0x8)+parseInt(_0x2afafd(0x166))/0x9+parseInt(_0x2afafd(0x167))/0xa;if(_0x811163===_0x1aa46a)break;else _0x32576a['push'](_0x32576a['shift']());}catch(_0x5beb52){_0x32576a['push'](_0x32576a['shift']());}}}(a47_0x33e1,0x5535e));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x22087a,_0x2cc337){const _0x525a56=a47_0x5b45,_0x5ed246=_0x22087a||_0x525a56(0x173),_0x37b8a6=_0x2cc337||_0x525a56(0x163);return _0x5ed246+':'+_0x37b8a6;}function a47_0x5b45(_0x1df6e7,_0x545df0){_0x1df6e7=_0x1df6e7-0x162;const _0x33e10d=a47_0x33e1();let _0x5b4569=_0x33e10d[_0x1df6e7];return _0x5b4569;}export function getCachedCredential(_0x55ca02,_0x4cf33d){const _0x5401ee=a47_0x5b45,_0x527e9f=getCacheKey(_0x55ca02,_0x4cf33d),_0x439d70=cache[_0x5401ee(0x16d)](_0x527e9f);if(!_0x439d70)return null;if(Date[_0x5401ee(0x168)]()-_0x439d70[_0x5401ee(0x162)]>CACHE_TTL_MS)return cache[_0x5401ee(0x16c)](_0x527e9f),null;return _0x439d70[_0x5401ee(0x172)];}function a47_0x33e1(){const _0x9d912b=['set','delete','get','3903204NxaNHz','618355UVWWmV','2qXyOHx','7VQbQRm','apiKey','__default_site__','loadedAt','__default_profile__','626881xjTmRd','874968ZuBytx','246609HYMyfD','10740950TXYYsC','now','3LIrzGv','2042564KWpBro'];a47_0x33e1=function(){return _0x9d912b;};return a47_0x33e1();}export function setCachedCredential(_0x410953,_0x1ff426,_0x221783){const _0x12b1ca=a47_0x5b45,_0x3cc6d4=getCacheKey(_0x1ff426,_0x221783);cache[_0x12b1ca(0x16b)](_0x3cc6d4,{'apiKey':_0x410953,'loadedAt':Date[_0x12b1ca(0x168)]()});}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x3e4b58,_0x56eaa8){const _0x3dbd06=getCacheKey(_0x3e4b58,_0x56eaa8);cache['delete'](_0x3dbd06);}
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_0x4b56b8=a48_0x1495;(function(_0x19f44e,_0x10005b){const _0x112cba=a48_0x1495,_0x4369e4=_0x19f44e();while(!![]){try{const _0x1ac60a=parseInt(_0x112cba(0x12d))/0x1+parseInt(_0x112cba(0x139))/0x2*(parseInt(_0x112cba(0x146))/0x3)+-parseInt(_0x112cba(0x147))/0x4*(-parseInt(_0x112cba(0x11b))/0x5)+-parseInt(_0x112cba(0x13a))/0x6*(-parseInt(_0x112cba(0x148))/0x7)+parseInt(_0x112cba(0x10d))/0x8+parseInt(_0x112cba(0x14e))/0x9+-parseInt(_0x112cba(0x141))/0xa;if(_0x1ac60a===_0x10005b)break;else _0x4369e4['push'](_0x4369e4['shift']());}catch(_0x3af587){_0x4369e4['push'](_0x4369e4['shift']());}}}(a48_0x4d9e,0xf3d62));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_0x4d9e(){const _0x273e5c=['llm_project','.json','verbose','tdx.json','default','Session','profile','profile:\x20','displayWithSources','resolveAPIKeyAsync','TDX_SITE','join','existsSync','35ivznmk','env','display','utf-8','logLevel','string','global','sessionId','assign','cliFlags','getSource','Global\x20Credentials','session','workflow_project','\x0a[configuration\x20files]','log','profileCredentials','config','434968fQJrvs','replace','llmProject','segment_path','toString','Global','not\x20set','sessions','configFiles','llmAgent','workflowProject','segmentPath','1174408SptzOv','6HrKGRL','createAsync','Profile','parentSegment','Profile\x20Credentials','database','layers','44032820TVdsGJ','project','[context]','activeProfile','getParameters','3GUgQLZ','221404tXMcxW','11107509BtctDW','(active)','us01','loadGlobalConfig','llm_agent','injectIntoOptions','10738980YbyUYY',':\x20none','profiles','parent_segment','readFileSync','entries','apiKey','site',':\x20none\x20(using\x20session:\x20','.env','9699200aIMATr'];a48_0x4d9e=function(){return _0x273e5c;};return a48_0x4d9e();}import{LogLevel}from'../utils/tdx-logger.js';function a48_0x1495(_0x5cb5dd,_0x4cad42){_0x5cb5dd=_0x5cb5dd-0x107;const _0x4d9edb=a48_0x4d9e();let _0x14956c=_0x4d9edb[_0x5cb5dd];return _0x14956c;}import*as a48_0x55311e from'node:fs';import*as a48_0x28117e from'node:path';export class GlobalContext{['site'];[a48_0x4b56b8(0x13f)];[a48_0x4b56b8(0x151)];[a48_0x4b56b8(0x130)];[a48_0x4b56b8(0x10e)];[a48_0x4b56b8(0x14c)];['workflow_project'];[a48_0x4b56b8(0x109)];['verbose'];[a48_0x4b56b8(0x11f)];[a48_0x4b56b8(0x114)];['layers'];[a48_0x4b56b8(0x144)];[a48_0x4b56b8(0x122)];['configFiles'];constructor(_0x1517ed){const _0x4521de=a48_0x4b56b8;this[_0x4521de(0x122)]=_0x1517ed[_0x4521de(0x127)]||getCurrentSessionPID()[_0x4521de(0x131)]();const _0x1cc599=loadSessionContext(_0x1517ed[_0x4521de(0x127)]),_0x348db0=loadProjectConfig(),_0x4b4450=this['loadGlobalConfig']();this['activeProfile']=_0x1517ed[_0x4521de(0x114)]||_0x1cc599?.[_0x4521de(0x114)]||_0x4b4450['profile']||getActiveProfile();const _0x157969=this[_0x4521de(0x144)]?loadProfile(this[_0x4521de(0x144)]):null,_0x34c655=_0x57f72e=>{const _0x4843a1=_0x4521de;if(!_0x57f72e)return{};const _0x5e35a4=_0x57f72e,_0x25c259={};for(const [_0x11e4f2,_0xd4dde4]of Object[_0x4843a1(0x108)](_0x5e35a4)){typeof _0xd4dde4===_0x4843a1(0x120)&&(_0x25c259[_0x11e4f2]=_0xd4dde4);}return _0x25c259;},_0x366fae={};if(_0x1517ed[_0x4521de(0x10a)]&&_0x1517ed[_0x4521de(0x10a)]!==_0x4521de(0x14a))_0x366fae['site']=_0x1517ed[_0x4521de(0x10a)];const _0x3eb443=_0x1cc599?.[_0x4521de(0x13f)],_0x445d55=_0x348db0?.[_0x4521de(0x13f)],_0x284420=_0x157969?.[_0x4521de(0x12c)]?.['database'],_0x3d653a=_0x4b4450[_0x4521de(0x13f)];_0x1517ed['database']&&(_0x1517ed[_0x4521de(0x13f)]!==_0x3eb443&&_0x1517ed['database']!==_0x445d55&&_0x1517ed[_0x4521de(0x13f)]!==_0x284420&&_0x1517ed['database']!==_0x3d653a)&&(_0x366fae[_0x4521de(0x13f)]=_0x1517ed[_0x4521de(0x13f)]);if(_0x1517ed['parentSegment'])_0x366fae[_0x4521de(0x151)]=_0x1517ed['parentSegment'];if(_0x1517ed[_0x4521de(0x12f)])_0x366fae[_0x4521de(0x10e)]=_0x1517ed[_0x4521de(0x12f)];if(_0x1517ed[_0x4521de(0x136)])_0x366fae[_0x4521de(0x14c)]=_0x1517ed['llmAgent'];if(_0x1517ed[_0x4521de(0x114)])_0x366fae[_0x4521de(0x114)]=_0x1517ed[_0x4521de(0x114)];this[_0x4521de(0x140)]={'cliFlags':_0x366fae,'session':_0x34c655(_0x1cc599),'project':_0x34c655(_0x348db0),'profile':_0x34c655(_0x157969?.[_0x4521de(0x12c)]),'global':_0x34c655(_0x4b4450)};const _0x1661dd={...this[_0x4521de(0x140)][_0x4521de(0x121)],...this[_0x4521de(0x140)][_0x4521de(0x114)],...this[_0x4521de(0x140)][_0x4521de(0x142)]};process[_0x4521de(0x11c)][_0x4521de(0x118)]&&!this[_0x4521de(0x140)][_0x4521de(0x127)][_0x4521de(0x10a)]&&!this['layers']['cliFlags'][_0x4521de(0x10a)]&&(_0x1661dd[_0x4521de(0x10a)]=process[_0x4521de(0x11c)]['TDX_SITE']);Object[_0x4521de(0x123)](_0x1661dd,this[_0x4521de(0x140)][_0x4521de(0x127)]),Object[_0x4521de(0x123)](_0x1661dd,this[_0x4521de(0x140)][_0x4521de(0x124)]);const _0x1ddafa=_0x1661dd[_0x4521de(0x10a)]||_0x4521de(0x14a);this[_0x4521de(0x10a)]=resolveSite(_0x1ddafa),this[_0x4521de(0x13f)]=_0x1661dd[_0x4521de(0x13f)],this['parent_segment']=_0x1661dd[_0x4521de(0x151)],this[_0x4521de(0x130)]=_0x1661dd[_0x4521de(0x130)],this[_0x4521de(0x10e)]=_0x1661dd[_0x4521de(0x10e)],this[_0x4521de(0x14c)]=_0x1661dd[_0x4521de(0x14c)],this[_0x4521de(0x128)]=_0x1661dd[_0x4521de(0x128)],this[_0x4521de(0x110)]=_0x1517ed[_0x4521de(0x110)]||![],this[_0x4521de(0x11f)]=_0x1517ed['logLevel']??LogLevel['INFO'],this[_0x4521de(0x114)]=this[_0x4521de(0x144)]||undefined,this['apiKey']=getAPIKey(this[_0x4521de(0x10a)],this['activeProfile']||undefined);const _0x1ce63f=getConfigDir(),_0x4afdca=a48_0x28117e[_0x4521de(0x119)](_0x1ce63f,_0x4521de(0x134),this[_0x4521de(0x122)]+_0x4521de(0x10f)),_0x1e74e6=findProjectConfigPath(),_0x3fbf2f=a48_0x28117e[_0x4521de(0x119)](_0x1ce63f,_0x4521de(0x111)),_0x1aeaf0=a48_0x28117e[_0x4521de(0x119)](_0x1ce63f,_0x4521de(0x10c));let _0x1613c3=null,_0x2acc80=null;this[_0x4521de(0x144)]&&(_0x1613c3=a48_0x28117e[_0x4521de(0x119)](_0x1ce63f,_0x4521de(0x150),this[_0x4521de(0x144)],'tdx.json'),_0x2acc80=a48_0x28117e[_0x4521de(0x119)](_0x1ce63f,_0x4521de(0x150),this['activeProfile'],_0x4521de(0x10c))),this[_0x4521de(0x135)]={'session':a48_0x55311e['existsSync'](_0x4afdca)?_0x4afdca:null,'project':_0x1e74e6,'profile':_0x1613c3&&a48_0x55311e[_0x4521de(0x11a)](_0x1613c3)?_0x1613c3:null,'profileCredentials':_0x2acc80&&a48_0x55311e[_0x4521de(0x11a)](_0x2acc80)?_0x2acc80:null,'global':a48_0x55311e[_0x4521de(0x11a)](_0x3fbf2f)?_0x3fbf2f:null,'globalCredentials':a48_0x55311e['existsSync'](_0x1aeaf0)?_0x1aeaf0:null};}[a48_0x4b56b8(0x125)](_0x5cbcfa,_0x854f00){const _0x164025=a48_0x4b56b8;if(!_0x854f00)return _0x164025(0x133);const _0x3f21cf=_0x854f00;if(this[_0x164025(0x140)][_0x164025(0x124)][_0x5cbcfa]===_0x3f21cf){if(_0x5cbcfa==='site'&&_0x3f21cf===_0x164025(0x14a)&&!this[_0x164025(0x140)][_0x164025(0x127)][_0x164025(0x10a)]&&!this[_0x164025(0x140)][_0x164025(0x142)][_0x164025(0x10a)]&&!this[_0x164025(0x140)][_0x164025(0x114)][_0x164025(0x10a)]&&!this['layers'][_0x164025(0x121)]['site'])return'default';return'CLI\x20flag:\x20--'+_0x5cbcfa[_0x164025(0x12e)](/_/g,'-');}if(this['layers']['session'][_0x5cbcfa]===_0x3f21cf)return _0x164025(0x127);if(this['layers'][_0x164025(0x142)][_0x5cbcfa]===_0x3f21cf)return _0x164025(0x142);if(this[_0x164025(0x140)][_0x164025(0x114)][_0x5cbcfa]===_0x3f21cf)return _0x164025(0x115)+this[_0x164025(0x144)];if(this[_0x164025(0x140)]['global'][_0x5cbcfa]===_0x3f21cf)return'global';return _0x164025(0x112);}[a48_0x4b56b8(0x14b)](){const _0x1ae82b=a48_0x4b56b8,_0x2a1a0d=a48_0x28117e[_0x1ae82b(0x119)](getConfigDir(),_0x1ae82b(0x111));if(!a48_0x55311e[_0x1ae82b(0x11a)](_0x2a1a0d))return{};try{const _0xc758b8=a48_0x55311e[_0x1ae82b(0x107)](_0x2a1a0d,_0x1ae82b(0x11e));return JSON['parse'](_0xc758b8);}catch{return{};}}[a48_0x4b56b8(0x14d)](_0x16f896){const _0x26b3f0=a48_0x4b56b8;_0x16f896[_0x26b3f0(0x10a)]=this[_0x26b3f0(0x10a)],!_0x16f896['database']&&this[_0x26b3f0(0x13f)]&&(_0x16f896[_0x26b3f0(0x13f)]=this[_0x26b3f0(0x13f)]),!_0x16f896[_0x26b3f0(0x13d)]&&this[_0x26b3f0(0x151)]&&(_0x16f896['parentSegment']=this[_0x26b3f0(0x151)]),!_0x16f896[_0x26b3f0(0x138)]&&this[_0x26b3f0(0x130)]&&(_0x16f896[_0x26b3f0(0x138)]=this[_0x26b3f0(0x130)]),!_0x16f896[_0x26b3f0(0x12f)]&&this[_0x26b3f0(0x10e)]&&(_0x16f896['llmProject']=this['llm_project']),!_0x16f896[_0x26b3f0(0x136)]&&this[_0x26b3f0(0x14c)]&&(_0x16f896[_0x26b3f0(0x136)]=this[_0x26b3f0(0x14c)]),!_0x16f896[_0x26b3f0(0x137)]&&this[_0x26b3f0(0x128)]&&(_0x16f896[_0x26b3f0(0x137)]=this[_0x26b3f0(0x128)]);}[a48_0x4b56b8(0x145)](){const _0x27957f=a48_0x4b56b8;return[{'key':_0x27957f(0x10a),'value':this[_0x27957f(0x10a)]},{'key':_0x27957f(0x13f),'value':this['database']},{'key':_0x27957f(0x151),'value':this[_0x27957f(0x151)]},{'key':'segment_path','value':this[_0x27957f(0x130)]},{'key':'llm_project','value':this[_0x27957f(0x10e)]},{'key':_0x27957f(0x14c),'value':this['llm_agent']},{'key':'workflow_project','value':this[_0x27957f(0x128)]},{'key':_0x27957f(0x114),'value':this[_0x27957f(0x144)]||undefined}];}[a48_0x4b56b8(0x11d)](){const _0x2e9806=a48_0x4b56b8;console[_0x2e9806(0x12a)](_0x2e9806(0x143));for(const {key:_0x24a2b4,value:_0x223697}of this['getParameters']()){_0x223697&&console[_0x2e9806(0x12a)](_0x24a2b4+':\x20'+_0x223697);}}[a48_0x4b56b8(0x116)](){const _0x1fad6b=a48_0x4b56b8;console['log'](_0x1fad6b(0x143));for(const {key:_0x3e1b0d,value:_0x26a06e}of this[_0x1fad6b(0x145)]()){if(_0x26a06e){const _0x36b169=_0x3e1b0d===_0x1fad6b(0x114)?_0x1fad6b(0x149):'('+this['getSource'](_0x3e1b0d,_0x26a06e)+')';console[_0x1fad6b(0x12a)](_0x3e1b0d+':\x20'+_0x26a06e+'\x20'+_0x36b169);}}console[_0x1fad6b(0x12a)](_0x1fad6b(0x129));const _0x5a27a8=[{'label':'Session','path':this[_0x1fad6b(0x135)]['session'],'extra':'(session:\x20'+this[_0x1fad6b(0x122)]+')'},{'label':'Project','path':this[_0x1fad6b(0x135)][_0x1fad6b(0x142)]},{'label':_0x1fad6b(0x13c),'path':this[_0x1fad6b(0x135)][_0x1fad6b(0x114)]},{'label':_0x1fad6b(0x13e),'path':this['configFiles'][_0x1fad6b(0x12b)]},{'label':_0x1fad6b(0x132),'path':this['configFiles'][_0x1fad6b(0x121)]},{'label':_0x1fad6b(0x126),'path':this['configFiles']['globalCredentials']}];for(const {label:_0x18d611,path:_0x11a598,extra:_0x54ef0f}of _0x5a27a8){if(_0x11a598)console['log'](_0x18d611+':\x20'+_0x11a598+'\x20✓'+(_0x54ef0f?'\x20'+_0x54ef0f:''));else{if(_0x18d611===_0x1fad6b(0x113))console['log'](_0x18d611+_0x1fad6b(0x10b)+this['sessionId']+')');else(_0x18d611==='Project'||_0x18d611===_0x1fad6b(0x132))&&console['log'](_0x18d611+_0x1fad6b(0x14f));}}}async[a48_0x4b56b8(0x117)](){const _0x560463=a48_0x4b56b8;return this[_0x560463(0x109)]=await getAPIKeyAsync(this[_0x560463(0x10a)],this['activeProfile']||undefined),this[_0x560463(0x109)];}static async[a48_0x4b56b8(0x13b)](_0x24ab42){const _0x8c4ef4=a48_0x4b56b8,_0x22426a=new GlobalContext(_0x24ab42);return await _0x22426a[_0x8c4ef4(0x117)](),_0x22426a;}}
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
- const a49_0x5dd608=a49_0x38ae;function a49_0x38ae(_0x1c85a2,_0x40eb0d){_0x1c85a2=_0x1c85a2-0xb5;const _0x28bf64=a49_0x28bf();let _0x38ae0b=_0x28bf64[_0x1c85a2];return _0x38ae0b;}(function(_0x58f9c7,_0x19ae02){const _0x2ff436=a49_0x38ae,_0x255936=_0x58f9c7();while(!![]){try{const _0xe1bd5c=parseInt(_0x2ff436(0xc0))/0x1+parseInt(_0x2ff436(0xd0))/0x2*(parseInt(_0x2ff436(0xd5))/0x3)+-parseInt(_0x2ff436(0xcc))/0x4*(parseInt(_0x2ff436(0xb8))/0x5)+parseInt(_0x2ff436(0xd1))/0x6+parseInt(_0x2ff436(0xd3))/0x7+parseInt(_0x2ff436(0xc1))/0x8*(-parseInt(_0x2ff436(0xbb))/0x9)+parseInt(_0x2ff436(0xb9))/0xa;if(_0xe1bd5c===_0x19ae02)break;else _0x255936['push'](_0x255936['shift']());}catch(_0x5e1aff){_0x255936['push'](_0x255936['shift']());}}}(a49_0x28bf,0xe31a5));const SERVICE_NAME=a49_0x5dd608(0xb6);function a49_0x28bf(){const _0x106286=['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.','1408791ngytbo','success','tdx','keyring','667745YbSPBv','369190IfJJRY','setPassword','135tTvMkD','getPassword','not_found','includes',':api_key','541177DfTccn','935736xGvQyl','message','-25300','__keychain_test__','access','@zowe/secrets-for-zowe-sdk','access_denied','value','System\x20keychain\x20is\x20not\x20available','toLowerCase','deletePassword','4oMmPqU','reason','not\x20available','could\x20not\x20be\x20found','2GwyOdZ','9282324PQKRvP','profile:','1564640NCnRBo'];a49_0x28bf=function(){return _0x106286;};return a49_0x28bf();}let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x543419=a49_0x5dd608;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x181294=await import(_0x543419(0xc6));return keyringModule=_0x181294[_0x543419(0xb7)],keyringModule;}catch(_0x1f2b8f){return keyringLoadError=_0x1f2b8f instanceof Error?_0x1f2b8f:new Error(String(_0x1f2b8f)),null;}}function getAccountName(_0x684492){const _0x564840=a49_0x5dd608,_0x140f2a=_0x684492||'';return _0x564840(0xd2)+_0x140f2a+_0x564840(0xbf);}export async function getKeychainAPIKey(_0x2fdca9){const _0x3c09c1=a49_0x5dd608,_0x1b3323=await getKeychainAPIKeyWithStatus(_0x2fdca9);if(_0x1b3323[_0x3c09c1(0xb5)])return _0x1b3323[_0x3c09c1(0xc8)];return _0x1b3323[_0x3c09c1(0xcd)]===_0x3c09c1(0xc7)&&console['error']('Warning:\x20'+_0x1b3323[_0x3c09c1(0xc2)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3e68c0){const _0x4780eb=a49_0x5dd608;try{const _0x368a61=await getKeyring();if(!_0x368a61)return{'success':![],'reason':'unavailable'};const _0x3882e9=getAccountName(_0x3e68c0),_0xcbfaad=await _0x368a61[_0x4780eb(0xbc)](SERVICE_NAME,_0x3882e9);if(_0xcbfaad)return{'success':!![],'value':_0xcbfaad};return{'success':![],'reason':_0x4780eb(0xbd)};}catch(_0x11ceec){const _0x2d5c7f=_0x11ceec instanceof Error?_0x11ceec['message']:String(_0x11ceec);if(_0x2d5c7f[_0x4780eb(0xbe)](_0x4780eb(0xc3))||_0x2d5c7f[_0x4780eb(0xca)]()[_0x4780eb(0xbe)](_0x4780eb(0xcf))||_0x2d5c7f[_0x4780eb(0xca)]()['includes']('not\x20found'))return{'success':![],'reason':_0x4780eb(0xbd)};if(_0x2d5c7f[_0x4780eb(0xbe)]('-25293')||_0x2d5c7f[_0x4780eb(0xca)]()[_0x4780eb(0xbe)]('restricted')||_0x2d5c7f[_0x4780eb(0xca)]()['includes'](_0x4780eb(0xc5)))return{'success':![],'reason':_0x4780eb(0xc7),'message':_0x4780eb(0xd4)};return{'success':![],'reason':'unavailable','message':_0x2d5c7f};}}export async function saveKeychainAPIKey(_0xd9a0ce,_0x1788be){const _0x57d401=a49_0x5dd608,_0x2c1c5d=await getKeyring();if(!_0x2c1c5d)throw new Error(_0x57d401(0xc9));const _0x175c96=getAccountName(_0x1788be);await _0x2c1c5d[_0x57d401(0xba)](SERVICE_NAME,_0x175c96,_0xd9a0ce);}export async function deleteKeychainAPIKey(_0x4aaaf7){const _0x1c11bf=a49_0x5dd608;try{const _0x8c1da6=await getKeyring();if(!_0x8c1da6)return![];const _0x112a5c=getAccountName(_0x4aaaf7);return await _0x8c1da6[_0x1c11bf(0xcb)](SERVICE_NAME,_0x112a5c);}catch{return![];}}export async function isKeychainAvailable(){const _0x50d59a=a49_0x5dd608;try{const _0xe5e809=await getKeyring();if(!_0xe5e809)return![];return await _0xe5e809[_0x50d59a(0xbc)](SERVICE_NAME,_0x50d59a(0xc4)),!![];}catch(_0x1aceee){const _0x15b69a=_0x1aceee instanceof Error?_0x1aceee[_0x50d59a(0xc2)][_0x50d59a(0xca)]():'';if(_0x15b69a['includes'](_0x50d59a(0xce))||_0x15b69a[_0x50d59a(0xbe)]('not\x20supported')||_0x15b69a['includes']('cannot\x20find'))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(_0xee462e,_0x4fbc70){const _0x2608e7=a50_0x4206,_0x3df3d6=_0xee462e();while(!![]){try{const _0x2cf1e4=parseInt(_0x2608e7(0x1b5))/0x1*(parseInt(_0x2608e7(0x196))/0x2)+-parseInt(_0x2608e7(0x18c))/0x3+-parseInt(_0x2608e7(0x19d))/0x4+-parseInt(_0x2608e7(0x1c5))/0x5+-parseInt(_0x2608e7(0x19f))/0x6+parseInt(_0x2608e7(0x1a7))/0x7*(parseInt(_0x2608e7(0x1c1))/0x8)+parseInt(_0x2608e7(0x1c3))/0x9;if(_0x2cf1e4===_0x4fbc70)break;else _0x3df3d6['push'](_0x3df3d6['shift']());}catch(_0x2c0554){_0x3df3d6['push'](_0x3df3d6['shift']());}}}(a50_0x2cd6,0x78afc));function a50_0x4206(_0x195f3e,_0x1be8d9){_0x195f3e=_0x195f3e-0x186;const _0x2cd646=a50_0x2cd6();let _0x420618=_0x2cd646[_0x195f3e];return _0x420618;}import*as a50_0x567483 from'node:fs';import*as a50_0x4e4ae8 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(_0x3f7f6d){const _0x22cb89=a50_0x4206,_0x57667a={};if(!_0x3f7f6d)return _0x57667a;for(const [_0x199eed,_0x379b7c]of Object[_0x22cb89(0x190)](_0x3f7f6d)){_0x199eed!==_0x22cb89(0x1a1)&&_0x379b7c!==undefined&&(_0x57667a[_0x199eed]=_0x379b7c);}return _0x57667a;}export function getProfilesDir(){const _0x5f36be=a50_0x4206;return a50_0x4e4ae8[_0x5f36be(0x1b9)](getConfigDir(),_0x5f36be(0x1c0));}function a50_0x2cd6(){const _0x21b351=['\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','rmSync','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','message','stringify','test','utf-8','Error:\x20','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','localeCompare','.env.','find','has','warn','database','some','env','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','readFileSync','filter','827160crwrRg','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','site',',\x20creating\x20new\x20file','entries','parent_segment','push','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','profile','llm_project','148gkbDto','string','\x27:\x20config\x20must\x20be\x20an\x20object','.env','object','\x27:\x20unknown\x20config\x20key\x20\x27','llm_agent','1488084ewXclg','Warning:\x20Failed\x20to\x20parse\x20','3574128HhDTiz','keys','description','Profile\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','map','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','Profile\x20\x27','63VAcNxs','\x20\x20mv\x20\x22','\x27\x20will\x20be\x20ignored','name','Warning:\x20Profile\x20\x27','parse','\x20does\x20not\x20exist','sort','\x20\x201.\x20Edit:\x20','existsSync','length','directory','toISOString','\x27\x20not\x20found\x20in\x20user\x20configuration','1905tGBhHB','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string',':\x20Invalid\x20JSON\x20syntax','user','join','readdirSync','local','from','\x20already\x20exists','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','tdx.json','profiles','764008ASzHEl','Failed\x20to\x20parse\x20','12444606kytLhE','set','3227260eihPKB','TDX_PROFILE'];a50_0x2cd6=function(){return _0x21b351;};return a50_0x2cd6();}function getProfileDir(_0x5353fa){return a50_0x4e4ae8['join'](getProfilesDir(),_0x5353fa);}function getProfileConfigPath(_0x594aa5){const _0x499d15=a50_0x4206;return a50_0x4e4ae8[_0x499d15(0x1b9)](getProfileDir(_0x594aa5),_0x499d15(0x1bf));}function getProfileEnvPath(_0x124895){const _0x1f5da8=a50_0x4206;return a50_0x4e4ae8[_0x1f5da8(0x1b9)](getProfileDir(_0x124895),_0x1f5da8(0x199));}function getGlobalConfigPath(){const _0x3673af=a50_0x4206;return a50_0x4e4ae8[_0x3673af(0x1b9)](getConfigDir(),_0x3673af(0x1bf));}function validateProfileName(_0x11d4dc){const _0x15933c=a50_0x4206;if(!/^[a-zA-Z0-9_-]+$/[_0x15933c(0x1ce)](_0x11d4dc))throw new Error('Invalid\x20profile\x20name:\x20'+_0x11d4dc+_0x15933c(0x1be));}function validateProfileConfig(_0x540960,_0x37daf7){const _0x29d95b=a50_0x4206;if(typeof _0x540960!==_0x29d95b(0x19a)||_0x540960===null)throw new Error('Profile\x20\x27'+_0x37daf7+_0x29d95b(0x198));const _0x1f7fc5=[_0x29d95b(0x1a1),_0x29d95b(0x18e),_0x29d95b(0x186),_0x29d95b(0x191),'llm_project',_0x29d95b(0x19c)],_0x18c9a1=_0x540960;for(const _0xd1a6cf of Object[_0x29d95b(0x1a0)](_0x18c9a1)){!_0x1f7fc5['includes'](_0xd1a6cf)&&console[_0x29d95b(0x1d6)](_0x29d95b(0x1ab)+_0x37daf7+_0x29d95b(0x19b)+_0xd1a6cf+_0x29d95b(0x1a9));}if(_0x18c9a1[_0x29d95b(0x1a1)]!==undefined&&typeof _0x18c9a1[_0x29d95b(0x1a1)]!=='string')throw new Error('Profile\x20\x27'+_0x37daf7+_0x29d95b(0x1a3));if(_0x18c9a1['site']!==undefined&&typeof _0x18c9a1['site']!==_0x29d95b(0x197))throw new Error(_0x29d95b(0x1a6)+_0x37daf7+_0x29d95b(0x1b6));if(_0x18c9a1[_0x29d95b(0x186)]!==undefined&&typeof _0x18c9a1[_0x29d95b(0x186)]!=='string')throw new Error('Profile\x20\x27'+_0x37daf7+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x18c9a1[_0x29d95b(0x191)]!==undefined&&typeof _0x18c9a1[_0x29d95b(0x191)]!==_0x29d95b(0x197))throw new Error(_0x29d95b(0x1a6)+_0x37daf7+_0x29d95b(0x1c9));if(_0x18c9a1[_0x29d95b(0x195)]!==undefined&&typeof _0x18c9a1[_0x29d95b(0x195)]!=='string')throw new Error(_0x29d95b(0x1a6)+_0x37daf7+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x18c9a1['llm_agent']!==undefined&&typeof _0x18c9a1[_0x29d95b(0x19c)]!==_0x29d95b(0x197))throw new Error(_0x29d95b(0x1a6)+_0x37daf7+_0x29d95b(0x1cb));return!![];}function loadProfilesFromTdxJson(_0x20ee64,_0x56faaa){const _0x185c7f=a50_0x4206;if(!a50_0x567483[_0x185c7f(0x1b0)](_0x20ee64))return[];try{const _0x1ee349=a50_0x567483[_0x185c7f(0x18a)](_0x20ee64,_0x185c7f(0x1cf)),_0x4f8345=JSON['parse'](_0x1ee349);if(!_0x4f8345['profiles']||typeof _0x4f8345['profiles']!=='object')return[];const _0x368e5e=[];for(const [_0x410e2e,_0x5576bc]of Object[_0x185c7f(0x190)](_0x4f8345[_0x185c7f(0x1c0)])){try{validateProfileConfig(_0x5576bc,_0x410e2e);const _0x471276=getNewCredentialPath(_0x410e2e),_0xedcce3=getOldCredentialPath(_0x410e2e),_0x66812e=a50_0x567483[_0x185c7f(0x1b0)](_0x471276)||a50_0x567483['existsSync'](_0xedcce3);_0x368e5e['push']({'name':_0x410e2e,'config':_0x5576bc,'metadata':{'name':_0x410e2e,'createdAt':new Date()[_0x185c7f(0x1b3)]()},'hasCredentials':_0x66812e,'scope':_0x56faaa});}catch(_0x306c32){_0x306c32 instanceof Error&&(console[_0x185c7f(0x1d6)](_0x185c7f(0x1c7)+_0x20ee64+':'),console[_0x185c7f(0x1d6)]('\x20\x20'+_0x306c32[_0x185c7f(0x1cc)]+'\x0a'));}}return _0x368e5e;}catch(_0x1b6a10){return _0x1b6a10 instanceof SyntaxError?(console[_0x185c7f(0x1d6)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x20ee64+_0x185c7f(0x1b7)),console['warn'](_0x185c7f(0x1d0)+_0x1b6a10[_0x185c7f(0x1cc)]+'\x0a')):console[_0x185c7f(0x1d6)](_0x185c7f(0x189)+_0x20ee64+':\x20'+_0x1b6a10+'\x0a'),[];}}export function getNewCredentialPath(_0x224a1b){const _0x2f456f=a50_0x4206;return a50_0x4e4ae8[_0x2f456f(0x1b9)](getConfigDir(),_0x2f456f(0x1d3)+_0x224a1b);}function getOldCredentialPath(_0x11be08){const _0x318009=a50_0x4206;return a50_0x4e4ae8[_0x318009(0x1b9)](getProfilesDir(),_0x11be08,_0x318009(0x199));}function loadProfilesFromTdxJsonFiles(){const _0x5016eb=a50_0x4206,_0x299209=[],_0x5b1ebd=findProjectConfigPath();_0x5b1ebd&&_0x299209[_0x5016eb(0x192)](...loadProfilesFromTdxJson(_0x5b1ebd,_0x5016eb(0x1bb)));const _0x34e82b=a50_0x4e4ae8[_0x5016eb(0x1b9)](getConfigDir(),_0x5016eb(0x1bf));return _0x299209[_0x5016eb(0x192)](...loadProfilesFromTdxJson(_0x34e82b,_0x5016eb(0x1b8))),_0x299209;}function loadProfilesFromDirectories(){const _0x3ceb44=a50_0x4206,_0x59796b=getProfilesDir();if(!a50_0x567483[_0x3ceb44(0x1b0)](_0x59796b))return[];try{return a50_0x567483[_0x3ceb44(0x1ba)](_0x59796b,{'withFileTypes':!![]})[_0x3ceb44(0x18b)](_0x232033=>_0x232033['isDirectory']())[_0x3ceb44(0x1a4)](_0x35367a=>_0x35367a['name'])[_0x3ceb44(0x18b)](_0x1e19ec=>{const _0x481366=_0x3ceb44,_0x243f0c=getProfileConfigPath(_0x1e19ec),_0x3ec19=getProfileEnvPath(_0x1e19ec);return a50_0x567483['existsSync'](_0x243f0c)||a50_0x567483[_0x481366(0x1b0)](_0x3ec19);})[_0x3ceb44(0x1a4)](_0x11231f=>{const _0x104956=_0x3ceb44,_0x527fe7=loadProfileFromDirectory(_0x11231f);if(_0x527fe7)return{..._0x527fe7,'scope':_0x104956(0x1b2)};return null;})['filter'](_0x225b48=>_0x225b48!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4d1fc1){const _0xa6b58a=a50_0x4206,_0x516086=getProfileConfigPath(_0x4d1fc1),_0xcfcf91=getOldCredentialPath(_0x4d1fc1);if(!a50_0x567483[_0xa6b58a(0x1b0)](_0x516086)&&!a50_0x567483[_0xa6b58a(0x1b0)](_0xcfcf91))return null;let _0x45877b={},_0x5b0f5e={'name':_0x4d1fc1,'createdAt':new Date()['toISOString']()};if(a50_0x567483[_0xa6b58a(0x1b0)](_0x516086))try{const _0x451dbf=a50_0x567483[_0xa6b58a(0x18a)](_0x516086,_0xa6b58a(0x1cf)),_0x504de3=JSON[_0xa6b58a(0x1ac)](_0x451dbf),{metadata:_0x24adb6,..._0x2fbb2a}=_0x504de3;_0x45877b=_0x2fbb2a,_0x24adb6&&(_0x5b0f5e=_0x24adb6);}catch{}return{'name':_0x4d1fc1,'config':_0x45877b,'metadata':_0x5b0f5e,'hasCredentials':a50_0x567483[_0xa6b58a(0x1b0)](_0xcfcf91),'scope':_0xa6b58a(0x1b2)};}export function listProfiles(){const _0x2e38ad=a50_0x4206,_0x36e57c=loadProfilesFromTdxJsonFiles(),_0x22d18d=loadProfilesFromDirectories();if(_0x22d18d[_0x2e38ad(0x1b1)]>0x0){const _0x462e52=_0x22d18d[_0x2e38ad(0x1a4)](_0x28dbd3=>_0x28dbd3['name'])[_0x2e38ad(0x1b9)](',\x20'),_0x267c7c=getConfigDir();console['warn'](_0x2e38ad(0x18d)+_0x462e52),console[_0x2e38ad(0x1d6)](_0x2e38ad(0x193)),console[_0x2e38ad(0x1d6)](_0x2e38ad(0x1af)+a50_0x4e4ae8[_0x2e38ad(0x1b9)](_0x267c7c,_0x2e38ad(0x1bf))),console['warn'](_0x2e38ad(0x1d1)),console[_0x2e38ad(0x1d6)](_0x2e38ad(0x1a5));}const _0x5c568d=[..._0x36e57c,..._0x22d18d],_0x4152d0=new Map();for(const _0x351ad of _0x5c568d){!_0x4152d0[_0x2e38ad(0x1d5)](_0x351ad['name'])&&_0x4152d0[_0x2e38ad(0x1c4)](_0x351ad[_0x2e38ad(0x1aa)],_0x351ad);}return Array[_0x2e38ad(0x1bc)](_0x4152d0['values']())[_0x2e38ad(0x1ae)]((_0x1d738c,_0x5dc5ba)=>_0x1d738c['name'][_0x2e38ad(0x1d2)](_0x5dc5ba[_0x2e38ad(0x1aa)]));}export function profileExists(_0x541a42){const _0x3ef728=a50_0x4206,_0x52872b=listProfiles();return _0x52872b[_0x3ef728(0x187)](_0x3875c7=>_0x3875c7[_0x3ef728(0x1aa)]===_0x541a42);}export function loadProfile(_0x5bfea1){const _0x346faf=a50_0x4206;validateProfileName(_0x5bfea1);const _0x533885=listProfiles(),_0x4dd96b=_0x533885[_0x346faf(0x1d4)](_0x213dee=>_0x213dee[_0x346faf(0x1aa)]===_0x5bfea1);return _0x4dd96b||null;}export function saveProfile(_0x1a42fc,_0x1a993f,_0x260cf4=![]){saveProfileToUserConfig(_0x1a42fc,_0x1a993f);}export function deleteProfile(_0x1b183f){const _0x3a89c4=a50_0x4206;validateProfileName(_0x1b183f);const _0x486afd=getProfileDir(_0x1b183f);if(!a50_0x567483['existsSync'](_0x486afd))throw new Error(_0x3a89c4(0x1a2)+_0x1b183f+'\x20does\x20not\x20exist');a50_0x567483[_0x3a89c4(0x1ca)](_0x486afd,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x2148e0,_0x34b79b){const _0x54307d=a50_0x4206;validateProfileName(_0x2148e0);const _0x51d0a3=getGlobalConfigPath(),_0x1c2137=getConfigDir();!a50_0x567483[_0x54307d(0x1b0)](_0x1c2137)&&createSecureDirectory(_0x1c2137);let _0x1e5433={};if(a50_0x567483['existsSync'](_0x51d0a3))try{const _0x46434b=a50_0x567483['readFileSync'](_0x51d0a3,_0x54307d(0x1cf));_0x1e5433=JSON['parse'](_0x46434b);}catch{console[_0x54307d(0x1d6)](_0x54307d(0x19e)+_0x51d0a3+_0x54307d(0x18f));}!_0x1e5433[_0x54307d(0x1c0)]&&(_0x1e5433[_0x54307d(0x1c0)]={}),_0x1e5433[_0x54307d(0x1c0)][_0x2148e0]=_0x34b79b,writeSecureFile(_0x51d0a3,JSON['stringify'](_0x1e5433,null,0x2));}export function removeProfileFromUserConfig(_0x35ed64){const _0x16b873=a50_0x4206;validateProfileName(_0x35ed64);const _0x20ba4f=getGlobalConfigPath();if(!a50_0x567483['existsSync'](_0x20ba4f))throw new Error(_0x16b873(0x1a6)+_0x35ed64+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x13e8d7={};try{const _0x312997=a50_0x567483[_0x16b873(0x18a)](_0x20ba4f,_0x16b873(0x1cf));_0x13e8d7=JSON[_0x16b873(0x1ac)](_0x312997);}catch{throw new Error(_0x16b873(0x1c2)+_0x20ba4f);}if(!_0x13e8d7['profiles']||!_0x13e8d7[_0x16b873(0x1c0)][_0x35ed64])throw new Error('Profile\x20\x27'+_0x35ed64+_0x16b873(0x1b4));delete _0x13e8d7[_0x16b873(0x1c0)][_0x35ed64],_0x13e8d7[_0x16b873(0x194)]===_0x35ed64&&delete _0x13e8d7[_0x16b873(0x194)],writeSecureFile(_0x20ba4f,JSON[_0x16b873(0x1cd)](_0x13e8d7,null,0x2));}export function getActiveProfile(){const _0x26a5a7=a50_0x4206,_0x38e8b7=loadSessionContext();if(_0x38e8b7?.[_0x26a5a7(0x194)])return _0x38e8b7[_0x26a5a7(0x194)];if(process['env'][_0x26a5a7(0x1c6)])return process[_0x26a5a7(0x188)][_0x26a5a7(0x1c6)];const _0x1c224c=getGlobalConfigPath();if(!a50_0x567483[_0x26a5a7(0x1b0)](_0x1c224c))return null;try{const _0x5c4559=a50_0x567483['readFileSync'](_0x1c224c,_0x26a5a7(0x1cf)),_0x57295b=JSON['parse'](_0x5c4559);return _0x57295b[_0x26a5a7(0x194)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x3938a3){const _0x11c796=a50_0x4206,_0x3a5c2e=getGlobalConfigPath(),_0x3942d2=getConfigDir();!a50_0x567483[_0x11c796(0x1b0)](_0x3942d2)&&createSecureDirectory(_0x3942d2);let _0x44ae28={};if(a50_0x567483['existsSync'](_0x3a5c2e))try{const _0x2f686c=a50_0x567483[_0x11c796(0x18a)](_0x3a5c2e,'utf-8');_0x44ae28=JSON[_0x11c796(0x1ac)](_0x2f686c);}catch{console[_0x11c796(0x1d6)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x3a5c2e+_0x11c796(0x18f));}_0x44ae28['site']=_0x3938a3,writeSecureFile(_0x3a5c2e,JSON['stringify'](_0x44ae28,null,0x2));}export function saveActiveProfileToUserConfig(_0x685a55){const _0x35435b=a50_0x4206;validateProfileName(_0x685a55);const _0x19a90f=getGlobalConfigPath(),_0x192feb=getConfigDir();!a50_0x567483[_0x35435b(0x1b0)](_0x192feb)&&createSecureDirectory(_0x192feb);let _0x5411ed={};if(a50_0x567483['existsSync'](_0x19a90f))try{const _0x4bd517=a50_0x567483[_0x35435b(0x18a)](_0x19a90f,_0x35435b(0x1cf));_0x5411ed=JSON[_0x35435b(0x1ac)](_0x4bd517);}catch{console[_0x35435b(0x1d6)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x19a90f+',\x20creating\x20new\x20file');}_0x5411ed[_0x35435b(0x194)]=_0x685a55,writeSecureFile(_0x19a90f,JSON['stringify'](_0x5411ed,null,0x2));}function clearFieldFromUserConfig(_0xd2d5a1){const _0x4b7cac=a50_0x4206,_0x2ad1e5=getGlobalConfigPath();if(!a50_0x567483['existsSync'](_0x2ad1e5))return;let _0x1d46b7={};try{const _0x46b06d=a50_0x567483[_0x4b7cac(0x18a)](_0x2ad1e5,_0x4b7cac(0x1cf));_0x1d46b7=JSON['parse'](_0x46b06d);}catch{return;}delete _0x1d46b7[_0xd2d5a1],writeSecureFile(_0x2ad1e5,JSON[_0x4b7cac(0x1cd)](_0x1d46b7,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x167c2d=a50_0x4206;clearFieldFromUserConfig(_0x167c2d(0x18e));}export function clearActiveProfileFromUserConfig(){const _0x7f9987=a50_0x4206;clearFieldFromUserConfig(_0x7f9987(0x194));}export function createProfile(_0x40f3ef,_0x2d7877){const _0x15d3b8=a50_0x4206;validateProfileName(_0x40f3ef);if(profileExists(_0x40f3ef))throw new Error(_0x15d3b8(0x1a2)+_0x40f3ef+_0x15d3b8(0x1bd));saveProfile(_0x40f3ef,_0x2d7877);}export function saveProfileCredentials(_0x321e8b,_0x2e275c){const _0x4d2d79=a50_0x4206;validateProfileName(_0x321e8b);if(!profileExists(_0x321e8b))throw new Error(_0x4d2d79(0x1a2)+_0x321e8b+_0x4d2d79(0x1ad));const _0x1e1f46=getNewCredentialPath(_0x321e8b);writeSecureFile(_0x1e1f46,_0x2e275c);}export function loadProfileCredentials(_0x323793){const _0xeef11=a50_0x4206;validateProfileName(_0x323793);const _0x1d1847=getNewCredentialPath(_0x323793);if(a50_0x567483['existsSync'](_0x1d1847))try{return a50_0x567483[_0xeef11(0x18a)](_0x1d1847,_0xeef11(0x1cf));}catch{}const _0x1cd9f2=getOldCredentialPath(_0x323793);if(a50_0x567483['existsSync'](_0x1cd9f2)){console['warn']('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x323793+'\x27'),console['warn']('To\x20migrate:'),console['warn'](_0xeef11(0x1a8)+_0x1cd9f2+'\x22\x20\x22'+_0x1d1847+'\x22'),console['warn'](_0xeef11(0x1c8));try{return a50_0x567483['readFileSync'](_0x1cd9f2,'utf-8');}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_0x570420=a51_0x3372;(function(_0x1f7c64,_0x2d99b8){const _0x53809f=a51_0x3372,_0x48f335=_0x1f7c64();while(!![]){try{const _0xbfe95c=parseInt(_0x53809f(0x1c0))/0x1*(-parseInt(_0x53809f(0x1cc))/0x2)+parseInt(_0x53809f(0x1c5))/0x3+parseInt(_0x53809f(0x1ca))/0x4*(parseInt(_0x53809f(0x1d0))/0x5)+-parseInt(_0x53809f(0x1ba))/0x6+parseInt(_0x53809f(0x1c7))/0x7*(-parseInt(_0x53809f(0x1cb))/0x8)+parseInt(_0x53809f(0x1d4))/0x9*(parseInt(_0x53809f(0x1d8))/0xa)+-parseInt(_0x53809f(0x1b8))/0xb*(-parseInt(_0x53809f(0x1c9))/0xc);if(_0xbfe95c===_0x2d99b8)break;else _0x48f335['push'](_0x48f335['shift']());}catch(_0x342495){_0x48f335['push'](_0x48f335['shift']());}}}(a51_0x2bc4,0xb7aa9));import*as a51_0x23a27c from'node:fs';import*as a51_0x3bf2bd from'node:path';const PROJECT_CONFIG_FILENAME=a51_0x570420(0x1c6);function a51_0x2bc4(){const _0x57fa64=['tdx.json','3512278HPmQIp','TD_API_KEY','61896eKZjkX','637196MHhCmA','8JFFPHf','6284WKsMhX','cwd','utf-8','join','10RtfzOc','stringify','api_key','Warning:\x20\x27profile\x27\x20field\x20in\x20','2178KDAHqL','includes',').\x20','readFileSync','11110MUWGfw','4037AHjChV','parse','8242836DXQAsk','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','dirname','code','\x20is\x20ignored.\x20','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','278jnkCHF','warn','ENOENT','apiKey','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','3062661AZDtqz'];a51_0x2bc4=function(){return _0x57fa64;};return a51_0x2bc4();}export function findProjectConfigPath(_0x14959a){const _0x431c6f=a51_0x570420;let _0x5158f7=_0x14959a||process[_0x431c6f(0x1cd)]();while(!![]){const _0x223d38=a51_0x3bf2bd[_0x431c6f(0x1cf)](_0x5158f7,PROJECT_CONFIG_FILENAME);if(a51_0x23a27c['existsSync'](_0x223d38))return _0x223d38;const _0x57d85e=a51_0x3bf2bd[_0x431c6f(0x1bc)](_0x5158f7);if(_0x57d85e===_0x5158f7)return null;_0x5158f7=_0x57d85e;}}export function loadProjectConfig(_0x275aee){const _0x52fb92=a51_0x570420,_0x193ece=findProjectConfigPath(_0x275aee);if(!_0x193ece)return null;try{const _0x297096=a51_0x23a27c[_0x52fb92(0x1d7)](_0x193ece,_0x52fb92(0x1ce)),_0x8e0f87=JSON[_0x52fb92(0x1b9)](_0x297096),_0x304d1c=JSON['stringify'](_0x8e0f87);if(_0x304d1c[_0x52fb92(0x1d5)](_0x52fb92(0x1c8))||_0x304d1c[_0x52fb92(0x1d5)]('apiKey')||_0x304d1c['includes'](_0x52fb92(0x1d2)))throw new Error(_0x52fb92(0x1bf)+_0x193ece+_0x52fb92(0x1d6)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x52769e,profile:_0x237354,..._0x5509e2}=_0x8e0f87;return _0x237354&&console[_0x52fb92(0x1c1)](_0x52fb92(0x1d3)+_0x193ece+_0x52fb92(0x1be)+_0x52fb92(0x1bb)),_0x5509e2;}catch(_0x529572){if(_0x529572 instanceof Error&&_0x52fb92(0x1bd)in _0x529572&&_0x529572[_0x52fb92(0x1bd)]===_0x52fb92(0x1c2))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x193ece+':\x20'+_0x529572);}}export function saveProjectConfig(_0x12f8d5,_0x3fad0b){const _0x1efe4a=a51_0x570420,_0x305853=_0x3fad0b||process[_0x1efe4a(0x1cd)](),_0x258f0a=a51_0x3bf2bd[_0x1efe4a(0x1cf)](_0x305853,PROJECT_CONFIG_FILENAME),_0x3b8717=JSON[_0x1efe4a(0x1d1)](_0x12f8d5);if(_0x3b8717[_0x1efe4a(0x1d5)]('TD_API_KEY')||_0x3b8717[_0x1efe4a(0x1d5)](_0x1efe4a(0x1c3))||_0x3b8717[_0x1efe4a(0x1d5)](_0x1efe4a(0x1d2)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if('profile'in _0x12f8d5)throw new Error(_0x1efe4a(0x1c4));a51_0x23a27c['writeFileSync'](_0x258f0a,JSON[_0x1efe4a(0x1d1)](_0x12f8d5,null,0x2));}export function hasProjectConfig(_0x512346){return findProjectConfigPath(_0x512346)!==null;}function a51_0x3372(_0x11a88e,_0x5a1525){_0x11a88e=_0x11a88e-0x1b8;const _0x2bc45e=a51_0x2bc4();let _0x337232=_0x2bc45e[_0x11a88e];return _0x337232;}export function getProjectRoot(_0x593cd6){const _0x93a34c=findProjectConfigPath(_0x593cd6);return _0x93a34c?a51_0x3bf2bd['dirname'](_0x93a34c):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(_0xaee44d,_0x18b6f1){const _0x5840de=a52_0x4995,_0x2d31d8=_0xaee44d();while(!![]){try{const _0x3cff2e=parseInt(_0x5840de(0xb6))/0x1*(parseInt(_0x5840de(0x9a))/0x2)+-parseInt(_0x5840de(0xa3))/0x3*(parseInt(_0x5840de(0xaf))/0x4)+-parseInt(_0x5840de(0xa8))/0x5+-parseInt(_0x5840de(0x92))/0x6+parseInt(_0x5840de(0xa6))/0x7+-parseInt(_0x5840de(0x91))/0x8*(parseInt(_0x5840de(0x96))/0x9)+parseInt(_0x5840de(0x97))/0xa*(parseInt(_0x5840de(0xa2))/0xb);if(_0x3cff2e===_0x18b6f1)break;else _0x2d31d8['push'](_0x2d31d8['shift']());}catch(_0x21870a){_0x2d31d8['push'](_0x2d31d8['shift']());}}}(a52_0x3112,0xf05d7));import*as a52_0x20b156 from'node:fs';import*as a52_0x4a9ca8 from'node:path';import*as a52_0x2de2bd 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 _0x32207e=a52_0x4995,_0x4c0e01=process[_0x32207e(0x9b)][_0x32207e(0xaa)]||a52_0x4a9ca8['join'](a52_0x2de2bd[_0x32207e(0x9d)](),_0x32207e(0xa0),_0x32207e(0xb5));return a52_0x4a9ca8[_0x32207e(0xad)](_0x4c0e01,'sessions');}function getSessionPath(_0x447ee4){return a52_0x4a9ca8['join'](getSessionsDir(),_0x447ee4+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x11822e){const _0x1ab73f=a52_0x4995;if(_0x11822e)return _0x11822e;return getCurrentSessionPID()[_0x1ab73f(0xa4)]();}export function loadSessionContext(_0x46febc){const _0x2c8db5=a52_0x4995,_0x110cca=_0x46febc||getCurrentSessionPID()[_0x2c8db5(0xa4)](),_0x1b7317=/^\d+$/[_0x2c8db5(0xb1)](_0x110cca)?parseInt(_0x110cca,0xa):null;return _0x1b7317!==null?loadSessionContextByPID(_0x1b7317):loadSessionContextByString(_0x110cca);}function a52_0x3112(){const _0x11d68a=['Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','5013162VHVeJf','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','3110305gjLhBA','sort','TDX_CONFIG_DIR','toISOString','parse','join','api_key','5641348zjtqrV','readFileSync','test','push','includes','warn','tdx','11wPfqYB','endsWith','createdAt','stringify','existsSync','readdirSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','982392uaGOBo','8633682rVIsmv','getTime','utf-8','apiKey','81Tjduyz','11430VdUkxM','writeFileSync','TD_API_KEY','313756eIzeHM','env','unlinkSync','homedir','.json','replace','.config','now','30019bSCXqM','3bMICno','toString'];a52_0x3112=function(){return _0x11d68a;};return a52_0x3112();}export function loadSessionContextByPID(_0x2ab00a){const _0x4783d1=a52_0x4995,_0x2ba520=getSessionPath(_0x2ab00a);if(!a52_0x20b156[_0x4783d1(0x8e)](_0x2ba520))return null;try{const _0x11d8b8=a52_0x20b156['readFileSync'](_0x2ba520,_0x4783d1(0x94)),_0x274e24=JSON[_0x4783d1(0xac)](_0x11d8b8),_0x2f57cb=new Date(_0x274e24['createdAt'])[_0x4783d1(0x93)](),_0x1f8d61=Date[_0x4783d1(0xa1)]();if(_0x1f8d61-_0x2f57cb>SESSION_EXPIRATION_MS)return a52_0x20b156[_0x4783d1(0x9c)](_0x2ba520),null;const _0x1048dc=JSON[_0x4783d1(0xb9)](_0x274e24);if(_0x1048dc[_0x4783d1(0xb3)](_0x4783d1(0x99))||_0x1048dc[_0x4783d1(0xb3)]('apiKey')||_0x1048dc[_0x4783d1(0xb3)](_0x4783d1(0xae)))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x2ba520+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a52_0x20b156[_0x4783d1(0x9c)](_0x2ba520),null;return _0x274e24;}catch{try{a52_0x20b156[_0x4783d1(0x9c)](_0x2ba520);}catch{}return null;}}function loadSessionContextByString(_0x101ba4){const _0x4f59ff=a52_0x4995,_0x549f59=a52_0x4a9ca8['join'](getSessionsDir(),_0x101ba4+_0x4f59ff(0x9e));if(!a52_0x20b156[_0x4f59ff(0x8e)](_0x549f59))return null;try{const _0x1a09e2=a52_0x20b156[_0x4f59ff(0xb0)](_0x549f59,_0x4f59ff(0x94)),_0x2e1365=JSON[_0x4f59ff(0xac)](_0x1a09e2),_0x5749be=new Date(_0x2e1365[_0x4f59ff(0xb8)])[_0x4f59ff(0x93)](),_0x1be07a=Date[_0x4f59ff(0xa1)]();if(_0x1be07a-_0x5749be>SESSION_EXPIRATION_MS)return a52_0x20b156['unlinkSync'](_0x549f59),null;const _0x38bd7b=JSON[_0x4f59ff(0xb9)](_0x2e1365);if(_0x38bd7b['includes'](_0x4f59ff(0x99))||_0x38bd7b[_0x4f59ff(0xb3)](_0x4f59ff(0x95))||_0x38bd7b[_0x4f59ff(0xb3)](_0x4f59ff(0xae)))return console[_0x4f59ff(0xb4)](_0x4f59ff(0xa5)+_0x549f59+_0x4f59ff(0x90)),a52_0x20b156[_0x4f59ff(0x9c)](_0x549f59),null;return _0x2e1365;}catch{try{a52_0x20b156[_0x4f59ff(0x9c)](_0x549f59);}catch{}return null;}}function a52_0x4995(_0x5bbdce,_0xadbf86){_0x5bbdce=_0x5bbdce-0x8e;const _0x31123d=a52_0x3112();let _0x499544=_0x31123d[_0x5bbdce];return _0x499544;}export function saveSessionContext(_0x3fd7ed,_0x2bdd49){const _0x361f15=a52_0x4995,_0x5a0b8a=_0x2bdd49||getCurrentSessionPID()['toString'](),_0x576125=/^\d+$/['test'](_0x5a0b8a)?parseInt(_0x5a0b8a,0xa):getCurrentSessionPID(),_0x32591d=a52_0x4a9ca8[_0x361f15(0xad)](getSessionsDir(),_0x5a0b8a+_0x361f15(0x9e)),_0x3046ec=getSessionsDir();createSecureDirectory(_0x3046ec);const _0x34e5a9=JSON[_0x361f15(0xb9)](_0x3fd7ed);if(_0x34e5a9[_0x361f15(0xb3)](_0x361f15(0x99))||_0x34e5a9['includes']('apiKey')||_0x34e5a9[_0x361f15(0xb3)](_0x361f15(0xae)))throw new Error(_0x361f15(0xa7));let _0x77bd29;const _0xa05828=/^\d+$/['test'](_0x5a0b8a)?loadSessionContextByPID(parseInt(_0x5a0b8a,0xa)):loadSessionContextByString(_0x5a0b8a);_0xa05828?_0x77bd29={..._0xa05828,..._0x3fd7ed,'pid':_0x576125,'sessionId':_0x5a0b8a!==_0x576125[_0x361f15(0xa4)]()?_0x5a0b8a:undefined,'updatedAt':new Date()['toISOString']()}:_0x77bd29={'pid':_0x576125,'sessionId':_0x5a0b8a!==_0x576125['toString']()?_0x5a0b8a:undefined,..._0x3fd7ed,'createdAt':new Date()[_0x361f15(0xab)](),'updatedAt':new Date()[_0x361f15(0xab)]()},a52_0x20b156[_0x361f15(0x98)](_0x32591d,JSON['stringify'](_0x77bd29,null,0x2));}export function clearSessionContext(_0xea4e42){const _0x193fec=a52_0x4995,_0x1e9a2f=_0xea4e42||getCurrentSessionPID()[_0x193fec(0xa4)](),_0x167de6=a52_0x4a9ca8[_0x193fec(0xad)](getSessionsDir(),_0x1e9a2f+_0x193fec(0x9e));a52_0x20b156[_0x193fec(0x8e)](_0x167de6)&&a52_0x20b156[_0x193fec(0x9c)](_0x167de6);}export function clearSessionContextField(_0x20344a,_0x1000b7){const _0x4cd328=a52_0x4995,_0x410d38=_0x1000b7||getCurrentSessionPID()[_0x4cd328(0xa4)](),_0x2e4672=a52_0x4a9ca8[_0x4cd328(0xad)](getSessionsDir(),_0x410d38+'.json');if(!a52_0x20b156['existsSync'](_0x2e4672))return;try{const _0x52869f=a52_0x20b156[_0x4cd328(0xb0)](_0x2e4672,'utf-8'),_0x11d67b=JSON[_0x4cd328(0xac)](_0x52869f);delete _0x11d67b[_0x20344a],a52_0x20b156['writeFileSync'](_0x2e4672,JSON[_0x4cd328(0xb9)](_0x11d67b,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x5152cf=a52_0x4995,_0x4f71f9=getSessionsDir();if(!a52_0x20b156[_0x5152cf(0x8e)](_0x4f71f9))return 0x0;let _0x50f393=0x0;const _0x17b2f6=Date['now']();try{const _0x327fb8=a52_0x20b156[_0x5152cf(0x8f)](_0x4f71f9);for(const _0x575211 of _0x327fb8){if(!_0x575211[_0x5152cf(0xb7)](_0x5152cf(0x9e)))continue;const _0x9a639c=a52_0x4a9ca8[_0x5152cf(0xad)](_0x4f71f9,_0x575211),_0x3722d5=_0x575211[_0x5152cf(0x9f)]('.json',''),_0x49c0c1=parseInt(_0x3722d5,0xa),_0x2951d1=!isNaN(_0x49c0c1);if(_0x2951d1){if(!isProcessRunning(_0x49c0c1)){a52_0x20b156[_0x5152cf(0x9c)](_0x9a639c),_0x50f393++;continue;}}try{const _0x34d71f=a52_0x20b156['readFileSync'](_0x9a639c,_0x5152cf(0x94)),_0x411fec=JSON['parse'](_0x34d71f),_0x316e6a=new Date(_0x411fec[_0x5152cf(0xb8)])[_0x5152cf(0x93)]();_0x17b2f6-_0x316e6a>SESSION_EXPIRATION_MS&&(a52_0x20b156[_0x5152cf(0x9c)](_0x9a639c),_0x50f393++);}catch{a52_0x20b156[_0x5152cf(0x9c)](_0x9a639c),_0x50f393++;}}}catch{}return _0x50f393;}export function listActiveSessions(){const _0x2b7c23=a52_0x4995,_0x55d9f5=getSessionsDir();if(!a52_0x20b156['existsSync'](_0x55d9f5))return[];try{const _0x33df71=a52_0x20b156[_0x2b7c23(0x8f)](_0x55d9f5),_0x338697=[];for(const _0x3b5315 of _0x33df71){if(!_0x3b5315[_0x2b7c23(0xb7)](_0x2b7c23(0x9e)))continue;const _0x2c13bd=_0x3b5315[_0x2b7c23(0x9f)](_0x2b7c23(0x9e),''),_0x3a1939=parseInt(_0x2c13bd,0xa);!isNaN(_0x3a1939)&&isProcessRunning(_0x3a1939)&&_0x338697[_0x2b7c23(0xb2)](_0x3a1939);}return _0x338697[_0x2b7c23(0xa9)]((_0x29fb1f,_0x28599b)=>_0x29fb1f-_0x28599b);}catch{return[];}}
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_0xe913(){const _0x1a6252=['parse','2382438UOBhPs','stringify','.json','2968220goJBOg','999009WcAKYH','4587YvCHPw','utf-8','users','937937wptkoh','default','users-','106UxxfJl','230442YCCrSA','32PaszLs','1415992MBCAnH','now'];a53_0xe913=function(){return _0x1a6252;};return a53_0xe913();}(function(_0x3fc020,_0x2a1878){const _0x401a16=a53_0x3c9f,_0x14a757=_0x3fc020();while(!![]){try{const _0x9ffa40=-parseInt(_0x401a16(0xc8))/0x1*(parseInt(_0x401a16(0xbd))/0x2)+parseInt(_0x401a16(0xbe))/0x3+parseInt(_0x401a16(0xc0))/0x4+-parseInt(_0x401a16(0xc6))/0x5+parseInt(_0x401a16(0xc3))/0x6+parseInt(_0x401a16(0xba))/0x7*(parseInt(_0x401a16(0xbf))/0x8)+-parseInt(_0x401a16(0xc7))/0x9;if(_0x9ffa40===_0x2a1878)break;else _0x14a757['push'](_0x14a757['shift']());}catch(_0x640f6e){_0x14a757['push'](_0x14a757['shift']());}}}(a53_0xe913,0x6595d));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x23dd68){const _0x37abf3=a53_0x3c9f,_0x5b1e81=_0x23dd68||_0x37abf3(0xbb);return join(getCacheDir(),_0x37abf3(0xbc)+_0x5b1e81+_0x37abf3(0xc5));}export function loadCachedUsers(_0x208c47){const _0x53154b=a53_0x3c9f,_0x10b454=getCacheFilePath(_0x208c47);if(!existsSync(_0x10b454))return null;try{const _0x3321f7=readFileSync(_0x10b454,_0x53154b(0xb8)),_0xb89f70=JSON[_0x53154b(0xc2)](_0x3321f7);return _0xb89f70[_0x53154b(0xb9)];}catch{return null;}}export function saveCachedUsers(_0x11fd85,_0x3dab4c){const _0x2b1edd=a53_0x3c9f,_0x57f410=getCacheDir();!existsSync(_0x57f410)&&mkdirSync(_0x57f410,{'recursive':!![]});const _0x2bcf4c=getCacheFilePath(_0x11fd85),_0x2911b1={'users':_0x3dab4c,'cachedAt':Date[_0x2b1edd(0xc1)]()};writeFileSync(_0x2bcf4c,JSON[_0x2b1edd(0xc4)](_0x2911b1,null,0x2),'utf-8');}function a53_0x3c9f(_0x15fd3f,_0x26f746){_0x15fd3f=_0x15fd3f-0xb8;const _0xe91334=a53_0xe913();let _0x3c9fc5=_0xe91334[_0x15fd3f];return _0x3c9fc5;}export function clearUserCache(_0x54c8e0){const _0x6be0e8=getCacheFilePath(_0x54c8e0);if(existsSync(_0x6be0e8))try{unlinkSync(_0x6be0e8);}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(_0x5cbe26,_0x230b58){const _0xc26e8=a54_0xc226,_0xfe0c46=_0x5cbe26();while(!![]){try{const _0x4cde64=-parseInt(_0xc26e8(0x1f2))/0x1*(parseInt(_0xc26e8(0x1f6))/0x2)+parseInt(_0xc26e8(0x1fd))/0x3*(parseInt(_0xc26e8(0x1fb))/0x4)+-parseInt(_0xc26e8(0x1f4))/0x5+parseInt(_0xc26e8(0x1ef))/0x6+parseInt(_0xc26e8(0x1ee))/0x7+-parseInt(_0xc26e8(0x1fa))/0x8*(parseInt(_0xc26e8(0x1f5))/0x9)+parseInt(_0xc26e8(0x1f0))/0xa;if(_0x4cde64===_0x230b58)break;else _0xfe0c46['push'](_0xfe0c46['shift']());}catch(_0x31ee42){_0xfe0c46['push'](_0xfe0c46['shift']());}}}(a54_0x1a9b,0x343ee));function a54_0xc226(_0x279bab,_0x47e487){_0x279bab=_0x279bab-0x1ee;const _0x1a9b35=a54_0x1a9b();let _0xc22610=_0x1a9b35[_0x279bab];return _0xc22610;}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;function a54_0x1a9b(){const _0x2e23a3=['69YhyrpN','1533287WWfDLk','2512410KBckQm','842080bRHame','includes','87031VQFclq','.dev','1735910DnCCHH','6507UxcUjr','6MYQZXf','version','utf-8','parse','1704ScIMvn','44224OdRPaA','../../package.json'];a54_0x1a9b=function(){return _0x2e23a3;};return a54_0x1a9b();}export function getBuildInfo(){const _0x72df70=a54_0xc226;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x2dd8c7=fileURLToPath(import.meta.url),_0x4bdadd=dirname(_0x2dd8c7);try{const _0x21da87=join(_0x4bdadd,'../build-info.json');cachedBuildInfo=JSON[_0x72df70(0x1f9)](readFileSync(_0x21da87,_0x72df70(0x1f8)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x5d9bf9=a54_0xc226;if(cachedVersion!==null)return cachedVersion;const _0x1c6cb9=fileURLToPath(import.meta.url),_0x57a9b4=dirname(_0x1c6cb9),_0x30a4e5=getBuildInfo();if(_0x30a4e5['version'])return cachedVersion=_0x30a4e5[_0x5d9bf9(0x1f7)],cachedVersion;try{const _0xee1f65=join(_0x57a9b4,_0x5d9bf9(0x1fc)),_0x56f007=JSON[_0x5d9bf9(0x1f9)](readFileSync(_0xee1f65,_0x5d9bf9(0x1f8)));cachedVersion=_0x56f007['version'];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x220950=a54_0xc226,_0x3c3a3f=getVersion();return _0x3c3a3f[_0x220950(0x1f1)](_0x220950(0x1f3))||_0x3c3a3f['includes']('-');}
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(_0x26d509,_0x4b5a1d){var _0x595341=a55_0x2246,_0x426cf6=_0x26d509();while(!![]){try{var _0x2345c7=-parseInt(_0x595341(0x1fb))/0x1*(parseInt(_0x595341(0x1f1))/0x2)+parseInt(_0x595341(0x1f7))/0x3*(-parseInt(_0x595341(0x1f2))/0x4)+-parseInt(_0x595341(0x1f3))/0x5+parseInt(_0x595341(0x1f4))/0x6+parseInt(_0x595341(0x1f5))/0x7+-parseInt(_0x595341(0x1f9))/0x8*(parseInt(_0x595341(0x1f6))/0x9)+parseInt(_0x595341(0x1f8))/0xa*(parseInt(_0x595341(0x1fa))/0xb);if(_0x2345c7===_0x4b5a1d)break;else _0x426cf6['push'](_0x426cf6['shift']());}catch(_0x4f8a8f){_0x426cf6['push'](_0x426cf6['shift']());}}}(a55_0x2d23,0x40543));function a55_0x2d23(){var _0x8a352d=['2056410cTQcTy','633978ABEHvn','3001551OeBINK','72rWlJKN','6rGzrhf','10717270DmisvK','180976ptMSiG','11CcKvsb','270bGFgDm','3778pPmYYL','480808cGBJOU'];a55_0x2d23=function(){return _0x8a352d;};return a55_0x2d23();}export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';function a55_0x2246(_0x6a0102,_0x1e904f){_0x6a0102=_0x6a0102-0x1f1;var _0x2d23af=a55_0x2d23();var _0x224653=_0x2d23af[_0x6a0102];return _0x224653;}export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_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(_0x4d1b8f,_0x581301){const _0x28455a=a56_0x348e,_0x38be00=_0x4d1b8f();while(!![]){try{const _0x1156ff=-parseInt(_0x28455a(0x143))/0x1+parseInt(_0x28455a(0x131))/0x2+parseInt(_0x28455a(0x140))/0x3+parseInt(_0x28455a(0x151))/0x4*(parseInt(_0x28455a(0x145))/0x5)+parseInt(_0x28455a(0x149))/0x6+-parseInt(_0x28455a(0x146))/0x7+-parseInt(_0x28455a(0x14a))/0x8;if(_0x1156ff===_0x581301)break;else _0x38be00['push'](_0x38be00['shift']());}catch(_0x4ec3f2){_0x38be00['push'](_0x38be00['shift']());}}}(a56_0x4137,0xc521a));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';function a56_0x4137(){const _0x3aec95=['array','once','SIGTERM','error','CDP','examples','map','1.0.0','description','**\x20(','describe','success','registerTool','No\x20commands\x20found\x20matching\x20\x22','3078168jABiSX','close','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.','656646xvAuAe','output','215reKelg','6068188AbWhnL','Data','Utilities','6531036baKOzm','1597080PzfUlR','text','\x0a\x0aExamples:\x0a','category','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.','join','\x0a\x0a---\x0a\x0a','14520rawQMu','tdx','optional','enum','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','tdx_search','tdx_run','string','Context','Command\x20failed','519926mBdwGu'];a56_0x4137=function(){return _0x3aec95;};return a56_0x4137();}import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x7563c7={}){const _0x32a628=a56_0x348e,_0x3a4a78=new McpServer({'name':_0x32a628(0x152),'version':_0x32a628(0x139)});return _0x3a4a78['registerTool'](_0x32a628(0x157),{'description':_0x32a628(0x142),'inputSchema':{'args':z[_0x32a628(0x132)](z[_0x32a628(0x158)]())[_0x32a628(0x13c)](_0x32a628(0x155))}},async({args:_0x17998a})=>{const _0xef4853=_0x32a628,_0x4d3f55=await executeTdxRun({'args':_0x17998a},_0x7563c7['env']||{});return _0x4d3f55[_0xef4853(0x13d)]?{'content':[{'type':_0xef4853(0x14b),'text':_0x4d3f55[_0xef4853(0x144)]||'Command\x20completed\x20successfully'}]}:{'content':[{'type':'text','text':_0x4d3f55[_0xef4853(0x135)]||_0x4d3f55[_0xef4853(0x144)]||_0xef4853(0x130)}],'isError':!![]};}),_0x3a4a78[_0x32a628(0x13e)](_0x32a628(0x156),{'description':_0x32a628(0x14e),'inputSchema':{'query':z[_0x32a628(0x158)]()[_0x32a628(0x13c)]('Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)'),'category':z[_0x32a628(0x154)]([_0x32a628(0x147),_0x32a628(0x136),'AI',_0x32a628(0x159),_0x32a628(0x148)])[_0x32a628(0x153)]()[_0x32a628(0x13c)]('Optional\x20filter\x20by\x20category')}},async({query:_0x2ab8c5,category:_0x43a0a4})=>{const _0x37db17=_0x32a628,_0x31df0c=searchCommands({'query':_0x2ab8c5,'category':_0x43a0a4});if(_0x31df0c['length']===0x0)return{'content':[{'type':_0x37db17(0x14b),'text':_0x37db17(0x13f)+_0x2ab8c5+'\x22'}]};const _0x24d45e=_0x31df0c[_0x37db17(0x138)](_0x123800=>{const _0x24b61b=_0x37db17,_0x1ed0b8=_0x123800[_0x24b61b(0x137)][_0x24b61b(0x138)](_0x8b2269=>'\x20\x20'+_0x8b2269)[_0x24b61b(0x14f)]('\x0a');return'**'+_0x123800['name']+_0x24b61b(0x13b)+_0x123800[_0x24b61b(0x14d)]+')\x0a'+_0x123800[_0x24b61b(0x13a)]+_0x24b61b(0x14c)+_0x1ed0b8;})[_0x37db17(0x14f)](_0x37db17(0x150));return{'content':[{'type':_0x37db17(0x14b),'text':_0x24d45e}]};}),_0x3a4a78;}function a56_0x348e(_0x163abc,_0x4063a4){_0x163abc=_0x163abc-0x130;const _0x41377=a56_0x4137();let _0x348e96=_0x41377[_0x163abc];return _0x348e96;}export async function startMCPServer(_0x3a73b1={}){const _0x49f49a=createMCPServer(_0x3a73b1),_0x463520=new StdioServerTransport();return await _0x49f49a['connect'](_0x463520),new Promise(_0x4b586e=>{const _0x38ae3c=a56_0x348e;let _0x47e977=![];const _0x1b3ae8=async()=>{const _0x431bb6=a56_0x348e;if(_0x47e977)return;_0x47e977=!![],await _0x49f49a[_0x431bb6(0x141)](),_0x4b586e();};process[_0x38ae3c(0x133)]('SIGINT',_0x1b3ae8),process['once'](_0x38ae3c(0x134),_0x1b3ae8),process['stdin']['once'](_0x38ae3c(0x141),_0x1b3ae8);});}
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(_0x10d8e9,_0x1b6022){var _0xa1378a=a57_0x24e5,_0x1d0535=_0x10d8e9();while(!![]){try{var _0x49d224=parseInt(_0xa1378a(0x123))/0x1+-parseInt(_0xa1378a(0x12b))/0x2+-parseInt(_0xa1378a(0x126))/0x3*(-parseInt(_0xa1378a(0x128))/0x4)+parseInt(_0xa1378a(0x12c))/0x5*(parseInt(_0xa1378a(0x125))/0x6)+-parseInt(_0xa1378a(0x124))/0x7+-parseInt(_0xa1378a(0x129))/0x8+parseInt(_0xa1378a(0x12a))/0x9*(parseInt(_0xa1378a(0x127))/0xa);if(_0x49d224===_0x1b6022)break;else _0x1d0535['push'](_0x1d0535['shift']());}catch(_0x53fa59){_0x1d0535['push'](_0x1d0535['shift']());}}}(a57_0x5f3a,0x212e9));function a57_0x24e5(_0x5bf608,_0x256b52){_0x5bf608=_0x5bf608-0x123;var _0x5f3a22=a57_0x5f3a();var _0x24e5b0=_0x5f3a22[_0x5bf608];return _0x24e5b0;}export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';function a57_0x5f3a(){var _0x3252eb=['439915Epbxou','70801PcqRcG','1313655asgmsy','6dwZKSx','1743ArZMAI','30LOusdT','948MdqAkP','1163416osfgaQ','1166382lGJySb','432540VzxXBJ'];a57_0x5f3a=function(){return _0x3252eb;};return a57_0x5f3a();}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_0x503414=a58_0x4de2;(function(_0x1bb237,_0x215924){const _0x57e0ea=a58_0x4de2,_0x43f9f8=_0x1bb237();while(!![]){try{const _0x4f2edd=parseInt(_0x57e0ea(0x140))/0x1+parseInt(_0x57e0ea(0x138))/0x2+parseInt(_0x57e0ea(0x143))/0x3+parseInt(_0x57e0ea(0x13a))/0x4*(-parseInt(_0x57e0ea(0x135))/0x5)+parseInt(_0x57e0ea(0x134))/0x6*(-parseInt(_0x57e0ea(0x137))/0x7)+parseInt(_0x57e0ea(0x13d))/0x8*(parseInt(_0x57e0ea(0x133))/0x9)+-parseInt(_0x57e0ea(0x14a))/0xa;if(_0x4f2edd===_0x215924)break;else _0x43f9f8['push'](_0x43f9f8['shift']());}catch(_0x42a67a){_0x43f9f8['push'](_0x43f9f8['shift']());}}}(a58_0x23ac,0xdcca0));function a58_0x23ac(){const _0x5af99e=['Failed\x20to\x20spawn\x20tdx:\x20','tdx','string','kill','3300280qeExZh','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','object','9ymFrym','5365974hlrytI','5ppkVgG','SIGTERM','14OXLxVA','3530492KJGzMG','message','2654376LgkVBU','Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','--json','906232MkqLiY','close','describe','803819xdzoEM','--no-color','stdout','3012864uXlpzq','true','pipe'];a58_0x23ac=function(){return _0x5af99e;};return a58_0x23ac();}function a58_0x4de2(_0x3476ff,_0x52547b){_0x3476ff=_0x3476ff-0x133;const _0x23acfd=a58_0x23ac();let _0x4de206=_0x23acfd[_0x3476ff];return _0x4de206;}import{spawn}from'child_process';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a58_0x503414(0x14c)]({'args':z['array'](z[a58_0x503414(0x148)]())[a58_0x503414(0x13f)](a58_0x503414(0x14b))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;export async function executeTdxRun(_0x3e9ad7,_0x942340){const _0x3c8d07=a58_0x503414,{args:_0x2091bf}=_0x3e9ad7;if(isBlockedCommand(_0x2091bf)){const _0x55c0d3=getBlockedReason(_0x2091bf);return{'success':![],'output':'','error':_0x55c0d3||'This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','exitCode':0x1};}const _0x59146f=[_0x3c8d07(0x13c),_0x3c8d07(0x141),..._0x2091bf];return new Promise(_0x58b085=>{const _0x178805=_0x3c8d07,_0x1ce79a=spawn(_0x178805(0x147),_0x59146f,{'env':{...process['env'],..._0x942340,'CI':_0x178805(0x144)},'stdio':['ignore',_0x178805(0x145),_0x178805(0x145)]});let _0x3d8684='',_0x1f4348='',_0x35087b=![];const _0x5384a6=setTimeout(()=>{const _0x5f5c1d=_0x178805;_0x35087b=!![],_0x1ce79a[_0x5f5c1d(0x149)](_0x5f5c1d(0x136));},DEFAULT_TIMEOUT_MS);_0x1ce79a[_0x178805(0x142)]['on']('data',_0xeeeb6a=>{_0x3d8684+=_0xeeeb6a['toString']();}),_0x1ce79a['stderr']['on']('data',_0x392467=>{_0x1f4348+=_0x392467['toString']();}),_0x1ce79a['on']('error',_0x5395f4=>{const _0x2d7628=_0x178805;clearTimeout(_0x5384a6),_0x58b085({'success':![],'output':'','error':_0x2d7628(0x146)+_0x5395f4[_0x2d7628(0x139)],'exitCode':0x1});}),_0x1ce79a['on'](_0x178805(0x13e),_0x48dcb2=>{const _0x4a103a=_0x178805;clearTimeout(_0x5384a6);if(_0x35087b){_0x58b085({'success':![],'output':formatOutput(_0x3d8684),'error':_0x4a103a(0x13b),'exitCode':0x7c});return;}const _0x2b0272=_0x48dcb2??0x1,_0x14d257=_0x2b0272===0x0,_0x183d79=formatOutput(_0x3d8684||_0x1f4348),_0x50e921=!_0x14d257&&_0x1f4348?formatOutput(_0x1f4348):undefined;_0x58b085({'success':_0x14d257,'output':_0x183d79,'error':_0x50e921,'exitCode':_0x2b0272});});});}
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});});});}