@treasuredata/tdx 2026.4.9 → 2026.4.10

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 (228) 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.d.ts.map +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-command.js.map +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.js +1 -1
  69. package/dist/core/profile.js +1 -1
  70. package/dist/core/project-config.js +1 -1
  71. package/dist/core/session.js +1 -1
  72. package/dist/core/user-cache.js +1 -1
  73. package/dist/core/version.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/mcp/server.js +1 -1
  76. package/dist/mcp/tools/index.js +1 -1
  77. package/dist/mcp/tools/tdx-run.js +1 -1
  78. package/dist/mcp/tools/tdx-search.js +1 -1
  79. package/dist/mcp/tools/work-create-item.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.js +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/sse-usage-parser.js +1 -1
  84. package/dist/sdk/agent/agent-config.js +1 -1
  85. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/test/evaluator.js +1 -1
  88. package/dist/sdk/agent/test/executor.js +1 -1
  89. package/dist/sdk/agent/test/index.js +1 -1
  90. package/dist/sdk/agent/test/output.js +1 -1
  91. package/dist/sdk/agent/test/parser.js +1 -1
  92. package/dist/sdk/agent/tool-target-registry.js +1 -1
  93. package/dist/sdk/api.js +1 -1
  94. package/dist/sdk/cas/cas-api-client.js +1 -1
  95. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  96. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  97. package/dist/sdk/cas/index.js +1 -1
  98. package/dist/sdk/cas/pull-workflow.js +1 -1
  99. package/dist/sdk/cas/push-workflow.js +1 -1
  100. package/dist/sdk/client/cdp-api-client.js +1 -1
  101. package/dist/sdk/client/delivery-api-client.js +1 -1
  102. package/dist/sdk/client/endpoints.js +1 -1
  103. package/dist/sdk/client/engage-api-client.js +1 -1
  104. package/dist/sdk/client/http-client.js +1 -1
  105. package/dist/sdk/client/llm-api-client.js +1 -1
  106. package/dist/sdk/client/oauth-refresh.js +1 -1
  107. package/dist/sdk/client/rate-limiter.js +1 -1
  108. package/dist/sdk/client/td-api-client.js +1 -1
  109. package/dist/sdk/client/trino-api-client.js +1 -1
  110. package/dist/sdk/client/workflow-client.js +1 -1
  111. package/dist/sdk/connection-validator.js +1 -1
  112. package/dist/sdk/connection.js +1 -1
  113. package/dist/sdk/delivery.js +1 -1
  114. package/dist/sdk/engage/campaign-pull.js +1 -1
  115. package/dist/sdk/engage/campaign-push.js +1 -1
  116. package/dist/sdk/engage/campaign-validator.js +1 -1
  117. package/dist/sdk/engage/campaign-yaml.js +1 -1
  118. package/dist/sdk/engage/template-pull.js +1 -1
  119. package/dist/sdk/engage/template-push.js +1 -1
  120. package/dist/sdk/engage/template-validator.js +1 -1
  121. package/dist/sdk/engage/template-yaml.js +1 -1
  122. package/dist/sdk/engage/types/campaign-def.js +1 -1
  123. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  124. package/dist/sdk/engage/types/template-schema.js +1 -1
  125. package/dist/sdk/engage.js +1 -1
  126. package/dist/sdk/errors.js +1 -1
  127. package/dist/sdk/index.js +1 -1
  128. package/dist/sdk/io/index.js +1 -1
  129. package/dist/sdk/io/node-filesystem.js +1 -1
  130. package/dist/sdk/job.js +1 -1
  131. package/dist/sdk/journey.js +1 -1
  132. package/dist/sdk/llm/chat-cache.js +1 -1
  133. package/dist/sdk/llm/index.js +1 -1
  134. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  135. package/dist/sdk/llm/model-factors.js +1 -1
  136. package/dist/sdk/personalization.js +1 -1
  137. package/dist/sdk/policy.js +1 -1
  138. package/dist/sdk/query/index.js +1 -1
  139. package/dist/sdk/query/sql-parser.js +1 -1
  140. package/dist/sdk/realtime.js +1 -1
  141. package/dist/sdk/schedule.js +1 -1
  142. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/fields-display.js +1 -1
  144. package/dist/sdk/segment/file-discovery.js +1 -1
  145. package/dist/sdk/segment/journey-utils.js +1 -1
  146. package/dist/sdk/segment/journey-validator.js +1 -1
  147. package/dist/sdk/segment/journey-yaml.js +1 -1
  148. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  149. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  150. package/dist/sdk/segment/pull-workflow.js +1 -1
  151. package/dist/sdk/segment/push-recovery.js +1 -1
  152. package/dist/sdk/segment/push-workflow.js +1 -1
  153. package/dist/sdk/segment/resolution-context.js +1 -1
  154. package/dist/sdk/segment/segment-path-parser.js +1 -1
  155. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  156. package/dist/sdk/segment/segment-validator.js +1 -1
  157. package/dist/sdk/segment/target-resolution.js +1 -1
  158. package/dist/sdk/segment/tdx-config.js +1 -1
  159. package/dist/sdk/segment/types/activation-schema.js +1 -1
  160. package/dist/sdk/segment/types/journey-def.js +1 -1
  161. package/dist/sdk/segment/types/journey-schema.js +1 -1
  162. package/dist/sdk/segment/types/segment-def.js +1 -1
  163. package/dist/sdk/segment/types/segment-schema.js +1 -1
  164. package/dist/sdk/segment/validate-files.js +1 -1
  165. package/dist/sdk/segment/yaml-validator.js +1 -1
  166. package/dist/sdk/segment.js +1 -1
  167. package/dist/sdk/types/index.js +1 -1
  168. package/dist/sdk/types/progress.js +1 -1
  169. package/dist/sdk/types/workspace.js +1 -1
  170. package/dist/sdk/user.js +1 -1
  171. package/dist/sdk/util/format-detector.js +1 -1
  172. package/dist/sdk/util/formatters.js +1 -1
  173. package/dist/sdk/util/index.js +1 -1
  174. package/dist/sdk/util/paginate.js +1 -1
  175. package/dist/sdk/util/tree-formatter.js +1 -1
  176. package/dist/sdk/workflow/archive-validation.js +1 -1
  177. package/dist/sdk/workflow/clone-workflow.js +1 -1
  178. package/dist/sdk/workflow/index.js +1 -1
  179. package/dist/sdk/workflow/pull-workflow.js +1 -1
  180. package/dist/sdk/workflow/push-workflow.js +1 -1
  181. package/dist/sdk/workflow/tdx-config.js +1 -1
  182. package/dist/sdk/workflow/workflow-utils.js +1 -1
  183. package/dist/sdk/workspace/access-tracker.js +1 -1
  184. package/dist/sdk/workspace/frontmatter.js +1 -1
  185. package/dist/sdk/workspace/git.d.ts +52 -0
  186. package/dist/sdk/workspace/git.d.ts.map +1 -1
  187. package/dist/sdk/workspace/git.js +1 -1
  188. package/dist/sdk/workspace/git.js.map +1 -1
  189. package/dist/sdk/workspace/index.d.ts +14 -0
  190. package/dist/sdk/workspace/index.d.ts.map +1 -1
  191. package/dist/sdk/workspace/index.js +1 -1
  192. package/dist/sdk/workspace/index.js.map +1 -1
  193. package/dist/sdk/workspace/templates.js +1 -1
  194. package/dist/sdk/workspace/weekly.js +1 -1
  195. package/dist/sdk/workspace/wikilinks.js +1 -1
  196. package/dist/test-utils/command-runner.js +1 -1
  197. package/dist/test-utils/factories.js +1 -1
  198. package/dist/test-utils/fixtures.js +1 -1
  199. package/dist/test-utils/http-mock.js +1 -1
  200. package/dist/test-utils/index.js +1 -1
  201. package/dist/utils/async.js +1 -1
  202. package/dist/utils/colors.js +1 -1
  203. package/dist/utils/diff.js +1 -1
  204. package/dist/utils/file-permissions.js +1 -1
  205. package/dist/utils/file-reader.js +1 -1
  206. package/dist/utils/github-releases.js +1 -1
  207. package/dist/utils/global-cache.js +1 -1
  208. package/dist/utils/json-loader.js +1 -1
  209. package/dist/utils/local-cache.js +1 -1
  210. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  211. package/dist/utils/logger/formatters/index.js +1 -1
  212. package/dist/utils/logger/handlers/console-handler.js +1 -1
  213. package/dist/utils/logger/handlers/file-handler.js +1 -1
  214. package/dist/utils/logger/handlers/index.js +1 -1
  215. package/dist/utils/logger/handlers/null-handler.js +1 -1
  216. package/dist/utils/logger/index.js +1 -1
  217. package/dist/utils/logger/logger.js +1 -1
  218. package/dist/utils/logger/types.js +1 -1
  219. package/dist/utils/option-validation.js +1 -1
  220. package/dist/utils/process.js +1 -1
  221. package/dist/utils/prompt.js +1 -1
  222. package/dist/utils/spinner.js +1 -1
  223. package/dist/utils/sse-parser.js +1 -1
  224. package/dist/utils/string-utils.js +1 -1
  225. package/dist/utils/table-ref-parser.js +1 -1
  226. package/dist/utils/tdx-logger.js +1 -1
  227. package/dist/utils/version-check.js +1 -1
  228. package/package.json +2 -1
