@treasuredata/tdx 2026.4.7 → 2026.4.8

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 (220) 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/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/access-tracker.js +1 -1
  182. package/dist/sdk/workspace/frontmatter.js +1 -1
  183. package/dist/sdk/workspace/git.js +1 -1
  184. package/dist/sdk/workspace/index.js +1 -1
  185. package/dist/sdk/workspace/templates.js +1 -1
  186. package/dist/sdk/workspace/weekly.js +1 -1
  187. package/dist/sdk/workspace/wikilinks.js +1 -1
  188. package/dist/test-utils/command-runner.js +1 -1
  189. package/dist/test-utils/factories.js +1 -1
  190. package/dist/test-utils/fixtures.js +1 -1
  191. package/dist/test-utils/http-mock.js +1 -1
  192. package/dist/test-utils/index.js +1 -1
  193. package/dist/utils/async.js +1 -1
  194. package/dist/utils/colors.js +1 -1
  195. package/dist/utils/diff.js +1 -1
  196. package/dist/utils/file-permissions.js +1 -1
  197. package/dist/utils/file-reader.js +1 -1
  198. package/dist/utils/github-releases.js +1 -1
  199. package/dist/utils/global-cache.js +1 -1
  200. package/dist/utils/json-loader.js +1 -1
  201. package/dist/utils/local-cache.js +1 -1
  202. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  203. package/dist/utils/logger/formatters/index.js +1 -1
  204. package/dist/utils/logger/handlers/console-handler.js +1 -1
  205. package/dist/utils/logger/handlers/file-handler.js +1 -1
  206. package/dist/utils/logger/handlers/index.js +1 -1
  207. package/dist/utils/logger/handlers/null-handler.js +1 -1
  208. package/dist/utils/logger/index.js +1 -1
  209. package/dist/utils/logger/logger.js +1 -1
  210. package/dist/utils/logger/types.js +1 -1
  211. package/dist/utils/option-validation.js +1 -1
  212. package/dist/utils/process.js +1 -1
  213. package/dist/utils/prompt.js +1 -1
  214. package/dist/utils/spinner.js +1 -1
  215. package/dist/utils/sse-parser.js +1 -1
  216. package/dist/utils/string-utils.js +1 -1
  217. package/dist/utils/table-ref-parser.js +1 -1
  218. package/dist/utils/tdx-logger.js +1 -1
  219. package/dist/utils/version-check.js +1 -1
  220. package/package.json +1 -1
