@treasuredata/tdx 0.28.2 → 0.28.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 (184) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segment-validate-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/status-command.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/unset-command.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.js +1 -1
  56. package/dist/core/keychain.js +1 -1
  57. package/dist/core/profile.js +1 -1
  58. package/dist/core/project-config.js +1 -1
  59. package/dist/core/session.js +1 -1
  60. package/dist/core/user-cache.js +1 -1
  61. package/dist/core/version.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/mcp/server.js +1 -1
  64. package/dist/mcp/tools/index.js +1 -1
  65. package/dist/mcp/tools/tdx-run.js +1 -1
  66. package/dist/mcp/tools/tdx-search.js +1 -1
  67. package/dist/mcp/utils.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/passthrough-server.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/agent/tool-target-registry.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/delivery-api-client.js +1 -1
  83. package/dist/sdk/client/endpoints.js +1 -1
  84. package/dist/sdk/client/engage-api-client.js +1 -1
  85. package/dist/sdk/client/http-client.js +1 -1
  86. package/dist/sdk/client/llm-api-client.js +1 -1
  87. package/dist/sdk/client/rate-limiter.js +1 -1
  88. package/dist/sdk/client/td-api-client.js +1 -1
  89. package/dist/sdk/client/trino-api-client.js +1 -1
  90. package/dist/sdk/client/workflow-client.js +1 -1
  91. package/dist/sdk/connection-validator.js +1 -1
  92. package/dist/sdk/connection.js +1 -1
  93. package/dist/sdk/delivery.js +1 -1
  94. package/dist/sdk/engage/campaign-pull.js +1 -1
  95. package/dist/sdk/engage/campaign-push.js +1 -1
  96. package/dist/sdk/engage/campaign-validator.js +1 -1
  97. package/dist/sdk/engage/campaign-yaml.js +1 -1
  98. package/dist/sdk/engage/types/campaign-def.js +1 -1
  99. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.js +1 -1
  109. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  110. package/dist/sdk/llm/model-factors.js +1 -1
  111. package/dist/sdk/personalization.js +1 -1
  112. package/dist/sdk/query/index.js +1 -1
  113. package/dist/sdk/query/sql-parser.js +1 -1
  114. package/dist/sdk/realtime.js +1 -1
  115. package/dist/sdk/schedule.js +1 -1
  116. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  117. package/dist/sdk/segment/fields-display.js +1 -1
  118. package/dist/sdk/segment/file-discovery.js +1 -1
  119. package/dist/sdk/segment/journey-utils.d.ts.map +1 -1
  120. package/dist/sdk/segment/journey-utils.js +1 -1
  121. package/dist/sdk/segment/journey-utils.js.map +1 -1
  122. package/dist/sdk/segment/journey-validator.js +1 -1
  123. package/dist/sdk/segment/journey-validator.js.map +1 -1
  124. package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
  125. package/dist/sdk/segment/journey-yaml.js +1 -1
  126. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  127. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  128. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  129. package/dist/sdk/segment/pull-workflow.js +1 -1
  130. package/dist/sdk/segment/push-recovery.js +1 -1
  131. package/dist/sdk/segment/push-workflow.js +1 -1
  132. package/dist/sdk/segment/resolution-context.js +1 -1
  133. package/dist/sdk/segment/segment-path-parser.js +1 -1
  134. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  135. package/dist/sdk/segment/target-resolution.js +1 -1
  136. package/dist/sdk/segment/tdx-config.js +1 -1
  137. package/dist/sdk/segment/validate-files.js +1 -1
  138. package/dist/sdk/segment/yaml-validator.js +1 -1
  139. package/dist/sdk/segment.js +1 -1
  140. package/dist/sdk/types/index.js +1 -1
  141. package/dist/sdk/types/progress.js +1 -1
  142. package/dist/sdk/user.js +1 -1
  143. package/dist/sdk/util/format-detector.js +1 -1
  144. package/dist/sdk/util/formatters.js +1 -1
  145. package/dist/sdk/util/index.js +1 -1
  146. package/dist/sdk/util/tree-formatter.js +1 -1
  147. package/dist/sdk/workflow/archive-validation.js +1 -1
  148. package/dist/sdk/workflow/clone-workflow.js +1 -1
  149. package/dist/sdk/workflow/index.js +1 -1
  150. package/dist/sdk/workflow/pull-workflow.js +1 -1
  151. package/dist/sdk/workflow/push-workflow.js +1 -1
  152. package/dist/sdk/workflow/tdx-config.js +1 -1
  153. package/dist/sdk/workflow/workflow-utils.js +1 -1
  154. package/dist/test-utils/command-runner.js +1 -1
  155. package/dist/test-utils/factories.js +1 -1
  156. package/dist/test-utils/fixtures.js +1 -1
  157. package/dist/test-utils/http-mock.js +1 -1
  158. package/dist/test-utils/index.js +1 -1
  159. package/dist/utils/async.js +1 -1
  160. package/dist/utils/colors.js +1 -1
  161. package/dist/utils/diff.js +1 -1
  162. package/dist/utils/file-permissions.js +1 -1
  163. package/dist/utils/global-cache.js +1 -1
  164. package/dist/utils/json-loader.js +1 -1
  165. package/dist/utils/local-cache.js +1 -1
  166. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  167. package/dist/utils/logger/formatters/index.js +1 -1
  168. package/dist/utils/logger/handlers/console-handler.js +1 -1
  169. package/dist/utils/logger/handlers/file-handler.js +1 -1
  170. package/dist/utils/logger/handlers/index.js +1 -1
  171. package/dist/utils/logger/handlers/null-handler.js +1 -1
  172. package/dist/utils/logger/index.js +1 -1
  173. package/dist/utils/logger/logger.js +1 -1
  174. package/dist/utils/logger/types.js +1 -1
  175. package/dist/utils/option-validation.js +1 -1
  176. package/dist/utils/process.js +1 -1
  177. package/dist/utils/prompt.js +1 -1
  178. package/dist/utils/spinner.js +1 -1
  179. package/dist/utils/sse-parser.js +1 -1
  180. package/dist/utils/string-utils.js +1 -1
  181. package/dist/utils/table-ref-parser.js +1 -1
  182. package/dist/utils/tdx-logger.js +1 -1
  183. package/dist/utils/version-check.js +1 -1
  184. package/package.json +1 -1