@@ -1 +1 @@
1
- const a57_0x269ec9=a57_0x4eae;(function(_0x522b08,_0x2b15b9){const _0x8de181=a57_0x4eae,_0x112ba1=_0x522b08();while(!![]){try{const _0x33b0f5=-parseInt(_0x8de181(0x1d6))/0x1+parseInt(_0x8de181(0x1de))/0x2+parseInt(_0x8de181(0x203))/0x3+parseInt(_0x8de181(0x1e4))/0x4*(-parseInt(_0x8de181(0x214))/0x5)+parseInt(_0x8de181(0x20a))/0x6*(-parseInt(_0x8de181(0x1fb))/0x7)+-parseInt(_0x8de181(0x1d4))/0x8*(parseInt(_0x8de181(0x216))/0x9)+parseInt(_0x8de181(0x1e5))/0xa*(parseInt(_0x8de181(0x202))/0xb);if(_0x33b0f5===_0x2b15b9)break;else _0x112ba1['push'](_0x112ba1['shift']());}catch(_0x5cc5b7){_0x112ba1['push'](_0x112ba1['shift']());}}}(a57_0x59cb,0xb7883));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x2eb65e from'node:fs';import*as a57_0x3ae796 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_0x56d954 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){return process.env.TDX_CONFIG_DIR||join(homedir(),'.config','tdx');}export function getConfigFile(){const _0x9a7e2d=a57_0x4eae;return join(getConfigDir(),_0x9a7e2d(0x1f2));}export function getConfigFilePath(_0x27e977){const _0x5d8570=a57_0x4eae,_0x53e708=getConfigDir();return _0x27e977?a57_0x3ae796[_0x5d8570(0x1fa)](_0x53e708,_0x5d8570(0x219)+_0x27e977):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x269ec9(0x1db),a57_0x269ec9(0x1f6));function a57_0x4eae(_0x565927,_0x174d3d){_0x565927=_0x565927-0x1d4;const _0x59cb8a=a57_0x59cb();let _0x4eae17=_0x59cb8a[_0x565927];return _0x4eae17;}export function getLLMProjectCacheFile(_0x5e4a68){const _0x547d69=a57_0x269ec9;return llmProjectCache[_0x547d69(0x1e6)](_0x5e4a68);}export function readCachedLLMProject(_0x4280cc){const _0x2e6e39=a57_0x269ec9,_0xe62a04=llmProjectCache['read'](_0x4280cc);if(_0xe62a04&&typeof _0xe62a04['id']===_0x2e6e39(0x213)&&typeof _0xe62a04[_0x2e6e39(0x1f1)]==='string')return _0xe62a04;return null;}export function writeCachedLLMProject(_0x441b0a,_0x22fee4,_0x479f05){try{llmProjectCache['write']({'name':_0x441b0a,'id':_0x22fee4},_0x479f05);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a57_0x269ec9(0x20d));export function getLLMAgentCacheFile(_0x3aed3b){const _0x5689d5=a57_0x269ec9;return llmAgentCache[_0x5689d5(0x1e6)](_0x3aed3b);}export function readCachedLLMAgent(_0x290e6c){const _0x5da242=a57_0x269ec9,_0x5e6cac=llmAgentCache[_0x5da242(0x1f0)](_0x290e6c);if(_0x5e6cac&&typeof _0x5e6cac['id']===_0x5da242(0x213)&&typeof _0x5e6cac[_0x5da242(0x1f1)]===_0x5da242(0x213)&&typeof _0x5e6cac[_0x5da242(0x1f5)]===_0x5da242(0x213))return _0x5e6cac;return null;}export function writeCachedLLMAgent(_0x12a333,_0x108c89,_0x409845,_0x5693a1){const _0x233d65=a57_0x269ec9;try{llmAgentCache[_0x233d65(0x207)]({'name':_0x12a333,'id':_0x108c89,'projectId':_0x409845},_0x5693a1);}catch{}}export function clearCachedLLMAgent(_0x3131aa){const _0x4161de=a57_0x269ec9;try{llmAgentCache[_0x4161de(0x21b)](_0x3131aa);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x269ec9(0x1ed),a57_0x269ec9(0x21a),{'suffix':a57_0x269ec9(0x200)});export function getAccountInfoCacheFile(_0x550d74){const _0x411249=a57_0x269ec9;return accountInfoCache[_0x411249(0x1e6)](_0x550d74);}export function readCachedAccountInfo(_0x4b8b6c){const _0x37ba12=a57_0x269ec9,_0x47f823=accountInfoCache[_0x37ba12(0x1f0)](_0x4b8b6c);if(_0x47f823&&typeof _0x47f823[_0x37ba12(0x218)]===_0x37ba12(0x213)&&typeof _0x47f823[_0x37ba12(0x212)]==='number')return _0x47f823;return null;}export function writeCachedAccountInfo(_0x105d85,_0x3d50c3,_0x23f52f){const _0x4b221b=a57_0x269ec9;try{accountInfoCache[_0x4b221b(0x207)]({'site':_0x105d85,'accountId':_0x3d50c3,'cachedAt':new Date()[_0x4b221b(0x1ef)]()},_0x23f52f);}catch{}}export function parseEnvFile(_0x1ec4c9){const _0x3df23e=a57_0x269ec9,_0x5780c3={};for(const _0xf348c0 of _0x1ec4c9[_0x3df23e(0x1e2)]('\x0a')){const _0x4f1222=_0xf348c0['trim']();if(!_0x4f1222||_0x4f1222[_0x3df23e(0x1d9)]('#'))continue;const _0x4b02fb=_0x4f1222[_0x3df23e(0x1df)](/^([^=]+)=(.*)$/);if(_0x4b02fb){const _0x383487=_0x4b02fb[0x1][_0x3df23e(0x21c)]();let _0x3abd22=_0x4b02fb[0x2][_0x3df23e(0x21c)]();(_0x3abd22[_0x3df23e(0x1d9)]('\x22')&&_0x3abd22[_0x3df23e(0x1f7)]('\x22')||_0x3abd22[_0x3df23e(0x1d9)]('\x27')&&_0x3abd22[_0x3df23e(0x1f7)]('\x27'))&&(_0x3abd22=_0x3abd22[_0x3df23e(0x21e)](0x1,-0x1)),_0x5780c3[_0x383487]=_0x3abd22;}}return _0x5780c3;}export function readUserConfig(){const _0x470cbc=a57_0x269ec9,_0x31f6b0=getConfigFile();if(!existsSync(_0x31f6b0))return{};try{const _0x5e9153=readFileSync(_0x31f6b0,_0x470cbc(0x1e8));return parseEnvFile(_0x5e9153);}catch(_0x10129e){return console[_0x470cbc(0x1fd)](_0x470cbc(0x209)+_0x31f6b0+':',_0x10129e),{};}}export function resolveSite(_0x12c001){const _0x1debaa=a57_0x269ec9,_0x5bc7ee=['us01',_0x1debaa(0x1ff),_0x1debaa(0x20f),_0x1debaa(0x1f9),_0x1debaa(0x220),_0x1debaa(0x1e9),_0x1debaa(0x21f),'stg-us01',_0x1debaa(0x1fe),_0x1debaa(0x1d5)];if(_0x5bc7ee[_0x1debaa(0x205)](_0x12c001))return _0x12c001;if(_0x12c001 in SITE_ALIASES)return SITE_ALIASES[_0x12c001];return console[_0x1debaa(0x1fd)](_0x1debaa(0x20b)+_0x12c001+_0x1debaa(0x1e0)),_0x1debaa(0x1e3);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x118baa){const _0x1a6dda=a57_0x269ec9,_0x486a67=_0x118baa||getActiveProfileName()||undefined;if(_0x486a67){const _0x1ba513=_0x1a6dda(0x222)+normalizeProfileForEnvVar(_0x486a67);if(process.env[_0x1ba513])return{'accessToken':process.env[_0x1ba513],'source':_0x1ba513+'\x20env\x20var'};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x1a6dda(0x20e)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x42f5f9=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x42f5f9)return{'accessToken':_0x42f5f9,'source':'TDX_ACCESS_TOKEN_FILE'};}return null;}function readAccessTokenFile(_0x55ef1c){const _0x40eb45=a57_0x269ec9;try{const _0x40550b=readFileSync(_0x55ef1c,'utf-8')[_0x40eb45(0x21c)]();return _0x40550b||null;}catch{return null;}}export function getAccessToken(_0x347706){const _0x1a5a92=a57_0x269ec9;return resolveAccessToken(_0x347706)?.[_0x1a5a92(0x210)];}export function getAPIKey(_0x2819c3){const _0x1d84a8=a57_0x269ec9,_0xe0410b=_0x2819c3||getActiveProfileName();if(_0xe0410b){const _0xd10170=_0x1d84a8(0x1f3)+normalizeProfileForEnvVar(_0xe0410b);if(process.env[_0xd10170])return process.env[_0xd10170];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x12d53f){const _0x39e9c2=a57_0x269ec9;return _0x12d53f['toUpperCase']()[_0x39e9c2(0x211)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x55451c,_0x6fc470){const _0x53b560=a57_0x269ec9,_0x55427e=resolveAccessToken(_0x6fc470);if(_0x55427e)return{'apiKey':_0x55427e[_0x53b560(0x210)],'source':_0x55427e[_0x53b560(0x221)],'isDeprecated':![]};const _0x51c5db=_0x6fc470||getActiveProfileName()||undefined;if(_0x51c5db){const _0x1dc681=_0x53b560(0x1f3)+normalizeProfileForEnvVar(_0x51c5db);if(process.env[_0x1dc681])return{'apiKey':process.env[_0x1dc681],'source':_0x1dc681+'\x20env\x20var','isDeprecated':![]};const _0x2bea07=getCachedCredential(_0x55451c,_0x51c5db);if(_0x2bea07)return{'apiKey':_0x2bea07,'source':_0x53b560(0x1d7)+_0x51c5db+')','isDeprecated':![]};const _0x4874ae=await getKeychainAPIKey(_0x51c5db);if(_0x4874ae)return setCachedCredential(_0x4874ae,_0x55451c,_0x51c5db),{'apiKey':_0x4874ae,'source':_0x53b560(0x1d7)+_0x51c5db+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x53b560(0x1eb),'isDeprecated':![]};if(!_0x51c5db){const _0x1ac550=getCachedCredential(_0x55451c,undefined);if(_0x1ac550)return{'apiKey':_0x1ac550,'source':_0x53b560(0x1dd),'isDeprecated':![]};const _0x2d85f9=await getKeychainAPIKey(undefined);if(_0x2d85f9)return setCachedCredential(_0x2d85f9,_0x55451c,undefined),{'apiKey':_0x2d85f9,'source':_0x53b560(0x1dd),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x5a2fe0,_0x1806d1){const _0x23dc2a=a57_0x269ec9,_0xa1ca5c=await resolveAPIKeyAsync(_0x5a2fe0,_0x1806d1);return _0xa1ca5c?.[_0x23dc2a(0x208)];}function cleanupLegacyEnvFile(_0x49a0c1){const _0xf3f658=a57_0x269ec9;if(!existsSync(_0x49a0c1))return![];try{const _0x3bfbf8=readFileSync(_0x49a0c1,'utf-8'),_0x155a28=_0x3bfbf8['split']('\x0a'),_0x422780=_0x155a28['filter'](_0x1389f0=>{const _0x5a70d8=a57_0x4eae,_0x592163=_0x1389f0[_0x5a70d8(0x21c)]();if(!_0x592163||_0x592163[_0x5a70d8(0x1d9)]('#'))return!![];const [_0x21a5d2]=_0x592163[_0x5a70d8(0x1e2)]('=');return!_0x21a5d2[_0x5a70d8(0x1d9)](_0x5a70d8(0x20c));}),_0x3e2df2=_0x422780[_0xf3f658(0x206)](_0x25034d=>{const _0x29f09c=_0xf3f658,_0x441a4f=_0x25034d[_0x29f09c(0x21c)]();return _0x441a4f&&!_0x441a4f[_0x29f09c(0x1d9)]('#');});if(!_0x3e2df2)return unlinkSync(_0x49a0c1),!![];return writeFileSync(_0x49a0c1,_0x422780[_0xf3f658(0x1fa)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x28cd4f=a57_0x269ec9;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x477401=a57_0x3ae796[_0x28cd4f(0x1fa)](getConfigDir(),_0x28cd4f(0x217));if(!a57_0x2eb65e[_0x28cd4f(0x1dc)](_0x477401))return null;try{const _0x4f5abb=a57_0x2eb65e[_0x28cd4f(0x1d8)](_0x477401,_0x28cd4f(0x1e8)),_0x18581e=JSON[_0x28cd4f(0x204)](_0x4f5abb);return _0x18581e['profile']||null;}catch{return null;}}export function saveAPIKey(_0x5aa5bd,_0x419dcd,_0x5da7b8){const _0x4086ed=a57_0x269ec9,_0x3a8b48=getConfigDir(),_0x5b7a40=getConfigFilePath(_0x5da7b8);!existsSync(_0x3a8b48)&&mkdirSync(_0x3a8b48,{'recursive':!![],'mode':0x1c0});let _0xb9ffa8={};if(existsSync(_0x5b7a40))try{const _0x49d7fc=readFileSync(_0x5b7a40,_0x4086ed(0x1e8));_0xb9ffa8=parseEnvFile(_0x49d7fc);}catch(_0x1f927f){console[_0x4086ed(0x1fd)](_0x4086ed(0x1da)+_0x5b7a40+':',_0x1f927f);}const _0x224ae8=_0x5aa5bd[_0x4086ed(0x1ec)]()[_0x4086ed(0x211)](/-/g,'_');_0xb9ffa8[_0x4086ed(0x201)+_0x224ae8]=_0x419dcd;const _0x266405=Object['entries'](_0xb9ffa8)[_0x4086ed(0x1e7)](([_0x33e2af,_0x121cd7])=>_0x33e2af+'='+_0x121cd7);writeFileSync(_0x5b7a40,_0x266405[_0x4086ed(0x1fa)]('\x0a')+'\x0a',{'mode':0x180});}function a57_0x59cb(){const _0xff45d=['endsWith','proxy','ap02','join','2949779tWRHyH','stg-us01','warn','stg-ap01','ap01','.json','TD_API_KEY_','11siyaaL','879540irdJwL','parse','includes','some','write','apiKey','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','6mgDOUU','Warning:\x20Unknown\x20site\x20\x27','TD_API_KEY','config/llm-agent','TDX_ACCESS_TOKEN\x20env\x20var','eu01','accessToken','replace','accountId','string','6604870CEiDxO','stringify','9XzrgoQ','tdx.json','site','.env.','config/account-info','clear','trim','next','slice','dev-eu01','ap03','source','TDX_ACCESS_TOKEN_','5926808HFBjuY','stg-ap03','1088347rYUVQD','keychain\x20(profile:\x20','readFileSync','startsWith','Warning:\x20Failed\x20to\x20read\x20','llm_default_project','existsSync','keychain','2070984IclOZk','match','\x27,\x20defaulting\x20to\x20us01','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','split','us01','4yeDivl','29946440BnAfde','path','map','utf-8','dev-us01','stable','TDX_API_KEY\x20env\x20var','toUpperCase','account_info','release_channel','toISOString','read','name','.env','TDX_API_KEY_','yellow','projectId','config/llm-project'];a57_0x59cb=function(){return _0xff45d;};return a57_0x59cb();}export async function saveAPIKeyAsync(_0x47a54a,_0x1c74b1,_0x183a5c){const _0x5179d9=a57_0x269ec9;await saveKeychainAPIKey(_0x47a54a,_0x183a5c),setCachedCredential(_0x47a54a,_0x1c74b1,_0x183a5c);const _0x2e5790=getConfigFilePath(_0x183a5c);cleanupLegacyEnvFile(_0x2e5790)&&console['warn'](a57_0x56d954[_0x5179d9(0x1f4)](_0x5179d9(0x1e1)));}export function loadConfig(){const _0xf80f24=a57_0x269ec9,_0x2e7ad0={'apiKeys':{},'defaultSite':_0xf80f24(0x1e3)},_0x34adb0=[_0xf80f24(0x1e3),'ap01',_0xf80f24(0x20f),_0xf80f24(0x1f9),_0xf80f24(0x220),_0xf80f24(0x1e9),_0xf80f24(0x21f),_0xf80f24(0x1fc),'stg-ap01',_0xf80f24(0x1d5)],_0x566d71=getAPIKey();if(_0x566d71)for(const _0x1ffbe6 of _0x34adb0){_0x2e7ad0['apiKeys'][_0x1ffbe6]=_0x566d71;}return _0x2e7ad0;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x33b53d=a57_0x269ec9,_0xec122=a57_0x3ae796[_0x33b53d(0x1fa)](getConfigDir(),'tdx.json');if(!a57_0x2eb65e['existsSync'](_0xec122))return undefined;try{const _0x2e7c43=a57_0x2eb65e['readFileSync'](_0xec122,_0x33b53d(0x1e8)),_0x255714=JSON[_0x33b53d(0x204)](_0x2e7c43);return typeof _0x255714[_0x33b53d(0x1f8)]==='string'?_0x255714[_0x33b53d(0x1f8)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x11728a=a57_0x269ec9,_0x381463=process.env.TDX_RELEASE_CHANNEL;if(_0x381463===_0x11728a(0x21d)||_0x381463===_0x11728a(0x1ea))return _0x381463;const _0x5c47a8=a57_0x3ae796[_0x11728a(0x1fa)](getConfigDir(),_0x11728a(0x217));if(!a57_0x2eb65e[_0x11728a(0x1dc)](_0x5c47a8))return'stable';try{const _0xfeef2f=a57_0x2eb65e[_0x11728a(0x1d8)](_0x5c47a8,_0x11728a(0x1e8)),_0x37dfa9=JSON[_0x11728a(0x204)](_0xfeef2f);if(_0x37dfa9[_0x11728a(0x1ee)]===_0x11728a(0x21d))return _0x11728a(0x21d);}catch{}return'stable';}export function saveReleaseChannel(_0x59132a){const _0x108925=a57_0x269ec9,_0x16bc27=getConfigDir(),_0x3a2def=a57_0x3ae796[_0x108925(0x1fa)](_0x16bc27,_0x108925(0x217));!existsSync(_0x16bc27)&&mkdirSync(_0x16bc27,{'recursive':!![],'mode':0x1c0});let _0x4ef0f5={};if(existsSync(_0x3a2def))try{const _0x4db1db=readFileSync(_0x3a2def,'utf-8');_0x4ef0f5=JSON[_0x108925(0x204)](_0x4db1db);}catch{}_0x4ef0f5['release_channel']=_0x59132a,writeFileSync(_0x3a2def,JSON[_0x108925(0x215)](_0x4ef0f5,null,0x2),{'mode':0x180});}
1
+ const a57_0x4d14ec=a57_0x2c4f;(function(_0x21204f,_0x1f327a){const _0x5667af=a57_0x2c4f,_0x3377ab=_0x21204f();while(!![]){try{const _0x170d3b=-parseInt(_0x5667af(0x1a9))/0x1*(parseInt(_0x5667af(0x1ad))/0x2)+-parseInt(_0x5667af(0x1d0))/0x3*(-parseInt(_0x5667af(0x1b7))/0x4)+parseInt(_0x5667af(0x1c8))/0x5+parseInt(_0x5667af(0x1d2))/0x6*(-parseInt(_0x5667af(0x1af))/0x7)+-parseInt(_0x5667af(0x1bf))/0x8*(-parseInt(_0x5667af(0x1ea))/0x9)+-parseInt(_0x5667af(0x1bc))/0xa+parseInt(_0x5667af(0x1eb))/0xb;if(_0x170d3b===_0x1f327a)break;else _0x3377ab['push'](_0x3377ab['shift']());}catch(_0x433976){_0x3377ab['push'](_0x3377ab['shift']());}}}(a57_0x20bb,0xe41f8));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';function a57_0x20bb(){const _0x4de33a=['accessToken','profile','parse','yellow','stg-ap03','name','clear','split','proxy','trim','9aFUjol','1128424mZzXXW','utf-8','llm_default_agent','TDX_API_KEY_','\x27,\x20defaulting\x20to\x20us01','keychain','replace','TDX_API_KEY\x20env\x20var','stable','apiKeys','us01','config/llm-project','59dUBJGz','join','slice','dev-us01','6716vTgNIl','\x20env\x20var','6377IrEafj','read','stringify','.env','map','ap03','llm_default_project','endsWith','1048lNsQsZ','path','dev-eu01','next','string','3741450bHtNIU','number','account_info','631112LbSvUA','.config','includes','TD_API_KEY','TDX_ACCESS_TOKEN_FILE','accountId','write','projectId','existsSync','7938745OzFFat','config/account-info','release_channel','TDX_ACCESS_TOKEN_','keychain\x20(profile:\x20','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','ap02','entries','3075UtPptP','tdx.json','3498vAUoYx','TD_API_KEY_','TDX_ACCESS_TOKEN\x20env\x20var','source','tdx','warn','startsWith','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','readFileSync','eu01','config/llm-agent','stg-us01','apiKey','stg-ap01'];a57_0x20bb=function(){return _0x4de33a;};return a57_0x20bb();}import*as a57_0x29ae3a from'node:fs';import*as a57_0x587230 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_0xe781ba from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x572bed=a57_0x2c4f;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x572bed(0x1c0),_0x572bed(0x1d6));}export function getConfigFile(){const _0x3e3a7d=a57_0x2c4f;return join(getConfigDir(),_0x3e3a7d(0x1b2));}export function getConfigFilePath(_0x4fbe10){const _0x4eea5f=getConfigDir();return _0x4fbe10?a57_0x587230['join'](_0x4eea5f,'.env.'+_0x4fbe10):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x4d14ec(0x1b5),a57_0x4d14ec(0x1a8));export function getLLMProjectCacheFile(_0x521a8d){return llmProjectCache['path'](_0x521a8d);}export function readCachedLLMProject(_0x102c23){const _0x9505e3=a57_0x4d14ec,_0x2edbe0=llmProjectCache['read'](_0x102c23);if(_0x2edbe0&&typeof _0x2edbe0['id']===_0x9505e3(0x1bb)&&typeof _0x2edbe0[_0x9505e3(0x1e5)]===_0x9505e3(0x1bb))return _0x2edbe0;return null;}export function writeCachedLLMProject(_0x22e3e7,_0x1e8de8,_0x55be5a){const _0x434769=a57_0x4d14ec;try{llmProjectCache[_0x434769(0x1c5)]({'name':_0x22e3e7,'id':_0x1e8de8},_0x55be5a);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x4d14ec(0x1ed),a57_0x4d14ec(0x1dc));export function getLLMAgentCacheFile(_0x479f18){const _0x1ccd33=a57_0x4d14ec;return llmAgentCache[_0x1ccd33(0x1b8)](_0x479f18);}export function readCachedLLMAgent(_0x5eb949){const _0xc33ba8=a57_0x4d14ec,_0x99d72b=llmAgentCache[_0xc33ba8(0x1b0)](_0x5eb949);if(_0x99d72b&&typeof _0x99d72b['id']===_0xc33ba8(0x1bb)&&typeof _0x99d72b[_0xc33ba8(0x1e5)]===_0xc33ba8(0x1bb)&&typeof _0x99d72b[_0xc33ba8(0x1c6)]===_0xc33ba8(0x1bb))return _0x99d72b;return null;}export function writeCachedLLMAgent(_0x505e7c,_0x1f486f,_0x5bc488,_0x562a89){const _0x167c96=a57_0x4d14ec;try{llmAgentCache[_0x167c96(0x1c5)]({'name':_0x505e7c,'id':_0x1f486f,'projectId':_0x5bc488},_0x562a89);}catch{}}export function clearCachedLLMAgent(_0x77b38e){const _0x134ccc=a57_0x4d14ec;try{llmAgentCache[_0x134ccc(0x1e6)](_0x77b38e);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x4d14ec(0x1be),a57_0x4d14ec(0x1c9),{'suffix':'.json'});export function getAccountInfoCacheFile(_0x37a021){const _0x127fc6=a57_0x4d14ec;return accountInfoCache[_0x127fc6(0x1b8)](_0x37a021);}export function readCachedAccountInfo(_0x341574){const _0x47887b=a57_0x4d14ec,_0x4dbe6e=accountInfoCache['read'](_0x341574);if(_0x4dbe6e&&typeof _0x4dbe6e['site']==='string'&&typeof _0x4dbe6e[_0x47887b(0x1c4)]===_0x47887b(0x1bd))return _0x4dbe6e;return null;}export function writeCachedAccountInfo(_0x128196,_0x5e0a0c,_0x5d7cec){try{accountInfoCache['write']({'site':_0x128196,'accountId':_0x5e0a0c,'cachedAt':new Date()['toISOString']()},_0x5d7cec);}catch{}}export function parseEnvFile(_0x56cd02){const _0x1397c4=a57_0x4d14ec,_0x25e558={};for(const _0x217118 of _0x56cd02[_0x1397c4(0x1e7)]('\x0a')){const _0x3405de=_0x217118[_0x1397c4(0x1e9)]();if(!_0x3405de||_0x3405de[_0x1397c4(0x1d8)]('#'))continue;const _0x140b6c=_0x3405de['match'](/^([^=]+)=(.*)$/);if(_0x140b6c){const _0x4bf6ae=_0x140b6c[0x1]['trim']();let _0x46ef36=_0x140b6c[0x2][_0x1397c4(0x1e9)]();(_0x46ef36[_0x1397c4(0x1d8)]('\x22')&&_0x46ef36[_0x1397c4(0x1b6)]('\x22')||_0x46ef36[_0x1397c4(0x1d8)]('\x27')&&_0x46ef36[_0x1397c4(0x1b6)]('\x27'))&&(_0x46ef36=_0x46ef36[_0x1397c4(0x1ab)](0x1,-0x1)),_0x25e558[_0x4bf6ae]=_0x46ef36;}}return _0x25e558;}export function readUserConfig(){const _0x29452d=a57_0x4d14ec,_0x9a4506=getConfigFile();if(!existsSync(_0x9a4506))return{};try{const _0xe79a1a=readFileSync(_0x9a4506,'utf-8');return parseEnvFile(_0xe79a1a);}catch(_0xc4c7c2){return console[_0x29452d(0x1d7)](_0x29452d(0x1d9)+_0x9a4506+':',_0xc4c7c2),{};}}export function resolveSite(_0x9c2961){const _0x12cf94=a57_0x4d14ec,_0x2294a7=['us01','ap01','eu01',_0x12cf94(0x1ce),_0x12cf94(0x1b4),'dev-us01',_0x12cf94(0x1b9),_0x12cf94(0x1dd),_0x12cf94(0x1df),_0x12cf94(0x1e4)];if(_0x2294a7[_0x12cf94(0x1c1)](_0x9c2961))return _0x9c2961;if(_0x9c2961 in SITE_ALIASES)return SITE_ALIASES[_0x9c2961];return console[_0x12cf94(0x1d7)]('Warning:\x20Unknown\x20site\x20\x27'+_0x9c2961+_0x12cf94(0x1ef)),_0x12cf94(0x1a7);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x5e9da7){const _0x440988=a57_0x4d14ec,_0x45adfa=_0x5e9da7||getActiveProfileName()||undefined;if(_0x45adfa){const _0x3c3c72=_0x440988(0x1cb)+normalizeProfileForEnvVar(_0x45adfa);if(process.env[_0x3c3c72])return{'accessToken':process.env[_0x3c3c72],'source':_0x3c3c72+_0x440988(0x1ae)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x440988(0x1d4)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x260d63=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x260d63)return{'accessToken':_0x260d63,'source':_0x440988(0x1c3)};}return null;}function readAccessTokenFile(_0x429339){const _0x8813df=a57_0x4d14ec;try{const _0xc29e0b=readFileSync(_0x429339,_0x8813df(0x1ec))['trim']();return _0xc29e0b||null;}catch{return null;}}export function getAccessToken(_0x24edbe){return resolveAccessToken(_0x24edbe)?.['accessToken'];}export function getAPIKey(_0x3ce714){const _0x2fcd3b=a57_0x4d14ec,_0x1307fc=_0x3ce714||getActiveProfileName();if(_0x1307fc){const _0x2329aa=_0x2fcd3b(0x1ee)+normalizeProfileForEnvVar(_0x1307fc);if(process.env[_0x2329aa])return process.env[_0x2329aa];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x5f419b){return _0x5f419b['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x47a8cf,_0x4c667a){const _0x5482a1=a57_0x4d14ec,_0x542106=resolveAccessToken(_0x4c667a);if(_0x542106)return{'apiKey':_0x542106[_0x5482a1(0x1e0)],'source':_0x542106[_0x5482a1(0x1d5)],'isDeprecated':![]};const _0x2a2be5=_0x4c667a||getActiveProfileName()||undefined;if(_0x2a2be5){const _0x44cc08='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x2a2be5);if(process.env[_0x44cc08])return{'apiKey':process.env[_0x44cc08],'source':_0x44cc08+_0x5482a1(0x1ae),'isDeprecated':![]};const _0x339a15=getCachedCredential(_0x47a8cf,_0x2a2be5);if(_0x339a15)return{'apiKey':_0x339a15,'source':_0x5482a1(0x1cc)+_0x2a2be5+')','isDeprecated':![]};const _0x538fb4=await getKeychainAPIKey(_0x2a2be5);if(_0x538fb4)return setCachedCredential(_0x538fb4,_0x47a8cf,_0x2a2be5),{'apiKey':_0x538fb4,'source':_0x5482a1(0x1cc)+_0x2a2be5+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x5482a1(0x1a4),'isDeprecated':![]};if(!_0x2a2be5){const _0x2f0b8c=getCachedCredential(_0x47a8cf,undefined);if(_0x2f0b8c)return{'apiKey':_0x2f0b8c,'source':_0x5482a1(0x1f0),'isDeprecated':![]};const _0x5545cf=await getKeychainAPIKey(undefined);if(_0x5545cf)return setCachedCredential(_0x5545cf,_0x47a8cf,undefined),{'apiKey':_0x5545cf,'source':'keychain','isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x3da1b3,_0x50512f){const _0x2f3dd8=a57_0x4d14ec,_0x1c00fb=await resolveAPIKeyAsync(_0x3da1b3,_0x50512f);return _0x1c00fb?.[_0x2f3dd8(0x1de)];}function cleanupLegacyEnvFile(_0x2d6e05){const _0x3435fe=a57_0x4d14ec;if(!existsSync(_0x2d6e05))return![];try{const _0x3c46f4=readFileSync(_0x2d6e05,_0x3435fe(0x1ec)),_0x50a916=_0x3c46f4[_0x3435fe(0x1e7)]('\x0a'),_0x1e606e=_0x50a916['filter'](_0x1b76ad=>{const _0x5bfa66=_0x3435fe,_0x3c3918=_0x1b76ad[_0x5bfa66(0x1e9)]();if(!_0x3c3918||_0x3c3918[_0x5bfa66(0x1d8)]('#'))return!![];const [_0x22654d]=_0x3c3918[_0x5bfa66(0x1e7)]('=');return!_0x22654d[_0x5bfa66(0x1d8)](_0x5bfa66(0x1c2));}),_0x262edf=_0x1e606e['some'](_0x52cf0c=>{const _0x36f188=_0x3435fe,_0x5d824b=_0x52cf0c[_0x36f188(0x1e9)]();return _0x5d824b&&!_0x5d824b['startsWith']('#');});if(!_0x262edf)return unlinkSync(_0x2d6e05),!![];return writeFileSync(_0x2d6e05,_0x1e606e['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x598280=a57_0x4d14ec;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x14caee=a57_0x587230['join'](getConfigDir(),_0x598280(0x1d1));if(!a57_0x29ae3a[_0x598280(0x1c7)](_0x14caee))return null;try{const _0x4d5f0c=a57_0x29ae3a[_0x598280(0x1da)](_0x14caee,_0x598280(0x1ec)),_0x1ce2f4=JSON[_0x598280(0x1e2)](_0x4d5f0c);return _0x1ce2f4[_0x598280(0x1e1)]||null;}catch{return null;}}export function saveAPIKey(_0x122cfb,_0x443490,_0x22007d){const _0x30f58f=a57_0x4d14ec,_0x533604=getConfigDir(),_0x23ca48=getConfigFilePath(_0x22007d);!existsSync(_0x533604)&&mkdirSync(_0x533604,{'recursive':!![],'mode':0x1c0});let _0xca78fd={};if(existsSync(_0x23ca48))try{const _0x42fc4a=readFileSync(_0x23ca48,_0x30f58f(0x1ec));_0xca78fd=parseEnvFile(_0x42fc4a);}catch(_0x2b54c4){console[_0x30f58f(0x1d7)]('Warning:\x20Failed\x20to\x20read\x20'+_0x23ca48+':',_0x2b54c4);}const _0x4888f6=_0x122cfb['toUpperCase']()[_0x30f58f(0x1a3)](/-/g,'_');_0xca78fd[_0x30f58f(0x1d3)+_0x4888f6]=_0x443490;const _0x4d5dff=Object[_0x30f58f(0x1cf)](_0xca78fd)[_0x30f58f(0x1b3)](([_0x179b73,_0x4de52f])=>_0x179b73+'='+_0x4de52f);writeFileSync(_0x23ca48,_0x4d5dff['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x474921,_0x5bf220,_0x25dfc2){const _0x45d675=a57_0x4d14ec;await saveKeychainAPIKey(_0x474921,_0x25dfc2),setCachedCredential(_0x474921,_0x5bf220,_0x25dfc2);const _0x1d6006=getConfigFilePath(_0x25dfc2);cleanupLegacyEnvFile(_0x1d6006)&&console[_0x45d675(0x1d7)](a57_0xe781ba[_0x45d675(0x1e3)](_0x45d675(0x1cd)));}function a57_0x2c4f(_0x311838,_0x283e65){_0x311838=_0x311838-0x1a3;const _0x20bb6c=a57_0x20bb();let _0x2c4fb9=_0x20bb6c[_0x311838];return _0x2c4fb9;}export function loadConfig(){const _0x5ee63e=a57_0x4d14ec,_0x3d7953={'apiKeys':{},'defaultSite':_0x5ee63e(0x1a7)},_0x5e8904=[_0x5ee63e(0x1a7),'ap01',_0x5ee63e(0x1db),_0x5ee63e(0x1ce),_0x5ee63e(0x1b4),_0x5ee63e(0x1ac),_0x5ee63e(0x1b9),_0x5ee63e(0x1dd),_0x5ee63e(0x1df),'stg-ap03'],_0x61637f=getAPIKey();if(_0x61637f)for(const _0x5a66f9 of _0x5e8904){_0x3d7953[_0x5ee63e(0x1a6)][_0x5a66f9]=_0x61637f;}return _0x3d7953;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x415194=a57_0x4d14ec,_0x437552=a57_0x587230[_0x415194(0x1aa)](getConfigDir(),_0x415194(0x1d1));if(!a57_0x29ae3a[_0x415194(0x1c7)](_0x437552))return undefined;try{const _0x380c4a=a57_0x29ae3a['readFileSync'](_0x437552,'utf-8'),_0x460847=JSON[_0x415194(0x1e2)](_0x380c4a);return typeof _0x460847[_0x415194(0x1e8)]===_0x415194(0x1bb)?_0x460847[_0x415194(0x1e8)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x271c7c=a57_0x4d14ec,_0xcfc8f=process.env.TDX_RELEASE_CHANNEL;if(_0xcfc8f===_0x271c7c(0x1ba)||_0xcfc8f==='stable')return _0xcfc8f;const _0x20de2b=a57_0x587230[_0x271c7c(0x1aa)](getConfigDir(),_0x271c7c(0x1d1));if(!a57_0x29ae3a[_0x271c7c(0x1c7)](_0x20de2b))return'stable';try{const _0x263d09=a57_0x29ae3a[_0x271c7c(0x1da)](_0x20de2b,'utf-8'),_0x3aef94=JSON[_0x271c7c(0x1e2)](_0x263d09);if(_0x3aef94['release_channel']===_0x271c7c(0x1ba))return _0x271c7c(0x1ba);}catch{}return _0x271c7c(0x1a5);}export function saveReleaseChannel(_0x3b13c4){const _0x408206=a57_0x4d14ec,_0x140f04=getConfigDir(),_0x37adab=a57_0x587230[_0x408206(0x1aa)](_0x140f04,_0x408206(0x1d1));!existsSync(_0x140f04)&&mkdirSync(_0x140f04,{'recursive':!![],'mode':0x1c0});let _0x43a01f={};if(existsSync(_0x37adab))try{const _0xd95e17=readFileSync(_0x37adab,_0x408206(0x1ec));_0x43a01f=JSON['parse'](_0xd95e17);}catch{}_0x43a01f[_0x408206(0x1ca)]=_0x3b13c4,writeFileSync(_0x37adab,JSON[_0x408206(0x1b1)](_0x43a01f,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- function a58_0x27d3(_0x5c0c43,_0x30bace){_0x5c0c43=_0x5c0c43-0x14b;const _0x206e23=a58_0x206e();let _0x27d331=_0x206e23[_0x5c0c43];return _0x27d331;}const a58_0xac807=a58_0x27d3;(function(_0xd387b8,_0x1138e4){const _0x5193ea=a58_0x27d3,_0x33d64d=_0xd387b8();while(!![]){try{const _0x1b7340=parseInt(_0x5193ea(0x154))/0x1+-parseInt(_0x5193ea(0x14c))/0x2*(-parseInt(_0x5193ea(0x158))/0x3)+-parseInt(_0x5193ea(0x14b))/0x4*(parseInt(_0x5193ea(0x156))/0x5)+parseInt(_0x5193ea(0x153))/0x6+-parseInt(_0x5193ea(0x151))/0x7*(parseInt(_0x5193ea(0x14e))/0x8)+parseInt(_0x5193ea(0x152))/0x9+parseInt(_0x5193ea(0x14d))/0xa;if(_0x1b7340===_0x1138e4)break;else _0x33d64d['push'](_0x33d64d['shift']());}catch(_0xe79c4d){_0x33d64d['push'](_0x33d64d['shift']());}}}(a58_0x206e,0x7a5bf));function a58_0x206e(){const _0x387612=['connections','connections-{profile}.json','14bccbUm','2686104kTRmhc','3600090vcrNDS','348429KSISul','clear','2667235DLxncH','core/connection-cache','3vaznpt','4RvGFoS','14882yTiyHr','3002530tqOWbY','2079856QyFFui'];a58_0x206e=function(){return _0x387612;};return a58_0x206e();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0xac807(0x150),a58_0xac807(0x157));export function loadCachedConnections(_0x37020a){const _0x3c229a=a58_0xac807,_0x5a1d9c=connectionCache['read'](_0x37020a);return _0x5a1d9c?.[_0x3c229a(0x14f)]??null;}export function saveCachedConnections(_0x1f1423,_0x46a493){connectionCache['write'](_0x1f1423,{'connections':_0x46a493,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x4ec334){const _0x4b6dd6=a58_0xac807;connectionCache[_0x4b6dd6(0x155)](_0x4ec334);}
1
+ const a58_0x2cc181=a58_0x4530;(function(_0x5aa5f0,_0x318365){const _0x2b5fea=a58_0x4530,_0x336f38=_0x5aa5f0();while(!![]){try{const _0x326943=parseInt(_0x2b5fea(0x1e2))/0x1*(parseInt(_0x2b5fea(0x1de))/0x2)+parseInt(_0x2b5fea(0x1e6))/0x3*(-parseInt(_0x2b5fea(0x1db))/0x4)+parseInt(_0x2b5fea(0x1dd))/0x5*(-parseInt(_0x2b5fea(0x1e0))/0x6)+parseInt(_0x2b5fea(0x1e5))/0x7*(-parseInt(_0x2b5fea(0x1e4))/0x8)+parseInt(_0x2b5fea(0x1ea))/0x9+parseInt(_0x2b5fea(0x1e1))/0xa+parseInt(_0x2b5fea(0x1e9))/0xb*(-parseInt(_0x2b5fea(0x1e8))/0xc);if(_0x326943===_0x318365)break;else _0x336f38['push'](_0x336f38['shift']());}catch(_0x44bb36){_0x336f38['push'](_0x336f38['shift']());}}}(a58_0x341b,0x3408c));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x2cc181(0x1e3),a58_0x2cc181(0x1eb));export function loadCachedConnections(_0x58ef69){const _0x3a7637=a58_0x2cc181,_0x207db1=connectionCache['read'](_0x58ef69);return _0x207db1?.[_0x3a7637(0x1df)]??null;}function a58_0x341b(){const _0x5f09de=['734jbVUrB','connections-{profile}.json','2808824VHlgSQ','7gzbVgj','27999OeVyyY','clear','12mbTQLZ','3124319ZeqNXl','2364471HWdPen','core/connection-cache','4HXFHEv','now','99275PgiyVn','1084LpaqGW','connections','12aexfrm','2367600aZlgFF'];a58_0x341b=function(){return _0x5f09de;};return a58_0x341b();}export function saveCachedConnections(_0x1d520f,_0x3d5033){const _0x306351=a58_0x2cc181;connectionCache['write'](_0x1d520f,{'connections':_0x3d5033,'cachedAt':Date[_0x306351(0x1dc)]()});}function a58_0x4530(_0x4427c8,_0x542a4e){_0x4427c8=_0x4427c8-0x1db;const _0x341b02=a58_0x341b();let _0x4530ac=_0x341b02[_0x4427c8];return _0x4530ac;}export function clearConnectionCache(_0x1dd5d7){const _0x5ec2e9=a58_0x2cc181;connectionCache[_0x5ec2e9(0x1e7)](_0x1dd5d7);}
@@ -1 +1 @@
1
- const a59_0x3b7f3d=a59_0x35b9;(function(_0xe1102b,_0x46ed9b){const _0x23cebe=a59_0x35b9,_0x1e734b=_0xe1102b();while(!![]){try{const _0x2ec225=-parseInt(_0x23cebe(0xd9))/0x1+parseInt(_0x23cebe(0xcc))/0x2*(-parseInt(_0x23cebe(0xcf))/0x3)+parseInt(_0x23cebe(0xbd))/0x4+-parseInt(_0x23cebe(0xda))/0x5*(-parseInt(_0x23cebe(0xd3))/0x6)+-parseInt(_0x23cebe(0xce))/0x7+parseInt(_0x23cebe(0xdb))/0x8+-parseInt(_0x23cebe(0xbe))/0x9*(-parseInt(_0x23cebe(0xd5))/0xa);if(_0x2ec225===_0x46ed9b)break;else _0x1e734b['push'](_0x1e734b['shift']());}catch(_0x3952fc){_0x1e734b['push'](_0x1e734b['shift']());}}}(a59_0x1904,0xa78e1));import a59_0x4fe2bb from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;function a59_0x35b9(_0x1fe9dc,_0xebf869){_0x1fe9dc=_0x1fe9dc-0xbb;const _0x19040c=a59_0x1904();let _0x35b95b=_0x19040c[_0x1fe9dc];return _0x35b95b;}export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x3167ca,_0x29c004){const _0x401e6c=a59_0x35b9;if(_0x3167ca===undefined)return _0x29c004;if(typeof _0x3167ca===_0x401e6c(0xbc))return _0x3167ca;return parseInt(_0x3167ca,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x3b7f3d(0xc0),'value':a59_0x3b7f3d(0xd1)},{'title':a59_0x3b7f3d(0xc8),'value':a59_0x3b7f3d(0xc4)},{'title':'eu\x20\x20\x20-\x20Europe','value':a59_0x3b7f3d(0xc5)},{'title':a59_0x3b7f3d(0xd4),'value':'ap02'}];export function buildSiteChoices(_0x4e549a){const _0xa31a6a=a59_0x3b7f3d,_0x41c60d=[...STANDARD_SITE_CHOICES];let _0x1b4085=_0x41c60d[_0xa31a6a(0xc1)](_0x4b09d4=>_0x4b09d4[_0xa31a6a(0xdc)]===_0x4e549a);return _0x1b4085===-0x1&&_0x4e549a!==_0xa31a6a(0xd1)&&(_0x41c60d[_0xa31a6a(0xcb)]({'title':_0x4e549a,'value':_0x4e549a}),_0x1b4085=_0x41c60d[_0xa31a6a(0xbf)]-0x1),_0x41c60d[_0xa31a6a(0xcb)]({'title':_0xa31a6a(0xc6),'value':_0xa31a6a(0xd0)}),{'choices':_0x41c60d,'initialIndex':_0x1b4085>=0x0?_0x1b4085:0x0};}export async function promptSiteSelection(_0x4f37ce,_0x89707b,_0x567c9d=a59_0x3b7f3d(0xc7)){const _0x555066=a59_0x3b7f3d,{choices:_0x2f90a4,initialIndex:_0xb15ba7}=buildSiteChoices(_0x4f37ce),_0x4dbcc5=_0x89707b?_0x555066(0xd7)+_0x89707b+'):':_0x555066(0xc2),_0x4ac350=await a59_0x4fe2bb({'type':_0x555066(0xd6),'name':_0x555066(0xbb),'message':_0x4dbcc5,'choices':_0x2f90a4,'initial':_0xb15ba7});if(!_0x4ac350[_0x555066(0xbb)])return console[_0x555066(0xdd)]('\x0a'+_0x567c9d),null;if(_0x4ac350[_0x555066(0xbb)]!==_0x555066(0xd0))return _0x4ac350[_0x555066(0xbb)];const _0x26ec83=await a59_0x4fe2bb({'type':_0x555066(0xd2),'name':_0x555066(0xca),'message':'Enter\x20site\x20name:','initial':_0x555066(0xd1),'validate':_0x5519e0=>{const _0x3cd63c=_0x555066;if(!_0x5519e0||!_0x5519e0[_0x3cd63c(0xd8)]())return _0x3cd63c(0xcd);if(!/^[a-z0-9-]+$/[_0x3cd63c(0xc3)](_0x5519e0[_0x3cd63c(0xd8)]()))return _0x3cd63c(0xc9);return!![];}});if(!_0x26ec83[_0x555066(0xca)])return console[_0x555066(0xdd)]('\x0a'+_0x567c9d),null;return _0x26ec83[_0x555066(0xca)];}function a59_0x1904(){const _0x33d246=['log','site','number','46720xAfRKw','9cjzgxe','length','us\x20\x20\x20-\x20United\x20States','findIndex','Select\x20your\x20Treasure\x20Data\x20site:','test','ap01','eu01','Enter\x20custom\x20site','Cancelled','jp\x20\x20\x20-\x20Japan','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','customSite','push','2ITXKVr','Site\x20name\x20cannot\x20be\x20empty','5136481kIDJOn','230757KkFiTX','other','us01','text','270648DkSuGT','ap02\x20-\x20Korea','5080190JHmnzn','select','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','trim','679123XPpgmr','55zDHVbY','9281944iMxeBJ','value'];a59_0x1904=function(){return _0x33d246;};return a59_0x1904();}
1
+ const a59_0x15edfc=a59_0x346f;(function(_0x4e48cc,_0x2fe87a){const _0x2b6012=a59_0x346f,_0x295aea=_0x4e48cc();while(!![]){try{const _0x5275b2=parseInt(_0x2b6012(0x7a))/0x1+parseInt(_0x2b6012(0x85))/0x2*(-parseInt(_0x2b6012(0x76))/0x3)+parseInt(_0x2b6012(0x6c))/0x4+-parseInt(_0x2b6012(0x7b))/0x5*(parseInt(_0x2b6012(0x7e))/0x6)+-parseInt(_0x2b6012(0x81))/0x7+-parseInt(_0x2b6012(0x70))/0x8*(parseInt(_0x2b6012(0x79))/0x9)+parseInt(_0x2b6012(0x7c))/0xa;if(_0x5275b2===_0x2fe87a)break;else _0x295aea['push'](_0x295aea['shift']());}catch(_0x12c865){_0x295aea['push'](_0x295aea['shift']());}}}(a59_0x58c2,0x44079));import a59_0xc9c6f7 from'prompts';function a59_0x58c2(){const _0x298aae=['push','8gyVnXP','length','Select\x20your\x20Treasure\x20Data\x20site:','trim','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','eu01','308082WcHaZS','ap02','number','578763JisYrL','486180TEqLuE','887365pLJsdM','175410NWXIPI','findIndex','6uPHRWR','other','customSite','2189313ZNrmVZ','log','Enter\x20site\x20name:','value','4wbHFTM','Enter\x20custom\x20site','eu\x20\x20\x20-\x20Europe','us01','site','Site\x20name\x20cannot\x20be\x20empty','ap02\x20-\x20Korea','us\x20\x20\x20-\x20United\x20States','2139420ZzEBMs','text','Cancelled'];a59_0x58c2=function(){return _0x298aae;};return a59_0x58c2();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x2089a9,_0x6398a1){const _0x37e6d1=a59_0x346f;if(_0x2089a9===undefined)return _0x6398a1;if(typeof _0x2089a9===_0x37e6d1(0x78))return _0x2089a9;return parseInt(_0x2089a9,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x15edfc(0x6b),'value':a59_0x15edfc(0x67)},{'title':'jp\x20\x20\x20-\x20Japan','value':'ap01'},{'title':a59_0x15edfc(0x87),'value':a59_0x15edfc(0x75)},{'title':a59_0x15edfc(0x6a),'value':a59_0x15edfc(0x77)}];function a59_0x346f(_0x25afaf,_0x1f4e17){_0x25afaf=_0x25afaf-0x67;const _0x58c2be=a59_0x58c2();let _0x346f94=_0x58c2be[_0x25afaf];return _0x346f94;}export function buildSiteChoices(_0x47a4d1){const _0x19496b=a59_0x15edfc,_0x476466=[...STANDARD_SITE_CHOICES];let _0x1a8f56=_0x476466[_0x19496b(0x7d)](_0x42d14e=>_0x42d14e[_0x19496b(0x84)]===_0x47a4d1);return _0x1a8f56===-0x1&&_0x47a4d1!=='us01'&&(_0x476466[_0x19496b(0x6f)]({'title':_0x47a4d1,'value':_0x47a4d1}),_0x1a8f56=_0x476466[_0x19496b(0x71)]-0x1),_0x476466['push']({'title':_0x19496b(0x86),'value':_0x19496b(0x7f)}),{'choices':_0x476466,'initialIndex':_0x1a8f56>=0x0?_0x1a8f56:0x0};}export async function promptSiteSelection(_0x47a012,_0x18757f,_0x4bfa14=a59_0x15edfc(0x6e)){const _0x4d114f=a59_0x15edfc,{choices:_0x5bb3d7,initialIndex:_0x4b36c}=buildSiteChoices(_0x47a012),_0x7ba6f0=_0x18757f?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x18757f+'):':_0x4d114f(0x72),_0x235144=await a59_0xc9c6f7({'type':'select','name':_0x4d114f(0x68),'message':_0x7ba6f0,'choices':_0x5bb3d7,'initial':_0x4b36c});if(!_0x235144[_0x4d114f(0x68)])return console[_0x4d114f(0x82)]('\x0a'+_0x4bfa14),null;if(_0x235144[_0x4d114f(0x68)]!==_0x4d114f(0x7f))return _0x235144['site'];const _0xd2bf28=await a59_0xc9c6f7({'type':_0x4d114f(0x6d),'name':_0x4d114f(0x80),'message':_0x4d114f(0x83),'initial':_0x4d114f(0x67),'validate':_0x50dbea=>{const _0x462199=_0x4d114f;if(!_0x50dbea||!_0x50dbea['trim']())return _0x462199(0x69);if(!/^[a-z0-9-]+$/['test'](_0x50dbea[_0x462199(0x73)]()))return _0x462199(0x74);return!![];}});if(!_0xd2bf28[_0x4d114f(0x80)])return console['log']('\x0a'+_0x4bfa14),null;return _0xd2bf28[_0x4d114f(0x80)];}
@@ -1 +1 @@
1
- (function(_0x7302e,_0x59b812){const _0x1f4a31=a60_0x4020,_0xa6b881=_0x7302e();while(!![]){try{const _0x3f676e=parseInt(_0x1f4a31(0x1c1))/0x1*(-parseInt(_0x1f4a31(0x1be))/0x2)+-parseInt(_0x1f4a31(0x1bf))/0x3+-parseInt(_0x1f4a31(0x1c3))/0x4*(-parseInt(_0x1f4a31(0x1bb))/0x5)+parseInt(_0x1f4a31(0x1c2))/0x6*(parseInt(_0x1f4a31(0x1c6))/0x7)+-parseInt(_0x1f4a31(0x1c5))/0x8*(parseInt(_0x1f4a31(0x1b7))/0x9)+-parseInt(_0x1f4a31(0x1c0))/0xa+parseInt(_0x1f4a31(0x1bd))/0xb;if(_0x3f676e===_0x59b812)break;else _0xa6b881['push'](_0xa6b881['shift']());}catch(_0x245ad1){_0xa6b881['push'](_0xa6b881['shift']());}}}(a60_0x3f8e,0x7f2f1));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x54d75c,_0x447fe1){const _0x558ddd=a60_0x4020,_0x467c09=_0x54d75c||_0x558ddd(0x1b8),_0x266f51=_0x447fe1||'__default_profile__';return _0x467c09+':'+_0x266f51;}function a60_0x3f8e(){const _0x479a38=['6706220Iyhvrj','25hcOGBN','7164suNjSd','351572HKaAco','set','9416XlawhC','3493HwWqql','2529BouVHQ','__default_site__','loadedAt','get','35LaKIRD','delete','22847704IMJmJv','83260PoWqLa','2175201mclOZh'];a60_0x3f8e=function(){return _0x479a38;};return a60_0x3f8e();}export function getCachedCredential(_0x5a4b62,_0x29a7f6){const _0x38c8b0=a60_0x4020,_0x130f7e=getCacheKey(_0x5a4b62,_0x29a7f6),_0x392e6c=cache[_0x38c8b0(0x1ba)](_0x130f7e);if(!_0x392e6c)return null;if(Date['now']()-_0x392e6c[_0x38c8b0(0x1b9)]>CACHE_TTL_MS)return cache[_0x38c8b0(0x1bc)](_0x130f7e),null;return _0x392e6c['apiKey'];}export function setCachedCredential(_0x23ede8,_0xa15a60,_0x1e249f){const _0x4679c2=a60_0x4020,_0x2ade0f=getCacheKey(_0xa15a60,_0x1e249f);cache[_0x4679c2(0x1c4)](_0x2ade0f,{'apiKey':_0x23ede8,'loadedAt':Date['now']()});}function a60_0x4020(_0x141e55,_0x4ba107){_0x141e55=_0x141e55-0x1b7;const _0x3f8e6e=a60_0x3f8e();let _0x4020a6=_0x3f8e6e[_0x141e55];return _0x4020a6;}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x4462d4,_0x3cbf82){const _0xadf2b3=a60_0x4020,_0x21cc9a=getCacheKey(_0x4462d4,_0x3cbf82);cache[_0xadf2b3(0x1bc)](_0x21cc9a);}
1
+ (function(_0x577a83,_0x2cef21){const _0x1802d0=a60_0x2a51,_0x4d101c=_0x577a83();while(!![]){try{const _0x3df232=-parseInt(_0x1802d0(0x120))/0x1+-parseInt(_0x1802d0(0x11a))/0x2*(parseInt(_0x1802d0(0x119))/0x3)+parseInt(_0x1802d0(0x116))/0x4*(parseInt(_0x1802d0(0x118))/0x5)+parseInt(_0x1802d0(0x11e))/0x6+-parseInt(_0x1802d0(0x115))/0x7+parseInt(_0x1802d0(0x123))/0x8+parseInt(_0x1802d0(0x124))/0x9;if(_0x3df232===_0x2cef21)break;else _0x4d101c['push'](_0x4d101c['shift']());}catch(_0x704f5){_0x4d101c['push'](_0x4d101c['shift']());}}}(a60_0x4237,0x9c0b6));function a60_0x2a51(_0x3322ab,_0x2859ac){_0x3322ab=_0x3322ab-0x115;const _0x423785=a60_0x4237();let _0x2a51af=_0x423785[_0x3322ab];return _0x2a51af;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x138bc6,_0x178207){const _0x25b8f8=a60_0x2a51,_0x54672f=_0x138bc6||_0x25b8f8(0x122),_0x5d26cb=_0x178207||'__default_profile__';return _0x54672f+':'+_0x5d26cb;}function a60_0x4237(){const _0x19520d=['loadedAt','818630VSTHzk','get','__default_site__','7048960Hbypkj','8430867WivJES','3103996fuIqug','136QZVZvW','delete','21245yxSDeP','3HBXVMP','1688348bwYwFj','apiKey','clear','now','4698246LsqvpU'];a60_0x4237=function(){return _0x19520d;};return a60_0x4237();}export function getCachedCredential(_0x558222,_0x55fe1d){const _0x57d5fe=a60_0x2a51,_0x593124=getCacheKey(_0x558222,_0x55fe1d),_0x32c983=cache[_0x57d5fe(0x121)](_0x593124);if(!_0x32c983)return null;if(Date[_0x57d5fe(0x11d)]()-_0x32c983[_0x57d5fe(0x11f)]>CACHE_TTL_MS)return cache[_0x57d5fe(0x117)](_0x593124),null;return _0x32c983[_0x57d5fe(0x11b)];}export function setCachedCredential(_0x29c05b,_0x39639d,_0x26e128){const _0x29f5df=getCacheKey(_0x39639d,_0x26e128);cache['set'](_0x29f5df,{'apiKey':_0x29c05b,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x5744cd=a60_0x2a51;cache[_0x5744cd(0x11c)]();}export function clearCachedCredential(_0x20783e,_0x11d701){const _0x47ab49=getCacheKey(_0x20783e,_0x11d701);cache['delete'](_0x47ab49);}
@@ -1 +1 @@
1
- const a61_0xbdb2fd=a61_0x547a;(function(_0x265bca,_0x13aa08){const _0x365f40=a61_0x547a,_0x164932=_0x265bca();while(!![]){try{const _0x56797e=parseInt(_0x365f40(0x13d))/0x1+parseInt(_0x365f40(0x146))/0x2+parseInt(_0x365f40(0x11f))/0x3+-parseInt(_0x365f40(0x143))/0x4+parseInt(_0x365f40(0x14c))/0x5*(-parseInt(_0x365f40(0x15d))/0x6)+parseInt(_0x365f40(0x155))/0x7*(parseInt(_0x365f40(0x125))/0x8)+-parseInt(_0x365f40(0x136))/0x9;if(_0x56797e===_0x13aa08)break;else _0x164932['push'](_0x164932['shift']());}catch(_0x3fe881){_0x164932['push'](_0x164932['shift']());}}}(a61_0xf2ff,0x53a93));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0xf2ff(){const _0x202814=['logLevel','(using\x20session:\x20','composableAudience','apiKey','resolveAPIKeyAsync','expires_at','113281rQCPhT','llmProject','display','not\x20set','createAsync','configFiles','loadGlobalConfig','workflow_project','1728816GChXKG','database','default','layers','(session:\x20','profileSource','displayWithSources','parent_segment','entries','workflowProject','cyan','access_token','dim','env','none','profile','site','project','segment_path','log','Profile','verbose','profiles','CLI\x20flag:\x20--','1761387yRhoea','.env','parentSegment','llm_project','existsSync','composable_audience','40fRKUto','replace','[context]','injectIntoOptions','Profile\x20Credentials','Project','Global','green','global','cli','proxy','join','globalCredentials','accessToken','.json','sessionId','getSource','5946759MAblau','llm_agent','profileCredentials','sessions','getParameters','session','llmAgent','526742qvTFsZ','Session','assign','config','segmentPath','tdx.json','2329128ntzAON','activeProfile','string','1358116tBlfpC','INFO','readFileSync','refresh_token','cliFlags','us01','5jnXaKA','now','bold'];a61_0xf2ff=function(){return _0x202814;};return a61_0xf2ff();}import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';function a61_0x547a(_0x455453,_0x1153f0){_0x455453=_0x455453-0x116;const _0xf2ffaf=a61_0xf2ff();let _0x547ac8=_0xf2ffaf[_0x455453];return _0x547ac8;}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_0x227d9e from'node:fs';import*as a61_0x1ed5ee from'node:path';import a61_0x2df60b from'chalk';export class GlobalContext{[a61_0xbdb2fd(0x117)];[a61_0xbdb2fd(0x15e)];[a61_0xbdb2fd(0x164)];['segment_path'];[a61_0xbdb2fd(0x122)];[a61_0xbdb2fd(0x137)];[a61_0xbdb2fd(0x15c)];[a61_0xbdb2fd(0x124)];[a61_0xbdb2fd(0x152)];[a61_0xbdb2fd(0x132)];[a61_0xbdb2fd(0x12f)];[a61_0xbdb2fd(0x11c)];[a61_0xbdb2fd(0x14f)];['profile'];[a61_0xbdb2fd(0x162)]=null;['layers'];[a61_0xbdb2fd(0x144)];[a61_0xbdb2fd(0x134)];[a61_0xbdb2fd(0x15a)];constructor(_0x17e2a2){const _0x265b96=a61_0xbdb2fd;this[_0x265b96(0x134)]=getSessionID(_0x17e2a2[_0x265b96(0x13b)]);const _0xb97b19=loadSessionContext(_0x17e2a2[_0x265b96(0x13b)]),_0x48617a=loadProjectConfig(),_0x368b54=this[_0x265b96(0x15b)]();if(_0x17e2a2[_0x265b96(0x116)])this[_0x265b96(0x144)]=_0x17e2a2[_0x265b96(0x116)],this[_0x265b96(0x162)]=_0x265b96(0x12e);else{if(_0xb97b19?.[_0x265b96(0x116)])this[_0x265b96(0x144)]=_0xb97b19['profile'],this[_0x265b96(0x162)]=_0x265b96(0x13b);else{if(_0x368b54['profile'])this[_0x265b96(0x144)]=_0x368b54['profile'],this[_0x265b96(0x162)]=_0x265b96(0x140);else process.env.TDX_PROFILE?(this[_0x265b96(0x144)]=process.env.TDX_PROFILE,this[_0x265b96(0x162)]=_0x265b96(0x16a)):(this[_0x265b96(0x144)]=null,this['profileSource']=null);}}const _0x1ae330=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x289814=_0x2c66e8=>{const _0x45ce31=_0x265b96;if(!_0x2c66e8)return{};const _0x201075=_0x2c66e8,_0x50be78={};for(const [_0x10e8ba,_0x76995a]of Object[_0x45ce31(0x165)](_0x201075)){typeof _0x76995a===_0x45ce31(0x145)&&(_0x50be78[_0x10e8ba]=_0x76995a);}return _0x50be78;},_0x314933={},_0x4947ac=(_0xf86a83,_0x35e026,_0x43ce14)=>{if(!_0xf86a83)return![];if(_0x43ce14&&_0xf86a83===_0x43ce14)return![];const _0x10945e=_0xb97b19,_0x150568=_0x48617a,_0x16aef0=_0x1ae330?.['config'],_0x212c7f=_0x368b54,_0x519f3c=_0x10945e?.[_0x35e026],_0x2557e5=_0x150568?.[_0x35e026],_0xab2680=_0x16aef0?.[_0x35e026],_0x48d62e=_0x212c7f[_0x35e026];return _0xf86a83!==_0x519f3c&&_0xf86a83!==_0x2557e5&&_0xf86a83!==_0xab2680&&_0xf86a83!==_0x48d62e;},_0x4ebb39=[{'optionKey':_0x265b96(0x117),'contextKey':_0x265b96(0x117),'defaultValue':_0x265b96(0x14b)},{'optionKey':'database','contextKey':_0x265b96(0x15e)},{'optionKey':_0x265b96(0x121),'contextKey':_0x265b96(0x164)},{'optionKey':_0x265b96(0x156),'contextKey':_0x265b96(0x122)},{'optionKey':_0x265b96(0x13c),'contextKey':'llm_agent'},{'optionKey':_0x265b96(0x151),'contextKey':_0x265b96(0x124)},{'optionKey':_0x265b96(0x116),'contextKey':_0x265b96(0x116)}];for(const {optionKey:_0x47d0e2,contextKey:_0xf09317,defaultValue:_0x58559d}of _0x4ebb39){const _0x4659c0=_0x17e2a2[_0x47d0e2];_0x4947ac(_0x4659c0,_0xf09317,_0x58559d)&&(_0x314933[_0xf09317]=_0x4659c0);}this[_0x265b96(0x160)]={'cliFlags':_0x314933,'session':_0x289814(_0xb97b19),'project':_0x289814(_0x48617a),'profile':_0x289814(_0x1ae330?.[_0x265b96(0x140)]),'global':_0x289814(_0x368b54)};const _0x27acc3={...this[_0x265b96(0x160)][_0x265b96(0x12d)],...this[_0x265b96(0x160)][_0x265b96(0x116)],...this['layers'][_0x265b96(0x118)]};process.env.TDX_SITE&&!this['layers'][_0x265b96(0x13b)][_0x265b96(0x117)]&&!this[_0x265b96(0x160)][_0x265b96(0x14a)][_0x265b96(0x117)]&&(_0x27acc3['site']=process.env.TDX_SITE);Object['assign'](_0x27acc3,this['layers'][_0x265b96(0x13b)]),Object[_0x265b96(0x13f)](_0x27acc3,this[_0x265b96(0x160)][_0x265b96(0x14a)]);const _0x5258a2=_0x27acc3[_0x265b96(0x117)]||_0x265b96(0x14b);this[_0x265b96(0x117)]=resolveSite(_0x5258a2),this[_0x265b96(0x15e)]=_0x27acc3[_0x265b96(0x15e)],this[_0x265b96(0x164)]=_0x27acc3[_0x265b96(0x164)],this['segment_path']=_0x27acc3['segment_path'],this[_0x265b96(0x122)]=_0x27acc3[_0x265b96(0x122)],this[_0x265b96(0x137)]=_0x27acc3['llm_agent'],this[_0x265b96(0x15c)]=_0x27acc3['workflow_project'],this['composable_audience']=_0x27acc3[_0x265b96(0x124)],this['verbose']=_0x17e2a2[_0x265b96(0x11c)]||![],this[_0x265b96(0x14f)]=_0x17e2a2[_0x265b96(0x14f)]??LogLevel[_0x265b96(0x147)],this[_0x265b96(0x116)]=this[_0x265b96(0x144)]||undefined,this[_0x265b96(0x132)]=getAccessToken(this[_0x265b96(0x144)]||undefined),this[_0x265b96(0x152)]=getAPIKey(this[_0x265b96(0x144)]||undefined);const _0x36d9c6=typeof _0x368b54[_0x265b96(0x12f)]===_0x265b96(0x145)?_0x368b54[_0x265b96(0x12f)]:undefined;this['proxy']=_0x36d9c6||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x566aa2=getConfigDir(),_0x3a31bf=a61_0x1ed5ee[_0x265b96(0x130)](_0x566aa2,_0x265b96(0x139),this[_0x265b96(0x134)]+_0x265b96(0x133)),_0x1cb542=findProjectConfigPath(),_0x23e417=a61_0x1ed5ee['join'](_0x566aa2,_0x265b96(0x142)),_0x3337a1=a61_0x1ed5ee['join'](_0x566aa2,_0x265b96(0x120));let _0x4409cf=null,_0x2ebb8e=null;this[_0x265b96(0x144)]&&(_0x4409cf=a61_0x1ed5ee['join'](_0x566aa2,_0x265b96(0x11d),this[_0x265b96(0x144)],'tdx.json'),_0x2ebb8e=a61_0x1ed5ee[_0x265b96(0x130)](_0x566aa2,_0x265b96(0x11d),this['activeProfile'],_0x265b96(0x120))),this['configFiles']={'session':a61_0x227d9e[_0x265b96(0x123)](_0x3a31bf)?_0x3a31bf:null,'project':_0x1cb542,'profile':_0x4409cf&&a61_0x227d9e[_0x265b96(0x123)](_0x4409cf)?_0x4409cf:null,'profileCredentials':_0x2ebb8e&&a61_0x227d9e[_0x265b96(0x123)](_0x2ebb8e)?_0x2ebb8e:null,'global':a61_0x227d9e[_0x265b96(0x123)](_0x23e417)?_0x23e417:null,'globalCredentials':a61_0x227d9e[_0x265b96(0x123)](_0x3337a1)?_0x3337a1:null};}[a61_0xbdb2fd(0x135)](_0x5b98a6,_0x42899e){const _0x59d5f5=a61_0xbdb2fd;if(!_0x42899e)return _0x59d5f5(0x158);const _0xb7ec7e=_0x42899e;if(this[_0x59d5f5(0x160)][_0x59d5f5(0x14a)][_0x5b98a6]===_0xb7ec7e){if(_0x5b98a6===_0x59d5f5(0x117)&&_0xb7ec7e==='us01'&&!this[_0x59d5f5(0x160)][_0x59d5f5(0x13b)][_0x59d5f5(0x117)]&&!this[_0x59d5f5(0x160)][_0x59d5f5(0x118)][_0x59d5f5(0x117)]&&!this[_0x59d5f5(0x160)][_0x59d5f5(0x116)][_0x59d5f5(0x117)]&&!this[_0x59d5f5(0x160)][_0x59d5f5(0x12d)][_0x59d5f5(0x117)])return'default';return _0x59d5f5(0x11e)+_0x5b98a6[_0x59d5f5(0x126)](/_/g,'-');}if(this['layers'][_0x59d5f5(0x13b)][_0x5b98a6]===_0xb7ec7e)return _0x59d5f5(0x13b);if(this[_0x59d5f5(0x160)][_0x59d5f5(0x118)][_0x5b98a6]===_0xb7ec7e)return'project';if(this[_0x59d5f5(0x160)][_0x59d5f5(0x116)][_0x5b98a6]===_0xb7ec7e)return'profile:\x20'+this[_0x59d5f5(0x144)];if(this[_0x59d5f5(0x160)]['global'][_0x5b98a6]===_0xb7ec7e)return _0x59d5f5(0x12d);return _0x59d5f5(0x15f);}[a61_0xbdb2fd(0x15b)](){const _0x3a2324=a61_0xbdb2fd,_0x587277=a61_0x1ed5ee[_0x3a2324(0x130)](getConfigDir(),_0x3a2324(0x142));if(!a61_0x227d9e[_0x3a2324(0x123)](_0x587277))return{};try{const _0x32ba45=a61_0x227d9e[_0x3a2324(0x148)](_0x587277,'utf-8');return JSON['parse'](_0x32ba45);}catch{return{};}}[a61_0xbdb2fd(0x128)](_0x9497a6){const _0x39605a=a61_0xbdb2fd;_0x9497a6['site']=this[_0x39605a(0x117)],!_0x9497a6[_0x39605a(0x15e)]&&this[_0x39605a(0x15e)]&&(_0x9497a6['database']=this[_0x39605a(0x15e)]),!_0x9497a6[_0x39605a(0x121)]&&this[_0x39605a(0x164)]&&(_0x9497a6[_0x39605a(0x121)]=this[_0x39605a(0x164)]),!_0x9497a6[_0x39605a(0x141)]&&this[_0x39605a(0x119)]&&(_0x9497a6[_0x39605a(0x141)]=this[_0x39605a(0x119)]),!_0x9497a6[_0x39605a(0x156)]&&this[_0x39605a(0x122)]&&(_0x9497a6['llmProject']=this['llm_project']),!_0x9497a6[_0x39605a(0x13c)]&&this[_0x39605a(0x137)]&&(_0x9497a6[_0x39605a(0x13c)]=this[_0x39605a(0x137)]),!_0x9497a6[_0x39605a(0x166)]&&this[_0x39605a(0x15c)]&&(_0x9497a6['workflowProject']=this[_0x39605a(0x15c)]),!_0x9497a6['composableAudience']&&this[_0x39605a(0x124)]&&(_0x9497a6['composableAudience']=this[_0x39605a(0x124)]);}['getParameters'](){const _0x192de2=a61_0xbdb2fd;return[{'key':_0x192de2(0x117),'value':this[_0x192de2(0x117)]},{'key':'database','value':this['database']},{'key':'parent_segment','value':this[_0x192de2(0x164)]},{'key':_0x192de2(0x119),'value':this[_0x192de2(0x119)]},{'key':'llm_project','value':this[_0x192de2(0x122)]},{'key':'llm_agent','value':this[_0x192de2(0x137)]},{'key':_0x192de2(0x15c),'value':this['workflow_project']},{'key':'composable_audience','value':this[_0x192de2(0x124)]},{'key':'profile','value':this[_0x192de2(0x144)]||undefined}];}[a61_0xbdb2fd(0x157)](){const _0x4da005=a61_0xbdb2fd;console[_0x4da005(0x11a)](a61_0x2df60b[_0x4da005(0x14e)]('[context]'));for(const {key:_0x2f22c4,value:_0x517ac4}of this[_0x4da005(0x13a)]()){_0x517ac4&&console[_0x4da005(0x11a)](a61_0x2df60b[_0x4da005(0x167)](_0x2f22c4)+':\x20'+_0x517ac4);}}[a61_0xbdb2fd(0x163)](){const _0x32db80=a61_0xbdb2fd;console['log'](a61_0x2df60b[_0x32db80(0x14e)](_0x32db80(0x127)));for(const {key:_0x36762e,value:_0x2b7e7b}of this[_0x32db80(0x13a)]()){if(_0x2b7e7b){const _0x3b9947=_0x36762e==='profile'?'(active)':'('+this[_0x32db80(0x135)](_0x36762e,_0x2b7e7b)+')';console[_0x32db80(0x11a)](a61_0x2df60b[_0x32db80(0x167)](_0x36762e)+':\x20'+_0x2b7e7b+'\x20'+a61_0x2df60b['dim'](_0x3b9947));}}console[_0x32db80(0x11a)]('\x0a'+a61_0x2df60b[_0x32db80(0x14e)]('[configuration\x20files]'));const _0x49f73a=[{'label':_0x32db80(0x13e),'path':this[_0x32db80(0x15a)][_0x32db80(0x13b)],'extra':_0x32db80(0x161)+this[_0x32db80(0x134)]+')'},{'label':_0x32db80(0x12a),'path':this[_0x32db80(0x15a)][_0x32db80(0x118)]},{'label':_0x32db80(0x11b),'path':this[_0x32db80(0x15a)]['profile']},{'label':_0x32db80(0x129),'path':this[_0x32db80(0x15a)][_0x32db80(0x138)]},{'label':'Global','path':this['configFiles'][_0x32db80(0x12d)]},{'label':'Global\x20Credentials','path':this[_0x32db80(0x15a)][_0x32db80(0x131)]}];for(const {label:_0x245592,path:_0x1711ec,extra:_0x5cc77c}of _0x49f73a){if(_0x1711ec)console['log'](a61_0x2df60b[_0x32db80(0x167)](_0x245592)+':\x20'+_0x1711ec+'\x20'+a61_0x2df60b[_0x32db80(0x12c)]('✓')+(_0x5cc77c?'\x20'+a61_0x2df60b[_0x32db80(0x169)](_0x5cc77c):''));else{if(_0x245592===_0x32db80(0x13e))console[_0x32db80(0x11a)](a61_0x2df60b[_0x32db80(0x167)](_0x245592)+':\x20'+a61_0x2df60b[_0x32db80(0x169)](_0x32db80(0x16b))+'\x20'+a61_0x2df60b[_0x32db80(0x169)](_0x32db80(0x150)+this[_0x32db80(0x134)]+')'));else(_0x245592===_0x32db80(0x12a)||_0x245592===_0x32db80(0x12b))&&console[_0x32db80(0x11a)](a61_0x2df60b[_0x32db80(0x167)](_0x245592)+':\x20'+a61_0x2df60b[_0x32db80(0x169)](_0x32db80(0x16b)));}}}async[a61_0xbdb2fd(0x153)](){const _0x17a52d=a61_0xbdb2fd;if(!this[_0x17a52d(0x132)]){const _0x104dd8=await getOAuthTokens(this[_0x17a52d(0x144)]||undefined);if(_0x104dd8){const _0x41c4ed=0x5*0x3c*0x3e8,_0x496523=!_0x104dd8[_0x17a52d(0x154)]||_0x104dd8[_0x17a52d(0x154)]<Date[_0x17a52d(0x14d)]()+_0x41c4ed;if(_0x496523&&_0x104dd8[_0x17a52d(0x149)])try{const _0x30ac09=getConsoleUrl(this[_0x17a52d(0x117)]),_0x2ed297=await refreshAccessToken(_0x30ac09,_0x104dd8[_0x17a52d(0x149)]);await saveOAuthTokens(_0x2ed297,this[_0x17a52d(0x144)]||undefined),this[_0x17a52d(0x132)]=_0x2ed297[_0x17a52d(0x168)];}catch{this[_0x17a52d(0x132)]=_0x104dd8[_0x17a52d(0x168)];}else this['accessToken']=_0x104dd8[_0x17a52d(0x168)];return undefined;}}return this[_0x17a52d(0x152)]=await getAPIKeyAsync(this[_0x17a52d(0x117)],this[_0x17a52d(0x144)]||undefined),this[_0x17a52d(0x152)];}static async[a61_0xbdb2fd(0x159)](_0x3f27ca){const _0x2fe0ff=new GlobalContext(_0x3f27ca);return await _0x2fe0ff['resolveAPIKeyAsync'](),_0x2fe0ff;}}
1
+ const a61_0x5e9ba5=a61_0x2f84;(function(_0x4eecb7,_0x21c580){const _0x149ea2=a61_0x2f84,_0x135d62=_0x4eecb7();while(!![]){try{const _0xbc0747=parseInt(_0x149ea2(0x244))/0x1+-parseInt(_0x149ea2(0x201))/0x2+-parseInt(_0x149ea2(0x207))/0x3+-parseInt(_0x149ea2(0x21b))/0x4*(-parseInt(_0x149ea2(0x20b))/0x5)+-parseInt(_0x149ea2(0x23d))/0x6+-parseInt(_0x149ea2(0x1fc))/0x7+parseInt(_0x149ea2(0x221))/0x8;if(_0xbc0747===_0x21c580)break;else _0x135d62['push'](_0x135d62['shift']());}catch(_0x445746){_0x135d62['push'](_0x135d62['shift']());}}}(a61_0x34a6,0xbb657));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0x34a6(){const _0x1ea98b=['project','segment_path','(session:\x20','logLevel','now','green','llmProject','global','getSource','layers','workflowProject','us01','database','dim','displayWithSources','cliFlags','parent_segment','join','none','profileSource','existsSync','replace','4698030PepkKQ','llm_agent','.json','entries','(using\x20session:\x20','log','resolveAPIKeyAsync','1405228sYiQzb','assign','llmAgent','[context]','proxy','profileCredentials','default','string','apiKey','display','(active)','injectIntoOptions','workflow_project','profile','composableAudience','87178HULZqW','loadGlobalConfig','llm_project','sessions','createAsync','2631882RNfelF','utf-8','site','session','Project','[configuration\x20files]','3518274tQhOxB','accessToken','sessionId','bold','32090gDljHQ','globalCredentials','parse','profiles','INFO','expires_at','.env','refresh_token','readFileSync','verbose','configFiles','CLI\x20flag:\x20--','segmentPath','tdx.json','profile:\x20','config','184nXQYXe','activeProfile','composable_audience','parentSegment','Global','Global\x20Credentials','18810216KwMbuZ','cyan','Profile','Session','getParameters','access_token'];a61_0x34a6=function(){return _0x1ea98b;};return a61_0x34a6();}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';function a61_0x2f84(_0x1ab4c1,_0x1d9749){_0x1ab4c1=_0x1ab4c1-0x1ee;const _0x34a673=a61_0x34a6();let _0x2f84c4=_0x34a673[_0x1ab4c1];return _0x2f84c4;}import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x1b9791 from'node:fs';import*as a61_0x452e09 from'node:path';import a61_0x2247fd from'chalk';export class GlobalContext{['site'];[a61_0x5e9ba5(0x233)];[a61_0x5e9ba5(0x237)];[a61_0x5e9ba5(0x228)];[a61_0x5e9ba5(0x1fe)];[a61_0x5e9ba5(0x23e)];[a61_0x5e9ba5(0x1f9)];['composable_audience'];[a61_0x5e9ba5(0x1f5)];['accessToken'];[a61_0x5e9ba5(0x1f1)];[a61_0x5e9ba5(0x214)];[a61_0x5e9ba5(0x22a)];[a61_0x5e9ba5(0x1fa)];['profileSource']=null;['layers'];[a61_0x5e9ba5(0x21c)];['sessionId'];['configFiles'];constructor(_0x2d9234){const _0x5608de=a61_0x5e9ba5;this[_0x5608de(0x209)]=getSessionID(_0x2d9234[_0x5608de(0x204)]);const _0x59fd36=loadSessionContext(_0x2d9234[_0x5608de(0x204)]),_0x53fb92=loadProjectConfig(),_0x1199bb=this[_0x5608de(0x1fd)]();if(_0x2d9234['profile'])this[_0x5608de(0x21c)]=_0x2d9234[_0x5608de(0x1fa)],this[_0x5608de(0x23a)]='cli';else{if(_0x59fd36?.[_0x5608de(0x1fa)])this[_0x5608de(0x21c)]=_0x59fd36['profile'],this[_0x5608de(0x23a)]=_0x5608de(0x204);else{if(_0x1199bb[_0x5608de(0x1fa)])this['activeProfile']=_0x1199bb['profile'],this[_0x5608de(0x23a)]=_0x5608de(0x21a);else process.env.TDX_PROFILE?(this[_0x5608de(0x21c)]=process.env.TDX_PROFILE,this[_0x5608de(0x23a)]='env'):(this[_0x5608de(0x21c)]=null,this[_0x5608de(0x23a)]=null);}}const _0x1183b1=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x994e6e=_0x73af78=>{const _0x267317=_0x5608de;if(!_0x73af78)return{};const _0x1e15d0=_0x73af78,_0x1866dc={};for(const [_0x5d4118,_0x2ad11c]of Object[_0x267317(0x240)](_0x1e15d0)){typeof _0x2ad11c===_0x267317(0x1f4)&&(_0x1866dc[_0x5d4118]=_0x2ad11c);}return _0x1866dc;},_0x4e8d1c={},_0x4f9793=(_0x57e694,_0x3d63d8,_0x167a48)=>{const _0x3d81c4=_0x5608de;if(!_0x57e694)return![];if(_0x167a48&&_0x57e694===_0x167a48)return![];const _0x453ff2=_0x59fd36,_0x1423f4=_0x53fb92,_0x72f3e=_0x1183b1?.[_0x3d81c4(0x21a)],_0x385647=_0x1199bb,_0x50b66=_0x453ff2?.[_0x3d63d8],_0x7a2e40=_0x1423f4?.[_0x3d63d8],_0x275478=_0x72f3e?.[_0x3d63d8],_0x4913d0=_0x385647[_0x3d63d8];return _0x57e694!==_0x50b66&&_0x57e694!==_0x7a2e40&&_0x57e694!==_0x275478&&_0x57e694!==_0x4913d0;},_0x244e1d=[{'optionKey':_0x5608de(0x203),'contextKey':'site','defaultValue':_0x5608de(0x232)},{'optionKey':'database','contextKey':_0x5608de(0x233)},{'optionKey':_0x5608de(0x21e),'contextKey':'parent_segment'},{'optionKey':'llmProject','contextKey':'llm_project'},{'optionKey':_0x5608de(0x1ef),'contextKey':_0x5608de(0x23e)},{'optionKey':_0x5608de(0x1fb),'contextKey':'composable_audience'},{'optionKey':'profile','contextKey':'profile'}];for(const {optionKey:_0x302be5,contextKey:_0x345cf2,defaultValue:_0x416efd}of _0x244e1d){const _0x484150=_0x2d9234[_0x302be5];_0x4f9793(_0x484150,_0x345cf2,_0x416efd)&&(_0x4e8d1c[_0x345cf2]=_0x484150);}this['layers']={'cliFlags':_0x4e8d1c,'session':_0x994e6e(_0x59fd36),'project':_0x994e6e(_0x53fb92),'profile':_0x994e6e(_0x1183b1?.[_0x5608de(0x21a)]),'global':_0x994e6e(_0x1199bb)};const _0x3ef7ec={...this[_0x5608de(0x230)][_0x5608de(0x22e)],...this[_0x5608de(0x230)][_0x5608de(0x1fa)],...this['layers'][_0x5608de(0x227)]};process.env.TDX_SITE&&!this['layers'][_0x5608de(0x204)]['site']&&!this[_0x5608de(0x230)][_0x5608de(0x236)][_0x5608de(0x203)]&&(_0x3ef7ec['site']=process.env.TDX_SITE);Object[_0x5608de(0x1ee)](_0x3ef7ec,this[_0x5608de(0x230)][_0x5608de(0x204)]),Object[_0x5608de(0x1ee)](_0x3ef7ec,this['layers'][_0x5608de(0x236)]);const _0x379bb5=_0x3ef7ec[_0x5608de(0x203)]||_0x5608de(0x232);this[_0x5608de(0x203)]=resolveSite(_0x379bb5),this[_0x5608de(0x233)]=_0x3ef7ec['database'],this[_0x5608de(0x237)]=_0x3ef7ec[_0x5608de(0x237)],this[_0x5608de(0x228)]=_0x3ef7ec[_0x5608de(0x228)],this[_0x5608de(0x1fe)]=_0x3ef7ec[_0x5608de(0x1fe)],this['llm_agent']=_0x3ef7ec[_0x5608de(0x23e)],this[_0x5608de(0x1f9)]=_0x3ef7ec[_0x5608de(0x1f9)],this[_0x5608de(0x21d)]=_0x3ef7ec[_0x5608de(0x21d)],this[_0x5608de(0x214)]=_0x2d9234['verbose']||![],this['logLevel']=_0x2d9234[_0x5608de(0x22a)]??LogLevel[_0x5608de(0x20f)],this[_0x5608de(0x1fa)]=this[_0x5608de(0x21c)]||undefined,this[_0x5608de(0x208)]=getAccessToken(this[_0x5608de(0x21c)]||undefined),this['apiKey']=getAPIKey(this['activeProfile']||undefined);const _0x4c161a=typeof _0x1199bb[_0x5608de(0x1f1)]===_0x5608de(0x1f4)?_0x1199bb[_0x5608de(0x1f1)]:undefined;this[_0x5608de(0x1f1)]=_0x4c161a||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x25f8bd=getConfigDir(),_0x464809=a61_0x452e09[_0x5608de(0x238)](_0x25f8bd,_0x5608de(0x1ff),this[_0x5608de(0x209)]+_0x5608de(0x23f)),_0x1688df=findProjectConfigPath(),_0x23d447=a61_0x452e09[_0x5608de(0x238)](_0x25f8bd,_0x5608de(0x218)),_0xe95764=a61_0x452e09[_0x5608de(0x238)](_0x25f8bd,_0x5608de(0x211));let _0x5cb670=null,_0xbf9ef3=null;this[_0x5608de(0x21c)]&&(_0x5cb670=a61_0x452e09[_0x5608de(0x238)](_0x25f8bd,_0x5608de(0x20e),this[_0x5608de(0x21c)],_0x5608de(0x218)),_0xbf9ef3=a61_0x452e09['join'](_0x25f8bd,'profiles',this[_0x5608de(0x21c)],_0x5608de(0x211))),this[_0x5608de(0x215)]={'session':a61_0x1b9791[_0x5608de(0x23b)](_0x464809)?_0x464809:null,'project':_0x1688df,'profile':_0x5cb670&&a61_0x1b9791[_0x5608de(0x23b)](_0x5cb670)?_0x5cb670:null,'profileCredentials':_0xbf9ef3&&a61_0x1b9791[_0x5608de(0x23b)](_0xbf9ef3)?_0xbf9ef3:null,'global':a61_0x1b9791[_0x5608de(0x23b)](_0x23d447)?_0x23d447:null,'globalCredentials':a61_0x1b9791[_0x5608de(0x23b)](_0xe95764)?_0xe95764:null};}[a61_0x5e9ba5(0x22f)](_0x1891bf,_0x5d194b){const _0x39ef66=a61_0x5e9ba5;if(!_0x5d194b)return'not\x20set';const _0x3210c3=_0x5d194b;if(this['layers'][_0x39ef66(0x236)][_0x1891bf]===_0x3210c3){if(_0x1891bf===_0x39ef66(0x203)&&_0x3210c3===_0x39ef66(0x232)&&!this[_0x39ef66(0x230)][_0x39ef66(0x204)][_0x39ef66(0x203)]&&!this[_0x39ef66(0x230)][_0x39ef66(0x227)]['site']&&!this[_0x39ef66(0x230)][_0x39ef66(0x1fa)][_0x39ef66(0x203)]&&!this[_0x39ef66(0x230)][_0x39ef66(0x22e)]['site'])return _0x39ef66(0x1f3);return _0x39ef66(0x216)+_0x1891bf[_0x39ef66(0x23c)](/_/g,'-');}if(this[_0x39ef66(0x230)][_0x39ef66(0x204)][_0x1891bf]===_0x3210c3)return _0x39ef66(0x204);if(this[_0x39ef66(0x230)]['project'][_0x1891bf]===_0x3210c3)return _0x39ef66(0x227);if(this[_0x39ef66(0x230)][_0x39ef66(0x1fa)][_0x1891bf]===_0x3210c3)return _0x39ef66(0x219)+this[_0x39ef66(0x21c)];if(this[_0x39ef66(0x230)]['global'][_0x1891bf]===_0x3210c3)return _0x39ef66(0x22e);return'default';}[a61_0x5e9ba5(0x1fd)](){const _0xd8f2a6=a61_0x5e9ba5,_0x6f43d6=a61_0x452e09['join'](getConfigDir(),_0xd8f2a6(0x218));if(!a61_0x1b9791[_0xd8f2a6(0x23b)](_0x6f43d6))return{};try{const _0x269602=a61_0x1b9791[_0xd8f2a6(0x213)](_0x6f43d6,_0xd8f2a6(0x202));return JSON[_0xd8f2a6(0x20d)](_0x269602);}catch{return{};}}[a61_0x5e9ba5(0x1f8)](_0x30b359){const _0x407381=a61_0x5e9ba5;_0x30b359[_0x407381(0x203)]=this[_0x407381(0x203)],!_0x30b359[_0x407381(0x233)]&&this[_0x407381(0x233)]&&(_0x30b359[_0x407381(0x233)]=this['database']),!_0x30b359[_0x407381(0x21e)]&&this[_0x407381(0x237)]&&(_0x30b359['parentSegment']=this[_0x407381(0x237)]),!_0x30b359[_0x407381(0x217)]&&this['segment_path']&&(_0x30b359[_0x407381(0x217)]=this[_0x407381(0x228)]),!_0x30b359[_0x407381(0x22d)]&&this[_0x407381(0x1fe)]&&(_0x30b359[_0x407381(0x22d)]=this['llm_project']),!_0x30b359[_0x407381(0x1ef)]&&this[_0x407381(0x23e)]&&(_0x30b359[_0x407381(0x1ef)]=this[_0x407381(0x23e)]),!_0x30b359[_0x407381(0x231)]&&this['workflow_project']&&(_0x30b359[_0x407381(0x231)]=this[_0x407381(0x1f9)]),!_0x30b359[_0x407381(0x1fb)]&&this[_0x407381(0x21d)]&&(_0x30b359[_0x407381(0x1fb)]=this[_0x407381(0x21d)]);}[a61_0x5e9ba5(0x225)](){const _0xaccc0c=a61_0x5e9ba5;return[{'key':_0xaccc0c(0x203),'value':this[_0xaccc0c(0x203)]},{'key':_0xaccc0c(0x233),'value':this['database']},{'key':_0xaccc0c(0x237),'value':this[_0xaccc0c(0x237)]},{'key':'segment_path','value':this['segment_path']},{'key':_0xaccc0c(0x1fe),'value':this[_0xaccc0c(0x1fe)]},{'key':_0xaccc0c(0x23e),'value':this[_0xaccc0c(0x23e)]},{'key':'workflow_project','value':this[_0xaccc0c(0x1f9)]},{'key':'composable_audience','value':this['composable_audience']},{'key':'profile','value':this[_0xaccc0c(0x21c)]||undefined}];}[a61_0x5e9ba5(0x1f6)](){const _0x33b708=a61_0x5e9ba5;console[_0x33b708(0x242)](a61_0x2247fd[_0x33b708(0x20a)](_0x33b708(0x1f0)));for(const {key:_0x353a46,value:_0x5bcb72}of this[_0x33b708(0x225)]()){_0x5bcb72&&console[_0x33b708(0x242)](a61_0x2247fd[_0x33b708(0x222)](_0x353a46)+':\x20'+_0x5bcb72);}}[a61_0x5e9ba5(0x235)](){const _0x283253=a61_0x5e9ba5;console[_0x283253(0x242)](a61_0x2247fd[_0x283253(0x20a)](_0x283253(0x1f0)));for(const {key:_0x265401,value:_0x494794}of this[_0x283253(0x225)]()){if(_0x494794){const _0x5138b7=_0x265401==='profile'?_0x283253(0x1f7):'('+this[_0x283253(0x22f)](_0x265401,_0x494794)+')';console[_0x283253(0x242)](a61_0x2247fd['cyan'](_0x265401)+':\x20'+_0x494794+'\x20'+a61_0x2247fd['dim'](_0x5138b7));}}console[_0x283253(0x242)]('\x0a'+a61_0x2247fd[_0x283253(0x20a)](_0x283253(0x206)));const _0x47637a=[{'label':_0x283253(0x224),'path':this['configFiles'][_0x283253(0x204)],'extra':_0x283253(0x229)+this[_0x283253(0x209)]+')'},{'label':_0x283253(0x205),'path':this[_0x283253(0x215)][_0x283253(0x227)]},{'label':_0x283253(0x223),'path':this[_0x283253(0x215)]['profile']},{'label':'Profile\x20Credentials','path':this[_0x283253(0x215)][_0x283253(0x1f2)]},{'label':_0x283253(0x21f),'path':this[_0x283253(0x215)][_0x283253(0x22e)]},{'label':_0x283253(0x220),'path':this[_0x283253(0x215)][_0x283253(0x20c)]}];for(const {label:_0x2f408c,path:_0x1c90c8,extra:_0x5d40e3}of _0x47637a){if(_0x1c90c8)console[_0x283253(0x242)](a61_0x2247fd[_0x283253(0x222)](_0x2f408c)+':\x20'+_0x1c90c8+'\x20'+a61_0x2247fd[_0x283253(0x22c)]('✓')+(_0x5d40e3?'\x20'+a61_0x2247fd['dim'](_0x5d40e3):''));else{if(_0x2f408c===_0x283253(0x224))console[_0x283253(0x242)](a61_0x2247fd[_0x283253(0x222)](_0x2f408c)+':\x20'+a61_0x2247fd[_0x283253(0x234)](_0x283253(0x239))+'\x20'+a61_0x2247fd[_0x283253(0x234)](_0x283253(0x241)+this[_0x283253(0x209)]+')'));else(_0x2f408c==='Project'||_0x2f408c===_0x283253(0x21f))&&console[_0x283253(0x242)](a61_0x2247fd[_0x283253(0x222)](_0x2f408c)+':\x20'+a61_0x2247fd[_0x283253(0x234)](_0x283253(0x239)));}}}async[a61_0x5e9ba5(0x243)](){const _0x55f9f5=a61_0x5e9ba5;if(!this[_0x55f9f5(0x208)]){const _0x44a0b9=await getOAuthTokens(this[_0x55f9f5(0x21c)]||undefined);if(_0x44a0b9){const _0x4d49a9=0x5*0x3c*0x3e8,_0x153a11=!_0x44a0b9[_0x55f9f5(0x210)]||_0x44a0b9['expires_at']<Date[_0x55f9f5(0x22b)]()+_0x4d49a9;if(_0x153a11&&_0x44a0b9[_0x55f9f5(0x212)])try{const _0x314e00=getConsoleUrl(this['site']),_0xcccbdf=await refreshAccessToken(_0x314e00,_0x44a0b9[_0x55f9f5(0x212)]);await saveOAuthTokens(_0xcccbdf,this[_0x55f9f5(0x21c)]||undefined),this[_0x55f9f5(0x208)]=_0xcccbdf['access_token'];}catch{this[_0x55f9f5(0x208)]=_0x44a0b9[_0x55f9f5(0x226)];}else this[_0x55f9f5(0x208)]=_0x44a0b9[_0x55f9f5(0x226)];return undefined;}}return this[_0x55f9f5(0x1f5)]=await getAPIKeyAsync(this[_0x55f9f5(0x203)],this[_0x55f9f5(0x21c)]||undefined),this[_0x55f9f5(0x1f5)];}static async[a61_0x5e9ba5(0x200)](_0x1c0642){const _0x490460=a61_0x5e9ba5,_0x52ae4b=new GlobalContext(_0x1c0642);return await _0x52ae4b[_0x490460(0x243)](),_0x52ae4b;}}
@@ -1 +1 @@
1
- const a62_0x22fa29=a62_0x5e7e;function a62_0x3902(){const _0x17890a=['103nOqwGw','15608835FObiAP','@napi-rs/keyring','access_denied','getPassword','toLowerCase','unavailable','reason','deleteCredential','Warning:\x20','-25293','not\x20available','setPassword','success','includes','6690160BLUimG','message','could\x20not\x20be\x20found','cannot\x20find','System\x20keychain\x20is\x20not\x20available','not\x20found','not_found','__keychain_test__','1978865mWkify','access','error','22430gjQfjo','4631876xKsLqz','Entry','no\x20matching\x20entry','4091199adqxTF','3ZfPtAz','7144470xVvbZX','tdx',':api_key'];a62_0x3902=function(){return _0x17890a;};return a62_0x3902();}(function(_0x44f73b,_0x2469b7){const _0x3f369b=a62_0x5e7e,_0x45c802=_0x44f73b();while(!![]){try{const _0x1be2a5=-parseInt(_0x3f369b(0x79))/0x1*(-parseInt(_0x3f369b(0x70))/0x2)+parseInt(_0x3f369b(0x75))/0x3*(parseInt(_0x3f369b(0x71))/0x4)+parseInt(_0x3f369b(0x6d))/0x5+parseInt(_0x3f369b(0x76))/0x6+-parseInt(_0x3f369b(0x74))/0x7+-parseInt(_0x3f369b(0x65))/0x8+-parseInt(_0x3f369b(0x7a))/0x9;if(_0x1be2a5===_0x2469b7)break;else _0x45c802['push'](_0x45c802['shift']());}catch(_0xd7de6){_0x45c802['push'](_0x45c802['shift']());}}}(a62_0x3902,0xb5c8e));const SERVICE_NAME=a62_0x22fa29(0x77);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x29fe70=a62_0x22fa29;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x7fc8a1=await import(_0x29fe70(0x7b));return EntryClass=_0x7fc8a1[_0x29fe70(0x72)],EntryClass;}catch(_0x42b573){return keyringLoadError=_0x42b573 instanceof Error?_0x42b573:new Error(String(_0x42b573)),null;}}function getAccountName(_0x430d8b){const _0x35ee68=a62_0x22fa29,_0x1ccd04=_0x430d8b||'';return'profile:'+_0x1ccd04+_0x35ee68(0x78);}export async function getKeychainAPIKey(_0xa101bb){const _0x22a696=a62_0x22fa29,_0x34f14a=await getKeychainAPIKeyWithStatus(_0xa101bb);if(_0x34f14a[_0x22a696(0x86)])return _0x34f14a['value'];return _0x34f14a[_0x22a696(0x80)]===_0x22a696(0x7c)&&console[_0x22a696(0x6f)](_0x22a696(0x82)+_0x34f14a[_0x22a696(0x66)]),null;}function a62_0x5e7e(_0x2237fb,_0xcee6a3){_0x2237fb=_0x2237fb-0x65;const _0x3902f8=a62_0x3902();let _0x5e7e70=_0x3902f8[_0x2237fb];return _0x5e7e70;}export async function getKeychainAPIKeyWithStatus(_0x4c70e0){const _0x2df6d5=a62_0x22fa29;try{const _0x197ecc=await getEntryClass();if(!_0x197ecc)return{'success':![],'reason':_0x2df6d5(0x7f)};const _0x59df9b=getAccountName(_0x4c70e0),_0x4bd4f8=new _0x197ecc(SERVICE_NAME,_0x59df9b),_0xb59fe3=_0x4bd4f8[_0x2df6d5(0x7d)]();if(_0xb59fe3)return{'success':!![],'value':_0xb59fe3};return{'success':![],'reason':_0x2df6d5(0x6b)};}catch(_0x223142){const _0x309a54=_0x223142 instanceof Error?_0x223142[_0x2df6d5(0x66)]:String(_0x223142);if(_0x309a54['includes']('-25300')||_0x309a54[_0x2df6d5(0x7e)]()[_0x2df6d5(0x87)](_0x2df6d5(0x67))||_0x309a54[_0x2df6d5(0x7e)]()['includes'](_0x2df6d5(0x6a))||_0x309a54[_0x2df6d5(0x7e)]()[_0x2df6d5(0x87)](_0x2df6d5(0x73)))return{'success':![],'reason':_0x2df6d5(0x6b)};if(_0x309a54[_0x2df6d5(0x87)](_0x2df6d5(0x83))||_0x309a54['toLowerCase']()[_0x2df6d5(0x87)]('restricted')||_0x309a54[_0x2df6d5(0x7e)]()['includes'](_0x2df6d5(0x6e)))return{'success':![],'reason':'access_denied','message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x2df6d5(0x7f),'message':_0x309a54};}}export async function saveKeychainAPIKey(_0x1382b4,_0x15d1a5){const _0x1f0fa4=a62_0x22fa29,_0x31bf70=await getEntryClass();if(!_0x31bf70)throw new Error(_0x1f0fa4(0x69));const _0xb0cb90=getAccountName(_0x15d1a5),_0x4bc71b=new _0x31bf70(SERVICE_NAME,_0xb0cb90);_0x4bc71b[_0x1f0fa4(0x85)](_0x1382b4);}export async function deleteKeychainAPIKey(_0x4fafa4){const _0x10a20d=a62_0x22fa29;try{const _0x2e59ed=await getEntryClass();if(!_0x2e59ed)return![];const _0x3e9e50=getAccountName(_0x4fafa4),_0x42ff48=new _0x2e59ed(SERVICE_NAME,_0x3e9e50);return _0x42ff48[_0x10a20d(0x81)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x58fddd=a62_0x22fa29;try{const _0x372303=await getEntryClass();if(!_0x372303)return![];const _0x5450a5=new _0x372303(SERVICE_NAME,_0x58fddd(0x6c));return _0x5450a5['getPassword'](),!![];}catch(_0xc2dd0f){const _0xabcf0d=_0xc2dd0f instanceof Error?_0xc2dd0f[_0x58fddd(0x66)][_0x58fddd(0x7e)]():'';if(_0xabcf0d[_0x58fddd(0x87)](_0x58fddd(0x84))||_0xabcf0d[_0x58fddd(0x87)]('not\x20supported')||_0xabcf0d[_0x58fddd(0x87)](_0x58fddd(0x68)))return![];return!![];}}
1
+ const a62_0x5f2947=a62_0x4ce4;(function(_0x401098,_0x373d4a){const _0x1b5988=a62_0x4ce4,_0x5f01a8=_0x401098();while(!![]){try{const _0x2abf9f=-parseInt(_0x1b5988(0xd3))/0x1*(parseInt(_0x1b5988(0xe7))/0x2)+parseInt(_0x1b5988(0xd0))/0x3*(parseInt(_0x1b5988(0xde))/0x4)+-parseInt(_0x1b5988(0xe5))/0x5*(parseInt(_0x1b5988(0xe1))/0x6)+parseInt(_0x1b5988(0xce))/0x7*(parseInt(_0x1b5988(0xd7))/0x8)+-parseInt(_0x1b5988(0xe3))/0x9*(-parseInt(_0x1b5988(0xec))/0xa)+-parseInt(_0x1b5988(0xc8))/0xb+parseInt(_0x1b5988(0xea))/0xc;if(_0x2abf9f===_0x373d4a)break;else _0x5f01a8['push'](_0x5f01a8['shift']());}catch(_0x3b82d7){_0x5f01a8['push'](_0x5f01a8['shift']());}}}(a62_0x1054,0x3ab2d));const SERVICE_NAME=a62_0x5f2947(0xe8);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x7264f=a62_0x5f2947;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x1fd1c5=await import(_0x7264f(0xd4));return EntryClass=_0x1fd1c5[_0x7264f(0xcf)],EntryClass;}catch(_0x256870){return keyringLoadError=_0x256870 instanceof Error?_0x256870:new Error(String(_0x256870)),null;}}function a62_0x1054(){const _0x3aa6d2=['not\x20supported','7353228HbMwqI','__keychain_test__','43110prBKCK','restricted','success','4437565EUMatr','error','includes','not\x20available','no\x20matching\x20entry','unavailable','15792ijcoHO','Entry','48yIXlth','toLowerCase','profile:','766IbUdTT','@napi-rs/keyring','reason','-25300','96GfhTWP','not_found','cannot\x20find','setPassword','access_denied','message','getPassword','71744TZtPzz','access',':api_key','6yNeYdi','System\x20keychain\x20is\x20not\x20available','198gFnLml','-25293','1686085fKrEeg','not\x20found','106WuqkdV','tdx'];a62_0x1054=function(){return _0x3aa6d2;};return a62_0x1054();}function getAccountName(_0x163f27){const _0x1e628f=a62_0x5f2947,_0x2a04d6=_0x163f27||'';return _0x1e628f(0xd2)+_0x2a04d6+_0x1e628f(0xe0);}export async function getKeychainAPIKey(_0x363afd){const _0x394566=a62_0x5f2947,_0x159a20=await getKeychainAPIKeyWithStatus(_0x363afd);if(_0x159a20[_0x394566(0xc7)])return _0x159a20['value'];return _0x159a20[_0x394566(0xd5)]==='access_denied'&&console[_0x394566(0xc9)]('Warning:\x20'+_0x159a20[_0x394566(0xdc)]),null;}export async function getKeychainAPIKeyWithStatus(_0x429753){const _0x16e139=a62_0x5f2947;try{const _0x19211e=await getEntryClass();if(!_0x19211e)return{'success':![],'reason':_0x16e139(0xcd)};const _0x1866e7=getAccountName(_0x429753),_0x153f11=new _0x19211e(SERVICE_NAME,_0x1866e7),_0x318f99=_0x153f11[_0x16e139(0xdd)]();if(_0x318f99)return{'success':!![],'value':_0x318f99};return{'success':![],'reason':_0x16e139(0xd8)};}catch(_0x41d936){const _0x3f44e0=_0x41d936 instanceof Error?_0x41d936[_0x16e139(0xdc)]:String(_0x41d936);if(_0x3f44e0[_0x16e139(0xca)](_0x16e139(0xd6))||_0x3f44e0['toLowerCase']()[_0x16e139(0xca)]('could\x20not\x20be\x20found')||_0x3f44e0[_0x16e139(0xd1)]()['includes'](_0x16e139(0xe6))||_0x3f44e0[_0x16e139(0xd1)]()[_0x16e139(0xca)](_0x16e139(0xcc)))return{'success':![],'reason':_0x16e139(0xd8)};if(_0x3f44e0[_0x16e139(0xca)](_0x16e139(0xe4))||_0x3f44e0['toLowerCase']()[_0x16e139(0xca)](_0x16e139(0xed))||_0x3f44e0[_0x16e139(0xd1)]()['includes'](_0x16e139(0xdf)))return{'success':![],'reason':_0x16e139(0xdb),'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':_0x16e139(0xcd),'message':_0x3f44e0};}}function a62_0x4ce4(_0x2e5be8,_0x384258){_0x2e5be8=_0x2e5be8-0xc7;const _0x10548b=a62_0x1054();let _0x4ce4f7=_0x10548b[_0x2e5be8];return _0x4ce4f7;}export async function saveKeychainAPIKey(_0x352d33,_0x257222){const _0x269992=a62_0x5f2947,_0x89c128=await getEntryClass();if(!_0x89c128)throw new Error(_0x269992(0xe2));const _0x202562=getAccountName(_0x257222),_0x275886=new _0x89c128(SERVICE_NAME,_0x202562);_0x275886[_0x269992(0xda)](_0x352d33);}export async function deleteKeychainAPIKey(_0x2d0f83){try{const _0x2e03a3=await getEntryClass();if(!_0x2e03a3)return![];const _0x13ab7d=getAccountName(_0x2d0f83),_0x274d04=new _0x2e03a3(SERVICE_NAME,_0x13ab7d);return _0x274d04['deleteCredential'](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x128fb3=a62_0x5f2947;try{const _0x8f6e9=await getEntryClass();if(!_0x8f6e9)return![];const _0x5dc45f=new _0x8f6e9(SERVICE_NAME,_0x128fb3(0xeb));return _0x5dc45f[_0x128fb3(0xdd)](),!![];}catch(_0x1e21a2){const _0x47cf6a=_0x1e21a2 instanceof Error?_0x1e21a2[_0x128fb3(0xdc)][_0x128fb3(0xd1)]():'';if(_0x47cf6a[_0x128fb3(0xca)](_0x128fb3(0xcb))||_0x47cf6a['includes'](_0x128fb3(0xe9))||_0x47cf6a[_0x128fb3(0xca)](_0x128fb3(0xd9)))return![];return!![];}}
@@ -1 +1 @@
1
- function a63_0x5064(_0x45ae79,_0x43a2af){_0x45ae79=_0x45ae79-0x121;const _0xd6010f=a63_0xd601();let _0x5064c0=_0xd6010f[_0x45ae79];return _0x5064c0;}const a63_0x47d5f8=a63_0x5064;(function(_0x195440,_0x1102d7){const _0xee8c59=a63_0x5064,_0x31e0d4=_0x195440();while(!![]){try{const _0x353e6b=parseInt(_0xee8c59(0x125))/0x1*(parseInt(_0xee8c59(0x12e))/0x2)+-parseInt(_0xee8c59(0x12c))/0x3*(parseInt(_0xee8c59(0x12b))/0x4)+-parseInt(_0xee8c59(0x135))/0x5*(parseInt(_0xee8c59(0x128))/0x6)+parseInt(_0xee8c59(0x126))/0x7*(parseInt(_0xee8c59(0x121))/0x8)+-parseInt(_0xee8c59(0x12f))/0x9*(-parseInt(_0xee8c59(0x12a))/0xa)+-parseInt(_0xee8c59(0x12d))/0xb*(-parseInt(_0xee8c59(0x136))/0xc)+-parseInt(_0xee8c59(0x123))/0xd;if(_0x353e6b===_0x1102d7)break;else _0x31e0d4['push'](_0x31e0d4['shift']());}catch(_0x2086ec){_0x31e0d4['push'](_0x31e0d4['shift']());}}}(a63_0xd601,0x504d0));const SERVICE_NAME=a63_0x47d5f8(0x132);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x3b2de9=a63_0x47d5f8;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x43eb16=await import(_0x3b2de9(0x130));return EntryClass=_0x43eb16[_0x3b2de9(0x127)],EntryClass;}catch(_0x20376c){return keyringLoadError=_0x20376c instanceof Error?_0x20376c:new Error(String(_0x20376c)),null;}}function getOAuthAccountName(_0x8e3ab8){const _0x3f5895=a63_0x47d5f8,_0x98c603=_0x8e3ab8||'';return _0x3f5895(0x122)+_0x98c603+_0x3f5895(0x129);}export async function saveOAuthTokens(_0x18524d,_0x3b4113){const _0xf2d14f=a63_0x47d5f8,_0xe4fc7b=await getEntryClass();if(!_0xe4fc7b)throw new Error(_0xf2d14f(0x131));const _0x7d2f93=getOAuthAccountName(_0x3b4113),_0x53e5c7=new _0xe4fc7b(SERVICE_NAME,_0x7d2f93);_0x53e5c7[_0xf2d14f(0x124)](JSON['stringify'](_0x18524d));}function a63_0xd601(){const _0x2ca3ba=['tdx','parse','deleteCredential','157000ppafCt','84mjjVPY','101960gcJFTX','profile:','5992480OlQiET','setPassword','65775yjKOsn','70ZZQQet','Entry','66YaNmRp',':oauth_tokens','4655510IlLDUP','12476RhvDYn','183CPjqwW','634315WPihtg','10UprABw','9xjxRYD','@napi-rs/keyring','System\x20keychain\x20is\x20not\x20available'];a63_0xd601=function(){return _0x2ca3ba;};return a63_0xd601();}export async function getOAuthTokens(_0x352a6a){const _0x51a53f=a63_0x47d5f8;try{const _0x1e9baa=await getEntryClass();if(!_0x1e9baa)return null;const _0x28c4b2=getOAuthAccountName(_0x352a6a),_0xdcf71b=new _0x1e9baa(SERVICE_NAME,_0x28c4b2),_0x483c6d=_0xdcf71b['getPassword']();if(_0x483c6d)return JSON[_0x51a53f(0x133)](_0x483c6d);return null;}catch{return null;}}export async function deleteOAuthTokens(_0xea45f8){const _0x3995ab=a63_0x47d5f8;try{const _0xde7a1c=await getEntryClass();if(!_0xde7a1c)return![];const _0x591845=getOAuthAccountName(_0xea45f8),_0x2606e4=new _0xde7a1c(SERVICE_NAME,_0x591845);return _0x2606e4[_0x3995ab(0x134)](),!![];}catch{return![];}}
1
+ (function(_0x54c224,_0xb1662e){const _0x4bac32=a63_0x1e64,_0x52daeb=_0x54c224();while(!![]){try{const _0x33e240=parseInt(_0x4bac32(0x17c))/0x1+parseInt(_0x4bac32(0x172))/0x2*(parseInt(_0x4bac32(0x17d))/0x3)+-parseInt(_0x4bac32(0x173))/0x4*(-parseInt(_0x4bac32(0x176))/0x5)+parseInt(_0x4bac32(0x17a))/0x6+-parseInt(_0x4bac32(0x177))/0x7*(-parseInt(_0x4bac32(0x16d))/0x8)+-parseInt(_0x4bac32(0x17b))/0x9+-parseInt(_0x4bac32(0x16f))/0xa;if(_0x33e240===_0xb1662e)break;else _0x52daeb['push'](_0x52daeb['shift']());}catch(_0x23eb89){_0x52daeb['push'](_0x52daeb['shift']());}}}(a63_0x1abe,0x4cf45));const SERVICE_NAME='tdx';function a63_0x1e64(_0xf6bb84,_0x2b0b56){_0xf6bb84=_0xf6bb84-0x16c;const _0x1abe98=a63_0x1abe();let _0x1e6465=_0x1abe98[_0xf6bb84];return _0x1e6465;}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1e5966=a63_0x1e64;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3bd01f=await import(_0x1e5966(0x174));return EntryClass=_0x3bd01f['Entry'],EntryClass;}catch(_0x4dab47){return keyringLoadError=_0x4dab47 instanceof Error?_0x4dab47:new Error(String(_0x4dab47)),null;}}function getOAuthAccountName(_0x7b6ab0){const _0x534db0=a63_0x1e64,_0x50020c=_0x7b6ab0||'';return _0x534db0(0x16e)+_0x50020c+_0x534db0(0x16c);}export async function saveOAuthTokens(_0x6d20d,_0x41c8e9){const _0xce3c60=a63_0x1e64,_0x3126e5=await getEntryClass();if(!_0x3126e5)throw new Error(_0xce3c60(0x179));const _0x5a6884=getOAuthAccountName(_0x41c8e9),_0x5752c9=new _0x3126e5(SERVICE_NAME,_0x5a6884);_0x5752c9[_0xce3c60(0x178)](JSON[_0xce3c60(0x170)](_0x6d20d));}export async function getOAuthTokens(_0x120d7a){const _0xd1b352=a63_0x1e64;try{const _0x54b697=await getEntryClass();if(!_0x54b697)return null;const _0x194a61=getOAuthAccountName(_0x120d7a),_0x30a0f4=new _0x54b697(SERVICE_NAME,_0x194a61),_0xa1b60f=_0x30a0f4[_0xd1b352(0x175)]();if(_0xa1b60f)return JSON['parse'](_0xa1b60f);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x243c1c){const _0x3f6572=a63_0x1e64;try{const _0x1447bc=await getEntryClass();if(!_0x1447bc)return![];const _0x4ca945=getOAuthAccountName(_0x243c1c),_0x285b1a=new _0x1447bc(SERVICE_NAME,_0x4ca945);return _0x285b1a[_0x3f6572(0x171)](),!![];}catch{return![];}}function a63_0x1abe(){const _0x8377b5=['16ifqDIk','profile:','11164000NNVwNR','stringify','deleteCredential','25178oFpsek','128532SsJgnD','@napi-rs/keyring','getPassword','45SnymmP','1269415KRaWGa','setPassword','System\x20keychain\x20is\x20not\x20available','2707674oCNDtg','4938345aAwSkp','335817ANkfue','129BJIqEA',':oauth_tokens'];a63_0x1abe=function(){return _0x8377b5;};return a63_0x1abe();}
@@ -1 +1 @@
1
- const a64_0xcf66be=a64_0x10c3;(function(_0x44f598,_0x99965a){const _0x522409=a64_0x10c3,_0xdd8592=_0x44f598();while(!![]){try{const _0x62fd77=-parseInt(_0x522409(0xc9))/0x1*(-parseInt(_0x522409(0xd8))/0x2)+-parseInt(_0x522409(0xb8))/0x3+parseInt(_0x522409(0xa1))/0x4*(parseInt(_0x522409(0xad))/0x5)+-parseInt(_0x522409(0x9c))/0x6*(parseInt(_0x522409(0xa0))/0x7)+-parseInt(_0x522409(0xb5))/0x8*(-parseInt(_0x522409(0x99))/0x9)+parseInt(_0x522409(0xbf))/0xa*(parseInt(_0x522409(0xb7))/0xb)+-parseInt(_0x522409(0xa8))/0xc*(parseInt(_0x522409(0xb6))/0xd);if(_0x62fd77===_0x99965a)break;else _0xdd8592['push'](_0xdd8592['shift']());}catch(_0x39823b){_0xdd8592['push'](_0xdd8592['shift']());}}}(a64_0x3d45,0xf0013));import*as a64_0x5f199f from'node:crypto';import*as a64_0x16225a from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a64_0xcf66be(0xab);export function getOAuthClientId(){const _0x34c018=a64_0xcf66be;return process.env.TD_OAUTH_CLIENT_ID||_0x34c018(0xd3);}export function generatePKCEPair(){const _0x4b91ea=a64_0xcf66be,_0x3ef95b=a64_0x5f199f[_0x4b91ea(0xcb)](0x20)[_0x4b91ea(0xae)](_0x4b91ea(0xa6)),_0x584ee7=a64_0x5f199f[_0x4b91ea(0xac)](_0x4b91ea(0xbb))[_0x4b91ea(0xc6)](_0x3ef95b)['digest'](_0x4b91ea(0xa6));return{'verifier':_0x3ef95b,'challenge':_0x584ee7};}export function buildAuthorizeURL(_0x28254f,_0x129a56){const _0x37b5b7=a64_0xcf66be,_0x42ff2f=new URL('/oauth/authorize',_0x28254f);return _0x42ff2f[_0x37b5b7(0xba)][_0x37b5b7(0xb4)](_0x37b5b7(0xb1),_0x37b5b7(0xdb)),_0x42ff2f[_0x37b5b7(0xba)][_0x37b5b7(0xb4)](_0x37b5b7(0xc5),_0x129a56[_0x37b5b7(0xa5)]),_0x42ff2f['searchParams'][_0x37b5b7(0xb4)](_0x37b5b7(0xbd),_0x129a56[_0x37b5b7(0x98)]),_0x42ff2f[_0x37b5b7(0xba)][_0x37b5b7(0xb4)](_0x37b5b7(0xcd),_0x129a56[_0x37b5b7(0xcd)]),_0x42ff2f['searchParams']['set'](_0x37b5b7(0xc2),_0x129a56['codeChallenge']),_0x42ff2f[_0x37b5b7(0xba)][_0x37b5b7(0xb4)](_0x37b5b7(0xcc),_0x37b5b7(0x9e)),_0x129a56[_0x37b5b7(0x9d)]&&_0x42ff2f[_0x37b5b7(0xba)][_0x37b5b7(0xb4)](_0x37b5b7(0x9d),_0x129a56['scope']),_0x42ff2f[_0x37b5b7(0xae)]();}export function buildSSOInitiateURL(_0x7df9bc,_0x1fab6e,_0x667596){const _0x1cd1f6=a64_0xcf66be,_0x28b1f2=new URL(_0x1cd1f6(0xa7),_0x7df9bc);_0x28b1f2['searchParams']['set'](_0x1cd1f6(0xb3),_0x1fab6e);const _0x27c6c5=_0x667596[_0x1cd1f6(0xb9)](_0x7df9bc,'');return _0x28b1f2[_0x1cd1f6(0xba)][_0x1cd1f6(0xb4)](_0x1cd1f6(0xbc),_0x27c6c5),_0x28b1f2['toString']();}export async function postTokenRequest(_0xde33aa,_0x15c89e){const _0x3fd11d=a64_0xcf66be,_0x12bc35=new URLSearchParams(_0x15c89e)[_0x3fd11d(0xae)](),_0x5211d8=await fetch(_0xde33aa,{'method':_0x3fd11d(0xb2),'headers':{'Content-Type':_0x3fd11d(0x9a)},'body':_0x12bc35});if(!_0x5211d8['ok']){const _0x17ec83=await _0x5211d8['text']();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0x5211d8[_0x3fd11d(0xa4)]+_0x3fd11d(0xc8)+_0x17ec83);}const _0xeef5fe=await _0x5211d8[_0x3fd11d(0xb0)]();return{'access_token':_0xeef5fe[_0x3fd11d(0xc0)],'refresh_token':_0xeef5fe[_0x3fd11d(0xd2)],'scope':_0xeef5fe[_0x3fd11d(0x9d)],'expires_at':_0xeef5fe[_0x3fd11d(0xa3)]?Date['now']()+_0xeef5fe[_0x3fd11d(0xa3)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x13fd86,_0x3247b4,_0xa4e0d7,_0x3a8bfc){const _0x43e62a=a64_0xcf66be,_0x3c3944=_0x13fd86+_0x43e62a(0xd9);return postTokenRequest(_0x3c3944,{'grant_type':_0x43e62a(0xd0),'client_id':getOAuthClientId(),'code':_0x3247b4,'code_verifier':_0xa4e0d7,'redirect_uri':_0x3a8bfc});}function a64_0x3d45(){const _0x13a694=['\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','text/html','close','openid\x20email\x20profile','1456916ASWXcn','/oauth/token','writeHead','code','redirectUri','9CnCFNH','application/x-www-form-urlencoded','http://127.0.0.1','6ZcfhxY','scope','S256','waitForCallback','9131045FGHJOA','1689388ugSMAH','127.0.0.1','expires_in','status','clientId','base64url','/users/initiate_sso','584760xpQSeG','pathname','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','/oauth/callback','createHash','5QSMQpG','toString','EADDRINUSE','json','response_type','POST','account_name','set','178680KYaCNx','13bxbmih','121022gvWKjm','735516fGOENh','replace','searchParams','sha256','redirect_to_path','redirect_uri','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','1280tHNKwE','access_token','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','code_challenge','end','accountName','client_id','update','error','):\x20','1WgHxDG','Port\x20','randomBytes','code_challenge_method','state','get','text/plain','authorization_code','message','refresh_token','tdx'];a64_0x3d45=function(){return _0x13a694;};return a64_0x3d45();}export function startLocalCallbackServer(){const _0xc45932=a64_0xcf66be;let _0x3abb37,_0x44c640;const _0x55fafd=new Promise((_0x42f330,_0x27273a)=>{_0x3abb37=_0x42f330,_0x44c640=_0x27273a;}),_0x1c0e64=a64_0x16225a['createServer']((_0x445df6,_0x4c7d90)=>{const _0x937db5=a64_0x10c3,_0x51d687=new URL(_0x445df6['url']||'/',_0x937db5(0x9b));if(_0x51d687[_0x937db5(0xa9)]!==_0x937db5(0xab)){_0x4c7d90[_0x937db5(0xda)](0x194,{'Content-Type':_0x937db5(0xcf)}),_0x4c7d90[_0x937db5(0xc3)]('Not\x20Found');return;}const _0x2de0fe=_0x51d687[_0x937db5(0xba)][_0x937db5(0xce)](_0x937db5(0xdb)),_0x29a1eb=_0x51d687[_0x937db5(0xba)]['get'](_0x937db5(0xcd)),_0x195285=_0x51d687[_0x937db5(0xba)][_0x937db5(0xce)](_0x937db5(0xc7));if(_0x195285||!_0x2de0fe||!_0x29a1eb){_0x4c7d90['writeHead'](0x190,{'Content-Type':_0x937db5(0xd5)}),_0x4c7d90[_0x937db5(0xc3)](_0x937db5(0xc1)),_0x44c640(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x4c7d90[_0x937db5(0xda)](0xc8,{'Content-Type':_0x937db5(0xd5)}),_0x4c7d90['end']('<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>'),_0x3abb37({'code':_0x2de0fe,'state':_0x29a1eb});});_0x1c0e64['on'](_0xc45932(0xc7),_0x2be6fe=>{const _0x2bbc08=_0xc45932;_0x2be6fe[_0x2bbc08(0xdb)]===_0x2bbc08(0xaf)?_0x44c640(new Error(_0x2bbc08(0xca)+OAUTH_CALLBACK_PORT+_0x2bbc08(0xd4))):_0x44c640(new Error(_0x2bbc08(0xaa)+_0x2be6fe[_0x2bbc08(0xd1)]));}),_0x1c0e64['listen'](OAUTH_CALLBACK_PORT,_0xc45932(0xa2));const _0x220d72=setTimeout(()=>{const _0x3c4f26=_0xc45932;_0x44c640(new Error(_0x3c4f26(0xbe))),_0x1c0e64['close']();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x55fafd,'close':()=>{const _0x456de2=_0xc45932;clearTimeout(_0x220d72),_0x1c0e64[_0x456de2(0xd6)]();}};}function a64_0x10c3(_0x4d6eda,_0x37d4f3){_0x4d6eda=_0x4d6eda-0x98;const _0x3d45e3=a64_0x3d45();let _0x10c3a2=_0x3d45e3[_0x4d6eda];return _0x10c3a2;}export async function startOAuthFlow(_0x5cf407,_0xf0c8c7){const _0x5186f7=a64_0xcf66be,_0x488aa5=getConsoleUrl(_0x5cf407),_0x49d03a=getOAuthClientId(),{verifier:_0x1b66f6,challenge:_0x3c052a}=generatePKCEPair(),_0x12caf5=a64_0x5f199f[_0x5186f7(0xcb)](0x10)[_0x5186f7(0xae)]('hex'),_0x4d374b=startLocalCallbackServer();try{const _0x36b6c8=OAUTH_REDIRECT_URI,_0x37188e=buildAuthorizeURL(_0x488aa5,{'clientId':_0x49d03a,'redirectUri':_0x36b6c8,'state':_0x12caf5,'codeChallenge':_0x3c052a,'scope':_0x5186f7(0xd7)}),_0x3591a7=_0xf0c8c7?.[_0x5186f7(0xc4)]?buildSSOInitiateURL(_0x488aa5,_0xf0c8c7[_0x5186f7(0xc4)],_0x37188e):_0x37188e;openBrowser(_0x3591a7);const _0x1449d6=await _0x4d374b[_0x5186f7(0x9f)]();if(_0x1449d6[_0x5186f7(0xcd)]!==_0x12caf5)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x488aa5,_0x1449d6[_0x5186f7(0xdb)],_0x1b66f6,_0x36b6c8);}finally{_0x4d374b[_0x5186f7(0xd6)]();}}
1
+ const a64_0x44f132=a64_0x5c44;(function(_0x2a5f62,_0x5642bf){const _0x581f55=a64_0x5c44,_0x50ba11=_0x2a5f62();while(!![]){try{const _0x151356=-parseInt(_0x581f55(0x233))/0x1+-parseInt(_0x581f55(0x20c))/0x2*(-parseInt(_0x581f55(0x214))/0x3)+parseInt(_0x581f55(0x211))/0x4*(parseInt(_0x581f55(0x22a))/0x5)+parseInt(_0x581f55(0x20d))/0x6*(-parseInt(_0x581f55(0x21a))/0x7)+-parseInt(_0x581f55(0x1fc))/0x8+parseInt(_0x581f55(0x21b))/0x9+-parseInt(_0x581f55(0x222))/0xa*(-parseInt(_0x581f55(0x208))/0xb);if(_0x151356===_0x5642bf)break;else _0x50ba11['push'](_0x50ba11['shift']());}catch(_0x35a4f7){_0x50ba11['push'](_0x50ba11['shift']());}}}(a64_0x2a7d,0x7af5d));import*as a64_0x51d03d from'node:crypto';import*as a64_0x1c7887 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a64_0x44f132(0x22c)+OAUTH_CALLBACK_PORT+'/oauth/callback';function a64_0x5c44(_0x2290dc,_0x175d73){_0x2290dc=_0x2290dc-0x1f3;const _0x2a7db7=a64_0x2a7d();let _0x5c4459=_0x2a7db7[_0x2290dc];return _0x5c4459;}export function getOAuthClientId(){const _0xf202c5=a64_0x44f132;return process.env.TD_OAUTH_CLIENT_ID||_0xf202c5(0x210);}export function generatePKCEPair(){const _0x442e2a=a64_0x44f132,_0x166ce6=a64_0x51d03d[_0x442e2a(0x230)](0x20)['toString'](_0x442e2a(0x232)),_0xe78e25=a64_0x51d03d[_0x442e2a(0x223)](_0x442e2a(0x20f))[_0x442e2a(0x21d)](_0x166ce6)[_0x442e2a(0x21c)]('base64url');return{'verifier':_0x166ce6,'challenge':_0xe78e25};}export function buildAuthorizeURL(_0x526f6a,_0x132c26){const _0x5ee98a=a64_0x44f132,_0x4b4101=new URL(_0x5ee98a(0x202),_0x526f6a);return _0x4b4101[_0x5ee98a(0x201)][_0x5ee98a(0x22f)](_0x5ee98a(0x215),_0x5ee98a(0x213)),_0x4b4101[_0x5ee98a(0x201)][_0x5ee98a(0x22f)](_0x5ee98a(0x209),_0x132c26[_0x5ee98a(0x20a)]),_0x4b4101[_0x5ee98a(0x201)]['set'](_0x5ee98a(0x1f5),_0x132c26[_0x5ee98a(0x216)]),_0x4b4101['searchParams']['set'](_0x5ee98a(0x1fb),_0x132c26[_0x5ee98a(0x1fb)]),_0x4b4101[_0x5ee98a(0x201)]['set'](_0x5ee98a(0x219),_0x132c26[_0x5ee98a(0x1f8)]),_0x4b4101['searchParams'][_0x5ee98a(0x22f)](_0x5ee98a(0x21e),_0x5ee98a(0x1f3)),_0x132c26[_0x5ee98a(0x227)]&&_0x4b4101[_0x5ee98a(0x201)][_0x5ee98a(0x22f)](_0x5ee98a(0x227),_0x132c26[_0x5ee98a(0x227)]),_0x4b4101[_0x5ee98a(0x228)]();}function a64_0x2a7d(){const _0x57fb5e=['redirectUri','writeHead','refresh_token','code_challenge','3224956IyMQTF','3474036EicVRW','digest','update','code_challenge_method','json','listen','text/html','10JKBpgJ','createHash','get','close','waitForCallback','scope','toString','OAuth\x20token\x20request\x20failed\x20(','29105dpuXqt','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','http://localhost:','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','http://127.0.0.1','set','randomBytes','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','base64url','445893hemhYm','S256','error','redirect_uri','application/x-www-form-urlencoded','EADDRINUSE','codeChallenge','account_name','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','state','2396384sLOUkO','POST','/oauth/callback','accountName','status','searchParams','/oauth/authorize','end','createServer','/users/initiate_sso','expires_in','text','12232968wbDSaI','client_id','clientId','url','82nIHiNn','12ZzxReJ','now','sha256','tdx','452qkNwtp','replace','code','1071vYShCl','response_type'];a64_0x2a7d=function(){return _0x57fb5e;};return a64_0x2a7d();}export function buildSSOInitiateURL(_0x454a36,_0x2ae3fe,_0x23dfce){const _0x8c1687=a64_0x44f132,_0x18f00b=new URL(_0x8c1687(0x205),_0x454a36);_0x18f00b['searchParams'][_0x8c1687(0x22f)](_0x8c1687(0x1f9),_0x2ae3fe);const _0x355bfa=_0x23dfce[_0x8c1687(0x212)](_0x454a36,'');return _0x18f00b[_0x8c1687(0x201)][_0x8c1687(0x22f)]('redirect_to_path',_0x355bfa),_0x18f00b[_0x8c1687(0x228)]();}export async function postTokenRequest(_0xc51a51,_0x1aa4c4){const _0x485930=a64_0x44f132,_0x48cfba=new URLSearchParams(_0x1aa4c4)[_0x485930(0x228)](),_0x173301=await fetch(_0xc51a51,{'method':_0x485930(0x1fd),'headers':{'Content-Type':_0x485930(0x1f6)},'body':_0x48cfba});if(!_0x173301['ok']){const _0x309267=await _0x173301[_0x485930(0x207)]();throw new Error(_0x485930(0x229)+_0x173301[_0x485930(0x200)]+'):\x20'+_0x309267);}const _0x325b52=await _0x173301[_0x485930(0x21f)]();return{'access_token':_0x325b52['access_token'],'refresh_token':_0x325b52[_0x485930(0x218)],'scope':_0x325b52[_0x485930(0x227)],'expires_at':_0x325b52['expires_in']?Date[_0x485930(0x20e)]()+_0x325b52[_0x485930(0x206)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x562385,_0x4cea43,_0x5e75b5,_0x4e4e6f){const _0x5c488f=_0x562385+'/oauth/token';return postTokenRequest(_0x5c488f,{'grant_type':'authorization_code','client_id':getOAuthClientId(),'code':_0x4cea43,'code_verifier':_0x5e75b5,'redirect_uri':_0x4e4e6f});}export function startLocalCallbackServer(){const _0xf399b1=a64_0x44f132;let _0x211d3f,_0x34edce;const _0x5ce6a7=new Promise((_0x56fb44,_0x14403b)=>{_0x211d3f=_0x56fb44,_0x34edce=_0x14403b;}),_0x255ca6=a64_0x1c7887[_0xf399b1(0x204)]((_0x1bd3e4,_0x130703)=>{const _0x39a4e7=_0xf399b1,_0x3f45ac=new URL(_0x1bd3e4[_0x39a4e7(0x20b)]||'/',_0x39a4e7(0x22e));if(_0x3f45ac['pathname']!==_0x39a4e7(0x1fe)){_0x130703[_0x39a4e7(0x217)](0x194,{'Content-Type':'text/plain'}),_0x130703['end']('Not\x20Found');return;}const _0x3c0a88=_0x3f45ac[_0x39a4e7(0x201)][_0x39a4e7(0x224)]('code'),_0x3bf1a8=_0x3f45ac[_0x39a4e7(0x201)][_0x39a4e7(0x224)]('state'),_0x532f6c=_0x3f45ac[_0x39a4e7(0x201)][_0x39a4e7(0x224)](_0x39a4e7(0x1f4));if(_0x532f6c||!_0x3c0a88||!_0x3bf1a8){_0x130703[_0x39a4e7(0x217)](0x190,{'Content-Type':_0x39a4e7(0x221)}),_0x130703[_0x39a4e7(0x203)]('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0x34edce(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x130703[_0x39a4e7(0x217)](0xc8,{'Content-Type':_0x39a4e7(0x221)}),_0x130703['end'](_0x39a4e7(0x231)),_0x211d3f({'code':_0x3c0a88,'state':_0x3bf1a8});});_0x255ca6['on'](_0xf399b1(0x1f4),_0xc1a598=>{const _0x40e10d=_0xf399b1;_0xc1a598[_0x40e10d(0x213)]===_0x40e10d(0x1f7)?_0x34edce(new Error('Port\x20'+OAUTH_CALLBACK_PORT+_0x40e10d(0x22d))):_0x34edce(new Error(_0x40e10d(0x22b)+_0xc1a598['message']));}),_0x255ca6[_0xf399b1(0x220)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x5973e7=setTimeout(()=>{const _0x264012=_0xf399b1;_0x34edce(new Error(_0x264012(0x1fa))),_0x255ca6[_0x264012(0x225)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x5ce6a7,'close':()=>{clearTimeout(_0x5973e7),_0x255ca6['close']();}};}export async function startOAuthFlow(_0x251035,_0x44544e){const _0x430504=a64_0x44f132,_0x2db574=getConsoleUrl(_0x251035),_0x5334f5=getOAuthClientId(),{verifier:_0x2b3946,challenge:_0x2957d1}=generatePKCEPair(),_0x4c91bc=a64_0x51d03d[_0x430504(0x230)](0x10)[_0x430504(0x228)]('hex'),_0x12749f=startLocalCallbackServer();try{const _0x2ea0f9=OAUTH_REDIRECT_URI,_0x28b347=buildAuthorizeURL(_0x2db574,{'clientId':_0x5334f5,'redirectUri':_0x2ea0f9,'state':_0x4c91bc,'codeChallenge':_0x2957d1,'scope':'openid\x20email\x20profile'}),_0x3624ee=_0x44544e?.[_0x430504(0x1ff)]?buildSSOInitiateURL(_0x2db574,_0x44544e[_0x430504(0x1ff)],_0x28b347):_0x28b347;openBrowser(_0x3624ee);const _0x4afee2=await _0x12749f[_0x430504(0x226)]();if(_0x4afee2['state']!==_0x4c91bc)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x2db574,_0x4afee2[_0x430504(0x213)],_0x2b3946,_0x2ea0f9);}finally{_0x12749f[_0x430504(0x225)]();}}
@@ -1 +1 @@
1
- const a65_0x37679b=a65_0x4474;(function(_0x1556ca,_0x4bc287){const _0x34ea68=a65_0x4474,_0x2de885=_0x1556ca();while(!![]){try{const _0x503817=parseInt(_0x34ea68(0x183))/0x1+parseInt(_0x34ea68(0x18d))/0x2+parseInt(_0x34ea68(0x187))/0x3+-parseInt(_0x34ea68(0x14a))/0x4+-parseInt(_0x34ea68(0x152))/0x5+parseInt(_0x34ea68(0x185))/0x6+parseInt(_0x34ea68(0x177))/0x7*(parseInt(_0x34ea68(0x184))/0x8);if(_0x503817===_0x4bc287)break;else _0x2de885['push'](_0x2de885['shift']());}catch(_0x1bb0a8){_0x2de885['push'](_0x2de885['shift']());}}}(a65_0x5454,0x8ca3a));import*as a65_0x1c6966 from'node:fs';import*as a65_0xc9a307 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';function a65_0x5454(){const _0x182856=['user','.env','description','string','255425xOPLjL','24yIbaZC','2829648QJtDzs','filter','1039794czHXml','test','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','utf-8','user_info','Failed\x20to\x20parse\x20','436552mUXmHk','object','message','warn','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x27:\x20config\x20must\x20be\x20an\x20object','map','stringify',',\x20creating\x20new\x20file','4432744pnMuPO','\x27\x20will\x20be\x20ignored','.env.','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','To\x20migrate:','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','4276860SpJUof','INVALID_PROFILE_CONFIG','\x20\x20mv\x20\x22','directory','profile','\x20does\x20not\x20exist','\x27:\x20unknown\x20config\x20key\x20\x27','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','readFileSync','from','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','readdirSync','database','\x22\x20\x22','rmSync','push','name','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','values','entries','some','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','profiles','Warning:\x20Profile\x20\x27','@tdx-studio','existsSync','Profile\x20\x27','llm_agent','local','find','\x27\x20not\x20found\x20in\x20user\x20configuration','parse','parent_segment','llm_project','join','2911321qRMQaN','tdx.json','site','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','keys','Profile\x20',':\x20Invalid\x20JSON\x20syntax','toISOString'];a65_0x5454=function(){return _0x182856;};return a65_0x5454();}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';function a65_0x4474(_0x1370df,_0x1ac610){_0x1370df=_0x1370df-0x14a;const _0x5454cb=a65_0x5454();let _0x447489=_0x5454cb[_0x1370df];return _0x447489;}export const STUDIO_PROFILE_NAME=a65_0x37679b(0x16c);export function getProfileParams(_0x35fb7c){const _0x57e39e=a65_0x37679b,_0x508611={};if(!_0x35fb7c)return _0x508611;for(const [_0x3f8876,_0x58c6b8]of Object['entries'](_0x35fb7c)){_0x3f8876!==_0x57e39e(0x181)&&_0x58c6b8!==undefined&&(_0x508611[_0x3f8876]=_0x58c6b8);}return _0x508611;}export function getProfilesDir(){const _0x33fcf1=a65_0x37679b;return a65_0xc9a307['join'](getConfigDir(),_0x33fcf1(0x16a));}function getProfileDir(_0x35990a){const _0x16ae3f=a65_0x37679b;return a65_0xc9a307[_0x16ae3f(0x176)](getProfilesDir(),_0x35990a);}function getProfileConfigPath(_0x2c2521){const _0x2802d2=a65_0x37679b;return a65_0xc9a307[_0x2802d2(0x176)](getProfileDir(_0x2c2521),'tdx.json');}function getProfileEnvPath(_0x4a28c8){const _0x5db380=a65_0x37679b;return a65_0xc9a307[_0x5db380(0x176)](getProfileDir(_0x4a28c8),_0x5db380(0x180));}function getGlobalConfigPath(){const _0x347a8e=a65_0x37679b;return a65_0xc9a307[_0x347a8e(0x176)](getConfigDir(),_0x347a8e(0x178));}function validateProfileName(_0x4c5859){const _0x2c2c19=a65_0x37679b;if(/^@?[a-zA-Z0-9_-]+$/[_0x2c2c19(0x188)](_0x4c5859))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x2c2c19(0x188)](_0x4c5859))return;throw new Error('Invalid\x20profile\x20name:\x20'+_0x4c5859+_0x2c2c19(0x17a));}function validateProfileConfig(_0x201fbc,_0x41fdcb){const _0x424002=a65_0x37679b;if(typeof _0x201fbc!==_0x424002(0x18e)||_0x201fbc===null)throw new SDKError(ErrorCode[_0x424002(0x153)],_0x424002(0x16e)+_0x41fdcb+_0x424002(0x192));const _0x4b6330=[_0x424002(0x181),'site',_0x424002(0x160),_0x424002(0x174),_0x424002(0x175),_0x424002(0x16f),_0x424002(0x18b)],_0x4fb291=_0x201fbc;for(const _0x59bf26 of Object[_0x424002(0x17b)](_0x4fb291)){!_0x4b6330['includes'](_0x59bf26)&&console[_0x424002(0x190)](_0x424002(0x16b)+_0x41fdcb+_0x424002(0x158)+_0x59bf26+_0x424002(0x14b));}if(_0x4fb291[_0x424002(0x181)]!==undefined&&typeof _0x4fb291[_0x424002(0x181)]!==_0x424002(0x182))throw new SDKError(ErrorCode[_0x424002(0x153)],_0x424002(0x16e)+_0x41fdcb+_0x424002(0x15e));if(_0x4fb291['site']!==undefined&&typeof _0x4fb291[_0x424002(0x179)]!=='string')throw new SDKError(ErrorCode[_0x424002(0x153)],_0x424002(0x16e)+_0x41fdcb+_0x424002(0x151));if(_0x4fb291[_0x424002(0x160)]!==undefined&&typeof _0x4fb291['database']!=='string')throw new SDKError(ErrorCode[_0x424002(0x153)],_0x424002(0x16e)+_0x41fdcb+_0x424002(0x14d));if(_0x4fb291['parent_segment']!==undefined&&typeof _0x4fb291[_0x424002(0x174)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x41fdcb+_0x424002(0x191));if(_0x4fb291[_0x424002(0x175)]!==undefined&&typeof _0x4fb291['llm_project']!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x41fdcb+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x4fb291[_0x424002(0x16f)]!==undefined&&typeof _0x4fb291[_0x424002(0x16f)]!==_0x424002(0x182))throw new SDKError(ErrorCode[_0x424002(0x153)],'Profile\x20\x27'+_0x41fdcb+_0x424002(0x159));return!![];}function loadProfilesFromTdxJson(_0xb5ec85,_0x21b088){const _0xca7cd4=a65_0x37679b;if(!a65_0x1c6966[_0xca7cd4(0x16d)](_0xb5ec85))return[];try{const _0x21998a=a65_0x1c6966[_0xca7cd4(0x15b)](_0xb5ec85,_0xca7cd4(0x18a)),_0x1c44f6=JSON['parse'](_0x21998a);if(!_0x1c44f6[_0xca7cd4(0x16a)]||typeof _0x1c44f6[_0xca7cd4(0x16a)]!=='object')return[];const _0x1b2d32=[];for(const [_0x59b04c,_0xfce56d]of Object[_0xca7cd4(0x167)](_0x1c44f6['profiles'])){try{validateProfileConfig(_0xfce56d,_0x59b04c);const _0x45f8d2=getNewCredentialPath(_0x59b04c),_0xdf0feb=getOldCredentialPath(_0x59b04c),_0x3d0756=a65_0x1c6966['existsSync'](_0x45f8d2)||a65_0x1c6966[_0xca7cd4(0x16d)](_0xdf0feb);_0x1b2d32[_0xca7cd4(0x163)]({'name':_0x59b04c,'config':_0xfce56d,'metadata':{'name':_0x59b04c,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x3d0756,'scope':_0x21b088});}catch(_0x12d4b2){_0x12d4b2 instanceof Error&&(console[_0xca7cd4(0x190)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0xb5ec85+':'),console[_0xca7cd4(0x190)]('\x20\x20'+_0x12d4b2[_0xca7cd4(0x18f)]+'\x0a'));}}return _0x1b2d32;}catch(_0x2ed223){return _0x2ed223 instanceof SyntaxError?(console[_0xca7cd4(0x190)](_0xca7cd4(0x15d)+_0xb5ec85+_0xca7cd4(0x17d)),console[_0xca7cd4(0x190)]('Error:\x20'+_0x2ed223[_0xca7cd4(0x18f)]+'\x0a')):console[_0xca7cd4(0x190)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0xb5ec85+':\x20'+_0x2ed223+'\x0a'),[];}}export function getNewCredentialPath(_0x40be69){const _0x150fd2=a65_0x37679b;return a65_0xc9a307[_0x150fd2(0x176)](getConfigDir(),_0x150fd2(0x14c)+_0x40be69);}function getOldCredentialPath(_0x45eedf){const _0x1ef780=a65_0x37679b;return a65_0xc9a307[_0x1ef780(0x176)](getProfilesDir(),_0x45eedf,_0x1ef780(0x180));}function loadProfilesFromTdxJsonFiles(){const _0x5429ff=a65_0x37679b,_0x3d298b=[],_0x2ce839=findProjectConfigPath();_0x2ce839&&_0x3d298b[_0x5429ff(0x163)](...loadProfilesFromTdxJson(_0x2ce839,_0x5429ff(0x170)));const _0x3d1f85=a65_0xc9a307[_0x5429ff(0x176)](getConfigDir(),_0x5429ff(0x178));return _0x3d298b[_0x5429ff(0x163)](...loadProfilesFromTdxJson(_0x3d1f85,_0x5429ff(0x17f))),_0x3d298b;}function loadProfilesFromDirectories(){const _0x466c98=a65_0x37679b,_0x4ce969=getProfilesDir();if(!a65_0x1c6966['existsSync'](_0x4ce969))return[];try{return a65_0x1c6966[_0x466c98(0x15f)](_0x4ce969,{'withFileTypes':!![]})[_0x466c98(0x186)](_0x5be874=>_0x5be874['isDirectory']())[_0x466c98(0x193)](_0x4c43c2=>_0x4c43c2['name'])[_0x466c98(0x186)](_0x224b84=>{const _0x275db0=_0x466c98,_0x29b3e6=getProfileConfigPath(_0x224b84),_0x5af752=getProfileEnvPath(_0x224b84);return a65_0x1c6966['existsSync'](_0x29b3e6)||a65_0x1c6966[_0x275db0(0x16d)](_0x5af752);})[_0x466c98(0x193)](_0x3049d3=>{const _0x2e83c5=loadProfileFromDirectory(_0x3049d3);if(_0x2e83c5)return{..._0x2e83c5,'scope':'directory'};return null;})[_0x466c98(0x186)](_0x4468a6=>_0x4468a6!==null);}catch{return[];}}function loadProfileFromDirectory(_0x194ce6){const _0xddd2d2=a65_0x37679b,_0x599d99=getProfileConfigPath(_0x194ce6),_0x41e0a3=getOldCredentialPath(_0x194ce6);if(!a65_0x1c6966[_0xddd2d2(0x16d)](_0x599d99)&&!a65_0x1c6966['existsSync'](_0x41e0a3))return null;let _0x50f3c2={},_0x2c170f={'name':_0x194ce6,'createdAt':new Date()[_0xddd2d2(0x17e)]()};if(a65_0x1c6966[_0xddd2d2(0x16d)](_0x599d99))try{const _0x5cc2ff=a65_0x1c6966[_0xddd2d2(0x15b)](_0x599d99,_0xddd2d2(0x18a)),_0x13f8ac=JSON[_0xddd2d2(0x173)](_0x5cc2ff),{metadata:_0x5cf3c3,..._0x33d8fc}=_0x13f8ac;_0x50f3c2=_0x33d8fc,_0x5cf3c3&&(_0x2c170f=_0x5cf3c3);}catch{}return{'name':_0x194ce6,'config':_0x50f3c2,'metadata':_0x2c170f,'hasCredentials':a65_0x1c6966['existsSync'](_0x41e0a3),'scope':_0xddd2d2(0x155)};}export function listProfiles(){const _0x4c7129=a65_0x37679b,_0x4ca4e3=loadProfilesFromTdxJsonFiles(),_0x675aaf=loadProfilesFromDirectories();if(_0x675aaf['length']>0x0){const _0x1aac79=_0x675aaf[_0x4c7129(0x193)](_0x201416=>_0x201416[_0x4c7129(0x164)])[_0x4c7129(0x176)](',\x20'),_0x4f83ec=getConfigDir();console[_0x4c7129(0x190)](_0x4c7129(0x165)+_0x1aac79),console[_0x4c7129(0x190)](_0x4c7129(0x169)),console[_0x4c7129(0x190)]('\x20\x201.\x20Edit:\x20'+a65_0xc9a307[_0x4c7129(0x176)](_0x4f83ec,_0x4c7129(0x178))),console[_0x4c7129(0x190)](_0x4c7129(0x14e)),console[_0x4c7129(0x190)](_0x4c7129(0x189));}const _0x25518c=[..._0x4ca4e3,..._0x675aaf],_0x1758bb=new Map();for(const _0x1f55e7 of _0x25518c){!_0x1758bb['has'](_0x1f55e7[_0x4c7129(0x164)])&&_0x1758bb['set'](_0x1f55e7['name'],_0x1f55e7);}return Array[_0x4c7129(0x15c)](_0x1758bb[_0x4c7129(0x166)]())['sort']((_0x231975,_0x7ed9d5)=>_0x231975[_0x4c7129(0x164)]['localeCompare'](_0x7ed9d5[_0x4c7129(0x164)]));}export function profileExists(_0x437271){const _0x1da17a=a65_0x37679b,_0x3f817b=listProfiles();return _0x3f817b[_0x1da17a(0x168)](_0xd849fa=>_0xd849fa[_0x1da17a(0x164)]===_0x437271);}export function loadProfile(_0x5a0fdf){const _0x247e83=a65_0x37679b;validateProfileName(_0x5a0fdf);const _0x4506ad=listProfiles(),_0x5cacc8=_0x4506ad[_0x247e83(0x171)](_0x22f836=>_0x22f836[_0x247e83(0x164)]===_0x5a0fdf);return _0x5cacc8||null;}export function saveProfile(_0x2b39e3,_0x5a5d64,_0x3ea623=![]){saveProfileToUserConfig(_0x2b39e3,_0x5a5d64);}export function deleteProfile(_0x11501a){const _0xa80cb0=a65_0x37679b;validateProfileName(_0x11501a);const _0x1223d0=getProfileDir(_0x11501a);if(!a65_0x1c6966[_0xa80cb0(0x16d)](_0x1223d0))throw new Error('Profile\x20'+_0x11501a+'\x20does\x20not\x20exist');a65_0x1c6966[_0xa80cb0(0x162)](_0x1223d0,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4d6510,_0x42cd3a){const _0x4e027a=a65_0x37679b;validateProfileName(_0x4d6510);const _0x1aaa40=getGlobalConfigPath(),_0x35cd9e=getConfigDir();!a65_0x1c6966[_0x4e027a(0x16d)](_0x35cd9e)&&createSecureDirectory(_0x35cd9e);let _0x1eaa9c={};if(a65_0x1c6966[_0x4e027a(0x16d)](_0x1aaa40))try{const _0x2bd767=a65_0x1c6966[_0x4e027a(0x15b)](_0x1aaa40,'utf-8');_0x1eaa9c=JSON[_0x4e027a(0x173)](_0x2bd767);}catch{console[_0x4e027a(0x190)](_0x4e027a(0x15a)+_0x1aaa40+_0x4e027a(0x195));}!_0x1eaa9c['profiles']&&(_0x1eaa9c[_0x4e027a(0x16a)]={}),_0x1eaa9c[_0x4e027a(0x16a)][_0x4d6510]=_0x42cd3a,writeSecureFile(_0x1aaa40,JSON[_0x4e027a(0x194)](_0x1eaa9c,null,0x2));}export function removeProfileFromUserConfig(_0x10abe2){const _0x43f32a=a65_0x37679b;validateProfileName(_0x10abe2);const _0x451cda=getGlobalConfigPath();if(!a65_0x1c6966[_0x43f32a(0x16d)](_0x451cda))throw new Error(_0x43f32a(0x16e)+_0x10abe2+_0x43f32a(0x172));let _0x20bd5e={};try{const _0x4128f=a65_0x1c6966[_0x43f32a(0x15b)](_0x451cda,_0x43f32a(0x18a));_0x20bd5e=JSON['parse'](_0x4128f);}catch{throw new Error(_0x43f32a(0x18c)+_0x451cda);}if(!_0x20bd5e[_0x43f32a(0x16a)]||!_0x20bd5e[_0x43f32a(0x16a)][_0x10abe2])throw new Error(_0x43f32a(0x16e)+_0x10abe2+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x20bd5e['profiles'][_0x10abe2],_0x20bd5e[_0x43f32a(0x156)]===_0x10abe2&&delete _0x20bd5e[_0x43f32a(0x156)],writeSecureFile(_0x451cda,JSON[_0x43f32a(0x194)](_0x20bd5e,null,0x2));}export function getActiveProfile(){const _0x49229c=a65_0x37679b,_0x2023c2=loadSessionContext();if(_0x2023c2?.[_0x49229c(0x156)])return _0x2023c2['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x265834=getGlobalConfigPath();if(!a65_0x1c6966[_0x49229c(0x16d)](_0x265834))return null;try{const _0x33aed4=a65_0x1c6966['readFileSync'](_0x265834,_0x49229c(0x18a)),_0x154399=JSON['parse'](_0x33aed4);return _0x154399[_0x49229c(0x156)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x57c367){const _0x77371e=a65_0x37679b,_0x155ecb=getGlobalConfigPath(),_0x1f4e28=getConfigDir();!a65_0x1c6966[_0x77371e(0x16d)](_0x1f4e28)&&createSecureDirectory(_0x1f4e28);let _0x228e21={};if(a65_0x1c6966['existsSync'](_0x155ecb))try{const _0x554360=a65_0x1c6966[_0x77371e(0x15b)](_0x155ecb,'utf-8');_0x228e21=JSON[_0x77371e(0x173)](_0x554360);}catch{console[_0x77371e(0x190)](_0x77371e(0x15a)+_0x155ecb+_0x77371e(0x195));}_0x228e21[_0x77371e(0x179)]=_0x57c367,writeSecureFile(_0x155ecb,JSON['stringify'](_0x228e21,null,0x2));}export function saveActiveProfileToUserConfig(_0x1a8ac0){const _0x5f20b9=a65_0x37679b;validateProfileName(_0x1a8ac0);const _0x2abb35=getGlobalConfigPath(),_0x2a7f8b=getConfigDir();!a65_0x1c6966[_0x5f20b9(0x16d)](_0x2a7f8b)&&createSecureDirectory(_0x2a7f8b);let _0x1f2f05={};if(a65_0x1c6966[_0x5f20b9(0x16d)](_0x2abb35))try{const _0xb666c5=a65_0x1c6966[_0x5f20b9(0x15b)](_0x2abb35,_0x5f20b9(0x18a));_0x1f2f05=JSON[_0x5f20b9(0x173)](_0xb666c5);}catch{console[_0x5f20b9(0x190)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x2abb35+_0x5f20b9(0x195));}_0x1f2f05[_0x5f20b9(0x156)]=_0x1a8ac0,writeSecureFile(_0x2abb35,JSON[_0x5f20b9(0x194)](_0x1f2f05,null,0x2));}function clearFieldFromUserConfig(_0x42bedf){const _0x10b05e=a65_0x37679b,_0x50b4eb=getGlobalConfigPath();if(!a65_0x1c6966[_0x10b05e(0x16d)](_0x50b4eb))return;let _0x23058d={};try{const _0x395b3e=a65_0x1c6966['readFileSync'](_0x50b4eb,_0x10b05e(0x18a));_0x23058d=JSON[_0x10b05e(0x173)](_0x395b3e);}catch{return;}delete _0x23058d[_0x42bedf],writeSecureFile(_0x50b4eb,JSON[_0x10b05e(0x194)](_0x23058d,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x453eda=a65_0x37679b;clearFieldFromUserConfig(_0x453eda(0x179));}export function clearActiveProfileFromUserConfig(){const _0x32a0fd=a65_0x37679b;clearFieldFromUserConfig(_0x32a0fd(0x156));}export function createProfile(_0x3a796,_0x4c70b5){const _0x33bba1=a65_0x37679b;validateProfileName(_0x3a796);if(profileExists(_0x3a796))throw new Error(_0x33bba1(0x17c)+_0x3a796+'\x20already\x20exists');saveProfile(_0x3a796,_0x4c70b5);}export function saveProfileCredentials(_0x73861c,_0x14e08d){const _0x3984f4=a65_0x37679b;validateProfileName(_0x73861c);if(!profileExists(_0x73861c))throw new Error(_0x3984f4(0x17c)+_0x73861c+_0x3984f4(0x157));const _0x3fe856=getNewCredentialPath(_0x73861c);writeSecureFile(_0x3fe856,_0x14e08d);}export function loadProfileCredentials(_0x37b964){const _0x4f36ca=a65_0x37679b;validateProfileName(_0x37b964);const _0x1daf4e=getNewCredentialPath(_0x37b964);if(a65_0x1c6966[_0x4f36ca(0x16d)](_0x1daf4e))try{return a65_0x1c6966['readFileSync'](_0x1daf4e,_0x4f36ca(0x18a));}catch{}const _0x4d1898=getOldCredentialPath(_0x37b964);if(a65_0x1c6966[_0x4f36ca(0x16d)](_0x4d1898)){console['warn'](_0x4f36ca(0x150)+_0x37b964+'\x27'),console[_0x4f36ca(0x190)](_0x4f36ca(0x14f)),console['warn'](_0x4f36ca(0x154)+_0x4d1898+_0x4f36ca(0x161)+_0x1daf4e+'\x22'),console['warn']('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a65_0x1c6966['readFileSync'](_0x4d1898,_0x4f36ca(0x18a));}catch{return null;}}return null;}
1
+ const a65_0x4238ab=a65_0x25cb;(function(_0x29d315,_0x4a447d){const _0x2f6d0a=a65_0x25cb,_0xd8a8a4=_0x29d315();while(!![]){try{const _0x4701b9=-parseInt(_0x2f6d0a(0x167))/0x1*(parseInt(_0x2f6d0a(0x119))/0x2)+-parseInt(_0x2f6d0a(0x161))/0x3+parseInt(_0x2f6d0a(0x11d))/0x4+-parseInt(_0x2f6d0a(0x150))/0x5*(parseInt(_0x2f6d0a(0x144))/0x6)+parseInt(_0x2f6d0a(0x11f))/0x7+-parseInt(_0x2f6d0a(0x166))/0x8+parseInt(_0x2f6d0a(0x160))/0x9;if(_0x4701b9===_0x4a447d)break;else _0xd8a8a4['push'](_0xd8a8a4['shift']());}catch(_0x38bf2c){_0xd8a8a4['push'](_0xd8a8a4['shift']());}}}(a65_0x4ef5,0x3071a));import*as a65_0x20a008 from'node:fs';function a65_0x25cb(_0x34270a,_0x20e11b){_0x34270a=_0x34270a-0x119;const _0x4ef504=a65_0x4ef5();let _0x25cbbe=_0x4ef504[_0x34270a];return _0x25cbbe;}import*as a65_0x2b42cd 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_0x4238ab(0x16c);export function getProfileParams(_0x1c61b0){const _0x530cee=a65_0x4238ab,_0x5096f5={};if(!_0x1c61b0)return _0x5096f5;for(const [_0x27f8ac,_0x5170e2]of Object[_0x530cee(0x153)](_0x1c61b0)){_0x27f8ac!=='description'&&_0x5170e2!==undefined&&(_0x5096f5[_0x27f8ac]=_0x5170e2);}return _0x5096f5;}export function getProfilesDir(){const _0x2b7633=a65_0x4238ab;return a65_0x2b42cd[_0x2b7633(0x169)](getConfigDir(),_0x2b7633(0x130));}function getProfileDir(_0x16617a){const _0x5b328c=a65_0x4238ab;return a65_0x2b42cd[_0x5b328c(0x169)](getProfilesDir(),_0x16617a);}function getProfileConfigPath(_0x2aec49){const _0x5514a3=a65_0x4238ab;return a65_0x2b42cd[_0x5514a3(0x169)](getProfileDir(_0x2aec49),_0x5514a3(0x168));}function getProfileEnvPath(_0x2e09b0){const _0x199d84=a65_0x4238ab;return a65_0x2b42cd[_0x199d84(0x169)](getProfileDir(_0x2e09b0),_0x199d84(0x148));}function getGlobalConfigPath(){const _0x545e20=a65_0x4238ab;return a65_0x2b42cd[_0x545e20(0x169)](getConfigDir(),_0x545e20(0x168));}function validateProfileName(_0x683c3f){const _0x47dd9e=a65_0x4238ab;if(/^@?[a-zA-Z0-9_-]+$/[_0x47dd9e(0x138)](_0x683c3f))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x47dd9e(0x138)](_0x683c3f))return;throw new Error(_0x47dd9e(0x133)+_0x683c3f+_0x47dd9e(0x14b));}function validateProfileConfig(_0x37094c,_0x4f7523){const _0x11fb03=a65_0x4238ab;if(typeof _0x37094c!==_0x11fb03(0x128)||_0x37094c===null)throw new SDKError(ErrorCode[_0x11fb03(0x135)],'Profile\x20\x27'+_0x4f7523+_0x11fb03(0x12f));const _0x5b6d21=['description',_0x11fb03(0x11b),_0x11fb03(0x142),_0x11fb03(0x11c),'llm_project',_0x11fb03(0x145),'user_info'],_0x263a7e=_0x37094c;for(const _0x1060d2 of Object[_0x11fb03(0x15a)](_0x263a7e)){!_0x5b6d21[_0x11fb03(0x13d)](_0x1060d2)&&console[_0x11fb03(0x15e)](_0x11fb03(0x15f)+_0x4f7523+_0x11fb03(0x123)+_0x1060d2+_0x11fb03(0x122));}if(_0x263a7e[_0x11fb03(0x14f)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x14f)]!=='string')throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x263a7e[_0x11fb03(0x11b)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x11b)]!=='string')throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+_0x11fb03(0x157));if(_0x263a7e[_0x11fb03(0x142)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x142)]!==_0x11fb03(0x127))throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+_0x11fb03(0x13b));if(_0x263a7e[_0x11fb03(0x11c)]!==undefined&&typeof _0x263a7e['parent_segment']!==_0x11fb03(0x127))throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+_0x11fb03(0x15b));if(_0x263a7e[_0x11fb03(0x15d)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x15d)]!==_0x11fb03(0x127))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x4f7523+_0x11fb03(0x14e));if(_0x263a7e[_0x11fb03(0x145)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x145)]!==_0x11fb03(0x127))throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+_0x11fb03(0x158));return!![];}function loadProfilesFromTdxJson(_0x3a9d4d,_0x420c42){const _0x4e56d0=a65_0x4238ab;if(!a65_0x20a008[_0x4e56d0(0x165)](_0x3a9d4d))return[];try{const _0x3cd29c=a65_0x20a008['readFileSync'](_0x3a9d4d,_0x4e56d0(0x14c)),_0x1668ab=JSON[_0x4e56d0(0x143)](_0x3cd29c);if(!_0x1668ab[_0x4e56d0(0x130)]||typeof _0x1668ab[_0x4e56d0(0x130)]!=='object')return[];const _0x203359=[];for(const [_0x1f6659,_0x1791b0]of Object[_0x4e56d0(0x153)](_0x1668ab[_0x4e56d0(0x130)])){try{validateProfileConfig(_0x1791b0,_0x1f6659);const _0x550ab3=getNewCredentialPath(_0x1f6659),_0xb42b43=getOldCredentialPath(_0x1f6659),_0xda7ddd=a65_0x20a008['existsSync'](_0x550ab3)||a65_0x20a008[_0x4e56d0(0x165)](_0xb42b43);_0x203359[_0x4e56d0(0x11a)]({'name':_0x1f6659,'config':_0x1791b0,'metadata':{'name':_0x1f6659,'createdAt':new Date()[_0x4e56d0(0x120)]()},'hasCredentials':_0xda7ddd,'scope':_0x420c42});}catch(_0x1bb151){_0x1bb151 instanceof Error&&(console[_0x4e56d0(0x15e)](_0x4e56d0(0x12e)+_0x3a9d4d+':'),console['warn']('\x20\x20'+_0x1bb151[_0x4e56d0(0x124)]+'\x0a'));}}return _0x203359;}catch(_0x504bd2){return _0x504bd2 instanceof SyntaxError?(console[_0x4e56d0(0x15e)](_0x4e56d0(0x13e)+_0x3a9d4d+_0x4e56d0(0x13f)),console[_0x4e56d0(0x15e)](_0x4e56d0(0x125)+_0x504bd2[_0x4e56d0(0x124)]+'\x0a')):console['warn'](_0x4e56d0(0x132)+_0x3a9d4d+':\x20'+_0x504bd2+'\x0a'),[];}}export function getNewCredentialPath(_0x4933e7){const _0x1ff48a=a65_0x4238ab;return a65_0x2b42cd[_0x1ff48a(0x169)](getConfigDir(),_0x1ff48a(0x131)+_0x4933e7);}function getOldCredentialPath(_0x5f5395){const _0x1d26e7=a65_0x4238ab;return a65_0x2b42cd[_0x1d26e7(0x169)](getProfilesDir(),_0x5f5395,_0x1d26e7(0x148));}function loadProfilesFromTdxJsonFiles(){const _0x16397e=a65_0x4238ab,_0x165fa2=[],_0xe2100a=findProjectConfigPath();_0xe2100a&&_0x165fa2[_0x16397e(0x11a)](...loadProfilesFromTdxJson(_0xe2100a,_0x16397e(0x121)));const _0x510284=a65_0x2b42cd[_0x16397e(0x169)](getConfigDir(),_0x16397e(0x168));return _0x165fa2[_0x16397e(0x11a)](...loadProfilesFromTdxJson(_0x510284,_0x16397e(0x16b))),_0x165fa2;}function loadProfilesFromDirectories(){const _0x592799=a65_0x4238ab,_0x1e02f5=getProfilesDir();if(!a65_0x20a008[_0x592799(0x165)](_0x1e02f5))return[];try{return a65_0x20a008[_0x592799(0x14a)](_0x1e02f5,{'withFileTypes':!![]})[_0x592799(0x147)](_0x4b2c00=>_0x4b2c00[_0x592799(0x163)]())[_0x592799(0x12d)](_0x509501=>_0x509501[_0x592799(0x13c)])['filter'](_0x1971f9=>{const _0x5a2798=_0x592799,_0x257a60=getProfileConfigPath(_0x1971f9),_0x46e3f8=getProfileEnvPath(_0x1971f9);return a65_0x20a008[_0x5a2798(0x165)](_0x257a60)||a65_0x20a008[_0x5a2798(0x165)](_0x46e3f8);})[_0x592799(0x12d)](_0x41da97=>{const _0x920451=_0x592799,_0x4a8dfc=loadProfileFromDirectory(_0x41da97);if(_0x4a8dfc)return{..._0x4a8dfc,'scope':_0x920451(0x15c)};return null;})[_0x592799(0x147)](_0x2255e8=>_0x2255e8!==null);}catch{return[];}}function loadProfileFromDirectory(_0x1b9f3b){const _0x98f56c=a65_0x4238ab,_0x264d12=getProfileConfigPath(_0x1b9f3b),_0x390ba4=getOldCredentialPath(_0x1b9f3b);if(!a65_0x20a008[_0x98f56c(0x165)](_0x264d12)&&!a65_0x20a008[_0x98f56c(0x165)](_0x390ba4))return null;let _0x1fd625={},_0x41f3c7={'name':_0x1b9f3b,'createdAt':new Date()[_0x98f56c(0x120)]()};if(a65_0x20a008['existsSync'](_0x264d12))try{const _0x266c67=a65_0x20a008[_0x98f56c(0x129)](_0x264d12,'utf-8'),_0x3dc2df=JSON['parse'](_0x266c67),{metadata:_0x4c65ae,..._0x26aa7a}=_0x3dc2df;_0x1fd625=_0x26aa7a,_0x4c65ae&&(_0x41f3c7=_0x4c65ae);}catch{}return{'name':_0x1b9f3b,'config':_0x1fd625,'metadata':_0x41f3c7,'hasCredentials':a65_0x20a008['existsSync'](_0x390ba4),'scope':_0x98f56c(0x15c)};}export function listProfiles(){const _0x48697c=a65_0x4238ab,_0x1296df=loadProfilesFromTdxJsonFiles(),_0xfacc30=loadProfilesFromDirectories();if(_0xfacc30[_0x48697c(0x11e)]>0x0){const _0x2534f4=_0xfacc30['map'](_0x39de56=>_0x39de56[_0x48697c(0x13c)])[_0x48697c(0x169)](',\x20'),_0x18b0f5=getConfigDir();console[_0x48697c(0x15e)](_0x48697c(0x164)+_0x2534f4),console[_0x48697c(0x15e)](_0x48697c(0x146)),console['warn'](_0x48697c(0x137)+a65_0x2b42cd[_0x48697c(0x169)](_0x18b0f5,_0x48697c(0x168))),console['warn'](_0x48697c(0x141)),console[_0x48697c(0x15e)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x5debac=[..._0x1296df,..._0xfacc30],_0x5bd5a6=new Map();for(const _0x39b793 of _0x5debac){!_0x5bd5a6['has'](_0x39b793[_0x48697c(0x13c)])&&_0x5bd5a6['set'](_0x39b793[_0x48697c(0x13c)],_0x39b793);}return Array[_0x48697c(0x134)](_0x5bd5a6[_0x48697c(0x151)]())[_0x48697c(0x12c)]((_0x443c03,_0x3c8206)=>_0x443c03['name'][_0x48697c(0x16a)](_0x3c8206[_0x48697c(0x13c)]));}export function profileExists(_0x4db75e){const _0x545f2d=a65_0x4238ab,_0x11de26=listProfiles();return _0x11de26[_0x545f2d(0x152)](_0x5d2f4e=>_0x5d2f4e['name']===_0x4db75e);}export function loadProfile(_0x2d5cfa){const _0x38e4a3=a65_0x4238ab;validateProfileName(_0x2d5cfa);const _0x4a1cd1=listProfiles(),_0x26f250=_0x4a1cd1[_0x38e4a3(0x14d)](_0x58bae8=>_0x58bae8[_0x38e4a3(0x13c)]===_0x2d5cfa);return _0x26f250||null;}export function saveProfile(_0x5251f6,_0x1eb1c3,_0x4371b2=![]){saveProfileToUserConfig(_0x5251f6,_0x1eb1c3);}export function deleteProfile(_0x41bd7f){const _0x40f14c=a65_0x4238ab;validateProfileName(_0x41bd7f);const _0x363d0b=getProfileDir(_0x41bd7f);if(!a65_0x20a008['existsSync'](_0x363d0b))throw new Error(_0x40f14c(0x140)+_0x41bd7f+'\x20does\x20not\x20exist');a65_0x20a008[_0x40f14c(0x159)](_0x363d0b,{'recursive':!![],'force':!![]});}function a65_0x4ef5(){const _0x35a111=['\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','directory','llm_project','warn','Warning:\x20Profile\x20\x27','7924482rgNvMZ','664272BjgNie','To\x20migrate:','isDirectory','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','existsSync','1376848VNtwfS','150461ycuXpy','tdx.json','join','localeCompare','user','@tdx-studio','4LdBpAD','push','site','parent_segment','671520pVUzhO','length','458584rUzfqm','toISOString','local','\x27\x20will\x20be\x20ignored','\x27:\x20unknown\x20config\x20key\x20\x27','message','Error:\x20','Failed\x20to\x20parse\x20','string','object','readFileSync','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27',',\x20creating\x20new\x20file','sort','map','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x27:\x20config\x20must\x20be\x20an\x20object','profiles','.env.','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','Invalid\x20profile\x20name:\x20','from','INVALID_PROFILE_CONFIG','Profile\x20\x27','\x20\x201.\x20Edit:\x20','test','stringify','profile','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','name','includes','\x0aWarning:\x20Failed\x20to\x20parse\x20',':\x20Invalid\x20JSON\x20syntax','Profile\x20','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','database','parse','30138BgjCQw','llm_agent','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','filter','.env','\x20already\x20exists','readdirSync','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','utf-8','find','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','description','220kxhcrI','values','some','entries','\x20does\x20not\x20exist','\x20\x20mv\x20\x22','Warning:\x20Failed\x20to\x20parse\x20','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','rmSync','keys'];a65_0x4ef5=function(){return _0x35a111;};return a65_0x4ef5();}export function saveProfileToUserConfig(_0x5503e6,_0x5afb8a){const _0x272649=a65_0x4238ab;validateProfileName(_0x5503e6);const _0x287a0a=getGlobalConfigPath(),_0x5ea2f2=getConfigDir();!a65_0x20a008[_0x272649(0x165)](_0x5ea2f2)&&createSecureDirectory(_0x5ea2f2);let _0x4a5b89={};if(a65_0x20a008[_0x272649(0x165)](_0x287a0a))try{const _0x1cdc59=a65_0x20a008[_0x272649(0x129)](_0x287a0a,'utf-8');_0x4a5b89=JSON['parse'](_0x1cdc59);}catch{console[_0x272649(0x15e)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x287a0a+_0x272649(0x12b));}!_0x4a5b89[_0x272649(0x130)]&&(_0x4a5b89[_0x272649(0x130)]={}),_0x4a5b89[_0x272649(0x130)][_0x5503e6]=_0x5afb8a,writeSecureFile(_0x287a0a,JSON[_0x272649(0x139)](_0x4a5b89,null,0x2));}export function removeProfileFromUserConfig(_0x15aa89){const _0x5eea6a=a65_0x4238ab;validateProfileName(_0x15aa89);const _0x2867b0=getGlobalConfigPath();if(!a65_0x20a008[_0x5eea6a(0x165)](_0x2867b0))throw new Error(_0x5eea6a(0x136)+_0x15aa89+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x1fa083={};try{const _0x41e1bc=a65_0x20a008[_0x5eea6a(0x129)](_0x2867b0,_0x5eea6a(0x14c));_0x1fa083=JSON[_0x5eea6a(0x143)](_0x41e1bc);}catch{throw new Error(_0x5eea6a(0x126)+_0x2867b0);}if(!_0x1fa083[_0x5eea6a(0x130)]||!_0x1fa083[_0x5eea6a(0x130)][_0x15aa89])throw new Error(_0x5eea6a(0x136)+_0x15aa89+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x1fa083[_0x5eea6a(0x130)][_0x15aa89],_0x1fa083[_0x5eea6a(0x13a)]===_0x15aa89&&delete _0x1fa083[_0x5eea6a(0x13a)],writeSecureFile(_0x2867b0,JSON['stringify'](_0x1fa083,null,0x2));}export function getActiveProfile(){const _0x548a99=a65_0x4238ab,_0x1cf25d=loadSessionContext();if(_0x1cf25d?.[_0x548a99(0x13a)])return _0x1cf25d[_0x548a99(0x13a)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xdac08=getGlobalConfigPath();if(!a65_0x20a008['existsSync'](_0xdac08))return null;try{const _0xeae082=a65_0x20a008[_0x548a99(0x129)](_0xdac08,_0x548a99(0x14c)),_0x30cdd5=JSON[_0x548a99(0x143)](_0xeae082);return _0x30cdd5[_0x548a99(0x13a)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x5228b5){const _0x5669aa=a65_0x4238ab,_0x2b98a8=getGlobalConfigPath(),_0x22bd2f=getConfigDir();!a65_0x20a008[_0x5669aa(0x165)](_0x22bd2f)&&createSecureDirectory(_0x22bd2f);let _0xfac728={};if(a65_0x20a008['existsSync'](_0x2b98a8))try{const _0x4147e4=a65_0x20a008['readFileSync'](_0x2b98a8,_0x5669aa(0x14c));_0xfac728=JSON[_0x5669aa(0x143)](_0x4147e4);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x2b98a8+_0x5669aa(0x12b));}_0xfac728['site']=_0x5228b5,writeSecureFile(_0x2b98a8,JSON[_0x5669aa(0x139)](_0xfac728,null,0x2));}export function saveActiveProfileToUserConfig(_0x1a3d23){const _0x434ca2=a65_0x4238ab;validateProfileName(_0x1a3d23);const _0x562ec8=getGlobalConfigPath(),_0x51fd6b=getConfigDir();!a65_0x20a008[_0x434ca2(0x165)](_0x51fd6b)&&createSecureDirectory(_0x51fd6b);let _0x1faa9a={};if(a65_0x20a008[_0x434ca2(0x165)](_0x562ec8))try{const _0x7065c2=a65_0x20a008['readFileSync'](_0x562ec8,'utf-8');_0x1faa9a=JSON['parse'](_0x7065c2);}catch{console['warn'](_0x434ca2(0x156)+_0x562ec8+_0x434ca2(0x12b));}_0x1faa9a['profile']=_0x1a3d23,writeSecureFile(_0x562ec8,JSON['stringify'](_0x1faa9a,null,0x2));}function clearFieldFromUserConfig(_0x2e20c4){const _0x4e36f8=a65_0x4238ab,_0x401545=getGlobalConfigPath();if(!a65_0x20a008[_0x4e36f8(0x165)](_0x401545))return;let _0x157e9c={};try{const _0x191496=a65_0x20a008[_0x4e36f8(0x129)](_0x401545,_0x4e36f8(0x14c));_0x157e9c=JSON[_0x4e36f8(0x143)](_0x191496);}catch{return;}delete _0x157e9c[_0x2e20c4],writeSecureFile(_0x401545,JSON[_0x4e36f8(0x139)](_0x157e9c,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x193feb=a65_0x4238ab;clearFieldFromUserConfig(_0x193feb(0x11b));}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x14c3f9,_0x25e3f8){const _0x1fa7c5=a65_0x4238ab;validateProfileName(_0x14c3f9);if(profileExists(_0x14c3f9))throw new Error(_0x1fa7c5(0x140)+_0x14c3f9+_0x1fa7c5(0x149));saveProfile(_0x14c3f9,_0x25e3f8);}export function saveProfileCredentials(_0x5ea30d,_0xfe7e5c){const _0x4dd057=a65_0x4238ab;validateProfileName(_0x5ea30d);if(!profileExists(_0x5ea30d))throw new Error(_0x4dd057(0x140)+_0x5ea30d+_0x4dd057(0x154));const _0x5baf72=getNewCredentialPath(_0x5ea30d);writeSecureFile(_0x5baf72,_0xfe7e5c);}export function loadProfileCredentials(_0x1bf9f6){const _0x45eb7e=a65_0x4238ab;validateProfileName(_0x1bf9f6);const _0x38fbd5=getNewCredentialPath(_0x1bf9f6);if(a65_0x20a008[_0x45eb7e(0x165)](_0x38fbd5))try{return a65_0x20a008[_0x45eb7e(0x129)](_0x38fbd5,_0x45eb7e(0x14c));}catch{}const _0x5a9064=getOldCredentialPath(_0x1bf9f6);if(a65_0x20a008['existsSync'](_0x5a9064)){console[_0x45eb7e(0x15e)](_0x45eb7e(0x12a)+_0x1bf9f6+'\x27'),console[_0x45eb7e(0x15e)](_0x45eb7e(0x162)),console[_0x45eb7e(0x15e)](_0x45eb7e(0x155)+_0x5a9064+'\x22\x20\x22'+_0x38fbd5+'\x22'),console[_0x45eb7e(0x15e)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a65_0x20a008[_0x45eb7e(0x129)](_0x5a9064,_0x45eb7e(0x14c));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- (function(_0x420473,_0x5ba390){const _0x39a675=a66_0x2a12,_0x968244=_0x420473();while(!![]){try{const _0x5a654a=-parseInt(_0x39a675(0x76))/0x1*(-parseInt(_0x39a675(0x83))/0x2)+-parseInt(_0x39a675(0x77))/0x3*(parseInt(_0x39a675(0x68))/0x4)+-parseInt(_0x39a675(0x89))/0x5+-parseInt(_0x39a675(0x82))/0x6+parseInt(_0x39a675(0x70))/0x7*(parseInt(_0x39a675(0x6a))/0x8)+parseInt(_0x39a675(0x6d))/0x9+parseInt(_0x39a675(0x75))/0xa*(parseInt(_0x39a675(0x88))/0xb);if(_0x5a654a===_0x5ba390)break;else _0x968244['push'](_0x968244['shift']());}catch(_0x2ca820){_0x968244['push'](_0x968244['shift']());}}}(a66_0x4947,0x39ec5));import*as a66_0x2395ac from'node:fs';import*as a66_0x1b80ed from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x5fdfc9){const _0xbabdae=a66_0x2a12;let _0x22406d=_0x5fdfc9||process[_0xbabdae(0x6f)]();while(!![]){const _0x528eee=a66_0x1b80ed[_0xbabdae(0x81)](_0x22406d,PROJECT_CONFIG_FILENAME);if(a66_0x2395ac['existsSync'](_0x528eee))return _0x528eee;const _0xa071d0=a66_0x1b80ed[_0xbabdae(0x87)](_0x22406d);if(_0xa071d0===_0x22406d)return null;_0x22406d=_0xa071d0;}}function a66_0x2a12(_0x2e7e57,_0xa0a9cd){_0x2e7e57=_0x2e7e57-0x68;const _0x494783=a66_0x4947();let _0x2a1212=_0x494783[_0x2e7e57];return _0x2a1212;}export function loadProjectConfig(_0x5c0492){const _0x2165f7=a66_0x2a12,_0x29a4a9=findProjectConfigPath(_0x5c0492);if(!_0x29a4a9)return null;try{const _0x47ec3c=a66_0x2395ac[_0x2165f7(0x6b)](_0x29a4a9,_0x2165f7(0x86)),_0xe144d7=JSON[_0x2165f7(0x7e)](_0x47ec3c),_0x2ea1f6=JSON[_0x2165f7(0x69)](_0xe144d7);if(_0x2ea1f6['includes'](_0x2165f7(0x79))||_0x2ea1f6[_0x2165f7(0x80)](_0x2165f7(0x7c))||_0x2ea1f6[_0x2165f7(0x80)](_0x2165f7(0x85)))throw new Error(_0x2165f7(0x78)+_0x29a4a9+_0x2165f7(0x6c)+_0x2165f7(0x74));const {metadata:_0x24f089,profile:_0x93efc,..._0x74b1d0}=_0xe144d7;return _0x93efc&&console[_0x2165f7(0x73)](_0x2165f7(0x72)+_0x29a4a9+_0x2165f7(0x7d)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x74b1d0;}catch(_0xa7ba82){if(_0xa7ba82 instanceof Error&&_0x2165f7(0x84)in _0xa7ba82&&_0xa7ba82['code']===_0x2165f7(0x7f))return null;throw new Error(_0x2165f7(0x7a)+_0x29a4a9+':\x20'+_0xa7ba82);}}export function saveProjectConfig(_0x133c38,_0x22dbdd){const _0x56c572=a66_0x2a12,_0x5e7c98=_0x22dbdd||process['cwd'](),_0x1d2fe3=a66_0x1b80ed[_0x56c572(0x81)](_0x5e7c98,PROJECT_CONFIG_FILENAME),_0x19b87c=JSON[_0x56c572(0x69)](_0x133c38);if(_0x19b87c[_0x56c572(0x80)](_0x56c572(0x79))||_0x19b87c['includes'](_0x56c572(0x7c))||_0x19b87c[_0x56c572(0x80)](_0x56c572(0x85)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x56c572(0x71)in _0x133c38)throw new Error(_0x56c572(0x6e));a66_0x2395ac[_0x56c572(0x7b)](_0x1d2fe3,JSON['stringify'](_0x133c38,null,0x2));}export function hasProjectConfig(_0x2d38bd){return findProjectConfigPath(_0x2d38bd)!==null;}function a66_0x4947(){const _0x40eb5c=['writeFileSync','apiKey','\x20is\x20ignored.\x20','parse','ENOENT','includes','join','814608FywmFe','88692CpJewt','code','api_key','utf-8','dirname','11iaNnSV','2013265FRvNYw','832duVWAY','stringify','8zpLNmW','readFileSync',').\x20','3747744JRZGwQ','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','cwd','825538DXpECn','profile','Warning:\x20\x27profile\x27\x20field\x20in\x20','warn','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','3806420nHWlpM','1qvOtTh','2649cTaIKq','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','TD_API_KEY','Failed\x20to\x20load\x20project\x20config\x20from\x20'];a66_0x4947=function(){return _0x40eb5c;};return a66_0x4947();}export function getProjectRoot(_0x49a3ad){const _0x20905b=a66_0x2a12,_0x3d609f=findProjectConfigPath(_0x49a3ad);return _0x3d609f?a66_0x1b80ed[_0x20905b(0x87)](_0x3d609f):null;}
1
+ const a66_0x51d934=a66_0x338b;(function(_0x47910c,_0x4dddeb){const _0x439774=a66_0x338b,_0x4591c5=_0x47910c();while(!![]){try{const _0x17d801=parseInt(_0x439774(0x1b9))/0x1*(-parseInt(_0x439774(0x1aa))/0x2)+parseInt(_0x439774(0x1a8))/0x3+-parseInt(_0x439774(0x1a2))/0x4*(-parseInt(_0x439774(0x1b5))/0x5)+-parseInt(_0x439774(0x1ac))/0x6*(-parseInt(_0x439774(0x1b2))/0x7)+-parseInt(_0x439774(0x1b4))/0x8+-parseInt(_0x439774(0x19d))/0x9*(parseInt(_0x439774(0x1b6))/0xa)+parseInt(_0x439774(0x19b))/0xb;if(_0x17d801===_0x4dddeb)break;else _0x4591c5['push'](_0x4591c5['shift']());}catch(_0x4edbd6){_0x4591c5['push'](_0x4591c5['shift']());}}}(a66_0xc9a6,0xa0dc8));import*as a66_0x3b1cf0 from'node:fs';function a66_0xc9a6(){const _0x205cc8=['ENOENT','includes','16193OzwjcS','readFileSync','\x20is\x20ignored.\x20','existsSync','tdx.json','11393250ZuPBLE','warn','3555bvAiqc','cwd','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','code','Warning:\x20\x27profile\x27\x20field\x20in\x20','724oPYUiZ',').\x20','TD_API_KEY','dirname','stringify','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','2571372QEBLOc','apiKey','118CMPrTQ','api_key','3047742rGtotG','profile','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','join','Failed\x20to\x20load\x20project\x20config\x20from\x20','14kLbAYf','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','10188352yrDqwh','11980vdbQCV','11510bURoHA'];a66_0xc9a6=function(){return _0x205cc8;};return a66_0xc9a6();}import*as a66_0x3a3c97 from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x51d934(0x19a);export function findProjectConfigPath(_0x43cdd7){const _0x551fb2=a66_0x51d934;let _0x5c7506=_0x43cdd7||process[_0x551fb2(0x19e)]();while(!![]){const _0x4ff686=a66_0x3a3c97[_0x551fb2(0x1b0)](_0x5c7506,PROJECT_CONFIG_FILENAME);if(a66_0x3b1cf0[_0x551fb2(0x1bc)](_0x4ff686))return _0x4ff686;const _0x1a3258=a66_0x3a3c97[_0x551fb2(0x1a5)](_0x5c7506);if(_0x1a3258===_0x5c7506)return null;_0x5c7506=_0x1a3258;}}export function loadProjectConfig(_0x5aa9cd){const _0x2d2716=a66_0x51d934,_0x138f25=findProjectConfigPath(_0x5aa9cd);if(!_0x138f25)return null;try{const _0x3189cf=a66_0x3b1cf0[_0x2d2716(0x1ba)](_0x138f25,'utf-8'),_0x405a48=JSON['parse'](_0x3189cf),_0x5e1005=JSON['stringify'](_0x405a48);if(_0x5e1005[_0x2d2716(0x1b8)](_0x2d2716(0x1a4))||_0x5e1005[_0x2d2716(0x1b8)](_0x2d2716(0x1a9))||_0x5e1005[_0x2d2716(0x1b8)]('api_key'))throw new Error(_0x2d2716(0x1a7)+_0x138f25+_0x2d2716(0x1a3)+_0x2d2716(0x1b3));const {metadata:_0x4a798d,profile:_0x5dbbdd,..._0x228309}=_0x405a48;return _0x5dbbdd&&console[_0x2d2716(0x19c)](_0x2d2716(0x1a1)+_0x138f25+_0x2d2716(0x1bb)+_0x2d2716(0x1ae)),_0x228309;}catch(_0x4247c4){if(_0x4247c4 instanceof Error&&_0x2d2716(0x1a0)in _0x4247c4&&_0x4247c4[_0x2d2716(0x1a0)]===_0x2d2716(0x1b7))return null;throw new Error(_0x2d2716(0x1b1)+_0x138f25+':\x20'+_0x4247c4);}}function a66_0x338b(_0x1d0c49,_0x8c82bd){_0x1d0c49=_0x1d0c49-0x19a;const _0xc9a683=a66_0xc9a6();let _0x338b52=_0xc9a683[_0x1d0c49];return _0x338b52;}export function saveProjectConfig(_0x3a8cba,_0x3e46f1){const _0x33e8ce=a66_0x51d934,_0x1c1ba0=_0x3e46f1||process[_0x33e8ce(0x19e)](),_0x2df769=a66_0x3a3c97['join'](_0x1c1ba0,PROJECT_CONFIG_FILENAME),_0x90dd0a=JSON[_0x33e8ce(0x1a6)](_0x3a8cba);if(_0x90dd0a['includes'](_0x33e8ce(0x1a4))||_0x90dd0a['includes'](_0x33e8ce(0x1a9))||_0x90dd0a[_0x33e8ce(0x1b8)](_0x33e8ce(0x1ab)))throw new Error(_0x33e8ce(0x19f));if(_0x33e8ce(0x1ad)in _0x3a8cba)throw new Error(_0x33e8ce(0x1af));a66_0x3b1cf0['writeFileSync'](_0x2df769,JSON[_0x33e8ce(0x1a6)](_0x3a8cba,null,0x2));}export function hasProjectConfig(_0x524789){return findProjectConfigPath(_0x524789)!==null;}export function getProjectRoot(_0x5d5e5d){const _0x423038=a66_0x51d934,_0x1f5d27=findProjectConfigPath(_0x5d5e5d);return _0x1f5d27?a66_0x3a3c97[_0x423038(0x1a5)](_0x1f5d27):null;}
@@ -1 +1 @@
1
- (function(_0x32dde4,_0x22a315){const _0x2495cc=a67_0x430d,_0x1b221d=_0x32dde4();while(!![]){try{const _0x4e7d19=parseInt(_0x2495cc(0xd2))/0x1*(parseInt(_0x2495cc(0xdc))/0x2)+-parseInt(_0x2495cc(0xc2))/0x3+-parseInt(_0x2495cc(0xd5))/0x4*(-parseInt(_0x2495cc(0xdd))/0x5)+parseInt(_0x2495cc(0xde))/0x6*(-parseInt(_0x2495cc(0xe9))/0x7)+parseInt(_0x2495cc(0xc5))/0x8*(parseInt(_0x2495cc(0xc4))/0x9)+-parseInt(_0x2495cc(0xcb))/0xa*(parseInt(_0x2495cc(0xcc))/0xb)+-parseInt(_0x2495cc(0xc9))/0xc;if(_0x4e7d19===_0x22a315)break;else _0x1b221d['push'](_0x1b221d['shift']());}catch(_0x36dc76){_0x1b221d['push'](_0x1b221d['shift']());}}}(a67_0x55e7,0x78f35));import*as a67_0x57a34f from'node:fs';import*as a67_0x40bb67 from'node:path';import*as a67_0x2429a6 from'node:os';function a67_0x55e7(){const _0x3c56a8=['stringify','readdirSync','join','now','getTime','1501717tEHSTI','replace','endsWith','writeFileSync','791037EmGkwQ','createdAt','2853AbfzGS','9344sGuJiM','unlinkSync','.json','sessions','5356824eWKBlA','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','10ucItTv','4158979QeGNAu','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','homedir','parse','toString','warn','139arcQgF','apiKey','test','1428NyiysJ','api_key','toISOString','TD_API_KEY','.config','tdx','includes','7102jhXros','13085LNKaGU','6JQLioE','existsSync','readFileSync','sort','utf-8','.\x20This\x20is\x20insecure.\x20Removing\x20session.'];a67_0x55e7=function(){return _0x3c56a8;};return a67_0x55e7();}import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';function a67_0x430d(_0xa67948,_0x11dda4){_0xa67948=_0xa67948-0xbf;const _0x55e770=a67_0x55e7();let _0x430d70=_0x55e770[_0xa67948];return _0x430d70;}const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x94598=a67_0x430d,_0x281213=process.env.TDX_CONFIG_DIR||a67_0x40bb67[_0x94598(0xe6)](a67_0x2429a6[_0x94598(0xce)](),_0x94598(0xd9),_0x94598(0xda));return a67_0x40bb67[_0x94598(0xe6)](_0x281213,_0x94598(0xc8));}function getSessionPath(_0x975e25){const _0xacbbf8=a67_0x430d;return a67_0x40bb67[_0xacbbf8(0xe6)](getSessionsDir(),_0x975e25+_0xacbbf8(0xc7));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x36a4b4){const _0x1dd88b=a67_0x430d;if(_0x36a4b4)return _0x36a4b4;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x1dd88b(0xd0)]();}export function loadSessionContext(_0x25b14e){const _0x4b2e77=a67_0x430d,_0x43b356=getSessionID(_0x25b14e),_0x5b0881=/^\d+$/[_0x4b2e77(0xd4)](_0x43b356)?parseInt(_0x43b356,0xa):null;return _0x5b0881!==null?loadSessionContextByPID(_0x5b0881):loadSessionContextByString(_0x43b356);}export function loadSessionContextByPID(_0x316d2e){const _0x1c4376=a67_0x430d,_0x31466f=getSessionPath(_0x316d2e);if(!a67_0x57a34f[_0x1c4376(0xdf)](_0x31466f))return null;try{const _0x298805=a67_0x57a34f[_0x1c4376(0xe0)](_0x31466f,_0x1c4376(0xe2)),_0x1e77f7=JSON[_0x1c4376(0xcf)](_0x298805),_0x3c6e2b=new Date(_0x1e77f7[_0x1c4376(0xc3)])[_0x1c4376(0xe8)](),_0x212895=Date[_0x1c4376(0xe7)]();if(_0x212895-_0x3c6e2b>SESSION_EXPIRATION_MS)return a67_0x57a34f[_0x1c4376(0xc6)](_0x31466f),null;const _0x2f8d07=JSON[_0x1c4376(0xe4)](_0x1e77f7);if(_0x2f8d07[_0x1c4376(0xdb)]('TD_API_KEY')||_0x2f8d07[_0x1c4376(0xdb)]('apiKey')||_0x2f8d07[_0x1c4376(0xdb)](_0x1c4376(0xd6)))return console[_0x1c4376(0xd1)](_0x1c4376(0xca)+_0x31466f+_0x1c4376(0xe3)),a67_0x57a34f['unlinkSync'](_0x31466f),null;return _0x1e77f7;}catch{try{a67_0x57a34f['unlinkSync'](_0x31466f);}catch{}return null;}}function loadSessionContextByString(_0x1182cd){const _0x49febc=a67_0x430d,_0x524ad0=a67_0x40bb67['join'](getSessionsDir(),_0x1182cd+_0x49febc(0xc7));if(!a67_0x57a34f[_0x49febc(0xdf)](_0x524ad0))return null;try{const _0x1042ca=a67_0x57a34f[_0x49febc(0xe0)](_0x524ad0,_0x49febc(0xe2)),_0x3b142d=JSON[_0x49febc(0xcf)](_0x1042ca),_0xe08f5c=new Date(_0x3b142d[_0x49febc(0xc3)])[_0x49febc(0xe8)](),_0x54426f=Date[_0x49febc(0xe7)]();if(_0x54426f-_0xe08f5c>SESSION_EXPIRATION_MS)return a67_0x57a34f[_0x49febc(0xc6)](_0x524ad0),null;const _0x2c768f=JSON[_0x49febc(0xe4)](_0x3b142d);if(_0x2c768f[_0x49febc(0xdb)](_0x49febc(0xd8))||_0x2c768f[_0x49febc(0xdb)](_0x49febc(0xd3))||_0x2c768f[_0x49febc(0xdb)](_0x49febc(0xd6)))return console[_0x49febc(0xd1)](_0x49febc(0xca)+_0x524ad0+_0x49febc(0xe3)),a67_0x57a34f[_0x49febc(0xc6)](_0x524ad0),null;return _0x3b142d;}catch{try{a67_0x57a34f[_0x49febc(0xc6)](_0x524ad0);}catch{}return null;}}export function saveSessionContext(_0x320c06,_0x537910){const _0x49abbb=a67_0x430d,_0x595254=getSessionID(_0x537910),_0x651c71=/^\d+$/[_0x49abbb(0xd4)](_0x595254)?parseInt(_0x595254,0xa):getCurrentSessionPID(),_0x200063=a67_0x40bb67[_0x49abbb(0xe6)](getSessionsDir(),_0x595254+_0x49abbb(0xc7)),_0x560467=getSessionsDir();createSecureDirectory(_0x560467);const _0x9d2e01=JSON[_0x49abbb(0xe4)](_0x320c06);if(_0x9d2e01[_0x49abbb(0xdb)](_0x49abbb(0xd8))||_0x9d2e01['includes'](_0x49abbb(0xd3))||_0x9d2e01[_0x49abbb(0xdb)](_0x49abbb(0xd6)))throw new Error(_0x49abbb(0xcd));let _0x5cef8a;const _0x265a26=/^\d+$/[_0x49abbb(0xd4)](_0x595254)?loadSessionContextByPID(parseInt(_0x595254,0xa)):loadSessionContextByString(_0x595254);_0x265a26?_0x5cef8a={..._0x265a26,..._0x320c06,'pid':_0x651c71,'sessionId':_0x595254!==_0x651c71['toString']()?_0x595254:undefined,'updatedAt':new Date()[_0x49abbb(0xd7)]()}:_0x5cef8a={'pid':_0x651c71,'sessionId':_0x595254!==_0x651c71[_0x49abbb(0xd0)]()?_0x595254:undefined,..._0x320c06,'createdAt':new Date()[_0x49abbb(0xd7)](),'updatedAt':new Date()[_0x49abbb(0xd7)]()},a67_0x57a34f[_0x49abbb(0xc1)](_0x200063,JSON[_0x49abbb(0xe4)](_0x5cef8a,null,0x2));}export function clearSessionContext(_0x6ad519){const _0x149859=a67_0x430d,_0x2c7b1d=getSessionID(_0x6ad519),_0x47e8a7=a67_0x40bb67[_0x149859(0xe6)](getSessionsDir(),_0x2c7b1d+_0x149859(0xc7));a67_0x57a34f['existsSync'](_0x47e8a7)&&a67_0x57a34f['unlinkSync'](_0x47e8a7);}export function clearSessionContextField(_0x455a08,_0x1da6c4){const _0xc9f016=a67_0x430d,_0x4e3073=getSessionID(_0x1da6c4),_0x3304cf=a67_0x40bb67[_0xc9f016(0xe6)](getSessionsDir(),_0x4e3073+_0xc9f016(0xc7));if(!a67_0x57a34f[_0xc9f016(0xdf)](_0x3304cf))return;try{const _0x4cb96d=a67_0x57a34f[_0xc9f016(0xe0)](_0x3304cf,_0xc9f016(0xe2)),_0x5cb23e=JSON['parse'](_0x4cb96d);delete _0x5cb23e[_0x455a08],a67_0x57a34f['writeFileSync'](_0x3304cf,JSON[_0xc9f016(0xe4)](_0x5cb23e,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x2dc980=a67_0x430d,_0x3f4c66=getSessionsDir();if(!a67_0x57a34f[_0x2dc980(0xdf)](_0x3f4c66))return 0x0;let _0x16e3b3=0x0;const _0x376e46=Date[_0x2dc980(0xe7)]();try{const _0xf82cf9=a67_0x57a34f['readdirSync'](_0x3f4c66);for(const _0x44cb09 of _0xf82cf9){if(!_0x44cb09[_0x2dc980(0xc0)](_0x2dc980(0xc7)))continue;const _0x14278f=a67_0x40bb67[_0x2dc980(0xe6)](_0x3f4c66,_0x44cb09),_0x38a0ad=_0x44cb09[_0x2dc980(0xbf)](_0x2dc980(0xc7),''),_0x4d2490=parseInt(_0x38a0ad,0xa),_0x247347=!isNaN(_0x4d2490);if(_0x247347){if(!isProcessRunning(_0x4d2490)){a67_0x57a34f[_0x2dc980(0xc6)](_0x14278f),_0x16e3b3++;continue;}}try{const _0x447c96=a67_0x57a34f[_0x2dc980(0xe0)](_0x14278f,_0x2dc980(0xe2)),_0x150ea1=JSON['parse'](_0x447c96),_0x532e18=new Date(_0x150ea1[_0x2dc980(0xc3)])[_0x2dc980(0xe8)]();_0x376e46-_0x532e18>SESSION_EXPIRATION_MS&&(a67_0x57a34f[_0x2dc980(0xc6)](_0x14278f),_0x16e3b3++);}catch{a67_0x57a34f[_0x2dc980(0xc6)](_0x14278f),_0x16e3b3++;}}}catch{}return _0x16e3b3;}export function listActiveSessions(){const _0x44dd80=a67_0x430d,_0x4543f5=getSessionsDir();if(!a67_0x57a34f[_0x44dd80(0xdf)](_0x4543f5))return[];try{const _0x56d1cf=a67_0x57a34f[_0x44dd80(0xe5)](_0x4543f5),_0x467f03=[];for(const _0x4c85a0 of _0x56d1cf){if(!_0x4c85a0[_0x44dd80(0xc0)](_0x44dd80(0xc7)))continue;const _0x372ab5=_0x4c85a0[_0x44dd80(0xbf)](_0x44dd80(0xc7),''),_0x14aae3=parseInt(_0x372ab5,0xa);!isNaN(_0x14aae3)&&isProcessRunning(_0x14aae3)&&_0x467f03['push'](_0x14aae3);}return _0x467f03[_0x44dd80(0xe1)]((_0x5684ca,_0x23fa7f)=>_0x5684ca-_0x23fa7f);}catch{return[];}}
1
+ function a67_0x2de7(){const _0x2fec21=['11999808flRIHA','unlinkSync','toString','36fjUrwE','utf-8','5901973NrAkKf','toISOString','includes','writeFileSync','tdx','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','.\x20This\x20is\x20insecure.\x20Removing\x20session.','test','push','stringify','apiKey','api_key','warn','now','3853725KKwVAr','join','2531200SeiKop','homedir','.json','readdirSync','1558332pPITip','existsSync','TD_API_KEY','3140PFKrPz','replace','getTime','createdAt','parse','240aAMFSz','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','readFileSync','306093QQtQtg'];a67_0x2de7=function(){return _0x2fec21;};return a67_0x2de7();}(function(_0x3b2e41,_0x1ec245){const _0x4c4d96=a67_0x35b6,_0x26aade=_0x3b2e41();while(!![]){try{const _0x36d36f=parseInt(_0x4c4d96(0x1d2))/0x1*(parseInt(_0x4c4d96(0x1cd))/0x2)+parseInt(_0x4c4d96(0x1d5))/0x3*(parseInt(_0x4c4d96(0x1d9))/0x4)+parseInt(_0x4c4d96(0x1c4))/0x5+parseInt(_0x4c4d96(0x1ca))/0x6+-parseInt(_0x4c4d96(0x1db))/0x7+parseInt(_0x4c4d96(0x1c6))/0x8+-parseInt(_0x4c4d96(0x1d6))/0x9;if(_0x36d36f===_0x1ec245)break;else _0x26aade['push'](_0x26aade['shift']());}catch(_0x198561){_0x26aade['push'](_0x26aade['shift']());}}}(a67_0x2de7,0x71a57));import*as a67_0x1afcee from'node:fs';import*as a67_0x49cdc8 from'node:path';import*as a67_0x4d6681 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 _0x23d528=a67_0x35b6,_0x16bc1b=process.env.TDX_CONFIG_DIR||a67_0x49cdc8['join'](a67_0x4d6681[_0x23d528(0x1c7)](),'.config',_0x23d528(0x1df));return a67_0x49cdc8[_0x23d528(0x1c5)](_0x16bc1b,'sessions');}function getSessionPath(_0x1e169b){const _0x1c1e15=a67_0x35b6;return a67_0x49cdc8[_0x1c1e15(0x1c5)](getSessionsDir(),_0x1e169b+_0x1c1e15(0x1c8));}export function getCurrentSessionPID(){return getPPID();}function a67_0x35b6(_0x4e0b9b,_0x4748b7){_0x4e0b9b=_0x4e0b9b-0x1c2;const _0x2de700=a67_0x2de7();let _0x35b60d=_0x2de700[_0x4e0b9b];return _0x35b60d;}export function getSessionID(_0x5a78a4){const _0x335874=a67_0x35b6;if(_0x5a78a4)return _0x5a78a4;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x335874(0x1d8)]();}export function loadSessionContext(_0x2b460a){const _0x1d455f=getSessionID(_0x2b460a),_0xf37cad=/^\d+$/['test'](_0x1d455f)?parseInt(_0x1d455f,0xa):null;return _0xf37cad!==null?loadSessionContextByPID(_0xf37cad):loadSessionContextByString(_0x1d455f);}export function loadSessionContextByPID(_0x30c5e0){const _0x49ee84=a67_0x35b6,_0x5407da=getSessionPath(_0x30c5e0);if(!a67_0x1afcee[_0x49ee84(0x1cb)](_0x5407da))return null;try{const _0x249388=a67_0x1afcee[_0x49ee84(0x1d4)](_0x5407da,_0x49ee84(0x1da)),_0x2b7d0b=JSON[_0x49ee84(0x1d1)](_0x249388),_0x5c7f13=new Date(_0x2b7d0b['createdAt'])[_0x49ee84(0x1cf)](),_0x4acc40=Date[_0x49ee84(0x1c3)]();if(_0x4acc40-_0x5c7f13>SESSION_EXPIRATION_MS)return a67_0x1afcee['unlinkSync'](_0x5407da),null;const _0x159aea=JSON[_0x49ee84(0x1e4)](_0x2b7d0b);if(_0x159aea[_0x49ee84(0x1dd)](_0x49ee84(0x1cc))||_0x159aea['includes'](_0x49ee84(0x1e5))||_0x159aea[_0x49ee84(0x1dd)](_0x49ee84(0x1e6)))return console[_0x49ee84(0x1c2)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x5407da+_0x49ee84(0x1e1)),a67_0x1afcee[_0x49ee84(0x1d7)](_0x5407da),null;return _0x2b7d0b;}catch{try{a67_0x1afcee[_0x49ee84(0x1d7)](_0x5407da);}catch{}return null;}}function loadSessionContextByString(_0x31a18c){const _0x4c3423=a67_0x35b6,_0x1fe7e7=a67_0x49cdc8[_0x4c3423(0x1c5)](getSessionsDir(),_0x31a18c+'.json');if(!a67_0x1afcee['existsSync'](_0x1fe7e7))return null;try{const _0x158a07=a67_0x1afcee['readFileSync'](_0x1fe7e7,_0x4c3423(0x1da)),_0x377aa8=JSON[_0x4c3423(0x1d1)](_0x158a07),_0x5e7e9b=new Date(_0x377aa8[_0x4c3423(0x1d0)])[_0x4c3423(0x1cf)](),_0x12ba4e=Date[_0x4c3423(0x1c3)]();if(_0x12ba4e-_0x5e7e9b>SESSION_EXPIRATION_MS)return a67_0x1afcee[_0x4c3423(0x1d7)](_0x1fe7e7),null;const _0x269f1c=JSON[_0x4c3423(0x1e4)](_0x377aa8);if(_0x269f1c[_0x4c3423(0x1dd)](_0x4c3423(0x1cc))||_0x269f1c[_0x4c3423(0x1dd)](_0x4c3423(0x1e5))||_0x269f1c[_0x4c3423(0x1dd)]('api_key'))return console[_0x4c3423(0x1c2)](_0x4c3423(0x1e0)+_0x1fe7e7+_0x4c3423(0x1e1)),a67_0x1afcee['unlinkSync'](_0x1fe7e7),null;return _0x377aa8;}catch{try{a67_0x1afcee[_0x4c3423(0x1d7)](_0x1fe7e7);}catch{}return null;}}export function saveSessionContext(_0x4a4be0,_0x26da54){const _0x3b408a=a67_0x35b6,_0x592d70=getSessionID(_0x26da54),_0x24fe4f=/^\d+$/[_0x3b408a(0x1e2)](_0x592d70)?parseInt(_0x592d70,0xa):getCurrentSessionPID(),_0xec5ff5=a67_0x49cdc8[_0x3b408a(0x1c5)](getSessionsDir(),_0x592d70+'.json'),_0x4a2670=getSessionsDir();createSecureDirectory(_0x4a2670);const _0x282f5d=JSON[_0x3b408a(0x1e4)](_0x4a4be0);if(_0x282f5d['includes'](_0x3b408a(0x1cc))||_0x282f5d[_0x3b408a(0x1dd)](_0x3b408a(0x1e5))||_0x282f5d['includes'](_0x3b408a(0x1e6)))throw new Error(_0x3b408a(0x1d3));let _0x2d8968;const _0x81b0f3=/^\d+$/['test'](_0x592d70)?loadSessionContextByPID(parseInt(_0x592d70,0xa)):loadSessionContextByString(_0x592d70);_0x81b0f3?_0x2d8968={..._0x81b0f3,..._0x4a4be0,'pid':_0x24fe4f,'sessionId':_0x592d70!==_0x24fe4f[_0x3b408a(0x1d8)]()?_0x592d70:undefined,'updatedAt':new Date()[_0x3b408a(0x1dc)]()}:_0x2d8968={'pid':_0x24fe4f,'sessionId':_0x592d70!==_0x24fe4f[_0x3b408a(0x1d8)]()?_0x592d70:undefined,..._0x4a4be0,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x3b408a(0x1dc)]()},a67_0x1afcee['writeFileSync'](_0xec5ff5,JSON[_0x3b408a(0x1e4)](_0x2d8968,null,0x2));}export function clearSessionContext(_0x4b8527){const _0x1721ab=a67_0x35b6,_0x59eae4=getSessionID(_0x4b8527),_0x33be38=a67_0x49cdc8[_0x1721ab(0x1c5)](getSessionsDir(),_0x59eae4+_0x1721ab(0x1c8));a67_0x1afcee[_0x1721ab(0x1cb)](_0x33be38)&&a67_0x1afcee[_0x1721ab(0x1d7)](_0x33be38);}export function clearSessionContextField(_0x3f9d8a,_0x2f2926){const _0x3a647a=a67_0x35b6,_0xbcfa74=getSessionID(_0x2f2926),_0x4f7576=a67_0x49cdc8[_0x3a647a(0x1c5)](getSessionsDir(),_0xbcfa74+'.json');if(!a67_0x1afcee[_0x3a647a(0x1cb)](_0x4f7576))return;try{const _0x27068c=a67_0x1afcee['readFileSync'](_0x4f7576,'utf-8'),_0x27b168=JSON['parse'](_0x27068c);delete _0x27b168[_0x3f9d8a],a67_0x1afcee[_0x3a647a(0x1de)](_0x4f7576,JSON[_0x3a647a(0x1e4)](_0x27b168,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x565cf9=a67_0x35b6,_0x4699f7=getSessionsDir();if(!a67_0x1afcee[_0x565cf9(0x1cb)](_0x4699f7))return 0x0;let _0xf541e=0x0;const _0x3fc969=Date[_0x565cf9(0x1c3)]();try{const _0x1ee30e=a67_0x1afcee['readdirSync'](_0x4699f7);for(const _0x3d3dd1 of _0x1ee30e){if(!_0x3d3dd1['endsWith'](_0x565cf9(0x1c8)))continue;const _0x34491d=a67_0x49cdc8[_0x565cf9(0x1c5)](_0x4699f7,_0x3d3dd1),_0x25ca00=_0x3d3dd1['replace'](_0x565cf9(0x1c8),''),_0x152c60=parseInt(_0x25ca00,0xa),_0x60f7a=!isNaN(_0x152c60);if(_0x60f7a){if(!isProcessRunning(_0x152c60)){a67_0x1afcee[_0x565cf9(0x1d7)](_0x34491d),_0xf541e++;continue;}}try{const _0xbd7df0=a67_0x1afcee[_0x565cf9(0x1d4)](_0x34491d,'utf-8'),_0x3f282f=JSON[_0x565cf9(0x1d1)](_0xbd7df0),_0x23ee8f=new Date(_0x3f282f[_0x565cf9(0x1d0)])[_0x565cf9(0x1cf)]();_0x3fc969-_0x23ee8f>SESSION_EXPIRATION_MS&&(a67_0x1afcee['unlinkSync'](_0x34491d),_0xf541e++);}catch{a67_0x1afcee[_0x565cf9(0x1d7)](_0x34491d),_0xf541e++;}}}catch{}return _0xf541e;}export function listActiveSessions(){const _0x3586c9=a67_0x35b6,_0x2bc3af=getSessionsDir();if(!a67_0x1afcee[_0x3586c9(0x1cb)](_0x2bc3af))return[];try{const _0x3e6d97=a67_0x1afcee[_0x3586c9(0x1c9)](_0x2bc3af),_0x35f978=[];for(const _0x3127ed of _0x3e6d97){if(!_0x3127ed['endsWith']('.json'))continue;const _0x353e81=_0x3127ed[_0x3586c9(0x1ce)](_0x3586c9(0x1c8),''),_0xe85fc0=parseInt(_0x353e81,0xa);!isNaN(_0xe85fc0)&&isProcessRunning(_0xe85fc0)&&_0x35f978[_0x3586c9(0x1e3)](_0xe85fc0);}return _0x35f978['sort']((_0x3f3f49,_0x29bd19)=>_0x3f3f49-_0x29bd19);}catch{return[];}}
@@ -1 +1 @@
1
- const a68_0x3dac56=a68_0x36a0;(function(_0x4294eb,_0x55f65e){const _0x4fe56b=a68_0x36a0,_0x247102=_0x4294eb();while(!![]){try{const _0x64544d=-parseInt(_0x4fe56b(0x14a))/0x1*(parseInt(_0x4fe56b(0x149))/0x2)+-parseInt(_0x4fe56b(0x14d))/0x3*(-parseInt(_0x4fe56b(0x148))/0x4)+parseInt(_0x4fe56b(0x153))/0x5*(parseInt(_0x4fe56b(0x144))/0x6)+-parseInt(_0x4fe56b(0x143))/0x7*(parseInt(_0x4fe56b(0x151))/0x8)+parseInt(_0x4fe56b(0x14c))/0x9*(-parseInt(_0x4fe56b(0x145))/0xa)+parseInt(_0x4fe56b(0x14f))/0xb*(parseInt(_0x4fe56b(0x14b))/0xc)+parseInt(_0x4fe56b(0x155))/0xd*(parseInt(_0x4fe56b(0x154))/0xe);if(_0x64544d===_0x55f65e)break;else _0x247102['push'](_0x247102['shift']());}catch(_0x36bd7d){_0x247102['push'](_0x247102['shift']());}}}(a68_0x59a0,0x38bfa));import{createProfileCache}from'../utils/global-cache.js';function a68_0x36a0(_0x223349,_0xf8e7e5){_0x223349=_0x223349-0x143;const _0x59a04e=a68_0x59a0();let _0x36a08a=_0x59a04e[_0x223349];return _0x36a08a;}const userCache=createProfileCache(a68_0x3dac56(0x147),'core/user-cache');function a68_0x59a0(){const _0x586a9c=['27HnDtSh','users','4955610VlPanl','read','1555616FdUlsA','clear','5VKoEJM','98UKeLrV','586573vxqNhb','14FIesSG','1671534yVgeER','1562310sENXjl','now','users-{profile}.json','126460uFJsvp','791346gbImLW','1IuyMKg','12VByZkK','18FuZoBC'];a68_0x59a0=function(){return _0x586a9c;};return a68_0x59a0();}export function loadCachedUsers(_0x3f1493){const _0x5d073c=a68_0x3dac56,_0x365ae1=userCache[_0x5d073c(0x150)](_0x3f1493);return _0x365ae1?.[_0x5d073c(0x14e)]??null;}export function saveCachedUsers(_0x5d8ce4,_0xb6da79){const _0x378b78=a68_0x3dac56;userCache['write'](_0x5d8ce4,{'users':_0xb6da79,'cachedAt':Date[_0x378b78(0x146)]()});}export function clearUserCache(_0x273df7){const _0x250820=a68_0x3dac56;userCache[_0x250820(0x152)](_0x273df7);}
1
+ const a68_0x58739b=a68_0x5474;(function(_0x4b0838,_0x462fad){const _0x185bc3=a68_0x5474,_0x2caee6=_0x4b0838();while(!![]){try{const _0x6b0ce5=parseInt(_0x185bc3(0xf6))/0x1+-parseInt(_0x185bc3(0xfd))/0x2*(-parseInt(_0x185bc3(0xfc))/0x3)+-parseInt(_0x185bc3(0xf8))/0x4+-parseInt(_0x185bc3(0x100))/0x5+-parseInt(_0x185bc3(0xff))/0x6+-parseInt(_0x185bc3(0xfe))/0x7*(parseInt(_0x185bc3(0xf4))/0x8)+parseInt(_0x185bc3(0xfa))/0x9;if(_0x6b0ce5===_0x462fad)break;else _0x2caee6['push'](_0x2caee6['shift']());}catch(_0x7319e4){_0x2caee6['push'](_0x2caee6['shift']());}}}(a68_0xe29e,0x46e6a));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x58739b(0x101),a68_0x58739b(0xfb));export function loadCachedUsers(_0x453b55){const _0x4f3e92=a68_0x58739b,_0x27e1f3=userCache[_0x4f3e92(0x102)](_0x453b55);return _0x27e1f3?.[_0x4f3e92(0xf5)]??null;}export function saveCachedUsers(_0x23a834,_0x372c39){const _0x1acb84=a68_0x58739b;userCache[_0x1acb84(0xf9)](_0x23a834,{'users':_0x372c39,'cachedAt':Date[_0x1acb84(0x103)]()});}function a68_0x5474(_0x2c1d6f,_0x3d4fdf){_0x2c1d6f=_0x2c1d6f-0xf4;const _0xe29eb7=a68_0xe29e();let _0x547400=_0xe29eb7[_0x2c1d6f];return _0x547400;}function a68_0xe29e(){const _0xc9a816=['clear','1435356VQrclX','write','7970778nACFjy','core/user-cache','504333nNuunt','4BGBKfg','2981643QgDtcy','1547064WUHArB','987915GmvTkT','users-{profile}.json','read','now','8lGBwJc','users','308761fHjIsY'];a68_0xe29e=function(){return _0xc9a816;};return a68_0xe29e();}export function clearUserCache(_0x3a5b66){const _0x2f03cc=a68_0x58739b;userCache[_0x2f03cc(0xf7)](_0x3a5b66);}
@@ -1 +1 @@
1
- (function(_0x285ad9,_0x5e4f12){const _0x54a595=a69_0x1106,_0x54df96=_0x285ad9();while(!![]){try{const _0x5160ea=-parseInt(_0x54a595(0x11b))/0x1+parseInt(_0x54a595(0x111))/0x2*(-parseInt(_0x54a595(0x118))/0x3)+parseInt(_0x54a595(0x119))/0x4*(-parseInt(_0x54a595(0x112))/0x5)+-parseInt(_0x54a595(0x116))/0x6*(-parseInt(_0x54a595(0x114))/0x7)+parseInt(_0x54a595(0x11c))/0x8+parseInt(_0x54a595(0x113))/0x9+parseInt(_0x54a595(0x10d))/0xa*(parseInt(_0x54a595(0x117))/0xb);if(_0x5160ea===_0x5e4f12)break;else _0x54df96['push'](_0x54df96['shift']());}catch(_0x1800fc){_0x54df96['push'](_0x54df96['shift']());}}}(a69_0x22cf,0x651c1));import{readFileSync}from'fs';function a69_0x1106(_0x19c8a0,_0x21aef7){_0x19c8a0=_0x19c8a0-0x10d;const _0x22cfbc=a69_0x22cf();let _0x110600=_0x22cfbc[_0x19c8a0];return _0x110600;}import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x2facd1=a69_0x1106;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x21f8d7=fileURLToPath(import.meta.url),_0x55858c=dirname(_0x21f8d7);try{const _0x29f11f=join(_0x55858c,'../build-info.json');cachedBuildInfo=JSON[_0x2facd1(0x115)](readFileSync(_0x29f11f,_0x2facd1(0x11a)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x470694=a69_0x1106;if(cachedVersion!==null)return cachedVersion;const _0x262735=fileURLToPath(import.meta.url),_0x4ce6ef=dirname(_0x262735),_0xbe86af=getBuildInfo();if(_0xbe86af[_0x470694(0x11e)])return cachedVersion=_0xbe86af[_0x470694(0x11e)],cachedVersion;try{const _0x2642cf=join(_0x4ce6ef,_0x470694(0x10f)),_0x327021=JSON[_0x470694(0x115)](readFileSync(_0x2642cf,'utf-8'));cachedVersion=_0x327021['version'];}catch{cachedVersion=_0x470694(0x110);}return cachedVersion;}export function isDevVersion(){const _0x5adb14=a69_0x1106,_0x57fd31=getVersion();return _0x57fd31[_0x5adb14(0x11d)](_0x5adb14(0x10e))||_0x57fd31['includes']('-');}function a69_0x22cf(){const _0x3de7b7=['766271tGVuCK','3422040rMTEYs','includes','version','60xgvfQz','.dev','../../package.json','0.0.0','1303986ObSYxr','105iYrUGz','4109013ebWKoe','7gSofwa','parse','1656708tXORNI','1386616KDXWbZ','3kQYqyk','16068bLrylK','utf-8'];a69_0x22cf=function(){return _0x3de7b7;};return a69_0x22cf();}
1
+ function a69_0x38fb(){const _0x5eb98c=['3238295ykyutB','18879468EAspUc','7HrihVn','1067590jkbyva','../build-info.json','2509538CaXEuM','.dev','12XejrZw','4cOCtev','4148019VigmcK','0.0.0','1HhnCyH','parse','11WrKXkS','1482776loriax','../../package.json','2261310xEEeCV','version','utf-8'];a69_0x38fb=function(){return _0x5eb98c;};return a69_0x38fb();}(function(_0x267485,_0x4d1686){const _0xf72a63=a69_0x474b,_0x150de9=_0x267485();while(!![]){try{const _0xd8c675=-parseInt(_0xf72a63(0x191))/0x1*(parseInt(_0xf72a63(0x18b))/0x2)+-parseInt(_0xf72a63(0x183))/0x3*(parseInt(_0xf72a63(0x18e))/0x4)+-parseInt(_0xf72a63(0x186))/0x5*(-parseInt(_0xf72a63(0x18d))/0x6)+parseInt(_0xf72a63(0x188))/0x7*(parseInt(_0xf72a63(0x181))/0x8)+-parseInt(_0xf72a63(0x18f))/0x9+parseInt(_0xf72a63(0x189))/0xa*(parseInt(_0xf72a63(0x180))/0xb)+parseInt(_0xf72a63(0x187))/0xc;if(_0xd8c675===_0x4d1686)break;else _0x150de9['push'](_0x150de9['shift']());}catch(_0x271ea1){_0x150de9['push'](_0x150de9['shift']());}}}(a69_0x38fb,0xa8c53));import{readFileSync}from'fs';function a69_0x474b(_0x37549a,_0x2303b3){_0x37549a=_0x37549a-0x17f;const _0x38fb88=a69_0x38fb();let _0x474b35=_0x38fb88[_0x37549a];return _0x474b35;}import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x394208=a69_0x474b;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4fe3c3=fileURLToPath(import.meta.url),_0x5d9917=dirname(_0x4fe3c3);try{const _0x2fa590=join(_0x5d9917,_0x394208(0x18a));cachedBuildInfo=JSON['parse'](readFileSync(_0x2fa590,_0x394208(0x185)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0xb2da64=a69_0x474b;if(cachedVersion!==null)return cachedVersion;const _0x35e508=fileURLToPath(import.meta.url),_0xed61f9=dirname(_0x35e508),_0x42a841=getBuildInfo();if(_0x42a841[_0xb2da64(0x184)])return cachedVersion=_0x42a841['version'],cachedVersion;try{const _0x40e9f2=join(_0xed61f9,_0xb2da64(0x182)),_0x579f1a=JSON[_0xb2da64(0x17f)](readFileSync(_0x40e9f2,_0xb2da64(0x185)));cachedVersion=_0x579f1a[_0xb2da64(0x184)];}catch{cachedVersion=_0xb2da64(0x190);}return cachedVersion;}export function isDevVersion(){const _0x422bce=a69_0x474b,_0x4614c9=getVersion();return _0x4614c9['includes'](_0x422bce(0x18c))||_0x4614c9['includes']('-');}