@treasuredata/tdx 0.25.3 → 0.25.4

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 (163) 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/mcp-command.js +1 -1
  24. package/dist/commands/parent-segment-command.js +1 -1
  25. package/dist/commands/profile-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/schedule-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/passthrough-server.js +1 -1
  66. package/dist/proxy/sse-usage-parser.js +1 -1
  67. package/dist/sdk/agent/agent-config.js +1 -1
  68. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.js +1 -1
  70. package/dist/sdk/agent/test/evaluator.js +1 -1
  71. package/dist/sdk/agent/test/executor.js +1 -1
  72. package/dist/sdk/agent/test/index.js +1 -1
  73. package/dist/sdk/agent/test/output.js +1 -1
  74. package/dist/sdk/agent/test/parser.js +1 -1
  75. package/dist/sdk/api.js +1 -1
  76. package/dist/sdk/client/cdp-api-client.js +1 -1
  77. package/dist/sdk/client/endpoints.js +1 -1
  78. package/dist/sdk/client/engage-api-client.js +1 -1
  79. package/dist/sdk/client/http-client.js +1 -1
  80. package/dist/sdk/client/llm-api-client.js +1 -1
  81. package/dist/sdk/client/rate-limiter.js +1 -1
  82. package/dist/sdk/client/td-api-client.js +1 -1
  83. package/dist/sdk/client/trino-api-client.js +1 -1
  84. package/dist/sdk/client/workflow-client.js +1 -1
  85. package/dist/sdk/connection-validator.js +1 -1
  86. package/dist/sdk/connection.js +1 -1
  87. package/dist/sdk/engage.js +1 -1
  88. package/dist/sdk/errors.js +1 -1
  89. package/dist/sdk/index.js +1 -1
  90. package/dist/sdk/io/index.js +1 -1
  91. package/dist/sdk/io/node-filesystem.js +1 -1
  92. package/dist/sdk/job.js +1 -1
  93. package/dist/sdk/journey.js +1 -1
  94. package/dist/sdk/llm/chat-cache.js +1 -1
  95. package/dist/sdk/llm/index.js +1 -1
  96. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  97. package/dist/sdk/llm/model-factors.js +1 -1
  98. package/dist/sdk/query/index.js +1 -1
  99. package/dist/sdk/query/sql-parser.js +1 -1
  100. package/dist/sdk/schedule.js +1 -1
  101. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  102. package/dist/sdk/segment/fields-display.js +1 -1
  103. package/dist/sdk/segment/file-discovery.js +1 -1
  104. package/dist/sdk/segment/journey-utils.js +1 -1
  105. package/dist/sdk/segment/journey-yaml.js +1 -1
  106. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  107. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  108. package/dist/sdk/segment/pull-workflow.js +1 -1
  109. package/dist/sdk/segment/push-workflow.js +1 -1
  110. package/dist/sdk/segment/resolution-context.js +1 -1
  111. package/dist/sdk/segment/segment-path-parser.js +1 -1
  112. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  113. package/dist/sdk/segment/target-resolution.js +1 -1
  114. package/dist/sdk/segment/tdx-config.js +1 -1
  115. package/dist/sdk/segment/validate-files.js +1 -1
  116. package/dist/sdk/segment/yaml-validator.js +1 -1
  117. package/dist/sdk/segment.js +1 -1
  118. package/dist/sdk/types/index.js +1 -1
  119. package/dist/sdk/types/progress.js +1 -1
  120. package/dist/sdk/user.js +1 -1
  121. package/dist/sdk/util/format-detector.js +1 -1
  122. package/dist/sdk/util/formatters.js +1 -1
  123. package/dist/sdk/util/index.js +1 -1
  124. package/dist/sdk/util/tree-formatter.js +1 -1
  125. package/dist/sdk/workflow/archive-validation.js +1 -1
  126. package/dist/sdk/workflow/clone-workflow.js +1 -1
  127. package/dist/sdk/workflow/index.js +1 -1
  128. package/dist/sdk/workflow/pull-workflow.js +1 -1
  129. package/dist/sdk/workflow/push-workflow.js +1 -1
  130. package/dist/sdk/workflow/tdx-config.js +1 -1
  131. package/dist/sdk/workflow/workflow-utils.js +1 -1
  132. package/dist/test-utils/command-runner.js +1 -1
  133. package/dist/test-utils/factories.js +1 -1
  134. package/dist/test-utils/fixtures.js +1 -1
  135. package/dist/test-utils/http-mock.js +1 -1
  136. package/dist/test-utils/index.js +1 -1
  137. package/dist/utils/async.js +1 -1
  138. package/dist/utils/colors.js +1 -1
  139. package/dist/utils/diff.js +1 -1
  140. package/dist/utils/file-permissions.js +1 -1
  141. package/dist/utils/global-cache.js +1 -1
  142. package/dist/utils/json-loader.js +1 -1
  143. package/dist/utils/local-cache.js +1 -1
  144. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  145. package/dist/utils/logger/formatters/index.js +1 -1
  146. package/dist/utils/logger/handlers/console-handler.js +1 -1
  147. package/dist/utils/logger/handlers/file-handler.js +1 -1
  148. package/dist/utils/logger/handlers/index.js +1 -1
  149. package/dist/utils/logger/handlers/null-handler.js +1 -1
  150. package/dist/utils/logger/index.js +1 -1
  151. package/dist/utils/logger/logger.js +1 -1
  152. package/dist/utils/logger/types.js +1 -1
  153. package/dist/utils/option-validation.js +1 -1
  154. package/dist/utils/port.js +1 -1
  155. package/dist/utils/process.js +1 -1
  156. package/dist/utils/prompt.js +1 -1
  157. package/dist/utils/spinner.js +1 -1
  158. package/dist/utils/sse-parser.js +1 -1
  159. package/dist/utils/string-utils.js +1 -1
  160. package/dist/utils/table-ref-parser.js +1 -1
  161. package/dist/utils/tdx-logger.js +1 -1
  162. package/dist/utils/version-check.js +1 -1
  163. package/package.json +1 -1