@@ -1 +1 @@
1
- const a49_0xbd79a9=a49_0x2261;(function(_0x20b408,_0x52ac17){const _0x740a0f=a49_0x2261,_0x14763f=_0x20b408();while(!![]){try{const _0x2d8595=parseInt(_0x740a0f(0x1b8))/0x1*(parseInt(_0x740a0f(0x1b5))/0x2)+-parseInt(_0x740a0f(0x1ce))/0x3*(-parseInt(_0x740a0f(0x1f9))/0x4)+-parseInt(_0x740a0f(0x1c7))/0x5*(parseInt(_0x740a0f(0x1e9))/0x6)+parseInt(_0x740a0f(0x1e1))/0x7+-parseInt(_0x740a0f(0x1bc))/0x8*(parseInt(_0x740a0f(0x1f8))/0x9)+-parseInt(_0x740a0f(0x1cb))/0xa*(-parseInt(_0x740a0f(0x1d4))/0xb)+-parseInt(_0x740a0f(0x1c8))/0xc;if(_0x2d8595===_0x52ac17)break;else _0x14763f['push'](_0x14763f['shift']());}catch(_0x6f1710){_0x14763f['push'](_0x14763f['shift']());}}}(a49_0x3448,0x6c019));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a49_0x1321f1 from'node:fs';import*as a49_0x18b6c9 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 a49_0x14d185 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x514fa6=a49_0x2261;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x514fa6(0x1b9),_0x514fa6(0x1c3));}export function getConfigFile(){const _0x5ac5b0=a49_0x2261;return join(getConfigDir(),_0x5ac5b0(0x1cd));}export function getConfigFilePath(_0x1e287c){const _0xf7a0c4=a49_0x2261,_0x2ef043=getConfigDir();return _0x1e287c?a49_0x18b6c9[_0xf7a0c4(0x1b4)](_0x2ef043,_0xf7a0c4(0x1cc)+_0x1e287c):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a49_0xbd79a9(0x1c1),'config/llm-project');export function getLLMProjectCacheFile(_0x9ddd37){const _0x2fb56a=a49_0xbd79a9;return llmProjectCache[_0x2fb56a(0x1f7)](_0x9ddd37);}export function readCachedLLMProject(_0x3a64da){const _0x534ea2=a49_0xbd79a9,_0x208a2f=llmProjectCache[_0x534ea2(0x1f1)](_0x3a64da);if(_0x208a2f&&typeof _0x208a2f['id']==='string'&&typeof _0x208a2f['name']==='string')return _0x208a2f;return null;}export function writeCachedLLMProject(_0x548f15,_0xf8255b,_0x41a097){const _0x11023b=a49_0xbd79a9;try{llmProjectCache[_0x11023b(0x1c2)]({'name':_0x548f15,'id':_0xf8255b},_0x41a097);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a49_0xbd79a9(0x1f0));export function getLLMAgentCacheFile(_0x23c8f7){const _0x487ec9=a49_0xbd79a9;return llmAgentCache[_0x487ec9(0x1f7)](_0x23c8f7);}export function readCachedLLMAgent(_0x1a8685){const _0x48aaf7=a49_0xbd79a9,_0x5f5871=llmAgentCache[_0x48aaf7(0x1f1)](_0x1a8685);if(_0x5f5871&&typeof _0x5f5871['id']==='string'&&typeof _0x5f5871[_0x48aaf7(0x1f3)]===_0x48aaf7(0x1ea)&&typeof _0x5f5871[_0x48aaf7(0x1d2)]===_0x48aaf7(0x1ea))return _0x5f5871;return null;}export function writeCachedLLMAgent(_0x1bf4ca,_0x4a1e48,_0x5efb53,_0x270565){const _0x5316ac=a49_0xbd79a9;try{llmAgentCache[_0x5316ac(0x1c2)]({'name':_0x1bf4ca,'id':_0x4a1e48,'projectId':_0x5efb53},_0x270565);}catch{}}function a49_0x2261(_0x16b3e6,_0x4380ab){_0x16b3e6=_0x16b3e6-0x1b0;const _0x344880=a49_0x3448();let _0x22611b=_0x344880[_0x16b3e6];return _0x22611b;}export function clearCachedLLMAgent(_0x56b591){const _0x4f6ccf=a49_0xbd79a9;try{llmAgentCache[_0x4f6ccf(0x1b7)](_0x56b591);}catch{}}const accountInfoCache=createOptionalProfileCache(a49_0xbd79a9(0x1bd),a49_0xbd79a9(0x1d1),{'suffix':'.json'});export function getAccountInfoCacheFile(_0x30895b){const _0x3e88b0=a49_0xbd79a9;return accountInfoCache[_0x3e88b0(0x1f7)](_0x30895b);}export function readCachedAccountInfo(_0x38e59c){const _0x293d55=a49_0xbd79a9,_0x2f8fdf=accountInfoCache['read'](_0x38e59c);if(_0x2f8fdf&&typeof _0x2f8fdf[_0x293d55(0x1db)]===_0x293d55(0x1ea)&&typeof _0x2f8fdf[_0x293d55(0x1bf)]===_0x293d55(0x1b2))return _0x2f8fdf;return null;}export function writeCachedAccountInfo(_0x2d2de9,_0x41b0cf,_0xf1826a){const _0x33c323=a49_0xbd79a9;try{accountInfoCache['write']({'site':_0x2d2de9,'accountId':_0x41b0cf,'cachedAt':new Date()[_0x33c323(0x1da)]()},_0xf1826a);}catch{}}export function parseEnvFile(_0x42fa0e){const _0x116778=a49_0xbd79a9,_0x2fc9e8={};for(const _0x4f1d29 of _0x42fa0e[_0x116778(0x1eb)]('\x0a')){const _0x5047b4=_0x4f1d29[_0x116778(0x1fd)]();if(!_0x5047b4||_0x5047b4[_0x116778(0x1d7)]('#'))continue;const _0x1b626a=_0x5047b4[_0x116778(0x1b0)](/^([^=]+)=(.*)$/);if(_0x1b626a){const _0x181e67=_0x1b626a[0x1][_0x116778(0x1fd)]();let _0x11fe43=_0x1b626a[0x2][_0x116778(0x1fd)]();(_0x11fe43[_0x116778(0x1d7)]('\x22')&&_0x11fe43[_0x116778(0x1f6)]('\x22')||_0x11fe43[_0x116778(0x1d7)]('\x27')&&_0x11fe43[_0x116778(0x1f6)]('\x27'))&&(_0x11fe43=_0x11fe43[_0x116778(0x1e3)](0x1,-0x1)),_0x2fc9e8[_0x181e67]=_0x11fe43;}}return _0x2fc9e8;}function a49_0x3448(){const _0x55aa86=['trim','match','replace','number','toUpperCase','join','606658tXBEqx','release_channel','clear','2LtlHRf','.config','\x27,\x20defaulting\x20to\x20us01','tdx.json','648UpiKew','account_info','Warning:\x20Failed\x20to\x20read\x20','accountId','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','llm_default_project','write','tdx','existsSync','stg-ap03','\x20env\x20var','1851395RLlsnl','14607372GXafQg','us01','parse','10KCdOwp','.env.','.env','3ukydcx','Warning:\x20Unknown\x20site\x20\x27','keychain','config/account-info','projectId','dev-us01','7899991acuNpt','TDX_API_KEY_','utf-8','startsWith','entries','stg-us01','toISOString','site','stg-jp01','some','map','keychain\x20(profile:\x20','apiKeys','4025000eIKGbH','proxy','slice','yellow','filter','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','readFileSync','TD_API_KEY','6RkTSun','string','split','TDX_API_KEY\x20env\x20var','next','warn','ap02','config/llm-agent','read','dev-eu01','name','ap03','eu01','endsWith','path','33399gsafJZ','1722820JWBpzr','jp01','stable','apiKey'];a49_0x3448=function(){return _0x55aa86;};return a49_0x3448();}export function readUserConfig(){const _0x9bb228=a49_0xbd79a9,_0x21ff7b=getConfigFile();if(!existsSync(_0x21ff7b))return{};try{const _0x3dc703=readFileSync(_0x21ff7b,_0x9bb228(0x1d6));return parseEnvFile(_0x3dc703);}catch(_0x5c3199){return console[_0x9bb228(0x1ee)](_0x9bb228(0x1e6)+_0x21ff7b+':',_0x5c3199),{};}}export function resolveSite(_0x1adb37){const _0x3d14fe=a49_0xbd79a9,_0x5d521b=[_0x3d14fe(0x1c9),_0x3d14fe(0x1fa),_0x3d14fe(0x1f5),_0x3d14fe(0x1ef),_0x3d14fe(0x1f4),_0x3d14fe(0x1d3),_0x3d14fe(0x1f2),_0x3d14fe(0x1d9),_0x3d14fe(0x1dc),_0x3d14fe(0x1c5)];if(_0x5d521b['includes'](_0x1adb37))return _0x1adb37;if(_0x1adb37 in SITE_ALIASES)return SITE_ALIASES[_0x1adb37];return console[_0x3d14fe(0x1ee)](_0x3d14fe(0x1cf)+_0x1adb37+_0x3d14fe(0x1ba)),_0x3d14fe(0x1c9);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x3e8dbe){const _0x3319b2=a49_0xbd79a9,_0x5fae72=_0x3e8dbe||getActiveProfileName();if(_0x5fae72){const _0x236f8f=_0x3319b2(0x1d5)+normalizeProfileForEnvVar(_0x5fae72);if(process.env[_0x236f8f])return process.env[_0x236f8f];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x4714c5){const _0x410b91=a49_0xbd79a9;return _0x4714c5[_0x410b91(0x1b3)]()[_0x410b91(0x1b1)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x452ab7,_0x932c95){const _0x806512=a49_0xbd79a9,_0x19e21c=_0x932c95||getActiveProfileName()||undefined;if(_0x19e21c){const _0x302605=_0x806512(0x1d5)+normalizeProfileForEnvVar(_0x19e21c);if(process.env[_0x302605])return{'apiKey':process.env[_0x302605],'source':_0x302605+_0x806512(0x1c6),'isDeprecated':![]};const _0x599fa5=getCachedCredential(_0x452ab7,_0x19e21c);if(_0x599fa5)return{'apiKey':_0x599fa5,'source':_0x806512(0x1df)+_0x19e21c+')','isDeprecated':![]};const _0x38f917=await getKeychainAPIKey(_0x19e21c);if(_0x38f917)return setCachedCredential(_0x38f917,_0x452ab7,_0x19e21c),{'apiKey':_0x38f917,'source':_0x806512(0x1df)+_0x19e21c+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x806512(0x1ec),'isDeprecated':![]};if(!_0x19e21c){const _0x587bd7=getCachedCredential(_0x452ab7,undefined);if(_0x587bd7)return{'apiKey':_0x587bd7,'source':'keychain','isDeprecated':![]};const _0x392199=await getKeychainAPIKey(undefined);if(_0x392199)return setCachedCredential(_0x392199,_0x452ab7,undefined),{'apiKey':_0x392199,'source':_0x806512(0x1d0),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x591d6a,_0x4ac40e){const _0x525d0c=a49_0xbd79a9,_0x353522=await resolveAPIKeyAsync(_0x591d6a,_0x4ac40e);return _0x353522?.[_0x525d0c(0x1fc)];}function cleanupLegacyEnvFile(_0x34ca9a){const _0x3cd846=a49_0xbd79a9;if(!existsSync(_0x34ca9a))return![];try{const _0xc753a6=readFileSync(_0x34ca9a,_0x3cd846(0x1d6)),_0x348aaa=_0xc753a6[_0x3cd846(0x1eb)]('\x0a'),_0x4ae7f6=_0x348aaa[_0x3cd846(0x1e5)](_0x46d81d=>{const _0x59a1b5=_0x3cd846,_0x3b35ba=_0x46d81d[_0x59a1b5(0x1fd)]();if(!_0x3b35ba||_0x3b35ba[_0x59a1b5(0x1d7)]('#'))return!![];const [_0x5b2991]=_0x3b35ba['split']('=');return!_0x5b2991[_0x59a1b5(0x1d7)](_0x59a1b5(0x1e8));}),_0xa6a128=_0x4ae7f6[_0x3cd846(0x1dd)](_0x566445=>{const _0x36de23=_0x3cd846,_0x5b28f3=_0x566445[_0x36de23(0x1fd)]();return _0x5b28f3&&!_0x5b28f3[_0x36de23(0x1d7)]('#');});if(!_0xa6a128)return unlinkSync(_0x34ca9a),!![];return writeFileSync(_0x34ca9a,_0x4ae7f6[_0x3cd846(0x1b4)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x3b7ee6=a49_0xbd79a9;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x543de7=a49_0x18b6c9[_0x3b7ee6(0x1b4)](getConfigDir(),'tdx.json');if(!a49_0x1321f1[_0x3b7ee6(0x1c4)](_0x543de7))return null;try{const _0x1f49f9=a49_0x1321f1['readFileSync'](_0x543de7,'utf-8'),_0x505b35=JSON[_0x3b7ee6(0x1ca)](_0x1f49f9);return _0x505b35['profile']||null;}catch{return null;}}export function saveAPIKey(_0x3c202a,_0x249572,_0x21571b){const _0x2b9d5b=a49_0xbd79a9,_0x3d813f=getConfigDir(),_0x242de6=getConfigFilePath(_0x21571b);!existsSync(_0x3d813f)&&mkdirSync(_0x3d813f,{'recursive':!![],'mode':0x1c0});let _0xf6fa74={};if(existsSync(_0x242de6))try{const _0x501ec6=readFileSync(_0x242de6,_0x2b9d5b(0x1d6));_0xf6fa74=parseEnvFile(_0x501ec6);}catch(_0x5929a2){console['warn'](_0x2b9d5b(0x1be)+_0x242de6+':',_0x5929a2);}const _0x233236=_0x3c202a['toUpperCase']()['replace'](/-/g,'_');_0xf6fa74['TD_API_KEY_'+_0x233236]=_0x249572;const _0xc4bf68=Object[_0x2b9d5b(0x1d8)](_0xf6fa74)[_0x2b9d5b(0x1de)](([_0x53df75,_0xe6fd])=>_0x53df75+'='+_0xe6fd);writeFileSync(_0x242de6,_0xc4bf68['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x4b906a,_0x353cc8,_0x463cef){const _0x42809f=a49_0xbd79a9;await saveKeychainAPIKey(_0x4b906a,_0x463cef),setCachedCredential(_0x4b906a,_0x353cc8,_0x463cef);const _0x44b5dd=getConfigFilePath(_0x463cef);cleanupLegacyEnvFile(_0x44b5dd)&&console[_0x42809f(0x1ee)](a49_0x14d185[_0x42809f(0x1e4)](_0x42809f(0x1c0)));}export function loadConfig(){const _0x52c481=a49_0xbd79a9,_0x2d2186={'apiKeys':{},'defaultSite':_0x52c481(0x1c9)},_0x328cc5=['us01',_0x52c481(0x1fa),_0x52c481(0x1f5),_0x52c481(0x1ef),_0x52c481(0x1f4),_0x52c481(0x1d3),'dev-eu01','stg-us01',_0x52c481(0x1dc),_0x52c481(0x1c5)],_0x3fc87a=getAPIKey();if(_0x3fc87a)for(const _0x28ef98 of _0x328cc5){_0x2d2186[_0x52c481(0x1e0)][_0x28ef98]=_0x3fc87a;}return _0x2d2186;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x3430ad=a49_0xbd79a9,_0x4c6b14=a49_0x18b6c9[_0x3430ad(0x1b4)](getConfigDir(),_0x3430ad(0x1bb));if(!a49_0x1321f1[_0x3430ad(0x1c4)](_0x4c6b14))return undefined;try{const _0x1ea070=a49_0x1321f1[_0x3430ad(0x1e7)](_0x4c6b14,'utf-8'),_0x36dff8=JSON['parse'](_0x1ea070);return typeof _0x36dff8[_0x3430ad(0x1e2)]===_0x3430ad(0x1ea)?_0x36dff8[_0x3430ad(0x1e2)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x1e30c5=a49_0xbd79a9,_0x7b8427=process.env.TDX_RELEASE_CHANNEL;if(_0x7b8427===_0x1e30c5(0x1ed)||_0x7b8427===_0x1e30c5(0x1fb))return _0x7b8427;const _0x4306da=a49_0x18b6c9[_0x1e30c5(0x1b4)](getConfigDir(),_0x1e30c5(0x1bb));if(!a49_0x1321f1[_0x1e30c5(0x1c4)](_0x4306da))return _0x1e30c5(0x1fb);try{const _0x1ba41b=a49_0x1321f1[_0x1e30c5(0x1e7)](_0x4306da,_0x1e30c5(0x1d6)),_0xcb015e=JSON[_0x1e30c5(0x1ca)](_0x1ba41b);if(_0xcb015e[_0x1e30c5(0x1b6)]===_0x1e30c5(0x1ed))return _0x1e30c5(0x1ed);}catch{}return _0x1e30c5(0x1fb);}export function saveReleaseChannel(_0x4ca9ea){const _0x53d640=a49_0xbd79a9,_0x39c625=getConfigDir(),_0x16abb5=a49_0x18b6c9['join'](_0x39c625,_0x53d640(0x1bb));!existsSync(_0x39c625)&&mkdirSync(_0x39c625,{'recursive':!![],'mode':0x1c0});let _0x383850={};if(existsSync(_0x16abb5))try{const _0x511b7d=readFileSync(_0x16abb5,'utf-8');_0x383850=JSON[_0x53d640(0x1ca)](_0x511b7d);}catch{}_0x383850['release_channel']=_0x4ca9ea,writeFileSync(_0x16abb5,JSON['stringify'](_0x383850,null,0x2),{'mode':0x180});}
1
+ const a49_0x398868=a49_0x3ff2;(function(_0x382167,_0x1cedfa){const _0x58c145=a49_0x3ff2,_0x4b9457=_0x382167();while(!![]){try{const _0x37f290=-parseInt(_0x58c145(0xf8))/0x1*(parseInt(_0x58c145(0xd8))/0x2)+-parseInt(_0x58c145(0xd9))/0x3*(parseInt(_0x58c145(0x107))/0x4)+-parseInt(_0x58c145(0x100))/0x5*(-parseInt(_0x58c145(0xf7))/0x6)+-parseInt(_0x58c145(0x102))/0x7*(parseInt(_0x58c145(0xee))/0x8)+-parseInt(_0x58c145(0x109))/0x9+-parseInt(_0x58c145(0x10a))/0xa*(-parseInt(_0x58c145(0x10e))/0xb)+parseInt(_0x58c145(0x114))/0xc;if(_0x37f290===_0x1cedfa)break;else _0x4b9457['push'](_0x4b9457['shift']());}catch(_0x54ee0f){_0x4b9457['push'](_0x4b9457['shift']());}}}(a49_0x51f2,0x270f0));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a49_0x545e4e from'node:fs';import*as a49_0x5628fe 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 a49_0x5a6609 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x3f5df4=a49_0x3ff2;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x3f5df4(0xfe));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x35999f){const _0x3b7f12=getConfigDir();return _0x35999f?a49_0x5628fe['join'](_0x3b7f12,'.env.'+_0x35999f):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project','config/llm-project');export function getLLMProjectCacheFile(_0x5e43dc){const _0x321cbb=a49_0x3ff2;return llmProjectCache[_0x321cbb(0x10d)](_0x5e43dc);}export function readCachedLLMProject(_0x366548){const _0x2d188d=a49_0x3ff2,_0xce2d4b=llmProjectCache[_0x2d188d(0xe2)](_0x366548);if(_0xce2d4b&&typeof _0xce2d4b['id']==='string'&&typeof _0xce2d4b[_0x2d188d(0xe8)]==='string')return _0xce2d4b;return null;}export function writeCachedLLMProject(_0x238a4f,_0x2847fd,_0x29cbf3){try{llmProjectCache['write']({'name':_0x238a4f,'id':_0x2847fd},_0x29cbf3);}catch{}}const llmAgentCache=createOptionalProfileCache(a49_0x398868(0xfd),'config/llm-agent');export function getLLMAgentCacheFile(_0x5317a4){const _0x2facc9=a49_0x398868;return llmAgentCache[_0x2facc9(0x10d)](_0x5317a4);}export function readCachedLLMAgent(_0xcd291e){const _0x2114bc=a49_0x398868,_0x27f953=llmAgentCache[_0x2114bc(0xe2)](_0xcd291e);if(_0x27f953&&typeof _0x27f953['id']===_0x2114bc(0xfc)&&typeof _0x27f953[_0x2114bc(0xe8)]===_0x2114bc(0xfc)&&typeof _0x27f953[_0x2114bc(0x105)]===_0x2114bc(0xfc))return _0x27f953;return null;}export function writeCachedLLMAgent(_0x145f97,_0xb44486,_0x58cc09,_0xaeb961){const _0x3438f4=a49_0x398868;try{llmAgentCache[_0x3438f4(0xfa)]({'name':_0x145f97,'id':_0xb44486,'projectId':_0x58cc09},_0xaeb961);}catch{}}export function clearCachedLLMAgent(_0x584b54){const _0x3f33f3=a49_0x398868;try{llmAgentCache[_0x3f33f3(0x10f)](_0x584b54);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a49_0x398868(0x101),{'suffix':'.json'});export function getAccountInfoCacheFile(_0x4263b1){const _0x4cca26=a49_0x398868;return accountInfoCache[_0x4cca26(0x10d)](_0x4263b1);}export function readCachedAccountInfo(_0x20821f){const _0x3d6620=a49_0x398868,_0x42642c=accountInfoCache[_0x3d6620(0xe2)](_0x20821f);if(_0x42642c&&typeof _0x42642c[_0x3d6620(0xed)]===_0x3d6620(0xfc)&&typeof _0x42642c['accountId']===_0x3d6620(0xf0))return _0x42642c;return null;}export function writeCachedAccountInfo(_0x40dad2,_0x2ee879,_0x160516){const _0x59eb95=a49_0x398868;try{accountInfoCache[_0x59eb95(0xfa)]({'site':_0x40dad2,'accountId':_0x2ee879,'cachedAt':new Date()[_0x59eb95(0xff)]()},_0x160516);}catch{}}export function parseEnvFile(_0x442890){const _0x4d27ce=a49_0x398868,_0x5372f4={};for(const _0x136291 of _0x442890['split']('\x0a')){const _0x5ac792=_0x136291[_0x4d27ce(0xdb)]();if(!_0x5ac792||_0x5ac792[_0x4d27ce(0xd7)]('#'))continue;const _0x4c5a28=_0x5ac792[_0x4d27ce(0xf2)](/^([^=]+)=(.*)$/);if(_0x4c5a28){const _0x37186f=_0x4c5a28[0x1]['trim']();let _0x2ba0f5=_0x4c5a28[0x2][_0x4d27ce(0xdb)]();(_0x2ba0f5[_0x4d27ce(0xd7)]('\x22')&&_0x2ba0f5[_0x4d27ce(0x116)]('\x22')||_0x2ba0f5['startsWith']('\x27')&&_0x2ba0f5[_0x4d27ce(0x116)]('\x27'))&&(_0x2ba0f5=_0x2ba0f5[_0x4d27ce(0xdc)](0x1,-0x1)),_0x5372f4[_0x37186f]=_0x2ba0f5;}}return _0x5372f4;}function a49_0x51f2(){const _0x23ea34=['string','llm_default_agent','tdx','toISOString','416810FjyIyN','config/account-info','2737lBWMpH','stg-ap03','dev-eu01','projectId','ap02','83116amflZm','keychain','636021rPOUnV','10coLlUl','next','stg-us01','path','2153657oAfYxS','clear','stable','toUpperCase','warn','eu01','7750476hCAbAZ','yellow','endsWith','profile','Warning:\x20Failed\x20to\x20read\x20','dev-us01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','\x27,\x20defaulting\x20to\x20us01','existsSync','TDX_API_KEY_','startsWith','15584apMQlR','39zCRfQy','TD_API_KEY','trim','slice','some','utf-8','us01','keychain\x20(profile:\x20','readFileSync','read','parse','join','replace','\x20env\x20var','apiKey','name','map','TD_API_KEY_','includes','proxy','site','6352zNjTBR','stg-jp01','number','Warning:\x20Unknown\x20site\x20\x27','match','split','release_channel','filter','jp01','18XQHmdc','36mtclNv','ap03','write','tdx.json'];a49_0x51f2=function(){return _0x23ea34;};return a49_0x51f2();}export function readUserConfig(){const _0x45e9c7=a49_0x398868,_0x254f8a=getConfigFile();if(!existsSync(_0x254f8a))return{};try{const _0x27e113=readFileSync(_0x254f8a,_0x45e9c7(0xde));return parseEnvFile(_0x27e113);}catch(_0x3c138d){return console[_0x45e9c7(0x112)](_0x45e9c7(0x11a)+_0x254f8a+':',_0x3c138d),{};}}export function resolveSite(_0x257e44){const _0x47ff20=a49_0x398868,_0x728b0=[_0x47ff20(0xdf),_0x47ff20(0xf6),_0x47ff20(0x113),'ap02',_0x47ff20(0xf9),_0x47ff20(0x119),_0x47ff20(0x104),_0x47ff20(0x10c),'stg-jp01',_0x47ff20(0x103)];if(_0x728b0[_0x47ff20(0xeb)](_0x257e44))return _0x257e44;if(_0x257e44 in SITE_ALIASES)return SITE_ALIASES[_0x257e44];return console['warn'](_0x47ff20(0xf1)+_0x257e44+_0x47ff20(0x11b)),_0x47ff20(0xdf);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x8ad57b){const _0x3c1f1f=a49_0x398868,_0x191dc8=_0x8ad57b||getActiveProfileName();if(_0x191dc8){const _0x35f62b=_0x3c1f1f(0x11d)+normalizeProfileForEnvVar(_0x191dc8);if(process.env[_0x35f62b])return process.env[_0x35f62b];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x2bf6b2){const _0x586d66=a49_0x398868;return _0x2bf6b2[_0x586d66(0x111)]()[_0x586d66(0xe5)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x340846,_0xdeebc){const _0x5e5412=a49_0x398868,_0xd1b5d6=_0xdeebc||getActiveProfileName()||undefined;if(_0xd1b5d6){const _0x4416d1=_0x5e5412(0x11d)+normalizeProfileForEnvVar(_0xd1b5d6);if(process.env[_0x4416d1])return{'apiKey':process.env[_0x4416d1],'source':_0x4416d1+_0x5e5412(0xe6),'isDeprecated':![]};const _0x4966a8=getCachedCredential(_0x340846,_0xd1b5d6);if(_0x4966a8)return{'apiKey':_0x4966a8,'source':_0x5e5412(0xe0)+_0xd1b5d6+')','isDeprecated':![]};const _0x4ee294=await getKeychainAPIKey(_0xd1b5d6);if(_0x4ee294)return setCachedCredential(_0x4ee294,_0x340846,_0xd1b5d6),{'apiKey':_0x4ee294,'source':_0x5e5412(0xe0)+_0xd1b5d6+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0xd1b5d6){const _0x43cfa4=getCachedCredential(_0x340846,undefined);if(_0x43cfa4)return{'apiKey':_0x43cfa4,'source':_0x5e5412(0x108),'isDeprecated':![]};const _0x1687b8=await getKeychainAPIKey(undefined);if(_0x1687b8)return setCachedCredential(_0x1687b8,_0x340846,undefined),{'apiKey':_0x1687b8,'source':_0x5e5412(0x108),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x33826c,_0x3dd1f4){const _0x4c5a72=a49_0x398868,_0x4681c6=await resolveAPIKeyAsync(_0x33826c,_0x3dd1f4);return _0x4681c6?.[_0x4c5a72(0xe7)];}function cleanupLegacyEnvFile(_0x2b95c0){const _0xa809c=a49_0x398868;if(!existsSync(_0x2b95c0))return![];try{const _0x2bf811=readFileSync(_0x2b95c0,_0xa809c(0xde)),_0x494cc1=_0x2bf811[_0xa809c(0xf3)]('\x0a'),_0x58ca41=_0x494cc1[_0xa809c(0xf5)](_0x2b00a1=>{const _0x17663a=_0xa809c,_0x1056c5=_0x2b00a1['trim']();if(!_0x1056c5||_0x1056c5[_0x17663a(0xd7)]('#'))return!![];const [_0x12b6dd]=_0x1056c5[_0x17663a(0xf3)]('=');return!_0x12b6dd[_0x17663a(0xd7)](_0x17663a(0xda));}),_0x5185c6=_0x58ca41[_0xa809c(0xdd)](_0x57ba66=>{const _0xb6b04f=_0xa809c,_0x305813=_0x57ba66[_0xb6b04f(0xdb)]();return _0x305813&&!_0x305813[_0xb6b04f(0xd7)]('#');});if(!_0x5185c6)return unlinkSync(_0x2b95c0),!![];return writeFileSync(_0x2b95c0,_0x58ca41[_0xa809c(0xe4)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x2f9c0e=a49_0x398868;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xc1d22b=a49_0x5628fe[_0x2f9c0e(0xe4)](getConfigDir(),_0x2f9c0e(0xfb));if(!a49_0x545e4e[_0x2f9c0e(0x11c)](_0xc1d22b))return null;try{const _0x141d50=a49_0x545e4e[_0x2f9c0e(0xe1)](_0xc1d22b,_0x2f9c0e(0xde)),_0x9d7516=JSON[_0x2f9c0e(0xe3)](_0x141d50);return _0x9d7516[_0x2f9c0e(0x117)]||null;}catch{return null;}}export function saveAPIKey(_0x22061c,_0x445f46,_0x20a0a7){const _0x3f1858=a49_0x398868,_0x35a4ed=getConfigDir(),_0x1d2168=getConfigFilePath(_0x20a0a7);!existsSync(_0x35a4ed)&&mkdirSync(_0x35a4ed,{'recursive':!![],'mode':0x1c0});let _0x2f8e95={};if(existsSync(_0x1d2168))try{const _0x1b24ca=readFileSync(_0x1d2168,_0x3f1858(0xde));_0x2f8e95=parseEnvFile(_0x1b24ca);}catch(_0x4e3ad5){console[_0x3f1858(0x112)](_0x3f1858(0x118)+_0x1d2168+':',_0x4e3ad5);}const _0x2ce31f=_0x22061c[_0x3f1858(0x111)]()[_0x3f1858(0xe5)](/-/g,'_');_0x2f8e95[_0x3f1858(0xea)+_0x2ce31f]=_0x445f46;const _0x2169ac=Object['entries'](_0x2f8e95)[_0x3f1858(0xe9)](([_0x59a2d1,_0x2932c5])=>_0x59a2d1+'='+_0x2932c5);writeFileSync(_0x1d2168,_0x2169ac[_0x3f1858(0xe4)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x2a68ec,_0x4a2e7e,_0x420acf){const _0x49918f=a49_0x398868;await saveKeychainAPIKey(_0x2a68ec,_0x420acf),setCachedCredential(_0x2a68ec,_0x4a2e7e,_0x420acf);const _0xa88571=getConfigFilePath(_0x420acf);cleanupLegacyEnvFile(_0xa88571)&&console[_0x49918f(0x112)](a49_0x5a6609[_0x49918f(0x115)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x43f956=a49_0x398868,_0x4e7149={'apiKeys':{},'defaultSite':'us01'},_0xe60ac0=[_0x43f956(0xdf),'jp01',_0x43f956(0x113),_0x43f956(0x106),_0x43f956(0xf9),'dev-us01',_0x43f956(0x104),'stg-us01',_0x43f956(0xef),'stg-ap03'],_0x11fa01=getAPIKey();if(_0x11fa01)for(const _0x2a2600 of _0xe60ac0){_0x4e7149['apiKeys'][_0x2a2600]=_0x11fa01;}return _0x4e7149;}function a49_0x3ff2(_0x45735c,_0xa98b07){_0x45735c=_0x45735c-0xd7;const _0x51f227=a49_0x51f2();let _0x3ff213=_0x51f227[_0x45735c];return _0x3ff213;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x5a47ae=a49_0x398868,_0x492f49=a49_0x5628fe[_0x5a47ae(0xe4)](getConfigDir(),'tdx.json');if(!a49_0x545e4e[_0x5a47ae(0x11c)](_0x492f49))return undefined;try{const _0x406e62=a49_0x545e4e[_0x5a47ae(0xe1)](_0x492f49,'utf-8'),_0x2c26db=JSON[_0x5a47ae(0xe3)](_0x406e62);return typeof _0x2c26db[_0x5a47ae(0xec)]===_0x5a47ae(0xfc)?_0x2c26db[_0x5a47ae(0xec)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x1d70d1=a49_0x398868,_0x18b730=process.env.TDX_RELEASE_CHANNEL;if(_0x18b730===_0x1d70d1(0x10b)||_0x18b730===_0x1d70d1(0x110))return _0x18b730;const _0x3fa17d=a49_0x5628fe[_0x1d70d1(0xe4)](getConfigDir(),_0x1d70d1(0xfb));if(!a49_0x545e4e[_0x1d70d1(0x11c)](_0x3fa17d))return _0x1d70d1(0x110);try{const _0x54be38=a49_0x545e4e['readFileSync'](_0x3fa17d,_0x1d70d1(0xde)),_0x4c3dce=JSON[_0x1d70d1(0xe3)](_0x54be38);if(_0x4c3dce[_0x1d70d1(0xf4)]===_0x1d70d1(0x10b))return _0x1d70d1(0x10b);}catch{}return _0x1d70d1(0x110);}export function saveReleaseChannel(_0x414f1e){const _0x1e0c59=a49_0x398868,_0x1c910d=getConfigDir(),_0x25d05b=a49_0x5628fe['join'](_0x1c910d,_0x1e0c59(0xfb));!existsSync(_0x1c910d)&&mkdirSync(_0x1c910d,{'recursive':!![],'mode':0x1c0});let _0xec38a6={};if(existsSync(_0x25d05b))try{const _0x490c7d=readFileSync(_0x25d05b,'utf-8');_0xec38a6=JSON[_0x1e0c59(0xe3)](_0x490c7d);}catch{}_0xec38a6['release_channel']=_0x414f1e,writeFileSync(_0x25d05b,JSON['stringify'](_0xec38a6,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a50_0x24f38c=a50_0x5df1;(function(_0x16405d,_0x5be5df){const _0x469305=a50_0x5df1,_0x55cb8a=_0x16405d();while(!![]){try{const _0x1dfa24=parseInt(_0x469305(0xd2))/0x1*(parseInt(_0x469305(0xcd))/0x2)+parseInt(_0x469305(0xc9))/0x3*(-parseInt(_0x469305(0xd5))/0x4)+-parseInt(_0x469305(0xcb))/0x5+parseInt(_0x469305(0xd3))/0x6+parseInt(_0x469305(0xd0))/0x7+-parseInt(_0x469305(0xcf))/0x8+-parseInt(_0x469305(0xca))/0x9;if(_0x1dfa24===_0x5be5df)break;else _0x55cb8a['push'](_0x55cb8a['shift']());}catch(_0x4947d2){_0x55cb8a['push'](_0x55cb8a['shift']());}}}(a50_0x20cd,0xf063a));import{createProfileCache}from'../utils/global-cache.js';function a50_0x20cd(){const _0x3b37ee=['clear','8VyNhJH','72069jnbJIq','4526631jIcoqJ','6677720kbvoTp','write','40LPkBHI','core/connection-cache','4968360abZYNl','9665544tvDwfO','connections','67411tFodCT','4579296fuAONX'];a50_0x20cd=function(){return _0x3b37ee;};return a50_0x20cd();}function a50_0x5df1(_0x195cec,_0x286df3){_0x195cec=_0x195cec-0xc9;const _0x20cd88=a50_0x20cd();let _0x5df19a=_0x20cd88[_0x195cec];return _0x5df19a;}const connectionCache=createProfileCache('connections-{profile}.json',a50_0x24f38c(0xce));export function loadCachedConnections(_0x87b657){const _0x3e4fc7=a50_0x24f38c,_0x33f4bb=connectionCache['read'](_0x87b657);return _0x33f4bb?.[_0x3e4fc7(0xd1)]??null;}export function saveCachedConnections(_0x47ba50,_0x37d446){const _0x4391c0=a50_0x24f38c;connectionCache[_0x4391c0(0xcc)](_0x47ba50,{'connections':_0x37d446,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x3353cf){const _0x212028=a50_0x24f38c;connectionCache[_0x212028(0xd4)](_0x3353cf);}
1
+ function a50_0x3deb(){const _0x3e5079=['clear','core/connection-cache','connections','943290LiSwkN','connections-{profile}.json','155944ahBMki','50HtCSdZ','329CvbhkW','write','408875STUAKq','3JnDcJl','1260626CzBgEI','106005NKaEKs','2292308BZJVSD','3238062tXYRlI','read'];a50_0x3deb=function(){return _0x3e5079;};return a50_0x3deb();}const a50_0x5d943b=a50_0x57c2;(function(_0x18877e,_0x2bc319){const _0x52432a=a50_0x57c2,_0x51ef68=_0x18877e();while(!![]){try{const _0x4d37c4=-parseInt(_0x52432a(0x170))/0x1+-parseInt(_0x52432a(0x172))/0x2*(parseInt(_0x52432a(0x171))/0x3)+parseInt(_0x52432a(0x174))/0x4+parseInt(_0x52432a(0x173))/0x5+parseInt(_0x52432a(0x175))/0x6+-parseInt(_0x52432a(0x16e))/0x7*(-parseInt(_0x52432a(0x16c))/0x8)+parseInt(_0x52432a(0x17a))/0x9*(-parseInt(_0x52432a(0x16d))/0xa);if(_0x4d37c4===_0x2bc319)break;else _0x51ef68['push'](_0x51ef68['shift']());}catch(_0x1f0973){_0x51ef68['push'](_0x51ef68['shift']());}}}(a50_0x3deb,0x76de8));import{createProfileCache}from'../utils/global-cache.js';function a50_0x57c2(_0x44f582,_0x5b2994){_0x44f582=_0x44f582-0x16b;const _0x3debde=a50_0x3deb();let _0x57c25e=_0x3debde[_0x44f582];return _0x57c25e;}const connectionCache=createProfileCache(a50_0x5d943b(0x16b),a50_0x5d943b(0x178));export function loadCachedConnections(_0x58fdf3){const _0x71510b=a50_0x5d943b,_0x2a220b=connectionCache[_0x71510b(0x176)](_0x58fdf3);return _0x2a220b?.[_0x71510b(0x179)]??null;}export function saveCachedConnections(_0x1d17d9,_0x49bda4){const _0x2a1f1f=a50_0x5d943b;connectionCache[_0x2a1f1f(0x16f)](_0x1d17d9,{'connections':_0x49bda4,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x1ef2af){const _0xcc6020=a50_0x5d943b;connectionCache[_0xcc6020(0x177)](_0x1ef2af);}
@@ -1 +1 @@
1
- const a51_0x226b96=a51_0x4506;(function(_0x43cdf7,_0x3fd15b){const _0x3c3c66=a51_0x4506,_0x3e98d6=_0x43cdf7();while(!![]){try{const _0x262571=parseInt(_0x3c3c66(0xc2))/0x1+parseInt(_0x3c3c66(0xbc))/0x2*(-parseInt(_0x3c3c66(0xbf))/0x3)+parseInt(_0x3c3c66(0xb9))/0x4*(parseInt(_0x3c3c66(0xcd))/0x5)+-parseInt(_0x3c3c66(0xc1))/0x6+parseInt(_0x3c3c66(0xc0))/0x7+parseInt(_0x3c3c66(0xc6))/0x8+-parseInt(_0x3c3c66(0xbb))/0x9*(parseInt(_0x3c3c66(0xc9))/0xa);if(_0x262571===_0x3fd15b)break;else _0x3e98d6['push'](_0x3e98d6['shift']());}catch(_0x46be43){_0x3e98d6['push'](_0x3e98d6['shift']());}}}(a51_0x2940,0xf04e2));function a51_0x4506(_0x74aff6,_0x204146){_0x74aff6=_0x74aff6-0xb8;const _0x29404b=a51_0x2940();let _0x4506ec=_0x29404b[_0x74aff6];return _0x4506ec;}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;function a51_0x2940(){const _0x55eeae=['jp\x20\x20\x20-\x20Japan','44mJhVzy','number','5143041DthMAj','6dspnXn','eu\x20\x20\x20-\x20Europe','ap02','521499fHYzCd','8584723hPSoVT','3799476JbmSUh','729558vVVkQw','jp01','Enter\x20custom\x20site','eu01','506104MGNeAv','us01','push','20zwFtFB','us\x20\x20\x20-\x20United\x20States','other','value','573965yuBcZy','length'];a51_0x2940=function(){return _0x55eeae;};return a51_0x2940();}export function resolveLimit(_0x2abf2b,_0x22d841){const _0x25511a=a51_0x4506;if(_0x2abf2b===undefined)return _0x22d841;if(typeof _0x2abf2b===_0x25511a(0xba))return _0x2abf2b;return parseInt(_0x2abf2b,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a51_0x226b96(0xca),'value':a51_0x226b96(0xc7)},{'title':a51_0x226b96(0xb8),'value':a51_0x226b96(0xc3)},{'title':a51_0x226b96(0xbd),'value':a51_0x226b96(0xc5)},{'title':'ap02\x20-\x20Korea','value':a51_0x226b96(0xbe)}];export function buildSiteChoices(_0x533608){const _0x366bb8=a51_0x226b96,_0x396f62=[...STANDARD_SITE_CHOICES];let _0x2927c9=_0x396f62['findIndex'](_0x429392=>_0x429392[_0x366bb8(0xcc)]===_0x533608);return _0x2927c9===-0x1&&_0x533608!=='us01'&&(_0x396f62[_0x366bb8(0xc8)]({'title':_0x533608,'value':_0x533608}),_0x2927c9=_0x396f62[_0x366bb8(0xce)]-0x1),_0x396f62['push']({'title':_0x366bb8(0xc4),'value':_0x366bb8(0xcb)}),{'choices':_0x396f62,'initialIndex':_0x2927c9>=0x0?_0x2927c9:0x0};}
1
+ const a51_0x59c378=a51_0x39f1;(function(_0x2dd13b,_0x25501d){const _0x353dbe=a51_0x39f1,_0x49941b=_0x2dd13b();while(!![]){try{const _0x29016e=-parseInt(_0x353dbe(0x17d))/0x1+parseInt(_0x353dbe(0x16a))/0x2+parseInt(_0x353dbe(0x181))/0x3*(-parseInt(_0x353dbe(0x16f))/0x4)+-parseInt(_0x353dbe(0x17c))/0x5*(parseInt(_0x353dbe(0x175))/0x6)+parseInt(_0x353dbe(0x17a))/0x7*(-parseInt(_0x353dbe(0x180))/0x8)+parseInt(_0x353dbe(0x16c))/0x9*(parseInt(_0x353dbe(0x179))/0xa)+-parseInt(_0x353dbe(0x17b))/0xb*(-parseInt(_0x353dbe(0x170))/0xc);if(_0x29016e===_0x25501d)break;else _0x49941b['push'](_0x49941b['shift']());}catch(_0x380085){_0x49941b['push'](_0x49941b['shift']());}}}(a51_0x2fd2,0x43d07));export const DEFAULT_DISPLAY_LIMIT=0x28;function a51_0x39f1(_0x12aee2,_0x155331){_0x12aee2=_0x12aee2-0x16a;const _0x2fd2b1=a51_0x2fd2();let _0x39f12d=_0x2fd2b1[_0x12aee2];return _0x39f12d;}export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x4c6e27,_0x4644ba){const _0x11430f=a51_0x39f1;if(_0x4c6e27===undefined)return _0x4644ba;if(typeof _0x4c6e27===_0x11430f(0x171))return _0x4c6e27;return parseInt(_0x4c6e27,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a51_0x59c378(0x17f),'value':a51_0x59c378(0x176)},{'title':'jp\x20\x20\x20-\x20Japan','value':a51_0x59c378(0x174)},{'title':a51_0x59c378(0x16d),'value':'eu01'},{'title':'ap02\x20-\x20Korea','value':a51_0x59c378(0x172)}];function a51_0x2fd2(){const _0x51658d=['28qOVgrf','3519582AANbQN','778445rXVnYo','477719QnnPCN','other','us\x20\x20\x20-\x20United\x20States','117896UWgWkN','127071zrIBTG','102412RJVwHw','findIndex','1794906bFPSBg','eu\x20\x20\x20-\x20Europe','push','8BKzGDb','36HvDLEc','number','ap02','Enter\x20custom\x20site','jp01','12kVXffO','us01','value','length','10ZurchP'];a51_0x2fd2=function(){return _0x51658d;};return a51_0x2fd2();}export function buildSiteChoices(_0x5a9588){const _0x126a98=a51_0x59c378,_0x4ea2ae=[...STANDARD_SITE_CHOICES];let _0x546410=_0x4ea2ae[_0x126a98(0x16b)](_0x113fde=>_0x113fde[_0x126a98(0x177)]===_0x5a9588);return _0x546410===-0x1&&_0x5a9588!=='us01'&&(_0x4ea2ae[_0x126a98(0x16e)]({'title':_0x5a9588,'value':_0x5a9588}),_0x546410=_0x4ea2ae[_0x126a98(0x178)]-0x1),_0x4ea2ae[_0x126a98(0x16e)]({'title':_0x126a98(0x173),'value':_0x126a98(0x17e)}),{'choices':_0x4ea2ae,'initialIndex':_0x546410>=0x0?_0x546410:0x0};}
@@ -1 +1 @@
1
- (function(_0x264a6d,_0x205808){const _0x590ee8=a52_0x54df,_0x32a6e1=_0x264a6d();while(!![]){try{const _0x1397a1=-parseInt(_0x590ee8(0xfc))/0x1+-parseInt(_0x590ee8(0xf5))/0x2+parseInt(_0x590ee8(0x103))/0x3+parseInt(_0x590ee8(0xfd))/0x4+-parseInt(_0x590ee8(0x102))/0x5+parseInt(_0x590ee8(0xf6))/0x6*(parseInt(_0x590ee8(0xf8))/0x7)+-parseInt(_0x590ee8(0xff))/0x8*(-parseInt(_0x590ee8(0x101))/0x9);if(_0x1397a1===_0x205808)break;else _0x32a6e1['push'](_0x32a6e1['shift']());}catch(_0x20a496){_0x32a6e1['push'](_0x32a6e1['shift']());}}}(a52_0xcbfa,0xd8fde));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3a322f,_0x42c49b){const _0x46774e=a52_0x54df,_0x1487a4=_0x3a322f||'__default_site__',_0x4c4990=_0x42c49b||_0x46774e(0xf9);return _0x1487a4+':'+_0x4c4990;}export function getCachedCredential(_0x447c2a,_0x39b8da){const _0x2c99d0=a52_0x54df,_0x4e94a1=getCacheKey(_0x447c2a,_0x39b8da),_0x52a63c=cache[_0x2c99d0(0xf7)](_0x4e94a1);if(!_0x52a63c)return null;if(Date[_0x2c99d0(0x100)]()-_0x52a63c[_0x2c99d0(0xfe)]>CACHE_TTL_MS)return cache[_0x2c99d0(0xfb)](_0x4e94a1),null;return _0x52a63c['apiKey'];}export function setCachedCredential(_0x3e987a,_0x4f550a,_0x1faa73){const _0x5bcb8d=a52_0x54df,_0x2cf4c3=getCacheKey(_0x4f550a,_0x1faa73);cache[_0x5bcb8d(0xfa)](_0x2cf4c3,{'apiKey':_0x3e987a,'loadedAt':Date[_0x5bcb8d(0x100)]()});}export function clearCredentialCache(){const _0x10786f=a52_0x54df;cache[_0x10786f(0xf4)]();}function a52_0x54df(_0x5e3f94,_0x25f86b){_0x5e3f94=_0x5e3f94-0xf4;const _0xcbfa01=a52_0xcbfa();let _0x54dfc7=_0xcbfa01[_0x5e3f94];return _0x54dfc7;}export function clearCachedCredential(_0x367985,_0x66f33a){const _0xd53c39=getCacheKey(_0x367985,_0x66f33a);cache['delete'](_0xd53c39);}function a52_0xcbfa(){const _0x19f011=['loadedAt','1095880vSlYYg','now','207hAiISz','4239245krLaes','1443345PJdZbb','clear','2597998wlbona','798OSKCgF','get','21175TBOpku','__default_profile__','set','delete','1405099thqMoe','1626600heAdAD'];a52_0xcbfa=function(){return _0x19f011;};return a52_0xcbfa();}
1
+ (function(_0x42023f,_0x5ab44e){const _0x45706e=a52_0x4142,_0x17a522=_0x42023f();while(!![]){try{const _0x380f5f=-parseInt(_0x45706e(0xc4))/0x1+-parseInt(_0x45706e(0xce))/0x2*(-parseInt(_0x45706e(0xc7))/0x3)+parseInt(_0x45706e(0xc5))/0x4*(parseInt(_0x45706e(0xc2))/0x5)+parseInt(_0x45706e(0xc0))/0x6+parseInt(_0x45706e(0xc1))/0x7*(parseInt(_0x45706e(0xcb))/0x8)+-parseInt(_0x45706e(0xcd))/0x9+parseInt(_0x45706e(0xc9))/0xa;if(_0x380f5f===_0x5ab44e)break;else _0x17a522['push'](_0x17a522['shift']());}catch(_0x38e09b){_0x17a522['push'](_0x17a522['shift']());}}}(a52_0x742d,0xad902));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x373798,_0x32af20){const _0x1de671=a52_0x4142,_0x97f6b6=_0x373798||_0x1de671(0xc8),_0x5756d4=_0x32af20||'__default_profile__';return _0x97f6b6+':'+_0x5756d4;}export function getCachedCredential(_0xecc941,_0x2e12c5){const _0x21721b=a52_0x4142,_0x4be311=getCacheKey(_0xecc941,_0x2e12c5),_0x55e6ee=cache[_0x21721b(0xcf)](_0x4be311);if(!_0x55e6ee)return null;if(Date[_0x21721b(0xca)]()-_0x55e6ee['loadedAt']>CACHE_TTL_MS)return cache[_0x21721b(0xc3)](_0x4be311),null;return _0x55e6ee[_0x21721b(0xcc)];}function a52_0x4142(_0xc1753e,_0x41cc94){_0xc1753e=_0xc1753e-0xc0;const _0x742db9=a52_0x742d();let _0x41426d=_0x742db9[_0xc1753e];return _0x41426d;}export function setCachedCredential(_0x4d5aed,_0x30623c,_0x40a182){const _0x4b5a40=a52_0x4142,_0x2ee19d=getCacheKey(_0x30623c,_0x40a182);cache[_0x4b5a40(0xc6)](_0x2ee19d,{'apiKey':_0x4d5aed,'loadedAt':Date[_0x4b5a40(0xca)]()});}export function clearCredentialCache(){cache['clear']();}function a52_0x742d(){const _0x5f05b4=['delete','1347417WgJepr','4IWiVUm','set','10188efacYt','__default_site__','12257450ypoRkH','now','531704uwfDQb','apiKey','5360463bVRftB','2hcLaQX','get','3897192TkVZKT','21OSkNpz','2879380zoAqmN'];a52_0x742d=function(){return _0x5f05b4;};return a52_0x742d();}export function clearCachedCredential(_0x1f1143,_0x52a9ef){const _0x47b408=getCacheKey(_0x1f1143,_0x52a9ef);cache['delete'](_0x47b408);}
@@ -1 +1 @@
1
- const a53_0x55163c=a53_0x1669;(function(_0x53d423,_0x1c222c){const _0x241554=a53_0x1669,_0x4506f3=_0x53d423();while(!![]){try{const _0x3a6737=-parseInt(_0x241554(0x1cb))/0x1+parseInt(_0x241554(0x1c0))/0x2*(-parseInt(_0x241554(0x1e2))/0x3)+parseInt(_0x241554(0x1db))/0x4+parseInt(_0x241554(0x1c3))/0x5+-parseInt(_0x241554(0x1d8))/0x6+-parseInt(_0x241554(0x1c5))/0x7+-parseInt(_0x241554(0x1aa))/0x8*(-parseInt(_0x241554(0x1d7))/0x9);if(_0x3a6737===_0x1c222c)break;else _0x4506f3['push'](_0x4506f3['shift']());}catch(_0x55eff0){_0x4506f3['push'](_0x4506f3['shift']());}}}(a53_0x4a18,0x398a2));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a53_0x29b77f from'node:fs';import*as a53_0x477d1f from'node:path';function a53_0x1669(_0x5d9b5d,_0x5a138a){_0x5d9b5d=_0x5d9b5d-0x197;const _0x4a18b7=a53_0x4a18();let _0x1669bd=_0x4a18b7[_0x5d9b5d];return _0x1669bd;}import a53_0x3989de from'chalk';function a53_0x4a18(){const _0xb6f235=['Global\x20Credentials','Global','none','us01','452224nCAPhO','existsSync','(using\x20session:\x20','profileSource','tdx.json','llm_project','layers','join','Profile\x20Credentials','parentSegment','configFiles','parent_segment','loadGlobalConfig','workflow_project','database','CLI\x20flag:\x20--','log','dim','readFileSync','activeProfile','profile','cliFlags','151748LfgGFF','config','green','1966245DGLZQp','segment_path','2827503OsDQGw','session','site','not\x20set','Profile','default','23287VnOcJK','resolveAPIKeyAsync','workflowProject','globalCredentials','injectIntoOptions','verbose','llmProject','sessions','llm_agent','global','project','[context]','72EEjXuw','1522494POxdqm','assign','(session:\x20','891688TqGRUF','INFO','display','sessionId','Project','.env','string','6ZqjihU','createAsync','profiles','getSource','getParameters','apiKey','cli','[configuration\x20files]','profileCredentials','(active)','llmAgent','proxy','bold','segmentPath','parse','Session','env','cyan'];a53_0x4a18=function(){return _0xb6f235;};return a53_0x4a18();}export class GlobalContext{['site'];[a53_0x55163c(0x1b8)];[a53_0x55163c(0x1b5)];['segment_path'];[a53_0x55163c(0x1af)];[a53_0x55163c(0x1d3)];[a53_0x55163c(0x1b7)];[a53_0x55163c(0x199)];[a53_0x55163c(0x19f)];[a53_0x55163c(0x1d0)];['logLevel'];[a53_0x55163c(0x1be)];[a53_0x55163c(0x1ad)]=null;[a53_0x55163c(0x1b0)];[a53_0x55163c(0x1bd)];[a53_0x55163c(0x1de)];[a53_0x55163c(0x1b4)];constructor(_0x3454e6){const _0x4f52c6=a53_0x55163c;this[_0x4f52c6(0x1de)]=getSessionID(_0x3454e6[_0x4f52c6(0x1c6)]);const _0x1a32b2=loadSessionContext(_0x3454e6[_0x4f52c6(0x1c6)]),_0x691790=loadProjectConfig(),_0x178a1a=this[_0x4f52c6(0x1b6)]();if(_0x3454e6['profile'])this['activeProfile']=_0x3454e6[_0x4f52c6(0x1be)],this[_0x4f52c6(0x1ad)]=_0x4f52c6(0x19a);else{if(_0x1a32b2?.[_0x4f52c6(0x1be)])this['activeProfile']=_0x1a32b2[_0x4f52c6(0x1be)],this[_0x4f52c6(0x1ad)]='session';else{if(_0x178a1a[_0x4f52c6(0x1be)])this[_0x4f52c6(0x1bd)]=_0x178a1a[_0x4f52c6(0x1be)],this['profileSource']='config';else process.env.TDX_PROFILE?(this[_0x4f52c6(0x1bd)]=process.env.TDX_PROFILE,this[_0x4f52c6(0x1ad)]=_0x4f52c6(0x1a4)):(this[_0x4f52c6(0x1bd)]=null,this['profileSource']=null);}}const _0x15bb25=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x33d33f=_0x1d2220=>{const _0x1b4913=_0x4f52c6;if(!_0x1d2220)return{};const _0x79649f=_0x1d2220,_0x2dfc62={};for(const [_0x288556,_0x56eb89]of Object['entries'](_0x79649f)){typeof _0x56eb89===_0x1b4913(0x1e1)&&(_0x2dfc62[_0x288556]=_0x56eb89);}return _0x2dfc62;},_0x2169ed={},_0x254733=(_0x4ec32f,_0x22b578,_0x473fe7)=>{const _0x3df16e=_0x4f52c6;if(!_0x4ec32f)return![];if(_0x473fe7&&_0x4ec32f===_0x473fe7)return![];const _0x44f537=_0x1a32b2,_0x3ece74=_0x691790,_0x2d7ada=_0x15bb25?.[_0x3df16e(0x1c1)],_0x1a3b81=_0x178a1a,_0x3a701f=_0x44f537?.[_0x22b578],_0x2a2365=_0x3ece74?.[_0x22b578],_0x36597e=_0x2d7ada?.[_0x22b578],_0x42aadf=_0x1a3b81[_0x22b578];return _0x4ec32f!==_0x3a701f&&_0x4ec32f!==_0x2a2365&&_0x4ec32f!==_0x36597e&&_0x4ec32f!==_0x42aadf;},_0x3158d2=[{'optionKey':_0x4f52c6(0x1c7),'contextKey':'site','defaultValue':_0x4f52c6(0x1a9)},{'optionKey':_0x4f52c6(0x1b8),'contextKey':_0x4f52c6(0x1b8)},{'optionKey':_0x4f52c6(0x1b3),'contextKey':_0x4f52c6(0x1b5)},{'optionKey':_0x4f52c6(0x1d1),'contextKey':_0x4f52c6(0x1af)},{'optionKey':_0x4f52c6(0x19e),'contextKey':'llm_agent'},{'optionKey':_0x4f52c6(0x1be),'contextKey':_0x4f52c6(0x1be)}];for(const {optionKey:_0x247c85,contextKey:_0x5085af,defaultValue:_0x1b2773}of _0x3158d2){const _0x9492e2=_0x3454e6[_0x247c85];_0x254733(_0x9492e2,_0x5085af,_0x1b2773)&&(_0x2169ed[_0x5085af]=_0x9492e2);}this[_0x4f52c6(0x1b0)]={'cliFlags':_0x2169ed,'session':_0x33d33f(_0x1a32b2),'project':_0x33d33f(_0x691790),'profile':_0x33d33f(_0x15bb25?.[_0x4f52c6(0x1c1)]),'global':_0x33d33f(_0x178a1a)};const _0x2ecdb1={...this[_0x4f52c6(0x1b0)][_0x4f52c6(0x1d4)],...this[_0x4f52c6(0x1b0)][_0x4f52c6(0x1be)],...this[_0x4f52c6(0x1b0)]['project']};process.env.TDX_SITE&&!this[_0x4f52c6(0x1b0)][_0x4f52c6(0x1c6)]['site']&&!this[_0x4f52c6(0x1b0)][_0x4f52c6(0x1bf)][_0x4f52c6(0x1c7)]&&(_0x2ecdb1[_0x4f52c6(0x1c7)]=process.env.TDX_SITE);Object[_0x4f52c6(0x1d9)](_0x2ecdb1,this['layers'][_0x4f52c6(0x1c6)]),Object[_0x4f52c6(0x1d9)](_0x2ecdb1,this[_0x4f52c6(0x1b0)][_0x4f52c6(0x1bf)]);const _0x11dea4=_0x2ecdb1[_0x4f52c6(0x1c7)]||_0x4f52c6(0x1a9);this[_0x4f52c6(0x1c7)]=resolveSite(_0x11dea4),this[_0x4f52c6(0x1b8)]=_0x2ecdb1['database'],this[_0x4f52c6(0x1b5)]=_0x2ecdb1[_0x4f52c6(0x1b5)],this['segment_path']=_0x2ecdb1[_0x4f52c6(0x1c4)],this[_0x4f52c6(0x1af)]=_0x2ecdb1[_0x4f52c6(0x1af)],this[_0x4f52c6(0x1d3)]=_0x2ecdb1[_0x4f52c6(0x1d3)],this['workflow_project']=_0x2ecdb1[_0x4f52c6(0x1b7)],this[_0x4f52c6(0x1d0)]=_0x3454e6[_0x4f52c6(0x1d0)]||![],this['logLevel']=_0x3454e6['logLevel']??LogLevel[_0x4f52c6(0x1dc)],this[_0x4f52c6(0x1be)]=this[_0x4f52c6(0x1bd)]||undefined,this['apiKey']=getAPIKey(this['activeProfile']||undefined);const _0x20abb5=typeof _0x178a1a[_0x4f52c6(0x19f)]===_0x4f52c6(0x1e1)?_0x178a1a['proxy']:undefined;this[_0x4f52c6(0x19f)]=_0x20abb5||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x103986=getConfigDir(),_0x40dae9=a53_0x477d1f[_0x4f52c6(0x1b1)](_0x103986,_0x4f52c6(0x1d2),this['sessionId']+'.json'),_0x16455b=findProjectConfigPath(),_0x447d62=a53_0x477d1f[_0x4f52c6(0x1b1)](_0x103986,'tdx.json'),_0x4a7add=a53_0x477d1f[_0x4f52c6(0x1b1)](_0x103986,_0x4f52c6(0x1e0));let _0x25ef17=null,_0x111e42=null;this['activeProfile']&&(_0x25ef17=a53_0x477d1f[_0x4f52c6(0x1b1)](_0x103986,_0x4f52c6(0x1e4),this[_0x4f52c6(0x1bd)],'tdx.json'),_0x111e42=a53_0x477d1f[_0x4f52c6(0x1b1)](_0x103986,'profiles',this[_0x4f52c6(0x1bd)],_0x4f52c6(0x1e0))),this['configFiles']={'session':a53_0x29b77f['existsSync'](_0x40dae9)?_0x40dae9:null,'project':_0x16455b,'profile':_0x25ef17&&a53_0x29b77f['existsSync'](_0x25ef17)?_0x25ef17:null,'profileCredentials':_0x111e42&&a53_0x29b77f[_0x4f52c6(0x1ab)](_0x111e42)?_0x111e42:null,'global':a53_0x29b77f['existsSync'](_0x447d62)?_0x447d62:null,'globalCredentials':a53_0x29b77f[_0x4f52c6(0x1ab)](_0x4a7add)?_0x4a7add:null};}[a53_0x55163c(0x197)](_0x336e0d,_0x4a5287){const _0x3b1500=a53_0x55163c;if(!_0x4a5287)return _0x3b1500(0x1c8);const _0x1f7c43=_0x4a5287;if(this[_0x3b1500(0x1b0)]['cliFlags'][_0x336e0d]===_0x1f7c43){if(_0x336e0d===_0x3b1500(0x1c7)&&_0x1f7c43===_0x3b1500(0x1a9)&&!this[_0x3b1500(0x1b0)]['session'][_0x3b1500(0x1c7)]&&!this['layers'][_0x3b1500(0x1d5)]['site']&&!this['layers'][_0x3b1500(0x1be)]['site']&&!this[_0x3b1500(0x1b0)][_0x3b1500(0x1d4)][_0x3b1500(0x1c7)])return _0x3b1500(0x1ca);return _0x3b1500(0x1b9)+_0x336e0d['replace'](/_/g,'-');}if(this[_0x3b1500(0x1b0)]['session'][_0x336e0d]===_0x1f7c43)return _0x3b1500(0x1c6);if(this['layers']['project'][_0x336e0d]===_0x1f7c43)return'project';if(this['layers'][_0x3b1500(0x1be)][_0x336e0d]===_0x1f7c43)return'profile:\x20'+this['activeProfile'];if(this[_0x3b1500(0x1b0)][_0x3b1500(0x1d4)][_0x336e0d]===_0x1f7c43)return'global';return'default';}[a53_0x55163c(0x1b6)](){const _0x2973ca=a53_0x55163c,_0x19b537=a53_0x477d1f[_0x2973ca(0x1b1)](getConfigDir(),_0x2973ca(0x1ae));if(!a53_0x29b77f[_0x2973ca(0x1ab)](_0x19b537))return{};try{const _0x505c7a=a53_0x29b77f[_0x2973ca(0x1bc)](_0x19b537,'utf-8');return JSON[_0x2973ca(0x1a2)](_0x505c7a);}catch{return{};}}[a53_0x55163c(0x1cf)](_0xe55cac){const _0x2ff18f=a53_0x55163c;_0xe55cac[_0x2ff18f(0x1c7)]=this['site'],!_0xe55cac[_0x2ff18f(0x1b8)]&&this[_0x2ff18f(0x1b8)]&&(_0xe55cac[_0x2ff18f(0x1b8)]=this['database']),!_0xe55cac[_0x2ff18f(0x1b3)]&&this[_0x2ff18f(0x1b5)]&&(_0xe55cac[_0x2ff18f(0x1b3)]=this[_0x2ff18f(0x1b5)]),!_0xe55cac[_0x2ff18f(0x1a1)]&&this[_0x2ff18f(0x1c4)]&&(_0xe55cac[_0x2ff18f(0x1a1)]=this['segment_path']),!_0xe55cac[_0x2ff18f(0x1d1)]&&this[_0x2ff18f(0x1af)]&&(_0xe55cac['llmProject']=this[_0x2ff18f(0x1af)]),!_0xe55cac[_0x2ff18f(0x19e)]&&this['llm_agent']&&(_0xe55cac[_0x2ff18f(0x19e)]=this['llm_agent']),!_0xe55cac[_0x2ff18f(0x1cd)]&&this['workflow_project']&&(_0xe55cac[_0x2ff18f(0x1cd)]=this['workflow_project']);}[a53_0x55163c(0x198)](){const _0x5a4ff6=a53_0x55163c;return[{'key':'site','value':this['site']},{'key':'database','value':this[_0x5a4ff6(0x1b8)]},{'key':_0x5a4ff6(0x1b5),'value':this['parent_segment']},{'key':_0x5a4ff6(0x1c4),'value':this['segment_path']},{'key':_0x5a4ff6(0x1af),'value':this[_0x5a4ff6(0x1af)]},{'key':_0x5a4ff6(0x1d3),'value':this['llm_agent']},{'key':_0x5a4ff6(0x1b7),'value':this[_0x5a4ff6(0x1b7)]},{'key':_0x5a4ff6(0x1be),'value':this[_0x5a4ff6(0x1bd)]||undefined}];}[a53_0x55163c(0x1dd)](){const _0x1a66b7=a53_0x55163c;console[_0x1a66b7(0x1ba)](a53_0x3989de[_0x1a66b7(0x1a0)]('[context]'));for(const {key:_0x59f208,value:_0x2d315b}of this['getParameters']()){_0x2d315b&&console['log'](a53_0x3989de[_0x1a66b7(0x1a5)](_0x59f208)+':\x20'+_0x2d315b);}}['displayWithSources'](){const _0x3cbc25=a53_0x55163c;console[_0x3cbc25(0x1ba)](a53_0x3989de['bold'](_0x3cbc25(0x1d6)));for(const {key:_0x2ffcfb,value:_0x5547c1}of this[_0x3cbc25(0x198)]()){if(_0x5547c1){const _0x29fd98=_0x2ffcfb===_0x3cbc25(0x1be)?_0x3cbc25(0x19d):'('+this[_0x3cbc25(0x197)](_0x2ffcfb,_0x5547c1)+')';console[_0x3cbc25(0x1ba)](a53_0x3989de[_0x3cbc25(0x1a5)](_0x2ffcfb)+':\x20'+_0x5547c1+'\x20'+a53_0x3989de['dim'](_0x29fd98));}}console['log']('\x0a'+a53_0x3989de['bold'](_0x3cbc25(0x19b)));const _0x1eb6f6=[{'label':_0x3cbc25(0x1a3),'path':this['configFiles'][_0x3cbc25(0x1c6)],'extra':_0x3cbc25(0x1da)+this[_0x3cbc25(0x1de)]+')'},{'label':'Project','path':this[_0x3cbc25(0x1b4)][_0x3cbc25(0x1d5)]},{'label':_0x3cbc25(0x1c9),'path':this[_0x3cbc25(0x1b4)][_0x3cbc25(0x1be)]},{'label':_0x3cbc25(0x1b2),'path':this[_0x3cbc25(0x1b4)][_0x3cbc25(0x19c)]},{'label':_0x3cbc25(0x1a7),'path':this[_0x3cbc25(0x1b4)][_0x3cbc25(0x1d4)]},{'label':_0x3cbc25(0x1a6),'path':this['configFiles'][_0x3cbc25(0x1ce)]}];for(const {label:_0xa7702d,path:_0x192321,extra:_0x404588}of _0x1eb6f6){if(_0x192321)console['log'](a53_0x3989de[_0x3cbc25(0x1a5)](_0xa7702d)+':\x20'+_0x192321+'\x20'+a53_0x3989de[_0x3cbc25(0x1c2)]('✓')+(_0x404588?'\x20'+a53_0x3989de['dim'](_0x404588):''));else{if(_0xa7702d===_0x3cbc25(0x1a3))console[_0x3cbc25(0x1ba)](a53_0x3989de[_0x3cbc25(0x1a5)](_0xa7702d)+':\x20'+a53_0x3989de[_0x3cbc25(0x1bb)](_0x3cbc25(0x1a8))+'\x20'+a53_0x3989de[_0x3cbc25(0x1bb)](_0x3cbc25(0x1ac)+this[_0x3cbc25(0x1de)]+')'));else(_0xa7702d===_0x3cbc25(0x1df)||_0xa7702d===_0x3cbc25(0x1a7))&&console[_0x3cbc25(0x1ba)](a53_0x3989de[_0x3cbc25(0x1a5)](_0xa7702d)+':\x20'+a53_0x3989de[_0x3cbc25(0x1bb)](_0x3cbc25(0x1a8)));}}}async[a53_0x55163c(0x1cc)](){const _0x168ff8=a53_0x55163c;return this[_0x168ff8(0x199)]=await getAPIKeyAsync(this[_0x168ff8(0x1c7)],this[_0x168ff8(0x1bd)]||undefined),this[_0x168ff8(0x199)];}static async[a53_0x55163c(0x1e3)](_0x36b4bc){const _0x5ee82d=new GlobalContext(_0x36b4bc);return await _0x5ee82d['resolveAPIKeyAsync'](),_0x5ee82d;}}
1
+ const a53_0x5673a4=a53_0x24b0;(function(_0x4f57aa,_0x165448){const _0x59db94=a53_0x24b0,_0x4ef4f0=_0x4f57aa();while(!![]){try{const _0x5af461=-parseInt(_0x59db94(0x1eb))/0x1+parseInt(_0x59db94(0x1ff))/0x2*(-parseInt(_0x59db94(0x1d0))/0x3)+parseInt(_0x59db94(0x1dc))/0x4*(-parseInt(_0x59db94(0x207))/0x5)+-parseInt(_0x59db94(0x1ea))/0x6*(-parseInt(_0x59db94(0x1cf))/0x7)+-parseInt(_0x59db94(0x20a))/0x8+parseInt(_0x59db94(0x206))/0x9*(parseInt(_0x59db94(0x1c8))/0xa)+parseInt(_0x59db94(0x1f3))/0xb;if(_0x5af461===_0x165448)break;else _0x4ef4f0['push'](_0x4ef4f0['shift']());}catch(_0x18a3dc){_0x4ef4f0['push'](_0x4ef4f0['shift']());}}}(a53_0x302a,0x7f5ae));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 a53_0x24b0(_0x422203,_0x6ed3b9){_0x422203=_0x422203-0x1c3;const _0x302a88=a53_0x302a();let _0x24b0cf=_0x302a88[_0x422203];return _0x24b0cf;}import*as a53_0x7b4b1b from'node:fs';import*as a53_0x3f4df1 from'node:path';function a53_0x302a(){const _0x42deec=['env','layers','resolveAPIKeyAsync','tdx.json','entries','INFO','display','cli','CLI\x20flag:\x20--','.env','proxy','6mxzbeT','525173kslrtg','Global','workflow_project','configFiles','cyan','Session','assign','session','20830073ymUzgn','green','(using\x20session:\x20','profile','logLevel','Global\x20Credentials','injectIntoOptions','segment_path','join','apiKey','segmentPath','bold','57098bsXQhH','llmProject','llm_agent','log','existsSync','replace','sessions','54AsTMJZ','2155mjXmuV','parse','site','6348944WdLhZh','llmAgent','project','default','database','verbose','none','activeProfile','config','Profile\x20Credentials','displayWithSources','string','1663020XYnKQn','[configuration\x20files]','Profile','parentSegment','dim','profileSource','us01','3614051ElgwZC','81oboEPA','(session:\x20','loadGlobalConfig','sessionId','getParameters','readFileSync','parent_segment','cliFlags','Project','globalCredentials','global','workflowProject','7392PssOtQ','profileCredentials','llm_project'];a53_0x302a=function(){return _0x42deec;};return a53_0x302a();}import a53_0x38dfc8 from'chalk';export class GlobalContext{[a53_0x5673a4(0x209)];[a53_0x5673a4(0x20e)];['parent_segment'];[a53_0x5673a4(0x1fa)];[a53_0x5673a4(0x1de)];[a53_0x5673a4(0x201)];[a53_0x5673a4(0x1ed)];[a53_0x5673a4(0x1fc)];['proxy'];[a53_0x5673a4(0x20f)];['logLevel'];[a53_0x5673a4(0x1f6)];['profileSource']=null;['layers'];[a53_0x5673a4(0x1c3)];[a53_0x5673a4(0x1d3)];[a53_0x5673a4(0x1ee)];constructor(_0xeec3aa){const _0x556df1=a53_0x5673a4;this[_0x556df1(0x1d3)]=getSessionID(_0xeec3aa['session']);const _0x4d2e9e=loadSessionContext(_0xeec3aa[_0x556df1(0x1f2)]),_0x26fc8a=loadProjectConfig(),_0x5b6a72=this[_0x556df1(0x1d2)]();if(_0xeec3aa[_0x556df1(0x1f6)])this['activeProfile']=_0xeec3aa[_0x556df1(0x1f6)],this['profileSource']=_0x556df1(0x1e6);else{if(_0x4d2e9e?.[_0x556df1(0x1f6)])this[_0x556df1(0x1c3)]=_0x4d2e9e[_0x556df1(0x1f6)],this[_0x556df1(0x1cd)]=_0x556df1(0x1f2);else{if(_0x5b6a72[_0x556df1(0x1f6)])this[_0x556df1(0x1c3)]=_0x5b6a72['profile'],this['profileSource']=_0x556df1(0x1c4);else process.env.TDX_PROFILE?(this[_0x556df1(0x1c3)]=process.env.TDX_PROFILE,this['profileSource']=_0x556df1(0x1df)):(this[_0x556df1(0x1c3)]=null,this[_0x556df1(0x1cd)]=null);}}const _0x25f19f=this[_0x556df1(0x1c3)]?loadProfile(this[_0x556df1(0x1c3)]):null,_0x293297=_0x2ad5a6=>{const _0x4f84f9=_0x556df1;if(!_0x2ad5a6)return{};const _0x1489db=_0x2ad5a6,_0x57977c={};for(const [_0x267298,_0x4ae705]of Object[_0x4f84f9(0x1e3)](_0x1489db)){typeof _0x4ae705==='string'&&(_0x57977c[_0x267298]=_0x4ae705);}return _0x57977c;},_0x245ca6={},_0x285a9b=(_0x5eee2f,_0x573d8e,_0x1976b8)=>{const _0x463282=_0x556df1;if(!_0x5eee2f)return![];if(_0x1976b8&&_0x5eee2f===_0x1976b8)return![];const _0x3066c7=_0x4d2e9e,_0xc6e4cc=_0x26fc8a,_0x3c5198=_0x25f19f?.[_0x463282(0x1c4)],_0x1d7278=_0x5b6a72,_0x2d5a29=_0x3066c7?.[_0x573d8e],_0x3577e7=_0xc6e4cc?.[_0x573d8e],_0x1b61cb=_0x3c5198?.[_0x573d8e],_0x41a39d=_0x1d7278[_0x573d8e];return _0x5eee2f!==_0x2d5a29&&_0x5eee2f!==_0x3577e7&&_0x5eee2f!==_0x1b61cb&&_0x5eee2f!==_0x41a39d;},_0x33c13a=[{'optionKey':'site','contextKey':'site','defaultValue':_0x556df1(0x1ce)},{'optionKey':_0x556df1(0x20e),'contextKey':_0x556df1(0x20e)},{'optionKey':_0x556df1(0x1cb),'contextKey':'parent_segment'},{'optionKey':_0x556df1(0x200),'contextKey':_0x556df1(0x1de)},{'optionKey':_0x556df1(0x20b),'contextKey':_0x556df1(0x201)},{'optionKey':_0x556df1(0x1f6),'contextKey':_0x556df1(0x1f6)}];for(const {optionKey:_0x5d98a9,contextKey:_0x3b8167,defaultValue:_0x4074a1}of _0x33c13a){const _0xe95992=_0xeec3aa[_0x5d98a9];_0x285a9b(_0xe95992,_0x3b8167,_0x4074a1)&&(_0x245ca6[_0x3b8167]=_0xe95992);}this['layers']={'cliFlags':_0x245ca6,'session':_0x293297(_0x4d2e9e),'project':_0x293297(_0x26fc8a),'profile':_0x293297(_0x25f19f?.['config']),'global':_0x293297(_0x5b6a72)};const _0x438297={...this[_0x556df1(0x1e0)][_0x556df1(0x1da)],...this[_0x556df1(0x1e0)]['profile'],...this[_0x556df1(0x1e0)][_0x556df1(0x20c)]};process.env.TDX_SITE&&!this[_0x556df1(0x1e0)]['session'][_0x556df1(0x209)]&&!this['layers'][_0x556df1(0x1d7)][_0x556df1(0x209)]&&(_0x438297[_0x556df1(0x209)]=process.env.TDX_SITE);Object[_0x556df1(0x1f1)](_0x438297,this[_0x556df1(0x1e0)][_0x556df1(0x1f2)]),Object[_0x556df1(0x1f1)](_0x438297,this[_0x556df1(0x1e0)][_0x556df1(0x1d7)]);const _0x2e7c4b=_0x438297['site']||'us01';this['site']=resolveSite(_0x2e7c4b),this[_0x556df1(0x20e)]=_0x438297['database'],this['parent_segment']=_0x438297[_0x556df1(0x1d6)],this['segment_path']=_0x438297[_0x556df1(0x1fa)],this[_0x556df1(0x1de)]=_0x438297[_0x556df1(0x1de)],this[_0x556df1(0x201)]=_0x438297[_0x556df1(0x201)],this['workflow_project']=_0x438297['workflow_project'],this[_0x556df1(0x20f)]=_0xeec3aa[_0x556df1(0x20f)]||![],this['logLevel']=_0xeec3aa[_0x556df1(0x1f7)]??LogLevel[_0x556df1(0x1e4)],this[_0x556df1(0x1f6)]=this[_0x556df1(0x1c3)]||undefined,this[_0x556df1(0x1fc)]=getAPIKey(this[_0x556df1(0x1c3)]||undefined);const _0x59e498=typeof _0x5b6a72['proxy']===_0x556df1(0x1c7)?_0x5b6a72[_0x556df1(0x1e9)]:undefined;this['proxy']=_0x59e498||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x287d43=getConfigDir(),_0x1f72de=a53_0x3f4df1['join'](_0x287d43,_0x556df1(0x205),this[_0x556df1(0x1d3)]+'.json'),_0x2af577=findProjectConfigPath(),_0x2d0e05=a53_0x3f4df1[_0x556df1(0x1fb)](_0x287d43,'tdx.json'),_0x2e51d1=a53_0x3f4df1[_0x556df1(0x1fb)](_0x287d43,_0x556df1(0x1e8));let _0x38e15c=null,_0x2c1eba=null;this[_0x556df1(0x1c3)]&&(_0x38e15c=a53_0x3f4df1[_0x556df1(0x1fb)](_0x287d43,'profiles',this['activeProfile'],'tdx.json'),_0x2c1eba=a53_0x3f4df1[_0x556df1(0x1fb)](_0x287d43,'profiles',this[_0x556df1(0x1c3)],'.env')),this['configFiles']={'session':a53_0x7b4b1b[_0x556df1(0x203)](_0x1f72de)?_0x1f72de:null,'project':_0x2af577,'profile':_0x38e15c&&a53_0x7b4b1b[_0x556df1(0x203)](_0x38e15c)?_0x38e15c:null,'profileCredentials':_0x2c1eba&&a53_0x7b4b1b[_0x556df1(0x203)](_0x2c1eba)?_0x2c1eba:null,'global':a53_0x7b4b1b[_0x556df1(0x203)](_0x2d0e05)?_0x2d0e05:null,'globalCredentials':a53_0x7b4b1b[_0x556df1(0x203)](_0x2e51d1)?_0x2e51d1:null};}['getSource'](_0x519584,_0x24099e){const _0x58bc94=a53_0x5673a4;if(!_0x24099e)return'not\x20set';const _0x3a0e3a=_0x24099e;if(this[_0x58bc94(0x1e0)]['cliFlags'][_0x519584]===_0x3a0e3a){if(_0x519584===_0x58bc94(0x209)&&_0x3a0e3a===_0x58bc94(0x1ce)&&!this[_0x58bc94(0x1e0)]['session'][_0x58bc94(0x209)]&&!this[_0x58bc94(0x1e0)][_0x58bc94(0x20c)]['site']&&!this[_0x58bc94(0x1e0)][_0x58bc94(0x1f6)][_0x58bc94(0x209)]&&!this[_0x58bc94(0x1e0)]['global'][_0x58bc94(0x209)])return _0x58bc94(0x20d);return _0x58bc94(0x1e7)+_0x519584[_0x58bc94(0x204)](/_/g,'-');}if(this[_0x58bc94(0x1e0)][_0x58bc94(0x1f2)][_0x519584]===_0x3a0e3a)return _0x58bc94(0x1f2);if(this[_0x58bc94(0x1e0)]['project'][_0x519584]===_0x3a0e3a)return _0x58bc94(0x20c);if(this[_0x58bc94(0x1e0)][_0x58bc94(0x1f6)][_0x519584]===_0x3a0e3a)return'profile:\x20'+this['activeProfile'];if(this[_0x58bc94(0x1e0)][_0x58bc94(0x1da)][_0x519584]===_0x3a0e3a)return _0x58bc94(0x1da);return _0x58bc94(0x20d);}[a53_0x5673a4(0x1d2)](){const _0xf9e43e=a53_0x5673a4,_0x3d5092=a53_0x3f4df1[_0xf9e43e(0x1fb)](getConfigDir(),_0xf9e43e(0x1e2));if(!a53_0x7b4b1b[_0xf9e43e(0x203)](_0x3d5092))return{};try{const _0x5e23c9=a53_0x7b4b1b[_0xf9e43e(0x1d5)](_0x3d5092,'utf-8');return JSON[_0xf9e43e(0x208)](_0x5e23c9);}catch{return{};}}[a53_0x5673a4(0x1f9)](_0x1dabb4){const _0x1eed29=a53_0x5673a4;_0x1dabb4['site']=this[_0x1eed29(0x209)],!_0x1dabb4[_0x1eed29(0x20e)]&&this[_0x1eed29(0x20e)]&&(_0x1dabb4['database']=this[_0x1eed29(0x20e)]),!_0x1dabb4[_0x1eed29(0x1cb)]&&this[_0x1eed29(0x1d6)]&&(_0x1dabb4[_0x1eed29(0x1cb)]=this[_0x1eed29(0x1d6)]),!_0x1dabb4[_0x1eed29(0x1fd)]&&this[_0x1eed29(0x1fa)]&&(_0x1dabb4[_0x1eed29(0x1fd)]=this[_0x1eed29(0x1fa)]),!_0x1dabb4['llmProject']&&this[_0x1eed29(0x1de)]&&(_0x1dabb4[_0x1eed29(0x200)]=this['llm_project']),!_0x1dabb4[_0x1eed29(0x20b)]&&this[_0x1eed29(0x201)]&&(_0x1dabb4[_0x1eed29(0x20b)]=this[_0x1eed29(0x201)]),!_0x1dabb4[_0x1eed29(0x1db)]&&this['workflow_project']&&(_0x1dabb4[_0x1eed29(0x1db)]=this[_0x1eed29(0x1ed)]);}['getParameters'](){const _0x4e8e10=a53_0x5673a4;return[{'key':_0x4e8e10(0x209),'value':this['site']},{'key':_0x4e8e10(0x20e),'value':this['database']},{'key':_0x4e8e10(0x1d6),'value':this[_0x4e8e10(0x1d6)]},{'key':_0x4e8e10(0x1fa),'value':this['segment_path']},{'key':_0x4e8e10(0x1de),'value':this['llm_project']},{'key':_0x4e8e10(0x201),'value':this['llm_agent']},{'key':_0x4e8e10(0x1ed),'value':this[_0x4e8e10(0x1ed)]},{'key':_0x4e8e10(0x1f6),'value':this[_0x4e8e10(0x1c3)]||undefined}];}[a53_0x5673a4(0x1e5)](){const _0x4bca60=a53_0x5673a4;console[_0x4bca60(0x202)](a53_0x38dfc8[_0x4bca60(0x1fe)]('[context]'));for(const {key:_0x45f453,value:_0x1d4894}of this[_0x4bca60(0x1d4)]()){_0x1d4894&&console[_0x4bca60(0x202)](a53_0x38dfc8[_0x4bca60(0x1ef)](_0x45f453)+':\x20'+_0x1d4894);}}[a53_0x5673a4(0x1c6)](){const _0x491520=a53_0x5673a4;console[_0x491520(0x202)](a53_0x38dfc8['bold']('[context]'));for(const {key:_0x5c2aa3,value:_0x3950d1}of this[_0x491520(0x1d4)]()){if(_0x3950d1){const _0x1679e6=_0x5c2aa3==='profile'?'(active)':'('+this['getSource'](_0x5c2aa3,_0x3950d1)+')';console[_0x491520(0x202)](a53_0x38dfc8[_0x491520(0x1ef)](_0x5c2aa3)+':\x20'+_0x3950d1+'\x20'+a53_0x38dfc8[_0x491520(0x1cc)](_0x1679e6));}}console[_0x491520(0x202)]('\x0a'+a53_0x38dfc8['bold'](_0x491520(0x1c9)));const _0x5ba152=[{'label':_0x491520(0x1f0),'path':this[_0x491520(0x1ee)][_0x491520(0x1f2)],'extra':_0x491520(0x1d1)+this['sessionId']+')'},{'label':_0x491520(0x1d8),'path':this['configFiles'][_0x491520(0x20c)]},{'label':_0x491520(0x1ca),'path':this[_0x491520(0x1ee)]['profile']},{'label':_0x491520(0x1c5),'path':this[_0x491520(0x1ee)][_0x491520(0x1dd)]},{'label':_0x491520(0x1ec),'path':this['configFiles']['global']},{'label':_0x491520(0x1f8),'path':this['configFiles'][_0x491520(0x1d9)]}];for(const {label:_0x13c49f,path:_0x3f6cbc,extra:_0x40e714}of _0x5ba152){if(_0x3f6cbc)console[_0x491520(0x202)](a53_0x38dfc8['cyan'](_0x13c49f)+':\x20'+_0x3f6cbc+'\x20'+a53_0x38dfc8[_0x491520(0x1f4)]('✓')+(_0x40e714?'\x20'+a53_0x38dfc8['dim'](_0x40e714):''));else{if(_0x13c49f===_0x491520(0x1f0))console[_0x491520(0x202)](a53_0x38dfc8[_0x491520(0x1ef)](_0x13c49f)+':\x20'+a53_0x38dfc8[_0x491520(0x1cc)](_0x491520(0x210))+'\x20'+a53_0x38dfc8[_0x491520(0x1cc)](_0x491520(0x1f5)+this[_0x491520(0x1d3)]+')'));else(_0x13c49f===_0x491520(0x1d8)||_0x13c49f===_0x491520(0x1ec))&&console[_0x491520(0x202)](a53_0x38dfc8[_0x491520(0x1ef)](_0x13c49f)+':\x20'+a53_0x38dfc8[_0x491520(0x1cc)]('none'));}}}async[a53_0x5673a4(0x1e1)](){const _0x5c8e6f=a53_0x5673a4;return this[_0x5c8e6f(0x1fc)]=await getAPIKeyAsync(this[_0x5c8e6f(0x209)],this[_0x5c8e6f(0x1c3)]||undefined),this['apiKey'];}static async['createAsync'](_0x47a737){const _0x4b8949=a53_0x5673a4,_0x143c35=new GlobalContext(_0x47a737);return await _0x143c35[_0x4b8949(0x1e1)](),_0x143c35;}}
@@ -1 +1 @@
1
- function a54_0x2506(){const _0x2429b1=[':api_key','could\x20not\x20be\x20found','16jFfdjx','cannot\x20find','restricted','includes','setPassword','@napi-rs/keyring','not_found','profile:','8JXkYJV','6169842DkkREL','getPassword','access_denied','not\x20found','46837xcOHzE','244211rXaEaV','2126202ZdmCow','552AxhVnh','-25293','Entry','996YhFBog','6MhtjNI','unavailable','message','3988550ZVAzsZ','Warning:\x20','toLowerCase','not\x20supported','7729UyYTJi','tdx','reason','deleteCredential','__keychain_test__','success','no\x20matching\x20entry','not\x20available','-25300','214255dyfkMf'];a54_0x2506=function(){return _0x2429b1;};return a54_0x2506();}const a54_0xd9eb8f=a54_0x204e;(function(_0x414925,_0x7eaecc){const _0x232011=a54_0x204e,_0x3b65bb=_0x414925();while(!![]){try{const _0xb01840=-parseInt(_0x232011(0x161))/0x1*(-parseInt(_0x232011(0x181))/0x2)+parseInt(_0x232011(0x17c))/0x3+-parseInt(_0x232011(0x16d))/0x4*(parseInt(_0x232011(0x16a))/0x5)+-parseInt(_0x232011(0x17d))/0x6*(-parseInt(_0x232011(0x17a))/0x7)+parseInt(_0x232011(0x175))/0x8*(parseInt(_0x232011(0x176))/0x9)+parseInt(_0x232011(0x184))/0xa+-parseInt(_0x232011(0x17b))/0xb*(parseInt(_0x232011(0x180))/0xc);if(_0xb01840===_0x7eaecc)break;else _0x3b65bb['push'](_0x3b65bb['shift']());}catch(_0x2d347b){_0x3b65bb['push'](_0x3b65bb['shift']());}}}(a54_0x2506,0x66007));const SERVICE_NAME=a54_0xd9eb8f(0x162);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1d07e3=a54_0xd9eb8f;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x368045=await import(_0x1d07e3(0x172));return EntryClass=_0x368045[_0x1d07e3(0x17f)],EntryClass;}catch(_0x2d2edb){return keyringLoadError=_0x2d2edb instanceof Error?_0x2d2edb:new Error(String(_0x2d2edb)),null;}}function a54_0x204e(_0x584f1a,_0xdee072){_0x584f1a=_0x584f1a-0x160;const _0x2506ae=a54_0x2506();let _0x204e66=_0x2506ae[_0x584f1a];return _0x204e66;}function getAccountName(_0x3380a6){const _0x48de96=a54_0xd9eb8f,_0x31a660=_0x3380a6||'';return _0x48de96(0x174)+_0x31a660+_0x48de96(0x16b);}export async function getKeychainAPIKey(_0x3bef18){const _0x5e3137=a54_0xd9eb8f,_0x1821cc=await getKeychainAPIKeyWithStatus(_0x3bef18);if(_0x1821cc[_0x5e3137(0x166)])return _0x1821cc['value'];return _0x1821cc[_0x5e3137(0x163)]===_0x5e3137(0x178)&&console['error'](_0x5e3137(0x185)+_0x1821cc['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x2c085d){const _0x2d8673=a54_0xd9eb8f;try{const _0x6ede1=await getEntryClass();if(!_0x6ede1)return{'success':![],'reason':_0x2d8673(0x182)};const _0x444e90=getAccountName(_0x2c085d),_0x4e4506=new _0x6ede1(SERVICE_NAME,_0x444e90),_0x2081bf=_0x4e4506[_0x2d8673(0x177)]();if(_0x2081bf)return{'success':!![],'value':_0x2081bf};return{'success':![],'reason':_0x2d8673(0x173)};}catch(_0x1ad551){const _0x527fe6=_0x1ad551 instanceof Error?_0x1ad551[_0x2d8673(0x183)]:String(_0x1ad551);if(_0x527fe6['includes'](_0x2d8673(0x169))||_0x527fe6['toLowerCase']()['includes'](_0x2d8673(0x16c))||_0x527fe6[_0x2d8673(0x186)]()['includes'](_0x2d8673(0x179))||_0x527fe6['toLowerCase']()[_0x2d8673(0x170)](_0x2d8673(0x167)))return{'success':![],'reason':_0x2d8673(0x173)};if(_0x527fe6[_0x2d8673(0x170)](_0x2d8673(0x17e))||_0x527fe6[_0x2d8673(0x186)]()[_0x2d8673(0x170)](_0x2d8673(0x16f))||_0x527fe6['toLowerCase']()[_0x2d8673(0x170)]('access'))return{'success':![],'reason':'access_denied','message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':'unavailable','message':_0x527fe6};}}export async function saveKeychainAPIKey(_0xc8ff34,_0x4488fa){const _0x2c4f4f=a54_0xd9eb8f,_0x572397=await getEntryClass();if(!_0x572397)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x5775d=getAccountName(_0x4488fa),_0x154119=new _0x572397(SERVICE_NAME,_0x5775d);_0x154119[_0x2c4f4f(0x171)](_0xc8ff34);}export async function deleteKeychainAPIKey(_0x457dd9){const _0x30e6ab=a54_0xd9eb8f;try{const _0x2d5045=await getEntryClass();if(!_0x2d5045)return![];const _0x3baf41=getAccountName(_0x457dd9),_0x46e5cd=new _0x2d5045(SERVICE_NAME,_0x3baf41);return _0x46e5cd[_0x30e6ab(0x164)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x23c223=a54_0xd9eb8f;try{const _0x5b8e64=await getEntryClass();if(!_0x5b8e64)return![];const _0x33989c=new _0x5b8e64(SERVICE_NAME,_0x23c223(0x165));return _0x33989c['getPassword'](),!![];}catch(_0x19a48f){const _0x4c63b9=_0x19a48f instanceof Error?_0x19a48f[_0x23c223(0x183)][_0x23c223(0x186)]():'';if(_0x4c63b9[_0x23c223(0x170)](_0x23c223(0x168))||_0x4c63b9[_0x23c223(0x170)](_0x23c223(0x160))||_0x4c63b9[_0x23c223(0x170)](_0x23c223(0x16e)))return![];return!![];}}
1
+ const a54_0x50c4cb=a54_0x2b70;(function(_0x7554d0,_0x65bb8c){const _0x50c2c8=a54_0x2b70,_0x3808ba=_0x7554d0();while(!![]){try{const _0x455d7f=-parseInt(_0x50c2c8(0x182))/0x1+parseInt(_0x50c2c8(0x17b))/0x2*(parseInt(_0x50c2c8(0x18c))/0x3)+parseInt(_0x50c2c8(0x17f))/0x4+parseInt(_0x50c2c8(0x172))/0x5*(-parseInt(_0x50c2c8(0x185))/0x6)+-parseInt(_0x50c2c8(0x17c))/0x7+parseInt(_0x50c2c8(0x177))/0x8+parseInt(_0x50c2c8(0x188))/0x9*(parseInt(_0x50c2c8(0x16e))/0xa);if(_0x455d7f===_0x65bb8c)break;else _0x3808ba['push'](_0x3808ba['shift']());}catch(_0x395970){_0x3808ba['push'](_0x3808ba['shift']());}}}(a54_0x34e3,0x3dbc5));const SERVICE_NAME=a54_0x50c4cb(0x179);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x22f074=await import('@napi-rs/keyring');return EntryClass=_0x22f074['Entry'],EntryClass;}catch(_0x37f24a){return keyringLoadError=_0x37f24a instanceof Error?_0x37f24a:new Error(String(_0x37f24a)),null;}}function a54_0x2b70(_0x1f83d5,_0x42e6bd){_0x1f83d5=_0x1f83d5-0x168;const _0x34e34d=a54_0x34e3();let _0x2b700c=_0x34e34d[_0x1f83d5];return _0x2b700c;}function getAccountName(_0x495595){const _0x76b39e=a54_0x50c4cb,_0x2aab17=_0x495595||'';return'profile:'+_0x2aab17+_0x76b39e(0x17e);}function a54_0x34e3(){const _0x29747c=['411099hMHBvp','-25293','-25300','138ywplbG','not\x20found','unavailable','9MRcVUS','access','includes','message','921oHXwpp','System\x20keychain\x20is\x20not\x20available','not\x20available','setPassword','value','deleteCredential','getPassword','4938590KmoiHz','could\x20not\x20be\x20found','success','access_denied','100665BhtXsP','cannot\x20find','no\x20matching\x20entry','not_found','__keychain_test__','3652760eSNFRp','error','tdx','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.','1114saKufH','285663aRWOWn','Warning:\x20',':api_key','185532IYFgsG','reason','toLowerCase'];a54_0x34e3=function(){return _0x29747c;};return a54_0x34e3();}export async function getKeychainAPIKey(_0x497cfe){const _0xd65a5f=a54_0x50c4cb,_0x2dee6b=await getKeychainAPIKeyWithStatus(_0x497cfe);if(_0x2dee6b[_0xd65a5f(0x170)])return _0x2dee6b[_0xd65a5f(0x16b)];return _0x2dee6b[_0xd65a5f(0x180)]===_0xd65a5f(0x171)&&console[_0xd65a5f(0x178)](_0xd65a5f(0x17d)+_0x2dee6b[_0xd65a5f(0x18b)]),null;}export async function getKeychainAPIKeyWithStatus(_0xbc73ef){const _0x1027e0=a54_0x50c4cb;try{const _0x2072ba=await getEntryClass();if(!_0x2072ba)return{'success':![],'reason':_0x1027e0(0x187)};const _0xdaffbf=getAccountName(_0xbc73ef),_0x383b3b=new _0x2072ba(SERVICE_NAME,_0xdaffbf),_0x1de5c2=_0x383b3b[_0x1027e0(0x16d)]();if(_0x1de5c2)return{'success':!![],'value':_0x1de5c2};return{'success':![],'reason':_0x1027e0(0x175)};}catch(_0x273bf2){const _0x55f19d=_0x273bf2 instanceof Error?_0x273bf2[_0x1027e0(0x18b)]:String(_0x273bf2);if(_0x55f19d['includes'](_0x1027e0(0x184))||_0x55f19d['toLowerCase']()[_0x1027e0(0x18a)](_0x1027e0(0x16f))||_0x55f19d[_0x1027e0(0x181)]()[_0x1027e0(0x18a)](_0x1027e0(0x186))||_0x55f19d[_0x1027e0(0x181)]()[_0x1027e0(0x18a)](_0x1027e0(0x174)))return{'success':![],'reason':_0x1027e0(0x175)};if(_0x55f19d['includes'](_0x1027e0(0x183))||_0x55f19d['toLowerCase']()[_0x1027e0(0x18a)]('restricted')||_0x55f19d['toLowerCase']()[_0x1027e0(0x18a)](_0x1027e0(0x189)))return{'success':![],'reason':'access_denied','message':_0x1027e0(0x17a)};return{'success':![],'reason':_0x1027e0(0x187),'message':_0x55f19d};}}export async function saveKeychainAPIKey(_0x5db157,_0x412b5f){const _0x432488=a54_0x50c4cb,_0x2ad091=await getEntryClass();if(!_0x2ad091)throw new Error(_0x432488(0x168));const _0x15eb05=getAccountName(_0x412b5f),_0x1611fa=new _0x2ad091(SERVICE_NAME,_0x15eb05);_0x1611fa[_0x432488(0x16a)](_0x5db157);}export async function deleteKeychainAPIKey(_0x1fc170){const _0x1a254a=a54_0x50c4cb;try{const _0x6c7245=await getEntryClass();if(!_0x6c7245)return![];const _0x22cb7a=getAccountName(_0x1fc170),_0x161514=new _0x6c7245(SERVICE_NAME,_0x22cb7a);return _0x161514[_0x1a254a(0x16c)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x56d08a=a54_0x50c4cb;try{const _0x3c21bc=await getEntryClass();if(!_0x3c21bc)return![];const _0x281157=new _0x3c21bc(SERVICE_NAME,_0x56d08a(0x176));return _0x281157[_0x56d08a(0x16d)](),!![];}catch(_0x24cd8a){const _0x4c883f=_0x24cd8a instanceof Error?_0x24cd8a['message'][_0x56d08a(0x181)]():'';if(_0x4c883f['includes'](_0x56d08a(0x169))||_0x4c883f[_0x56d08a(0x18a)]('not\x20supported')||_0x4c883f['includes'](_0x56d08a(0x173)))return![];return!![];}}
@@ -1 +1 @@
1
- const a55_0x51e4fc=a55_0x4b30;(function(_0x195d10,_0x29752f){const _0x24062e=a55_0x4b30,_0x11f6ce=_0x195d10();while(!![]){try{const _0x20196d=parseInt(_0x24062e(0x15e))/0x1+parseInt(_0x24062e(0x188))/0x2+parseInt(_0x24062e(0x19f))/0x3*(parseInt(_0x24062e(0x193))/0x4)+-parseInt(_0x24062e(0x15c))/0x5+-parseInt(_0x24062e(0x164))/0x6+parseInt(_0x24062e(0x19e))/0x7+parseInt(_0x24062e(0x183))/0x8*(-parseInt(_0x24062e(0x171))/0x9);if(_0x20196d===_0x29752f)break;else _0x11f6ce['push'](_0x11f6ce['shift']());}catch(_0x15477b){_0x11f6ce['push'](_0x11f6ce['shift']());}}}(a55_0x46ac,0xeb018));import*as a55_0x365007 from'node:fs';import*as a55_0x48ba48 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=a55_0x51e4fc(0x15a);export function getProfileParams(_0x127479){const _0x4a69f5=a55_0x51e4fc,_0x79e5f9={};if(!_0x127479)return _0x79e5f9;for(const [_0x53025f,_0x22c80c]of Object[_0x4a69f5(0x18d)](_0x127479)){_0x53025f!=='description'&&_0x22c80c!==undefined&&(_0x79e5f9[_0x53025f]=_0x22c80c);}return _0x79e5f9;}export function getProfilesDir(){return a55_0x48ba48['join'](getConfigDir(),'profiles');}function a55_0x46ac(){const _0x7babeb=['8rtahxc','message','string','map','join','rmSync',',\x20creating\x20new\x20file','llm_project','\x27\x20will\x20be\x20ignored','\x22\x20\x22','\x20does\x20not\x20exist','11444216IqvLzz','1747146FxnVgF','sort','localeCompare',':\x20Invalid\x20JSON\x20syntax','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20parse\x20','existsSync','@tdx-studio','Warning:\x20Profile\x20\x27','3708150IWrnRS','\x20\x20mv\x20\x22','1467789twLriR','utf-8','name','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','some','includes','7049748ZMvPhN','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','database','has','stringify','parse','readFileSync','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','directory','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','Profile\x20','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','951516DhyZPc','toISOString','profile','INVALID_PROFILE_CONFIG','parent_segment','Warning:\x20Failed\x20to\x20parse\x20','Failed\x20to\x20parse\x20','filter','from','\x27:\x20unknown\x20config\x20key\x20\x27','llm_agent','\x20already\x20exists','site','push','test','Profile\x20\x27','length','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','184PHaNYc','.env','user_info','object','\x27\x20not\x20found\x20in\x20user\x20configuration','2086766ahbZqm','readdirSync','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','description','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','entries','isDirectory','profiles','To\x20migrate:','warn','tdx.json'];a55_0x46ac=function(){return _0x7babeb;};return a55_0x46ac();}function getProfileDir(_0x5805fb){return a55_0x48ba48['join'](getProfilesDir(),_0x5805fb);}function getProfileConfigPath(_0x1bf2a7){const _0x80b617=a55_0x51e4fc;return a55_0x48ba48[_0x80b617(0x197)](getProfileDir(_0x1bf2a7),_0x80b617(0x192));}function getProfileEnvPath(_0xd20a53){const _0x43a628=a55_0x51e4fc;return a55_0x48ba48[_0x43a628(0x197)](getProfileDir(_0xd20a53),_0x43a628(0x184));}function getGlobalConfigPath(){return a55_0x48ba48['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x4394d8){const _0x5ddfb9=a55_0x51e4fc;if(/^@?[a-zA-Z0-9_-]+$/[_0x5ddfb9(0x17f)](_0x4394d8))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/[_0x5ddfb9(0x17f)](_0x4394d8))return;throw new Error('Invalid\x20profile\x20name:\x20'+_0x4394d8+_0x5ddfb9(0x16e));}function validateProfileConfig(_0x1774a7,_0x373aab){const _0x1972d1=a55_0x51e4fc;if(typeof _0x1774a7!==_0x1972d1(0x186)||_0x1774a7===null)throw new SDKError(ErrorCode[_0x1972d1(0x174)],'Profile\x20\x27'+_0x373aab+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x2c48bc=[_0x1972d1(0x18b),'site',_0x1972d1(0x166),_0x1972d1(0x175),_0x1972d1(0x19a),_0x1972d1(0x17b),_0x1972d1(0x185)],_0x3ab8d1=_0x1774a7;for(const _0x2af928 of Object['keys'](_0x3ab8d1)){!_0x2c48bc[_0x1972d1(0x163)](_0x2af928)&&console[_0x1972d1(0x191)](_0x1972d1(0x15b)+_0x373aab+_0x1972d1(0x17a)+_0x2af928+_0x1972d1(0x19b));}if(_0x3ab8d1[_0x1972d1(0x18b)]!==undefined&&typeof _0x3ab8d1[_0x1972d1(0x18b)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x1972d1(0x180)+_0x373aab+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x3ab8d1[_0x1972d1(0x17d)]!==undefined&&typeof _0x3ab8d1[_0x1972d1(0x17d)]!=='string')throw new SDKError(ErrorCode[_0x1972d1(0x174)],_0x1972d1(0x180)+_0x373aab+_0x1972d1(0x182));if(_0x3ab8d1[_0x1972d1(0x166)]!==undefined&&typeof _0x3ab8d1[_0x1972d1(0x166)]!==_0x1972d1(0x195))throw new SDKError(ErrorCode[_0x1972d1(0x174)],'Profile\x20\x27'+_0x373aab+_0x1972d1(0x16b));if(_0x3ab8d1[_0x1972d1(0x175)]!==undefined&&typeof _0x3ab8d1[_0x1972d1(0x175)]!==_0x1972d1(0x195))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x373aab+_0x1972d1(0x157));if(_0x3ab8d1['llm_project']!==undefined&&typeof _0x3ab8d1[_0x1972d1(0x19a)]!==_0x1972d1(0x195))throw new SDKError(ErrorCode[_0x1972d1(0x174)],_0x1972d1(0x180)+_0x373aab+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x3ab8d1[_0x1972d1(0x17b)]!==undefined&&typeof _0x3ab8d1[_0x1972d1(0x17b)]!==_0x1972d1(0x195))throw new SDKError(ErrorCode[_0x1972d1(0x174)],_0x1972d1(0x180)+_0x373aab+_0x1972d1(0x170));return!![];}function loadProfilesFromTdxJson(_0x24f3c3,_0x2c3fe0){const _0x235ffb=a55_0x51e4fc;if(!a55_0x365007[_0x235ffb(0x159)](_0x24f3c3))return[];try{const _0x19d88b=a55_0x365007[_0x235ffb(0x16a)](_0x24f3c3,'utf-8'),_0x2600de=JSON['parse'](_0x19d88b);if(!_0x2600de[_0x235ffb(0x18f)]||typeof _0x2600de[_0x235ffb(0x18f)]!==_0x235ffb(0x186))return[];const _0x5c1cfd=[];for(const [_0x4e8215,_0xcb2f27]of Object[_0x235ffb(0x18d)](_0x2600de[_0x235ffb(0x18f)])){try{validateProfileConfig(_0xcb2f27,_0x4e8215);const _0x45e0f6=getNewCredentialPath(_0x4e8215),_0x1901da=getOldCredentialPath(_0x4e8215),_0x4a8930=a55_0x365007['existsSync'](_0x45e0f6)||a55_0x365007[_0x235ffb(0x159)](_0x1901da);_0x5c1cfd['push']({'name':_0x4e8215,'config':_0xcb2f27,'metadata':{'name':_0x4e8215,'createdAt':new Date()[_0x235ffb(0x172)]()},'hasCredentials':_0x4a8930,'scope':_0x2c3fe0});}catch(_0x419fea){_0x419fea instanceof Error&&(console[_0x235ffb(0x191)](_0x235ffb(0x161)+_0x24f3c3+':'),console[_0x235ffb(0x191)]('\x20\x20'+_0x419fea[_0x235ffb(0x194)]+'\x0a'));}}return _0x5c1cfd;}catch(_0x532747){return _0x532747 instanceof SyntaxError?(console['warn'](_0x235ffb(0x158)+_0x24f3c3+_0x235ffb(0x156)),console[_0x235ffb(0x191)]('Error:\x20'+_0x532747[_0x235ffb(0x194)]+'\x0a')):console[_0x235ffb(0x191)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x24f3c3+':\x20'+_0x532747+'\x0a'),[];}}export function getNewCredentialPath(_0x1b6c11){const _0x4dac21=a55_0x51e4fc;return a55_0x48ba48[_0x4dac21(0x197)](getConfigDir(),'.env.'+_0x1b6c11);}function getOldCredentialPath(_0x1f8a35){const _0x35d205=a55_0x51e4fc;return a55_0x48ba48[_0x35d205(0x197)](getProfilesDir(),_0x1f8a35,_0x35d205(0x184));}function loadProfilesFromTdxJsonFiles(){const _0x3ab86d=a55_0x51e4fc,_0x132294=[],_0x4810d9=findProjectConfigPath();_0x4810d9&&_0x132294[_0x3ab86d(0x17e)](...loadProfilesFromTdxJson(_0x4810d9,'local'));const _0x57eef5=a55_0x48ba48[_0x3ab86d(0x197)](getConfigDir(),_0x3ab86d(0x192));return _0x132294[_0x3ab86d(0x17e)](...loadProfilesFromTdxJson(_0x57eef5,'user')),_0x132294;}function loadProfilesFromDirectories(){const _0x87e0cd=a55_0x51e4fc,_0x590782=getProfilesDir();if(!a55_0x365007['existsSync'](_0x590782))return[];try{return a55_0x365007[_0x87e0cd(0x189)](_0x590782,{'withFileTypes':!![]})['filter'](_0x6d5177=>_0x6d5177[_0x87e0cd(0x18e)]())[_0x87e0cd(0x196)](_0x151e4e=>_0x151e4e['name'])[_0x87e0cd(0x178)](_0x450cad=>{const _0x3f7751=_0x87e0cd,_0x9a4db1=getProfileConfigPath(_0x450cad),_0x434fb9=getProfileEnvPath(_0x450cad);return a55_0x365007['existsSync'](_0x9a4db1)||a55_0x365007[_0x3f7751(0x159)](_0x434fb9);})[_0x87e0cd(0x196)](_0x3ebd02=>{const _0x2111c2=_0x87e0cd,_0x250ebb=loadProfileFromDirectory(_0x3ebd02);if(_0x250ebb)return{..._0x250ebb,'scope':_0x2111c2(0x16d)};return null;})[_0x87e0cd(0x178)](_0x1985cb=>_0x1985cb!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4e5960){const _0x5c6308=a55_0x51e4fc,_0x5ad05e=getProfileConfigPath(_0x4e5960),_0x176515=getOldCredentialPath(_0x4e5960);if(!a55_0x365007[_0x5c6308(0x159)](_0x5ad05e)&&!a55_0x365007['existsSync'](_0x176515))return null;let _0x1772ad={},_0x588723={'name':_0x4e5960,'createdAt':new Date()['toISOString']()};if(a55_0x365007['existsSync'](_0x5ad05e))try{const _0x58412b=a55_0x365007[_0x5c6308(0x16a)](_0x5ad05e,_0x5c6308(0x15f)),_0x314886=JSON[_0x5c6308(0x169)](_0x58412b),{metadata:_0x5d629f,..._0x2db48c}=_0x314886;_0x1772ad=_0x2db48c,_0x5d629f&&(_0x588723=_0x5d629f);}catch{}return{'name':_0x4e5960,'config':_0x1772ad,'metadata':_0x588723,'hasCredentials':a55_0x365007['existsSync'](_0x176515),'scope':_0x5c6308(0x16d)};}export function listProfiles(){const _0x5a76ba=a55_0x51e4fc,_0x42e27f=loadProfilesFromTdxJsonFiles(),_0x233955=loadProfilesFromDirectories();if(_0x233955[_0x5a76ba(0x181)]>0x0){const _0x5d8692=_0x233955[_0x5a76ba(0x196)](_0x548048=>_0x548048[_0x5a76ba(0x160)])[_0x5a76ba(0x197)](',\x20'),_0xec4898=getConfigDir();console['warn']('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x5d8692),console['warn'](_0x5a76ba(0x16c)),console['warn']('\x20\x201.\x20Edit:\x20'+a55_0x48ba48['join'](_0xec4898,'tdx.json')),console[_0x5a76ba(0x191)](_0x5a76ba(0x18c)),console['warn'](_0x5a76ba(0x18a));}const _0x21b4d8=[..._0x42e27f,..._0x233955],_0x71f862=new Map();for(const _0x494f7d of _0x21b4d8){!_0x71f862[_0x5a76ba(0x167)](_0x494f7d[_0x5a76ba(0x160)])&&_0x71f862['set'](_0x494f7d[_0x5a76ba(0x160)],_0x494f7d);}return Array[_0x5a76ba(0x179)](_0x71f862['values']())[_0x5a76ba(0x1a0)]((_0x390d0f,_0x218578)=>_0x390d0f[_0x5a76ba(0x160)][_0x5a76ba(0x155)](_0x218578[_0x5a76ba(0x160)]));}export function profileExists(_0x56ae16){const _0xd1e21d=a55_0x51e4fc,_0xb4af85=listProfiles();return _0xb4af85[_0xd1e21d(0x162)](_0x45316e=>_0x45316e[_0xd1e21d(0x160)]===_0x56ae16);}export function loadProfile(_0x5a31a1){validateProfileName(_0x5a31a1);const _0x21dd11=listProfiles(),_0x1e54df=_0x21dd11['find'](_0x543650=>_0x543650['name']===_0x5a31a1);return _0x1e54df||null;}export function saveProfile(_0x6a9245,_0x3c5865,_0x373bc0=![]){saveProfileToUserConfig(_0x6a9245,_0x3c5865);}export function deleteProfile(_0x1715e2){const _0x35a701=a55_0x51e4fc;validateProfileName(_0x1715e2);const _0x412f92=getProfileDir(_0x1715e2);if(!a55_0x365007['existsSync'](_0x412f92))throw new Error(_0x35a701(0x16f)+_0x1715e2+_0x35a701(0x19d));a55_0x365007[_0x35a701(0x198)](_0x412f92,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x5b4fb3,_0x225114){const _0x164da3=a55_0x51e4fc;validateProfileName(_0x5b4fb3);const _0x5bde24=getGlobalConfigPath(),_0x3e5645=getConfigDir();!a55_0x365007[_0x164da3(0x159)](_0x3e5645)&&createSecureDirectory(_0x3e5645);let _0x374b6b={};if(a55_0x365007[_0x164da3(0x159)](_0x5bde24))try{const _0x3b719b=a55_0x365007[_0x164da3(0x16a)](_0x5bde24,_0x164da3(0x15f));_0x374b6b=JSON['parse'](_0x3b719b);}catch{console['warn'](_0x164da3(0x176)+_0x5bde24+_0x164da3(0x199));}!_0x374b6b[_0x164da3(0x18f)]&&(_0x374b6b[_0x164da3(0x18f)]={}),_0x374b6b[_0x164da3(0x18f)][_0x5b4fb3]=_0x225114,writeSecureFile(_0x5bde24,JSON[_0x164da3(0x168)](_0x374b6b,null,0x2));}export function removeProfileFromUserConfig(_0x33f0c1){const _0x2d4600=a55_0x51e4fc;validateProfileName(_0x33f0c1);const _0x23ff9f=getGlobalConfigPath();if(!a55_0x365007['existsSync'](_0x23ff9f))throw new Error(_0x2d4600(0x180)+_0x33f0c1+_0x2d4600(0x187));let _0x3c6b95={};try{const _0x3ba7a3=a55_0x365007[_0x2d4600(0x16a)](_0x23ff9f,_0x2d4600(0x15f));_0x3c6b95=JSON[_0x2d4600(0x169)](_0x3ba7a3);}catch{throw new Error(_0x2d4600(0x177)+_0x23ff9f);}if(!_0x3c6b95[_0x2d4600(0x18f)]||!_0x3c6b95[_0x2d4600(0x18f)][_0x33f0c1])throw new Error(_0x2d4600(0x180)+_0x33f0c1+_0x2d4600(0x187));delete _0x3c6b95[_0x2d4600(0x18f)][_0x33f0c1],_0x3c6b95[_0x2d4600(0x173)]===_0x33f0c1&&delete _0x3c6b95[_0x2d4600(0x173)],writeSecureFile(_0x23ff9f,JSON[_0x2d4600(0x168)](_0x3c6b95,null,0x2));}export function getActiveProfile(){const _0x5eeb21=a55_0x51e4fc,_0x2774af=loadSessionContext();if(_0x2774af?.['profile'])return _0x2774af[_0x5eeb21(0x173)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x17ee18=getGlobalConfigPath();if(!a55_0x365007[_0x5eeb21(0x159)](_0x17ee18))return null;try{const _0x52aeca=a55_0x365007[_0x5eeb21(0x16a)](_0x17ee18,'utf-8'),_0x4ed0b4=JSON[_0x5eeb21(0x169)](_0x52aeca);return _0x4ed0b4[_0x5eeb21(0x173)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x19c502){const _0x3a5099=a55_0x51e4fc,_0xbb6c52=getGlobalConfigPath(),_0x13b79c=getConfigDir();!a55_0x365007[_0x3a5099(0x159)](_0x13b79c)&&createSecureDirectory(_0x13b79c);let _0x2a4518={};if(a55_0x365007[_0x3a5099(0x159)](_0xbb6c52))try{const _0xfc489a=a55_0x365007['readFileSync'](_0xbb6c52,_0x3a5099(0x15f));_0x2a4518=JSON[_0x3a5099(0x169)](_0xfc489a);}catch{console[_0x3a5099(0x191)](_0x3a5099(0x176)+_0xbb6c52+_0x3a5099(0x199));}_0x2a4518['site']=_0x19c502,writeSecureFile(_0xbb6c52,JSON[_0x3a5099(0x168)](_0x2a4518,null,0x2));}export function saveActiveProfileToUserConfig(_0x2bd0c7){const _0x2b7041=a55_0x51e4fc;validateProfileName(_0x2bd0c7);const _0x281455=getGlobalConfigPath(),_0x3ead46=getConfigDir();!a55_0x365007[_0x2b7041(0x159)](_0x3ead46)&&createSecureDirectory(_0x3ead46);let _0x1512d4={};if(a55_0x365007[_0x2b7041(0x159)](_0x281455))try{const _0x25b7c2=a55_0x365007['readFileSync'](_0x281455,_0x2b7041(0x15f));_0x1512d4=JSON[_0x2b7041(0x169)](_0x25b7c2);}catch{console[_0x2b7041(0x191)](_0x2b7041(0x176)+_0x281455+_0x2b7041(0x199));}_0x1512d4[_0x2b7041(0x173)]=_0x2bd0c7,writeSecureFile(_0x281455,JSON[_0x2b7041(0x168)](_0x1512d4,null,0x2));}function clearFieldFromUserConfig(_0x4db528){const _0x279c78=a55_0x51e4fc,_0x20e69e=getGlobalConfigPath();if(!a55_0x365007['existsSync'](_0x20e69e))return;let _0x3d71ff={};try{const _0x1d0013=a55_0x365007[_0x279c78(0x16a)](_0x20e69e,'utf-8');_0x3d71ff=JSON[_0x279c78(0x169)](_0x1d0013);}catch{return;}delete _0x3d71ff[_0x4db528],writeSecureFile(_0x20e69e,JSON[_0x279c78(0x168)](_0x3d71ff,null,0x2));}function a55_0x4b30(_0x45dbba,_0x253470){_0x45dbba=_0x45dbba-0x155;const _0x46ac2b=a55_0x46ac();let _0x4b309e=_0x46ac2b[_0x45dbba];return _0x4b309e;}export function clearDefaultSiteFromUserConfig(){const _0x3e15d=a55_0x51e4fc;clearFieldFromUserConfig(_0x3e15d(0x17d));}export function clearActiveProfileFromUserConfig(){const _0x308a8b=a55_0x51e4fc;clearFieldFromUserConfig(_0x308a8b(0x173));}export function createProfile(_0x59ed8b,_0x31802b){const _0x1f972e=a55_0x51e4fc;validateProfileName(_0x59ed8b);if(profileExists(_0x59ed8b))throw new Error(_0x1f972e(0x16f)+_0x59ed8b+_0x1f972e(0x17c));saveProfile(_0x59ed8b,_0x31802b);}export function saveProfileCredentials(_0x4da43c,_0x1c4234){const _0x483fb9=a55_0x51e4fc;validateProfileName(_0x4da43c);if(!profileExists(_0x4da43c))throw new Error(_0x483fb9(0x16f)+_0x4da43c+_0x483fb9(0x19d));const _0xad03e4=getNewCredentialPath(_0x4da43c);writeSecureFile(_0xad03e4,_0x1c4234);}export function loadProfileCredentials(_0x2de505){const _0x4fa700=a55_0x51e4fc;validateProfileName(_0x2de505);const _0x2bcaeb=getNewCredentialPath(_0x2de505);if(a55_0x365007['existsSync'](_0x2bcaeb))try{return a55_0x365007[_0x4fa700(0x16a)](_0x2bcaeb,_0x4fa700(0x15f));}catch{}const _0x3a8e38=getOldCredentialPath(_0x2de505);if(a55_0x365007[_0x4fa700(0x159)](_0x3a8e38)){console[_0x4fa700(0x191)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x2de505+'\x27'),console[_0x4fa700(0x191)](_0x4fa700(0x190)),console[_0x4fa700(0x191)](_0x4fa700(0x15d)+_0x3a8e38+_0x4fa700(0x19c)+_0x2bcaeb+'\x22'),console[_0x4fa700(0x191)](_0x4fa700(0x165));try{return a55_0x365007[_0x4fa700(0x16a)](_0x3a8e38,_0x4fa700(0x15f));}catch{return null;}}return null;}
1
+ const a55_0xfdf0e6=a55_0xb727;(function(_0xf5241e,_0x2d7e34){const _0x510499=a55_0xb727,_0x4c22ff=_0xf5241e();while(!![]){try{const _0x268790=parseInt(_0x510499(0x217))/0x1*(-parseInt(_0x510499(0x1fc))/0x2)+-parseInt(_0x510499(0x1d7))/0x3*(parseInt(_0x510499(0x1fe))/0x4)+-parseInt(_0x510499(0x201))/0x5*(parseInt(_0x510499(0x1d6))/0x6)+parseInt(_0x510499(0x220))/0x7+-parseInt(_0x510499(0x20f))/0x8+-parseInt(_0x510499(0x205))/0x9+parseInt(_0x510499(0x1db))/0xa;if(_0x268790===_0x2d7e34)break;else _0x4c22ff['push'](_0x4c22ff['shift']());}catch(_0x1ff651){_0x4c22ff['push'](_0x4c22ff['shift']());}}}(a55_0x4d6f,0x27ae6));import*as a55_0x5be7fa from'node:fs';import*as a55_0x27ce58 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';function a55_0xb727(_0x189493,_0x278a44){_0x189493=_0x189493-0x1d4;const _0x4d6f91=a55_0x4d6f();let _0xb72777=_0x4d6f91[_0x189493];return _0xb72777;}import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a55_0xfdf0e6(0x20e);export function getProfileParams(_0x15b1f5){const _0x29529d=a55_0xfdf0e6,_0x2332fa={};if(!_0x15b1f5)return _0x2332fa;for(const [_0x47afc4,_0x416c49]of Object['entries'](_0x15b1f5)){_0x47afc4!==_0x29529d(0x1e6)&&_0x416c49!==undefined&&(_0x2332fa[_0x47afc4]=_0x416c49);}return _0x2332fa;}export function getProfilesDir(){const _0x4deef5=a55_0xfdf0e6;return a55_0x27ce58[_0x4deef5(0x1df)](getConfigDir(),_0x4deef5(0x204));}function getProfileDir(_0x584b3b){const _0x21eee8=a55_0xfdf0e6;return a55_0x27ce58[_0x21eee8(0x1df)](getProfilesDir(),_0x584b3b);}function getProfileConfigPath(_0x1f2413){const _0x5538ed=a55_0xfdf0e6;return a55_0x27ce58[_0x5538ed(0x1df)](getProfileDir(_0x1f2413),_0x5538ed(0x1fa));}function getProfileEnvPath(_0x15bb01){const _0x11587c=a55_0xfdf0e6;return a55_0x27ce58[_0x11587c(0x1df)](getProfileDir(_0x15bb01),_0x11587c(0x1dc));}function getGlobalConfigPath(){const _0x33df54=a55_0xfdf0e6;return a55_0x27ce58[_0x33df54(0x1df)](getConfigDir(),'tdx.json');}function validateProfileName(_0x2ebf10){const _0xa7bf95=a55_0xfdf0e6;if(/^@?[a-zA-Z0-9_-]+$/[_0xa7bf95(0x1f0)](_0x2ebf10))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+$/[_0xa7bf95(0x1f0)](_0x2ebf10))return;throw new Error(_0xa7bf95(0x207)+_0x2ebf10+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x200eaf,_0x440711){const _0xe581a2=a55_0xfdf0e6;if(typeof _0x200eaf!=='object'||_0x200eaf===null)throw new SDKError(ErrorCode[_0xe581a2(0x208)],_0xe581a2(0x21b)+_0x440711+_0xe581a2(0x218));const _0x875821=[_0xe581a2(0x1e6),_0xe581a2(0x1d4),_0xe581a2(0x1f6),'parent_segment','llm_project',_0xe581a2(0x20c),'user_info'],_0x526ad0=_0x200eaf;for(const _0x127867 of Object[_0xe581a2(0x1f3)](_0x526ad0)){!_0x875821[_0xe581a2(0x1e2)](_0x127867)&&console['warn'](_0xe581a2(0x219)+_0x440711+_0xe581a2(0x1eb)+_0x127867+_0xe581a2(0x1e3));}if(_0x526ad0[_0xe581a2(0x1e6)]!==undefined&&typeof _0x526ad0[_0xe581a2(0x1e6)]!=='string')throw new SDKError(ErrorCode[_0xe581a2(0x208)],_0xe581a2(0x21b)+_0x440711+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x526ad0['site']!==undefined&&typeof _0x526ad0['site']!==_0xe581a2(0x1f8))throw new SDKError(ErrorCode[_0xe581a2(0x208)],_0xe581a2(0x21b)+_0x440711+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x526ad0[_0xe581a2(0x1f6)]!==undefined&&typeof _0x526ad0[_0xe581a2(0x1f6)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x440711+_0xe581a2(0x20b));if(_0x526ad0['parent_segment']!==undefined&&typeof _0x526ad0['parent_segment']!==_0xe581a2(0x1f8))throw new SDKError(ErrorCode[_0xe581a2(0x208)],_0xe581a2(0x21b)+_0x440711+_0xe581a2(0x1fd));if(_0x526ad0[_0xe581a2(0x1e9)]!==undefined&&typeof _0x526ad0['llm_project']!==_0xe581a2(0x1f8))throw new SDKError(ErrorCode[_0xe581a2(0x208)],_0xe581a2(0x21b)+_0x440711+_0xe581a2(0x1d5));if(_0x526ad0[_0xe581a2(0x20c)]!==undefined&&typeof _0x526ad0['llm_agent']!==_0xe581a2(0x1f8))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0xe581a2(0x21b)+_0x440711+_0xe581a2(0x1f1));return!![];}function loadProfilesFromTdxJson(_0x541357,_0x53ee1f){const _0x34d877=a55_0xfdf0e6;if(!a55_0x5be7fa['existsSync'](_0x541357))return[];try{const _0xfe85fe=a55_0x5be7fa[_0x34d877(0x1e4)](_0x541357,'utf-8'),_0x12b291=JSON[_0x34d877(0x216)](_0xfe85fe);if(!_0x12b291[_0x34d877(0x204)]||typeof _0x12b291[_0x34d877(0x204)]!=='object')return[];const _0x50c994=[];for(const [_0x1be8b9,_0x5ca2fa]of Object[_0x34d877(0x21d)](_0x12b291[_0x34d877(0x204)])){try{validateProfileConfig(_0x5ca2fa,_0x1be8b9);const _0x37b008=getNewCredentialPath(_0x1be8b9),_0x98a693=getOldCredentialPath(_0x1be8b9),_0xdb7e07=a55_0x5be7fa[_0x34d877(0x202)](_0x37b008)||a55_0x5be7fa[_0x34d877(0x202)](_0x98a693);_0x50c994[_0x34d877(0x215)]({'name':_0x1be8b9,'config':_0x5ca2fa,'metadata':{'name':_0x1be8b9,'createdAt':new Date()[_0x34d877(0x21e)]()},'hasCredentials':_0xdb7e07,'scope':_0x53ee1f});}catch(_0x45b910){_0x45b910 instanceof Error&&(console['warn'](_0x34d877(0x21a)+_0x541357+':'),console[_0x34d877(0x1e8)]('\x20\x20'+_0x45b910['message']+'\x0a'));}}return _0x50c994;}catch(_0x13db7f){return _0x13db7f instanceof SyntaxError?(console[_0x34d877(0x1e8)](_0x34d877(0x1ff)+_0x541357+_0x34d877(0x1ea)),console['warn'](_0x34d877(0x211)+_0x13db7f['message']+'\x0a')):console[_0x34d877(0x1e8)](_0x34d877(0x1f9)+_0x541357+':\x20'+_0x13db7f+'\x0a'),[];}}export function getNewCredentialPath(_0xfa7f01){const _0x38873d=a55_0xfdf0e6;return a55_0x27ce58[_0x38873d(0x1df)](getConfigDir(),'.env.'+_0xfa7f01);}function getOldCredentialPath(_0x8f0f4b){const _0x56210b=a55_0xfdf0e6;return a55_0x27ce58[_0x56210b(0x1df)](getProfilesDir(),_0x8f0f4b,_0x56210b(0x1dc));}function loadProfilesFromTdxJsonFiles(){const _0x4a0488=a55_0xfdf0e6,_0x255d98=[],_0x5b2dcd=findProjectConfigPath();_0x5b2dcd&&_0x255d98[_0x4a0488(0x215)](...loadProfilesFromTdxJson(_0x5b2dcd,'local'));const _0x58e98b=a55_0x27ce58[_0x4a0488(0x1df)](getConfigDir(),_0x4a0488(0x1fa));return _0x255d98[_0x4a0488(0x215)](...loadProfilesFromTdxJson(_0x58e98b,_0x4a0488(0x1ec))),_0x255d98;}function a55_0x4d6f(){const _0x1a186c=['keys','profile','some','database','set','string','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','tdx.json','\x22\x20\x22','2606MTJWhI','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','20WioFeE','\x0aWarning:\x20Failed\x20to\x20parse\x20','name','33265wSQLDt','existsSync','filter','profiles','2144898DUPRMS','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Invalid\x20profile\x20name:\x20','INVALID_PROFILE_CONFIG',',\x20creating\x20new\x20file','readdirSync','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','llm_agent','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','@tdx-studio','1460080lWeXza','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','Error:\x20','rmSync','length','map','push','parse','248dVKUUA','\x27:\x20config\x20must\x20be\x20an\x20object','Warning:\x20Profile\x20\x27','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Profile\x20\x27','isDirectory','entries','toISOString','values','548975aVxVLT','site','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','24KrTMMz','21279UodnNc','\x27\x20not\x20found\x20in\x20user\x20configuration','utf-8','\x20already\x20exists','8901620UGAQuo','.env','directory','\x20does\x20not\x20exist','join','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','has','includes','\x27\x20will\x20be\x20ignored','readFileSync','stringify','description','\x20\x201.\x20Edit:\x20','warn','llm_project',':\x20Invalid\x20JSON\x20syntax','\x27:\x20unknown\x20config\x20key\x20\x27','user','sort','find','Profile\x20','test','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20'];a55_0x4d6f=function(){return _0x1a186c;};return a55_0x4d6f();}function loadProfilesFromDirectories(){const _0x11b990=a55_0xfdf0e6,_0x12a089=getProfilesDir();if(!a55_0x5be7fa[_0x11b990(0x202)](_0x12a089))return[];try{return a55_0x5be7fa[_0x11b990(0x20a)](_0x12a089,{'withFileTypes':!![]})[_0x11b990(0x203)](_0x1c5a14=>_0x1c5a14[_0x11b990(0x21c)]())[_0x11b990(0x214)](_0x104203=>_0x104203[_0x11b990(0x200)])[_0x11b990(0x203)](_0x45b15b=>{const _0x5bd0f5=_0x11b990,_0x2c54ef=getProfileConfigPath(_0x45b15b),_0x1423bf=getProfileEnvPath(_0x45b15b);return a55_0x5be7fa[_0x5bd0f5(0x202)](_0x2c54ef)||a55_0x5be7fa[_0x5bd0f5(0x202)](_0x1423bf);})[_0x11b990(0x214)](_0x2fb539=>{const _0x4a568d=_0x11b990,_0x1e5eb9=loadProfileFromDirectory(_0x2fb539);if(_0x1e5eb9)return{..._0x1e5eb9,'scope':_0x4a568d(0x1dd)};return null;})['filter'](_0x2c4a34=>_0x2c4a34!==null);}catch{return[];}}function loadProfileFromDirectory(_0x14d53c){const _0x5693b4=a55_0xfdf0e6,_0xc7bdf3=getProfileConfigPath(_0x14d53c),_0x7c2244=getOldCredentialPath(_0x14d53c);if(!a55_0x5be7fa[_0x5693b4(0x202)](_0xc7bdf3)&&!a55_0x5be7fa[_0x5693b4(0x202)](_0x7c2244))return null;let _0x2a8e2a={},_0x36a2e7={'name':_0x14d53c,'createdAt':new Date()[_0x5693b4(0x21e)]()};if(a55_0x5be7fa[_0x5693b4(0x202)](_0xc7bdf3))try{const _0x515e1d=a55_0x5be7fa[_0x5693b4(0x1e4)](_0xc7bdf3,_0x5693b4(0x1d9)),_0x2eba54=JSON[_0x5693b4(0x216)](_0x515e1d),{metadata:_0x41511e,..._0x278421}=_0x2eba54;_0x2a8e2a=_0x278421,_0x41511e&&(_0x36a2e7=_0x41511e);}catch{}return{'name':_0x14d53c,'config':_0x2a8e2a,'metadata':_0x36a2e7,'hasCredentials':a55_0x5be7fa['existsSync'](_0x7c2244),'scope':_0x5693b4(0x1dd)};}export function listProfiles(){const _0x4b03b0=a55_0xfdf0e6,_0x194615=loadProfilesFromTdxJsonFiles(),_0x181170=loadProfilesFromDirectories();if(_0x181170[_0x4b03b0(0x213)]>0x0){const _0x3185f5=_0x181170[_0x4b03b0(0x214)](_0x386927=>_0x386927[_0x4b03b0(0x200)])[_0x4b03b0(0x1df)](',\x20'),_0xf291b3=getConfigDir();console[_0x4b03b0(0x1e8)](_0x4b03b0(0x20d)+_0x3185f5),console[_0x4b03b0(0x1e8)](_0x4b03b0(0x210)),console[_0x4b03b0(0x1e8)](_0x4b03b0(0x1e7)+a55_0x27ce58[_0x4b03b0(0x1df)](_0xf291b3,_0x4b03b0(0x1fa))),console[_0x4b03b0(0x1e8)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x4b03b0(0x1e8)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x3dd790=[..._0x194615,..._0x181170],_0x101927=new Map();for(const _0x2f1448 of _0x3dd790){!_0x101927[_0x4b03b0(0x1e1)](_0x2f1448[_0x4b03b0(0x200)])&&_0x101927[_0x4b03b0(0x1f7)](_0x2f1448[_0x4b03b0(0x200)],_0x2f1448);}return Array['from'](_0x101927[_0x4b03b0(0x21f)]())[_0x4b03b0(0x1ed)]((_0x37c897,_0x39399c)=>_0x37c897[_0x4b03b0(0x200)]['localeCompare'](_0x39399c['name']));}export function profileExists(_0x45d729){const _0x1388de=a55_0xfdf0e6,_0x372f47=listProfiles();return _0x372f47[_0x1388de(0x1f5)](_0x29e6d7=>_0x29e6d7['name']===_0x45d729);}export function loadProfile(_0x2ef050){const _0x2786d9=a55_0xfdf0e6;validateProfileName(_0x2ef050);const _0x2304b9=listProfiles(),_0x21732d=_0x2304b9[_0x2786d9(0x1ee)](_0x1996c2=>_0x1996c2[_0x2786d9(0x200)]===_0x2ef050);return _0x21732d||null;}export function saveProfile(_0x5b099b,_0x177871,_0x410fb8=![]){saveProfileToUserConfig(_0x5b099b,_0x177871);}export function deleteProfile(_0x1e069c){const _0x5c8a6f=a55_0xfdf0e6;validateProfileName(_0x1e069c);const _0xd7990d=getProfileDir(_0x1e069c);if(!a55_0x5be7fa[_0x5c8a6f(0x202)](_0xd7990d))throw new Error(_0x5c8a6f(0x1ef)+_0x1e069c+_0x5c8a6f(0x1de));a55_0x5be7fa[_0x5c8a6f(0x212)](_0xd7990d,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1ff238,_0x160e95){const _0x11cf3a=a55_0xfdf0e6;validateProfileName(_0x1ff238);const _0x480def=getGlobalConfigPath(),_0x10da93=getConfigDir();!a55_0x5be7fa['existsSync'](_0x10da93)&&createSecureDirectory(_0x10da93);let _0x32df00={};if(a55_0x5be7fa[_0x11cf3a(0x202)](_0x480def))try{const _0x27631e=a55_0x5be7fa[_0x11cf3a(0x1e4)](_0x480def,_0x11cf3a(0x1d9));_0x32df00=JSON[_0x11cf3a(0x216)](_0x27631e);}catch{console[_0x11cf3a(0x1e8)](_0x11cf3a(0x1f2)+_0x480def+_0x11cf3a(0x209));}!_0x32df00['profiles']&&(_0x32df00[_0x11cf3a(0x204)]={}),_0x32df00[_0x11cf3a(0x204)][_0x1ff238]=_0x160e95,writeSecureFile(_0x480def,JSON[_0x11cf3a(0x1e5)](_0x32df00,null,0x2));}export function removeProfileFromUserConfig(_0x145bfa){const _0x32fbad=a55_0xfdf0e6;validateProfileName(_0x145bfa);const _0x3265a8=getGlobalConfigPath();if(!a55_0x5be7fa['existsSync'](_0x3265a8))throw new Error('Profile\x20\x27'+_0x145bfa+_0x32fbad(0x1d8));let _0x481984={};try{const _0x1b22b2=a55_0x5be7fa['readFileSync'](_0x3265a8,'utf-8');_0x481984=JSON['parse'](_0x1b22b2);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0x3265a8);}if(!_0x481984[_0x32fbad(0x204)]||!_0x481984[_0x32fbad(0x204)][_0x145bfa])throw new Error('Profile\x20\x27'+_0x145bfa+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x481984[_0x32fbad(0x204)][_0x145bfa],_0x481984[_0x32fbad(0x1f4)]===_0x145bfa&&delete _0x481984[_0x32fbad(0x1f4)],writeSecureFile(_0x3265a8,JSON[_0x32fbad(0x1e5)](_0x481984,null,0x2));}export function getActiveProfile(){const _0x2d7cb7=a55_0xfdf0e6,_0x22e6fb=loadSessionContext();if(_0x22e6fb?.[_0x2d7cb7(0x1f4)])return _0x22e6fb[_0x2d7cb7(0x1f4)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x45fa70=getGlobalConfigPath();if(!a55_0x5be7fa[_0x2d7cb7(0x202)](_0x45fa70))return null;try{const _0x23c342=a55_0x5be7fa[_0x2d7cb7(0x1e4)](_0x45fa70,'utf-8'),_0x3613f3=JSON[_0x2d7cb7(0x216)](_0x23c342);return _0x3613f3['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x27635b){const _0x5422f1=a55_0xfdf0e6,_0x42d9be=getGlobalConfigPath(),_0x3b5b01=getConfigDir();!a55_0x5be7fa[_0x5422f1(0x202)](_0x3b5b01)&&createSecureDirectory(_0x3b5b01);let _0x358e46={};if(a55_0x5be7fa[_0x5422f1(0x202)](_0x42d9be))try{const _0x27b591=a55_0x5be7fa['readFileSync'](_0x42d9be,_0x5422f1(0x1d9));_0x358e46=JSON[_0x5422f1(0x216)](_0x27b591);}catch{console['warn'](_0x5422f1(0x1f2)+_0x42d9be+',\x20creating\x20new\x20file');}_0x358e46[_0x5422f1(0x1d4)]=_0x27635b,writeSecureFile(_0x42d9be,JSON[_0x5422f1(0x1e5)](_0x358e46,null,0x2));}export function saveActiveProfileToUserConfig(_0xccf660){const _0x340809=a55_0xfdf0e6;validateProfileName(_0xccf660);const _0x492d8c=getGlobalConfigPath(),_0x1577a3=getConfigDir();!a55_0x5be7fa[_0x340809(0x202)](_0x1577a3)&&createSecureDirectory(_0x1577a3);let _0x340e7f={};if(a55_0x5be7fa[_0x340809(0x202)](_0x492d8c))try{const _0x33675e=a55_0x5be7fa[_0x340809(0x1e4)](_0x492d8c,'utf-8');_0x340e7f=JSON[_0x340809(0x216)](_0x33675e);}catch{console[_0x340809(0x1e8)](_0x340809(0x1f2)+_0x492d8c+_0x340809(0x209));}_0x340e7f[_0x340809(0x1f4)]=_0xccf660,writeSecureFile(_0x492d8c,JSON['stringify'](_0x340e7f,null,0x2));}function clearFieldFromUserConfig(_0x5e555f){const _0x2d2d4f=a55_0xfdf0e6,_0x4c6ddd=getGlobalConfigPath();if(!a55_0x5be7fa['existsSync'](_0x4c6ddd))return;let _0x164b62={};try{const _0x1c30c8=a55_0x5be7fa['readFileSync'](_0x4c6ddd,_0x2d2d4f(0x1d9));_0x164b62=JSON['parse'](_0x1c30c8);}catch{return;}delete _0x164b62[_0x5e555f],writeSecureFile(_0x4c6ddd,JSON[_0x2d2d4f(0x1e5)](_0x164b62,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x93656d=a55_0xfdf0e6;clearFieldFromUserConfig(_0x93656d(0x1d4));}export function clearActiveProfileFromUserConfig(){const _0x22673f=a55_0xfdf0e6;clearFieldFromUserConfig(_0x22673f(0x1f4));}export function createProfile(_0xcd3c07,_0x4aebd0){const _0x2c1fa8=a55_0xfdf0e6;validateProfileName(_0xcd3c07);if(profileExists(_0xcd3c07))throw new Error(_0x2c1fa8(0x1ef)+_0xcd3c07+_0x2c1fa8(0x1da));saveProfile(_0xcd3c07,_0x4aebd0);}export function saveProfileCredentials(_0x35f371,_0x5512c2){const _0x596455=a55_0xfdf0e6;validateProfileName(_0x35f371);if(!profileExists(_0x35f371))throw new Error(_0x596455(0x1ef)+_0x35f371+_0x596455(0x1de));const _0x254df8=getNewCredentialPath(_0x35f371);writeSecureFile(_0x254df8,_0x5512c2);}export function loadProfileCredentials(_0x295fda){const _0xa44e3a=a55_0xfdf0e6;validateProfileName(_0x295fda);const _0x3acc8e=getNewCredentialPath(_0x295fda);if(a55_0x5be7fa[_0xa44e3a(0x202)](_0x3acc8e))try{return a55_0x5be7fa['readFileSync'](_0x3acc8e,_0xa44e3a(0x1d9));}catch{}const _0x1e7262=getOldCredentialPath(_0x295fda);if(a55_0x5be7fa['existsSync'](_0x1e7262)){console[_0xa44e3a(0x1e8)](_0xa44e3a(0x206)+_0x295fda+'\x27'),console['warn']('To\x20migrate:'),console[_0xa44e3a(0x1e8)]('\x20\x20mv\x20\x22'+_0x1e7262+_0xa44e3a(0x1fb)+_0x3acc8e+'\x22'),console[_0xa44e3a(0x1e8)](_0xa44e3a(0x1e0));try{return a55_0x5be7fa[_0xa44e3a(0x1e4)](_0x1e7262,_0xa44e3a(0x1d9));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a56_0x4e5c9d=a56_0x5f16;(function(_0x1fdaa3,_0x4d5a8a){const _0x140d35=a56_0x5f16,_0x42567d=_0x1fdaa3();while(!![]){try{const _0xf5879=parseInt(_0x140d35(0x1dd))/0x1+-parseInt(_0x140d35(0x1e0))/0x2*(-parseInt(_0x140d35(0x1df))/0x3)+-parseInt(_0x140d35(0x1e7))/0x4+-parseInt(_0x140d35(0x1e4))/0x5+-parseInt(_0x140d35(0x1d5))/0x6+parseInt(_0x140d35(0x1d9))/0x7*(parseInt(_0x140d35(0x1ed))/0x8)+parseInt(_0x140d35(0x1db))/0x9;if(_0xf5879===_0x4d5a8a)break;else _0x42567d['push'](_0x42567d['shift']());}catch(_0x189b85){_0x42567d['push'](_0x42567d['shift']());}}}(a56_0x2ae5,0x9f046));import*as a56_0x1f8052 from'node:fs';import*as a56_0x4ac748 from'node:path';const PROJECT_CONFIG_FILENAME=a56_0x4e5c9d(0x1f2);export function findProjectConfigPath(_0x151a9a){const _0x3cd3a3=a56_0x4e5c9d;let _0x4d9a85=_0x151a9a||process[_0x3cd3a3(0x1e8)]();while(!![]){const _0x358b0e=a56_0x4ac748['join'](_0x4d9a85,PROJECT_CONFIG_FILENAME);if(a56_0x1f8052[_0x3cd3a3(0x1eb)](_0x358b0e))return _0x358b0e;const _0x2c0648=a56_0x4ac748[_0x3cd3a3(0x1de)](_0x4d9a85);if(_0x2c0648===_0x4d9a85)return null;_0x4d9a85=_0x2c0648;}}export function loadProjectConfig(_0x328167){const _0x589fc4=a56_0x4e5c9d,_0x1ec660=findProjectConfigPath(_0x328167);if(!_0x1ec660)return null;try{const _0x2428f3=a56_0x1f8052['readFileSync'](_0x1ec660,_0x589fc4(0x1e6)),_0x37df2a=JSON['parse'](_0x2428f3),_0x4e5ed2=JSON[_0x589fc4(0x1f1)](_0x37df2a);if(_0x4e5ed2[_0x589fc4(0x1ea)](_0x589fc4(0x1f0))||_0x4e5ed2['includes']('apiKey')||_0x4e5ed2['includes']('api_key'))throw new Error(_0x589fc4(0x1e2)+_0x1ec660+_0x589fc4(0x1d6)+_0x589fc4(0x1ef));const {metadata:_0x310bcf,profile:_0x470a7d,..._0xc06b4d}=_0x37df2a;return _0x470a7d&&console[_0x589fc4(0x1d7)](_0x589fc4(0x1dc)+_0x1ec660+'\x20is\x20ignored.\x20'+_0x589fc4(0x1da)),_0xc06b4d;}catch(_0x1b1595){if(_0x1b1595 instanceof Error&&_0x589fc4(0x1e5)in _0x1b1595&&_0x1b1595[_0x589fc4(0x1e5)]===_0x589fc4(0x1ee))return null;throw new Error(_0x589fc4(0x1e3)+_0x1ec660+':\x20'+_0x1b1595);}}function a56_0x5f16(_0x219405,_0x2dd1f0){_0x219405=_0x219405-0x1d4;const _0x2ae5f4=a56_0x2ae5();let _0x5f16dd=_0x2ae5f4[_0x219405];return _0x5f16dd;}export function saveProjectConfig(_0x262e4c,_0x3da8f2){const _0x359425=a56_0x4e5c9d,_0x39ab97=_0x3da8f2||process[_0x359425(0x1e8)](),_0x1af0b9=a56_0x4ac748['join'](_0x39ab97,PROJECT_CONFIG_FILENAME),_0x1e5072=JSON[_0x359425(0x1f1)](_0x262e4c);if(_0x1e5072['includes'](_0x359425(0x1f0))||_0x1e5072[_0x359425(0x1ea)]('apiKey')||_0x1e5072[_0x359425(0x1ea)](_0x359425(0x1ec)))throw new Error(_0x359425(0x1e1));if(_0x359425(0x1d8)in _0x262e4c)throw new Error(_0x359425(0x1e9));a56_0x1f8052[_0x359425(0x1d4)](_0x1af0b9,JSON[_0x359425(0x1f1)](_0x262e4c,null,0x2));}function a56_0x2ae5(){const _0x490424=['3839680ZffPvs','cwd','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','includes','existsSync','api_key','40168iMfNHI','ENOENT','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','TD_API_KEY','stringify','tdx.json','writeFileSync','5216766wrwNSy',').\x20','warn','profile','1400tVRFyy','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','1379448dsYzfU','Warning:\x20\x27profile\x27\x20field\x20in\x20','548177WAvONs','dirname','1847031dNpjkY','4fbezjO','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','Failed\x20to\x20load\x20project\x20config\x20from\x20','2281440afdOeL','code','utf-8'];a56_0x2ae5=function(){return _0x490424;};return a56_0x2ae5();}export function hasProjectConfig(_0x51ef3d){return findProjectConfigPath(_0x51ef3d)!==null;}export function getProjectRoot(_0x46c530){const _0x4a32c0=a56_0x4e5c9d,_0x32bcdb=findProjectConfigPath(_0x46c530);return _0x32bcdb?a56_0x4ac748[_0x4a32c0(0x1de)](_0x32bcdb):null;}
1
+ const a56_0x2f2729=a56_0x3be1;(function(_0x4b47af,_0x38178b){const _0x4653e1=a56_0x3be1,_0x206596=_0x4b47af();while(!![]){try{const _0x45c930=parseInt(_0x4653e1(0x7d))/0x1*(-parseInt(_0x4653e1(0x84))/0x2)+-parseInt(_0x4653e1(0x87))/0x3*(parseInt(_0x4653e1(0x94))/0x4)+-parseInt(_0x4653e1(0x89))/0x5*(-parseInt(_0x4653e1(0x81))/0x6)+parseInt(_0x4653e1(0x82))/0x7*(-parseInt(_0x4653e1(0x7b))/0x8)+-parseInt(_0x4653e1(0x88))/0x9*(-parseInt(_0x4653e1(0x85))/0xa)+parseInt(_0x4653e1(0x80))/0xb+-parseInt(_0x4653e1(0x86))/0xc;if(_0x45c930===_0x38178b)break;else _0x206596['push'](_0x206596['shift']());}catch(_0x35416f){_0x206596['push'](_0x206596['shift']());}}}(a56_0x3204,0x9c9aa));import*as a56_0x4103ae from'node:fs';import*as a56_0x5b18dc from'node:path';const PROJECT_CONFIG_FILENAME=a56_0x2f2729(0x8d);export function findProjectConfigPath(_0x53859f){const _0x17a953=a56_0x2f2729;let _0x3a98a1=_0x53859f||process[_0x17a953(0x95)]();while(!![]){const _0x367af6=a56_0x5b18dc[_0x17a953(0x8a)](_0x3a98a1,PROJECT_CONFIG_FILENAME);if(a56_0x4103ae[_0x17a953(0x8c)](_0x367af6))return _0x367af6;const _0x2f8084=a56_0x5b18dc[_0x17a953(0x8f)](_0x3a98a1);if(_0x2f8084===_0x3a98a1)return null;_0x3a98a1=_0x2f8084;}}function a56_0x3204(){const _0x2151a3=['API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','6641404ckkUsZ','30VMhYVv','735GvBixj','writeFileSync','6azyZBh','10NhHuSF','4070916YqBBAA','1221cDgLeC','6636177MfHQIP','1086055sCcwjU','join','readFileSync','existsSync','tdx.json','ENOENT','dirname','api_key','code','includes','stringify','3436BNuWWg','cwd','utf-8','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','parse','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','TD_API_KEY','apiKey','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.',').\x20','61448XgwRos','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','96787GiqxHK','profile'];a56_0x3204=function(){return _0x2151a3;};return a56_0x3204();}function a56_0x3be1(_0x552864,_0x5f2d58){_0x552864=_0x552864-0x79;const _0x3204f5=a56_0x3204();let _0x3be1e3=_0x3204f5[_0x552864];return _0x3be1e3;}export function loadProjectConfig(_0x14541b){const _0x4c2ba0=a56_0x2f2729,_0x3d9c00=findProjectConfigPath(_0x14541b);if(!_0x3d9c00)return null;try{const _0x514a2c=a56_0x4103ae[_0x4c2ba0(0x8b)](_0x3d9c00,_0x4c2ba0(0x96)),_0x49de08=JSON[_0x4c2ba0(0x98)](_0x514a2c),_0x5a92e7=JSON[_0x4c2ba0(0x93)](_0x49de08);if(_0x5a92e7[_0x4c2ba0(0x92)](_0x4c2ba0(0x9a))||_0x5a92e7[_0x4c2ba0(0x92)](_0x4c2ba0(0x9b))||_0x5a92e7['includes']('api_key'))throw new Error(_0x4c2ba0(0x97)+_0x3d9c00+_0x4c2ba0(0x7a)+_0x4c2ba0(0x7c));const {metadata:_0x5c42db,profile:_0x45c884,..._0x5d68e3}=_0x49de08;return _0x45c884&&console['warn']('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x3d9c00+'\x20is\x20ignored.\x20'+_0x4c2ba0(0x99)),_0x5d68e3;}catch(_0x28c71b){if(_0x28c71b instanceof Error&&'code'in _0x28c71b&&_0x28c71b[_0x4c2ba0(0x91)]===_0x4c2ba0(0x8e))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x3d9c00+':\x20'+_0x28c71b);}}export function saveProjectConfig(_0x490091,_0x249bbe){const _0x5147ef=a56_0x2f2729,_0x4b48f1=_0x249bbe||process[_0x5147ef(0x95)](),_0x3f034f=a56_0x5b18dc['join'](_0x4b48f1,PROJECT_CONFIG_FILENAME),_0x4f2420=JSON[_0x5147ef(0x93)](_0x490091);if(_0x4f2420['includes'](_0x5147ef(0x9a))||_0x4f2420[_0x5147ef(0x92)]('apiKey')||_0x4f2420[_0x5147ef(0x92)](_0x5147ef(0x90)))throw new Error(_0x5147ef(0x7f));if(_0x5147ef(0x7e)in _0x490091)throw new Error(_0x5147ef(0x79));a56_0x4103ae[_0x5147ef(0x83)](_0x3f034f,JSON[_0x5147ef(0x93)](_0x490091,null,0x2));}export function hasProjectConfig(_0x51e873){return findProjectConfigPath(_0x51e873)!==null;}export function getProjectRoot(_0x170511){const _0x411bfc=a56_0x2f2729,_0xe1c0a6=findProjectConfigPath(_0x170511);return _0xe1c0a6?a56_0x5b18dc[_0x411bfc(0x8f)](_0xe1c0a6):null;}
@@ -1 +1 @@
1
- (function(_0x15bb7d,_0x2021b8){const _0xd5d599=a57_0x2874,_0x29dc1c=_0x15bb7d();while(!![]){try{const _0x1e3490=parseInt(_0xd5d599(0x12a))/0x1*(-parseInt(_0xd5d599(0x10f))/0x2)+parseInt(_0xd5d599(0x133))/0x3*(parseInt(_0xd5d599(0x130))/0x4)+-parseInt(_0xd5d599(0x110))/0x5+parseInt(_0xd5d599(0x11b))/0x6+-parseInt(_0xd5d599(0x114))/0x7+parseInt(_0xd5d599(0x12b))/0x8*(-parseInt(_0xd5d599(0x12f))/0x9)+parseInt(_0xd5d599(0x10e))/0xa;if(_0x1e3490===_0x2021b8)break;else _0x29dc1c['push'](_0x29dc1c['shift']());}catch(_0xd6fe67){_0x29dc1c['push'](_0x29dc1c['shift']());}}}(a57_0xa06a,0xcf1db));import*as a57_0x1da3a9 from'node:fs';import*as a57_0x36c7ba from'node:path';import*as a57_0x3333cf 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 _0xa2e5e=a57_0x2874,_0x4d8c6e=process.env.TDX_CONFIG_DIR||a57_0x36c7ba['join'](a57_0x3333cf[_0xa2e5e(0x117)](),_0xa2e5e(0x111),'tdx');return a57_0x36c7ba[_0xa2e5e(0x123)](_0x4d8c6e,'sessions');}function a57_0xa06a(){const _0x490ae9=['82sZcbsJ','5367640XqpGEj','.config','.\x20This\x20is\x20insecure.\x20Removing\x20session.','replace','542801zPMPsy','apiKey','readdirSync','homedir','now','TD_API_KEY','readFileSync','2530992lqBAOU','toString','includes','.json','push','existsSync','unlinkSync','toISOString','join','parse','test','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','utf-8','sort','getTime','35225jkMIQd','8OFCGVM','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','stringify','api_key','7406811weXCut','1135548yQazDb','writeFileSync','createdAt','3WUyPJY','endsWith','warn','35609030vRiaCI'];a57_0xa06a=function(){return _0x490ae9;};return a57_0xa06a();}function a57_0x2874(_0x3fa5ea,_0x45b9d3){_0x3fa5ea=_0x3fa5ea-0x10d;const _0xa06aaf=a57_0xa06a();let _0x28743c=_0xa06aaf[_0x3fa5ea];return _0x28743c;}function getSessionPath(_0x3f2f45){const _0x224862=a57_0x2874;return a57_0x36c7ba['join'](getSessionsDir(),_0x3f2f45+_0x224862(0x11e));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x298df0){const _0x2a8368=a57_0x2874;if(_0x298df0)return _0x298df0;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x2a8368(0x11c)]();}export function loadSessionContext(_0x46d1f5){const _0x4250a6=a57_0x2874,_0x5944d3=getSessionID(_0x46d1f5),_0x3a2529=/^\d+$/[_0x4250a6(0x125)](_0x5944d3)?parseInt(_0x5944d3,0xa):null;return _0x3a2529!==null?loadSessionContextByPID(_0x3a2529):loadSessionContextByString(_0x5944d3);}export function loadSessionContextByPID(_0x1e427f){const _0x40c08a=a57_0x2874,_0x236d06=getSessionPath(_0x1e427f);if(!a57_0x1da3a9[_0x40c08a(0x120)](_0x236d06))return null;try{const _0x3a0c18=a57_0x1da3a9[_0x40c08a(0x11a)](_0x236d06,_0x40c08a(0x127)),_0x14cfbc=JSON[_0x40c08a(0x124)](_0x3a0c18),_0x51ca3c=new Date(_0x14cfbc[_0x40c08a(0x132)])[_0x40c08a(0x129)](),_0x1584cf=Date[_0x40c08a(0x118)]();if(_0x1584cf-_0x51ca3c>SESSION_EXPIRATION_MS)return a57_0x1da3a9['unlinkSync'](_0x236d06),null;const _0x5b0ab3=JSON[_0x40c08a(0x12d)](_0x14cfbc);if(_0x5b0ab3[_0x40c08a(0x11d)](_0x40c08a(0x119))||_0x5b0ab3[_0x40c08a(0x11d)](_0x40c08a(0x115))||_0x5b0ab3['includes']('api_key'))return console[_0x40c08a(0x10d)](_0x40c08a(0x126)+_0x236d06+_0x40c08a(0x112)),a57_0x1da3a9['unlinkSync'](_0x236d06),null;return _0x14cfbc;}catch{try{a57_0x1da3a9[_0x40c08a(0x121)](_0x236d06);}catch{}return null;}}function loadSessionContextByString(_0x23ae33){const _0x21eb0b=a57_0x2874,_0x494d38=a57_0x36c7ba[_0x21eb0b(0x123)](getSessionsDir(),_0x23ae33+_0x21eb0b(0x11e));if(!a57_0x1da3a9[_0x21eb0b(0x120)](_0x494d38))return null;try{const _0x3545c9=a57_0x1da3a9[_0x21eb0b(0x11a)](_0x494d38,_0x21eb0b(0x127)),_0x125628=JSON['parse'](_0x3545c9),_0x309413=new Date(_0x125628['createdAt'])[_0x21eb0b(0x129)](),_0x3c3777=Date[_0x21eb0b(0x118)]();if(_0x3c3777-_0x309413>SESSION_EXPIRATION_MS)return a57_0x1da3a9[_0x21eb0b(0x121)](_0x494d38),null;const _0x26ca6e=JSON[_0x21eb0b(0x12d)](_0x125628);if(_0x26ca6e[_0x21eb0b(0x11d)](_0x21eb0b(0x119))||_0x26ca6e[_0x21eb0b(0x11d)](_0x21eb0b(0x115))||_0x26ca6e['includes']('api_key'))return console[_0x21eb0b(0x10d)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x494d38+_0x21eb0b(0x112)),a57_0x1da3a9[_0x21eb0b(0x121)](_0x494d38),null;return _0x125628;}catch{try{a57_0x1da3a9[_0x21eb0b(0x121)](_0x494d38);}catch{}return null;}}export function saveSessionContext(_0x40939c,_0x5c6d6e){const _0x56cba5=a57_0x2874,_0x1b29fa=getSessionID(_0x5c6d6e),_0x4b53a3=/^\d+$/['test'](_0x1b29fa)?parseInt(_0x1b29fa,0xa):getCurrentSessionPID(),_0x12c2a6=a57_0x36c7ba[_0x56cba5(0x123)](getSessionsDir(),_0x1b29fa+_0x56cba5(0x11e)),_0x4d68e1=getSessionsDir();createSecureDirectory(_0x4d68e1);const _0x471313=JSON[_0x56cba5(0x12d)](_0x40939c);if(_0x471313[_0x56cba5(0x11d)]('TD_API_KEY')||_0x471313[_0x56cba5(0x11d)](_0x56cba5(0x115))||_0x471313[_0x56cba5(0x11d)](_0x56cba5(0x12e)))throw new Error(_0x56cba5(0x12c));let _0x33eef1;const _0x45fd8a=/^\d+$/['test'](_0x1b29fa)?loadSessionContextByPID(parseInt(_0x1b29fa,0xa)):loadSessionContextByString(_0x1b29fa);_0x45fd8a?_0x33eef1={..._0x45fd8a,..._0x40939c,'pid':_0x4b53a3,'sessionId':_0x1b29fa!==_0x4b53a3[_0x56cba5(0x11c)]()?_0x1b29fa:undefined,'updatedAt':new Date()[_0x56cba5(0x122)]()}:_0x33eef1={'pid':_0x4b53a3,'sessionId':_0x1b29fa!==_0x4b53a3[_0x56cba5(0x11c)]()?_0x1b29fa:undefined,..._0x40939c,'createdAt':new Date()[_0x56cba5(0x122)](),'updatedAt':new Date()[_0x56cba5(0x122)]()},a57_0x1da3a9['writeFileSync'](_0x12c2a6,JSON[_0x56cba5(0x12d)](_0x33eef1,null,0x2));}export function clearSessionContext(_0x12af22){const _0x5226f8=a57_0x2874,_0xb3c0f6=getSessionID(_0x12af22),_0x465db7=a57_0x36c7ba[_0x5226f8(0x123)](getSessionsDir(),_0xb3c0f6+_0x5226f8(0x11e));a57_0x1da3a9[_0x5226f8(0x120)](_0x465db7)&&a57_0x1da3a9[_0x5226f8(0x121)](_0x465db7);}export function clearSessionContextField(_0x2811fc,_0x5ead2d){const _0x1eb260=a57_0x2874,_0x86d29e=getSessionID(_0x5ead2d),_0x50c1c4=a57_0x36c7ba['join'](getSessionsDir(),_0x86d29e+_0x1eb260(0x11e));if(!a57_0x1da3a9[_0x1eb260(0x120)](_0x50c1c4))return;try{const _0x569eae=a57_0x1da3a9[_0x1eb260(0x11a)](_0x50c1c4,'utf-8'),_0x214cb1=JSON[_0x1eb260(0x124)](_0x569eae);delete _0x214cb1[_0x2811fc],a57_0x1da3a9[_0x1eb260(0x131)](_0x50c1c4,JSON[_0x1eb260(0x12d)](_0x214cb1,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x375879=a57_0x2874,_0x3257c9=getSessionsDir();if(!a57_0x1da3a9['existsSync'](_0x3257c9))return 0x0;let _0x135ec2=0x0;const _0x1d74f1=Date['now']();try{const _0x4a1cc3=a57_0x1da3a9[_0x375879(0x116)](_0x3257c9);for(const _0x4b23f4 of _0x4a1cc3){if(!_0x4b23f4['endsWith'](_0x375879(0x11e)))continue;const _0x3f536c=a57_0x36c7ba[_0x375879(0x123)](_0x3257c9,_0x4b23f4),_0x46fb17=_0x4b23f4[_0x375879(0x113)](_0x375879(0x11e),''),_0x5c43bc=parseInt(_0x46fb17,0xa),_0x31a003=!isNaN(_0x5c43bc);if(_0x31a003){if(!isProcessRunning(_0x5c43bc)){a57_0x1da3a9[_0x375879(0x121)](_0x3f536c),_0x135ec2++;continue;}}try{const _0x255326=a57_0x1da3a9[_0x375879(0x11a)](_0x3f536c,_0x375879(0x127)),_0x230f00=JSON[_0x375879(0x124)](_0x255326),_0x1cfbe4=new Date(_0x230f00['createdAt'])[_0x375879(0x129)]();_0x1d74f1-_0x1cfbe4>SESSION_EXPIRATION_MS&&(a57_0x1da3a9[_0x375879(0x121)](_0x3f536c),_0x135ec2++);}catch{a57_0x1da3a9[_0x375879(0x121)](_0x3f536c),_0x135ec2++;}}}catch{}return _0x135ec2;}export function listActiveSessions(){const _0x358bc7=a57_0x2874,_0x1a9039=getSessionsDir();if(!a57_0x1da3a9['existsSync'](_0x1a9039))return[];try{const _0x95af8f=a57_0x1da3a9[_0x358bc7(0x116)](_0x1a9039),_0x16c3cc=[];for(const _0x2bb4e1 of _0x95af8f){if(!_0x2bb4e1[_0x358bc7(0x134)](_0x358bc7(0x11e)))continue;const _0x19accd=_0x2bb4e1[_0x358bc7(0x113)](_0x358bc7(0x11e),''),_0x5b92d2=parseInt(_0x19accd,0xa);!isNaN(_0x5b92d2)&&isProcessRunning(_0x5b92d2)&&_0x16c3cc[_0x358bc7(0x11f)](_0x5b92d2);}return _0x16c3cc[_0x358bc7(0x128)]((_0x4395b3,_0x36d427)=>_0x4395b3-_0x36d427);}catch{return[];}}
1
+ function a57_0x3bc8(){const _0x2167dc=['5wKhlhZ','unlinkSync','stringify','existsSync','.json','warn','308579oybZXU','sessions','utf-8','parse','307569tSaidr','now','homedir','5023536JBaBso','getTime','1584890nNqUPE','toISOString','replace','830944gDlTgq','writeFileSync','readFileSync','createdAt','test','toString','push','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','apiKey','TD_API_KEY','join','9uoDTwV','includes','2014134kRSzYg','tdx','.\x20This\x20is\x20insecure.\x20Removing\x20session.','.config','4jsfnnT','readdirSync','api_key','endsWith','2834088aFvgat','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.'];a57_0x3bc8=function(){return _0x2167dc;};return a57_0x3bc8();}(function(_0x143514,_0x1d39d3){const _0x32d578=a57_0x5634,_0xa3912=_0x143514();while(!![]){try{const _0x5efb30=parseInt(_0x32d578(0x204))/0x1+parseInt(_0x32d578(0x1f8))/0x2*(-parseInt(_0x32d578(0x208))/0x3)+-parseInt(_0x32d578(0x1fc))/0x4*(-parseInt(_0x32d578(0x1fe))/0x5)+parseInt(_0x32d578(0x1f4))/0x6+-parseInt(_0x32d578(0x20b))/0x7+parseInt(_0x32d578(0x1e7))/0x8+-parseInt(_0x32d578(0x1f2))/0x9*(parseInt(_0x32d578(0x1e4))/0xa);if(_0x5efb30===_0x1d39d3)break;else _0xa3912['push'](_0xa3912['shift']());}catch(_0x3b68da){_0xa3912['push'](_0xa3912['shift']());}}}(a57_0x3bc8,0x5bab3));import*as a57_0x46071a from'node:fs';import*as a57_0x2e308c from'node:path';import*as a57_0x2b3f9f 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 _0x2106ac=a57_0x5634,_0x3e25b9=process.env.TDX_CONFIG_DIR||a57_0x2e308c[_0x2106ac(0x1f1)](a57_0x2b3f9f[_0x2106ac(0x20a)](),_0x2106ac(0x1f7),_0x2106ac(0x1f5));return a57_0x2e308c['join'](_0x3e25b9,_0x2106ac(0x205));}function getSessionPath(_0x2068b4){const _0x35f16e=a57_0x5634;return a57_0x2e308c[_0x35f16e(0x1f1)](getSessionsDir(),_0x2068b4+_0x35f16e(0x202));}function a57_0x5634(_0x575706,_0x5a33c8){_0x575706=_0x575706-0x1e4;const _0x3bc8c0=a57_0x3bc8();let _0x5634d9=_0x3bc8c0[_0x575706];return _0x5634d9;}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x33bcf5){const _0x5bc8ec=a57_0x5634;if(_0x33bcf5)return _0x33bcf5;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x5bc8ec(0x1ec)]();}export function loadSessionContext(_0x727ca2){const _0x53f74a=a57_0x5634,_0x2b5fb5=getSessionID(_0x727ca2),_0x487f7f=/^\d+$/[_0x53f74a(0x1eb)](_0x2b5fb5)?parseInt(_0x2b5fb5,0xa):null;return _0x487f7f!==null?loadSessionContextByPID(_0x487f7f):loadSessionContextByString(_0x2b5fb5);}export function loadSessionContextByPID(_0x2d881f){const _0x31c8fa=a57_0x5634,_0x470b4f=getSessionPath(_0x2d881f);if(!a57_0x46071a['existsSync'](_0x470b4f))return null;try{const _0x1ef1d=a57_0x46071a[_0x31c8fa(0x1e9)](_0x470b4f,_0x31c8fa(0x206)),_0x212201=JSON[_0x31c8fa(0x207)](_0x1ef1d),_0x22c34c=new Date(_0x212201['createdAt'])[_0x31c8fa(0x20c)](),_0x3f6e0e=Date[_0x31c8fa(0x209)]();if(_0x3f6e0e-_0x22c34c>SESSION_EXPIRATION_MS)return a57_0x46071a[_0x31c8fa(0x1ff)](_0x470b4f),null;const _0x6b5d6e=JSON[_0x31c8fa(0x200)](_0x212201);if(_0x6b5d6e[_0x31c8fa(0x1f3)](_0x31c8fa(0x1f0))||_0x6b5d6e[_0x31c8fa(0x1f3)](_0x31c8fa(0x1ef))||_0x6b5d6e[_0x31c8fa(0x1f3)](_0x31c8fa(0x1fa)))return console[_0x31c8fa(0x203)](_0x31c8fa(0x1ee)+_0x470b4f+_0x31c8fa(0x1f6)),a57_0x46071a[_0x31c8fa(0x1ff)](_0x470b4f),null;return _0x212201;}catch{try{a57_0x46071a['unlinkSync'](_0x470b4f);}catch{}return null;}}function loadSessionContextByString(_0x293f6e){const _0x56a00a=a57_0x5634,_0x3f82c8=a57_0x2e308c['join'](getSessionsDir(),_0x293f6e+_0x56a00a(0x202));if(!a57_0x46071a['existsSync'](_0x3f82c8))return null;try{const _0x3130fb=a57_0x46071a['readFileSync'](_0x3f82c8,'utf-8'),_0x3d4242=JSON[_0x56a00a(0x207)](_0x3130fb),_0x47729e=new Date(_0x3d4242[_0x56a00a(0x1ea)])[_0x56a00a(0x20c)](),_0x11055e=Date[_0x56a00a(0x209)]();if(_0x11055e-_0x47729e>SESSION_EXPIRATION_MS)return a57_0x46071a['unlinkSync'](_0x3f82c8),null;const _0x47b726=JSON[_0x56a00a(0x200)](_0x3d4242);if(_0x47b726['includes'](_0x56a00a(0x1f0))||_0x47b726[_0x56a00a(0x1f3)](_0x56a00a(0x1ef))||_0x47b726['includes'](_0x56a00a(0x1fa)))return console[_0x56a00a(0x203)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x3f82c8+_0x56a00a(0x1f6)),a57_0x46071a[_0x56a00a(0x1ff)](_0x3f82c8),null;return _0x3d4242;}catch{try{a57_0x46071a[_0x56a00a(0x1ff)](_0x3f82c8);}catch{}return null;}}export function saveSessionContext(_0x4eb317,_0x114a33){const _0x32d28d=a57_0x5634,_0x1bbc32=getSessionID(_0x114a33),_0x576b17=/^\d+$/[_0x32d28d(0x1eb)](_0x1bbc32)?parseInt(_0x1bbc32,0xa):getCurrentSessionPID(),_0x3ad025=a57_0x2e308c[_0x32d28d(0x1f1)](getSessionsDir(),_0x1bbc32+'.json'),_0x1c45de=getSessionsDir();createSecureDirectory(_0x1c45de);const _0x4ffb09=JSON[_0x32d28d(0x200)](_0x4eb317);if(_0x4ffb09[_0x32d28d(0x1f3)](_0x32d28d(0x1f0))||_0x4ffb09['includes'](_0x32d28d(0x1ef))||_0x4ffb09[_0x32d28d(0x1f3)](_0x32d28d(0x1fa)))throw new Error(_0x32d28d(0x1fd));let _0x1e59c6;const _0x1f8ac9=/^\d+$/[_0x32d28d(0x1eb)](_0x1bbc32)?loadSessionContextByPID(parseInt(_0x1bbc32,0xa)):loadSessionContextByString(_0x1bbc32);_0x1f8ac9?_0x1e59c6={..._0x1f8ac9,..._0x4eb317,'pid':_0x576b17,'sessionId':_0x1bbc32!==_0x576b17['toString']()?_0x1bbc32:undefined,'updatedAt':new Date()[_0x32d28d(0x1e5)]()}:_0x1e59c6={'pid':_0x576b17,'sessionId':_0x1bbc32!==_0x576b17[_0x32d28d(0x1ec)]()?_0x1bbc32:undefined,..._0x4eb317,'createdAt':new Date()[_0x32d28d(0x1e5)](),'updatedAt':new Date()[_0x32d28d(0x1e5)]()},a57_0x46071a['writeFileSync'](_0x3ad025,JSON[_0x32d28d(0x200)](_0x1e59c6,null,0x2));}export function clearSessionContext(_0x3afce2){const _0x2c7a40=a57_0x5634,_0x25b858=getSessionID(_0x3afce2),_0x5c54e0=a57_0x2e308c[_0x2c7a40(0x1f1)](getSessionsDir(),_0x25b858+'.json');a57_0x46071a[_0x2c7a40(0x201)](_0x5c54e0)&&a57_0x46071a[_0x2c7a40(0x1ff)](_0x5c54e0);}export function clearSessionContextField(_0x157bda,_0x4fbee0){const _0x3046e1=a57_0x5634,_0x52dd68=getSessionID(_0x4fbee0),_0xaa2503=a57_0x2e308c[_0x3046e1(0x1f1)](getSessionsDir(),_0x52dd68+_0x3046e1(0x202));if(!a57_0x46071a[_0x3046e1(0x201)](_0xaa2503))return;try{const _0x16c58b=a57_0x46071a[_0x3046e1(0x1e9)](_0xaa2503,_0x3046e1(0x206)),_0x1de67a=JSON[_0x3046e1(0x207)](_0x16c58b);delete _0x1de67a[_0x157bda],a57_0x46071a[_0x3046e1(0x1e8)](_0xaa2503,JSON[_0x3046e1(0x200)](_0x1de67a,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x5f02ba=a57_0x5634,_0x2f7920=getSessionsDir();if(!a57_0x46071a[_0x5f02ba(0x201)](_0x2f7920))return 0x0;let _0x213690=0x0;const _0x6e2b97=Date['now']();try{const _0x418bc7=a57_0x46071a[_0x5f02ba(0x1f9)](_0x2f7920);for(const _0x4f45fe of _0x418bc7){if(!_0x4f45fe[_0x5f02ba(0x1fb)](_0x5f02ba(0x202)))continue;const _0x56eeb3=a57_0x2e308c[_0x5f02ba(0x1f1)](_0x2f7920,_0x4f45fe),_0x1ef89b=_0x4f45fe[_0x5f02ba(0x1e6)](_0x5f02ba(0x202),''),_0x320e0e=parseInt(_0x1ef89b,0xa),_0x352970=!isNaN(_0x320e0e);if(_0x352970){if(!isProcessRunning(_0x320e0e)){a57_0x46071a['unlinkSync'](_0x56eeb3),_0x213690++;continue;}}try{const _0x2d59b2=a57_0x46071a[_0x5f02ba(0x1e9)](_0x56eeb3,_0x5f02ba(0x206)),_0x1942e2=JSON[_0x5f02ba(0x207)](_0x2d59b2),_0x37b8dd=new Date(_0x1942e2[_0x5f02ba(0x1ea)])[_0x5f02ba(0x20c)]();_0x6e2b97-_0x37b8dd>SESSION_EXPIRATION_MS&&(a57_0x46071a['unlinkSync'](_0x56eeb3),_0x213690++);}catch{a57_0x46071a['unlinkSync'](_0x56eeb3),_0x213690++;}}}catch{}return _0x213690;}export function listActiveSessions(){const _0x120816=a57_0x5634,_0x28c37c=getSessionsDir();if(!a57_0x46071a[_0x120816(0x201)](_0x28c37c))return[];try{const _0x153b59=a57_0x46071a[_0x120816(0x1f9)](_0x28c37c),_0x445e34=[];for(const _0x5727aa of _0x153b59){if(!_0x5727aa[_0x120816(0x1fb)](_0x120816(0x202)))continue;const _0x35be5c=_0x5727aa[_0x120816(0x1e6)](_0x120816(0x202),''),_0x1deb1c=parseInt(_0x35be5c,0xa);!isNaN(_0x1deb1c)&&isProcessRunning(_0x1deb1c)&&_0x445e34[_0x120816(0x1ed)](_0x1deb1c);}return _0x445e34['sort']((_0x5322f9,_0x23b748)=>_0x5322f9-_0x23b748);}catch{return[];}}
@@ -1 +1 @@
1
- (function(_0x1a65db,_0x46d36a){const _0x1e885a=a58_0x552f,_0x51e838=_0x1a65db();while(!![]){try{const _0x218522=parseInt(_0x1e885a(0x120))/0x1+parseInt(_0x1e885a(0x11d))/0x2+parseInt(_0x1e885a(0x11c))/0x3+parseInt(_0x1e885a(0x119))/0x4*(parseInt(_0x1e885a(0x117))/0x5)+parseInt(_0x1e885a(0x118))/0x6+-parseInt(_0x1e885a(0x11a))/0x7*(-parseInt(_0x1e885a(0x121))/0x8)+-parseInt(_0x1e885a(0x11b))/0x9;if(_0x218522===_0x46d36a)break;else _0x51e838['push'](_0x51e838['shift']());}catch(_0x87d423){_0x51e838['push'](_0x51e838['shift']());}}}(a58_0x2bef,0xb2ee5));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json','core/user-cache');export function loadCachedUsers(_0x931256){const _0x36042d=a58_0x552f,_0xe62fc7=userCache[_0x36042d(0x115)](_0x931256);return _0xe62fc7?.[_0x36042d(0x11f)]??null;}function a58_0x2bef(){const _0x186203=['users','1433044YUoWGP','208AhbYfv','clear','read','write','46640EyRhko','1386600AyNZtO','228NaSiFI','1498AknZZF','23155533iOhGwm','1150407ycaQiq','1441730OMZiFl','now'];a58_0x2bef=function(){return _0x186203;};return a58_0x2bef();}function a58_0x552f(_0x3dd4b1,_0x17bfa6){_0x3dd4b1=_0x3dd4b1-0x115;const _0x2bef68=a58_0x2bef();let _0x552fbe=_0x2bef68[_0x3dd4b1];return _0x552fbe;}export function saveCachedUsers(_0x46678f,_0xeeface){const _0x1a9997=a58_0x552f;userCache[_0x1a9997(0x116)](_0x46678f,{'users':_0xeeface,'cachedAt':Date[_0x1a9997(0x11e)]()});}export function clearUserCache(_0x3ad1fa){const _0xf1dfd3=a58_0x552f;userCache[_0xf1dfd3(0x122)](_0x3ad1fa);}
1
+ const a58_0x7be855=a58_0x33b4;(function(_0x5d6342,_0x1a63e8){const _0x380fb6=a58_0x33b4,_0x138e00=_0x5d6342();while(!![]){try{const _0x2917fd=-parseInt(_0x380fb6(0x17e))/0x1*(-parseInt(_0x380fb6(0x185))/0x2)+-parseInt(_0x380fb6(0x18a))/0x3*(parseInt(_0x380fb6(0x18c))/0x4)+parseInt(_0x380fb6(0x180))/0x5*(-parseInt(_0x380fb6(0x182))/0x6)+parseInt(_0x380fb6(0x184))/0x7*(-parseInt(_0x380fb6(0x17d))/0x8)+parseInt(_0x380fb6(0x183))/0x9*(-parseInt(_0x380fb6(0x18b))/0xa)+parseInt(_0x380fb6(0x188))/0xb+-parseInt(_0x380fb6(0x17f))/0xc*(-parseInt(_0x380fb6(0x181))/0xd);if(_0x2917fd===_0x1a63e8)break;else _0x138e00['push'](_0x138e00['shift']());}catch(_0x4cacbc){_0x138e00['push'](_0x138e00['shift']());}}}(a58_0x347c,0xe8ae7));function a58_0x347c(){const _0x1f7d4c=['14870FLImFF','692taHgFX','24KSmUiT','2635jfQbhE','8866716PkfNGK','3815885klFwhd','26zMhNQF','12WVsUpq','594utyvuc','13076mPLdsx','248eLfmhM','clear','read','18550048UdOUAD','core/user-cache','15741cbqBqx'];a58_0x347c=function(){return _0x1f7d4c;};return a58_0x347c();}function a58_0x33b4(_0x321916,_0x3c49f5){_0x321916=_0x321916-0x17d;const _0x347c01=a58_0x347c();let _0x33b490=_0x347c01[_0x321916];return _0x33b490;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json',a58_0x7be855(0x189));export function loadCachedUsers(_0x3ece90){const _0x353d6d=a58_0x7be855,_0x2ce002=userCache[_0x353d6d(0x187)](_0x3ece90);return _0x2ce002?.['users']??null;}export function saveCachedUsers(_0x19928a,_0x2bdb99){userCache['write'](_0x19928a,{'users':_0x2bdb99,'cachedAt':Date['now']()});}export function clearUserCache(_0x434e41){const _0x54b79b=a58_0x7be855;userCache[_0x54b79b(0x186)](_0x434e41);}
@@ -1 +1 @@
1
- (function(_0xc85517,_0x10a849){const _0x5c4697=a59_0x259e,_0x1cd694=_0xc85517();while(!![]){try{const _0x3b10bc=parseInt(_0x5c4697(0xb7))/0x1*(-parseInt(_0x5c4697(0xac))/0x2)+-parseInt(_0x5c4697(0xb0))/0x3+-parseInt(_0x5c4697(0xae))/0x4+parseInt(_0x5c4697(0xb5))/0x5*(-parseInt(_0x5c4697(0xaf))/0x6)+parseInt(_0x5c4697(0xb6))/0x7*(parseInt(_0x5c4697(0xb8))/0x8)+-parseInt(_0x5c4697(0xb2))/0x9+parseInt(_0x5c4697(0xba))/0xa;if(_0x3b10bc===_0x10a849)break;else _0x1cd694['push'](_0x1cd694['shift']());}catch(_0x530695){_0x1cd694['push'](_0x1cd694['shift']());}}}(a59_0x4dc0,0x70c7b));import{readFileSync}from'fs';import{fileURLToPath}from'url';function a59_0x4dc0(){const _0x2bd9b7=['6861690USqcSw','version','parse','11315RaTvuN','378ISIohF','1awkhrk','74256UQyhUN','includes','27228810WERfPq','../../package.json','966306bDnOJY','../build-info.json','610344xLNyle','1626ajwIIh','2252220PHbAOe','utf-8'];a59_0x4dc0=function(){return _0x2bd9b7;};return a59_0x4dc0();}import{dirname,join}from'path';function a59_0x259e(_0x38fa72,_0x4815e6){_0x38fa72=_0x38fa72-0xab;const _0x4dc095=a59_0x4dc0();let _0x259e27=_0x4dc095[_0x38fa72];return _0x259e27;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x538cda=a59_0x259e;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x28cec9=fileURLToPath(import.meta.url),_0x421622=dirname(_0x28cec9);try{const _0x583f53=join(_0x421622,_0x538cda(0xad));cachedBuildInfo=JSON[_0x538cda(0xb4)](readFileSync(_0x583f53,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x3f1f04=a59_0x259e;if(cachedVersion!==null)return cachedVersion;const _0xb5aebb=fileURLToPath(import.meta.url),_0xca8a9=dirname(_0xb5aebb),_0x29ebec=getBuildInfo();if(_0x29ebec[_0x3f1f04(0xb3)])return cachedVersion=_0x29ebec[_0x3f1f04(0xb3)],cachedVersion;try{const _0x2f1be3=join(_0xca8a9,_0x3f1f04(0xab)),_0x1db3ab=JSON[_0x3f1f04(0xb4)](readFileSync(_0x2f1be3,_0x3f1f04(0xb1)));cachedVersion=_0x1db3ab['version'];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x19707e=a59_0x259e,_0x67585b=getVersion();return _0x67585b[_0x19707e(0xb9)]('.dev')||_0x67585b['includes']('-');}
1
+ (function(_0x63b811,_0x4daa68){const _0x1cfc82=a59_0x3b65,_0x36678a=_0x63b811();while(!![]){try{const _0x11dac1=-parseInt(_0x1cfc82(0x78))/0x1*(-parseInt(_0x1cfc82(0x7e))/0x2)+-parseInt(_0x1cfc82(0x74))/0x3*(parseInt(_0x1cfc82(0x7b))/0x4)+-parseInt(_0x1cfc82(0x7d))/0x5*(-parseInt(_0x1cfc82(0x7a))/0x6)+-parseInt(_0x1cfc82(0x81))/0x7*(-parseInt(_0x1cfc82(0x79))/0x8)+parseInt(_0x1cfc82(0x7f))/0x9+parseInt(_0x1cfc82(0x71))/0xa+-parseInt(_0x1cfc82(0x76))/0xb;if(_0x11dac1===_0x4daa68)break;else _0x36678a['push'](_0x36678a['shift']());}catch(_0x3be4a2){_0x36678a['push'](_0x36678a['shift']());}}}(a59_0x3d89,0xae08d));function a59_0x3d89(){const _0x5a605e=['0.0.0','2862lrKgwE','8XFufNn','62688khuOsg','34120TmVJWC','../../package.json','280Fdiefr','696BLNczW','5719680sHwWSE','../build-info.json','606823PGncCc','utf-8','version','4113200ROurAx','includes','parse','351XHcJBu','.dev','11041118MqEwaO'];a59_0x3d89=function(){return _0x5a605e;};return a59_0x3d89();}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a59_0x3b65(_0x4b289e,_0x56b96e){_0x4b289e=_0x4b289e-0x6f;const _0x3d89ef=a59_0x3d89();let _0x3b654a=_0x3d89ef[_0x4b289e];return _0x3b654a;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x4965f8=a59_0x3b65;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4bc726=fileURLToPath(import.meta.url),_0x2fa3a0=dirname(_0x4bc726);try{const _0x14115a=join(_0x2fa3a0,_0x4965f8(0x80));cachedBuildInfo=JSON[_0x4965f8(0x73)](readFileSync(_0x14115a,_0x4965f8(0x6f)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x1bde30=a59_0x3b65;if(cachedVersion!==null)return cachedVersion;const _0x3e8af2=fileURLToPath(import.meta.url),_0x10dee8=dirname(_0x3e8af2),_0x42a3cd=getBuildInfo();if(_0x42a3cd[_0x1bde30(0x70)])return cachedVersion=_0x42a3cd[_0x1bde30(0x70)],cachedVersion;try{const _0x321a3d=join(_0x10dee8,_0x1bde30(0x7c)),_0x5f4ef8=JSON[_0x1bde30(0x73)](readFileSync(_0x321a3d,_0x1bde30(0x6f)));cachedVersion=_0x5f4ef8[_0x1bde30(0x70)];}catch{cachedVersion=_0x1bde30(0x77);}return cachedVersion;}export function isDevVersion(){const _0x1b8da4=a59_0x3b65,_0x4142df=getVersion();return _0x4142df['includes'](_0x1b8da4(0x75))||_0x4142df[_0x1b8da4(0x72)]('-');}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x5bee29,_0x4baa68){var _0x442fa2=a60_0x48a0,_0x4c071a=_0x5bee29();while(!![]){try{var _0x254601=parseInt(_0x442fa2(0xce))/0x1*(-parseInt(_0x442fa2(0xc9))/0x2)+-parseInt(_0x442fa2(0xc8))/0x3*(parseInt(_0x442fa2(0xca))/0x4)+-parseInt(_0x442fa2(0xc6))/0x5+-parseInt(_0x442fa2(0xcf))/0x6*(-parseInt(_0x442fa2(0xc5))/0x7)+parseInt(_0x442fa2(0xc7))/0x8*(-parseInt(_0x442fa2(0xcb))/0x9)+-parseInt(_0x442fa2(0xcd))/0xa+parseInt(_0x442fa2(0xcc))/0xb;if(_0x254601===_0x4baa68)break;else _0x4c071a['push'](_0x4c071a['shift']());}catch(_0x548930){_0x4c071a['push'](_0x4c071a['shift']());}}}(a60_0x4824,0xc7359));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';function a60_0x4824(){var _0x43a151=['96752QetoCb','1108290ZUHSzt','14xUhxXE','2412230vFllji','608AnbsQa','39jTwllj','32zXlYEJ','46348hKuPkY','30312EdQcbv','47379277kJVVVF','14235990btNPmI'];a60_0x4824=function(){return _0x43a151;};return a60_0x4824();}export*from'./commands/query-command.js';export*from'./commands/databases.js';function a60_0x48a0(_0x164849,_0x16dcc0){_0x164849=_0x164849-0xc5;var _0x482486=a60_0x4824();var _0x48a0f3=_0x482486[_0x164849];return _0x48a0f3;}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(_0x514442,_0x122431){var _0x11e5b6=a60_0x312e,_0x5c0478=_0x514442();while(!![]){try{var _0x1100d6=parseInt(_0x11e5b6(0xf3))/0x1*(-parseInt(_0x11e5b6(0xf7))/0x2)+-parseInt(_0x11e5b6(0xf9))/0x3*(-parseInt(_0x11e5b6(0xfc))/0x4)+parseInt(_0x11e5b6(0xf4))/0x5*(-parseInt(_0x11e5b6(0xf8))/0x6)+-parseInt(_0x11e5b6(0xfa))/0x7+-parseInt(_0x11e5b6(0xfb))/0x8*(parseInt(_0x11e5b6(0xf2))/0x9)+-parseInt(_0x11e5b6(0xfd))/0xa*(parseInt(_0x11e5b6(0xf5))/0xb)+parseInt(_0x11e5b6(0xf6))/0xc;if(_0x1100d6===_0x122431)break;else _0x5c0478['push'](_0x5c0478['shift']());}catch(_0x40a5c8){_0x5c0478['push'](_0x5c0478['shift']());}}}(a60_0x54e5,0xb74ff));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';function a60_0x312e(_0x4d1283,_0x59a0a5){_0x4d1283=_0x4d1283-0xf2;var _0x54e5a5=a60_0x54e5();var _0x312e59=_0x54e5a5[_0x4d1283];return _0x312e59;}export*from'./sdk/types/trino.js';export*from'./commands/command.js';function a60_0x54e5(){var _0x59d6a3=['7527091euRmal','33976584gUxVeR','1108014JqYBlz','48YTRLsV','93HsdyfF','3270645IarVAH','1240GZhVwe','131056MSnyzN','10JqqEkA','6147qsQXDD','2GchVrk','456765ZChNqo'];a60_0x54e5=function(){return _0x59d6a3;};return a60_0x54e5();}export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
@@ -1 +1 @@
1
- (function(_0x31f063,_0x539d3b){const _0x24b817=a61_0x2fe3,_0x3f8f6f=_0x31f063();while(!![]){try{const _0x427396=parseInt(_0x24b817(0x9c))/0x1*(parseInt(_0x24b817(0x88))/0x2)+-parseInt(_0x24b817(0x90))/0x3*(-parseInt(_0x24b817(0x96))/0x4)+-parseInt(_0x24b817(0xa4))/0x5*(-parseInt(_0x24b817(0xb0))/0x6)+-parseInt(_0x24b817(0xa5))/0x7+parseInt(_0x24b817(0x8f))/0x8*(-parseInt(_0x24b817(0xa2))/0x9)+-parseInt(_0x24b817(0x99))/0xa*(parseInt(_0x24b817(0x9e))/0xb)+-parseInt(_0x24b817(0x93))/0xc*(-parseInt(_0x24b817(0xaa))/0xd);if(_0x427396===_0x539d3b)break;else _0x3f8f6f['push'](_0x3f8f6f['shift']());}catch(_0x2113c0){_0x3f8f6f['push'](_0x3f8f6f['shift']());}}}(a61_0x4ec5,0xccbd0));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a61_0x2fe3(_0xe318ae,_0x649a76){_0xe318ae=_0xe318ae-0x86;const _0x4ec577=a61_0x4ec5();let _0x2fe388=_0x4ec577[_0xe318ae];return _0x2fe388;}import{z}from'zod';function a61_0x4ec5(){const _0x56fb38=['94950ZwDAlP','1.0.0','5SGxTjl','11364171iYyXtt','**\x20(','category','description','once','26RhwELT','map','Command\x20completed\x20successfully','output','connect','join','3892398XvnIGY','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.','success','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','registerTool','text','name','2276XSZCkM','env','enum','examples','\x0a\x0a---\x0a\x0a','Utilities','Context','600LyBFOJ','2526XERSzT','SIGTERM','CDP','14099388RgtEEw','tdx','error','1528modNOy','No\x20commands\x20found\x20matching\x20\x22','describe','80odnpzL','length','optional','1306ZyYwnk','stdin','2135639jtDUdd','close','string','array'];a61_0x4ec5=function(){return _0x56fb38;};return a61_0x4ec5();}import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x43b623={}){const _0x5ac8a5=a61_0x2fe3,_0x9f0e85=new McpServer({'name':_0x5ac8a5(0x94),'version':_0x5ac8a5(0xa3)});return _0x9f0e85[_0x5ac8a5(0xb4)]('tdx_run',{'description':_0x5ac8a5(0xb1),'inputSchema':{'args':z[_0x5ac8a5(0xa1)](z['string']())[_0x5ac8a5(0x98)]('Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])')}},async({args:_0x443274})=>{const _0xf2837e=_0x5ac8a5,_0x546b1c=await executeTdxRun({'args':_0x443274},_0x43b623[_0xf2837e(0x89)]||{});return _0x546b1c[_0xf2837e(0xb2)]?{'content':[{'type':'text','text':_0x546b1c[_0xf2837e(0xad)]||_0xf2837e(0xac)}]}:{'content':[{'type':_0xf2837e(0x86),'text':_0x546b1c[_0xf2837e(0x95)]||_0x546b1c['output']||'Command\x20failed'}],'isError':!![]};}),_0x9f0e85['registerTool']('tdx_search',{'description':'Search\x20for\x20relevant\x20tdx\x20commands\x20based\x20on\x20what\x20you\x20want\x20to\x20do.\x0a\x0aExamples:\x0a-\x20{\x22query\x22:\x20\x22how\x20to\x20run\x20SQL\x20queries\x22}\x0a-\x20{\x22query\x22:\x20\x22list\x20databases\x20and\x20tables\x22}\x0a-\x20{\x22query\x22:\x20\x22manage\x20customer\x20segments\x22,\x20\x22category\x22:\x20\x22CDP\x22}\x0a-\x20{\x22query\x22:\x20\x22workflow\x20logs\x22}\x0a\x0aCategories:\x20Data,\x20CDP,\x20AI,\x20Context,\x20Utilities\x0a\x0aReturns\x20matching\x20commands\x20with\x20descriptions\x20and\x20example\x20usage.','inputSchema':{'query':z[_0x5ac8a5(0xa0)]()[_0x5ac8a5(0x98)](_0x5ac8a5(0xb3)),'category':z[_0x5ac8a5(0x8a)](['Data',_0x5ac8a5(0x92),'AI',_0x5ac8a5(0x8e),_0x5ac8a5(0x8d)])[_0x5ac8a5(0x9b)]()['describe']('Optional\x20filter\x20by\x20category')}},async({query:_0x280745,category:_0x1c2056})=>{const _0x39a6f1=_0x5ac8a5,_0x17a6cf=searchCommands({'query':_0x280745,'category':_0x1c2056});if(_0x17a6cf[_0x39a6f1(0x9a)]===0x0)return{'content':[{'type':'text','text':_0x39a6f1(0x97)+_0x280745+'\x22'}]};const _0x121040=_0x17a6cf['map'](_0x4e9060=>{const _0x1472ab=_0x39a6f1,_0x40fd45=_0x4e9060[_0x1472ab(0x8b)][_0x1472ab(0xab)](_0x50aa56=>'\x20\x20'+_0x50aa56)[_0x1472ab(0xaf)]('\x0a');return'**'+_0x4e9060[_0x1472ab(0x87)]+_0x1472ab(0xa6)+_0x4e9060[_0x1472ab(0xa7)]+')\x0a'+_0x4e9060[_0x1472ab(0xa8)]+'\x0a\x0aExamples:\x0a'+_0x40fd45;})[_0x39a6f1(0xaf)](_0x39a6f1(0x8c));return{'content':[{'type':'text','text':_0x121040}]};}),_0x9f0e85;}export async function startMCPServer(_0x3f508f={}){const _0x3ed82f=a61_0x2fe3,_0x49e283=createMCPServer(_0x3f508f),_0x74763f=new StdioServerTransport();return await _0x49e283[_0x3ed82f(0xae)](_0x74763f),new Promise(_0x49ff04=>{const _0x21e811=_0x3ed82f;let _0x3cd549=![];const _0x4db939=async()=>{const _0x32b42c=a61_0x2fe3;if(_0x3cd549)return;_0x3cd549=!![],await _0x49e283[_0x32b42c(0x9f)](),_0x49ff04();};process[_0x21e811(0xa9)]('SIGINT',_0x4db939),process['once'](_0x21e811(0x91),_0x4db939),process[_0x21e811(0x9d)][_0x21e811(0xa9)](_0x21e811(0x9f),_0x4db939);});}
1
+ (function(_0x350878,_0x5a258d){const _0xd7ed07=a61_0x494d,_0x3e0972=_0x350878();while(!![]){try{const _0x586c7f=-parseInt(_0xd7ed07(0x14a))/0x1+parseInt(_0xd7ed07(0x16e))/0x2+-parseInt(_0xd7ed07(0x157))/0x3*(-parseInt(_0xd7ed07(0x167))/0x4)+-parseInt(_0xd7ed07(0x153))/0x5+-parseInt(_0xd7ed07(0x14c))/0x6*(parseInt(_0xd7ed07(0x164))/0x7)+parseInt(_0xd7ed07(0x14e))/0x8+-parseInt(_0xd7ed07(0x16c))/0x9;if(_0x586c7f===_0x5a258d)break;else _0x3e0972['push'](_0x3e0972['shift']());}catch(_0x5e00af){_0x3e0972['push'](_0x3e0972['shift']());}}}(a61_0x5781,0xa069c));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';function a61_0x494d(_0x65e626,_0x323b73){_0x65e626=_0x65e626-0x14a;const _0x578179=a61_0x5781();let _0x494d30=_0x578179[_0x65e626];return _0x494d30;}import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x1d60be={}){const _0x5d4eb9=a61_0x494d,_0x130076=new McpServer({'name':'tdx','version':_0x5d4eb9(0x155)});return _0x130076['registerTool'](_0x5d4eb9(0x163),{'description':_0x5d4eb9(0x16f),'inputSchema':{'args':z[_0x5d4eb9(0x151)](z['string']())[_0x5d4eb9(0x150)](_0x5d4eb9(0x154))}},async({args:_0x1559ba})=>{const _0x73b43e=_0x5d4eb9,_0x3ee33d=await executeTdxRun({'args':_0x1559ba},_0x1d60be[_0x73b43e(0x16a)]||{});return _0x3ee33d[_0x73b43e(0x169)]?{'content':[{'type':_0x73b43e(0x176),'text':_0x3ee33d[_0x73b43e(0x14d)]||_0x73b43e(0x168)}]}:{'content':[{'type':_0x73b43e(0x176),'text':_0x3ee33d[_0x73b43e(0x15a)]||_0x3ee33d[_0x73b43e(0x14d)]||'Command\x20failed'}],'isError':!![]};}),_0x130076[_0x5d4eb9(0x175)](_0x5d4eb9(0x156),{'description':_0x5d4eb9(0x162),'inputSchema':{'query':z[_0x5d4eb9(0x174)]()[_0x5d4eb9(0x150)](_0x5d4eb9(0x161)),'category':z[_0x5d4eb9(0x165)]([_0x5d4eb9(0x158),_0x5d4eb9(0x160),'AI','Context',_0x5d4eb9(0x170)])[_0x5d4eb9(0x166)]()[_0x5d4eb9(0x150)](_0x5d4eb9(0x152))}},async({query:_0x3f15ec,category:_0x51cacf})=>{const _0x49a89e=_0x5d4eb9,_0x1ebe87=searchCommands({'query':_0x3f15ec,'category':_0x51cacf});if(_0x1ebe87[_0x49a89e(0x16b)]===0x0)return{'content':[{'type':_0x49a89e(0x176),'text':_0x49a89e(0x15d)+_0x3f15ec+'\x22'}]};const _0x3404b3=_0x1ebe87['map'](_0x4cbd9d=>{const _0x319d2e=_0x49a89e,_0x2bcf97=_0x4cbd9d[_0x319d2e(0x15f)]['map'](_0x24fbb4=>'\x20\x20'+_0x24fbb4)['join']('\x0a');return'**'+_0x4cbd9d[_0x319d2e(0x15e)]+_0x319d2e(0x14b)+_0x4cbd9d['category']+')\x0a'+_0x4cbd9d[_0x319d2e(0x172)]+_0x319d2e(0x159)+_0x2bcf97;})[_0x49a89e(0x171)](_0x49a89e(0x15b));return{'content':[{'type':_0x49a89e(0x176),'text':_0x3404b3}]};}),_0x130076;}function a61_0x5781(){const _0x1aa259=['env','length','8639829egXAjG','SIGINT','717602reVSXx','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.','Utilities','join','description','SIGTERM','string','registerTool','text','373031kpiLYu','**\x20(','1067526CoHlCw','output','8625232earfrz','once','describe','array','Optional\x20filter\x20by\x20category','861210cxaKTC','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','1.0.0','tdx_search','426PkVrYr','Data','\x0a\x0aExamples:\x0a','error','\x0a\x0a---\x0a\x0a','close','No\x20commands\x20found\x20matching\x20\x22','name','examples','CDP','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','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.','tdx_run','21ZFsPFi','enum','optional','35468ARmYmL','Command\x20completed\x20successfully','success'];a61_0x5781=function(){return _0x1aa259;};return a61_0x5781();}export async function startMCPServer(_0x2fffe1={}){const _0x14fda0=createMCPServer(_0x2fffe1),_0x598cbf=new StdioServerTransport();return await _0x14fda0['connect'](_0x598cbf),new Promise(_0x4f98f2=>{const _0x586681=a61_0x494d;let _0x9c4e1e=![];const _0x2b6147=async()=>{const _0x281dea=a61_0x494d;if(_0x9c4e1e)return;_0x9c4e1e=!![],await _0x14fda0[_0x281dea(0x15c)](),_0x4f98f2();};process[_0x586681(0x14f)](_0x586681(0x16d),_0x2b6147),process[_0x586681(0x14f)](_0x586681(0x173),_0x2b6147),process['stdin'][_0x586681(0x14f)](_0x586681(0x15c),_0x2b6147);});}
@@ -1 +1 @@
1
- function a62_0x29e3(_0x118ff8,_0x458a66){_0x118ff8=_0x118ff8-0x1e3;var _0x3b7d1a=a62_0x3b7d();var _0x29e347=_0x3b7d1a[_0x118ff8];return _0x29e347;}function a62_0x3b7d(){var _0x12cedb=['4zwqDyL','385EvSALv','331370lIihat','8VfEQOc','11932857ZDzvoW','797271PtRZjq','8776626XpAHPK','3703784pXTEgE','627512JKKwjL','5YpFFjO','1661352nsrBHI','20teUcwn'];a62_0x3b7d=function(){return _0x12cedb;};return a62_0x3b7d();}(function(_0x2d5cda,_0x36e8e5){var _0x145f53=a62_0x29e3,_0x13a586=_0x2d5cda();while(!![]){try{var _0x43883b=-parseInt(_0x145f53(0x1ea))/0x1*(-parseInt(_0x145f53(0x1ee))/0x2)+-parseInt(_0x145f53(0x1e7))/0x3*(parseInt(_0x145f53(0x1ed))/0x4)+parseInt(_0x145f53(0x1eb))/0x5*(parseInt(_0x145f53(0x1e8))/0x6)+parseInt(_0x145f53(0x1e9))/0x7*(-parseInt(_0x145f53(0x1e5))/0x8)+parseInt(_0x145f53(0x1e6))/0x9+parseInt(_0x145f53(0x1e4))/0xa*(-parseInt(_0x145f53(0x1e3))/0xb)+-parseInt(_0x145f53(0x1ec))/0xc;if(_0x43883b===_0x36e8e5)break;else _0x13a586['push'](_0x13a586['shift']());}catch(_0x2dbb38){_0x13a586['push'](_0x13a586['shift']());}}}(a62_0x3b7d,0xd8aea));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
1
+ function a62_0x1caf(_0x1034fd,_0x1368f3){_0x1034fd=_0x1034fd-0xfb;var _0x1c3a02=a62_0x1c3a();var _0x1cafe0=_0x1c3a02[_0x1034fd];return _0x1cafe0;}(function(_0x29f512,_0x5aba8a){var _0x59291b=a62_0x1caf,_0x6f7030=_0x29f512();while(!![]){try{var _0x532caf=parseInt(_0x59291b(0xff))/0x1*(-parseInt(_0x59291b(0x100))/0x2)+-parseInt(_0x59291b(0xfd))/0x3+parseInt(_0x59291b(0x104))/0x4*(parseInt(_0x59291b(0xfc))/0x5)+parseInt(_0x59291b(0x103))/0x6+-parseInt(_0x59291b(0xfe))/0x7+-parseInt(_0x59291b(0xfb))/0x8*(parseInt(_0x59291b(0x101))/0x9)+parseInt(_0x59291b(0x102))/0xa;if(_0x532caf===_0x5aba8a)break;else _0x6f7030['push'](_0x6f7030['shift']());}catch(_0x2af8b3){_0x6f7030['push'](_0x6f7030['shift']());}}}(a62_0x1c3a,0xef0ac));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';function a62_0x1c3a(){var _0x5b4b43=['15zdlXiT','2316819AKkAju','3796212sagwUM','745wfiVya','2516WVcVky','18NnkIrN','2295930cgAizO','10309524lHskXQ','2087704SMbzpj','1130840BjqOTA'];a62_0x1c3a=function(){return _0x5b4b43;};return a62_0x1c3a();}export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';
@@ -1 +1 @@
1
- const a63_0x5f2735=a63_0x18ea;(function(_0x93dbcc,_0xa961a1){const _0x35d015=a63_0x18ea,_0x229150=_0x93dbcc();while(!![]){try{const _0x2ea035=-parseInt(_0x35d015(0x8b))/0x1*(parseInt(_0x35d015(0x7f))/0x2)+parseInt(_0x35d015(0x84))/0x3+parseInt(_0x35d015(0x78))/0x4+parseInt(_0x35d015(0x80))/0x5+-parseInt(_0x35d015(0x75))/0x6+parseInt(_0x35d015(0x73))/0x7*(parseInt(_0x35d015(0x82))/0x8)+-parseInt(_0x35d015(0x7b))/0x9;if(_0x2ea035===_0xa961a1)break;else _0x229150['push'](_0x229150['shift']());}catch(_0x267f2){_0x229150['push'](_0x229150['shift']());}}}(a63_0x5c2d,0x69604));import{spawn}from'child_process';function a63_0x18ea(_0x2b841c,_0x24d3c1){_0x2b841c=_0x2b841c-0x70;const _0x5c2d76=a63_0x5c2d();let _0x18eabb=_0x5c2d76[_0x2b841c];return _0x18eabb;}import{dirname,join}from'path';function a63_0x5c2d(){const _0xe8eb30=['ignore','true','68677VmnALv','toString','2455776BEhZJi','pipe','resourcesPath','2912268KDzbOH','SIGTERM','platform','6312537pBbZYX','win32','object','string','565902QbGPiL','3313335ZvGMyt','array','208qOtWCG','--json','538320USrmuW','kill','execPath','node.exe','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','stderr','PATH','1DlMrNp','--no-color','node','tdx','Failed\x20to\x20spawn\x20tdx:\x20'];a63_0x5c2d=function(){return _0xe8eb30;};return a63_0x5c2d();}import{existsSync}from'fs';import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a63_0x5f2735(0x7d)]({'args':z[a63_0x5f2735(0x81)](z[a63_0x5f2735(0x7e)]())['describe'](a63_0x5f2735(0x88))});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function getNodeBinDir(){const _0x573821=a63_0x5f2735,_0x1dee07=process[_0x573821(0x77)];if(_0x1dee07){const _0x471a25=join(_0x1dee07,_0x573821(0x8d)),_0x23130f=process[_0x573821(0x7a)]===_0x573821(0x7c)?_0x573821(0x87):_0x573821(0x8d);if(existsSync(join(_0x471a25,_0x23130f)))return _0x471a25;}return dirname(process[_0x573821(0x86)]);}export async function executeTdxRun(_0x4212cf,_0x3b428a){const _0x14bfd2=a63_0x5f2735,{args:_0x162558}=_0x4212cf;if(isBlockedCommand(_0x162558)){const _0x10d693=getBlockedReason(_0x162558);return{'success':![],'output':'','error':_0x10d693||'This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','exitCode':0x1};}const _0x2f6682=[_0x14bfd2(0x83),_0x14bfd2(0x8c),..._0x162558],_0x30c0e9=getNodeBinDir(),_0x1b271b=process[_0x14bfd2(0x7a)]===_0x14bfd2(0x7c)?';':':',_0x226192=_0x3b428a[_0x14bfd2(0x8a)]??process.env.PATH??'',_0x368216=''+_0x30c0e9+_0x1b271b+_0x226192;return new Promise(_0x37f7d4=>{const _0x382ac5=_0x14bfd2,_0x3a548e=spawn(_0x382ac5(0x8e),_0x2f6682,{'env':{...process.env,..._0x3b428a,'PATH':_0x368216,'CI':_0x382ac5(0x72)},'stdio':[_0x382ac5(0x71),_0x382ac5(0x76),_0x382ac5(0x76)]});let _0x2cc46f='',_0x405ec5='',_0xc476b6=![];const _0x11d596=setTimeout(()=>{const _0x306133=_0x382ac5;_0xc476b6=!![],_0x3a548e[_0x306133(0x85)](_0x306133(0x79));},DEFAULT_TIMEOUT_MS);_0x3a548e['stdout']['on']('data',_0x55ae87=>{_0x2cc46f+=_0x55ae87['toString']();}),_0x3a548e[_0x382ac5(0x89)]['on']('data',_0x3fd4b8=>{const _0x4f88d5=_0x382ac5;_0x405ec5+=_0x3fd4b8[_0x4f88d5(0x74)]();}),_0x3a548e['on']('error',_0x126a58=>{const _0x10bd7d=_0x382ac5;clearTimeout(_0x11d596),_0x37f7d4({'success':![],'output':'','error':_0x10bd7d(0x70)+_0x126a58['message'],'exitCode':0x1});}),_0x3a548e['on']('close',_0x32753b=>{clearTimeout(_0x11d596);if(_0xc476b6){_0x37f7d4({'success':![],'output':formatOutput(_0x2cc46f),'error':'Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','exitCode':0x7c});return;}const _0x2f3a55=_0x32753b??0x1,_0x18a430=_0x2f3a55===0x0,_0x1081c4=formatOutput(_0x2cc46f||_0x405ec5),_0x3bf7b9=!_0x18a430&&_0x405ec5?formatOutput(_0x405ec5):undefined;_0x37f7d4({'success':_0x18a430,'output':_0x1081c4,'error':_0x3bf7b9,'exitCode':_0x2f3a55});});});}
1
+ const a63_0x2c370a=a63_0x10f4;(function(_0x4c21f8,_0x424a50){const _0x1a5364=a63_0x10f4,_0x44c9cf=_0x4c21f8();while(!![]){try{const _0x2c1448=-parseInt(_0x1a5364(0xac))/0x1+parseInt(_0x1a5364(0xaf))/0x2*(-parseInt(_0x1a5364(0xa3))/0x3)+parseInt(_0x1a5364(0xa7))/0x4*(-parseInt(_0x1a5364(0x94))/0x5)+-parseInt(_0x1a5364(0x96))/0x6*(parseInt(_0x1a5364(0x9a))/0x7)+-parseInt(_0x1a5364(0xb0))/0x8+-parseInt(_0x1a5364(0xa6))/0x9*(-parseInt(_0x1a5364(0xa4))/0xa)+parseInt(_0x1a5364(0x95))/0xb;if(_0x2c1448===_0x424a50)break;else _0x44c9cf['push'](_0x44c9cf['shift']());}catch(_0x322a04){_0x44c9cf['push'](_0x44c9cf['shift']());}}}(a63_0xe99e,0x19812));import{spawn}from'child_process';import{dirname,join}from'path';import{existsSync}from'fs';function a63_0xe99e(){const _0x210a0f=['error','close','platform','92944LMKTbG','This\x20command\x20is\x20not\x20allowed\x20via\x20MCP','data','10cHwcIO','1432984CNnEkI','tdx','ignore','describe','node','string','244685cbwogW','7020079nsvaeU','12vlUVvM','SIGTERM','PATH','--json','481551tSOVoN','object','array','toString','pipe','stderr','kill','win32','--no-color','100431pXRRsh','461260MwgyFX','stdout','18PwyHvG','4mnKRDs','message'];a63_0xe99e=function(){return _0x210a0f;};return a63_0xe99e();}import{z}from'zod';import{isBlockedCommand,getBlockedReason,formatOutput}from'../utils.js';export const TdxRunInputSchema=z[a63_0x2c370a(0x9b)]({'args':z[a63_0x2c370a(0x9c)](z[a63_0x2c370a(0x93)]())[a63_0x2c370a(0x91)]('Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])')});const DEFAULT_TIMEOUT_MS=0xf*0x3c*0x3e8;function getNodeBinDir(){const _0xc71b0a=a63_0x2c370a,_0x2b3c4e=process['resourcesPath'];if(_0x2b3c4e){const _0xdc219b=join(_0x2b3c4e,_0xc71b0a(0x92)),_0x46e1bd=process[_0xc71b0a(0xab)]===_0xc71b0a(0xa1)?'node.exe':'node';if(existsSync(join(_0xdc219b,_0x46e1bd)))return _0xdc219b;}return dirname(process['execPath']);}function a63_0x10f4(_0x2e2954,_0x5e0c86){_0x2e2954=_0x2e2954-0x8f;const _0xe99e6e=a63_0xe99e();let _0x10f40e=_0xe99e6e[_0x2e2954];return _0x10f40e;}export async function executeTdxRun(_0x5406c1,_0x278f67){const _0xa3a3c4=a63_0x2c370a,{args:_0x403f91}=_0x5406c1;if(isBlockedCommand(_0x403f91)){const _0x19cc61=getBlockedReason(_0x403f91);return{'success':![],'output':'','error':_0x19cc61||_0xa3a3c4(0xad),'exitCode':0x1};}const _0x823dc8=[_0xa3a3c4(0x99),_0xa3a3c4(0xa2),..._0x403f91],_0x1e2d45=getNodeBinDir(),_0x3b7bfb=process[_0xa3a3c4(0xab)]===_0xa3a3c4(0xa1)?';':':',_0x394997=_0x278f67[_0xa3a3c4(0x98)]??process.env.PATH??'',_0x5bf1c8=''+_0x1e2d45+_0x3b7bfb+_0x394997;return new Promise(_0x3a4e37=>{const _0x5e07e2=_0xa3a3c4,_0x1a0ed7=spawn(_0x5e07e2(0x8f),_0x823dc8,{'env':{...process.env,..._0x278f67,'PATH':_0x5bf1c8,'CI':'true'},'stdio':[_0x5e07e2(0x90),'pipe',_0x5e07e2(0x9e)]});let _0x4a019d='',_0x23c2af='',_0x21db47=![];const _0x26b74a=setTimeout(()=>{const _0x4fd3b8=_0x5e07e2;_0x21db47=!![],_0x1a0ed7[_0x4fd3b8(0xa0)](_0x4fd3b8(0x97));},DEFAULT_TIMEOUT_MS);_0x1a0ed7[_0x5e07e2(0xa5)]['on'](_0x5e07e2(0xae),_0xbb1264=>{const _0x5d5c2d=_0x5e07e2;_0x4a019d+=_0xbb1264[_0x5d5c2d(0x9d)]();}),_0x1a0ed7[_0x5e07e2(0x9f)]['on'](_0x5e07e2(0xae),_0x555fbd=>{_0x23c2af+=_0x555fbd['toString']();}),_0x1a0ed7['on'](_0x5e07e2(0xa9),_0x237628=>{const _0x2518ba=_0x5e07e2;clearTimeout(_0x26b74a),_0x3a4e37({'success':![],'output':'','error':'Failed\x20to\x20spawn\x20tdx:\x20'+_0x237628[_0x2518ba(0xa8)],'exitCode':0x1});}),_0x1a0ed7['on'](_0x5e07e2(0xaa),_0x282b4d=>{clearTimeout(_0x26b74a);if(_0x21db47){_0x3a4e37({'success':![],'output':formatOutput(_0x4a019d),'error':'Command\x20timed\x20out\x20after\x2015\x20minutes.\x20For\x20long-running\x20queries,\x20use\x20job\x20submit\x20instead.','exitCode':0x7c});return;}const _0x12cbe5=_0x282b4d??0x1,_0x3f59c2=_0x12cbe5===0x0,_0x6587e3=formatOutput(_0x4a019d||_0x23c2af),_0x4ad11f=!_0x3f59c2&&_0x23c2af?formatOutput(_0x23c2af):undefined;_0x3a4e37({'success':_0x3f59c2,'output':_0x6587e3,'error':_0x4ad11f,'exitCode':_0x12cbe5});});});}