@treasuredata/tdx 2026.4.8 → 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 (237) 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.d.ts +2 -0
  184. package/dist/sdk/workspace/access-tracker.d.ts.map +1 -1
  185. package/dist/sdk/workspace/access-tracker.js +1 -1
  186. package/dist/sdk/workspace/access-tracker.js.map +1 -1
  187. package/dist/sdk/workspace/frontmatter.js +1 -1
  188. package/dist/sdk/workspace/git.d.ts +52 -0
  189. package/dist/sdk/workspace/git.d.ts.map +1 -1
  190. package/dist/sdk/workspace/git.js +1 -1
  191. package/dist/sdk/workspace/git.js.map +1 -1
  192. package/dist/sdk/workspace/index.d.ts +16 -0
  193. package/dist/sdk/workspace/index.d.ts.map +1 -1
  194. package/dist/sdk/workspace/index.js +1 -1
  195. package/dist/sdk/workspace/index.js.map +1 -1
  196. package/dist/sdk/workspace/templates.js +1 -1
  197. package/dist/sdk/workspace/weekly.js +1 -1
  198. package/dist/sdk/workspace/wikilinks.js +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.d.ts +3 -0
  224. package/dist/utils/process.d.ts.map +1 -1
  225. package/dist/utils/process.js +1 -1
  226. package/dist/utils/process.js.map +1 -1
  227. package/dist/utils/prompt.js +1 -1
  228. package/dist/utils/spinner.js +1 -1
  229. package/dist/utils/sse-parser.js +1 -1
  230. package/dist/utils/string-utils.js +1 -1
  231. package/dist/utils/table-ref-parser.js +1 -1
  232. package/dist/utils/tdx-logger.js +1 -1
  233. package/dist/utils/version-check.d.ts +10 -2
  234. package/dist/utils/version-check.d.ts.map +1 -1
  235. package/dist/utils/version-check.js +1 -1
  236. package/dist/utils/version-check.js.map +1 -1
  237. package/package.json +2 -1