@@ -1 +1 @@
1
- const a45_0xe3f3af=a45_0x566d;(function(_0x36588f,_0x2cd4e1){const _0x33c7ad=a45_0x566d,_0x5f5b31=_0x36588f();while(!![]){try{const _0x451f40=-parseInt(_0x33c7ad(0x181))/0x1*(-parseInt(_0x33c7ad(0x17e))/0x2)+parseInt(_0x33c7ad(0x188))/0x3*(-parseInt(_0x33c7ad(0x158))/0x4)+-parseInt(_0x33c7ad(0x186))/0x5*(parseInt(_0x33c7ad(0x172))/0x6)+parseInt(_0x33c7ad(0x190))/0x7*(parseInt(_0x33c7ad(0x173))/0x8)+-parseInt(_0x33c7ad(0x15b))/0x9*(parseInt(_0x33c7ad(0x19f))/0xa)+parseInt(_0x33c7ad(0x166))/0xb+parseInt(_0x33c7ad(0x15f))/0xc;if(_0x451f40===_0x2cd4e1)break;else _0x5f5b31['push'](_0x5f5b31['shift']());}catch(_0x3f61e7){_0x5f5b31['push'](_0x5f5b31['shift']());}}}(a45_0x4a24,0xdf8dd));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x29832a from'node:fs';import*as a45_0x1fdbb2 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x97fc9a from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x238578=a45_0x566d;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x238578(0x19a),_0x238578(0x16d));}function a45_0x4a24(){const _0x2edb53=['includes','dev-us01','projectId','.json','1707362Eegryt','utf-8','.env.','1jbWOeQ','site','endsWith','path','jp01','4202335TdHuFq','Warning:\x20Unknown\x20site\x20\x27','3bGoZHk','tdx.json','string','warn','startsWith','write','keychain\x20(profile:\x20','TDX_API_KEY_','7520198Fcmleo','stable','existsSync','some','eu01','dev-eu01','us01','ap03','match','config/llm-project','.config','TD_API_KEY_','split','account_info','TDX_API_KEY\x20env\x20var','30BeExEg','llm_default_agent','replace','3863876VYjLLx','ap02','stg-ap03','3913857GHPZzH','\x27,\x20defaulting\x20to\x20us01','name','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','22292484ChjLtA','readFileSync','yellow','filter','apiKey','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','toUpperCase','2651330lUyMiv','stg-us01','slice','release_channel','proxy','\x20env\x20var','llm_default_project','tdx','profile','.env','join','parse','6MVREjF','8KEBnIS','trim','number','next','read','stg-jp01','TD_API_KEY'];a45_0x4a24=function(){return _0x2edb53;};return a45_0x4a24();}export function getConfigFile(){const _0x43f3e5=a45_0x566d;return join(getConfigDir(),_0x43f3e5(0x16f));}export function getConfigFilePath(_0x412878){const _0x39bbc8=a45_0x566d,_0x20db8a=getConfigDir();return _0x412878?a45_0x1fdbb2[_0x39bbc8(0x170)](_0x20db8a,_0x39bbc8(0x180)+_0x412878):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0xe3f3af(0x16c),a45_0xe3f3af(0x199));export function getLLMProjectCacheFile(_0x9e676c){const _0x1b0a1b=a45_0xe3f3af;return llmProjectCache[_0x1b0a1b(0x184)](_0x9e676c);}export function readCachedLLMProject(_0x287e69){const _0x5a42a5=a45_0xe3f3af,_0x58ea89=llmProjectCache[_0x5a42a5(0x177)](_0x287e69);if(_0x58ea89&&typeof _0x58ea89['id']===_0x5a42a5(0x18a)&&typeof _0x58ea89[_0x5a42a5(0x15d)]==='string')return _0x58ea89;return null;}export function writeCachedLLMProject(_0x49b6f7,_0x4d43d2,_0x21f20c){const _0x189e46=a45_0xe3f3af;try{llmProjectCache[_0x189e46(0x18d)]({'name':_0x49b6f7,'id':_0x4d43d2},_0x21f20c);}catch{}}function a45_0x566d(_0x23c1e4,_0x472159){_0x23c1e4=_0x23c1e4-0x157;const _0x4a2410=a45_0x4a24();let _0x566d97=_0x4a2410[_0x23c1e4];return _0x566d97;}const llmAgentCache=createOptionalProfileCache(a45_0xe3f3af(0x1a0),'config/llm-agent');export function getLLMAgentCacheFile(_0x2e857b){const _0x45f948=a45_0xe3f3af;return llmAgentCache[_0x45f948(0x184)](_0x2e857b);}export function readCachedLLMAgent(_0x3451a0){const _0x19d38f=a45_0xe3f3af,_0x5f318b=llmAgentCache[_0x19d38f(0x177)](_0x3451a0);if(_0x5f318b&&typeof _0x5f318b['id']===_0x19d38f(0x18a)&&typeof _0x5f318b[_0x19d38f(0x15d)]===_0x19d38f(0x18a)&&typeof _0x5f318b[_0x19d38f(0x17c)]===_0x19d38f(0x18a))return _0x5f318b;return null;}export function writeCachedLLMAgent(_0x462212,_0x143e91,_0x4f9b32,_0x49723d){const _0x58ef36=a45_0xe3f3af;try{llmAgentCache[_0x58ef36(0x18d)]({'name':_0x462212,'id':_0x143e91,'projectId':_0x4f9b32},_0x49723d);}catch{}}export function clearCachedLLMAgent(_0x301ac1){try{llmAgentCache['clear'](_0x301ac1);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0xe3f3af(0x19d),'config/account-info',{'suffix':a45_0xe3f3af(0x17d)});export function getAccountInfoCacheFile(_0x5510c8){return accountInfoCache['path'](_0x5510c8);}export function readCachedAccountInfo(_0x44f7b6){const _0x33aa18=a45_0xe3f3af,_0x3a3aaf=accountInfoCache[_0x33aa18(0x177)](_0x44f7b6);if(_0x3a3aaf&&typeof _0x3a3aaf[_0x33aa18(0x182)]===_0x33aa18(0x18a)&&typeof _0x3a3aaf['accountId']===_0x33aa18(0x175))return _0x3a3aaf;return null;}export function writeCachedAccountInfo(_0x464f5e,_0x3dd7a4,_0x5a490c){try{accountInfoCache['write']({'site':_0x464f5e,'accountId':_0x3dd7a4,'cachedAt':new Date()['toISOString']()},_0x5a490c);}catch{}}export function parseEnvFile(_0x528464){const _0x27fd4d=a45_0xe3f3af,_0x3fbe88={};for(const _0x472b0b of _0x528464[_0x27fd4d(0x19c)]('\x0a')){const _0xc0a615=_0x472b0b['trim']();if(!_0xc0a615||_0xc0a615[_0x27fd4d(0x18c)]('#'))continue;const _0x3d399f=_0xc0a615[_0x27fd4d(0x198)](/^([^=]+)=(.*)$/);if(_0x3d399f){const _0x35e1b8=_0x3d399f[0x1][_0x27fd4d(0x174)]();let _0x5a53fb=_0x3d399f[0x2][_0x27fd4d(0x174)]();(_0x5a53fb['startsWith']('\x22')&&_0x5a53fb['endsWith']('\x22')||_0x5a53fb[_0x27fd4d(0x18c)]('\x27')&&_0x5a53fb[_0x27fd4d(0x183)]('\x27'))&&(_0x5a53fb=_0x5a53fb[_0x27fd4d(0x168)](0x1,-0x1)),_0x3fbe88[_0x35e1b8]=_0x5a53fb;}}return _0x3fbe88;}export function readUserConfig(){const _0x5ce010=a45_0xe3f3af,_0x1b5d72=getConfigFile();if(!existsSync(_0x1b5d72))return{};try{const _0x150932=readFileSync(_0x1b5d72,'utf-8');return parseEnvFile(_0x150932);}catch(_0x15cd81){return console['warn'](_0x5ce010(0x15e)+_0x1b5d72+':',_0x15cd81),{};}}export function resolveSite(_0x46f333){const _0x2edf2c=a45_0xe3f3af,_0x21cf01=[_0x2edf2c(0x196),'jp01',_0x2edf2c(0x194),_0x2edf2c(0x159),_0x2edf2c(0x197),_0x2edf2c(0x17b),_0x2edf2c(0x195),'stg-us01',_0x2edf2c(0x178),_0x2edf2c(0x15a)];if(_0x21cf01[_0x2edf2c(0x17a)](_0x46f333))return _0x46f333;if(_0x46f333 in SITE_ALIASES)return SITE_ALIASES[_0x46f333];return console[_0x2edf2c(0x18b)](_0x2edf2c(0x187)+_0x46f333+_0x2edf2c(0x15c)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x973f50){const _0x1f8448=a45_0xe3f3af,_0x50f6d0=_0x973f50||getActiveProfileName();if(_0x50f6d0){const _0x1b363e=_0x1f8448(0x18f)+normalizeProfileForEnvVar(_0x50f6d0);if(process.env[_0x1b363e])return process.env[_0x1b363e];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x3cf6c7){return _0x3cf6c7['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x3b0b40,_0x209451){const _0x1c080a=a45_0xe3f3af,_0x23fa72=_0x209451||getActiveProfileName()||undefined;if(_0x23fa72){const _0x4ec877=_0x1c080a(0x18f)+normalizeProfileForEnvVar(_0x23fa72);if(process.env[_0x4ec877])return{'apiKey':process.env[_0x4ec877],'source':_0x4ec877+_0x1c080a(0x16b),'isDeprecated':![]};const _0x66f389=getCachedCredential(_0x3b0b40,_0x23fa72);if(_0x66f389)return{'apiKey':_0x66f389,'source':_0x1c080a(0x18e)+_0x23fa72+')','isDeprecated':![]};const _0x372c86=await getKeychainAPIKey(_0x23fa72);if(_0x372c86)return setCachedCredential(_0x372c86,_0x3b0b40,_0x23fa72),{'apiKey':_0x372c86,'source':_0x1c080a(0x18e)+_0x23fa72+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x1c080a(0x19e),'isDeprecated':![]};if(!_0x23fa72){const _0x2d066d=getCachedCredential(_0x3b0b40,undefined);if(_0x2d066d)return{'apiKey':_0x2d066d,'source':'keychain','isDeprecated':![]};const _0x5a9abf=await getKeychainAPIKey(undefined);if(_0x5a9abf)return setCachedCredential(_0x5a9abf,_0x3b0b40,undefined),{'apiKey':_0x5a9abf,'source':'keychain','isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x1ea06a,_0xd55961){const _0x43018e=a45_0xe3f3af,_0xf36da8=await resolveAPIKeyAsync(_0x1ea06a,_0xd55961);return _0xf36da8?.[_0x43018e(0x163)];}function cleanupLegacyEnvFile(_0x19a155){const _0x3149b7=a45_0xe3f3af;if(!existsSync(_0x19a155))return![];try{const _0x23932b=readFileSync(_0x19a155,_0x3149b7(0x17f)),_0x33603f=_0x23932b[_0x3149b7(0x19c)]('\x0a'),_0xacc44c=_0x33603f[_0x3149b7(0x162)](_0x12dbdb=>{const _0x46c756=_0x3149b7,_0x3a36a2=_0x12dbdb[_0x46c756(0x174)]();if(!_0x3a36a2||_0x3a36a2[_0x46c756(0x18c)]('#'))return!![];const [_0x597d7d]=_0x3a36a2[_0x46c756(0x19c)]('=');return!_0x597d7d[_0x46c756(0x18c)](_0x46c756(0x179));}),_0x36cdda=_0xacc44c[_0x3149b7(0x193)](_0x582d36=>{const _0x27313d=_0x3149b7,_0x20d6fc=_0x582d36[_0x27313d(0x174)]();return _0x20d6fc&&!_0x20d6fc['startsWith']('#');});if(!_0x36cdda)return unlinkSync(_0x19a155),!![];return writeFileSync(_0x19a155,_0xacc44c['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x20abe5=a45_0xe3f3af;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x5bf4fb=a45_0x1fdbb2[_0x20abe5(0x170)](getConfigDir(),_0x20abe5(0x189));if(!a45_0x29832a['existsSync'](_0x5bf4fb))return null;try{const _0x243e5f=a45_0x29832a['readFileSync'](_0x5bf4fb,_0x20abe5(0x17f)),_0x2f4a18=JSON['parse'](_0x243e5f);return _0x2f4a18[_0x20abe5(0x16e)]||null;}catch{return null;}}export function saveAPIKey(_0x25acfa,_0x597a4d,_0x5e78cf){const _0x4362dd=a45_0xe3f3af,_0x5d3e11=getConfigDir(),_0x376dee=getConfigFilePath(_0x5e78cf);!existsSync(_0x5d3e11)&&mkdirSync(_0x5d3e11,{'recursive':!![],'mode':0x1c0});let _0x2745d4={};if(existsSync(_0x376dee))try{const _0x627e0b=readFileSync(_0x376dee,'utf-8');_0x2745d4=parseEnvFile(_0x627e0b);}catch(_0x4cdce9){console[_0x4362dd(0x18b)]('Warning:\x20Failed\x20to\x20read\x20'+_0x376dee+':',_0x4cdce9);}const _0x499e31=_0x25acfa[_0x4362dd(0x165)]()[_0x4362dd(0x157)](/-/g,'_');_0x2745d4[_0x4362dd(0x19b)+_0x499e31]=_0x597a4d;const _0x212109=Object['entries'](_0x2745d4)['map'](([_0x27cc15,_0x44ba0c])=>_0x27cc15+'='+_0x44ba0c);writeFileSync(_0x376dee,_0x212109[_0x4362dd(0x170)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x1dec25,_0x56cc09,_0x2fa480){const _0x108b17=a45_0xe3f3af;await saveKeychainAPIKey(_0x1dec25,_0x2fa480),setCachedCredential(_0x1dec25,_0x56cc09,_0x2fa480);const _0x2652c5=getConfigFilePath(_0x2fa480);cleanupLegacyEnvFile(_0x2652c5)&&console[_0x108b17(0x18b)](a45_0x97fc9a[_0x108b17(0x161)](_0x108b17(0x164)));}export function loadConfig(){const _0x2e603d=a45_0xe3f3af,_0xcd87d7={'apiKeys':{},'defaultSite':_0x2e603d(0x196)},_0x3accd4=[_0x2e603d(0x196),_0x2e603d(0x185),_0x2e603d(0x194),'ap02',_0x2e603d(0x197),_0x2e603d(0x17b),'dev-eu01',_0x2e603d(0x167),_0x2e603d(0x178),_0x2e603d(0x15a)],_0x4905e7=getAPIKey();if(_0x4905e7)for(const _0x468a87 of _0x3accd4){_0xcd87d7['apiKeys'][_0x468a87]=_0x4905e7;}return _0xcd87d7;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x2a3fdf=a45_0xe3f3af,_0x2eb28d=a45_0x1fdbb2[_0x2a3fdf(0x170)](getConfigDir(),_0x2a3fdf(0x189));if(!a45_0x29832a['existsSync'](_0x2eb28d))return undefined;try{const _0x13b33a=a45_0x29832a[_0x2a3fdf(0x160)](_0x2eb28d,'utf-8'),_0x2fdd99=JSON[_0x2a3fdf(0x171)](_0x13b33a);return typeof _0x2fdd99[_0x2a3fdf(0x16a)]===_0x2a3fdf(0x18a)?_0x2fdd99[_0x2a3fdf(0x16a)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x34c468=a45_0xe3f3af,_0x40f6ef=process.env.TDX_RELEASE_CHANNEL;if(_0x40f6ef===_0x34c468(0x176)||_0x40f6ef===_0x34c468(0x191))return _0x40f6ef;const _0x2df643=a45_0x1fdbb2[_0x34c468(0x170)](getConfigDir(),_0x34c468(0x189));if(!a45_0x29832a[_0x34c468(0x192)](_0x2df643))return _0x34c468(0x191);try{const _0x368794=a45_0x29832a[_0x34c468(0x160)](_0x2df643,_0x34c468(0x17f)),_0x3b2f62=JSON['parse'](_0x368794);if(_0x3b2f62[_0x34c468(0x169)]===_0x34c468(0x176))return _0x34c468(0x176);}catch{}return _0x34c468(0x191);}export function saveReleaseChannel(_0x1faa4e){const _0x383516=a45_0xe3f3af,_0x585d3a=getConfigDir(),_0x8cff66=a45_0x1fdbb2[_0x383516(0x170)](_0x585d3a,_0x383516(0x189));!existsSync(_0x585d3a)&&mkdirSync(_0x585d3a,{'recursive':!![],'mode':0x1c0});let _0x42402e={};if(existsSync(_0x8cff66))try{const _0xfb0d63=readFileSync(_0x8cff66,'utf-8');_0x42402e=JSON[_0x383516(0x171)](_0xfb0d63);}catch{}_0x42402e[_0x383516(0x169)]=_0x1faa4e,writeFileSync(_0x8cff66,JSON['stringify'](_0x42402e,null,0x2),{'mode':0x180});}
1
+ const a45_0x41b713=a45_0x5918;(function(_0x3f511d,_0x2b9f51){const _0x2d35d7=a45_0x5918,_0x231065=_0x3f511d();while(!![]){try{const _0x5b58ce=parseInt(_0x2d35d7(0x14e))/0x1*(parseInt(_0x2d35d7(0x139))/0x2)+-parseInt(_0x2d35d7(0x12f))/0x3*(-parseInt(_0x2d35d7(0x150))/0x4)+-parseInt(_0x2d35d7(0x13c))/0x5+parseInt(_0x2d35d7(0x15f))/0x6+parseInt(_0x2d35d7(0x12d))/0x7+parseInt(_0x2d35d7(0x12e))/0x8*(parseInt(_0x2d35d7(0x136))/0x9)+-parseInt(_0x2d35d7(0x133))/0xa;if(_0x5b58ce===_0x2b9f51)break;else _0x231065['push'](_0x231065['shift']());}catch(_0x59e2bc){_0x231065['push'](_0x231065['shift']());}}}(a45_0x206e,0xd79eb));function a45_0x5918(_0x5d83ac,_0x199ef2){_0x5d83ac=_0x5d83ac-0x11e;const _0x206eed=a45_0x206e();let _0x59189a=_0x206eed[_0x5d83ac];return _0x59189a;}import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x1aca66 from'node:fs';import*as a45_0x5a10de from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x3a2cf0 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){return process.env.TDX_CONFIG_DIR||join(homedir(),'.config','tdx');}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x1b0929){const _0x28b82c=getConfigDir();return _0x1b0929?a45_0x5a10de['join'](_0x28b82c,'.env.'+_0x1b0929):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a45_0x41b713(0x130),a45_0x41b713(0x13b));export function getLLMProjectCacheFile(_0x188db1){return llmProjectCache['path'](_0x188db1);}export function readCachedLLMProject(_0x9a1cc8){const _0x291ace=a45_0x41b713,_0x461039=llmProjectCache[_0x291ace(0x129)](_0x9a1cc8);if(_0x461039&&typeof _0x461039['id']===_0x291ace(0x155)&&typeof _0x461039[_0x291ace(0x159)]===_0x291ace(0x155))return _0x461039;return null;}export function writeCachedLLMProject(_0x5103ef,_0x7fe725,_0x5d2c11){const _0x4cc368=a45_0x41b713;try{llmProjectCache[_0x4cc368(0x138)]({'name':_0x5103ef,'id':_0x7fe725},_0x5d2c11);}catch{}}const llmAgentCache=createOptionalProfileCache(a45_0x41b713(0x15c),a45_0x41b713(0x124));export function getLLMAgentCacheFile(_0x336dc4){const _0x3ae362=a45_0x41b713;return llmAgentCache[_0x3ae362(0x13d)](_0x336dc4);}export function readCachedLLMAgent(_0x67a431){const _0x497c00=a45_0x41b713,_0x5b2637=llmAgentCache['read'](_0x67a431);if(_0x5b2637&&typeof _0x5b2637['id']===_0x497c00(0x155)&&typeof _0x5b2637[_0x497c00(0x159)]==='string'&&typeof _0x5b2637['projectId']===_0x497c00(0x155))return _0x5b2637;return null;}export function writeCachedLLMAgent(_0x53e72a,_0x22223d,_0x493526,_0x2af89e){const _0x2fdea6=a45_0x41b713;try{llmAgentCache[_0x2fdea6(0x138)]({'name':_0x53e72a,'id':_0x22223d,'projectId':_0x493526},_0x2af89e);}catch{}}export function clearCachedLLMAgent(_0x5cd88a){try{llmAgentCache['clear'](_0x5cd88a);}catch{}}const accountInfoCache=createOptionalProfileCache(a45_0x41b713(0x13a),'config/account-info',{'suffix':a45_0x41b713(0x12b)});export function getAccountInfoCacheFile(_0x25eb61){const _0x574b8b=a45_0x41b713;return accountInfoCache[_0x574b8b(0x13d)](_0x25eb61);}export function readCachedAccountInfo(_0x212a99){const _0x46c907=a45_0x41b713,_0x1cb5b9=accountInfoCache[_0x46c907(0x129)](_0x212a99);if(_0x1cb5b9&&typeof _0x1cb5b9['site']==='string'&&typeof _0x1cb5b9[_0x46c907(0x15b)]===_0x46c907(0x149))return _0x1cb5b9;return null;}export function writeCachedAccountInfo(_0x49071e,_0x4b932d,_0x181c02){const _0x314dba=a45_0x41b713;try{accountInfoCache[_0x314dba(0x138)]({'site':_0x49071e,'accountId':_0x4b932d,'cachedAt':new Date()['toISOString']()},_0x181c02);}catch{}}export function parseEnvFile(_0x582092){const _0x3f9c36=a45_0x41b713,_0xaf178c={};for(const _0x3045a of _0x582092[_0x3f9c36(0x127)]('\x0a')){const _0x6aed6a=_0x3045a[_0x3f9c36(0x122)]();if(!_0x6aed6a||_0x6aed6a['startsWith']('#'))continue;const _0x15effa=_0x6aed6a[_0x3f9c36(0x146)](/^([^=]+)=(.*)$/);if(_0x15effa){const _0x1400ff=_0x15effa[0x1][_0x3f9c36(0x122)]();let _0x16b735=_0x15effa[0x2][_0x3f9c36(0x122)]();(_0x16b735[_0x3f9c36(0x131)]('\x22')&&_0x16b735[_0x3f9c36(0x132)]('\x22')||_0x16b735['startsWith']('\x27')&&_0x16b735['endsWith']('\x27'))&&(_0x16b735=_0x16b735[_0x3f9c36(0x158)](0x1,-0x1)),_0xaf178c[_0x1400ff]=_0x16b735;}}return _0xaf178c;}export function readUserConfig(){const _0x32e59c=a45_0x41b713,_0x25a304=getConfigFile();if(!existsSync(_0x25a304))return{};try{const _0x183d76=readFileSync(_0x25a304,_0x32e59c(0x14c));return parseEnvFile(_0x183d76);}catch(_0x20aa7a){return console[_0x32e59c(0x125)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x25a304+':',_0x20aa7a),{};}}export function resolveSite(_0x7ea6b4){const _0xe1348a=a45_0x41b713,_0x46bc4e=[_0xe1348a(0x126),_0xe1348a(0x121),_0xe1348a(0x141),_0xe1348a(0x11e),_0xe1348a(0x14a),'dev-us01',_0xe1348a(0x145),_0xe1348a(0x153),'stg-jp01','stg-ap03'];if(_0x46bc4e[_0xe1348a(0x157)](_0x7ea6b4))return _0x7ea6b4;if(_0x7ea6b4 in SITE_ALIASES)return SITE_ALIASES[_0x7ea6b4];return console[_0xe1348a(0x125)](_0xe1348a(0x123)+_0x7ea6b4+_0xe1348a(0x154)),_0xe1348a(0x126);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}function a45_0x206e(){const _0x2bab18=['warn','us01','split','release_channel','read','parse','.json','entries','8117676AoeDzc','8590616HnLOKu','939510JaESXq','llm_default_project','startsWith','endsWith','32941390UiCZpO','profile','stringify','9SCjCGJ','join','write','68QJlQeU','account_info','config/llm-project','6471760dhuPPR','path','dev-us01','tdx.json','Warning:\x20Failed\x20to\x20read\x20','eu01','existsSync','proxy','TD_API_KEY_','dev-eu01','match','stable','keychain\x20(profile:\x20','number','ap03','next','utf-8','readFileSync','40058OTGwSf','stg-ap03','8rGUZCE','TDX_API_KEY\x20env\x20var','TD_API_KEY','stg-us01','\x27,\x20defaulting\x20to\x20us01','string','map','includes','slice','name','apiKeys','accountId','llm_default_agent','keychain','replace','7499178WfePzs','ap02','TDX_API_KEY_','some','jp01','trim','Warning:\x20Unknown\x20site\x20\x27','config/llm-agent'];a45_0x206e=function(){return _0x2bab18;};return a45_0x206e();}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x27357e){const _0xabf507=a45_0x41b713,_0x491380=_0x27357e||getActiveProfileName();if(_0x491380){const _0x10e25b=_0xabf507(0x11f)+normalizeProfileForEnvVar(_0x491380);if(process.env[_0x10e25b])return process.env[_0x10e25b];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x383313){const _0x466a45=a45_0x41b713;return _0x383313['toUpperCase']()[_0x466a45(0x15e)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x387f1c,_0xf7432d){const _0x1ec85b=a45_0x41b713,_0x2f3641=_0xf7432d||getActiveProfileName()||undefined;if(_0x2f3641){const _0x3dcf8c=_0x1ec85b(0x11f)+normalizeProfileForEnvVar(_0x2f3641);if(process.env[_0x3dcf8c])return{'apiKey':process.env[_0x3dcf8c],'source':_0x3dcf8c+'\x20env\x20var','isDeprecated':![]};const _0x37390d=getCachedCredential(_0x387f1c,_0x2f3641);if(_0x37390d)return{'apiKey':_0x37390d,'source':_0x1ec85b(0x148)+_0x2f3641+')','isDeprecated':![]};const _0xf723ee=await getKeychainAPIKey(_0x2f3641);if(_0xf723ee)return setCachedCredential(_0xf723ee,_0x387f1c,_0x2f3641),{'apiKey':_0xf723ee,'source':_0x1ec85b(0x148)+_0x2f3641+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x1ec85b(0x151),'isDeprecated':![]};if(!_0x2f3641){const _0x3aec2a=getCachedCredential(_0x387f1c,undefined);if(_0x3aec2a)return{'apiKey':_0x3aec2a,'source':'keychain','isDeprecated':![]};const _0x20590d=await getKeychainAPIKey(undefined);if(_0x20590d)return setCachedCredential(_0x20590d,_0x387f1c,undefined),{'apiKey':_0x20590d,'source':_0x1ec85b(0x15d),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x129006,_0x51f195){const _0x29427f=await resolveAPIKeyAsync(_0x129006,_0x51f195);return _0x29427f?.['apiKey'];}function cleanupLegacyEnvFile(_0x33da73){const _0x375950=a45_0x41b713;if(!existsSync(_0x33da73))return![];try{const _0x238867=readFileSync(_0x33da73,_0x375950(0x14c)),_0x55b940=_0x238867[_0x375950(0x127)]('\x0a'),_0x296cbe=_0x55b940['filter'](_0x217453=>{const _0x56d4a7=_0x375950,_0x19dcaf=_0x217453[_0x56d4a7(0x122)]();if(!_0x19dcaf||_0x19dcaf[_0x56d4a7(0x131)]('#'))return!![];const [_0x284cf8]=_0x19dcaf['split']('=');return!_0x284cf8[_0x56d4a7(0x131)](_0x56d4a7(0x152));}),_0x46d9bb=_0x296cbe[_0x375950(0x120)](_0x322f22=>{const _0x366e7e=_0x375950,_0x15236e=_0x322f22[_0x366e7e(0x122)]();return _0x15236e&&!_0x15236e[_0x366e7e(0x131)]('#');});if(!_0x46d9bb)return unlinkSync(_0x33da73),!![];return writeFileSync(_0x33da73,_0x296cbe['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x3a50a5=a45_0x41b713;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x3325b0=a45_0x5a10de['join'](getConfigDir(),_0x3a50a5(0x13f));if(!a45_0x1aca66['existsSync'](_0x3325b0))return null;try{const _0x506e92=a45_0x1aca66[_0x3a50a5(0x14d)](_0x3325b0,'utf-8'),_0x45dc23=JSON['parse'](_0x506e92);return _0x45dc23[_0x3a50a5(0x134)]||null;}catch{return null;}}export function saveAPIKey(_0x1f7f74,_0x82c669,_0x1d583f){const _0x13193e=a45_0x41b713,_0x581828=getConfigDir(),_0x14be0d=getConfigFilePath(_0x1d583f);!existsSync(_0x581828)&&mkdirSync(_0x581828,{'recursive':!![],'mode':0x1c0});let _0x742389={};if(existsSync(_0x14be0d))try{const _0x53c845=readFileSync(_0x14be0d,'utf-8');_0x742389=parseEnvFile(_0x53c845);}catch(_0x199e48){console[_0x13193e(0x125)](_0x13193e(0x140)+_0x14be0d+':',_0x199e48);}const _0x4bf081=_0x1f7f74['toUpperCase']()[_0x13193e(0x15e)](/-/g,'_');_0x742389[_0x13193e(0x144)+_0x4bf081]=_0x82c669;const _0x4816e9=Object[_0x13193e(0x12c)](_0x742389)[_0x13193e(0x156)](([_0x356c64,_0xfcb56a])=>_0x356c64+'='+_0xfcb56a);writeFileSync(_0x14be0d,_0x4816e9['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x455312,_0x5b34e3,_0x189812){const _0x35c9c2=a45_0x41b713;await saveKeychainAPIKey(_0x455312,_0x189812),setCachedCredential(_0x455312,_0x5b34e3,_0x189812);const _0x257380=getConfigFilePath(_0x189812);cleanupLegacyEnvFile(_0x257380)&&console[_0x35c9c2(0x125)](a45_0x3a2cf0['yellow']('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x5e04c3=a45_0x41b713,_0x5cabe9={'apiKeys':{},'defaultSite':_0x5e04c3(0x126)},_0x18a995=[_0x5e04c3(0x126),'jp01','eu01','ap02',_0x5e04c3(0x14a),_0x5e04c3(0x13e),'dev-eu01','stg-us01','stg-jp01',_0x5e04c3(0x14f)],_0x5e9343=getAPIKey();if(_0x5e9343)for(const _0x20c095 of _0x18a995){_0x5cabe9[_0x5e04c3(0x15a)][_0x20c095]=_0x5e9343;}return _0x5cabe9;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x1f8c9=a45_0x41b713,_0x122a78=a45_0x5a10de[_0x1f8c9(0x137)](getConfigDir(),_0x1f8c9(0x13f));if(!a45_0x1aca66[_0x1f8c9(0x142)](_0x122a78))return undefined;try{const _0x3ec22d=a45_0x1aca66[_0x1f8c9(0x14d)](_0x122a78,_0x1f8c9(0x14c)),_0x3ba4e0=JSON[_0x1f8c9(0x12a)](_0x3ec22d);return typeof _0x3ba4e0[_0x1f8c9(0x143)]==='string'?_0x3ba4e0['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0xa4e711=a45_0x41b713,_0x2ccfa0=process.env.TDX_RELEASE_CHANNEL;if(_0x2ccfa0===_0xa4e711(0x14b)||_0x2ccfa0==='stable')return _0x2ccfa0;const _0x5a0b80=a45_0x5a10de['join'](getConfigDir(),_0xa4e711(0x13f));if(!a45_0x1aca66['existsSync'](_0x5a0b80))return _0xa4e711(0x147);try{const _0xa1f332=a45_0x1aca66['readFileSync'](_0x5a0b80,_0xa4e711(0x14c)),_0x4b11dd=JSON[_0xa4e711(0x12a)](_0xa1f332);if(_0x4b11dd[_0xa4e711(0x128)]==='next')return'next';}catch{}return _0xa4e711(0x147);}export function saveReleaseChannel(_0x1490ce){const _0x1e121e=a45_0x41b713,_0x44dc31=getConfigDir(),_0x4dd707=a45_0x5a10de[_0x1e121e(0x137)](_0x44dc31,'tdx.json');!existsSync(_0x44dc31)&&mkdirSync(_0x44dc31,{'recursive':!![],'mode':0x1c0});let _0x176278={};if(existsSync(_0x4dd707))try{const _0x455c7a=readFileSync(_0x4dd707,_0x1e121e(0x14c));_0x176278=JSON[_0x1e121e(0x12a)](_0x455c7a);}catch{}_0x176278[_0x1e121e(0x128)]=_0x1490ce,writeFileSync(_0x4dd707,JSON[_0x1e121e(0x135)](_0x176278,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a46_0x282056=a46_0x48ae;(function(_0x3fd503,_0x4f4350){const _0x527475=a46_0x48ae,_0x4634d6=_0x3fd503();while(!![]){try{const _0x12b8e8=parseInt(_0x527475(0x1a3))/0x1*(-parseInt(_0x527475(0x1ad))/0x2)+-parseInt(_0x527475(0x1ab))/0x3+parseInt(_0x527475(0x1ac))/0x4*(parseInt(_0x527475(0x1a5))/0x5)+-parseInt(_0x527475(0x19e))/0x6*(-parseInt(_0x527475(0x19d))/0x7)+parseInt(_0x527475(0x1a4))/0x8*(parseInt(_0x527475(0x1a2))/0x9)+parseInt(_0x527475(0x1a9))/0xa+-parseInt(_0x527475(0x1a1))/0xb*(parseInt(_0x527475(0x1aa))/0xc);if(_0x12b8e8===_0x4f4350)break;else _0x4634d6['push'](_0x4634d6['shift']());}catch(_0x45d985){_0x4634d6['push'](_0x4634d6['shift']());}}}(a46_0x293e,0x901eb));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache('connections-{profile}.json',a46_0x282056(0x1a8));export function loadCachedConnections(_0x91ed68){const _0x134890=a46_0x282056,_0x23d3c6=connectionCache[_0x134890(0x19f)](_0x91ed68);return _0x23d3c6?.[_0x134890(0x1a6)]??null;}function a46_0x48ae(_0x44d406,_0x1229e5){_0x44d406=_0x44d406-0x19c;const _0x293eba=a46_0x293e();let _0x48ae2c=_0x293eba[_0x44d406];return _0x48ae2c;}export function saveCachedConnections(_0x2feaf5,_0x2e38c7){const _0x4a6d23=a46_0x282056;connectionCache[_0x4a6d23(0x1a7)](_0x2feaf5,{'connections':_0x2e38c7,'cachedAt':Date[_0x4a6d23(0x1a0)]()});}export function clearConnectionCache(_0x2fee50){const _0x20e08f=a46_0x282056;connectionCache[_0x20e08f(0x19c)](_0x2fee50);}function a46_0x293e(){const _0x3b0cd2=['119PWfhZe','395958YVyprq','read','now','4741DNxkNg','117jroBGn','8tYiIHb','672184OjHJNU','77905BMPdKZ','connections','write','core/connection-cache','8105730dyewYt','41964CCPGRb','1281288ToFwLE','84bnGgVE','206834ANsfup','clear'];a46_0x293e=function(){return _0x3b0cd2;};return a46_0x293e();}
1
+ const a46_0x546aa6=a46_0x1d85;(function(_0x5097a1,_0x2502bb){const _0x572261=a46_0x1d85,_0xb18f3=_0x5097a1();while(!![]){try{const _0x22b226=-parseInt(_0x572261(0x1f1))/0x1+parseInt(_0x572261(0x1f3))/0x2*(-parseInt(_0x572261(0x1e7))/0x3)+parseInt(_0x572261(0x1ee))/0x4+-parseInt(_0x572261(0x1eb))/0x5*(-parseInt(_0x572261(0x1ed))/0x6)+parseInt(_0x572261(0x1e6))/0x7*(parseInt(_0x572261(0x1f0))/0x8)+parseInt(_0x572261(0x1f2))/0x9*(parseInt(_0x572261(0x1ef))/0xa)+-parseInt(_0x572261(0x1ec))/0xb;if(_0x22b226===_0x2502bb)break;else _0xb18f3['push'](_0xb18f3['shift']());}catch(_0x15cbf6){_0xb18f3['push'](_0xb18f3['shift']());}}}(a46_0x320c,0x614e0));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a46_0x546aa6(0x1e9),a46_0x546aa6(0x1e4));export function loadCachedConnections(_0x42781a){const _0x2108b5=a46_0x546aa6,_0x27d2c9=connectionCache[_0x2108b5(0x1e8)](_0x42781a);return _0x27d2c9?.[_0x2108b5(0x1e5)]??null;}export function saveCachedConnections(_0x476bed,_0x2801b2){const _0x29e6fb=a46_0x546aa6;connectionCache[_0x29e6fb(0x1e3)](_0x476bed,{'connections':_0x2801b2,'cachedAt':Date['now']()});}function a46_0x320c(){const _0x9f9602=['connections-{profile}.json','clear','55745KeBRWE','7995317ALvcMd','324KdUryc','1011068SCFfba','10xLuKPy','1160eNTmHe','371034xxvPod','4559301EVQSJc','2HpfWHf','write','core/connection-cache','connections','36148bRjXpR','1841223lIfqma','read'];a46_0x320c=function(){return _0x9f9602;};return a46_0x320c();}function a46_0x1d85(_0x25d823,_0x13f472){_0x25d823=_0x25d823-0x1e3;const _0x320cb1=a46_0x320c();let _0x1d8568=_0x320cb1[_0x25d823];return _0x1d8568;}export function clearConnectionCache(_0x187a0f){const _0x5929aa=a46_0x546aa6;connectionCache[_0x5929aa(0x1ea)](_0x187a0f);}
@@ -1 +1 @@
1
- const a47_0x23d40c=a47_0x4dc9;(function(_0x498c81,_0x4d644a){const _0x16dcaf=a47_0x4dc9,_0x24fc97=_0x498c81();while(!![]){try{const _0x516d1a=parseInt(_0x16dcaf(0x1b2))/0x1*(-parseInt(_0x16dcaf(0x1b5))/0x2)+-parseInt(_0x16dcaf(0x1a6))/0x3*(-parseInt(_0x16dcaf(0x1b0))/0x4)+parseInt(_0x16dcaf(0x1a5))/0x5*(parseInt(_0x16dcaf(0x1a9))/0x6)+parseInt(_0x16dcaf(0x1a7))/0x7*(parseInt(_0x16dcaf(0x1ba))/0x8)+parseInt(_0x16dcaf(0x1ae))/0x9+parseInt(_0x16dcaf(0x1ad))/0xa*(parseInt(_0x16dcaf(0x1b9))/0xb)+parseInt(_0x16dcaf(0x1aa))/0xc*(parseInt(_0x16dcaf(0x1b8))/0xd);if(_0x516d1a===_0x4d644a)break;else _0x24fc97['push'](_0x24fc97['shift']());}catch(_0x27b359){_0x24fc97['push'](_0x24fc97['shift']());}}}(a47_0x1162,0x1df86));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;function a47_0x4dc9(_0x1a46b8,_0x552543){_0x1a46b8=_0x1a46b8-0x1a4;const _0x11623e=a47_0x1162();let _0x4dc9a4=_0x11623e[_0x1a46b8];return _0x4dc9a4;}export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x26740b,_0x34bd88){const _0x100254=a47_0x4dc9;if(_0x26740b===undefined)return _0x34bd88;if(typeof _0x26740b===_0x100254(0x1ab))return _0x26740b;return parseInt(_0x26740b,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':'us01'},{'title':'jp\x20\x20\x20-\x20Japan','value':a47_0x23d40c(0x1b7)},{'title':a47_0x23d40c(0x1b4),'value':a47_0x23d40c(0x1af)},{'title':a47_0x23d40c(0x1ac),'value':a47_0x23d40c(0x1bb)}];function a47_0x1162(){const _0x56474c=['539759CpzLUZ','45776Ukokxo','ap02','other','35aihplW','63771ShEFze','7npXaKh','us01','74940OtmouW','4068gxKVJN','number','ap02\x20-\x20Korea','30FNkZEa','329823dQoERc','eu01','4pNIHns','Enter\x20custom\x20site','5471bbyywU','findIndex','eu\x20\x20\x20-\x20Europe','68VXkLCU','length','jp01','403bcdROx'];a47_0x1162=function(){return _0x56474c;};return a47_0x1162();}export function buildSiteChoices(_0x5da0e8){const _0x161036=a47_0x23d40c,_0xacfdc6=[...STANDARD_SITE_CHOICES];let _0x53014a=_0xacfdc6[_0x161036(0x1b3)](_0x205aae=>_0x205aae['value']===_0x5da0e8);return _0x53014a===-0x1&&_0x5da0e8!==_0x161036(0x1a8)&&(_0xacfdc6['push']({'title':_0x5da0e8,'value':_0x5da0e8}),_0x53014a=_0xacfdc6[_0x161036(0x1b6)]-0x1),_0xacfdc6['push']({'title':_0x161036(0x1b1),'value':_0x161036(0x1a4)}),{'choices':_0xacfdc6,'initialIndex':_0x53014a>=0x0?_0x53014a:0x0};}
1
+ function a47_0x423c(){const _0x7c08e3=['us\x20\x20\x20-\x20United\x20States','ap02','826435zCGMWa','19500570xChdOF','push','jp\x20\x20\x20-\x20Japan','jp01','3992440Xruvfn','number','us01','530118Vwoqpu','Enter\x20custom\x20site','findIndex','2436emKlRS','2685966EdZLpV','7dGigaW','value','eu\x20\x20\x20-\x20Europe','4455jBmbbQ','4110885BaSEXx'];a47_0x423c=function(){return _0x7c08e3;};return a47_0x423c();}const a47_0x3cec30=a47_0x4deb;function a47_0x4deb(_0x571fd5,_0x3fc4e9){_0x571fd5=_0x571fd5-0x1db;const _0x423cfd=a47_0x423c();let _0x4debc1=_0x423cfd[_0x571fd5];return _0x4debc1;}(function(_0x319540,_0x5a4fed){const _0x4b71af=a47_0x4deb,_0x1509df=_0x319540();while(!![]){try{const _0x5d131d=parseInt(_0x4b71af(0x1db))/0x1+parseInt(_0x4b71af(0x1e3))/0x2+parseInt(_0x4b71af(0x1ec))/0x3+-parseInt(_0x4b71af(0x1e6))/0x4*(parseInt(_0x4b71af(0x1eb))/0x5)+parseInt(_0x4b71af(0x1e7))/0x6+-parseInt(_0x4b71af(0x1e8))/0x7*(-parseInt(_0x4b71af(0x1e0))/0x8)+-parseInt(_0x4b71af(0x1dc))/0x9;if(_0x5d131d===_0x5a4fed)break;else _0x1509df['push'](_0x1509df['shift']());}catch(_0x1b1dcf){_0x1509df['push'](_0x1509df['shift']());}}}(a47_0x423c,0xaab14));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x18cd4e,_0x3d71d5){const _0x444f05=a47_0x4deb;if(_0x18cd4e===undefined)return _0x3d71d5;if(typeof _0x18cd4e===_0x444f05(0x1e1))return _0x18cd4e;return parseInt(_0x18cd4e,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a47_0x3cec30(0x1ed),'value':a47_0x3cec30(0x1e2)},{'title':a47_0x3cec30(0x1de),'value':a47_0x3cec30(0x1df)},{'title':a47_0x3cec30(0x1ea),'value':'eu01'},{'title':'ap02\x20-\x20Korea','value':a47_0x3cec30(0x1ee)}];export function buildSiteChoices(_0x20bf9d){const _0xfaa3cb=a47_0x3cec30,_0x5a9c88=[...STANDARD_SITE_CHOICES];let _0x49e48c=_0x5a9c88[_0xfaa3cb(0x1e5)](_0x213d4d=>_0x213d4d[_0xfaa3cb(0x1e9)]===_0x20bf9d);return _0x49e48c===-0x1&&_0x20bf9d!=='us01'&&(_0x5a9c88[_0xfaa3cb(0x1dd)]({'title':_0x20bf9d,'value':_0x20bf9d}),_0x49e48c=_0x5a9c88['length']-0x1),_0x5a9c88[_0xfaa3cb(0x1dd)]({'title':_0xfaa3cb(0x1e4),'value':'other'}),{'choices':_0x5a9c88,'initialIndex':_0x49e48c>=0x0?_0x49e48c:0x0};}
@@ -1 +1 @@
1
- (function(_0x5a39c3,_0x596c83){const _0x47e25b=a48_0x9fe8,_0x4cbcbc=_0x5a39c3();while(!![]){try{const _0x49f307=parseInt(_0x47e25b(0x13b))/0x1*(-parseInt(_0x47e25b(0x138))/0x2)+parseInt(_0x47e25b(0x135))/0x3+parseInt(_0x47e25b(0x134))/0x4+parseInt(_0x47e25b(0x144))/0x5+parseInt(_0x47e25b(0x13d))/0x6+parseInt(_0x47e25b(0x13c))/0x7*(parseInt(_0x47e25b(0x142))/0x8)+-parseInt(_0x47e25b(0x140))/0x9*(parseInt(_0x47e25b(0x136))/0xa);if(_0x49f307===_0x596c83)break;else _0x4cbcbc['push'](_0x4cbcbc['shift']());}catch(_0x160e4b){_0x4cbcbc['push'](_0x4cbcbc['shift']());}}}(a48_0x5341,0x9d52b));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x43f7c0,_0x10672e){const _0x44efb3=a48_0x9fe8,_0x3aa01e=_0x43f7c0||_0x44efb3(0x139),_0x31d767=_0x10672e||_0x44efb3(0x13e);return _0x3aa01e+':'+_0x31d767;}export function getCachedCredential(_0x98f4c2,_0x34a452){const _0xd8c448=a48_0x9fe8,_0xb752=getCacheKey(_0x98f4c2,_0x34a452),_0x449a4e=cache[_0xd8c448(0x141)](_0xb752);if(!_0x449a4e)return null;if(Date[_0xd8c448(0x143)]()-_0x449a4e['loadedAt']>CACHE_TTL_MS)return cache['delete'](_0xb752),null;return _0x449a4e['apiKey'];}export function setCachedCredential(_0x1c9d8b,_0x3ff63e,_0xcf5a9){const _0x3eb0b4=a48_0x9fe8,_0x1f4ac8=getCacheKey(_0x3ff63e,_0xcf5a9);cache[_0x3eb0b4(0x137)](_0x1f4ac8,{'apiKey':_0x1c9d8b,'loadedAt':Date[_0x3eb0b4(0x143)]()});}export function clearCredentialCache(){const _0x44b8fe=a48_0x9fe8;cache[_0x44b8fe(0x13a)]();}function a48_0x9fe8(_0x55c977,_0x2444d0){_0x55c977=_0x55c977-0x134;const _0x5341d0=a48_0x5341();let _0x9fe8d4=_0x5341d0[_0x55c977];return _0x9fe8d4;}function a48_0x5341(){const _0x8edab3=['63gMHEAv','get','347384ZmCpGe','now','3814215JSxSJX','785240JBuyZU','1182138SIElvL','1347990nUJaku','set','4SbLSBV','__default_site__','clear','476579LvTnql','63jtDYRS','4782840eNTUYN','__default_profile__','delete'];a48_0x5341=function(){return _0x8edab3;};return a48_0x5341();}export function clearCachedCredential(_0x3277b7,_0xc09b51){const _0x4451a3=a48_0x9fe8,_0x2f9494=getCacheKey(_0x3277b7,_0xc09b51);cache[_0x4451a3(0x13f)](_0x2f9494);}
1
+ function a48_0x5e6d(_0x375315,_0x5a97a7){_0x375315=_0x375315-0x12e;const _0x5668d5=a48_0x5668();let _0x5e6d99=_0x5668d5[_0x375315];return _0x5e6d99;}(function(_0x195f4e,_0x29b47a){const _0x27747a=a48_0x5e6d,_0x389270=_0x195f4e();while(!![]){try{const _0x3db4b8=-parseInt(_0x27747a(0x133))/0x1*(parseInt(_0x27747a(0x13d))/0x2)+parseInt(_0x27747a(0x137))/0x3+-parseInt(_0x27747a(0x12f))/0x4*(-parseInt(_0x27747a(0x12e))/0x5)+-parseInt(_0x27747a(0x132))/0x6*(-parseInt(_0x27747a(0x136))/0x7)+parseInt(_0x27747a(0x139))/0x8+parseInt(_0x27747a(0x13c))/0x9+-parseInt(_0x27747a(0x13a))/0xa*(parseInt(_0x27747a(0x131))/0xb);if(_0x3db4b8===_0x29b47a)break;else _0x389270['push'](_0x389270['shift']());}catch(_0x4a96c5){_0x389270['push'](_0x389270['shift']());}}}(a48_0x5668,0xda958));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a48_0x5668(){const _0x5d826f=['1178176xzeVsG','22735890RpPDeU','delete','12278889NddbsR','46758TTyHQi','3125830bmlKZe','4oaRDEv','clear','11ooUJRJ','6vCAlln','37oeTQKm','now','apiKey','8360569bAxRas','2108418KwhsWh','loadedAt'];a48_0x5668=function(){return _0x5d826f;};return a48_0x5668();}function getCacheKey(_0x595d18,_0x2d89c0){const _0x3b3a86=_0x595d18||'__default_site__',_0x2b337b=_0x2d89c0||'__default_profile__';return _0x3b3a86+':'+_0x2b337b;}export function getCachedCredential(_0x3c8134,_0x239aab){const _0x1b78d9=a48_0x5e6d,_0xbf4cc3=getCacheKey(_0x3c8134,_0x239aab),_0x4bf61b=cache['get'](_0xbf4cc3);if(!_0x4bf61b)return null;if(Date[_0x1b78d9(0x134)]()-_0x4bf61b[_0x1b78d9(0x138)]>CACHE_TTL_MS)return cache[_0x1b78d9(0x13b)](_0xbf4cc3),null;return _0x4bf61b[_0x1b78d9(0x135)];}export function setCachedCredential(_0x4c8cd9,_0x58f4e1,_0x412d76){const _0x275c18=a48_0x5e6d,_0x1f44b4=getCacheKey(_0x58f4e1,_0x412d76);cache['set'](_0x1f44b4,{'apiKey':_0x4c8cd9,'loadedAt':Date[_0x275c18(0x134)]()});}export function clearCredentialCache(){const _0x51f86e=a48_0x5e6d;cache[_0x51f86e(0x130)]();}export function clearCachedCredential(_0x3cd28c,_0x29928f){const _0x3b9d32=getCacheKey(_0x3cd28c,_0x29928f);cache['delete'](_0x3b9d32);}
@@ -1 +1 @@
1
- const a49_0x17a750=a49_0x58b3;(function(_0x34010c,_0x1357b3){const _0x230b0f=a49_0x58b3,_0x53ce84=_0x34010c();while(!![]){try{const _0x2cced1=-parseInt(_0x230b0f(0x231))/0x1*(parseInt(_0x230b0f(0x233))/0x2)+parseInt(_0x230b0f(0x1f5))/0x3*(parseInt(_0x230b0f(0x210))/0x4)+parseInt(_0x230b0f(0x1fc))/0x5+parseInt(_0x230b0f(0x221))/0x6+parseInt(_0x230b0f(0x200))/0x7*(parseInt(_0x230b0f(0x1ff))/0x8)+-parseInt(_0x230b0f(0x1fe))/0x9*(parseInt(_0x230b0f(0x21f))/0xa)+-parseInt(_0x230b0f(0x1f8))/0xb;if(_0x2cced1===_0x1357b3)break;else _0x53ce84['push'](_0x53ce84['shift']());}catch(_0x4984ab){_0x53ce84['push'](_0x53ce84['shift']());}}}(a49_0x56e5,0x8fc76));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';function a49_0x58b3(_0x3a3bc1,_0x587081){_0x3a3bc1=_0x3a3bc1-0x1e3;const _0x56e5d2=a49_0x56e5();let _0x58b322=_0x56e5d2[_0x3a3bc1];return _0x58b322;}function a49_0x56e5(){const _0x489ce2=['segment_path','llmAgent','resolveAPIKeyAsync','profileSource','1EZjrRK','globalCredentials','35302nNZgod','activeProfile','session','cliFlags','profile:\x20','tdx.json','getParameters','config','profileCredentials','profile','Session','Project','CLI\x20flag:\x20--','llm_agent','Profile\x20Credentials','.json','INFO','(session:\x20','Global\x20Credentials','30NCFAdL','readFileSync','createAsync','11147378cxVYpT','global','injectIntoOptions','database','2828595BYJCBf','cli','5228955TwxnIa','7789816mDJkkX','7iVkMyr','parentSegment','configFiles','apiKey','segmentPath','site','loadGlobalConfig','dim','parse','us01','(active)','proxy','replace','[configuration\x20files]','existsSync','assign','71340riFsSq','workflow_project','getSource','cyan','profiles','verbose','layers','display','parent_segment','logLevel','(using\x20session:\x20','llmProject','workflowProject','llm_project','not\x20set','10pfUtxW','entries','2898996vuFhlt','default','project','bold','env','join','sessionId','Global','Profile','[context]','none','log'];a49_0x56e5=function(){return _0x489ce2;};return a49_0x56e5();}import*as a49_0x37b3e8 from'node:fs';import*as a49_0x31e80e from'node:path';import a49_0x370069 from'chalk';export class GlobalContext{[a49_0x17a750(0x205)];['database'];['parent_segment'];[a49_0x17a750(0x22d)];[a49_0x17a750(0x21d)];['llm_agent'];[a49_0x17a750(0x211)];[a49_0x17a750(0x203)];[a49_0x17a750(0x20b)];['verbose'];[a49_0x17a750(0x219)];[a49_0x17a750(0x1eb)];[a49_0x17a750(0x230)]=null;[a49_0x17a750(0x216)];[a49_0x17a750(0x1e3)];[a49_0x17a750(0x227)];[a49_0x17a750(0x202)];constructor(_0x2dd1f1){const _0x35bd0e=a49_0x17a750;this[_0x35bd0e(0x227)]=getSessionID(_0x2dd1f1['session']);const _0x1cd2c7=loadSessionContext(_0x2dd1f1[_0x35bd0e(0x1e4)]),_0x11d4ef=loadProjectConfig(),_0x4919c6=this[_0x35bd0e(0x206)]();if(_0x2dd1f1[_0x35bd0e(0x1eb)])this[_0x35bd0e(0x1e3)]=_0x2dd1f1[_0x35bd0e(0x1eb)],this[_0x35bd0e(0x230)]=_0x35bd0e(0x1fd);else{if(_0x1cd2c7?.[_0x35bd0e(0x1eb)])this[_0x35bd0e(0x1e3)]=_0x1cd2c7[_0x35bd0e(0x1eb)],this[_0x35bd0e(0x230)]=_0x35bd0e(0x1e4);else{if(_0x4919c6[_0x35bd0e(0x1eb)])this[_0x35bd0e(0x1e3)]=_0x4919c6[_0x35bd0e(0x1eb)],this[_0x35bd0e(0x230)]=_0x35bd0e(0x1e9);else process.env.TDX_PROFILE?(this[_0x35bd0e(0x1e3)]=process.env.TDX_PROFILE,this[_0x35bd0e(0x230)]=_0x35bd0e(0x225)):(this['activeProfile']=null,this[_0x35bd0e(0x230)]=null);}}const _0x17523a=this[_0x35bd0e(0x1e3)]?loadProfile(this[_0x35bd0e(0x1e3)]):null,_0x8d09dc=_0x27bbee=>{const _0x405e7e=_0x35bd0e;if(!_0x27bbee)return{};const _0x39d273=_0x27bbee,_0x361549={};for(const [_0x1409b8,_0x648534]of Object[_0x405e7e(0x220)](_0x39d273)){typeof _0x648534==='string'&&(_0x361549[_0x1409b8]=_0x648534);}return _0x361549;},_0x4de3ab={},_0x4f5f2c=(_0x4a5caa,_0x5a6677,_0x4b64ee)=>{const _0x195e2=_0x35bd0e;if(!_0x4a5caa)return![];if(_0x4b64ee&&_0x4a5caa===_0x4b64ee)return![];const _0x193603=_0x1cd2c7,_0x54b41d=_0x11d4ef,_0x13082f=_0x17523a?.[_0x195e2(0x1e9)],_0x172e6a=_0x4919c6,_0x3bd945=_0x193603?.[_0x5a6677],_0x5515d4=_0x54b41d?.[_0x5a6677],_0x270b67=_0x13082f?.[_0x5a6677],_0x197753=_0x172e6a[_0x5a6677];return _0x4a5caa!==_0x3bd945&&_0x4a5caa!==_0x5515d4&&_0x4a5caa!==_0x270b67&&_0x4a5caa!==_0x197753;},_0x11b50d=[{'optionKey':_0x35bd0e(0x205),'contextKey':_0x35bd0e(0x205),'defaultValue':'us01'},{'optionKey':_0x35bd0e(0x1fb),'contextKey':_0x35bd0e(0x1fb)},{'optionKey':'parentSegment','contextKey':'parent_segment'},{'optionKey':_0x35bd0e(0x21b),'contextKey':'llm_project'},{'optionKey':_0x35bd0e(0x22e),'contextKey':_0x35bd0e(0x1ef)},{'optionKey':_0x35bd0e(0x1eb),'contextKey':_0x35bd0e(0x1eb)}];for(const {optionKey:_0x109cd7,contextKey:_0x463126,defaultValue:_0x25d467}of _0x11b50d){const _0x108954=_0x2dd1f1[_0x109cd7];_0x4f5f2c(_0x108954,_0x463126,_0x25d467)&&(_0x4de3ab[_0x463126]=_0x108954);}this[_0x35bd0e(0x216)]={'cliFlags':_0x4de3ab,'session':_0x8d09dc(_0x1cd2c7),'project':_0x8d09dc(_0x11d4ef),'profile':_0x8d09dc(_0x17523a?.[_0x35bd0e(0x1e9)]),'global':_0x8d09dc(_0x4919c6)};const _0x1eface={...this[_0x35bd0e(0x216)][_0x35bd0e(0x1f9)],...this[_0x35bd0e(0x216)][_0x35bd0e(0x1eb)],...this[_0x35bd0e(0x216)]['project']};process.env.TDX_SITE&&!this[_0x35bd0e(0x216)][_0x35bd0e(0x1e4)][_0x35bd0e(0x205)]&&!this[_0x35bd0e(0x216)][_0x35bd0e(0x1e5)][_0x35bd0e(0x205)]&&(_0x1eface['site']=process.env.TDX_SITE);Object[_0x35bd0e(0x20f)](_0x1eface,this[_0x35bd0e(0x216)][_0x35bd0e(0x1e4)]),Object[_0x35bd0e(0x20f)](_0x1eface,this[_0x35bd0e(0x216)][_0x35bd0e(0x1e5)]);const _0x53b4e8=_0x1eface[_0x35bd0e(0x205)]||_0x35bd0e(0x209);this[_0x35bd0e(0x205)]=resolveSite(_0x53b4e8),this[_0x35bd0e(0x1fb)]=_0x1eface['database'],this[_0x35bd0e(0x218)]=_0x1eface[_0x35bd0e(0x218)],this['segment_path']=_0x1eface[_0x35bd0e(0x22d)],this[_0x35bd0e(0x21d)]=_0x1eface[_0x35bd0e(0x21d)],this[_0x35bd0e(0x1ef)]=_0x1eface[_0x35bd0e(0x1ef)],this['workflow_project']=_0x1eface[_0x35bd0e(0x211)],this['verbose']=_0x2dd1f1[_0x35bd0e(0x215)]||![],this[_0x35bd0e(0x219)]=_0x2dd1f1[_0x35bd0e(0x219)]??LogLevel[_0x35bd0e(0x1f2)],this[_0x35bd0e(0x1eb)]=this['activeProfile']||undefined,this[_0x35bd0e(0x203)]=getAPIKey(this['activeProfile']||undefined);const _0x43e7e6=typeof _0x4919c6['proxy']==='string'?_0x4919c6[_0x35bd0e(0x20b)]:undefined;this[_0x35bd0e(0x20b)]=_0x43e7e6||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x54cbae=getConfigDir(),_0x71944e=a49_0x31e80e[_0x35bd0e(0x226)](_0x54cbae,'sessions',this[_0x35bd0e(0x227)]+_0x35bd0e(0x1f1)),_0x5b827a=findProjectConfigPath(),_0x9c63b=a49_0x31e80e[_0x35bd0e(0x226)](_0x54cbae,_0x35bd0e(0x1e7)),_0x549f39=a49_0x31e80e[_0x35bd0e(0x226)](_0x54cbae,'.env');let _0x3a1a03=null,_0x2ed761=null;this['activeProfile']&&(_0x3a1a03=a49_0x31e80e[_0x35bd0e(0x226)](_0x54cbae,_0x35bd0e(0x214),this['activeProfile'],_0x35bd0e(0x1e7)),_0x2ed761=a49_0x31e80e[_0x35bd0e(0x226)](_0x54cbae,'profiles',this[_0x35bd0e(0x1e3)],'.env')),this[_0x35bd0e(0x202)]={'session':a49_0x37b3e8[_0x35bd0e(0x20e)](_0x71944e)?_0x71944e:null,'project':_0x5b827a,'profile':_0x3a1a03&&a49_0x37b3e8[_0x35bd0e(0x20e)](_0x3a1a03)?_0x3a1a03:null,'profileCredentials':_0x2ed761&&a49_0x37b3e8[_0x35bd0e(0x20e)](_0x2ed761)?_0x2ed761:null,'global':a49_0x37b3e8[_0x35bd0e(0x20e)](_0x9c63b)?_0x9c63b:null,'globalCredentials':a49_0x37b3e8[_0x35bd0e(0x20e)](_0x549f39)?_0x549f39:null};}[a49_0x17a750(0x212)](_0x22dca9,_0x22ecaa){const _0x423682=a49_0x17a750;if(!_0x22ecaa)return _0x423682(0x21e);const _0x30f80a=_0x22ecaa;if(this[_0x423682(0x216)]['cliFlags'][_0x22dca9]===_0x30f80a){if(_0x22dca9===_0x423682(0x205)&&_0x30f80a==='us01'&&!this[_0x423682(0x216)][_0x423682(0x1e4)]['site']&&!this[_0x423682(0x216)][_0x423682(0x223)]['site']&&!this[_0x423682(0x216)][_0x423682(0x1eb)]['site']&&!this['layers'][_0x423682(0x1f9)]['site'])return _0x423682(0x222);return _0x423682(0x1ee)+_0x22dca9[_0x423682(0x20c)](/_/g,'-');}if(this[_0x423682(0x216)][_0x423682(0x1e4)][_0x22dca9]===_0x30f80a)return _0x423682(0x1e4);if(this[_0x423682(0x216)][_0x423682(0x223)][_0x22dca9]===_0x30f80a)return'project';if(this['layers'][_0x423682(0x1eb)][_0x22dca9]===_0x30f80a)return _0x423682(0x1e6)+this[_0x423682(0x1e3)];if(this['layers'][_0x423682(0x1f9)][_0x22dca9]===_0x30f80a)return _0x423682(0x1f9);return _0x423682(0x222);}[a49_0x17a750(0x206)](){const _0x476509=a49_0x17a750,_0x4c2d8d=a49_0x31e80e[_0x476509(0x226)](getConfigDir(),'tdx.json');if(!a49_0x37b3e8[_0x476509(0x20e)](_0x4c2d8d))return{};try{const _0x2750c0=a49_0x37b3e8[_0x476509(0x1f6)](_0x4c2d8d,'utf-8');return JSON[_0x476509(0x208)](_0x2750c0);}catch{return{};}}[a49_0x17a750(0x1fa)](_0x2e3bfe){const _0x797ee6=a49_0x17a750;_0x2e3bfe[_0x797ee6(0x205)]=this[_0x797ee6(0x205)],!_0x2e3bfe['database']&&this['database']&&(_0x2e3bfe['database']=this['database']),!_0x2e3bfe[_0x797ee6(0x201)]&&this[_0x797ee6(0x218)]&&(_0x2e3bfe[_0x797ee6(0x201)]=this[_0x797ee6(0x218)]),!_0x2e3bfe[_0x797ee6(0x204)]&&this[_0x797ee6(0x22d)]&&(_0x2e3bfe[_0x797ee6(0x204)]=this['segment_path']),!_0x2e3bfe[_0x797ee6(0x21b)]&&this[_0x797ee6(0x21d)]&&(_0x2e3bfe[_0x797ee6(0x21b)]=this[_0x797ee6(0x21d)]),!_0x2e3bfe[_0x797ee6(0x22e)]&&this[_0x797ee6(0x1ef)]&&(_0x2e3bfe[_0x797ee6(0x22e)]=this['llm_agent']),!_0x2e3bfe[_0x797ee6(0x21c)]&&this[_0x797ee6(0x211)]&&(_0x2e3bfe['workflowProject']=this[_0x797ee6(0x211)]);}['getParameters'](){const _0x3260b0=a49_0x17a750;return[{'key':_0x3260b0(0x205),'value':this[_0x3260b0(0x205)]},{'key':'database','value':this['database']},{'key':'parent_segment','value':this[_0x3260b0(0x218)]},{'key':_0x3260b0(0x22d),'value':this['segment_path']},{'key':_0x3260b0(0x21d),'value':this['llm_project']},{'key':_0x3260b0(0x1ef),'value':this[_0x3260b0(0x1ef)]},{'key':_0x3260b0(0x211),'value':this[_0x3260b0(0x211)]},{'key':_0x3260b0(0x1eb),'value':this[_0x3260b0(0x1e3)]||undefined}];}[a49_0x17a750(0x217)](){const _0x1369f4=a49_0x17a750;console[_0x1369f4(0x22c)](a49_0x370069['bold'](_0x1369f4(0x22a)));for(const {key:_0x4f869f,value:_0x3ddcfc}of this[_0x1369f4(0x1e8)]()){_0x3ddcfc&&console[_0x1369f4(0x22c)](a49_0x370069['cyan'](_0x4f869f)+':\x20'+_0x3ddcfc);}}['displayWithSources'](){const _0x37b8d5=a49_0x17a750;console[_0x37b8d5(0x22c)](a49_0x370069[_0x37b8d5(0x224)]('[context]'));for(const {key:_0x29381e,value:_0xfe9e30}of this[_0x37b8d5(0x1e8)]()){if(_0xfe9e30){const _0xd47478=_0x29381e===_0x37b8d5(0x1eb)?_0x37b8d5(0x20a):'('+this[_0x37b8d5(0x212)](_0x29381e,_0xfe9e30)+')';console[_0x37b8d5(0x22c)](a49_0x370069[_0x37b8d5(0x213)](_0x29381e)+':\x20'+_0xfe9e30+'\x20'+a49_0x370069[_0x37b8d5(0x207)](_0xd47478));}}console['log']('\x0a'+a49_0x370069[_0x37b8d5(0x224)](_0x37b8d5(0x20d)));const _0x3e5472=[{'label':_0x37b8d5(0x1ec),'path':this['configFiles']['session'],'extra':_0x37b8d5(0x1f3)+this[_0x37b8d5(0x227)]+')'},{'label':_0x37b8d5(0x1ed),'path':this['configFiles'][_0x37b8d5(0x223)]},{'label':_0x37b8d5(0x229),'path':this[_0x37b8d5(0x202)][_0x37b8d5(0x1eb)]},{'label':_0x37b8d5(0x1f0),'path':this[_0x37b8d5(0x202)][_0x37b8d5(0x1ea)]},{'label':_0x37b8d5(0x228),'path':this[_0x37b8d5(0x202)]['global']},{'label':_0x37b8d5(0x1f4),'path':this['configFiles'][_0x37b8d5(0x232)]}];for(const {label:_0x4c62a5,path:_0x9fcd6e,extra:_0x5c13b9}of _0x3e5472){if(_0x9fcd6e)console[_0x37b8d5(0x22c)](a49_0x370069['cyan'](_0x4c62a5)+':\x20'+_0x9fcd6e+'\x20'+a49_0x370069['green']('✓')+(_0x5c13b9?'\x20'+a49_0x370069[_0x37b8d5(0x207)](_0x5c13b9):''));else{if(_0x4c62a5===_0x37b8d5(0x1ec))console[_0x37b8d5(0x22c)](a49_0x370069[_0x37b8d5(0x213)](_0x4c62a5)+':\x20'+a49_0x370069[_0x37b8d5(0x207)](_0x37b8d5(0x22b))+'\x20'+a49_0x370069[_0x37b8d5(0x207)](_0x37b8d5(0x21a)+this[_0x37b8d5(0x227)]+')'));else(_0x4c62a5==='Project'||_0x4c62a5===_0x37b8d5(0x228))&&console[_0x37b8d5(0x22c)](a49_0x370069[_0x37b8d5(0x213)](_0x4c62a5)+':\x20'+a49_0x370069[_0x37b8d5(0x207)](_0x37b8d5(0x22b)));}}}async['resolveAPIKeyAsync'](){const _0x341f36=a49_0x17a750;return this[_0x341f36(0x203)]=await getAPIKeyAsync(this[_0x341f36(0x205)],this[_0x341f36(0x1e3)]||undefined),this[_0x341f36(0x203)];}static async[a49_0x17a750(0x1f7)](_0x2ada88){const _0x1b9975=a49_0x17a750,_0x22e827=new GlobalContext(_0x2ada88);return await _0x22e827[_0x1b9975(0x22f)](),_0x22e827;}}
1
+ const a49_0x44b017=a49_0x451c;function a49_0x451c(_0xf57c89,_0x4a45a6){_0xf57c89=_0xf57c89-0x19d;const _0xe72aee=a49_0xe72a();let _0x451c7c=_0xe72aee[_0xf57c89];return _0x451c7c;}(function(_0x42fdb0,_0x21128d){const _0x2ce99d=a49_0x451c,_0x2cf74e=_0x42fdb0();while(!![]){try{const _0x146c67=parseInt(_0x2ce99d(0x1d7))/0x1*(-parseInt(_0x2ce99d(0x1b7))/0x2)+parseInt(_0x2ce99d(0x1c1))/0x3*(-parseInt(_0x2ce99d(0x1b4))/0x4)+-parseInt(_0x2ce99d(0x1e1))/0x5*(-parseInt(_0x2ce99d(0x1df))/0x6)+parseInt(_0x2ce99d(0x1d2))/0x7*(-parseInt(_0x2ce99d(0x1c6))/0x8)+-parseInt(_0x2ce99d(0x1bd))/0x9*(-parseInt(_0x2ce99d(0x1c0))/0xa)+parseInt(_0x2ce99d(0x1c3))/0xb+-parseInt(_0x2ce99d(0x1e3))/0xc;if(_0x146c67===_0x21128d)break;else _0x2cf74e['push'](_0x2cf74e['shift']());}catch(_0x5cc4a1){_0x2cf74e['push'](_0x2cf74e['shift']());}}}(a49_0xe72a,0x1efc4));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a49_0xe72a(){const _0x21f2b5=['(active)','115wtmgeS','join','1166304ihKrCC','logLevel','replace','not\x20set','global','loadGlobalConfig','workflow_project','segment_path','site','[context]','layers','Global\x20Credentials','Global','config','readFileSync','profile','profileSource','displayWithSources','Session','apiKey','profileCredentials','tdx.json','Profile\x20Credentials','getSource','llmProject','segmentPath','proxy','green','activeProfile','existsSync','profile:\x20','injectIntoOptions','getParameters','database','272296RuIXmT','verbose','configFiles','2XPQxCm','project','profiles','CLI\x20flag:\x20--','INFO','workflowProject','171fVZLeG','assign','none','38130xJwdQZ','3iqnzyk','string','1710577DXojcW','llm_agent','sessionId','177328ydJoFo','dim','parentSegment','llmAgent','session','.env','utf-8','entries','log','(session:\x20','parent_segment','us01','7YTSXZh','bold','env','default','cliFlags','61933tqYhqd','llm_project','[configuration\x20files]','cyan','parse','createAsync','sessions','Project','38694ZAWTkT'];a49_0xe72a=function(){return _0x21f2b5;};return a49_0xe72a();}import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a49_0x1ab7b2 from'node:fs';import*as a49_0x20caf1 from'node:path';import a49_0x32c54e from'chalk';export class GlobalContext{['site'];[a49_0x44b017(0x1b3)];[a49_0x44b017(0x1d0)];[a49_0x44b017(0x1ea)];[a49_0x44b017(0x1d8)];[a49_0x44b017(0x1c4)];[a49_0x44b017(0x1e9)];[a49_0x44b017(0x1a5)];[a49_0x44b017(0x1ac)];['verbose'];[a49_0x44b017(0x1e4)];['profile'];[a49_0x44b017(0x1a2)]=null;['layers'];[a49_0x44b017(0x1ae)];[a49_0x44b017(0x1c5)];[a49_0x44b017(0x1b6)];constructor(_0x51d1e6){const _0x41a363=a49_0x44b017;this[_0x41a363(0x1c5)]=getSessionID(_0x51d1e6['session']);const _0x5f13a4=loadSessionContext(_0x51d1e6[_0x41a363(0x1ca)]),_0x19ea7b=loadProjectConfig(),_0x3f16a8=this['loadGlobalConfig']();if(_0x51d1e6[_0x41a363(0x1a1)])this[_0x41a363(0x1ae)]=_0x51d1e6['profile'],this[_0x41a363(0x1a2)]='cli';else{if(_0x5f13a4?.['profile'])this[_0x41a363(0x1ae)]=_0x5f13a4[_0x41a363(0x1a1)],this[_0x41a363(0x1a2)]=_0x41a363(0x1ca);else{if(_0x3f16a8[_0x41a363(0x1a1)])this[_0x41a363(0x1ae)]=_0x3f16a8[_0x41a363(0x1a1)],this[_0x41a363(0x1a2)]='config';else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x41a363(0x1a2)]=_0x41a363(0x1d4)):(this[_0x41a363(0x1ae)]=null,this[_0x41a363(0x1a2)]=null);}}const _0x2f297b=this[_0x41a363(0x1ae)]?loadProfile(this[_0x41a363(0x1ae)]):null,_0x3efba3=_0x406a9b=>{const _0x40d483=_0x41a363;if(!_0x406a9b)return{};const _0xf867d8=_0x406a9b,_0x485549={};for(const [_0x495f8d,_0x4b8fa5]of Object[_0x40d483(0x1cd)](_0xf867d8)){typeof _0x4b8fa5===_0x40d483(0x1c2)&&(_0x485549[_0x495f8d]=_0x4b8fa5);}return _0x485549;},_0xae26b3={},_0x242db2=(_0x187435,_0x341172,_0x101a3c)=>{const _0x3355c4=_0x41a363;if(!_0x187435)return![];if(_0x101a3c&&_0x187435===_0x101a3c)return![];const _0x205e4e=_0x5f13a4,_0xb2002d=_0x19ea7b,_0x2c1550=_0x2f297b?.[_0x3355c4(0x19f)],_0x5a8b96=_0x3f16a8,_0x3ba544=_0x205e4e?.[_0x341172],_0x101c47=_0xb2002d?.[_0x341172],_0x18ed3b=_0x2c1550?.[_0x341172],_0x68e851=_0x5a8b96[_0x341172];return _0x187435!==_0x3ba544&&_0x187435!==_0x101c47&&_0x187435!==_0x18ed3b&&_0x187435!==_0x68e851;},_0x5a6974=[{'optionKey':_0x41a363(0x1eb),'contextKey':_0x41a363(0x1eb),'defaultValue':_0x41a363(0x1d1)},{'optionKey':'database','contextKey':_0x41a363(0x1b3)},{'optionKey':_0x41a363(0x1c8),'contextKey':_0x41a363(0x1d0)},{'optionKey':'llmProject','contextKey':_0x41a363(0x1d8)},{'optionKey':'llmAgent','contextKey':_0x41a363(0x1c4)},{'optionKey':'profile','contextKey':_0x41a363(0x1a1)}];for(const {optionKey:_0xa8127e,contextKey:_0x5c815b,defaultValue:_0x29943a}of _0x5a6974){const _0x4e971a=_0x51d1e6[_0xa8127e];_0x242db2(_0x4e971a,_0x5c815b,_0x29943a)&&(_0xae26b3[_0x5c815b]=_0x4e971a);}this[_0x41a363(0x1ed)]={'cliFlags':_0xae26b3,'session':_0x3efba3(_0x5f13a4),'project':_0x3efba3(_0x19ea7b),'profile':_0x3efba3(_0x2f297b?.['config']),'global':_0x3efba3(_0x3f16a8)};const _0x5bb329={...this[_0x41a363(0x1ed)][_0x41a363(0x1e7)],...this['layers'][_0x41a363(0x1a1)],...this['layers'][_0x41a363(0x1b8)]};process.env.TDX_SITE&&!this[_0x41a363(0x1ed)]['session']['site']&&!this[_0x41a363(0x1ed)][_0x41a363(0x1d6)][_0x41a363(0x1eb)]&&(_0x5bb329[_0x41a363(0x1eb)]=process.env.TDX_SITE);Object['assign'](_0x5bb329,this[_0x41a363(0x1ed)][_0x41a363(0x1ca)]),Object[_0x41a363(0x1be)](_0x5bb329,this[_0x41a363(0x1ed)][_0x41a363(0x1d6)]);const _0x38bd5f=_0x5bb329[_0x41a363(0x1eb)]||_0x41a363(0x1d1);this[_0x41a363(0x1eb)]=resolveSite(_0x38bd5f),this['database']=_0x5bb329['database'],this['parent_segment']=_0x5bb329['parent_segment'],this['segment_path']=_0x5bb329[_0x41a363(0x1ea)],this['llm_project']=_0x5bb329[_0x41a363(0x1d8)],this[_0x41a363(0x1c4)]=_0x5bb329[_0x41a363(0x1c4)],this['workflow_project']=_0x5bb329[_0x41a363(0x1e9)],this[_0x41a363(0x1b5)]=_0x51d1e6[_0x41a363(0x1b5)]||![],this[_0x41a363(0x1e4)]=_0x51d1e6[_0x41a363(0x1e4)]??LogLevel[_0x41a363(0x1bb)],this[_0x41a363(0x1a1)]=this[_0x41a363(0x1ae)]||undefined,this[_0x41a363(0x1a5)]=getAPIKey(this[_0x41a363(0x1ae)]||undefined);const _0x910b16=typeof _0x3f16a8[_0x41a363(0x1ac)]===_0x41a363(0x1c2)?_0x3f16a8[_0x41a363(0x1ac)]:undefined;this['proxy']=_0x910b16||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x180372=getConfigDir(),_0x38f3d8=a49_0x20caf1['join'](_0x180372,_0x41a363(0x1dd),this[_0x41a363(0x1c5)]+'.json'),_0xfbbf93=findProjectConfigPath(),_0x5b8e18=a49_0x20caf1[_0x41a363(0x1e2)](_0x180372,_0x41a363(0x1a7)),_0x752d1c=a49_0x20caf1[_0x41a363(0x1e2)](_0x180372,'.env');let _0x531c2d=null,_0x373692=null;this[_0x41a363(0x1ae)]&&(_0x531c2d=a49_0x20caf1['join'](_0x180372,'profiles',this[_0x41a363(0x1ae)],_0x41a363(0x1a7)),_0x373692=a49_0x20caf1['join'](_0x180372,_0x41a363(0x1b9),this[_0x41a363(0x1ae)],_0x41a363(0x1cb))),this[_0x41a363(0x1b6)]={'session':a49_0x1ab7b2[_0x41a363(0x1af)](_0x38f3d8)?_0x38f3d8:null,'project':_0xfbbf93,'profile':_0x531c2d&&a49_0x1ab7b2[_0x41a363(0x1af)](_0x531c2d)?_0x531c2d:null,'profileCredentials':_0x373692&&a49_0x1ab7b2[_0x41a363(0x1af)](_0x373692)?_0x373692:null,'global':a49_0x1ab7b2[_0x41a363(0x1af)](_0x5b8e18)?_0x5b8e18:null,'globalCredentials':a49_0x1ab7b2[_0x41a363(0x1af)](_0x752d1c)?_0x752d1c:null};}[a49_0x44b017(0x1a9)](_0x3e0e50,_0x311512){const _0x579f0c=a49_0x44b017;if(!_0x311512)return _0x579f0c(0x1e6);const _0x4f310c=_0x311512;if(this[_0x579f0c(0x1ed)][_0x579f0c(0x1d6)][_0x3e0e50]===_0x4f310c){if(_0x3e0e50==='site'&&_0x4f310c===_0x579f0c(0x1d1)&&!this[_0x579f0c(0x1ed)]['session'][_0x579f0c(0x1eb)]&&!this[_0x579f0c(0x1ed)][_0x579f0c(0x1b8)][_0x579f0c(0x1eb)]&&!this[_0x579f0c(0x1ed)]['profile']['site']&&!this['layers'][_0x579f0c(0x1e7)][_0x579f0c(0x1eb)])return _0x579f0c(0x1d5);return _0x579f0c(0x1ba)+_0x3e0e50[_0x579f0c(0x1e5)](/_/g,'-');}if(this[_0x579f0c(0x1ed)][_0x579f0c(0x1ca)][_0x3e0e50]===_0x4f310c)return _0x579f0c(0x1ca);if(this['layers'][_0x579f0c(0x1b8)][_0x3e0e50]===_0x4f310c)return _0x579f0c(0x1b8);if(this[_0x579f0c(0x1ed)][_0x579f0c(0x1a1)][_0x3e0e50]===_0x4f310c)return _0x579f0c(0x1b0)+this[_0x579f0c(0x1ae)];if(this[_0x579f0c(0x1ed)][_0x579f0c(0x1e7)][_0x3e0e50]===_0x4f310c)return'global';return _0x579f0c(0x1d5);}[a49_0x44b017(0x1e8)](){const _0xb92bdd=a49_0x44b017,_0x31a8a7=a49_0x20caf1[_0xb92bdd(0x1e2)](getConfigDir(),_0xb92bdd(0x1a7));if(!a49_0x1ab7b2['existsSync'](_0x31a8a7))return{};try{const _0xf5e0e5=a49_0x1ab7b2[_0xb92bdd(0x1a0)](_0x31a8a7,_0xb92bdd(0x1cc));return JSON[_0xb92bdd(0x1db)](_0xf5e0e5);}catch{return{};}}[a49_0x44b017(0x1b1)](_0x2be3f4){const _0x55251c=a49_0x44b017;_0x2be3f4['site']=this[_0x55251c(0x1eb)],!_0x2be3f4[_0x55251c(0x1b3)]&&this[_0x55251c(0x1b3)]&&(_0x2be3f4['database']=this['database']),!_0x2be3f4[_0x55251c(0x1c8)]&&this[_0x55251c(0x1d0)]&&(_0x2be3f4[_0x55251c(0x1c8)]=this[_0x55251c(0x1d0)]),!_0x2be3f4[_0x55251c(0x1ab)]&&this[_0x55251c(0x1ea)]&&(_0x2be3f4[_0x55251c(0x1ab)]=this['segment_path']),!_0x2be3f4[_0x55251c(0x1aa)]&&this['llm_project']&&(_0x2be3f4[_0x55251c(0x1aa)]=this[_0x55251c(0x1d8)]),!_0x2be3f4[_0x55251c(0x1c9)]&&this[_0x55251c(0x1c4)]&&(_0x2be3f4[_0x55251c(0x1c9)]=this[_0x55251c(0x1c4)]),!_0x2be3f4[_0x55251c(0x1bc)]&&this[_0x55251c(0x1e9)]&&(_0x2be3f4[_0x55251c(0x1bc)]=this[_0x55251c(0x1e9)]);}['getParameters'](){const _0x541d8f=a49_0x44b017;return[{'key':_0x541d8f(0x1eb),'value':this['site']},{'key':_0x541d8f(0x1b3),'value':this[_0x541d8f(0x1b3)]},{'key':'parent_segment','value':this['parent_segment']},{'key':_0x541d8f(0x1ea),'value':this[_0x541d8f(0x1ea)]},{'key':_0x541d8f(0x1d8),'value':this[_0x541d8f(0x1d8)]},{'key':_0x541d8f(0x1c4),'value':this[_0x541d8f(0x1c4)]},{'key':'workflow_project','value':this[_0x541d8f(0x1e9)]},{'key':_0x541d8f(0x1a1),'value':this[_0x541d8f(0x1ae)]||undefined}];}['display'](){const _0x358188=a49_0x44b017;console[_0x358188(0x1ce)](a49_0x32c54e[_0x358188(0x1d3)]('[context]'));for(const {key:_0x2aefed,value:_0x4bcb04}of this[_0x358188(0x1b2)]()){_0x4bcb04&&console['log'](a49_0x32c54e[_0x358188(0x1da)](_0x2aefed)+':\x20'+_0x4bcb04);}}[a49_0x44b017(0x1a3)](){const _0x1033bb=a49_0x44b017;console['log'](a49_0x32c54e['bold'](_0x1033bb(0x1ec)));for(const {key:_0x5d249a,value:_0x400988}of this['getParameters']()){if(_0x400988){const _0x2f57b3=_0x5d249a==='profile'?_0x1033bb(0x1e0):'('+this['getSource'](_0x5d249a,_0x400988)+')';console[_0x1033bb(0x1ce)](a49_0x32c54e[_0x1033bb(0x1da)](_0x5d249a)+':\x20'+_0x400988+'\x20'+a49_0x32c54e['dim'](_0x2f57b3));}}console[_0x1033bb(0x1ce)]('\x0a'+a49_0x32c54e[_0x1033bb(0x1d3)](_0x1033bb(0x1d9)));const _0x475d5c=[{'label':_0x1033bb(0x1a4),'path':this[_0x1033bb(0x1b6)][_0x1033bb(0x1ca)],'extra':_0x1033bb(0x1cf)+this[_0x1033bb(0x1c5)]+')'},{'label':'Project','path':this['configFiles'][_0x1033bb(0x1b8)]},{'label':'Profile','path':this['configFiles'][_0x1033bb(0x1a1)]},{'label':_0x1033bb(0x1a8),'path':this[_0x1033bb(0x1b6)][_0x1033bb(0x1a6)]},{'label':_0x1033bb(0x19e),'path':this[_0x1033bb(0x1b6)][_0x1033bb(0x1e7)]},{'label':_0x1033bb(0x19d),'path':this[_0x1033bb(0x1b6)]['globalCredentials']}];for(const {label:_0x1f0690,path:_0x219313,extra:_0x316282}of _0x475d5c){if(_0x219313)console[_0x1033bb(0x1ce)](a49_0x32c54e[_0x1033bb(0x1da)](_0x1f0690)+':\x20'+_0x219313+'\x20'+a49_0x32c54e[_0x1033bb(0x1ad)]('✓')+(_0x316282?'\x20'+a49_0x32c54e[_0x1033bb(0x1c7)](_0x316282):''));else{if(_0x1f0690===_0x1033bb(0x1a4))console[_0x1033bb(0x1ce)](a49_0x32c54e['cyan'](_0x1f0690)+':\x20'+a49_0x32c54e[_0x1033bb(0x1c7)](_0x1033bb(0x1bf))+'\x20'+a49_0x32c54e[_0x1033bb(0x1c7)]('(using\x20session:\x20'+this['sessionId']+')'));else(_0x1f0690===_0x1033bb(0x1de)||_0x1f0690===_0x1033bb(0x19e))&&console[_0x1033bb(0x1ce)](a49_0x32c54e[_0x1033bb(0x1da)](_0x1f0690)+':\x20'+a49_0x32c54e[_0x1033bb(0x1c7)](_0x1033bb(0x1bf)));}}}async['resolveAPIKeyAsync'](){const _0x326238=a49_0x44b017;return this['apiKey']=await getAPIKeyAsync(this['site'],this[_0x326238(0x1ae)]||undefined),this[_0x326238(0x1a5)];}static async[a49_0x44b017(0x1dc)](_0x976885){const _0x52921e=new GlobalContext(_0x976885);return await _0x52921e['resolveAPIKeyAsync'](),_0x52921e;}}
@@ -1 +1 @@
1
- function a50_0x212b(_0x19ab4e,_0x1f49cf){_0x19ab4e=_0x19ab4e-0xc0;const _0x2d4658=a50_0x2d46();let _0x212bb0=_0x2d4658[_0x19ab4e];return _0x212bb0;}const a50_0x2365ce=a50_0x212b;(function(_0xd95deb,_0x2cfa1a){const _0x501eac=a50_0x212b,_0x32e8b2=_0xd95deb();while(!![]){try{const _0x3593d6=-parseInt(_0x501eac(0xe3))/0x1*(parseInt(_0x501eac(0xcb))/0x2)+-parseInt(_0x501eac(0xda))/0x3+-parseInt(_0x501eac(0xde))/0x4+-parseInt(_0x501eac(0xd8))/0x5*(-parseInt(_0x501eac(0xdf))/0x6)+-parseInt(_0x501eac(0xe4))/0x7*(parseInt(_0x501eac(0xd6))/0x8)+-parseInt(_0x501eac(0xd7))/0x9*(-parseInt(_0x501eac(0xd4))/0xa)+-parseInt(_0x501eac(0xc2))/0xb*(-parseInt(_0x501eac(0xc3))/0xc);if(_0x3593d6===_0x2cfa1a)break;else _0x32e8b2['push'](_0x32e8b2['shift']());}catch(_0x5b0213){_0x32e8b2['push'](_0x32e8b2['shift']());}}}(a50_0x2d46,0xc89d6));const SERVICE_NAME=a50_0x2365ce(0xd5);let EntryClass=null,keyringLoadError=null;function a50_0x2d46(){const _0x3ffcba=['873phKQgL','1114390kuGnGL','message','4344048nhNJHR','deleteCredential','no\x20matching\x20entry','access','2818600fcMBvv','42bCYWHg','cannot\x20find','value','unavailable','372083KRMZef','21hYkvPA','not_found','could\x20not\x20be\x20found','13786663fSoBRs','24ZVOGRi','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.','@napi-rs/keyring','error','System\x20keychain\x20is\x20not\x20available','restricted','Entry','-25293','2FwUUzf','setPassword','not\x20available','-25300','getPassword','not\x20supported','toLowerCase',':api_key','includes','38610fZygod','tdx','2919632oYvxXU'];a50_0x2d46=function(){return _0x3ffcba;};return a50_0x2d46();}async function getEntryClass(){const _0x4fe92f=a50_0x2365ce;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x497a39=await import(_0x4fe92f(0xc5));return EntryClass=_0x497a39[_0x4fe92f(0xc9)],EntryClass;}catch(_0x2285ce){return keyringLoadError=_0x2285ce instanceof Error?_0x2285ce:new Error(String(_0x2285ce)),null;}}function getAccountName(_0x2e70a9){const _0x3d575f=a50_0x2365ce,_0xd48cb3=_0x2e70a9||'';return'profile:'+_0xd48cb3+_0x3d575f(0xd2);}export async function getKeychainAPIKey(_0xdfb007){const _0x228b69=a50_0x2365ce,_0x675fee=await getKeychainAPIKeyWithStatus(_0xdfb007);if(_0x675fee['success'])return _0x675fee[_0x228b69(0xe1)];return _0x675fee['reason']==='access_denied'&&console[_0x228b69(0xc6)]('Warning:\x20'+_0x675fee[_0x228b69(0xd9)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3fce86){const _0x53ce13=a50_0x2365ce;try{const _0x7e1e1b=await getEntryClass();if(!_0x7e1e1b)return{'success':![],'reason':_0x53ce13(0xe2)};const _0x4d42f3=getAccountName(_0x3fce86),_0x2edaa7=new _0x7e1e1b(SERVICE_NAME,_0x4d42f3),_0x1363d9=_0x2edaa7[_0x53ce13(0xcf)]();if(_0x1363d9)return{'success':!![],'value':_0x1363d9};return{'success':![],'reason':'not_found'};}catch(_0x2661bb){const _0x164adf=_0x2661bb instanceof Error?_0x2661bb[_0x53ce13(0xd9)]:String(_0x2661bb);if(_0x164adf['includes'](_0x53ce13(0xce))||_0x164adf[_0x53ce13(0xd1)]()[_0x53ce13(0xd3)](_0x53ce13(0xc1))||_0x164adf['toLowerCase']()[_0x53ce13(0xd3)]('not\x20found')||_0x164adf[_0x53ce13(0xd1)]()[_0x53ce13(0xd3)](_0x53ce13(0xdc)))return{'success':![],'reason':_0x53ce13(0xc0)};if(_0x164adf[_0x53ce13(0xd3)](_0x53ce13(0xca))||_0x164adf[_0x53ce13(0xd1)]()[_0x53ce13(0xd3)](_0x53ce13(0xc8))||_0x164adf[_0x53ce13(0xd1)]()[_0x53ce13(0xd3)](_0x53ce13(0xdd)))return{'success':![],'reason':'access_denied','message':_0x53ce13(0xc4)};return{'success':![],'reason':_0x53ce13(0xe2),'message':_0x164adf};}}export async function saveKeychainAPIKey(_0x31291b,_0x1eddc5){const _0x16c7d3=a50_0x2365ce,_0x3f4c8c=await getEntryClass();if(!_0x3f4c8c)throw new Error(_0x16c7d3(0xc7));const _0x5f1588=getAccountName(_0x1eddc5),_0x572298=new _0x3f4c8c(SERVICE_NAME,_0x5f1588);_0x572298[_0x16c7d3(0xcc)](_0x31291b);}export async function deleteKeychainAPIKey(_0x2da300){const _0x4e2744=a50_0x2365ce;try{const _0x2d6968=await getEntryClass();if(!_0x2d6968)return![];const _0x12c83d=getAccountName(_0x2da300),_0x1f1c3d=new _0x2d6968(SERVICE_NAME,_0x12c83d);return _0x1f1c3d[_0x4e2744(0xdb)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x169a89=a50_0x2365ce;try{const _0x249fdc=await getEntryClass();if(!_0x249fdc)return![];const _0x5e778a=new _0x249fdc(SERVICE_NAME,'__keychain_test__');return _0x5e778a[_0x169a89(0xcf)](),!![];}catch(_0x56d7e9){const _0x3f4a76=_0x56d7e9 instanceof Error?_0x56d7e9[_0x169a89(0xd9)][_0x169a89(0xd1)]():'';if(_0x3f4a76['includes'](_0x169a89(0xcd))||_0x3f4a76[_0x169a89(0xd3)](_0x169a89(0xd0))||_0x3f4a76[_0x169a89(0xd3)](_0x169a89(0xe0)))return![];return!![];}}
1
+ function a50_0x568d(_0x1ca7f7,_0x57e454){_0x1ca7f7=_0x1ca7f7-0x1aa;const _0x4852ec=a50_0x4852();let _0x568d3f=_0x4852ec[_0x1ca7f7];return _0x568d3f;}const a50_0x34ea9a=a50_0x568d;(function(_0x4404a4,_0xee4217){const _0x5a51d4=a50_0x568d,_0x56e399=_0x4404a4();while(!![]){try{const _0x23f8ae=parseInt(_0x5a51d4(0x1c0))/0x1*(-parseInt(_0x5a51d4(0x1bd))/0x2)+parseInt(_0x5a51d4(0x1b0))/0x3*(parseInt(_0x5a51d4(0x1d0))/0x4)+-parseInt(_0x5a51d4(0x1b9))/0x5+parseInt(_0x5a51d4(0x1ae))/0x6*(-parseInt(_0x5a51d4(0x1c1))/0x7)+parseInt(_0x5a51d4(0x1bf))/0x8*(parseInt(_0x5a51d4(0x1b3))/0x9)+-parseInt(_0x5a51d4(0x1b2))/0xa*(parseInt(_0x5a51d4(0x1cb))/0xb)+parseInt(_0x5a51d4(0x1ab))/0xc;if(_0x23f8ae===_0xee4217)break;else _0x56e399['push'](_0x56e399['shift']());}catch(_0x1fc728){_0x56e399['push'](_0x56e399['shift']());}}}(a50_0x4852,0x3b04f));const SERVICE_NAME=a50_0x34ea9a(0x1c8);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x42b2fa=a50_0x34ea9a;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x796620=await import(_0x42b2fa(0x1bb));return EntryClass=_0x796620[_0x42b2fa(0x1ce)],EntryClass;}catch(_0x1905ae){return keyringLoadError=_0x1905ae instanceof Error?_0x1905ae:new Error(String(_0x1905ae)),null;}}function getAccountName(_0x5360f0){const _0x1689c5=a50_0x34ea9a,_0x39e319=_0x5360f0||'';return'profile:'+_0x39e319+_0x1689c5(0x1c7);}export async function getKeychainAPIKey(_0x42a531){const _0xa632f9=a50_0x34ea9a,_0x244243=await getKeychainAPIKeyWithStatus(_0x42a531);if(_0x244243[_0xa632f9(0x1c2)])return _0x244243[_0xa632f9(0x1c6)];return _0x244243[_0xa632f9(0x1b6)]===_0xa632f9(0x1c9)&&console[_0xa632f9(0x1d2)](_0xa632f9(0x1b8)+_0x244243['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x127ecc){const _0x2056c0=a50_0x34ea9a;try{const _0x4557bb=await getEntryClass();if(!_0x4557bb)return{'success':![],'reason':_0x2056c0(0x1ba)};const _0x2f69fa=getAccountName(_0x127ecc),_0x3f2036=new _0x4557bb(SERVICE_NAME,_0x2f69fa),_0x59419c=_0x3f2036['getPassword']();if(_0x59419c)return{'success':!![],'value':_0x59419c};return{'success':![],'reason':_0x2056c0(0x1cc)};}catch(_0x269801){const _0x52129d=_0x269801 instanceof Error?_0x269801['message']:String(_0x269801);if(_0x52129d[_0x2056c0(0x1d1)](_0x2056c0(0x1ca))||_0x52129d[_0x2056c0(0x1c4)]()[_0x2056c0(0x1d1)](_0x2056c0(0x1b5))||_0x52129d[_0x2056c0(0x1c4)]()[_0x2056c0(0x1d1)](_0x2056c0(0x1b4))||_0x52129d[_0x2056c0(0x1c4)]()[_0x2056c0(0x1d1)]('no\x20matching\x20entry'))return{'success':![],'reason':_0x2056c0(0x1cc)};if(_0x52129d[_0x2056c0(0x1d1)](_0x2056c0(0x1b1))||_0x52129d[_0x2056c0(0x1c4)]()[_0x2056c0(0x1d1)](_0x2056c0(0x1b7))||_0x52129d[_0x2056c0(0x1c4)]()[_0x2056c0(0x1d1)](_0x2056c0(0x1ac)))return{'success':![],'reason':_0x2056c0(0x1c9),'message':_0x2056c0(0x1af)};return{'success':![],'reason':_0x2056c0(0x1ba),'message':_0x52129d};}}export async function saveKeychainAPIKey(_0x35620b,_0x5b5e61){const _0x379a13=a50_0x34ea9a,_0x4b45ee=await getEntryClass();if(!_0x4b45ee)throw new Error(_0x379a13(0x1ad));const _0x236e04=getAccountName(_0x5b5e61),_0x3860eb=new _0x4b45ee(SERVICE_NAME,_0x236e04);_0x3860eb[_0x379a13(0x1be)](_0x35620b);}export async function deleteKeychainAPIKey(_0xac3a4a){const _0x50bf4e=a50_0x34ea9a;try{const _0x432f4b=await getEntryClass();if(!_0x432f4b)return![];const _0x298111=getAccountName(_0xac3a4a),_0x1a945c=new _0x432f4b(SERVICE_NAME,_0x298111);return _0x1a945c[_0x50bf4e(0x1aa)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x183c28=a50_0x34ea9a;try{const _0x4d7589=await getEntryClass();if(!_0x4d7589)return![];const _0x419589=new _0x4d7589(SERVICE_NAME,'__keychain_test__');return _0x419589[_0x183c28(0x1cd)](),!![];}catch(_0x11ba78){const _0x1385e8=_0x11ba78 instanceof Error?_0x11ba78[_0x183c28(0x1cf)][_0x183c28(0x1c4)]():'';if(_0x1385e8[_0x183c28(0x1d1)](_0x183c28(0x1bc))||_0x1385e8[_0x183c28(0x1d1)](_0x183c28(0x1c3))||_0x1385e8[_0x183c28(0x1d1)](_0x183c28(0x1c5)))return![];return!![];}}function a50_0x4852(){const _0xb61a03=['65547DPvmRT','not\x20found','could\x20not\x20be\x20found','reason','restricted','Warning:\x20','1711815XFwKja','unavailable','@napi-rs/keyring','not\x20available','311396qsePHU','setPassword','432KoUiaX','1tnFsQV','2932055ZKYaXd','success','not\x20supported','toLowerCase','cannot\x20find','value',':api_key','tdx','access_denied','-25300','2914670abHtUr','not_found','getPassword','Entry','message','4MMlCbM','includes','error','deleteCredential','11431752btuopL','access','System\x20keychain\x20is\x20not\x20available','6qoDZeg','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.','233133HvqpFR','-25293','10JfxZgY'];a50_0x4852=function(){return _0xb61a03;};return a50_0x4852();}
@@ -1 +1 @@
1
- const a51_0x29eda3=a51_0x2c56;(function(_0x3506f4,_0x46392a){const _0x427475=a51_0x2c56,_0x5c0316=_0x3506f4();while(!![]){try{const _0xa649ed=parseInt(_0x427475(0xc2))/0x1*(parseInt(_0x427475(0xe2))/0x2)+parseInt(_0x427475(0xf8))/0x3*(parseInt(_0x427475(0xdc))/0x4)+parseInt(_0x427475(0xbf))/0x5+parseInt(_0x427475(0xde))/0x6*(-parseInt(_0x427475(0xf9))/0x7)+parseInt(_0x427475(0x103))/0x8+parseInt(_0x427475(0xb5))/0x9*(-parseInt(_0x427475(0xd0))/0xa)+-parseInt(_0x427475(0xdf))/0xb;if(_0xa649ed===_0x46392a)break;else _0x5c0316['push'](_0x5c0316['shift']());}catch(_0x3a3613){_0x5c0316['push'](_0x5c0316['shift']());}}}(a51_0x38d0,0x50211));import*as a51_0x3606cb from'node:fs';import*as a51_0x1709d2 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';function a51_0x2c56(_0x425501,_0x553e6e){_0x425501=_0x425501-0xb2;const _0x38d020=a51_0x38d0();let _0x2c5619=_0x38d020[_0x425501];return _0x2c5619;}export const STUDIO_PROFILE_NAME=a51_0x29eda3(0xf5);export function getProfileParams(_0x5585ec){const _0x1baf8b=a51_0x29eda3,_0x5ebc7a={};if(!_0x5585ec)return _0x5ebc7a;for(const [_0x6f26ac,_0x3e8fbb]of Object[_0x1baf8b(0xd9)](_0x5585ec)){_0x6f26ac!=='description'&&_0x3e8fbb!==undefined&&(_0x5ebc7a[_0x6f26ac]=_0x3e8fbb);}return _0x5ebc7a;}export function getProfilesDir(){const _0x455597=a51_0x29eda3;return a51_0x1709d2[_0x455597(0xff)](getConfigDir(),_0x455597(0xea));}function getProfileDir(_0xa1f622){const _0x525435=a51_0x29eda3;return a51_0x1709d2[_0x525435(0xff)](getProfilesDir(),_0xa1f622);}function getProfileConfigPath(_0x932ec7){const _0xeac171=a51_0x29eda3;return a51_0x1709d2[_0xeac171(0xff)](getProfileDir(_0x932ec7),_0xeac171(0xbe));}function getProfileEnvPath(_0x88c96c){return a51_0x1709d2['join'](getProfileDir(_0x88c96c),'.env');}function getGlobalConfigPath(){const _0x4c35c6=a51_0x29eda3;return a51_0x1709d2[_0x4c35c6(0xff)](getConfigDir(),'tdx.json');}function validateProfileName(_0x588da7){const _0x39e730=a51_0x29eda3;if(/^@?[a-zA-Z0-9_-]+$/[_0x39e730(0xbc)](_0x588da7))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/[_0x39e730(0xbc)](_0x588da7))return;throw new Error(_0x39e730(0xe7)+_0x588da7+_0x39e730(0xc6));}function validateProfileConfig(_0x5e0025,_0x59d2ac){const _0xf6369=a51_0x29eda3;if(typeof _0x5e0025!==_0xf6369(0xfa)||_0x5e0025===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x59d2ac+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x2a7b7c=[_0xf6369(0xb7),'site',_0xf6369(0xc9),_0xf6369(0xf7),_0xf6369(0xf4),'llm_agent','user_info'],_0x123c0f=_0x5e0025;for(const _0x42b850 of Object[_0xf6369(0xc3)](_0x123c0f)){!_0x2a7b7c[_0xf6369(0x100)](_0x42b850)&&console[_0xf6369(0xcc)]('Warning:\x20Profile\x20\x27'+_0x59d2ac+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x42b850+_0xf6369(0xb2));}if(_0x123c0f[_0xf6369(0xb7)]!==undefined&&typeof _0x123c0f[_0xf6369(0xb7)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0xf6369(0xef)+_0x59d2ac+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x123c0f[_0xf6369(0xee)]!==undefined&&typeof _0x123c0f[_0xf6369(0xee)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0xf6369(0xef)+_0x59d2ac+_0xf6369(0xdd));if(_0x123c0f['database']!==undefined&&typeof _0x123c0f['database']!=='string')throw new SDKError(ErrorCode[_0xf6369(0xb3)],'Profile\x20\x27'+_0x59d2ac+_0xf6369(0xbb));if(_0x123c0f[_0xf6369(0xf7)]!==undefined&&typeof _0x123c0f[_0xf6369(0xf7)]!=='string')throw new SDKError(ErrorCode[_0xf6369(0xb3)],_0xf6369(0xef)+_0x59d2ac+_0xf6369(0xe1));if(_0x123c0f[_0xf6369(0xf4)]!==undefined&&typeof _0x123c0f[_0xf6369(0xf4)]!=='string')throw new SDKError(ErrorCode[_0xf6369(0xb3)],_0xf6369(0xef)+_0x59d2ac+_0xf6369(0xe3));if(_0x123c0f['llm_agent']!==undefined&&typeof _0x123c0f[_0xf6369(0xc7)]!==_0xf6369(0xe8))throw new SDKError(ErrorCode[_0xf6369(0xb3)],_0xf6369(0xef)+_0x59d2ac+_0xf6369(0xd7));return!![];}function a51_0x38d0(){const _0x51deef=['profile','\x20\x201.\x20Edit:\x20','set','join','includes','\x20already\x20exists','name','2046624SjhRfY','\x27\x20will\x20be\x20ignored','INVALID_PROFILE_CONFIG','Profile\x20','18aUtjuD','utf-8','description','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Failed\x20to\x20parse\x20','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','test','\x20\x20mv\x20\x22','tdx.json','565220PDgHyr','parse','\x22\x20\x22','29387vdSpvo','keys','filter','message','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','llm_agent','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','database','\x27\x20not\x20found\x20in\x20user\x20configuration','some','warn','map','readFileSync','To\x20migrate:','2645210bJRPSk','\x20does\x20not\x20exist','values','push','stringify','existsSync','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','.env','entries','readdirSync','user','2009868NDCljv','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','6246kfHPxU','1561571hGBRHT','toISOString','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','16ArBebK','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','isDirectory','from','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Invalid\x20profile\x20name:\x20','string','directory','profiles','find','\x0aWarning:\x20Failed\x20to\x20parse\x20','has','site','Profile\x20\x27','sort',':\x20Invalid\x20JSON\x20syntax','Warning:\x20Failed\x20to\x20parse\x20','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','llm_project','@tdx-studio',',\x20creating\x20new\x20file','parent_segment','3NBWTNN','721YvJnZl','object','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'];a51_0x38d0=function(){return _0x51deef;};return a51_0x38d0();}function loadProfilesFromTdxJson(_0x2e1912,_0x160c19){const _0x419530=a51_0x29eda3;if(!a51_0x3606cb[_0x419530(0xd5)](_0x2e1912))return[];try{const _0x352357=a51_0x3606cb[_0x419530(0xce)](_0x2e1912,_0x419530(0xb6)),_0x52d15e=JSON[_0x419530(0xc0)](_0x352357);if(!_0x52d15e[_0x419530(0xea)]||typeof _0x52d15e[_0x419530(0xea)]!==_0x419530(0xfa))return[];const _0x27c1ed=[];for(const [_0x45adb6,_0x5f24c5]of Object[_0x419530(0xd9)](_0x52d15e[_0x419530(0xea)])){try{validateProfileConfig(_0x5f24c5,_0x45adb6);const _0x49cd7e=getNewCredentialPath(_0x45adb6),_0x27a6f6=getOldCredentialPath(_0x45adb6),_0x1746b6=a51_0x3606cb[_0x419530(0xd5)](_0x49cd7e)||a51_0x3606cb[_0x419530(0xd5)](_0x27a6f6);_0x27c1ed[_0x419530(0xd3)]({'name':_0x45adb6,'config':_0x5f24c5,'metadata':{'name':_0x45adb6,'createdAt':new Date()[_0x419530(0xe0)]()},'hasCredentials':_0x1746b6,'scope':_0x160c19});}catch(_0x4aef11){_0x4aef11 instanceof Error&&(console[_0x419530(0xcc)](_0x419530(0xb9)+_0x2e1912+':'),console['warn']('\x20\x20'+_0x4aef11[_0x419530(0xc5)]+'\x0a'));}}return _0x27c1ed;}catch(_0x43975d){return _0x43975d instanceof SyntaxError?(console[_0x419530(0xcc)](_0x419530(0xec)+_0x2e1912+_0x419530(0xf1)),console[_0x419530(0xcc)]('Error:\x20'+_0x43975d[_0x419530(0xc5)]+'\x0a')):console['warn'](_0x419530(0xd6)+_0x2e1912+':\x20'+_0x43975d+'\x0a'),[];}}export function getNewCredentialPath(_0x3b68e5){const _0x4cc8e6=a51_0x29eda3;return a51_0x1709d2[_0x4cc8e6(0xff)](getConfigDir(),'.env.'+_0x3b68e5);}function getOldCredentialPath(_0x35b4bd){const _0xca6dfa=a51_0x29eda3;return a51_0x1709d2[_0xca6dfa(0xff)](getProfilesDir(),_0x35b4bd,_0xca6dfa(0xd8));}function loadProfilesFromTdxJsonFiles(){const _0x315b64=a51_0x29eda3,_0xdec305=[],_0x3c9835=findProjectConfigPath();_0x3c9835&&_0xdec305['push'](...loadProfilesFromTdxJson(_0x3c9835,'local'));const _0x5c8dc3=a51_0x1709d2[_0x315b64(0xff)](getConfigDir(),_0x315b64(0xbe));return _0xdec305['push'](...loadProfilesFromTdxJson(_0x5c8dc3,_0x315b64(0xdb))),_0xdec305;}function loadProfilesFromDirectories(){const _0x356218=a51_0x29eda3,_0x4c5107=getProfilesDir();if(!a51_0x3606cb[_0x356218(0xd5)](_0x4c5107))return[];try{return a51_0x3606cb[_0x356218(0xda)](_0x4c5107,{'withFileTypes':!![]})[_0x356218(0xc4)](_0x470fc6=>_0x470fc6[_0x356218(0xe4)]())[_0x356218(0xcd)](_0x56629e=>_0x56629e[_0x356218(0x102)])['filter'](_0x44fe95=>{const _0x5bb6cd=_0x356218,_0x3e44c9=getProfileConfigPath(_0x44fe95),_0x3beaa4=getProfileEnvPath(_0x44fe95);return a51_0x3606cb[_0x5bb6cd(0xd5)](_0x3e44c9)||a51_0x3606cb['existsSync'](_0x3beaa4);})[_0x356218(0xcd)](_0x41953a=>{const _0x410415=_0x356218,_0x497a94=loadProfileFromDirectory(_0x41953a);if(_0x497a94)return{..._0x497a94,'scope':_0x410415(0xe9)};return null;})[_0x356218(0xc4)](_0x4c5068=>_0x4c5068!==null);}catch{return[];}}function loadProfileFromDirectory(_0x149fe6){const _0xa2cec5=a51_0x29eda3,_0x3d0714=getProfileConfigPath(_0x149fe6),_0x2d5dfc=getOldCredentialPath(_0x149fe6);if(!a51_0x3606cb['existsSync'](_0x3d0714)&&!a51_0x3606cb[_0xa2cec5(0xd5)](_0x2d5dfc))return null;let _0x1f5b7f={},_0x3f1eef={'name':_0x149fe6,'createdAt':new Date()[_0xa2cec5(0xe0)]()};if(a51_0x3606cb[_0xa2cec5(0xd5)](_0x3d0714))try{const _0x477834=a51_0x3606cb[_0xa2cec5(0xce)](_0x3d0714,'utf-8'),_0xcb29d7=JSON[_0xa2cec5(0xc0)](_0x477834),{metadata:_0x45a245,..._0x238fd0}=_0xcb29d7;_0x1f5b7f=_0x238fd0,_0x45a245&&(_0x3f1eef=_0x45a245);}catch{}return{'name':_0x149fe6,'config':_0x1f5b7f,'metadata':_0x3f1eef,'hasCredentials':a51_0x3606cb[_0xa2cec5(0xd5)](_0x2d5dfc),'scope':_0xa2cec5(0xe9)};}export function listProfiles(){const _0xdbfce=a51_0x29eda3,_0x1291d7=loadProfilesFromTdxJsonFiles(),_0xffc51d=loadProfilesFromDirectories();if(_0xffc51d['length']>0x0){const _0x2c2f29=_0xffc51d['map'](_0x2b3331=>_0x2b3331[_0xdbfce(0x102)])['join'](',\x20'),_0x4a0941=getConfigDir();console[_0xdbfce(0xcc)](_0xdbfce(0xb8)+_0x2c2f29),console['warn'](_0xdbfce(0xfb)),console[_0xdbfce(0xcc)](_0xdbfce(0xfd)+a51_0x1709d2[_0xdbfce(0xff)](_0x4a0941,_0xdbfce(0xbe))),console[_0xdbfce(0xcc)](_0xdbfce(0xf3)),console[_0xdbfce(0xcc)](_0xdbfce(0xc8));}const _0x3a13d4=[..._0x1291d7,..._0xffc51d],_0x3a63d1=new Map();for(const _0x27c396 of _0x3a13d4){!_0x3a63d1[_0xdbfce(0xed)](_0x27c396[_0xdbfce(0x102)])&&_0x3a63d1[_0xdbfce(0xfe)](_0x27c396['name'],_0x27c396);}return Array[_0xdbfce(0xe5)](_0x3a63d1[_0xdbfce(0xd2)]())[_0xdbfce(0xf0)]((_0x104401,_0x31479e)=>_0x104401[_0xdbfce(0x102)]['localeCompare'](_0x31479e[_0xdbfce(0x102)]));}export function profileExists(_0x151a0b){const _0x29a7ed=a51_0x29eda3,_0x5d72d6=listProfiles();return _0x5d72d6[_0x29a7ed(0xcb)](_0x1938f8=>_0x1938f8[_0x29a7ed(0x102)]===_0x151a0b);}export function loadProfile(_0x13ed29){const _0x4b1044=a51_0x29eda3;validateProfileName(_0x13ed29);const _0x7cd379=listProfiles(),_0x20cb19=_0x7cd379[_0x4b1044(0xeb)](_0x1e0f0e=>_0x1e0f0e[_0x4b1044(0x102)]===_0x13ed29);return _0x20cb19||null;}export function saveProfile(_0x5d8046,_0x3accaf,_0x5f2533=![]){saveProfileToUserConfig(_0x5d8046,_0x3accaf);}export function deleteProfile(_0x10652d){const _0x4840c2=a51_0x29eda3;validateProfileName(_0x10652d);const _0x107be1=getProfileDir(_0x10652d);if(!a51_0x3606cb[_0x4840c2(0xd5)](_0x107be1))throw new Error('Profile\x20'+_0x10652d+_0x4840c2(0xd1));a51_0x3606cb['rmSync'](_0x107be1,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x34372c,_0x11649b){const _0x270c43=a51_0x29eda3;validateProfileName(_0x34372c);const _0x2b57ac=getGlobalConfigPath(),_0x3ff44a=getConfigDir();!a51_0x3606cb[_0x270c43(0xd5)](_0x3ff44a)&&createSecureDirectory(_0x3ff44a);let _0x437533={};if(a51_0x3606cb[_0x270c43(0xd5)](_0x2b57ac))try{const _0x36952f=a51_0x3606cb[_0x270c43(0xce)](_0x2b57ac,'utf-8');_0x437533=JSON['parse'](_0x36952f);}catch{console[_0x270c43(0xcc)](_0x270c43(0xf2)+_0x2b57ac+_0x270c43(0xf6));}!_0x437533['profiles']&&(_0x437533[_0x270c43(0xea)]={}),_0x437533[_0x270c43(0xea)][_0x34372c]=_0x11649b,writeSecureFile(_0x2b57ac,JSON['stringify'](_0x437533,null,0x2));}export function removeProfileFromUserConfig(_0x1fb6dd){const _0x14523e=a51_0x29eda3;validateProfileName(_0x1fb6dd);const _0x40f635=getGlobalConfigPath();if(!a51_0x3606cb[_0x14523e(0xd5)](_0x40f635))throw new Error(_0x14523e(0xef)+_0x1fb6dd+_0x14523e(0xca));let _0x2590d1={};try{const _0xb33fa=a51_0x3606cb[_0x14523e(0xce)](_0x40f635,_0x14523e(0xb6));_0x2590d1=JSON['parse'](_0xb33fa);}catch{throw new Error(_0x14523e(0xba)+_0x40f635);}if(!_0x2590d1[_0x14523e(0xea)]||!_0x2590d1[_0x14523e(0xea)][_0x1fb6dd])throw new Error(_0x14523e(0xef)+_0x1fb6dd+_0x14523e(0xca));delete _0x2590d1[_0x14523e(0xea)][_0x1fb6dd],_0x2590d1[_0x14523e(0xfc)]===_0x1fb6dd&&delete _0x2590d1['profile'],writeSecureFile(_0x40f635,JSON[_0x14523e(0xd4)](_0x2590d1,null,0x2));}export function getActiveProfile(){const _0x28630b=a51_0x29eda3,_0x4d4aba=loadSessionContext();if(_0x4d4aba?.[_0x28630b(0xfc)])return _0x4d4aba['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x566a69=getGlobalConfigPath();if(!a51_0x3606cb[_0x28630b(0xd5)](_0x566a69))return null;try{const _0xd5980a=a51_0x3606cb['readFileSync'](_0x566a69,_0x28630b(0xb6)),_0x10af14=JSON[_0x28630b(0xc0)](_0xd5980a);return _0x10af14['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x360828){const _0x424964=a51_0x29eda3,_0x380378=getGlobalConfigPath(),_0x3e92d7=getConfigDir();!a51_0x3606cb[_0x424964(0xd5)](_0x3e92d7)&&createSecureDirectory(_0x3e92d7);let _0x2b6fcd={};if(a51_0x3606cb[_0x424964(0xd5)](_0x380378))try{const _0x13fd96=a51_0x3606cb[_0x424964(0xce)](_0x380378,'utf-8');_0x2b6fcd=JSON[_0x424964(0xc0)](_0x13fd96);}catch{console[_0x424964(0xcc)](_0x424964(0xf2)+_0x380378+_0x424964(0xf6));}_0x2b6fcd['site']=_0x360828,writeSecureFile(_0x380378,JSON['stringify'](_0x2b6fcd,null,0x2));}export function saveActiveProfileToUserConfig(_0x9e26dd){const _0xbd8da0=a51_0x29eda3;validateProfileName(_0x9e26dd);const _0x16614f=getGlobalConfigPath(),_0x35a500=getConfigDir();!a51_0x3606cb[_0xbd8da0(0xd5)](_0x35a500)&&createSecureDirectory(_0x35a500);let _0x3d65f6={};if(a51_0x3606cb[_0xbd8da0(0xd5)](_0x16614f))try{const _0x16fa0d=a51_0x3606cb['readFileSync'](_0x16614f,_0xbd8da0(0xb6));_0x3d65f6=JSON[_0xbd8da0(0xc0)](_0x16fa0d);}catch{console[_0xbd8da0(0xcc)](_0xbd8da0(0xf2)+_0x16614f+_0xbd8da0(0xf6));}_0x3d65f6[_0xbd8da0(0xfc)]=_0x9e26dd,writeSecureFile(_0x16614f,JSON[_0xbd8da0(0xd4)](_0x3d65f6,null,0x2));}function clearFieldFromUserConfig(_0x4e8afb){const _0xa0e212=a51_0x29eda3,_0x42fb85=getGlobalConfigPath();if(!a51_0x3606cb[_0xa0e212(0xd5)](_0x42fb85))return;let _0x353423={};try{const _0x28b097=a51_0x3606cb[_0xa0e212(0xce)](_0x42fb85,_0xa0e212(0xb6));_0x353423=JSON[_0xa0e212(0xc0)](_0x28b097);}catch{return;}delete _0x353423[_0x4e8afb],writeSecureFile(_0x42fb85,JSON[_0xa0e212(0xd4)](_0x353423,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x127364=a51_0x29eda3;clearFieldFromUserConfig(_0x127364(0xfc));}export function createProfile(_0x41aa3d,_0x21e91d){const _0x25e551=a51_0x29eda3;validateProfileName(_0x41aa3d);if(profileExists(_0x41aa3d))throw new Error(_0x25e551(0xb4)+_0x41aa3d+_0x25e551(0x101));saveProfile(_0x41aa3d,_0x21e91d);}export function saveProfileCredentials(_0x743cf3,_0x2e7c31){const _0x58c5ea=a51_0x29eda3;validateProfileName(_0x743cf3);if(!profileExists(_0x743cf3))throw new Error('Profile\x20'+_0x743cf3+_0x58c5ea(0xd1));const _0x3099c4=getNewCredentialPath(_0x743cf3);writeSecureFile(_0x3099c4,_0x2e7c31);}export function loadProfileCredentials(_0x89c033){const _0x4c33c7=a51_0x29eda3;validateProfileName(_0x89c033);const _0x2097c7=getNewCredentialPath(_0x89c033);if(a51_0x3606cb[_0x4c33c7(0xd5)](_0x2097c7))try{return a51_0x3606cb[_0x4c33c7(0xce)](_0x2097c7,_0x4c33c7(0xb6));}catch{}const _0x43e325=getOldCredentialPath(_0x89c033);if(a51_0x3606cb[_0x4c33c7(0xd5)](_0x43e325)){console['warn'](_0x4c33c7(0xe6)+_0x89c033+'\x27'),console[_0x4c33c7(0xcc)](_0x4c33c7(0xcf)),console[_0x4c33c7(0xcc)](_0x4c33c7(0xbd)+_0x43e325+_0x4c33c7(0xc1)+_0x2097c7+'\x22'),console[_0x4c33c7(0xcc)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a51_0x3606cb['readFileSync'](_0x43e325,'utf-8');}catch{return null;}}return null;}
1
+ const a51_0x57c2e6=a51_0x45b6;(function(_0x302ec1,_0xacd1d1){const _0xe76b2b=a51_0x45b6,_0xaccd96=_0x302ec1();while(!![]){try{const _0x5c3c67=-parseInt(_0xe76b2b(0xb5))/0x1+parseInt(_0xe76b2b(0xed))/0x2+-parseInt(_0xe76b2b(0xe6))/0x3+parseInt(_0xe76b2b(0xe1))/0x4*(parseInt(_0xe76b2b(0xfa))/0x5)+-parseInt(_0xe76b2b(0xe9))/0x6+-parseInt(_0xe76b2b(0xbf))/0x7+-parseInt(_0xe76b2b(0xe5))/0x8*(-parseInt(_0xe76b2b(0xd4))/0x9);if(_0x5c3c67===_0xacd1d1)break;else _0xaccd96['push'](_0xaccd96['shift']());}catch(_0x2f9955){_0xaccd96['push'](_0xaccd96['shift']());}}}(a51_0x3d88,0xe6a9b));import*as a51_0x5b373c from'node:fs';import*as a51_0x5add4c from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a51_0x57c2e6(0xd6);export function getProfileParams(_0x41a60a){const _0x242f4d={};if(!_0x41a60a)return _0x242f4d;for(const [_0x818145,_0x8c6f36]of Object['entries'](_0x41a60a)){_0x818145!=='description'&&_0x8c6f36!==undefined&&(_0x242f4d[_0x818145]=_0x8c6f36);}return _0x242f4d;}export function getProfilesDir(){const _0xd47525=a51_0x57c2e6;return a51_0x5add4c[_0xd47525(0xe0)](getConfigDir(),_0xd47525(0xf4));}function getProfileDir(_0x351f42){const _0x29ecf2=a51_0x57c2e6;return a51_0x5add4c[_0x29ecf2(0xe0)](getProfilesDir(),_0x351f42);}function getProfileConfigPath(_0x56cc22){const _0x3b30db=a51_0x57c2e6;return a51_0x5add4c[_0x3b30db(0xe0)](getProfileDir(_0x56cc22),_0x3b30db(0xc3));}function getProfileEnvPath(_0xbe3352){const _0x520bf0=a51_0x57c2e6;return a51_0x5add4c[_0x520bf0(0xe0)](getProfileDir(_0xbe3352),_0x520bf0(0xf6));}function getGlobalConfigPath(){const _0x4237a8=a51_0x57c2e6;return a51_0x5add4c[_0x4237a8(0xe0)](getConfigDir(),_0x4237a8(0xc3));}function validateProfileName(_0x5bf8e1){const _0x1153ea=a51_0x57c2e6;if(/^@?[a-zA-Z0-9_-]+$/[_0x1153ea(0xb7)](_0x5bf8e1))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/['test'](_0x5bf8e1))return;throw new Error(_0x1153ea(0xf0)+_0x5bf8e1+_0x1153ea(0xdb));}function validateProfileConfig(_0x2af2e1,_0x29da0c){const _0x257627=a51_0x57c2e6;if(typeof _0x2af2e1!=='object'||_0x2af2e1===null)throw new SDKError(ErrorCode[_0x257627(0xdc)],'Profile\x20\x27'+_0x29da0c+_0x257627(0xd8));const _0x495f47=[_0x257627(0xd3),_0x257627(0xdf),'database',_0x257627(0xbc),'llm_project',_0x257627(0xc1),'user_info'],_0x1e4c33=_0x2af2e1;for(const _0x2111d3 of Object[_0x257627(0xb0)](_0x1e4c33)){!_0x495f47[_0x257627(0xca)](_0x2111d3)&&console[_0x257627(0xd5)](_0x257627(0xc7)+_0x29da0c+_0x257627(0xe4)+_0x2111d3+_0x257627(0xad));}if(_0x1e4c33[_0x257627(0xd3)]!==undefined&&typeof _0x1e4c33['description']!==_0x257627(0xb9))throw new SDKError(ErrorCode[_0x257627(0xdc)],_0x257627(0xc6)+_0x29da0c+_0x257627(0xd0));if(_0x1e4c33[_0x257627(0xdf)]!==undefined&&typeof _0x1e4c33['site']!==_0x257627(0xb9))throw new SDKError(ErrorCode[_0x257627(0xdc)],_0x257627(0xc6)+_0x29da0c+_0x257627(0xf3));if(_0x1e4c33[_0x257627(0xf7)]!==undefined&&typeof _0x1e4c33[_0x257627(0xf7)]!==_0x257627(0xb9))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x29da0c+_0x257627(0xaf));if(_0x1e4c33[_0x257627(0xbc)]!==undefined&&typeof _0x1e4c33['parent_segment']!==_0x257627(0xb9))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x257627(0xc6)+_0x29da0c+_0x257627(0xcd));if(_0x1e4c33[_0x257627(0xf8)]!==undefined&&typeof _0x1e4c33['llm_project']!==_0x257627(0xb9))throw new SDKError(ErrorCode[_0x257627(0xdc)],_0x257627(0xc6)+_0x29da0c+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x1e4c33[_0x257627(0xc1)]!==undefined&&typeof _0x1e4c33[_0x257627(0xc1)]!==_0x257627(0xb9))throw new SDKError(ErrorCode[_0x257627(0xdc)],_0x257627(0xc6)+_0x29da0c+_0x257627(0xbe));return!![];}function loadProfilesFromTdxJson(_0x321fca,_0x14202d){const _0x523aef=a51_0x57c2e6;if(!a51_0x5b373c['existsSync'](_0x321fca))return[];try{const _0x1ee1dc=a51_0x5b373c[_0x523aef(0xda)](_0x321fca,_0x523aef(0xd7)),_0x5bc894=JSON[_0x523aef(0xe7)](_0x1ee1dc);if(!_0x5bc894[_0x523aef(0xf4)]||typeof _0x5bc894['profiles']!=='object')return[];const _0x44e0b5=[];for(const [_0x25f0e5,_0x4a9047]of Object[_0x523aef(0xb2)](_0x5bc894['profiles'])){try{validateProfileConfig(_0x4a9047,_0x25f0e5);const _0x4cd393=getNewCredentialPath(_0x25f0e5),_0x189d70=getOldCredentialPath(_0x25f0e5),_0x2cfea0=a51_0x5b373c['existsSync'](_0x4cd393)||a51_0x5b373c[_0x523aef(0xcc)](_0x189d70);_0x44e0b5[_0x523aef(0xb6)]({'name':_0x25f0e5,'config':_0x4a9047,'metadata':{'name':_0x25f0e5,'createdAt':new Date()[_0x523aef(0xd1)]()},'hasCredentials':_0x2cfea0,'scope':_0x14202d});}catch(_0x18c9f7){_0x18c9f7 instanceof Error&&(console[_0x523aef(0xd5)](_0x523aef(0xc8)+_0x321fca+':'),console[_0x523aef(0xd5)]('\x20\x20'+_0x18c9f7[_0x523aef(0xce)]+'\x0a'));}}return _0x44e0b5;}catch(_0x33a97f){return _0x33a97f instanceof SyntaxError?(console[_0x523aef(0xd5)](_0x523aef(0xc4)+_0x321fca+':\x20Invalid\x20JSON\x20syntax'),console[_0x523aef(0xd5)](_0x523aef(0xdd)+_0x33a97f[_0x523aef(0xce)]+'\x0a')):console['warn'](_0x523aef(0xee)+_0x321fca+':\x20'+_0x33a97f+'\x0a'),[];}}export function getNewCredentialPath(_0x11a61c){const _0x3712b1=a51_0x57c2e6;return a51_0x5add4c['join'](getConfigDir(),_0x3712b1(0xc2)+_0x11a61c);}function getOldCredentialPath(_0x2c30c6){const _0x111662=a51_0x57c2e6;return a51_0x5add4c[_0x111662(0xe0)](getProfilesDir(),_0x2c30c6,_0x111662(0xf6));}function loadProfilesFromTdxJsonFiles(){const _0x4d3f80=a51_0x57c2e6,_0x13993d=[],_0x3924e4=findProjectConfigPath();_0x3924e4&&_0x13993d['push'](...loadProfilesFromTdxJson(_0x3924e4,'local'));const _0x597064=a51_0x5add4c[_0x4d3f80(0xe0)](getConfigDir(),_0x4d3f80(0xc3));return _0x13993d['push'](...loadProfilesFromTdxJson(_0x597064,_0x4d3f80(0xbb))),_0x13993d;}function loadProfilesFromDirectories(){const _0x2c19d2=a51_0x57c2e6,_0x16f56e=getProfilesDir();if(!a51_0x5b373c[_0x2c19d2(0xcc)](_0x16f56e))return[];try{return a51_0x5b373c['readdirSync'](_0x16f56e,{'withFileTypes':!![]})[_0x2c19d2(0xb3)](_0x25cb14=>_0x25cb14['isDirectory']())['map'](_0x916f8c=>_0x916f8c[_0x2c19d2(0xc5)])[_0x2c19d2(0xb3)](_0xb2195d=>{const _0x103eac=_0x2c19d2,_0xb20a88=getProfileConfigPath(_0xb2195d),_0x58ee08=getProfileEnvPath(_0xb2195d);return a51_0x5b373c[_0x103eac(0xcc)](_0xb20a88)||a51_0x5b373c[_0x103eac(0xcc)](_0x58ee08);})['map'](_0x3d45f5=>{const _0x1d2ac4=_0x2c19d2,_0x453931=loadProfileFromDirectory(_0x3d45f5);if(_0x453931)return{..._0x453931,'scope':_0x1d2ac4(0xb1)};return null;})[_0x2c19d2(0xb3)](_0x5c0b86=>_0x5c0b86!==null);}catch{return[];}}function a51_0x3d88(){const _0x5373de=['tdx.json','\x0aWarning:\x20Failed\x20to\x20parse\x20','name','Profile\x20\x27','Warning:\x20Profile\x20\x27','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','set','includes','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','existsSync','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','message','stringify','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','toISOString','\x20does\x20not\x20exist','description','3639033erItQB','warn','@tdx-studio','utf-8','\x27:\x20config\x20must\x20be\x20an\x20object','Failed\x20to\x20parse\x20','readFileSync','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','INVALID_PROFILE_CONFIG','Error:\x20','map','site','join','124640eNTQyY','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20unknown\x20config\x20key\x20\x27','64AyifiR','1442715xHjjOs','parse','To\x20migrate:','11149158WULPms','has','find','from','3467378aPWBRR','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20already\x20exists','Invalid\x20profile\x20name:\x20','\x20\x201.\x20Edit:\x20','Profile\x20','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','profiles','rmSync','.env','database','llm_project','\x22\x20\x22','5dMUinx','profile','sort','\x27\x20will\x20be\x20ignored','values','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','keys','directory','entries','filter','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','1479531kFGdZo','push','test',',\x20creating\x20new\x20file','string','Warning:\x20Failed\x20to\x20parse\x20','user','parent_segment','\x27\x20not\x20found\x20in\x20user\x20configuration','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','1652847XiJTAS','\x20\x20mv\x20\x22','llm_agent','.env.'];a51_0x3d88=function(){return _0x5373de;};return a51_0x3d88();}function loadProfileFromDirectory(_0x27b533){const _0x2415c8=a51_0x57c2e6,_0x249242=getProfileConfigPath(_0x27b533),_0x412b40=getOldCredentialPath(_0x27b533);if(!a51_0x5b373c[_0x2415c8(0xcc)](_0x249242)&&!a51_0x5b373c[_0x2415c8(0xcc)](_0x412b40))return null;let _0x26ac79={},_0x4df427={'name':_0x27b533,'createdAt':new Date()[_0x2415c8(0xd1)]()};if(a51_0x5b373c[_0x2415c8(0xcc)](_0x249242))try{const _0x2e1470=a51_0x5b373c[_0x2415c8(0xda)](_0x249242,_0x2415c8(0xd7)),_0x445d82=JSON['parse'](_0x2e1470),{metadata:_0x16724e,..._0x7dbc3e}=_0x445d82;_0x26ac79=_0x7dbc3e,_0x16724e&&(_0x4df427=_0x16724e);}catch{}return{'name':_0x27b533,'config':_0x26ac79,'metadata':_0x4df427,'hasCredentials':a51_0x5b373c[_0x2415c8(0xcc)](_0x412b40),'scope':_0x2415c8(0xb1)};}export function listProfiles(){const _0x10a17d=a51_0x57c2e6,_0x2456c2=loadProfilesFromTdxJsonFiles(),_0x25c523=loadProfilesFromDirectories();if(_0x25c523['length']>0x0){const _0x56c2d9=_0x25c523[_0x10a17d(0xde)](_0x26d4f3=>_0x26d4f3[_0x10a17d(0xc5)])['join'](',\x20'),_0x51773c=getConfigDir();console[_0x10a17d(0xd5)](_0x10a17d(0xcb)+_0x56c2d9),console[_0x10a17d(0xd5)](_0x10a17d(0xe2)),console[_0x10a17d(0xd5)](_0x10a17d(0xf1)+a51_0x5add4c[_0x10a17d(0xe0)](_0x51773c,_0x10a17d(0xc3))),console[_0x10a17d(0xd5)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console['warn'](_0x10a17d(0xb4));}const _0x343468=[..._0x2456c2,..._0x25c523],_0x1b57bd=new Map();for(const _0x8c32b2 of _0x343468){!_0x1b57bd[_0x10a17d(0xea)](_0x8c32b2[_0x10a17d(0xc5)])&&_0x1b57bd[_0x10a17d(0xc9)](_0x8c32b2[_0x10a17d(0xc5)],_0x8c32b2);}return Array[_0x10a17d(0xec)](_0x1b57bd[_0x10a17d(0xae)]())[_0x10a17d(0xac)]((_0x260577,_0x4c0b11)=>_0x260577[_0x10a17d(0xc5)]['localeCompare'](_0x4c0b11[_0x10a17d(0xc5)]));}export function profileExists(_0x3e0c63){const _0x2ab1f4=a51_0x57c2e6,_0x9d5374=listProfiles();return _0x9d5374['some'](_0x365f35=>_0x365f35[_0x2ab1f4(0xc5)]===_0x3e0c63);}export function loadProfile(_0x3e6b01){const _0x2d4c79=a51_0x57c2e6;validateProfileName(_0x3e6b01);const _0x364ea9=listProfiles(),_0x1d4a3a=_0x364ea9[_0x2d4c79(0xeb)](_0x1601e7=>_0x1601e7['name']===_0x3e6b01);return _0x1d4a3a||null;}export function saveProfile(_0x3b1154,_0x362ba7,_0x566e9a=![]){saveProfileToUserConfig(_0x3b1154,_0x362ba7);}export function deleteProfile(_0x3e739e){const _0x2180a8=a51_0x57c2e6;validateProfileName(_0x3e739e);const _0x12f6ba=getProfileDir(_0x3e739e);if(!a51_0x5b373c[_0x2180a8(0xcc)](_0x12f6ba))throw new Error(_0x2180a8(0xf2)+_0x3e739e+_0x2180a8(0xd2));a51_0x5b373c[_0x2180a8(0xf5)](_0x12f6ba,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x50fb82,_0x116656){const _0x5c1b77=a51_0x57c2e6;validateProfileName(_0x50fb82);const _0x641dba=getGlobalConfigPath(),_0x5de63e=getConfigDir();!a51_0x5b373c[_0x5c1b77(0xcc)](_0x5de63e)&&createSecureDirectory(_0x5de63e);let _0x4fabfa={};if(a51_0x5b373c[_0x5c1b77(0xcc)](_0x641dba))try{const _0xf5fde0=a51_0x5b373c[_0x5c1b77(0xda)](_0x641dba,_0x5c1b77(0xd7));_0x4fabfa=JSON[_0x5c1b77(0xe7)](_0xf5fde0);}catch{console[_0x5c1b77(0xd5)](_0x5c1b77(0xba)+_0x641dba+_0x5c1b77(0xb8));}!_0x4fabfa[_0x5c1b77(0xf4)]&&(_0x4fabfa[_0x5c1b77(0xf4)]={}),_0x4fabfa[_0x5c1b77(0xf4)][_0x50fb82]=_0x116656,writeSecureFile(_0x641dba,JSON[_0x5c1b77(0xcf)](_0x4fabfa,null,0x2));}export function removeProfileFromUserConfig(_0x12ab6e){const _0x2e18d9=a51_0x57c2e6;validateProfileName(_0x12ab6e);const _0x1e1811=getGlobalConfigPath();if(!a51_0x5b373c[_0x2e18d9(0xcc)](_0x1e1811))throw new Error(_0x2e18d9(0xc6)+_0x12ab6e+_0x2e18d9(0xbd));let _0x231a14={};try{const _0x51c7f5=a51_0x5b373c[_0x2e18d9(0xda)](_0x1e1811,_0x2e18d9(0xd7));_0x231a14=JSON[_0x2e18d9(0xe7)](_0x51c7f5);}catch{throw new Error(_0x2e18d9(0xd9)+_0x1e1811);}if(!_0x231a14['profiles']||!_0x231a14['profiles'][_0x12ab6e])throw new Error(_0x2e18d9(0xc6)+_0x12ab6e+_0x2e18d9(0xbd));delete _0x231a14['profiles'][_0x12ab6e],_0x231a14['profile']===_0x12ab6e&&delete _0x231a14[_0x2e18d9(0xfb)],writeSecureFile(_0x1e1811,JSON[_0x2e18d9(0xcf)](_0x231a14,null,0x2));}export function getActiveProfile(){const _0x35c528=a51_0x57c2e6,_0x292bc6=loadSessionContext();if(_0x292bc6?.[_0x35c528(0xfb)])return _0x292bc6[_0x35c528(0xfb)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x22a721=getGlobalConfigPath();if(!a51_0x5b373c[_0x35c528(0xcc)](_0x22a721))return null;try{const _0x3295d7=a51_0x5b373c[_0x35c528(0xda)](_0x22a721,_0x35c528(0xd7)),_0x47dd46=JSON['parse'](_0x3295d7);return _0x47dd46['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x3f47ac){const _0xfd4f3=a51_0x57c2e6,_0x5616c6=getGlobalConfigPath(),_0x5df330=getConfigDir();!a51_0x5b373c[_0xfd4f3(0xcc)](_0x5df330)&&createSecureDirectory(_0x5df330);let _0x2dd062={};if(a51_0x5b373c[_0xfd4f3(0xcc)](_0x5616c6))try{const _0x482f63=a51_0x5b373c[_0xfd4f3(0xda)](_0x5616c6,'utf-8');_0x2dd062=JSON[_0xfd4f3(0xe7)](_0x482f63);}catch{console[_0xfd4f3(0xd5)](_0xfd4f3(0xba)+_0x5616c6+',\x20creating\x20new\x20file');}_0x2dd062[_0xfd4f3(0xdf)]=_0x3f47ac,writeSecureFile(_0x5616c6,JSON[_0xfd4f3(0xcf)](_0x2dd062,null,0x2));}export function saveActiveProfileToUserConfig(_0x3d748d){const _0x10db33=a51_0x57c2e6;validateProfileName(_0x3d748d);const _0x449d24=getGlobalConfigPath(),_0x5c65dd=getConfigDir();!a51_0x5b373c[_0x10db33(0xcc)](_0x5c65dd)&&createSecureDirectory(_0x5c65dd);let _0x545b4a={};if(a51_0x5b373c['existsSync'](_0x449d24))try{const _0x4855a5=a51_0x5b373c[_0x10db33(0xda)](_0x449d24,_0x10db33(0xd7));_0x545b4a=JSON[_0x10db33(0xe7)](_0x4855a5);}catch{console[_0x10db33(0xd5)](_0x10db33(0xba)+_0x449d24+_0x10db33(0xb8));}_0x545b4a[_0x10db33(0xfb)]=_0x3d748d,writeSecureFile(_0x449d24,JSON['stringify'](_0x545b4a,null,0x2));}function clearFieldFromUserConfig(_0x13975e){const _0x461e6b=a51_0x57c2e6,_0x222f54=getGlobalConfigPath();if(!a51_0x5b373c[_0x461e6b(0xcc)](_0x222f54))return;let _0x41e89b={};try{const _0x1aa121=a51_0x5b373c['readFileSync'](_0x222f54,_0x461e6b(0xd7));_0x41e89b=JSON[_0x461e6b(0xe7)](_0x1aa121);}catch{return;}delete _0x41e89b[_0x13975e],writeSecureFile(_0x222f54,JSON[_0x461e6b(0xcf)](_0x41e89b,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x4fb4a7=a51_0x57c2e6;clearFieldFromUserConfig(_0x4fb4a7(0xfb));}function a51_0x45b6(_0x449516,_0xc4b6be){_0x449516=_0x449516-0xac;const _0x3d8886=a51_0x3d88();let _0x45b630=_0x3d8886[_0x449516];return _0x45b630;}export function createProfile(_0x4f9178,_0xb7b589){const _0x17cdc7=a51_0x57c2e6;validateProfileName(_0x4f9178);if(profileExists(_0x4f9178))throw new Error('Profile\x20'+_0x4f9178+_0x17cdc7(0xef));saveProfile(_0x4f9178,_0xb7b589);}export function saveProfileCredentials(_0x556121,_0x3964b5){const _0x2a0f34=a51_0x57c2e6;validateProfileName(_0x556121);if(!profileExists(_0x556121))throw new Error('Profile\x20'+_0x556121+_0x2a0f34(0xd2));const _0x5a9b54=getNewCredentialPath(_0x556121);writeSecureFile(_0x5a9b54,_0x3964b5);}export function loadProfileCredentials(_0x50291e){const _0x148a36=a51_0x57c2e6;validateProfileName(_0x50291e);const _0x42bde5=getNewCredentialPath(_0x50291e);if(a51_0x5b373c[_0x148a36(0xcc)](_0x42bde5))try{return a51_0x5b373c['readFileSync'](_0x42bde5,_0x148a36(0xd7));}catch{}const _0x555d44=getOldCredentialPath(_0x50291e);if(a51_0x5b373c['existsSync'](_0x555d44)){console[_0x148a36(0xd5)](_0x148a36(0xe3)+_0x50291e+'\x27'),console[_0x148a36(0xd5)](_0x148a36(0xe8)),console[_0x148a36(0xd5)](_0x148a36(0xc0)+_0x555d44+_0x148a36(0xf9)+_0x42bde5+'\x22'),console[_0x148a36(0xd5)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a51_0x5b373c[_0x148a36(0xda)](_0x555d44,_0x148a36(0xd7));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a52_0x127460=a52_0x2955;(function(_0x5da879,_0x2d581d){const _0x359475=a52_0x2955,_0x423039=_0x5da879();while(!![]){try{const _0x5514f3=-parseInt(_0x359475(0x1c9))/0x1*(parseInt(_0x359475(0x1b6))/0x2)+parseInt(_0x359475(0x1c4))/0x3+parseInt(_0x359475(0x1b9))/0x4+-parseInt(_0x359475(0x1b5))/0x5+-parseInt(_0x359475(0x1ca))/0x6*(parseInt(_0x359475(0x1cc))/0x7)+parseInt(_0x359475(0x1bc))/0x8+parseInt(_0x359475(0x1be))/0x9;if(_0x5514f3===_0x2d581d)break;else _0x423039['push'](_0x423039['shift']());}catch(_0x136cd8){_0x423039['push'](_0x423039['shift']());}}}(a52_0x4322,0xb0a43));import*as a52_0x479d43 from'node:fs';function a52_0x2955(_0x40bad3,_0x27f129){_0x40bad3=_0x40bad3-0x1b1;const _0x432254=a52_0x4322();let _0x29556a=_0x432254[_0x40bad3];return _0x29556a;}import*as a52_0x13f3d7 from'node:path';function a52_0x4322(){const _0x1ccdc3=['TD_API_KEY','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','join','apiKey','3094353gAgcYu','dirname','\x20is\x20ignored.\x20','includes','code','424159yMhDUh','66YVhSoL','Failed\x20to\x20load\x20project\x20config\x20from\x20','740621jxpsGH','ENOENT','cwd','writeFileSync','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','profile','readFileSync','1715750Vgclfj','2baAEoy','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','tdx.json','1136260yEWZyG','existsSync','stringify','5679208kSQuXD','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','5663232RxSWbi','utf-8'];a52_0x4322=function(){return _0x1ccdc3;};return a52_0x4322();}const PROJECT_CONFIG_FILENAME=a52_0x127460(0x1b8);export function findProjectConfigPath(_0x3cb830){const _0x57a1b5=a52_0x127460;let _0x37358b=_0x3cb830||process[_0x57a1b5(0x1ce)]();while(!![]){const _0x4023a7=a52_0x13f3d7[_0x57a1b5(0x1c2)](_0x37358b,PROJECT_CONFIG_FILENAME);if(a52_0x479d43[_0x57a1b5(0x1ba)](_0x4023a7))return _0x4023a7;const _0x15fead=a52_0x13f3d7['dirname'](_0x37358b);if(_0x15fead===_0x37358b)return null;_0x37358b=_0x15fead;}}export function loadProjectConfig(_0xade97b){const _0x2989dd=a52_0x127460,_0x29fb96=findProjectConfigPath(_0xade97b);if(!_0x29fb96)return null;try{const _0x518ad7=a52_0x479d43[_0x2989dd(0x1b4)](_0x29fb96,_0x2989dd(0x1bf)),_0x38443e=JSON['parse'](_0x518ad7),_0x2610f7=JSON[_0x2989dd(0x1bb)](_0x38443e);if(_0x2610f7[_0x2989dd(0x1c7)](_0x2989dd(0x1c0))||_0x2610f7[_0x2989dd(0x1c7)](_0x2989dd(0x1c3))||_0x2610f7[_0x2989dd(0x1c7)]('api_key'))throw new Error(_0x2989dd(0x1b7)+_0x29fb96+').\x20'+_0x2989dd(0x1c1));const {metadata:_0x5721a1,profile:_0x3f46f7,..._0x5c78e4}=_0x38443e;return _0x3f46f7&&console['warn']('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x29fb96+_0x2989dd(0x1c6)+_0x2989dd(0x1b2)),_0x5c78e4;}catch(_0x26175d){if(_0x26175d instanceof Error&&_0x2989dd(0x1c8)in _0x26175d&&_0x26175d['code']===_0x2989dd(0x1cd))return null;throw new Error(_0x2989dd(0x1cb)+_0x29fb96+':\x20'+_0x26175d);}}export function saveProjectConfig(_0x19da7e,_0x43e338){const _0x26628b=a52_0x127460,_0xcf2d1c=_0x43e338||process['cwd'](),_0x5ac860=a52_0x13f3d7[_0x26628b(0x1c2)](_0xcf2d1c,PROJECT_CONFIG_FILENAME),_0x25df9c=JSON[_0x26628b(0x1bb)](_0x19da7e);if(_0x25df9c[_0x26628b(0x1c7)](_0x26628b(0x1c0))||_0x25df9c[_0x26628b(0x1c7)]('apiKey')||_0x25df9c['includes']('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x26628b(0x1b3)in _0x19da7e)throw new Error(_0x26628b(0x1bd));a52_0x479d43[_0x26628b(0x1b1)](_0x5ac860,JSON[_0x26628b(0x1bb)](_0x19da7e,null,0x2));}export function hasProjectConfig(_0x4017a9){return findProjectConfigPath(_0x4017a9)!==null;}export function getProjectRoot(_0x373a37){const _0x4ea8a9=a52_0x127460,_0x48ca9d=findProjectConfigPath(_0x373a37);return _0x48ca9d?a52_0x13f3d7[_0x4ea8a9(0x1c5)](_0x48ca9d):null;}
1
+ function a52_0x3bd3(_0xf8818e,_0xbc5dd9){_0xf8818e=_0xf8818e-0xed;const _0x381788=a52_0x3817();let _0x3bd3cc=_0x381788[_0xf8818e];return _0x3bd3cc;}const a52_0x140227=a52_0x3bd3;(function(_0x5a86c3,_0x1b27bd){const _0x4c4d42=a52_0x3bd3,_0x4a6ba2=_0x5a86c3();while(!![]){try{const _0x4be195=parseInt(_0x4c4d42(0xf9))/0x1*(-parseInt(_0x4c4d42(0x10c))/0x2)+parseInt(_0x4c4d42(0x107))/0x3+parseInt(_0x4c4d42(0x101))/0x4*(parseInt(_0x4c4d42(0xfa))/0x5)+parseInt(_0x4c4d42(0xff))/0x6+parseInt(_0x4c4d42(0x103))/0x7+-parseInt(_0x4c4d42(0xf2))/0x8*(-parseInt(_0x4c4d42(0x102))/0x9)+-parseInt(_0x4c4d42(0xf0))/0xa*(parseInt(_0x4c4d42(0x105))/0xb);if(_0x4be195===_0x1b27bd)break;else _0x4a6ba2['push'](_0x4a6ba2['shift']());}catch(_0x23ea1f){_0x4a6ba2['push'](_0x4a6ba2['shift']());}}}(a52_0x3817,0x36e60));import*as a52_0x43bd15 from'node:fs';import*as a52_0x512fee from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x140227(0xf4);export function findProjectConfigPath(_0xf076aa){const _0x5dfe3e=a52_0x140227;let _0x222cfb=_0xf076aa||process[_0x5dfe3e(0x10a)]();while(!![]){const _0x34c22e=a52_0x512fee[_0x5dfe3e(0xee)](_0x222cfb,PROJECT_CONFIG_FILENAME);if(a52_0x43bd15[_0x5dfe3e(0xf8)](_0x34c22e))return _0x34c22e;const _0x57a296=a52_0x512fee['dirname'](_0x222cfb);if(_0x57a296===_0x222cfb)return null;_0x222cfb=_0x57a296;}}export function loadProjectConfig(_0x7a6fd2){const _0x45a6dc=a52_0x140227,_0x188878=findProjectConfigPath(_0x7a6fd2);if(!_0x188878)return null;try{const _0x1d8e66=a52_0x43bd15[_0x45a6dc(0xf5)](_0x188878,_0x45a6dc(0xf1)),_0x551782=JSON[_0x45a6dc(0xfb)](_0x1d8e66),_0x43d7df=JSON[_0x45a6dc(0xfe)](_0x551782);if(_0x43d7df[_0x45a6dc(0x10b)](_0x45a6dc(0xef))||_0x43d7df[_0x45a6dc(0x10b)](_0x45a6dc(0xf6))||_0x43d7df[_0x45a6dc(0x10b)](_0x45a6dc(0x10d)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x188878+').\x20'+_0x45a6dc(0xfc));const {metadata:_0x18dde4,profile:_0x298e83,..._0x31da8d}=_0x551782;return _0x298e83&&console[_0x45a6dc(0xfd)](_0x45a6dc(0x104)+_0x188878+_0x45a6dc(0x108)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x31da8d;}catch(_0x4a1d39){if(_0x4a1d39 instanceof Error&&_0x45a6dc(0xed)in _0x4a1d39&&_0x4a1d39[_0x45a6dc(0xed)]==='ENOENT')return null;throw new Error(_0x45a6dc(0xf7)+_0x188878+':\x20'+_0x4a1d39);}}function a52_0x3817(){const _0x515570=['profile','cwd','includes','18gBQJMq','api_key','code','join','TD_API_KEY','170SLDjru','utf-8','104yuuDWk','dirname','tdx.json','readFileSync','apiKey','Failed\x20to\x20load\x20project\x20config\x20from\x20','existsSync','27143BksYgy','171655lrZUUz','parse','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','warn','stringify','412836RvquWi','writeFileSync','28dmlRSM','144198TsJxcw','254429pMLxyl','Warning:\x20\x27profile\x27\x20field\x20in\x20','286913LZgFKa','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','1076418XGEXtd','\x20is\x20ignored.\x20'];a52_0x3817=function(){return _0x515570;};return a52_0x3817();}export function saveProjectConfig(_0x358e7f,_0x27d2b5){const _0x488151=a52_0x140227,_0x5574ae=_0x27d2b5||process[_0x488151(0x10a)](),_0x49124f=a52_0x512fee[_0x488151(0xee)](_0x5574ae,PROJECT_CONFIG_FILENAME),_0x762282=JSON[_0x488151(0xfe)](_0x358e7f);if(_0x762282[_0x488151(0x10b)](_0x488151(0xef))||_0x762282[_0x488151(0x10b)](_0x488151(0xf6))||_0x762282['includes'](_0x488151(0x10d)))throw new Error(_0x488151(0x106));if(_0x488151(0x109)in _0x358e7f)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a52_0x43bd15[_0x488151(0x100)](_0x49124f,JSON[_0x488151(0xfe)](_0x358e7f,null,0x2));}export function hasProjectConfig(_0x1956f1){return findProjectConfigPath(_0x1956f1)!==null;}export function getProjectRoot(_0x54dc2e){const _0x34dbe1=a52_0x140227,_0x5d392b=findProjectConfigPath(_0x54dc2e);return _0x5d392b?a52_0x512fee[_0x34dbe1(0xf3)](_0x5d392b):null;}
@@ -1 +1 @@
1
- (function(_0x2f635a,_0x41e1c6){const _0xb794dd=a53_0xc808,_0xedaf97=_0x2f635a();while(!![]){try{const _0x23c4cc=parseInt(_0xb794dd(0xeb))/0x1*(parseInt(_0xb794dd(0xdc))/0x2)+parseInt(_0xb794dd(0xe3))/0x3*(parseInt(_0xb794dd(0xdb))/0x4)+parseInt(_0xb794dd(0xdd))/0x5+parseInt(_0xb794dd(0xd7))/0x6+-parseInt(_0xb794dd(0xf5))/0x7+parseInt(_0xb794dd(0xe6))/0x8+-parseInt(_0xb794dd(0xf1))/0x9*(parseInt(_0xb794dd(0xe7))/0xa);if(_0x23c4cc===_0x41e1c6)break;else _0xedaf97['push'](_0xedaf97['shift']());}catch(_0xfe65e){_0xedaf97['push'](_0xedaf97['shift']());}}}(a53_0x2e74,0x29e8e));import*as a53_0x26f5d4 from'node:fs';import*as a53_0x3ca0b5 from'node:path';import*as a53_0x2630fb 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 _0x486a4b=a53_0xc808,_0x494718=process.env.TDX_CONFIG_DIR||a53_0x3ca0b5[_0x486a4b(0xd6)](a53_0x2630fb[_0x486a4b(0xe5)](),'.config',_0x486a4b(0xdf));return a53_0x3ca0b5[_0x486a4b(0xd6)](_0x494718,_0x486a4b(0xd3));}function a53_0xc808(_0x569235,_0x2aaf22){_0x569235=_0x569235-0xcf;const _0x2e7404=a53_0x2e74();let _0xc808a6=_0x2e7404[_0x569235];return _0xc808a6;}function getSessionPath(_0x21b41d){const _0x2cee81=a53_0xc808;return a53_0x3ca0b5[_0x2cee81(0xd6)](getSessionsDir(),_0x21b41d+_0x2cee81(0xcf));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x3d310e){if(_0x3d310e)return _0x3d310e;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x5438d1){const _0x142205=a53_0xc808,_0x4a568=getSessionID(_0x5438d1),_0x716b75=/^\d+$/[_0x142205(0xde)](_0x4a568)?parseInt(_0x4a568,0xa):null;return _0x716b75!==null?loadSessionContextByPID(_0x716b75):loadSessionContextByString(_0x4a568);}export function loadSessionContextByPID(_0x8b8d83){const _0x294eb5=a53_0xc808,_0x2ae9e6=getSessionPath(_0x8b8d83);if(!a53_0x26f5d4[_0x294eb5(0xd8)](_0x2ae9e6))return null;try{const _0x270de7=a53_0x26f5d4[_0x294eb5(0xec)](_0x2ae9e6,_0x294eb5(0xd2)),_0xfa8e20=JSON[_0x294eb5(0xed)](_0x270de7),_0xec4a65=new Date(_0xfa8e20[_0x294eb5(0xe1)])[_0x294eb5(0xf0)](),_0x4f24c4=Date[_0x294eb5(0xd1)]();if(_0x4f24c4-_0xec4a65>SESSION_EXPIRATION_MS)return a53_0x26f5d4[_0x294eb5(0xd9)](_0x2ae9e6),null;const _0x22cc38=JSON[_0x294eb5(0xd4)](_0xfa8e20);if(_0x22cc38[_0x294eb5(0xf4)]('TD_API_KEY')||_0x22cc38[_0x294eb5(0xf4)](_0x294eb5(0xe4))||_0x22cc38[_0x294eb5(0xf4)]('api_key'))return console['warn'](_0x294eb5(0xd0)+_0x2ae9e6+_0x294eb5(0xe8)),a53_0x26f5d4[_0x294eb5(0xd9)](_0x2ae9e6),null;return _0xfa8e20;}catch{try{a53_0x26f5d4[_0x294eb5(0xd9)](_0x2ae9e6);}catch{}return null;}}function loadSessionContextByString(_0x35ec17){const _0x42d383=a53_0xc808,_0x4e683b=a53_0x3ca0b5[_0x42d383(0xd6)](getSessionsDir(),_0x35ec17+_0x42d383(0xcf));if(!a53_0x26f5d4['existsSync'](_0x4e683b))return null;try{const _0x29861f=a53_0x26f5d4['readFileSync'](_0x4e683b,'utf-8'),_0x3d4371=JSON[_0x42d383(0xed)](_0x29861f),_0x3a3ede=new Date(_0x3d4371[_0x42d383(0xe1)])[_0x42d383(0xf0)](),_0xb59bbf=Date['now']();if(_0xb59bbf-_0x3a3ede>SESSION_EXPIRATION_MS)return a53_0x26f5d4['unlinkSync'](_0x4e683b),null;const _0x4a6d93=JSON['stringify'](_0x3d4371);if(_0x4a6d93[_0x42d383(0xf4)](_0x42d383(0xd5))||_0x4a6d93[_0x42d383(0xf4)](_0x42d383(0xe4))||_0x4a6d93[_0x42d383(0xf4)](_0x42d383(0xf2)))return console['warn'](_0x42d383(0xd0)+_0x4e683b+_0x42d383(0xe8)),a53_0x26f5d4[_0x42d383(0xd9)](_0x4e683b),null;return _0x3d4371;}catch{try{a53_0x26f5d4[_0x42d383(0xd9)](_0x4e683b);}catch{}return null;}}function a53_0x2e74(){const _0x43bcae=['getTime','128160hExthz','api_key','toString','includes','164654LMRGpT','.json','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','now','utf-8','sessions','stringify','TD_API_KEY','join','998532dDUDzK','existsSync','unlinkSync','endsWith','642748TJxdZT','112474ZtgrkQ','539605mIVtiP','test','tdx','readdirSync','createdAt','replace','6PEvoBo','apiKey','homedir','1364104xKKxtU','480YKdPDZ','.\x20This\x20is\x20insecure.\x20Removing\x20session.','toISOString','sort','2iPxYkk','readFileSync','parse','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','writeFileSync'];a53_0x2e74=function(){return _0x43bcae;};return a53_0x2e74();}export function saveSessionContext(_0x44cac8,_0x311a25){const _0x469728=a53_0xc808,_0x5ad559=getSessionID(_0x311a25),_0x5f084b=/^\d+$/['test'](_0x5ad559)?parseInt(_0x5ad559,0xa):getCurrentSessionPID(),_0x32109a=a53_0x3ca0b5[_0x469728(0xd6)](getSessionsDir(),_0x5ad559+_0x469728(0xcf)),_0x1839ef=getSessionsDir();createSecureDirectory(_0x1839ef);const _0x33595b=JSON[_0x469728(0xd4)](_0x44cac8);if(_0x33595b[_0x469728(0xf4)](_0x469728(0xd5))||_0x33595b[_0x469728(0xf4)](_0x469728(0xe4))||_0x33595b[_0x469728(0xf4)](_0x469728(0xf2)))throw new Error(_0x469728(0xee));let _0x5bd34e;const _0x134d72=/^\d+$/[_0x469728(0xde)](_0x5ad559)?loadSessionContextByPID(parseInt(_0x5ad559,0xa)):loadSessionContextByString(_0x5ad559);_0x134d72?_0x5bd34e={..._0x134d72,..._0x44cac8,'pid':_0x5f084b,'sessionId':_0x5ad559!==_0x5f084b[_0x469728(0xf3)]()?_0x5ad559:undefined,'updatedAt':new Date()[_0x469728(0xe9)]()}:_0x5bd34e={'pid':_0x5f084b,'sessionId':_0x5ad559!==_0x5f084b[_0x469728(0xf3)]()?_0x5ad559:undefined,..._0x44cac8,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()['toISOString']()},a53_0x26f5d4[_0x469728(0xef)](_0x32109a,JSON['stringify'](_0x5bd34e,null,0x2));}export function clearSessionContext(_0x50d689){const _0x5bc872=a53_0xc808,_0x19f80c=getSessionID(_0x50d689),_0x248124=a53_0x3ca0b5[_0x5bc872(0xd6)](getSessionsDir(),_0x19f80c+'.json');a53_0x26f5d4[_0x5bc872(0xd8)](_0x248124)&&a53_0x26f5d4[_0x5bc872(0xd9)](_0x248124);}export function clearSessionContextField(_0x4b7ef0,_0x4869db){const _0x34bd62=a53_0xc808,_0x274343=getSessionID(_0x4869db),_0x16c124=a53_0x3ca0b5[_0x34bd62(0xd6)](getSessionsDir(),_0x274343+_0x34bd62(0xcf));if(!a53_0x26f5d4[_0x34bd62(0xd8)](_0x16c124))return;try{const _0x240978=a53_0x26f5d4[_0x34bd62(0xec)](_0x16c124,_0x34bd62(0xd2)),_0x2f6ae=JSON[_0x34bd62(0xed)](_0x240978);delete _0x2f6ae[_0x4b7ef0],a53_0x26f5d4[_0x34bd62(0xef)](_0x16c124,JSON[_0x34bd62(0xd4)](_0x2f6ae,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x4209ab=a53_0xc808,_0x46ab04=getSessionsDir();if(!a53_0x26f5d4['existsSync'](_0x46ab04))return 0x0;let _0x21493c=0x0;const _0x4f0c3c=Date[_0x4209ab(0xd1)]();try{const _0x6581da=a53_0x26f5d4[_0x4209ab(0xe0)](_0x46ab04);for(const _0xd47c8b of _0x6581da){if(!_0xd47c8b[_0x4209ab(0xda)](_0x4209ab(0xcf)))continue;const _0x137495=a53_0x3ca0b5[_0x4209ab(0xd6)](_0x46ab04,_0xd47c8b),_0x45c0b7=_0xd47c8b[_0x4209ab(0xe2)](_0x4209ab(0xcf),''),_0x19f492=parseInt(_0x45c0b7,0xa),_0xed079c=!isNaN(_0x19f492);if(_0xed079c){if(!isProcessRunning(_0x19f492)){a53_0x26f5d4[_0x4209ab(0xd9)](_0x137495),_0x21493c++;continue;}}try{const _0x44a428=a53_0x26f5d4[_0x4209ab(0xec)](_0x137495,_0x4209ab(0xd2)),_0xf19bcb=JSON['parse'](_0x44a428),_0x4f3263=new Date(_0xf19bcb['createdAt'])['getTime']();_0x4f0c3c-_0x4f3263>SESSION_EXPIRATION_MS&&(a53_0x26f5d4[_0x4209ab(0xd9)](_0x137495),_0x21493c++);}catch{a53_0x26f5d4[_0x4209ab(0xd9)](_0x137495),_0x21493c++;}}}catch{}return _0x21493c;}export function listActiveSessions(){const _0x54bc40=a53_0xc808,_0x317dae=getSessionsDir();if(!a53_0x26f5d4[_0x54bc40(0xd8)](_0x317dae))return[];try{const _0x17f820=a53_0x26f5d4[_0x54bc40(0xe0)](_0x317dae),_0x3110dd=[];for(const _0x3d3751 of _0x17f820){if(!_0x3d3751[_0x54bc40(0xda)]('.json'))continue;const _0xa09755=_0x3d3751['replace'](_0x54bc40(0xcf),''),_0x5c60f7=parseInt(_0xa09755,0xa);!isNaN(_0x5c60f7)&&isProcessRunning(_0x5c60f7)&&_0x3110dd['push'](_0x5c60f7);}return _0x3110dd[_0x54bc40(0xea)]((_0x3dbf67,_0x192cde)=>_0x3dbf67-_0x192cde);}catch{return[];}}
1
+ (function(_0x16fd7a,_0x573880){const _0x550ccb=a53_0x2075,_0x3459cd=_0x16fd7a();while(!![]){try{const _0x44c383=parseInt(_0x550ccb(0xd3))/0x1*(parseInt(_0x550ccb(0xf2))/0x2)+-parseInt(_0x550ccb(0xea))/0x3+parseInt(_0x550ccb(0xe0))/0x4*(-parseInt(_0x550ccb(0xcf))/0x5)+parseInt(_0x550ccb(0xda))/0x6*(parseInt(_0x550ccb(0xdf))/0x7)+parseInt(_0x550ccb(0xd6))/0x8*(-parseInt(_0x550ccb(0xd2))/0x9)+parseInt(_0x550ccb(0xe9))/0xa+parseInt(_0x550ccb(0xd7))/0xb;if(_0x44c383===_0x573880)break;else _0x3459cd['push'](_0x3459cd['shift']());}catch(_0x343cc7){_0x3459cd['push'](_0x3459cd['shift']());}}}(a53_0x495e,0x7402f));import*as a53_0x5e80fb from'node:fs';import*as a53_0x1e6b3f from'node:path';import*as a53_0x1ce2cd 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 _0x12b818=a53_0x2075,_0x421e86=process.env.TDX_CONFIG_DIR||a53_0x1e6b3f[_0x12b818(0xd5)](a53_0x1ce2cd[_0x12b818(0xe5)](),_0x12b818(0xd4),_0x12b818(0xe3));return a53_0x1e6b3f[_0x12b818(0xd5)](_0x421e86,_0x12b818(0xeb));}function getSessionPath(_0x55dd72){const _0x57cf36=a53_0x2075;return a53_0x1e6b3f[_0x57cf36(0xd5)](getSessionsDir(),_0x55dd72+_0x57cf36(0xed));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x36900e){const _0x4bdca7=a53_0x2075;if(_0x36900e)return _0x36900e;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x4bdca7(0xd8)]();}export function loadSessionContext(_0x175ddb){const _0x4f9494=getSessionID(_0x175ddb),_0x4a14ab=/^\d+$/['test'](_0x4f9494)?parseInt(_0x4f9494,0xa):null;return _0x4a14ab!==null?loadSessionContextByPID(_0x4a14ab):loadSessionContextByString(_0x4f9494);}function a53_0x495e(){const _0x1e15a7=['1950909ZaeaAP','sessions','getTime','.json','api_key','utf-8','.\x20This\x20is\x20insecure.\x20Removing\x20session.','endsWith','172RPJxBQ','readFileSync','warn','now','1191535JRAafN','writeFileSync','toISOString','27jzWjTX','2611AQoefc','.config','join','628072NNvzKY','5486305vyBCLw','toString','createdAt','2778DwYAOt','stringify','parse','test','existsSync','1155mEIVkK','4YtMWXE','apiKey','includes','tdx','unlinkSync','homedir','TD_API_KEY','readdirSync','sort','7996240GvRIrr'];a53_0x495e=function(){return _0x1e15a7;};return a53_0x495e();}export function loadSessionContextByPID(_0x5f4392){const _0x455d94=a53_0x2075,_0x4f4fc6=getSessionPath(_0x5f4392);if(!a53_0x5e80fb[_0x455d94(0xde)](_0x4f4fc6))return null;try{const _0x3b766e=a53_0x5e80fb[_0x455d94(0xcc)](_0x4f4fc6,_0x455d94(0xef)),_0x1e023a=JSON['parse'](_0x3b766e),_0x25cb7b=new Date(_0x1e023a[_0x455d94(0xd9)])['getTime'](),_0x2ec5b0=Date['now']();if(_0x2ec5b0-_0x25cb7b>SESSION_EXPIRATION_MS)return a53_0x5e80fb[_0x455d94(0xe4)](_0x4f4fc6),null;const _0x496007=JSON['stringify'](_0x1e023a);if(_0x496007['includes'](_0x455d94(0xe6))||_0x496007['includes'](_0x455d94(0xe1))||_0x496007[_0x455d94(0xe2)](_0x455d94(0xee)))return console[_0x455d94(0xcd)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x4f4fc6+_0x455d94(0xf0)),a53_0x5e80fb[_0x455d94(0xe4)](_0x4f4fc6),null;return _0x1e023a;}catch{try{a53_0x5e80fb[_0x455d94(0xe4)](_0x4f4fc6);}catch{}return null;}}function loadSessionContextByString(_0x2e5643){const _0x1ea405=a53_0x2075,_0xe3ed5d=a53_0x1e6b3f['join'](getSessionsDir(),_0x2e5643+_0x1ea405(0xed));if(!a53_0x5e80fb['existsSync'](_0xe3ed5d))return null;try{const _0xb9c7d1=a53_0x5e80fb['readFileSync'](_0xe3ed5d,_0x1ea405(0xef)),_0x1a5fa4=JSON[_0x1ea405(0xdc)](_0xb9c7d1),_0x24560d=new Date(_0x1a5fa4[_0x1ea405(0xd9)])[_0x1ea405(0xec)](),_0x3d6b7c=Date[_0x1ea405(0xce)]();if(_0x3d6b7c-_0x24560d>SESSION_EXPIRATION_MS)return a53_0x5e80fb[_0x1ea405(0xe4)](_0xe3ed5d),null;const _0x3b4900=JSON[_0x1ea405(0xdb)](_0x1a5fa4);if(_0x3b4900[_0x1ea405(0xe2)](_0x1ea405(0xe6))||_0x3b4900[_0x1ea405(0xe2)]('apiKey')||_0x3b4900[_0x1ea405(0xe2)]('api_key'))return console[_0x1ea405(0xcd)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0xe3ed5d+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a53_0x5e80fb[_0x1ea405(0xe4)](_0xe3ed5d),null;return _0x1a5fa4;}catch{try{a53_0x5e80fb['unlinkSync'](_0xe3ed5d);}catch{}return null;}}export function saveSessionContext(_0x6306db,_0x2aa4b6){const _0x2d3d58=a53_0x2075,_0x364f00=getSessionID(_0x2aa4b6),_0x4dbc0c=/^\d+$/[_0x2d3d58(0xdd)](_0x364f00)?parseInt(_0x364f00,0xa):getCurrentSessionPID(),_0x6ed0d3=a53_0x1e6b3f[_0x2d3d58(0xd5)](getSessionsDir(),_0x364f00+_0x2d3d58(0xed)),_0x555f4c=getSessionsDir();createSecureDirectory(_0x555f4c);const _0x5858f7=JSON[_0x2d3d58(0xdb)](_0x6306db);if(_0x5858f7['includes'](_0x2d3d58(0xe6))||_0x5858f7['includes']('apiKey')||_0x5858f7[_0x2d3d58(0xe2)](_0x2d3d58(0xee)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x48900e;const _0x4b56d6=/^\d+$/[_0x2d3d58(0xdd)](_0x364f00)?loadSessionContextByPID(parseInt(_0x364f00,0xa)):loadSessionContextByString(_0x364f00);_0x4b56d6?_0x48900e={..._0x4b56d6,..._0x6306db,'pid':_0x4dbc0c,'sessionId':_0x364f00!==_0x4dbc0c[_0x2d3d58(0xd8)]()?_0x364f00:undefined,'updatedAt':new Date()['toISOString']()}:_0x48900e={'pid':_0x4dbc0c,'sessionId':_0x364f00!==_0x4dbc0c[_0x2d3d58(0xd8)]()?_0x364f00:undefined,..._0x6306db,'createdAt':new Date()[_0x2d3d58(0xd1)](),'updatedAt':new Date()[_0x2d3d58(0xd1)]()},a53_0x5e80fb[_0x2d3d58(0xd0)](_0x6ed0d3,JSON[_0x2d3d58(0xdb)](_0x48900e,null,0x2));}function a53_0x2075(_0x27aed2,_0xd02947){_0x27aed2=_0x27aed2-0xcc;const _0x495e19=a53_0x495e();let _0x2075c6=_0x495e19[_0x27aed2];return _0x2075c6;}export function clearSessionContext(_0x3f48c7){const _0xa285ee=a53_0x2075,_0x40374b=getSessionID(_0x3f48c7),_0x452ee4=a53_0x1e6b3f[_0xa285ee(0xd5)](getSessionsDir(),_0x40374b+_0xa285ee(0xed));a53_0x5e80fb[_0xa285ee(0xde)](_0x452ee4)&&a53_0x5e80fb[_0xa285ee(0xe4)](_0x452ee4);}export function clearSessionContextField(_0x3e77f2,_0x3db9f0){const _0x27aed0=a53_0x2075,_0x134e6b=getSessionID(_0x3db9f0),_0x307f43=a53_0x1e6b3f[_0x27aed0(0xd5)](getSessionsDir(),_0x134e6b+_0x27aed0(0xed));if(!a53_0x5e80fb['existsSync'](_0x307f43))return;try{const _0xa9d710=a53_0x5e80fb[_0x27aed0(0xcc)](_0x307f43,_0x27aed0(0xef)),_0x75215d=JSON[_0x27aed0(0xdc)](_0xa9d710);delete _0x75215d[_0x3e77f2],a53_0x5e80fb[_0x27aed0(0xd0)](_0x307f43,JSON['stringify'](_0x75215d,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x4a72dd=a53_0x2075,_0x410d47=getSessionsDir();if(!a53_0x5e80fb[_0x4a72dd(0xde)](_0x410d47))return 0x0;let _0x12fcc8=0x0;const _0x1ce534=Date[_0x4a72dd(0xce)]();try{const _0x5d928c=a53_0x5e80fb['readdirSync'](_0x410d47);for(const _0xe79101 of _0x5d928c){if(!_0xe79101[_0x4a72dd(0xf1)](_0x4a72dd(0xed)))continue;const _0xbc263d=a53_0x1e6b3f[_0x4a72dd(0xd5)](_0x410d47,_0xe79101),_0x4c90a6=_0xe79101['replace'](_0x4a72dd(0xed),''),_0x1feb80=parseInt(_0x4c90a6,0xa),_0x18d435=!isNaN(_0x1feb80);if(_0x18d435){if(!isProcessRunning(_0x1feb80)){a53_0x5e80fb[_0x4a72dd(0xe4)](_0xbc263d),_0x12fcc8++;continue;}}try{const _0x4b7a96=a53_0x5e80fb[_0x4a72dd(0xcc)](_0xbc263d,_0x4a72dd(0xef)),_0x384bb1=JSON[_0x4a72dd(0xdc)](_0x4b7a96),_0x48b75d=new Date(_0x384bb1[_0x4a72dd(0xd9)])[_0x4a72dd(0xec)]();_0x1ce534-_0x48b75d>SESSION_EXPIRATION_MS&&(a53_0x5e80fb[_0x4a72dd(0xe4)](_0xbc263d),_0x12fcc8++);}catch{a53_0x5e80fb[_0x4a72dd(0xe4)](_0xbc263d),_0x12fcc8++;}}}catch{}return _0x12fcc8;}export function listActiveSessions(){const _0x58cd08=a53_0x2075,_0x565915=getSessionsDir();if(!a53_0x5e80fb[_0x58cd08(0xde)](_0x565915))return[];try{const _0x4d3234=a53_0x5e80fb[_0x58cd08(0xe7)](_0x565915),_0x255243=[];for(const _0x237f1f of _0x4d3234){if(!_0x237f1f[_0x58cd08(0xf1)](_0x58cd08(0xed)))continue;const _0x4a7013=_0x237f1f['replace']('.json',''),_0x698581=parseInt(_0x4a7013,0xa);!isNaN(_0x698581)&&isProcessRunning(_0x698581)&&_0x255243['push'](_0x698581);}return _0x255243[_0x58cd08(0xe8)]((_0xe795c1,_0x486da6)=>_0xe795c1-_0x486da6);}catch{return[];}}
@@ -1 +1 @@
1
- const a54_0x3e661f=a54_0x3f7a;(function(_0x5bf099,_0xd77fe7){const _0x5de1cd=a54_0x3f7a,_0x551f9f=_0x5bf099();while(!![]){try{const _0x298857=-parseInt(_0x5de1cd(0xc6))/0x1*(-parseInt(_0x5de1cd(0xd0))/0x2)+-parseInt(_0x5de1cd(0xcc))/0x3+-parseInt(_0x5de1cd(0xd6))/0x4+parseInt(_0x5de1cd(0xc9))/0x5+-parseInt(_0x5de1cd(0xd2))/0x6*(parseInt(_0x5de1cd(0xc7))/0x7)+-parseInt(_0x5de1cd(0xd1))/0x8*(-parseInt(_0x5de1cd(0xce))/0x9)+-parseInt(_0x5de1cd(0xcd))/0xa*(-parseInt(_0x5de1cd(0xcf))/0xb);if(_0x298857===_0xd77fe7)break;else _0x551f9f['push'](_0x551f9f['shift']());}catch(_0x360a37){_0x551f9f['push'](_0x551f9f['shift']());}}}(a54_0x11e0,0xe240a));function a54_0x3f7a(_0x5c0339,_0x40a72a){_0x5c0339=_0x5c0339-0xc6;const _0x11e045=a54_0x11e0();let _0x3f7af0=_0x11e045[_0x5c0339];return _0x3f7af0;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a54_0x3e661f(0xd4),a54_0x3e661f(0xc8));export function loadCachedUsers(_0x3522a9){const _0x454593=a54_0x3e661f,_0x1700cf=userCache[_0x454593(0xca)](_0x3522a9);return _0x1700cf?.[_0x454593(0xcb)]??null;}export function saveCachedUsers(_0x1a8092,_0xa13688){const _0x1249e4=a54_0x3e661f;userCache[_0x1249e4(0xd3)](_0x1a8092,{'users':_0xa13688,'cachedAt':Date['now']()});}function a54_0x11e0(){const _0x3f905e=['1884vfbkDf','5679672aNBydz','4450146CnUVpo','write','users-{profile}.json','clear','3586884xBiPYJ','1317CbYDKa','7YTLIGA','core/user-cache','2928520abgtWz','read','users','3819597WAtqjH','5921050UFHmGN','18DVWFJa','11KjWhya'];a54_0x11e0=function(){return _0x3f905e;};return a54_0x11e0();}export function clearUserCache(_0x55f10b){const _0x4be298=a54_0x3e661f;userCache[_0x4be298(0xd5)](_0x55f10b);}
1
+ const a54_0x25402b=a54_0x30eb;(function(_0x29ee55,_0x4233db){const _0x1276a8=a54_0x30eb,_0x5833a4=_0x29ee55();while(!![]){try{const _0x447dc1=parseInt(_0x1276a8(0x120))/0x1+parseInt(_0x1276a8(0x121))/0x2+-parseInt(_0x1276a8(0x118))/0x3*(parseInt(_0x1276a8(0x11b))/0x4)+parseInt(_0x1276a8(0x119))/0x5*(-parseInt(_0x1276a8(0x11d))/0x6)+parseInt(_0x1276a8(0x117))/0x7+-parseInt(_0x1276a8(0x11e))/0x8*(parseInt(_0x1276a8(0x123))/0x9)+-parseInt(_0x1276a8(0x115))/0xa;if(_0x447dc1===_0x4233db)break;else _0x5833a4['push'](_0x5833a4['shift']());}catch(_0x4562f4){_0x5833a4['push'](_0x5833a4['shift']());}}}(a54_0x5c95,0x560bc));import{createProfileCache}from'../utils/global-cache.js';function a54_0x5c95(){const _0x18252e=['4733407tjgSeG','32181Ezkvyx','5edlgSp','core/user-cache','196SQNkpu','users','1696656WNlfKG','56zLXPid','write','591479EbZpgo','1191830YUXQYM','read','471114hiSaLM','clear','3363300sbreHp','users-{profile}.json'];a54_0x5c95=function(){return _0x18252e;};return a54_0x5c95();}const userCache=createProfileCache(a54_0x25402b(0x116),a54_0x25402b(0x11a));export function loadCachedUsers(_0x391753){const _0x523147=a54_0x25402b,_0x443c5b=userCache[_0x523147(0x122)](_0x391753);return _0x443c5b?.[_0x523147(0x11c)]??null;}function a54_0x30eb(_0x180e9e,_0x5d40e8){_0x180e9e=_0x180e9e-0x115;const _0x5c95d1=a54_0x5c95();let _0x30eb02=_0x5c95d1[_0x180e9e];return _0x30eb02;}export function saveCachedUsers(_0x5cb4d2,_0x225ef5){const _0x5bafcd=a54_0x25402b;userCache[_0x5bafcd(0x11f)](_0x5cb4d2,{'users':_0x225ef5,'cachedAt':Date['now']()});}export function clearUserCache(_0x460c93){const _0x6bcb28=a54_0x25402b;userCache[_0x6bcb28(0x124)](_0x460c93);}
@@ -1 +1 @@
1
- (function(_0x5c585e,_0x45a833){const _0x328ed0=a55_0x3cd7,_0x7392c0=_0x5c585e();while(!![]){try{const _0x1f3cb5=parseInt(_0x328ed0(0x14c))/0x1+-parseInt(_0x328ed0(0x152))/0x2+parseInt(_0x328ed0(0x14f))/0x3*(-parseInt(_0x328ed0(0x147))/0x4)+-parseInt(_0x328ed0(0x14d))/0x5*(-parseInt(_0x328ed0(0x154))/0x6)+-parseInt(_0x328ed0(0x153))/0x7*(parseInt(_0x328ed0(0x14b))/0x8)+-parseInt(_0x328ed0(0x14e))/0x9+parseInt(_0x328ed0(0x149))/0xa;if(_0x1f3cb5===_0x45a833)break;else _0x7392c0['push'](_0x7392c0['shift']());}catch(_0x35cd8a){_0x7392c0['push'](_0x7392c0['shift']());}}}(a55_0xc696,0xcb220));import{readFileSync}from'fs';import{fileURLToPath}from'url';function a55_0x3cd7(_0x3cb5de,_0x48c317){_0x3cb5de=_0x3cb5de-0x146;const _0xc69648=a55_0xc696();let _0x3cd7a1=_0xc69648[_0x3cb5de];return _0x3cd7a1;}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x2063bd=a55_0x3cd7;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x9786a3=fileURLToPath(import.meta.url),_0x20700f=dirname(_0x9786a3);try{const _0x198d89=join(_0x20700f,'../build-info.json');cachedBuildInfo=JSON[_0x2063bd(0x148)](readFileSync(_0x198d89,_0x2063bd(0x150)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}function a55_0xc696(){const _0x3861f3=['10501866TTkncn','1468920IcqPBU','utf-8','includes','2413136FkBrHJ','9926idUIkv','1025022kMVEFB','version','../../package.json','12DraSFw','parse','22228210lJjzvx','0.0.0','1512MEjorG','1182042aKoEqn','45QrzDBE'];a55_0xc696=function(){return _0x3861f3;};return a55_0xc696();}export function getVersion(){const _0x430d81=a55_0x3cd7;if(cachedVersion!==null)return cachedVersion;const _0xb0a911=fileURLToPath(import.meta.url),_0x316254=dirname(_0xb0a911),_0x40f642=getBuildInfo();if(_0x40f642[_0x430d81(0x155)])return cachedVersion=_0x40f642[_0x430d81(0x155)],cachedVersion;try{const _0x128a95=join(_0x316254,_0x430d81(0x146)),_0x435a6b=JSON[_0x430d81(0x148)](readFileSync(_0x128a95,_0x430d81(0x150)));cachedVersion=_0x435a6b[_0x430d81(0x155)];}catch{cachedVersion=_0x430d81(0x14a);}return cachedVersion;}export function isDevVersion(){const _0x208975=a55_0x3cd7,_0x59f03b=getVersion();return _0x59f03b[_0x208975(0x151)]('.dev')||_0x59f03b[_0x208975(0x151)]('-');}
1
+ (function(_0x545717,_0x44ad28){const _0x22cf44=a55_0x32cd,_0x105172=_0x545717();while(!![]){try{const _0x677c7d=-parseInt(_0x22cf44(0x10c))/0x1*(-parseInt(_0x22cf44(0x10e))/0x2)+-parseInt(_0x22cf44(0x111))/0x3+-parseInt(_0x22cf44(0x116))/0x4+parseInt(_0x22cf44(0x107))/0x5*(-parseInt(_0x22cf44(0x109))/0x6)+-parseInt(_0x22cf44(0x117))/0x7+-parseInt(_0x22cf44(0x112))/0x8+-parseInt(_0x22cf44(0x113))/0x9*(-parseInt(_0x22cf44(0x114))/0xa);if(_0x677c7d===_0x44ad28)break;else _0x105172['push'](_0x105172['shift']());}catch(_0x4f9f93){_0x105172['push'](_0x105172['shift']());}}}(a55_0x1b3c,0xb382d));import{readFileSync}from'fs';import{fileURLToPath}from'url';function a55_0x1b3c(){const _0x3c0589=['2025924SVAklp','../build-info.json','../../package.json','34mKFmTI','utf-8','61112JpcOUb','.dev','0.0.0','3505278zJhmPu','666936EETslp','666GWGXJd','319070iCtmZq','includes','3048296cYrivi','2192568XrlIAD','version','5pXyPST','parse'];a55_0x1b3c=function(){return _0x3c0589;};return a55_0x1b3c();}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;function a55_0x32cd(_0x49f4d9,_0x318d41){_0x49f4d9=_0x49f4d9-0x106;const _0x1b3c82=a55_0x1b3c();let _0x32cd73=_0x1b3c82[_0x49f4d9];return _0x32cd73;}export function getBuildInfo(){const _0x59e07a=a55_0x32cd;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x2f966e=fileURLToPath(import.meta.url),_0x4e6f4a=dirname(_0x2f966e);try{const _0x28d0f9=join(_0x4e6f4a,_0x59e07a(0x10a));cachedBuildInfo=JSON[_0x59e07a(0x108)](readFileSync(_0x28d0f9,_0x59e07a(0x10d)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x292613=a55_0x32cd;if(cachedVersion!==null)return cachedVersion;const _0x3033f6=fileURLToPath(import.meta.url),_0x8b6b28=dirname(_0x3033f6),_0x59629c=getBuildInfo();if(_0x59629c['version'])return cachedVersion=_0x59629c[_0x292613(0x106)],cachedVersion;try{const _0x70838=join(_0x8b6b28,_0x292613(0x10b)),_0x3cd2c6=JSON[_0x292613(0x108)](readFileSync(_0x70838,_0x292613(0x10d)));cachedVersion=_0x3cd2c6[_0x292613(0x106)];}catch{cachedVersion=_0x292613(0x110);}return cachedVersion;}export function isDevVersion(){const _0x23c14b=a55_0x32cd,_0x14c825=getVersion();return _0x14c825[_0x23c14b(0x115)](_0x23c14b(0x10f))||_0x14c825[_0x23c14b(0x115)]('-');}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0xd9049f,_0x366caa){var _0x59384c=a56_0x549d,_0x4965aa=_0xd9049f();while(!![]){try{var _0x4c9511=-parseInt(_0x59384c(0x11c))/0x1+-parseInt(_0x59384c(0x11a))/0x2*(parseInt(_0x59384c(0x11d))/0x3)+parseInt(_0x59384c(0x119))/0x4*(-parseInt(_0x59384c(0x11f))/0x5)+parseInt(_0x59384c(0x118))/0x6+parseInt(_0x59384c(0x11b))/0x7+parseInt(_0x59384c(0x11e))/0x8*(-parseInt(_0x59384c(0x120))/0x9)+parseInt(_0x59384c(0x122))/0xa*(parseInt(_0x59384c(0x121))/0xb);if(_0x4c9511===_0x366caa)break;else _0x4965aa['push'](_0x4965aa['shift']());}catch(_0x574eea){_0x4965aa['push'](_0x4965aa['shift']());}}}(a56_0x1a0d,0xa4644));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';function a56_0x1a0d(){var _0x3ee70e=['34640903zQVCnJ','10OcAJXm','2233992wtfWGS','692iHwpgX','6EPLJhB','1011206azYGBO','992855IZmVUk','1216713LaJhNP','155728ZoPFVJ','14755ZMsGwg','126UfLQMJ'];a56_0x1a0d=function(){return _0x3ee70e;};return a56_0x1a0d();}export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';function a56_0x549d(_0x5e6900,_0x317423){_0x5e6900=_0x5e6900-0x118;var _0x1a0dbe=a56_0x1a0d();var _0x549dad=_0x1a0dbe[_0x5e6900];return _0x549dad;}export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x330d9d,_0x59b995){var _0x21598f=a56_0x54b0,_0x5187e2=_0x330d9d();while(!![]){try{var _0x2c7f76=parseInt(_0x21598f(0x84))/0x1+parseInt(_0x21598f(0x83))/0x2*(parseInt(_0x21598f(0x7d))/0x3)+parseInt(_0x21598f(0x7b))/0x4*(parseInt(_0x21598f(0x7c))/0x5)+parseInt(_0x21598f(0x81))/0x6+-parseInt(_0x21598f(0x7a))/0x7+-parseInt(_0x21598f(0x80))/0x8*(-parseInt(_0x21598f(0x7e))/0x9)+parseInt(_0x21598f(0x7f))/0xa*(-parseInt(_0x21598f(0x82))/0xb);if(_0x2c7f76===_0x59b995)break;else _0x5187e2['push'](_0x5187e2['shift']());}catch(_0x3bb22f){_0x5187e2['push'](_0x5187e2['shift']());}}}(a56_0x1dae,0x65e3b));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';function a56_0x1dae(){var _0x1cf1b9=['380oqyWUg','35435lejVko','434037pBrqsT','18fVvtdU','20Zvwakf','960312DFEziU','3944922xoyrwv','4409372upglKP','4wxkHsd','108840cnlVCz','5249895KbmYil'];a56_0x1dae=function(){return _0x1cf1b9;};return a56_0x1dae();}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 a56_0x54b0(_0x1f3aaa,_0x46774a){_0x1f3aaa=_0x1f3aaa-0x7a;var _0x1daeb5=a56_0x1dae();var _0x54b0f4=_0x1daeb5[_0x1f3aaa];return _0x54b0f4;}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(_0x5767d0,_0x5d7056){const _0x5a2262=a57_0xbe1f,_0x86a5fe=_0x5767d0();while(!![]){try{const _0x3fdfc4=parseInt(_0x5a2262(0xd8))/0x1*(-parseInt(_0x5a2262(0xda))/0x2)+parseInt(_0x5a2262(0xcd))/0x3+parseInt(_0x5a2262(0xd0))/0x4+parseInt(_0x5a2262(0xd4))/0x5*(-parseInt(_0x5a2262(0xd6))/0x6)+-parseInt(_0x5a2262(0xde))/0x7+parseInt(_0x5a2262(0xd5))/0x8+-parseInt(_0x5a2262(0xe7))/0x9;if(_0x3fdfc4===_0x5d7056)break;else _0x86a5fe['push'](_0x86a5fe['shift']());}catch(_0x2cae3d){_0x86a5fe['push'](_0x86a5fe['shift']());}}}(a57_0x3594,0x930fb));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a57_0xbe1f(_0x5e4b11,_0x2198dd){_0x5e4b11=_0x5e4b11-0xcc;const _0x3594f1=a57_0x3594();let _0xbe1f5b=_0x3594f1[_0x5e4b11];return _0xbe1f5b;}import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x20e33a={}){const _0x17c2a0=a57_0xbe1f,_0x1ea1df=new McpServer({'name':_0x17c2a0(0xcf),'version':_0x17c2a0(0xe3)});return _0x1ea1df[_0x17c2a0(0xed)](_0x17c2a0(0xf4),{'description':_0x17c2a0(0xe5),'inputSchema':{'args':z[_0x17c2a0(0xce)](z[_0x17c2a0(0xe2)]())[_0x17c2a0(0xf2)]('Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])')}},async({args:_0x500ea3})=>{const _0x47784d=_0x17c2a0,_0x4bb225=await executeTdxRun({'args':_0x500ea3},_0x20e33a[_0x47784d(0xd3)]||{});return _0x4bb225[_0x47784d(0xe4)]?{'content':[{'type':_0x47784d(0xe9),'text':_0x4bb225[_0x47784d(0xd9)]||_0x47784d(0xe1)}]}:{'content':[{'type':_0x47784d(0xe9),'text':_0x4bb225['error']||_0x4bb225[_0x47784d(0xd9)]||'Command\x20failed'}],'isError':!![]};}),_0x1ea1df['registerTool']('tdx_search',{'description':_0x17c2a0(0xf5),'inputSchema':{'query':z[_0x17c2a0(0xe2)]()['describe'](_0x17c2a0(0xdc)),'category':z[_0x17c2a0(0xe0)]([_0x17c2a0(0xe8),_0x17c2a0(0xe6),'AI',_0x17c2a0(0xdf),'Utilities'])[_0x17c2a0(0xd1)]()[_0x17c2a0(0xf2)]('Optional\x20filter\x20by\x20category')}},async({query:_0x3650a8,category:_0x414ac8})=>{const _0x994b7d=_0x17c2a0,_0x4f2fe2=searchCommands({'query':_0x3650a8,'category':_0x414ac8});if(_0x4f2fe2['length']===0x0)return{'content':[{'type':'text','text':_0x994b7d(0xec)+_0x3650a8+'\x22'}]};const _0x4ce366=_0x4f2fe2['map'](_0x2cf781=>{const _0x3620d2=_0x994b7d,_0x5a3a2c=_0x2cf781[_0x3620d2(0xdb)][_0x3620d2(0xeb)](_0x3d6937=>'\x20\x20'+_0x3d6937)[_0x3620d2(0xf1)]('\x0a');return'**'+_0x2cf781[_0x3620d2(0xf6)]+_0x3620d2(0xcc)+_0x2cf781[_0x3620d2(0xdd)]+')\x0a'+_0x2cf781[_0x3620d2(0xf0)]+_0x3620d2(0xea)+_0x5a3a2c;})[_0x994b7d(0xf1)](_0x994b7d(0xee));return{'content':[{'type':_0x994b7d(0xe9),'text':_0x4ce366}]};}),_0x1ea1df;}function a57_0x3594(){const _0x47c8c5=['once','env','1235LSvZMQ','5515840zoydJe','2340HCQlfr','close','158189mnKQyC','output','8JROeDV','examples','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','category','3795778oDAPyN','Context','enum','Command\x20completed\x20successfully','string','1.0.0','success','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.','CDP','2998791sAKbmg','Data','text','\x0a\x0aExamples:\x0a','map','No\x20commands\x20found\x20matching\x20\x22','registerTool','\x0a\x0a---\x0a\x0a','SIGTERM','description','join','describe','connect','tdx_run','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.','name','**\x20(','1018881JgmFIF','array','tdx','4711180dVpbjO','optional'];a57_0x3594=function(){return _0x47c8c5;};return a57_0x3594();}export async function startMCPServer(_0x454214={}){const _0x18986e=a57_0xbe1f,_0x594969=createMCPServer(_0x454214),_0x279dfc=new StdioServerTransport();return await _0x594969[_0x18986e(0xf3)](_0x279dfc),new Promise(_0x2aff0b=>{const _0x4328a5=_0x18986e;let _0x3ac2a0=![];const _0x5e4d61=async()=>{if(_0x3ac2a0)return;_0x3ac2a0=!![],await _0x594969['close'](),_0x2aff0b();};process[_0x4328a5(0xd2)]('SIGINT',_0x5e4d61),process[_0x4328a5(0xd2)](_0x4328a5(0xef),_0x5e4d61),process['stdin'][_0x4328a5(0xd2)](_0x4328a5(0xd7),_0x5e4d61);});}
1
+ (function(_0x2c83c7,_0x5e3c53){const _0x4c1602=a57_0x1bd4,_0x4a4711=_0x2c83c7();while(!![]){try{const _0x3cd5c=parseInt(_0x4c1602(0xf6))/0x1*(parseInt(_0x4c1602(0xe9))/0x2)+-parseInt(_0x4c1602(0x10d))/0x3*(-parseInt(_0x4c1602(0xf1))/0x4)+-parseInt(_0x4c1602(0x103))/0x5*(-parseInt(_0x4c1602(0xff))/0x6)+-parseInt(_0x4c1602(0xef))/0x7*(parseInt(_0x4c1602(0x10a))/0x8)+-parseInt(_0x4c1602(0xe5))/0x9+parseInt(_0x4c1602(0xed))/0xa*(parseInt(_0x4c1602(0xf3))/0xb)+-parseInt(_0x4c1602(0x109))/0xc*(parseInt(_0x4c1602(0xf5))/0xd);if(_0x3cd5c===_0x5e3c53)break;else _0x4a4711['push'](_0x4a4711['shift']());}catch(_0x13da74){_0x4a4711['push'](_0x4a4711['shift']());}}}(a57_0x51e8,0x38da0));function a57_0x51e8(){const _0x1f62ae=['CDP','2314807iEFllH','category','3836365qwtWEo','83497PZZPSH','enum','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.','once','Optional\x20filter\x20by\x20category','string','\x0a\x0a---\x0a\x0a','SIGINT','Command\x20failed','126xnCSvb','registerTool','output','error','31300yBZWrU','SIGTERM','description','Utilities','tdx_search','describe','12WlDUUB','5144yVqOpk','Context','connect','139971dNAtdO','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','text','name','2606400nlfasm','Data','No\x20commands\x20found\x20matching\x20\x22','join','6ASIuoI','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','Command\x20completed\x20successfully','examples','20ekfigj','tdx','3395HWHrKf','close','28oMNFOo'];a57_0x51e8=function(){return _0x1f62ae;};return a57_0x51e8();}import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';function a57_0x1bd4(_0x5bf40d,_0x3033a8){_0x5bf40d=_0x5bf40d-0xe5;const _0x51e87c=a57_0x51e8();let _0x1bd4c4=_0x51e87c[_0x5bf40d];return _0x1bd4c4;}import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x28fba2={}){const _0x410de8=a57_0x1bd4,_0x332237=new McpServer({'name':_0x410de8(0xee),'version':'1.0.0'});return _0x332237['registerTool']('tdx_run',{'description':'Execute\x20any\x20tdx\x20CLI\x20command.\x20Returns\x20JSON\x20output.\x0a\x0aExamples:\x0a-\x20List\x20databases:\x20{\x22args\x22:\x20[\x22databases\x22]}\x0a-\x20Run\x20SQL\x20query:\x20{\x22args\x22:\x20[\x22query\x22,\x20\x22SELECT\x20*\x20FROM\x20mydb.users\x20LIMIT\x2010\x22]}\x0a-\x20List\x20segments:\x20{\x22args\x22:\x20[\x22segments\x22,\x20\x22--recursive\x22]}\x0a-\x20Show\x20job\x20details:\x20{\x22args\x22:\x20[\x22job\x22,\x20\x22show\x22,\x20\x2212345\x22]}\x0a-\x20List\x20tables:\x20{\x22args\x22:\x20[\x22tables\x22,\x20\x22mydb.*\x22]}\x0a\x0aNote:\x20Some\x20commands\x20(auth,\x20profile\x20management,\x20mcp)\x20are\x20blocked\x20for\x20security.','inputSchema':{'args':z['array'](z[_0x410de8(0xfb)]())[_0x410de8(0x108)](_0x410de8(0x10e))}},async({args:_0x1f12bb})=>{const _0x2c1113=_0x410de8,_0x12de10=await executeTdxRun({'args':_0x1f12bb},_0x28fba2['env']||{});return _0x12de10['success']?{'content':[{'type':_0x2c1113(0x10f),'text':_0x12de10['output']||_0x2c1113(0xeb)}]}:{'content':[{'type':_0x2c1113(0x10f),'text':_0x12de10[_0x2c1113(0x102)]||_0x12de10[_0x2c1113(0x101)]||_0x2c1113(0xfe)}],'isError':!![]};}),_0x332237[_0x410de8(0x100)](_0x410de8(0x107),{'description':_0x410de8(0xf8),'inputSchema':{'query':z[_0x410de8(0xfb)]()[_0x410de8(0x108)](_0x410de8(0xea)),'category':z[_0x410de8(0xf7)]([_0x410de8(0xe6),_0x410de8(0xf2),'AI',_0x410de8(0x10b),_0x410de8(0x106)])['optional']()[_0x410de8(0x108)](_0x410de8(0xfa))}},async({query:_0x298ce8,category:_0x2332a4})=>{const _0x6af959=_0x410de8,_0x123061=searchCommands({'query':_0x298ce8,'category':_0x2332a4});if(_0x123061['length']===0x0)return{'content':[{'type':_0x6af959(0x10f),'text':_0x6af959(0xe7)+_0x298ce8+'\x22'}]};const _0x3ee0f6=_0x123061['map'](_0x1ac6e9=>{const _0x4d21e8=_0x6af959,_0x464f0b=_0x1ac6e9[_0x4d21e8(0xec)]['map'](_0x361cb9=>'\x20\x20'+_0x361cb9)[_0x4d21e8(0xe8)]('\x0a');return'**'+_0x1ac6e9[_0x4d21e8(0x110)]+'**\x20('+_0x1ac6e9[_0x4d21e8(0xf4)]+')\x0a'+_0x1ac6e9[_0x4d21e8(0x105)]+'\x0a\x0aExamples:\x0a'+_0x464f0b;})['join'](_0x6af959(0xfc));return{'content':[{'type':_0x6af959(0x10f),'text':_0x3ee0f6}]};}),_0x332237;}export async function startMCPServer(_0x59b1e7={}){const _0x22de0a=a57_0x1bd4,_0x271b72=createMCPServer(_0x59b1e7),_0xfe4844=new StdioServerTransport();return await _0x271b72[_0x22de0a(0x10c)](_0xfe4844),new Promise(_0x29ca51=>{const _0x1e9173=_0x22de0a;let _0x3e64e3=![];const _0x4a6cc4=async()=>{if(_0x3e64e3)return;_0x3e64e3=!![],await _0x271b72['close'](),_0x29ca51();};process[_0x1e9173(0xf9)](_0x1e9173(0xfd),_0x4a6cc4),process['once'](_0x1e9173(0x104),_0x4a6cc4),process['stdin']['once'](_0x1e9173(0xf0),_0x4a6cc4);});}
@@ -1 +1 @@
1
- (function(_0x2a744a,_0xd8c8db){var _0xa45a0f=a58_0x5b71,_0x392d04=_0x2a744a();while(!![]){try{var _0x4142b9=-parseInt(_0xa45a0f(0x199))/0x1+-parseInt(_0xa45a0f(0x19c))/0x2+-parseInt(_0xa45a0f(0x194))/0x3+parseInt(_0xa45a0f(0x195))/0x4*(parseInt(_0xa45a0f(0x19b))/0x5)+parseInt(_0xa45a0f(0x197))/0x6*(parseInt(_0xa45a0f(0x193))/0x7)+-parseInt(_0xa45a0f(0x196))/0x8+parseInt(_0xa45a0f(0x198))/0x9*(parseInt(_0xa45a0f(0x19a))/0xa);if(_0x4142b9===_0xd8c8db)break;else _0x392d04['push'](_0x392d04['shift']());}catch(_0xc6441e){_0x392d04['push'](_0x392d04['shift']());}}}(a58_0x17e1,0xbe6fa));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';function a58_0x17e1(){var _0x534240=['9CgznVq','1051417kKiPAJ','25966690eqVGcT','20CnpwbK','2566176jALfBA','588413tsoDwC','2869344vbYJSQ','1210376PfkVzT','9320552iZmPhy','102AtUlgu'];a58_0x17e1=function(){return _0x534240;};return a58_0x17e1();}function a58_0x5b71(_0x339827,_0x1f5040){_0x339827=_0x339827-0x193;var _0x17e1e1=a58_0x17e1();var _0x5b7130=_0x17e1e1[_0x339827];return _0x5b7130;}export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
1
+ function a58_0x5a51(_0x267b26,_0x1fa8cb){_0x267b26=_0x267b26-0x78;var _0x2167e7=a58_0x2167();var _0x5a51d0=_0x2167e7[_0x267b26];return _0x5a51d0;}function a58_0x2167(){var _0x368552=['3296495RAdgEa','2349767hhCjPe','120614aXJtGZ','669348oMphaE','3174633xJjHZf','78915aOSfDn','99qGzSkg','6ESoPsQ','779430pYfnSX','6UJBJoi','44YbIJML','24zXTZnj'];a58_0x2167=function(){return _0x368552;};return a58_0x2167();}(function(_0x4275f7,_0x3f26c2){var _0x204770=a58_0x5a51,_0x52031c=_0x4275f7();while(!![]){try{var _0x5de8e0=parseInt(_0x204770(0x7f))/0x1*(parseInt(_0x204770(0x7a))/0x2)+parseInt(_0x204770(0x82))/0x3*(-parseInt(_0x204770(0x7b))/0x4)+-parseInt(_0x204770(0x7d))/0x5*(-parseInt(_0x204770(0x78))/0x6)+parseInt(_0x204770(0x7e))/0x7*(-parseInt(_0x204770(0x7c))/0x8)+parseInt(_0x204770(0x81))/0x9+parseInt(_0x204770(0x79))/0xa+-parseInt(_0x204770(0x83))/0xb*(-parseInt(_0x204770(0x80))/0xc);if(_0x5de8e0===_0x3f26c2)break;else _0x52031c['push'](_0x52031c['shift']());}catch(_0x4a852f){_0x52031c['push'](_0x52031c['shift']());}}}(a58_0x2167,0xa081a));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
@@ -1 +1 @@
1
- function a59_0x2735(_0x1560a0,_0x300d77){_0x1560a0=_0x1560a0-0x72;const _0x2bb46d=a59_0x2bb4();let _0x273572=_0x2bb46d[_0x1560a0];return _0x273572;}const a59_0x421d55=a59_0x2735;(function(_0x657ee3,_0x796b5){const _0xdae7b4=a59_0x2735,_0x1c988f=_0x657ee3();while(!![]){try{const _0x3dd2b7=-parseInt(_0xdae7b4(0x78))/0x1*(parseInt(_0xdae7b4(0x77))/0x2)+parseInt(_0xdae7b4(0x76))/0x3+-parseInt(_0xdae7b4(0x7d))/0x4*(-parseInt(_0xdae7b4(0x7b))/0x5)+-parseInt(_0xdae7b4(0x84))/0x6+-parseInt(_0xdae7b4(0x79))/0x7+parseInt(_0xdae7b4(0x8e))/0x8+parseInt(_0xdae7b4(0x7a))/0x9;if(_0x3dd2b7===_0x796b5)break;else _0x1c988f['push'](_0x1c988f['shift']());}catch(_0x314247){_0x1c988f['push'](_0x1c988f['shift']());}}}(a59_0x2bb4,0x82bf7));import{spawn}from'child_process';import{dirname,join}from'path';import{existsSync}from'fs';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z['object']({'args':z['array'](z[a59_0x421d55(0x86)]())[a59_0x421d55(0x75)](a59_0x421d55(0x83))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function a59_0x2bb4(){const _0x232211=['kill','2948RPiMpK','PATH','node','Failed\x20to\x20spawn\x20tdx:\x20','true','platform','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','4211112dIJVmj','tdx','string','data','execPath','stderr','--no-color','message','close','win32','7011160qoZkPd','pipe','SIGTERM','toString','error','resourcesPath','describe','956349GxooYb','24PbRjjw','53422ZOBsYf','3843098dENsZE','2680011aAdvkR','6340UFtIcm'];a59_0x2bb4=function(){return _0x232211;};return a59_0x2bb4();}function getNodeBinDir(){const _0x5d40f7=a59_0x421d55,_0x23af39=process[_0x5d40f7(0x74)];if(_0x23af39){const _0x53e29b=join(_0x23af39,_0x5d40f7(0x7f)),_0x491040=process['platform']==='win32'?'node.exe':_0x5d40f7(0x7f);if(existsSync(join(_0x53e29b,_0x491040)))return _0x53e29b;}return dirname(process[_0x5d40f7(0x88)]);}export async function executeTdxRun(_0x280564,_0x2bb1f6){const _0x30dbc3=a59_0x421d55,{args:_0x300771}=_0x280564;if(isBlockedCommand(_0x300771)){const _0xef142c=getBlockedReason(_0x300771);return{'success':![],'output':'','error':_0xef142c||'This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','exitCode':0x1};}const _0x5355c8=['--json',_0x30dbc3(0x8a),..._0x300771],_0x305bd6=getNodeBinDir(),_0x2e1d57=process[_0x30dbc3(0x82)]===_0x30dbc3(0x8d)?';':':',_0x4c7af0=_0x2bb1f6[_0x30dbc3(0x7e)]??process.env.PATH??'',_0x28f454=''+_0x305bd6+_0x2e1d57+_0x4c7af0;return new Promise(_0x13999b=>{const _0x228868=_0x30dbc3,_0xdabb75=spawn(_0x228868(0x85),_0x5355c8,{'env':{...process.env,..._0x2bb1f6,'PATH':_0x28f454,'CI':_0x228868(0x81)},'stdio':['ignore',_0x228868(0x8f),_0x228868(0x8f)]});let _0x316929='',_0xf2ee0a='',_0x569b14=![];const _0x19750b=setTimeout(()=>{const _0x3f1567=_0x228868;_0x569b14=!![],_0xdabb75[_0x3f1567(0x7c)](_0x3f1567(0x90));},DEFAULT_TIMEOUT_MS);_0xdabb75['stdout']['on']('data',_0x3ea4fe=>{const _0x3af4bd=_0x228868;_0x316929+=_0x3ea4fe[_0x3af4bd(0x72)]();}),_0xdabb75[_0x228868(0x89)]['on'](_0x228868(0x87),_0x804d97=>{_0xf2ee0a+=_0x804d97['toString']();}),_0xdabb75['on'](_0x228868(0x73),_0x44ad04=>{const _0x56fc88=_0x228868;clearTimeout(_0x19750b),_0x13999b({'success':![],'output':'','error':_0x56fc88(0x80)+_0x44ad04[_0x56fc88(0x8b)],'exitCode':0x1});}),_0xdabb75['on'](_0x228868(0x8c),_0x57c17b=>{clearTimeout(_0x19750b);if(_0x569b14){_0x13999b({'success':![],'output':formatOutput(_0x316929),'error':'Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','exitCode':0x7c});return;}const _0x267c23=_0x57c17b??0x1,_0x961ecc=_0x267c23===0x0,_0x2ef456=formatOutput(_0x316929||_0xf2ee0a),_0x145546=!_0x961ecc&&_0xf2ee0a?formatOutput(_0xf2ee0a):undefined;_0x13999b({'success':_0x961ecc,'output':_0x2ef456,'error':_0x145546,'exitCode':_0x267c23});});});}
1
+ const a59_0x207b34=a59_0x3c5d;(function(_0x428f9c,_0x450c95){const _0x580dc0=a59_0x3c5d,_0x143686=_0x428f9c();while(!![]){try{const _0x155ad1=-parseInt(_0x580dc0(0x1a7))/0x1*(parseInt(_0x580dc0(0x1ab))/0x2)+-parseInt(_0x580dc0(0x1a2))/0x3*(-parseInt(_0x580dc0(0x1b1))/0x4)+-parseInt(_0x580dc0(0x1a8))/0x5+parseInt(_0x580dc0(0x1b2))/0x6*(-parseInt(_0x580dc0(0x1af))/0x7)+-parseInt(_0x580dc0(0x1a0))/0x8*(parseInt(_0x580dc0(0x1b4))/0x9)+-parseInt(_0x580dc0(0x1a9))/0xa+parseInt(_0x580dc0(0x1ac))/0xb;if(_0x155ad1===_0x450c95)break;else _0x143686['push'](_0x143686['shift']());}catch(_0x177be2){_0x143686['push'](_0x143686['shift']());}}}(a59_0x4598,0xd0a88));import{spawn}from'child_process';function a59_0x3c5d(_0x180277,_0x4fcf5a){_0x180277=_0x180277-0x198;const _0x4598a2=a59_0x4598();let _0x3c5d9c=_0x4598a2[_0x180277];return _0x3c5d9c;}import{dirname,join}from'path';function a59_0x4598(){const _0x5472d7=['Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','24Iyxlvb','234RStGnt','true','1386CqIdNr','stdout','tdx','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','SIGTERM','message','Failed\x20to\x20spawn\x20tdx:\x20','pipe','platform','node.exe','kill','data','45104FEuueE','PATH','852501qfIeKg','describe','object','ignore','array','1771WsifaM','4196330fOUmtf','3459570JCvnjF','--json','782kADSOK','37470180pbnLCh','toString','string','271166fqmZcB'];a59_0x4598=function(){return _0x5472d7;};return a59_0x4598();}import{existsSync}from'fs';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a59_0x207b34(0x1a4)]({'args':z[a59_0x207b34(0x1a6)](z[a59_0x207b34(0x1ae)]())[a59_0x207b34(0x1a3)](a59_0x207b34(0x1b7))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function getNodeBinDir(){const _0xf970f1=a59_0x207b34,_0x5c4089=process['resourcesPath'];if(_0x5c4089){const _0xf93da7=join(_0x5c4089,'node'),_0x3f0e72=process['platform']==='win32'?_0xf970f1(0x19d):'node';if(existsSync(join(_0xf93da7,_0x3f0e72)))return _0xf93da7;}return dirname(process['execPath']);}export async function executeTdxRun(_0x30f0fc,_0x322990){const _0x3e0ccd=a59_0x207b34,{args:_0x443ae1}=_0x30f0fc;if(isBlockedCommand(_0x443ae1)){const _0x33a7d9=getBlockedReason(_0x443ae1);return{'success':![],'output':'','error':_0x33a7d9||'This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','exitCode':0x1};}const _0x50a62d=[_0x3e0ccd(0x1aa),'--no-color',..._0x443ae1],_0xb15b1e=getNodeBinDir(),_0x2a8bf1=process[_0x3e0ccd(0x19c)]==='win32'?';':':',_0x167593=_0x322990[_0x3e0ccd(0x1a1)]??process.env.PATH??'',_0x5e4b0a=''+_0xb15b1e+_0x2a8bf1+_0x167593;return new Promise(_0x288c6a=>{const _0x56b7ca=_0x3e0ccd,_0x47a327=spawn(_0x56b7ca(0x1b6),_0x50a62d,{'env':{...process.env,..._0x322990,'PATH':_0x5e4b0a,'CI':_0x56b7ca(0x1b3)},'stdio':[_0x56b7ca(0x1a5),_0x56b7ca(0x19b),'pipe']});let _0x24716f='',_0xa134a8='',_0x4afc40=![];const _0xa5df4f=setTimeout(()=>{const _0x248444=_0x56b7ca;_0x4afc40=!![],_0x47a327[_0x248444(0x19e)](_0x248444(0x198));},DEFAULT_TIMEOUT_MS);_0x47a327[_0x56b7ca(0x1b5)]['on'](_0x56b7ca(0x19f),_0x216a88=>{const _0x52cea8=_0x56b7ca;_0x24716f+=_0x216a88[_0x52cea8(0x1ad)]();}),_0x47a327['stderr']['on'](_0x56b7ca(0x19f),_0x2dfc62=>{const _0x2669d5=_0x56b7ca;_0xa134a8+=_0x2dfc62[_0x2669d5(0x1ad)]();}),_0x47a327['on']('error',_0x512ba4=>{const _0x4d96ca=_0x56b7ca;clearTimeout(_0xa5df4f),_0x288c6a({'success':![],'output':'','error':_0x4d96ca(0x19a)+_0x512ba4[_0x4d96ca(0x199)],'exitCode':0x1});}),_0x47a327['on']('close',_0x28203b=>{const _0x80e0=_0x56b7ca;clearTimeout(_0xa5df4f);if(_0x4afc40){_0x288c6a({'success':![],'output':formatOutput(_0x24716f),'error':_0x80e0(0x1b0),'exitCode':0x7c});return;}const _0x3baeee=_0x28203b??0x1,_0xec9306=_0x3baeee===0x0,_0x10c29a=formatOutput(_0x24716f||_0xa134a8),_0x403e6d=!_0xec9306&&_0xa134a8?formatOutput(_0xa134a8):undefined;_0x288c6a({'success':_0xec9306,'output':_0x10c29a,'error':_0x403e6d,'exitCode':_0x3baeee});});});}