@treasuredata/tdx 2026.4.0 → 2026.4.2

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 (219) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- const a57_0x12f73d=a57_0x4042;(function(_0x3329d,_0x4f2317){const _0x1ae65e=a57_0x4042,_0x3208e6=_0x3329d();while(!![]){try{const _0x1f15ae=parseInt(_0x1ae65e(0xdd))/0x1+parseInt(_0x1ae65e(0xe7))/0x2+parseInt(_0x1ae65e(0xd0))/0x3+parseInt(_0x1ae65e(0xc9))/0x4*(-parseInt(_0x1ae65e(0xf1))/0x5)+parseInt(_0x1ae65e(0xe0))/0x6+-parseInt(_0x1ae65e(0xfd))/0x7*(parseInt(_0x1ae65e(0xcb))/0x8)+-parseInt(_0x1ae65e(0xf2))/0x9*(-parseInt(_0x1ae65e(0xb2))/0xa);if(_0x1f15ae===_0x4f2317)break;else _0x3208e6['push'](_0x3208e6['shift']());}catch(_0x19460c){_0x3208e6['push'](_0x3208e6['shift']());}}}(a57_0xd3cb,0xa7509));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x197fd2 from'node:fs';import*as a57_0x343706 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_0x1ad366 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x212892=a57_0x4042;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x212892(0xeb),_0x212892(0xc1));}export function getConfigFile(){const _0x1e77ed=a57_0x4042;return join(getConfigDir(),_0x1e77ed(0xd8));}export function getConfigFilePath(_0x4468ab){const _0x37c7f7=a57_0x4042,_0x4661ae=getConfigDir();return _0x4468ab?a57_0x343706[_0x37c7f7(0xb8)](_0x4661ae,_0x37c7f7(0xcd)+_0x4468ab):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x12f73d(0xc0),a57_0x12f73d(0xd5));export function getLLMProjectCacheFile(_0x1a1ef7){const _0x5c19c2=a57_0x12f73d;return llmProjectCache[_0x5c19c2(0xd6)](_0x1a1ef7);}export function readCachedLLMProject(_0x46b18d){const _0x4312e4=a57_0x12f73d,_0x41ecd0=llmProjectCache[_0x4312e4(0xc8)](_0x46b18d);if(_0x41ecd0&&typeof _0x41ecd0['id']===_0x4312e4(0xda)&&typeof _0x41ecd0[_0x4312e4(0xe5)]===_0x4312e4(0xda))return _0x41ecd0;return null;}export function writeCachedLLMProject(_0x46db99,_0xc79a38,_0x4b5ed6){const _0x265d67=a57_0x12f73d;try{llmProjectCache[_0x265d67(0xc6)]({'name':_0x46db99,'id':_0xc79a38},_0x4b5ed6);}catch{}}function a57_0xd3cb(){const _0x576a61=['split','includes','source','30471vVKZKX','tdx.json','6950210sXcDAI','config/llm-agent','accessToken','stg-us01','us01','toISOString','join','release_channel','account_info','trim','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','TDX_API_KEY\x20env\x20var','TD_API_KEY','proxy','llm_default_project','tdx','keychain','config/account-info','eu01','some','write','ap01','read','302964ZnOmWl','existsSync','2224mUiPzw','clear','.env.','stg-ap03','dev-us01','3557277MhFypH','apiKey','stg-ap01','readFileSync','slice','config/llm-project','path','ap03','.env','entries','string','TDX_ACCESS_TOKEN_','replace','86719XTZBwI','toUpperCase','TDX_ACCESS_TOKEN\x20env\x20var','882420LeLODz','match','keychain\x20(profile:\x20','TDX_API_KEY_','next','name','\x27,\x20defaulting\x20to\x20us01','1834002xtThXa','.json','TDX_ACCESS_TOKEN_FILE','parse','.config','llm_default_agent','number','dev-eu01','TD_API_KEY_','utf-8','75hqpHBT','9yLgtSw','endsWith','\x20env\x20var','Warning:\x20Unknown\x20site\x20\x27','warn','startsWith','stable','map'];a57_0xd3cb=function(){return _0x576a61;};return a57_0xd3cb();}const llmAgentCache=createOptionalProfileCache(a57_0x12f73d(0xec),a57_0x12f73d(0xb3));export function getLLMAgentCacheFile(_0xd2112){const _0x1dd768=a57_0x12f73d;return llmAgentCache[_0x1dd768(0xd6)](_0xd2112);}export function readCachedLLMAgent(_0x45f2d5){const _0x2ac1b3=a57_0x12f73d,_0x254e37=llmAgentCache[_0x2ac1b3(0xc8)](_0x45f2d5);if(_0x254e37&&typeof _0x254e37['id']==='string'&&typeof _0x254e37[_0x2ac1b3(0xe5)]===_0x2ac1b3(0xda)&&typeof _0x254e37['projectId']===_0x2ac1b3(0xda))return _0x254e37;return null;}export function writeCachedLLMAgent(_0x335a06,_0x4a277b,_0x33a032,_0x4b3bd4){const _0x2d4c9f=a57_0x12f73d;try{llmAgentCache[_0x2d4c9f(0xc6)]({'name':_0x335a06,'id':_0x4a277b,'projectId':_0x33a032},_0x4b3bd4);}catch{}}export function clearCachedLLMAgent(_0x2220d5){const _0x3b2187=a57_0x12f73d;try{llmAgentCache[_0x3b2187(0xcc)](_0x2220d5);}catch{}}function a57_0x4042(_0x4fb250,_0x37fd19){_0x4fb250=_0x4fb250-0xb1;const _0xd3cb54=a57_0xd3cb();let _0x40426b=_0xd3cb54[_0x4fb250];return _0x40426b;}const accountInfoCache=createOptionalProfileCache(a57_0x12f73d(0xba),a57_0x12f73d(0xc3),{'suffix':a57_0x12f73d(0xe8)});export function getAccountInfoCacheFile(_0x599b90){const _0x23682d=a57_0x12f73d;return accountInfoCache[_0x23682d(0xd6)](_0x599b90);}export function readCachedAccountInfo(_0x21faab){const _0x10d138=a57_0x12f73d,_0x12f3e1=accountInfoCache[_0x10d138(0xc8)](_0x21faab);if(_0x12f3e1&&typeof _0x12f3e1['site']==='string'&&typeof _0x12f3e1['accountId']===_0x10d138(0xed))return _0x12f3e1;return null;}export function writeCachedAccountInfo(_0x57dc97,_0x11b80f,_0x22e080){const _0x2c36eb=a57_0x12f73d;try{accountInfoCache[_0x2c36eb(0xc6)]({'site':_0x57dc97,'accountId':_0x11b80f,'cachedAt':new Date()[_0x2c36eb(0xb7)]()},_0x22e080);}catch{}}export function parseEnvFile(_0x2c11f5){const _0x335e6e=a57_0x12f73d,_0x2cea72={};for(const _0x20d023 of _0x2c11f5['split']('\x0a')){const _0xa2dc84=_0x20d023[_0x335e6e(0xbb)]();if(!_0xa2dc84||_0xa2dc84['startsWith']('#'))continue;const _0x9ad200=_0xa2dc84[_0x335e6e(0xe1)](/^([^=]+)=(.*)$/);if(_0x9ad200){const _0x28d08b=_0x9ad200[0x1]['trim']();let _0x2174c3=_0x9ad200[0x2][_0x335e6e(0xbb)]();(_0x2174c3[_0x335e6e(0xf7)]('\x22')&&_0x2174c3[_0x335e6e(0xf3)]('\x22')||_0x2174c3[_0x335e6e(0xf7)]('\x27')&&_0x2174c3[_0x335e6e(0xf3)]('\x27'))&&(_0x2174c3=_0x2174c3[_0x335e6e(0xd4)](0x1,-0x1)),_0x2cea72[_0x28d08b]=_0x2174c3;}}return _0x2cea72;}export function readUserConfig(){const _0x5491f0=getConfigFile();if(!existsSync(_0x5491f0))return{};try{const _0x341142=readFileSync(_0x5491f0,'utf-8');return parseEnvFile(_0x341142);}catch(_0x1151f8){return console['warn']('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x5491f0+':',_0x1151f8),{};}}export function resolveSite(_0xa38b37){const _0x7b5ac0=a57_0x12f73d,_0x3db9a2=[_0x7b5ac0(0xb6),_0x7b5ac0(0xc7),_0x7b5ac0(0xc4),'ap02',_0x7b5ac0(0xd7),_0x7b5ac0(0xcf),_0x7b5ac0(0xee),_0x7b5ac0(0xb5),_0x7b5ac0(0xd2),_0x7b5ac0(0xce)];if(_0x3db9a2[_0x7b5ac0(0xfb)](_0xa38b37))return _0xa38b37;if(_0xa38b37 in SITE_ALIASES)return SITE_ALIASES[_0xa38b37];return console[_0x7b5ac0(0xf6)](_0x7b5ac0(0xf5)+_0xa38b37+_0x7b5ac0(0xe6)),_0x7b5ac0(0xb6);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x21d2ba){const _0x152762=a57_0x12f73d,_0x487ba2=_0x21d2ba||getActiveProfileName()||undefined;if(_0x487ba2){const _0x2081aa=_0x152762(0xdb)+normalizeProfileForEnvVar(_0x487ba2);if(process.env[_0x2081aa])return{'accessToken':process.env[_0x2081aa],'source':_0x2081aa+_0x152762(0xf4)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x152762(0xdf)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x13b184=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x13b184)return{'accessToken':_0x13b184,'source':_0x152762(0xe9)};}return null;}function readAccessTokenFile(_0x1012e0){const _0x213dd5=a57_0x12f73d;try{const _0x66b69d=readFileSync(_0x1012e0,_0x213dd5(0xf0))[_0x213dd5(0xbb)]();return _0x66b69d||null;}catch{return null;}}export function getAccessToken(_0x43a8e8){const _0x52b987=a57_0x12f73d;return resolveAccessToken(_0x43a8e8)?.[_0x52b987(0xb4)];}export function getAPIKey(_0xd8a32b){const _0x7e6e55=a57_0x12f73d,_0x364eb6=_0xd8a32b||getActiveProfileName();if(_0x364eb6){const _0x3b312e=_0x7e6e55(0xe3)+normalizeProfileForEnvVar(_0x364eb6);if(process.env[_0x3b312e])return process.env[_0x3b312e];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x55fe7a){const _0x3133e0=a57_0x12f73d;return _0x55fe7a[_0x3133e0(0xde)]()[_0x3133e0(0xdc)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x3497dc,_0x545166){const _0x5e3cf5=a57_0x12f73d,_0xc3d338=resolveAccessToken(_0x545166);if(_0xc3d338)return{'apiKey':_0xc3d338[_0x5e3cf5(0xb4)],'source':_0xc3d338[_0x5e3cf5(0xfc)],'isDeprecated':![]};const _0x45270e=_0x545166||getActiveProfileName()||undefined;if(_0x45270e){const _0x481318=_0x5e3cf5(0xe3)+normalizeProfileForEnvVar(_0x45270e);if(process.env[_0x481318])return{'apiKey':process.env[_0x481318],'source':_0x481318+_0x5e3cf5(0xf4),'isDeprecated':![]};const _0x1d79fa=getCachedCredential(_0x3497dc,_0x45270e);if(_0x1d79fa)return{'apiKey':_0x1d79fa,'source':_0x5e3cf5(0xe2)+_0x45270e+')','isDeprecated':![]};const _0x17af7f=await getKeychainAPIKey(_0x45270e);if(_0x17af7f)return setCachedCredential(_0x17af7f,_0x3497dc,_0x45270e),{'apiKey':_0x17af7f,'source':'keychain\x20(profile:\x20'+_0x45270e+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x5e3cf5(0xbd),'isDeprecated':![]};if(!_0x45270e){const _0x3391b2=getCachedCredential(_0x3497dc,undefined);if(_0x3391b2)return{'apiKey':_0x3391b2,'source':'keychain','isDeprecated':![]};const _0x928b47=await getKeychainAPIKey(undefined);if(_0x928b47)return setCachedCredential(_0x928b47,_0x3497dc,undefined),{'apiKey':_0x928b47,'source':_0x5e3cf5(0xc2),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x5c72e4,_0x110d3e){const _0x2a1b30=a57_0x12f73d,_0x52129f=await resolveAPIKeyAsync(_0x5c72e4,_0x110d3e);return _0x52129f?.[_0x2a1b30(0xd1)];}function cleanupLegacyEnvFile(_0x22bbb6){const _0x405774=a57_0x12f73d;if(!existsSync(_0x22bbb6))return![];try{const _0x4aa959=readFileSync(_0x22bbb6,_0x405774(0xf0)),_0x75b826=_0x4aa959[_0x405774(0xfa)]('\x0a'),_0x149b20=_0x75b826['filter'](_0x330b62=>{const _0x40c7f4=_0x405774,_0xc51e86=_0x330b62[_0x40c7f4(0xbb)]();if(!_0xc51e86||_0xc51e86['startsWith']('#'))return!![];const [_0x6c31e3]=_0xc51e86[_0x40c7f4(0xfa)]('=');return!_0x6c31e3[_0x40c7f4(0xf7)](_0x40c7f4(0xbe));}),_0x269288=_0x149b20[_0x405774(0xc5)](_0x3139f2=>{const _0x5383c8=_0x405774,_0x271dcf=_0x3139f2[_0x5383c8(0xbb)]();return _0x271dcf&&!_0x271dcf['startsWith']('#');});if(!_0x269288)return unlinkSync(_0x22bbb6),!![];return writeFileSync(_0x22bbb6,_0x149b20[_0x405774(0xb8)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x59a826=a57_0x12f73d;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x189613=a57_0x343706[_0x59a826(0xb8)](getConfigDir(),_0x59a826(0xb1));if(!a57_0x197fd2[_0x59a826(0xca)](_0x189613))return null;try{const _0x1ad6a6=a57_0x197fd2[_0x59a826(0xd3)](_0x189613,_0x59a826(0xf0)),_0x51079c=JSON[_0x59a826(0xea)](_0x1ad6a6);return _0x51079c['profile']||null;}catch{return null;}}export function saveAPIKey(_0x14a025,_0x468bdd,_0x2dae1c){const _0x221a8f=a57_0x12f73d,_0x435f73=getConfigDir(),_0x4903e8=getConfigFilePath(_0x2dae1c);!existsSync(_0x435f73)&&mkdirSync(_0x435f73,{'recursive':!![],'mode':0x1c0});let _0x1cdbde={};if(existsSync(_0x4903e8))try{const _0x5a1d05=readFileSync(_0x4903e8,'utf-8');_0x1cdbde=parseEnvFile(_0x5a1d05);}catch(_0x3f285b){console[_0x221a8f(0xf6)]('Warning:\x20Failed\x20to\x20read\x20'+_0x4903e8+':',_0x3f285b);}const _0x4e42e4=_0x14a025['toUpperCase']()[_0x221a8f(0xdc)](/-/g,'_');_0x1cdbde[_0x221a8f(0xef)+_0x4e42e4]=_0x468bdd;const _0x9e792d=Object[_0x221a8f(0xd9)](_0x1cdbde)[_0x221a8f(0xf9)](([_0x5d4abc,_0x555240])=>_0x5d4abc+'='+_0x555240);writeFileSync(_0x4903e8,_0x9e792d[_0x221a8f(0xb8)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x3ef509,_0x1a6589,_0x4b612f){const _0xdb88ff=a57_0x12f73d;await saveKeychainAPIKey(_0x3ef509,_0x4b612f),setCachedCredential(_0x3ef509,_0x1a6589,_0x4b612f);const _0x4d8f33=getConfigFilePath(_0x4b612f);cleanupLegacyEnvFile(_0x4d8f33)&&console[_0xdb88ff(0xf6)](a57_0x1ad366['yellow'](_0xdb88ff(0xbc)));}export function loadConfig(){const _0x48de69=a57_0x12f73d,_0x32989e={'apiKeys':{},'defaultSite':_0x48de69(0xb6)},_0x5eed86=[_0x48de69(0xb6),_0x48de69(0xc7),_0x48de69(0xc4),'ap02',_0x48de69(0xd7),_0x48de69(0xcf),_0x48de69(0xee),'stg-us01',_0x48de69(0xd2),_0x48de69(0xce)],_0x39a34e=getAPIKey();if(_0x39a34e)for(const _0x328728 of _0x5eed86){_0x32989e['apiKeys'][_0x328728]=_0x39a34e;}return _0x32989e;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x2e172f=a57_0x12f73d,_0x5c2e9b=a57_0x343706[_0x2e172f(0xb8)](getConfigDir(),'tdx.json');if(!a57_0x197fd2[_0x2e172f(0xca)](_0x5c2e9b))return undefined;try{const _0x4caf61=a57_0x197fd2[_0x2e172f(0xd3)](_0x5c2e9b,_0x2e172f(0xf0)),_0x27e9b2=JSON[_0x2e172f(0xea)](_0x4caf61);return typeof _0x27e9b2[_0x2e172f(0xbf)]===_0x2e172f(0xda)?_0x27e9b2['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x3afe5b=a57_0x12f73d,_0x43b4a7=process.env.TDX_RELEASE_CHANNEL;if(_0x43b4a7===_0x3afe5b(0xe4)||_0x43b4a7===_0x3afe5b(0xf8))return _0x43b4a7;const _0x1764dd=a57_0x343706[_0x3afe5b(0xb8)](getConfigDir(),_0x3afe5b(0xb1));if(!a57_0x197fd2[_0x3afe5b(0xca)](_0x1764dd))return _0x3afe5b(0xf8);try{const _0x22ac46=a57_0x197fd2[_0x3afe5b(0xd3)](_0x1764dd,_0x3afe5b(0xf0)),_0x32a912=JSON[_0x3afe5b(0xea)](_0x22ac46);if(_0x32a912[_0x3afe5b(0xb9)]===_0x3afe5b(0xe4))return _0x3afe5b(0xe4);}catch{}return _0x3afe5b(0xf8);}export function saveReleaseChannel(_0x16b77e){const _0x3a5842=a57_0x12f73d,_0x3535e7=getConfigDir(),_0x99adce=a57_0x343706[_0x3a5842(0xb8)](_0x3535e7,'tdx.json');!existsSync(_0x3535e7)&&mkdirSync(_0x3535e7,{'recursive':!![],'mode':0x1c0});let _0x535c54={};if(existsSync(_0x99adce))try{const _0x11a6e5=readFileSync(_0x99adce,_0x3a5842(0xf0));_0x535c54=JSON['parse'](_0x11a6e5);}catch{}_0x535c54[_0x3a5842(0xb9)]=_0x16b77e,writeFileSync(_0x99adce,JSON['stringify'](_0x535c54,null,0x2),{'mode':0x180});}
1
+ const a57_0x410a1c=a57_0x2968;(function(_0x4b290f,_0x322ce3){const _0x4ce625=a57_0x2968,_0x2cfa68=_0x4b290f();while(!![]){try{const _0xad1a32=parseInt(_0x4ce625(0x214))/0x1+-parseInt(_0x4ce625(0x1fa))/0x2+parseInt(_0x4ce625(0x211))/0x3*(-parseInt(_0x4ce625(0x20c))/0x4)+-parseInt(_0x4ce625(0x23b))/0x5*(-parseInt(_0x4ce625(0x232))/0x6)+-parseInt(_0x4ce625(0x21e))/0x7+-parseInt(_0x4ce625(0x22f))/0x8*(parseInt(_0x4ce625(0x236))/0x9)+parseInt(_0x4ce625(0x22d))/0xa;if(_0xad1a32===_0x322ce3)break;else _0x2cfa68['push'](_0x2cfa68['shift']());}catch(_0xa71c37){_0x2cfa68['push'](_0x2cfa68['shift']());}}}(a57_0x5992,0x41719));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x40ff0a from'node:fs';import*as a57_0x5da7a3 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_0x5d53b9 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x4d5901=a57_0x2968;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x4d5901(0x228));}export function getConfigFile(){const _0x4dd78f=a57_0x2968;return join(getConfigDir(),_0x4dd78f(0x212));}export function getConfigFilePath(_0x3e54ba){const _0x5ca4f1=a57_0x2968,_0xf21b45=getConfigDir();return _0x3e54ba?a57_0x5da7a3['join'](_0xf21b45,_0x5ca4f1(0x1f7)+_0x3e54ba):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x410a1c(0x221),a57_0x410a1c(0x20e));export function getLLMProjectCacheFile(_0x3f0ab6){const _0x26cb00=a57_0x410a1c;return llmProjectCache[_0x26cb00(0x204)](_0x3f0ab6);}export function readCachedLLMProject(_0x51182f){const _0x1a9183=a57_0x410a1c,_0x7185ed=llmProjectCache[_0x1a9183(0x22c)](_0x51182f);if(_0x7185ed&&typeof _0x7185ed['id']===_0x1a9183(0x21c)&&typeof _0x7185ed[_0x1a9183(0x223)]===_0x1a9183(0x21c))return _0x7185ed;return null;}export function writeCachedLLMProject(_0x14f1dc,_0x19c701,_0x7069b6){const _0x11201d=a57_0x410a1c;try{llmProjectCache[_0x11201d(0x1f1)]({'name':_0x14f1dc,'id':_0x19c701},_0x7069b6);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x410a1c(0x217),'config/llm-agent');export function getLLMAgentCacheFile(_0x2773f2){const _0x2930d7=a57_0x410a1c;return llmAgentCache[_0x2930d7(0x204)](_0x2773f2);}export function readCachedLLMAgent(_0x1e2921){const _0x201504=a57_0x410a1c,_0x1a7686=llmAgentCache['read'](_0x1e2921);if(_0x1a7686&&typeof _0x1a7686['id']===_0x201504(0x21c)&&typeof _0x1a7686['name']===_0x201504(0x21c)&&typeof _0x1a7686[_0x201504(0x21f)]===_0x201504(0x21c))return _0x1a7686;return null;}export function writeCachedLLMAgent(_0x50d3e9,_0x514ed0,_0x33720e,_0x3b1cb3){const _0x143ddb=a57_0x410a1c;try{llmAgentCache[_0x143ddb(0x1f1)]({'name':_0x50d3e9,'id':_0x514ed0,'projectId':_0x33720e},_0x3b1cb3);}catch{}}export function clearCachedLLMAgent(_0x424fe7){const _0x175b17=a57_0x410a1c;try{llmAgentCache[_0x175b17(0x230)](_0x424fe7);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x410a1c(0x233),a57_0x410a1c(0x208),{'suffix':'.json'});export function getAccountInfoCacheFile(_0xddbe9){return accountInfoCache['path'](_0xddbe9);}export function readCachedAccountInfo(_0x5dccdf){const _0x21e34=a57_0x410a1c,_0x4cf2fe=accountInfoCache['read'](_0x5dccdf);if(_0x4cf2fe&&typeof _0x4cf2fe[_0x21e34(0x207)]===_0x21e34(0x21c)&&typeof _0x4cf2fe[_0x21e34(0x203)]==='number')return _0x4cf2fe;return null;}export function writeCachedAccountInfo(_0x1e258e,_0x59bf39,_0x234d45){const _0x1ff497=a57_0x410a1c;try{accountInfoCache[_0x1ff497(0x1f1)]({'site':_0x1e258e,'accountId':_0x59bf39,'cachedAt':new Date()[_0x1ff497(0x220)]()},_0x234d45);}catch{}}export function parseEnvFile(_0x4d71f5){const _0x49167c=a57_0x410a1c,_0x5da088={};for(const _0x1bc633 of _0x4d71f5[_0x49167c(0x20f)]('\x0a')){const _0x54ac05=_0x1bc633[_0x49167c(0x209)]();if(!_0x54ac05||_0x54ac05[_0x49167c(0x21b)]('#'))continue;const _0x396e3e=_0x54ac05[_0x49167c(0x231)](/^([^=]+)=(.*)$/);if(_0x396e3e){const _0x192afc=_0x396e3e[0x1]['trim']();let _0x2a36b4=_0x396e3e[0x2][_0x49167c(0x209)]();(_0x2a36b4[_0x49167c(0x21b)]('\x22')&&_0x2a36b4['endsWith']('\x22')||_0x2a36b4[_0x49167c(0x21b)]('\x27')&&_0x2a36b4[_0x49167c(0x21d)]('\x27'))&&(_0x2a36b4=_0x2a36b4[_0x49167c(0x218)](0x1,-0x1)),_0x5da088[_0x192afc]=_0x2a36b4;}}return _0x5da088;}export function readUserConfig(){const _0xcd5dd5=a57_0x410a1c,_0x436d39=getConfigFile();if(!existsSync(_0x436d39))return{};try{const _0x5ec64a=readFileSync(_0x436d39,_0xcd5dd5(0x238));return parseEnvFile(_0x5ec64a);}catch(_0x305212){return console[_0xcd5dd5(0x225)](_0xcd5dd5(0x23d)+_0x436d39+':',_0x305212),{};}}export function resolveSite(_0x59aa46){const _0x4f778c=a57_0x410a1c,_0x15f2dd=[_0x4f778c(0x226),_0x4f778c(0x23a),_0x4f778c(0x227),_0x4f778c(0x1f8),_0x4f778c(0x1f2),_0x4f778c(0x23c),_0x4f778c(0x215),_0x4f778c(0x1f0),_0x4f778c(0x205),_0x4f778c(0x1fc)];if(_0x15f2dd[_0x4f778c(0x222)](_0x59aa46))return _0x59aa46;if(_0x59aa46 in SITE_ALIASES)return SITE_ALIASES[_0x59aa46];return console[_0x4f778c(0x225)](_0x4f778c(0x210)+_0x59aa46+_0x4f778c(0x1f3)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x3a3311){const _0x45af72=a57_0x410a1c,_0x1b2225=_0x3a3311||getActiveProfileName()||undefined;if(_0x1b2225){const _0x2be3bf=_0x45af72(0x1ef)+normalizeProfileForEnvVar(_0x1b2225);if(process.env[_0x2be3bf])return{'accessToken':process.env[_0x2be3bf],'source':_0x2be3bf+_0x45af72(0x1f5)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':'TDX_ACCESS_TOKEN\x20env\x20var'};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x3a62c5=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x3a62c5)return{'accessToken':_0x3a62c5,'source':_0x45af72(0x21a)};}return null;}function readAccessTokenFile(_0x460833){const _0x193523=a57_0x410a1c;try{const _0x645684=readFileSync(_0x460833,_0x193523(0x238))[_0x193523(0x209)]();return _0x645684||null;}catch{return null;}}export function getAccessToken(_0x590608){const _0x42e6c6=a57_0x410a1c;return resolveAccessToken(_0x590608)?.[_0x42e6c6(0x22b)];}function a57_0x5992(){const _0x4248f7=['account_info','TD_API_KEY_','TD_API_KEY','4135050dWxjpG','apiKeys','utf-8','entries','ap01','48520fCVBgB','dev-us01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','TDX_ACCESS_TOKEN_','stg-us01','write','ap03','\x27,\x20defaulting\x20to\x20us01','keychain','\x20env\x20var','profile','.env.','ap02','proxy','521516YMaJRZ','readFileSync','stg-ap03','parse','Warning:\x20Failed\x20to\x20read\x20','keychain\x20(profile:\x20','toUpperCase','existsSync','join','accountId','path','stg-ap01','TDX_API_KEY_','site','config/account-info','trim','stable','release_channel','60wxgFSF','filter','config/llm-project','split','Warning:\x20Unknown\x20site\x20\x27','8958NjJQcH','.env','tdx.json','160400ltIyBn','dev-eu01','TDX_API_KEY\x20env\x20var','llm_default_agent','slice','stringify','TDX_ACCESS_TOKEN_FILE','startsWith','string','endsWith','3350466Oyacsz','projectId','toISOString','llm_default_project','includes','name','apiKey','warn','us01','eu01','tdx','replace','some','accessToken','read','10601730ihbmlR','map','8OWQGuM','clear','match','180HZNVzK'];a57_0x5992=function(){return _0x4248f7;};return a57_0x5992();}export function getAPIKey(_0x5b2481){const _0x3f92c0=_0x5b2481||getActiveProfileName();if(_0x3f92c0){const _0x1960cc='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x3f92c0);if(process.env[_0x1960cc])return process.env[_0x1960cc];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x5a37a8){const _0x48db0e=a57_0x410a1c;return _0x5a37a8[_0x48db0e(0x200)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x48948f,_0x2e520){const _0x29e9a7=a57_0x410a1c,_0x45f585=resolveAccessToken(_0x2e520);if(_0x45f585)return{'apiKey':_0x45f585[_0x29e9a7(0x22b)],'source':_0x45f585['source'],'isDeprecated':![]};const _0x598d82=_0x2e520||getActiveProfileName()||undefined;if(_0x598d82){const _0x54fb60=_0x29e9a7(0x206)+normalizeProfileForEnvVar(_0x598d82);if(process.env[_0x54fb60])return{'apiKey':process.env[_0x54fb60],'source':_0x54fb60+'\x20env\x20var','isDeprecated':![]};const _0x3c5d62=getCachedCredential(_0x48948f,_0x598d82);if(_0x3c5d62)return{'apiKey':_0x3c5d62,'source':'keychain\x20(profile:\x20'+_0x598d82+')','isDeprecated':![]};const _0x13d2f4=await getKeychainAPIKey(_0x598d82);if(_0x13d2f4)return setCachedCredential(_0x13d2f4,_0x48948f,_0x598d82),{'apiKey':_0x13d2f4,'source':_0x29e9a7(0x1ff)+_0x598d82+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x29e9a7(0x216),'isDeprecated':![]};if(!_0x598d82){const _0x393935=getCachedCredential(_0x48948f,undefined);if(_0x393935)return{'apiKey':_0x393935,'source':_0x29e9a7(0x1f4),'isDeprecated':![]};const _0x493d53=await getKeychainAPIKey(undefined);if(_0x493d53)return setCachedCredential(_0x493d53,_0x48948f,undefined),{'apiKey':_0x493d53,'source':_0x29e9a7(0x1f4),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x442fd9,_0x2d0473){const _0x471e71=a57_0x410a1c,_0x61ff12=await resolveAPIKeyAsync(_0x442fd9,_0x2d0473);return _0x61ff12?.[_0x471e71(0x224)];}function cleanupLegacyEnvFile(_0x330622){const _0x16cfaa=a57_0x410a1c;if(!existsSync(_0x330622))return![];try{const _0x2c078f=readFileSync(_0x330622,_0x16cfaa(0x238)),_0x3bd72d=_0x2c078f[_0x16cfaa(0x20f)]('\x0a'),_0x30597b=_0x3bd72d[_0x16cfaa(0x20d)](_0x3c91f7=>{const _0x1f91b8=_0x16cfaa,_0x1fcac3=_0x3c91f7[_0x1f91b8(0x209)]();if(!_0x1fcac3||_0x1fcac3['startsWith']('#'))return!![];const [_0x17247b]=_0x1fcac3[_0x1f91b8(0x20f)]('=');return!_0x17247b[_0x1f91b8(0x21b)](_0x1f91b8(0x235));}),_0x3db17d=_0x30597b[_0x16cfaa(0x22a)](_0x5d0bcc=>{const _0x2cbc7f=_0x16cfaa,_0xb15802=_0x5d0bcc['trim']();return _0xb15802&&!_0xb15802[_0x2cbc7f(0x21b)]('#');});if(!_0x3db17d)return unlinkSync(_0x330622),!![];return writeFileSync(_0x330622,_0x30597b[_0x16cfaa(0x202)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x95d6bd=a57_0x410a1c;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x2f2394=a57_0x5da7a3[_0x95d6bd(0x202)](getConfigDir(),_0x95d6bd(0x213));if(!a57_0x40ff0a[_0x95d6bd(0x201)](_0x2f2394))return null;try{const _0x5948de=a57_0x40ff0a[_0x95d6bd(0x1fb)](_0x2f2394,_0x95d6bd(0x238)),_0x2f872b=JSON['parse'](_0x5948de);return _0x2f872b[_0x95d6bd(0x1f6)]||null;}catch{return null;}}function a57_0x2968(_0x108587,_0x9897f1){_0x108587=_0x108587-0x1ef;const _0x59926e=a57_0x5992();let _0x296889=_0x59926e[_0x108587];return _0x296889;}export function saveAPIKey(_0x41dedd,_0xc8340a,_0x5273a8){const _0xfccfb4=a57_0x410a1c,_0x8541ad=getConfigDir(),_0x3e6b09=getConfigFilePath(_0x5273a8);!existsSync(_0x8541ad)&&mkdirSync(_0x8541ad,{'recursive':!![],'mode':0x1c0});let _0x2e57dd={};if(existsSync(_0x3e6b09))try{const _0x9a1e53=readFileSync(_0x3e6b09,_0xfccfb4(0x238));_0x2e57dd=parseEnvFile(_0x9a1e53);}catch(_0x3c3b8f){console['warn'](_0xfccfb4(0x1fe)+_0x3e6b09+':',_0x3c3b8f);}const _0x386ca4=_0x41dedd['toUpperCase']()[_0xfccfb4(0x229)](/-/g,'_');_0x2e57dd[_0xfccfb4(0x234)+_0x386ca4]=_0xc8340a;const _0x3c7801=Object[_0xfccfb4(0x239)](_0x2e57dd)[_0xfccfb4(0x22e)](([_0x9c72c2,_0x23baf1])=>_0x9c72c2+'='+_0x23baf1);writeFileSync(_0x3e6b09,_0x3c7801['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x3eff60,_0x161f14,_0x155274){const _0x50dd38=a57_0x410a1c;await saveKeychainAPIKey(_0x3eff60,_0x155274),setCachedCredential(_0x3eff60,_0x161f14,_0x155274);const _0x523d38=getConfigFilePath(_0x155274);cleanupLegacyEnvFile(_0x523d38)&&console[_0x50dd38(0x225)](a57_0x5d53b9['yellow']('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x2052d8=a57_0x410a1c,_0xfdcb6c={'apiKeys':{},'defaultSite':_0x2052d8(0x226)},_0x5e731b=['us01',_0x2052d8(0x23a),_0x2052d8(0x227),'ap02',_0x2052d8(0x1f2),_0x2052d8(0x23c),_0x2052d8(0x215),_0x2052d8(0x1f0),_0x2052d8(0x205),_0x2052d8(0x1fc)],_0x1b0969=getAPIKey();if(_0x1b0969)for(const _0x540770 of _0x5e731b){_0xfdcb6c[_0x2052d8(0x237)][_0x540770]=_0x1b0969;}return _0xfdcb6c;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x48383e=a57_0x410a1c,_0x17840c=a57_0x5da7a3[_0x48383e(0x202)](getConfigDir(),_0x48383e(0x213));if(!a57_0x40ff0a[_0x48383e(0x201)](_0x17840c))return undefined;try{const _0x13b39d=a57_0x40ff0a[_0x48383e(0x1fb)](_0x17840c,'utf-8'),_0x32bafb=JSON['parse'](_0x13b39d);return typeof _0x32bafb[_0x48383e(0x1f9)]==='string'?_0x32bafb['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x3cedb6=a57_0x410a1c,_0x304720=process.env.TDX_RELEASE_CHANNEL;if(_0x304720==='next'||_0x304720===_0x3cedb6(0x20a))return _0x304720;const _0x2d81ab=a57_0x5da7a3[_0x3cedb6(0x202)](getConfigDir(),_0x3cedb6(0x213));if(!a57_0x40ff0a[_0x3cedb6(0x201)](_0x2d81ab))return _0x3cedb6(0x20a);try{const _0xd28f14=a57_0x40ff0a[_0x3cedb6(0x1fb)](_0x2d81ab,_0x3cedb6(0x238)),_0x32d70a=JSON['parse'](_0xd28f14);if(_0x32d70a['release_channel']==='next')return'next';}catch{}return'stable';}export function saveReleaseChannel(_0x32207f){const _0x5c3cf7=a57_0x410a1c,_0x358f6c=getConfigDir(),_0x5dbeca=a57_0x5da7a3['join'](_0x358f6c,'tdx.json');!existsSync(_0x358f6c)&&mkdirSync(_0x358f6c,{'recursive':!![],'mode':0x1c0});let _0x598ef4={};if(existsSync(_0x5dbeca))try{const _0x393908=readFileSync(_0x5dbeca,_0x5c3cf7(0x238));_0x598ef4=JSON[_0x5c3cf7(0x1fd)](_0x393908);}catch{}_0x598ef4[_0x5c3cf7(0x20b)]=_0x32207f,writeFileSync(_0x5dbeca,JSON[_0x5c3cf7(0x219)](_0x598ef4,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- function a58_0x576a(){const _0x56823b=['443505GNdrmh','connections-{profile}.json','connections','2331264kmeZlO','42655UtdonF','read','now','5108440cYZMkW','core/connection-cache','clear','5105121xpBUbd','21528pNrVdV','6WLvcFt','1755225ADBJxr','36jPhtQg','write','2310MAvpXv'];a58_0x576a=function(){return _0x56823b;};return a58_0x576a();}function a58_0x2dd1(_0x2379f4,_0x253b83){_0x2379f4=_0x2379f4-0xad;const _0x576adf=a58_0x576a();let _0x2dd101=_0x576adf[_0x2379f4];return _0x2dd101;}const a58_0x4ed492=a58_0x2dd1;(function(_0x59addc,_0xa37f45){const _0x33df27=a58_0x2dd1,_0x26bbdb=_0x59addc();while(!![]){try{const _0x22e1a5=-parseInt(_0x33df27(0xbb))/0x1+-parseInt(_0x33df27(0xba))/0x2+-parseInt(_0x33df27(0xb7))/0x3*(-parseInt(_0x33df27(0xb4))/0x4)+parseInt(_0x33df27(0xb3))/0x5+-parseInt(_0x33df27(0xb2))/0x6*(parseInt(_0x33df27(0xb0))/0x7)+parseInt(_0x33df27(0xad))/0x8+parseInt(_0x33df27(0xb1))/0x9*(parseInt(_0x33df27(0xb6))/0xa);if(_0x22e1a5===_0xa37f45)break;else _0x26bbdb['push'](_0x26bbdb['shift']());}catch(_0x20ae59){_0x26bbdb['push'](_0x26bbdb['shift']());}}}(a58_0x576a,0xe44a5));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x4ed492(0xb8),a58_0x4ed492(0xae));export function loadCachedConnections(_0x1ea88c){const _0x25390b=a58_0x4ed492,_0x43efc6=connectionCache[_0x25390b(0xbc)](_0x1ea88c);return _0x43efc6?.[_0x25390b(0xb9)]??null;}export function saveCachedConnections(_0x10748,_0x512f32){const _0x365c77=a58_0x4ed492;connectionCache[_0x365c77(0xb5)](_0x10748,{'connections':_0x512f32,'cachedAt':Date[_0x365c77(0xbd)]()});}export function clearConnectionCache(_0x3407a5){const _0x2175e6=a58_0x4ed492;connectionCache[_0x2175e6(0xaf)](_0x3407a5);}
1
+ const a58_0x381f90=a58_0x1e83;function a58_0x1e83(_0x2f7206,_0x126ead){_0x2f7206=_0x2f7206-0x1ae;const _0x2da732=a58_0x2da7();let _0x1e8314=_0x2da732[_0x2f7206];return _0x1e8314;}(function(_0xff3cb0,_0x236aa7){const _0x4c57af=a58_0x1e83,_0x46e18d=_0xff3cb0();while(!![]){try{const _0x35c471=-parseInt(_0x4c57af(0x1be))/0x1*(parseInt(_0x4c57af(0x1b9))/0x2)+-parseInt(_0x4c57af(0x1b6))/0x3+-parseInt(_0x4c57af(0x1ba))/0x4+parseInt(_0x4c57af(0x1b7))/0x5*(parseInt(_0x4c57af(0x1b2))/0x6)+parseInt(_0x4c57af(0x1b1))/0x7*(parseInt(_0x4c57af(0x1bf))/0x8)+-parseInt(_0x4c57af(0x1b3))/0x9*(parseInt(_0x4c57af(0x1bd))/0xa)+-parseInt(_0x4c57af(0x1b0))/0xb*(-parseInt(_0x4c57af(0x1ae))/0xc);if(_0x35c471===_0x236aa7)break;else _0x46e18d['push'](_0x46e18d['shift']());}catch(_0x460c00){_0x46e18d['push'](_0x46e18d['shift']());}}}(a58_0x2da7,0xd9fce));import{createProfileCache}from'../utils/global-cache.js';function a58_0x2da7(){const _0x52a69b=['21sqsVsp','18JkpqPe','297vbUGLd','connections','read','514704vpmoqQ','1180150vARWCl','connections-{profile}.json','434AuMunn','1082272ActGzC','write','now','181430zuKLHA','95wgMOmX','642728aBjyXQ','4476HTNbad','core/connection-cache','29645fWNxpB'];a58_0x2da7=function(){return _0x52a69b;};return a58_0x2da7();}const connectionCache=createProfileCache(a58_0x381f90(0x1b8),a58_0x381f90(0x1af));export function loadCachedConnections(_0x5a6f85){const _0x7eb3a=a58_0x381f90,_0x3b2b3e=connectionCache[_0x7eb3a(0x1b5)](_0x5a6f85);return _0x3b2b3e?.[_0x7eb3a(0x1b4)]??null;}export function saveCachedConnections(_0x379215,_0x6e55ba){const _0x24c509=a58_0x381f90;connectionCache[_0x24c509(0x1bb)](_0x379215,{'connections':_0x6e55ba,'cachedAt':Date[_0x24c509(0x1bc)]()});}export function clearConnectionCache(_0x576e08){connectionCache['clear'](_0x576e08);}
@@ -1 +1 @@
1
- const a59_0x2e61c0=a59_0x8b70;(function(_0x2e3ef3,_0x26e4b3){const _0x5b5514=a59_0x8b70,_0x48b71a=_0x2e3ef3();while(!![]){try{const _0x32e9b4=parseInt(_0x5b5514(0x176))/0x1+-parseInt(_0x5b5514(0x17b))/0x2*(parseInt(_0x5b5514(0x18f))/0x3)+parseInt(_0x5b5514(0x188))/0x4*(-parseInt(_0x5b5514(0x190))/0x5)+parseInt(_0x5b5514(0x18b))/0x6*(parseInt(_0x5b5514(0x171))/0x7)+-parseInt(_0x5b5514(0x192))/0x8+parseInt(_0x5b5514(0x174))/0x9+-parseInt(_0x5b5514(0x185))/0xa*(-parseInt(_0x5b5514(0x170))/0xb);if(_0x32e9b4===_0x26e4b3)break;else _0x48b71a['push'](_0x48b71a['shift']());}catch(_0x56c19a){_0x48b71a['push'](_0x48b71a['shift']());}}}(a59_0xe0b4,0x2c09d));import a59_0x213ffd from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;function a59_0xe0b4(){const _0x4e2971=['Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','trim','ap02','us01','customSite','site','Enter\x20site\x20name:','10VqPTHF','Site\x20name\x20cannot\x20be\x20empty','ap02\x20-\x20Korea','4daQXJD','Cancelled','eu\x20\x20\x20-\x20Europe','82020wvWrYk','text','log','Select\x20your\x20Treasure\x20Data\x20site:','33vhtMLl','1331755qxHvDH','other','2773952SSYRmz','length','ap01','1502138mTmnBj','98XXmEVl','eu01','us\x20\x20\x20-\x20United\x20States','2910519CYozfN','test','182550LVIveY','value','jp\x20\x20\x20-\x20Japan','number','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','7346AzjqMW','push','findIndex'];a59_0xe0b4=function(){return _0x4e2971;};return a59_0xe0b4();}function a59_0x8b70(_0x296e71,_0x3c7cba){_0x296e71=_0x296e71-0x170;const _0xe0b493=a59_0xe0b4();let _0x8b70d6=_0xe0b493[_0x296e71];return _0x8b70d6;}export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x28d65c,_0x4c6b25){const _0x2889d4=a59_0x8b70;if(_0x28d65c===undefined)return _0x4c6b25;if(typeof _0x28d65c===_0x2889d4(0x179))return _0x28d65c;return parseInt(_0x28d65c,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x2e61c0(0x173),'value':a59_0x2e61c0(0x181)},{'title':a59_0x2e61c0(0x178),'value':a59_0x2e61c0(0x194)},{'title':a59_0x2e61c0(0x18a),'value':a59_0x2e61c0(0x172)},{'title':a59_0x2e61c0(0x187),'value':a59_0x2e61c0(0x180)}];export function buildSiteChoices(_0x53166a){const _0x5b37ec=a59_0x2e61c0,_0x6ff105=[...STANDARD_SITE_CHOICES];let _0x28a187=_0x6ff105[_0x5b37ec(0x17d)](_0x439989=>_0x439989[_0x5b37ec(0x177)]===_0x53166a);return _0x28a187===-0x1&&_0x53166a!==_0x5b37ec(0x181)&&(_0x6ff105[_0x5b37ec(0x17c)]({'title':_0x53166a,'value':_0x53166a}),_0x28a187=_0x6ff105[_0x5b37ec(0x193)]-0x1),_0x6ff105[_0x5b37ec(0x17c)]({'title':'Enter\x20custom\x20site','value':_0x5b37ec(0x191)}),{'choices':_0x6ff105,'initialIndex':_0x28a187>=0x0?_0x28a187:0x0};}export async function promptSiteSelection(_0x106921,_0x430598,_0x4f0023=a59_0x2e61c0(0x189)){const _0x455e5e=a59_0x2e61c0,{choices:_0x3896ad,initialIndex:_0x2f7bb0}=buildSiteChoices(_0x106921),_0x58949d=_0x430598?_0x455e5e(0x17e)+_0x430598+'):':_0x455e5e(0x18e),_0x160a66=await a59_0x213ffd({'type':'select','name':_0x455e5e(0x183),'message':_0x58949d,'choices':_0x3896ad,'initial':_0x2f7bb0});if(!_0x160a66[_0x455e5e(0x183)])return console[_0x455e5e(0x18d)]('\x0a'+_0x4f0023),null;if(_0x160a66[_0x455e5e(0x183)]!==_0x455e5e(0x191))return _0x160a66['site'];const _0x3d2feb=await a59_0x213ffd({'type':_0x455e5e(0x18c),'name':'customSite','message':_0x455e5e(0x184),'initial':_0x455e5e(0x181),'validate':_0x148c09=>{const _0xa44e94=_0x455e5e;if(!_0x148c09||!_0x148c09[_0xa44e94(0x17f)]())return _0xa44e94(0x186);if(!/^[a-z0-9-]+$/[_0xa44e94(0x175)](_0x148c09[_0xa44e94(0x17f)]()))return _0xa44e94(0x17a);return!![];}});if(!_0x3d2feb['customSite'])return console[_0x455e5e(0x18d)]('\x0a'+_0x4f0023),null;return _0x3d2feb[_0x455e5e(0x182)];}
1
+ const a59_0x3b3923=a59_0xde01;(function(_0x371d5c,_0x4b3166){const _0x38a4a1=a59_0xde01,_0x496455=_0x371d5c();while(!![]){try{const _0x408612=parseInt(_0x38a4a1(0x1ee))/0x1+-parseInt(_0x38a4a1(0x1e4))/0x2+-parseInt(_0x38a4a1(0x1e1))/0x3*(parseInt(_0x38a4a1(0x1de))/0x4)+parseInt(_0x38a4a1(0x1da))/0x5+parseInt(_0x38a4a1(0x1db))/0x6+-parseInt(_0x38a4a1(0x1d9))/0x7*(parseInt(_0x38a4a1(0x1ea))/0x8)+-parseInt(_0x38a4a1(0x1f1))/0x9*(-parseInt(_0x38a4a1(0x1e6))/0xa);if(_0x408612===_0x4b3166)break;else _0x496455['push'](_0x496455['shift']());}catch(_0x380a91){_0x496455['push'](_0x496455['shift']());}}}(a59_0x2026,0xaeca6));import a59_0x1ac8d5 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x3ff665,_0x194e58){const _0xeb5f52=a59_0xde01;if(_0x3ff665===undefined)return _0x194e58;if(typeof _0x3ff665===_0xeb5f52(0x1e8))return _0x3ff665;return parseInt(_0x3ff665,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a59_0x3b3923(0x1e5)},{'title':a59_0x3b3923(0x1e9),'value':a59_0x3b3923(0x1f0)},{'title':a59_0x3b3923(0x1eb),'value':'eu01'},{'title':'ap02\x20-\x20Korea','value':a59_0x3b3923(0x1ec)}];export function buildSiteChoices(_0x585d99){const _0x2579a8=a59_0x3b3923,_0x157384=[...STANDARD_SITE_CHOICES];let _0x276599=_0x157384[_0x2579a8(0x1dc)](_0x46cc9c=>_0x46cc9c[_0x2579a8(0x1ef)]===_0x585d99);return _0x276599===-0x1&&_0x585d99!==_0x2579a8(0x1e5)&&(_0x157384['push']({'title':_0x585d99,'value':_0x585d99}),_0x276599=_0x157384[_0x2579a8(0x1d5)]-0x1),_0x157384['push']({'title':_0x2579a8(0x1e0),'value':_0x2579a8(0x1e7)}),{'choices':_0x157384,'initialIndex':_0x276599>=0x0?_0x276599:0x0};}function a59_0x2026(){const _0x2490df=['trim','251702GpfUOS','value','ap01','9837viVMHm','Cancelled','Enter\x20site\x20name:','test','length','Select\x20your\x20Treasure\x20Data\x20site:','site','log','84YjxYkK','4350800CHHZIx','5348934DKCoYy','findIndex','Site\x20name\x20cannot\x20be\x20empty','4RKlKFr','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','Enter\x20custom\x20site','1015383Plehgw','select','text','2033970ghWIbc','us01','5810ZMfwmx','other','number','jp\x20\x20\x20-\x20Japan','384664uPfGmV','eu\x20\x20\x20-\x20Europe','ap02'];a59_0x2026=function(){return _0x2490df;};return a59_0x2026();}function a59_0xde01(_0x206a2f,_0x99fc9e){_0x206a2f=_0x206a2f-0x1d5;const _0x20266d=a59_0x2026();let _0xde01b2=_0x20266d[_0x206a2f];return _0xde01b2;}export async function promptSiteSelection(_0x2b23f8,_0x3a16af,_0x4197de=a59_0x3b3923(0x1f2)){const _0x4ee83b=a59_0x3b3923,{choices:_0xc46120,initialIndex:_0x40d0ad}=buildSiteChoices(_0x2b23f8),_0x20a914=_0x3a16af?_0x4ee83b(0x1df)+_0x3a16af+'):':_0x4ee83b(0x1d6),_0x2e62f7=await a59_0x1ac8d5({'type':_0x4ee83b(0x1e2),'name':'site','message':_0x20a914,'choices':_0xc46120,'initial':_0x40d0ad});if(!_0x2e62f7['site'])return console[_0x4ee83b(0x1d8)]('\x0a'+_0x4197de),null;if(_0x2e62f7[_0x4ee83b(0x1d7)]!==_0x4ee83b(0x1e7))return _0x2e62f7[_0x4ee83b(0x1d7)];const _0x371e00=await a59_0x1ac8d5({'type':_0x4ee83b(0x1e3),'name':'customSite','message':_0x4ee83b(0x1f3),'initial':'us01','validate':_0x22be4f=>{const _0x317a94=_0x4ee83b;if(!_0x22be4f||!_0x22be4f[_0x317a94(0x1ed)]())return _0x317a94(0x1dd);if(!/^[a-z0-9-]+$/[_0x317a94(0x1f4)](_0x22be4f['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x371e00['customSite'])return console['log']('\x0a'+_0x4197de),null;return _0x371e00['customSite'];}
@@ -1 +1 @@
1
- (function(_0x3d6e2d,_0x506d69){const _0x1d7635=a60_0x207a,_0x278ab0=_0x3d6e2d();while(!![]){try{const _0x22e64d=parseInt(_0x1d7635(0x1da))/0x1*(-parseInt(_0x1d7635(0x1d2))/0x2)+-parseInt(_0x1d7635(0x1d8))/0x3*(-parseInt(_0x1d7635(0x1d9))/0x4)+parseInt(_0x1d7635(0x1d7))/0x5*(-parseInt(_0x1d7635(0x1d1))/0x6)+parseInt(_0x1d7635(0x1d6))/0x7*(-parseInt(_0x1d7635(0x1cd))/0x8)+-parseInt(_0x1d7635(0x1cc))/0x9+parseInt(_0x1d7635(0x1d5))/0xa+parseInt(_0x1d7635(0x1d4))/0xb;if(_0x22e64d===_0x506d69)break;else _0x278ab0['push'](_0x278ab0['shift']());}catch(_0x1405a7){_0x278ab0['push'](_0x278ab0['shift']());}}}(a60_0x16f9,0x917c2));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0xef92a8,_0x2a6903){const _0x171800=a60_0x207a,_0x32329b=_0xef92a8||_0x171800(0x1ce),_0x414967=_0x2a6903||_0x171800(0x1cf);return _0x32329b+':'+_0x414967;}export function getCachedCredential(_0x110cf7,_0x8406e1){const _0x43bfb9=a60_0x207a,_0x651689=getCacheKey(_0x110cf7,_0x8406e1),_0x4e60c7=cache[_0x43bfb9(0x1d3)](_0x651689);if(!_0x4e60c7)return null;if(Date[_0x43bfb9(0x1d0)]()-_0x4e60c7[_0x43bfb9(0x1cb)]>CACHE_TTL_MS)return cache['delete'](_0x651689),null;return _0x4e60c7[_0x43bfb9(0x1dc)];}function a60_0x207a(_0x2c6f2e,_0x564ef4){_0x2c6f2e=_0x2c6f2e-0x1cb;const _0x16f9d8=a60_0x16f9();let _0x207a6e=_0x16f9d8[_0x2c6f2e];return _0x207a6e;}export function setCachedCredential(_0x455a6f,_0x5fb444,_0x583bcc){const _0x433491=a60_0x207a,_0x9bdf18=getCacheKey(_0x5fb444,_0x583bcc);cache['set'](_0x9bdf18,{'apiKey':_0x455a6f,'loadedAt':Date[_0x433491(0x1d0)]()});}function a60_0x16f9(){const _0x3d3c6b=['6048130NParQm','28TDAQcc','275XGMMmX','3lJrjZD','1602136ryaejS','5HmgajV','clear','apiKey','loadedAt','7788537NLvLYk','819688mQjFiP','__default_site__','__default_profile__','now','90354oaKLmV','249752AvUEOF','get','25502631lcxMQL'];a60_0x16f9=function(){return _0x3d3c6b;};return a60_0x16f9();}export function clearCredentialCache(){const _0x4407eb=a60_0x207a;cache[_0x4407eb(0x1db)]();}export function clearCachedCredential(_0x453919,_0x58fb08){const _0xd107a7=getCacheKey(_0x453919,_0x58fb08);cache['delete'](_0xd107a7);}
1
+ (function(_0x158805,_0xc7dea){const _0x599d2e=a60_0x2dc5,_0x5c7f71=_0x158805();while(!![]){try{const _0x3da4d4=parseInt(_0x599d2e(0x197))/0x1*(parseInt(_0x599d2e(0x18f))/0x2)+parseInt(_0x599d2e(0x19a))/0x3+-parseInt(_0x599d2e(0x18d))/0x4+-parseInt(_0x599d2e(0x195))/0x5*(-parseInt(_0x599d2e(0x19b))/0x6)+parseInt(_0x599d2e(0x193))/0x7+-parseInt(_0x599d2e(0x198))/0x8*(-parseInt(_0x599d2e(0x199))/0x9)+-parseInt(_0x599d2e(0x196))/0xa;if(_0x3da4d4===_0xc7dea)break;else _0x5c7f71['push'](_0x5c7f71['shift']());}catch(_0x3aedc4){_0x5c7f71['push'](_0x5c7f71['shift']());}}}(a60_0x5b6d,0x92a8d));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a60_0x2dc5(_0x5b983f,_0x3feb8b){_0x5b983f=_0x5b983f-0x18d;const _0x5b6d95=a60_0x5b6d();let _0x2dc547=_0x5b6d95[_0x5b983f];return _0x2dc547;}function getCacheKey(_0xc99d67,_0x2f10ed){const _0x36ac53=a60_0x2dc5,_0x81795e=_0xc99d67||_0x36ac53(0x191),_0x40cea3=_0x2f10ed||_0x36ac53(0x18e);return _0x81795e+':'+_0x40cea3;}function a60_0x5b6d(){const _0x1bac4c=['11966650AyeYei','300512zBwYaT','26056rgksXw','27htxiXu','2038770KyUmDi','3198pTsbFK','apiKey','now','4277992oQJcZH','__default_profile__','2AhbHYm','get','__default_site__','clear','7415695zdTUWz','set','7670PYqplO'];a60_0x5b6d=function(){return _0x1bac4c;};return a60_0x5b6d();}export function getCachedCredential(_0x36c689,_0x3049f5){const _0x47ad25=a60_0x2dc5,_0x3d57e9=getCacheKey(_0x36c689,_0x3049f5),_0xd36aae=cache[_0x47ad25(0x190)](_0x3d57e9);if(!_0xd36aae)return null;if(Date[_0x47ad25(0x19d)]()-_0xd36aae['loadedAt']>CACHE_TTL_MS)return cache['delete'](_0x3d57e9),null;return _0xd36aae[_0x47ad25(0x19c)];}export function setCachedCredential(_0x515e28,_0x110ff0,_0x50cf3d){const _0x579d60=a60_0x2dc5,_0x1a0658=getCacheKey(_0x110ff0,_0x50cf3d);cache[_0x579d60(0x194)](_0x1a0658,{'apiKey':_0x515e28,'loadedAt':Date[_0x579d60(0x19d)]()});}export function clearCredentialCache(){const _0xd6eb84=a60_0x2dc5;cache[_0xd6eb84(0x192)]();}export function clearCachedCredential(_0x5b4028,_0x3f9dd7){const _0x44e585=getCacheKey(_0x5b4028,_0x3f9dd7);cache['delete'](_0x44e585);}
@@ -1 +1 @@
1
- function a61_0x174a(_0x1d3b28,_0x55ef50){_0x1d3b28=_0x1d3b28-0x1ae;const _0x257fd6=a61_0x257f();let _0x174a31=_0x257fd6[_0x1d3b28];return _0x174a31;}const a61_0x376229=a61_0x174a;function a61_0x257f(){const _0x22d8e2=['resolveAPIKeyAsync','green','default','dim','config','not\x20set','Global','parse','sessions','env','existsSync','configFiles','injectIntoOptions','profiles','project','composable_audience','697040mfPiLM','workflow_project','66siVATS','CLI\x20flag:\x20--','27qeNKKu','layers','cli','accessToken','profile','now','string','expires_at','sessionId','61065XTzbyg','6245616zJkNMz','llmAgent','bold','composableAudience','us01','llm_project','log','proxy','access_token','segmentPath','parent_segment','264929kWylrN','readFileSync','displayWithSources','global','activeProfile','join','profileSource','cyan','display','getParameters','database','apiKey','llm_agent','loadGlobalConfig','Project','llmProject','(session:\x20','(active)','entries','segment_path','getSource','Session','verbose','replace','tdx.json','371213MXOCVZ','parentSegment','169968wgyQoZ','Profile\x20Credentials','6oWfnHC','Global\x20Credentials','session','[configuration\x20files]','site','.env','utf-8','[context]','.json','INFO','cliFlags','1425716BrsUcq'];a61_0x257f=function(){return _0x22d8e2;};return a61_0x257f();}(function(_0x585886,_0x1f3b09){const _0x5779dd=a61_0x174a,_0x21ffc3=_0x585886();while(!![]){try{const _0x1eceba=parseInt(_0x5779dd(0x1fc))/0x1+-parseInt(_0x5779dd(0x1ae))/0x2*(parseInt(_0x5779dd(0x1fe))/0x3)+-parseInt(_0x5779dd(0x1b9))/0x4+-parseInt(_0x5779dd(0x1d7))/0x5+-parseInt(_0x5779dd(0x1cc))/0x6*(parseInt(_0x5779dd(0x1e3))/0x7)+parseInt(_0x5779dd(0x1d8))/0x8+-parseInt(_0x5779dd(0x1ce))/0x9*(-parseInt(_0x5779dd(0x1ca))/0xa);if(_0x1eceba===_0x1f3b09)break;else _0x21ffc3['push'](_0x21ffc3['shift']());}catch(_0x3f90f0){_0x21ffc3['push'](_0x21ffc3['shift']());}}}(a61_0x257f,0x63254));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_0x5a5a1f from'node:fs';import*as a61_0xcff648 from'node:path';import a61_0x419a89 from'chalk';export class GlobalContext{[a61_0x376229(0x1b2)];[a61_0x376229(0x1ed)];[a61_0x376229(0x1e2)];[a61_0x376229(0x1f6)];['llm_project'];['llm_agent'];[a61_0x376229(0x1cb)];[a61_0x376229(0x1c9)];[a61_0x376229(0x1ee)];[a61_0x376229(0x1d1)];[a61_0x376229(0x1df)];[a61_0x376229(0x1f9)];['logLevel'];['profile'];[a61_0x376229(0x1e9)]=null;['layers'];[a61_0x376229(0x1e7)];[a61_0x376229(0x1d6)];[a61_0x376229(0x1c5)];constructor(_0x320150){const _0x45de96=a61_0x376229;this[_0x45de96(0x1d6)]=getSessionID(_0x320150[_0x45de96(0x1b0)]);const _0x5d1541=loadSessionContext(_0x320150['session']),_0x4e6b28=loadProjectConfig(),_0x262220=this[_0x45de96(0x1f0)]();if(_0x320150[_0x45de96(0x1d2)])this[_0x45de96(0x1e7)]=_0x320150[_0x45de96(0x1d2)],this[_0x45de96(0x1e9)]=_0x45de96(0x1d0);else{if(_0x5d1541?.[_0x45de96(0x1d2)])this[_0x45de96(0x1e7)]=_0x5d1541[_0x45de96(0x1d2)],this[_0x45de96(0x1e9)]='session';else{if(_0x262220[_0x45de96(0x1d2)])this['activeProfile']=_0x262220['profile'],this[_0x45de96(0x1e9)]=_0x45de96(0x1be);else process.env.TDX_PROFILE?(this[_0x45de96(0x1e7)]=process.env.TDX_PROFILE,this[_0x45de96(0x1e9)]=_0x45de96(0x1c3)):(this['activeProfile']=null,this[_0x45de96(0x1e9)]=null);}}const _0x572fab=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x4406ef=_0x263f67=>{const _0x589483=_0x45de96;if(!_0x263f67)return{};const _0xc49abd=_0x263f67,_0x190d3c={};for(const [_0x551bf0,_0x12d315]of Object[_0x589483(0x1f5)](_0xc49abd)){typeof _0x12d315==='string'&&(_0x190d3c[_0x551bf0]=_0x12d315);}return _0x190d3c;},_0x42dec0={},_0x2137f7=(_0xec25e9,_0xcb4b67,_0x3f5a7d)=>{if(!_0xec25e9)return![];if(_0x3f5a7d&&_0xec25e9===_0x3f5a7d)return![];const _0x5dda0b=_0x5d1541,_0x2d71a8=_0x4e6b28,_0x299cde=_0x572fab?.['config'],_0x19bf1b=_0x262220,_0x3ff650=_0x5dda0b?.[_0xcb4b67],_0x405040=_0x2d71a8?.[_0xcb4b67],_0x1643cb=_0x299cde?.[_0xcb4b67],_0x46e2cb=_0x19bf1b[_0xcb4b67];return _0xec25e9!==_0x3ff650&&_0xec25e9!==_0x405040&&_0xec25e9!==_0x1643cb&&_0xec25e9!==_0x46e2cb;},_0x965ecd=[{'optionKey':_0x45de96(0x1b2),'contextKey':_0x45de96(0x1b2),'defaultValue':_0x45de96(0x1dc)},{'optionKey':'database','contextKey':'database'},{'optionKey':_0x45de96(0x1fd),'contextKey':_0x45de96(0x1e2)},{'optionKey':_0x45de96(0x1f2),'contextKey':_0x45de96(0x1dd)},{'optionKey':_0x45de96(0x1d9),'contextKey':_0x45de96(0x1ef)},{'optionKey':_0x45de96(0x1db),'contextKey':_0x45de96(0x1c9)},{'optionKey':_0x45de96(0x1d2),'contextKey':_0x45de96(0x1d2)}];for(const {optionKey:_0x5eae1f,contextKey:_0x71e696,defaultValue:_0x1d4926}of _0x965ecd){const _0xe40096=_0x320150[_0x5eae1f];_0x2137f7(_0xe40096,_0x71e696,_0x1d4926)&&(_0x42dec0[_0x71e696]=_0xe40096);}this[_0x45de96(0x1cf)]={'cliFlags':_0x42dec0,'session':_0x4406ef(_0x5d1541),'project':_0x4406ef(_0x4e6b28),'profile':_0x4406ef(_0x572fab?.[_0x45de96(0x1be)]),'global':_0x4406ef(_0x262220)};const _0x2998ca={...this[_0x45de96(0x1cf)][_0x45de96(0x1e6)],...this[_0x45de96(0x1cf)][_0x45de96(0x1d2)],...this['layers'][_0x45de96(0x1c8)]};process.env.TDX_SITE&&!this[_0x45de96(0x1cf)]['session'][_0x45de96(0x1b2)]&&!this['layers'][_0x45de96(0x1b8)][_0x45de96(0x1b2)]&&(_0x2998ca[_0x45de96(0x1b2)]=process.env.TDX_SITE);Object['assign'](_0x2998ca,this[_0x45de96(0x1cf)][_0x45de96(0x1b0)]),Object['assign'](_0x2998ca,this[_0x45de96(0x1cf)][_0x45de96(0x1b8)]);const _0x2420c4=_0x2998ca['site']||_0x45de96(0x1dc);this['site']=resolveSite(_0x2420c4),this['database']=_0x2998ca[_0x45de96(0x1ed)],this[_0x45de96(0x1e2)]=_0x2998ca['parent_segment'],this[_0x45de96(0x1f6)]=_0x2998ca[_0x45de96(0x1f6)],this[_0x45de96(0x1dd)]=_0x2998ca[_0x45de96(0x1dd)],this['llm_agent']=_0x2998ca[_0x45de96(0x1ef)],this[_0x45de96(0x1cb)]=_0x2998ca[_0x45de96(0x1cb)],this[_0x45de96(0x1c9)]=_0x2998ca[_0x45de96(0x1c9)],this[_0x45de96(0x1f9)]=_0x320150[_0x45de96(0x1f9)]||![],this['logLevel']=_0x320150['logLevel']??LogLevel[_0x45de96(0x1b7)],this['profile']=this['activeProfile']||undefined,this[_0x45de96(0x1d1)]=getAccessToken(this[_0x45de96(0x1e7)]||undefined),this[_0x45de96(0x1ee)]=getAPIKey(this['activeProfile']||undefined);const _0x3fa68b=typeof _0x262220[_0x45de96(0x1df)]===_0x45de96(0x1d4)?_0x262220['proxy']:undefined;this[_0x45de96(0x1df)]=_0x3fa68b||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0xc5ee6=getConfigDir(),_0x52fd25=a61_0xcff648['join'](_0xc5ee6,_0x45de96(0x1c2),this[_0x45de96(0x1d6)]+_0x45de96(0x1b6)),_0x36ff6f=findProjectConfigPath(),_0x1d341a=a61_0xcff648[_0x45de96(0x1e8)](_0xc5ee6,_0x45de96(0x1fb)),_0x494d27=a61_0xcff648['join'](_0xc5ee6,'.env');let _0x3ae67f=null,_0x361c01=null;this[_0x45de96(0x1e7)]&&(_0x3ae67f=a61_0xcff648[_0x45de96(0x1e8)](_0xc5ee6,'profiles',this['activeProfile'],'tdx.json'),_0x361c01=a61_0xcff648[_0x45de96(0x1e8)](_0xc5ee6,_0x45de96(0x1c7),this[_0x45de96(0x1e7)],_0x45de96(0x1b3))),this['configFiles']={'session':a61_0x5a5a1f[_0x45de96(0x1c4)](_0x52fd25)?_0x52fd25:null,'project':_0x36ff6f,'profile':_0x3ae67f&&a61_0x5a5a1f[_0x45de96(0x1c4)](_0x3ae67f)?_0x3ae67f:null,'profileCredentials':_0x361c01&&a61_0x5a5a1f['existsSync'](_0x361c01)?_0x361c01:null,'global':a61_0x5a5a1f[_0x45de96(0x1c4)](_0x1d341a)?_0x1d341a:null,'globalCredentials':a61_0x5a5a1f[_0x45de96(0x1c4)](_0x494d27)?_0x494d27:null};}['getSource'](_0x17682c,_0x5dbb53){const _0x274193=a61_0x376229;if(!_0x5dbb53)return _0x274193(0x1bf);const _0x40907d=_0x5dbb53;if(this[_0x274193(0x1cf)]['cliFlags'][_0x17682c]===_0x40907d){if(_0x17682c===_0x274193(0x1b2)&&_0x40907d===_0x274193(0x1dc)&&!this[_0x274193(0x1cf)]['session']['site']&&!this['layers'][_0x274193(0x1c8)][_0x274193(0x1b2)]&&!this[_0x274193(0x1cf)][_0x274193(0x1d2)][_0x274193(0x1b2)]&&!this[_0x274193(0x1cf)][_0x274193(0x1e6)][_0x274193(0x1b2)])return _0x274193(0x1bc);return _0x274193(0x1cd)+_0x17682c[_0x274193(0x1fa)](/_/g,'-');}if(this[_0x274193(0x1cf)][_0x274193(0x1b0)][_0x17682c]===_0x40907d)return _0x274193(0x1b0);if(this[_0x274193(0x1cf)]['project'][_0x17682c]===_0x40907d)return _0x274193(0x1c8);if(this['layers'][_0x274193(0x1d2)][_0x17682c]===_0x40907d)return'profile:\x20'+this[_0x274193(0x1e7)];if(this[_0x274193(0x1cf)][_0x274193(0x1e6)][_0x17682c]===_0x40907d)return _0x274193(0x1e6);return'default';}[a61_0x376229(0x1f0)](){const _0x1d4544=a61_0x376229,_0x2917b7=a61_0xcff648[_0x1d4544(0x1e8)](getConfigDir(),'tdx.json');if(!a61_0x5a5a1f[_0x1d4544(0x1c4)](_0x2917b7))return{};try{const _0x5c5348=a61_0x5a5a1f[_0x1d4544(0x1e4)](_0x2917b7,_0x1d4544(0x1b4));return JSON[_0x1d4544(0x1c1)](_0x5c5348);}catch{return{};}}[a61_0x376229(0x1c6)](_0x5283bd){const _0x557bc7=a61_0x376229;_0x5283bd['site']=this['site'],!_0x5283bd[_0x557bc7(0x1ed)]&&this[_0x557bc7(0x1ed)]&&(_0x5283bd[_0x557bc7(0x1ed)]=this[_0x557bc7(0x1ed)]),!_0x5283bd[_0x557bc7(0x1fd)]&&this[_0x557bc7(0x1e2)]&&(_0x5283bd['parentSegment']=this['parent_segment']),!_0x5283bd[_0x557bc7(0x1e1)]&&this['segment_path']&&(_0x5283bd['segmentPath']=this['segment_path']),!_0x5283bd['llmProject']&&this[_0x557bc7(0x1dd)]&&(_0x5283bd['llmProject']=this[_0x557bc7(0x1dd)]),!_0x5283bd[_0x557bc7(0x1d9)]&&this[_0x557bc7(0x1ef)]&&(_0x5283bd[_0x557bc7(0x1d9)]=this['llm_agent']),!_0x5283bd['workflowProject']&&this[_0x557bc7(0x1cb)]&&(_0x5283bd['workflowProject']=this[_0x557bc7(0x1cb)]),!_0x5283bd[_0x557bc7(0x1db)]&&this[_0x557bc7(0x1c9)]&&(_0x5283bd['composableAudience']=this[_0x557bc7(0x1c9)]);}[a61_0x376229(0x1ec)](){const _0x1697d1=a61_0x376229;return[{'key':'site','value':this[_0x1697d1(0x1b2)]},{'key':_0x1697d1(0x1ed),'value':this[_0x1697d1(0x1ed)]},{'key':_0x1697d1(0x1e2),'value':this[_0x1697d1(0x1e2)]},{'key':_0x1697d1(0x1f6),'value':this[_0x1697d1(0x1f6)]},{'key':'llm_project','value':this['llm_project']},{'key':_0x1697d1(0x1ef),'value':this[_0x1697d1(0x1ef)]},{'key':_0x1697d1(0x1cb),'value':this[_0x1697d1(0x1cb)]},{'key':_0x1697d1(0x1c9),'value':this[_0x1697d1(0x1c9)]},{'key':'profile','value':this[_0x1697d1(0x1e7)]||undefined}];}[a61_0x376229(0x1eb)](){const _0x34ef1e=a61_0x376229;console[_0x34ef1e(0x1de)](a61_0x419a89[_0x34ef1e(0x1da)](_0x34ef1e(0x1b5)));for(const {key:_0x820b14,value:_0x461e90}of this[_0x34ef1e(0x1ec)]()){_0x461e90&&console[_0x34ef1e(0x1de)](a61_0x419a89['cyan'](_0x820b14)+':\x20'+_0x461e90);}}[a61_0x376229(0x1e5)](){const _0x3d7017=a61_0x376229;console[_0x3d7017(0x1de)](a61_0x419a89[_0x3d7017(0x1da)](_0x3d7017(0x1b5)));for(const {key:_0x538796,value:_0x468c7e}of this[_0x3d7017(0x1ec)]()){if(_0x468c7e){const _0x38dfe3=_0x538796===_0x3d7017(0x1d2)?_0x3d7017(0x1f4):'('+this[_0x3d7017(0x1f7)](_0x538796,_0x468c7e)+')';console[_0x3d7017(0x1de)](a61_0x419a89['cyan'](_0x538796)+':\x20'+_0x468c7e+'\x20'+a61_0x419a89['dim'](_0x38dfe3));}}console['log']('\x0a'+a61_0x419a89[_0x3d7017(0x1da)](_0x3d7017(0x1b1)));const _0xffc7dd=[{'label':'Session','path':this['configFiles'][_0x3d7017(0x1b0)],'extra':_0x3d7017(0x1f3)+this['sessionId']+')'},{'label':_0x3d7017(0x1f1),'path':this['configFiles'][_0x3d7017(0x1c8)]},{'label':'Profile','path':this['configFiles'][_0x3d7017(0x1d2)]},{'label':_0x3d7017(0x1ff),'path':this[_0x3d7017(0x1c5)]['profileCredentials']},{'label':_0x3d7017(0x1c0),'path':this[_0x3d7017(0x1c5)][_0x3d7017(0x1e6)]},{'label':_0x3d7017(0x1af),'path':this[_0x3d7017(0x1c5)]['globalCredentials']}];for(const {label:_0x21db12,path:_0x574bfc,extra:_0x451efa}of _0xffc7dd){if(_0x574bfc)console[_0x3d7017(0x1de)](a61_0x419a89[_0x3d7017(0x1ea)](_0x21db12)+':\x20'+_0x574bfc+'\x20'+a61_0x419a89[_0x3d7017(0x1bb)]('✓')+(_0x451efa?'\x20'+a61_0x419a89[_0x3d7017(0x1bd)](_0x451efa):''));else{if(_0x21db12===_0x3d7017(0x1f8))console[_0x3d7017(0x1de)](a61_0x419a89[_0x3d7017(0x1ea)](_0x21db12)+':\x20'+a61_0x419a89[_0x3d7017(0x1bd)]('none')+'\x20'+a61_0x419a89[_0x3d7017(0x1bd)]('(using\x20session:\x20'+this[_0x3d7017(0x1d6)]+')'));else(_0x21db12===_0x3d7017(0x1f1)||_0x21db12===_0x3d7017(0x1c0))&&console[_0x3d7017(0x1de)](a61_0x419a89['cyan'](_0x21db12)+':\x20'+a61_0x419a89['dim']('none'));}}}async['resolveAPIKeyAsync'](){const _0x5285cf=a61_0x376229;if(!this[_0x5285cf(0x1d1)]){const _0x13479b=await getOAuthTokens(this[_0x5285cf(0x1e7)]||undefined);if(_0x13479b){const _0x206e8d=0x5*0x3c*0x3e8,_0x2efb89=!_0x13479b['expires_at']||_0x13479b[_0x5285cf(0x1d5)]<Date[_0x5285cf(0x1d3)]()+_0x206e8d;if(_0x2efb89&&_0x13479b['refresh_token'])try{const _0x2572b7=getConsoleUrl(this[_0x5285cf(0x1b2)]),_0x472718=await refreshAccessToken(_0x2572b7,_0x13479b['refresh_token']);await saveOAuthTokens(_0x472718,this[_0x5285cf(0x1e7)]||undefined),this[_0x5285cf(0x1d1)]=_0x472718[_0x5285cf(0x1e0)];}catch{this[_0x5285cf(0x1d1)]=_0x13479b[_0x5285cf(0x1e0)];}else this['accessToken']=_0x13479b[_0x5285cf(0x1e0)];return undefined;}}return this[_0x5285cf(0x1ee)]=await getAPIKeyAsync(this[_0x5285cf(0x1b2)],this[_0x5285cf(0x1e7)]||undefined),this[_0x5285cf(0x1ee)];}static async['createAsync'](_0x33736a){const _0x445553=a61_0x376229,_0x319463=new GlobalContext(_0x33736a);return await _0x319463[_0x445553(0x1ba)](),_0x319463;}}
1
+ const a61_0x35a833=a61_0x5f41;(function(_0x57db7a,_0x853223){const _0x520ea4=a61_0x5f41,_0x43967d=_0x57db7a();while(!![]){try{const _0x65899a=-parseInt(_0x520ea4(0xdb))/0x1*(-parseInt(_0x520ea4(0xca))/0x2)+-parseInt(_0x520ea4(0x9d))/0x3*(parseInt(_0x520ea4(0xa5))/0x4)+-parseInt(_0x520ea4(0xd8))/0x5*(parseInt(_0x520ea4(0xd4))/0x6)+-parseInt(_0x520ea4(0xc9))/0x7*(-parseInt(_0x520ea4(0xd2))/0x8)+-parseInt(_0x520ea4(0xd1))/0x9+-parseInt(_0x520ea4(0xde))/0xa*(parseInt(_0x520ea4(0xe2))/0xb)+parseInt(_0x520ea4(0xa6))/0xc;if(_0x65899a===_0x853223)break;else _0x43967d['push'](_0x43967d['shift']());}catch(_0x188e48){_0x43967d['push'](_0x43967d['shift']());}}}(a61_0x34da,0x26998));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_0x36280f from'node:fs';function a61_0x5f41(_0x251cce,_0x298277){_0x251cce=_0x251cce-0x96;const _0x34da08=a61_0x34da();let _0x5f410d=_0x34da08[_0x251cce];return _0x5f410d;}function a61_0x34da(){const _0x59f89e=['config','log','9830FUDvsj','Profile\x20Credentials','replace','311xRBjYh','workflowProject','parse','210wXCfwS','parent_segment','loadGlobalConfig','getParameters','135663JCbcve','cli','profile','none','configFiles','resolveAPIKeyAsync','sessionId','getSource','profileCredentials','llm_agent','globalCredentials','session','existsSync','composable_audience','green','global','dim','proxy','llmProject','301791uDlvSZ','accessToken','cliFlags','access_token','CLI\x20flag:\x20--','Global\x20Credentials','sessions','segmentPath','4RnbwHz','7343856sGPkII','(using\x20session:\x20','logLevel','Project','readFileSync','[configuration\x20files]','llmAgent','Profile','now','composableAudience','displayWithSources','segment_path','activeProfile','env','layers','cyan','(active)','(session:\x20','parentSegment','workflow_project','assign','verbose','site','Global','apiKey','profileSource','createAsync','injectIntoOptions','tdx.json','[context]','display','entries','bold','llm_project','Session','210bxWEgt','734FmOTjx','us01','database','join','string','expires_at','project','2670831wsIdUO','27224tJyyAR','.env','42iMRDwK','refresh_token'];a61_0x34da=function(){return _0x59f89e;};return a61_0x34da();}import*as a61_0x3c8df3 from'node:path';import a61_0x39e652 from'chalk';export class GlobalContext{[a61_0x35a833(0xbc)];['database'];['parent_segment'];[a61_0x35a833(0xb1)];[a61_0x35a833(0xc7)];['llm_agent'];[a61_0x35a833(0xb9)];['composable_audience'];[a61_0x35a833(0xbe)];['accessToken'];[a61_0x35a833(0x9b)];[a61_0x35a833(0xbb)];[a61_0x35a833(0xa8)];[a61_0x35a833(0xe4)];['profileSource']=null;[a61_0x35a833(0xb4)];[a61_0x35a833(0xb2)];['sessionId'];[a61_0x35a833(0xe6)];constructor(_0x2e3a85){const _0x2ef647=a61_0x35a833;this[_0x2ef647(0xe8)]=getSessionID(_0x2e3a85[_0x2ef647(0xed)]);const _0xf1e396=loadSessionContext(_0x2e3a85['session']),_0x43c08f=loadProjectConfig(),_0x162d8e=this['loadGlobalConfig']();if(_0x2e3a85[_0x2ef647(0xe4)])this[_0x2ef647(0xb2)]=_0x2e3a85[_0x2ef647(0xe4)],this['profileSource']=_0x2ef647(0xe3);else{if(_0xf1e396?.['profile'])this[_0x2ef647(0xb2)]=_0xf1e396[_0x2ef647(0xe4)],this['profileSource']=_0x2ef647(0xed);else{if(_0x162d8e['profile'])this['activeProfile']=_0x162d8e[_0x2ef647(0xe4)],this['profileSource']=_0x2ef647(0xd6);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x2ef647(0xbf)]=_0x2ef647(0xb3)):(this[_0x2ef647(0xb2)]=null,this[_0x2ef647(0xbf)]=null);}}const _0x38b32c=this[_0x2ef647(0xb2)]?loadProfile(this[_0x2ef647(0xb2)]):null,_0x132aaf=_0x12da8c=>{const _0x4b880c=_0x2ef647;if(!_0x12da8c)return{};const _0xb91c1c=_0x12da8c,_0x5dcc03={};for(const [_0x2a0dc0,_0x4973e3]of Object[_0x4b880c(0xc5)](_0xb91c1c)){typeof _0x4973e3==='string'&&(_0x5dcc03[_0x2a0dc0]=_0x4973e3);}return _0x5dcc03;},_0x14778a={},_0x17707e=(_0x4ecd82,_0x586ad1,_0x203ba4)=>{const _0x3327ce=_0x2ef647;if(!_0x4ecd82)return![];if(_0x203ba4&&_0x4ecd82===_0x203ba4)return![];const _0x147247=_0xf1e396,_0x2b89df=_0x43c08f,_0x34ef90=_0x38b32c?.[_0x3327ce(0xd6)],_0x194d8f=_0x162d8e,_0xc7c61c=_0x147247?.[_0x586ad1],_0x5e3759=_0x2b89df?.[_0x586ad1],_0x47a9fc=_0x34ef90?.[_0x586ad1],_0xe10976=_0x194d8f[_0x586ad1];return _0x4ecd82!==_0xc7c61c&&_0x4ecd82!==_0x5e3759&&_0x4ecd82!==_0x47a9fc&&_0x4ecd82!==_0xe10976;},_0x4b7e46=[{'optionKey':_0x2ef647(0xbc),'contextKey':_0x2ef647(0xbc),'defaultValue':_0x2ef647(0xcb)},{'optionKey':_0x2ef647(0xcc),'contextKey':_0x2ef647(0xcc)},{'optionKey':_0x2ef647(0xb8),'contextKey':_0x2ef647(0xdf)},{'optionKey':'llmProject','contextKey':_0x2ef647(0xc7)},{'optionKey':_0x2ef647(0xac),'contextKey':_0x2ef647(0xeb)},{'optionKey':_0x2ef647(0xaf),'contextKey':_0x2ef647(0x97)},{'optionKey':_0x2ef647(0xe4),'contextKey':_0x2ef647(0xe4)}];for(const {optionKey:_0x52a34b,contextKey:_0x3e6d33,defaultValue:_0x5c563b}of _0x4b7e46){const _0x456ba8=_0x2e3a85[_0x52a34b];_0x17707e(_0x456ba8,_0x3e6d33,_0x5c563b)&&(_0x14778a[_0x3e6d33]=_0x456ba8);}this['layers']={'cliFlags':_0x14778a,'session':_0x132aaf(_0xf1e396),'project':_0x132aaf(_0x43c08f),'profile':_0x132aaf(_0x38b32c?.[_0x2ef647(0xd6)]),'global':_0x132aaf(_0x162d8e)};const _0x1b4ef8={...this[_0x2ef647(0xb4)][_0x2ef647(0x99)],...this[_0x2ef647(0xb4)]['profile'],...this['layers'][_0x2ef647(0xd0)]};process.env.TDX_SITE&&!this['layers']['session'][_0x2ef647(0xbc)]&&!this[_0x2ef647(0xb4)][_0x2ef647(0x9f)][_0x2ef647(0xbc)]&&(_0x1b4ef8[_0x2ef647(0xbc)]=process.env.TDX_SITE);Object[_0x2ef647(0xba)](_0x1b4ef8,this['layers'][_0x2ef647(0xed)]),Object[_0x2ef647(0xba)](_0x1b4ef8,this[_0x2ef647(0xb4)]['cliFlags']);const _0x210c3d=_0x1b4ef8[_0x2ef647(0xbc)]||'us01';this[_0x2ef647(0xbc)]=resolveSite(_0x210c3d),this[_0x2ef647(0xcc)]=_0x1b4ef8[_0x2ef647(0xcc)],this[_0x2ef647(0xdf)]=_0x1b4ef8[_0x2ef647(0xdf)],this[_0x2ef647(0xb1)]=_0x1b4ef8[_0x2ef647(0xb1)],this[_0x2ef647(0xc7)]=_0x1b4ef8[_0x2ef647(0xc7)],this['llm_agent']=_0x1b4ef8[_0x2ef647(0xeb)],this[_0x2ef647(0xb9)]=_0x1b4ef8[_0x2ef647(0xb9)],this['composable_audience']=_0x1b4ef8['composable_audience'],this['verbose']=_0x2e3a85[_0x2ef647(0xbb)]||![],this[_0x2ef647(0xa8)]=_0x2e3a85[_0x2ef647(0xa8)]??LogLevel['INFO'],this['profile']=this[_0x2ef647(0xb2)]||undefined,this[_0x2ef647(0x9e)]=getAccessToken(this['activeProfile']||undefined),this[_0x2ef647(0xbe)]=getAPIKey(this['activeProfile']||undefined);const _0x463762=typeof _0x162d8e[_0x2ef647(0x9b)]===_0x2ef647(0xce)?_0x162d8e[_0x2ef647(0x9b)]:undefined;this['proxy']=_0x463762||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x259042=getConfigDir(),_0x2dc57d=a61_0x3c8df3['join'](_0x259042,_0x2ef647(0xa3),this[_0x2ef647(0xe8)]+'.json'),_0xb332ed=findProjectConfigPath(),_0x53b89e=a61_0x3c8df3[_0x2ef647(0xcd)](_0x259042,'tdx.json'),_0x73ed36=a61_0x3c8df3[_0x2ef647(0xcd)](_0x259042,_0x2ef647(0xd3));let _0x406147=null,_0x305012=null;this[_0x2ef647(0xb2)]&&(_0x406147=a61_0x3c8df3['join'](_0x259042,'profiles',this['activeProfile'],_0x2ef647(0xc2)),_0x305012=a61_0x3c8df3[_0x2ef647(0xcd)](_0x259042,'profiles',this['activeProfile'],_0x2ef647(0xd3))),this['configFiles']={'session':a61_0x36280f['existsSync'](_0x2dc57d)?_0x2dc57d:null,'project':_0xb332ed,'profile':_0x406147&&a61_0x36280f['existsSync'](_0x406147)?_0x406147:null,'profileCredentials':_0x305012&&a61_0x36280f[_0x2ef647(0x96)](_0x305012)?_0x305012:null,'global':a61_0x36280f['existsSync'](_0x53b89e)?_0x53b89e:null,'globalCredentials':a61_0x36280f[_0x2ef647(0x96)](_0x73ed36)?_0x73ed36:null};}[a61_0x35a833(0xe9)](_0x172a6b,_0x162042){const _0x4f232c=a61_0x35a833;if(!_0x162042)return'not\x20set';const _0x5f56e7=_0x162042;if(this[_0x4f232c(0xb4)]['cliFlags'][_0x172a6b]===_0x5f56e7){if(_0x172a6b===_0x4f232c(0xbc)&&_0x5f56e7===_0x4f232c(0xcb)&&!this[_0x4f232c(0xb4)][_0x4f232c(0xed)][_0x4f232c(0xbc)]&&!this[_0x4f232c(0xb4)][_0x4f232c(0xd0)][_0x4f232c(0xbc)]&&!this[_0x4f232c(0xb4)][_0x4f232c(0xe4)]['site']&&!this[_0x4f232c(0xb4)][_0x4f232c(0x99)][_0x4f232c(0xbc)])return'default';return _0x4f232c(0xa1)+_0x172a6b[_0x4f232c(0xda)](/_/g,'-');}if(this[_0x4f232c(0xb4)][_0x4f232c(0xed)][_0x172a6b]===_0x5f56e7)return'session';if(this[_0x4f232c(0xb4)][_0x4f232c(0xd0)][_0x172a6b]===_0x5f56e7)return _0x4f232c(0xd0);if(this[_0x4f232c(0xb4)][_0x4f232c(0xe4)][_0x172a6b]===_0x5f56e7)return'profile:\x20'+this['activeProfile'];if(this['layers'][_0x4f232c(0x99)][_0x172a6b]===_0x5f56e7)return _0x4f232c(0x99);return'default';}[a61_0x35a833(0xe0)](){const _0x473043=a61_0x35a833,_0x75ec57=a61_0x3c8df3['join'](getConfigDir(),_0x473043(0xc2));if(!a61_0x36280f[_0x473043(0x96)](_0x75ec57))return{};try{const _0x9092c5=a61_0x36280f[_0x473043(0xaa)](_0x75ec57,'utf-8');return JSON[_0x473043(0xdd)](_0x9092c5);}catch{return{};}}[a61_0x35a833(0xc1)](_0x43cb40){const _0x29d8b8=a61_0x35a833;_0x43cb40[_0x29d8b8(0xbc)]=this[_0x29d8b8(0xbc)],!_0x43cb40[_0x29d8b8(0xcc)]&&this[_0x29d8b8(0xcc)]&&(_0x43cb40[_0x29d8b8(0xcc)]=this[_0x29d8b8(0xcc)]),!_0x43cb40[_0x29d8b8(0xb8)]&&this[_0x29d8b8(0xdf)]&&(_0x43cb40[_0x29d8b8(0xb8)]=this['parent_segment']),!_0x43cb40[_0x29d8b8(0xa4)]&&this[_0x29d8b8(0xb1)]&&(_0x43cb40[_0x29d8b8(0xa4)]=this[_0x29d8b8(0xb1)]),!_0x43cb40[_0x29d8b8(0x9c)]&&this['llm_project']&&(_0x43cb40['llmProject']=this[_0x29d8b8(0xc7)]),!_0x43cb40[_0x29d8b8(0xac)]&&this[_0x29d8b8(0xeb)]&&(_0x43cb40[_0x29d8b8(0xac)]=this[_0x29d8b8(0xeb)]),!_0x43cb40[_0x29d8b8(0xdc)]&&this[_0x29d8b8(0xb9)]&&(_0x43cb40[_0x29d8b8(0xdc)]=this[_0x29d8b8(0xb9)]),!_0x43cb40['composableAudience']&&this[_0x29d8b8(0x97)]&&(_0x43cb40[_0x29d8b8(0xaf)]=this[_0x29d8b8(0x97)]);}[a61_0x35a833(0xe1)](){const _0x5a3fe5=a61_0x35a833;return[{'key':_0x5a3fe5(0xbc),'value':this['site']},{'key':_0x5a3fe5(0xcc),'value':this[_0x5a3fe5(0xcc)]},{'key':_0x5a3fe5(0xdf),'value':this[_0x5a3fe5(0xdf)]},{'key':'segment_path','value':this[_0x5a3fe5(0xb1)]},{'key':_0x5a3fe5(0xc7),'value':this[_0x5a3fe5(0xc7)]},{'key':_0x5a3fe5(0xeb),'value':this['llm_agent']},{'key':_0x5a3fe5(0xb9),'value':this[_0x5a3fe5(0xb9)]},{'key':_0x5a3fe5(0x97),'value':this[_0x5a3fe5(0x97)]},{'key':_0x5a3fe5(0xe4),'value':this[_0x5a3fe5(0xb2)]||undefined}];}[a61_0x35a833(0xc4)](){const _0x1903a3=a61_0x35a833;console[_0x1903a3(0xd7)](a61_0x39e652[_0x1903a3(0xc6)](_0x1903a3(0xc3)));for(const {key:_0x37528a,value:_0x25cc02}of this[_0x1903a3(0xe1)]()){_0x25cc02&&console[_0x1903a3(0xd7)](a61_0x39e652[_0x1903a3(0xb5)](_0x37528a)+':\x20'+_0x25cc02);}}[a61_0x35a833(0xb0)](){const _0x2ab2a4=a61_0x35a833;console[_0x2ab2a4(0xd7)](a61_0x39e652[_0x2ab2a4(0xc6)](_0x2ab2a4(0xc3)));for(const {key:_0x2e546a,value:_0x49a66a}of this['getParameters']()){if(_0x49a66a){const _0x38986c=_0x2e546a==='profile'?_0x2ab2a4(0xb6):'('+this[_0x2ab2a4(0xe9)](_0x2e546a,_0x49a66a)+')';console[_0x2ab2a4(0xd7)](a61_0x39e652[_0x2ab2a4(0xb5)](_0x2e546a)+':\x20'+_0x49a66a+'\x20'+a61_0x39e652[_0x2ab2a4(0x9a)](_0x38986c));}}console['log']('\x0a'+a61_0x39e652[_0x2ab2a4(0xc6)](_0x2ab2a4(0xab)));const _0x23560a=[{'label':_0x2ab2a4(0xc8),'path':this['configFiles'][_0x2ab2a4(0xed)],'extra':_0x2ab2a4(0xb7)+this['sessionId']+')'},{'label':_0x2ab2a4(0xa9),'path':this[_0x2ab2a4(0xe6)]['project']},{'label':_0x2ab2a4(0xad),'path':this[_0x2ab2a4(0xe6)][_0x2ab2a4(0xe4)]},{'label':_0x2ab2a4(0xd9),'path':this[_0x2ab2a4(0xe6)][_0x2ab2a4(0xea)]},{'label':_0x2ab2a4(0xbd),'path':this['configFiles']['global']},{'label':_0x2ab2a4(0xa2),'path':this[_0x2ab2a4(0xe6)][_0x2ab2a4(0xec)]}];for(const {label:_0x5707fd,path:_0x138b29,extra:_0x47b382}of _0x23560a){if(_0x138b29)console[_0x2ab2a4(0xd7)](a61_0x39e652[_0x2ab2a4(0xb5)](_0x5707fd)+':\x20'+_0x138b29+'\x20'+a61_0x39e652[_0x2ab2a4(0x98)]('✓')+(_0x47b382?'\x20'+a61_0x39e652[_0x2ab2a4(0x9a)](_0x47b382):''));else{if(_0x5707fd===_0x2ab2a4(0xc8))console['log'](a61_0x39e652['cyan'](_0x5707fd)+':\x20'+a61_0x39e652[_0x2ab2a4(0x9a)](_0x2ab2a4(0xe5))+'\x20'+a61_0x39e652[_0x2ab2a4(0x9a)](_0x2ab2a4(0xa7)+this[_0x2ab2a4(0xe8)]+')'));else(_0x5707fd===_0x2ab2a4(0xa9)||_0x5707fd===_0x2ab2a4(0xbd))&&console[_0x2ab2a4(0xd7)](a61_0x39e652['cyan'](_0x5707fd)+':\x20'+a61_0x39e652[_0x2ab2a4(0x9a)](_0x2ab2a4(0xe5)));}}}async[a61_0x35a833(0xe7)](){const _0x163e9b=a61_0x35a833;if(!this['accessToken']){const _0x243028=await getOAuthTokens(this['activeProfile']||undefined);if(_0x243028){const _0x4f33b3=0x5*0x3c*0x3e8,_0x11b066=!_0x243028[_0x163e9b(0xcf)]||_0x243028[_0x163e9b(0xcf)]<Date[_0x163e9b(0xae)]()+_0x4f33b3;if(_0x11b066&&_0x243028[_0x163e9b(0xd5)])try{const _0x293290=getConsoleUrl(this[_0x163e9b(0xbc)]),_0xc23291=await refreshAccessToken(_0x293290,_0x243028[_0x163e9b(0xd5)]);await saveOAuthTokens(_0xc23291,this[_0x163e9b(0xb2)]||undefined),this[_0x163e9b(0x9e)]=_0xc23291[_0x163e9b(0xa0)];}catch{this[_0x163e9b(0x9e)]=_0x243028[_0x163e9b(0xa0)];}else this[_0x163e9b(0x9e)]=_0x243028[_0x163e9b(0xa0)];return undefined;}}return this[_0x163e9b(0xbe)]=await getAPIKeyAsync(this[_0x163e9b(0xbc)],this[_0x163e9b(0xb2)]||undefined),this[_0x163e9b(0xbe)];}static async[a61_0x35a833(0xc0)](_0xf8a997){const _0xbbdc31=a61_0x35a833,_0x47370a=new GlobalContext(_0xf8a997);return await _0x47370a[_0xbbdc31(0xe7)](),_0x47370a;}}
@@ -1 +1 @@
1
- const a62_0x5a9210=a62_0x17f8;(function(_0x2b7c41,_0x369cb5){const _0x3ef183=a62_0x17f8,_0x59ca17=_0x2b7c41();while(!![]){try{const _0x2af5ff=-parseInt(_0x3ef183(0x10f))/0x1+parseInt(_0x3ef183(0x124))/0x2*(parseInt(_0x3ef183(0x11a))/0x3)+-parseInt(_0x3ef183(0x10c))/0x4*(-parseInt(_0x3ef183(0x11e))/0x5)+parseInt(_0x3ef183(0x113))/0x6*(-parseInt(_0x3ef183(0x11b))/0x7)+parseInt(_0x3ef183(0x11c))/0x8*(-parseInt(_0x3ef183(0x12b))/0x9)+-parseInt(_0x3ef183(0x10e))/0xa+parseInt(_0x3ef183(0x10b))/0xb*(parseInt(_0x3ef183(0x111))/0xc);if(_0x2af5ff===_0x369cb5)break;else _0x59ca17['push'](_0x59ca17['shift']());}catch(_0x351054){_0x59ca17['push'](_0x59ca17['shift']());}}}(a62_0x3565,0x6a532));const SERVICE_NAME=a62_0x5a9210(0x123);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2cff0e=a62_0x5a9210;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0xad4a0a=await import(_0x2cff0e(0x128));return EntryClass=_0xad4a0a['Entry'],EntryClass;}catch(_0x430f3c){return keyringLoadError=_0x430f3c instanceof Error?_0x430f3c:new Error(String(_0x430f3c)),null;}}function a62_0x3565(){const _0x1e89d8=['26fkiINo','toLowerCase','could\x20not\x20be\x20found','unavailable','@napi-rs/keyring','no\x20matching\x20entry','not\x20available','697833uRIahy','message','access','-25293','success','2844105tjGXag','204ocsEQC','error','1886780KdOjxN','659084eqEozZ','access_denied','72XWhnXV','Warning:\x20','12PfpjTk',':api_key','setPassword','includes','-25300','reason','deleteCredential','136467ezjVRW','39214aSJRyj','88rJyNGO','getPassword','460qVQJqG','not\x20supported','__keychain_test__','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.','System\x20keychain\x20is\x20not\x20available','tdx'];a62_0x3565=function(){return _0x1e89d8;};return a62_0x3565();}function getAccountName(_0xd4da68){const _0x461cde=a62_0x5a9210,_0x2c1ccc=_0xd4da68||'';return'profile:'+_0x2c1ccc+_0x461cde(0x114);}function a62_0x17f8(_0x504d92,_0x298056){_0x504d92=_0x504d92-0x109;const _0x356590=a62_0x3565();let _0x17f8b3=_0x356590[_0x504d92];return _0x17f8b3;}export async function getKeychainAPIKey(_0x209bb3){const _0x1b7eda=a62_0x5a9210,_0x530da8=await getKeychainAPIKeyWithStatus(_0x209bb3);if(_0x530da8[_0x1b7eda(0x10a)])return _0x530da8['value'];return _0x530da8[_0x1b7eda(0x118)]===_0x1b7eda(0x110)&&console[_0x1b7eda(0x10d)](_0x1b7eda(0x112)+_0x530da8[_0x1b7eda(0x12c)]),null;}export async function getKeychainAPIKeyWithStatus(_0x163b1e){const _0x3f071f=a62_0x5a9210;try{const _0x2a29a4=await getEntryClass();if(!_0x2a29a4)return{'success':![],'reason':_0x3f071f(0x127)};const _0x506b37=getAccountName(_0x163b1e),_0x3f16a0=new _0x2a29a4(SERVICE_NAME,_0x506b37),_0x4e1a49=_0x3f16a0[_0x3f071f(0x11d)]();if(_0x4e1a49)return{'success':!![],'value':_0x4e1a49};return{'success':![],'reason':'not_found'};}catch(_0x2dd86c){const _0x368353=_0x2dd86c instanceof Error?_0x2dd86c[_0x3f071f(0x12c)]:String(_0x2dd86c);if(_0x368353[_0x3f071f(0x116)](_0x3f071f(0x117))||_0x368353['toLowerCase']()['includes'](_0x3f071f(0x126))||_0x368353[_0x3f071f(0x125)]()['includes']('not\x20found')||_0x368353[_0x3f071f(0x125)]()[_0x3f071f(0x116)](_0x3f071f(0x129)))return{'success':![],'reason':'not_found'};if(_0x368353[_0x3f071f(0x116)](_0x3f071f(0x109))||_0x368353[_0x3f071f(0x125)]()[_0x3f071f(0x116)]('restricted')||_0x368353['toLowerCase']()[_0x3f071f(0x116)](_0x3f071f(0x12d)))return{'success':![],'reason':_0x3f071f(0x110),'message':_0x3f071f(0x121)};return{'success':![],'reason':_0x3f071f(0x127),'message':_0x368353};}}export async function saveKeychainAPIKey(_0x5e85b2,_0x42d3e4){const _0x170ddd=a62_0x5a9210,_0x5d1da5=await getEntryClass();if(!_0x5d1da5)throw new Error(_0x170ddd(0x122));const _0x2c24ae=getAccountName(_0x42d3e4),_0xb0500d=new _0x5d1da5(SERVICE_NAME,_0x2c24ae);_0xb0500d[_0x170ddd(0x115)](_0x5e85b2);}export async function deleteKeychainAPIKey(_0x305068){const _0x46fb31=a62_0x5a9210;try{const _0x4ba34c=await getEntryClass();if(!_0x4ba34c)return![];const _0x254525=getAccountName(_0x305068),_0x397575=new _0x4ba34c(SERVICE_NAME,_0x254525);return _0x397575[_0x46fb31(0x119)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x20a94b=a62_0x5a9210;try{const _0x1d5e47=await getEntryClass();if(!_0x1d5e47)return![];const _0x54c1c5=new _0x1d5e47(SERVICE_NAME,_0x20a94b(0x120));return _0x54c1c5[_0x20a94b(0x11d)](),!![];}catch(_0x1761d4){const _0x5e223f=_0x1761d4 instanceof Error?_0x1761d4[_0x20a94b(0x12c)][_0x20a94b(0x125)]():'';if(_0x5e223f[_0x20a94b(0x116)](_0x20a94b(0x12a))||_0x5e223f[_0x20a94b(0x116)](_0x20a94b(0x11f))||_0x5e223f['includes']('cannot\x20find'))return![];return!![];}}
1
+ const a62_0x55f221=a62_0x353e;function a62_0x139c(){const _0x145962=['14nfTdhp','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.','-25300','33hIKpmk','getPassword','System\x20keychain\x20is\x20not\x20available','profile:','5EPdahh','5181202QnFreE','59350XpOXZV','tdx','cannot\x20find','reason','__keychain_test__','includes','toLowerCase','access_denied','Warning:\x20','1506636RsBXoB','not\x20found','Entry','707rZSaTB','access','message','not_found','342CcdcCJ','setPassword','unavailable','deleteCredential','could\x20not\x20be\x20found','354189JNnGId',':api_key','value','1755744VVLOcH','error','2kmrCIU','not\x20available','17176coFlqF','@napi-rs/keyring','not\x20supported','4zCOxRh','no\x20matching\x20entry','restricted','187645fyuCLl'];a62_0x139c=function(){return _0x145962;};return a62_0x139c();}(function(_0x289974,_0x14ee6f){const _0x25f86a=a62_0x353e,_0x1e47cb=_0x289974();while(!![]){try{const _0x192cc9=-parseInt(_0x25f86a(0x1a4))/0x1*(-parseInt(_0x25f86a(0x19c))/0x2)+parseInt(_0x25f86a(0x197))/0x3*(-parseInt(_0x25f86a(0x1a1))/0x4)+parseInt(_0x25f86a(0x180))/0x5*(-parseInt(_0x25f86a(0x19a))/0x6)+-parseInt(_0x25f86a(0x18e))/0x7*(-parseInt(_0x25f86a(0x19e))/0x8)+parseInt(_0x25f86a(0x192))/0x9*(parseInt(_0x25f86a(0x182))/0xa)+parseInt(_0x25f86a(0x17c))/0xb*(parseInt(_0x25f86a(0x18b))/0xc)+parseInt(_0x25f86a(0x181))/0xd*(-parseInt(_0x25f86a(0x1a5))/0xe);if(_0x192cc9===_0x14ee6f)break;else _0x1e47cb['push'](_0x1e47cb['shift']());}catch(_0x46cd14){_0x1e47cb['push'](_0x1e47cb['shift']());}}}(a62_0x139c,0x30340));const SERVICE_NAME=a62_0x55f221(0x183);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2f1bb3=a62_0x55f221;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x455f48=await import(_0x2f1bb3(0x19f));return EntryClass=_0x455f48[_0x2f1bb3(0x18d)],EntryClass;}catch(_0x236eff){return keyringLoadError=_0x236eff instanceof Error?_0x236eff:new Error(String(_0x236eff)),null;}}function getAccountName(_0x56bbc0){const _0x562abd=a62_0x55f221,_0x419888=_0x56bbc0||'';return _0x562abd(0x17f)+_0x419888+_0x562abd(0x198);}export async function getKeychainAPIKey(_0x2a48e0){const _0x6fe773=a62_0x55f221,_0x15b261=await getKeychainAPIKeyWithStatus(_0x2a48e0);if(_0x15b261['success'])return _0x15b261[_0x6fe773(0x199)];return _0x15b261[_0x6fe773(0x185)]===_0x6fe773(0x189)&&console[_0x6fe773(0x19b)](_0x6fe773(0x18a)+_0x15b261[_0x6fe773(0x190)]),null;}function a62_0x353e(_0x1bf0d6,_0x5dff03){_0x1bf0d6=_0x1bf0d6-0x17b;const _0x139c14=a62_0x139c();let _0x353ef0=_0x139c14[_0x1bf0d6];return _0x353ef0;}export async function getKeychainAPIKeyWithStatus(_0x26833f){const _0x7c6518=a62_0x55f221;try{const _0x47e114=await getEntryClass();if(!_0x47e114)return{'success':![],'reason':_0x7c6518(0x194)};const _0x18f6a6=getAccountName(_0x26833f),_0x3b78b9=new _0x47e114(SERVICE_NAME,_0x18f6a6),_0x23084a=_0x3b78b9[_0x7c6518(0x17d)]();if(_0x23084a)return{'success':!![],'value':_0x23084a};return{'success':![],'reason':'not_found'};}catch(_0x3fd538){const _0x48e564=_0x3fd538 instanceof Error?_0x3fd538[_0x7c6518(0x190)]:String(_0x3fd538);if(_0x48e564[_0x7c6518(0x187)](_0x7c6518(0x17b))||_0x48e564[_0x7c6518(0x188)]()['includes'](_0x7c6518(0x196))||_0x48e564['toLowerCase']()['includes'](_0x7c6518(0x18c))||_0x48e564[_0x7c6518(0x188)]()['includes'](_0x7c6518(0x1a2)))return{'success':![],'reason':_0x7c6518(0x191)};if(_0x48e564[_0x7c6518(0x187)]('-25293')||_0x48e564[_0x7c6518(0x188)]()[_0x7c6518(0x187)](_0x7c6518(0x1a3))||_0x48e564[_0x7c6518(0x188)]()[_0x7c6518(0x187)](_0x7c6518(0x18f)))return{'success':![],'reason':_0x7c6518(0x189),'message':_0x7c6518(0x1a6)};return{'success':![],'reason':_0x7c6518(0x194),'message':_0x48e564};}}export async function saveKeychainAPIKey(_0x1777f7,_0x59872d){const _0x3d6e50=a62_0x55f221,_0x150818=await getEntryClass();if(!_0x150818)throw new Error(_0x3d6e50(0x17e));const _0x14524e=getAccountName(_0x59872d),_0xc518f=new _0x150818(SERVICE_NAME,_0x14524e);_0xc518f[_0x3d6e50(0x193)](_0x1777f7);}export async function deleteKeychainAPIKey(_0x1d5817){const _0x497c8a=a62_0x55f221;try{const _0x4ecf70=await getEntryClass();if(!_0x4ecf70)return![];const _0x27b854=getAccountName(_0x1d5817),_0x4d2193=new _0x4ecf70(SERVICE_NAME,_0x27b854);return _0x4d2193[_0x497c8a(0x195)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x2f52fd=a62_0x55f221;try{const _0x557508=await getEntryClass();if(!_0x557508)return![];const _0x4ecadc=new _0x557508(SERVICE_NAME,_0x2f52fd(0x186));return _0x4ecadc[_0x2f52fd(0x17d)](),!![];}catch(_0xe5814){const _0x5f4266=_0xe5814 instanceof Error?_0xe5814[_0x2f52fd(0x190)]['toLowerCase']():'';if(_0x5f4266[_0x2f52fd(0x187)](_0x2f52fd(0x19d))||_0x5f4266[_0x2f52fd(0x187)](_0x2f52fd(0x1a0))||_0x5f4266['includes'](_0x2f52fd(0x184)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x5bfb2f,_0x258832){const _0x2ee1b7=a63_0x4935,_0xc6f2dc=_0x5bfb2f();while(!![]){try{const _0x26b744=-parseInt(_0x2ee1b7(0xf6))/0x1*(parseInt(_0x2ee1b7(0xfa))/0x2)+parseInt(_0x2ee1b7(0x104))/0x3+parseInt(_0x2ee1b7(0xfd))/0x4*(-parseInt(_0x2ee1b7(0xfe))/0x5)+-parseInt(_0x2ee1b7(0x103))/0x6+parseInt(_0x2ee1b7(0x105))/0x7*(-parseInt(_0x2ee1b7(0xfb))/0x8)+parseInt(_0x2ee1b7(0x101))/0x9*(-parseInt(_0x2ee1b7(0x106))/0xa)+parseInt(_0x2ee1b7(0x102))/0xb;if(_0x26b744===_0x258832)break;else _0xc6f2dc['push'](_0xc6f2dc['shift']());}catch(_0x1e7188){_0xc6f2dc['push'](_0xc6f2dc['shift']());}}}(a63_0x186c,0xc9529));const SERVICE_NAME='tdx';function a63_0x186c(){const _0x35d6ac=['8Emdlon','setPassword','76kexBab','259015DooGXd','Entry','profile:','7656057MfVEvY','38563921hsvjRg','477606MsZhgU','89046cTAyCM','317303rzJHjI','10QIaywy','getPassword','System\x20keychain\x20is\x20not\x20available','2PzKTwU','deleteCredential',':oauth_tokens','stringify','751016xplOkZ'];a63_0x186c=function(){return _0x35d6ac;};return a63_0x186c();}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2e66e9=a63_0x4935;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x11ef46=await import('@napi-rs/keyring');return EntryClass=_0x11ef46[_0x2e66e9(0xff)],EntryClass;}catch(_0x305c2c){return keyringLoadError=_0x305c2c instanceof Error?_0x305c2c:new Error(String(_0x305c2c)),null;}}function getOAuthAccountName(_0x109be6){const _0x140699=a63_0x4935,_0x5bec88=_0x109be6||'';return _0x140699(0x100)+_0x5bec88+_0x140699(0xf8);}export async function saveOAuthTokens(_0x518acd,_0x9bd05a){const _0x39009c=a63_0x4935,_0x10d7ae=await getEntryClass();if(!_0x10d7ae)throw new Error(_0x39009c(0xf5));const _0x3ad83b=getOAuthAccountName(_0x9bd05a),_0x329ff1=new _0x10d7ae(SERVICE_NAME,_0x3ad83b);_0x329ff1[_0x39009c(0xfc)](JSON[_0x39009c(0xf9)](_0x518acd));}function a63_0x4935(_0x1210ee,_0x58058a){_0x1210ee=_0x1210ee-0xf4;const _0x186c10=a63_0x186c();let _0x49353a=_0x186c10[_0x1210ee];return _0x49353a;}export async function getOAuthTokens(_0x26e15d){const _0x25ec21=a63_0x4935;try{const _0x5e08c2=await getEntryClass();if(!_0x5e08c2)return null;const _0x2c642b=getOAuthAccountName(_0x26e15d),_0x1855a7=new _0x5e08c2(SERVICE_NAME,_0x2c642b),_0x8d5469=_0x1855a7[_0x25ec21(0xf4)]();if(_0x8d5469)return JSON['parse'](_0x8d5469);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x38bf9d){const _0x3381ef=a63_0x4935;try{const _0x2ce87c=await getEntryClass();if(!_0x2ce87c)return![];const _0x20daed=getOAuthAccountName(_0x38bf9d),_0x1b7e8a=new _0x2ce87c(SERVICE_NAME,_0x20daed);return _0x1b7e8a[_0x3381ef(0xf7)](),!![];}catch{return![];}}
1
+ const a63_0x5567fa=a63_0x3298;(function(_0x2250bb,_0x2fe80f){const _0x2464e1=a63_0x3298,_0xbb23e4=_0x2250bb();while(!![]){try{const _0x550791=-parseInt(_0x2464e1(0x1cf))/0x1+parseInt(_0x2464e1(0x1cc))/0x2*(-parseInt(_0x2464e1(0x1c5))/0x3)+-parseInt(_0x2464e1(0x1d2))/0x4+-parseInt(_0x2464e1(0x1cd))/0x5+parseInt(_0x2464e1(0x1c3))/0x6*(parseInt(_0x2464e1(0x1ca))/0x7)+-parseInt(_0x2464e1(0x1d4))/0x8+-parseInt(_0x2464e1(0x1c9))/0x9*(-parseInt(_0x2464e1(0x1cb))/0xa);if(_0x550791===_0x2fe80f)break;else _0xbb23e4['push'](_0xbb23e4['shift']());}catch(_0xdb18a){_0xbb23e4['push'](_0xbb23e4['shift']());}}}(a63_0x3a08,0x1a00a));const SERVICE_NAME=a63_0x5567fa(0x1d0);let EntryClass=null,keyringLoadError=null;function a63_0x3298(_0x1c43fc,_0x141ed7){_0x1c43fc=_0x1c43fc-0x1c3;const _0x3a0822=a63_0x3a08();let _0x329833=_0x3a0822[_0x1c43fc];return _0x329833;}function a63_0x3a08(){const _0x5dd0f8=['637485BNvpLD','parse','202322izbznV','tdx','System\x20keychain\x20is\x20not\x20available','830108gkoSLl','@napi-rs/keyring','1002576bSRrQE','6nGXVaG','Entry','3HEKPjn','getPassword','deleteCredential','profile:','3172806RixxSL','1297744aWuhPp','20gcIBFA','242572gNAfFg'];a63_0x3a08=function(){return _0x5dd0f8;};return a63_0x3a08();}async function getEntryClass(){const _0x14888c=a63_0x5567fa;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3c6393=await import(_0x14888c(0x1d3));return EntryClass=_0x3c6393[_0x14888c(0x1c4)],EntryClass;}catch(_0x145bbe){return keyringLoadError=_0x145bbe instanceof Error?_0x145bbe:new Error(String(_0x145bbe)),null;}}function getOAuthAccountName(_0x3a036e){const _0x501b17=a63_0x5567fa,_0x3892c6=_0x3a036e||'';return _0x501b17(0x1c8)+_0x3892c6+':oauth_tokens';}export async function saveOAuthTokens(_0x46df9e,_0x580c4d){const _0x25adba=a63_0x5567fa,_0x203f4a=await getEntryClass();if(!_0x203f4a)throw new Error(_0x25adba(0x1d1));const _0x1d4199=getOAuthAccountName(_0x580c4d),_0x100581=new _0x203f4a(SERVICE_NAME,_0x1d4199);_0x100581['setPassword'](JSON['stringify'](_0x46df9e));}export async function getOAuthTokens(_0x2d2db5){const _0x179691=a63_0x5567fa;try{const _0x234848=await getEntryClass();if(!_0x234848)return null;const _0x27189a=getOAuthAccountName(_0x2d2db5),_0x27b894=new _0x234848(SERVICE_NAME,_0x27189a),_0x38537d=_0x27b894[_0x179691(0x1c6)]();if(_0x38537d)return JSON[_0x179691(0x1ce)](_0x38537d);return null;}catch{return null;}}export async function deleteOAuthTokens(_0xcbcfed){const _0x4fdd59=a63_0x5567fa;try{const _0x30f7bf=await getEntryClass();if(!_0x30f7bf)return![];const _0x674c1e=getOAuthAccountName(_0xcbcfed),_0x478343=new _0x30f7bf(SERVICE_NAME,_0x674c1e);return _0x478343[_0x4fdd59(0x1c7)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- function a64_0x5a43(_0x3b7ec1,_0x49f7b6){_0x3b7ec1=_0x3b7ec1-0x13c;const _0x4c760f=a64_0x4c76();let _0x5a43c7=_0x4c760f[_0x3b7ec1];return _0x5a43c7;}const a64_0x30a8f6=a64_0x5a43;(function(_0x50feb4,_0x5489d6){const _0x24243a=a64_0x5a43,_0x1b4e21=_0x50feb4();while(!![]){try{const _0x4967d8=-parseInt(_0x24243a(0x143))/0x1*(-parseInt(_0x24243a(0x17b))/0x2)+-parseInt(_0x24243a(0x16f))/0x3*(parseInt(_0x24243a(0x156))/0x4)+parseInt(_0x24243a(0x165))/0x5+parseInt(_0x24243a(0x14d))/0x6+parseInt(_0x24243a(0x14c))/0x7*(parseInt(_0x24243a(0x141))/0x8)+parseInt(_0x24243a(0x168))/0x9+-parseInt(_0x24243a(0x173))/0xa*(parseInt(_0x24243a(0x178))/0xb);if(_0x4967d8===_0x5489d6)break;else _0x1b4e21['push'](_0x1b4e21['shift']());}catch(_0x2f6690){_0x1b4e21['push'](_0x1b4e21['shift']());}}}(a64_0x4c76,0x2438a));import*as a64_0x286903 from'node:crypto';function a64_0x4c76(){const _0x238218=['end','application/x-www-form-urlencoded','expires_in','S256','authorization_code','/users/initiate_sso','text','216776eNQGmb','1185300CVPtwF','createServer','digest','toString','clientId','EADDRINUSE','error','createHash','access_token','12CogPuU','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','now','url','writeHead','scope','/oauth/token','Not\x20Found','http://127.0.0.1','json','searchParams','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','waitForCallback','state','790790dFijvF','account_name','code','2510631WXYLiI','codeChallenge','text/plain','accountName','close','tdx','get','206376hmRFDU','redirect_uri','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','text/html','10tTLiyM','/oauth/authorize','randomBytes','update','base64url','6963077RMKBYW','redirectUri','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','396476EEWxaA','):\x20','code_challenge_method','client_id','/oauth/callback','redirect_to_path','sha256','40ccxehY','set','1jPirlj','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes'];a64_0x4c76=function(){return _0x238218;};return a64_0x4c76();}import*as a64_0xa79a51 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a64_0x30a8f6(0x13e);export function getOAuthClientId(){const _0x4fbd56=a64_0x30a8f6;return process.env.TD_OAUTH_CLIENT_ID||_0x4fbd56(0x16d);}export function generatePKCEPair(){const _0xda9b3a=a64_0x30a8f6,_0x1b3e15=a64_0x286903['randomBytes'](0x20)['toString'](_0xda9b3a(0x177)),_0x233028=a64_0x286903[_0xda9b3a(0x154)](_0xda9b3a(0x140))[_0xda9b3a(0x176)](_0x1b3e15)[_0xda9b3a(0x14f)](_0xda9b3a(0x177));return{'verifier':_0x1b3e15,'challenge':_0x233028};}export function buildAuthorizeURL(_0x582d5d,_0x3143ff){const _0x259011=a64_0x30a8f6,_0x308a20=new URL(_0x259011(0x174),_0x582d5d);return _0x308a20[_0x259011(0x160)][_0x259011(0x142)]('response_type','code'),_0x308a20[_0x259011(0x160)][_0x259011(0x142)](_0x259011(0x13d),_0x3143ff[_0x259011(0x151)]),_0x308a20['searchParams'][_0x259011(0x142)](_0x259011(0x170),_0x3143ff[_0x259011(0x179)]),_0x308a20[_0x259011(0x160)][_0x259011(0x142)](_0x259011(0x164),_0x3143ff[_0x259011(0x164)]),_0x308a20[_0x259011(0x160)][_0x259011(0x142)]('code_challenge',_0x3143ff[_0x259011(0x169)]),_0x308a20[_0x259011(0x160)]['set'](_0x259011(0x13c),_0x259011(0x148)),_0x3143ff['scope']&&_0x308a20[_0x259011(0x160)][_0x259011(0x142)](_0x259011(0x15b),_0x3143ff[_0x259011(0x15b)]),_0x308a20[_0x259011(0x150)]();}export function buildSSOInitiateURL(_0x485a25,_0x2d7742,_0x13ef66){const _0x17e321=a64_0x30a8f6,_0x4ac836=new URL(_0x17e321(0x14a),_0x485a25);_0x4ac836['searchParams'][_0x17e321(0x142)](_0x17e321(0x166),_0x2d7742);const _0xbf303c=_0x13ef66['replace'](_0x485a25,'');return _0x4ac836['searchParams'][_0x17e321(0x142)](_0x17e321(0x13f),_0xbf303c),_0x4ac836['toString']();}export async function postTokenRequest(_0x5aec8e,_0x481d5b){const _0x2372c6=a64_0x30a8f6,_0x1fcd96=new URLSearchParams(_0x481d5b)[_0x2372c6(0x150)](),_0x4f05ae=await fetch(_0x5aec8e,{'method':'POST','headers':{'Content-Type':_0x2372c6(0x146)},'body':_0x1fcd96});if(!_0x4f05ae['ok']){const _0x3e7f79=await _0x4f05ae[_0x2372c6(0x14b)]();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0x4f05ae['status']+_0x2372c6(0x17c)+_0x3e7f79);}const _0x3ed4d4=await _0x4f05ae[_0x2372c6(0x15f)]();return{'access_token':_0x3ed4d4[_0x2372c6(0x155)],'refresh_token':_0x3ed4d4['refresh_token'],'scope':_0x3ed4d4[_0x2372c6(0x15b)],'expires_at':_0x3ed4d4[_0x2372c6(0x147)]?Date[_0x2372c6(0x158)]()+_0x3ed4d4[_0x2372c6(0x147)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x4a2386,_0x4fac41,_0x1a6f89,_0x413a55){const _0x478b4b=a64_0x30a8f6,_0x1a3437=_0x4a2386+_0x478b4b(0x15c);return postTokenRequest(_0x1a3437,{'grant_type':_0x478b4b(0x149),'client_id':getOAuthClientId(),'code':_0x4fac41,'code_verifier':_0x1a6f89,'redirect_uri':_0x413a55});}export function startLocalCallbackServer(){const _0x2badae=a64_0x30a8f6;let _0x9df349,_0x2c1947;const _0x3272ce=new Promise((_0x845e66,_0x30d912)=>{_0x9df349=_0x845e66,_0x2c1947=_0x30d912;}),_0x44bb61=a64_0xa79a51[_0x2badae(0x14e)]((_0xa38b84,_0x43995b)=>{const _0x47af4b=_0x2badae,_0x167db9=new URL(_0xa38b84[_0x47af4b(0x159)]||'/',_0x47af4b(0x15e));if(_0x167db9['pathname']!=='/oauth/callback'){_0x43995b[_0x47af4b(0x15a)](0x194,{'Content-Type':_0x47af4b(0x16a)}),_0x43995b[_0x47af4b(0x145)](_0x47af4b(0x15d));return;}const _0x4d87d2=_0x167db9['searchParams'][_0x47af4b(0x16e)](_0x47af4b(0x167)),_0x53fdc2=_0x167db9[_0x47af4b(0x160)][_0x47af4b(0x16e)](_0x47af4b(0x164)),_0x3cd9c5=_0x167db9[_0x47af4b(0x160)][_0x47af4b(0x16e)](_0x47af4b(0x153));if(_0x3cd9c5||!_0x4d87d2||!_0x53fdc2){_0x43995b[_0x47af4b(0x15a)](0x190,{'Content-Type':_0x47af4b(0x172)}),_0x43995b[_0x47af4b(0x145)](_0x47af4b(0x161)),_0x2c1947(new Error(_0x47af4b(0x162)));return;}_0x43995b[_0x47af4b(0x15a)](0xc8,{'Content-Type':_0x47af4b(0x172)}),_0x43995b[_0x47af4b(0x145)](_0x47af4b(0x171)),_0x9df349({'code':_0x4d87d2,'state':_0x53fdc2});});_0x44bb61['on'](_0x2badae(0x153),_0x147ff3=>{const _0x7d9b8b=_0x2badae;_0x147ff3[_0x7d9b8b(0x167)]===_0x7d9b8b(0x152)?_0x2c1947(new Error('Port\x20'+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x2c1947(new Error(_0x7d9b8b(0x157)+_0x147ff3['message']));}),_0x44bb61['listen'](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0xc1d464=setTimeout(()=>{const _0x50fc90=_0x2badae;_0x2c1947(new Error(_0x50fc90(0x144))),_0x44bb61[_0x50fc90(0x16c)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x3272ce,'close':()=>{const _0x49a246=_0x2badae;clearTimeout(_0xc1d464),_0x44bb61[_0x49a246(0x16c)]();}};}export async function startOAuthFlow(_0x362980,_0x1e05e8){const _0x4cb977=a64_0x30a8f6,_0x351b13=getConsoleUrl(_0x362980),_0x393041=getOAuthClientId(),{verifier:_0x3cd0c,challenge:_0xeea8fd}=generatePKCEPair(),_0xf32aeb=a64_0x286903[_0x4cb977(0x175)](0x10)[_0x4cb977(0x150)]('hex'),_0x39b328=startLocalCallbackServer();try{const _0x17e122=OAUTH_REDIRECT_URI,_0x3e9aad=buildAuthorizeURL(_0x351b13,{'clientId':_0x393041,'redirectUri':_0x17e122,'state':_0xf32aeb,'codeChallenge':_0xeea8fd,'scope':'openid\x20email\x20profile'}),_0x472e76=_0x1e05e8?.[_0x4cb977(0x16b)]?buildSSOInitiateURL(_0x351b13,_0x1e05e8['accountName'],_0x3e9aad):_0x3e9aad;openBrowser(_0x472e76);const _0x5663b7=await _0x39b328[_0x4cb977(0x163)]();if(_0x5663b7[_0x4cb977(0x164)]!==_0xf32aeb)throw new Error(_0x4cb977(0x17a));return await exchangeCodeForTokens(_0x351b13,_0x5663b7['code'],_0x3cd0c,_0x17e122);}finally{_0x39b328[_0x4cb977(0x16c)]();}}
1
+ const a64_0x2d94b9=a64_0x2908;(function(_0x1be680,_0x2da5f7){const _0x37e7c7=a64_0x2908,_0x39d99e=_0x1be680();while(!![]){try{const _0x16dc30=-parseInt(_0x37e7c7(0xf6))/0x1+parseInt(_0x37e7c7(0xc9))/0x2+-parseInt(_0x37e7c7(0xb8))/0x3+-parseInt(_0x37e7c7(0xb9))/0x4+parseInt(_0x37e7c7(0xe2))/0x5+-parseInt(_0x37e7c7(0xe0))/0x6*(-parseInt(_0x37e7c7(0xd3))/0x7)+-parseInt(_0x37e7c7(0xc5))/0x8*(-parseInt(_0x37e7c7(0xd0))/0x9);if(_0x16dc30===_0x2da5f7)break;else _0x39d99e['push'](_0x39d99e['shift']());}catch(_0x199523){_0x39d99e['push'](_0x39d99e['shift']());}}}(a64_0x1263,0x7d6a6));import*as a64_0x59332c from'node:crypto';import*as a64_0x18f1c8 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_0x2d94b9(0xdc)+OAUTH_CALLBACK_PORT+a64_0x2d94b9(0xe9);export function getOAuthClientId(){const _0x45410b=a64_0x2d94b9;return process.env.TD_OAUTH_CLIENT_ID||_0x45410b(0xf5);}export function generatePKCEPair(){const _0x4acbbb=a64_0x2d94b9,_0x3130e1=a64_0x59332c[_0x4acbbb(0xe8)](0x20)[_0x4acbbb(0xe3)](_0x4acbbb(0xc6)),_0x197c4f=a64_0x59332c[_0x4acbbb(0xd5)](_0x4acbbb(0xcb))['update'](_0x3130e1)[_0x4acbbb(0xd6)](_0x4acbbb(0xc6));return{'verifier':_0x3130e1,'challenge':_0x197c4f};}export function buildAuthorizeURL(_0x4f8892,_0x4491f2){const _0x411cb5=a64_0x2d94b9,_0x4286ab=new URL(_0x411cb5(0xbc),_0x4f8892);return _0x4286ab['searchParams'][_0x411cb5(0xc3)](_0x411cb5(0xf2),_0x411cb5(0xf7)),_0x4286ab['searchParams'][_0x411cb5(0xc3)](_0x411cb5(0xed),_0x4491f2['clientId']),_0x4286ab['searchParams'][_0x411cb5(0xc3)](_0x411cb5(0xcf),_0x4491f2['redirectUri']),_0x4286ab[_0x411cb5(0xca)][_0x411cb5(0xc3)](_0x411cb5(0xd1),_0x4491f2[_0x411cb5(0xd1)]),_0x4286ab['searchParams'][_0x411cb5(0xc3)]('code_challenge',_0x4491f2[_0x411cb5(0xd2)]),_0x4286ab['searchParams'][_0x411cb5(0xc3)]('code_challenge_method',_0x411cb5(0xcc)),_0x4491f2['scope']&&_0x4286ab[_0x411cb5(0xca)]['set'](_0x411cb5(0xcd),_0x4491f2['scope']),_0x4286ab['toString']();}export function buildSSOInitiateURL(_0x318258,_0x2b3e92,_0x5e507e){const _0xa19f2e=a64_0x2d94b9,_0xd76cea=new URL(_0xa19f2e(0xbb),_0x318258);_0xd76cea[_0xa19f2e(0xca)][_0xa19f2e(0xc3)](_0xa19f2e(0xda),_0x2b3e92);const _0x3289da=_0x5e507e[_0xa19f2e(0xf8)](_0x318258,'');return _0xd76cea[_0xa19f2e(0xca)][_0xa19f2e(0xc3)](_0xa19f2e(0xbf),_0x3289da),_0xd76cea[_0xa19f2e(0xe3)]();}export async function postTokenRequest(_0x139729,_0xaaa551){const _0x2a2695=a64_0x2d94b9,_0xf66da2=new URLSearchParams(_0xaaa551)[_0x2a2695(0xe3)](),_0x381ef9=await fetch(_0x139729,{'method':_0x2a2695(0xdb),'headers':{'Content-Type':_0x2a2695(0xc0)},'body':_0xf66da2});if(!_0x381ef9['ok']){const _0x5908e3=await _0x381ef9[_0x2a2695(0xd9)]();throw new Error(_0x2a2695(0xc2)+_0x381ef9[_0x2a2695(0xf3)]+_0x2a2695(0xeb)+_0x5908e3);}const _0x11e5cc=await _0x381ef9[_0x2a2695(0xba)]();return{'access_token':_0x11e5cc['access_token'],'refresh_token':_0x11e5cc['refresh_token'],'scope':_0x11e5cc[_0x2a2695(0xcd)],'expires_at':_0x11e5cc[_0x2a2695(0xdf)]?Date[_0x2a2695(0xef)]()+_0x11e5cc['expires_in']*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x47895a,_0x4e9c0a,_0x2a97eb,_0x2adf40){const _0x4b45f2=a64_0x2d94b9,_0xb36001=_0x47895a+_0x4b45f2(0xbd);return postTokenRequest(_0xb36001,{'grant_type':_0x4b45f2(0xe6),'client_id':getOAuthClientId(),'code':_0x4e9c0a,'code_verifier':_0x2a97eb,'redirect_uri':_0x2adf40});}function a64_0x1263(){const _0xfe41e3=['redirect_to_path','application/x-www-form-urlencoded','text/html','OAuth\x20token\x20request\x20failed\x20(','set','accountName','8hzioyf','base64url','get','writeHead','1409576DroaaJ','searchParams','sha256','S256','scope','EADDRINUSE','redirect_uri','6412428ACxHYx','state','codeChallenge','3311wNEpGq','openid\x20email\x20profile','createHash','digest','text/plain','hex','text','account_name','POST','http://localhost:','close','url','expires_in','9480SqrRSf','error','172895aYishi','toString','waitForCallback','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','authorization_code','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','randomBytes','/oauth/callback','Port\x20','):\x20','pathname','client_id','createServer','now','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','response_type','status','listen','tdx','754550fSjAvx','code','replace','587961AKiAty','2939840OHQmEX','json','/users/initiate_sso','/oauth/authorize','/oauth/token','Not\x20Found'];a64_0x1263=function(){return _0xfe41e3;};return a64_0x1263();}export function startLocalCallbackServer(){const _0x3d13a3=a64_0x2d94b9;let _0x9641a1,_0x395b38;const _0x21400c=new Promise((_0x28db8f,_0x28af49)=>{_0x9641a1=_0x28db8f,_0x395b38=_0x28af49;}),_0x330bff=a64_0x18f1c8[_0x3d13a3(0xee)]((_0x5d44be,_0x1db3b5)=>{const _0x513134=_0x3d13a3,_0x2f2ef8=new URL(_0x5d44be[_0x513134(0xde)]||'/','http://127.0.0.1');if(_0x2f2ef8[_0x513134(0xec)]!==_0x513134(0xe9)){_0x1db3b5[_0x513134(0xc8)](0x194,{'Content-Type':_0x513134(0xd7)}),_0x1db3b5['end'](_0x513134(0xbe));return;}const _0x456117=_0x2f2ef8[_0x513134(0xca)][_0x513134(0xc7)](_0x513134(0xf7)),_0x30fb57=_0x2f2ef8[_0x513134(0xca)][_0x513134(0xc7)](_0x513134(0xd1)),_0x170cd6=_0x2f2ef8[_0x513134(0xca)]['get'](_0x513134(0xe1));if(_0x170cd6||!_0x456117||!_0x30fb57){_0x1db3b5['writeHead'](0x190,{'Content-Type':_0x513134(0xc1)}),_0x1db3b5['end'](_0x513134(0xe7)),_0x395b38(new Error(_0x513134(0xe5)));return;}_0x1db3b5[_0x513134(0xc8)](0xc8,{'Content-Type':_0x513134(0xc1)}),_0x1db3b5['end'](_0x513134(0xf0)),_0x9641a1({'code':_0x456117,'state':_0x30fb57});});_0x330bff['on'](_0x3d13a3(0xe1),_0x14fc61=>{const _0xec9ebf=_0x3d13a3;_0x14fc61[_0xec9ebf(0xf7)]===_0xec9ebf(0xce)?_0x395b38(new Error(_0xec9ebf(0xea)+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x395b38(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x14fc61['message']));}),_0x330bff[_0x3d13a3(0xf4)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x5b27fe=setTimeout(()=>{_0x395b38(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x330bff['close']();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x21400c,'close':()=>{clearTimeout(_0x5b27fe),_0x330bff['close']();}};}function a64_0x2908(_0x347d5d,_0x5bdf5b){_0x347d5d=_0x347d5d-0xb8;const _0x126302=a64_0x1263();let _0x2908b0=_0x126302[_0x347d5d];return _0x2908b0;}export async function startOAuthFlow(_0x15803f,_0x32d4a3){const _0x498d8e=a64_0x2d94b9,_0x1a0d8d=getConsoleUrl(_0x15803f),_0x389a75=getOAuthClientId(),{verifier:_0xa0a6,challenge:_0x4f01c7}=generatePKCEPair(),_0x214c16=a64_0x59332c[_0x498d8e(0xe8)](0x10)[_0x498d8e(0xe3)](_0x498d8e(0xd8)),_0x458745=startLocalCallbackServer();try{const _0x4e2469=OAUTH_REDIRECT_URI,_0x142422=buildAuthorizeURL(_0x1a0d8d,{'clientId':_0x389a75,'redirectUri':_0x4e2469,'state':_0x214c16,'codeChallenge':_0x4f01c7,'scope':_0x498d8e(0xd4)}),_0x50b61c=_0x32d4a3?.[_0x498d8e(0xc4)]?buildSSOInitiateURL(_0x1a0d8d,_0x32d4a3[_0x498d8e(0xc4)],_0x142422):_0x142422;openBrowser(_0x50b61c);const _0x366021=await _0x458745[_0x498d8e(0xe4)]();if(_0x366021[_0x498d8e(0xd1)]!==_0x214c16)throw new Error(_0x498d8e(0xf1));return await exchangeCodeForTokens(_0x1a0d8d,_0x366021[_0x498d8e(0xf7)],_0xa0a6,_0x4e2469);}finally{_0x458745[_0x498d8e(0xdd)]();}}
@@ -1 +1 @@
1
- const a65_0x39a1cf=a65_0x29d1;(function(_0x111d01,_0x111374){const _0x56bff4=a65_0x29d1,_0x215590=_0x111d01();while(!![]){try{const _0x193f83=-parseInt(_0x56bff4(0x212))/0x1+-parseInt(_0x56bff4(0x223))/0x2+-parseInt(_0x56bff4(0x227))/0x3*(-parseInt(_0x56bff4(0x228))/0x4)+-parseInt(_0x56bff4(0x21e))/0x5*(-parseInt(_0x56bff4(0x1f3))/0x6)+parseInt(_0x56bff4(0x201))/0x7+parseInt(_0x56bff4(0x1f2))/0x8+-parseInt(_0x56bff4(0x216))/0x9*(parseInt(_0x56bff4(0x1e9))/0xa);if(_0x193f83===_0x111374)break;else _0x215590['push'](_0x215590['shift']());}catch(_0x6424ed){_0x215590['push'](_0x215590['shift']());}}}(a65_0x301a,0x894f7));import*as a65_0x520cc9 from'node:fs';import*as a65_0xe059b7 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_0x39a1cf(0x209);export function getProfileParams(_0x195a25){const _0x45b065=a65_0x39a1cf,_0xef8a62={};if(!_0x195a25)return _0xef8a62;for(const [_0x4a6f06,_0x3066dc]of Object[_0x45b065(0x21c)](_0x195a25)){_0x4a6f06!==_0x45b065(0x1e8)&&_0x3066dc!==undefined&&(_0xef8a62[_0x4a6f06]=_0x3066dc);}return _0xef8a62;}export function getProfilesDir(){const _0x40b3b3=a65_0x39a1cf;return a65_0xe059b7[_0x40b3b3(0x20b)](getConfigDir(),'profiles');}function getProfileDir(_0x370abf){return a65_0xe059b7['join'](getProfilesDir(),_0x370abf);}function getProfileConfigPath(_0x6a4e15){const _0x38f74c=a65_0x39a1cf;return a65_0xe059b7[_0x38f74c(0x20b)](getProfileDir(_0x6a4e15),'tdx.json');}function getProfileEnvPath(_0x3ded05){const _0x3793b6=a65_0x39a1cf;return a65_0xe059b7[_0x3793b6(0x20b)](getProfileDir(_0x3ded05),_0x3793b6(0x1e5));}function getGlobalConfigPath(){const _0x48ef18=a65_0x39a1cf;return a65_0xe059b7[_0x48ef18(0x20b)](getConfigDir(),_0x48ef18(0x1f0));}function validateProfileName(_0x199ce8){const _0x44394d=a65_0x39a1cf;if(/^@?[a-zA-Z0-9_-]+$/[_0x44394d(0x207)](_0x199ce8))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x44394d(0x207)](_0x199ce8))return;throw new Error(_0x44394d(0x221)+_0x199ce8+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function a65_0x29d1(_0x92db3c,_0x5d182f){_0x92db3c=_0x92db3c-0x1e4;const _0x301a92=a65_0x301a();let _0x29d10c=_0x301a92[_0x92db3c];return _0x29d10c;}function validateProfileConfig(_0x46160a,_0x289f83){const _0x5bda57=a65_0x39a1cf;if(typeof _0x46160a!=='object'||_0x46160a===null)throw new SDKError(ErrorCode[_0x5bda57(0x214)],_0x5bda57(0x1ed)+_0x289f83+_0x5bda57(0x1f1));const _0x3566d2=[_0x5bda57(0x1e8),_0x5bda57(0x21b),_0x5bda57(0x22f),_0x5bda57(0x21f),'llm_project',_0x5bda57(0x222),_0x5bda57(0x226)],_0x25c223=_0x46160a;for(const _0x476181 of Object[_0x5bda57(0x21a)](_0x25c223)){!_0x3566d2['includes'](_0x476181)&&console[_0x5bda57(0x22c)](_0x5bda57(0x218)+_0x289f83+_0x5bda57(0x1f9)+_0x476181+_0x5bda57(0x1fa));}if(_0x25c223[_0x5bda57(0x1e8)]!==undefined&&typeof _0x25c223['description']!==_0x5bda57(0x1e6))throw new SDKError(ErrorCode[_0x5bda57(0x214)],_0x5bda57(0x1ed)+_0x289f83+_0x5bda57(0x22a));if(_0x25c223['site']!==undefined&&typeof _0x25c223['site']!==_0x5bda57(0x1e6))throw new SDKError(ErrorCode[_0x5bda57(0x214)],_0x5bda57(0x1ed)+_0x289f83+_0x5bda57(0x230));if(_0x25c223['database']!==undefined&&typeof _0x25c223[_0x5bda57(0x22f)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5bda57(0x1ed)+_0x289f83+_0x5bda57(0x1f6));if(_0x25c223[_0x5bda57(0x21f)]!==undefined&&typeof _0x25c223[_0x5bda57(0x21f)]!==_0x5bda57(0x1e6))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5bda57(0x1ed)+_0x289f83+_0x5bda57(0x1fe));if(_0x25c223[_0x5bda57(0x220)]!==undefined&&typeof _0x25c223[_0x5bda57(0x220)]!=='string')throw new SDKError(ErrorCode[_0x5bda57(0x214)],_0x5bda57(0x1ed)+_0x289f83+_0x5bda57(0x1ef));if(_0x25c223[_0x5bda57(0x222)]!==undefined&&typeof _0x25c223[_0x5bda57(0x222)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5bda57(0x1ed)+_0x289f83+_0x5bda57(0x225));return!![];}function loadProfilesFromTdxJson(_0x892519,_0x4284ac){const _0x1e965a=a65_0x39a1cf;if(!a65_0x520cc9[_0x1e965a(0x1fc)](_0x892519))return[];try{const _0x2d11a5=a65_0x520cc9[_0x1e965a(0x231)](_0x892519,_0x1e965a(0x213)),_0x13d56e=JSON['parse'](_0x2d11a5);if(!_0x13d56e['profiles']||typeof _0x13d56e[_0x1e965a(0x211)]!==_0x1e965a(0x20c))return[];const _0xf1cbc7=[];for(const [_0x43a2a5,_0xadb031]of Object[_0x1e965a(0x21c)](_0x13d56e['profiles'])){try{validateProfileConfig(_0xadb031,_0x43a2a5);const _0xf8d1f6=getNewCredentialPath(_0x43a2a5),_0xa99b87=getOldCredentialPath(_0x43a2a5),_0x8404dd=a65_0x520cc9[_0x1e965a(0x1fc)](_0xf8d1f6)||a65_0x520cc9['existsSync'](_0xa99b87);_0xf1cbc7[_0x1e965a(0x1ee)]({'name':_0x43a2a5,'config':_0xadb031,'metadata':{'name':_0x43a2a5,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x8404dd,'scope':_0x4284ac});}catch(_0x2b7966){_0x2b7966 instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x892519+':'),console[_0x1e965a(0x22c)]('\x20\x20'+_0x2b7966[_0x1e965a(0x22e)]+'\x0a'));}}return _0xf1cbc7;}catch(_0x54de00){return _0x54de00 instanceof SyntaxError?(console[_0x1e965a(0x22c)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x892519+_0x1e965a(0x21d)),console[_0x1e965a(0x22c)]('Error:\x20'+_0x54de00['message']+'\x0a')):console[_0x1e965a(0x22c)](_0x1e965a(0x22d)+_0x892519+':\x20'+_0x54de00+'\x0a'),[];}}export function getNewCredentialPath(_0x3ff475){const _0x30f3de=a65_0x39a1cf;return a65_0xe059b7[_0x30f3de(0x20b)](getConfigDir(),'.env.'+_0x3ff475);}function getOldCredentialPath(_0x7864fc){const _0x4edf04=a65_0x39a1cf;return a65_0xe059b7['join'](getProfilesDir(),_0x7864fc,_0x4edf04(0x1e5));}function loadProfilesFromTdxJsonFiles(){const _0x2d6723=a65_0x39a1cf,_0x10e3dc=[],_0x34b5b1=findProjectConfigPath();_0x34b5b1&&_0x10e3dc['push'](...loadProfilesFromTdxJson(_0x34b5b1,_0x2d6723(0x217)));const _0x1d2c77=a65_0xe059b7[_0x2d6723(0x20b)](getConfigDir(),'tdx.json');return _0x10e3dc[_0x2d6723(0x1ee)](...loadProfilesFromTdxJson(_0x1d2c77,_0x2d6723(0x20f))),_0x10e3dc;}function loadProfilesFromDirectories(){const _0x131d25=a65_0x39a1cf,_0x27679e=getProfilesDir();if(!a65_0x520cc9[_0x131d25(0x1fc)](_0x27679e))return[];try{return a65_0x520cc9[_0x131d25(0x1fb)](_0x27679e,{'withFileTypes':!![]})[_0x131d25(0x224)](_0x3c4172=>_0x3c4172[_0x131d25(0x203)]())[_0x131d25(0x1fd)](_0x19ed8b=>_0x19ed8b[_0x131d25(0x215)])['filter'](_0x9a3c85=>{const _0x6785c3=_0x131d25,_0xdab73d=getProfileConfigPath(_0x9a3c85),_0x571cc1=getProfileEnvPath(_0x9a3c85);return a65_0x520cc9[_0x6785c3(0x1fc)](_0xdab73d)||a65_0x520cc9[_0x6785c3(0x1fc)](_0x571cc1);})[_0x131d25(0x1fd)](_0x5e1772=>{const _0x298a32=_0x131d25,_0x1a7cff=loadProfileFromDirectory(_0x5e1772);if(_0x1a7cff)return{..._0x1a7cff,'scope':_0x298a32(0x210)};return null;})[_0x131d25(0x224)](_0x40b63c=>_0x40b63c!==null);}catch{return[];}}function loadProfileFromDirectory(_0x5e3926){const _0x2fb87e=a65_0x39a1cf,_0x2a50a0=getProfileConfigPath(_0x5e3926),_0x3c5bf9=getOldCredentialPath(_0x5e3926);if(!a65_0x520cc9[_0x2fb87e(0x1fc)](_0x2a50a0)&&!a65_0x520cc9[_0x2fb87e(0x1fc)](_0x3c5bf9))return null;let _0x1ecd41={},_0x350144={'name':_0x5e3926,'createdAt':new Date()[_0x2fb87e(0x206)]()};if(a65_0x520cc9[_0x2fb87e(0x1fc)](_0x2a50a0))try{const _0x5efdb1=a65_0x520cc9[_0x2fb87e(0x231)](_0x2a50a0,_0x2fb87e(0x213)),_0x190ab5=JSON[_0x2fb87e(0x1f7)](_0x5efdb1),{metadata:_0xef4015,..._0x12a8fb}=_0x190ab5;_0x1ecd41=_0x12a8fb,_0xef4015&&(_0x350144=_0xef4015);}catch{}return{'name':_0x5e3926,'config':_0x1ecd41,'metadata':_0x350144,'hasCredentials':a65_0x520cc9[_0x2fb87e(0x1fc)](_0x3c5bf9),'scope':'directory'};}function a65_0x301a(){const _0x38bb6f=['has','\x22\x20\x22','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','parse','stringify','\x27:\x20unknown\x20config\x20key\x20\x27','\x27\x20will\x20be\x20ignored','readdirSync','existsSync','map','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string',',\x20creating\x20new\x20file','rmSync','7156303KEfeDF','To\x20migrate:','isDirectory','\x20does\x20not\x20exist','\x20\x201.\x20Edit:\x20','toISOString','test','Failed\x20to\x20parse\x20','@tdx-studio','\x20already\x20exists','join','object','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','localeCompare','user','directory','profiles','551252niOuja','utf-8','INVALID_PROFILE_CONFIG','name','27CgVYSK','local','Warning:\x20Profile\x20\x27','Warning:\x20Failed\x20to\x20parse\x20','keys','site','entries',':\x20Invalid\x20JSON\x20syntax','871905ilipjX','parent_segment','llm_project','Invalid\x20profile\x20name:\x20','llm_agent','1620346YbkJuc','filter','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','user_info','5331qOTtLS','1756FqyWFa','Profile\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x27\x20not\x20found\x20in\x20user\x20configuration','warn','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','message','database','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','readFileSync','sort','profile','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','.env','string','values','description','2088890aGHNuJ','set','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','some','Profile\x20\x27','push','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','tdx.json','\x27:\x20config\x20must\x20be\x20an\x20object','4589616BuQsSl','6huPAuG'];a65_0x301a=function(){return _0x38bb6f;};return a65_0x301a();}export function listProfiles(){const _0x1cae2c=a65_0x39a1cf,_0x22c124=loadProfilesFromTdxJsonFiles(),_0x4c461d=loadProfilesFromDirectories();if(_0x4c461d['length']>0x0){const _0x46be2c=_0x4c461d[_0x1cae2c(0x1fd)](_0x51054b=>_0x51054b[_0x1cae2c(0x215)])[_0x1cae2c(0x20b)](',\x20'),_0x19fa9a=getConfigDir();console[_0x1cae2c(0x22c)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x46be2c),console[_0x1cae2c(0x22c)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x1cae2c(0x22c)](_0x1cae2c(0x205)+a65_0xe059b7[_0x1cae2c(0x20b)](_0x19fa9a,_0x1cae2c(0x1f0))),console['warn'](_0x1cae2c(0x20d)),console[_0x1cae2c(0x22c)](_0x1cae2c(0x1e4));}const _0x18cee6=[..._0x22c124,..._0x4c461d],_0x37952d=new Map();for(const _0x5bae1a of _0x18cee6){!_0x37952d[_0x1cae2c(0x1f4)](_0x5bae1a['name'])&&_0x37952d[_0x1cae2c(0x1ea)](_0x5bae1a['name'],_0x5bae1a);}return Array['from'](_0x37952d[_0x1cae2c(0x1e7)]())[_0x1cae2c(0x232)]((_0x18a466,_0x427f82)=>_0x18a466['name'][_0x1cae2c(0x20e)](_0x427f82['name']));}export function profileExists(_0x8d1306){const _0x516723=a65_0x39a1cf,_0x396942=listProfiles();return _0x396942[_0x516723(0x1ec)](_0x2d6920=>_0x2d6920[_0x516723(0x215)]===_0x8d1306);}export function loadProfile(_0x2e9e3f){const _0x67ae74=a65_0x39a1cf;validateProfileName(_0x2e9e3f);const _0x2e43e8=listProfiles(),_0x13abd4=_0x2e43e8['find'](_0x346bf4=>_0x346bf4[_0x67ae74(0x215)]===_0x2e9e3f);return _0x13abd4||null;}export function saveProfile(_0x349b93,_0x5166b9,_0x2a9bb5=![]){saveProfileToUserConfig(_0x349b93,_0x5166b9);}export function deleteProfile(_0x18a436){const _0x27c352=a65_0x39a1cf;validateProfileName(_0x18a436);const _0x5b8b8f=getProfileDir(_0x18a436);if(!a65_0x520cc9[_0x27c352(0x1fc)](_0x5b8b8f))throw new Error(_0x27c352(0x229)+_0x18a436+_0x27c352(0x204));a65_0x520cc9[_0x27c352(0x200)](_0x5b8b8f,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x26117d,_0x4350eb){const _0xbfe407=a65_0x39a1cf;validateProfileName(_0x26117d);const _0x58da3a=getGlobalConfigPath(),_0x2c0925=getConfigDir();!a65_0x520cc9[_0xbfe407(0x1fc)](_0x2c0925)&&createSecureDirectory(_0x2c0925);let _0x125d0e={};if(a65_0x520cc9[_0xbfe407(0x1fc)](_0x58da3a))try{const _0x3a36d9=a65_0x520cc9['readFileSync'](_0x58da3a,_0xbfe407(0x213));_0x125d0e=JSON[_0xbfe407(0x1f7)](_0x3a36d9);}catch{console[_0xbfe407(0x22c)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x58da3a+_0xbfe407(0x1ff));}!_0x125d0e[_0xbfe407(0x211)]&&(_0x125d0e[_0xbfe407(0x211)]={}),_0x125d0e['profiles'][_0x26117d]=_0x4350eb,writeSecureFile(_0x58da3a,JSON[_0xbfe407(0x1f8)](_0x125d0e,null,0x2));}export function removeProfileFromUserConfig(_0x2bacad){const _0x28c4bf=a65_0x39a1cf;validateProfileName(_0x2bacad);const _0x191c50=getGlobalConfigPath();if(!a65_0x520cc9[_0x28c4bf(0x1fc)](_0x191c50))throw new Error(_0x28c4bf(0x1ed)+_0x2bacad+_0x28c4bf(0x22b));let _0x1290c8={};try{const _0xfda7d5=a65_0x520cc9['readFileSync'](_0x191c50,'utf-8');_0x1290c8=JSON[_0x28c4bf(0x1f7)](_0xfda7d5);}catch{throw new Error(_0x28c4bf(0x208)+_0x191c50);}if(!_0x1290c8[_0x28c4bf(0x211)]||!_0x1290c8['profiles'][_0x2bacad])throw new Error('Profile\x20\x27'+_0x2bacad+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x1290c8[_0x28c4bf(0x211)][_0x2bacad],_0x1290c8[_0x28c4bf(0x233)]===_0x2bacad&&delete _0x1290c8['profile'],writeSecureFile(_0x191c50,JSON[_0x28c4bf(0x1f8)](_0x1290c8,null,0x2));}export function getActiveProfile(){const _0x13f952=a65_0x39a1cf,_0x164121=loadSessionContext();if(_0x164121?.[_0x13f952(0x233)])return _0x164121[_0x13f952(0x233)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x4a087b=getGlobalConfigPath();if(!a65_0x520cc9[_0x13f952(0x1fc)](_0x4a087b))return null;try{const _0x427574=a65_0x520cc9['readFileSync'](_0x4a087b,_0x13f952(0x213)),_0x543baf=JSON[_0x13f952(0x1f7)](_0x427574);return _0x543baf['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x14547c){const _0x291dae=a65_0x39a1cf,_0x40fc24=getGlobalConfigPath(),_0x48e6d3=getConfigDir();!a65_0x520cc9[_0x291dae(0x1fc)](_0x48e6d3)&&createSecureDirectory(_0x48e6d3);let _0x189073={};if(a65_0x520cc9['existsSync'](_0x40fc24))try{const _0x21f7a5=a65_0x520cc9[_0x291dae(0x231)](_0x40fc24,_0x291dae(0x213));_0x189073=JSON[_0x291dae(0x1f7)](_0x21f7a5);}catch{console[_0x291dae(0x22c)](_0x291dae(0x219)+_0x40fc24+_0x291dae(0x1ff));}_0x189073[_0x291dae(0x21b)]=_0x14547c,writeSecureFile(_0x40fc24,JSON[_0x291dae(0x1f8)](_0x189073,null,0x2));}export function saveActiveProfileToUserConfig(_0x281d62){const _0x339f74=a65_0x39a1cf;validateProfileName(_0x281d62);const _0x187aeb=getGlobalConfigPath(),_0x262a31=getConfigDir();!a65_0x520cc9[_0x339f74(0x1fc)](_0x262a31)&&createSecureDirectory(_0x262a31);let _0xcaf501={};if(a65_0x520cc9[_0x339f74(0x1fc)](_0x187aeb))try{const _0x1ca68e=a65_0x520cc9[_0x339f74(0x231)](_0x187aeb,_0x339f74(0x213));_0xcaf501=JSON[_0x339f74(0x1f7)](_0x1ca68e);}catch{console[_0x339f74(0x22c)](_0x339f74(0x219)+_0x187aeb+_0x339f74(0x1ff));}_0xcaf501[_0x339f74(0x233)]=_0x281d62,writeSecureFile(_0x187aeb,JSON[_0x339f74(0x1f8)](_0xcaf501,null,0x2));}function clearFieldFromUserConfig(_0x3b0f37){const _0x1e13af=a65_0x39a1cf,_0x3bf3de=getGlobalConfigPath();if(!a65_0x520cc9[_0x1e13af(0x1fc)](_0x3bf3de))return;let _0x57ca79={};try{const _0x37da97=a65_0x520cc9['readFileSync'](_0x3bf3de,_0x1e13af(0x213));_0x57ca79=JSON[_0x1e13af(0x1f7)](_0x37da97);}catch{return;}delete _0x57ca79[_0x3b0f37],writeSecureFile(_0x3bf3de,JSON[_0x1e13af(0x1f8)](_0x57ca79,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x18061d=a65_0x39a1cf;clearFieldFromUserConfig(_0x18061d(0x21b));}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x2b2ee7,_0x303843){const _0x2b2b7e=a65_0x39a1cf;validateProfileName(_0x2b2ee7);if(profileExists(_0x2b2ee7))throw new Error(_0x2b2b7e(0x229)+_0x2b2ee7+_0x2b2b7e(0x20a));saveProfile(_0x2b2ee7,_0x303843);}export function saveProfileCredentials(_0x4654a8,_0x4c419f){const _0x1ef5c1=a65_0x39a1cf;validateProfileName(_0x4654a8);if(!profileExists(_0x4654a8))throw new Error(_0x1ef5c1(0x229)+_0x4654a8+_0x1ef5c1(0x204));const _0x107b38=getNewCredentialPath(_0x4654a8);writeSecureFile(_0x107b38,_0x4c419f);}export function loadProfileCredentials(_0x1460db){const _0x4f0add=a65_0x39a1cf;validateProfileName(_0x1460db);const _0x481785=getNewCredentialPath(_0x1460db);if(a65_0x520cc9[_0x4f0add(0x1fc)](_0x481785))try{return a65_0x520cc9[_0x4f0add(0x231)](_0x481785,_0x4f0add(0x213));}catch{}const _0x214feb=getOldCredentialPath(_0x1460db);if(a65_0x520cc9[_0x4f0add(0x1fc)](_0x214feb)){console[_0x4f0add(0x22c)](_0x4f0add(0x1eb)+_0x1460db+'\x27'),console[_0x4f0add(0x22c)](_0x4f0add(0x202)),console[_0x4f0add(0x22c)]('\x20\x20mv\x20\x22'+_0x214feb+_0x4f0add(0x1f5)+_0x481785+'\x22'),console[_0x4f0add(0x22c)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a65_0x520cc9[_0x4f0add(0x231)](_0x214feb,'utf-8');}catch{return null;}}return null;}
1
+ const a65_0x7d89f7=a65_0x53c0;(function(_0x24fb5c,_0xa2b699){const _0x454411=a65_0x53c0,_0x27527a=_0x24fb5c();while(!![]){try{const _0x3fd86f=-parseInt(_0x454411(0x1f8))/0x1+-parseInt(_0x454411(0x1e6))/0x2+-parseInt(_0x454411(0x1c4))/0x3*(parseInt(_0x454411(0x1db))/0x4)+parseInt(_0x454411(0x1de))/0x5+-parseInt(_0x454411(0x1c2))/0x6+parseInt(_0x454411(0x1f6))/0x7+parseInt(_0x454411(0x1f5))/0x8;if(_0x3fd86f===_0xa2b699)break;else _0x27527a['push'](_0x27527a['shift']());}catch(_0x5432ac){_0x27527a['push'](_0x27527a['shift']());}}}(a65_0x1807,0xab364));import*as a65_0x57d545 from'node:fs';import*as a65_0x53fec8 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_0x7d89f7(0x1f4);export function getProfileParams(_0x157792){const _0x1b6556=a65_0x7d89f7,_0x49541f={};if(!_0x157792)return _0x49541f;for(const [_0x4d9e96,_0x402b9c]of Object[_0x1b6556(0x1c0)](_0x157792)){_0x4d9e96!==_0x1b6556(0x1b5)&&_0x402b9c!==undefined&&(_0x49541f[_0x4d9e96]=_0x402b9c);}return _0x49541f;}export function getProfilesDir(){const _0x3e18ff=a65_0x7d89f7;return a65_0x53fec8['join'](getConfigDir(),_0x3e18ff(0x1df));}function getProfileDir(_0xdafd41){const _0x2e5f98=a65_0x7d89f7;return a65_0x53fec8[_0x2e5f98(0x1bb)](getProfilesDir(),_0xdafd41);}function getProfileConfigPath(_0x3b073c){const _0x44f791=a65_0x7d89f7;return a65_0x53fec8[_0x44f791(0x1bb)](getProfileDir(_0x3b073c),_0x44f791(0x1d0));}function getProfileEnvPath(_0x1f8374){const _0x4ad0e7=a65_0x7d89f7;return a65_0x53fec8[_0x4ad0e7(0x1bb)](getProfileDir(_0x1f8374),_0x4ad0e7(0x1b3));}function a65_0x1807(){const _0x167356=[',\x20creating\x20new\x20file','.env','Warning:\x20Profile\x20\x27','description','find','rmSync','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','parent_segment','Warning:\x20Failed\x20to\x20parse\x20','join','To\x20migrate:','set','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','parse','entries','localeCompare','7699086UrFDdr','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','6yUZgmE','\x0aWarning:\x20Failed\x20to\x20parse\x20','string','llm_project','name','Invalid\x20profile\x20name:\x20','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','filter','user','Profile\x20','readFileSync','readdirSync','tdx.json','\x20already\x20exists','keys','length','toISOString','push','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x27\x20not\x20found\x20in\x20user\x20configuration','message','map','Profile\x20\x27','2590064TmVUki','Failed\x20to\x20parse\x20','stringify','214960iFqokV','profiles','profile','warn','\x27\x20will\x20be\x20ignored','utf-8','directory','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','2525162DiXiiW',':\x20Invalid\x20JSON\x20syntax','existsSync','site','\x27:\x20unknown\x20config\x20key\x20\x27','\x27:\x20config\x20must\x20be\x20an\x20object','\x20does\x20not\x20exist','test','INVALID_PROFILE_CONFIG','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x22\x20\x22','\x20\x201.\x20Edit:\x20','database','.env.','@tdx-studio','43211448CsSxsR','1537102utIfxh','includes','1121931nuBXzN','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','some','from','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','llm_agent','has','object'];a65_0x1807=function(){return _0x167356;};return a65_0x1807();}function getGlobalConfigPath(){const _0x4d190e=a65_0x7d89f7;return a65_0x53fec8[_0x4d190e(0x1bb)](getConfigDir(),'tdx.json');}function validateProfileName(_0x13cf70){const _0x3770fb=a65_0x7d89f7;if(/^@?[a-zA-Z0-9_-]+$/[_0x3770fb(0x1ed)](_0x13cf70))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x13cf70))return;throw new Error(_0x3770fb(0x1c9)+_0x13cf70+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x13583b,_0x9c2e4d){const _0x495951=a65_0x7d89f7;if(typeof _0x13583b!==_0x495951(0x1b1)||_0x13583b===null)throw new SDKError(ErrorCode[_0x495951(0x1ee)],_0x495951(0x1da)+_0x9c2e4d+_0x495951(0x1eb));const _0x54f994=[_0x495951(0x1b5),_0x495951(0x1e9),_0x495951(0x1f2),'parent_segment',_0x495951(0x1c7),'llm_agent','user_info'],_0x54bafc=_0x13583b;for(const _0x1a77bd of Object[_0x495951(0x1d2)](_0x54bafc)){!_0x54f994[_0x495951(0x1f7)](_0x1a77bd)&&console[_0x495951(0x1e1)](_0x495951(0x1b4)+_0x9c2e4d+_0x495951(0x1ea)+_0x1a77bd+_0x495951(0x1e2));}if(_0x54bafc[_0x495951(0x1b5)]!==undefined&&typeof _0x54bafc[_0x495951(0x1b5)]!=='string')throw new SDKError(ErrorCode[_0x495951(0x1ee)],_0x495951(0x1da)+_0x9c2e4d+_0x495951(0x1e5));if(_0x54bafc[_0x495951(0x1e9)]!==undefined&&typeof _0x54bafc[_0x495951(0x1e9)]!=='string')throw new SDKError(ErrorCode[_0x495951(0x1ee)],_0x495951(0x1da)+_0x9c2e4d+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x54bafc[_0x495951(0x1f2)]!==undefined&&typeof _0x54bafc[_0x495951(0x1f2)]!==_0x495951(0x1c6))throw new SDKError(ErrorCode[_0x495951(0x1ee)],'Profile\x20\x27'+_0x9c2e4d+_0x495951(0x1fd));if(_0x54bafc[_0x495951(0x1b9)]!==undefined&&typeof _0x54bafc[_0x495951(0x1b9)]!==_0x495951(0x1c6))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x9c2e4d+_0x495951(0x1ca));if(_0x54bafc[_0x495951(0x1c7)]!==undefined&&typeof _0x54bafc[_0x495951(0x1c7)]!==_0x495951(0x1c6))throw new SDKError(ErrorCode[_0x495951(0x1ee)],_0x495951(0x1da)+_0x9c2e4d+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x54bafc['llm_agent']!==undefined&&typeof _0x54bafc[_0x495951(0x1fe)]!==_0x495951(0x1c6))throw new SDKError(ErrorCode[_0x495951(0x1ee)],_0x495951(0x1da)+_0x9c2e4d+_0x495951(0x1c3));return!![];}function loadProfilesFromTdxJson(_0x2d1bd7,_0x523638){const _0x49296a=a65_0x7d89f7;if(!a65_0x57d545[_0x49296a(0x1e8)](_0x2d1bd7))return[];try{const _0xe97f55=a65_0x57d545[_0x49296a(0x1ce)](_0x2d1bd7,_0x49296a(0x1e3)),_0x164888=JSON[_0x49296a(0x1bf)](_0xe97f55);if(!_0x164888['profiles']||typeof _0x164888[_0x49296a(0x1df)]!==_0x49296a(0x1b1))return[];const _0x591014=[];for(const [_0x1f1268,_0x5cf7b1]of Object[_0x49296a(0x1c0)](_0x164888[_0x49296a(0x1df)])){try{validateProfileConfig(_0x5cf7b1,_0x1f1268);const _0x5cef61=getNewCredentialPath(_0x1f1268),_0x27e8a0=getOldCredentialPath(_0x1f1268),_0x5024b6=a65_0x57d545[_0x49296a(0x1e8)](_0x5cef61)||a65_0x57d545['existsSync'](_0x27e8a0);_0x591014[_0x49296a(0x1d5)]({'name':_0x1f1268,'config':_0x5cf7b1,'metadata':{'name':_0x1f1268,'createdAt':new Date()[_0x49296a(0x1d4)]()},'hasCredentials':_0x5024b6,'scope':_0x523638});}catch(_0x1bb88e){_0x1bb88e instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x2d1bd7+':'),console[_0x49296a(0x1e1)]('\x20\x20'+_0x1bb88e[_0x49296a(0x1d8)]+'\x0a'));}}return _0x591014;}catch(_0x4fc9e8){return _0x4fc9e8 instanceof SyntaxError?(console[_0x49296a(0x1e1)](_0x49296a(0x1c5)+_0x2d1bd7+_0x49296a(0x1e7)),console[_0x49296a(0x1e1)]('Error:\x20'+_0x4fc9e8[_0x49296a(0x1d8)]+'\x0a')):console[_0x49296a(0x1e1)](_0x49296a(0x1b8)+_0x2d1bd7+':\x20'+_0x4fc9e8+'\x0a'),[];}}export function getNewCredentialPath(_0x3c82ae){const _0x4cbdd2=a65_0x7d89f7;return a65_0x53fec8[_0x4cbdd2(0x1bb)](getConfigDir(),_0x4cbdd2(0x1f3)+_0x3c82ae);}function getOldCredentialPath(_0x273e37){const _0x121433=a65_0x7d89f7;return a65_0x53fec8[_0x121433(0x1bb)](getProfilesDir(),_0x273e37,_0x121433(0x1b3));}function loadProfilesFromTdxJsonFiles(){const _0x4c7413=a65_0x7d89f7,_0x7ca693=[],_0x2a6221=findProjectConfigPath();_0x2a6221&&_0x7ca693['push'](...loadProfilesFromTdxJson(_0x2a6221,'local'));const _0x1b2c4a=a65_0x53fec8['join'](getConfigDir(),_0x4c7413(0x1d0));return _0x7ca693[_0x4c7413(0x1d5)](...loadProfilesFromTdxJson(_0x1b2c4a,_0x4c7413(0x1cc))),_0x7ca693;}function loadProfilesFromDirectories(){const _0x464103=a65_0x7d89f7,_0x4afe90=getProfilesDir();if(!a65_0x57d545[_0x464103(0x1e8)](_0x4afe90))return[];try{return a65_0x57d545[_0x464103(0x1cf)](_0x4afe90,{'withFileTypes':!![]})[_0x464103(0x1cb)](_0x9ba0b7=>_0x9ba0b7['isDirectory']())['map'](_0x4545d8=>_0x4545d8[_0x464103(0x1c8)])[_0x464103(0x1cb)](_0x12fafc=>{const _0x4f722f=_0x464103,_0x2d8ffb=getProfileConfigPath(_0x12fafc),_0x3834e5=getProfileEnvPath(_0x12fafc);return a65_0x57d545[_0x4f722f(0x1e8)](_0x2d8ffb)||a65_0x57d545[_0x4f722f(0x1e8)](_0x3834e5);})[_0x464103(0x1d9)](_0x2d6f00=>{const _0x517174=loadProfileFromDirectory(_0x2d6f00);if(_0x517174)return{..._0x517174,'scope':'directory'};return null;})[_0x464103(0x1cb)](_0x21d1d5=>_0x21d1d5!==null);}catch{return[];}}function loadProfileFromDirectory(_0x28c0b1){const _0xbc212f=a65_0x7d89f7,_0x458988=getProfileConfigPath(_0x28c0b1),_0x90f430=getOldCredentialPath(_0x28c0b1);if(!a65_0x57d545[_0xbc212f(0x1e8)](_0x458988)&&!a65_0x57d545[_0xbc212f(0x1e8)](_0x90f430))return null;let _0x77f8={},_0x19e5be={'name':_0x28c0b1,'createdAt':new Date()[_0xbc212f(0x1d4)]()};if(a65_0x57d545['existsSync'](_0x458988))try{const _0xd83bab=a65_0x57d545['readFileSync'](_0x458988,_0xbc212f(0x1e3)),_0x19fc5b=JSON['parse'](_0xd83bab),{metadata:_0x300210,..._0x112286}=_0x19fc5b;_0x77f8=_0x112286,_0x300210&&(_0x19e5be=_0x300210);}catch{}return{'name':_0x28c0b1,'config':_0x77f8,'metadata':_0x19e5be,'hasCredentials':a65_0x57d545[_0xbc212f(0x1e8)](_0x90f430),'scope':_0xbc212f(0x1e4)};}export function listProfiles(){const _0xf5abc0=a65_0x7d89f7,_0x44655b=loadProfilesFromTdxJsonFiles(),_0x5e64fe=loadProfilesFromDirectories();if(_0x5e64fe[_0xf5abc0(0x1d3)]>0x0){const _0x1947da=_0x5e64fe[_0xf5abc0(0x1d9)](_0x470a11=>_0x470a11[_0xf5abc0(0x1c8)])[_0xf5abc0(0x1bb)](',\x20'),_0x56aa93=getConfigDir();console[_0xf5abc0(0x1e1)](_0xf5abc0(0x1fc)+_0x1947da),console['warn'](_0xf5abc0(0x1ef)),console[_0xf5abc0(0x1e1)](_0xf5abc0(0x1f1)+a65_0x53fec8[_0xf5abc0(0x1bb)](_0x56aa93,_0xf5abc0(0x1d0))),console['warn']('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0xf5abc0(0x1e1)](_0xf5abc0(0x1be));}const _0x25d7f8=[..._0x44655b,..._0x5e64fe],_0x450e28=new Map();for(const _0x413623 of _0x25d7f8){!_0x450e28[_0xf5abc0(0x1b0)](_0x413623[_0xf5abc0(0x1c8)])&&_0x450e28[_0xf5abc0(0x1bd)](_0x413623['name'],_0x413623);}return Array[_0xf5abc0(0x1fb)](_0x450e28['values']())['sort']((_0x35eb77,_0x3462df)=>_0x35eb77['name'][_0xf5abc0(0x1c1)](_0x3462df[_0xf5abc0(0x1c8)]));}export function profileExists(_0x1673ae){const _0x50b540=a65_0x7d89f7,_0x392197=listProfiles();return _0x392197[_0x50b540(0x1fa)](_0x5c28f1=>_0x5c28f1['name']===_0x1673ae);}export function loadProfile(_0x3e9777){const _0x5afdc2=a65_0x7d89f7;validateProfileName(_0x3e9777);const _0x3cb98a=listProfiles(),_0x5786cf=_0x3cb98a[_0x5afdc2(0x1b6)](_0x125149=>_0x125149[_0x5afdc2(0x1c8)]===_0x3e9777);return _0x5786cf||null;}export function saveProfile(_0x553e7a,_0x20794a,_0x2258aa=![]){saveProfileToUserConfig(_0x553e7a,_0x20794a);}export function deleteProfile(_0x542286){const _0x3f9b3=a65_0x7d89f7;validateProfileName(_0x542286);const _0x371c5e=getProfileDir(_0x542286);if(!a65_0x57d545['existsSync'](_0x371c5e))throw new Error(_0x3f9b3(0x1cd)+_0x542286+_0x3f9b3(0x1ec));a65_0x57d545[_0x3f9b3(0x1b7)](_0x371c5e,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x59015b,_0xe896){const _0x4edcf5=a65_0x7d89f7;validateProfileName(_0x59015b);const _0x13e5ee=getGlobalConfigPath(),_0x438c32=getConfigDir();!a65_0x57d545['existsSync'](_0x438c32)&&createSecureDirectory(_0x438c32);let _0x4d23a5={};if(a65_0x57d545['existsSync'](_0x13e5ee))try{const _0x101b35=a65_0x57d545[_0x4edcf5(0x1ce)](_0x13e5ee,'utf-8');_0x4d23a5=JSON[_0x4edcf5(0x1bf)](_0x101b35);}catch{console[_0x4edcf5(0x1e1)](_0x4edcf5(0x1ba)+_0x13e5ee+_0x4edcf5(0x1b2));}!_0x4d23a5[_0x4edcf5(0x1df)]&&(_0x4d23a5[_0x4edcf5(0x1df)]={}),_0x4d23a5[_0x4edcf5(0x1df)][_0x59015b]=_0xe896,writeSecureFile(_0x13e5ee,JSON[_0x4edcf5(0x1dd)](_0x4d23a5,null,0x2));}export function removeProfileFromUserConfig(_0x98d4c3){const _0x1c7c05=a65_0x7d89f7;validateProfileName(_0x98d4c3);const _0x4a940a=getGlobalConfigPath();if(!a65_0x57d545[_0x1c7c05(0x1e8)](_0x4a940a))throw new Error(_0x1c7c05(0x1da)+_0x98d4c3+_0x1c7c05(0x1d7));let _0x170d4e={};try{const _0x24d863=a65_0x57d545[_0x1c7c05(0x1ce)](_0x4a940a,'utf-8');_0x170d4e=JSON['parse'](_0x24d863);}catch{throw new Error(_0x1c7c05(0x1dc)+_0x4a940a);}if(!_0x170d4e[_0x1c7c05(0x1df)]||!_0x170d4e['profiles'][_0x98d4c3])throw new Error(_0x1c7c05(0x1da)+_0x98d4c3+_0x1c7c05(0x1d7));delete _0x170d4e[_0x1c7c05(0x1df)][_0x98d4c3],_0x170d4e[_0x1c7c05(0x1e0)]===_0x98d4c3&&delete _0x170d4e[_0x1c7c05(0x1e0)],writeSecureFile(_0x4a940a,JSON[_0x1c7c05(0x1dd)](_0x170d4e,null,0x2));}export function getActiveProfile(){const _0xde5ba4=a65_0x7d89f7,_0x1d2250=loadSessionContext();if(_0x1d2250?.[_0xde5ba4(0x1e0)])return _0x1d2250[_0xde5ba4(0x1e0)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x33e1f8=getGlobalConfigPath();if(!a65_0x57d545[_0xde5ba4(0x1e8)](_0x33e1f8))return null;try{const _0x3218d3=a65_0x57d545['readFileSync'](_0x33e1f8,'utf-8'),_0x46f876=JSON[_0xde5ba4(0x1bf)](_0x3218d3);return _0x46f876[_0xde5ba4(0x1e0)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x8f8cdb){const _0x8b806c=a65_0x7d89f7,_0x10a19b=getGlobalConfigPath(),_0x4c9905=getConfigDir();!a65_0x57d545[_0x8b806c(0x1e8)](_0x4c9905)&&createSecureDirectory(_0x4c9905);let _0x550c59={};if(a65_0x57d545[_0x8b806c(0x1e8)](_0x10a19b))try{const _0x12d15c=a65_0x57d545[_0x8b806c(0x1ce)](_0x10a19b,'utf-8');_0x550c59=JSON[_0x8b806c(0x1bf)](_0x12d15c);}catch{console[_0x8b806c(0x1e1)](_0x8b806c(0x1ba)+_0x10a19b+_0x8b806c(0x1b2));}_0x550c59[_0x8b806c(0x1e9)]=_0x8f8cdb,writeSecureFile(_0x10a19b,JSON[_0x8b806c(0x1dd)](_0x550c59,null,0x2));}function a65_0x53c0(_0x39de0d,_0x513d64){_0x39de0d=_0x39de0d-0x1b0;const _0x1807d9=a65_0x1807();let _0x53c07c=_0x1807d9[_0x39de0d];return _0x53c07c;}export function saveActiveProfileToUserConfig(_0x18ccbd){const _0x3f329f=a65_0x7d89f7;validateProfileName(_0x18ccbd);const _0x582b3b=getGlobalConfigPath(),_0x4995ef=getConfigDir();!a65_0x57d545[_0x3f329f(0x1e8)](_0x4995ef)&&createSecureDirectory(_0x4995ef);let _0x3970a8={};if(a65_0x57d545[_0x3f329f(0x1e8)](_0x582b3b))try{const _0x5b54ed=a65_0x57d545[_0x3f329f(0x1ce)](_0x582b3b,'utf-8');_0x3970a8=JSON['parse'](_0x5b54ed);}catch{console[_0x3f329f(0x1e1)](_0x3f329f(0x1ba)+_0x582b3b+_0x3f329f(0x1b2));}_0x3970a8[_0x3f329f(0x1e0)]=_0x18ccbd,writeSecureFile(_0x582b3b,JSON[_0x3f329f(0x1dd)](_0x3970a8,null,0x2));}function clearFieldFromUserConfig(_0x58b4c0){const _0x5e05f8=a65_0x7d89f7,_0x20cd2f=getGlobalConfigPath();if(!a65_0x57d545[_0x5e05f8(0x1e8)](_0x20cd2f))return;let _0x3b844a={};try{const _0x324457=a65_0x57d545['readFileSync'](_0x20cd2f,'utf-8');_0x3b844a=JSON[_0x5e05f8(0x1bf)](_0x324457);}catch{return;}delete _0x3b844a[_0x58b4c0],writeSecureFile(_0x20cd2f,JSON[_0x5e05f8(0x1dd)](_0x3b844a,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0xe8b92f=a65_0x7d89f7;clearFieldFromUserConfig(_0xe8b92f(0x1e0));}export function createProfile(_0x243ce9,_0xa2a77c){const _0xa2441f=a65_0x7d89f7;validateProfileName(_0x243ce9);if(profileExists(_0x243ce9))throw new Error('Profile\x20'+_0x243ce9+_0xa2441f(0x1d1));saveProfile(_0x243ce9,_0xa2a77c);}export function saveProfileCredentials(_0x4982e8,_0x32d6c7){const _0x1abdc5=a65_0x7d89f7;validateProfileName(_0x4982e8);if(!profileExists(_0x4982e8))throw new Error(_0x1abdc5(0x1cd)+_0x4982e8+_0x1abdc5(0x1ec));const _0x35f2eb=getNewCredentialPath(_0x4982e8);writeSecureFile(_0x35f2eb,_0x32d6c7);}export function loadProfileCredentials(_0x1745e1){const _0x46a69a=a65_0x7d89f7;validateProfileName(_0x1745e1);const _0x47d326=getNewCredentialPath(_0x1745e1);if(a65_0x57d545[_0x46a69a(0x1e8)](_0x47d326))try{return a65_0x57d545[_0x46a69a(0x1ce)](_0x47d326,_0x46a69a(0x1e3));}catch{}const _0x468e32=getOldCredentialPath(_0x1745e1);if(a65_0x57d545[_0x46a69a(0x1e8)](_0x468e32)){console[_0x46a69a(0x1e1)](_0x46a69a(0x1f9)+_0x1745e1+'\x27'),console[_0x46a69a(0x1e1)](_0x46a69a(0x1bc)),console[_0x46a69a(0x1e1)]('\x20\x20mv\x20\x22'+_0x468e32+_0x46a69a(0x1f0)+_0x47d326+'\x22'),console[_0x46a69a(0x1e1)](_0x46a69a(0x1d6));try{return a65_0x57d545[_0x46a69a(0x1ce)](_0x468e32,_0x46a69a(0x1e3));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a66_0x534ed3=a66_0x14e8;function a66_0x14e8(_0x1a00b7,_0x35affb){_0x1a00b7=_0x1a00b7-0xfb;const _0x1d0aba=a66_0x1d0a();let _0x14e842=_0x1d0aba[_0x1a00b7];return _0x14e842;}(function(_0x336665,_0x3f0a3b){const _0xce553d=a66_0x14e8,_0x223a9d=_0x336665();while(!![]){try{const _0x44b452=parseInt(_0xce553d(0xff))/0x1*(-parseInt(_0xce553d(0x10a))/0x2)+parseInt(_0xce553d(0x104))/0x3*(parseInt(_0xce553d(0x118))/0x4)+parseInt(_0xce553d(0x107))/0x5*(-parseInt(_0xce553d(0x111))/0x6)+-parseInt(_0xce553d(0xfd))/0x7*(parseInt(_0xce553d(0x10c))/0x8)+parseInt(_0xce553d(0x100))/0x9+parseInt(_0xce553d(0x115))/0xa*(parseInt(_0xce553d(0xfb))/0xb)+-parseInt(_0xce553d(0x109))/0xc;if(_0x44b452===_0x3f0a3b)break;else _0x223a9d['push'](_0x223a9d['shift']());}catch(_0x575555){_0x223a9d['push'](_0x223a9d['shift']());}}}(a66_0x1d0a,0xedf00));import*as a66_0x4d2b9b from'node:fs';function a66_0x1d0a(){const _0x4b153f=['8128274xZWmtF','writeFileSync','63TieDDT','code','591292XkxhnQ','12794112DNTnHJ','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','dirname','join','40659LjSLgK','stringify','existsSync','1979255oCdEMH','api_key','6311544sVmkpc','6mtWAHV','parse','368664yyVnUr','cwd','Failed\x20to\x20load\x20project\x20config\x20from\x20','ENOENT','tdx.json','6CqfCTA',').\x20','readFileSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','10kFyhWm','TD_API_KEY','apiKey','568CTfhOD','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','includes','Warning:\x20\x27profile\x27\x20field\x20in\x20'];a66_0x1d0a=function(){return _0x4b153f;};return a66_0x1d0a();}import*as a66_0x2b6c95 from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x534ed3(0x110);export function findProjectConfigPath(_0x466a27){const _0x5a99dc=a66_0x534ed3;let _0xee477b=_0x466a27||process['cwd']();while(!![]){const _0x3ad631=a66_0x2b6c95[_0x5a99dc(0x103)](_0xee477b,PROJECT_CONFIG_FILENAME);if(a66_0x4d2b9b[_0x5a99dc(0x106)](_0x3ad631))return _0x3ad631;const _0xdd43ef=a66_0x2b6c95[_0x5a99dc(0x102)](_0xee477b);if(_0xdd43ef===_0xee477b)return null;_0xee477b=_0xdd43ef;}}export function loadProjectConfig(_0x4f2783){const _0x5b0857=a66_0x534ed3,_0x40ee5b=findProjectConfigPath(_0x4f2783);if(!_0x40ee5b)return null;try{const _0x1835cb=a66_0x4d2b9b[_0x5b0857(0x113)](_0x40ee5b,'utf-8'),_0x404bea=JSON[_0x5b0857(0x10b)](_0x1835cb),_0x2fef13=JSON[_0x5b0857(0x105)](_0x404bea);if(_0x2fef13['includes'](_0x5b0857(0x116))||_0x2fef13[_0x5b0857(0x11a)](_0x5b0857(0x117))||_0x2fef13[_0x5b0857(0x11a)](_0x5b0857(0x108)))throw new Error(_0x5b0857(0x101)+_0x40ee5b+_0x5b0857(0x112)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0xeba1f,profile:_0x2dfb3e,..._0x37b959}=_0x404bea;return _0x2dfb3e&&console['warn'](_0x5b0857(0x11b)+_0x40ee5b+'\x20is\x20ignored.\x20'+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x37b959;}catch(_0x3c8185){if(_0x3c8185 instanceof Error&&'code'in _0x3c8185&&_0x3c8185[_0x5b0857(0xfe)]===_0x5b0857(0x10f))return null;throw new Error(_0x5b0857(0x10e)+_0x40ee5b+':\x20'+_0x3c8185);}}export function saveProjectConfig(_0x36521e,_0x456ea4){const _0x1eb3b9=a66_0x534ed3,_0x11b971=_0x456ea4||process[_0x1eb3b9(0x10d)](),_0x132d04=a66_0x2b6c95[_0x1eb3b9(0x103)](_0x11b971,PROJECT_CONFIG_FILENAME),_0x3db4d2=JSON[_0x1eb3b9(0x105)](_0x36521e);if(_0x3db4d2[_0x1eb3b9(0x11a)](_0x1eb3b9(0x116))||_0x3db4d2[_0x1eb3b9(0x11a)](_0x1eb3b9(0x117))||_0x3db4d2[_0x1eb3b9(0x11a)](_0x1eb3b9(0x108)))throw new Error(_0x1eb3b9(0x114));if('profile'in _0x36521e)throw new Error(_0x1eb3b9(0x119));a66_0x4d2b9b[_0x1eb3b9(0xfc)](_0x132d04,JSON['stringify'](_0x36521e,null,0x2));}export function hasProjectConfig(_0x106a20){return findProjectConfigPath(_0x106a20)!==null;}export function getProjectRoot(_0x1540ee){const _0x12d18a=a66_0x534ed3,_0x1f2ed4=findProjectConfigPath(_0x1540ee);return _0x1f2ed4?a66_0x2b6c95[_0x12d18a(0x102)](_0x1f2ed4):null;}
1
+ const a66_0x227850=a66_0x1475;(function(_0x4d9ef9,_0x4b1dc9){const _0x444125=a66_0x1475,_0x47b1a2=_0x4d9ef9();while(!![]){try{const _0x524915=parseInt(_0x444125(0x191))/0x1*(parseInt(_0x444125(0x19d))/0x2)+-parseInt(_0x444125(0x197))/0x3*(parseInt(_0x444125(0x199))/0x4)+parseInt(_0x444125(0x189))/0x5+parseInt(_0x444125(0x186))/0x6*(parseInt(_0x444125(0x18c))/0x7)+parseInt(_0x444125(0x192))/0x8*(parseInt(_0x444125(0x194))/0x9)+parseInt(_0x444125(0x18a))/0xa+-parseInt(_0x444125(0x18d))/0xb*(parseInt(_0x444125(0x187))/0xc);if(_0x524915===_0x4b1dc9)break;else _0x47b1a2['push'](_0x47b1a2['shift']());}catch(_0x4f495e){_0x47b1a2['push'](_0x47b1a2['shift']());}}}(a66_0x2d42,0x36a21));import*as a66_0x3e7005 from'node:fs';function a66_0x1475(_0x1509c2,_0x360890){_0x1509c2=_0x1509c2-0x183;const _0x2d427e=a66_0x2d42();let _0x147584=_0x2d427e[_0x1509c2];return _0x147584;}import*as a66_0x5597e3 from'node:path';function a66_0x2d42(){const _0x2cd0c8=['existsSync',').\x20','dirname','350490dWHZlH','16236UBYJhj','join','1760425FRoHTI','2200460zfKOCn','TD_API_KEY','35wKOwnL','5874COWjKV','api_key','readFileSync','includes','5422tMXkDn','8YvXmdX','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','941121TvhYDJ','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','cwd','774hnaDuC','utf-8','4720CpMBlE','tdx.json','writeFileSync','apiKey','104fFTwJL'];a66_0x2d42=function(){return _0x2cd0c8;};return a66_0x2d42();}const PROJECT_CONFIG_FILENAME=a66_0x227850(0x19a);export function findProjectConfigPath(_0x239f58){const _0x3d7b33=a66_0x227850;let _0x4f979b=_0x239f58||process['cwd']();while(!![]){const _0x27ea32=a66_0x5597e3[_0x3d7b33(0x188)](_0x4f979b,PROJECT_CONFIG_FILENAME);if(a66_0x3e7005[_0x3d7b33(0x183)](_0x27ea32))return _0x27ea32;const _0x5d4dee=a66_0x5597e3[_0x3d7b33(0x185)](_0x4f979b);if(_0x5d4dee===_0x4f979b)return null;_0x4f979b=_0x5d4dee;}}export function loadProjectConfig(_0x3a3bdb){const _0x41ce2e=a66_0x227850,_0x26ba8b=findProjectConfigPath(_0x3a3bdb);if(!_0x26ba8b)return null;try{const _0x41333a=a66_0x3e7005[_0x41ce2e(0x18f)](_0x26ba8b,_0x41ce2e(0x198)),_0x260b1e=JSON['parse'](_0x41333a),_0x54bad5=JSON['stringify'](_0x260b1e);if(_0x54bad5[_0x41ce2e(0x190)]('TD_API_KEY')||_0x54bad5['includes'](_0x41ce2e(0x19c))||_0x54bad5[_0x41ce2e(0x190)](_0x41ce2e(0x18e)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x26ba8b+_0x41ce2e(0x184)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0xda729c,profile:_0x524cca,..._0x4b4b46}=_0x260b1e;return _0x524cca&&console['warn']('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x26ba8b+'\x20is\x20ignored.\x20'+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x4b4b46;}catch(_0x2dba97){if(_0x2dba97 instanceof Error&&'code'in _0x2dba97&&_0x2dba97['code']==='ENOENT')return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x26ba8b+':\x20'+_0x2dba97);}}export function saveProjectConfig(_0x330020,_0x295de3){const _0x3fe766=a66_0x227850,_0x328dcd=_0x295de3||process[_0x3fe766(0x196)](),_0x345ecc=a66_0x5597e3[_0x3fe766(0x188)](_0x328dcd,PROJECT_CONFIG_FILENAME),_0x39d884=JSON['stringify'](_0x330020);if(_0x39d884[_0x3fe766(0x190)](_0x3fe766(0x18b))||_0x39d884[_0x3fe766(0x190)]('apiKey')||_0x39d884[_0x3fe766(0x190)](_0x3fe766(0x18e)))throw new Error(_0x3fe766(0x195));if('profile'in _0x330020)throw new Error(_0x3fe766(0x193));a66_0x3e7005[_0x3fe766(0x19b)](_0x345ecc,JSON['stringify'](_0x330020,null,0x2));}export function hasProjectConfig(_0x43101c){return findProjectConfigPath(_0x43101c)!==null;}export function getProjectRoot(_0x23c6d1){const _0x5aef28=a66_0x227850,_0x492955=findProjectConfigPath(_0x23c6d1);return _0x492955?a66_0x5597e3[_0x5aef28(0x185)](_0x492955):null;}
@@ -1 +1 @@
1
- (function(_0xadb465,_0x21a422){const _0x3adef4=a67_0x711c,_0x24eb6e=_0xadb465();while(!![]){try{const _0x41636a=parseInt(_0x3adef4(0x116))/0x1+-parseInt(_0x3adef4(0x12d))/0x2+parseInt(_0x3adef4(0x121))/0x3+-parseInt(_0x3adef4(0x133))/0x4+parseInt(_0x3adef4(0x11b))/0x5+-parseInt(_0x3adef4(0x12a))/0x6+-parseInt(_0x3adef4(0x118))/0x7*(-parseInt(_0x3adef4(0x127))/0x8);if(_0x41636a===_0x21a422)break;else _0x24eb6e['push'](_0x24eb6e['shift']());}catch(_0x57f7c3){_0x24eb6e['push'](_0x24eb6e['shift']());}}}(a67_0x2574,0xa62d8));import*as a67_0x4b9d4e from'node:fs';import*as a67_0x2f5577 from'node:path';import*as a67_0x48028d from'node:os';function a67_0x2574(){const _0x5d64cd=['5582874rQMDIW','toISOString','push','1331634SHwRbZ','stringify','readdirSync','.config','test','warn','3047868wwwYQf','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','join','.json','toString','sessions','readFileSync','includes','endsWith','933334yKwExj','parse','9465428QEItyp','existsSync','getTime','381775IQjhMM','apiKey','.\x20This\x20is\x20insecure.\x20Removing\x20session.','TD_API_KEY','now','writeFileSync','2031102EBGWAi','tdx','replace','homedir','unlinkSync','createdAt','8YSPwrJ','utf-8','api_key'];a67_0x2574=function(){return _0x5d64cd;};return a67_0x2574();}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 _0x636775=a67_0x711c,_0x3f5070=process.env.TDX_CONFIG_DIR||a67_0x2f5577['join'](a67_0x48028d[_0x636775(0x124)](),_0x636775(0x130),_0x636775(0x122));return a67_0x2f5577[_0x636775(0x10f)](_0x3f5070,_0x636775(0x112));}function a67_0x711c(_0x1b773b,_0x2de757){_0x1b773b=_0x1b773b-0x10f;const _0x2574aa=a67_0x2574();let _0x711c42=_0x2574aa[_0x1b773b];return _0x711c42;}function getSessionPath(_0x122a10){const _0x2ff55f=a67_0x711c;return a67_0x2f5577[_0x2ff55f(0x10f)](getSessionsDir(),_0x122a10+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x6fb593){if(_0x6fb593)return _0x6fb593;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0xb9bdd4){const _0x2af0ff=a67_0x711c,_0x2e2d45=getSessionID(_0xb9bdd4),_0x23a5cd=/^\d+$/[_0x2af0ff(0x131)](_0x2e2d45)?parseInt(_0x2e2d45,0xa):null;return _0x23a5cd!==null?loadSessionContextByPID(_0x23a5cd):loadSessionContextByString(_0x2e2d45);}export function loadSessionContextByPID(_0x526475){const _0x3b85e5=a67_0x711c,_0x555343=getSessionPath(_0x526475);if(!a67_0x4b9d4e['existsSync'](_0x555343))return null;try{const _0x3d4e10=a67_0x4b9d4e[_0x3b85e5(0x113)](_0x555343,_0x3b85e5(0x128)),_0x82bbe1=JSON[_0x3b85e5(0x117)](_0x3d4e10),_0x27e08b=new Date(_0x82bbe1['createdAt'])[_0x3b85e5(0x11a)](),_0x18201d=Date[_0x3b85e5(0x11f)]();if(_0x18201d-_0x27e08b>SESSION_EXPIRATION_MS)return a67_0x4b9d4e[_0x3b85e5(0x125)](_0x555343),null;const _0x34e642=JSON[_0x3b85e5(0x12e)](_0x82bbe1);if(_0x34e642[_0x3b85e5(0x114)]('TD_API_KEY')||_0x34e642[_0x3b85e5(0x114)]('apiKey')||_0x34e642[_0x3b85e5(0x114)]('api_key'))return console[_0x3b85e5(0x132)](_0x3b85e5(0x134)+_0x555343+_0x3b85e5(0x11d)),a67_0x4b9d4e[_0x3b85e5(0x125)](_0x555343),null;return _0x82bbe1;}catch{try{a67_0x4b9d4e[_0x3b85e5(0x125)](_0x555343);}catch{}return null;}}function loadSessionContextByString(_0x45a4c7){const _0xd8ca49=a67_0x711c,_0x4210dc=a67_0x2f5577[_0xd8ca49(0x10f)](getSessionsDir(),_0x45a4c7+'.json');if(!a67_0x4b9d4e[_0xd8ca49(0x119)](_0x4210dc))return null;try{const _0x1aa52d=a67_0x4b9d4e[_0xd8ca49(0x113)](_0x4210dc,'utf-8'),_0x3fa2ef=JSON[_0xd8ca49(0x117)](_0x1aa52d),_0x4cf41a=new Date(_0x3fa2ef[_0xd8ca49(0x126)])[_0xd8ca49(0x11a)](),_0x44085a=Date['now']();if(_0x44085a-_0x4cf41a>SESSION_EXPIRATION_MS)return a67_0x4b9d4e[_0xd8ca49(0x125)](_0x4210dc),null;const _0x5a1fc8=JSON[_0xd8ca49(0x12e)](_0x3fa2ef);if(_0x5a1fc8[_0xd8ca49(0x114)]('TD_API_KEY')||_0x5a1fc8[_0xd8ca49(0x114)]('apiKey')||_0x5a1fc8[_0xd8ca49(0x114)](_0xd8ca49(0x129)))return console[_0xd8ca49(0x132)](_0xd8ca49(0x134)+_0x4210dc+_0xd8ca49(0x11d)),a67_0x4b9d4e[_0xd8ca49(0x125)](_0x4210dc),null;return _0x3fa2ef;}catch{try{a67_0x4b9d4e[_0xd8ca49(0x125)](_0x4210dc);}catch{}return null;}}export function saveSessionContext(_0x7c2b66,_0xbe255b){const _0x2afc1e=a67_0x711c,_0x5255a6=getSessionID(_0xbe255b),_0x1b70c2=/^\d+$/['test'](_0x5255a6)?parseInt(_0x5255a6,0xa):getCurrentSessionPID(),_0x10df99=a67_0x2f5577[_0x2afc1e(0x10f)](getSessionsDir(),_0x5255a6+_0x2afc1e(0x110)),_0x3c413a=getSessionsDir();createSecureDirectory(_0x3c413a);const _0x302e40=JSON[_0x2afc1e(0x12e)](_0x7c2b66);if(_0x302e40[_0x2afc1e(0x114)](_0x2afc1e(0x11e))||_0x302e40[_0x2afc1e(0x114)](_0x2afc1e(0x11c))||_0x302e40[_0x2afc1e(0x114)]('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x23e613;const _0x26f05c=/^\d+$/[_0x2afc1e(0x131)](_0x5255a6)?loadSessionContextByPID(parseInt(_0x5255a6,0xa)):loadSessionContextByString(_0x5255a6);_0x26f05c?_0x23e613={..._0x26f05c,..._0x7c2b66,'pid':_0x1b70c2,'sessionId':_0x5255a6!==_0x1b70c2[_0x2afc1e(0x111)]()?_0x5255a6:undefined,'updatedAt':new Date()[_0x2afc1e(0x12b)]()}:_0x23e613={'pid':_0x1b70c2,'sessionId':_0x5255a6!==_0x1b70c2[_0x2afc1e(0x111)]()?_0x5255a6:undefined,..._0x7c2b66,'createdAt':new Date()[_0x2afc1e(0x12b)](),'updatedAt':new Date()[_0x2afc1e(0x12b)]()},a67_0x4b9d4e[_0x2afc1e(0x120)](_0x10df99,JSON[_0x2afc1e(0x12e)](_0x23e613,null,0x2));}export function clearSessionContext(_0x117fdf){const _0x3c417c=a67_0x711c,_0x12d908=getSessionID(_0x117fdf),_0x555c59=a67_0x2f5577[_0x3c417c(0x10f)](getSessionsDir(),_0x12d908+_0x3c417c(0x110));a67_0x4b9d4e[_0x3c417c(0x119)](_0x555c59)&&a67_0x4b9d4e[_0x3c417c(0x125)](_0x555c59);}export function clearSessionContextField(_0x2a46cb,_0x4eee30){const _0x33b5d8=a67_0x711c,_0x48f764=getSessionID(_0x4eee30),_0x526cc1=a67_0x2f5577[_0x33b5d8(0x10f)](getSessionsDir(),_0x48f764+'.json');if(!a67_0x4b9d4e[_0x33b5d8(0x119)](_0x526cc1))return;try{const _0x30cc1e=a67_0x4b9d4e['readFileSync'](_0x526cc1,_0x33b5d8(0x128)),_0x42425f=JSON[_0x33b5d8(0x117)](_0x30cc1e);delete _0x42425f[_0x2a46cb],a67_0x4b9d4e[_0x33b5d8(0x120)](_0x526cc1,JSON[_0x33b5d8(0x12e)](_0x42425f,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x277469=a67_0x711c,_0x4c8bdf=getSessionsDir();if(!a67_0x4b9d4e['existsSync'](_0x4c8bdf))return 0x0;let _0xc921f2=0x0;const _0x332ee6=Date[_0x277469(0x11f)]();try{const _0x52e5d6=a67_0x4b9d4e[_0x277469(0x12f)](_0x4c8bdf);for(const _0x17e5b7 of _0x52e5d6){if(!_0x17e5b7['endsWith']('.json'))continue;const _0x34e93b=a67_0x2f5577[_0x277469(0x10f)](_0x4c8bdf,_0x17e5b7),_0x1ea47c=_0x17e5b7[_0x277469(0x123)](_0x277469(0x110),''),_0x1f38f4=parseInt(_0x1ea47c,0xa),_0x4b8be4=!isNaN(_0x1f38f4);if(_0x4b8be4){if(!isProcessRunning(_0x1f38f4)){a67_0x4b9d4e[_0x277469(0x125)](_0x34e93b),_0xc921f2++;continue;}}try{const _0x24f180=a67_0x4b9d4e[_0x277469(0x113)](_0x34e93b,'utf-8'),_0x1c83c8=JSON['parse'](_0x24f180),_0x3720b4=new Date(_0x1c83c8[_0x277469(0x126)])[_0x277469(0x11a)]();_0x332ee6-_0x3720b4>SESSION_EXPIRATION_MS&&(a67_0x4b9d4e[_0x277469(0x125)](_0x34e93b),_0xc921f2++);}catch{a67_0x4b9d4e[_0x277469(0x125)](_0x34e93b),_0xc921f2++;}}}catch{}return _0xc921f2;}export function listActiveSessions(){const _0x27111b=a67_0x711c,_0x55f8fb=getSessionsDir();if(!a67_0x4b9d4e[_0x27111b(0x119)](_0x55f8fb))return[];try{const _0x4a3501=a67_0x4b9d4e[_0x27111b(0x12f)](_0x55f8fb),_0xd22624=[];for(const _0x2d5a8a of _0x4a3501){if(!_0x2d5a8a[_0x27111b(0x115)](_0x27111b(0x110)))continue;const _0x4df8e3=_0x2d5a8a['replace'](_0x27111b(0x110),''),_0x76f72b=parseInt(_0x4df8e3,0xa);!isNaN(_0x76f72b)&&isProcessRunning(_0x76f72b)&&_0xd22624[_0x27111b(0x12c)](_0x76f72b);}return _0xd22624['sort']((_0x587552,_0x5b51c3)=>_0x587552-_0x5b51c3);}catch{return[];}}
1
+ (function(_0x1bc93c,_0x281d8c){const _0x2d741e=a67_0x2086,_0x4952fe=_0x1bc93c();while(!![]){try{const _0x54bb00=-parseInt(_0x2d741e(0x171))/0x1*(-parseInt(_0x2d741e(0x175))/0x2)+-parseInt(_0x2d741e(0x162))/0x3+parseInt(_0x2d741e(0x160))/0x4*(parseInt(_0x2d741e(0x15e))/0x5)+-parseInt(_0x2d741e(0x17a))/0x6+parseInt(_0x2d741e(0x174))/0x7+parseInt(_0x2d741e(0x168))/0x8*(parseInt(_0x2d741e(0x166))/0x9)+parseInt(_0x2d741e(0x16a))/0xa;if(_0x54bb00===_0x281d8c)break;else _0x4952fe['push'](_0x4952fe['shift']());}catch(_0x138bc7){_0x4952fe['push'](_0x4952fe['shift']());}}}(a67_0x3a71,0xb9f02));import*as a67_0x5759e8 from'node:fs';import*as a67_0x1407ff from'node:path';function a67_0x3a71(){const _0x43a5b2=['utf-8','toString','1532902nBzQvG','2hcFfJc','api_key','toISOString','test','existsSync','8600136cgwRge','readdirSync','join','push','sessions','homedir','endsWith','TD_API_KEY','tdx','now','createdAt','readFileSync','75105VcKAbo','apiKey','20UNfhUO','includes','2561697htjToo','.\x20This\x20is\x20insecure.\x20Removing\x20session.','stringify','.json','9bgeWoH','replace','6968504sSgzfD','sort','14368910ULAccY','unlinkSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','warn','parse','getTime','writeFileSync','446812ikZqro'];a67_0x3a71=function(){return _0x43a5b2;};return a67_0x3a71();}import*as a67_0x2c389d 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 _0x414dd0=a67_0x2086,_0x5de0b6=process.env.TDX_CONFIG_DIR||a67_0x1407ff[_0x414dd0(0x17c)](a67_0x2c389d[_0x414dd0(0x17f)](),'.config',_0x414dd0(0x15a));return a67_0x1407ff[_0x414dd0(0x17c)](_0x5de0b6,_0x414dd0(0x17e));}function getSessionPath(_0x3c349e){const _0x5207a7=a67_0x2086;return a67_0x1407ff[_0x5207a7(0x17c)](getSessionsDir(),_0x3c349e+_0x5207a7(0x165));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x167384){const _0x3f28e6=a67_0x2086;if(_0x167384)return _0x167384;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x3f28e6(0x173)]();}export function loadSessionContext(_0x1ecaa5){const _0x5e9bc2=getSessionID(_0x1ecaa5),_0x3d2c8c=/^\d+$/['test'](_0x5e9bc2)?parseInt(_0x5e9bc2,0xa):null;return _0x3d2c8c!==null?loadSessionContextByPID(_0x3d2c8c):loadSessionContextByString(_0x5e9bc2);}export function loadSessionContextByPID(_0x1ade50){const _0x4362d7=a67_0x2086,_0x45115d=getSessionPath(_0x1ade50);if(!a67_0x5759e8[_0x4362d7(0x179)](_0x45115d))return null;try{const _0x12a0f9=a67_0x5759e8[_0x4362d7(0x15d)](_0x45115d,_0x4362d7(0x172)),_0x4a1cbb=JSON[_0x4362d7(0x16e)](_0x12a0f9),_0x231238=new Date(_0x4a1cbb[_0x4362d7(0x15c)])['getTime'](),_0x1408a9=Date[_0x4362d7(0x15b)]();if(_0x1408a9-_0x231238>SESSION_EXPIRATION_MS)return a67_0x5759e8[_0x4362d7(0x16b)](_0x45115d),null;const _0x477caf=JSON[_0x4362d7(0x164)](_0x4a1cbb);if(_0x477caf[_0x4362d7(0x161)](_0x4362d7(0x159))||_0x477caf[_0x4362d7(0x161)](_0x4362d7(0x15f))||_0x477caf['includes'](_0x4362d7(0x176)))return console[_0x4362d7(0x16d)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x45115d+_0x4362d7(0x163)),a67_0x5759e8[_0x4362d7(0x16b)](_0x45115d),null;return _0x4a1cbb;}catch{try{a67_0x5759e8[_0x4362d7(0x16b)](_0x45115d);}catch{}return null;}}function loadSessionContextByString(_0xaa20bb){const _0xa965f8=a67_0x2086,_0xda266c=a67_0x1407ff[_0xa965f8(0x17c)](getSessionsDir(),_0xaa20bb+_0xa965f8(0x165));if(!a67_0x5759e8[_0xa965f8(0x179)](_0xda266c))return null;try{const _0x392fc4=a67_0x5759e8[_0xa965f8(0x15d)](_0xda266c,_0xa965f8(0x172)),_0x7a8134=JSON['parse'](_0x392fc4),_0xb881d9=new Date(_0x7a8134[_0xa965f8(0x15c)])['getTime'](),_0x270718=Date[_0xa965f8(0x15b)]();if(_0x270718-_0xb881d9>SESSION_EXPIRATION_MS)return a67_0x5759e8[_0xa965f8(0x16b)](_0xda266c),null;const _0x56ce0a=JSON['stringify'](_0x7a8134);if(_0x56ce0a['includes'](_0xa965f8(0x159))||_0x56ce0a[_0xa965f8(0x161)]('apiKey')||_0x56ce0a[_0xa965f8(0x161)](_0xa965f8(0x176)))return console[_0xa965f8(0x16d)](_0xa965f8(0x16c)+_0xda266c+_0xa965f8(0x163)),a67_0x5759e8['unlinkSync'](_0xda266c),null;return _0x7a8134;}catch{try{a67_0x5759e8[_0xa965f8(0x16b)](_0xda266c);}catch{}return null;}}function a67_0x2086(_0x1c51b2,_0x103a6f){_0x1c51b2=_0x1c51b2-0x159;const _0x3a7195=a67_0x3a71();let _0x2086a0=_0x3a7195[_0x1c51b2];return _0x2086a0;}export function saveSessionContext(_0x451b48,_0x37b038){const _0x58315d=a67_0x2086,_0x1b80fd=getSessionID(_0x37b038),_0x5e558d=/^\d+$/[_0x58315d(0x178)](_0x1b80fd)?parseInt(_0x1b80fd,0xa):getCurrentSessionPID(),_0x4fb9b4=a67_0x1407ff['join'](getSessionsDir(),_0x1b80fd+_0x58315d(0x165)),_0x5de57d=getSessionsDir();createSecureDirectory(_0x5de57d);const _0x2ee302=JSON['stringify'](_0x451b48);if(_0x2ee302[_0x58315d(0x161)](_0x58315d(0x159))||_0x2ee302['includes']('apiKey')||_0x2ee302['includes'](_0x58315d(0x176)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x2e67b9;const _0x9b49bd=/^\d+$/[_0x58315d(0x178)](_0x1b80fd)?loadSessionContextByPID(parseInt(_0x1b80fd,0xa)):loadSessionContextByString(_0x1b80fd);_0x9b49bd?_0x2e67b9={..._0x9b49bd,..._0x451b48,'pid':_0x5e558d,'sessionId':_0x1b80fd!==_0x5e558d[_0x58315d(0x173)]()?_0x1b80fd:undefined,'updatedAt':new Date()[_0x58315d(0x177)]()}:_0x2e67b9={'pid':_0x5e558d,'sessionId':_0x1b80fd!==_0x5e558d['toString']()?_0x1b80fd:undefined,..._0x451b48,'createdAt':new Date()[_0x58315d(0x177)](),'updatedAt':new Date()[_0x58315d(0x177)]()},a67_0x5759e8['writeFileSync'](_0x4fb9b4,JSON[_0x58315d(0x164)](_0x2e67b9,null,0x2));}export function clearSessionContext(_0x42d4ec){const _0x57f724=a67_0x2086,_0x2a5d87=getSessionID(_0x42d4ec),_0x5bfcff=a67_0x1407ff[_0x57f724(0x17c)](getSessionsDir(),_0x2a5d87+'.json');a67_0x5759e8[_0x57f724(0x179)](_0x5bfcff)&&a67_0x5759e8['unlinkSync'](_0x5bfcff);}export function clearSessionContextField(_0x27f254,_0x32fd2b){const _0x207b86=a67_0x2086,_0x2d36f2=getSessionID(_0x32fd2b),_0x4d5e66=a67_0x1407ff[_0x207b86(0x17c)](getSessionsDir(),_0x2d36f2+_0x207b86(0x165));if(!a67_0x5759e8['existsSync'](_0x4d5e66))return;try{const _0x29323d=a67_0x5759e8[_0x207b86(0x15d)](_0x4d5e66,_0x207b86(0x172)),_0x188566=JSON[_0x207b86(0x16e)](_0x29323d);delete _0x188566[_0x27f254],a67_0x5759e8[_0x207b86(0x170)](_0x4d5e66,JSON[_0x207b86(0x164)](_0x188566,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x2077be=a67_0x2086,_0x2a0c8f=getSessionsDir();if(!a67_0x5759e8[_0x2077be(0x179)](_0x2a0c8f))return 0x0;let _0x420273=0x0;const _0x189ad2=Date[_0x2077be(0x15b)]();try{const _0x4bd372=a67_0x5759e8[_0x2077be(0x17b)](_0x2a0c8f);for(const _0x3cffef of _0x4bd372){if(!_0x3cffef[_0x2077be(0x180)]('.json'))continue;const _0x41f988=a67_0x1407ff[_0x2077be(0x17c)](_0x2a0c8f,_0x3cffef),_0x4e9f76=_0x3cffef['replace'](_0x2077be(0x165),''),_0x58be42=parseInt(_0x4e9f76,0xa),_0x59a864=!isNaN(_0x58be42);if(_0x59a864){if(!isProcessRunning(_0x58be42)){a67_0x5759e8[_0x2077be(0x16b)](_0x41f988),_0x420273++;continue;}}try{const _0x49a9c6=a67_0x5759e8[_0x2077be(0x15d)](_0x41f988,'utf-8'),_0x5d54e5=JSON[_0x2077be(0x16e)](_0x49a9c6),_0xeb2e38=new Date(_0x5d54e5[_0x2077be(0x15c)])[_0x2077be(0x16f)]();_0x189ad2-_0xeb2e38>SESSION_EXPIRATION_MS&&(a67_0x5759e8[_0x2077be(0x16b)](_0x41f988),_0x420273++);}catch{a67_0x5759e8['unlinkSync'](_0x41f988),_0x420273++;}}}catch{}return _0x420273;}export function listActiveSessions(){const _0x2be967=a67_0x2086,_0x29e85d=getSessionsDir();if(!a67_0x5759e8[_0x2be967(0x179)](_0x29e85d))return[];try{const _0x31924c=a67_0x5759e8[_0x2be967(0x17b)](_0x29e85d),_0x1354cd=[];for(const _0xe7ee9c of _0x31924c){if(!_0xe7ee9c['endsWith'](_0x2be967(0x165)))continue;const _0x2db210=_0xe7ee9c[_0x2be967(0x167)]('.json',''),_0x1aa803=parseInt(_0x2db210,0xa);!isNaN(_0x1aa803)&&isProcessRunning(_0x1aa803)&&_0x1354cd[_0x2be967(0x17d)](_0x1aa803);}return _0x1354cd[_0x2be967(0x169)]((_0x20d25e,_0x16988b)=>_0x20d25e-_0x16988b);}catch{return[];}}
@@ -1 +1 @@
1
- function a68_0x1cbb(){const _0x4231a4=['32SuJqal','1922796lkevRu','1498080iWbyVT','82209pwWkmP','write','core/user-cache','542593hQfSPa','users','68OoSlfn','6865ttyaEa','4656DPqIsS','6570948WFVEEB','2947245NuBqqW','clear'];a68_0x1cbb=function(){return _0x4231a4;};return a68_0x1cbb();}const a68_0x36b606=a68_0x5863;(function(_0x12b3d5,_0x15d4d8){const _0xad35b9=a68_0x5863,_0x2a359d=_0x12b3d5();while(!![]){try{const _0x295d0e=-parseInt(_0xad35b9(0x1e6))/0x1+parseInt(_0xad35b9(0x1e8))/0x2*(parseInt(_0xad35b9(0x1e3))/0x3)+-parseInt(_0xad35b9(0x1eb))/0x4+-parseInt(_0xad35b9(0x1e9))/0x5*(-parseInt(_0xad35b9(0x1ea))/0x6)+parseInt(_0xad35b9(0x1ec))/0x7+-parseInt(_0xad35b9(0x1e0))/0x8*(-parseInt(_0xad35b9(0x1e1))/0x9)+-parseInt(_0xad35b9(0x1e2))/0xa;if(_0x295d0e===_0x15d4d8)break;else _0x2a359d['push'](_0x2a359d['shift']());}catch(_0x463fd4){_0x2a359d['push'](_0x2a359d['shift']());}}}(a68_0x1cbb,0xe4e97));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json',a68_0x36b606(0x1e5));export function loadCachedUsers(_0xce5745){const _0x816b9b=a68_0x36b606,_0x5232d6=userCache['read'](_0xce5745);return _0x5232d6?.[_0x816b9b(0x1e7)]??null;}function a68_0x5863(_0x122880,_0x5ea390){_0x122880=_0x122880-0x1df;const _0x1cbb4a=a68_0x1cbb();let _0x5863ea=_0x1cbb4a[_0x122880];return _0x5863ea;}export function saveCachedUsers(_0x3f265a,_0x1a5621){const _0x1e2efc=a68_0x36b606;userCache[_0x1e2efc(0x1e4)](_0x3f265a,{'users':_0x1a5621,'cachedAt':Date['now']()});}export function clearUserCache(_0x357264){const _0x394e6a=a68_0x36b606;userCache[_0x394e6a(0x1df)](_0x357264);}
1
+ const a68_0x404c19=a68_0x37f3;(function(_0x229ed0,_0x1837ab){const _0x29a412=a68_0x37f3,_0x415941=_0x229ed0();while(!![]){try{const _0x2dd4a2=parseInt(_0x29a412(0x179))/0x1+parseInt(_0x29a412(0x17b))/0x2+parseInt(_0x29a412(0x17c))/0x3+parseInt(_0x29a412(0x17a))/0x4+parseInt(_0x29a412(0x180))/0x5*(-parseInt(_0x29a412(0x17d))/0x6)+parseInt(_0x29a412(0x181))/0x7*(parseInt(_0x29a412(0x17f))/0x8)+-parseInt(_0x29a412(0x17e))/0x9;if(_0x2dd4a2===_0x1837ab)break;else _0x415941['push'](_0x415941['shift']());}catch(_0x5054e6){_0x415941['push'](_0x415941['shift']());}}}(a68_0x319d,0x7955d));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x404c19(0x183),a68_0x404c19(0x184));export function loadCachedUsers(_0x162d61){const _0x4136e9=a68_0x404c19,_0x226837=userCache[_0x4136e9(0x178)](_0x162d61);return _0x226837?.['users']??null;}function a68_0x37f3(_0x49ce02,_0x226912){_0x49ce02=_0x49ce02-0x178;const _0x319dae=a68_0x319d();let _0x37f331=_0x319dae[_0x49ce02];return _0x37f331;}export function saveCachedUsers(_0x162ef0,_0x4cf04d){const _0x42018e=a68_0x404c19;userCache['write'](_0x162ef0,{'users':_0x4cf04d,'cachedAt':Date[_0x42018e(0x182)]()});}export function clearUserCache(_0x567a44){userCache['clear'](_0x567a44);}function a68_0x319d(){const _0x26c820=['read','842480EBPLPH','490708iKBdNt','556236bCrcFE','241050WgIRlU','116682JvFlWr','5413239EOautI','104cdMRrB','235DqYSHM','370916EagNjh','now','users-{profile}.json','core/user-cache'];a68_0x319d=function(){return _0x26c820;};return a68_0x319d();}
@@ -1 +1 @@
1
- (function(_0x299455,_0x29d090){const _0x465dfd=a69_0x4ab3,_0x2c497d=_0x299455();while(!![]){try{const _0x2480c8=-parseInt(_0x465dfd(0x179))/0x1*(parseInt(_0x465dfd(0x16d))/0x2)+-parseInt(_0x465dfd(0x171))/0x3*(parseInt(_0x465dfd(0x175))/0x4)+parseInt(_0x465dfd(0x170))/0x5*(parseInt(_0x465dfd(0x17c))/0x6)+-parseInt(_0x465dfd(0x17a))/0x7*(-parseInt(_0x465dfd(0x172))/0x8)+parseInt(_0x465dfd(0x16f))/0x9*(parseInt(_0x465dfd(0x16e))/0xa)+-parseInt(_0x465dfd(0x174))/0xb+parseInt(_0x465dfd(0x176))/0xc;if(_0x2480c8===_0x29d090)break;else _0x2c497d['push'](_0x2c497d['shift']());}catch(_0x3829d9){_0x2c497d['push'](_0x2c497d['shift']());}}}(a69_0x2faa,0x343fc));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;function a69_0x2faa(){const _0x260357=['3092738HrkFBl','16MNZHBc','2571936wGkdkB','0.0.0','../../package.json','11ybmiut','1990002XGfXId','version','108294DrYGxS','includes','utf-8','.dev','parse','21158kkXwvi','5230nnZPEz','1467qfzlnn','60QSkCGR','141684zOkVJu','8FnJUaz','../build-info.json'];a69_0x2faa=function(){return _0x260357;};return a69_0x2faa();}function a69_0x4ab3(_0x255811,_0x27b590){_0x255811=_0x255811-0x169;const _0x2faa5c=a69_0x2faa();let _0x4ab3b7=_0x2faa5c[_0x255811];return _0x4ab3b7;}export function getBuildInfo(){const _0x35811c=a69_0x4ab3;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0xe3a2d0=fileURLToPath(import.meta.url),_0x2c0b02=dirname(_0xe3a2d0);try{const _0x469572=join(_0x2c0b02,_0x35811c(0x173));cachedBuildInfo=JSON[_0x35811c(0x16c)](readFileSync(_0x469572,_0x35811c(0x16a)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x3e847d=a69_0x4ab3;if(cachedVersion!==null)return cachedVersion;const _0x239ea0=fileURLToPath(import.meta.url),_0x1e7ba7=dirname(_0x239ea0),_0x6de1f2=getBuildInfo();if(_0x6de1f2[_0x3e847d(0x17b)])return cachedVersion=_0x6de1f2[_0x3e847d(0x17b)],cachedVersion;try{const _0x468448=join(_0x1e7ba7,_0x3e847d(0x178)),_0x35a44a=JSON[_0x3e847d(0x16c)](readFileSync(_0x468448,_0x3e847d(0x16a)));cachedVersion=_0x35a44a[_0x3e847d(0x17b)];}catch{cachedVersion=_0x3e847d(0x177);}return cachedVersion;}export function isDevVersion(){const _0x123d14=a69_0x4ab3,_0x2e8bf9=getVersion();return _0x2e8bf9[_0x123d14(0x169)](_0x123d14(0x16b))||_0x2e8bf9['includes']('-');}
1
+ (function(_0x22e421,_0x2b7014){const _0x1398a3=a69_0x3db4,_0x19c9fd=_0x22e421();while(!![]){try{const _0x1cffb8=-parseInt(_0x1398a3(0x97))/0x1+-parseInt(_0x1398a3(0x99))/0x2*(parseInt(_0x1398a3(0x98))/0x3)+parseInt(_0x1398a3(0x9b))/0x4*(-parseInt(_0x1398a3(0x92))/0x5)+-parseInt(_0x1398a3(0x8f))/0x6+-parseInt(_0x1398a3(0x9c))/0x7*(parseInt(_0x1398a3(0x95))/0x8)+parseInt(_0x1398a3(0x96))/0x9+parseInt(_0x1398a3(0x94))/0xa;if(_0x1cffb8===_0x2b7014)break;else _0x19c9fd['push'](_0x19c9fd['shift']());}catch(_0x4c27d9){_0x19c9fd['push'](_0x19c9fd['shift']());}}}(a69_0x5c70,0x4a514));import{readFileSync}from'fs';function a69_0x3db4(_0x1d0087,_0x4dbd53){_0x1d0087=_0x1d0087-0x8e;const _0x5c70a0=a69_0x5c70();let _0x3db414=_0x5c70a0[_0x1d0087];return _0x3db414;}import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x4615a5=a69_0x3db4;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x17f9c1=fileURLToPath(import.meta.url),_0x128120=dirname(_0x17f9c1);try{const _0x573183=join(_0x128120,'../build-info.json');cachedBuildInfo=JSON[_0x4615a5(0x9a)](readFileSync(_0x573183,_0x4615a5(0x90)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}function a69_0x5c70(){const _0x392ac1=['0.0.0','1333830wZaUUk','utf-8','.dev','565xUYxxa','version','12232230qbOssl','88iTLDnR','3672981sLqLrc','55530kzZJZj','1208442ntonnl','2yKwTpe','parse','13796cVgylK','163254Nzrddm'];a69_0x5c70=function(){return _0x392ac1;};return a69_0x5c70();}export function getVersion(){const _0x4aae6a=a69_0x3db4;if(cachedVersion!==null)return cachedVersion;const _0x11023f=fileURLToPath(import.meta.url),_0x27d823=dirname(_0x11023f),_0xbfb9c9=getBuildInfo();if(_0xbfb9c9[_0x4aae6a(0x93)])return cachedVersion=_0xbfb9c9['version'],cachedVersion;try{const _0x42fd0f=join(_0x27d823,'../../package.json'),_0x31290d=JSON['parse'](readFileSync(_0x42fd0f,_0x4aae6a(0x90)));cachedVersion=_0x31290d[_0x4aae6a(0x93)];}catch{cachedVersion=_0x4aae6a(0x8e);}return cachedVersion;}export function isDevVersion(){const _0x13633b=a69_0x3db4,_0x520797=getVersion();return _0x520797['includes'](_0x13633b(0x91))||_0x520797['includes']('-');}