@@ -1 +1 @@
1
- const a57_0x3a7d7b=a57_0x5be0;(function(_0x30a123,_0x4ef62f){const _0xd3036d=a57_0x5be0,_0x1b0fb7=_0x30a123();while(!![]){try{const _0x33b205=parseInt(_0xd3036d(0xcf))/0x1+parseInt(_0xd3036d(0xf9))/0x2+-parseInt(_0xd3036d(0xd3))/0x3+-parseInt(_0xd3036d(0xc4))/0x4*(-parseInt(_0xd3036d(0xb0))/0x5)+-parseInt(_0xd3036d(0xf4))/0x6*(parseInt(_0xd3036d(0xbb))/0x7)+-parseInt(_0xd3036d(0xde))/0x8+-parseInt(_0xd3036d(0xbd))/0x9*(parseInt(_0xd3036d(0xc9))/0xa);if(_0x33b205===_0x4ef62f)break;else _0x1b0fb7['push'](_0x1b0fb7['shift']());}catch(_0x1b8f5c){_0x1b0fb7['push'](_0x1b0fb7['shift']());}}}(a57_0x33e8,0x2203c));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x3140aa from'node:fs';function a57_0x33e8(){const _0x5b5e8c=['⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','stg-us01','split','TD_API_KEY','existsSync','stable','accessToken','.env','stg-ap01','path','toISOString','apiKey','keychain\x20(profile:\x20','slice','map','\x20env\x20var','name','ap01','TD_API_KEY_','269226hFKVXZ','trim','profile','join','ap02','389296xdIwmO','dev-eu01','account_info','utf-8','keychain','toUpperCase','write','10620XSqrFF','string','number','llm_default_agent','yellow','replace','TDX_ACCESS_TOKEN\x20env\x20var','config/llm-agent','parse','entries','stringify','14xzlPZK','tdx.json','11556PNUEXY','release_channel','TDX_ACCESS_TOKEN_FILE','tdx','clear','match','Warning:\x20Unknown\x20site\x20\x27','100RrXOMt','llm_default_project','source','site','config/llm-project','220XHTfUo','us01','startsWith','next','readFileSync','warn','213197qwMnXh','eu01','dev-us01','.env.','591072EowiYF','\x27,\x20defaulting\x20to\x20us01','config/account-info','.json','stg-ap03','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','proxy','read','Warning:\x20Failed\x20to\x20read\x20','apiKeys','TDX_API_KEY_','52856IeyGoc','endsWith','TDX_API_KEY\x20env\x20var'];a57_0x33e8=function(){return _0x5b5e8c;};return a57_0x33e8();}import*as a57_0x51c057 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 a57_0x31a9bb from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x3f5aee=a57_0x5be0;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x3f5aee(0xc0));}export function getConfigFile(){const _0x58bc26=a57_0x5be0;return join(getConfigDir(),_0x58bc26(0xe8));}export function getConfigFilePath(_0x2e0a5a){const _0x1ec6ba=a57_0x5be0,_0x21e2d0=getConfigDir();return _0x2e0a5a?a57_0x51c057[_0x1ec6ba(0xf7)](_0x21e2d0,_0x1ec6ba(0xd2)+_0x2e0a5a):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x3a7d7b(0xc5),a57_0x3a7d7b(0xc8));export function getLLMProjectCacheFile(_0x5cc024){return llmProjectCache['path'](_0x5cc024);}export function readCachedLLMProject(_0x244627){const _0x48c619=a57_0x3a7d7b,_0x4ab919=llmProjectCache['read'](_0x244627);if(_0x4ab919&&typeof _0x4ab919['id']===_0x48c619(0xb1)&&typeof _0x4ab919[_0x48c619(0xf1)]===_0x48c619(0xb1))return _0x4ab919;return null;}export function writeCachedLLMProject(_0xbe3d31,_0x117bde,_0x5d215b){const _0x104adf=a57_0x3a7d7b;try{llmProjectCache[_0x104adf(0xaf)]({'name':_0xbe3d31,'id':_0x117bde},_0x5d215b);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x3a7d7b(0xb3),a57_0x3a7d7b(0xb7));export function getLLMAgentCacheFile(_0x4b5e3e){const _0x338fed=a57_0x3a7d7b;return llmAgentCache[_0x338fed(0xea)](_0x4b5e3e);}export function readCachedLLMAgent(_0xf4d1cc){const _0x183c0a=a57_0x3a7d7b,_0x4874fc=llmAgentCache['read'](_0xf4d1cc);if(_0x4874fc&&typeof _0x4874fc['id']==='string'&&typeof _0x4874fc[_0x183c0a(0xf1)]==='string'&&typeof _0x4874fc['projectId']===_0x183c0a(0xb1))return _0x4874fc;return null;}export function writeCachedLLMAgent(_0x16684c,_0x106337,_0x52299c,_0x303645){const _0x2a61d0=a57_0x3a7d7b;try{llmAgentCache[_0x2a61d0(0xaf)]({'name':_0x16684c,'id':_0x106337,'projectId':_0x52299c},_0x303645);}catch{}}export function clearCachedLLMAgent(_0x20786c){const _0x3e32ca=a57_0x3a7d7b;try{llmAgentCache[_0x3e32ca(0xc1)](_0x20786c);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x3a7d7b(0xfb),a57_0x3a7d7b(0xd5),{'suffix':a57_0x3a7d7b(0xd6)});export function getAccountInfoCacheFile(_0x486998){const _0x38370f=a57_0x3a7d7b;return accountInfoCache[_0x38370f(0xea)](_0x486998);}export function readCachedAccountInfo(_0x7b1305){const _0x59c75a=a57_0x3a7d7b,_0x2b0608=accountInfoCache[_0x59c75a(0xda)](_0x7b1305);if(_0x2b0608&&typeof _0x2b0608[_0x59c75a(0xc7)]===_0x59c75a(0xb1)&&typeof _0x2b0608['accountId']===_0x59c75a(0xb2))return _0x2b0608;return null;}export function writeCachedAccountInfo(_0x25a230,_0x147d53,_0xe2e085){const _0x3294ad=a57_0x3a7d7b;try{accountInfoCache[_0x3294ad(0xaf)]({'site':_0x25a230,'accountId':_0x147d53,'cachedAt':new Date()[_0x3294ad(0xeb)]()},_0xe2e085);}catch{}}export function parseEnvFile(_0x15c01b){const _0x39a1cc=a57_0x3a7d7b,_0x535da6={};for(const _0x46f5e3 of _0x15c01b[_0x39a1cc(0xe3)]('\x0a')){const _0x22103a=_0x46f5e3[_0x39a1cc(0xf5)]();if(!_0x22103a||_0x22103a['startsWith']('#'))continue;const _0x1074cc=_0x22103a[_0x39a1cc(0xc2)](/^([^=]+)=(.*)$/);if(_0x1074cc){const _0x76e7cc=_0x1074cc[0x1][_0x39a1cc(0xf5)]();let _0x490539=_0x1074cc[0x2]['trim']();(_0x490539[_0x39a1cc(0xcb)]('\x22')&&_0x490539['endsWith']('\x22')||_0x490539[_0x39a1cc(0xcb)]('\x27')&&_0x490539[_0x39a1cc(0xdf)]('\x27'))&&(_0x490539=_0x490539[_0x39a1cc(0xee)](0x1,-0x1)),_0x535da6[_0x76e7cc]=_0x490539;}}return _0x535da6;}export function readUserConfig(){const _0xf650d9=a57_0x3a7d7b,_0x36c68b=getConfigFile();if(!existsSync(_0x36c68b))return{};try{const _0x33fed1=readFileSync(_0x36c68b,'utf-8');return parseEnvFile(_0x33fed1);}catch(_0xeb4d7a){return console[_0xf650d9(0xce)](_0xf650d9(0xd8)+_0x36c68b+':',_0xeb4d7a),{};}}export function resolveSite(_0x2fa638){const _0x8084e6=a57_0x3a7d7b,_0x484511=[_0x8084e6(0xca),_0x8084e6(0xf2),_0x8084e6(0xd0),_0x8084e6(0xf8),'ap03',_0x8084e6(0xd1),_0x8084e6(0xfa),_0x8084e6(0xe2),_0x8084e6(0xe9),_0x8084e6(0xd7)];if(_0x484511['includes'](_0x2fa638))return _0x2fa638;if(_0x2fa638 in SITE_ALIASES)return SITE_ALIASES[_0x2fa638];return console[_0x8084e6(0xce)](_0x8084e6(0xc3)+_0x2fa638+_0x8084e6(0xd4)),_0x8084e6(0xca);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x4a3a06){const _0x1ea59b=a57_0x3a7d7b,_0x5e792c=_0x4a3a06||getActiveProfileName()||undefined;if(_0x5e792c){const _0x3ba206='TDX_ACCESS_TOKEN_'+normalizeProfileForEnvVar(_0x5e792c);if(process.env[_0x3ba206])return{'accessToken':process.env[_0x3ba206],'source':_0x3ba206+_0x1ea59b(0xf0)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x1ea59b(0xb6)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x243ca6=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x243ca6)return{'accessToken':_0x243ca6,'source':_0x1ea59b(0xbf)};}return null;}function readAccessTokenFile(_0x526e91){const _0x565d71=a57_0x3a7d7b;try{const _0x56b71e=readFileSync(_0x526e91,'utf-8')[_0x565d71(0xf5)]();return _0x56b71e||null;}catch{return null;}}export function getAccessToken(_0x2eedad){return resolveAccessToken(_0x2eedad)?.['accessToken'];}export function getAPIKey(_0x57332e){const _0x1e5644=a57_0x3a7d7b,_0x5b2b13=_0x57332e||getActiveProfileName();if(_0x5b2b13){const _0x138306=_0x1e5644(0xdd)+normalizeProfileForEnvVar(_0x5b2b13);if(process.env[_0x138306])return process.env[_0x138306];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x125cac){const _0x273593=a57_0x3a7d7b;return _0x125cac[_0x273593(0xae)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x196b6f,_0x3dcbaa){const _0x2d913d=a57_0x3a7d7b,_0x542f74=resolveAccessToken(_0x3dcbaa);if(_0x542f74)return{'apiKey':_0x542f74[_0x2d913d(0xe7)],'source':_0x542f74[_0x2d913d(0xc6)],'isDeprecated':![]};const _0x45cca5=_0x3dcbaa||getActiveProfileName()||undefined;if(_0x45cca5){const _0x4a17f9=_0x2d913d(0xdd)+normalizeProfileForEnvVar(_0x45cca5);if(process.env[_0x4a17f9])return{'apiKey':process.env[_0x4a17f9],'source':_0x4a17f9+'\x20env\x20var','isDeprecated':![]};const _0x7cdefe=getCachedCredential(_0x196b6f,_0x45cca5);if(_0x7cdefe)return{'apiKey':_0x7cdefe,'source':_0x2d913d(0xed)+_0x45cca5+')','isDeprecated':![]};const _0x3c9e26=await getKeychainAPIKey(_0x45cca5);if(_0x3c9e26)return setCachedCredential(_0x3c9e26,_0x196b6f,_0x45cca5),{'apiKey':_0x3c9e26,'source':_0x2d913d(0xed)+_0x45cca5+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x2d913d(0xe0),'isDeprecated':![]};if(!_0x45cca5){const _0x412ee0=getCachedCredential(_0x196b6f,undefined);if(_0x412ee0)return{'apiKey':_0x412ee0,'source':_0x2d913d(0xad),'isDeprecated':![]};const _0x15413f=await getKeychainAPIKey(undefined);if(_0x15413f)return setCachedCredential(_0x15413f,_0x196b6f,undefined),{'apiKey':_0x15413f,'source':_0x2d913d(0xad),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x3064c7,_0x46b5f7){const _0x19bb13=a57_0x3a7d7b,_0x36ffa6=await resolveAPIKeyAsync(_0x3064c7,_0x46b5f7);return _0x36ffa6?.[_0x19bb13(0xec)];}function cleanupLegacyEnvFile(_0x55d30a){const _0x3c6e2e=a57_0x3a7d7b;if(!existsSync(_0x55d30a))return![];try{const _0x2af8ff=readFileSync(_0x55d30a,'utf-8'),_0x2be82c=_0x2af8ff[_0x3c6e2e(0xe3)]('\x0a'),_0x404651=_0x2be82c['filter'](_0x14f887=>{const _0x6583c7=_0x3c6e2e,_0x300acb=_0x14f887['trim']();if(!_0x300acb||_0x300acb[_0x6583c7(0xcb)]('#'))return!![];const [_0x3bd829]=_0x300acb['split']('=');return!_0x3bd829[_0x6583c7(0xcb)](_0x6583c7(0xe4));}),_0x3dac0d=_0x404651['some'](_0x4bb183=>{const _0xea1e72=_0x3c6e2e,_0x355a8b=_0x4bb183[_0xea1e72(0xf5)]();return _0x355a8b&&!_0x355a8b[_0xea1e72(0xcb)]('#');});if(!_0x3dac0d)return unlinkSync(_0x55d30a),!![];return writeFileSync(_0x55d30a,_0x404651[_0x3c6e2e(0xf7)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x217a5c=a57_0x3a7d7b;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1ecfcc=a57_0x51c057['join'](getConfigDir(),'tdx.json');if(!a57_0x3140aa[_0x217a5c(0xe5)](_0x1ecfcc))return null;try{const _0x32466c=a57_0x3140aa[_0x217a5c(0xcd)](_0x1ecfcc,_0x217a5c(0xfc)),_0x42dfff=JSON[_0x217a5c(0xb8)](_0x32466c);return _0x42dfff[_0x217a5c(0xf6)]||null;}catch{return null;}}export function saveAPIKey(_0x53c8de,_0x56b598,_0x29dc9a){const _0x5b47bd=a57_0x3a7d7b,_0x47ad4a=getConfigDir(),_0x42fece=getConfigFilePath(_0x29dc9a);!existsSync(_0x47ad4a)&&mkdirSync(_0x47ad4a,{'recursive':!![],'mode':0x1c0});let _0x5d566f={};if(existsSync(_0x42fece))try{const _0x1d34de=readFileSync(_0x42fece,_0x5b47bd(0xfc));_0x5d566f=parseEnvFile(_0x1d34de);}catch(_0x4d1ab2){console['warn'](_0x5b47bd(0xdb)+_0x42fece+':',_0x4d1ab2);}const _0x12c689=_0x53c8de[_0x5b47bd(0xae)]()[_0x5b47bd(0xb5)](/-/g,'_');_0x5d566f[_0x5b47bd(0xf3)+_0x12c689]=_0x56b598;const _0x545c2f=Object[_0x5b47bd(0xb9)](_0x5d566f)[_0x5b47bd(0xef)](([_0x179dc9,_0x50e748])=>_0x179dc9+'='+_0x50e748);writeFileSync(_0x42fece,_0x545c2f[_0x5b47bd(0xf7)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x23bb4a,_0x5eaab0,_0x115593){const _0x1041d6=a57_0x3a7d7b;await saveKeychainAPIKey(_0x23bb4a,_0x115593),setCachedCredential(_0x23bb4a,_0x5eaab0,_0x115593);const _0x2eab1f=getConfigFilePath(_0x115593);cleanupLegacyEnvFile(_0x2eab1f)&&console[_0x1041d6(0xce)](a57_0x31a9bb[_0x1041d6(0xb4)](_0x1041d6(0xe1)));}export function loadConfig(){const _0x233567=a57_0x3a7d7b,_0x178718={'apiKeys':{},'defaultSite':_0x233567(0xca)},_0x21960b=['us01',_0x233567(0xf2),'eu01',_0x233567(0xf8),'ap03',_0x233567(0xd1),_0x233567(0xfa),'stg-us01',_0x233567(0xe9),_0x233567(0xd7)],_0x41596b=getAPIKey();if(_0x41596b)for(const _0x2a0347 of _0x21960b){_0x178718[_0x233567(0xdc)][_0x2a0347]=_0x41596b;}return _0x178718;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}function a57_0x5be0(_0x11bc4f,_0x6a46df){_0x11bc4f=_0x11bc4f-0xad;const _0x33e819=a57_0x33e8();let _0x5be0e7=_0x33e819[_0x11bc4f];return _0x5be0e7;}export function loadGlobalProxy(){const _0x24a180=a57_0x3a7d7b,_0x7a509c=a57_0x51c057['join'](getConfigDir(),_0x24a180(0xbc));if(!a57_0x3140aa['existsSync'](_0x7a509c))return undefined;try{const _0xbcbd02=a57_0x3140aa[_0x24a180(0xcd)](_0x7a509c,'utf-8'),_0x41877b=JSON['parse'](_0xbcbd02);return typeof _0x41877b[_0x24a180(0xd9)]===_0x24a180(0xb1)?_0x41877b[_0x24a180(0xd9)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x277b2e=a57_0x3a7d7b,_0x1a1989=process.env.TDX_RELEASE_CHANNEL;if(_0x1a1989===_0x277b2e(0xcc)||_0x1a1989===_0x277b2e(0xe6))return _0x1a1989;const _0x54032b=a57_0x51c057[_0x277b2e(0xf7)](getConfigDir(),'tdx.json');if(!a57_0x3140aa[_0x277b2e(0xe5)](_0x54032b))return _0x277b2e(0xe6);try{const _0x298e5a=a57_0x3140aa[_0x277b2e(0xcd)](_0x54032b,_0x277b2e(0xfc)),_0x474cf6=JSON[_0x277b2e(0xb8)](_0x298e5a);if(_0x474cf6[_0x277b2e(0xbe)]===_0x277b2e(0xcc))return'next';}catch{}return _0x277b2e(0xe6);}export function saveReleaseChannel(_0x3008bf){const _0x58c9cd=a57_0x3a7d7b,_0x1368c8=getConfigDir(),_0xd091e3=a57_0x51c057[_0x58c9cd(0xf7)](_0x1368c8,'tdx.json');!existsSync(_0x1368c8)&&mkdirSync(_0x1368c8,{'recursive':!![],'mode':0x1c0});let _0x1437d8={};if(existsSync(_0xd091e3))try{const _0x112e6f=readFileSync(_0xd091e3,_0x58c9cd(0xfc));_0x1437d8=JSON[_0x58c9cd(0xb8)](_0x112e6f);}catch{}_0x1437d8['release_channel']=_0x3008bf,writeFileSync(_0xd091e3,JSON[_0x58c9cd(0xba)](_0x1437d8,null,0x2),{'mode':0x180});}
1
+ const a57_0x36162f=a57_0x5b0d;(function(_0x3f0f47,_0x4aae19){const _0x2fa672=a57_0x5b0d,_0x1b6318=_0x3f0f47();while(!![]){try{const _0xde9ded=parseInt(_0x2fa672(0xc0))/0x1+-parseInt(_0x2fa672(0xdb))/0x2*(parseInt(_0x2fa672(0xa4))/0x3)+-parseInt(_0x2fa672(0xc9))/0x4+-parseInt(_0x2fa672(0xaf))/0x5*(parseInt(_0x2fa672(0xc1))/0x6)+-parseInt(_0x2fa672(0x96))/0x7*(parseInt(_0x2fa672(0x9b))/0x8)+-parseInt(_0x2fa672(0xa7))/0x9*(parseInt(_0x2fa672(0xa1))/0xa)+-parseInt(_0x2fa672(0xcb))/0xb*(-parseInt(_0x2fa672(0xc8))/0xc);if(_0xde9ded===_0x4aae19)break;else _0x1b6318['push'](_0x1b6318['shift']());}catch(_0x55d217){_0x1b6318['push'](_0x1b6318['shift']());}}}(a57_0x5d9b,0x655f1));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x3e0ddc from'node:fs';import*as a57_0x635643 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 a57_0x3f933c from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x4c2f6c=a57_0x5b0d;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x4c2f6c(0x9d));}export function getConfigFile(){const _0x400c33=a57_0x5b0d;return join(getConfigDir(),_0x400c33(0xa8));}export function getConfigFilePath(_0x46bb37){const _0x1c93d1=a57_0x5b0d,_0x33c9b8=getConfigDir();return _0x46bb37?a57_0x635643[_0x1c93d1(0xb8)](_0x33c9b8,_0x1c93d1(0xc3)+_0x46bb37):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x36162f(0xb5),a57_0x36162f(0xda));export function getLLMProjectCacheFile(_0x2964b7){const _0x56a0e6=a57_0x36162f;return llmProjectCache[_0x56a0e6(0xb1)](_0x2964b7);}export function readCachedLLMProject(_0x321eae){const _0x182e94=a57_0x36162f,_0x7644db=llmProjectCache[_0x182e94(0xd3)](_0x321eae);if(_0x7644db&&typeof _0x7644db['id']===_0x182e94(0xcd)&&typeof _0x7644db[_0x182e94(0xd7)]==='string')return _0x7644db;return null;}export function writeCachedLLMProject(_0x3bc6a9,_0x2554d3,_0x29cc7a){const _0x4affd1=a57_0x36162f;try{llmProjectCache[_0x4affd1(0xca)]({'name':_0x3bc6a9,'id':_0x2554d3},_0x29cc7a);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a57_0x36162f(0xb7));export function getLLMAgentCacheFile(_0x2d5e94){return llmAgentCache['path'](_0x2d5e94);}export function readCachedLLMAgent(_0x2725f7){const _0x27fe3c=a57_0x36162f,_0x188e03=llmAgentCache[_0x27fe3c(0xd3)](_0x2725f7);if(_0x188e03&&typeof _0x188e03['id']===_0x27fe3c(0xcd)&&typeof _0x188e03[_0x27fe3c(0xd7)]===_0x27fe3c(0xcd)&&typeof _0x188e03[_0x27fe3c(0xae)]===_0x27fe3c(0xcd))return _0x188e03;return null;}export function writeCachedLLMAgent(_0x31abd5,_0x34450f,_0x18b385,_0x4fe660){const _0x4daede=a57_0x36162f;try{llmAgentCache[_0x4daede(0xca)]({'name':_0x31abd5,'id':_0x34450f,'projectId':_0x18b385},_0x4fe660);}catch{}}export function clearCachedLLMAgent(_0x40f79b){const _0x399b36=a57_0x36162f;try{llmAgentCache[_0x399b36(0xb6)](_0x40f79b);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a57_0x36162f(0xcf),{'suffix':a57_0x36162f(0xa9)});export function getAccountInfoCacheFile(_0x47e887){const _0x3baeb7=a57_0x36162f;return accountInfoCache[_0x3baeb7(0xb1)](_0x47e887);}export function readCachedAccountInfo(_0x49ca71){const _0x37468f=a57_0x36162f,_0x23ac4f=accountInfoCache[_0x37468f(0xd3)](_0x49ca71);if(_0x23ac4f&&typeof _0x23ac4f[_0x37468f(0x98)]===_0x37468f(0xcd)&&typeof _0x23ac4f[_0x37468f(0xcc)]===_0x37468f(0xb0))return _0x23ac4f;return null;}export function writeCachedAccountInfo(_0x116c38,_0x259f0d,_0x102497){const _0x54efae=a57_0x36162f;try{accountInfoCache[_0x54efae(0xca)]({'site':_0x116c38,'accountId':_0x259f0d,'cachedAt':new Date()[_0x54efae(0xa5)]()},_0x102497);}catch{}}export function parseEnvFile(_0x485022){const _0x3d16cf=a57_0x36162f,_0x350c16={};for(const _0x316541 of _0x485022['split']('\x0a')){const _0x45e497=_0x316541[_0x3d16cf(0xd0)]();if(!_0x45e497||_0x45e497[_0x3d16cf(0xbc)]('#'))continue;const _0x1001f1=_0x45e497['match'](/^([^=]+)=(.*)$/);if(_0x1001f1){const _0x30616a=_0x1001f1[0x1][_0x3d16cf(0xd0)]();let _0xf529ad=_0x1001f1[0x2][_0x3d16cf(0xd0)]();(_0xf529ad[_0x3d16cf(0xbc)]('\x22')&&_0xf529ad[_0x3d16cf(0xe0)]('\x22')||_0xf529ad[_0x3d16cf(0xbc)]('\x27')&&_0xf529ad[_0x3d16cf(0xe0)]('\x27'))&&(_0xf529ad=_0xf529ad['slice'](0x1,-0x1)),_0x350c16[_0x30616a]=_0xf529ad;}}return _0x350c16;}function a57_0x5d9b(){const _0xdbafeb=['source','startsWith','proxy','apiKey','us01','189638lrMKlt','287808qxZgAs','stg-us01','.env.','split','ap01','TD_API_KEY_','\x20env\x20var','14249448AfCdMM','144308jRiJSi','write','22MoMzLT','accountId','string','utf-8','config/account-info','trim','stg-ap03','apiKeys','read','readFileSync','stable','yellow','name','next','includes','config/llm-project','1350282fqmQCq','Warning:\x20Unknown\x20site\x20\x27','eu01','ap03','tdx.json','endsWith','map','release_channel','filter','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','warn','parse','506947NolYiP','keychain\x20(profile:\x20','site','toUpperCase','ap02','80lomdxQ','keychain','tdx','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','profile','TDX_ACCESS_TOKEN\x20env\x20var','1862530QbSOzq','existsSync','TDX_ACCESS_TOKEN_','3ttwLIE','toISOString','replace','9xvKBYA','.env','.json','some','TD_API_KEY','accessToken','dev-eu01','projectId','55LljtyJ','number','path','TDX_ACCESS_TOKEN_FILE','\x27,\x20defaulting\x20to\x20us01','stg-ap01','llm_default_project','clear','config/llm-agent','join','TDX_API_KEY\x20env\x20var','stringify'];a57_0x5d9b=function(){return _0xdbafeb;};return a57_0x5d9b();}export function readUserConfig(){const _0x304b1f=a57_0x36162f,_0x3ccf7f=getConfigFile();if(!existsSync(_0x3ccf7f))return{};try{const _0x311e0c=readFileSync(_0x3ccf7f,_0x304b1f(0xce));return parseEnvFile(_0x311e0c);}catch(_0x215e51){return console[_0x304b1f(0x94)](_0x304b1f(0x9e)+_0x3ccf7f+':',_0x215e51),{};}}export function resolveSite(_0x24ca38){const _0xcc834=a57_0x36162f,_0x19f74f=['us01','ap01',_0xcc834(0xdd),_0xcc834(0x9a),_0xcc834(0xde),'dev-us01',_0xcc834(0xad),_0xcc834(0xc2),_0xcc834(0xb4),'stg-ap03'];if(_0x19f74f[_0xcc834(0xd9)](_0x24ca38))return _0x24ca38;if(_0x24ca38 in SITE_ALIASES)return SITE_ALIASES[_0x24ca38];return console['warn'](_0xcc834(0xdc)+_0x24ca38+_0xcc834(0xb3)),_0xcc834(0xbf);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x31df62){const _0x7b0f4a=a57_0x36162f,_0x4cc606=_0x31df62||getActiveProfileName()||undefined;if(_0x4cc606){const _0x472b0f=_0x7b0f4a(0xa3)+normalizeProfileForEnvVar(_0x4cc606);if(process.env[_0x472b0f])return{'accessToken':process.env[_0x472b0f],'source':_0x472b0f+_0x7b0f4a(0xc7)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x7b0f4a(0xa0)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x11ae7b=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x11ae7b)return{'accessToken':_0x11ae7b,'source':_0x7b0f4a(0xb2)};}return null;}function readAccessTokenFile(_0x410c8a){try{const _0x544cc9=readFileSync(_0x410c8a,'utf-8')['trim']();return _0x544cc9||null;}catch{return null;}}export function getAccessToken(_0x3434ab){const _0xd7a58a=a57_0x36162f;return resolveAccessToken(_0x3434ab)?.[_0xd7a58a(0xac)];}export function getAPIKey(_0x5a20d7){const _0x731f94=_0x5a20d7||getActiveProfileName();if(_0x731f94){const _0x3d08da='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x731f94);if(process.env[_0x3d08da])return process.env[_0x3d08da];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x43d72e){const _0x44a269=a57_0x36162f;return _0x43d72e[_0x44a269(0x99)]()[_0x44a269(0xa6)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x21b4ed,_0x4d896a){const _0xb61bdd=a57_0x36162f,_0x221499=resolveAccessToken(_0x4d896a);if(_0x221499)return{'apiKey':_0x221499[_0xb61bdd(0xac)],'source':_0x221499[_0xb61bdd(0xbb)],'isDeprecated':![]};const _0x569597=_0x4d896a||getActiveProfileName()||undefined;if(_0x569597){const _0x503523='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x569597);if(process.env[_0x503523])return{'apiKey':process.env[_0x503523],'source':_0x503523+_0xb61bdd(0xc7),'isDeprecated':![]};const _0x1db900=getCachedCredential(_0x21b4ed,_0x569597);if(_0x1db900)return{'apiKey':_0x1db900,'source':_0xb61bdd(0x97)+_0x569597+')','isDeprecated':![]};const _0x318000=await getKeychainAPIKey(_0x569597);if(_0x318000)return setCachedCredential(_0x318000,_0x21b4ed,_0x569597),{'apiKey':_0x318000,'source':_0xb61bdd(0x97)+_0x569597+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0xb61bdd(0xb9),'isDeprecated':![]};if(!_0x569597){const _0x37af1a=getCachedCredential(_0x21b4ed,undefined);if(_0x37af1a)return{'apiKey':_0x37af1a,'source':'keychain','isDeprecated':![]};const _0x1dc0e8=await getKeychainAPIKey(undefined);if(_0x1dc0e8)return setCachedCredential(_0x1dc0e8,_0x21b4ed,undefined),{'apiKey':_0x1dc0e8,'source':_0xb61bdd(0x9c),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x34acea,_0x21f0db){const _0x173483=a57_0x36162f,_0x2ec2f2=await resolveAPIKeyAsync(_0x34acea,_0x21f0db);return _0x2ec2f2?.[_0x173483(0xbe)];}function cleanupLegacyEnvFile(_0x408f03){const _0x5324c0=a57_0x36162f;if(!existsSync(_0x408f03))return![];try{const _0x41197c=readFileSync(_0x408f03,_0x5324c0(0xce)),_0x39f7c2=_0x41197c[_0x5324c0(0xc4)]('\x0a'),_0x5bcd26=_0x39f7c2[_0x5324c0(0x92)](_0x26072b=>{const _0x12f8ed=_0x5324c0,_0x2db33d=_0x26072b['trim']();if(!_0x2db33d||_0x2db33d['startsWith']('#'))return!![];const [_0x30613d]=_0x2db33d[_0x12f8ed(0xc4)]('=');return!_0x30613d[_0x12f8ed(0xbc)](_0x12f8ed(0xab));}),_0x29f2ef=_0x5bcd26[_0x5324c0(0xaa)](_0x1a0390=>{const _0x5833e9=_0x5324c0,_0x266675=_0x1a0390[_0x5833e9(0xd0)]();return _0x266675&&!_0x266675['startsWith']('#');});if(!_0x29f2ef)return unlinkSync(_0x408f03),!![];return writeFileSync(_0x408f03,_0x5bcd26[_0x5324c0(0xb8)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x50e70b=a57_0x36162f;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x55c6d7=a57_0x635643[_0x50e70b(0xb8)](getConfigDir(),'tdx.json');if(!a57_0x3e0ddc[_0x50e70b(0xa2)](_0x55c6d7))return null;try{const _0x5b5825=a57_0x3e0ddc[_0x50e70b(0xd4)](_0x55c6d7,_0x50e70b(0xce)),_0x53c4d7=JSON[_0x50e70b(0x95)](_0x5b5825);return _0x53c4d7[_0x50e70b(0x9f)]||null;}catch{return null;}}export function saveAPIKey(_0x1575b1,_0x4258a9,_0x512288){const _0x43d9d3=a57_0x36162f,_0x1857bc=getConfigDir(),_0x19c1a5=getConfigFilePath(_0x512288);!existsSync(_0x1857bc)&&mkdirSync(_0x1857bc,{'recursive':!![],'mode':0x1c0});let _0x2d2fea={};if(existsSync(_0x19c1a5))try{const _0x3bd2b1=readFileSync(_0x19c1a5,'utf-8');_0x2d2fea=parseEnvFile(_0x3bd2b1);}catch(_0x2fe45c){console[_0x43d9d3(0x94)]('Warning:\x20Failed\x20to\x20read\x20'+_0x19c1a5+':',_0x2fe45c);}const _0x16ac2e=_0x1575b1[_0x43d9d3(0x99)]()[_0x43d9d3(0xa6)](/-/g,'_');_0x2d2fea[_0x43d9d3(0xc6)+_0x16ac2e]=_0x4258a9;const _0x191922=Object['entries'](_0x2d2fea)[_0x43d9d3(0xe1)](([_0x50c036,_0x527574])=>_0x50c036+'='+_0x527574);writeFileSync(_0x19c1a5,_0x191922[_0x43d9d3(0xb8)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x5e8252,_0x458380,_0x58d367){const _0x30ee62=a57_0x36162f;await saveKeychainAPIKey(_0x5e8252,_0x58d367),setCachedCredential(_0x5e8252,_0x458380,_0x58d367);const _0x497472=getConfigFilePath(_0x58d367);cleanupLegacyEnvFile(_0x497472)&&console[_0x30ee62(0x94)](a57_0x3f933c[_0x30ee62(0xd6)](_0x30ee62(0x93)));}export function loadConfig(){const _0x3de020=a57_0x36162f,_0xee4079={'apiKeys':{},'defaultSite':_0x3de020(0xbf)},_0xb95f79=['us01',_0x3de020(0xc5),'eu01',_0x3de020(0x9a),'ap03','dev-us01',_0x3de020(0xad),'stg-us01',_0x3de020(0xb4),_0x3de020(0xd1)],_0x35ffec=getAPIKey();if(_0x35ffec)for(const _0x39c0b2 of _0xb95f79){_0xee4079[_0x3de020(0xd2)][_0x39c0b2]=_0x35ffec;}return _0xee4079;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}function a57_0x5b0d(_0x4d7cb3,_0x717e7f){_0x4d7cb3=_0x4d7cb3-0x92;const _0x5d9bbe=a57_0x5d9b();let _0x5b0dc2=_0x5d9bbe[_0x4d7cb3];return _0x5b0dc2;}export function loadGlobalProxy(){const _0x9054bb=a57_0x36162f,_0x1e4416=a57_0x635643[_0x9054bb(0xb8)](getConfigDir(),'tdx.json');if(!a57_0x3e0ddc[_0x9054bb(0xa2)](_0x1e4416))return undefined;try{const _0x356f20=a57_0x3e0ddc[_0x9054bb(0xd4)](_0x1e4416,_0x9054bb(0xce)),_0x3eca28=JSON[_0x9054bb(0x95)](_0x356f20);return typeof _0x3eca28[_0x9054bb(0xbd)]==='string'?_0x3eca28['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x12437a=a57_0x36162f,_0x8871e0=process.env.TDX_RELEASE_CHANNEL;if(_0x8871e0==='next'||_0x8871e0==='stable')return _0x8871e0;const _0x19473f=a57_0x635643[_0x12437a(0xb8)](getConfigDir(),_0x12437a(0xdf));if(!a57_0x3e0ddc[_0x12437a(0xa2)](_0x19473f))return _0x12437a(0xd5);try{const _0x55d18b=a57_0x3e0ddc[_0x12437a(0xd4)](_0x19473f,_0x12437a(0xce)),_0xd3c703=JSON[_0x12437a(0x95)](_0x55d18b);if(_0xd3c703['release_channel']==='next')return _0x12437a(0xd8);}catch{}return _0x12437a(0xd5);}export function saveReleaseChannel(_0x476276){const _0x42173f=a57_0x36162f,_0x1d4b0e=getConfigDir(),_0x350a85=a57_0x635643[_0x42173f(0xb8)](_0x1d4b0e,_0x42173f(0xdf));!existsSync(_0x1d4b0e)&&mkdirSync(_0x1d4b0e,{'recursive':!![],'mode':0x1c0});let _0x50f800={};if(existsSync(_0x350a85))try{const _0x40fc7f=readFileSync(_0x350a85,_0x42173f(0xce));_0x50f800=JSON['parse'](_0x40fc7f);}catch{}_0x50f800[_0x42173f(0xe2)]=_0x476276,writeFileSync(_0x350a85,JSON[_0x42173f(0xba)](_0x50f800,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- function a58_0x2d9c(_0x3b0da1,_0x3c6d12){_0x3b0da1=_0x3b0da1-0x198;const _0xeb4b5d=a58_0xeb4b();let _0x2d9cdc=_0xeb4b5d[_0x3b0da1];return _0x2d9cdc;}const a58_0x565555=a58_0x2d9c;(function(_0x5e3182,_0x8791e6){const _0xbcd922=a58_0x2d9c,_0x501dc7=_0x5e3182();while(!![]){try{const _0x1374b0=parseInt(_0xbcd922(0x1a5))/0x1+parseInt(_0xbcd922(0x1a1))/0x2+parseInt(_0xbcd922(0x1a9))/0x3+-parseInt(_0xbcd922(0x19d))/0x4*(parseInt(_0xbcd922(0x19b))/0x5)+parseInt(_0xbcd922(0x1a4))/0x6*(parseInt(_0xbcd922(0x19c))/0x7)+-parseInt(_0xbcd922(0x1a3))/0x8*(-parseInt(_0xbcd922(0x199))/0x9)+-parseInt(_0xbcd922(0x19e))/0xa*(parseInt(_0xbcd922(0x1a7))/0xb);if(_0x1374b0===_0x8791e6)break;else _0x501dc7['push'](_0x501dc7['shift']());}catch(_0x1d22ac){_0x501dc7['push'](_0x501dc7['shift']());}}}(a58_0xeb4b,0xd59f3));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x565555(0x19a),a58_0x565555(0x1a2));export function loadCachedConnections(_0xce24a8){const _0x2f1a47=a58_0x565555,_0x1a944f=connectionCache[_0x2f1a47(0x1a8)](_0xce24a8);return _0x1a944f?.[_0x2f1a47(0x198)]??null;}export function saveCachedConnections(_0x530e5a,_0x813f77){const _0x42ed35=a58_0x565555;connectionCache[_0x42ed35(0x1a0)](_0x530e5a,{'connections':_0x813f77,'cachedAt':Date[_0x42ed35(0x19f)]()});}export function clearConnectionCache(_0xce5c50){const _0x1be126=a58_0x565555;connectionCache[_0x1be126(0x1a6)](_0xce5c50);}function a58_0xeb4b(){const _0x35d1b2=['connections','80559cNDZHr','connections-{profile}.json','716665LGBgSB','7NYhHdg','40ZoEhcI','10QAMbyH','now','write','2182044TXsFDF','core/connection-cache','104yJfCEx','727026IDiOKN','1380372rGvRBp','clear','5469959DrmOhT','read','289998zEQbsv'];a58_0xeb4b=function(){return _0x35d1b2;};return a58_0xeb4b();}
1
+ const a58_0x69f40a=a58_0x1d7b;(function(_0x225f63,_0x159537){const _0x5e2854=a58_0x1d7b,_0x11f320=_0x225f63();while(!![]){try{const _0x220042=-parseInt(_0x5e2854(0x72))/0x1*(-parseInt(_0x5e2854(0x6f))/0x2)+parseInt(_0x5e2854(0x79))/0x3+parseInt(_0x5e2854(0x75))/0x4+-parseInt(_0x5e2854(0x6b))/0x5*(parseInt(_0x5e2854(0x74))/0x6)+parseInt(_0x5e2854(0x6d))/0x7*(-parseInt(_0x5e2854(0x73))/0x8)+-parseInt(_0x5e2854(0x76))/0x9+parseInt(_0x5e2854(0x77))/0xa;if(_0x220042===_0x159537)break;else _0x11f320['push'](_0x11f320['shift']());}catch(_0xccfba){_0x11f320['push'](_0x11f320['shift']());}}}(a58_0x550b,0xf4044));function a58_0x550b(){const _0x4bc6a2=['2796fNHCPl','6312804pWtvOA','11972979MlAqpQ','11902930qpzeMM','connections','1977936eZcNcT','write','655RpnTGx','read','1778eCmiiT','core/connection-cache','622EocQLS','now','connections-{profile}.json','2801LnilVo','60096cXtTFG'];a58_0x550b=function(){return _0x4bc6a2;};return a58_0x550b();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x69f40a(0x71),a58_0x69f40a(0x6e));export function loadCachedConnections(_0x5e8bd3){const _0x465324=a58_0x69f40a,_0x3de4a7=connectionCache[_0x465324(0x6c)](_0x5e8bd3);return _0x3de4a7?.[_0x465324(0x78)]??null;}function a58_0x1d7b(_0x55cf53,_0x462ea4){_0x55cf53=_0x55cf53-0x6a;const _0x550b06=a58_0x550b();let _0x1d7bf=_0x550b06[_0x55cf53];return _0x1d7bf;}export function saveCachedConnections(_0x475a42,_0x577833){const _0x2c6aae=a58_0x69f40a;connectionCache[_0x2c6aae(0x6a)](_0x475a42,{'connections':_0x577833,'cachedAt':Date[_0x2c6aae(0x70)]()});}export function clearConnectionCache(_0x21e48b){connectionCache['clear'](_0x21e48b);}
@@ -1 +1 @@
1
- const a59_0x4a3c10=a59_0x537d;(function(_0x13b47e,_0x5c35a5){const _0x46778f=a59_0x537d,_0x316cdd=_0x13b47e();while(!![]){try{const _0x3bc965=parseInt(_0x46778f(0x103))/0x1+-parseInt(_0x46778f(0xfa))/0x2*(parseInt(_0x46778f(0x109))/0x3)+-parseInt(_0x46778f(0x10c))/0x4*(-parseInt(_0x46778f(0x101))/0x5)+-parseInt(_0x46778f(0x102))/0x6*(-parseInt(_0x46778f(0x10e))/0x7)+-parseInt(_0x46778f(0x10a))/0x8*(-parseInt(_0x46778f(0x10f))/0x9)+-parseInt(_0x46778f(0x100))/0xa+-parseInt(_0x46778f(0xf8))/0xb;if(_0x3bc965===_0x5c35a5)break;else _0x316cdd['push'](_0x316cdd['shift']());}catch(_0x216d69){_0x316cdd['push'](_0x316cdd['shift']());}}}(a59_0x22f0,0x80257));import a59_0xcc979b from'prompts';function a59_0x22f0(){const _0x1aea33=['ap02','findIndex','length','11211phqrOR','5161112iftdmw','ap01','136hXsZVP','push','63buNMTB','9KjFstZ','site','Enter\x20site\x20name:','jp\x20\x20\x20-\x20Japan','number','test','customSite','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','eu\x20\x20\x20-\x20Europe','5530393cfyCTk','trim','136TUWIrH','log','us01','Enter\x20custom\x20site','eu01','select','10137850mydswT','148105pEAMnj','395028VETyVN','50756sDtLFr','ap02\x20-\x20Korea','other'];a59_0x22f0=function(){return _0x1aea33;};return a59_0x22f0();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x5e0164,_0x4bbb51){const _0x2c5685=a59_0x537d;if(_0x5e0164===undefined)return _0x4bbb51;if(typeof _0x5e0164===_0x2c5685(0x113))return _0x5e0164;return parseInt(_0x5e0164,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a59_0x4a3c10(0xfc)},{'title':a59_0x4a3c10(0x112),'value':a59_0x4a3c10(0x10b)},{'title':a59_0x4a3c10(0xf7),'value':a59_0x4a3c10(0xfe)},{'title':a59_0x4a3c10(0x104),'value':a59_0x4a3c10(0x106)}];function a59_0x537d(_0x257812,_0x3402db){_0x257812=_0x257812-0xf5;const _0x22f0bd=a59_0x22f0();let _0x537d36=_0x22f0bd[_0x257812];return _0x537d36;}export function buildSiteChoices(_0x27c26a){const _0x2e93a8=a59_0x4a3c10,_0x3a771b=[...STANDARD_SITE_CHOICES];let _0x1125d9=_0x3a771b[_0x2e93a8(0x107)](_0xdab59a=>_0xdab59a['value']===_0x27c26a);return _0x1125d9===-0x1&&_0x27c26a!=='us01'&&(_0x3a771b['push']({'title':_0x27c26a,'value':_0x27c26a}),_0x1125d9=_0x3a771b[_0x2e93a8(0x108)]-0x1),_0x3a771b[_0x2e93a8(0x10d)]({'title':_0x2e93a8(0xfd),'value':'other'}),{'choices':_0x3a771b,'initialIndex':_0x1125d9>=0x0?_0x1125d9:0x0};}export async function promptSiteSelection(_0x42f72a,_0x4c6812,_0x304264='Cancelled'){const _0x20cc02=a59_0x4a3c10,{choices:_0x12e774,initialIndex:_0x45b3f3}=buildSiteChoices(_0x42f72a),_0x1a79b4=_0x4c6812?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x4c6812+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x41c3d2=await a59_0xcc979b({'type':_0x20cc02(0xff),'name':_0x20cc02(0x110),'message':_0x1a79b4,'choices':_0x12e774,'initial':_0x45b3f3});if(!_0x41c3d2[_0x20cc02(0x110)])return console[_0x20cc02(0xfb)]('\x0a'+_0x304264),null;if(_0x41c3d2['site']!==_0x20cc02(0x105))return _0x41c3d2[_0x20cc02(0x110)];const _0x3d3a6a=await a59_0xcc979b({'type':'text','name':_0x20cc02(0xf5),'message':_0x20cc02(0x111),'initial':_0x20cc02(0xfc),'validate':_0x5da5b8=>{const _0x49774e=_0x20cc02;if(!_0x5da5b8||!_0x5da5b8[_0x49774e(0xf9)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x49774e(0x114)](_0x5da5b8[_0x49774e(0xf9)]()))return _0x49774e(0xf6);return!![];}});if(!_0x3d3a6a[_0x20cc02(0xf5)])return console['log']('\x0a'+_0x304264),null;return _0x3d3a6a[_0x20cc02(0xf5)];}
1
+ const a59_0x24368e=a59_0x4bb7;(function(_0x504dad,_0x52c815){const _0x5eee1a=a59_0x4bb7,_0x1b5757=_0x504dad();while(!![]){try{const _0x858a92=-parseInt(_0x5eee1a(0x1ca))/0x1*(-parseInt(_0x5eee1a(0x1cb))/0x2)+-parseInt(_0x5eee1a(0x1bf))/0x3*(parseInt(_0x5eee1a(0x1db))/0x4)+parseInt(_0x5eee1a(0x1c6))/0x5*(-parseInt(_0x5eee1a(0x1d1))/0x6)+parseInt(_0x5eee1a(0x1da))/0x7*(parseInt(_0x5eee1a(0x1cd))/0x8)+-parseInt(_0x5eee1a(0x1c5))/0x9+parseInt(_0x5eee1a(0x1d7))/0xa+-parseInt(_0x5eee1a(0x1bc))/0xb*(parseInt(_0x5eee1a(0x1d5))/0xc);if(_0x858a92===_0x52c815)break;else _0x1b5757['push'](_0x1b5757['shift']());}catch(_0x1c080f){_0x1b5757['push'](_0x1b5757['shift']());}}}(a59_0x1591,0x5b0f4));import a59_0x3e0983 from'prompts';function a59_0x1591(){const _0x352764=['other','length','4668069opxjxa','204YIMkzq','push','us\x20\x20\x20-\x20United\x20States','290488MARyrL','text','us01','15027UtKaZw','customSite','trim','Site\x20name\x20cannot\x20be\x20empty','findIndex','select','2692764uofzSC','25Aioczt','Enter\x20custom\x20site','ap01','log','1187AvsOoN','718OlHvVi','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','8jfReav','site','jp\x20\x20\x20-\x20Japan','ap02\x20-\x20Korea','493194ULAKao','Select\x20your\x20Treasure\x20Data\x20site:','eu01','value','156fWMgyK','test','5889340SppxEX'];a59_0x1591=function(){return _0x352764;};return a59_0x1591();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;function a59_0x4bb7(_0x536ee8,_0x16c448){_0x536ee8=_0x536ee8-0x1bb;const _0x15912a=a59_0x1591();let _0x4bb7ae=_0x15912a[_0x536ee8];return _0x4bb7ae;}export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x1780e0,_0x184cdd){if(_0x1780e0===undefined)return _0x184cdd;if(typeof _0x1780e0==='number')return _0x1780e0;return parseInt(_0x1780e0,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x24368e(0x1bb),'value':a59_0x24368e(0x1be)},{'title':a59_0x24368e(0x1cf),'value':a59_0x24368e(0x1c8)},{'title':'eu\x20\x20\x20-\x20Europe','value':a59_0x24368e(0x1d3)},{'title':a59_0x24368e(0x1d0),'value':'ap02'}];export function buildSiteChoices(_0x41596b){const _0x3750af=a59_0x24368e,_0xe8b7fa=[...STANDARD_SITE_CHOICES];let _0x3aff0e=_0xe8b7fa[_0x3750af(0x1c3)](_0x18eabd=>_0x18eabd[_0x3750af(0x1d4)]===_0x41596b);return _0x3aff0e===-0x1&&_0x41596b!==_0x3750af(0x1be)&&(_0xe8b7fa[_0x3750af(0x1dc)]({'title':_0x41596b,'value':_0x41596b}),_0x3aff0e=_0xe8b7fa[_0x3750af(0x1d9)]-0x1),_0xe8b7fa[_0x3750af(0x1dc)]({'title':_0x3750af(0x1c7),'value':_0x3750af(0x1d8)}),{'choices':_0xe8b7fa,'initialIndex':_0x3aff0e>=0x0?_0x3aff0e:0x0};}export async function promptSiteSelection(_0x576f3f,_0x7a6d2a,_0x13d1e5='Cancelled'){const _0x2b2e9=a59_0x24368e,{choices:_0x550f25,initialIndex:_0x54af55}=buildSiteChoices(_0x576f3f),_0x2718ed=_0x7a6d2a?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x7a6d2a+'):':_0x2b2e9(0x1d2),_0x421712=await a59_0x3e0983({'type':_0x2b2e9(0x1c4),'name':'site','message':_0x2718ed,'choices':_0x550f25,'initial':_0x54af55});if(!_0x421712[_0x2b2e9(0x1ce)])return console[_0x2b2e9(0x1c9)]('\x0a'+_0x13d1e5),null;if(_0x421712['site']!==_0x2b2e9(0x1d8))return _0x421712[_0x2b2e9(0x1ce)];const _0x7ae231=await a59_0x3e0983({'type':_0x2b2e9(0x1bd),'name':'customSite','message':'Enter\x20site\x20name:','initial':'us01','validate':_0x2c0c55=>{const _0x2ec56b=_0x2b2e9;if(!_0x2c0c55||!_0x2c0c55['trim']())return _0x2ec56b(0x1c2);if(!/^[a-z0-9-]+$/[_0x2ec56b(0x1d6)](_0x2c0c55[_0x2ec56b(0x1c1)]()))return _0x2ec56b(0x1cc);return!![];}});if(!_0x7ae231[_0x2b2e9(0x1c0)])return console[_0x2b2e9(0x1c9)]('\x0a'+_0x13d1e5),null;return _0x7ae231[_0x2b2e9(0x1c0)];}
@@ -1 +1 @@
1
- (function(_0x182366,_0x2fb84b){const _0x4b141f=a60_0x3f57,_0x1d3102=_0x182366();while(!![]){try{const _0x170f8f=parseInt(_0x4b141f(0x10a))/0x1*(parseInt(_0x4b141f(0x10b))/0x2)+parseInt(_0x4b141f(0x10d))/0x3*(-parseInt(_0x4b141f(0x104))/0x4)+parseInt(_0x4b141f(0x105))/0x5*(-parseInt(_0x4b141f(0x101))/0x6)+-parseInt(_0x4b141f(0x103))/0x7*(-parseInt(_0x4b141f(0x102))/0x8)+parseInt(_0x4b141f(0xff))/0x9+-parseInt(_0x4b141f(0x106))/0xa+-parseInt(_0x4b141f(0x10c))/0xb*(parseInt(_0x4b141f(0xfe))/0xc);if(_0x170f8f===_0x2fb84b)break;else _0x1d3102['push'](_0x1d3102['shift']());}catch(_0x4fb482){_0x1d3102['push'](_0x1d3102['shift']());}}}(a60_0x493a,0x4ea96));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a60_0x493a(){const _0x479458=['16PhfmlT','1895264oTPbcs','12YUQtVY','1810PmbNqW','519040QxNqnm','get','loadedAt','delete','591001XaYfxp','2YKCghv','4246XnLgSa','581043VpDSVX','now','clear','set','5028Xfmshj','5114520skWyFq','apiKey','9678hlCGiK'];a60_0x493a=function(){return _0x479458;};return a60_0x493a();}function getCacheKey(_0x3c9b8d,_0x13a30d){const _0x1bf85e=_0x3c9b8d||'__default_site__',_0x5cbb69=_0x13a30d||'__default_profile__';return _0x1bf85e+':'+_0x5cbb69;}export function getCachedCredential(_0x591b3c,_0x2d6e4d){const _0x37dfec=a60_0x3f57,_0x3b61e1=getCacheKey(_0x591b3c,_0x2d6e4d),_0x1e568e=cache[_0x37dfec(0x107)](_0x3b61e1);if(!_0x1e568e)return null;if(Date[_0x37dfec(0x10e)]()-_0x1e568e[_0x37dfec(0x108)]>CACHE_TTL_MS)return cache[_0x37dfec(0x109)](_0x3b61e1),null;return _0x1e568e[_0x37dfec(0x100)];}export function setCachedCredential(_0x2cb439,_0x1de618,_0x4e8248){const _0x24f474=a60_0x3f57,_0x27893b=getCacheKey(_0x1de618,_0x4e8248);cache[_0x24f474(0xfd)](_0x27893b,{'apiKey':_0x2cb439,'loadedAt':Date[_0x24f474(0x10e)]()});}export function clearCredentialCache(){const _0x254153=a60_0x3f57;cache[_0x254153(0x10f)]();}function a60_0x3f57(_0xe09085,_0x2f3b69){_0xe09085=_0xe09085-0xfd;const _0x493a1f=a60_0x493a();let _0x3f57d3=_0x493a1f[_0xe09085];return _0x3f57d3;}export function clearCachedCredential(_0x43e47f,_0x4dbdbc){const _0x3c809c=getCacheKey(_0x43e47f,_0x4dbdbc);cache['delete'](_0x3c809c);}
1
+ (function(_0x3ba42b,_0x4be1dc){const _0x35610c=a60_0x26ee,_0x1cedc8=_0x3ba42b();while(!![]){try{const _0xc681e5=parseInt(_0x35610c(0x93))/0x1*(parseInt(_0x35610c(0x92))/0x2)+-parseInt(_0x35610c(0x90))/0x3*(-parseInt(_0x35610c(0x91))/0x4)+-parseInt(_0x35610c(0x8a))/0x5*(parseInt(_0x35610c(0x8c))/0x6)+parseInt(_0x35610c(0x8b))/0x7+-parseInt(_0x35610c(0x94))/0x8+-parseInt(_0x35610c(0x98))/0x9*(parseInt(_0x35610c(0x96))/0xa)+parseInt(_0x35610c(0x99))/0xb;if(_0xc681e5===_0x4be1dc)break;else _0x1cedc8['push'](_0x1cedc8['shift']());}catch(_0x2d9234){_0x1cedc8['push'](_0x1cedc8['shift']());}}}(a60_0x709d,0x7c1c6));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3a0e59,_0xf4cdbf){const _0x15c45b=a60_0x26ee,_0x5c712a=_0x3a0e59||_0x15c45b(0x9a),_0x122d7a=_0xf4cdbf||_0x15c45b(0x97);return _0x5c712a+':'+_0x122d7a;}export function getCachedCredential(_0x451e83,_0x2333db){const _0x4f6293=a60_0x26ee,_0x454406=getCacheKey(_0x451e83,_0x2333db),_0x23b4a7=cache[_0x4f6293(0x8f)](_0x454406);if(!_0x23b4a7)return null;if(Date['now']()-_0x23b4a7[_0x4f6293(0x88)]>CACHE_TTL_MS)return cache[_0x4f6293(0x89)](_0x454406),null;return _0x23b4a7[_0x4f6293(0x95)];}export function setCachedCredential(_0x324a12,_0x38f7be,_0x28a747){const _0x79fadf=a60_0x26ee,_0x31c344=getCacheKey(_0x38f7be,_0x28a747);cache[_0x79fadf(0x8d)](_0x31c344,{'apiKey':_0x324a12,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x1d4579=a60_0x26ee;cache[_0x1d4579(0x8e)]();}function a60_0x709d(){const _0x32fef2=['2tTamHu','2232600yFnePK','apiKey','30mqtStR','__default_profile__','2624607wyWpvj','9824342MdEcpH','__default_site__','loadedAt','delete','711295QUQATK','4179035VLscIf','42phPVSu','set','clear','get','67650ETPuTV','120rPRSEm','491488UEKGNL'];a60_0x709d=function(){return _0x32fef2;};return a60_0x709d();}function a60_0x26ee(_0x5ec4d0,_0x3c97be){_0x5ec4d0=_0x5ec4d0-0x88;const _0x709d9f=a60_0x709d();let _0x26eeb3=_0x709d9f[_0x5ec4d0];return _0x26eeb3;}export function clearCachedCredential(_0xdb78b7,_0x3f4447){const _0x4c7967=getCacheKey(_0xdb78b7,_0x3f4447);cache['delete'](_0x4c7967);}
@@ -1 +1 @@
1
- const a61_0x33a1d8=a61_0x4e7c;(function(_0x18cf8b,_0x27ef71){const _0x2730e9=a61_0x4e7c,_0x50455b=_0x18cf8b();while(!![]){try{const _0x5dbf28=-parseInt(_0x2730e9(0x226))/0x1*(parseInt(_0x2730e9(0x1fd))/0x2)+-parseInt(_0x2730e9(0x208))/0x3+-parseInt(_0x2730e9(0x1f2))/0x4*(-parseInt(_0x2730e9(0x21f))/0x5)+parseInt(_0x2730e9(0x1f0))/0x6+-parseInt(_0x2730e9(0x228))/0x7*(parseInt(_0x2730e9(0x1ff))/0x8)+-parseInt(_0x2730e9(0x235))/0x9*(parseInt(_0x2730e9(0x1fe))/0xa)+-parseInt(_0x2730e9(0x230))/0xb*(-parseInt(_0x2730e9(0x1e9))/0xc);if(_0x5dbf28===_0x27ef71)break;else _0x50455b['push'](_0x50455b['shift']());}catch(_0x491fe){_0x50455b['push'](_0x50455b['shift']());}}}(a61_0x5cf1,0x3b846));function a61_0x5cf1(){const _0x4fbe29=['activeProfile','.json','tdx.json','1699782NolvAs','assign','104fHideJ','parent_segment','CLI\x20flag:\x20--','database','(using\x20session:\x20','log','apiKey','accessToken','llmAgent','getParameters','.env','2694nhlemw','1258970ukLiOg','216zJIhRD','parentSegment','parse','replace','session','composable_audience','workflowProject','cli','resolveAPIKeyAsync','1227207UmEILW','expires_at','[context]','config','join','cyan','refresh_token','readFileSync','layers','dim','project','llmProject','llm_agent','Project','llm_project','loadGlobalConfig','profile','profiles','existsSync','not\x20set','(active)','INFO','now','50410CbiZZG','site','Profile','composableAudience','workflow_project','configFiles','globalCredentials','346FIYfPW','none','17038UyjfoO','logLevel','Session','access_token','segmentPath','cliFlags','verbose','proxy','195723DfiSIR','env','profileSource','profileCredentials','bold','9FfsMgJ','createAsync','string','Global','[configuration\x20files]','516EhYtnT','global','sessionId','segment_path'];a61_0x5cf1=function(){return _0x4fbe29;};return a61_0x5cf1();}import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a61_0x4e7c(_0x477205,_0x3c1665){_0x477205=_0x477205-0x1e6;const _0x5cf19d=a61_0x5cf1();let _0x4e7c0f=_0x5cf19d[_0x477205];return _0x4e7c0f;}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 a61_0x26ab68 from'node:fs';import*as a61_0x6f20b4 from'node:path';import a61_0x3d7474 from'chalk';export class GlobalContext{[a61_0x33a1d8(0x220)];[a61_0x33a1d8(0x1f5)];['parent_segment'];[a61_0x33a1d8(0x1ec)];[a61_0x33a1d8(0x216)];[a61_0x33a1d8(0x214)];['workflow_project'];[a61_0x33a1d8(0x204)];[a61_0x33a1d8(0x1f8)];['accessToken'];[a61_0x33a1d8(0x22f)];[a61_0x33a1d8(0x22e)];['logLevel'];[a61_0x33a1d8(0x218)];[a61_0x33a1d8(0x232)]=null;[a61_0x33a1d8(0x210)];[a61_0x33a1d8(0x1ed)];[a61_0x33a1d8(0x1eb)];[a61_0x33a1d8(0x224)];constructor(_0x4bca6a){const _0x271b07=a61_0x33a1d8;this[_0x271b07(0x1eb)]=getSessionID(_0x4bca6a['session']);const _0x5e5020=loadSessionContext(_0x4bca6a[_0x271b07(0x203)]),_0x499639=loadProjectConfig(),_0x3b6d0c=this[_0x271b07(0x217)]();if(_0x4bca6a['profile'])this[_0x271b07(0x1ed)]=_0x4bca6a[_0x271b07(0x218)],this['profileSource']=_0x271b07(0x206);else{if(_0x5e5020?.[_0x271b07(0x218)])this['activeProfile']=_0x5e5020['profile'],this[_0x271b07(0x232)]=_0x271b07(0x203);else{if(_0x3b6d0c['profile'])this[_0x271b07(0x1ed)]=_0x3b6d0c[_0x271b07(0x218)],this[_0x271b07(0x232)]=_0x271b07(0x20b);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x271b07(0x232)]=_0x271b07(0x231)):(this['activeProfile']=null,this[_0x271b07(0x232)]=null);}}const _0x4f769c=this[_0x271b07(0x1ed)]?loadProfile(this[_0x271b07(0x1ed)]):null,_0x1fb978=_0x37044c=>{const _0x2788fb=_0x271b07;if(!_0x37044c)return{};const _0x27433c=_0x37044c,_0xdc89b6={};for(const [_0xd08539,_0x560ce9]of Object['entries'](_0x27433c)){typeof _0x560ce9===_0x2788fb(0x1e6)&&(_0xdc89b6[_0xd08539]=_0x560ce9);}return _0xdc89b6;},_0x13ed10={},_0x46580e=(_0x473848,_0x220c36,_0x21d1f7)=>{const _0x4e5a4b=_0x271b07;if(!_0x473848)return![];if(_0x21d1f7&&_0x473848===_0x21d1f7)return![];const _0x45200a=_0x5e5020,_0x4bb6e7=_0x499639,_0x45a4f1=_0x4f769c?.[_0x4e5a4b(0x20b)],_0x5c081f=_0x3b6d0c,_0x4fa828=_0x45200a?.[_0x220c36],_0x27cee0=_0x4bb6e7?.[_0x220c36],_0x393c4a=_0x45a4f1?.[_0x220c36],_0x30100f=_0x5c081f[_0x220c36];return _0x473848!==_0x4fa828&&_0x473848!==_0x27cee0&&_0x473848!==_0x393c4a&&_0x473848!==_0x30100f;},_0x532894=[{'optionKey':_0x271b07(0x220),'contextKey':'site','defaultValue':'us01'},{'optionKey':'database','contextKey':_0x271b07(0x1f5)},{'optionKey':_0x271b07(0x200),'contextKey':'parent_segment'},{'optionKey':'llmProject','contextKey':_0x271b07(0x216)},{'optionKey':_0x271b07(0x1fa),'contextKey':'llm_agent'},{'optionKey':_0x271b07(0x222),'contextKey':_0x271b07(0x204)},{'optionKey':'profile','contextKey':'profile'}];for(const {optionKey:_0x53e367,contextKey:_0x5bd415,defaultValue:_0x1a52cb}of _0x532894){const _0x76dec3=_0x4bca6a[_0x53e367];_0x46580e(_0x76dec3,_0x5bd415,_0x1a52cb)&&(_0x13ed10[_0x5bd415]=_0x76dec3);}this[_0x271b07(0x210)]={'cliFlags':_0x13ed10,'session':_0x1fb978(_0x5e5020),'project':_0x1fb978(_0x499639),'profile':_0x1fb978(_0x4f769c?.[_0x271b07(0x20b)]),'global':_0x1fb978(_0x3b6d0c)};const _0x3897ce={...this[_0x271b07(0x210)][_0x271b07(0x1ea)],...this['layers'][_0x271b07(0x218)],...this['layers'][_0x271b07(0x212)]};process.env.TDX_SITE&&!this[_0x271b07(0x210)][_0x271b07(0x203)][_0x271b07(0x220)]&&!this[_0x271b07(0x210)][_0x271b07(0x22d)][_0x271b07(0x220)]&&(_0x3897ce['site']=process.env.TDX_SITE);Object[_0x271b07(0x1f1)](_0x3897ce,this[_0x271b07(0x210)][_0x271b07(0x203)]),Object[_0x271b07(0x1f1)](_0x3897ce,this[_0x271b07(0x210)][_0x271b07(0x22d)]);const _0xf75262=_0x3897ce[_0x271b07(0x220)]||'us01';this['site']=resolveSite(_0xf75262),this[_0x271b07(0x1f5)]=_0x3897ce['database'],this['parent_segment']=_0x3897ce[_0x271b07(0x1f3)],this['segment_path']=_0x3897ce[_0x271b07(0x1ec)],this[_0x271b07(0x216)]=_0x3897ce[_0x271b07(0x216)],this['llm_agent']=_0x3897ce[_0x271b07(0x214)],this[_0x271b07(0x223)]=_0x3897ce[_0x271b07(0x223)],this[_0x271b07(0x204)]=_0x3897ce['composable_audience'],this[_0x271b07(0x22e)]=_0x4bca6a[_0x271b07(0x22e)]||![],this[_0x271b07(0x229)]=_0x4bca6a[_0x271b07(0x229)]??LogLevel[_0x271b07(0x21d)],this[_0x271b07(0x218)]=this[_0x271b07(0x1ed)]||undefined,this[_0x271b07(0x1f9)]=getAccessToken(this[_0x271b07(0x1ed)]||undefined),this['apiKey']=getAPIKey(this['activeProfile']||undefined);const _0x9d0596=typeof _0x3b6d0c[_0x271b07(0x22f)]===_0x271b07(0x1e6)?_0x3b6d0c[_0x271b07(0x22f)]:undefined;this[_0x271b07(0x22f)]=_0x9d0596||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x3737c4=getConfigDir(),_0x5d9a60=a61_0x6f20b4['join'](_0x3737c4,'sessions',this['sessionId']+_0x271b07(0x1ee)),_0x2cc255=findProjectConfigPath(),_0x487fd6=a61_0x6f20b4[_0x271b07(0x20c)](_0x3737c4,_0x271b07(0x1ef)),_0x4baca4=a61_0x6f20b4[_0x271b07(0x20c)](_0x3737c4,_0x271b07(0x1fc));let _0x46b7c1=null,_0xbde809=null;this[_0x271b07(0x1ed)]&&(_0x46b7c1=a61_0x6f20b4[_0x271b07(0x20c)](_0x3737c4,_0x271b07(0x219),this[_0x271b07(0x1ed)],_0x271b07(0x1ef)),_0xbde809=a61_0x6f20b4[_0x271b07(0x20c)](_0x3737c4,'profiles',this[_0x271b07(0x1ed)],_0x271b07(0x1fc))),this[_0x271b07(0x224)]={'session':a61_0x26ab68[_0x271b07(0x21a)](_0x5d9a60)?_0x5d9a60:null,'project':_0x2cc255,'profile':_0x46b7c1&&a61_0x26ab68[_0x271b07(0x21a)](_0x46b7c1)?_0x46b7c1:null,'profileCredentials':_0xbde809&&a61_0x26ab68[_0x271b07(0x21a)](_0xbde809)?_0xbde809:null,'global':a61_0x26ab68[_0x271b07(0x21a)](_0x487fd6)?_0x487fd6:null,'globalCredentials':a61_0x26ab68[_0x271b07(0x21a)](_0x4baca4)?_0x4baca4:null};}['getSource'](_0x1a5152,_0x3dbd01){const _0x387415=a61_0x33a1d8;if(!_0x3dbd01)return _0x387415(0x21b);const _0x5d8acd=_0x3dbd01;if(this['layers']['cliFlags'][_0x1a5152]===_0x5d8acd){if(_0x1a5152==='site'&&_0x5d8acd==='us01'&&!this['layers'][_0x387415(0x203)][_0x387415(0x220)]&&!this[_0x387415(0x210)][_0x387415(0x212)][_0x387415(0x220)]&&!this[_0x387415(0x210)][_0x387415(0x218)][_0x387415(0x220)]&&!this['layers'][_0x387415(0x1ea)][_0x387415(0x220)])return'default';return _0x387415(0x1f4)+_0x1a5152[_0x387415(0x202)](/_/g,'-');}if(this[_0x387415(0x210)][_0x387415(0x203)][_0x1a5152]===_0x5d8acd)return _0x387415(0x203);if(this[_0x387415(0x210)][_0x387415(0x212)][_0x1a5152]===_0x5d8acd)return'project';if(this['layers'][_0x387415(0x218)][_0x1a5152]===_0x5d8acd)return'profile:\x20'+this[_0x387415(0x1ed)];if(this[_0x387415(0x210)][_0x387415(0x1ea)][_0x1a5152]===_0x5d8acd)return _0x387415(0x1ea);return'default';}[a61_0x33a1d8(0x217)](){const _0x461917=a61_0x33a1d8,_0x2ee5fe=a61_0x6f20b4['join'](getConfigDir(),_0x461917(0x1ef));if(!a61_0x26ab68[_0x461917(0x21a)](_0x2ee5fe))return{};try{const _0x158ae2=a61_0x26ab68[_0x461917(0x20f)](_0x2ee5fe,'utf-8');return JSON[_0x461917(0x201)](_0x158ae2);}catch{return{};}}['injectIntoOptions'](_0x471f4c){const _0x48630c=a61_0x33a1d8;_0x471f4c[_0x48630c(0x220)]=this[_0x48630c(0x220)],!_0x471f4c[_0x48630c(0x1f5)]&&this[_0x48630c(0x1f5)]&&(_0x471f4c['database']=this[_0x48630c(0x1f5)]),!_0x471f4c[_0x48630c(0x200)]&&this['parent_segment']&&(_0x471f4c[_0x48630c(0x200)]=this[_0x48630c(0x1f3)]),!_0x471f4c[_0x48630c(0x22c)]&&this[_0x48630c(0x1ec)]&&(_0x471f4c[_0x48630c(0x22c)]=this[_0x48630c(0x1ec)]),!_0x471f4c[_0x48630c(0x213)]&&this[_0x48630c(0x216)]&&(_0x471f4c[_0x48630c(0x213)]=this[_0x48630c(0x216)]),!_0x471f4c[_0x48630c(0x1fa)]&&this[_0x48630c(0x214)]&&(_0x471f4c['llmAgent']=this[_0x48630c(0x214)]),!_0x471f4c[_0x48630c(0x205)]&&this[_0x48630c(0x223)]&&(_0x471f4c[_0x48630c(0x205)]=this[_0x48630c(0x223)]),!_0x471f4c[_0x48630c(0x222)]&&this[_0x48630c(0x204)]&&(_0x471f4c[_0x48630c(0x222)]=this[_0x48630c(0x204)]);}[a61_0x33a1d8(0x1fb)](){const _0x5cc705=a61_0x33a1d8;return[{'key':_0x5cc705(0x220),'value':this[_0x5cc705(0x220)]},{'key':_0x5cc705(0x1f5),'value':this[_0x5cc705(0x1f5)]},{'key':'parent_segment','value':this[_0x5cc705(0x1f3)]},{'key':'segment_path','value':this['segment_path']},{'key':_0x5cc705(0x216),'value':this[_0x5cc705(0x216)]},{'key':_0x5cc705(0x214),'value':this[_0x5cc705(0x214)]},{'key':'workflow_project','value':this[_0x5cc705(0x223)]},{'key':_0x5cc705(0x204),'value':this[_0x5cc705(0x204)]},{'key':_0x5cc705(0x218),'value':this[_0x5cc705(0x1ed)]||undefined}];}['display'](){const _0x2e78c8=a61_0x33a1d8;console['log'](a61_0x3d7474[_0x2e78c8(0x234)](_0x2e78c8(0x20a)));for(const {key:_0x3ec408,value:_0x33d81d}of this[_0x2e78c8(0x1fb)]()){_0x33d81d&&console['log'](a61_0x3d7474[_0x2e78c8(0x20d)](_0x3ec408)+':\x20'+_0x33d81d);}}['displayWithSources'](){const _0x36a064=a61_0x33a1d8;console['log'](a61_0x3d7474['bold']('[context]'));for(const {key:_0xcfd31e,value:_0x58c9bb}of this[_0x36a064(0x1fb)]()){if(_0x58c9bb){const _0x330e53=_0xcfd31e===_0x36a064(0x218)?_0x36a064(0x21c):'('+this['getSource'](_0xcfd31e,_0x58c9bb)+')';console[_0x36a064(0x1f7)](a61_0x3d7474[_0x36a064(0x20d)](_0xcfd31e)+':\x20'+_0x58c9bb+'\x20'+a61_0x3d7474[_0x36a064(0x211)](_0x330e53));}}console['log']('\x0a'+a61_0x3d7474[_0x36a064(0x234)](_0x36a064(0x1e8)));const _0x1bf9a5=[{'label':_0x36a064(0x22a),'path':this[_0x36a064(0x224)][_0x36a064(0x203)],'extra':'(session:\x20'+this[_0x36a064(0x1eb)]+')'},{'label':_0x36a064(0x215),'path':this['configFiles'][_0x36a064(0x212)]},{'label':_0x36a064(0x221),'path':this[_0x36a064(0x224)]['profile']},{'label':'Profile\x20Credentials','path':this[_0x36a064(0x224)][_0x36a064(0x233)]},{'label':_0x36a064(0x1e7),'path':this[_0x36a064(0x224)][_0x36a064(0x1ea)]},{'label':'Global\x20Credentials','path':this[_0x36a064(0x224)][_0x36a064(0x225)]}];for(const {label:_0x28785c,path:_0x1af10d,extra:_0x3fac8b}of _0x1bf9a5){if(_0x1af10d)console[_0x36a064(0x1f7)](a61_0x3d7474[_0x36a064(0x20d)](_0x28785c)+':\x20'+_0x1af10d+'\x20'+a61_0x3d7474['green']('✓')+(_0x3fac8b?'\x20'+a61_0x3d7474['dim'](_0x3fac8b):''));else{if(_0x28785c===_0x36a064(0x22a))console['log'](a61_0x3d7474[_0x36a064(0x20d)](_0x28785c)+':\x20'+a61_0x3d7474[_0x36a064(0x211)](_0x36a064(0x227))+'\x20'+a61_0x3d7474['dim'](_0x36a064(0x1f6)+this[_0x36a064(0x1eb)]+')'));else(_0x28785c==='Project'||_0x28785c===_0x36a064(0x1e7))&&console[_0x36a064(0x1f7)](a61_0x3d7474[_0x36a064(0x20d)](_0x28785c)+':\x20'+a61_0x3d7474[_0x36a064(0x211)](_0x36a064(0x227)));}}}async[a61_0x33a1d8(0x207)](){const _0x59d6ee=a61_0x33a1d8;if(!this[_0x59d6ee(0x1f9)]){const _0x55618a=await getOAuthTokens(this[_0x59d6ee(0x1ed)]||undefined);if(_0x55618a){const _0x1a2146=0x5*0x3c*0x3e8,_0x1b373e=!_0x55618a[_0x59d6ee(0x209)]||_0x55618a['expires_at']<Date[_0x59d6ee(0x21e)]()+_0x1a2146;if(_0x1b373e&&_0x55618a[_0x59d6ee(0x20e)])try{const _0x9d840f=getConsoleUrl(this[_0x59d6ee(0x220)]),_0x396d2f=await refreshAccessToken(_0x9d840f,_0x55618a['refresh_token']);await saveOAuthTokens(_0x396d2f,this[_0x59d6ee(0x1ed)]||undefined),this[_0x59d6ee(0x1f9)]=_0x396d2f[_0x59d6ee(0x22b)];}catch{this[_0x59d6ee(0x1f9)]=_0x55618a[_0x59d6ee(0x22b)];}else this[_0x59d6ee(0x1f9)]=_0x55618a[_0x59d6ee(0x22b)];return undefined;}}return this[_0x59d6ee(0x1f8)]=await getAPIKeyAsync(this[_0x59d6ee(0x220)],this[_0x59d6ee(0x1ed)]||undefined),this[_0x59d6ee(0x1f8)];}static async[a61_0x33a1d8(0x236)](_0xb7f795){const _0x491243=a61_0x33a1d8,_0x4cfb2e=new GlobalContext(_0xb7f795);return await _0x4cfb2e[_0x491243(0x207)](),_0x4cfb2e;}}
1
+ const a61_0xa27371=a61_0x2423;(function(_0x4b08d6,_0x4d886e){const _0x3d55bb=a61_0x2423,_0x58ca12=_0x4b08d6();while(!![]){try{const _0x37fc8b=parseInt(_0x3d55bb(0x77))/0x1*(-parseInt(_0x3d55bb(0xb4))/0x2)+-parseInt(_0x3d55bb(0x79))/0x3*(-parseInt(_0x3d55bb(0x82))/0x4)+-parseInt(_0x3d55bb(0xbb))/0x5*(parseInt(_0x3d55bb(0x9a))/0x6)+parseInt(_0x3d55bb(0x8f))/0x7*(-parseInt(_0x3d55bb(0xae))/0x8)+-parseInt(_0x3d55bb(0x8e))/0x9*(-parseInt(_0x3d55bb(0x95))/0xa)+parseInt(_0x3d55bb(0x99))/0xb+parseInt(_0x3d55bb(0x93))/0xc;if(_0x37fc8b===_0x4d886e)break;else _0x58ca12['push'](_0x58ca12['shift']());}catch(_0x3a8068){_0x58ca12['push'](_0x58ca12['shift']());}}}(a61_0x4b98,0x2b7ae));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.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 a61_0x1a1753 from'node:fs';import*as a61_0x5eaffc from'node:path';function a61_0x2423(_0x2c0335,_0x1eb959){_0x2c0335=_0x2c0335-0x75;const _0x4b98db=a61_0x4b98();let _0x2423fa=_0x4b98db[_0x2c0335];return _0x2423fa;}import a61_0x5d2284 from'chalk';export class GlobalContext{[a61_0xa27371(0x97)];[a61_0xa27371(0x9d)];['parent_segment'];[a61_0xa27371(0xb7)];[a61_0xa27371(0x90)];[a61_0xa27371(0xa5)];[a61_0xa27371(0xc2)];[a61_0xa27371(0xba)];[a61_0xa27371(0xa1)];['accessToken'];['proxy'];[a61_0xa27371(0x87)];[a61_0xa27371(0xcc)];['profile'];[a61_0xa27371(0xb6)]=null;['layers'];['activeProfile'];[a61_0xa27371(0xaf)];['configFiles'];constructor(_0xba7a6e){const _0x243640=a61_0xa27371;this[_0x243640(0xaf)]=getSessionID(_0xba7a6e[_0x243640(0x7f)]);const _0x35963d=loadSessionContext(_0xba7a6e[_0x243640(0x7f)]),_0x1608dc=loadProjectConfig(),_0x51a823=this[_0x243640(0xbe)]();if(_0xba7a6e[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0xba7a6e[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0x80);else{if(_0x35963d?.[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0x35963d[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0x7f);else{if(_0x51a823[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0x51a823[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0xb1);else process.env.TDX_PROFILE?(this[_0x243640(0xa0)]=process.env.TDX_PROFILE,this[_0x243640(0xb6)]='env'):(this[_0x243640(0xa0)]=null,this['profileSource']=null);}}const _0x88785e=this[_0x243640(0xa0)]?loadProfile(this[_0x243640(0xa0)]):null,_0x45cd54=_0x3709cb=>{const _0x523b59=_0x243640;if(!_0x3709cb)return{};const _0x3fcf29=_0x3709cb,_0x22e880={};for(const [_0x3c3618,_0x32e18e]of Object[_0x523b59(0xcb)](_0x3fcf29)){typeof _0x32e18e===_0x523b59(0xb0)&&(_0x22e880[_0x3c3618]=_0x32e18e);}return _0x22e880;},_0x2d488f={},_0x4ba5a6=(_0x2d95fd,_0x515c27,_0x28e541)=>{const _0x2c3f09=_0x243640;if(!_0x2d95fd)return![];if(_0x28e541&&_0x2d95fd===_0x28e541)return![];const _0x14d5ed=_0x35963d,_0x5de4ea=_0x1608dc,_0x31e67d=_0x88785e?.[_0x2c3f09(0xb1)],_0x75c66f=_0x51a823,_0x50e513=_0x14d5ed?.[_0x515c27],_0x385a82=_0x5de4ea?.[_0x515c27],_0x122763=_0x31e67d?.[_0x515c27],_0x3ff9b2=_0x75c66f[_0x515c27];return _0x2d95fd!==_0x50e513&&_0x2d95fd!==_0x385a82&&_0x2d95fd!==_0x122763&&_0x2d95fd!==_0x3ff9b2;},_0x5cee9d=[{'optionKey':_0x243640(0x97),'contextKey':_0x243640(0x97),'defaultValue':_0x243640(0xa6)},{'optionKey':_0x243640(0x9d),'contextKey':_0x243640(0x9d)},{'optionKey':'parentSegment','contextKey':'parent_segment'},{'optionKey':_0x243640(0xa7),'contextKey':_0x243640(0x90)},{'optionKey':_0x243640(0x9b),'contextKey':_0x243640(0xa5)},{'optionKey':_0x243640(0xa9),'contextKey':'composable_audience'},{'optionKey':_0x243640(0x8c),'contextKey':_0x243640(0x8c)}];for(const {optionKey:_0x58fcb5,contextKey:_0x121573,defaultValue:_0x4363e7}of _0x5cee9d){const _0xd0043f=_0xba7a6e[_0x58fcb5];_0x4ba5a6(_0xd0043f,_0x121573,_0x4363e7)&&(_0x2d488f[_0x121573]=_0xd0043f);}this[_0x243640(0x85)]={'cliFlags':_0x2d488f,'session':_0x45cd54(_0x35963d),'project':_0x45cd54(_0x1608dc),'profile':_0x45cd54(_0x88785e?.['config']),'global':_0x45cd54(_0x51a823)};const _0x29fde9={...this[_0x243640(0x85)][_0x243640(0xc0)],...this[_0x243640(0x85)]['profile'],...this['layers'][_0x243640(0xcd)]};process.env.TDX_SITE&&!this[_0x243640(0x85)][_0x243640(0x7f)][_0x243640(0x97)]&&!this[_0x243640(0x85)][_0x243640(0x7e)]['site']&&(_0x29fde9[_0x243640(0x97)]=process.env.TDX_SITE);Object[_0x243640(0xb9)](_0x29fde9,this[_0x243640(0x85)][_0x243640(0x7f)]),Object[_0x243640(0xb9)](_0x29fde9,this['layers'][_0x243640(0x7e)]);const _0x32331d=_0x29fde9[_0x243640(0x97)]||_0x243640(0xa6);this['site']=resolveSite(_0x32331d),this[_0x243640(0x9d)]=_0x29fde9[_0x243640(0x9d)],this[_0x243640(0x86)]=_0x29fde9[_0x243640(0x86)],this[_0x243640(0xb7)]=_0x29fde9[_0x243640(0xb7)],this[_0x243640(0x90)]=_0x29fde9[_0x243640(0x90)],this[_0x243640(0xa5)]=_0x29fde9[_0x243640(0xa5)],this[_0x243640(0xc2)]=_0x29fde9['workflow_project'],this[_0x243640(0xba)]=_0x29fde9[_0x243640(0xba)],this[_0x243640(0x87)]=_0xba7a6e[_0x243640(0x87)]||![],this[_0x243640(0xcc)]=_0xba7a6e[_0x243640(0xcc)]??LogLevel[_0x243640(0x84)],this[_0x243640(0x8c)]=this[_0x243640(0xa0)]||undefined,this[_0x243640(0x89)]=getAccessToken(this['activeProfile']||undefined),this[_0x243640(0xa1)]=getAPIKey(this[_0x243640(0xa0)]||undefined);const _0x3ff33e=typeof _0x51a823['proxy']===_0x243640(0xb0)?_0x51a823[_0x243640(0x76)]:undefined;this[_0x243640(0x76)]=_0x3ff33e||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x12f5df=getConfigDir(),_0x43b9c1=a61_0x5eaffc['join'](_0x12f5df,_0x243640(0x98),this['sessionId']+_0x243640(0xad)),_0x3a5ab3=findProjectConfigPath(),_0x6d65=a61_0x5eaffc['join'](_0x12f5df,_0x243640(0x9f)),_0x2d60d4=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,_0x243640(0x8b));let _0x561764=null,_0x58194a=null;this[_0x243640(0xa0)]&&(_0x561764=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,'profiles',this[_0x243640(0xa0)],_0x243640(0x9f)),_0x58194a=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,'profiles',this[_0x243640(0xa0)],_0x243640(0x8b))),this[_0x243640(0x78)]={'session':a61_0x1a1753['existsSync'](_0x43b9c1)?_0x43b9c1:null,'project':_0x3a5ab3,'profile':_0x561764&&a61_0x1a1753[_0x243640(0x81)](_0x561764)?_0x561764:null,'profileCredentials':_0x58194a&&a61_0x1a1753[_0x243640(0x81)](_0x58194a)?_0x58194a:null,'global':a61_0x1a1753[_0x243640(0x81)](_0x6d65)?_0x6d65:null,'globalCredentials':a61_0x1a1753[_0x243640(0x81)](_0x2d60d4)?_0x2d60d4:null};}[a61_0xa27371(0xa3)](_0xe22462,_0x57e191){const _0x5a016b=a61_0xa27371;if(!_0x57e191)return'not\x20set';const _0x583039=_0x57e191;if(this[_0x5a016b(0x85)][_0x5a016b(0x7e)][_0xe22462]===_0x583039){if(_0xe22462===_0x5a016b(0x97)&&_0x583039===_0x5a016b(0xa6)&&!this[_0x5a016b(0x85)][_0x5a016b(0x7f)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0xcd)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0x8c)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0xc0)][_0x5a016b(0x97)])return _0x5a016b(0x8a);return _0x5a016b(0x7d)+_0xe22462[_0x5a016b(0x75)](/_/g,'-');}if(this['layers']['session'][_0xe22462]===_0x583039)return _0x5a016b(0x7f);if(this['layers'][_0x5a016b(0xcd)][_0xe22462]===_0x583039)return _0x5a016b(0xcd);if(this['layers'][_0x5a016b(0x8c)][_0xe22462]===_0x583039)return _0x5a016b(0x7c)+this['activeProfile'];if(this[_0x5a016b(0x85)][_0x5a016b(0xc0)][_0xe22462]===_0x583039)return _0x5a016b(0xc0);return'default';}['loadGlobalConfig'](){const _0x147197=a61_0xa27371,_0xc2825b=a61_0x5eaffc[_0x147197(0xc4)](getConfigDir(),'tdx.json');if(!a61_0x1a1753[_0x147197(0x81)](_0xc2825b))return{};try{const _0x342b85=a61_0x1a1753[_0x147197(0xa8)](_0xc2825b,_0x147197(0xab));return JSON[_0x147197(0x7b)](_0x342b85);}catch{return{};}}[a61_0xa27371(0x96)](_0x2d36a7){const _0x2c0ae5=a61_0xa27371;_0x2d36a7[_0x2c0ae5(0x97)]=this['site'],!_0x2d36a7[_0x2c0ae5(0x9d)]&&this[_0x2c0ae5(0x9d)]&&(_0x2d36a7[_0x2c0ae5(0x9d)]=this[_0x2c0ae5(0x9d)]),!_0x2d36a7[_0x2c0ae5(0xb2)]&&this[_0x2c0ae5(0x86)]&&(_0x2d36a7['parentSegment']=this[_0x2c0ae5(0x86)]),!_0x2d36a7[_0x2c0ae5(0xac)]&&this[_0x2c0ae5(0xb7)]&&(_0x2d36a7[_0x2c0ae5(0xac)]=this[_0x2c0ae5(0xb7)]),!_0x2d36a7['llmProject']&&this[_0x2c0ae5(0x90)]&&(_0x2d36a7['llmProject']=this[_0x2c0ae5(0x90)]),!_0x2d36a7[_0x2c0ae5(0x9b)]&&this[_0x2c0ae5(0xa5)]&&(_0x2d36a7[_0x2c0ae5(0x9b)]=this[_0x2c0ae5(0xa5)]),!_0x2d36a7['workflowProject']&&this['workflow_project']&&(_0x2d36a7[_0x2c0ae5(0xc3)]=this[_0x2c0ae5(0xc2)]),!_0x2d36a7[_0x2c0ae5(0xa9)]&&this[_0x2c0ae5(0xba)]&&(_0x2d36a7['composableAudience']=this[_0x2c0ae5(0xba)]);}[a61_0xa27371(0xa2)](){const _0x3c7e11=a61_0xa27371;return[{'key':_0x3c7e11(0x97),'value':this['site']},{'key':'database','value':this[_0x3c7e11(0x9d)]},{'key':_0x3c7e11(0x86),'value':this['parent_segment']},{'key':_0x3c7e11(0xb7),'value':this['segment_path']},{'key':_0x3c7e11(0x90),'value':this[_0x3c7e11(0x90)]},{'key':_0x3c7e11(0xa5),'value':this[_0x3c7e11(0xa5)]},{'key':_0x3c7e11(0xc2),'value':this[_0x3c7e11(0xc2)]},{'key':_0x3c7e11(0xba),'value':this['composable_audience']},{'key':_0x3c7e11(0x8c),'value':this[_0x3c7e11(0xa0)]||undefined}];}[a61_0xa27371(0x94)](){const _0x44f235=a61_0xa27371;console['log'](a61_0x5d2284[_0x44f235(0xbf)]('[context]'));for(const {key:_0x357906,value:_0x106ad3}of this[_0x44f235(0xa2)]()){_0x106ad3&&console[_0x44f235(0xb3)](a61_0x5d2284[_0x44f235(0xc9)](_0x357906)+':\x20'+_0x106ad3);}}[a61_0xa27371(0x88)](){const _0x4ec3cb=a61_0xa27371;console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xbf)](_0x4ec3cb(0xca)));for(const {key:_0x564e17,value:_0x3c86fe}of this[_0x4ec3cb(0xa2)]()){if(_0x3c86fe){const _0x5d3c2e=_0x564e17===_0x4ec3cb(0x8c)?_0x4ec3cb(0x9e):'('+this[_0x4ec3cb(0xa3)](_0x564e17,_0x3c86fe)+')';console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x564e17)+':\x20'+_0x3c86fe+'\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x5d3c2e));}}console[_0x4ec3cb(0xb3)]('\x0a'+a61_0x5d2284[_0x4ec3cb(0xbf)](_0x4ec3cb(0x7a)));const _0x5a8bcc=[{'label':_0x4ec3cb(0xb8),'path':this[_0x4ec3cb(0x78)]['session'],'extra':'(session:\x20'+this[_0x4ec3cb(0xaf)]+')'},{'label':'Project','path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xcd)]},{'label':'Profile','path':this[_0x4ec3cb(0x78)]['profile']},{'label':_0x4ec3cb(0x83),'path':this['configFiles'][_0x4ec3cb(0xbc)]},{'label':_0x4ec3cb(0x91),'path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xc0)]},{'label':_0x4ec3cb(0x92),'path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xc8)]}];for(const {label:_0x153832,path:_0x488a92,extra:_0x589ba9}of _0x5a8bcc){if(_0x488a92)console['log'](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x153832)+':\x20'+_0x488a92+'\x20'+a61_0x5d2284[_0x4ec3cb(0xc7)]('✓')+(_0x589ba9?'\x20'+a61_0x5d2284['dim'](_0x589ba9):''));else{if(_0x153832===_0x4ec3cb(0xb8))console[_0x4ec3cb(0xb3)](a61_0x5d2284['cyan'](_0x153832)+':\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x4ec3cb(0xb5))+'\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x4ec3cb(0xc5)+this[_0x4ec3cb(0xaf)]+')'));else(_0x153832===_0x4ec3cb(0x8d)||_0x153832===_0x4ec3cb(0x91))&&console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x153832)+':\x20'+a61_0x5d2284['dim'](_0x4ec3cb(0xb5)));}}}async[a61_0xa27371(0xa4)](){const _0x3dcc81=a61_0xa27371;if(!this[_0x3dcc81(0x89)]){const _0x4d11dd=await getOAuthTokens(this[_0x3dcc81(0xa0)]||undefined);if(_0x4d11dd){const _0x440a26=0x5*0x3c*0x3e8,_0x13eff2=!_0x4d11dd[_0x3dcc81(0xaa)]||_0x4d11dd[_0x3dcc81(0xaa)]<Date['now']()+_0x440a26;if(_0x13eff2&&_0x4d11dd[_0x3dcc81(0xc1)])try{const _0x403b85=getConsoleUrl(this['site']),_0x45bbdc=await refreshAccessToken(_0x403b85,_0x4d11dd[_0x3dcc81(0xc1)]);await saveOAuthTokens(_0x45bbdc,this[_0x3dcc81(0xa0)]||undefined),this['accessToken']=_0x45bbdc[_0x3dcc81(0xbd)];}catch{this[_0x3dcc81(0x89)]=_0x4d11dd[_0x3dcc81(0xbd)];}else this[_0x3dcc81(0x89)]=_0x4d11dd[_0x3dcc81(0xbd)];return undefined;}}return this['apiKey']=await getAPIKeyAsync(this[_0x3dcc81(0x97)],this[_0x3dcc81(0xa0)]||undefined),this[_0x3dcc81(0xa1)];}static async[a61_0xa27371(0xc6)](_0x3fd792){const _0x1f01f2=a61_0xa27371,_0x1f9979=new GlobalContext(_0x3fd792);return await _0x1f9979[_0x1f01f2(0xa4)](),_0x1f9979;}}function a61_0x4b98(){const _0x335dc1=['activeProfile','apiKey','getParameters','getSource','resolveAPIKeyAsync','llm_agent','us01','llmProject','readFileSync','composableAudience','expires_at','utf-8','segmentPath','.json','24hUpAPP','sessionId','string','config','parentSegment','log','97442GdpUKE','none','profileSource','segment_path','Session','assign','composable_audience','547270ciySXj','profileCredentials','access_token','loadGlobalConfig','bold','global','refresh_token','workflow_project','workflowProject','join','(using\x20session:\x20','createAsync','green','globalCredentials','cyan','[context]','entries','logLevel','project','replace','proxy','1erbXtT','configFiles','259206fYPofV','[configuration\x20files]','parse','profile:\x20','CLI\x20flag:\x20--','cliFlags','session','cli','existsSync','16zwCVsQ','Profile\x20Credentials','INFO','layers','parent_segment','verbose','displayWithSources','accessToken','default','.env','profile','Project','2000763PtUBoS','737233oCCkCb','llm_project','Global','Global\x20Credentials','818208NFygWT','display','10ucQgLA','injectIntoOptions','site','sessions','2585385VbQDJt','18DYITJR','llmAgent','dim','database','(active)','tdx.json'];a61_0x4b98=function(){return _0x335dc1;};return a61_0x4b98();}
@@ -1 +1 @@
1
- const a62_0xacf82a=a62_0x416c;(function(_0x2de2b6,_0x3b4e3e){const _0x5afe14=a62_0x416c,_0x99630c=_0x2de2b6();while(!![]){try{const _0xc1b67e=parseInt(_0x5afe14(0xd1))/0x1+parseInt(_0x5afe14(0xe9))/0x2*(parseInt(_0x5afe14(0xd5))/0x3)+-parseInt(_0x5afe14(0xec))/0x4*(-parseInt(_0x5afe14(0xdc))/0x5)+parseInt(_0x5afe14(0xd2))/0x6+parseInt(_0x5afe14(0xd9))/0x7*(-parseInt(_0x5afe14(0xe2))/0x8)+-parseInt(_0x5afe14(0xe4))/0x9*(-parseInt(_0x5afe14(0xe3))/0xa)+-parseInt(_0x5afe14(0xd8))/0xb;if(_0xc1b67e===_0x3b4e3e)break;else _0x99630c['push'](_0x99630c['shift']());}catch(_0x621900){_0x99630c['push'](_0x99630c['shift']());}}}(a62_0x45ac,0xecd23));const SERVICE_NAME=a62_0xacf82a(0xd4);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0xf9ef3b=a62_0xacf82a;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x4cbedf=await import('@napi-rs/keyring');return EntryClass=_0x4cbedf[_0xf9ef3b(0xee)],EntryClass;}catch(_0x29c1fb){return keyringLoadError=_0x29c1fb instanceof Error?_0x29c1fb:new Error(String(_0x29c1fb)),null;}}function a62_0x45ac(){const _0x2c2b8f=['System\x20keychain\x20is\x20not\x20available','toLowerCase','deleteCredential','reason','access_denied','-25300','93713jOVxwH','6054348AJsJcC','restricted','tdx','365487ejtoDd','profile:','could\x20not\x20be\x20found','23023572BJueHs','672EwGIsN','includes','message','5piRzNz','unavailable','not\x20supported','Warning:\x20','-25293','success','55576pPTuEf','10237340ORwWdv','9CvXzVJ','no\x20matching\x20entry','not_found','access','not\x20found','26IYebEH','getPassword','cannot\x20find','78804PYxbEz','error','Entry'];a62_0x45ac=function(){return _0x2c2b8f;};return a62_0x45ac();}function getAccountName(_0x436139){const _0x32c54f=a62_0xacf82a,_0x1675ca=_0x436139||'';return _0x32c54f(0xd6)+_0x1675ca+':api_key';}function a62_0x416c(_0x209de8,_0x4cd264){_0x209de8=_0x209de8-0xcd;const _0x45ac64=a62_0x45ac();let _0x416c6f=_0x45ac64[_0x209de8];return _0x416c6f;}export async function getKeychainAPIKey(_0x20d641){const _0x4c3bf9=a62_0xacf82a,_0x12b619=await getKeychainAPIKeyWithStatus(_0x20d641);if(_0x12b619[_0x4c3bf9(0xe1)])return _0x12b619['value'];return _0x12b619[_0x4c3bf9(0xce)]===_0x4c3bf9(0xcf)&&console[_0x4c3bf9(0xed)](_0x4c3bf9(0xdf)+_0x12b619[_0x4c3bf9(0xdb)]),null;}export async function getKeychainAPIKeyWithStatus(_0x43f096){const _0x5771a9=a62_0xacf82a;try{const _0x5ede14=await getEntryClass();if(!_0x5ede14)return{'success':![],'reason':_0x5771a9(0xdd)};const _0x1684e5=getAccountName(_0x43f096),_0xcd83c2=new _0x5ede14(SERVICE_NAME,_0x1684e5),_0x21f596=_0xcd83c2[_0x5771a9(0xea)]();if(_0x21f596)return{'success':!![],'value':_0x21f596};return{'success':![],'reason':_0x5771a9(0xe6)};}catch(_0x42cc68){const _0x4ef270=_0x42cc68 instanceof Error?_0x42cc68[_0x5771a9(0xdb)]:String(_0x42cc68);if(_0x4ef270[_0x5771a9(0xda)](_0x5771a9(0xd0))||_0x4ef270[_0x5771a9(0xf0)]()['includes'](_0x5771a9(0xd7))||_0x4ef270[_0x5771a9(0xf0)]()[_0x5771a9(0xda)](_0x5771a9(0xe8))||_0x4ef270['toLowerCase']()[_0x5771a9(0xda)](_0x5771a9(0xe5)))return{'success':![],'reason':_0x5771a9(0xe6)};if(_0x4ef270[_0x5771a9(0xda)](_0x5771a9(0xe0))||_0x4ef270[_0x5771a9(0xf0)]()[_0x5771a9(0xda)](_0x5771a9(0xd3))||_0x4ef270['toLowerCase']()[_0x5771a9(0xda)](_0x5771a9(0xe7)))return{'success':![],'reason':_0x5771a9(0xcf),'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':_0x5771a9(0xdd),'message':_0x4ef270};}}export async function saveKeychainAPIKey(_0x2ea67f,_0x5cd716){const _0x236855=a62_0xacf82a,_0x28cfe4=await getEntryClass();if(!_0x28cfe4)throw new Error(_0x236855(0xef));const _0x44fdb2=getAccountName(_0x5cd716),_0x17e19d=new _0x28cfe4(SERVICE_NAME,_0x44fdb2);_0x17e19d['setPassword'](_0x2ea67f);}export async function deleteKeychainAPIKey(_0x41b950){const _0x496d2c=a62_0xacf82a;try{const _0x166185=await getEntryClass();if(!_0x166185)return![];const _0x501cea=getAccountName(_0x41b950),_0x1d19df=new _0x166185(SERVICE_NAME,_0x501cea);return _0x1d19df[_0x496d2c(0xcd)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x2c3d43=a62_0xacf82a;try{const _0x3c51a4=await getEntryClass();if(!_0x3c51a4)return![];const _0xd809aa=new _0x3c51a4(SERVICE_NAME,'__keychain_test__');return _0xd809aa[_0x2c3d43(0xea)](),!![];}catch(_0x77b17d){const _0x14583c=_0x77b17d instanceof Error?_0x77b17d[_0x2c3d43(0xdb)][_0x2c3d43(0xf0)]():'';if(_0x14583c[_0x2c3d43(0xda)]('not\x20available')||_0x14583c['includes'](_0x2c3d43(0xde))||_0x14583c['includes'](_0x2c3d43(0xeb)))return![];return!![];}}
1
+ const a62_0x1e7027=a62_0x4820;(function(_0x4bc64a,_0x5a86c6){const _0xb21567=a62_0x4820,_0x55da2c=_0x4bc64a();while(!![]){try{const _0x4f49ec=-parseInt(_0xb21567(0x93))/0x1+-parseInt(_0xb21567(0x86))/0x2+parseInt(_0xb21567(0x90))/0x3+parseInt(_0xb21567(0x8a))/0x4+parseInt(_0xb21567(0x99))/0x5+parseInt(_0xb21567(0x83))/0x6+-parseInt(_0xb21567(0x7d))/0x7*(parseInt(_0xb21567(0x80))/0x8);if(_0x4f49ec===_0x5a86c6)break;else _0x55da2c['push'](_0x55da2c['shift']());}catch(_0xcdb2f7){_0x55da2c['push'](_0x55da2c['shift']());}}}(a62_0x4e2f,0x9ecfe));const SERVICE_NAME=a62_0x1e7027(0x7f);function a62_0x4e2f(){const _0x4afa17=['8FHWyzL','-25300',':api_key','7322790tNFmXz','@napi-rs/keyring','error','1158958BRdLjB','value','unavailable','includes','4443288CJniyx','access','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.','success','toLowerCase','System\x20keychain\x20is\x20not\x20available','1194456QydJcm','message','deleteCredential','1162396FvvRAR','could\x20not\x20be\x20found','Warning:\x20','not\x20supported','profile:','not\x20found','2536135NrTPuE','__keychain_test__','getPassword','5910079PmsltQ','access_denied','tdx'];a62_0x4e2f=function(){return _0x4afa17;};return a62_0x4e2f();}let EntryClass=null,keyringLoadError=null;function a62_0x4820(_0x3d330d,_0x3ce117){_0x3d330d=_0x3d330d-0x7d;const _0x4e2f9e=a62_0x4e2f();let _0x48208e=_0x4e2f9e[_0x3d330d];return _0x48208e;}async function getEntryClass(){const _0x1eafbd=a62_0x1e7027;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x4fa66f=await import(_0x1eafbd(0x84));return EntryClass=_0x4fa66f['Entry'],EntryClass;}catch(_0x3f3449){return keyringLoadError=_0x3f3449 instanceof Error?_0x3f3449:new Error(String(_0x3f3449)),null;}}function getAccountName(_0x449386){const _0x4cbef8=a62_0x1e7027,_0xef3ac2=_0x449386||'';return _0x4cbef8(0x97)+_0xef3ac2+_0x4cbef8(0x82);}export async function getKeychainAPIKey(_0x31d26b){const _0x6850a6=a62_0x1e7027,_0x20c3c2=await getKeychainAPIKeyWithStatus(_0x31d26b);if(_0x20c3c2[_0x6850a6(0x8d)])return _0x20c3c2[_0x6850a6(0x87)];return _0x20c3c2['reason']===_0x6850a6(0x7e)&&console[_0x6850a6(0x85)](_0x6850a6(0x95)+_0x20c3c2[_0x6850a6(0x91)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3652be){const _0x1ac98d=a62_0x1e7027;try{const _0xcd882a=await getEntryClass();if(!_0xcd882a)return{'success':![],'reason':'unavailable'};const _0x6d8a23=getAccountName(_0x3652be),_0xe5aa2c=new _0xcd882a(SERVICE_NAME,_0x6d8a23),_0x1c6b0e=_0xe5aa2c['getPassword']();if(_0x1c6b0e)return{'success':!![],'value':_0x1c6b0e};return{'success':![],'reason':'not_found'};}catch(_0x2c8fc3){const _0x3a17bb=_0x2c8fc3 instanceof Error?_0x2c8fc3[_0x1ac98d(0x91)]:String(_0x2c8fc3);if(_0x3a17bb[_0x1ac98d(0x89)](_0x1ac98d(0x81))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x94))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x98))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)]('no\x20matching\x20entry'))return{'success':![],'reason':'not_found'};if(_0x3a17bb[_0x1ac98d(0x89)]('-25293')||_0x3a17bb[_0x1ac98d(0x8e)]()['includes']('restricted')||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x8b)))return{'success':![],'reason':_0x1ac98d(0x7e),'message':_0x1ac98d(0x8c)};return{'success':![],'reason':_0x1ac98d(0x88),'message':_0x3a17bb};}}export async function saveKeychainAPIKey(_0x2d312e,_0x47b2ca){const _0x4c3958=a62_0x1e7027,_0x5b7b96=await getEntryClass();if(!_0x5b7b96)throw new Error(_0x4c3958(0x8f));const _0x3a275a=getAccountName(_0x47b2ca),_0x223eae=new _0x5b7b96(SERVICE_NAME,_0x3a275a);_0x223eae['setPassword'](_0x2d312e);}export async function deleteKeychainAPIKey(_0x4a9db9){const _0x293733=a62_0x1e7027;try{const _0x34932d=await getEntryClass();if(!_0x34932d)return![];const _0x384f62=getAccountName(_0x4a9db9),_0x3d5351=new _0x34932d(SERVICE_NAME,_0x384f62);return _0x3d5351[_0x293733(0x92)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x3dd301=a62_0x1e7027;try{const _0x263d7c=await getEntryClass();if(!_0x263d7c)return![];const _0x39f8b8=new _0x263d7c(SERVICE_NAME,_0x3dd301(0x9a));return _0x39f8b8[_0x3dd301(0x9b)](),!![];}catch(_0x31f3f1){const _0x2e0330=_0x31f3f1 instanceof Error?_0x31f3f1[_0x3dd301(0x91)]['toLowerCase']():'';if(_0x2e0330[_0x3dd301(0x89)]('not\x20available')||_0x2e0330[_0x3dd301(0x89)](_0x3dd301(0x96))||_0x2e0330[_0x3dd301(0x89)]('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- const a63_0x40b9a3=a63_0x47b9;(function(_0x8065ec,_0x2cd2b5){const _0x46fa66=a63_0x47b9,_0x44c369=_0x8065ec();while(!![]){try{const _0x23dae1=-parseInt(_0x46fa66(0xf5))/0x1+-parseInt(_0x46fa66(0xea))/0x2+-parseInt(_0x46fa66(0xf7))/0x3*(-parseInt(_0x46fa66(0xf3))/0x4)+-parseInt(_0x46fa66(0xf1))/0x5+-parseInt(_0x46fa66(0xf0))/0x6+parseInt(_0x46fa66(0xf6))/0x7+parseInt(_0x46fa66(0xe9))/0x8*(parseInt(_0x46fa66(0xef))/0x9);if(_0x23dae1===_0x2cd2b5)break;else _0x44c369['push'](_0x44c369['shift']());}catch(_0x19f36c){_0x44c369['push'](_0x44c369['shift']());}}}(a63_0x15ec,0xa82f8));const SERVICE_NAME=a63_0x40b9a3(0xf2);function a63_0x15ec(){const _0x654a49=['6856728csJHpL','1821585nmEYDO','tdx','1769924GQcASi','getPassword','957338kKEhjH','3232915RllChl','6pyXcDd','Entry','deleteCredential','46672bFInRg','1264176bFXMSJ','setPassword',':oauth_tokens','@napi-rs/keyring','System\x20keychain\x20is\x20not\x20available','3762loxZYw'];a63_0x15ec=function(){return _0x654a49;};return a63_0x15ec();}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x3dcd3e=a63_0x40b9a3;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x12c075=await import(_0x3dcd3e(0xed));return EntryClass=_0x12c075[_0x3dcd3e(0xf8)],EntryClass;}catch(_0x1356cd){return keyringLoadError=_0x1356cd instanceof Error?_0x1356cd:new Error(String(_0x1356cd)),null;}}function getOAuthAccountName(_0x502b94){const _0x4bc438=a63_0x40b9a3,_0x44b075=_0x502b94||'';return'profile:'+_0x44b075+_0x4bc438(0xec);}function a63_0x47b9(_0x1abb17,_0x413370){_0x1abb17=_0x1abb17-0xe8;const _0x15ec13=a63_0x15ec();let _0x47b97c=_0x15ec13[_0x1abb17];return _0x47b97c;}export async function saveOAuthTokens(_0x4be90a,_0x20e78b){const _0x4aa4f=a63_0x40b9a3,_0x5aa7c3=await getEntryClass();if(!_0x5aa7c3)throw new Error(_0x4aa4f(0xee));const _0x2cfc97=getOAuthAccountName(_0x20e78b),_0x22b5a4=new _0x5aa7c3(SERVICE_NAME,_0x2cfc97);_0x22b5a4[_0x4aa4f(0xeb)](JSON['stringify'](_0x4be90a));}export async function getOAuthTokens(_0x4efb1a){const _0x5cfa3d=a63_0x40b9a3;try{const _0x35e84d=await getEntryClass();if(!_0x35e84d)return null;const _0x5432bb=getOAuthAccountName(_0x4efb1a),_0x581776=new _0x35e84d(SERVICE_NAME,_0x5432bb),_0x4bb3fd=_0x581776[_0x5cfa3d(0xf4)]();if(_0x4bb3fd)return JSON['parse'](_0x4bb3fd);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x558671){const _0x2b29e7=a63_0x40b9a3;try{const _0x4cf424=await getEntryClass();if(!_0x4cf424)return![];const _0x405bea=getOAuthAccountName(_0x558671),_0x2582c1=new _0x4cf424(SERVICE_NAME,_0x405bea);return _0x2582c1[_0x2b29e7(0xe8)](),!![];}catch{return![];}}
1
+ const a63_0x11371d=a63_0x2cc7;function a63_0x5daf(){const _0x1f47bc=['478110ifyjmD','1849377jhOKmB','4JgXMUk','@napi-rs/keyring','getPassword','6vtyjlt','profile:','tdx','setPassword','17830LgRTJN','System\x20keychain\x20is\x20not\x20available','1562463xoYZql','6150053xwPTPL','2355305sUASKF','916400MizjkG','deleteCredential'];a63_0x5daf=function(){return _0x1f47bc;};return a63_0x5daf();}(function(_0x38a68d,_0x2713bb){const _0x34d034=a63_0x2cc7,_0x213ef0=_0x38a68d();while(!![]){try{const _0xcbab0f=-parseInt(_0x34d034(0x9c))/0x1+parseInt(_0x34d034(0xa5))/0x2+parseInt(_0x34d034(0x9d))/0x3*(parseInt(_0x34d034(0x9e))/0x4)+-parseInt(_0x34d034(0xa9))/0x5+-parseInt(_0x34d034(0xa1))/0x6*(-parseInt(_0x34d034(0xa8))/0x7)+parseInt(_0x34d034(0x9a))/0x8+-parseInt(_0x34d034(0xa7))/0x9;if(_0xcbab0f===_0x2713bb)break;else _0x213ef0['push'](_0x213ef0['shift']());}catch(_0x378d8b){_0x213ef0['push'](_0x213ef0['shift']());}}}(a63_0x5daf,0x7906d));function a63_0x2cc7(_0x4eb48e,_0x4cfab8){_0x4eb48e=_0x4eb48e-0x9a;const _0x5dafe9=a63_0x5daf();let _0x2cc78c=_0x5dafe9[_0x4eb48e];return _0x2cc78c;}const SERVICE_NAME=a63_0x11371d(0xa3);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2388ed=a63_0x11371d;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x5446b6=await import(_0x2388ed(0x9f));return EntryClass=_0x5446b6['Entry'],EntryClass;}catch(_0x2d5ab5){return keyringLoadError=_0x2d5ab5 instanceof Error?_0x2d5ab5:new Error(String(_0x2d5ab5)),null;}}function getOAuthAccountName(_0x5c9ff7){const _0x5dc96a=a63_0x11371d,_0x592fa8=_0x5c9ff7||'';return _0x5dc96a(0xa2)+_0x592fa8+':oauth_tokens';}export async function saveOAuthTokens(_0x5a4c24,_0x4edcdf){const _0x53261e=a63_0x11371d,_0x375aa0=await getEntryClass();if(!_0x375aa0)throw new Error(_0x53261e(0xa6));const _0x4e732=getOAuthAccountName(_0x4edcdf),_0x50e543=new _0x375aa0(SERVICE_NAME,_0x4e732);_0x50e543[_0x53261e(0xa4)](JSON['stringify'](_0x5a4c24));}export async function getOAuthTokens(_0x4f4687){const _0x439805=a63_0x11371d;try{const _0x1c7afc=await getEntryClass();if(!_0x1c7afc)return null;const _0x208afb=getOAuthAccountName(_0x4f4687),_0x2103f2=new _0x1c7afc(SERVICE_NAME,_0x208afb),_0x3ad94f=_0x2103f2[_0x439805(0xa0)]();if(_0x3ad94f)return JSON['parse'](_0x3ad94f);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x3618ca){const _0x1d67f3=a63_0x11371d;try{const _0x309c85=await getEntryClass();if(!_0x309c85)return![];const _0x31abb0=getOAuthAccountName(_0x3618ca),_0x4478b0=new _0x309c85(SERVICE_NAME,_0x31abb0);return _0x4478b0[_0x1d67f3(0x9b)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a64_0x1614cc=a64_0x158e;(function(_0x1d1d4f,_0x5c42fe){const _0x38ae91=a64_0x158e,_0xafae28=_0x1d1d4f();while(!![]){try{const _0x2cf35d=parseInt(_0x38ae91(0xf4))/0x1*(parseInt(_0x38ae91(0x112))/0x2)+-parseInt(_0x38ae91(0x10c))/0x3*(-parseInt(_0x38ae91(0x109))/0x4)+parseInt(_0x38ae91(0xe5))/0x5+parseInt(_0x38ae91(0xe9))/0x6*(-parseInt(_0x38ae91(0x126))/0x7)+parseInt(_0x38ae91(0xf0))/0x8+parseInt(_0x38ae91(0xee))/0x9+-parseInt(_0x38ae91(0x120))/0xa;if(_0x2cf35d===_0x5c42fe)break;else _0xafae28['push'](_0xafae28['shift']());}catch(_0x12ff2b){_0xafae28['push'](_0xafae28['shift']());}}}(a64_0x2245,0xdb5e0));function a64_0x158e(_0x42f84f,_0x317637){_0x42f84f=_0x42f84f-0xe5;const _0x224518=a64_0x2245();let _0x158ec5=_0x224518[_0x42f84f];return _0x158ec5;}import*as a64_0x3e8548 from'node:crypto';import*as a64_0x37e788 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a64_0x2245(){const _0x1de32c=['EADDRINUSE','state','redirect_to_path','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','13261851XQfsHL','accountName','13541216DMxWQJ','createHash','code_challenge_method','redirectUri','47oqbWfb','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','code','codeChallenge','text/plain','end','OAuth\x20token\x20request\x20failed\x20(','scope','application/x-www-form-urlencoded','digest','refresh_token','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','get','randomBytes','clientId','waitForCallback','Port\x20','searchParams','expires_in','authorization_code','Not\x20Found','5836ghHgNk','sha256','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','2733NauvnB','POST','http://localhost:','base64url','createServer','client_id','40724APHoHl','error','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','pathname','url','access_token','text/html','close','text','http://127.0.0.1','redirect_uri','toString','writeHead','response_type','37063980LIoxvO','set','update','/oauth/callback','):\x20','account_name','139853OcXlsZ','hex','tdx','2355930KcJDgu','now','/oauth/token','/users/initiate_sso','396jAKapK'];a64_0x2245=function(){return _0x1de32c;};return a64_0x2245();}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a64_0x1614cc(0x10e)+OAUTH_CALLBACK_PORT+a64_0x1614cc(0x123);export function getOAuthClientId(){const _0x32c667=a64_0x1614cc;return process.env.TD_OAUTH_CLIENT_ID||_0x32c667(0x128);}export function generatePKCEPair(){const _0x308053=a64_0x1614cc,_0x2cadca=a64_0x3e8548[_0x308053(0x101)](0x20)[_0x308053(0x11d)](_0x308053(0x10f)),_0x50eb1e=a64_0x3e8548[_0x308053(0xf1)](_0x308053(0x10a))[_0x308053(0x122)](_0x2cadca)[_0x308053(0xfd)](_0x308053(0x10f));return{'verifier':_0x2cadca,'challenge':_0x50eb1e};}export function buildAuthorizeURL(_0x416a03,_0x4e1109){const _0x3ecf01=a64_0x1614cc,_0x4d12cd=new URL('/oauth/authorize',_0x416a03);return _0x4d12cd[_0x3ecf01(0x105)][_0x3ecf01(0x121)](_0x3ecf01(0x11f),_0x3ecf01(0xf6)),_0x4d12cd['searchParams'][_0x3ecf01(0x121)](_0x3ecf01(0x111),_0x4e1109[_0x3ecf01(0x102)]),_0x4d12cd['searchParams'][_0x3ecf01(0x121)](_0x3ecf01(0x11c),_0x4e1109[_0x3ecf01(0xf3)]),_0x4d12cd[_0x3ecf01(0x105)][_0x3ecf01(0x121)]('state',_0x4e1109[_0x3ecf01(0xeb)]),_0x4d12cd[_0x3ecf01(0x105)]['set']('code_challenge',_0x4e1109[_0x3ecf01(0xf7)]),_0x4d12cd[_0x3ecf01(0x105)]['set'](_0x3ecf01(0xf2),'S256'),_0x4e1109[_0x3ecf01(0xfb)]&&_0x4d12cd[_0x3ecf01(0x105)][_0x3ecf01(0x121)](_0x3ecf01(0xfb),_0x4e1109['scope']),_0x4d12cd[_0x3ecf01(0x11d)]();}export function buildSSOInitiateURL(_0x285835,_0x47eb87,_0x127898){const _0x127dc9=a64_0x1614cc,_0x289887=new URL(_0x127dc9(0xe8),_0x285835);_0x289887[_0x127dc9(0x105)]['set'](_0x127dc9(0x125),_0x47eb87);const _0x38bcca=_0x127898['replace'](_0x285835,'');return _0x289887[_0x127dc9(0x105)][_0x127dc9(0x121)](_0x127dc9(0xec),_0x38bcca),_0x289887['toString']();}export async function postTokenRequest(_0x5bd214,_0x85e439){const _0x356b0a=a64_0x1614cc,_0x4c5cde=new URLSearchParams(_0x85e439)[_0x356b0a(0x11d)](),_0x1f34d8=await fetch(_0x5bd214,{'method':_0x356b0a(0x10d),'headers':{'Content-Type':_0x356b0a(0xfc)},'body':_0x4c5cde});if(!_0x1f34d8['ok']){const _0x1aa0f3=await _0x1f34d8[_0x356b0a(0x11a)]();throw new Error(_0x356b0a(0xfa)+_0x1f34d8['status']+_0x356b0a(0x124)+_0x1aa0f3);}const _0x52d0c9=await _0x1f34d8['json']();return{'access_token':_0x52d0c9[_0x356b0a(0x117)],'refresh_token':_0x52d0c9[_0x356b0a(0xfe)],'scope':_0x52d0c9[_0x356b0a(0xfb)],'expires_at':_0x52d0c9[_0x356b0a(0x106)]?Date[_0x356b0a(0xe6)]()+_0x52d0c9[_0x356b0a(0x106)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x42ac0c,_0x58be8e,_0x3bbd7d,_0x332f56){const _0x5e7f8f=a64_0x1614cc,_0x5e291f=_0x42ac0c+_0x5e7f8f(0xe7);return postTokenRequest(_0x5e291f,{'grant_type':_0x5e7f8f(0x107),'client_id':getOAuthClientId(),'code':_0x58be8e,'code_verifier':_0x3bbd7d,'redirect_uri':_0x332f56});}export function startLocalCallbackServer(){const _0x21f083=a64_0x1614cc;let _0x2621fa,_0x177ac7;const _0x1162d6=new Promise((_0x2fc787,_0x543da0)=>{_0x2621fa=_0x2fc787,_0x177ac7=_0x543da0;}),_0x3e0c50=a64_0x37e788[_0x21f083(0x110)]((_0x10ba15,_0x34923c)=>{const _0x4d540d=_0x21f083,_0x5052dc=new URL(_0x10ba15[_0x4d540d(0x116)]||'/',_0x4d540d(0x11b));if(_0x5052dc[_0x4d540d(0x115)]!=='/oauth/callback'){_0x34923c[_0x4d540d(0x11e)](0x194,{'Content-Type':_0x4d540d(0xf8)}),_0x34923c['end'](_0x4d540d(0x108));return;}const _0x2d2c2a=_0x5052dc[_0x4d540d(0x105)]['get'](_0x4d540d(0xf6)),_0x30b8ab=_0x5052dc['searchParams'][_0x4d540d(0x100)]('state'),_0x218165=_0x5052dc[_0x4d540d(0x105)][_0x4d540d(0x100)]('error');if(_0x218165||!_0x2d2c2a||!_0x30b8ab){_0x34923c[_0x4d540d(0x11e)](0x190,{'Content-Type':_0x4d540d(0x118)}),_0x34923c[_0x4d540d(0xf9)]('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0x177ac7(new Error(_0x4d540d(0xed)));return;}_0x34923c[_0x4d540d(0x11e)](0xc8,{'Content-Type':_0x4d540d(0x118)}),_0x34923c['end'](_0x4d540d(0xf5)),_0x2621fa({'code':_0x2d2c2a,'state':_0x30b8ab});});_0x3e0c50['on'](_0x21f083(0x113),_0x32989f=>{const _0x38a6b0=_0x21f083;_0x32989f[_0x38a6b0(0xf6)]===_0x38a6b0(0xea)?_0x177ac7(new Error(_0x38a6b0(0x104)+OAUTH_CALLBACK_PORT+_0x38a6b0(0x114))):_0x177ac7(new Error(_0x38a6b0(0x10b)+_0x32989f['message']));}),_0x3e0c50['listen'](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x1e0ec6=setTimeout(()=>{const _0x45d536=_0x21f083;_0x177ac7(new Error(_0x45d536(0xff))),_0x3e0c50[_0x45d536(0x119)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x1162d6,'close':()=>{const _0x446d03=_0x21f083;clearTimeout(_0x1e0ec6),_0x3e0c50[_0x446d03(0x119)]();}};}export async function startOAuthFlow(_0x5bd276,_0x4c18f0){const _0x24fe39=a64_0x1614cc,_0x16bf76=getConsoleUrl(_0x5bd276),_0x38ffd8=getOAuthClientId(),{verifier:_0x4f6d48,challenge:_0x3203cc}=generatePKCEPair(),_0x11410e=a64_0x3e8548[_0x24fe39(0x101)](0x10)[_0x24fe39(0x11d)](_0x24fe39(0x127)),_0xd12068=startLocalCallbackServer();try{const _0x564a9a=OAUTH_REDIRECT_URI,_0x26c8bc=buildAuthorizeURL(_0x16bf76,{'clientId':_0x38ffd8,'redirectUri':_0x564a9a,'state':_0x11410e,'codeChallenge':_0x3203cc,'scope':'openid\x20email\x20profile'}),_0x4369d2=_0x4c18f0?.[_0x24fe39(0xef)]?buildSSOInitiateURL(_0x16bf76,_0x4c18f0[_0x24fe39(0xef)],_0x26c8bc):_0x26c8bc;openBrowser(_0x4369d2);const _0x258202=await _0xd12068[_0x24fe39(0x103)]();if(_0x258202[_0x24fe39(0xeb)]!==_0x11410e)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x16bf76,_0x258202['code'],_0x4f6d48,_0x564a9a);}finally{_0xd12068['close']();}}
1
+ const a64_0xb08823=a64_0x1a24;function a64_0x3b1d(){const _0x2a1a37=['redirect_uri','close','3519894qxHZNY','url','end','text/html','):\x20','5BZkdqQ','codeChallenge','Not\x20Found','650402IcTkpS','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','listen','expires_in','S256','application/x-www-form-urlencoded','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','text','http://127.0.0.1','account_name','toString','/users/initiate_sso','access_token','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','redirectUri','authorization_code','4064zOmYbO','base64url','sha256','scope','EADDRINUSE','error','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','status','randomBytes','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','hex','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','code_challenge_method','createServer','searchParams','3353274pFpPxi','response_type','tdx','POST','3937424lJsnsn','6KZECtc','pathname','waitForCallback','code_challenge','/oauth/callback','writeHead','Port\x20','digest','1070261vOvsUT','accountName','code','get','http://localhost:','createHash','redirect_to_path','/oauth/authorize','update','text/plain','clientId','state','set','openid\x20email\x20profile','2762052NJalFn','OAuth\x20token\x20request\x20failed\x20('];a64_0x3b1d=function(){return _0x2a1a37;};return a64_0x3b1d();}(function(_0x44a5c9,_0x15e106){const _0x143a72=a64_0x1a24,_0x2cf767=_0x44a5c9();while(!![]){try{const _0x512344=-parseInt(_0x143a72(0x1b3))/0x1+parseInt(_0x143a72(0x1cd))/0x2+parseInt(_0x143a72(0x1c1))/0x3+-parseInt(_0x143a72(0x1dd))/0x4*(-parseInt(_0x143a72(0x1ca))/0x5)+parseInt(_0x143a72(0x1f2))/0x6*(parseInt(_0x143a72(0x1c5))/0x7)+-parseInt(_0x143a72(0x1f1))/0x8+parseInt(_0x143a72(0x1ed))/0x9;if(_0x512344===_0x15e106)break;else _0x2cf767['push'](_0x2cf767['shift']());}catch(_0x4dc3e5){_0x2cf767['push'](_0x2cf767['shift']());}}}(a64_0x3b1d,0x88b12));import*as a64_0x352fc5 from'node:crypto';import*as a64_0x1b83eb from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;function a64_0x1a24(_0x55d1b7,_0x4ac9e2){_0x55d1b7=_0x55d1b7-0x1ad;const _0x3b1d85=a64_0x3b1d();let _0x1a246f=_0x3b1d85[_0x55d1b7];return _0x1a246f;}export const OAUTH_REDIRECT_URI=a64_0xb08823(0x1b7)+OAUTH_CALLBACK_PORT+a64_0xb08823(0x1af);export function getOAuthClientId(){const _0x43d259=a64_0xb08823;return process.env.TD_OAUTH_CLIENT_ID||_0x43d259(0x1ef);}export function generatePKCEPair(){const _0x9a628b=a64_0xb08823,_0x3ee92a=a64_0x352fc5[_0x9a628b(0x1e5)](0x20)[_0x9a628b(0x1d7)](_0x9a628b(0x1de)),_0x10eb8c=a64_0x352fc5[_0x9a628b(0x1b8)](_0x9a628b(0x1df))[_0x9a628b(0x1bb)](_0x3ee92a)[_0x9a628b(0x1b2)](_0x9a628b(0x1de));return{'verifier':_0x3ee92a,'challenge':_0x10eb8c};}export function buildAuthorizeURL(_0x384cae,_0x113ebb){const _0x29ea63=a64_0xb08823,_0x4411ae=new URL(_0x29ea63(0x1ba),_0x384cae);return _0x4411ae[_0x29ea63(0x1ec)]['set'](_0x29ea63(0x1ee),_0x29ea63(0x1b5)),_0x4411ae[_0x29ea63(0x1ec)]['set']('client_id',_0x113ebb[_0x29ea63(0x1bd)]),_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1c3),_0x113ebb[_0x29ea63(0x1db)]),_0x4411ae['searchParams'][_0x29ea63(0x1bf)](_0x29ea63(0x1be),_0x113ebb['state']),_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1ae),_0x113ebb[_0x29ea63(0x1cb)]),_0x4411ae['searchParams']['set'](_0x29ea63(0x1ea),_0x29ea63(0x1d1)),_0x113ebb[_0x29ea63(0x1e0)]&&_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1e0),_0x113ebb['scope']),_0x4411ae[_0x29ea63(0x1d7)]();}export function buildSSOInitiateURL(_0x17500a,_0x2fe755,_0x4b26f6){const _0x2bdf18=a64_0xb08823,_0x3592b6=new URL(_0x2bdf18(0x1d8),_0x17500a);_0x3592b6[_0x2bdf18(0x1ec)][_0x2bdf18(0x1bf)](_0x2bdf18(0x1d6),_0x2fe755);const _0x4b1de6=_0x4b26f6['replace'](_0x17500a,'');return _0x3592b6[_0x2bdf18(0x1ec)]['set'](_0x2bdf18(0x1b9),_0x4b1de6),_0x3592b6[_0x2bdf18(0x1d7)]();}export async function postTokenRequest(_0x37419d,_0x5d35e2){const _0xef9289=a64_0xb08823,_0x2f5de2=new URLSearchParams(_0x5d35e2)[_0xef9289(0x1d7)](),_0x2744ca=await fetch(_0x37419d,{'method':_0xef9289(0x1f0),'headers':{'Content-Type':_0xef9289(0x1d2)},'body':_0x2f5de2});if(!_0x2744ca['ok']){const _0x54a000=await _0x2744ca[_0xef9289(0x1d4)]();throw new Error(_0xef9289(0x1c2)+_0x2744ca[_0xef9289(0x1e4)]+_0xef9289(0x1c9)+_0x54a000);}const _0x2b3223=await _0x2744ca['json']();return{'access_token':_0x2b3223[_0xef9289(0x1d9)],'refresh_token':_0x2b3223['refresh_token'],'scope':_0x2b3223[_0xef9289(0x1e0)],'expires_at':_0x2b3223[_0xef9289(0x1d0)]?Date['now']()+_0x2b3223[_0xef9289(0x1d0)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x445ac9,_0x2a7a7d,_0x5ea4ab,_0x5704f1){const _0xc19d8d=a64_0xb08823,_0x4bae27=_0x445ac9+'/oauth/token';return postTokenRequest(_0x4bae27,{'grant_type':_0xc19d8d(0x1dc),'client_id':getOAuthClientId(),'code':_0x2a7a7d,'code_verifier':_0x5ea4ab,'redirect_uri':_0x5704f1});}export function startLocalCallbackServer(){const _0x340327=a64_0xb08823;let _0x4a429e,_0x35cf4c;const _0x29258a=new Promise((_0x2e786b,_0x30d258)=>{_0x4a429e=_0x2e786b,_0x35cf4c=_0x30d258;}),_0x54e4ca=a64_0x1b83eb[_0x340327(0x1eb)]((_0x235dbe,_0x4f711e)=>{const _0x1523ee=_0x340327,_0x525a04=new URL(_0x235dbe[_0x1523ee(0x1c6)]||'/',_0x1523ee(0x1d5));if(_0x525a04[_0x1523ee(0x1f3)]!=='/oauth/callback'){_0x4f711e['writeHead'](0x194,{'Content-Type':_0x1523ee(0x1bc)}),_0x4f711e[_0x1523ee(0x1c7)](_0x1523ee(0x1cc));return;}const _0x5aa780=_0x525a04[_0x1523ee(0x1ec)][_0x1523ee(0x1b6)](_0x1523ee(0x1b5)),_0x86f0d3=_0x525a04[_0x1523ee(0x1ec)]['get'](_0x1523ee(0x1be)),_0x3b4b8e=_0x525a04[_0x1523ee(0x1ec)][_0x1523ee(0x1b6)](_0x1523ee(0x1e2));if(_0x3b4b8e||!_0x5aa780||!_0x86f0d3){_0x4f711e[_0x1523ee(0x1b0)](0x190,{'Content-Type':_0x1523ee(0x1c8)}),_0x4f711e[_0x1523ee(0x1c7)](_0x1523ee(0x1e3)),_0x35cf4c(new Error(_0x1523ee(0x1ce)));return;}_0x4f711e[_0x1523ee(0x1b0)](0xc8,{'Content-Type':_0x1523ee(0x1c8)}),_0x4f711e['end'](_0x1523ee(0x1d3)),_0x4a429e({'code':_0x5aa780,'state':_0x86f0d3});});_0x54e4ca['on'](_0x340327(0x1e2),_0x1a5a4d=>{const _0x4818f2=_0x340327;_0x1a5a4d['code']===_0x4818f2(0x1e1)?_0x35cf4c(new Error(_0x4818f2(0x1b1)+OAUTH_CALLBACK_PORT+_0x4818f2(0x1da))):_0x35cf4c(new Error(_0x4818f2(0x1e6)+_0x1a5a4d['message']));}),_0x54e4ca[_0x340327(0x1cf)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x5f5a4e=setTimeout(()=>{const _0x40e064=_0x340327;_0x35cf4c(new Error(_0x40e064(0x1e7))),_0x54e4ca[_0x40e064(0x1c4)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x29258a,'close':()=>{const _0x22d7c9=_0x340327;clearTimeout(_0x5f5a4e),_0x54e4ca[_0x22d7c9(0x1c4)]();}};}export async function startOAuthFlow(_0x1ea216,_0x5dfbfa){const _0xe31503=a64_0xb08823,_0x2997e7=getConsoleUrl(_0x1ea216),_0xeb98b6=getOAuthClientId(),{verifier:_0x2e4a6c,challenge:_0x59f6ac}=generatePKCEPair(),_0xed8fce=a64_0x352fc5['randomBytes'](0x10)[_0xe31503(0x1d7)](_0xe31503(0x1e8)),_0x551a20=startLocalCallbackServer();try{const _0x3c2eb4=OAUTH_REDIRECT_URI,_0x2243d3=buildAuthorizeURL(_0x2997e7,{'clientId':_0xeb98b6,'redirectUri':_0x3c2eb4,'state':_0xed8fce,'codeChallenge':_0x59f6ac,'scope':_0xe31503(0x1c0)}),_0xbf4f3d=_0x5dfbfa?.[_0xe31503(0x1b4)]?buildSSOInitiateURL(_0x2997e7,_0x5dfbfa['accountName'],_0x2243d3):_0x2243d3;openBrowser(_0xbf4f3d);const _0x5c1ffc=await _0x551a20[_0xe31503(0x1ad)]();if(_0x5c1ffc[_0xe31503(0x1be)]!==_0xed8fce)throw new Error(_0xe31503(0x1e9));return await exchangeCodeForTokens(_0x2997e7,_0x5c1ffc[_0xe31503(0x1b5)],_0x2e4a6c,_0x3c2eb4);}finally{_0x551a20[_0xe31503(0x1c4)]();}}
@@ -1 +1 @@
1
- const a65_0x503618=a65_0x5833;(function(_0x5aa681,_0x173153){const _0x3b2f9c=a65_0x5833,_0x21d91f=_0x5aa681();while(!![]){try{const _0x371c5f=-parseInt(_0x3b2f9c(0x212))/0x1*(parseInt(_0x3b2f9c(0x201))/0x2)+parseInt(_0x3b2f9c(0x232))/0x3*(-parseInt(_0x3b2f9c(0x1f9))/0x4)+-parseInt(_0x3b2f9c(0x1f8))/0x5*(-parseInt(_0x3b2f9c(0x218))/0x6)+-parseInt(_0x3b2f9c(0x20d))/0x7+parseInt(_0x3b2f9c(0x208))/0x8*(parseInt(_0x3b2f9c(0x1ea))/0x9)+-parseInt(_0x3b2f9c(0x23c))/0xa*(-parseInt(_0x3b2f9c(0x213))/0xb)+parseInt(_0x3b2f9c(0x220))/0xc;if(_0x371c5f===_0x173153)break;else _0x21d91f['push'](_0x21d91f['shift']());}catch(_0x48a6c6){_0x21d91f['push'](_0x21d91f['shift']());}}}(a65_0xeb33,0x79174));import*as a65_0x1e3c3b from'node:fs';import*as a65_0x5ccc4f from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';function a65_0x5833(_0x142363,_0x4b65b7){_0x142363=_0x142363-0x1ea;const _0xeb3386=a65_0xeb33();let _0x58332d=_0xeb3386[_0x142363];return _0x58332d;}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';function a65_0xeb33(){const _0x412cc2=['parse','toISOString','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','length','Warning:\x20Profile\x20\x27','Profile\x20','Error:\x20','1040220rMPKJN','\x20\x20mv\x20\x22',',\x20creating\x20new\x20file','\x27:\x20config\x20must\x20be\x20an\x20object','.env.','llm_project','stringify','\x20\x201.\x20Edit:\x20','localeCompare','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20does\x20not\x20exist','description','Invalid\x20profile\x20name:\x20','join','isDirectory','tdx.json','llm_agent','string','1015959nsqSqW','@tdx-studio','\x27:\x20unknown\x20config\x20key\x20\x27','user_info','existsSync','sort','\x20already\x20exists','Profile\x20\x27','warn','filter','2510ePqfTr','.env','database','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','4275Snpflg','keys','\x27\x20will\x20be\x20ignored','\x22\x20\x22','values','profile','object','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','readdirSync','To\x20migrate:','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','set','message','5pjmsJr','4usyyml','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','includes','parent_segment','site','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','readFileSync','18hapGbb','profiles','name','\x27\x20not\x20found\x20in\x20user\x20configuration','Warning:\x20Failed\x20to\x20parse\x20','local','entries','13696yiGcme',':\x20Invalid\x20JSON\x20syntax','has','directory','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','1344924NTLERS','Failed\x20to\x20parse\x20','utf-8','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','72232MkKFMB','27533stTZOg','push','INVALID_PROFILE_CONFIG','map','test','892338vtCaYH'];a65_0xeb33=function(){return _0x412cc2;};return a65_0xeb33();}export const STUDIO_PROFILE_NAME=a65_0x503618(0x233);export function getProfileParams(_0x424410){const _0x3d80ed=a65_0x503618,_0xe45f10={};if(!_0x424410)return _0xe45f10;for(const [_0x443b8f,_0x25086e]of Object[_0x3d80ed(0x207)](_0x424410)){_0x443b8f!=='description'&&_0x25086e!==undefined&&(_0xe45f10[_0x443b8f]=_0x25086e);}return _0xe45f10;}export function getProfilesDir(){const _0xec0c83=a65_0x503618;return a65_0x5ccc4f[_0xec0c83(0x22d)](getConfigDir(),_0xec0c83(0x202));}function getProfileDir(_0x3b090e){const _0x1f015b=a65_0x503618;return a65_0x5ccc4f[_0x1f015b(0x22d)](getProfilesDir(),_0x3b090e);}function getProfileConfigPath(_0x24580d){return a65_0x5ccc4f['join'](getProfileDir(_0x24580d),'tdx.json');}function getProfileEnvPath(_0x39f3b7){const _0x5a147c=a65_0x503618;return a65_0x5ccc4f[_0x5a147c(0x22d)](getProfileDir(_0x39f3b7),_0x5a147c(0x23d));}function getGlobalConfigPath(){const _0x1e2c91=a65_0x503618;return a65_0x5ccc4f[_0x1e2c91(0x22d)](getConfigDir(),_0x1e2c91(0x22f));}function validateProfileName(_0x16555e){const _0x388679=a65_0x503618;if(/^@?[a-zA-Z0-9_-]+$/['test'](_0x16555e))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x388679(0x217)](_0x16555e))return;throw new Error(_0x388679(0x22c)+_0x16555e+_0x388679(0x229));}function validateProfileConfig(_0xf7a4fb,_0x37a9d4){const _0x3818f2=a65_0x503618;if(typeof _0xf7a4fb!==_0x3818f2(0x1f0)||_0xf7a4fb===null)throw new SDKError(ErrorCode[_0x3818f2(0x215)],'Profile\x20\x27'+_0x37a9d4+_0x3818f2(0x223));const _0x22e07b=[_0x3818f2(0x22b),_0x3818f2(0x1fd),_0x3818f2(0x23e),_0x3818f2(0x1fc),'llm_project',_0x3818f2(0x230),_0x3818f2(0x235)],_0x225b1=_0xf7a4fb;for(const _0x642fbb of Object[_0x3818f2(0x1eb)](_0x225b1)){!_0x22e07b[_0x3818f2(0x1fb)](_0x642fbb)&&console[_0x3818f2(0x23a)](_0x3818f2(0x21d)+_0x37a9d4+_0x3818f2(0x234)+_0x642fbb+_0x3818f2(0x1ec));}if(_0x225b1['description']!==undefined&&typeof _0x225b1[_0x3818f2(0x22b)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode[_0x3818f2(0x215)],'Profile\x20\x27'+_0x37a9d4+_0x3818f2(0x1fe));if(_0x225b1[_0x3818f2(0x1fd)]!==undefined&&typeof _0x225b1['site']!=='string')throw new SDKError(ErrorCode[_0x3818f2(0x215)],'Profile\x20\x27'+_0x37a9d4+_0x3818f2(0x1f5));if(_0x225b1['database']!==undefined&&typeof _0x225b1[_0x3818f2(0x23e)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x37a9d4+_0x3818f2(0x210));if(_0x225b1[_0x3818f2(0x1fc)]!==undefined&&typeof _0x225b1[_0x3818f2(0x1fc)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode[_0x3818f2(0x215)],_0x3818f2(0x239)+_0x37a9d4+_0x3818f2(0x211));if(_0x225b1['llm_project']!==undefined&&typeof _0x225b1[_0x3818f2(0x225)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode[_0x3818f2(0x215)],_0x3818f2(0x239)+_0x37a9d4+_0x3818f2(0x1f1));if(_0x225b1[_0x3818f2(0x230)]!==undefined&&typeof _0x225b1[_0x3818f2(0x230)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode[_0x3818f2(0x215)],_0x3818f2(0x239)+_0x37a9d4+_0x3818f2(0x23f));return!![];}function loadProfilesFromTdxJson(_0x5d04a5,_0x2a914b){const _0x4a420c=a65_0x503618;if(!a65_0x1e3c3b[_0x4a420c(0x236)](_0x5d04a5))return[];try{const _0x1bf397=a65_0x1e3c3b['readFileSync'](_0x5d04a5,_0x4a420c(0x20f)),_0x2d106c=JSON[_0x4a420c(0x219)](_0x1bf397);if(!_0x2d106c[_0x4a420c(0x202)]||typeof _0x2d106c[_0x4a420c(0x202)]!==_0x4a420c(0x1f0))return[];const _0x4f371b=[];for(const [_0x207e33,_0x562040]of Object['entries'](_0x2d106c[_0x4a420c(0x202)])){try{validateProfileConfig(_0x562040,_0x207e33);const _0x2bc718=getNewCredentialPath(_0x207e33),_0x14623f=getOldCredentialPath(_0x207e33),_0x349ed3=a65_0x1e3c3b['existsSync'](_0x2bc718)||a65_0x1e3c3b[_0x4a420c(0x236)](_0x14623f);_0x4f371b[_0x4a420c(0x214)]({'name':_0x207e33,'config':_0x562040,'metadata':{'name':_0x207e33,'createdAt':new Date()[_0x4a420c(0x21a)]()},'hasCredentials':_0x349ed3,'scope':_0x2a914b});}catch(_0x3f253b){_0x3f253b instanceof Error&&(console[_0x4a420c(0x23a)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x5d04a5+':'),console[_0x4a420c(0x23a)]('\x20\x20'+_0x3f253b[_0x4a420c(0x1f7)]+'\x0a'));}}return _0x4f371b;}catch(_0x667f1c){return _0x667f1c instanceof SyntaxError?(console[_0x4a420c(0x23a)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x5d04a5+_0x4a420c(0x209)),console[_0x4a420c(0x23a)](_0x4a420c(0x21f)+_0x667f1c[_0x4a420c(0x1f7)]+'\x0a')):console[_0x4a420c(0x23a)](_0x4a420c(0x1f4)+_0x5d04a5+':\x20'+_0x667f1c+'\x0a'),[];}}export function getNewCredentialPath(_0x24b449){const _0x91f7f1=a65_0x503618;return a65_0x5ccc4f[_0x91f7f1(0x22d)](getConfigDir(),_0x91f7f1(0x224)+_0x24b449);}function getOldCredentialPath(_0x493f6a){const _0x2988ad=a65_0x503618;return a65_0x5ccc4f[_0x2988ad(0x22d)](getProfilesDir(),_0x493f6a,_0x2988ad(0x23d));}function loadProfilesFromTdxJsonFiles(){const _0x2c8f9d=a65_0x503618,_0xe0e631=[],_0x185e3f=findProjectConfigPath();_0x185e3f&&_0xe0e631[_0x2c8f9d(0x214)](...loadProfilesFromTdxJson(_0x185e3f,_0x2c8f9d(0x206)));const _0x2822bb=a65_0x5ccc4f[_0x2c8f9d(0x22d)](getConfigDir(),_0x2c8f9d(0x22f));return _0xe0e631[_0x2c8f9d(0x214)](...loadProfilesFromTdxJson(_0x2822bb,'user')),_0xe0e631;}function loadProfilesFromDirectories(){const _0x22a769=a65_0x503618,_0x3736dc=getProfilesDir();if(!a65_0x1e3c3b[_0x22a769(0x236)](_0x3736dc))return[];try{return a65_0x1e3c3b[_0x22a769(0x1f2)](_0x3736dc,{'withFileTypes':!![]})[_0x22a769(0x23b)](_0x4239c7=>_0x4239c7[_0x22a769(0x22e)]())[_0x22a769(0x216)](_0x45860a=>_0x45860a['name'])[_0x22a769(0x23b)](_0x12267f=>{const _0x3008e5=_0x22a769,_0x3f2ab0=getProfileConfigPath(_0x12267f),_0x70a1df=getProfileEnvPath(_0x12267f);return a65_0x1e3c3b[_0x3008e5(0x236)](_0x3f2ab0)||a65_0x1e3c3b[_0x3008e5(0x236)](_0x70a1df);})[_0x22a769(0x216)](_0x178946=>{const _0x449567=_0x22a769,_0x4ee8a1=loadProfileFromDirectory(_0x178946);if(_0x4ee8a1)return{..._0x4ee8a1,'scope':_0x449567(0x20b)};return null;})[_0x22a769(0x23b)](_0x2ec7a0=>_0x2ec7a0!==null);}catch{return[];}}function loadProfileFromDirectory(_0x144904){const _0x21fc89=a65_0x503618,_0x2a9362=getProfileConfigPath(_0x144904),_0x139343=getOldCredentialPath(_0x144904);if(!a65_0x1e3c3b[_0x21fc89(0x236)](_0x2a9362)&&!a65_0x1e3c3b['existsSync'](_0x139343))return null;let _0x4affbf={},_0x2e37d4={'name':_0x144904,'createdAt':new Date()[_0x21fc89(0x21a)]()};if(a65_0x1e3c3b['existsSync'](_0x2a9362))try{const _0x45355e=a65_0x1e3c3b[_0x21fc89(0x200)](_0x2a9362,'utf-8'),_0x4825a8=JSON['parse'](_0x45355e),{metadata:_0x4ff714,..._0x115134}=_0x4825a8;_0x4affbf=_0x115134,_0x4ff714&&(_0x2e37d4=_0x4ff714);}catch{}return{'name':_0x144904,'config':_0x4affbf,'metadata':_0x2e37d4,'hasCredentials':a65_0x1e3c3b['existsSync'](_0x139343),'scope':_0x21fc89(0x20b)};}export function listProfiles(){const _0x322550=a65_0x503618,_0x185aff=loadProfilesFromTdxJsonFiles(),_0x2c777d=loadProfilesFromDirectories();if(_0x2c777d[_0x322550(0x21c)]>0x0){const _0x2fe31f=_0x2c777d[_0x322550(0x216)](_0x1896a2=>_0x1896a2[_0x322550(0x203)])[_0x322550(0x22d)](',\x20'),_0x398bc2=getConfigDir();console[_0x322550(0x23a)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x2fe31f),console[_0x322550(0x23a)](_0x322550(0x21b)),console['warn'](_0x322550(0x227)+a65_0x5ccc4f[_0x322550(0x22d)](_0x398bc2,_0x322550(0x22f))),console[_0x322550(0x23a)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console['warn'](_0x322550(0x1fa));}const _0x10c066=[..._0x185aff,..._0x2c777d],_0x3c1d3f=new Map();for(const _0x3f4556 of _0x10c066){!_0x3c1d3f[_0x322550(0x20a)](_0x3f4556[_0x322550(0x203)])&&_0x3c1d3f[_0x322550(0x1f6)](_0x3f4556[_0x322550(0x203)],_0x3f4556);}return Array['from'](_0x3c1d3f[_0x322550(0x1ee)]())[_0x322550(0x237)]((_0x5bea40,_0x5a3b37)=>_0x5bea40['name'][_0x322550(0x228)](_0x5a3b37[_0x322550(0x203)]));}export function profileExists(_0x2b6c60){const _0x5a922a=listProfiles();return _0x5a922a['some'](_0xc986a4=>_0xc986a4['name']===_0x2b6c60);}export function loadProfile(_0x5c3be7){const _0x73b09e=a65_0x503618;validateProfileName(_0x5c3be7);const _0x2c9cff=listProfiles(),_0x4a2d3f=_0x2c9cff['find'](_0x1f7eda=>_0x1f7eda[_0x73b09e(0x203)]===_0x5c3be7);return _0x4a2d3f||null;}export function saveProfile(_0x16a4f1,_0x1f7388,_0x5359dd=![]){saveProfileToUserConfig(_0x16a4f1,_0x1f7388);}export function deleteProfile(_0x1670f0){const _0xe55694=a65_0x503618;validateProfileName(_0x1670f0);const _0x5ce803=getProfileDir(_0x1670f0);if(!a65_0x1e3c3b[_0xe55694(0x236)](_0x5ce803))throw new Error(_0xe55694(0x21e)+_0x1670f0+_0xe55694(0x22a));a65_0x1e3c3b['rmSync'](_0x5ce803,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x143b03,_0x423999){const _0x507cff=a65_0x503618;validateProfileName(_0x143b03);const _0xa0a362=getGlobalConfigPath(),_0x5c220f=getConfigDir();!a65_0x1e3c3b[_0x507cff(0x236)](_0x5c220f)&&createSecureDirectory(_0x5c220f);let _0x593a33={};if(a65_0x1e3c3b[_0x507cff(0x236)](_0xa0a362))try{const _0x1240c5=a65_0x1e3c3b[_0x507cff(0x200)](_0xa0a362,_0x507cff(0x20f));_0x593a33=JSON[_0x507cff(0x219)](_0x1240c5);}catch{console['warn'](_0x507cff(0x205)+_0xa0a362+_0x507cff(0x222));}!_0x593a33[_0x507cff(0x202)]&&(_0x593a33['profiles']={}),_0x593a33[_0x507cff(0x202)][_0x143b03]=_0x423999,writeSecureFile(_0xa0a362,JSON['stringify'](_0x593a33,null,0x2));}export function removeProfileFromUserConfig(_0x5460bd){const _0x1f3123=a65_0x503618;validateProfileName(_0x5460bd);const _0x2f2d74=getGlobalConfigPath();if(!a65_0x1e3c3b[_0x1f3123(0x236)](_0x2f2d74))throw new Error(_0x1f3123(0x239)+_0x5460bd+_0x1f3123(0x204));let _0x1e322a={};try{const _0x3c558b=a65_0x1e3c3b[_0x1f3123(0x200)](_0x2f2d74,_0x1f3123(0x20f));_0x1e322a=JSON[_0x1f3123(0x219)](_0x3c558b);}catch{throw new Error(_0x1f3123(0x20e)+_0x2f2d74);}if(!_0x1e322a[_0x1f3123(0x202)]||!_0x1e322a[_0x1f3123(0x202)][_0x5460bd])throw new Error(_0x1f3123(0x239)+_0x5460bd+_0x1f3123(0x204));delete _0x1e322a[_0x1f3123(0x202)][_0x5460bd],_0x1e322a[_0x1f3123(0x1ef)]===_0x5460bd&&delete _0x1e322a[_0x1f3123(0x1ef)],writeSecureFile(_0x2f2d74,JSON[_0x1f3123(0x226)](_0x1e322a,null,0x2));}export function getActiveProfile(){const _0x5ffae2=a65_0x503618,_0x23df3e=loadSessionContext();if(_0x23df3e?.['profile'])return _0x23df3e[_0x5ffae2(0x1ef)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xbd651f=getGlobalConfigPath();if(!a65_0x1e3c3b[_0x5ffae2(0x236)](_0xbd651f))return null;try{const _0x15874d=a65_0x1e3c3b[_0x5ffae2(0x200)](_0xbd651f,_0x5ffae2(0x20f)),_0x1e42a5=JSON[_0x5ffae2(0x219)](_0x15874d);return _0x1e42a5[_0x5ffae2(0x1ef)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0xc696ce){const _0x3d8710=a65_0x503618,_0x3291ea=getGlobalConfigPath(),_0xfed8fd=getConfigDir();!a65_0x1e3c3b[_0x3d8710(0x236)](_0xfed8fd)&&createSecureDirectory(_0xfed8fd);let _0x3e0a68={};if(a65_0x1e3c3b[_0x3d8710(0x236)](_0x3291ea))try{const _0x351eb6=a65_0x1e3c3b['readFileSync'](_0x3291ea,_0x3d8710(0x20f));_0x3e0a68=JSON[_0x3d8710(0x219)](_0x351eb6);}catch{console[_0x3d8710(0x23a)](_0x3d8710(0x205)+_0x3291ea+_0x3d8710(0x222));}_0x3e0a68['site']=_0xc696ce,writeSecureFile(_0x3291ea,JSON['stringify'](_0x3e0a68,null,0x2));}export function saveActiveProfileToUserConfig(_0xffdb35){const _0x57d4e0=a65_0x503618;validateProfileName(_0xffdb35);const _0x227835=getGlobalConfigPath(),_0x121629=getConfigDir();!a65_0x1e3c3b[_0x57d4e0(0x236)](_0x121629)&&createSecureDirectory(_0x121629);let _0x760597={};if(a65_0x1e3c3b['existsSync'](_0x227835))try{const _0x1929f0=a65_0x1e3c3b[_0x57d4e0(0x200)](_0x227835,'utf-8');_0x760597=JSON[_0x57d4e0(0x219)](_0x1929f0);}catch{console[_0x57d4e0(0x23a)](_0x57d4e0(0x205)+_0x227835+_0x57d4e0(0x222));}_0x760597[_0x57d4e0(0x1ef)]=_0xffdb35,writeSecureFile(_0x227835,JSON['stringify'](_0x760597,null,0x2));}function clearFieldFromUserConfig(_0x5825a6){const _0xe40262=a65_0x503618,_0x26d53f=getGlobalConfigPath();if(!a65_0x1e3c3b[_0xe40262(0x236)](_0x26d53f))return;let _0x2e0a5c={};try{const _0x47e40b=a65_0x1e3c3b[_0xe40262(0x200)](_0x26d53f,_0xe40262(0x20f));_0x2e0a5c=JSON[_0xe40262(0x219)](_0x47e40b);}catch{return;}delete _0x2e0a5c[_0x5825a6],writeSecureFile(_0x26d53f,JSON['stringify'](_0x2e0a5c,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x1b0514=a65_0x503618;clearFieldFromUserConfig(_0x1b0514(0x1fd));}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x35b2ae,_0x30c04a){const _0x46b889=a65_0x503618;validateProfileName(_0x35b2ae);if(profileExists(_0x35b2ae))throw new Error(_0x46b889(0x21e)+_0x35b2ae+_0x46b889(0x238));saveProfile(_0x35b2ae,_0x30c04a);}export function saveProfileCredentials(_0x310a73,_0x47d7e3){const _0x15992e=a65_0x503618;validateProfileName(_0x310a73);if(!profileExists(_0x310a73))throw new Error(_0x15992e(0x21e)+_0x310a73+_0x15992e(0x22a));const _0x1bac11=getNewCredentialPath(_0x310a73);writeSecureFile(_0x1bac11,_0x47d7e3);}export function loadProfileCredentials(_0x3e0a9b){const _0x50041e=a65_0x503618;validateProfileName(_0x3e0a9b);const _0x23c511=getNewCredentialPath(_0x3e0a9b);if(a65_0x1e3c3b['existsSync'](_0x23c511))try{return a65_0x1e3c3b[_0x50041e(0x200)](_0x23c511,_0x50041e(0x20f));}catch{}const _0x3e71de=getOldCredentialPath(_0x3e0a9b);if(a65_0x1e3c3b[_0x50041e(0x236)](_0x3e71de)){console[_0x50041e(0x23a)](_0x50041e(0x1ff)+_0x3e0a9b+'\x27'),console[_0x50041e(0x23a)](_0x50041e(0x1f3)),console[_0x50041e(0x23a)](_0x50041e(0x221)+_0x3e71de+_0x50041e(0x1ed)+_0x23c511+'\x22'),console[_0x50041e(0x23a)](_0x50041e(0x20c));try{return a65_0x1e3c3b[_0x50041e(0x200)](_0x3e71de,'utf-8');}catch{return null;}}return null;}
1
+ const a65_0x3315a5=a65_0x13f2;(function(_0x11b603,_0x4991f8){const _0x45ac87=a65_0x13f2,_0x149bf4=_0x11b603();while(!![]){try{const _0x2fed73=parseInt(_0x45ac87(0x13d))/0x1+parseInt(_0x45ac87(0x12b))/0x2*(-parseInt(_0x45ac87(0x119))/0x3)+-parseInt(_0x45ac87(0x132))/0x4*(parseInt(_0x45ac87(0x126))/0x5)+-parseInt(_0x45ac87(0x11f))/0x6+-parseInt(_0x45ac87(0x13e))/0x7+parseInt(_0x45ac87(0x125))/0x8+parseInt(_0x45ac87(0x116))/0x9*(parseInt(_0x45ac87(0xfd))/0xa);if(_0x2fed73===_0x4991f8)break;else _0x149bf4['push'](_0x149bf4['shift']());}catch(_0x50362b){_0x149bf4['push'](_0x149bf4['shift']());}}}(a65_0x5487,0xeef16));import*as a65_0x1919df from'node:fs';import*as a65_0x18aeea 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=a65_0x3315a5(0x102);function a65_0x5487(){const _0x14d361=['tdx.json','set','test','object','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','4ZUVoFc','find','keys','\x20already\x20exists','\x0aWarning:\x20Failed\x20to\x20parse\x20','has','name','toISOString','join','filter','llm_agent','899357vdAIPc','5034890vLBVCs','\x27\x20not\x20found\x20in\x20user\x20configuration','user_info','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','description','.env','sort','push','some','message','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','profile','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','existsSync','readdirSync','10fpTNmw','Invalid\x20profile\x20name:\x20','database','Profile\x20','warn','@tdx-studio','site','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)',',\x20creating\x20new\x20file','Warning:\x20Failed\x20to\x20parse\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','To\x20migrate:','\x20\x201.\x20Edit:\x20','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20does\x20not\x20exist','parent_segment','INVALID_PROFILE_CONFIG','parse','stringify','local','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','from','localeCompare','\x27:\x20unknown\x20config\x20key\x20\x27','22690413viDQPY','directory','values','183kpHQBA','string','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x27\x20will\x20be\x20ignored','readFileSync',':\x20Invalid\x20JSON\x20syntax','11692254HjCjNq','profiles','.env.','entries','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Profile\x20\x27','9464928fBeGlk','2840940sPQVcq','map','\x27:\x20config\x20must\x20be\x20an\x20object','llm_project','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','12746iDVyVa','utf-8'];a65_0x5487=function(){return _0x14d361;};return a65_0x5487();}export function getProfileParams(_0x1e4394){const _0xd21e26=a65_0x3315a5,_0x22f910={};if(!_0x1e4394)return _0x22f910;for(const [_0x2b5a50,_0x174f06]of Object[_0xd21e26(0x122)](_0x1e4394)){_0x2b5a50!=='description'&&_0x174f06!==undefined&&(_0x22f910[_0x2b5a50]=_0x174f06);}return _0x22f910;}export function getProfilesDir(){const _0x14aad9=a65_0x3315a5;return a65_0x18aeea['join'](getConfigDir(),_0x14aad9(0x120));}function getProfileDir(_0x59bcd0){const _0x3ad3fe=a65_0x3315a5;return a65_0x18aeea[_0x3ad3fe(0x13a)](getProfilesDir(),_0x59bcd0);}function getProfileConfigPath(_0x4de976){const _0x399135=a65_0x3315a5;return a65_0x18aeea[_0x399135(0x13a)](getProfileDir(_0x4de976),_0x399135(0x12d));}function getProfileEnvPath(_0x9f522c){const _0xec3a8b=a65_0x3315a5;return a65_0x18aeea['join'](getProfileDir(_0x9f522c),_0xec3a8b(0x143));}function getGlobalConfigPath(){const _0x523362=a65_0x3315a5;return a65_0x18aeea[_0x523362(0x13a)](getConfigDir(),'tdx.json');}function validateProfileName(_0x51532b){const _0x1aeeb4=a65_0x3315a5;if(/^@?[a-zA-Z0-9_-]+$/[_0x1aeeb4(0x12f)](_0x51532b))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x51532b))return;throw new Error(_0x1aeeb4(0xfe)+_0x51532b+_0x1aeeb4(0x104));}function validateProfileConfig(_0x1a3beb,_0x2bd1fb){const _0x4219b1=a65_0x3315a5;if(typeof _0x1a3beb!==_0x4219b1(0x130)||_0x1a3beb===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x128));const _0x6c22b6=[_0x4219b1(0x142),_0x4219b1(0x103),'database','parent_segment',_0x4219b1(0x129),_0x4219b1(0x13c),_0x4219b1(0x140)],_0x581f5c=_0x1a3beb;for(const _0x40a72d of Object[_0x4219b1(0x134)](_0x581f5c)){!_0x6c22b6['includes'](_0x40a72d)&&console[_0x4219b1(0x101)]('Warning:\x20Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x115)+_0x40a72d+_0x4219b1(0x11c));}if(_0x581f5c[_0x4219b1(0x142)]!==undefined&&typeof _0x581f5c['description']!==_0x4219b1(0x11a))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x11b));if(_0x581f5c[_0x4219b1(0x103)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x103)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0xf8));if(_0x581f5c['database']!==undefined&&typeof _0x581f5c[_0x4219b1(0xff)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x4219b1(0x124)+_0x2bd1fb+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x581f5c[_0x4219b1(0x10d)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x10d)]!=='string')throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0x141));if(_0x581f5c[_0x4219b1(0x129)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x129)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0x131));if(_0x581f5c[_0x4219b1(0x13c)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x13c)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x4219b1(0x124)+_0x2bd1fb+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x10e617,_0x4e7f7e){const _0xeedd4b=a65_0x3315a5;if(!a65_0x1919df['existsSync'](_0x10e617))return[];try{const _0xe3bd95=a65_0x1919df[_0xeedd4b(0x11d)](_0x10e617,_0xeedd4b(0x12c)),_0x3e5c97=JSON['parse'](_0xe3bd95);if(!_0x3e5c97[_0xeedd4b(0x120)]||typeof _0x3e5c97[_0xeedd4b(0x120)]!==_0xeedd4b(0x130))return[];const _0x4a54c2=[];for(const [_0x52f4a1,_0x12a912]of Object[_0xeedd4b(0x122)](_0x3e5c97[_0xeedd4b(0x120)])){try{validateProfileConfig(_0x12a912,_0x52f4a1);const _0x4a1e8b=getNewCredentialPath(_0x52f4a1),_0x286c8a=getOldCredentialPath(_0x52f4a1),_0x138f46=a65_0x1919df[_0xeedd4b(0xfb)](_0x4a1e8b)||a65_0x1919df[_0xeedd4b(0xfb)](_0x286c8a);_0x4a54c2['push']({'name':_0x52f4a1,'config':_0x12a912,'metadata':{'name':_0x52f4a1,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x138f46,'scope':_0x4e7f7e});}catch(_0x2ad8bf){_0x2ad8bf instanceof Error&&(console[_0xeedd4b(0x101)](_0xeedd4b(0xfa)+_0x10e617+':'),console[_0xeedd4b(0x101)]('\x20\x20'+_0x2ad8bf[_0xeedd4b(0xf7)]+'\x0a'));}}return _0x4a54c2;}catch(_0x27dee0){return _0x27dee0 instanceof SyntaxError?(console['warn'](_0xeedd4b(0x136)+_0x10e617+_0xeedd4b(0x11e)),console[_0xeedd4b(0x101)]('Error:\x20'+_0x27dee0[_0xeedd4b(0xf7)]+'\x0a')):console[_0xeedd4b(0x101)](_0xeedd4b(0x10b)+_0x10e617+':\x20'+_0x27dee0+'\x0a'),[];}}export function getNewCredentialPath(_0x28227a){const _0x295d9e=a65_0x3315a5;return a65_0x18aeea[_0x295d9e(0x13a)](getConfigDir(),_0x295d9e(0x121)+_0x28227a);}function a65_0x13f2(_0x23dd34,_0xf3ba9e){_0x23dd34=_0x23dd34-0xf5;const _0x548715=a65_0x5487();let _0x13f22b=_0x548715[_0x23dd34];return _0x13f22b;}function getOldCredentialPath(_0x2dab8b){const _0x52da88=a65_0x3315a5;return a65_0x18aeea[_0x52da88(0x13a)](getProfilesDir(),_0x2dab8b,_0x52da88(0x143));}function loadProfilesFromTdxJsonFiles(){const _0x18c3c9=a65_0x3315a5,_0x4810e0=[],_0x29f23d=findProjectConfigPath();_0x29f23d&&_0x4810e0[_0x18c3c9(0xf5)](...loadProfilesFromTdxJson(_0x29f23d,_0x18c3c9(0x111)));const _0x2de0c3=a65_0x18aeea[_0x18c3c9(0x13a)](getConfigDir(),_0x18c3c9(0x12d));return _0x4810e0['push'](...loadProfilesFromTdxJson(_0x2de0c3,'user')),_0x4810e0;}function loadProfilesFromDirectories(){const _0x1c4f73=a65_0x3315a5,_0x42ee30=getProfilesDir();if(!a65_0x1919df[_0x1c4f73(0xfb)](_0x42ee30))return[];try{return a65_0x1919df[_0x1c4f73(0xfc)](_0x42ee30,{'withFileTypes':!![]})[_0x1c4f73(0x13b)](_0x34a63b=>_0x34a63b['isDirectory']())['map'](_0x204101=>_0x204101['name'])[_0x1c4f73(0x13b)](_0x122255=>{const _0x577ff0=_0x1c4f73,_0x49eda7=getProfileConfigPath(_0x122255),_0x33dad0=getProfileEnvPath(_0x122255);return a65_0x1919df[_0x577ff0(0xfb)](_0x49eda7)||a65_0x1919df['existsSync'](_0x33dad0);})[_0x1c4f73(0x127)](_0x3ed11e=>{const _0x468898=loadProfileFromDirectory(_0x3ed11e);if(_0x468898)return{..._0x468898,'scope':'directory'};return null;})[_0x1c4f73(0x13b)](_0x2e0322=>_0x2e0322!==null);}catch{return[];}}function loadProfileFromDirectory(_0x128c1c){const _0x540138=a65_0x3315a5,_0x46de94=getProfileConfigPath(_0x128c1c),_0x18cbb2=getOldCredentialPath(_0x128c1c);if(!a65_0x1919df[_0x540138(0xfb)](_0x46de94)&&!a65_0x1919df[_0x540138(0xfb)](_0x18cbb2))return null;let _0x4b39ea={},_0x49f33d={'name':_0x128c1c,'createdAt':new Date()[_0x540138(0x139)]()};if(a65_0x1919df['existsSync'](_0x46de94))try{const _0x844485=a65_0x1919df['readFileSync'](_0x46de94,'utf-8'),_0x232399=JSON[_0x540138(0x10f)](_0x844485),{metadata:_0x30ad5c,..._0x5338e3}=_0x232399;_0x4b39ea=_0x5338e3,_0x30ad5c&&(_0x49f33d=_0x30ad5c);}catch{}return{'name':_0x128c1c,'config':_0x4b39ea,'metadata':_0x49f33d,'hasCredentials':a65_0x1919df['existsSync'](_0x18cbb2),'scope':_0x540138(0x117)};}export function listProfiles(){const _0x271d1d=a65_0x3315a5,_0x41ceb4=loadProfilesFromTdxJsonFiles(),_0x2ac681=loadProfilesFromDirectories();if(_0x2ac681['length']>0x0){const _0x4aecb9=_0x2ac681[_0x271d1d(0x127)](_0x47577e=>_0x47577e[_0x271d1d(0x138)])[_0x271d1d(0x13a)](',\x20'),_0x304e65=getConfigDir();console['warn'](_0x271d1d(0x112)+_0x4aecb9),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x271d1d(0x101)](_0x271d1d(0x10a)+a65_0x18aeea[_0x271d1d(0x13a)](_0x304e65,'tdx.json')),console[_0x271d1d(0x101)](_0x271d1d(0x105)),console[_0x271d1d(0x101)](_0x271d1d(0x12a));}const _0x533051=[..._0x41ceb4,..._0x2ac681],_0x393162=new Map();for(const _0x47e272 of _0x533051){!_0x393162[_0x271d1d(0x137)](_0x47e272['name'])&&_0x393162[_0x271d1d(0x12e)](_0x47e272[_0x271d1d(0x138)],_0x47e272);}return Array[_0x271d1d(0x113)](_0x393162[_0x271d1d(0x118)]())[_0x271d1d(0x144)]((_0x282f7a,_0x12f8aa)=>_0x282f7a[_0x271d1d(0x138)][_0x271d1d(0x114)](_0x12f8aa['name']));}export function profileExists(_0x145dc1){const _0x20fac5=a65_0x3315a5,_0x497c98=listProfiles();return _0x497c98[_0x20fac5(0xf6)](_0x48b8b5=>_0x48b8b5['name']===_0x145dc1);}export function loadProfile(_0x381d8a){const _0x2e3b1f=a65_0x3315a5;validateProfileName(_0x381d8a);const _0x196f1d=listProfiles(),_0x16c0a3=_0x196f1d[_0x2e3b1f(0x133)](_0x3afba8=>_0x3afba8[_0x2e3b1f(0x138)]===_0x381d8a);return _0x16c0a3||null;}export function saveProfile(_0x15ae02,_0xdbc187,_0x3c8171=![]){saveProfileToUserConfig(_0x15ae02,_0xdbc187);}export function deleteProfile(_0x2e057a){const _0x1fe862=a65_0x3315a5;validateProfileName(_0x2e057a);const _0x3464df=getProfileDir(_0x2e057a);if(!a65_0x1919df[_0x1fe862(0xfb)](_0x3464df))throw new Error(_0x1fe862(0x100)+_0x2e057a+_0x1fe862(0x10c));a65_0x1919df['rmSync'](_0x3464df,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x42d5c6,_0x168bc6){const _0x4c0d30=a65_0x3315a5;validateProfileName(_0x42d5c6);const _0x47b686=getGlobalConfigPath(),_0x22d8e1=getConfigDir();!a65_0x1919df[_0x4c0d30(0xfb)](_0x22d8e1)&&createSecureDirectory(_0x22d8e1);let _0xa05005={};if(a65_0x1919df[_0x4c0d30(0xfb)](_0x47b686))try{const _0x2a2b72=a65_0x1919df[_0x4c0d30(0x11d)](_0x47b686,_0x4c0d30(0x12c));_0xa05005=JSON[_0x4c0d30(0x10f)](_0x2a2b72);}catch{console['warn'](_0x4c0d30(0x107)+_0x47b686+_0x4c0d30(0x106));}!_0xa05005[_0x4c0d30(0x120)]&&(_0xa05005['profiles']={}),_0xa05005['profiles'][_0x42d5c6]=_0x168bc6,writeSecureFile(_0x47b686,JSON[_0x4c0d30(0x110)](_0xa05005,null,0x2));}export function removeProfileFromUserConfig(_0x292dcc){const _0x37e131=a65_0x3315a5;validateProfileName(_0x292dcc);const _0x1dc4a1=getGlobalConfigPath();if(!a65_0x1919df['existsSync'](_0x1dc4a1))throw new Error('Profile\x20\x27'+_0x292dcc+_0x37e131(0x13f));let _0x19501b={};try{const _0x451b1c=a65_0x1919df[_0x37e131(0x11d)](_0x1dc4a1,'utf-8');_0x19501b=JSON[_0x37e131(0x10f)](_0x451b1c);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0x1dc4a1);}if(!_0x19501b[_0x37e131(0x120)]||!_0x19501b[_0x37e131(0x120)][_0x292dcc])throw new Error(_0x37e131(0x124)+_0x292dcc+_0x37e131(0x13f));delete _0x19501b['profiles'][_0x292dcc],_0x19501b[_0x37e131(0xf9)]===_0x292dcc&&delete _0x19501b['profile'],writeSecureFile(_0x1dc4a1,JSON[_0x37e131(0x110)](_0x19501b,null,0x2));}export function getActiveProfile(){const _0x9c9c8a=a65_0x3315a5,_0x3873c3=loadSessionContext();if(_0x3873c3?.['profile'])return _0x3873c3[_0x9c9c8a(0xf9)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x450239=getGlobalConfigPath();if(!a65_0x1919df[_0x9c9c8a(0xfb)](_0x450239))return null;try{const _0x1751ad=a65_0x1919df[_0x9c9c8a(0x11d)](_0x450239,_0x9c9c8a(0x12c)),_0x247966=JSON[_0x9c9c8a(0x10f)](_0x1751ad);return _0x247966[_0x9c9c8a(0xf9)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x4efc42){const _0x4f15ca=a65_0x3315a5,_0x138ae5=getGlobalConfigPath(),_0x1aeae9=getConfigDir();!a65_0x1919df['existsSync'](_0x1aeae9)&&createSecureDirectory(_0x1aeae9);let _0x36e1a6={};if(a65_0x1919df[_0x4f15ca(0xfb)](_0x138ae5))try{const _0x487e42=a65_0x1919df[_0x4f15ca(0x11d)](_0x138ae5,_0x4f15ca(0x12c));_0x36e1a6=JSON[_0x4f15ca(0x10f)](_0x487e42);}catch{console[_0x4f15ca(0x101)](_0x4f15ca(0x107)+_0x138ae5+_0x4f15ca(0x106));}_0x36e1a6[_0x4f15ca(0x103)]=_0x4efc42,writeSecureFile(_0x138ae5,JSON[_0x4f15ca(0x110)](_0x36e1a6,null,0x2));}export function saveActiveProfileToUserConfig(_0x4ceb85){const _0x31401f=a65_0x3315a5;validateProfileName(_0x4ceb85);const _0x5018ec=getGlobalConfigPath(),_0x36356b=getConfigDir();!a65_0x1919df['existsSync'](_0x36356b)&&createSecureDirectory(_0x36356b);let _0x4849f4={};if(a65_0x1919df[_0x31401f(0xfb)](_0x5018ec))try{const _0x3b39bc=a65_0x1919df['readFileSync'](_0x5018ec,_0x31401f(0x12c));_0x4849f4=JSON[_0x31401f(0x10f)](_0x3b39bc);}catch{console[_0x31401f(0x101)](_0x31401f(0x107)+_0x5018ec+',\x20creating\x20new\x20file');}_0x4849f4[_0x31401f(0xf9)]=_0x4ceb85,writeSecureFile(_0x5018ec,JSON[_0x31401f(0x110)](_0x4849f4,null,0x2));}function clearFieldFromUserConfig(_0x54fcb4){const _0xa76098=a65_0x3315a5,_0x3469db=getGlobalConfigPath();if(!a65_0x1919df[_0xa76098(0xfb)](_0x3469db))return;let _0x37f51c={};try{const _0x48dc56=a65_0x1919df['readFileSync'](_0x3469db,'utf-8');_0x37f51c=JSON[_0xa76098(0x10f)](_0x48dc56);}catch{return;}delete _0x37f51c[_0x54fcb4],writeSecureFile(_0x3469db,JSON[_0xa76098(0x110)](_0x37f51c,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x1ceec3,_0x30a95e){const _0x3eb79c=a65_0x3315a5;validateProfileName(_0x1ceec3);if(profileExists(_0x1ceec3))throw new Error(_0x3eb79c(0x100)+_0x1ceec3+_0x3eb79c(0x135));saveProfile(_0x1ceec3,_0x30a95e);}export function saveProfileCredentials(_0x123d8b,_0x2b0f80){const _0x4f13a6=a65_0x3315a5;validateProfileName(_0x123d8b);if(!profileExists(_0x123d8b))throw new Error(_0x4f13a6(0x100)+_0x123d8b+_0x4f13a6(0x10c));const _0x205eeb=getNewCredentialPath(_0x123d8b);writeSecureFile(_0x205eeb,_0x2b0f80);}export function loadProfileCredentials(_0x4356da){const _0x530307=a65_0x3315a5;validateProfileName(_0x4356da);const _0x437546=getNewCredentialPath(_0x4356da);if(a65_0x1919df[_0x530307(0xfb)](_0x437546))try{return a65_0x1919df[_0x530307(0x11d)](_0x437546,_0x530307(0x12c));}catch{}const _0x44a422=getOldCredentialPath(_0x4356da);if(a65_0x1919df[_0x530307(0xfb)](_0x44a422)){console[_0x530307(0x101)](_0x530307(0x123)+_0x4356da+'\x27'),console[_0x530307(0x101)](_0x530307(0x109)),console[_0x530307(0x101)]('\x20\x20mv\x20\x22'+_0x44a422+'\x22\x20\x22'+_0x437546+'\x22'),console[_0x530307(0x101)](_0x530307(0x108));try{return a65_0x1919df[_0x530307(0x11d)](_0x44a422,_0x530307(0x12c));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- (function(_0x2fd3e3,_0x269e67){const _0x51ccc8=a66_0x50e4,_0x28a030=_0x2fd3e3();while(!![]){try{const _0x1d6eae=parseInt(_0x51ccc8(0x1e6))/0x1*(-parseInt(_0x51ccc8(0x206))/0x2)+parseInt(_0x51ccc8(0x1fb))/0x3*(parseInt(_0x51ccc8(0x1ee))/0x4)+parseInt(_0x51ccc8(0x1f6))/0x5*(-parseInt(_0x51ccc8(0x1f4))/0x6)+-parseInt(_0x51ccc8(0x1f9))/0x7+parseInt(_0x51ccc8(0x203))/0x8+-parseInt(_0x51ccc8(0x200))/0x9+-parseInt(_0x51ccc8(0x1f7))/0xa*(-parseInt(_0x51ccc8(0x1e9))/0xb);if(_0x1d6eae===_0x269e67)break;else _0x28a030['push'](_0x28a030['shift']());}catch(_0x52ee0f){_0x28a030['push'](_0x28a030['shift']());}}}(a66_0x44e2,0x5d378));function a66_0x44e2(){const _0x17bf85=['includes','TD_API_KEY','5008104Aokuct','utf-8','apiKey','1302976LYpRdA','stringify','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','1iKbxfT','Failed\x20to\x20load\x20project\x20config\x20from\x20','code','11GyWXRw','cwd','join','parse','profile','112btXTLi','dirname','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20','api_key','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','13254eTOGbp',').\x20','65QbifCO','10260490DUhGce','warn','1296099jjbLEE','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','20340EYwqhj','\x20is\x20ignored.\x20','readFileSync','writeFileSync','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','5352516jlvJea'];a66_0x44e2=function(){return _0x17bf85;};return a66_0x44e2();}import*as a66_0x5cfcc7 from'node:fs';import*as a66_0x7f104b from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x1cdaec){const _0x1ef35b=a66_0x50e4;let _0x40cac7=_0x1cdaec||process[_0x1ef35b(0x1ea)]();while(!![]){const _0x444afc=a66_0x7f104b[_0x1ef35b(0x1eb)](_0x40cac7,PROJECT_CONFIG_FILENAME);if(a66_0x5cfcc7['existsSync'](_0x444afc))return _0x444afc;const _0x79830b=a66_0x7f104b[_0x1ef35b(0x1ef)](_0x40cac7);if(_0x79830b===_0x40cac7)return null;_0x40cac7=_0x79830b;}}export function loadProjectConfig(_0x2c4c3f){const _0x470393=a66_0x50e4,_0x1de139=findProjectConfigPath(_0x2c4c3f);if(!_0x1de139)return null;try{const _0x3ce29c=a66_0x5cfcc7[_0x470393(0x1fd)](_0x1de139,_0x470393(0x204)),_0x37d00d=JSON[_0x470393(0x1ec)](_0x3ce29c),_0x16a187=JSON[_0x470393(0x207)](_0x37d00d);if(_0x16a187[_0x470393(0x201)](_0x470393(0x202))||_0x16a187[_0x470393(0x201)](_0x470393(0x205))||_0x16a187['includes'](_0x470393(0x1f2)))throw new Error(_0x470393(0x1fa)+_0x1de139+_0x470393(0x1f5)+_0x470393(0x1f3));const {metadata:_0x487f78,profile:_0x5d427d,..._0x58de22}=_0x37d00d;return _0x5d427d&&console[_0x470393(0x1f8)](_0x470393(0x1f1)+_0x1de139+_0x470393(0x1fc)+_0x470393(0x1ff)),_0x58de22;}catch(_0x592b98){if(_0x592b98 instanceof Error&&'code'in _0x592b98&&_0x592b98[_0x470393(0x1e8)]==='ENOENT')return null;throw new Error(_0x470393(0x1e7)+_0x1de139+':\x20'+_0x592b98);}}function a66_0x50e4(_0x3de82b,_0x718458){_0x3de82b=_0x3de82b-0x1e6;const _0x44e26e=a66_0x44e2();let _0x50e4d0=_0x44e26e[_0x3de82b];return _0x50e4d0;}export function saveProjectConfig(_0x47041d,_0x3fb464){const _0x4c47cd=a66_0x50e4,_0x3de65e=_0x3fb464||process[_0x4c47cd(0x1ea)](),_0x3a758b=a66_0x7f104b['join'](_0x3de65e,PROJECT_CONFIG_FILENAME),_0x3029ce=JSON['stringify'](_0x47041d);if(_0x3029ce[_0x4c47cd(0x201)](_0x4c47cd(0x202))||_0x3029ce[_0x4c47cd(0x201)]('apiKey')||_0x3029ce[_0x4c47cd(0x201)](_0x4c47cd(0x1f2)))throw new Error(_0x4c47cd(0x208));if(_0x4c47cd(0x1ed)in _0x47041d)throw new Error(_0x4c47cd(0x1f0));a66_0x5cfcc7[_0x4c47cd(0x1fe)](_0x3a758b,JSON[_0x4c47cd(0x207)](_0x47041d,null,0x2));}export function hasProjectConfig(_0x4a693c){return findProjectConfigPath(_0x4a693c)!==null;}export function getProjectRoot(_0x14c91b){const _0x2c26a5=a66_0x50e4,_0x53f91b=findProjectConfigPath(_0x14c91b);return _0x53f91b?a66_0x7f104b[_0x2c26a5(0x1ef)](_0x53f91b):null;}
1
+ function a66_0x42d8(){const _0x13dbe6=['cwd','590958NWeGBN','300825YNpMOC','Failed\x20to\x20load\x20project\x20config\x20from\x20','includes','340uqYlSh',').\x20','14IyrLxX','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8','readFileSync','existsSync','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','join','4228290hbdfPa','apiKey','stringify','Warning:\x20\x27profile\x27\x20field\x20in\x20','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','297OEhVot','api_key','1010810YuKCAI','3062TBGvyr','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','\x20is\x20ignored.\x20','1332592fYCosm','TD_API_KEY','dirname','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','64071LPxaUz','8JWTqps','code'];a66_0x42d8=function(){return _0x13dbe6;};return a66_0x42d8();}(function(_0x316079,_0x378b0f){const _0x2c6bc0=a66_0x14e5,_0x30cae5=_0x316079();while(!![]){try{const _0x4280f4=-parseInt(_0x2c6bc0(0xa2))/0x1+-parseInt(_0x2c6bc0(0x96))/0x2*(parseInt(_0x2c6bc0(0x93))/0x3)+-parseInt(_0x2c6bc0(0x9e))/0x4*(-parseInt(_0x2c6bc0(0x95))/0x5)+parseInt(_0x2c6bc0(0xa1))/0x6*(-parseInt(_0x2c6bc0(0x87))/0x7)+-parseInt(_0x2c6bc0(0x99))/0x8+-parseInt(_0x2c6bc0(0x9d))/0x9*(-parseInt(_0x2c6bc0(0xa5))/0xa)+parseInt(_0x2c6bc0(0x8e))/0xb;if(_0x4280f4===_0x378b0f)break;else _0x30cae5['push'](_0x30cae5['shift']());}catch(_0x3796d1){_0x30cae5['push'](_0x30cae5['shift']());}}}(a66_0x42d8,0x34716));import*as a66_0x2f152f from'node:fs';import*as a66_0x2ab9f2 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';function a66_0x14e5(_0x40bba6,_0x1d3563){_0x40bba6=_0x40bba6-0x86;const _0x42d838=a66_0x42d8();let _0x14e500=_0x42d838[_0x40bba6];return _0x14e500;}export function findProjectConfigPath(_0x3beb87){const _0x5e2e8e=a66_0x14e5;let _0x688046=_0x3beb87||process[_0x5e2e8e(0xa0)]();while(!![]){const _0x5bbdf2=a66_0x2ab9f2[_0x5e2e8e(0x8d)](_0x688046,PROJECT_CONFIG_FILENAME);if(a66_0x2f152f[_0x5e2e8e(0x8b)](_0x5bbdf2))return _0x5bbdf2;const _0x56c64e=a66_0x2ab9f2[_0x5e2e8e(0x9b)](_0x688046);if(_0x56c64e===_0x688046)return null;_0x688046=_0x56c64e;}}export function loadProjectConfig(_0x148f66){const _0x58817b=a66_0x14e5,_0x14e014=findProjectConfigPath(_0x148f66);if(!_0x14e014)return null;try{const _0x370cc1=a66_0x2f152f[_0x58817b(0x8a)](_0x14e014,_0x58817b(0x89)),_0x3c5492=JSON['parse'](_0x370cc1),_0x53a056=JSON[_0x58817b(0x90)](_0x3c5492);if(_0x53a056['includes'](_0x58817b(0x9a))||_0x53a056[_0x58817b(0xa4)](_0x58817b(0x8f))||_0x53a056[_0x58817b(0xa4)](_0x58817b(0x94)))throw new Error(_0x58817b(0x88)+_0x14e014+_0x58817b(0x86)+_0x58817b(0x9c));const {metadata:_0x766ee3,profile:_0x33f57c,..._0x8594fe}=_0x3c5492;return _0x33f57c&&console['warn'](_0x58817b(0x91)+_0x14e014+_0x58817b(0x98)+_0x58817b(0x8c)),_0x8594fe;}catch(_0x380bac){if(_0x380bac instanceof Error&&_0x58817b(0x9f)in _0x380bac&&_0x380bac[_0x58817b(0x9f)]==='ENOENT')return null;throw new Error(_0x58817b(0xa3)+_0x14e014+':\x20'+_0x380bac);}}export function saveProjectConfig(_0x25e394,_0x3dd1f4){const _0x148d47=a66_0x14e5,_0x3ecd17=_0x3dd1f4||process[_0x148d47(0xa0)](),_0x1fc6b7=a66_0x2ab9f2[_0x148d47(0x8d)](_0x3ecd17,PROJECT_CONFIG_FILENAME),_0x5772be=JSON[_0x148d47(0x90)](_0x25e394);if(_0x5772be[_0x148d47(0xa4)](_0x148d47(0x9a))||_0x5772be[_0x148d47(0xa4)]('apiKey')||_0x5772be[_0x148d47(0xa4)](_0x148d47(0x94)))throw new Error(_0x148d47(0x97));if('profile'in _0x25e394)throw new Error(_0x148d47(0x92));a66_0x2f152f['writeFileSync'](_0x1fc6b7,JSON[_0x148d47(0x90)](_0x25e394,null,0x2));}export function hasProjectConfig(_0x4657ae){return findProjectConfigPath(_0x4657ae)!==null;}export function getProjectRoot(_0x430063){const _0x5663f2=findProjectConfigPath(_0x430063);return _0x5663f2?a66_0x2ab9f2['dirname'](_0x5663f2):null;}
@@ -1 +1 @@
1
- (function(_0xa6d178,_0x2513c2){const _0x2b4a9b=a67_0x5da0,_0xc14067=_0xa6d178();while(!![]){try{const _0x2a0f7e=parseInt(_0x2b4a9b(0x1eb))/0x1*(parseInt(_0x2b4a9b(0x1fd))/0x2)+parseInt(_0x2b4a9b(0x1fe))/0x3*(parseInt(_0x2b4a9b(0x1e7))/0x4)+parseInt(_0x2b4a9b(0x1e2))/0x5*(-parseInt(_0x2b4a9b(0x1f2))/0x6)+parseInt(_0x2b4a9b(0x1e5))/0x7+-parseInt(_0x2b4a9b(0x1fc))/0x8*(parseInt(_0x2b4a9b(0x1ed))/0x9)+parseInt(_0x2b4a9b(0x206))/0xa*(parseInt(_0x2b4a9b(0x1e8))/0xb)+parseInt(_0x2b4a9b(0x1ea))/0xc*(-parseInt(_0x2b4a9b(0x202))/0xd);if(_0x2a0f7e===_0x2513c2)break;else _0xc14067['push'](_0xc14067['shift']());}catch(_0x32885d){_0xc14067['push'](_0xc14067['shift']());}}}(a67_0x326a,0x2d742));import*as a67_0x433164 from'node:fs';import*as a67_0x1f5229 from'node:path';import*as a67_0xc7f053 from'node:os';function a67_0x5da0(_0xdc725b,_0x43c068){_0xdc725b=_0xdc725b-0x1dc;const _0x326a57=a67_0x326a();let _0x5da0b7=_0x326a57[_0xdc725b];return _0x5da0b7;}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 _0x16de72=a67_0x5da0,_0x28f802=process.env.TDX_CONFIG_DIR||a67_0x1f5229[_0x16de72(0x1f7)](a67_0xc7f053[_0x16de72(0x201)](),'.config',_0x16de72(0x1dc));return a67_0x1f5229[_0x16de72(0x1f7)](_0x28f802,_0x16de72(0x1e1));}function getSessionPath(_0x5d1736){const _0x4e51c9=a67_0x5da0;return a67_0x1f5229[_0x4e51c9(0x1f7)](getSessionsDir(),_0x5d1736+'.json');}function a67_0x326a(){const _0x2f5904=['join','existsSync','parse','unlinkSync','push','2250824hmLOqF','2cSYQFr','819705Fxzwwr','toString','readFileSync','homedir','47008DoUfru','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','.\x20This\x20is\x20insecure.\x20Removing\x20session.','warn','191990fYaXlz','tdx','sort','readdirSync','createdAt','utf-8','sessions','890imCWZg','test','now','1972145sGOGGZ','TD_API_KEY','4KhmvUQ','110SNjlWW','replace','516DdOabh','175277mKiejc','writeFileSync','9xWgOYG','stringify','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','getTime','apiKey','10086XAjMuF','endsWith','.json','toISOString','includes'];a67_0x326a=function(){return _0x2f5904;};return a67_0x326a();}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x16a6ee){const _0x241ef8=a67_0x5da0;if(_0x16a6ee)return _0x16a6ee;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x241ef8(0x1ff)]();}export function loadSessionContext(_0x34ddbc){const _0x28051e=a67_0x5da0,_0x45e4d9=getSessionID(_0x34ddbc),_0x3ab7ab=/^\d+$/[_0x28051e(0x1e3)](_0x45e4d9)?parseInt(_0x45e4d9,0xa):null;return _0x3ab7ab!==null?loadSessionContextByPID(_0x3ab7ab):loadSessionContextByString(_0x45e4d9);}export function loadSessionContextByPID(_0x1eb2e6){const _0x5a69de=a67_0x5da0,_0x232dc=getSessionPath(_0x1eb2e6);if(!a67_0x433164[_0x5a69de(0x1f8)](_0x232dc))return null;try{const _0x24814b=a67_0x433164[_0x5a69de(0x200)](_0x232dc,'utf-8'),_0x3f7776=JSON[_0x5a69de(0x1f9)](_0x24814b),_0x4bd189=new Date(_0x3f7776[_0x5a69de(0x1df)])[_0x5a69de(0x1f0)](),_0x26c812=Date['now']();if(_0x26c812-_0x4bd189>SESSION_EXPIRATION_MS)return a67_0x433164[_0x5a69de(0x1fa)](_0x232dc),null;const _0x204839=JSON['stringify'](_0x3f7776);if(_0x204839['includes']('TD_API_KEY')||_0x204839['includes'](_0x5a69de(0x1f1))||_0x204839['includes']('api_key'))return console[_0x5a69de(0x205)](_0x5a69de(0x203)+_0x232dc+_0x5a69de(0x204)),a67_0x433164[_0x5a69de(0x1fa)](_0x232dc),null;return _0x3f7776;}catch{try{a67_0x433164['unlinkSync'](_0x232dc);}catch{}return null;}}function loadSessionContextByString(_0x41eee2){const _0x339d7c=a67_0x5da0,_0x2582e7=a67_0x1f5229[_0x339d7c(0x1f7)](getSessionsDir(),_0x41eee2+_0x339d7c(0x1f4));if(!a67_0x433164[_0x339d7c(0x1f8)](_0x2582e7))return null;try{const _0x21257a=a67_0x433164[_0x339d7c(0x200)](_0x2582e7,_0x339d7c(0x1e0)),_0xe51584=JSON[_0x339d7c(0x1f9)](_0x21257a),_0xa7fab0=new Date(_0xe51584[_0x339d7c(0x1df)])[_0x339d7c(0x1f0)](),_0x18cd07=Date[_0x339d7c(0x1e4)]();if(_0x18cd07-_0xa7fab0>SESSION_EXPIRATION_MS)return a67_0x433164[_0x339d7c(0x1fa)](_0x2582e7),null;const _0xa2bef8=JSON[_0x339d7c(0x1ee)](_0xe51584);if(_0xa2bef8[_0x339d7c(0x1f6)]('TD_API_KEY')||_0xa2bef8['includes']('apiKey')||_0xa2bef8['includes']('api_key'))return console[_0x339d7c(0x205)](_0x339d7c(0x203)+_0x2582e7+_0x339d7c(0x204)),a67_0x433164[_0x339d7c(0x1fa)](_0x2582e7),null;return _0xe51584;}catch{try{a67_0x433164[_0x339d7c(0x1fa)](_0x2582e7);}catch{}return null;}}export function saveSessionContext(_0x3d76c4,_0x158079){const _0x54cd89=a67_0x5da0,_0xee7668=getSessionID(_0x158079),_0x41b7d7=/^\d+$/[_0x54cd89(0x1e3)](_0xee7668)?parseInt(_0xee7668,0xa):getCurrentSessionPID(),_0x39f0d7=a67_0x1f5229[_0x54cd89(0x1f7)](getSessionsDir(),_0xee7668+_0x54cd89(0x1f4)),_0x46326=getSessionsDir();createSecureDirectory(_0x46326);const _0x392f02=JSON[_0x54cd89(0x1ee)](_0x3d76c4);if(_0x392f02['includes'](_0x54cd89(0x1e6))||_0x392f02[_0x54cd89(0x1f6)]('apiKey')||_0x392f02['includes']('api_key'))throw new Error(_0x54cd89(0x1ef));let _0x4775b8;const _0x3bdfcb=/^\d+$/['test'](_0xee7668)?loadSessionContextByPID(parseInt(_0xee7668,0xa)):loadSessionContextByString(_0xee7668);_0x3bdfcb?_0x4775b8={..._0x3bdfcb,..._0x3d76c4,'pid':_0x41b7d7,'sessionId':_0xee7668!==_0x41b7d7[_0x54cd89(0x1ff)]()?_0xee7668:undefined,'updatedAt':new Date()[_0x54cd89(0x1f5)]()}:_0x4775b8={'pid':_0x41b7d7,'sessionId':_0xee7668!==_0x41b7d7[_0x54cd89(0x1ff)]()?_0xee7668:undefined,..._0x3d76c4,'createdAt':new Date()[_0x54cd89(0x1f5)](),'updatedAt':new Date()['toISOString']()},a67_0x433164['writeFileSync'](_0x39f0d7,JSON[_0x54cd89(0x1ee)](_0x4775b8,null,0x2));}export function clearSessionContext(_0xfb4681){const _0x275017=a67_0x5da0,_0x43005a=getSessionID(_0xfb4681),_0x4904c6=a67_0x1f5229[_0x275017(0x1f7)](getSessionsDir(),_0x43005a+_0x275017(0x1f4));a67_0x433164['existsSync'](_0x4904c6)&&a67_0x433164[_0x275017(0x1fa)](_0x4904c6);}export function clearSessionContextField(_0x7cb5b6,_0x55d583){const _0x266ce4=a67_0x5da0,_0x5cc006=getSessionID(_0x55d583),_0x58b2d0=a67_0x1f5229['join'](getSessionsDir(),_0x5cc006+_0x266ce4(0x1f4));if(!a67_0x433164[_0x266ce4(0x1f8)](_0x58b2d0))return;try{const _0x56c828=a67_0x433164[_0x266ce4(0x200)](_0x58b2d0,_0x266ce4(0x1e0)),_0x89459=JSON['parse'](_0x56c828);delete _0x89459[_0x7cb5b6],a67_0x433164[_0x266ce4(0x1ec)](_0x58b2d0,JSON[_0x266ce4(0x1ee)](_0x89459,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x3b7744=a67_0x5da0,_0x44e93a=getSessionsDir();if(!a67_0x433164['existsSync'](_0x44e93a))return 0x0;let _0x5e7613=0x0;const _0x204b92=Date['now']();try{const _0x2e3937=a67_0x433164[_0x3b7744(0x1de)](_0x44e93a);for(const _0x162bcb of _0x2e3937){if(!_0x162bcb[_0x3b7744(0x1f3)](_0x3b7744(0x1f4)))continue;const _0x51daa9=a67_0x1f5229['join'](_0x44e93a,_0x162bcb),_0x404d33=_0x162bcb[_0x3b7744(0x1e9)](_0x3b7744(0x1f4),''),_0x2847cb=parseInt(_0x404d33,0xa),_0x367f9a=!isNaN(_0x2847cb);if(_0x367f9a){if(!isProcessRunning(_0x2847cb)){a67_0x433164[_0x3b7744(0x1fa)](_0x51daa9),_0x5e7613++;continue;}}try{const _0xb393f5=a67_0x433164[_0x3b7744(0x200)](_0x51daa9,_0x3b7744(0x1e0)),_0x2b282c=JSON[_0x3b7744(0x1f9)](_0xb393f5),_0x19e05c=new Date(_0x2b282c[_0x3b7744(0x1df)])['getTime']();_0x204b92-_0x19e05c>SESSION_EXPIRATION_MS&&(a67_0x433164[_0x3b7744(0x1fa)](_0x51daa9),_0x5e7613++);}catch{a67_0x433164['unlinkSync'](_0x51daa9),_0x5e7613++;}}}catch{}return _0x5e7613;}export function listActiveSessions(){const _0xeefcf7=a67_0x5da0,_0x443654=getSessionsDir();if(!a67_0x433164[_0xeefcf7(0x1f8)](_0x443654))return[];try{const _0x4fcce7=a67_0x433164[_0xeefcf7(0x1de)](_0x443654),_0x5dcf14=[];for(const _0x3a43ed of _0x4fcce7){if(!_0x3a43ed['endsWith']('.json'))continue;const _0x3c2341=_0x3a43ed[_0xeefcf7(0x1e9)]('.json',''),_0x5a7a3a=parseInt(_0x3c2341,0xa);!isNaN(_0x5a7a3a)&&isProcessRunning(_0x5a7a3a)&&_0x5dcf14[_0xeefcf7(0x1fb)](_0x5a7a3a);}return _0x5dcf14[_0xeefcf7(0x1dd)]((_0x3fab7b,_0x48b220)=>_0x3fab7b-_0x48b220);}catch{return[];}}
1
+ (function(_0x1772b3,_0x81b553){const _0x51ccd9=a67_0x4306,_0x2bdeb6=_0x1772b3();while(!![]){try{const _0xe53369=parseInt(_0x51ccd9(0x93))/0x1+-parseInt(_0x51ccd9(0x85))/0x2+parseInt(_0x51ccd9(0x7a))/0x3+parseInt(_0x51ccd9(0x82))/0x4*(-parseInt(_0x51ccd9(0x76))/0x5)+parseInt(_0x51ccd9(0x79))/0x6+parseInt(_0x51ccd9(0x83))/0x7+-parseInt(_0x51ccd9(0x96))/0x8;if(_0xe53369===_0x81b553)break;else _0x2bdeb6['push'](_0x2bdeb6['shift']());}catch(_0x4997c2){_0x2bdeb6['push'](_0x2bdeb6['shift']());}}}(a67_0x3b6f,0xee66a));import*as a67_0x38809a from'node:fs';import*as a67_0x32b029 from'node:path';import*as a67_0x3f06f9 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 _0x27697c=a67_0x4306,_0x2f045f=process.env.TDX_CONFIG_DIR||a67_0x32b029[_0x27697c(0x8d)](a67_0x3f06f9[_0x27697c(0x7f)](),'.config',_0x27697c(0x84));return a67_0x32b029[_0x27697c(0x8d)](_0x2f045f,'sessions');}function getSessionPath(_0x4965e7){const _0x90401c=a67_0x4306;return a67_0x32b029['join'](getSessionsDir(),_0x4965e7+_0x90401c(0x8e));}function a67_0x4306(_0x57f098,_0x46c52c){_0x57f098=_0x57f098-0x76;const _0x3b6f76=a67_0x3b6f();let _0x430684=_0x3b6f76[_0x57f098];return _0x430684;}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x2ea867){if(_0x2ea867)return _0x2ea867;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x4120ba){const _0x158408=a67_0x4306,_0x4e20cb=getSessionID(_0x4120ba),_0x4681ed=/^\d+$/[_0x158408(0x7e)](_0x4e20cb)?parseInt(_0x4e20cb,0xa):null;return _0x4681ed!==null?loadSessionContextByPID(_0x4681ed):loadSessionContextByString(_0x4e20cb);}export function loadSessionContextByPID(_0xa9a36c){const _0x2d8810=a67_0x4306,_0x1c63dd=getSessionPath(_0xa9a36c);if(!a67_0x38809a[_0x2d8810(0x7d)](_0x1c63dd))return null;try{const _0x5f38fc=a67_0x38809a[_0x2d8810(0x78)](_0x1c63dd,_0x2d8810(0x92)),_0x363507=JSON[_0x2d8810(0x8a)](_0x5f38fc),_0x335bf5=new Date(_0x363507[_0x2d8810(0x80)])[_0x2d8810(0x8c)](),_0x36c79e=Date[_0x2d8810(0x7b)]();if(_0x36c79e-_0x335bf5>SESSION_EXPIRATION_MS)return a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd),null;const _0xd73d35=JSON[_0x2d8810(0x91)](_0x363507);if(_0xd73d35[_0x2d8810(0x94)](_0x2d8810(0x8b))||_0xd73d35[_0x2d8810(0x94)](_0x2d8810(0x89))||_0xd73d35['includes'](_0x2d8810(0x95)))return console[_0x2d8810(0x86)](_0x2d8810(0x87)+_0x1c63dd+_0x2d8810(0x90)),a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd),null;return _0x363507;}catch{try{a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd);}catch{}return null;}}function loadSessionContextByString(_0x4dd4a3){const _0x56721e=a67_0x4306,_0x181856=a67_0x32b029[_0x56721e(0x8d)](getSessionsDir(),_0x4dd4a3+_0x56721e(0x8e));if(!a67_0x38809a[_0x56721e(0x7d)](_0x181856))return null;try{const _0x5c886f=a67_0x38809a['readFileSync'](_0x181856,_0x56721e(0x92)),_0x5dc5e8=JSON[_0x56721e(0x8a)](_0x5c886f),_0x3ee68c=new Date(_0x5dc5e8[_0x56721e(0x80)])['getTime'](),_0x548323=Date['now']();if(_0x548323-_0x3ee68c>SESSION_EXPIRATION_MS)return a67_0x38809a['unlinkSync'](_0x181856),null;const _0x5b9476=JSON['stringify'](_0x5dc5e8);if(_0x5b9476[_0x56721e(0x94)]('TD_API_KEY')||_0x5b9476[_0x56721e(0x94)](_0x56721e(0x89))||_0x5b9476[_0x56721e(0x94)](_0x56721e(0x95)))return console['warn'](_0x56721e(0x87)+_0x181856+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a67_0x38809a[_0x56721e(0x97)](_0x181856),null;return _0x5dc5e8;}catch{try{a67_0x38809a['unlinkSync'](_0x181856);}catch{}return null;}}export function saveSessionContext(_0x371217,_0x50bfa1){const _0x2b118c=a67_0x4306,_0x559a89=getSessionID(_0x50bfa1),_0x54ff14=/^\d+$/[_0x2b118c(0x7e)](_0x559a89)?parseInt(_0x559a89,0xa):getCurrentSessionPID(),_0x4c6201=a67_0x32b029[_0x2b118c(0x8d)](getSessionsDir(),_0x559a89+_0x2b118c(0x8e)),_0x571174=getSessionsDir();createSecureDirectory(_0x571174);const _0x267fab=JSON['stringify'](_0x371217);if(_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x8b))||_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x89))||_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x95)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x4dd08f;const _0x4a5f2c=/^\d+$/[_0x2b118c(0x7e)](_0x559a89)?loadSessionContextByPID(parseInt(_0x559a89,0xa)):loadSessionContextByString(_0x559a89);_0x4a5f2c?_0x4dd08f={..._0x4a5f2c,..._0x371217,'pid':_0x54ff14,'sessionId':_0x559a89!==_0x54ff14[_0x2b118c(0x88)]()?_0x559a89:undefined,'updatedAt':new Date()[_0x2b118c(0x81)]()}:_0x4dd08f={'pid':_0x54ff14,'sessionId':_0x559a89!==_0x54ff14['toString']()?_0x559a89:undefined,..._0x371217,'createdAt':new Date()[_0x2b118c(0x81)](),'updatedAt':new Date()[_0x2b118c(0x81)]()},a67_0x38809a[_0x2b118c(0x77)](_0x4c6201,JSON[_0x2b118c(0x91)](_0x4dd08f,null,0x2));}export function clearSessionContext(_0x38a46e){const _0x11d4fb=a67_0x4306,_0x59537d=getSessionID(_0x38a46e),_0x44ee7c=a67_0x32b029[_0x11d4fb(0x8d)](getSessionsDir(),_0x59537d+_0x11d4fb(0x8e));a67_0x38809a[_0x11d4fb(0x7d)](_0x44ee7c)&&a67_0x38809a[_0x11d4fb(0x97)](_0x44ee7c);}export function clearSessionContextField(_0x54ba19,_0x584ae2){const _0x2e5319=a67_0x4306,_0x4cd87e=getSessionID(_0x584ae2),_0x12f3a9=a67_0x32b029[_0x2e5319(0x8d)](getSessionsDir(),_0x4cd87e+_0x2e5319(0x8e));if(!a67_0x38809a['existsSync'](_0x12f3a9))return;try{const _0x36d044=a67_0x38809a[_0x2e5319(0x78)](_0x12f3a9,_0x2e5319(0x92)),_0x5ead7c=JSON[_0x2e5319(0x8a)](_0x36d044);delete _0x5ead7c[_0x54ba19],a67_0x38809a[_0x2e5319(0x77)](_0x12f3a9,JSON['stringify'](_0x5ead7c,null,0x2));}catch{}}function a67_0x3b6f(){const _0x3ba61b=['includes','api_key','7709488DCmTkG','unlinkSync','replace','sort','42170pDDhSo','writeFileSync','readFileSync','2133648XaXtXQ','46254BQAMTV','now','push','existsSync','test','homedir','createdAt','toISOString','136xnbtEP','6983942vZQDdE','tdx','712162pxjVGR','warn','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','toString','apiKey','parse','TD_API_KEY','getTime','join','.json','endsWith','.\x20This\x20is\x20insecure.\x20Removing\x20session.','stringify','utf-8','1214281oGwqKW'];a67_0x3b6f=function(){return _0x3ba61b;};return a67_0x3b6f();}export function cleanExpiredSessions(){const _0x558343=a67_0x4306,_0x1987a0=getSessionsDir();if(!a67_0x38809a[_0x558343(0x7d)](_0x1987a0))return 0x0;let _0x47cbc7=0x0;const _0x27f2c1=Date[_0x558343(0x7b)]();try{const _0x490d86=a67_0x38809a['readdirSync'](_0x1987a0);for(const _0x424687 of _0x490d86){if(!_0x424687[_0x558343(0x8f)](_0x558343(0x8e)))continue;const _0x5d06a4=a67_0x32b029[_0x558343(0x8d)](_0x1987a0,_0x424687),_0x48d2c5=_0x424687[_0x558343(0x98)](_0x558343(0x8e),''),_0x1dc087=parseInt(_0x48d2c5,0xa),_0x3bc07a=!isNaN(_0x1dc087);if(_0x3bc07a){if(!isProcessRunning(_0x1dc087)){a67_0x38809a['unlinkSync'](_0x5d06a4),_0x47cbc7++;continue;}}try{const _0x13dd82=a67_0x38809a[_0x558343(0x78)](_0x5d06a4,_0x558343(0x92)),_0x542d19=JSON['parse'](_0x13dd82),_0xf0eccb=new Date(_0x542d19[_0x558343(0x80)])[_0x558343(0x8c)]();_0x27f2c1-_0xf0eccb>SESSION_EXPIRATION_MS&&(a67_0x38809a['unlinkSync'](_0x5d06a4),_0x47cbc7++);}catch{a67_0x38809a[_0x558343(0x97)](_0x5d06a4),_0x47cbc7++;}}}catch{}return _0x47cbc7;}export function listActiveSessions(){const _0x41b3ee=a67_0x4306,_0x43d56f=getSessionsDir();if(!a67_0x38809a[_0x41b3ee(0x7d)](_0x43d56f))return[];try{const _0x167cda=a67_0x38809a['readdirSync'](_0x43d56f),_0x3cb317=[];for(const _0x120cbf of _0x167cda){if(!_0x120cbf[_0x41b3ee(0x8f)](_0x41b3ee(0x8e)))continue;const _0x55c624=_0x120cbf[_0x41b3ee(0x98)](_0x41b3ee(0x8e),''),_0xd9ae22=parseInt(_0x55c624,0xa);!isNaN(_0xd9ae22)&&isProcessRunning(_0xd9ae22)&&_0x3cb317[_0x41b3ee(0x7c)](_0xd9ae22);}return _0x3cb317[_0x41b3ee(0x99)]((_0x3c4cfa,_0x35ff02)=>_0x3c4cfa-_0x35ff02);}catch{return[];}}
@@ -1 +1 @@
1
- function a68_0x10b8(_0xa36bd5,_0x36b638){_0xa36bd5=_0xa36bd5-0x92;const _0x55eeeb=a68_0x55ee();let _0x10b8c8=_0x55eeeb[_0xa36bd5];return _0x10b8c8;}const a68_0x39084a=a68_0x10b8;(function(_0x424e67,_0x22df08){const _0x3e80f2=a68_0x10b8,_0x3ccc86=_0x424e67();while(!![]){try{const _0x3e7396=parseInt(_0x3e80f2(0x9d))/0x1+parseInt(_0x3e80f2(0x9e))/0x2*(parseInt(_0x3e80f2(0xa1))/0x3)+parseInt(_0x3e80f2(0x9a))/0x4*(-parseInt(_0x3e80f2(0x92))/0x5)+-parseInt(_0x3e80f2(0x96))/0x6+parseInt(_0x3e80f2(0x97))/0x7*(-parseInt(_0x3e80f2(0xa0))/0x8)+-parseInt(_0x3e80f2(0x95))/0x9*(parseInt(_0x3e80f2(0x9f))/0xa)+parseInt(_0x3e80f2(0x94))/0xb*(parseInt(_0x3e80f2(0x99))/0xc);if(_0x3e7396===_0x22df08)break;else _0x3ccc86['push'](_0x3ccc86['shift']());}catch(_0x4466ea){_0x3ccc86['push'](_0x3ccc86['shift']());}}}(a68_0x55ee,0x6864e));function a68_0x55ee(){const _0x3d6ba2=['182943XGUPyS','173940nVylir','users-{profile}.json','5533bJzXwv','117nBjbPh','3815532dzxbxB','1918Qmlodn','users','51852QOnaVH','88EXgYwH','now','core/user-cache','736459CuSvYo','6DlygOH','612110nxzOLB','13672MdaRGu'];a68_0x55ee=function(){return _0x3d6ba2;};return a68_0x55ee();}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x39084a(0x93),a68_0x39084a(0x9c));export function loadCachedUsers(_0x402354){const _0x1c4264=a68_0x39084a,_0xe4a9be=userCache['read'](_0x402354);return _0xe4a9be?.[_0x1c4264(0x98)]??null;}export function saveCachedUsers(_0x2f6267,_0x5ec497){const _0x5418b7=a68_0x39084a;userCache['write'](_0x2f6267,{'users':_0x5ec497,'cachedAt':Date[_0x5418b7(0x9b)]()});}export function clearUserCache(_0x5da756){userCache['clear'](_0x5da756);}
1
+ const a68_0x45998c=a68_0x5f1c;(function(_0x54a383,_0x44d52b){const _0x22ca9e=a68_0x5f1c,_0x3fb006=_0x54a383();while(!![]){try{const _0x10790f=parseInt(_0x22ca9e(0x8b))/0x1+parseInt(_0x22ca9e(0x85))/0x2+-parseInt(_0x22ca9e(0x8a))/0x3+parseInt(_0x22ca9e(0x89))/0x4+parseInt(_0x22ca9e(0x8c))/0x5+parseInt(_0x22ca9e(0x84))/0x6+-parseInt(_0x22ca9e(0x8e))/0x7*(parseInt(_0x22ca9e(0x83))/0x8);if(_0x10790f===_0x44d52b)break;else _0x3fb006['push'](_0x3fb006['shift']());}catch(_0x411835){_0x3fb006['push'](_0x3fb006['shift']());}}}(a68_0x41a0,0x506aa));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x45998c(0x90),'core/user-cache');export function loadCachedUsers(_0xe39624){const _0x5f5545=a68_0x45998c,_0x35a49e=userCache[_0x5f5545(0x86)](_0xe39624);return _0x35a49e?.[_0x5f5545(0x8f)]??null;}export function saveCachedUsers(_0x4c287f,_0x13099d){const _0x2eae4b=a68_0x45998c;userCache[_0x2eae4b(0x87)](_0x4c287f,{'users':_0x13099d,'cachedAt':Date[_0x2eae4b(0x8d)]()});}export function clearUserCache(_0x6b759b){const _0xdbeadd=a68_0x45998c;userCache[_0xdbeadd(0x88)](_0x6b759b);}function a68_0x5f1c(_0x58ef73,_0x247c51){_0x58ef73=_0x58ef73-0x83;const _0x41a0a7=a68_0x41a0();let _0x5f1c65=_0x41a0a7[_0x58ef73];return _0x5f1c65;}function a68_0x41a0(){const _0x3139b3=['read','write','clear','2369320NhrOgO','708561ENNwZA','330784aScqWL','1052615LxeSze','now','9328781HiMQoQ','users','users-{profile}.json','8UwxJGt','701304ansqAm','1295470XkoiHX'];a68_0x41a0=function(){return _0x3139b3;};return a68_0x41a0();}
@@ -1 +1 @@
1
- (function(_0x154d95,_0xd7700b){const _0x2c5bc5=a69_0x3dce,_0x9fa243=_0x154d95();while(!![]){try{const _0x585367=parseInt(_0x2c5bc5(0xf3))/0x1+parseInt(_0x2c5bc5(0xe6))/0x2+-parseInt(_0x2c5bc5(0xf0))/0x3+parseInt(_0x2c5bc5(0xee))/0x4+-parseInt(_0x2c5bc5(0xed))/0x5+parseInt(_0x2c5bc5(0xec))/0x6+-parseInt(_0x2c5bc5(0xf2))/0x7;if(_0x585367===_0xd7700b)break;else _0x9fa243['push'](_0x9fa243['shift']());}catch(_0x6e74de){_0x9fa243['push'](_0x9fa243['shift']());}}}(a69_0x3b36,0x83f8e));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x2dde8e=a69_0x3dce;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x121399=fileURLToPath(import.meta.url),_0x1fba8c=dirname(_0x121399);try{const _0x2fb37a=join(_0x1fba8c,_0x2dde8e(0xf1));cachedBuildInfo=JSON['parse'](readFileSync(_0x2fb37a,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x507fb4=a69_0x3dce;if(cachedVersion!==null)return cachedVersion;const _0x30bfbb=fileURLToPath(import.meta.url),_0x38eebf=dirname(_0x30bfbb),_0x5d6aa9=getBuildInfo();if(_0x5d6aa9[_0x507fb4(0xe9)])return cachedVersion=_0x5d6aa9['version'],cachedVersion;try{const _0xba86d8=join(_0x38eebf,_0x507fb4(0xe7)),_0x5417e2=JSON['parse'](readFileSync(_0xba86d8,_0x507fb4(0xe8)));cachedVersion=_0x5417e2[_0x507fb4(0xe9)];}catch{cachedVersion=_0x507fb4(0xeb);}return cachedVersion;}function a69_0x3b36(){const _0x1a0829=['297188SCJppj','784862BaSmgd','../../package.json','utf-8','version','.dev','0.0.0','4039230HwSZgS','4144975BkaBaK','1754124NZRQVR','includes','302094wrMFYn','../build-info.json','2317728bNBgbO'];a69_0x3b36=function(){return _0x1a0829;};return a69_0x3b36();}function a69_0x3dce(_0x3d4a60,_0x296c80){_0x3d4a60=_0x3d4a60-0xe6;const _0x3b36c4=a69_0x3b36();let _0x3dce54=_0x3b36c4[_0x3d4a60];return _0x3dce54;}export function isDevVersion(){const _0x3d0ef7=a69_0x3dce,_0x56c474=getVersion();return _0x56c474[_0x3d0ef7(0xef)](_0x3d0ef7(0xea))||_0x56c474['includes']('-');}
1
+ (function(_0x22ad37,_0x24fede){const _0x4b7a43=a69_0x37d0,_0x1915ef=_0x22ad37();while(!![]){try{const _0x5b1b62=-parseInt(_0x4b7a43(0x170))/0x1*(-parseInt(_0x4b7a43(0x16f))/0x2)+-parseInt(_0x4b7a43(0x173))/0x3+parseInt(_0x4b7a43(0x164))/0x4*(-parseInt(_0x4b7a43(0x168))/0x5)+-parseInt(_0x4b7a43(0x16d))/0x6*(parseInt(_0x4b7a43(0x16a))/0x7)+-parseInt(_0x4b7a43(0x16b))/0x8+-parseInt(_0x4b7a43(0x166))/0x9*(parseInt(_0x4b7a43(0x162))/0xa)+-parseInt(_0x4b7a43(0x165))/0xb*(-parseInt(_0x4b7a43(0x163))/0xc);if(_0x5b1b62===_0x24fede)break;else _0x1915ef['push'](_0x1915ef['shift']());}catch(_0x332bc8){_0x1915ef['push'](_0x1915ef['shift']());}}}(a69_0xc253,0xabaa9));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a69_0x37d0(_0x22fab1,_0x454187){_0x22fab1=_0x22fab1-0x161;const _0xc2536a=a69_0xc253();let _0x37d0e0=_0xc2536a[_0x22fab1];return _0x37d0e0;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x59e16e=a69_0x37d0;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4738ad=fileURLToPath(import.meta.url),_0x40a250=dirname(_0x4738ad);try{const _0x3e6ad6=join(_0x40a250,_0x59e16e(0x172));cachedBuildInfo=JSON[_0x59e16e(0x171)](readFileSync(_0x3e6ad6,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}function a69_0xc253(){const _0x51ef23=['5ynvAfR','version','7KvaaMq','1683432zcPaDq','../../package.json','3832806GxKyQz','.dev','4oSRice','55299VpICfK','parse','../build-info.json','3459021fdMuCU','utf-8','10zAHClN','180vwiWqY','4247828VmmPFH','3458972InVjjV','9540351GfWCoK','includes'];a69_0xc253=function(){return _0x51ef23;};return a69_0xc253();}export function getVersion(){const _0x3a9c51=a69_0x37d0;if(cachedVersion!==null)return cachedVersion;const _0x5db132=fileURLToPath(import.meta.url),_0x4360ba=dirname(_0x5db132),_0x5c8ad9=getBuildInfo();if(_0x5c8ad9[_0x3a9c51(0x169)])return cachedVersion=_0x5c8ad9['version'],cachedVersion;try{const _0x37f38e=join(_0x4360ba,_0x3a9c51(0x16c)),_0x4e9c2f=JSON[_0x3a9c51(0x171)](readFileSync(_0x37f38e,_0x3a9c51(0x161)));cachedVersion=_0x4e9c2f['version'];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x2311c3=a69_0x37d0,_0x11badf=getVersion();return _0x11badf['includes'](_0x2311c3(0x16e))||_0x11badf[_0x2311c3(0x167)]('-');}