@@ -1 +1 @@
1
- const a57_0x36162f=a57_0x5b0d;(function(_0x3f0f47,_0x4aae19){const _0x2fa672=a57_0x5b0d,_0x1b6318=_0x3f0f47();while(!![]){try{const _0xde9ded=parseInt(_0x2fa672(0xc0))/0x1+-parseInt(_0x2fa672(0xdb))/0x2*(parseInt(_0x2fa672(0xa4))/0x3)+-parseInt(_0x2fa672(0xc9))/0x4+-parseInt(_0x2fa672(0xaf))/0x5*(parseInt(_0x2fa672(0xc1))/0x6)+-parseInt(_0x2fa672(0x96))/0x7*(parseInt(_0x2fa672(0x9b))/0x8)+-parseInt(_0x2fa672(0xa7))/0x9*(parseInt(_0x2fa672(0xa1))/0xa)+-parseInt(_0x2fa672(0xcb))/0xb*(-parseInt(_0x2fa672(0xc8))/0xc);if(_0xde9ded===_0x4aae19)break;else _0x1b6318['push'](_0x1b6318['shift']());}catch(_0x55d217){_0x1b6318['push'](_0x1b6318['shift']());}}}(a57_0x5d9b,0x655f1));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x3e0ddc from'node:fs';import*as a57_0x635643 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x3f933c from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x4c2f6c=a57_0x5b0d;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x4c2f6c(0x9d));}export function getConfigFile(){const _0x400c33=a57_0x5b0d;return join(getConfigDir(),_0x400c33(0xa8));}export function getConfigFilePath(_0x46bb37){const _0x1c93d1=a57_0x5b0d,_0x33c9b8=getConfigDir();return _0x46bb37?a57_0x635643[_0x1c93d1(0xb8)](_0x33c9b8,_0x1c93d1(0xc3)+_0x46bb37):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x36162f(0xb5),a57_0x36162f(0xda));export function getLLMProjectCacheFile(_0x2964b7){const _0x56a0e6=a57_0x36162f;return llmProjectCache[_0x56a0e6(0xb1)](_0x2964b7);}export function readCachedLLMProject(_0x321eae){const _0x182e94=a57_0x36162f,_0x7644db=llmProjectCache[_0x182e94(0xd3)](_0x321eae);if(_0x7644db&&typeof _0x7644db['id']===_0x182e94(0xcd)&&typeof _0x7644db[_0x182e94(0xd7)]==='string')return _0x7644db;return null;}export function writeCachedLLMProject(_0x3bc6a9,_0x2554d3,_0x29cc7a){const _0x4affd1=a57_0x36162f;try{llmProjectCache[_0x4affd1(0xca)]({'name':_0x3bc6a9,'id':_0x2554d3},_0x29cc7a);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a57_0x36162f(0xb7));export function getLLMAgentCacheFile(_0x2d5e94){return llmAgentCache['path'](_0x2d5e94);}export function readCachedLLMAgent(_0x2725f7){const _0x27fe3c=a57_0x36162f,_0x188e03=llmAgentCache[_0x27fe3c(0xd3)](_0x2725f7);if(_0x188e03&&typeof _0x188e03['id']===_0x27fe3c(0xcd)&&typeof _0x188e03[_0x27fe3c(0xd7)]===_0x27fe3c(0xcd)&&typeof _0x188e03[_0x27fe3c(0xae)]===_0x27fe3c(0xcd))return _0x188e03;return null;}export function writeCachedLLMAgent(_0x31abd5,_0x34450f,_0x18b385,_0x4fe660){const _0x4daede=a57_0x36162f;try{llmAgentCache[_0x4daede(0xca)]({'name':_0x31abd5,'id':_0x34450f,'projectId':_0x18b385},_0x4fe660);}catch{}}export function clearCachedLLMAgent(_0x40f79b){const _0x399b36=a57_0x36162f;try{llmAgentCache[_0x399b36(0xb6)](_0x40f79b);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a57_0x36162f(0xcf),{'suffix':a57_0x36162f(0xa9)});export function getAccountInfoCacheFile(_0x47e887){const _0x3baeb7=a57_0x36162f;return accountInfoCache[_0x3baeb7(0xb1)](_0x47e887);}export function readCachedAccountInfo(_0x49ca71){const _0x37468f=a57_0x36162f,_0x23ac4f=accountInfoCache[_0x37468f(0xd3)](_0x49ca71);if(_0x23ac4f&&typeof _0x23ac4f[_0x37468f(0x98)]===_0x37468f(0xcd)&&typeof _0x23ac4f[_0x37468f(0xcc)]===_0x37468f(0xb0))return _0x23ac4f;return null;}export function writeCachedAccountInfo(_0x116c38,_0x259f0d,_0x102497){const _0x54efae=a57_0x36162f;try{accountInfoCache[_0x54efae(0xca)]({'site':_0x116c38,'accountId':_0x259f0d,'cachedAt':new Date()[_0x54efae(0xa5)]()},_0x102497);}catch{}}export function parseEnvFile(_0x485022){const _0x3d16cf=a57_0x36162f,_0x350c16={};for(const _0x316541 of _0x485022['split']('\x0a')){const _0x45e497=_0x316541[_0x3d16cf(0xd0)]();if(!_0x45e497||_0x45e497[_0x3d16cf(0xbc)]('#'))continue;const _0x1001f1=_0x45e497['match'](/^([^=]+)=(.*)$/);if(_0x1001f1){const _0x30616a=_0x1001f1[0x1][_0x3d16cf(0xd0)]();let _0xf529ad=_0x1001f1[0x2][_0x3d16cf(0xd0)]();(_0xf529ad[_0x3d16cf(0xbc)]('\x22')&&_0xf529ad[_0x3d16cf(0xe0)]('\x22')||_0xf529ad[_0x3d16cf(0xbc)]('\x27')&&_0xf529ad[_0x3d16cf(0xe0)]('\x27'))&&(_0xf529ad=_0xf529ad['slice'](0x1,-0x1)),_0x350c16[_0x30616a]=_0xf529ad;}}return _0x350c16;}function a57_0x5d9b(){const _0xdbafeb=['source','startsWith','proxy','apiKey','us01','189638lrMKlt','287808qxZgAs','stg-us01','.env.','split','ap01','TD_API_KEY_','\x20env\x20var','14249448AfCdMM','144308jRiJSi','write','22MoMzLT','accountId','string','utf-8','config/account-info','trim','stg-ap03','apiKeys','read','readFileSync','stable','yellow','name','next','includes','config/llm-project','1350282fqmQCq','Warning:\x20Unknown\x20site\x20\x27','eu01','ap03','tdx.json','endsWith','map','release_channel','filter','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','warn','parse','506947NolYiP','keychain\x20(profile:\x20','site','toUpperCase','ap02','80lomdxQ','keychain','tdx','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','profile','TDX_ACCESS_TOKEN\x20env\x20var','1862530QbSOzq','existsSync','TDX_ACCESS_TOKEN_','3ttwLIE','toISOString','replace','9xvKBYA','.env','.json','some','TD_API_KEY','accessToken','dev-eu01','projectId','55LljtyJ','number','path','TDX_ACCESS_TOKEN_FILE','\x27,\x20defaulting\x20to\x20us01','stg-ap01','llm_default_project','clear','config/llm-agent','join','TDX_API_KEY\x20env\x20var','stringify'];a57_0x5d9b=function(){return _0xdbafeb;};return a57_0x5d9b();}export function readUserConfig(){const _0x304b1f=a57_0x36162f,_0x3ccf7f=getConfigFile();if(!existsSync(_0x3ccf7f))return{};try{const _0x311e0c=readFileSync(_0x3ccf7f,_0x304b1f(0xce));return parseEnvFile(_0x311e0c);}catch(_0x215e51){return console[_0x304b1f(0x94)](_0x304b1f(0x9e)+_0x3ccf7f+':',_0x215e51),{};}}export function resolveSite(_0x24ca38){const _0xcc834=a57_0x36162f,_0x19f74f=['us01','ap01',_0xcc834(0xdd),_0xcc834(0x9a),_0xcc834(0xde),'dev-us01',_0xcc834(0xad),_0xcc834(0xc2),_0xcc834(0xb4),'stg-ap03'];if(_0x19f74f[_0xcc834(0xd9)](_0x24ca38))return _0x24ca38;if(_0x24ca38 in SITE_ALIASES)return SITE_ALIASES[_0x24ca38];return console['warn'](_0xcc834(0xdc)+_0x24ca38+_0xcc834(0xb3)),_0xcc834(0xbf);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x31df62){const _0x7b0f4a=a57_0x36162f,_0x4cc606=_0x31df62||getActiveProfileName()||undefined;if(_0x4cc606){const _0x472b0f=_0x7b0f4a(0xa3)+normalizeProfileForEnvVar(_0x4cc606);if(process.env[_0x472b0f])return{'accessToken':process.env[_0x472b0f],'source':_0x472b0f+_0x7b0f4a(0xc7)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x7b0f4a(0xa0)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x11ae7b=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x11ae7b)return{'accessToken':_0x11ae7b,'source':_0x7b0f4a(0xb2)};}return null;}function readAccessTokenFile(_0x410c8a){try{const _0x544cc9=readFileSync(_0x410c8a,'utf-8')['trim']();return _0x544cc9||null;}catch{return null;}}export function getAccessToken(_0x3434ab){const _0xd7a58a=a57_0x36162f;return resolveAccessToken(_0x3434ab)?.[_0xd7a58a(0xac)];}export function getAPIKey(_0x5a20d7){const _0x731f94=_0x5a20d7||getActiveProfileName();if(_0x731f94){const _0x3d08da='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x731f94);if(process.env[_0x3d08da])return process.env[_0x3d08da];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x43d72e){const _0x44a269=a57_0x36162f;return _0x43d72e[_0x44a269(0x99)]()[_0x44a269(0xa6)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x21b4ed,_0x4d896a){const _0xb61bdd=a57_0x36162f,_0x221499=resolveAccessToken(_0x4d896a);if(_0x221499)return{'apiKey':_0x221499[_0xb61bdd(0xac)],'source':_0x221499[_0xb61bdd(0xbb)],'isDeprecated':![]};const _0x569597=_0x4d896a||getActiveProfileName()||undefined;if(_0x569597){const _0x503523='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x569597);if(process.env[_0x503523])return{'apiKey':process.env[_0x503523],'source':_0x503523+_0xb61bdd(0xc7),'isDeprecated':![]};const _0x1db900=getCachedCredential(_0x21b4ed,_0x569597);if(_0x1db900)return{'apiKey':_0x1db900,'source':_0xb61bdd(0x97)+_0x569597+')','isDeprecated':![]};const _0x318000=await getKeychainAPIKey(_0x569597);if(_0x318000)return setCachedCredential(_0x318000,_0x21b4ed,_0x569597),{'apiKey':_0x318000,'source':_0xb61bdd(0x97)+_0x569597+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0xb61bdd(0xb9),'isDeprecated':![]};if(!_0x569597){const _0x37af1a=getCachedCredential(_0x21b4ed,undefined);if(_0x37af1a)return{'apiKey':_0x37af1a,'source':'keychain','isDeprecated':![]};const _0x1dc0e8=await getKeychainAPIKey(undefined);if(_0x1dc0e8)return setCachedCredential(_0x1dc0e8,_0x21b4ed,undefined),{'apiKey':_0x1dc0e8,'source':_0xb61bdd(0x9c),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x34acea,_0x21f0db){const _0x173483=a57_0x36162f,_0x2ec2f2=await resolveAPIKeyAsync(_0x34acea,_0x21f0db);return _0x2ec2f2?.[_0x173483(0xbe)];}function cleanupLegacyEnvFile(_0x408f03){const _0x5324c0=a57_0x36162f;if(!existsSync(_0x408f03))return![];try{const _0x41197c=readFileSync(_0x408f03,_0x5324c0(0xce)),_0x39f7c2=_0x41197c[_0x5324c0(0xc4)]('\x0a'),_0x5bcd26=_0x39f7c2[_0x5324c0(0x92)](_0x26072b=>{const _0x12f8ed=_0x5324c0,_0x2db33d=_0x26072b['trim']();if(!_0x2db33d||_0x2db33d['startsWith']('#'))return!![];const [_0x30613d]=_0x2db33d[_0x12f8ed(0xc4)]('=');return!_0x30613d[_0x12f8ed(0xbc)](_0x12f8ed(0xab));}),_0x29f2ef=_0x5bcd26[_0x5324c0(0xaa)](_0x1a0390=>{const _0x5833e9=_0x5324c0,_0x266675=_0x1a0390[_0x5833e9(0xd0)]();return _0x266675&&!_0x266675['startsWith']('#');});if(!_0x29f2ef)return unlinkSync(_0x408f03),!![];return writeFileSync(_0x408f03,_0x5bcd26[_0x5324c0(0xb8)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x50e70b=a57_0x36162f;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x55c6d7=a57_0x635643[_0x50e70b(0xb8)](getConfigDir(),'tdx.json');if(!a57_0x3e0ddc[_0x50e70b(0xa2)](_0x55c6d7))return null;try{const _0x5b5825=a57_0x3e0ddc[_0x50e70b(0xd4)](_0x55c6d7,_0x50e70b(0xce)),_0x53c4d7=JSON[_0x50e70b(0x95)](_0x5b5825);return _0x53c4d7[_0x50e70b(0x9f)]||null;}catch{return null;}}export function saveAPIKey(_0x1575b1,_0x4258a9,_0x512288){const _0x43d9d3=a57_0x36162f,_0x1857bc=getConfigDir(),_0x19c1a5=getConfigFilePath(_0x512288);!existsSync(_0x1857bc)&&mkdirSync(_0x1857bc,{'recursive':!![],'mode':0x1c0});let _0x2d2fea={};if(existsSync(_0x19c1a5))try{const _0x3bd2b1=readFileSync(_0x19c1a5,'utf-8');_0x2d2fea=parseEnvFile(_0x3bd2b1);}catch(_0x2fe45c){console[_0x43d9d3(0x94)]('Warning:\x20Failed\x20to\x20read\x20'+_0x19c1a5+':',_0x2fe45c);}const _0x16ac2e=_0x1575b1[_0x43d9d3(0x99)]()[_0x43d9d3(0xa6)](/-/g,'_');_0x2d2fea[_0x43d9d3(0xc6)+_0x16ac2e]=_0x4258a9;const _0x191922=Object['entries'](_0x2d2fea)[_0x43d9d3(0xe1)](([_0x50c036,_0x527574])=>_0x50c036+'='+_0x527574);writeFileSync(_0x19c1a5,_0x191922[_0x43d9d3(0xb8)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x5e8252,_0x458380,_0x58d367){const _0x30ee62=a57_0x36162f;await saveKeychainAPIKey(_0x5e8252,_0x58d367),setCachedCredential(_0x5e8252,_0x458380,_0x58d367);const _0x497472=getConfigFilePath(_0x58d367);cleanupLegacyEnvFile(_0x497472)&&console[_0x30ee62(0x94)](a57_0x3f933c[_0x30ee62(0xd6)](_0x30ee62(0x93)));}export function loadConfig(){const _0x3de020=a57_0x36162f,_0xee4079={'apiKeys':{},'defaultSite':_0x3de020(0xbf)},_0xb95f79=['us01',_0x3de020(0xc5),'eu01',_0x3de020(0x9a),'ap03','dev-us01',_0x3de020(0xad),'stg-us01',_0x3de020(0xb4),_0x3de020(0xd1)],_0x35ffec=getAPIKey();if(_0x35ffec)for(const _0x39c0b2 of _0xb95f79){_0xee4079[_0x3de020(0xd2)][_0x39c0b2]=_0x35ffec;}return _0xee4079;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}function a57_0x5b0d(_0x4d7cb3,_0x717e7f){_0x4d7cb3=_0x4d7cb3-0x92;const _0x5d9bbe=a57_0x5d9b();let _0x5b0dc2=_0x5d9bbe[_0x4d7cb3];return _0x5b0dc2;}export function loadGlobalProxy(){const _0x9054bb=a57_0x36162f,_0x1e4416=a57_0x635643[_0x9054bb(0xb8)](getConfigDir(),'tdx.json');if(!a57_0x3e0ddc[_0x9054bb(0xa2)](_0x1e4416))return undefined;try{const _0x356f20=a57_0x3e0ddc[_0x9054bb(0xd4)](_0x1e4416,_0x9054bb(0xce)),_0x3eca28=JSON[_0x9054bb(0x95)](_0x356f20);return typeof _0x3eca28[_0x9054bb(0xbd)]==='string'?_0x3eca28['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x12437a=a57_0x36162f,_0x8871e0=process.env.TDX_RELEASE_CHANNEL;if(_0x8871e0==='next'||_0x8871e0==='stable')return _0x8871e0;const _0x19473f=a57_0x635643[_0x12437a(0xb8)](getConfigDir(),_0x12437a(0xdf));if(!a57_0x3e0ddc[_0x12437a(0xa2)](_0x19473f))return _0x12437a(0xd5);try{const _0x55d18b=a57_0x3e0ddc[_0x12437a(0xd4)](_0x19473f,_0x12437a(0xce)),_0xd3c703=JSON[_0x12437a(0x95)](_0x55d18b);if(_0xd3c703['release_channel']==='next')return _0x12437a(0xd8);}catch{}return _0x12437a(0xd5);}export function saveReleaseChannel(_0x476276){const _0x42173f=a57_0x36162f,_0x1d4b0e=getConfigDir(),_0x350a85=a57_0x635643[_0x42173f(0xb8)](_0x1d4b0e,_0x42173f(0xdf));!existsSync(_0x1d4b0e)&&mkdirSync(_0x1d4b0e,{'recursive':!![],'mode':0x1c0});let _0x50f800={};if(existsSync(_0x350a85))try{const _0x40fc7f=readFileSync(_0x350a85,_0x42173f(0xce));_0x50f800=JSON['parse'](_0x40fc7f);}catch{}_0x50f800[_0x42173f(0xe2)]=_0x476276,writeFileSync(_0x350a85,JSON[_0x42173f(0xba)](_0x50f800,null,0x2),{'mode':0x180});}
1
+ 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
- const a58_0x69f40a=a58_0x1d7b;(function(_0x225f63,_0x159537){const _0x5e2854=a58_0x1d7b,_0x11f320=_0x225f63();while(!![]){try{const _0x220042=-parseInt(_0x5e2854(0x72))/0x1*(-parseInt(_0x5e2854(0x6f))/0x2)+parseInt(_0x5e2854(0x79))/0x3+parseInt(_0x5e2854(0x75))/0x4+-parseInt(_0x5e2854(0x6b))/0x5*(parseInt(_0x5e2854(0x74))/0x6)+parseInt(_0x5e2854(0x6d))/0x7*(-parseInt(_0x5e2854(0x73))/0x8)+-parseInt(_0x5e2854(0x76))/0x9+parseInt(_0x5e2854(0x77))/0xa;if(_0x220042===_0x159537)break;else _0x11f320['push'](_0x11f320['shift']());}catch(_0xccfba){_0x11f320['push'](_0x11f320['shift']());}}}(a58_0x550b,0xf4044));function a58_0x550b(){const _0x4bc6a2=['2796fNHCPl','6312804pWtvOA','11972979MlAqpQ','11902930qpzeMM','connections','1977936eZcNcT','write','655RpnTGx','read','1778eCmiiT','core/connection-cache','622EocQLS','now','connections-{profile}.json','2801LnilVo','60096cXtTFG'];a58_0x550b=function(){return _0x4bc6a2;};return a58_0x550b();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x69f40a(0x71),a58_0x69f40a(0x6e));export function loadCachedConnections(_0x5e8bd3){const _0x465324=a58_0x69f40a,_0x3de4a7=connectionCache[_0x465324(0x6c)](_0x5e8bd3);return _0x3de4a7?.[_0x465324(0x78)]??null;}function a58_0x1d7b(_0x55cf53,_0x462ea4){_0x55cf53=_0x55cf53-0x6a;const _0x550b06=a58_0x550b();let _0x1d7bf=_0x550b06[_0x55cf53];return _0x1d7bf;}export function saveCachedConnections(_0x475a42,_0x577833){const _0x2c6aae=a58_0x69f40a;connectionCache[_0x2c6aae(0x6a)](_0x475a42,{'connections':_0x577833,'cachedAt':Date[_0x2c6aae(0x70)]()});}export function clearConnectionCache(_0x21e48b){connectionCache['clear'](_0x21e48b);}
1
+ 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_0x24368e=a59_0x4bb7;(function(_0x504dad,_0x52c815){const _0x5eee1a=a59_0x4bb7,_0x1b5757=_0x504dad();while(!![]){try{const _0x858a92=-parseInt(_0x5eee1a(0x1ca))/0x1*(-parseInt(_0x5eee1a(0x1cb))/0x2)+-parseInt(_0x5eee1a(0x1bf))/0x3*(parseInt(_0x5eee1a(0x1db))/0x4)+parseInt(_0x5eee1a(0x1c6))/0x5*(-parseInt(_0x5eee1a(0x1d1))/0x6)+parseInt(_0x5eee1a(0x1da))/0x7*(parseInt(_0x5eee1a(0x1cd))/0x8)+-parseInt(_0x5eee1a(0x1c5))/0x9+parseInt(_0x5eee1a(0x1d7))/0xa+-parseInt(_0x5eee1a(0x1bc))/0xb*(parseInt(_0x5eee1a(0x1d5))/0xc);if(_0x858a92===_0x52c815)break;else _0x1b5757['push'](_0x1b5757['shift']());}catch(_0x1c080f){_0x1b5757['push'](_0x1b5757['shift']());}}}(a59_0x1591,0x5b0f4));import a59_0x3e0983 from'prompts';function a59_0x1591(){const _0x352764=['other','length','4668069opxjxa','204YIMkzq','push','us\x20\x20\x20-\x20United\x20States','290488MARyrL','text','us01','15027UtKaZw','customSite','trim','Site\x20name\x20cannot\x20be\x20empty','findIndex','select','2692764uofzSC','25Aioczt','Enter\x20custom\x20site','ap01','log','1187AvsOoN','718OlHvVi','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','8jfReav','site','jp\x20\x20\x20-\x20Japan','ap02\x20-\x20Korea','493194ULAKao','Select\x20your\x20Treasure\x20Data\x20site:','eu01','value','156fWMgyK','test','5889340SppxEX'];a59_0x1591=function(){return _0x352764;};return a59_0x1591();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;function a59_0x4bb7(_0x536ee8,_0x16c448){_0x536ee8=_0x536ee8-0x1bb;const _0x15912a=a59_0x1591();let _0x4bb7ae=_0x15912a[_0x536ee8];return _0x4bb7ae;}export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x1780e0,_0x184cdd){if(_0x1780e0===undefined)return _0x184cdd;if(typeof _0x1780e0==='number')return _0x1780e0;return parseInt(_0x1780e0,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x24368e(0x1bb),'value':a59_0x24368e(0x1be)},{'title':a59_0x24368e(0x1cf),'value':a59_0x24368e(0x1c8)},{'title':'eu\x20\x20\x20-\x20Europe','value':a59_0x24368e(0x1d3)},{'title':a59_0x24368e(0x1d0),'value':'ap02'}];export function buildSiteChoices(_0x41596b){const _0x3750af=a59_0x24368e,_0xe8b7fa=[...STANDARD_SITE_CHOICES];let _0x3aff0e=_0xe8b7fa[_0x3750af(0x1c3)](_0x18eabd=>_0x18eabd[_0x3750af(0x1d4)]===_0x41596b);return _0x3aff0e===-0x1&&_0x41596b!==_0x3750af(0x1be)&&(_0xe8b7fa[_0x3750af(0x1dc)]({'title':_0x41596b,'value':_0x41596b}),_0x3aff0e=_0xe8b7fa[_0x3750af(0x1d9)]-0x1),_0xe8b7fa[_0x3750af(0x1dc)]({'title':_0x3750af(0x1c7),'value':_0x3750af(0x1d8)}),{'choices':_0xe8b7fa,'initialIndex':_0x3aff0e>=0x0?_0x3aff0e:0x0};}export async function promptSiteSelection(_0x576f3f,_0x7a6d2a,_0x13d1e5='Cancelled'){const _0x2b2e9=a59_0x24368e,{choices:_0x550f25,initialIndex:_0x54af55}=buildSiteChoices(_0x576f3f),_0x2718ed=_0x7a6d2a?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x7a6d2a+'):':_0x2b2e9(0x1d2),_0x421712=await a59_0x3e0983({'type':_0x2b2e9(0x1c4),'name':'site','message':_0x2718ed,'choices':_0x550f25,'initial':_0x54af55});if(!_0x421712[_0x2b2e9(0x1ce)])return console[_0x2b2e9(0x1c9)]('\x0a'+_0x13d1e5),null;if(_0x421712['site']!==_0x2b2e9(0x1d8))return _0x421712[_0x2b2e9(0x1ce)];const _0x7ae231=await a59_0x3e0983({'type':_0x2b2e9(0x1bd),'name':'customSite','message':'Enter\x20site\x20name:','initial':'us01','validate':_0x2c0c55=>{const _0x2ec56b=_0x2b2e9;if(!_0x2c0c55||!_0x2c0c55['trim']())return _0x2ec56b(0x1c2);if(!/^[a-z0-9-]+$/[_0x2ec56b(0x1d6)](_0x2c0c55[_0x2ec56b(0x1c1)]()))return _0x2ec56b(0x1cc);return!![];}});if(!_0x7ae231[_0x2b2e9(0x1c0)])return console[_0x2b2e9(0x1c9)]('\x0a'+_0x13d1e5),null;return _0x7ae231[_0x2b2e9(0x1c0)];}
1
+ 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(_0x3ba42b,_0x4be1dc){const _0x35610c=a60_0x26ee,_0x1cedc8=_0x3ba42b();while(!![]){try{const _0xc681e5=parseInt(_0x35610c(0x93))/0x1*(parseInt(_0x35610c(0x92))/0x2)+-parseInt(_0x35610c(0x90))/0x3*(-parseInt(_0x35610c(0x91))/0x4)+-parseInt(_0x35610c(0x8a))/0x5*(parseInt(_0x35610c(0x8c))/0x6)+parseInt(_0x35610c(0x8b))/0x7+-parseInt(_0x35610c(0x94))/0x8+-parseInt(_0x35610c(0x98))/0x9*(parseInt(_0x35610c(0x96))/0xa)+parseInt(_0x35610c(0x99))/0xb;if(_0xc681e5===_0x4be1dc)break;else _0x1cedc8['push'](_0x1cedc8['shift']());}catch(_0x2d9234){_0x1cedc8['push'](_0x1cedc8['shift']());}}}(a60_0x709d,0x7c1c6));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3a0e59,_0xf4cdbf){const _0x15c45b=a60_0x26ee,_0x5c712a=_0x3a0e59||_0x15c45b(0x9a),_0x122d7a=_0xf4cdbf||_0x15c45b(0x97);return _0x5c712a+':'+_0x122d7a;}export function getCachedCredential(_0x451e83,_0x2333db){const _0x4f6293=a60_0x26ee,_0x454406=getCacheKey(_0x451e83,_0x2333db),_0x23b4a7=cache[_0x4f6293(0x8f)](_0x454406);if(!_0x23b4a7)return null;if(Date['now']()-_0x23b4a7[_0x4f6293(0x88)]>CACHE_TTL_MS)return cache[_0x4f6293(0x89)](_0x454406),null;return _0x23b4a7[_0x4f6293(0x95)];}export function setCachedCredential(_0x324a12,_0x38f7be,_0x28a747){const _0x79fadf=a60_0x26ee,_0x31c344=getCacheKey(_0x38f7be,_0x28a747);cache[_0x79fadf(0x8d)](_0x31c344,{'apiKey':_0x324a12,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x1d4579=a60_0x26ee;cache[_0x1d4579(0x8e)]();}function a60_0x709d(){const _0x32fef2=['2tTamHu','2232600yFnePK','apiKey','30mqtStR','__default_profile__','2624607wyWpvj','9824342MdEcpH','__default_site__','loadedAt','delete','711295QUQATK','4179035VLscIf','42phPVSu','set','clear','get','67650ETPuTV','120rPRSEm','491488UEKGNL'];a60_0x709d=function(){return _0x32fef2;};return a60_0x709d();}function a60_0x26ee(_0x5ec4d0,_0x3c97be){_0x5ec4d0=_0x5ec4d0-0x88;const _0x709d9f=a60_0x709d();let _0x26eeb3=_0x709d9f[_0x5ec4d0];return _0x26eeb3;}export function clearCachedCredential(_0xdb78b7,_0x3f4447){const _0x4c7967=getCacheKey(_0xdb78b7,_0x3f4447);cache['delete'](_0x4c7967);}
1
+ (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_0xa27371=a61_0x2423;(function(_0x4b08d6,_0x4d886e){const _0x3d55bb=a61_0x2423,_0x58ca12=_0x4b08d6();while(!![]){try{const _0x37fc8b=parseInt(_0x3d55bb(0x77))/0x1*(-parseInt(_0x3d55bb(0xb4))/0x2)+-parseInt(_0x3d55bb(0x79))/0x3*(-parseInt(_0x3d55bb(0x82))/0x4)+-parseInt(_0x3d55bb(0xbb))/0x5*(parseInt(_0x3d55bb(0x9a))/0x6)+parseInt(_0x3d55bb(0x8f))/0x7*(-parseInt(_0x3d55bb(0xae))/0x8)+-parseInt(_0x3d55bb(0x8e))/0x9*(-parseInt(_0x3d55bb(0x95))/0xa)+parseInt(_0x3d55bb(0x99))/0xb+parseInt(_0x3d55bb(0x93))/0xc;if(_0x37fc8b===_0x4d886e)break;else _0x58ca12['push'](_0x58ca12['shift']());}catch(_0x3a8068){_0x58ca12['push'](_0x58ca12['shift']());}}}(a61_0x4b98,0x2b7ae));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x1a1753 from'node:fs';import*as a61_0x5eaffc from'node:path';function a61_0x2423(_0x2c0335,_0x1eb959){_0x2c0335=_0x2c0335-0x75;const _0x4b98db=a61_0x4b98();let _0x2423fa=_0x4b98db[_0x2c0335];return _0x2423fa;}import a61_0x5d2284 from'chalk';export class GlobalContext{[a61_0xa27371(0x97)];[a61_0xa27371(0x9d)];['parent_segment'];[a61_0xa27371(0xb7)];[a61_0xa27371(0x90)];[a61_0xa27371(0xa5)];[a61_0xa27371(0xc2)];[a61_0xa27371(0xba)];[a61_0xa27371(0xa1)];['accessToken'];['proxy'];[a61_0xa27371(0x87)];[a61_0xa27371(0xcc)];['profile'];[a61_0xa27371(0xb6)]=null;['layers'];['activeProfile'];[a61_0xa27371(0xaf)];['configFiles'];constructor(_0xba7a6e){const _0x243640=a61_0xa27371;this[_0x243640(0xaf)]=getSessionID(_0xba7a6e[_0x243640(0x7f)]);const _0x35963d=loadSessionContext(_0xba7a6e[_0x243640(0x7f)]),_0x1608dc=loadProjectConfig(),_0x51a823=this[_0x243640(0xbe)]();if(_0xba7a6e[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0xba7a6e[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0x80);else{if(_0x35963d?.[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0x35963d[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0x7f);else{if(_0x51a823[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0x51a823[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0xb1);else process.env.TDX_PROFILE?(this[_0x243640(0xa0)]=process.env.TDX_PROFILE,this[_0x243640(0xb6)]='env'):(this[_0x243640(0xa0)]=null,this['profileSource']=null);}}const _0x88785e=this[_0x243640(0xa0)]?loadProfile(this[_0x243640(0xa0)]):null,_0x45cd54=_0x3709cb=>{const _0x523b59=_0x243640;if(!_0x3709cb)return{};const _0x3fcf29=_0x3709cb,_0x22e880={};for(const [_0x3c3618,_0x32e18e]of Object[_0x523b59(0xcb)](_0x3fcf29)){typeof _0x32e18e===_0x523b59(0xb0)&&(_0x22e880[_0x3c3618]=_0x32e18e);}return _0x22e880;},_0x2d488f={},_0x4ba5a6=(_0x2d95fd,_0x515c27,_0x28e541)=>{const _0x2c3f09=_0x243640;if(!_0x2d95fd)return![];if(_0x28e541&&_0x2d95fd===_0x28e541)return![];const _0x14d5ed=_0x35963d,_0x5de4ea=_0x1608dc,_0x31e67d=_0x88785e?.[_0x2c3f09(0xb1)],_0x75c66f=_0x51a823,_0x50e513=_0x14d5ed?.[_0x515c27],_0x385a82=_0x5de4ea?.[_0x515c27],_0x122763=_0x31e67d?.[_0x515c27],_0x3ff9b2=_0x75c66f[_0x515c27];return _0x2d95fd!==_0x50e513&&_0x2d95fd!==_0x385a82&&_0x2d95fd!==_0x122763&&_0x2d95fd!==_0x3ff9b2;},_0x5cee9d=[{'optionKey':_0x243640(0x97),'contextKey':_0x243640(0x97),'defaultValue':_0x243640(0xa6)},{'optionKey':_0x243640(0x9d),'contextKey':_0x243640(0x9d)},{'optionKey':'parentSegment','contextKey':'parent_segment'},{'optionKey':_0x243640(0xa7),'contextKey':_0x243640(0x90)},{'optionKey':_0x243640(0x9b),'contextKey':_0x243640(0xa5)},{'optionKey':_0x243640(0xa9),'contextKey':'composable_audience'},{'optionKey':_0x243640(0x8c),'contextKey':_0x243640(0x8c)}];for(const {optionKey:_0x58fcb5,contextKey:_0x121573,defaultValue:_0x4363e7}of _0x5cee9d){const _0xd0043f=_0xba7a6e[_0x58fcb5];_0x4ba5a6(_0xd0043f,_0x121573,_0x4363e7)&&(_0x2d488f[_0x121573]=_0xd0043f);}this[_0x243640(0x85)]={'cliFlags':_0x2d488f,'session':_0x45cd54(_0x35963d),'project':_0x45cd54(_0x1608dc),'profile':_0x45cd54(_0x88785e?.['config']),'global':_0x45cd54(_0x51a823)};const _0x29fde9={...this[_0x243640(0x85)][_0x243640(0xc0)],...this[_0x243640(0x85)]['profile'],...this['layers'][_0x243640(0xcd)]};process.env.TDX_SITE&&!this[_0x243640(0x85)][_0x243640(0x7f)][_0x243640(0x97)]&&!this[_0x243640(0x85)][_0x243640(0x7e)]['site']&&(_0x29fde9[_0x243640(0x97)]=process.env.TDX_SITE);Object[_0x243640(0xb9)](_0x29fde9,this[_0x243640(0x85)][_0x243640(0x7f)]),Object[_0x243640(0xb9)](_0x29fde9,this['layers'][_0x243640(0x7e)]);const _0x32331d=_0x29fde9[_0x243640(0x97)]||_0x243640(0xa6);this['site']=resolveSite(_0x32331d),this[_0x243640(0x9d)]=_0x29fde9[_0x243640(0x9d)],this[_0x243640(0x86)]=_0x29fde9[_0x243640(0x86)],this[_0x243640(0xb7)]=_0x29fde9[_0x243640(0xb7)],this[_0x243640(0x90)]=_0x29fde9[_0x243640(0x90)],this[_0x243640(0xa5)]=_0x29fde9[_0x243640(0xa5)],this[_0x243640(0xc2)]=_0x29fde9['workflow_project'],this[_0x243640(0xba)]=_0x29fde9[_0x243640(0xba)],this[_0x243640(0x87)]=_0xba7a6e[_0x243640(0x87)]||![],this[_0x243640(0xcc)]=_0xba7a6e[_0x243640(0xcc)]??LogLevel[_0x243640(0x84)],this[_0x243640(0x8c)]=this[_0x243640(0xa0)]||undefined,this[_0x243640(0x89)]=getAccessToken(this['activeProfile']||undefined),this[_0x243640(0xa1)]=getAPIKey(this[_0x243640(0xa0)]||undefined);const _0x3ff33e=typeof _0x51a823['proxy']===_0x243640(0xb0)?_0x51a823[_0x243640(0x76)]:undefined;this[_0x243640(0x76)]=_0x3ff33e||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x12f5df=getConfigDir(),_0x43b9c1=a61_0x5eaffc['join'](_0x12f5df,_0x243640(0x98),this['sessionId']+_0x243640(0xad)),_0x3a5ab3=findProjectConfigPath(),_0x6d65=a61_0x5eaffc['join'](_0x12f5df,_0x243640(0x9f)),_0x2d60d4=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,_0x243640(0x8b));let _0x561764=null,_0x58194a=null;this[_0x243640(0xa0)]&&(_0x561764=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,'profiles',this[_0x243640(0xa0)],_0x243640(0x9f)),_0x58194a=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,'profiles',this[_0x243640(0xa0)],_0x243640(0x8b))),this[_0x243640(0x78)]={'session':a61_0x1a1753['existsSync'](_0x43b9c1)?_0x43b9c1:null,'project':_0x3a5ab3,'profile':_0x561764&&a61_0x1a1753[_0x243640(0x81)](_0x561764)?_0x561764:null,'profileCredentials':_0x58194a&&a61_0x1a1753[_0x243640(0x81)](_0x58194a)?_0x58194a:null,'global':a61_0x1a1753[_0x243640(0x81)](_0x6d65)?_0x6d65:null,'globalCredentials':a61_0x1a1753[_0x243640(0x81)](_0x2d60d4)?_0x2d60d4:null};}[a61_0xa27371(0xa3)](_0xe22462,_0x57e191){const _0x5a016b=a61_0xa27371;if(!_0x57e191)return'not\x20set';const _0x583039=_0x57e191;if(this[_0x5a016b(0x85)][_0x5a016b(0x7e)][_0xe22462]===_0x583039){if(_0xe22462===_0x5a016b(0x97)&&_0x583039===_0x5a016b(0xa6)&&!this[_0x5a016b(0x85)][_0x5a016b(0x7f)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0xcd)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0x8c)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0xc0)][_0x5a016b(0x97)])return _0x5a016b(0x8a);return _0x5a016b(0x7d)+_0xe22462[_0x5a016b(0x75)](/_/g,'-');}if(this['layers']['session'][_0xe22462]===_0x583039)return _0x5a016b(0x7f);if(this['layers'][_0x5a016b(0xcd)][_0xe22462]===_0x583039)return _0x5a016b(0xcd);if(this['layers'][_0x5a016b(0x8c)][_0xe22462]===_0x583039)return _0x5a016b(0x7c)+this['activeProfile'];if(this[_0x5a016b(0x85)][_0x5a016b(0xc0)][_0xe22462]===_0x583039)return _0x5a016b(0xc0);return'default';}['loadGlobalConfig'](){const _0x147197=a61_0xa27371,_0xc2825b=a61_0x5eaffc[_0x147197(0xc4)](getConfigDir(),'tdx.json');if(!a61_0x1a1753[_0x147197(0x81)](_0xc2825b))return{};try{const _0x342b85=a61_0x1a1753[_0x147197(0xa8)](_0xc2825b,_0x147197(0xab));return JSON[_0x147197(0x7b)](_0x342b85);}catch{return{};}}[a61_0xa27371(0x96)](_0x2d36a7){const _0x2c0ae5=a61_0xa27371;_0x2d36a7[_0x2c0ae5(0x97)]=this['site'],!_0x2d36a7[_0x2c0ae5(0x9d)]&&this[_0x2c0ae5(0x9d)]&&(_0x2d36a7[_0x2c0ae5(0x9d)]=this[_0x2c0ae5(0x9d)]),!_0x2d36a7[_0x2c0ae5(0xb2)]&&this[_0x2c0ae5(0x86)]&&(_0x2d36a7['parentSegment']=this[_0x2c0ae5(0x86)]),!_0x2d36a7[_0x2c0ae5(0xac)]&&this[_0x2c0ae5(0xb7)]&&(_0x2d36a7[_0x2c0ae5(0xac)]=this[_0x2c0ae5(0xb7)]),!_0x2d36a7['llmProject']&&this[_0x2c0ae5(0x90)]&&(_0x2d36a7['llmProject']=this[_0x2c0ae5(0x90)]),!_0x2d36a7[_0x2c0ae5(0x9b)]&&this[_0x2c0ae5(0xa5)]&&(_0x2d36a7[_0x2c0ae5(0x9b)]=this[_0x2c0ae5(0xa5)]),!_0x2d36a7['workflowProject']&&this['workflow_project']&&(_0x2d36a7[_0x2c0ae5(0xc3)]=this[_0x2c0ae5(0xc2)]),!_0x2d36a7[_0x2c0ae5(0xa9)]&&this[_0x2c0ae5(0xba)]&&(_0x2d36a7['composableAudience']=this[_0x2c0ae5(0xba)]);}[a61_0xa27371(0xa2)](){const _0x3c7e11=a61_0xa27371;return[{'key':_0x3c7e11(0x97),'value':this['site']},{'key':'database','value':this[_0x3c7e11(0x9d)]},{'key':_0x3c7e11(0x86),'value':this['parent_segment']},{'key':_0x3c7e11(0xb7),'value':this['segment_path']},{'key':_0x3c7e11(0x90),'value':this[_0x3c7e11(0x90)]},{'key':_0x3c7e11(0xa5),'value':this[_0x3c7e11(0xa5)]},{'key':_0x3c7e11(0xc2),'value':this[_0x3c7e11(0xc2)]},{'key':_0x3c7e11(0xba),'value':this['composable_audience']},{'key':_0x3c7e11(0x8c),'value':this[_0x3c7e11(0xa0)]||undefined}];}[a61_0xa27371(0x94)](){const _0x44f235=a61_0xa27371;console['log'](a61_0x5d2284[_0x44f235(0xbf)]('[context]'));for(const {key:_0x357906,value:_0x106ad3}of this[_0x44f235(0xa2)]()){_0x106ad3&&console[_0x44f235(0xb3)](a61_0x5d2284[_0x44f235(0xc9)](_0x357906)+':\x20'+_0x106ad3);}}[a61_0xa27371(0x88)](){const _0x4ec3cb=a61_0xa27371;console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xbf)](_0x4ec3cb(0xca)));for(const {key:_0x564e17,value:_0x3c86fe}of this[_0x4ec3cb(0xa2)]()){if(_0x3c86fe){const _0x5d3c2e=_0x564e17===_0x4ec3cb(0x8c)?_0x4ec3cb(0x9e):'('+this[_0x4ec3cb(0xa3)](_0x564e17,_0x3c86fe)+')';console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x564e17)+':\x20'+_0x3c86fe+'\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x5d3c2e));}}console[_0x4ec3cb(0xb3)]('\x0a'+a61_0x5d2284[_0x4ec3cb(0xbf)](_0x4ec3cb(0x7a)));const _0x5a8bcc=[{'label':_0x4ec3cb(0xb8),'path':this[_0x4ec3cb(0x78)]['session'],'extra':'(session:\x20'+this[_0x4ec3cb(0xaf)]+')'},{'label':'Project','path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xcd)]},{'label':'Profile','path':this[_0x4ec3cb(0x78)]['profile']},{'label':_0x4ec3cb(0x83),'path':this['configFiles'][_0x4ec3cb(0xbc)]},{'label':_0x4ec3cb(0x91),'path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xc0)]},{'label':_0x4ec3cb(0x92),'path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xc8)]}];for(const {label:_0x153832,path:_0x488a92,extra:_0x589ba9}of _0x5a8bcc){if(_0x488a92)console['log'](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x153832)+':\x20'+_0x488a92+'\x20'+a61_0x5d2284[_0x4ec3cb(0xc7)]('✓')+(_0x589ba9?'\x20'+a61_0x5d2284['dim'](_0x589ba9):''));else{if(_0x153832===_0x4ec3cb(0xb8))console[_0x4ec3cb(0xb3)](a61_0x5d2284['cyan'](_0x153832)+':\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x4ec3cb(0xb5))+'\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x4ec3cb(0xc5)+this[_0x4ec3cb(0xaf)]+')'));else(_0x153832===_0x4ec3cb(0x8d)||_0x153832===_0x4ec3cb(0x91))&&console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x153832)+':\x20'+a61_0x5d2284['dim'](_0x4ec3cb(0xb5)));}}}async[a61_0xa27371(0xa4)](){const _0x3dcc81=a61_0xa27371;if(!this[_0x3dcc81(0x89)]){const _0x4d11dd=await getOAuthTokens(this[_0x3dcc81(0xa0)]||undefined);if(_0x4d11dd){const _0x440a26=0x5*0x3c*0x3e8,_0x13eff2=!_0x4d11dd[_0x3dcc81(0xaa)]||_0x4d11dd[_0x3dcc81(0xaa)]<Date['now']()+_0x440a26;if(_0x13eff2&&_0x4d11dd[_0x3dcc81(0xc1)])try{const _0x403b85=getConsoleUrl(this['site']),_0x45bbdc=await refreshAccessToken(_0x403b85,_0x4d11dd[_0x3dcc81(0xc1)]);await saveOAuthTokens(_0x45bbdc,this[_0x3dcc81(0xa0)]||undefined),this['accessToken']=_0x45bbdc[_0x3dcc81(0xbd)];}catch{this[_0x3dcc81(0x89)]=_0x4d11dd[_0x3dcc81(0xbd)];}else this[_0x3dcc81(0x89)]=_0x4d11dd[_0x3dcc81(0xbd)];return undefined;}}return this['apiKey']=await getAPIKeyAsync(this[_0x3dcc81(0x97)],this[_0x3dcc81(0xa0)]||undefined),this[_0x3dcc81(0xa1)];}static async[a61_0xa27371(0xc6)](_0x3fd792){const _0x1f01f2=a61_0xa27371,_0x1f9979=new GlobalContext(_0x3fd792);return await _0x1f9979[_0x1f01f2(0xa4)](),_0x1f9979;}}function a61_0x4b98(){const _0x335dc1=['activeProfile','apiKey','getParameters','getSource','resolveAPIKeyAsync','llm_agent','us01','llmProject','readFileSync','composableAudience','expires_at','utf-8','segmentPath','.json','24hUpAPP','sessionId','string','config','parentSegment','log','97442GdpUKE','none','profileSource','segment_path','Session','assign','composable_audience','547270ciySXj','profileCredentials','access_token','loadGlobalConfig','bold','global','refresh_token','workflow_project','workflowProject','join','(using\x20session:\x20','createAsync','green','globalCredentials','cyan','[context]','entries','logLevel','project','replace','proxy','1erbXtT','configFiles','259206fYPofV','[configuration\x20files]','parse','profile:\x20','CLI\x20flag:\x20--','cliFlags','session','cli','existsSync','16zwCVsQ','Profile\x20Credentials','INFO','layers','parent_segment','verbose','displayWithSources','accessToken','default','.env','profile','Project','2000763PtUBoS','737233oCCkCb','llm_project','Global','Global\x20Credentials','818208NFygWT','display','10ucQgLA','injectIntoOptions','site','sessions','2585385VbQDJt','18DYITJR','llmAgent','dim','database','(active)','tdx.json'];a61_0x4b98=function(){return _0x335dc1;};return a61_0x4b98();}
1
+ 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_0x1e7027=a62_0x4820;(function(_0x4bc64a,_0x5a86c6){const _0xb21567=a62_0x4820,_0x55da2c=_0x4bc64a();while(!![]){try{const _0x4f49ec=-parseInt(_0xb21567(0x93))/0x1+-parseInt(_0xb21567(0x86))/0x2+parseInt(_0xb21567(0x90))/0x3+parseInt(_0xb21567(0x8a))/0x4+parseInt(_0xb21567(0x99))/0x5+parseInt(_0xb21567(0x83))/0x6+-parseInt(_0xb21567(0x7d))/0x7*(parseInt(_0xb21567(0x80))/0x8);if(_0x4f49ec===_0x5a86c6)break;else _0x55da2c['push'](_0x55da2c['shift']());}catch(_0xcdb2f7){_0x55da2c['push'](_0x55da2c['shift']());}}}(a62_0x4e2f,0x9ecfe));const SERVICE_NAME=a62_0x1e7027(0x7f);function a62_0x4e2f(){const _0x4afa17=['8FHWyzL','-25300',':api_key','7322790tNFmXz','@napi-rs/keyring','error','1158958BRdLjB','value','unavailable','includes','4443288CJniyx','access','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','success','toLowerCase','System\x20keychain\x20is\x20not\x20available','1194456QydJcm','message','deleteCredential','1162396FvvRAR','could\x20not\x20be\x20found','Warning:\x20','not\x20supported','profile:','not\x20found','2536135NrTPuE','__keychain_test__','getPassword','5910079PmsltQ','access_denied','tdx'];a62_0x4e2f=function(){return _0x4afa17;};return a62_0x4e2f();}let EntryClass=null,keyringLoadError=null;function a62_0x4820(_0x3d330d,_0x3ce117){_0x3d330d=_0x3d330d-0x7d;const _0x4e2f9e=a62_0x4e2f();let _0x48208e=_0x4e2f9e[_0x3d330d];return _0x48208e;}async function getEntryClass(){const _0x1eafbd=a62_0x1e7027;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x4fa66f=await import(_0x1eafbd(0x84));return EntryClass=_0x4fa66f['Entry'],EntryClass;}catch(_0x3f3449){return keyringLoadError=_0x3f3449 instanceof Error?_0x3f3449:new Error(String(_0x3f3449)),null;}}function getAccountName(_0x449386){const _0x4cbef8=a62_0x1e7027,_0xef3ac2=_0x449386||'';return _0x4cbef8(0x97)+_0xef3ac2+_0x4cbef8(0x82);}export async function getKeychainAPIKey(_0x31d26b){const _0x6850a6=a62_0x1e7027,_0x20c3c2=await getKeychainAPIKeyWithStatus(_0x31d26b);if(_0x20c3c2[_0x6850a6(0x8d)])return _0x20c3c2[_0x6850a6(0x87)];return _0x20c3c2['reason']===_0x6850a6(0x7e)&&console[_0x6850a6(0x85)](_0x6850a6(0x95)+_0x20c3c2[_0x6850a6(0x91)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3652be){const _0x1ac98d=a62_0x1e7027;try{const _0xcd882a=await getEntryClass();if(!_0xcd882a)return{'success':![],'reason':'unavailable'};const _0x6d8a23=getAccountName(_0x3652be),_0xe5aa2c=new _0xcd882a(SERVICE_NAME,_0x6d8a23),_0x1c6b0e=_0xe5aa2c['getPassword']();if(_0x1c6b0e)return{'success':!![],'value':_0x1c6b0e};return{'success':![],'reason':'not_found'};}catch(_0x2c8fc3){const _0x3a17bb=_0x2c8fc3 instanceof Error?_0x2c8fc3[_0x1ac98d(0x91)]:String(_0x2c8fc3);if(_0x3a17bb[_0x1ac98d(0x89)](_0x1ac98d(0x81))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x94))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x98))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)]('no\x20matching\x20entry'))return{'success':![],'reason':'not_found'};if(_0x3a17bb[_0x1ac98d(0x89)]('-25293')||_0x3a17bb[_0x1ac98d(0x8e)]()['includes']('restricted')||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x8b)))return{'success':![],'reason':_0x1ac98d(0x7e),'message':_0x1ac98d(0x8c)};return{'success':![],'reason':_0x1ac98d(0x88),'message':_0x3a17bb};}}export async function saveKeychainAPIKey(_0x2d312e,_0x47b2ca){const _0x4c3958=a62_0x1e7027,_0x5b7b96=await getEntryClass();if(!_0x5b7b96)throw new Error(_0x4c3958(0x8f));const _0x3a275a=getAccountName(_0x47b2ca),_0x223eae=new _0x5b7b96(SERVICE_NAME,_0x3a275a);_0x223eae['setPassword'](_0x2d312e);}export async function deleteKeychainAPIKey(_0x4a9db9){const _0x293733=a62_0x1e7027;try{const _0x34932d=await getEntryClass();if(!_0x34932d)return![];const _0x384f62=getAccountName(_0x4a9db9),_0x3d5351=new _0x34932d(SERVICE_NAME,_0x384f62);return _0x3d5351[_0x293733(0x92)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x3dd301=a62_0x1e7027;try{const _0x263d7c=await getEntryClass();if(!_0x263d7c)return![];const _0x39f8b8=new _0x263d7c(SERVICE_NAME,_0x3dd301(0x9a));return _0x39f8b8[_0x3dd301(0x9b)](),!![];}catch(_0x31f3f1){const _0x2e0330=_0x31f3f1 instanceof Error?_0x31f3f1[_0x3dd301(0x91)]['toLowerCase']():'';if(_0x2e0330[_0x3dd301(0x89)]('not\x20available')||_0x2e0330[_0x3dd301(0x89)](_0x3dd301(0x96))||_0x2e0330[_0x3dd301(0x89)]('cannot\x20find'))return![];return!![];}}
1
+ 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
- const a63_0x11371d=a63_0x2cc7;function a63_0x5daf(){const _0x1f47bc=['478110ifyjmD','1849377jhOKmB','4JgXMUk','@napi-rs/keyring','getPassword','6vtyjlt','profile:','tdx','setPassword','17830LgRTJN','System\x20keychain\x20is\x20not\x20available','1562463xoYZql','6150053xwPTPL','2355305sUASKF','916400MizjkG','deleteCredential'];a63_0x5daf=function(){return _0x1f47bc;};return a63_0x5daf();}(function(_0x38a68d,_0x2713bb){const _0x34d034=a63_0x2cc7,_0x213ef0=_0x38a68d();while(!![]){try{const _0xcbab0f=-parseInt(_0x34d034(0x9c))/0x1+parseInt(_0x34d034(0xa5))/0x2+parseInt(_0x34d034(0x9d))/0x3*(parseInt(_0x34d034(0x9e))/0x4)+-parseInt(_0x34d034(0xa9))/0x5+-parseInt(_0x34d034(0xa1))/0x6*(-parseInt(_0x34d034(0xa8))/0x7)+parseInt(_0x34d034(0x9a))/0x8+-parseInt(_0x34d034(0xa7))/0x9;if(_0xcbab0f===_0x2713bb)break;else _0x213ef0['push'](_0x213ef0['shift']());}catch(_0x378d8b){_0x213ef0['push'](_0x213ef0['shift']());}}}(a63_0x5daf,0x7906d));function a63_0x2cc7(_0x4eb48e,_0x4cfab8){_0x4eb48e=_0x4eb48e-0x9a;const _0x5dafe9=a63_0x5daf();let _0x2cc78c=_0x5dafe9[_0x4eb48e];return _0x2cc78c;}const SERVICE_NAME=a63_0x11371d(0xa3);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2388ed=a63_0x11371d;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x5446b6=await import(_0x2388ed(0x9f));return EntryClass=_0x5446b6['Entry'],EntryClass;}catch(_0x2d5ab5){return keyringLoadError=_0x2d5ab5 instanceof Error?_0x2d5ab5:new Error(String(_0x2d5ab5)),null;}}function getOAuthAccountName(_0x5c9ff7){const _0x5dc96a=a63_0x11371d,_0x592fa8=_0x5c9ff7||'';return _0x5dc96a(0xa2)+_0x592fa8+':oauth_tokens';}export async function saveOAuthTokens(_0x5a4c24,_0x4edcdf){const _0x53261e=a63_0x11371d,_0x375aa0=await getEntryClass();if(!_0x375aa0)throw new Error(_0x53261e(0xa6));const _0x4e732=getOAuthAccountName(_0x4edcdf),_0x50e543=new _0x375aa0(SERVICE_NAME,_0x4e732);_0x50e543[_0x53261e(0xa4)](JSON['stringify'](_0x5a4c24));}export async function getOAuthTokens(_0x4f4687){const _0x439805=a63_0x11371d;try{const _0x1c7afc=await getEntryClass();if(!_0x1c7afc)return null;const _0x208afb=getOAuthAccountName(_0x4f4687),_0x2103f2=new _0x1c7afc(SERVICE_NAME,_0x208afb),_0x3ad94f=_0x2103f2[_0x439805(0xa0)]();if(_0x3ad94f)return JSON['parse'](_0x3ad94f);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x3618ca){const _0x1d67f3=a63_0x11371d;try{const _0x309c85=await getEntryClass();if(!_0x309c85)return![];const _0x31abb0=getOAuthAccountName(_0x3618ca),_0x4478b0=new _0x309c85(SERVICE_NAME,_0x31abb0);return _0x4478b0[_0x1d67f3(0x9b)](),!![];}catch{return![];}}
1
+ (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_0xb08823=a64_0x1a24;function a64_0x3b1d(){const _0x2a1a37=['redirect_uri','close','3519894qxHZNY','url','end','text/html','):\x20','5BZkdqQ','codeChallenge','Not\x20Found','650402IcTkpS','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','listen','expires_in','S256','application/x-www-form-urlencoded','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','text','http://127.0.0.1','account_name','toString','/users/initiate_sso','access_token','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','redirectUri','authorization_code','4064zOmYbO','base64url','sha256','scope','EADDRINUSE','error','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','status','randomBytes','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','hex','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','code_challenge_method','createServer','searchParams','3353274pFpPxi','response_type','tdx','POST','3937424lJsnsn','6KZECtc','pathname','waitForCallback','code_challenge','/oauth/callback','writeHead','Port\x20','digest','1070261vOvsUT','accountName','code','get','http://localhost:','createHash','redirect_to_path','/oauth/authorize','update','text/plain','clientId','state','set','openid\x20email\x20profile','2762052NJalFn','OAuth\x20token\x20request\x20failed\x20('];a64_0x3b1d=function(){return _0x2a1a37;};return a64_0x3b1d();}(function(_0x44a5c9,_0x15e106){const _0x143a72=a64_0x1a24,_0x2cf767=_0x44a5c9();while(!![]){try{const _0x512344=-parseInt(_0x143a72(0x1b3))/0x1+parseInt(_0x143a72(0x1cd))/0x2+parseInt(_0x143a72(0x1c1))/0x3+-parseInt(_0x143a72(0x1dd))/0x4*(-parseInt(_0x143a72(0x1ca))/0x5)+parseInt(_0x143a72(0x1f2))/0x6*(parseInt(_0x143a72(0x1c5))/0x7)+-parseInt(_0x143a72(0x1f1))/0x8+parseInt(_0x143a72(0x1ed))/0x9;if(_0x512344===_0x15e106)break;else _0x2cf767['push'](_0x2cf767['shift']());}catch(_0x4dc3e5){_0x2cf767['push'](_0x2cf767['shift']());}}}(a64_0x3b1d,0x88b12));import*as a64_0x352fc5 from'node:crypto';import*as a64_0x1b83eb from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;function a64_0x1a24(_0x55d1b7,_0x4ac9e2){_0x55d1b7=_0x55d1b7-0x1ad;const _0x3b1d85=a64_0x3b1d();let _0x1a246f=_0x3b1d85[_0x55d1b7];return _0x1a246f;}export const OAUTH_REDIRECT_URI=a64_0xb08823(0x1b7)+OAUTH_CALLBACK_PORT+a64_0xb08823(0x1af);export function getOAuthClientId(){const _0x43d259=a64_0xb08823;return process.env.TD_OAUTH_CLIENT_ID||_0x43d259(0x1ef);}export function generatePKCEPair(){const _0x9a628b=a64_0xb08823,_0x3ee92a=a64_0x352fc5[_0x9a628b(0x1e5)](0x20)[_0x9a628b(0x1d7)](_0x9a628b(0x1de)),_0x10eb8c=a64_0x352fc5[_0x9a628b(0x1b8)](_0x9a628b(0x1df))[_0x9a628b(0x1bb)](_0x3ee92a)[_0x9a628b(0x1b2)](_0x9a628b(0x1de));return{'verifier':_0x3ee92a,'challenge':_0x10eb8c};}export function buildAuthorizeURL(_0x384cae,_0x113ebb){const _0x29ea63=a64_0xb08823,_0x4411ae=new URL(_0x29ea63(0x1ba),_0x384cae);return _0x4411ae[_0x29ea63(0x1ec)]['set'](_0x29ea63(0x1ee),_0x29ea63(0x1b5)),_0x4411ae[_0x29ea63(0x1ec)]['set']('client_id',_0x113ebb[_0x29ea63(0x1bd)]),_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1c3),_0x113ebb[_0x29ea63(0x1db)]),_0x4411ae['searchParams'][_0x29ea63(0x1bf)](_0x29ea63(0x1be),_0x113ebb['state']),_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1ae),_0x113ebb[_0x29ea63(0x1cb)]),_0x4411ae['searchParams']['set'](_0x29ea63(0x1ea),_0x29ea63(0x1d1)),_0x113ebb[_0x29ea63(0x1e0)]&&_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1e0),_0x113ebb['scope']),_0x4411ae[_0x29ea63(0x1d7)]();}export function buildSSOInitiateURL(_0x17500a,_0x2fe755,_0x4b26f6){const _0x2bdf18=a64_0xb08823,_0x3592b6=new URL(_0x2bdf18(0x1d8),_0x17500a);_0x3592b6[_0x2bdf18(0x1ec)][_0x2bdf18(0x1bf)](_0x2bdf18(0x1d6),_0x2fe755);const _0x4b1de6=_0x4b26f6['replace'](_0x17500a,'');return _0x3592b6[_0x2bdf18(0x1ec)]['set'](_0x2bdf18(0x1b9),_0x4b1de6),_0x3592b6[_0x2bdf18(0x1d7)]();}export async function postTokenRequest(_0x37419d,_0x5d35e2){const _0xef9289=a64_0xb08823,_0x2f5de2=new URLSearchParams(_0x5d35e2)[_0xef9289(0x1d7)](),_0x2744ca=await fetch(_0x37419d,{'method':_0xef9289(0x1f0),'headers':{'Content-Type':_0xef9289(0x1d2)},'body':_0x2f5de2});if(!_0x2744ca['ok']){const _0x54a000=await _0x2744ca[_0xef9289(0x1d4)]();throw new Error(_0xef9289(0x1c2)+_0x2744ca[_0xef9289(0x1e4)]+_0xef9289(0x1c9)+_0x54a000);}const _0x2b3223=await _0x2744ca['json']();return{'access_token':_0x2b3223[_0xef9289(0x1d9)],'refresh_token':_0x2b3223['refresh_token'],'scope':_0x2b3223[_0xef9289(0x1e0)],'expires_at':_0x2b3223[_0xef9289(0x1d0)]?Date['now']()+_0x2b3223[_0xef9289(0x1d0)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x445ac9,_0x2a7a7d,_0x5ea4ab,_0x5704f1){const _0xc19d8d=a64_0xb08823,_0x4bae27=_0x445ac9+'/oauth/token';return postTokenRequest(_0x4bae27,{'grant_type':_0xc19d8d(0x1dc),'client_id':getOAuthClientId(),'code':_0x2a7a7d,'code_verifier':_0x5ea4ab,'redirect_uri':_0x5704f1});}export function startLocalCallbackServer(){const _0x340327=a64_0xb08823;let _0x4a429e,_0x35cf4c;const _0x29258a=new Promise((_0x2e786b,_0x30d258)=>{_0x4a429e=_0x2e786b,_0x35cf4c=_0x30d258;}),_0x54e4ca=a64_0x1b83eb[_0x340327(0x1eb)]((_0x235dbe,_0x4f711e)=>{const _0x1523ee=_0x340327,_0x525a04=new URL(_0x235dbe[_0x1523ee(0x1c6)]||'/',_0x1523ee(0x1d5));if(_0x525a04[_0x1523ee(0x1f3)]!=='/oauth/callback'){_0x4f711e['writeHead'](0x194,{'Content-Type':_0x1523ee(0x1bc)}),_0x4f711e[_0x1523ee(0x1c7)](_0x1523ee(0x1cc));return;}const _0x5aa780=_0x525a04[_0x1523ee(0x1ec)][_0x1523ee(0x1b6)](_0x1523ee(0x1b5)),_0x86f0d3=_0x525a04[_0x1523ee(0x1ec)]['get'](_0x1523ee(0x1be)),_0x3b4b8e=_0x525a04[_0x1523ee(0x1ec)][_0x1523ee(0x1b6)](_0x1523ee(0x1e2));if(_0x3b4b8e||!_0x5aa780||!_0x86f0d3){_0x4f711e[_0x1523ee(0x1b0)](0x190,{'Content-Type':_0x1523ee(0x1c8)}),_0x4f711e[_0x1523ee(0x1c7)](_0x1523ee(0x1e3)),_0x35cf4c(new Error(_0x1523ee(0x1ce)));return;}_0x4f711e[_0x1523ee(0x1b0)](0xc8,{'Content-Type':_0x1523ee(0x1c8)}),_0x4f711e['end'](_0x1523ee(0x1d3)),_0x4a429e({'code':_0x5aa780,'state':_0x86f0d3});});_0x54e4ca['on'](_0x340327(0x1e2),_0x1a5a4d=>{const _0x4818f2=_0x340327;_0x1a5a4d['code']===_0x4818f2(0x1e1)?_0x35cf4c(new Error(_0x4818f2(0x1b1)+OAUTH_CALLBACK_PORT+_0x4818f2(0x1da))):_0x35cf4c(new Error(_0x4818f2(0x1e6)+_0x1a5a4d['message']));}),_0x54e4ca[_0x340327(0x1cf)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x5f5a4e=setTimeout(()=>{const _0x40e064=_0x340327;_0x35cf4c(new Error(_0x40e064(0x1e7))),_0x54e4ca[_0x40e064(0x1c4)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x29258a,'close':()=>{const _0x22d7c9=_0x340327;clearTimeout(_0x5f5a4e),_0x54e4ca[_0x22d7c9(0x1c4)]();}};}export async function startOAuthFlow(_0x1ea216,_0x5dfbfa){const _0xe31503=a64_0xb08823,_0x2997e7=getConsoleUrl(_0x1ea216),_0xeb98b6=getOAuthClientId(),{verifier:_0x2e4a6c,challenge:_0x59f6ac}=generatePKCEPair(),_0xed8fce=a64_0x352fc5['randomBytes'](0x10)[_0xe31503(0x1d7)](_0xe31503(0x1e8)),_0x551a20=startLocalCallbackServer();try{const _0x3c2eb4=OAUTH_REDIRECT_URI,_0x2243d3=buildAuthorizeURL(_0x2997e7,{'clientId':_0xeb98b6,'redirectUri':_0x3c2eb4,'state':_0xed8fce,'codeChallenge':_0x59f6ac,'scope':_0xe31503(0x1c0)}),_0xbf4f3d=_0x5dfbfa?.[_0xe31503(0x1b4)]?buildSSOInitiateURL(_0x2997e7,_0x5dfbfa['accountName'],_0x2243d3):_0x2243d3;openBrowser(_0xbf4f3d);const _0x5c1ffc=await _0x551a20[_0xe31503(0x1ad)]();if(_0x5c1ffc[_0xe31503(0x1be)]!==_0xed8fce)throw new Error(_0xe31503(0x1e9));return await exchangeCodeForTokens(_0x2997e7,_0x5c1ffc[_0xe31503(0x1b5)],_0x2e4a6c,_0x3c2eb4);}finally{_0x551a20[_0xe31503(0x1c4)]();}}
1
+ 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_0x3315a5=a65_0x13f2;(function(_0x11b603,_0x4991f8){const _0x45ac87=a65_0x13f2,_0x149bf4=_0x11b603();while(!![]){try{const _0x2fed73=parseInt(_0x45ac87(0x13d))/0x1+parseInt(_0x45ac87(0x12b))/0x2*(-parseInt(_0x45ac87(0x119))/0x3)+-parseInt(_0x45ac87(0x132))/0x4*(parseInt(_0x45ac87(0x126))/0x5)+-parseInt(_0x45ac87(0x11f))/0x6+-parseInt(_0x45ac87(0x13e))/0x7+parseInt(_0x45ac87(0x125))/0x8+parseInt(_0x45ac87(0x116))/0x9*(parseInt(_0x45ac87(0xfd))/0xa);if(_0x2fed73===_0x4991f8)break;else _0x149bf4['push'](_0x149bf4['shift']());}catch(_0x50362b){_0x149bf4['push'](_0x149bf4['shift']());}}}(a65_0x5487,0xeef16));import*as a65_0x1919df from'node:fs';import*as a65_0x18aeea from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a65_0x3315a5(0x102);function a65_0x5487(){const _0x14d361=['tdx.json','set','test','object','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','4ZUVoFc','find','keys','\x20already\x20exists','\x0aWarning:\x20Failed\x20to\x20parse\x20','has','name','toISOString','join','filter','llm_agent','899357vdAIPc','5034890vLBVCs','\x27\x20not\x20found\x20in\x20user\x20configuration','user_info','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','description','.env','sort','push','some','message','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','profile','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','existsSync','readdirSync','10fpTNmw','Invalid\x20profile\x20name:\x20','database','Profile\x20','warn','@tdx-studio','site','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)',',\x20creating\x20new\x20file','Warning:\x20Failed\x20to\x20parse\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','To\x20migrate:','\x20\x201.\x20Edit:\x20','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20does\x20not\x20exist','parent_segment','INVALID_PROFILE_CONFIG','parse','stringify','local','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','from','localeCompare','\x27:\x20unknown\x20config\x20key\x20\x27','22690413viDQPY','directory','values','183kpHQBA','string','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x27\x20will\x20be\x20ignored','readFileSync',':\x20Invalid\x20JSON\x20syntax','11692254HjCjNq','profiles','.env.','entries','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Profile\x20\x27','9464928fBeGlk','2840940sPQVcq','map','\x27:\x20config\x20must\x20be\x20an\x20object','llm_project','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','12746iDVyVa','utf-8'];a65_0x5487=function(){return _0x14d361;};return a65_0x5487();}export function getProfileParams(_0x1e4394){const _0xd21e26=a65_0x3315a5,_0x22f910={};if(!_0x1e4394)return _0x22f910;for(const [_0x2b5a50,_0x174f06]of Object[_0xd21e26(0x122)](_0x1e4394)){_0x2b5a50!=='description'&&_0x174f06!==undefined&&(_0x22f910[_0x2b5a50]=_0x174f06);}return _0x22f910;}export function getProfilesDir(){const _0x14aad9=a65_0x3315a5;return a65_0x18aeea['join'](getConfigDir(),_0x14aad9(0x120));}function getProfileDir(_0x59bcd0){const _0x3ad3fe=a65_0x3315a5;return a65_0x18aeea[_0x3ad3fe(0x13a)](getProfilesDir(),_0x59bcd0);}function getProfileConfigPath(_0x4de976){const _0x399135=a65_0x3315a5;return a65_0x18aeea[_0x399135(0x13a)](getProfileDir(_0x4de976),_0x399135(0x12d));}function getProfileEnvPath(_0x9f522c){const _0xec3a8b=a65_0x3315a5;return a65_0x18aeea['join'](getProfileDir(_0x9f522c),_0xec3a8b(0x143));}function getGlobalConfigPath(){const _0x523362=a65_0x3315a5;return a65_0x18aeea[_0x523362(0x13a)](getConfigDir(),'tdx.json');}function validateProfileName(_0x51532b){const _0x1aeeb4=a65_0x3315a5;if(/^@?[a-zA-Z0-9_-]+$/[_0x1aeeb4(0x12f)](_0x51532b))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x51532b))return;throw new Error(_0x1aeeb4(0xfe)+_0x51532b+_0x1aeeb4(0x104));}function validateProfileConfig(_0x1a3beb,_0x2bd1fb){const _0x4219b1=a65_0x3315a5;if(typeof _0x1a3beb!==_0x4219b1(0x130)||_0x1a3beb===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x128));const _0x6c22b6=[_0x4219b1(0x142),_0x4219b1(0x103),'database','parent_segment',_0x4219b1(0x129),_0x4219b1(0x13c),_0x4219b1(0x140)],_0x581f5c=_0x1a3beb;for(const _0x40a72d of Object[_0x4219b1(0x134)](_0x581f5c)){!_0x6c22b6['includes'](_0x40a72d)&&console[_0x4219b1(0x101)]('Warning:\x20Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x115)+_0x40a72d+_0x4219b1(0x11c));}if(_0x581f5c[_0x4219b1(0x142)]!==undefined&&typeof _0x581f5c['description']!==_0x4219b1(0x11a))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x11b));if(_0x581f5c[_0x4219b1(0x103)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x103)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0xf8));if(_0x581f5c['database']!==undefined&&typeof _0x581f5c[_0x4219b1(0xff)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x4219b1(0x124)+_0x2bd1fb+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x581f5c[_0x4219b1(0x10d)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x10d)]!=='string')throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0x141));if(_0x581f5c[_0x4219b1(0x129)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x129)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0x131));if(_0x581f5c[_0x4219b1(0x13c)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x13c)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x4219b1(0x124)+_0x2bd1fb+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x10e617,_0x4e7f7e){const _0xeedd4b=a65_0x3315a5;if(!a65_0x1919df['existsSync'](_0x10e617))return[];try{const _0xe3bd95=a65_0x1919df[_0xeedd4b(0x11d)](_0x10e617,_0xeedd4b(0x12c)),_0x3e5c97=JSON['parse'](_0xe3bd95);if(!_0x3e5c97[_0xeedd4b(0x120)]||typeof _0x3e5c97[_0xeedd4b(0x120)]!==_0xeedd4b(0x130))return[];const _0x4a54c2=[];for(const [_0x52f4a1,_0x12a912]of Object[_0xeedd4b(0x122)](_0x3e5c97[_0xeedd4b(0x120)])){try{validateProfileConfig(_0x12a912,_0x52f4a1);const _0x4a1e8b=getNewCredentialPath(_0x52f4a1),_0x286c8a=getOldCredentialPath(_0x52f4a1),_0x138f46=a65_0x1919df[_0xeedd4b(0xfb)](_0x4a1e8b)||a65_0x1919df[_0xeedd4b(0xfb)](_0x286c8a);_0x4a54c2['push']({'name':_0x52f4a1,'config':_0x12a912,'metadata':{'name':_0x52f4a1,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x138f46,'scope':_0x4e7f7e});}catch(_0x2ad8bf){_0x2ad8bf instanceof Error&&(console[_0xeedd4b(0x101)](_0xeedd4b(0xfa)+_0x10e617+':'),console[_0xeedd4b(0x101)]('\x20\x20'+_0x2ad8bf[_0xeedd4b(0xf7)]+'\x0a'));}}return _0x4a54c2;}catch(_0x27dee0){return _0x27dee0 instanceof SyntaxError?(console['warn'](_0xeedd4b(0x136)+_0x10e617+_0xeedd4b(0x11e)),console[_0xeedd4b(0x101)]('Error:\x20'+_0x27dee0[_0xeedd4b(0xf7)]+'\x0a')):console[_0xeedd4b(0x101)](_0xeedd4b(0x10b)+_0x10e617+':\x20'+_0x27dee0+'\x0a'),[];}}export function getNewCredentialPath(_0x28227a){const _0x295d9e=a65_0x3315a5;return a65_0x18aeea[_0x295d9e(0x13a)](getConfigDir(),_0x295d9e(0x121)+_0x28227a);}function a65_0x13f2(_0x23dd34,_0xf3ba9e){_0x23dd34=_0x23dd34-0xf5;const _0x548715=a65_0x5487();let _0x13f22b=_0x548715[_0x23dd34];return _0x13f22b;}function getOldCredentialPath(_0x2dab8b){const _0x52da88=a65_0x3315a5;return a65_0x18aeea[_0x52da88(0x13a)](getProfilesDir(),_0x2dab8b,_0x52da88(0x143));}function loadProfilesFromTdxJsonFiles(){const _0x18c3c9=a65_0x3315a5,_0x4810e0=[],_0x29f23d=findProjectConfigPath();_0x29f23d&&_0x4810e0[_0x18c3c9(0xf5)](...loadProfilesFromTdxJson(_0x29f23d,_0x18c3c9(0x111)));const _0x2de0c3=a65_0x18aeea[_0x18c3c9(0x13a)](getConfigDir(),_0x18c3c9(0x12d));return _0x4810e0['push'](...loadProfilesFromTdxJson(_0x2de0c3,'user')),_0x4810e0;}function loadProfilesFromDirectories(){const _0x1c4f73=a65_0x3315a5,_0x42ee30=getProfilesDir();if(!a65_0x1919df[_0x1c4f73(0xfb)](_0x42ee30))return[];try{return a65_0x1919df[_0x1c4f73(0xfc)](_0x42ee30,{'withFileTypes':!![]})[_0x1c4f73(0x13b)](_0x34a63b=>_0x34a63b['isDirectory']())['map'](_0x204101=>_0x204101['name'])[_0x1c4f73(0x13b)](_0x122255=>{const _0x577ff0=_0x1c4f73,_0x49eda7=getProfileConfigPath(_0x122255),_0x33dad0=getProfileEnvPath(_0x122255);return a65_0x1919df[_0x577ff0(0xfb)](_0x49eda7)||a65_0x1919df['existsSync'](_0x33dad0);})[_0x1c4f73(0x127)](_0x3ed11e=>{const _0x468898=loadProfileFromDirectory(_0x3ed11e);if(_0x468898)return{..._0x468898,'scope':'directory'};return null;})[_0x1c4f73(0x13b)](_0x2e0322=>_0x2e0322!==null);}catch{return[];}}function loadProfileFromDirectory(_0x128c1c){const _0x540138=a65_0x3315a5,_0x46de94=getProfileConfigPath(_0x128c1c),_0x18cbb2=getOldCredentialPath(_0x128c1c);if(!a65_0x1919df[_0x540138(0xfb)](_0x46de94)&&!a65_0x1919df[_0x540138(0xfb)](_0x18cbb2))return null;let _0x4b39ea={},_0x49f33d={'name':_0x128c1c,'createdAt':new Date()[_0x540138(0x139)]()};if(a65_0x1919df['existsSync'](_0x46de94))try{const _0x844485=a65_0x1919df['readFileSync'](_0x46de94,'utf-8'),_0x232399=JSON[_0x540138(0x10f)](_0x844485),{metadata:_0x30ad5c,..._0x5338e3}=_0x232399;_0x4b39ea=_0x5338e3,_0x30ad5c&&(_0x49f33d=_0x30ad5c);}catch{}return{'name':_0x128c1c,'config':_0x4b39ea,'metadata':_0x49f33d,'hasCredentials':a65_0x1919df['existsSync'](_0x18cbb2),'scope':_0x540138(0x117)};}export function listProfiles(){const _0x271d1d=a65_0x3315a5,_0x41ceb4=loadProfilesFromTdxJsonFiles(),_0x2ac681=loadProfilesFromDirectories();if(_0x2ac681['length']>0x0){const _0x4aecb9=_0x2ac681[_0x271d1d(0x127)](_0x47577e=>_0x47577e[_0x271d1d(0x138)])[_0x271d1d(0x13a)](',\x20'),_0x304e65=getConfigDir();console['warn'](_0x271d1d(0x112)+_0x4aecb9),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x271d1d(0x101)](_0x271d1d(0x10a)+a65_0x18aeea[_0x271d1d(0x13a)](_0x304e65,'tdx.json')),console[_0x271d1d(0x101)](_0x271d1d(0x105)),console[_0x271d1d(0x101)](_0x271d1d(0x12a));}const _0x533051=[..._0x41ceb4,..._0x2ac681],_0x393162=new Map();for(const _0x47e272 of _0x533051){!_0x393162[_0x271d1d(0x137)](_0x47e272['name'])&&_0x393162[_0x271d1d(0x12e)](_0x47e272[_0x271d1d(0x138)],_0x47e272);}return Array[_0x271d1d(0x113)](_0x393162[_0x271d1d(0x118)]())[_0x271d1d(0x144)]((_0x282f7a,_0x12f8aa)=>_0x282f7a[_0x271d1d(0x138)][_0x271d1d(0x114)](_0x12f8aa['name']));}export function profileExists(_0x145dc1){const _0x20fac5=a65_0x3315a5,_0x497c98=listProfiles();return _0x497c98[_0x20fac5(0xf6)](_0x48b8b5=>_0x48b8b5['name']===_0x145dc1);}export function loadProfile(_0x381d8a){const _0x2e3b1f=a65_0x3315a5;validateProfileName(_0x381d8a);const _0x196f1d=listProfiles(),_0x16c0a3=_0x196f1d[_0x2e3b1f(0x133)](_0x3afba8=>_0x3afba8[_0x2e3b1f(0x138)]===_0x381d8a);return _0x16c0a3||null;}export function saveProfile(_0x15ae02,_0xdbc187,_0x3c8171=![]){saveProfileToUserConfig(_0x15ae02,_0xdbc187);}export function deleteProfile(_0x2e057a){const _0x1fe862=a65_0x3315a5;validateProfileName(_0x2e057a);const _0x3464df=getProfileDir(_0x2e057a);if(!a65_0x1919df[_0x1fe862(0xfb)](_0x3464df))throw new Error(_0x1fe862(0x100)+_0x2e057a+_0x1fe862(0x10c));a65_0x1919df['rmSync'](_0x3464df,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x42d5c6,_0x168bc6){const _0x4c0d30=a65_0x3315a5;validateProfileName(_0x42d5c6);const _0x47b686=getGlobalConfigPath(),_0x22d8e1=getConfigDir();!a65_0x1919df[_0x4c0d30(0xfb)](_0x22d8e1)&&createSecureDirectory(_0x22d8e1);let _0xa05005={};if(a65_0x1919df[_0x4c0d30(0xfb)](_0x47b686))try{const _0x2a2b72=a65_0x1919df[_0x4c0d30(0x11d)](_0x47b686,_0x4c0d30(0x12c));_0xa05005=JSON[_0x4c0d30(0x10f)](_0x2a2b72);}catch{console['warn'](_0x4c0d30(0x107)+_0x47b686+_0x4c0d30(0x106));}!_0xa05005[_0x4c0d30(0x120)]&&(_0xa05005['profiles']={}),_0xa05005['profiles'][_0x42d5c6]=_0x168bc6,writeSecureFile(_0x47b686,JSON[_0x4c0d30(0x110)](_0xa05005,null,0x2));}export function removeProfileFromUserConfig(_0x292dcc){const _0x37e131=a65_0x3315a5;validateProfileName(_0x292dcc);const _0x1dc4a1=getGlobalConfigPath();if(!a65_0x1919df['existsSync'](_0x1dc4a1))throw new Error('Profile\x20\x27'+_0x292dcc+_0x37e131(0x13f));let _0x19501b={};try{const _0x451b1c=a65_0x1919df[_0x37e131(0x11d)](_0x1dc4a1,'utf-8');_0x19501b=JSON[_0x37e131(0x10f)](_0x451b1c);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0x1dc4a1);}if(!_0x19501b[_0x37e131(0x120)]||!_0x19501b[_0x37e131(0x120)][_0x292dcc])throw new Error(_0x37e131(0x124)+_0x292dcc+_0x37e131(0x13f));delete _0x19501b['profiles'][_0x292dcc],_0x19501b[_0x37e131(0xf9)]===_0x292dcc&&delete _0x19501b['profile'],writeSecureFile(_0x1dc4a1,JSON[_0x37e131(0x110)](_0x19501b,null,0x2));}export function getActiveProfile(){const _0x9c9c8a=a65_0x3315a5,_0x3873c3=loadSessionContext();if(_0x3873c3?.['profile'])return _0x3873c3[_0x9c9c8a(0xf9)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x450239=getGlobalConfigPath();if(!a65_0x1919df[_0x9c9c8a(0xfb)](_0x450239))return null;try{const _0x1751ad=a65_0x1919df[_0x9c9c8a(0x11d)](_0x450239,_0x9c9c8a(0x12c)),_0x247966=JSON[_0x9c9c8a(0x10f)](_0x1751ad);return _0x247966[_0x9c9c8a(0xf9)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x4efc42){const _0x4f15ca=a65_0x3315a5,_0x138ae5=getGlobalConfigPath(),_0x1aeae9=getConfigDir();!a65_0x1919df['existsSync'](_0x1aeae9)&&createSecureDirectory(_0x1aeae9);let _0x36e1a6={};if(a65_0x1919df[_0x4f15ca(0xfb)](_0x138ae5))try{const _0x487e42=a65_0x1919df[_0x4f15ca(0x11d)](_0x138ae5,_0x4f15ca(0x12c));_0x36e1a6=JSON[_0x4f15ca(0x10f)](_0x487e42);}catch{console[_0x4f15ca(0x101)](_0x4f15ca(0x107)+_0x138ae5+_0x4f15ca(0x106));}_0x36e1a6[_0x4f15ca(0x103)]=_0x4efc42,writeSecureFile(_0x138ae5,JSON[_0x4f15ca(0x110)](_0x36e1a6,null,0x2));}export function saveActiveProfileToUserConfig(_0x4ceb85){const _0x31401f=a65_0x3315a5;validateProfileName(_0x4ceb85);const _0x5018ec=getGlobalConfigPath(),_0x36356b=getConfigDir();!a65_0x1919df['existsSync'](_0x36356b)&&createSecureDirectory(_0x36356b);let _0x4849f4={};if(a65_0x1919df[_0x31401f(0xfb)](_0x5018ec))try{const _0x3b39bc=a65_0x1919df['readFileSync'](_0x5018ec,_0x31401f(0x12c));_0x4849f4=JSON[_0x31401f(0x10f)](_0x3b39bc);}catch{console[_0x31401f(0x101)](_0x31401f(0x107)+_0x5018ec+',\x20creating\x20new\x20file');}_0x4849f4[_0x31401f(0xf9)]=_0x4ceb85,writeSecureFile(_0x5018ec,JSON[_0x31401f(0x110)](_0x4849f4,null,0x2));}function clearFieldFromUserConfig(_0x54fcb4){const _0xa76098=a65_0x3315a5,_0x3469db=getGlobalConfigPath();if(!a65_0x1919df[_0xa76098(0xfb)](_0x3469db))return;let _0x37f51c={};try{const _0x48dc56=a65_0x1919df['readFileSync'](_0x3469db,'utf-8');_0x37f51c=JSON[_0xa76098(0x10f)](_0x48dc56);}catch{return;}delete _0x37f51c[_0x54fcb4],writeSecureFile(_0x3469db,JSON[_0xa76098(0x110)](_0x37f51c,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x1ceec3,_0x30a95e){const _0x3eb79c=a65_0x3315a5;validateProfileName(_0x1ceec3);if(profileExists(_0x1ceec3))throw new Error(_0x3eb79c(0x100)+_0x1ceec3+_0x3eb79c(0x135));saveProfile(_0x1ceec3,_0x30a95e);}export function saveProfileCredentials(_0x123d8b,_0x2b0f80){const _0x4f13a6=a65_0x3315a5;validateProfileName(_0x123d8b);if(!profileExists(_0x123d8b))throw new Error(_0x4f13a6(0x100)+_0x123d8b+_0x4f13a6(0x10c));const _0x205eeb=getNewCredentialPath(_0x123d8b);writeSecureFile(_0x205eeb,_0x2b0f80);}export function loadProfileCredentials(_0x4356da){const _0x530307=a65_0x3315a5;validateProfileName(_0x4356da);const _0x437546=getNewCredentialPath(_0x4356da);if(a65_0x1919df[_0x530307(0xfb)](_0x437546))try{return a65_0x1919df[_0x530307(0x11d)](_0x437546,_0x530307(0x12c));}catch{}const _0x44a422=getOldCredentialPath(_0x4356da);if(a65_0x1919df[_0x530307(0xfb)](_0x44a422)){console[_0x530307(0x101)](_0x530307(0x123)+_0x4356da+'\x27'),console[_0x530307(0x101)](_0x530307(0x109)),console[_0x530307(0x101)]('\x20\x20mv\x20\x22'+_0x44a422+'\x22\x20\x22'+_0x437546+'\x22'),console[_0x530307(0x101)](_0x530307(0x108));try{return a65_0x1919df[_0x530307(0x11d)](_0x44a422,_0x530307(0x12c));}catch{return null;}}return null;}
1
+ 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 a66_0x42d8(){const _0x13dbe6=['cwd','590958NWeGBN','300825YNpMOC','Failed\x20to\x20load\x20project\x20config\x20from\x20','includes','340uqYlSh',').\x20','14IyrLxX','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8','readFileSync','existsSync','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','join','4228290hbdfPa','apiKey','stringify','Warning:\x20\x27profile\x27\x20field\x20in\x20','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','297OEhVot','api_key','1010810YuKCAI','3062TBGvyr','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','\x20is\x20ignored.\x20','1332592fYCosm','TD_API_KEY','dirname','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','64071LPxaUz','8JWTqps','code'];a66_0x42d8=function(){return _0x13dbe6;};return a66_0x42d8();}(function(_0x316079,_0x378b0f){const _0x2c6bc0=a66_0x14e5,_0x30cae5=_0x316079();while(!![]){try{const _0x4280f4=-parseInt(_0x2c6bc0(0xa2))/0x1+-parseInt(_0x2c6bc0(0x96))/0x2*(parseInt(_0x2c6bc0(0x93))/0x3)+-parseInt(_0x2c6bc0(0x9e))/0x4*(-parseInt(_0x2c6bc0(0x95))/0x5)+parseInt(_0x2c6bc0(0xa1))/0x6*(-parseInt(_0x2c6bc0(0x87))/0x7)+-parseInt(_0x2c6bc0(0x99))/0x8+-parseInt(_0x2c6bc0(0x9d))/0x9*(-parseInt(_0x2c6bc0(0xa5))/0xa)+parseInt(_0x2c6bc0(0x8e))/0xb;if(_0x4280f4===_0x378b0f)break;else _0x30cae5['push'](_0x30cae5['shift']());}catch(_0x3796d1){_0x30cae5['push'](_0x30cae5['shift']());}}}(a66_0x42d8,0x34716));import*as a66_0x2f152f from'node:fs';import*as a66_0x2ab9f2 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';function a66_0x14e5(_0x40bba6,_0x1d3563){_0x40bba6=_0x40bba6-0x86;const _0x42d838=a66_0x42d8();let _0x14e500=_0x42d838[_0x40bba6];return _0x14e500;}export function findProjectConfigPath(_0x3beb87){const _0x5e2e8e=a66_0x14e5;let _0x688046=_0x3beb87||process[_0x5e2e8e(0xa0)]();while(!![]){const _0x5bbdf2=a66_0x2ab9f2[_0x5e2e8e(0x8d)](_0x688046,PROJECT_CONFIG_FILENAME);if(a66_0x2f152f[_0x5e2e8e(0x8b)](_0x5bbdf2))return _0x5bbdf2;const _0x56c64e=a66_0x2ab9f2[_0x5e2e8e(0x9b)](_0x688046);if(_0x56c64e===_0x688046)return null;_0x688046=_0x56c64e;}}export function loadProjectConfig(_0x148f66){const _0x58817b=a66_0x14e5,_0x14e014=findProjectConfigPath(_0x148f66);if(!_0x14e014)return null;try{const _0x370cc1=a66_0x2f152f[_0x58817b(0x8a)](_0x14e014,_0x58817b(0x89)),_0x3c5492=JSON['parse'](_0x370cc1),_0x53a056=JSON[_0x58817b(0x90)](_0x3c5492);if(_0x53a056['includes'](_0x58817b(0x9a))||_0x53a056[_0x58817b(0xa4)](_0x58817b(0x8f))||_0x53a056[_0x58817b(0xa4)](_0x58817b(0x94)))throw new Error(_0x58817b(0x88)+_0x14e014+_0x58817b(0x86)+_0x58817b(0x9c));const {metadata:_0x766ee3,profile:_0x33f57c,..._0x8594fe}=_0x3c5492;return _0x33f57c&&console['warn'](_0x58817b(0x91)+_0x14e014+_0x58817b(0x98)+_0x58817b(0x8c)),_0x8594fe;}catch(_0x380bac){if(_0x380bac instanceof Error&&_0x58817b(0x9f)in _0x380bac&&_0x380bac[_0x58817b(0x9f)]==='ENOENT')return null;throw new Error(_0x58817b(0xa3)+_0x14e014+':\x20'+_0x380bac);}}export function saveProjectConfig(_0x25e394,_0x3dd1f4){const _0x148d47=a66_0x14e5,_0x3ecd17=_0x3dd1f4||process[_0x148d47(0xa0)](),_0x1fc6b7=a66_0x2ab9f2[_0x148d47(0x8d)](_0x3ecd17,PROJECT_CONFIG_FILENAME),_0x5772be=JSON[_0x148d47(0x90)](_0x25e394);if(_0x5772be[_0x148d47(0xa4)](_0x148d47(0x9a))||_0x5772be[_0x148d47(0xa4)]('apiKey')||_0x5772be[_0x148d47(0xa4)](_0x148d47(0x94)))throw new Error(_0x148d47(0x97));if('profile'in _0x25e394)throw new Error(_0x148d47(0x92));a66_0x2f152f['writeFileSync'](_0x1fc6b7,JSON[_0x148d47(0x90)](_0x25e394,null,0x2));}export function hasProjectConfig(_0x4657ae){return findProjectConfigPath(_0x4657ae)!==null;}export function getProjectRoot(_0x430063){const _0x5663f2=findProjectConfigPath(_0x430063);return _0x5663f2?a66_0x2ab9f2['dirname'](_0x5663f2):null;}
1
+ 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(_0x1772b3,_0x81b553){const _0x51ccd9=a67_0x4306,_0x2bdeb6=_0x1772b3();while(!![]){try{const _0xe53369=parseInt(_0x51ccd9(0x93))/0x1+-parseInt(_0x51ccd9(0x85))/0x2+parseInt(_0x51ccd9(0x7a))/0x3+parseInt(_0x51ccd9(0x82))/0x4*(-parseInt(_0x51ccd9(0x76))/0x5)+parseInt(_0x51ccd9(0x79))/0x6+parseInt(_0x51ccd9(0x83))/0x7+-parseInt(_0x51ccd9(0x96))/0x8;if(_0xe53369===_0x81b553)break;else _0x2bdeb6['push'](_0x2bdeb6['shift']());}catch(_0x4997c2){_0x2bdeb6['push'](_0x2bdeb6['shift']());}}}(a67_0x3b6f,0xee66a));import*as a67_0x38809a from'node:fs';import*as a67_0x32b029 from'node:path';import*as a67_0x3f06f9 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x27697c=a67_0x4306,_0x2f045f=process.env.TDX_CONFIG_DIR||a67_0x32b029[_0x27697c(0x8d)](a67_0x3f06f9[_0x27697c(0x7f)](),'.config',_0x27697c(0x84));return a67_0x32b029[_0x27697c(0x8d)](_0x2f045f,'sessions');}function getSessionPath(_0x4965e7){const _0x90401c=a67_0x4306;return a67_0x32b029['join'](getSessionsDir(),_0x4965e7+_0x90401c(0x8e));}function a67_0x4306(_0x57f098,_0x46c52c){_0x57f098=_0x57f098-0x76;const _0x3b6f76=a67_0x3b6f();let _0x430684=_0x3b6f76[_0x57f098];return _0x430684;}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x2ea867){if(_0x2ea867)return _0x2ea867;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x4120ba){const _0x158408=a67_0x4306,_0x4e20cb=getSessionID(_0x4120ba),_0x4681ed=/^\d+$/[_0x158408(0x7e)](_0x4e20cb)?parseInt(_0x4e20cb,0xa):null;return _0x4681ed!==null?loadSessionContextByPID(_0x4681ed):loadSessionContextByString(_0x4e20cb);}export function loadSessionContextByPID(_0xa9a36c){const _0x2d8810=a67_0x4306,_0x1c63dd=getSessionPath(_0xa9a36c);if(!a67_0x38809a[_0x2d8810(0x7d)](_0x1c63dd))return null;try{const _0x5f38fc=a67_0x38809a[_0x2d8810(0x78)](_0x1c63dd,_0x2d8810(0x92)),_0x363507=JSON[_0x2d8810(0x8a)](_0x5f38fc),_0x335bf5=new Date(_0x363507[_0x2d8810(0x80)])[_0x2d8810(0x8c)](),_0x36c79e=Date[_0x2d8810(0x7b)]();if(_0x36c79e-_0x335bf5>SESSION_EXPIRATION_MS)return a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd),null;const _0xd73d35=JSON[_0x2d8810(0x91)](_0x363507);if(_0xd73d35[_0x2d8810(0x94)](_0x2d8810(0x8b))||_0xd73d35[_0x2d8810(0x94)](_0x2d8810(0x89))||_0xd73d35['includes'](_0x2d8810(0x95)))return console[_0x2d8810(0x86)](_0x2d8810(0x87)+_0x1c63dd+_0x2d8810(0x90)),a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd),null;return _0x363507;}catch{try{a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd);}catch{}return null;}}function loadSessionContextByString(_0x4dd4a3){const _0x56721e=a67_0x4306,_0x181856=a67_0x32b029[_0x56721e(0x8d)](getSessionsDir(),_0x4dd4a3+_0x56721e(0x8e));if(!a67_0x38809a[_0x56721e(0x7d)](_0x181856))return null;try{const _0x5c886f=a67_0x38809a['readFileSync'](_0x181856,_0x56721e(0x92)),_0x5dc5e8=JSON[_0x56721e(0x8a)](_0x5c886f),_0x3ee68c=new Date(_0x5dc5e8[_0x56721e(0x80)])['getTime'](),_0x548323=Date['now']();if(_0x548323-_0x3ee68c>SESSION_EXPIRATION_MS)return a67_0x38809a['unlinkSync'](_0x181856),null;const _0x5b9476=JSON['stringify'](_0x5dc5e8);if(_0x5b9476[_0x56721e(0x94)]('TD_API_KEY')||_0x5b9476[_0x56721e(0x94)](_0x56721e(0x89))||_0x5b9476[_0x56721e(0x94)](_0x56721e(0x95)))return console['warn'](_0x56721e(0x87)+_0x181856+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a67_0x38809a[_0x56721e(0x97)](_0x181856),null;return _0x5dc5e8;}catch{try{a67_0x38809a['unlinkSync'](_0x181856);}catch{}return null;}}export function saveSessionContext(_0x371217,_0x50bfa1){const _0x2b118c=a67_0x4306,_0x559a89=getSessionID(_0x50bfa1),_0x54ff14=/^\d+$/[_0x2b118c(0x7e)](_0x559a89)?parseInt(_0x559a89,0xa):getCurrentSessionPID(),_0x4c6201=a67_0x32b029[_0x2b118c(0x8d)](getSessionsDir(),_0x559a89+_0x2b118c(0x8e)),_0x571174=getSessionsDir();createSecureDirectory(_0x571174);const _0x267fab=JSON['stringify'](_0x371217);if(_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x8b))||_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x89))||_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x95)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x4dd08f;const _0x4a5f2c=/^\d+$/[_0x2b118c(0x7e)](_0x559a89)?loadSessionContextByPID(parseInt(_0x559a89,0xa)):loadSessionContextByString(_0x559a89);_0x4a5f2c?_0x4dd08f={..._0x4a5f2c,..._0x371217,'pid':_0x54ff14,'sessionId':_0x559a89!==_0x54ff14[_0x2b118c(0x88)]()?_0x559a89:undefined,'updatedAt':new Date()[_0x2b118c(0x81)]()}:_0x4dd08f={'pid':_0x54ff14,'sessionId':_0x559a89!==_0x54ff14['toString']()?_0x559a89:undefined,..._0x371217,'createdAt':new Date()[_0x2b118c(0x81)](),'updatedAt':new Date()[_0x2b118c(0x81)]()},a67_0x38809a[_0x2b118c(0x77)](_0x4c6201,JSON[_0x2b118c(0x91)](_0x4dd08f,null,0x2));}export function clearSessionContext(_0x38a46e){const _0x11d4fb=a67_0x4306,_0x59537d=getSessionID(_0x38a46e),_0x44ee7c=a67_0x32b029[_0x11d4fb(0x8d)](getSessionsDir(),_0x59537d+_0x11d4fb(0x8e));a67_0x38809a[_0x11d4fb(0x7d)](_0x44ee7c)&&a67_0x38809a[_0x11d4fb(0x97)](_0x44ee7c);}export function clearSessionContextField(_0x54ba19,_0x584ae2){const _0x2e5319=a67_0x4306,_0x4cd87e=getSessionID(_0x584ae2),_0x12f3a9=a67_0x32b029[_0x2e5319(0x8d)](getSessionsDir(),_0x4cd87e+_0x2e5319(0x8e));if(!a67_0x38809a['existsSync'](_0x12f3a9))return;try{const _0x36d044=a67_0x38809a[_0x2e5319(0x78)](_0x12f3a9,_0x2e5319(0x92)),_0x5ead7c=JSON[_0x2e5319(0x8a)](_0x36d044);delete _0x5ead7c[_0x54ba19],a67_0x38809a[_0x2e5319(0x77)](_0x12f3a9,JSON['stringify'](_0x5ead7c,null,0x2));}catch{}}function a67_0x3b6f(){const _0x3ba61b=['includes','api_key','7709488DCmTkG','unlinkSync','replace','sort','42170pDDhSo','writeFileSync','readFileSync','2133648XaXtXQ','46254BQAMTV','now','push','existsSync','test','homedir','createdAt','toISOString','136xnbtEP','6983942vZQDdE','tdx','712162pxjVGR','warn','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','toString','apiKey','parse','TD_API_KEY','getTime','join','.json','endsWith','.\x20This\x20is\x20insecure.\x20Removing\x20session.','stringify','utf-8','1214281oGwqKW'];a67_0x3b6f=function(){return _0x3ba61b;};return a67_0x3b6f();}export function cleanExpiredSessions(){const _0x558343=a67_0x4306,_0x1987a0=getSessionsDir();if(!a67_0x38809a[_0x558343(0x7d)](_0x1987a0))return 0x0;let _0x47cbc7=0x0;const _0x27f2c1=Date[_0x558343(0x7b)]();try{const _0x490d86=a67_0x38809a['readdirSync'](_0x1987a0);for(const _0x424687 of _0x490d86){if(!_0x424687[_0x558343(0x8f)](_0x558343(0x8e)))continue;const _0x5d06a4=a67_0x32b029[_0x558343(0x8d)](_0x1987a0,_0x424687),_0x48d2c5=_0x424687[_0x558343(0x98)](_0x558343(0x8e),''),_0x1dc087=parseInt(_0x48d2c5,0xa),_0x3bc07a=!isNaN(_0x1dc087);if(_0x3bc07a){if(!isProcessRunning(_0x1dc087)){a67_0x38809a['unlinkSync'](_0x5d06a4),_0x47cbc7++;continue;}}try{const _0x13dd82=a67_0x38809a[_0x558343(0x78)](_0x5d06a4,_0x558343(0x92)),_0x542d19=JSON['parse'](_0x13dd82),_0xf0eccb=new Date(_0x542d19[_0x558343(0x80)])[_0x558343(0x8c)]();_0x27f2c1-_0xf0eccb>SESSION_EXPIRATION_MS&&(a67_0x38809a['unlinkSync'](_0x5d06a4),_0x47cbc7++);}catch{a67_0x38809a[_0x558343(0x97)](_0x5d06a4),_0x47cbc7++;}}}catch{}return _0x47cbc7;}export function listActiveSessions(){const _0x41b3ee=a67_0x4306,_0x43d56f=getSessionsDir();if(!a67_0x38809a[_0x41b3ee(0x7d)](_0x43d56f))return[];try{const _0x167cda=a67_0x38809a['readdirSync'](_0x43d56f),_0x3cb317=[];for(const _0x120cbf of _0x167cda){if(!_0x120cbf[_0x41b3ee(0x8f)](_0x41b3ee(0x8e)))continue;const _0x55c624=_0x120cbf[_0x41b3ee(0x98)](_0x41b3ee(0x8e),''),_0xd9ae22=parseInt(_0x55c624,0xa);!isNaN(_0xd9ae22)&&isProcessRunning(_0xd9ae22)&&_0x3cb317[_0x41b3ee(0x7c)](_0xd9ae22);}return _0x3cb317[_0x41b3ee(0x99)]((_0x3c4cfa,_0x35ff02)=>_0x3c4cfa-_0x35ff02);}catch{return[];}}
1
+ 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_0x45998c=a68_0x5f1c;(function(_0x54a383,_0x44d52b){const _0x22ca9e=a68_0x5f1c,_0x3fb006=_0x54a383();while(!![]){try{const _0x10790f=parseInt(_0x22ca9e(0x8b))/0x1+parseInt(_0x22ca9e(0x85))/0x2+-parseInt(_0x22ca9e(0x8a))/0x3+parseInt(_0x22ca9e(0x89))/0x4+parseInt(_0x22ca9e(0x8c))/0x5+parseInt(_0x22ca9e(0x84))/0x6+-parseInt(_0x22ca9e(0x8e))/0x7*(parseInt(_0x22ca9e(0x83))/0x8);if(_0x10790f===_0x44d52b)break;else _0x3fb006['push'](_0x3fb006['shift']());}catch(_0x411835){_0x3fb006['push'](_0x3fb006['shift']());}}}(a68_0x41a0,0x506aa));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x45998c(0x90),'core/user-cache');export function loadCachedUsers(_0xe39624){const _0x5f5545=a68_0x45998c,_0x35a49e=userCache[_0x5f5545(0x86)](_0xe39624);return _0x35a49e?.[_0x5f5545(0x8f)]??null;}export function saveCachedUsers(_0x4c287f,_0x13099d){const _0x2eae4b=a68_0x45998c;userCache[_0x2eae4b(0x87)](_0x4c287f,{'users':_0x13099d,'cachedAt':Date[_0x2eae4b(0x8d)]()});}export function clearUserCache(_0x6b759b){const _0xdbeadd=a68_0x45998c;userCache[_0xdbeadd(0x88)](_0x6b759b);}function a68_0x5f1c(_0x58ef73,_0x247c51){_0x58ef73=_0x58ef73-0x83;const _0x41a0a7=a68_0x41a0();let _0x5f1c65=_0x41a0a7[_0x58ef73];return _0x5f1c65;}function a68_0x41a0(){const _0x3139b3=['read','write','clear','2369320NhrOgO','708561ENNwZA','330784aScqWL','1052615LxeSze','now','9328781HiMQoQ','users','users-{profile}.json','8UwxJGt','701304ansqAm','1295470XkoiHX'];a68_0x41a0=function(){return _0x3139b3;};return a68_0x41a0();}
1
+ 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(_0x22ad37,_0x24fede){const _0x4b7a43=a69_0x37d0,_0x1915ef=_0x22ad37();while(!![]){try{const _0x5b1b62=-parseInt(_0x4b7a43(0x170))/0x1*(-parseInt(_0x4b7a43(0x16f))/0x2)+-parseInt(_0x4b7a43(0x173))/0x3+parseInt(_0x4b7a43(0x164))/0x4*(-parseInt(_0x4b7a43(0x168))/0x5)+-parseInt(_0x4b7a43(0x16d))/0x6*(parseInt(_0x4b7a43(0x16a))/0x7)+-parseInt(_0x4b7a43(0x16b))/0x8+-parseInt(_0x4b7a43(0x166))/0x9*(parseInt(_0x4b7a43(0x162))/0xa)+-parseInt(_0x4b7a43(0x165))/0xb*(-parseInt(_0x4b7a43(0x163))/0xc);if(_0x5b1b62===_0x24fede)break;else _0x1915ef['push'](_0x1915ef['shift']());}catch(_0x332bc8){_0x1915ef['push'](_0x1915ef['shift']());}}}(a69_0xc253,0xabaa9));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a69_0x37d0(_0x22fab1,_0x454187){_0x22fab1=_0x22fab1-0x161;const _0xc2536a=a69_0xc253();let _0x37d0e0=_0xc2536a[_0x22fab1];return _0x37d0e0;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x59e16e=a69_0x37d0;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4738ad=fileURLToPath(import.meta.url),_0x40a250=dirname(_0x4738ad);try{const _0x3e6ad6=join(_0x40a250,_0x59e16e(0x172));cachedBuildInfo=JSON[_0x59e16e(0x171)](readFileSync(_0x3e6ad6,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}function a69_0xc253(){const _0x51ef23=['5ynvAfR','version','7KvaaMq','1683432zcPaDq','../../package.json','3832806GxKyQz','.dev','4oSRice','55299VpICfK','parse','../build-info.json','3459021fdMuCU','utf-8','10zAHClN','180vwiWqY','4247828VmmPFH','3458972InVjjV','9540351GfWCoK','includes'];a69_0xc253=function(){return _0x51ef23;};return a69_0xc253();}export function getVersion(){const _0x3a9c51=a69_0x37d0;if(cachedVersion!==null)return cachedVersion;const _0x5db132=fileURLToPath(import.meta.url),_0x4360ba=dirname(_0x5db132),_0x5c8ad9=getBuildInfo();if(_0x5c8ad9[_0x3a9c51(0x169)])return cachedVersion=_0x5c8ad9['version'],cachedVersion;try{const _0x37f38e=join(_0x4360ba,_0x3a9c51(0x16c)),_0x4e9c2f=JSON[_0x3a9c51(0x171)](readFileSync(_0x37f38e,_0x3a9c51(0x161)));cachedVersion=_0x4e9c2f['version'];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x2311c3=a69_0x37d0,_0x11badf=getVersion();return _0x11badf['includes'](_0x2311c3(0x16e))||_0x11badf[_0x2311c3(0x167)]('-');}
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']('-');}