@treasuredata/tdx 0.8.11 → 0.8.12

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 (137) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/engage-api-client.js +1 -1
  9. package/dist/client/http-client.js +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/rate-limiter.js +1 -1
  12. package/dist/client/td-api-client.js +1 -1
  13. package/dist/client/trino-api-client.js +1 -1
  14. package/dist/client/workflow-client.js +1 -1
  15. package/dist/commands/activations.js +1 -1
  16. package/dist/commands/api-command.js +1 -1
  17. package/dist/commands/auth-command.js +1 -1
  18. package/dist/commands/chat-command.js +1 -1
  19. package/dist/commands/claude-command.d.ts +23 -0
  20. package/dist/commands/claude-command.d.ts.map +1 -1
  21. package/dist/commands/claude-command.js +1 -1
  22. package/dist/commands/claude-command.js.map +1 -1
  23. package/dist/commands/claude-statusline-command.js +1 -1
  24. package/dist/commands/claude-usage-command.js +1 -1
  25. package/dist/commands/command.js +1 -1
  26. package/dist/commands/connection-command.js +1 -1
  27. package/dist/commands/context-command.js +1 -1
  28. package/dist/commands/databases.js +1 -1
  29. package/dist/commands/describe.js +1 -1
  30. package/dist/commands/engage-command.js +1 -1
  31. package/dist/commands/job-command.js +1 -1
  32. package/dist/commands/journey-command.d.ts +12 -0
  33. package/dist/commands/journey-command.d.ts.map +1 -1
  34. package/dist/commands/journey-command.js +1 -1
  35. package/dist/commands/journey-command.js.map +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/llm-proxy.js +1 -1
  38. package/dist/commands/parent-segment-command.js +1 -1
  39. package/dist/commands/profiles-command.js +1 -1
  40. package/dist/commands/query-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.d.ts.map +1 -1
  46. package/dist/commands/segment-push-command.js +1 -1
  47. package/dist/commands/segment-push-command.js.map +1 -1
  48. package/dist/commands/segment-update-command.js +1 -1
  49. package/dist/commands/segment-use-command.js +1 -1
  50. package/dist/commands/segments.d.ts.map +1 -1
  51. package/dist/commands/segments.js +1 -1
  52. package/dist/commands/segments.js.map +1 -1
  53. package/dist/commands/show.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/credential-cache.js +1 -1
  62. package/dist/core/global-context.js +1 -1
  63. package/dist/core/keychain.js +1 -1
  64. package/dist/core/profile.js +1 -1
  65. package/dist/core/project-config.js +1 -1
  66. package/dist/core/session.js +1 -1
  67. package/dist/core/user-cache.js +1 -1
  68. package/dist/index.js +1 -1
  69. package/dist/proxy/anthropic-adapter.js +1 -1
  70. package/dist/proxy/claude-usage-tracker.js +1 -1
  71. package/dist/proxy/context-signature.js +1 -1
  72. package/dist/proxy/conversation-utils.js +1 -1
  73. package/dist/proxy/server.js +1 -1
  74. package/dist/proxy/session-cache.js +1 -1
  75. package/dist/sdk/api.js +1 -1
  76. package/dist/sdk/connection.js +1 -1
  77. package/dist/sdk/engage.js +1 -1
  78. package/dist/sdk/errors.d.ts +2 -0
  79. package/dist/sdk/errors.d.ts.map +1 -1
  80. package/dist/sdk/errors.js +1 -1
  81. package/dist/sdk/errors.js.map +1 -1
  82. package/dist/sdk/index.js +1 -1
  83. package/dist/sdk/job.js +1 -1
  84. package/dist/sdk/journey.js +1 -1
  85. package/dist/sdk/llm.js +1 -1
  86. package/dist/sdk/query.js +1 -1
  87. package/dist/sdk/segment/child-segment-yaml.d.ts +4 -0
  88. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  89. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  90. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  91. package/dist/sdk/segment/journey-yaml.d.ts +13 -1
  92. package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
  93. package/dist/sdk/segment/journey-yaml.js +1 -1
  94. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  95. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  96. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  97. package/dist/sdk/segment.js +1 -1
  98. package/dist/sdk/user.js +1 -1
  99. package/dist/sdk/workflow.js +1 -1
  100. package/dist/types/endpoints.js +1 -1
  101. package/dist/types/index.js +1 -1
  102. package/dist/utils/agent-ref-parser.js +1 -1
  103. package/dist/utils/async.js +1 -1
  104. package/dist/utils/chat-cache.js +1 -1
  105. package/dist/utils/colors.js +1 -1
  106. package/dist/utils/command-output.js +1 -1
  107. package/dist/utils/constants.js +1 -1
  108. package/dist/utils/diff.js +1 -1
  109. package/dist/utils/fields-display.js +1 -1
  110. package/dist/utils/file-permissions.js +1 -1
  111. package/dist/utils/format-detector.js +1 -1
  112. package/dist/utils/formatters.js +1 -1
  113. package/dist/utils/journey-utils.js +1 -1
  114. package/dist/utils/json-loader.js +1 -1
  115. package/dist/utils/llm-backup-utils.js +1 -1
  116. package/dist/utils/model-aliases.js +1 -1
  117. package/dist/utils/model-factors.js +1 -1
  118. package/dist/utils/option-validation.js +1 -1
  119. package/dist/utils/port.js +1 -1
  120. package/dist/utils/process.js +1 -1
  121. package/dist/utils/prompt.js +1 -1
  122. package/dist/utils/segment-path-parser.js +1 -1
  123. package/dist/utils/segment-ref-parser.js +1 -1
  124. package/dist/utils/spinner.js +1 -1
  125. package/dist/utils/sql-parser.js +1 -1
  126. package/dist/utils/sse-parser.js +1 -1
  127. package/dist/utils/string-utils.js +1 -1
  128. package/dist/utils/table-ref-parser.js +1 -1
  129. package/dist/utils/tdx-config.js +1 -1
  130. package/dist/utils/tdx-logger.js +1 -1
  131. package/dist/utils/tree-formatter.d.ts +2 -0
  132. package/dist/utils/tree-formatter.d.ts.map +1 -1
  133. package/dist/utils/tree-formatter.js +1 -1
  134. package/dist/utils/tree-formatter.js.map +1 -1
  135. package/dist/utils/version-check.js +1 -1
  136. package/dist/utils/workflow-utils.js +1 -1
  137. package/package.json +1 -1
@@ -1 +1 @@
1
- (function(_0x461a0e,_0x5086a0){const _0x3a0cb8=a45_0x4065,_0x54f77c=_0x461a0e();while(!![]){try{const _0x43b2f7=parseInt(_0x3a0cb8(0x1db))/0x1*(parseInt(_0x3a0cb8(0x1da))/0x2)+-parseInt(_0x3a0cb8(0x1d8))/0x3*(parseInt(_0x3a0cb8(0x1cb))/0x4)+parseInt(_0x3a0cb8(0x1d7))/0x5*(-parseInt(_0x3a0cb8(0x1df))/0x6)+parseInt(_0x3a0cb8(0x1e0))/0x7*(-parseInt(_0x3a0cb8(0x1ef))/0x8)+parseInt(_0x3a0cb8(0x1f6))/0x9*(-parseInt(_0x3a0cb8(0x20c))/0xa)+-parseInt(_0x3a0cb8(0x1d1))/0xb*(-parseInt(_0x3a0cb8(0x1d4))/0xc)+parseInt(_0x3a0cb8(0x204))/0xd*(parseInt(_0x3a0cb8(0x1ed))/0xe);if(_0x43b2f7===_0x5086a0)break;else _0x54f77c['push'](_0x54f77c['shift']());}catch(_0x1f72ea){_0x54f77c['push'](_0x54f77c['shift']());}}}(a45_0x8e54,0x8e0f1));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x109a07 from'node:fs';import*as a45_0x127b04 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x2e3f95 from'chalk';export function getConfigDir(){const _0x53b3c9=a45_0x4065;return process[_0x53b3c9(0x1d2)][_0x53b3c9(0x1fc)]||join(homedir(),_0x53b3c9(0x1fa),_0x53b3c9(0x1ce));}export function getConfigFile(){const _0x49cbb2=a45_0x4065;return join(getConfigDir(),_0x49cbb2(0x1e3));}export function getConfigFilePath(_0x572e73){const _0x32ffd0=a45_0x4065,_0x4afa04=getConfigDir();return _0x572e73?a45_0x127b04['join'](_0x4afa04,_0x32ffd0(0x1d6)+_0x572e73):getConfigFile();}export function getCacheDir(){const _0x6d700=a45_0x4065;return process['env']['TDX_CACHE_DIR']||join(homedir(),'.cache',_0x6d700(0x1ce));}export function getLLMProjectCacheFile(_0x468b96){const _0xd75707=a45_0x4065,_0x4c79e1=_0x468b96?'llm_default_project.'+_0x468b96:_0xd75707(0x1cd);return join(getCacheDir(),_0x4c79e1);}export function readCachedLLMProject(_0x518fe9){const _0x1fd72b=a45_0x4065;try{const _0x5783de=getLLMProjectCacheFile(_0x518fe9);if(!existsSync(_0x5783de))return null;const _0x1652ef=readFileSync(_0x5783de,_0x1fd72b(0x1fb))[_0x1fd72b(0x1e1)]();try{const _0x23fc2a=JSON[_0x1fd72b(0x210)](_0x1652ef);if(_0x23fc2a&&typeof _0x23fc2a['id']==='string'&&typeof _0x23fc2a[_0x1fd72b(0x1c8)]===_0x1fd72b(0x203))return _0x23fc2a;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x45fc02,_0x3570f0,_0x433f41){const _0x5fabdb=a45_0x4065;try{const _0x42023b=getCacheDir(),_0x5180a5=getLLMProjectCacheFile(_0x433f41);!existsSync(_0x42023b)&&mkdirSync(_0x42023b,{'recursive':!![]});const _0x47f074={'name':_0x45fc02,'id':_0x3570f0};writeFileSync(_0x5180a5,JSON[_0x5fabdb(0x1fe)](_0x47f074),_0x5fabdb(0x1fb));}catch{}}export function getAccountInfoCacheFile(_0x515493){const _0x1691a9=a45_0x4065,_0x4a86ac=_0x515493?_0x1691a9(0x1f5)+_0x515493+_0x1691a9(0x205):'account_info.json';return join(getCacheDir(),_0x4a86ac);}export function readCachedAccountInfo(_0x3f633c){const _0x3512fa=a45_0x4065;try{const _0x45c5b7=getAccountInfoCacheFile(_0x3f633c);if(!existsSync(_0x45c5b7))return null;const _0x459edc=readFileSync(_0x45c5b7,_0x3512fa(0x1fb))[_0x3512fa(0x1e1)](),_0x263f4a=JSON[_0x3512fa(0x210)](_0x459edc);if(_0x263f4a&&typeof _0x263f4a[_0x3512fa(0x1e6)]===_0x3512fa(0x203)&&typeof _0x263f4a['accountId']===_0x3512fa(0x1c4))return _0x263f4a;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x56a791,_0x414cf0,_0x2ed5f6){const _0x42a863=a45_0x4065;try{const _0xaac387=getCacheDir(),_0x5a66e1=getAccountInfoCacheFile(_0x2ed5f6);!existsSync(_0xaac387)&&mkdirSync(_0xaac387,{'recursive':!![]});const _0x2ab662={'site':_0x56a791,'accountId':_0x414cf0,'cachedAt':new Date()[_0x42a863(0x1ec)]()};writeFileSync(_0x5a66e1,JSON[_0x42a863(0x1fe)](_0x2ab662),_0x42a863(0x1fb));}catch{}}export function parseEnvFile(_0x102e37){const _0x44834f=a45_0x4065,_0x1ab854={};for(const _0x920dba of _0x102e37[_0x44834f(0x1c6)]('\x0a')){const _0x15525d=_0x920dba[_0x44834f(0x1e1)]();if(!_0x15525d||_0x15525d[_0x44834f(0x1e2)]('#'))continue;const _0x4064a3=_0x15525d[_0x44834f(0x1e5)](/^([^=]+)=(.*)$/);if(_0x4064a3){const _0x4b847d=_0x4064a3[0x1][_0x44834f(0x1e1)]();let _0x15d32b=_0x4064a3[0x2][_0x44834f(0x1e1)]();(_0x15d32b['startsWith']('\x22')&&_0x15d32b['endsWith']('\x22')||_0x15d32b['startsWith']('\x27')&&_0x15d32b[_0x44834f(0x1f1)]('\x27'))&&(_0x15d32b=_0x15d32b[_0x44834f(0x1c7)](0x1,-0x1)),_0x1ab854[_0x4b847d]=_0x15d32b;}}return _0x1ab854;}export function readUserConfig(){const _0x4628ba=a45_0x4065,_0x36a4de=getConfigFile();if(!existsSync(_0x36a4de))return{};try{const _0x47e870=readFileSync(_0x36a4de,_0x4628ba(0x1fb));return parseEnvFile(_0x47e870);}catch(_0x1a3dfb){return console[_0x4628ba(0x1c3)](_0x4628ba(0x1ea)+_0x36a4de+':',_0x1a3dfb),{};}}export function resolveSite(_0x501b07){const _0x235a1e=a45_0x4065,_0x445f0a=['us01',_0x235a1e(0x1f9),_0x235a1e(0x1ff),_0x235a1e(0x209),_0x235a1e(0x1f2),_0x235a1e(0x1c9),_0x235a1e(0x1cf),_0x235a1e(0x1e8),_0x235a1e(0x206),'stg-ap03'];if(_0x445f0a[_0x235a1e(0x201)](_0x501b07))return _0x501b07;if(_0x501b07 in SITE_ALIASES)return SITE_ALIASES[_0x501b07];return console['warn']('Warning:\x20Unknown\x20site\x20\x27'+_0x501b07+'\x27,\x20defaulting\x20to\x20us01'),_0x235a1e(0x1f4);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x49653c,_0x2d6737){const _0x1fcfa9=a45_0x4065,_0x3d7046=_0x2d6737||getActiveProfileName();if(_0x3d7046){const _0x36afe5=_0x1fcfa9(0x208)+normalizeProfileForEnvVar(_0x3d7046);if(process[_0x1fcfa9(0x1d2)][_0x36afe5])return process[_0x1fcfa9(0x1d2)][_0x36afe5];}if(process['env']['TDX_API_KEY'])return process['env'][_0x1fcfa9(0x200)];if(process[_0x1fcfa9(0x1d2)][_0x1fcfa9(0x1f7)])return process[_0x1fcfa9(0x1d2)][_0x1fcfa9(0x1f7)];const _0x454f1b=_0x49653c[_0x1fcfa9(0x1ca)]()[_0x1fcfa9(0x20f)](/-/g,'_'),_0x36a47b=_0x1fcfa9(0x20a)+_0x454f1b;if(_0x3d7046){const _0x5e9752=loadProfileEnv(_0x3d7046);if(_0x5e9752){if(_0x5e9752[_0x36a47b])return _0x5e9752[_0x36a47b];if(_0x5e9752[_0x1fcfa9(0x1f7)])return _0x5e9752[_0x1fcfa9(0x1f7)];}}const _0x3e6f09=loadUserConfigOnce();if(_0x3e6f09[_0x36a47b])return _0x3e6f09[_0x36a47b];if(_0x3e6f09[_0x1fcfa9(0x1f7)])return _0x3e6f09[_0x1fcfa9(0x1f7)];return undefined;}export function normalizeProfileForEnvVar(_0x456f3){const _0x46d8dc=a45_0x4065;return _0x456f3['toUpperCase']()[_0x46d8dc(0x20f)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x2904a0,_0x4cd781){const _0xc66ca0=a45_0x4065,_0x389710=_0x4cd781||getActiveProfileName()||undefined;if(_0x389710){const _0x84d73=_0xc66ca0(0x208)+normalizeProfileForEnvVar(_0x389710);if(process['env'][_0x84d73])return{'apiKey':process[_0xc66ca0(0x1d2)][_0x84d73],'source':_0x84d73+'\x20env\x20var','isDeprecated':![]};const _0x278015=getCachedCredential(_0x2904a0,_0x389710);if(_0x278015)return{'apiKey':_0x278015,'source':_0xc66ca0(0x1d3)+_0x389710+')','isDeprecated':![]};const _0x357b02=await getKeychainAPIKey(_0x389710);if(_0x357b02)return setCachedCredential(_0x357b02,_0x2904a0,_0x389710),{'apiKey':_0x357b02,'source':_0xc66ca0(0x1d3)+_0x389710+')','isDeprecated':![]};}if(process[_0xc66ca0(0x1d2)][_0xc66ca0(0x200)])return{'apiKey':process[_0xc66ca0(0x1d2)][_0xc66ca0(0x200)],'source':_0xc66ca0(0x1d0),'isDeprecated':![]};if(!_0x389710){const _0x3054a3=getCachedCredential(_0x2904a0,undefined);if(_0x3054a3)return{'apiKey':_0x3054a3,'source':_0xc66ca0(0x1f3),'isDeprecated':![]};const _0x1b6b64=await getKeychainAPIKey(undefined);if(_0x1b6b64)return setCachedCredential(_0x1b6b64,_0x2904a0,undefined),{'apiKey':_0x1b6b64,'source':_0xc66ca0(0x1f3),'isDeprecated':![]};}if(process[_0xc66ca0(0x1d2)][_0xc66ca0(0x1f7)])return{'apiKey':process['env'][_0xc66ca0(0x1f7)],'source':_0xc66ca0(0x1fd),'isDeprecated':!![]};const _0x2fc6bb=getLegacyEnvAPIKey(_0x2904a0,_0x389710);if(_0x2fc6bb){const _0x5622fd=await isKeychainAvailable();if(_0x5622fd)try{await saveKeychainAPIKey(_0x2fc6bb,_0x389710),setCachedCredential(_0x2fc6bb,_0x2904a0,_0x389710);const _0x19437f=getConfigFilePath(_0x389710);cleanupLegacyEnvFile(_0x19437f)&&console[_0xc66ca0(0x1c3)](a45_0x2e3f95['yellow'](_0xc66ca0(0x20b)));}catch(_0x5107bf){console['warn'](a45_0x2e3f95['yellow'](_0xc66ca0(0x1eb)+_0x5107bf));}const _0x20c3f1=_0x389710?'legacy\x20.env\x20file\x20(profile:\x20'+_0x389710+')':_0xc66ca0(0x202);return{'apiKey':_0x2fc6bb,'source':_0x20c3f1,'isDeprecated':!![]};}return null;}function a45_0x8e54(){const _0x4aebd1=['⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','27240QBDpch','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','Warning:\x20Failed\x20to\x20read\x20','replace','parse','warn','number','isDeprecated','split','slice','name','dev-us01','toUpperCase','18612TuoGNB','yellow','llm_default_project','tdx','dev-eu01','TDX_API_KEY\x20env\x20var','5850152TPdTca','env','keychain\x20(profile:\x20','12SjHukF','profile','.env.','15DDbqCP','591ZvdiBK','join','52PHOILz','16452EyZEgq','existsSync','filter','Warning:\x20Failed\x20to\x20load\x20','731346eKylIQ','259rCUKSV','trim','startsWith','.env','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','match','site','apiKey','stg-us01','entries','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','toISOString','31485202mUxoJS','source','249440ctrzRR','apiKeys','endsWith','ap03','keychain','us01','account_info.','630eXPsWd','TD_API_KEY','map','jp01','.config','utf-8','TDX_CONFIG_DIR','TD_API_KEY\x20env\x20var\x20(deprecated)','stringify','eu01','TDX_API_KEY','includes','legacy\x20.env\x20file','string','13FxZNuG','.json','stg-jp01','tdx.json','TDX_API_KEY_','ap02','TD_API_KEY_'];a45_0x8e54=function(){return _0x4aebd1;};return a45_0x8e54();}export async function getAPIKeyAsync(_0x5730f9,_0x385c6f,_0x4b0343=!![]){const _0x2be38b=a45_0x4065,_0x574658=await resolveAPIKeyAsync(_0x5730f9,_0x385c6f);if(!_0x574658)return undefined;if(_0x4b0343&&_0x574658[_0x2be38b(0x1c5)]&&_0x574658[_0x2be38b(0x1ee)][_0x2be38b(0x201)](_0x2be38b(0x1f7))){const _0x22b913=_0x385c6f||getActiveProfileName()||undefined,_0x3c6add=_0x22b913?_0x2be38b(0x208)+normalizeProfileForEnvVar(_0x22b913):'TDX_API_KEY_<PROFILE>';console[_0x2be38b(0x1c3)](a45_0x2e3f95[_0x2be38b(0x1cc)](_0x2be38b(0x1e4)+(_0x2be38b(0x20d)+_0x3c6add+').')));}return _0x574658[_0x2be38b(0x1e7)];}function getLegacyEnvAPIKey(_0x118ce1,_0x3a14cd){const _0x1267ad=a45_0x4065,_0x311575=_0x118ce1[_0x1267ad(0x1ca)]()[_0x1267ad(0x20f)](/-/g,'_'),_0xcf9ed6='TD_API_KEY_'+_0x311575;if(_0x3a14cd){const _0x490c5e=loadProfileEnv(_0x3a14cd);if(_0x490c5e){if(_0x490c5e[_0xcf9ed6])return _0x490c5e[_0xcf9ed6];if(_0x490c5e[_0x1267ad(0x1f7)])return _0x490c5e['TD_API_KEY'];}}const _0x136500=loadUserConfigOnce();if(_0x136500[_0xcf9ed6])return _0x136500[_0xcf9ed6];if(_0x136500[_0x1267ad(0x1f7)])return _0x136500['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0x3b9c78){const _0x5efa20=a45_0x4065;if(!existsSync(_0x3b9c78))return![];try{const _0x2ee806=readFileSync(_0x3b9c78,'utf-8'),_0x552286=_0x2ee806[_0x5efa20(0x1c6)]('\x0a'),_0x3f4328=_0x552286[_0x5efa20(0x1dd)](_0x4c8b7f=>{const _0x574696=_0x5efa20,_0xb50c1d=_0x4c8b7f[_0x574696(0x1e1)]();if(!_0xb50c1d||_0xb50c1d[_0x574696(0x1e2)]('#'))return!![];const [_0x1b48ca]=_0xb50c1d[_0x574696(0x1c6)]('=');return!_0x1b48ca['startsWith'](_0x574696(0x1f7));}),_0x19c6ef=_0x3f4328['some'](_0x46de0d=>{const _0x4ad66a=_0x5efa20,_0x5afd20=_0x46de0d[_0x4ad66a(0x1e1)]();return _0x5afd20&&!_0x5afd20[_0x4ad66a(0x1e2)]('#');});if(!_0x19c6ef)return unlinkSync(_0x3b9c78),!![];return writeFileSync(_0x3b9c78,_0x3f4328[_0x5efa20(0x1d9)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x59c756){const _0x4be1cd=a45_0x4065,_0x4355b1=a45_0x127b04[_0x4be1cd(0x1d9)](getConfigDir(),'.env.'+_0x59c756);if(a45_0x109a07[_0x4be1cd(0x1dc)](_0x4355b1)){validateSecureFilePermissions(_0x4355b1);try{const _0x186c88=a45_0x109a07['readFileSync'](_0x4355b1,_0x4be1cd(0x1fb));return parseEnvFile(_0x186c88);}catch(_0x30cb22){console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x4355b1+':\x20'+_0x30cb22);}}const _0x244333=a45_0x127b04[_0x4be1cd(0x1d9)](getConfigDir(),'profiles',_0x59c756,_0x4be1cd(0x1e3));if(a45_0x109a07[_0x4be1cd(0x1dc)](_0x244333)){validateSecureFilePermissions(_0x244333);try{const _0x23bbfc=a45_0x109a07['readFileSync'](_0x244333,_0x4be1cd(0x1fb));return parseEnvFile(_0x23bbfc);}catch(_0x2cc1e4){return console['warn'](_0x4be1cd(0x1de)+_0x244333+':\x20'+_0x2cc1e4),null;}}return null;}function getActiveProfileName(){const _0x15cbe3=a45_0x4065,_0x2b96fb=a45_0x127b04[_0x15cbe3(0x1d9)](getConfigDir(),_0x15cbe3(0x207));if(!a45_0x109a07[_0x15cbe3(0x1dc)](_0x2b96fb))return null;try{const _0x550f86=a45_0x109a07['readFileSync'](_0x2b96fb,_0x15cbe3(0x1fb)),_0x70e5ac=JSON[_0x15cbe3(0x210)](_0x550f86);return _0x70e5ac[_0x15cbe3(0x1d5)]||null;}catch{return null;}}function a45_0x4065(_0x223cbe,_0x533849){_0x223cbe=_0x223cbe-0x1c3;const _0x8e547=a45_0x8e54();let _0x406589=_0x8e547[_0x223cbe];return _0x406589;}export function saveAPIKey(_0x4f3609,_0x1b0473,_0x462d3a){const _0x3b4972=a45_0x4065,_0x1f7083=getConfigDir(),_0x5f480e=getConfigFilePath(_0x462d3a);!existsSync(_0x1f7083)&&mkdirSync(_0x1f7083,{'recursive':!![],'mode':0x1c0});let _0x5a455f={};if(existsSync(_0x5f480e))try{const _0x81c501=readFileSync(_0x5f480e,'utf-8');_0x5a455f=parseEnvFile(_0x81c501);}catch(_0x429e62){console[_0x3b4972(0x1c3)](_0x3b4972(0x20e)+_0x5f480e+':',_0x429e62);}const _0x48b38c=_0x4f3609[_0x3b4972(0x1ca)]()[_0x3b4972(0x20f)](/-/g,'_');_0x5a455f[_0x3b4972(0x20a)+_0x48b38c]=_0x1b0473;const _0x6da4d1=Object[_0x3b4972(0x1e9)](_0x5a455f)[_0x3b4972(0x1f8)](([_0x398e82,_0x451c91])=>_0x398e82+'='+_0x451c91);writeFileSync(_0x5f480e,_0x6da4d1[_0x3b4972(0x1d9)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x59a026,_0x294493,_0x5bf292){const _0xc7ad3=a45_0x4065;await saveKeychainAPIKey(_0x59a026,_0x5bf292),setCachedCredential(_0x59a026,_0x294493,_0x5bf292);const _0xcc7d4d=getConfigFilePath(_0x5bf292);cleanupLegacyEnvFile(_0xcc7d4d)&&console['warn'](a45_0x2e3f95[_0xc7ad3(0x1cc)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x1dfceb=a45_0x4065,_0x17cf43={'apiKeys':{},'defaultSite':'us01'},_0x1e039d=[_0x1dfceb(0x1f4),_0x1dfceb(0x1f9),_0x1dfceb(0x1ff),_0x1dfceb(0x209),_0x1dfceb(0x1f2),_0x1dfceb(0x1c9),'dev-eu01',_0x1dfceb(0x1e8),_0x1dfceb(0x206),'stg-ap03'];for(const _0x4cb5e4 of _0x1e039d){const _0x390c13=getAPIKey(_0x4cb5e4);_0x390c13&&(_0x17cf43[_0x1dfceb(0x1f0)][_0x4cb5e4]=_0x390c13);}return _0x17cf43;}
1
+ (function(_0x27f967,_0x4f9e59){const _0x3ad590=a45_0x47cf,_0x613357=_0x27f967();while(!![]){try{const _0x163338=parseInt(_0x3ad590(0x107))/0x1*(parseInt(_0x3ad590(0xf5))/0x2)+parseInt(_0x3ad590(0xff))/0x3+parseInt(_0x3ad590(0xe6))/0x4+-parseInt(_0x3ad590(0xe4))/0x5*(-parseInt(_0x3ad590(0x104))/0x6)+-parseInt(_0x3ad590(0x108))/0x7+parseInt(_0x3ad590(0x10a))/0x8*(parseInt(_0x3ad590(0x116))/0x9)+-parseInt(_0x3ad590(0xe2))/0xa;if(_0x163338===_0x4f9e59)break;else _0x613357['push'](_0x613357['shift']());}catch(_0xbf11e0){_0x613357['push'](_0x613357['shift']());}}}(a45_0x3a09,0x6aad4));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x56b08d from'node:fs';import*as a45_0x3fd874 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';function a45_0x47cf(_0x2b3a14,_0x37f04a){_0x2b3a14=_0x2b3a14-0xcf;const _0x3a0949=a45_0x3a09();let _0x47cfe4=_0x3a0949[_0x2b3a14];return _0x47cfe4;}import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x591380 from'chalk';export function getConfigDir(){const _0x5aea83=a45_0x47cf;return process['env'][_0x5aea83(0xef)]||join(homedir(),'.config',_0x5aea83(0xe5));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x2cf9c8){const _0x51ef55=a45_0x47cf,_0x137c84=getConfigDir();return _0x2cf9c8?a45_0x3fd874[_0x51ef55(0x103)](_0x137c84,_0x51ef55(0xde)+_0x2cf9c8):getConfigFile();}export function getCacheDir(){const _0x3f2a88=a45_0x47cf;return process[_0x3f2a88(0xd4)][_0x3f2a88(0xd5)]||join(homedir(),_0x3f2a88(0x115),_0x3f2a88(0xe5));}export function getLLMProjectCacheFile(_0x28cd09){const _0x51141f=a45_0x47cf,_0x269304=_0x28cd09?_0x51141f(0xf8)+_0x28cd09:_0x51141f(0x101);return join(getCacheDir(),_0x269304);}export function readCachedLLMProject(_0x3c19a1){const _0x52bec1=a45_0x47cf;try{const _0x416029=getLLMProjectCacheFile(_0x3c19a1);if(!existsSync(_0x416029))return null;const _0x4f5bb5=readFileSync(_0x416029,_0x52bec1(0xe1))[_0x52bec1(0xf2)]();try{const _0x3099f4=JSON[_0x52bec1(0x110)](_0x4f5bb5);if(_0x3099f4&&typeof _0x3099f4['id']===_0x52bec1(0xdb)&&typeof _0x3099f4['name']==='string')return _0x3099f4;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x576973,_0x124918,_0x4c90f7){const _0x24ae7a=a45_0x47cf;try{const _0x4c8546=getCacheDir(),_0x5a3f6e=getLLMProjectCacheFile(_0x4c90f7);!existsSync(_0x4c8546)&&mkdirSync(_0x4c8546,{'recursive':!![]});const _0x447a2e={'name':_0x576973,'id':_0x124918};writeFileSync(_0x5a3f6e,JSON[_0x24ae7a(0xfa)](_0x447a2e),_0x24ae7a(0xe1));}catch{}}export function getAccountInfoCacheFile(_0x2fb98f){const _0x3d9520=a45_0x47cf,_0x28d012=_0x2fb98f?_0x3d9520(0x11a)+_0x2fb98f+'.json':_0x3d9520(0xee);return join(getCacheDir(),_0x28d012);}function a45_0x3a09(){const _0x229210=['1604283OgHMUy','legacy\x20.env\x20file','llm_default_project','TDX_API_KEY_<PROFILE>','join','4842rqYdMg','TD_API_KEY_','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','3bJomLQ','160097WHWzwl','Warning:\x20Failed\x20to\x20read\x20','352MlYogX','existsSync','ap02','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','endsWith','startsWith','parse','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','TD_API_KEY','TDX_API_KEY\x20env\x20var','us01','.cache','4689AWtkus','apiKey','map','legacy\x20.env\x20file\x20(profile:\x20','account_info.','tdx.json','Warning:\x20Unknown\x20site\x20\x27','profile','TDX_API_KEY_','filter','ap03','accountId','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','number','env','TDX_CACHE_DIR','keychain','TD_API_KEY\x20env\x20var\x20(deprecated)','stg-us01','isDeprecated','eu01','string','yellow','jp01','.env.','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','site','utf-8','15371390QOlkoq','warn','2375PpmPGd','tdx','3239540dwJDBr','includes','replace','apiKeys','dev-eu01','Warning:\x20Failed\x20to\x20load\x20','entries','\x27,\x20defaulting\x20to\x20us01','account_info.json','TDX_CONFIG_DIR','stg-jp01','match','trim','dev-us01','keychain\x20(profile:\x20','164042ErVnrj','toUpperCase','split','llm_default_project.','profiles','stringify','stg-ap03','some','readFileSync','TDX_API_KEY'];a45_0x3a09=function(){return _0x229210;};return a45_0x3a09();}export function readCachedAccountInfo(_0x3b2b67){const _0x5a1123=a45_0x47cf;try{const _0x4639d6=getAccountInfoCacheFile(_0x3b2b67);if(!existsSync(_0x4639d6))return null;const _0x86b06b=readFileSync(_0x4639d6,_0x5a1123(0xe1))['trim'](),_0x54654b=JSON[_0x5a1123(0x110)](_0x86b06b);if(_0x54654b&&typeof _0x54654b[_0x5a1123(0xe0)]===_0x5a1123(0xdb)&&typeof _0x54654b[_0x5a1123(0xd1)]===_0x5a1123(0xd3))return _0x54654b;return null;}catch{return null;}}export function writeCachedAccountInfo(_0xdd9045,_0x5ba707,_0x11ea35){const _0x220415=a45_0x47cf;try{const _0x2617f6=getCacheDir(),_0x85dfd4=getAccountInfoCacheFile(_0x11ea35);!existsSync(_0x2617f6)&&mkdirSync(_0x2617f6,{'recursive':!![]});const _0x12b5bd={'site':_0xdd9045,'accountId':_0x5ba707,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x85dfd4,JSON[_0x220415(0xfa)](_0x12b5bd),_0x220415(0xe1));}catch{}}export function parseEnvFile(_0x391db5){const _0x3ebbd2=a45_0x47cf,_0x461f44={};for(const _0x29116a of _0x391db5[_0x3ebbd2(0xf7)]('\x0a')){const _0x3f32b6=_0x29116a[_0x3ebbd2(0xf2)]();if(!_0x3f32b6||_0x3f32b6[_0x3ebbd2(0x10f)]('#'))continue;const _0x37a30d=_0x3f32b6[_0x3ebbd2(0xf1)](/^([^=]+)=(.*)$/);if(_0x37a30d){const _0x35e439=_0x37a30d[0x1][_0x3ebbd2(0xf2)]();let _0x2e4be3=_0x37a30d[0x2][_0x3ebbd2(0xf2)]();(_0x2e4be3[_0x3ebbd2(0x10f)]('\x22')&&_0x2e4be3[_0x3ebbd2(0x10e)]('\x22')||_0x2e4be3[_0x3ebbd2(0x10f)]('\x27')&&_0x2e4be3[_0x3ebbd2(0x10e)]('\x27'))&&(_0x2e4be3=_0x2e4be3['slice'](0x1,-0x1)),_0x461f44[_0x35e439]=_0x2e4be3;}}return _0x461f44;}export function readUserConfig(){const _0x29121b=a45_0x47cf,_0x2d3361=getConfigFile();if(!existsSync(_0x2d3361))return{};try{const _0x445674=readFileSync(_0x2d3361,_0x29121b(0xe1));return parseEnvFile(_0x445674);}catch(_0x34e835){return console[_0x29121b(0xe3)](_0x29121b(0x106)+_0x2d3361+':',_0x34e835),{};}}export function resolveSite(_0x1eac43){const _0x512a22=a45_0x47cf,_0x3c8a5b=[_0x512a22(0x114),_0x512a22(0xdd),_0x512a22(0xda),_0x512a22(0x10c),_0x512a22(0xd0),'dev-us01','dev-eu01',_0x512a22(0xd8),'stg-jp01','stg-ap03'];if(_0x3c8a5b[_0x512a22(0xe7)](_0x1eac43))return _0x1eac43;if(_0x1eac43 in SITE_ALIASES)return SITE_ALIASES[_0x1eac43];return console[_0x512a22(0xe3)](_0x512a22(0x11c)+_0x1eac43+_0x512a22(0xed)),_0x512a22(0x114);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x352392,_0x5cc20d){const _0x45295d=a45_0x47cf,_0x3b273c=_0x5cc20d||getActiveProfileName();if(_0x3b273c){const _0x27d598=_0x45295d(0x11e)+normalizeProfileForEnvVar(_0x3b273c);if(process[_0x45295d(0xd4)][_0x27d598])return process[_0x45295d(0xd4)][_0x27d598];}if(process[_0x45295d(0xd4)]['TDX_API_KEY'])return process[_0x45295d(0xd4)][_0x45295d(0xfe)];if(process[_0x45295d(0xd4)]['TD_API_KEY'])return process[_0x45295d(0xd4)][_0x45295d(0x112)];const _0x283121=_0x352392[_0x45295d(0xf6)]()[_0x45295d(0xe8)](/-/g,'_'),_0x27a486=_0x45295d(0x105)+_0x283121;if(_0x3b273c){const _0x3c9619=loadProfileEnv(_0x3b273c);if(_0x3c9619){if(_0x3c9619[_0x27a486])return _0x3c9619[_0x27a486];if(_0x3c9619[_0x45295d(0x112)])return _0x3c9619['TD_API_KEY'];}}const _0x3499f5=loadUserConfigOnce();if(_0x3499f5[_0x27a486])return _0x3499f5[_0x27a486];if(_0x3499f5[_0x45295d(0x112)])return _0x3499f5[_0x45295d(0x112)];return undefined;}export function normalizeProfileForEnvVar(_0x49238d){const _0x2621a0=a45_0x47cf;return _0x49238d[_0x2621a0(0xf6)]()[_0x2621a0(0xe8)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x5a4208,_0x2017d0){const _0x4c9d4d=a45_0x47cf,_0x1f1cce=_0x2017d0||getActiveProfileName()||undefined;if(_0x1f1cce){const _0x445c26='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x1f1cce);if(process[_0x4c9d4d(0xd4)][_0x445c26])return{'apiKey':process['env'][_0x445c26],'source':_0x445c26+'\x20env\x20var','isDeprecated':![]};const _0x16813b=getCachedCredential(_0x5a4208,_0x1f1cce);if(_0x16813b)return{'apiKey':_0x16813b,'source':_0x4c9d4d(0xf4)+_0x1f1cce+')','isDeprecated':![]};const _0x2769f8=await getKeychainAPIKey(_0x1f1cce);if(_0x2769f8)return setCachedCredential(_0x2769f8,_0x5a4208,_0x1f1cce),{'apiKey':_0x2769f8,'source':_0x4c9d4d(0xf4)+_0x1f1cce+')','isDeprecated':![]};}if(process[_0x4c9d4d(0xd4)][_0x4c9d4d(0xfe)])return{'apiKey':process[_0x4c9d4d(0xd4)][_0x4c9d4d(0xfe)],'source':_0x4c9d4d(0x113),'isDeprecated':![]};if(!_0x1f1cce){const _0x251ecf=getCachedCredential(_0x5a4208,undefined);if(_0x251ecf)return{'apiKey':_0x251ecf,'source':_0x4c9d4d(0xd6),'isDeprecated':![]};const _0x1affba=await getKeychainAPIKey(undefined);if(_0x1affba)return setCachedCredential(_0x1affba,_0x5a4208,undefined),{'apiKey':_0x1affba,'source':'keychain','isDeprecated':![]};}if(process['env'][_0x4c9d4d(0x112)])return{'apiKey':process[_0x4c9d4d(0xd4)][_0x4c9d4d(0x112)],'source':_0x4c9d4d(0xd7),'isDeprecated':!![]};const _0x26896f=getLegacyEnvAPIKey(_0x5a4208,_0x1f1cce);if(_0x26896f){const _0x8f7ac3=await isKeychainAvailable();if(_0x8f7ac3)try{await saveKeychainAPIKey(_0x26896f,_0x1f1cce),setCachedCredential(_0x26896f,_0x5a4208,_0x1f1cce);const _0x483544=getConfigFilePath(_0x1f1cce);cleanupLegacyEnvFile(_0x483544)&&console[_0x4c9d4d(0xe3)](a45_0x591380['yellow']('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x315711){console[_0x4c9d4d(0xe3)](a45_0x591380[_0x4c9d4d(0xdc)](_0x4c9d4d(0xd2)+_0x315711));}const _0x40c99b=_0x1f1cce?_0x4c9d4d(0x119)+_0x1f1cce+')':_0x4c9d4d(0x100);return{'apiKey':_0x26896f,'source':_0x40c99b,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x320cf0,_0x13e77c,_0x523d4a=!![]){const _0x49316d=a45_0x47cf,_0x58321e=await resolveAPIKeyAsync(_0x320cf0,_0x13e77c);if(!_0x58321e)return undefined;if(_0x523d4a&&_0x58321e[_0x49316d(0xd9)]&&_0x58321e['source']['includes'](_0x49316d(0x112))){const _0x272a3d=_0x13e77c||getActiveProfileName()||undefined,_0x59eaa8=_0x272a3d?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x272a3d):_0x49316d(0x102);console[_0x49316d(0xe3)](a45_0x591380['yellow'](_0x49316d(0xdf)+(_0x49316d(0x111)+_0x59eaa8+').')));}return _0x58321e[_0x49316d(0x117)];}function getLegacyEnvAPIKey(_0x193eae,_0x34722b){const _0x1f722e=a45_0x47cf,_0x4647e7=_0x193eae['toUpperCase']()[_0x1f722e(0xe8)](/-/g,'_'),_0x170751=_0x1f722e(0x105)+_0x4647e7;if(_0x34722b){const _0x591803=loadProfileEnv(_0x34722b);if(_0x591803){if(_0x591803[_0x170751])return _0x591803[_0x170751];if(_0x591803[_0x1f722e(0x112)])return _0x591803[_0x1f722e(0x112)];}}const _0x668721=loadUserConfigOnce();if(_0x668721[_0x170751])return _0x668721[_0x170751];if(_0x668721[_0x1f722e(0x112)])return _0x668721[_0x1f722e(0x112)];return undefined;}function cleanupLegacyEnvFile(_0x2327c9){const _0x2a4ac0=a45_0x47cf;if(!existsSync(_0x2327c9))return![];try{const _0x4d5d13=readFileSync(_0x2327c9,'utf-8'),_0xf57520=_0x4d5d13[_0x2a4ac0(0xf7)]('\x0a'),_0x5997e0=_0xf57520[_0x2a4ac0(0xcf)](_0x1ffa33=>{const _0x130654=_0x2a4ac0,_0x319783=_0x1ffa33['trim']();if(!_0x319783||_0x319783[_0x130654(0x10f)]('#'))return!![];const [_0x272d61]=_0x319783[_0x130654(0xf7)]('=');return!_0x272d61[_0x130654(0x10f)]('TD_API_KEY');}),_0x5b02bb=_0x5997e0[_0x2a4ac0(0xfc)](_0x3e934c=>{const _0x5ea686=_0x2a4ac0,_0x2f7820=_0x3e934c['trim']();return _0x2f7820&&!_0x2f7820[_0x5ea686(0x10f)]('#');});if(!_0x5b02bb)return unlinkSync(_0x2327c9),!![];return writeFileSync(_0x2327c9,_0x5997e0[_0x2a4ac0(0x103)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x4f4ac7){const _0x452a83=a45_0x47cf,_0x52c1c8=a45_0x3fd874[_0x452a83(0x103)](getConfigDir(),_0x452a83(0xde)+_0x4f4ac7);if(a45_0x56b08d[_0x452a83(0x10b)](_0x52c1c8)){validateSecureFilePermissions(_0x52c1c8);try{const _0x112424=a45_0x56b08d[_0x452a83(0xfd)](_0x52c1c8,_0x452a83(0xe1));return parseEnvFile(_0x112424);}catch(_0x2b8fc3){console['warn'](_0x452a83(0xeb)+_0x52c1c8+':\x20'+_0x2b8fc3);}}const _0x20f085=a45_0x3fd874[_0x452a83(0x103)](getConfigDir(),_0x452a83(0xf9),_0x4f4ac7,'.env');if(a45_0x56b08d['existsSync'](_0x20f085)){validateSecureFilePermissions(_0x20f085);try{const _0x3746b5=a45_0x56b08d[_0x452a83(0xfd)](_0x20f085,_0x452a83(0xe1));return parseEnvFile(_0x3746b5);}catch(_0x54c4de){return console[_0x452a83(0xe3)]('Warning:\x20Failed\x20to\x20load\x20'+_0x20f085+':\x20'+_0x54c4de),null;}}return null;}function getActiveProfileName(){const _0x2b3932=a45_0x47cf,_0x187efd=a45_0x3fd874[_0x2b3932(0x103)](getConfigDir(),_0x2b3932(0x11b));if(!a45_0x56b08d[_0x2b3932(0x10b)](_0x187efd))return null;try{const _0x4be4bf=a45_0x56b08d[_0x2b3932(0xfd)](_0x187efd,'utf-8'),_0x186ce1=JSON[_0x2b3932(0x110)](_0x4be4bf);return _0x186ce1[_0x2b3932(0x11d)]||null;}catch{return null;}}export function saveAPIKey(_0x20d049,_0x2900b7,_0x4adb6e){const _0x4b9dc7=a45_0x47cf,_0x2aba39=getConfigDir(),_0x414102=getConfigFilePath(_0x4adb6e);!existsSync(_0x2aba39)&&mkdirSync(_0x2aba39,{'recursive':!![],'mode':0x1c0});let _0x589569={};if(existsSync(_0x414102))try{const _0x3f5203=readFileSync(_0x414102,'utf-8');_0x589569=parseEnvFile(_0x3f5203);}catch(_0x22ccda){console[_0x4b9dc7(0xe3)](_0x4b9dc7(0x109)+_0x414102+':',_0x22ccda);}const _0x436f9c=_0x20d049['toUpperCase']()[_0x4b9dc7(0xe8)](/-/g,'_');_0x589569[_0x4b9dc7(0x105)+_0x436f9c]=_0x2900b7;const _0x4a37b3=Object[_0x4b9dc7(0xec)](_0x589569)[_0x4b9dc7(0x118)](([_0xc2c236,_0x56b4c4])=>_0xc2c236+'='+_0x56b4c4);writeFileSync(_0x414102,_0x4a37b3[_0x4b9dc7(0x103)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0xbc0011,_0x55a4f7,_0x393313){const _0x1e4d7d=a45_0x47cf;await saveKeychainAPIKey(_0xbc0011,_0x393313),setCachedCredential(_0xbc0011,_0x55a4f7,_0x393313);const _0x43de51=getConfigFilePath(_0x393313);cleanupLegacyEnvFile(_0x43de51)&&console[_0x1e4d7d(0xe3)](a45_0x591380[_0x1e4d7d(0xdc)](_0x1e4d7d(0x10d)));}export function loadConfig(){const _0x12b71e=a45_0x47cf,_0x5d8bde={'apiKeys':{},'defaultSite':'us01'},_0x170ac4=[_0x12b71e(0x114),'jp01',_0x12b71e(0xda),'ap02',_0x12b71e(0xd0),_0x12b71e(0xf3),_0x12b71e(0xea),_0x12b71e(0xd8),_0x12b71e(0xf0),_0x12b71e(0xfb)];for(const _0x20a9c0 of _0x170ac4){const _0x350c16=getAPIKey(_0x20a9c0);_0x350c16&&(_0x5d8bde[_0x12b71e(0xe9)][_0x20a9c0]=_0x350c16);}return _0x5d8bde;}
@@ -1 +1 @@
1
- (function(_0xdd47dd,_0x59bb3a){const _0x390973=a46_0x2489,_0x19271c=_0xdd47dd();while(!![]){try{const _0x54847a=-parseInt(_0x390973(0x10d))/0x1*(-parseInt(_0x390973(0x103))/0x2)+-parseInt(_0x390973(0x10e))/0x3*(-parseInt(_0x390973(0x105))/0x4)+parseInt(_0x390973(0x10c))/0x5*(-parseInt(_0x390973(0x111))/0x6)+parseInt(_0x390973(0x101))/0x7*(-parseInt(_0x390973(0xff))/0x8)+-parseInt(_0x390973(0x110))/0x9*(-parseInt(_0x390973(0x109))/0xa)+-parseInt(_0x390973(0x104))/0xb*(parseInt(_0x390973(0xfe))/0xc)+-parseInt(_0x390973(0xfd))/0xd*(-parseInt(_0x390973(0x102))/0xe);if(_0x54847a===_0x59bb3a)break;else _0x19271c['push'](_0x19271c['shift']());}catch(_0x4c29ab){_0x19271c['push'](_0x19271c['shift']());}}}(a46_0x507a,0x4a0c2));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function a46_0x507a(){const _0x5e30fc=['12jVFZux','213176MyqmpJ','connections-','119wWArkX','7629538qnPiwb','93418tpWJDb','5481509RwmJGn','172vaYVHb','now','utf-8','default','130lrhPWf','connections','.json','10dQfKlL','5WFsWFE','19161elGThr','parse','369765zzKVaX','997926uKYtvZ','13IdpmsX'];a46_0x507a=function(){return _0x5e30fc;};return a46_0x507a();}function a46_0x2489(_0x11c91f,_0x46c9fe){_0x11c91f=_0x11c91f-0xfd;const _0x507ae6=a46_0x507a();let _0x248923=_0x507ae6[_0x11c91f];return _0x248923;}function getCacheFilePath(_0x58d7e7){const _0x504c0a=a46_0x2489,_0x1267a1=_0x58d7e7||_0x504c0a(0x108);return join(getCacheDir(),_0x504c0a(0x100)+_0x1267a1+_0x504c0a(0x10b));}export function loadCachedConnections(_0x288a15){const _0x4d252a=a46_0x2489,_0x114c94=getCacheFilePath(_0x288a15);if(!existsSync(_0x114c94))return null;try{const _0x185d63=readFileSync(_0x114c94,_0x4d252a(0x107)),_0x53a4ee=JSON[_0x4d252a(0x10f)](_0x185d63);return _0x53a4ee[_0x4d252a(0x10a)];}catch{return null;}}export function saveCachedConnections(_0x52fb54,_0x56e4dc){const _0x8c3b9a=a46_0x2489,_0x46a938=getCacheDir();!existsSync(_0x46a938)&&mkdirSync(_0x46a938,{'recursive':!![]});const _0x118295=getCacheFilePath(_0x52fb54),_0x462923={'connections':_0x56e4dc,'cachedAt':Date[_0x8c3b9a(0x106)]()};writeFileSync(_0x118295,JSON['stringify'](_0x462923,null,0x2),'utf-8');}export function clearConnectionCache(_0x42e445){const _0x3c11d0=getCacheFilePath(_0x42e445);if(existsSync(_0x3c11d0))try{unlinkSync(_0x3c11d0);}catch{}}
1
+ (function(_0x373be8,_0x465f46){const _0x14a156=a46_0x33ea,_0x4b73a9=_0x373be8();while(!![]){try{const _0x4b1938=-parseInt(_0x14a156(0x1f9))/0x1+-parseInt(_0x14a156(0x1ec))/0x2*(-parseInt(_0x14a156(0x1f2))/0x3)+parseInt(_0x14a156(0x1f7))/0x4*(-parseInt(_0x14a156(0x1f1))/0x5)+-parseInt(_0x14a156(0x1ee))/0x6+-parseInt(_0x14a156(0x1f6))/0x7+-parseInt(_0x14a156(0x1ed))/0x8*(-parseInt(_0x14a156(0x1fb))/0x9)+parseInt(_0x14a156(0x1f0))/0xa*(parseInt(_0x14a156(0x1fc))/0xb);if(_0x4b1938===_0x465f46)break;else _0x4b73a9['push'](_0x4b73a9['shift']());}catch(_0x491274){_0x4b73a9['push'](_0x4b73a9['shift']());}}}(a46_0x1476,0xdaed4));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x5b584c){const _0xe7e30d=a46_0x33ea,_0x310ec1=_0x5b584c||_0xe7e30d(0x1f5);return join(getCacheDir(),_0xe7e30d(0x1fa)+_0x310ec1+_0xe7e30d(0x1f4));}function a46_0x33ea(_0x12dec4,_0x3ee1f2){_0x12dec4=_0x12dec4-0x1ec;const _0x147609=a46_0x1476();let _0x33eac2=_0x147609[_0x12dec4];return _0x33eac2;}export function loadCachedConnections(_0x3f2a2e){const _0x10d588=a46_0x33ea,_0xc8e1f8=getCacheFilePath(_0x3f2a2e);if(!existsSync(_0xc8e1f8))return null;try{const _0x15206f=readFileSync(_0xc8e1f8,_0x10d588(0x1f3)),_0x4b44a8=JSON['parse'](_0x15206f);return _0x4b44a8[_0x10d588(0x1ef)];}catch{return null;}}export function saveCachedConnections(_0x28de9a,_0x338cd6){const _0x496708=a46_0x33ea,_0x181f35=getCacheDir();!existsSync(_0x181f35)&&mkdirSync(_0x181f35,{'recursive':!![]});const _0x149ff1=getCacheFilePath(_0x28de9a),_0x1df2c5={'connections':_0x338cd6,'cachedAt':Date[_0x496708(0x1f8)]()};writeFileSync(_0x149ff1,JSON['stringify'](_0x1df2c5,null,0x2),'utf-8');}function a46_0x1476(){const _0x5c1d8b=['10526572TIxgox','24BjIqow','now','678195XODVqv','connections-','1017cKMhuJ','11wdeBNf','252078uYTqJF','1752GGIvSS','4670466DntCyP','connections','39522380IvGCHl','1255240ULLuQL','33ohjecu','utf-8','.json','default'];a46_0x1476=function(){return _0x5c1d8b;};return a46_0x1476();}export function clearConnectionCache(_0x3b6bdd){const _0x10cb40=getCacheFilePath(_0x3b6bdd);if(existsSync(_0x10cb40))try{unlinkSync(_0x10cb40);}catch{}}
@@ -1 +1 @@
1
- (function(_0x58d48a,_0xdf5120){const _0xa4d767=a47_0x5793,_0x212eb3=_0x58d48a();while(!![]){try{const _0x34dd0c=-parseInt(_0xa4d767(0x141))/0x1*(parseInt(_0xa4d767(0x13d))/0x2)+parseInt(_0xa4d767(0x13e))/0x3+-parseInt(_0xa4d767(0x138))/0x4*(parseInt(_0xa4d767(0x135))/0x5)+parseInt(_0xa4d767(0x132))/0x6*(-parseInt(_0xa4d767(0x144))/0x7)+parseInt(_0xa4d767(0x13f))/0x8+parseInt(_0xa4d767(0x137))/0x9+parseInt(_0xa4d767(0x143))/0xa*(parseInt(_0xa4d767(0x13b))/0xb);if(_0x34dd0c===_0xdf5120)break;else _0x212eb3['push'](_0x212eb3['shift']());}catch(_0x167e59){_0x212eb3['push'](_0x212eb3['shift']());}}}(a47_0x2a7d,0xdcd61));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3c38ca,_0x585796){const _0x2aa1da=a47_0x5793,_0xabbe6=_0x3c38ca||_0x2aa1da(0x139),_0x174446=_0x585796||_0x2aa1da(0x131);return _0xabbe6+':'+_0x174446;}function a47_0x2a7d(){const _0x41aaee=['delete','256986myTzuU','set','10nEIanA','160195ecyxpD','__default_profile__','204tFWGyk','apiKey','now','165XiEHuL','clear','16068276mQhAQT','118212tOWEQD','__default_site__','get','671473rmCoSS','loadedAt','10gRVTVa','2867628BSBRmX','9124248suRasR'];a47_0x2a7d=function(){return _0x41aaee;};return a47_0x2a7d();}function a47_0x5793(_0x233024,_0x2f5ee2){_0x233024=_0x233024-0x131;const _0x2a7db0=a47_0x2a7d();let _0x57936f=_0x2a7db0[_0x233024];return _0x57936f;}export function getCachedCredential(_0x2ef48d,_0x4d8ea8){const _0x2d15df=a47_0x5793,_0xeb61e2=getCacheKey(_0x2ef48d,_0x4d8ea8),_0x1546e6=cache[_0x2d15df(0x13a)](_0xeb61e2);if(!_0x1546e6)return null;if(Date['now']()-_0x1546e6[_0x2d15df(0x13c)]>CACHE_TTL_MS)return cache[_0x2d15df(0x140)](_0xeb61e2),null;return _0x1546e6[_0x2d15df(0x133)];}export function setCachedCredential(_0x4a429e,_0x36f435,_0x30fe69){const _0x4c7fc6=a47_0x5793,_0x5ffa17=getCacheKey(_0x36f435,_0x30fe69);cache[_0x4c7fc6(0x142)](_0x5ffa17,{'apiKey':_0x4a429e,'loadedAt':Date[_0x4c7fc6(0x134)]()});}export function clearCredentialCache(){const _0x4c0128=a47_0x5793;cache[_0x4c0128(0x136)]();}export function clearCachedCredential(_0xa35f71,_0xccf6c){const _0x4798d8=a47_0x5793,_0x5bd2b5=getCacheKey(_0xa35f71,_0xccf6c);cache[_0x4798d8(0x140)](_0x5bd2b5);}
1
+ (function(_0x455cba,_0x24fb65){const _0x4d431c=a47_0x1649,_0x3b22ba=_0x455cba();while(!![]){try{const _0x25535c=-parseInt(_0x4d431c(0x149))/0x1+parseInt(_0x4d431c(0x14a))/0x2*(parseInt(_0x4d431c(0x152))/0x3)+parseInt(_0x4d431c(0x151))/0x4*(parseInt(_0x4d431c(0x158))/0x5)+-parseInt(_0x4d431c(0x14d))/0x6+parseInt(_0x4d431c(0x14e))/0x7+-parseInt(_0x4d431c(0x147))/0x8+parseInt(_0x4d431c(0x153))/0x9*(parseInt(_0x4d431c(0x148))/0xa);if(_0x25535c===_0x24fb65)break;else _0x3b22ba['push'](_0x3b22ba['shift']());}catch(_0x6bde90){_0x3b22ba['push'](_0x3b22ba['shift']());}}}(a47_0xb7b3,0x69dad));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x2b1503,_0x38f530){const _0x289b13=a47_0x1649,_0x59e5f4=_0x2b1503||_0x289b13(0x159),_0x20b742=_0x38f530||_0x289b13(0x14b);return _0x59e5f4+':'+_0x20b742;}export function getCachedCredential(_0x498118,_0x3cd143){const _0x1badbf=a47_0x1649,_0x191aaa=getCacheKey(_0x498118,_0x3cd143),_0x2b58f9=cache[_0x1badbf(0x14c)](_0x191aaa);if(!_0x2b58f9)return null;if(Date[_0x1badbf(0x156)]()-_0x2b58f9[_0x1badbf(0x154)]>CACHE_TTL_MS)return cache[_0x1badbf(0x14f)](_0x191aaa),null;return _0x2b58f9[_0x1badbf(0x157)];}export function setCachedCredential(_0x4afc37,_0x3367df,_0x589e07){const _0x11c001=a47_0x1649,_0x4f8166=getCacheKey(_0x3367df,_0x589e07);cache[_0x11c001(0x150)](_0x4f8166,{'apiKey':_0x4afc37,'loadedAt':Date[_0x11c001(0x156)]()});}function a47_0x1649(_0x28454f,_0x1ff2d2){_0x28454f=_0x28454f-0x147;const _0xb7b3c3=a47_0xb7b3();let _0x164990=_0xb7b3c3[_0x28454f];return _0x164990;}export function clearCredentialCache(){const _0x52f438=a47_0x1649;cache[_0x52f438(0x155)]();}function a47_0xb7b3(){const _0x26b70e=['4557054OFfVsy','1826881ukzeUk','delete','set','263244iMaIJk','183soThSN','7074rmMqfQ','loadedAt','clear','now','apiKey','45qtHKIp','__default_site__','5021096lPqSwH','17240NGufwQ','433857ZtACju','1516VALgiK','__default_profile__','get'];a47_0xb7b3=function(){return _0x26b70e;};return a47_0xb7b3();}export function clearCachedCredential(_0x20c501,_0x501dd5){const _0x39f314=a47_0x1649,_0x4baf82=getCacheKey(_0x20c501,_0x501dd5);cache[_0x39f314(0x14f)](_0x4baf82);}
@@ -1 +1 @@
1
- const a48_0x4e1c52=a48_0x2250;(function(_0x1bea2a,_0x104ac4){const _0x10b940=a48_0x2250,_0x2c3ae0=_0x1bea2a();while(!![]){try{const _0x16881e=parseInt(_0x10b940(0x137))/0x1*(parseInt(_0x10b940(0x142))/0x2)+parseInt(_0x10b940(0x103))/0x3*(-parseInt(_0x10b940(0x102))/0x4)+parseInt(_0x10b940(0x11d))/0x5+parseInt(_0x10b940(0x104))/0x6+-parseInt(_0x10b940(0x145))/0x7*(-parseInt(_0x10b940(0x13e))/0x8)+-parseInt(_0x10b940(0x139))/0x9+parseInt(_0x10b940(0x129))/0xa;if(_0x16881e===_0x104ac4)break;else _0x2c3ae0['push'](_0x2c3ae0['shift']());}catch(_0xeacb2c){_0x2c3ae0['push'](_0x2c3ae0['shift']());}}}(a48_0x5f3a,0x28fd6));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';function a48_0x5f3a(){const _0x2cce9=['getParameters','133776iNimwM','existsSync','Global','not\x20set','367018MgVvuQ','INFO','Session','7xIOpeh','globalCredentials','1868YBuxiz','642LaozYE','510084vyTbnW','entries','displayWithSources','readFileSync','Profile','profile:\x20','createAsync','loadGlobalConfig','CLI\x20flag:\x20--','default','.env','toString','utf-8','sessionId','injectIntoOptions',':\x20none','display','logLevel','(active)','[context]','parent_segment','replace','verbose','project','llm_project','198230vcHeTE','string',':\x20none\x20(using\x20session:\x20','parentSegment','layers','database','parse','tdx.json','Global\x20Credentials','us01','resolveAPIKeyAsync','profileCredentials','890320wGawUA','session','config','log','cliFlags','llmProject','activeProfile','site','apiKey','profile','join','profiles','segment_path','getSource','1pYDOtC','Project','1314819rNsgSt','segmentPath','global','configFiles'];a48_0x5f3a=function(){return _0x2cce9;};return a48_0x5f3a();}import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x180f8f from'node:fs';function a48_0x2250(_0x1356bb,_0x428160){_0x1356bb=_0x1356bb-0x101;const _0x5f3a7c=a48_0x5f3a();let _0x2250a0=_0x5f3a7c[_0x1356bb];return _0x2250a0;}import*as a48_0x419250 from'node:path';export class GlobalContext{[a48_0x4e1c52(0x130)];[a48_0x4e1c52(0x122)];['parent_segment'];[a48_0x4e1c52(0x135)];[a48_0x4e1c52(0x11c)];[a48_0x4e1c52(0x131)];[a48_0x4e1c52(0x11a)];['logLevel'];[a48_0x4e1c52(0x132)];['layers'];['activeProfile'];[a48_0x4e1c52(0x111)];[a48_0x4e1c52(0x13c)];constructor(_0x513167){const _0x2c1581=a48_0x4e1c52;this['sessionId']=_0x513167[_0x2c1581(0x12a)]||getCurrentSessionPID()[_0x2c1581(0x10f)]();const _0x429a63=loadSessionContext(_0x513167[_0x2c1581(0x12a)]),_0x5f1830=loadProjectConfig(),_0x3aee8b=this[_0x2c1581(0x10b)]();this['activeProfile']=_0x513167[_0x2c1581(0x132)]||_0x429a63?.[_0x2c1581(0x132)]||_0x3aee8b[_0x2c1581(0x132)]||getActiveProfile();const _0x46f656=this['activeProfile']?loadProfile(this[_0x2c1581(0x12f)]):null,_0xa286d2=_0x596edc=>{const _0x41c9a6=_0x2c1581;if(!_0x596edc)return{};const _0x12c268=_0x596edc,_0x29d387={};for(const [_0x1c6e00,_0x20a80e]of Object[_0x41c9a6(0x105)](_0x12c268)){typeof _0x20a80e===_0x41c9a6(0x11e)&&(_0x29d387[_0x1c6e00]=_0x20a80e);}return _0x29d387;},_0x236a5a={};if(_0x513167[_0x2c1581(0x130)]&&_0x513167[_0x2c1581(0x130)]!=='us01')_0x236a5a[_0x2c1581(0x130)]=_0x513167['site'];const _0x44214c=_0x429a63?.['database'],_0x2a70ff=_0x5f1830?.['database'],_0x4cf88e=_0x46f656?.[_0x2c1581(0x12b)]?.[_0x2c1581(0x122)],_0x288238=_0x3aee8b['database'];_0x513167['database']&&(_0x513167[_0x2c1581(0x122)]!==_0x44214c&&_0x513167[_0x2c1581(0x122)]!==_0x2a70ff&&_0x513167[_0x2c1581(0x122)]!==_0x4cf88e&&_0x513167[_0x2c1581(0x122)]!==_0x288238)&&(_0x236a5a[_0x2c1581(0x122)]=_0x513167['database']);if(_0x513167[_0x2c1581(0x120)])_0x236a5a[_0x2c1581(0x118)]=_0x513167[_0x2c1581(0x120)];if(_0x513167[_0x2c1581(0x12e)])_0x236a5a['llm_project']=_0x513167[_0x2c1581(0x12e)];if(_0x513167[_0x2c1581(0x132)])_0x236a5a['profile']=_0x513167[_0x2c1581(0x132)];this[_0x2c1581(0x121)]={'cliFlags':_0x236a5a,'session':_0xa286d2(_0x429a63),'project':_0xa286d2(_0x5f1830),'profile':_0xa286d2(_0x46f656?.[_0x2c1581(0x12b)]),'global':_0xa286d2(_0x3aee8b)};const _0x2e095c={...this[_0x2c1581(0x121)][_0x2c1581(0x13b)],...this[_0x2c1581(0x121)][_0x2c1581(0x132)],...this[_0x2c1581(0x121)][_0x2c1581(0x11b)],...this[_0x2c1581(0x121)][_0x2c1581(0x12a)],...this[_0x2c1581(0x121)][_0x2c1581(0x12d)]},_0x1a143b=_0x2e095c['site']||_0x2c1581(0x126);this[_0x2c1581(0x130)]=resolveSite(_0x1a143b),this[_0x2c1581(0x122)]=_0x2e095c[_0x2c1581(0x122)],this[_0x2c1581(0x118)]=_0x2e095c[_0x2c1581(0x118)],this[_0x2c1581(0x135)]=_0x2e095c[_0x2c1581(0x135)],this[_0x2c1581(0x11c)]=_0x2e095c[_0x2c1581(0x11c)],this[_0x2c1581(0x11a)]=_0x513167[_0x2c1581(0x11a)]||![],this['logLevel']=_0x513167[_0x2c1581(0x115)]??LogLevel[_0x2c1581(0x143)],this[_0x2c1581(0x132)]=this[_0x2c1581(0x12f)]||undefined,this[_0x2c1581(0x131)]=getAPIKey(this[_0x2c1581(0x130)],this[_0x2c1581(0x12f)]||undefined);const _0x20db72=getConfigDir(),_0x114967=a48_0x419250[_0x2c1581(0x133)](_0x20db72,'sessions',this['sessionId']+'.json'),_0x14b89d=findProjectConfigPath(),_0x1cc9d0=a48_0x419250['join'](_0x20db72,_0x2c1581(0x124)),_0x1a2930=a48_0x419250[_0x2c1581(0x133)](_0x20db72,'.env');let _0xb34791=null,_0x2d95fb=null;this[_0x2c1581(0x12f)]&&(_0xb34791=a48_0x419250[_0x2c1581(0x133)](_0x20db72,_0x2c1581(0x134),this['activeProfile'],_0x2c1581(0x124)),_0x2d95fb=a48_0x419250[_0x2c1581(0x133)](_0x20db72,_0x2c1581(0x134),this[_0x2c1581(0x12f)],_0x2c1581(0x10e))),this['configFiles']={'session':a48_0x180f8f[_0x2c1581(0x13f)](_0x114967)?_0x114967:null,'project':_0x14b89d,'profile':_0xb34791&&a48_0x180f8f[_0x2c1581(0x13f)](_0xb34791)?_0xb34791:null,'profileCredentials':_0x2d95fb&&a48_0x180f8f[_0x2c1581(0x13f)](_0x2d95fb)?_0x2d95fb:null,'global':a48_0x180f8f[_0x2c1581(0x13f)](_0x1cc9d0)?_0x1cc9d0:null,'globalCredentials':a48_0x180f8f['existsSync'](_0x1a2930)?_0x1a2930:null};}[a48_0x4e1c52(0x136)](_0x47d9c6,_0x399d4a){const _0x4e4dfc=a48_0x4e1c52;if(!_0x399d4a)return _0x4e4dfc(0x141);const _0x300724=_0x399d4a;if(this[_0x4e4dfc(0x121)][_0x4e4dfc(0x12d)][_0x47d9c6]===_0x300724){if(_0x47d9c6===_0x4e4dfc(0x130)&&_0x300724==='us01'&&!this[_0x4e4dfc(0x121)]['session']['site']&&!this[_0x4e4dfc(0x121)][_0x4e4dfc(0x11b)]['site']&&!this['layers'][_0x4e4dfc(0x132)][_0x4e4dfc(0x130)]&&!this[_0x4e4dfc(0x121)][_0x4e4dfc(0x13b)][_0x4e4dfc(0x130)])return'default';return _0x4e4dfc(0x10c)+_0x47d9c6[_0x4e4dfc(0x119)](/_/g,'-');}if(this[_0x4e4dfc(0x121)]['session'][_0x47d9c6]===_0x300724)return _0x4e4dfc(0x12a);if(this[_0x4e4dfc(0x121)][_0x4e4dfc(0x11b)][_0x47d9c6]===_0x300724)return _0x4e4dfc(0x11b);if(this['layers'][_0x4e4dfc(0x132)][_0x47d9c6]===_0x300724)return _0x4e4dfc(0x109)+this[_0x4e4dfc(0x12f)];if(this[_0x4e4dfc(0x121)]['global'][_0x47d9c6]===_0x300724)return'global';return _0x4e4dfc(0x10d);}[a48_0x4e1c52(0x10b)](){const _0x36195b=a48_0x4e1c52,_0x4d41e6=a48_0x419250[_0x36195b(0x133)](getConfigDir(),_0x36195b(0x124));if(!a48_0x180f8f[_0x36195b(0x13f)](_0x4d41e6))return{};try{const _0x592ed6=a48_0x180f8f[_0x36195b(0x107)](_0x4d41e6,_0x36195b(0x110));return JSON[_0x36195b(0x123)](_0x592ed6);}catch{return{};}}[a48_0x4e1c52(0x112)](_0x38f0f3){const _0x352ed5=a48_0x4e1c52;_0x38f0f3[_0x352ed5(0x130)]=this['site'],!_0x38f0f3[_0x352ed5(0x122)]&&this['database']&&(_0x38f0f3[_0x352ed5(0x122)]=this[_0x352ed5(0x122)]),!_0x38f0f3[_0x352ed5(0x120)]&&this[_0x352ed5(0x118)]&&(_0x38f0f3[_0x352ed5(0x120)]=this[_0x352ed5(0x118)]),!_0x38f0f3[_0x352ed5(0x13a)]&&this[_0x352ed5(0x135)]&&(_0x38f0f3[_0x352ed5(0x13a)]=this[_0x352ed5(0x135)]),!_0x38f0f3[_0x352ed5(0x12e)]&&this[_0x352ed5(0x11c)]&&(_0x38f0f3[_0x352ed5(0x12e)]=this[_0x352ed5(0x11c)]);}['getParameters'](){const _0xe33e69=a48_0x4e1c52;return[{'key':_0xe33e69(0x130),'value':this['site']},{'key':_0xe33e69(0x122),'value':this['database']},{'key':_0xe33e69(0x118),'value':this[_0xe33e69(0x118)]},{'key':_0xe33e69(0x135),'value':this[_0xe33e69(0x135)]},{'key':_0xe33e69(0x11c),'value':this[_0xe33e69(0x11c)]},{'key':_0xe33e69(0x132),'value':this['activeProfile']||undefined}];}[a48_0x4e1c52(0x114)](){const _0x55e8c3=a48_0x4e1c52;console[_0x55e8c3(0x12c)](_0x55e8c3(0x117));for(const {key:_0x5cc25f,value:_0xfb408d}of this[_0x55e8c3(0x13d)]()){_0xfb408d&&console[_0x55e8c3(0x12c)](_0x5cc25f+':\x20'+_0xfb408d);}}[a48_0x4e1c52(0x106)](){const _0x5e5695=a48_0x4e1c52;console[_0x5e5695(0x12c)](_0x5e5695(0x117));for(const {key:_0x410496,value:_0x33f5e4}of this['getParameters']()){if(_0x33f5e4){const _0x42f9d1=_0x410496===_0x5e5695(0x132)?_0x5e5695(0x116):'('+this['getSource'](_0x410496,_0x33f5e4)+')';console[_0x5e5695(0x12c)](_0x410496+':\x20'+_0x33f5e4+'\x20'+_0x42f9d1);}}console[_0x5e5695(0x12c)]('\x0a[configuration\x20files]');const _0x5cd345=[{'label':_0x5e5695(0x144),'path':this[_0x5e5695(0x13c)]['session'],'extra':'(session:\x20'+this[_0x5e5695(0x111)]+')'},{'label':_0x5e5695(0x138),'path':this[_0x5e5695(0x13c)][_0x5e5695(0x11b)]},{'label':_0x5e5695(0x108),'path':this[_0x5e5695(0x13c)][_0x5e5695(0x132)]},{'label':'Profile\x20Credentials','path':this[_0x5e5695(0x13c)][_0x5e5695(0x128)]},{'label':'Global','path':this['configFiles']['global']},{'label':_0x5e5695(0x125),'path':this[_0x5e5695(0x13c)][_0x5e5695(0x101)]}];for(const {label:_0xdbc869,path:_0x2f7099,extra:_0x36e4c}of _0x5cd345){if(_0x2f7099)console[_0x5e5695(0x12c)](_0xdbc869+':\x20'+_0x2f7099+'\x20✓'+(_0x36e4c?'\x20'+_0x36e4c:''));else{if(_0xdbc869===_0x5e5695(0x144))console[_0x5e5695(0x12c)](_0xdbc869+_0x5e5695(0x11f)+this[_0x5e5695(0x111)]+')');else(_0xdbc869===_0x5e5695(0x138)||_0xdbc869===_0x5e5695(0x140))&&console[_0x5e5695(0x12c)](_0xdbc869+_0x5e5695(0x113));}}}async[a48_0x4e1c52(0x127)](){const _0x54b8fa=a48_0x4e1c52;return this[_0x54b8fa(0x131)]=await getAPIKeyAsync(this[_0x54b8fa(0x130)],this[_0x54b8fa(0x12f)]||undefined),this['apiKey'];}static async[a48_0x4e1c52(0x10a)](_0x3aad11){const _0x3bf164=a48_0x4e1c52,_0x554780=new GlobalContext(_0x3aad11);return await _0x554780[_0x3bf164(0x127)](),_0x554780;}}
1
+ const a48_0xb1f8fb=a48_0x1878;(function(_0x22ac4e,_0x4f397d){const _0x256411=a48_0x1878,_0x2c0652=_0x22ac4e();while(!![]){try{const _0xc280c2=parseInt(_0x256411(0x17e))/0x1+-parseInt(_0x256411(0x195))/0x2*(-parseInt(_0x256411(0x1b3))/0x3)+parseInt(_0x256411(0x1aa))/0x4+parseInt(_0x256411(0x1a5))/0x5+-parseInt(_0x256411(0x1a7))/0x6*(-parseInt(_0x256411(0x1b7))/0x7)+parseInt(_0x256411(0x180))/0x8+-parseInt(_0x256411(0x1a8))/0x9;if(_0xc280c2===_0x4f397d)break;else _0x2c0652['push'](_0x2c0652['shift']());}catch(_0x128c1f){_0x2c0652['push'](_0x2c0652['shift']());}}}(a48_0x6b78,0x4e1ce));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a48_0x6b78(){const _0x2f4d44=['parent_segment','layers','entries','parentSegment','logLevel','readFileSync','getSource',':\x20none','cliFlags','global','1565780wWvNjV','config','6qFBosk','8039259XiKPvg','displayWithSources','1139828AEysbA','string','segmentPath','us01','parse','llm_project',':\x20none\x20(using\x20session:\x20','profiles','project','67215ZrMRRr','default','llmProject','not\x20set','983948HECBDg','verbose','createAsync','session','INFO','profileCredentials','join','.env','CLI\x20flag:\x20--','profile','122541ZUDKLA','tdx.json','1381944wJfAuv','resolveAPIKeyAsync','site','configFiles','(session:\x20','segment_path','Project','getParameters','Profile','(active)','Global\x20Credentials','existsSync','display','toString','activeProfile','apiKey','sessionId','replace','Global','[context]','Profile\x20Credentials','16iMqBzd','\x0a[configuration\x20files]','database','Session','log','loadGlobalConfig'];a48_0x6b78=function(){return _0x2f4d44;};return a48_0x6b78();}function a48_0x1878(_0x184571,_0x2d4bac){_0x184571=_0x184571-0x179;const _0x6b78b0=a48_0x6b78();let _0x1878a4=_0x6b78b0[_0x184571];return _0x1878a4;}import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x358e6d from'node:fs';import*as a48_0x413f9f from'node:path';export class GlobalContext{['site'];[a48_0xb1f8fb(0x197)];[a48_0xb1f8fb(0x19b)];['segment_path'];[a48_0xb1f8fb(0x1af)];[a48_0xb1f8fb(0x18f)];[a48_0xb1f8fb(0x1b8)];[a48_0xb1f8fb(0x19f)];[a48_0xb1f8fb(0x17d)];['layers'];[a48_0xb1f8fb(0x18e)];['sessionId'];[a48_0xb1f8fb(0x183)];constructor(_0x1e3d8a){const _0x4def6a=a48_0xb1f8fb;this[_0x4def6a(0x190)]=_0x1e3d8a[_0x4def6a(0x1ba)]||getCurrentSessionPID()[_0x4def6a(0x18d)]();const _0x32ec99=loadSessionContext(_0x1e3d8a['session']),_0x560426=loadProjectConfig(),_0x26c1b2=this[_0x4def6a(0x19a)]();this['activeProfile']=_0x1e3d8a[_0x4def6a(0x17d)]||_0x32ec99?.[_0x4def6a(0x17d)]||_0x26c1b2[_0x4def6a(0x17d)]||getActiveProfile();const _0x2badb3=this[_0x4def6a(0x18e)]?loadProfile(this[_0x4def6a(0x18e)]):null,_0x80e38a=_0x2aa59b=>{const _0x1bb9f4=_0x4def6a;if(!_0x2aa59b)return{};const _0x8025a1=_0x2aa59b,_0x1ddcef={};for(const [_0x56b5a2,_0x17ec5b]of Object[_0x1bb9f4(0x19d)](_0x8025a1)){typeof _0x17ec5b===_0x1bb9f4(0x1ab)&&(_0x1ddcef[_0x56b5a2]=_0x17ec5b);}return _0x1ddcef;},_0x893116={};if(_0x1e3d8a['site']&&_0x1e3d8a[_0x4def6a(0x182)]!==_0x4def6a(0x1ad))_0x893116['site']=_0x1e3d8a[_0x4def6a(0x182)];const _0x4a6a2c=_0x32ec99?.[_0x4def6a(0x197)],_0x4c3466=_0x560426?.[_0x4def6a(0x197)],_0x21ba8e=_0x2badb3?.[_0x4def6a(0x1a6)]?.[_0x4def6a(0x197)],_0x27c1e7=_0x26c1b2['database'];_0x1e3d8a[_0x4def6a(0x197)]&&(_0x1e3d8a[_0x4def6a(0x197)]!==_0x4a6a2c&&_0x1e3d8a[_0x4def6a(0x197)]!==_0x4c3466&&_0x1e3d8a[_0x4def6a(0x197)]!==_0x21ba8e&&_0x1e3d8a[_0x4def6a(0x197)]!==_0x27c1e7)&&(_0x893116[_0x4def6a(0x197)]=_0x1e3d8a[_0x4def6a(0x197)]);if(_0x1e3d8a[_0x4def6a(0x19e)])_0x893116[_0x4def6a(0x19b)]=_0x1e3d8a[_0x4def6a(0x19e)];if(_0x1e3d8a[_0x4def6a(0x1b5)])_0x893116[_0x4def6a(0x1af)]=_0x1e3d8a[_0x4def6a(0x1b5)];if(_0x1e3d8a[_0x4def6a(0x17d)])_0x893116[_0x4def6a(0x17d)]=_0x1e3d8a[_0x4def6a(0x17d)];this[_0x4def6a(0x19c)]={'cliFlags':_0x893116,'session':_0x80e38a(_0x32ec99),'project':_0x80e38a(_0x560426),'profile':_0x80e38a(_0x2badb3?.[_0x4def6a(0x1a6)]),'global':_0x80e38a(_0x26c1b2)};const _0x3a2c46={...this['layers']['global'],...this[_0x4def6a(0x19c)]['profile'],...this[_0x4def6a(0x19c)][_0x4def6a(0x1b2)],...this['layers']['session'],...this[_0x4def6a(0x19c)][_0x4def6a(0x1a3)]},_0x719aee=_0x3a2c46[_0x4def6a(0x182)]||'us01';this[_0x4def6a(0x182)]=resolveSite(_0x719aee),this[_0x4def6a(0x197)]=_0x3a2c46[_0x4def6a(0x197)],this[_0x4def6a(0x19b)]=_0x3a2c46[_0x4def6a(0x19b)],this[_0x4def6a(0x185)]=_0x3a2c46['segment_path'],this[_0x4def6a(0x1af)]=_0x3a2c46[_0x4def6a(0x1af)],this[_0x4def6a(0x1b8)]=_0x1e3d8a['verbose']||![],this['logLevel']=_0x1e3d8a['logLevel']??LogLevel[_0x4def6a(0x1bb)],this[_0x4def6a(0x17d)]=this[_0x4def6a(0x18e)]||undefined,this['apiKey']=getAPIKey(this[_0x4def6a(0x182)],this[_0x4def6a(0x18e)]||undefined);const _0x9c627b=getConfigDir(),_0x311e0f=a48_0x413f9f[_0x4def6a(0x17a)](_0x9c627b,'sessions',this[_0x4def6a(0x190)]+'.json'),_0x3029cd=findProjectConfigPath(),_0x1fa293=a48_0x413f9f[_0x4def6a(0x17a)](_0x9c627b,_0x4def6a(0x17f)),_0x38369a=a48_0x413f9f[_0x4def6a(0x17a)](_0x9c627b,_0x4def6a(0x17b));let _0x3288a4=null,_0x2cae1a=null;this[_0x4def6a(0x18e)]&&(_0x3288a4=a48_0x413f9f[_0x4def6a(0x17a)](_0x9c627b,'profiles',this[_0x4def6a(0x18e)],_0x4def6a(0x17f)),_0x2cae1a=a48_0x413f9f['join'](_0x9c627b,_0x4def6a(0x1b1),this[_0x4def6a(0x18e)],_0x4def6a(0x17b))),this[_0x4def6a(0x183)]={'session':a48_0x358e6d['existsSync'](_0x311e0f)?_0x311e0f:null,'project':_0x3029cd,'profile':_0x3288a4&&a48_0x358e6d[_0x4def6a(0x18b)](_0x3288a4)?_0x3288a4:null,'profileCredentials':_0x2cae1a&&a48_0x358e6d[_0x4def6a(0x18b)](_0x2cae1a)?_0x2cae1a:null,'global':a48_0x358e6d[_0x4def6a(0x18b)](_0x1fa293)?_0x1fa293:null,'globalCredentials':a48_0x358e6d[_0x4def6a(0x18b)](_0x38369a)?_0x38369a:null};}[a48_0xb1f8fb(0x1a1)](_0x41725b,_0x486a3c){const _0x547362=a48_0xb1f8fb;if(!_0x486a3c)return _0x547362(0x1b6);const _0x468c61=_0x486a3c;if(this[_0x547362(0x19c)][_0x547362(0x1a3)][_0x41725b]===_0x468c61){if(_0x41725b==='site'&&_0x468c61===_0x547362(0x1ad)&&!this[_0x547362(0x19c)][_0x547362(0x1ba)][_0x547362(0x182)]&&!this['layers'][_0x547362(0x1b2)]['site']&&!this['layers'][_0x547362(0x17d)][_0x547362(0x182)]&&!this[_0x547362(0x19c)][_0x547362(0x1a4)][_0x547362(0x182)])return _0x547362(0x1b4);return _0x547362(0x17c)+_0x41725b[_0x547362(0x191)](/_/g,'-');}if(this['layers'][_0x547362(0x1ba)][_0x41725b]===_0x468c61)return'session';if(this[_0x547362(0x19c)]['project'][_0x41725b]===_0x468c61)return _0x547362(0x1b2);if(this[_0x547362(0x19c)]['profile'][_0x41725b]===_0x468c61)return'profile:\x20'+this[_0x547362(0x18e)];if(this[_0x547362(0x19c)][_0x547362(0x1a4)][_0x41725b]===_0x468c61)return _0x547362(0x1a4);return _0x547362(0x1b4);}[a48_0xb1f8fb(0x19a)](){const _0x1c0e02=a48_0xb1f8fb,_0x4b0112=a48_0x413f9f[_0x1c0e02(0x17a)](getConfigDir(),_0x1c0e02(0x17f));if(!a48_0x358e6d[_0x1c0e02(0x18b)](_0x4b0112))return{};try{const _0x37a513=a48_0x358e6d[_0x1c0e02(0x1a0)](_0x4b0112,'utf-8');return JSON[_0x1c0e02(0x1ae)](_0x37a513);}catch{return{};}}['injectIntoOptions'](_0x162fa8){const _0x1fe01e=a48_0xb1f8fb;_0x162fa8[_0x1fe01e(0x182)]=this[_0x1fe01e(0x182)],!_0x162fa8[_0x1fe01e(0x197)]&&this['database']&&(_0x162fa8[_0x1fe01e(0x197)]=this[_0x1fe01e(0x197)]),!_0x162fa8[_0x1fe01e(0x19e)]&&this[_0x1fe01e(0x19b)]&&(_0x162fa8[_0x1fe01e(0x19e)]=this[_0x1fe01e(0x19b)]),!_0x162fa8[_0x1fe01e(0x1ac)]&&this[_0x1fe01e(0x185)]&&(_0x162fa8['segmentPath']=this[_0x1fe01e(0x185)]),!_0x162fa8[_0x1fe01e(0x1b5)]&&this['llm_project']&&(_0x162fa8['llmProject']=this[_0x1fe01e(0x1af)]);}['getParameters'](){const _0x4b1b3e=a48_0xb1f8fb;return[{'key':_0x4b1b3e(0x182),'value':this['site']},{'key':_0x4b1b3e(0x197),'value':this['database']},{'key':_0x4b1b3e(0x19b),'value':this[_0x4b1b3e(0x19b)]},{'key':'segment_path','value':this[_0x4b1b3e(0x185)]},{'key':'llm_project','value':this[_0x4b1b3e(0x1af)]},{'key':'profile','value':this['activeProfile']||undefined}];}[a48_0xb1f8fb(0x18c)](){const _0x58d040=a48_0xb1f8fb;console[_0x58d040(0x199)](_0x58d040(0x193));for(const {key:_0x48d05f,value:_0x1cc16e}of this[_0x58d040(0x187)]()){_0x1cc16e&&console[_0x58d040(0x199)](_0x48d05f+':\x20'+_0x1cc16e);}}[a48_0xb1f8fb(0x1a9)](){const _0x19869e=a48_0xb1f8fb;console['log'](_0x19869e(0x193));for(const {key:_0x139227,value:_0x44c3b6}of this['getParameters']()){if(_0x44c3b6){const _0x6df90c=_0x139227===_0x19869e(0x17d)?_0x19869e(0x189):'('+this['getSource'](_0x139227,_0x44c3b6)+')';console[_0x19869e(0x199)](_0x139227+':\x20'+_0x44c3b6+'\x20'+_0x6df90c);}}console['log'](_0x19869e(0x196));const _0x9e7e17=[{'label':_0x19869e(0x198),'path':this[_0x19869e(0x183)][_0x19869e(0x1ba)],'extra':_0x19869e(0x184)+this[_0x19869e(0x190)]+')'},{'label':'Project','path':this['configFiles'][_0x19869e(0x1b2)]},{'label':_0x19869e(0x188),'path':this[_0x19869e(0x183)][_0x19869e(0x17d)]},{'label':_0x19869e(0x194),'path':this[_0x19869e(0x183)][_0x19869e(0x179)]},{'label':_0x19869e(0x192),'path':this[_0x19869e(0x183)][_0x19869e(0x1a4)]},{'label':_0x19869e(0x18a),'path':this[_0x19869e(0x183)]['globalCredentials']}];for(const {label:_0x17dfef,path:_0x5dd4e9,extra:_0x5adfeb}of _0x9e7e17){if(_0x5dd4e9)console[_0x19869e(0x199)](_0x17dfef+':\x20'+_0x5dd4e9+'\x20✓'+(_0x5adfeb?'\x20'+_0x5adfeb:''));else{if(_0x17dfef===_0x19869e(0x198))console[_0x19869e(0x199)](_0x17dfef+_0x19869e(0x1b0)+this[_0x19869e(0x190)]+')');else(_0x17dfef===_0x19869e(0x186)||_0x17dfef===_0x19869e(0x192))&&console[_0x19869e(0x199)](_0x17dfef+_0x19869e(0x1a2));}}}async[a48_0xb1f8fb(0x181)](){const _0x5d2f20=a48_0xb1f8fb;return this[_0x5d2f20(0x18f)]=await getAPIKeyAsync(this['site'],this['activeProfile']||undefined),this[_0x5d2f20(0x18f)];}static async[a48_0xb1f8fb(0x1b9)](_0x321d25){const _0x321868=new GlobalContext(_0x321d25);return await _0x321868['resolveAPIKeyAsync'](),_0x321868;}}
@@ -1 +1 @@
1
- function a49_0x3b29(){const _0xe1a29d=['reason','678383GxDtmz','unavailable','Warning:\x20','keyring','-25300','getPassword','not\x20supported','306887vXmYgC','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.','restricted','System\x20keychain\x20is\x20not\x20available','1372330QDZPzH','cannot\x20find','setPassword','79860oKPGuP','not\x20found','18drhTYZ','toLowerCase','message','access_denied','includes','152JGzwNw','deletePassword','value','error','379917TiCiLK','282488NaZveu','-25293',':api_key','not_found','1880908LruHMt','__keychain_test__'];a49_0x3b29=function(){return _0xe1a29d;};return a49_0x3b29();}(function(_0x21038c,_0x24ce5b){const _0x4434d3=a49_0x128f,_0x376679=_0x21038c();while(!![]){try{const _0x35a764=parseInt(_0x4434d3(0x1a9))/0x1+-parseInt(_0x4434d3(0x1a2))/0x2+parseInt(_0x4434d3(0x1b7))/0x3+-parseInt(_0x4434d3(0x1a6))/0x4+-parseInt(_0x4434d3(0x1b4))/0x5+parseInt(_0x4434d3(0x1b9))/0x6*(-parseInt(_0x4434d3(0x1b0))/0x7)+parseInt(_0x4434d3(0x19d))/0x8*(parseInt(_0x4434d3(0x1a1))/0x9);if(_0x35a764===_0x24ce5b)break;else _0x376679['push'](_0x376679['shift']());}catch(_0x2cd9cb){_0x376679['push'](_0x376679['shift']());}}}(a49_0x3b29,0x77876));const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x2b465b=a49_0x128f;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x3984fc=await import('@zowe/secrets-for-zowe-sdk');return keyringModule=_0x3984fc[_0x2b465b(0x1ac)],keyringModule;}catch(_0x29e7ef){return keyringLoadError=_0x29e7ef instanceof Error?_0x29e7ef:new Error(String(_0x29e7ef)),null;}}function getAccountName(_0x599165){const _0x321864=a49_0x128f,_0x10b8d1=_0x599165||'';return'profile:'+_0x10b8d1+_0x321864(0x1a4);}export async function getKeychainAPIKey(_0x3518ed){const _0x2e664a=a49_0x128f,_0x5adfd5=await getKeychainAPIKeyWithStatus(_0x3518ed);if(_0x5adfd5['success'])return _0x5adfd5[_0x2e664a(0x19f)];return _0x5adfd5[_0x2e664a(0x1a8)]===_0x2e664a(0x19b)&&console[_0x2e664a(0x1a0)](_0x2e664a(0x1ab)+_0x5adfd5[_0x2e664a(0x19a)]),null;}export async function getKeychainAPIKeyWithStatus(_0x8bc7a2){const _0x527c65=a49_0x128f;try{const _0x4f15cc=await getKeyring();if(!_0x4f15cc)return{'success':![],'reason':_0x527c65(0x1aa)};const _0x12b18f=getAccountName(_0x8bc7a2),_0x27fe39=await _0x4f15cc[_0x527c65(0x1ae)](SERVICE_NAME,_0x12b18f);if(_0x27fe39)return{'success':!![],'value':_0x27fe39};return{'success':![],'reason':_0x527c65(0x1a5)};}catch(_0x1761bf){const _0x2369d7=_0x1761bf instanceof Error?_0x1761bf[_0x527c65(0x19a)]:String(_0x1761bf);if(_0x2369d7['includes'](_0x527c65(0x1ad))||_0x2369d7[_0x527c65(0x199)]()[_0x527c65(0x19c)]('could\x20not\x20be\x20found')||_0x2369d7[_0x527c65(0x199)]()[_0x527c65(0x19c)](_0x527c65(0x1b8)))return{'success':![],'reason':_0x527c65(0x1a5)};if(_0x2369d7[_0x527c65(0x19c)](_0x527c65(0x1a3))||_0x2369d7[_0x527c65(0x199)]()['includes'](_0x527c65(0x1b2))||_0x2369d7[_0x527c65(0x199)]()[_0x527c65(0x19c)]('access'))return{'success':![],'reason':_0x527c65(0x19b),'message':_0x527c65(0x1b1)};return{'success':![],'reason':_0x527c65(0x1aa),'message':_0x2369d7};}}function a49_0x128f(_0x22c758,_0xd72eb7){_0x22c758=_0x22c758-0x199;const _0x3b296b=a49_0x3b29();let _0x128f4f=_0x3b296b[_0x22c758];return _0x128f4f;}export async function saveKeychainAPIKey(_0x44a3ad,_0x6b35e0){const _0x411340=a49_0x128f,_0x178636=await getKeyring();if(!_0x178636)throw new Error(_0x411340(0x1b3));const _0x4f5e1b=getAccountName(_0x6b35e0);await _0x178636[_0x411340(0x1b6)](SERVICE_NAME,_0x4f5e1b,_0x44a3ad);}export async function deleteKeychainAPIKey(_0x2cfd1f){const _0x2a976c=a49_0x128f;try{const _0x4e1f2c=await getKeyring();if(!_0x4e1f2c)return![];const _0x23a790=getAccountName(_0x2cfd1f);return await _0x4e1f2c[_0x2a976c(0x19e)](SERVICE_NAME,_0x23a790);}catch{return![];}}export async function isKeychainAvailable(){const _0x1042ca=a49_0x128f;try{const _0x4b53c4=await getKeyring();if(!_0x4b53c4)return![];return await _0x4b53c4[_0x1042ca(0x1ae)](SERVICE_NAME,_0x1042ca(0x1a7)),!![];}catch(_0x2dd492){const _0x29a576=_0x2dd492 instanceof Error?_0x2dd492[_0x1042ca(0x19a)][_0x1042ca(0x199)]():'';if(_0x29a576[_0x1042ca(0x19c)]('not\x20available')||_0x29a576['includes'](_0x1042ca(0x1af))||_0x29a576['includes'](_0x1042ca(0x1b5)))return![];return!![];}}
1
+ function a49_0x2abb(_0x39ecf2,_0x3670ab){_0x39ecf2=_0x39ecf2-0xc4;const _0x4a36f9=a49_0x4a36();let _0x2abb4a=_0x4a36f9[_0x39ecf2];return _0x2abb4a;}const a49_0x4452e9=a49_0x2abb;(function(_0x5493fa,_0xf1cf3){const _0x485ff9=a49_0x2abb,_0x482988=_0x5493fa();while(!![]){try{const _0x63c77e=-parseInt(_0x485ff9(0xde))/0x1*(-parseInt(_0x485ff9(0xe3))/0x2)+parseInt(_0x485ff9(0xce))/0x3*(-parseInt(_0x485ff9(0xc8))/0x4)+-parseInt(_0x485ff9(0xdd))/0x5+-parseInt(_0x485ff9(0xdc))/0x6+-parseInt(_0x485ff9(0xda))/0x7*(-parseInt(_0x485ff9(0xd3))/0x8)+-parseInt(_0x485ff9(0xdb))/0x9+-parseInt(_0x485ff9(0xe5))/0xa*(-parseInt(_0x485ff9(0xcb))/0xb);if(_0x63c77e===_0xf1cf3)break;else _0x482988['push'](_0x482988['shift']());}catch(_0x1084e6){_0x482988['push'](_0x482988['shift']());}}}(a49_0x4a36,0x28130));const SERVICE_NAME=a49_0x4452e9(0xc5);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x5fe8bc=a49_0x4452e9;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x3801c2=await import(_0x5fe8bc(0xd5));return keyringModule=_0x3801c2[_0x5fe8bc(0xc7)],keyringModule;}catch(_0x7fa7cd){return keyringLoadError=_0x7fa7cd instanceof Error?_0x7fa7cd:new Error(String(_0x7fa7cd)),null;}}function a49_0x4a36(){const _0x245f7c=['access','280660daRxUu','System\x20keychain\x20is\x20not\x20available','getPassword','tdx','unavailable','keyring','28lGeMur','includes','success','88SxaxDL','access_denied','not\x20found','7041TKFTEo','deletePassword','message','cannot\x20find','-25300','1680VoFTbU',':api_key','@zowe/secrets-for-zowe-sdk','toLowerCase','__keychain_test__','not_found','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.','9289Vsqlty','1890540RaFBct','1499322nJgpgR','528860sLrnwd','243094JpjqTC','could\x20not\x20be\x20found','value','-25293','setPassword','2nsNnMc'];a49_0x4a36=function(){return _0x245f7c;};return a49_0x4a36();}function getAccountName(_0x451b0d){const _0x5c66fb=a49_0x4452e9,_0xcd63b2=_0x451b0d||'';return'profile:'+_0xcd63b2+_0x5c66fb(0xd4);}export async function getKeychainAPIKey(_0x4b574e){const _0x4874a2=a49_0x4452e9,_0x48c567=await getKeychainAPIKeyWithStatus(_0x4b574e);if(_0x48c567[_0x4874a2(0xca)])return _0x48c567[_0x4874a2(0xe0)];return _0x48c567['reason']===_0x4874a2(0xcc)&&console['error']('Warning:\x20'+_0x48c567[_0x4874a2(0xd0)]),null;}export async function getKeychainAPIKeyWithStatus(_0xcd65c){const _0x5c5211=a49_0x4452e9;try{const _0x4d8238=await getKeyring();if(!_0x4d8238)return{'success':![],'reason':_0x5c5211(0xc6)};const _0x9efdf1=getAccountName(_0xcd65c),_0x46cf6c=await _0x4d8238['getPassword'](SERVICE_NAME,_0x9efdf1);if(_0x46cf6c)return{'success':!![],'value':_0x46cf6c};return{'success':![],'reason':_0x5c5211(0xd8)};}catch(_0xb81a8b){const _0x4c242f=_0xb81a8b instanceof Error?_0xb81a8b[_0x5c5211(0xd0)]:String(_0xb81a8b);if(_0x4c242f[_0x5c5211(0xc9)](_0x5c5211(0xd2))||_0x4c242f[_0x5c5211(0xd6)]()[_0x5c5211(0xc9)](_0x5c5211(0xdf))||_0x4c242f[_0x5c5211(0xd6)]()[_0x5c5211(0xc9)](_0x5c5211(0xcd)))return{'success':![],'reason':'not_found'};if(_0x4c242f[_0x5c5211(0xc9)](_0x5c5211(0xe1))||_0x4c242f[_0x5c5211(0xd6)]()[_0x5c5211(0xc9)]('restricted')||_0x4c242f['toLowerCase']()[_0x5c5211(0xc9)](_0x5c5211(0xe4)))return{'success':![],'reason':'access_denied','message':_0x5c5211(0xd9)};return{'success':![],'reason':_0x5c5211(0xc6),'message':_0x4c242f};}}export async function saveKeychainAPIKey(_0x45ba95,_0x202255){const _0x36c239=a49_0x4452e9,_0x23b079=await getKeyring();if(!_0x23b079)throw new Error(_0x36c239(0xe6));const _0x192165=getAccountName(_0x202255);await _0x23b079[_0x36c239(0xe2)](SERVICE_NAME,_0x192165,_0x45ba95);}export async function deleteKeychainAPIKey(_0x1496db){const _0x4fe5c7=a49_0x4452e9;try{const _0x43fb3e=await getKeyring();if(!_0x43fb3e)return![];const _0x14107b=getAccountName(_0x1496db);return await _0x43fb3e[_0x4fe5c7(0xcf)](SERVICE_NAME,_0x14107b);}catch{return![];}}export async function isKeychainAvailable(){const _0x6345e0=a49_0x4452e9;try{const _0x2c93e9=await getKeyring();if(!_0x2c93e9)return![];return await _0x2c93e9[_0x6345e0(0xc4)](SERVICE_NAME,_0x6345e0(0xd7)),!![];}catch(_0x4a3986){const _0x100a75=_0x4a3986 instanceof Error?_0x4a3986['message'][_0x6345e0(0xd6)]():'';if(_0x100a75['includes']('not\x20available')||_0x100a75[_0x6345e0(0xc9)]('not\x20supported')||_0x100a75['includes'](_0x6345e0(0xd1)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0xc07364,_0x495633){const _0x1b9b15=a50_0x1bfe,_0x10465b=_0xc07364();while(!![]){try{const _0x2cb60a=parseInt(_0x1b9b15(0xe8))/0x1+-parseInt(_0x1b9b15(0x10f))/0x2+-parseInt(_0x1b9b15(0x126))/0x3*(-parseInt(_0x1b9b15(0x116))/0x4)+parseInt(_0x1b9b15(0x10a))/0x5+-parseInt(_0x1b9b15(0x10b))/0x6*(-parseInt(_0x1b9b15(0x124))/0x7)+-parseInt(_0x1b9b15(0x122))/0x8+parseInt(_0x1b9b15(0x11a))/0x9;if(_0x2cb60a===_0x495633)break;else _0x10465b['push'](_0x10465b['shift']());}catch(_0x5b8729){_0x10465b['push'](_0x10465b['shift']());}}}(a50_0xa1e2,0x3a15d));import*as a50_0x506c1f from'node:fs';import*as a50_0x527940 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';function a50_0x1bfe(_0x37f6de,_0x6169bc){_0x37f6de=_0x37f6de-0xe2;const _0xa1e2a4=a50_0xa1e2();let _0x1bfeba=_0xa1e2a4[_0x37f6de];return _0x1bfeba;}import{loadSessionContext}from'./session.js';export function getProfileParams(_0x30165a){const _0x36e8e2=a50_0x1bfe,_0x34c81d={};if(!_0x30165a)return _0x34c81d;for(const [_0x1f0768,_0x14da61]of Object['entries'](_0x30165a)){_0x1f0768!==_0x36e8e2(0x11c)&&_0x14da61!==undefined&&(_0x34c81d[_0x1f0768]=_0x14da61);}return _0x34c81d;}export function getProfilesDir(){const _0x2a0633=a50_0x1bfe;return a50_0x527940['join'](getConfigDir(),_0x2a0633(0x107));}function getProfileDir(_0xd7c997){const _0x3a1095=a50_0x1bfe;return a50_0x527940[_0x3a1095(0xf8)](getProfilesDir(),_0xd7c997);}function getProfileConfigPath(_0x43cb3f){const _0x30b60f=a50_0x1bfe;return a50_0x527940[_0x30b60f(0xf8)](getProfileDir(_0x43cb3f),_0x30b60f(0xe5));}function getProfileEnvPath(_0x1cb89d){const _0x30987d=a50_0x1bfe;return a50_0x527940[_0x30987d(0xf8)](getProfileDir(_0x1cb89d),'.env');}function getGlobalConfigPath(){const _0xc91976=a50_0x1bfe;return a50_0x527940['join'](getConfigDir(),_0xc91976(0xe5));}function validateProfileName(_0x4ac165){const _0x145562=a50_0x1bfe;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x4ac165))throw new Error(_0x145562(0x11d)+_0x4ac165+_0x145562(0x12a));}function validateProfileConfig(_0x490b91,_0x2b342d){const _0x59a9dc=a50_0x1bfe;if(typeof _0x490b91!==_0x59a9dc(0xf9)||_0x490b91===null)throw new Error('Profile\x20\x27'+_0x2b342d+_0x59a9dc(0xf6));const _0x1b76fd=['description',_0x59a9dc(0x10d),_0x59a9dc(0xfd),_0x59a9dc(0x11e),_0x59a9dc(0x112),_0x59a9dc(0x128)],_0x3621de=_0x490b91;for(const _0x455bae of Object[_0x59a9dc(0xe7)](_0x3621de)){!_0x1b76fd[_0x59a9dc(0x111)](_0x455bae)&&console[_0x59a9dc(0xe3)](_0x59a9dc(0xe6)+_0x2b342d+_0x59a9dc(0x11f)+_0x455bae+_0x59a9dc(0xfc));}if(_0x3621de[_0x59a9dc(0x11c)]!==undefined&&typeof _0x3621de['description']!==_0x59a9dc(0x125))throw new Error(_0x59a9dc(0x119)+_0x2b342d+_0x59a9dc(0xf7));if(_0x3621de[_0x59a9dc(0x10d)]!==undefined&&typeof _0x3621de['site']!==_0x59a9dc(0x125))throw new Error(_0x59a9dc(0x119)+_0x2b342d+_0x59a9dc(0xef));if(_0x3621de[_0x59a9dc(0xfd)]!==undefined&&typeof _0x3621de['database']!==_0x59a9dc(0x125))throw new Error(_0x59a9dc(0x119)+_0x2b342d+_0x59a9dc(0xfe));if(_0x3621de['parent_segment']!==undefined&&typeof _0x3621de[_0x59a9dc(0x11e)]!==_0x59a9dc(0x125))throw new Error('Profile\x20\x27'+_0x2b342d+_0x59a9dc(0xec));if(_0x3621de[_0x59a9dc(0x112)]!==undefined&&typeof _0x3621de[_0x59a9dc(0x112)]!=='string')throw new Error('Profile\x20\x27'+_0x2b342d+_0x59a9dc(0x113));if(_0x3621de[_0x59a9dc(0x128)]!==undefined&&typeof _0x3621de[_0x59a9dc(0x128)]!==_0x59a9dc(0x125))throw new Error(_0x59a9dc(0x119)+_0x2b342d+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x1dbcc7,_0x23f851){const _0x155108=a50_0x1bfe;if(!a50_0x506c1f[_0x155108(0x106)](_0x1dbcc7))return[];try{const _0xde205e=a50_0x506c1f[_0x155108(0x105)](_0x1dbcc7,_0x155108(0x104)),_0x2b75ef=JSON[_0x155108(0xe4)](_0xde205e);if(!_0x2b75ef[_0x155108(0x107)]||typeof _0x2b75ef[_0x155108(0x107)]!=='object')return[];const _0x1d5e01=[];for(const [_0x3ce7c7,_0x3aec1e]of Object['entries'](_0x2b75ef[_0x155108(0x107)])){try{validateProfileConfig(_0x3aec1e,_0x3ce7c7);const _0x519f40=getNewCredentialPath(_0x3ce7c7),_0x1d0243=getOldCredentialPath(_0x3ce7c7),_0x27071f=a50_0x506c1f['existsSync'](_0x519f40)||a50_0x506c1f[_0x155108(0x106)](_0x1d0243);_0x1d5e01[_0x155108(0x108)]({'name':_0x3ce7c7,'config':_0x3aec1e,'metadata':{'name':_0x3ce7c7,'createdAt':new Date()[_0x155108(0x103)]()},'hasCredentials':_0x27071f,'scope':_0x23f851});}catch(_0x1057c4){_0x1057c4 instanceof Error&&(console[_0x155108(0xe3)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x1dbcc7+':'),console['warn']('\x20\x20'+_0x1057c4[_0x155108(0x109)]+'\x0a'));}}return _0x1d5e01;}catch(_0x309758){return _0x309758 instanceof SyntaxError?(console[_0x155108(0xe3)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x1dbcc7+_0x155108(0x121)),console[_0x155108(0xe3)](_0x155108(0x11b)+_0x309758[_0x155108(0x109)]+'\x0a')):console[_0x155108(0xe3)](_0x155108(0x10c)+_0x1dbcc7+':\x20'+_0x309758+'\x0a'),[];}}export function getNewCredentialPath(_0xf5e9b){const _0x308edb=a50_0x1bfe;return a50_0x527940[_0x308edb(0xf8)](getConfigDir(),_0x308edb(0xf5)+_0xf5e9b);}function getOldCredentialPath(_0x74abc8){const _0x175559=a50_0x1bfe;return a50_0x527940[_0x175559(0xf8)](getProfilesDir(),_0x74abc8,_0x175559(0xf1));}function loadProfilesFromTdxJsonFiles(){const _0x40d6d6=a50_0x1bfe,_0x146afe=[],_0x78198b=findProjectConfigPath();_0x78198b&&_0x146afe[_0x40d6d6(0x108)](...loadProfilesFromTdxJson(_0x78198b,_0x40d6d6(0x117)));const _0x42cbb5=a50_0x527940[_0x40d6d6(0xf8)](getConfigDir(),_0x40d6d6(0xe5));return _0x146afe['push'](...loadProfilesFromTdxJson(_0x42cbb5,'user')),_0x146afe;}function loadProfilesFromDirectories(){const _0x592452=a50_0x1bfe,_0x54e2c1=getProfilesDir();if(!a50_0x506c1f[_0x592452(0x106)](_0x54e2c1))return[];try{return a50_0x506c1f[_0x592452(0xf0)](_0x54e2c1,{'withFileTypes':!![]})['filter'](_0x3868a0=>_0x3868a0[_0x592452(0x110)]())[_0x592452(0x100)](_0x126006=>_0x126006['name'])[_0x592452(0x101)](_0x2c105e=>{const _0xd69be1=_0x592452,_0x430c12=getProfileConfigPath(_0x2c105e),_0x365840=getProfileEnvPath(_0x2c105e);return a50_0x506c1f[_0xd69be1(0x106)](_0x430c12)||a50_0x506c1f[_0xd69be1(0x106)](_0x365840);})['map'](_0x551e1b=>{const _0x3fc658=_0x592452,_0x327954=loadProfileFromDirectory(_0x551e1b);if(_0x327954)return{..._0x327954,'scope':_0x3fc658(0xe9)};return null;})['filter'](_0x4a10ee=>_0x4a10ee!==null);}catch{return[];}}function loadProfileFromDirectory(_0x507a11){const _0x1f43b6=a50_0x1bfe,_0x53d089=getProfileConfigPath(_0x507a11),_0xa8de8d=getOldCredentialPath(_0x507a11);if(!a50_0x506c1f[_0x1f43b6(0x106)](_0x53d089)&&!a50_0x506c1f[_0x1f43b6(0x106)](_0xa8de8d))return null;let _0x3532d6={},_0x972e6e={'name':_0x507a11,'createdAt':new Date()[_0x1f43b6(0x103)]()};if(a50_0x506c1f[_0x1f43b6(0x106)](_0x53d089))try{const _0x228254=a50_0x506c1f[_0x1f43b6(0x105)](_0x53d089,_0x1f43b6(0x104)),_0x327687=JSON[_0x1f43b6(0xe4)](_0x228254),{metadata:_0x1af8da,..._0x2a5b32}=_0x327687;_0x3532d6=_0x2a5b32,_0x1af8da&&(_0x972e6e=_0x1af8da);}catch{}return{'name':_0x507a11,'config':_0x3532d6,'metadata':_0x972e6e,'hasCredentials':a50_0x506c1f[_0x1f43b6(0x106)](_0xa8de8d),'scope':_0x1f43b6(0xe9)};}export function listProfiles(){const _0xfc881d=a50_0x1bfe,_0x122559=loadProfilesFromTdxJsonFiles(),_0x1d51f4=loadProfilesFromDirectories();if(_0x1d51f4[_0xfc881d(0xee)]>0x0){const _0x169139=_0x1d51f4[_0xfc881d(0x100)](_0x50aee4=>_0x50aee4[_0xfc881d(0x10e)])[_0xfc881d(0xf8)](',\x20'),_0x5c328d=getConfigDir();console['warn']('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x169139),console[_0xfc881d(0xe3)](_0xfc881d(0xfb)),console['warn'](_0xfc881d(0x102)+a50_0x527940[_0xfc881d(0xf8)](_0x5c328d,_0xfc881d(0xe5))),console[_0xfc881d(0xe3)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0xfc881d(0xe3)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x4c1a17=[..._0x122559,..._0x1d51f4],_0x3da479=new Map();for(const _0x18d8f2 of _0x4c1a17){!_0x3da479[_0xfc881d(0xeb)](_0x18d8f2[_0xfc881d(0x10e)])&&_0x3da479[_0xfc881d(0x129)](_0x18d8f2[_0xfc881d(0x10e)],_0x18d8f2);}return Array[_0xfc881d(0xea)](_0x3da479['values']())[_0xfc881d(0x114)]((_0x56feef,_0x1c779b)=>_0x56feef[_0xfc881d(0x10e)][_0xfc881d(0xe2)](_0x1c779b[_0xfc881d(0x10e)]));}export function profileExists(_0x59dda7){const _0x5aecd5=a50_0x1bfe,_0x30c0b0=listProfiles();return _0x30c0b0['some'](_0x2ae794=>_0x2ae794[_0x5aecd5(0x10e)]===_0x59dda7);}export function loadProfile(_0x58f5f4){const _0x5b0c50=a50_0x1bfe;validateProfileName(_0x58f5f4);const _0x502e5c=listProfiles(),_0x518a40=_0x502e5c[_0x5b0c50(0x115)](_0x48a0cc=>_0x48a0cc[_0x5b0c50(0x10e)]===_0x58f5f4);return _0x518a40||null;}export function saveProfile(_0x5d0077,_0x5068b5,_0x1a61e7=![]){saveProfileToUserConfig(_0x5d0077,_0x5068b5);}export function deleteProfile(_0x493b82){const _0x35d810=a50_0x1bfe;validateProfileName(_0x493b82);const _0x564eb1=getProfileDir(_0x493b82);if(!a50_0x506c1f[_0x35d810(0x106)](_0x564eb1))throw new Error(_0x35d810(0x123)+_0x493b82+_0x35d810(0xf4));a50_0x506c1f[_0x35d810(0xf2)](_0x564eb1,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x55ae5b,_0x59dba7){const _0xe6ed7f=a50_0x1bfe;validateProfileName(_0x55ae5b);const _0x5fca8f=getGlobalConfigPath(),_0x35d60f=getConfigDir();!a50_0x506c1f['existsSync'](_0x35d60f)&&createSecureDirectory(_0x35d60f);let _0x48256d={};if(a50_0x506c1f[_0xe6ed7f(0x106)](_0x5fca8f))try{const _0x60e5af=a50_0x506c1f['readFileSync'](_0x5fca8f,'utf-8');_0x48256d=JSON[_0xe6ed7f(0xe4)](_0x60e5af);}catch{console[_0xe6ed7f(0xe3)](_0xe6ed7f(0xfa)+_0x5fca8f+_0xe6ed7f(0xff));}!_0x48256d['profiles']&&(_0x48256d[_0xe6ed7f(0x107)]={}),_0x48256d[_0xe6ed7f(0x107)][_0x55ae5b]=_0x59dba7,writeSecureFile(_0x5fca8f,JSON[_0xe6ed7f(0x120)](_0x48256d,null,0x2));}function a50_0xa1e2(){const _0x2747aa=['find','43236bvSiyx','local','To\x20migrate:','Profile\x20\x27','310140JOhGlE','Error:\x20','description','Invalid\x20profile\x20name:\x20','parent_segment','\x27:\x20unknown\x20config\x20key\x20\x27','stringify',':\x20Invalid\x20JSON\x20syntax','945056MempXC','Profile\x20','470127RNwDcN','string','24rKosnK','\x20\x20mv\x20\x22','llm_agent','set','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','localeCompare','warn','parse','tdx.json','Warning:\x20Profile\x20\x27','keys','89007FATHjY','directory','from','has','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','length','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','readdirSync','.env','rmSync','profile','\x20does\x20not\x20exist','.env.','\x27:\x20config\x20must\x20be\x20an\x20object','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','join','object','Warning:\x20Failed\x20to\x20parse\x20','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x27\x20will\x20be\x20ignored','database','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string',',\x20creating\x20new\x20file','map','filter','\x20\x201.\x20Edit:\x20','toISOString','utf-8','readFileSync','existsSync','profiles','push','message','899695sWvspW','12XfguOx','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','site','name','336302CgsyFO','isDirectory','includes','llm_project','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','sort'];a50_0xa1e2=function(){return _0x2747aa;};return a50_0xa1e2();}export function getActiveProfile(){const _0xfad78c=a50_0x1bfe,_0x4c53ff=loadSessionContext();if(_0x4c53ff?.['profile'])return _0x4c53ff[_0xfad78c(0xf3)];const _0x3091f3=getGlobalConfigPath();if(!a50_0x506c1f[_0xfad78c(0x106)](_0x3091f3))return null;try{const _0x325c46=a50_0x506c1f[_0xfad78c(0x105)](_0x3091f3,_0xfad78c(0x104)),_0x4e25d6=JSON[_0xfad78c(0xe4)](_0x325c46);return _0x4e25d6[_0xfad78c(0xf3)]||null;}catch{return null;}}export function createProfile(_0x3e4a96,_0x3fe9a2){const _0x56d3b3=a50_0x1bfe;validateProfileName(_0x3e4a96);if(profileExists(_0x3e4a96))throw new Error(_0x56d3b3(0x123)+_0x3e4a96+'\x20already\x20exists');saveProfile(_0x3e4a96,_0x3fe9a2);}export function saveProfileCredentials(_0xc9c772,_0x3a8976){const _0x537f85=a50_0x1bfe;validateProfileName(_0xc9c772);if(!profileExists(_0xc9c772))throw new Error(_0x537f85(0x123)+_0xc9c772+_0x537f85(0xf4));const _0x1672a8=getNewCredentialPath(_0xc9c772);writeSecureFile(_0x1672a8,_0x3a8976);}export function loadProfileCredentials(_0x2f1913){const _0x12c4b9=a50_0x1bfe;validateProfileName(_0x2f1913);const _0x708c8c=getNewCredentialPath(_0x2f1913);if(a50_0x506c1f[_0x12c4b9(0x106)](_0x708c8c))try{return a50_0x506c1f[_0x12c4b9(0x105)](_0x708c8c,_0x12c4b9(0x104));}catch{}const _0x3edda0=getOldCredentialPath(_0x2f1913);if(a50_0x506c1f[_0x12c4b9(0x106)](_0x3edda0)){console[_0x12c4b9(0xe3)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x2f1913+'\x27'),console['warn'](_0x12c4b9(0x118)),console[_0x12c4b9(0xe3)](_0x12c4b9(0x127)+_0x3edda0+'\x22\x20\x22'+_0x708c8c+'\x22'),console[_0x12c4b9(0xe3)](_0x12c4b9(0xed));try{return a50_0x506c1f['readFileSync'](_0x3edda0,_0x12c4b9(0x104));}catch{return null;}}return null;}
1
+ (function(_0x19d972,_0x4bbafc){const _0x40fa58=a50_0x2533,_0x209158=_0x19d972();while(!![]){try{const _0x3ef33c=-parseInt(_0x40fa58(0xf2))/0x1+parseInt(_0x40fa58(0x10c))/0x2+parseInt(_0x40fa58(0x12e))/0x3*(parseInt(_0x40fa58(0x134))/0x4)+parseInt(_0x40fa58(0x113))/0x5+-parseInt(_0x40fa58(0x100))/0x6*(parseInt(_0x40fa58(0x116))/0x7)+-parseInt(_0x40fa58(0xfd))/0x8*(parseInt(_0x40fa58(0x11a))/0x9)+parseInt(_0x40fa58(0x12b))/0xa*(parseInt(_0x40fa58(0xf0))/0xb);if(_0x3ef33c===_0x4bbafc)break;else _0x209158['push'](_0x209158['shift']());}catch(_0x445f25){_0x209158['push'](_0x209158['shift']());}}}(a50_0x5937,0xe24d8));import*as a50_0x350e2f from'node:fs';import*as a50_0x1eef90 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';function a50_0x5937(){const _0x4ce07c=['\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','filter','513601OTRBzM','from','534492toncmz','join','llm_agent','site','rmSync','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','utf-8','some','description','map','231448fTfyfE','message','includes','6FwBSmk','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','object','values','toISOString','\x20\x20mv\x20\x22','parse','readFileSync','user','To\x20migrate:','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','has','2865640iRcciP','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','string','database','push','Profile\x20\x27','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','5697860neZvhf','.env','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','8112853ULyYLO','profiles','existsSync','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','360qDRIaj','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','sort','Profile\x20','directory','set','tdx.json','profile','readdirSync','\x27\x20will\x20be\x20ignored','\x0aWarning:\x20Failed\x20to\x20parse\x20','name','\x27:\x20config\x20must\x20be\x20an\x20object','\x20already\x20exists','test','parent_segment','\x20does\x20not\x20exist','160svCLGR','find','warn','21819LFiYIR',':\x20Invalid\x20JSON\x20syntax','llm_project','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a',',\x20creating\x20new\x20file','Warning:\x20Failed\x20to\x20parse\x20','252owjcJe','\x20\x201.\x20Edit:\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string'];a50_0x5937=function(){return _0x4ce07c;};return a50_0x5937();}import{loadSessionContext}from'./session.js';export function getProfileParams(_0x1207a6){const _0x4e71cc=a50_0x2533,_0x13234a={};if(!_0x1207a6)return _0x13234a;for(const [_0x4c9b46,_0x1f37c9]of Object['entries'](_0x1207a6)){_0x4c9b46!==_0x4e71cc(0xfb)&&_0x1f37c9!==undefined&&(_0x13234a[_0x4c9b46]=_0x1f37c9);}return _0x13234a;}export function getProfilesDir(){const _0x5110df=a50_0x2533;return a50_0x1eef90[_0x5110df(0xf3)](getConfigDir(),_0x5110df(0x117));}function getProfileDir(_0x32103d){return a50_0x1eef90['join'](getProfilesDir(),_0x32103d);}function getProfileConfigPath(_0x2b4672){const _0x4b42c4=a50_0x2533;return a50_0x1eef90['join'](getProfileDir(_0x2b4672),_0x4b42c4(0x120));}function getProfileEnvPath(_0x34f0ce){const _0x380740=a50_0x2533;return a50_0x1eef90[_0x380740(0xf3)](getProfileDir(_0x34f0ce),'.env');}function getGlobalConfigPath(){const _0xf7c054=a50_0x2533;return a50_0x1eef90[_0xf7c054(0xf3)](getConfigDir(),'tdx.json');}function validateProfileName(_0x413f75){const _0x30c34c=a50_0x2533;if(!/^[a-zA-Z0-9_-]+$/[_0x30c34c(0x128)](_0x413f75))throw new Error('Invalid\x20profile\x20name:\x20'+_0x413f75+_0x30c34c(0x119));}function validateProfileConfig(_0x209184,_0x47139f){const _0x1fe3b4=a50_0x2533;if(typeof _0x209184!=='object'||_0x209184===null)throw new Error(_0x1fe3b4(0x111)+_0x47139f+_0x1fe3b4(0x126));const _0x30cfa3=['description',_0x1fe3b4(0xf5),'database',_0x1fe3b4(0x129),_0x1fe3b4(0x130),'llm_agent'],_0x42dbd9=_0x209184;for(const _0x283f49 of Object['keys'](_0x42dbd9)){!_0x30cfa3[_0x1fe3b4(0xff)](_0x283f49)&&console[_0x1fe3b4(0x12d)]('Warning:\x20Profile\x20\x27'+_0x47139f+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x283f49+_0x1fe3b4(0x123));}if(_0x42dbd9[_0x1fe3b4(0xfb)]!==undefined&&typeof _0x42dbd9[_0x1fe3b4(0xfb)]!=='string')throw new Error(_0x1fe3b4(0x111)+_0x47139f+_0x1fe3b4(0x112));if(_0x42dbd9[_0x1fe3b4(0xf5)]!==undefined&&typeof _0x42dbd9[_0x1fe3b4(0xf5)]!==_0x1fe3b4(0x10e))throw new Error(_0x1fe3b4(0x111)+_0x47139f+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x42dbd9[_0x1fe3b4(0x10f)]!==undefined&&typeof _0x42dbd9[_0x1fe3b4(0x10f)]!==_0x1fe3b4(0x10e))throw new Error('Profile\x20\x27'+_0x47139f+_0x1fe3b4(0xf7));if(_0x42dbd9[_0x1fe3b4(0x129)]!==undefined&&typeof _0x42dbd9['parent_segment']!==_0x1fe3b4(0x10e))throw new Error(_0x1fe3b4(0x111)+_0x47139f+_0x1fe3b4(0x115));if(_0x42dbd9['llm_project']!==undefined&&typeof _0x42dbd9['llm_project']!=='string')throw new Error(_0x1fe3b4(0x111)+_0x47139f+_0x1fe3b4(0x136));if(_0x42dbd9['llm_agent']!==undefined&&typeof _0x42dbd9[_0x1fe3b4(0xf4)]!=='string')throw new Error(_0x1fe3b4(0x111)+_0x47139f+_0x1fe3b4(0x11b));return!![];}function loadProfilesFromTdxJson(_0x227703,_0x1dca63){const _0x3f8610=a50_0x2533;if(!a50_0x350e2f[_0x3f8610(0x118)](_0x227703))return[];try{const _0xe713a8=a50_0x350e2f['readFileSync'](_0x227703,'utf-8'),_0x47b0e1=JSON['parse'](_0xe713a8);if(!_0x47b0e1[_0x3f8610(0x117)]||typeof _0x47b0e1[_0x3f8610(0x117)]!==_0x3f8610(0x102))return[];const _0x215b1e=[];for(const [_0x38dcbb,_0x343b1b]of Object['entries'](_0x47b0e1[_0x3f8610(0x117)])){try{validateProfileConfig(_0x343b1b,_0x38dcbb);const _0x4e5609=getNewCredentialPath(_0x38dcbb),_0x281c87=getOldCredentialPath(_0x38dcbb),_0x54994b=a50_0x350e2f['existsSync'](_0x4e5609)||a50_0x350e2f[_0x3f8610(0x118)](_0x281c87);_0x215b1e[_0x3f8610(0x110)]({'name':_0x38dcbb,'config':_0x343b1b,'metadata':{'name':_0x38dcbb,'createdAt':new Date()[_0x3f8610(0x104)]()},'hasCredentials':_0x54994b,'scope':_0x1dca63});}catch(_0x3e8ef3){_0x3e8ef3 instanceof Error&&(console[_0x3f8610(0x12d)](_0x3f8610(0x10a)+_0x227703+':'),console[_0x3f8610(0x12d)]('\x20\x20'+_0x3e8ef3[_0x3f8610(0xfe)]+'\x0a'));}}return _0x215b1e;}catch(_0x4eadad){return _0x4eadad instanceof SyntaxError?(console[_0x3f8610(0x12d)](_0x3f8610(0x124)+_0x227703+_0x3f8610(0x12f)),console['warn']('Error:\x20'+_0x4eadad[_0x3f8610(0xfe)]+'\x0a')):console[_0x3f8610(0x12d)](_0x3f8610(0xf8)+_0x227703+':\x20'+_0x4eadad+'\x0a'),[];}}export function getNewCredentialPath(_0x54a0a9){const _0x2dfaef=a50_0x2533;return a50_0x1eef90[_0x2dfaef(0xf3)](getConfigDir(),'.env.'+_0x54a0a9);}function getOldCredentialPath(_0x561a2d){const _0xbf0eba=a50_0x2533;return a50_0x1eef90['join'](getProfilesDir(),_0x561a2d,_0xbf0eba(0x114));}function a50_0x2533(_0x51d17d,_0x4ebd00){_0x51d17d=_0x51d17d-0xf0;const _0x5937ef=a50_0x5937();let _0x25337d=_0x5937ef[_0x51d17d];return _0x25337d;}function loadProfilesFromTdxJsonFiles(){const _0x429eb0=a50_0x2533,_0x54616d=[],_0x1dad7b=findProjectConfigPath();_0x1dad7b&&_0x54616d['push'](...loadProfilesFromTdxJson(_0x1dad7b,'local'));const _0x34c1c8=a50_0x1eef90[_0x429eb0(0xf3)](getConfigDir(),_0x429eb0(0x120));return _0x54616d[_0x429eb0(0x110)](...loadProfilesFromTdxJson(_0x34c1c8,_0x429eb0(0x108))),_0x54616d;}function loadProfilesFromDirectories(){const _0x43c418=a50_0x2533,_0x4d2b80=getProfilesDir();if(!a50_0x350e2f['existsSync'](_0x4d2b80))return[];try{return a50_0x350e2f[_0x43c418(0x122)](_0x4d2b80,{'withFileTypes':!![]})['filter'](_0x5ec2c0=>_0x5ec2c0['isDirectory']())['map'](_0x4e5085=>_0x4e5085[_0x43c418(0x125)])[_0x43c418(0x138)](_0xceebd2=>{const _0x54bff9=_0x43c418,_0x62b5dc=getProfileConfigPath(_0xceebd2),_0x22d90e=getProfileEnvPath(_0xceebd2);return a50_0x350e2f[_0x54bff9(0x118)](_0x62b5dc)||a50_0x350e2f['existsSync'](_0x22d90e);})[_0x43c418(0xfc)](_0x4f2934=>{const _0x910ac3=_0x43c418,_0x25df3b=loadProfileFromDirectory(_0x4f2934);if(_0x25df3b)return{..._0x25df3b,'scope':_0x910ac3(0x11e)};return null;})['filter'](_0x468afb=>_0x468afb!==null);}catch{return[];}}function loadProfileFromDirectory(_0x25125d){const _0x535d98=a50_0x2533,_0x2a092c=getProfileConfigPath(_0x25125d),_0x501f48=getOldCredentialPath(_0x25125d);if(!a50_0x350e2f[_0x535d98(0x118)](_0x2a092c)&&!a50_0x350e2f[_0x535d98(0x118)](_0x501f48))return null;let _0x41d105={},_0x449304={'name':_0x25125d,'createdAt':new Date()[_0x535d98(0x104)]()};if(a50_0x350e2f[_0x535d98(0x118)](_0x2a092c))try{const _0x353d6a=a50_0x350e2f[_0x535d98(0x107)](_0x2a092c,_0x535d98(0xf9)),_0x4901c9=JSON['parse'](_0x353d6a),{metadata:_0x216247,..._0x21f573}=_0x4901c9;_0x41d105=_0x21f573,_0x216247&&(_0x449304=_0x216247);}catch{}return{'name':_0x25125d,'config':_0x41d105,'metadata':_0x449304,'hasCredentials':a50_0x350e2f[_0x535d98(0x118)](_0x501f48),'scope':_0x535d98(0x11e)};}export function listProfiles(){const _0x2b1bec=a50_0x2533,_0x1c60fc=loadProfilesFromTdxJsonFiles(),_0x1f4f72=loadProfilesFromDirectories();if(_0x1f4f72['length']>0x0){const _0x55dcf4=_0x1f4f72['map'](_0x3d3dd0=>_0x3d3dd0[_0x2b1bec(0x125)])[_0x2b1bec(0xf3)](',\x20'),_0x4f7c4a=getConfigDir();console[_0x2b1bec(0x12d)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x55dcf4),console[_0x2b1bec(0x12d)](_0x2b1bec(0x10d)),console[_0x2b1bec(0x12d)](_0x2b1bec(0x135)+a50_0x1eef90['join'](_0x4f7c4a,_0x2b1bec(0x120))),console['warn'](_0x2b1bec(0x101)),console[_0x2b1bec(0x12d)](_0x2b1bec(0x137));}const _0x185b61=[..._0x1c60fc,..._0x1f4f72],_0x2b1154=new Map();for(const _0x3c800a of _0x185b61){!_0x2b1154[_0x2b1bec(0x10b)](_0x3c800a['name'])&&_0x2b1154[_0x2b1bec(0x11f)](_0x3c800a[_0x2b1bec(0x125)],_0x3c800a);}return Array[_0x2b1bec(0xf1)](_0x2b1154[_0x2b1bec(0x103)]())[_0x2b1bec(0x11c)]((_0x216662,_0x2de043)=>_0x216662['name']['localeCompare'](_0x2de043[_0x2b1bec(0x125)]));}export function profileExists(_0x11d517){const _0x1788fa=a50_0x2533,_0x3fdc49=listProfiles();return _0x3fdc49[_0x1788fa(0xfa)](_0x43df6f=>_0x43df6f[_0x1788fa(0x125)]===_0x11d517);}export function loadProfile(_0x486100){const _0x1c85d7=a50_0x2533;validateProfileName(_0x486100);const _0x1a856a=listProfiles(),_0x488edf=_0x1a856a[_0x1c85d7(0x12c)](_0x14d186=>_0x14d186[_0x1c85d7(0x125)]===_0x486100);return _0x488edf||null;}export function saveProfile(_0x3c91c2,_0x15047d,_0x151d51=![]){saveProfileToUserConfig(_0x3c91c2,_0x15047d);}export function deleteProfile(_0x3b0132){const _0xff8a4b=a50_0x2533;validateProfileName(_0x3b0132);const _0x18f364=getProfileDir(_0x3b0132);if(!a50_0x350e2f[_0xff8a4b(0x118)](_0x18f364))throw new Error(_0xff8a4b(0x11d)+_0x3b0132+_0xff8a4b(0x12a));a50_0x350e2f[_0xff8a4b(0xf6)](_0x18f364,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x82f9e5,_0x3711ef){const _0xaa3154=a50_0x2533;validateProfileName(_0x82f9e5);const _0x4c391a=getGlobalConfigPath(),_0x5d1af7=getConfigDir();!a50_0x350e2f[_0xaa3154(0x118)](_0x5d1af7)&&createSecureDirectory(_0x5d1af7);let _0x33e672={};if(a50_0x350e2f[_0xaa3154(0x118)](_0x4c391a))try{const _0x3d997f=a50_0x350e2f[_0xaa3154(0x107)](_0x4c391a,_0xaa3154(0xf9));_0x33e672=JSON[_0xaa3154(0x106)](_0x3d997f);}catch{console[_0xaa3154(0x12d)](_0xaa3154(0x133)+_0x4c391a+_0xaa3154(0x132));}!_0x33e672['profiles']&&(_0x33e672['profiles']={}),_0x33e672[_0xaa3154(0x117)][_0x82f9e5]=_0x3711ef,writeSecureFile(_0x4c391a,JSON['stringify'](_0x33e672,null,0x2));}export function getActiveProfile(){const _0x403509=a50_0x2533,_0x488c4f=loadSessionContext();if(_0x488c4f?.[_0x403509(0x121)])return _0x488c4f['profile'];const _0x4b3260=getGlobalConfigPath();if(!a50_0x350e2f[_0x403509(0x118)](_0x4b3260))return null;try{const _0x48e8ae=a50_0x350e2f['readFileSync'](_0x4b3260,_0x403509(0xf9)),_0x13ceec=JSON[_0x403509(0x106)](_0x48e8ae);return _0x13ceec[_0x403509(0x121)]||null;}catch{return null;}}export function createProfile(_0x8a77a9,_0xd41455){const _0x3b9e54=a50_0x2533;validateProfileName(_0x8a77a9);if(profileExists(_0x8a77a9))throw new Error('Profile\x20'+_0x8a77a9+_0x3b9e54(0x127));saveProfile(_0x8a77a9,_0xd41455);}export function saveProfileCredentials(_0x23d619,_0x1d95bf){const _0x5e06cf=a50_0x2533;validateProfileName(_0x23d619);if(!profileExists(_0x23d619))throw new Error(_0x5e06cf(0x11d)+_0x23d619+'\x20does\x20not\x20exist');const _0x5a450b=getNewCredentialPath(_0x23d619);writeSecureFile(_0x5a450b,_0x1d95bf);}export function loadProfileCredentials(_0x16fc17){const _0x13c69f=a50_0x2533;validateProfileName(_0x16fc17);const _0x16d9f4=getNewCredentialPath(_0x16fc17);if(a50_0x350e2f['existsSync'](_0x16d9f4))try{return a50_0x350e2f[_0x13c69f(0x107)](_0x16d9f4,_0x13c69f(0xf9));}catch{}const _0x67f59a=getOldCredentialPath(_0x16fc17);if(a50_0x350e2f[_0x13c69f(0x118)](_0x67f59a)){console[_0x13c69f(0x12d)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x16fc17+'\x27'),console['warn'](_0x13c69f(0x109)),console[_0x13c69f(0x12d)](_0x13c69f(0x105)+_0x67f59a+'\x22\x20\x22'+_0x16d9f4+'\x22'),console[_0x13c69f(0x12d)](_0x13c69f(0x131));try{return a50_0x350e2f[_0x13c69f(0x107)](_0x67f59a,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a51_0x560389=a51_0x1ecb;(function(_0x591b00,_0x221416){const _0x2f4b8a=a51_0x1ecb,_0x4d8857=_0x591b00();while(!![]){try{const _0x503673=-parseInt(_0x2f4b8a(0x1fd))/0x1+-parseInt(_0x2f4b8a(0x1f5))/0x2+-parseInt(_0x2f4b8a(0x1e6))/0x3+parseInt(_0x2f4b8a(0x1fb))/0x4+-parseInt(_0x2f4b8a(0x1eb))/0x5+parseInt(_0x2f4b8a(0x1ff))/0x6*(parseInt(_0x2f4b8a(0x1f7))/0x7)+parseInt(_0x2f4b8a(0x1e9))/0x8*(parseInt(_0x2f4b8a(0x1e7))/0x9);if(_0x503673===_0x221416)break;else _0x4d8857['push'](_0x4d8857['shift']());}catch(_0x1a9673){_0x4d8857['push'](_0x4d8857['shift']());}}}(a51_0x3b49,0x77144));import*as a51_0x5dd25d from'node:fs';import*as a51_0x54535c from'node:path';function a51_0x1ecb(_0x204c5c,_0xcb143c){_0x204c5c=_0x204c5c-0x1e6;const _0x3b4954=a51_0x3b49();let _0x1ecbb5=_0x3b4954[_0x204c5c];return _0x1ecbb5;}const PROJECT_CONFIG_FILENAME=a51_0x560389(0x1f3);export function findProjectConfigPath(_0x206c86){const _0x40fbfc=a51_0x560389;let _0x2cc6ad=_0x206c86||process[_0x40fbfc(0x1fa)]();while(!![]){const _0x19e4d4=a51_0x54535c[_0x40fbfc(0x1ef)](_0x2cc6ad,PROJECT_CONFIG_FILENAME);if(a51_0x5dd25d[_0x40fbfc(0x1f6)](_0x19e4d4))return _0x19e4d4;const _0x2b3f3c=a51_0x54535c['dirname'](_0x2cc6ad);if(_0x2b3f3c===_0x2cc6ad)return null;_0x2cc6ad=_0x2b3f3c;}}export function loadProjectConfig(_0x44c0c2){const _0x5abd00=a51_0x560389,_0x4e8e79=findProjectConfigPath(_0x44c0c2);if(!_0x4e8e79)return null;try{const _0xe9423c=a51_0x5dd25d[_0x5abd00(0x1ea)](_0x4e8e79,'utf-8'),_0x57ea8a=JSON[_0x5abd00(0x1f4)](_0xe9423c),_0x4be709=JSON['stringify'](_0x57ea8a);if(_0x4be709[_0x5abd00(0x1ec)]('TD_API_KEY')||_0x4be709[_0x5abd00(0x1ec)]('apiKey')||_0x4be709[_0x5abd00(0x1ec)]('api_key'))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x4e8e79+_0x5abd00(0x1e8)+_0x5abd00(0x1f0));const {metadata:_0x3c3080,profile:_0x54c48,..._0x41c0bb}=_0x57ea8a;return _0x54c48&&console[_0x5abd00(0x204)](_0x5abd00(0x203)+_0x4e8e79+_0x5abd00(0x200)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x41c0bb;}catch(_0x170f39){if(_0x170f39 instanceof Error&&_0x5abd00(0x1ee)in _0x170f39&&_0x170f39[_0x5abd00(0x1ee)]==='ENOENT')return null;throw new Error(_0x5abd00(0x1f8)+_0x4e8e79+':\x20'+_0x170f39);}}export function saveProjectConfig(_0x15267d,_0x50fe67){const _0x1dbd94=a51_0x560389,_0x3c8536=_0x50fe67||process[_0x1dbd94(0x1fa)](),_0x5e855b=a51_0x54535c[_0x1dbd94(0x1ef)](_0x3c8536,PROJECT_CONFIG_FILENAME),_0x33ad25=JSON[_0x1dbd94(0x201)](_0x15267d);if(_0x33ad25[_0x1dbd94(0x1ec)](_0x1dbd94(0x1f1))||_0x33ad25[_0x1dbd94(0x1ec)](_0x1dbd94(0x1f9))||_0x33ad25[_0x1dbd94(0x1ec)](_0x1dbd94(0x1f2)))throw new Error(_0x1dbd94(0x1fc));if(_0x1dbd94(0x1ed)in _0x15267d)throw new Error(_0x1dbd94(0x202));a51_0x5dd25d[_0x1dbd94(0x1fe)](_0x5e855b,JSON[_0x1dbd94(0x201)](_0x15267d,null,0x2));}function a51_0x3b49(){const _0x2f4033=['join','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','TD_API_KEY','api_key','tdx.json','parse','441194PoJmGP','existsSync','14cxnRwP','Failed\x20to\x20load\x20project\x20config\x20from\x20','apiKey','cwd','2780160hdJgKv','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','428537qrycza','writeFileSync','490128COEFQW','\x20is\x20ignored.\x20','stringify','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20','warn','1511658ksWoAk','12719007hYHDXH',').\x20','8rCHbXP','readFileSync','3154355tPFnkc','includes','profile','code'];a51_0x3b49=function(){return _0x2f4033;};return a51_0x3b49();}export function hasProjectConfig(_0xab8d23){return findProjectConfigPath(_0xab8d23)!==null;}export function getProjectRoot(_0x336f51){const _0x561583=findProjectConfigPath(_0x336f51);return _0x561583?a51_0x54535c['dirname'](_0x561583):null;}
1
+ (function(_0x24ea22,_0x3f43ce){const _0x1a8f5d=a51_0x1ad3,_0x544b62=_0x24ea22();while(!![]){try{const _0x3ad0fa=-parseInt(_0x1a8f5d(0x7d))/0x1*(parseInt(_0x1a8f5d(0x9b))/0x2)+parseInt(_0x1a8f5d(0x94))/0x3*(-parseInt(_0x1a8f5d(0x84))/0x4)+parseInt(_0x1a8f5d(0x88))/0x5+parseInt(_0x1a8f5d(0x92))/0x6+parseInt(_0x1a8f5d(0x99))/0x7+-parseInt(_0x1a8f5d(0x96))/0x8*(-parseInt(_0x1a8f5d(0x8b))/0x9)+parseInt(_0x1a8f5d(0x93))/0xa*(parseInt(_0x1a8f5d(0x90))/0xb);if(_0x3ad0fa===_0x3f43ce)break;else _0x544b62['push'](_0x544b62['shift']());}catch(_0x1e11f3){_0x544b62['push'](_0x544b62['shift']());}}}(a51_0x1d3a,0x186a9));import*as a51_0x298238 from'node:fs';function a51_0x1d3a(){const _0x4f961a=['621628XVrlnn','TD_API_KEY','54VpCWiC','profile','includes','join','5133gGBNWH','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','Failed\x20to\x20load\x20project\x20config\x20from\x20','parse','utf-8','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','ENOENT','4jyhQXU','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','code','existsSync','220625fuqbxb','\x20is\x20ignored.\x20','Warning:\x20\x27profile\x27\x20field\x20in\x20','2907dSGevC','stringify','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','cwd','api_key','151415YUwRfj','dirname','375486nswJXj','110fRJeVT','580791VLYRIj','apiKey','2112sQPrdy','readFileSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.'];a51_0x1d3a=function(){return _0x4f961a;};return a51_0x1d3a();}import*as a51_0x2c6858 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x4286ca){const _0x2aa22c=a51_0x1ad3;let _0x37e8a8=_0x4286ca||process[_0x2aa22c(0x8e)]();while(!![]){const _0x2aa3d8=a51_0x2c6858[_0x2aa22c(0x7c)](_0x37e8a8,PROJECT_CONFIG_FILENAME);if(a51_0x298238[_0x2aa22c(0x87)](_0x2aa3d8))return _0x2aa3d8;const _0x1d1efb=a51_0x2c6858[_0x2aa22c(0x91)](_0x37e8a8);if(_0x1d1efb===_0x37e8a8)return null;_0x37e8a8=_0x1d1efb;}}export function loadProjectConfig(_0x16f356){const _0x4b010a=a51_0x1ad3,_0x3926fd=findProjectConfigPath(_0x16f356);if(!_0x3926fd)return null;try{const _0x4d5df6=a51_0x298238[_0x4b010a(0x97)](_0x3926fd,_0x4b010a(0x81)),_0xa82036=JSON[_0x4b010a(0x80)](_0x4d5df6),_0x6b562d=JSON['stringify'](_0xa82036);if(_0x6b562d[_0x4b010a(0x7b)](_0x4b010a(0x9a))||_0x6b562d[_0x4b010a(0x7b)](_0x4b010a(0x95))||_0x6b562d['includes'](_0x4b010a(0x8f)))throw new Error(_0x4b010a(0x8d)+_0x3926fd+').\x20'+_0x4b010a(0x85));const {metadata:_0x3b9ac3,profile:_0x5493b6,..._0x3d90af}=_0xa82036;return _0x5493b6&&console['warn'](_0x4b010a(0x8a)+_0x3926fd+_0x4b010a(0x89)+_0x4b010a(0x7e)),_0x3d90af;}catch(_0x453cf8){if(_0x453cf8 instanceof Error&&_0x4b010a(0x86)in _0x453cf8&&_0x453cf8[_0x4b010a(0x86)]===_0x4b010a(0x83))return null;throw new Error(_0x4b010a(0x7f)+_0x3926fd+':\x20'+_0x453cf8);}}function a51_0x1ad3(_0x550d1d,_0x676b2){_0x550d1d=_0x550d1d-0x7b;const _0x1d3a73=a51_0x1d3a();let _0x1ad3c8=_0x1d3a73[_0x550d1d];return _0x1ad3c8;}export function saveProjectConfig(_0x12cbd3,_0x5ae00f){const _0x59ad11=a51_0x1ad3,_0x3b8f57=_0x5ae00f||process[_0x59ad11(0x8e)](),_0x1ba4cc=a51_0x2c6858[_0x59ad11(0x7c)](_0x3b8f57,PROJECT_CONFIG_FILENAME),_0x3913d0=JSON[_0x59ad11(0x8c)](_0x12cbd3);if(_0x3913d0[_0x59ad11(0x7b)](_0x59ad11(0x9a))||_0x3913d0[_0x59ad11(0x7b)](_0x59ad11(0x95))||_0x3913d0['includes'](_0x59ad11(0x8f)))throw new Error(_0x59ad11(0x98));if(_0x59ad11(0x9c)in _0x12cbd3)throw new Error(_0x59ad11(0x82));a51_0x298238['writeFileSync'](_0x1ba4cc,JSON['stringify'](_0x12cbd3,null,0x2));}export function hasProjectConfig(_0x1ef78e){return findProjectConfigPath(_0x1ef78e)!==null;}export function getProjectRoot(_0x568bfa){const _0x47207c=a51_0x1ad3,_0x1ee9c2=findProjectConfigPath(_0x568bfa);return _0x1ee9c2?a51_0x2c6858[_0x47207c(0x91)](_0x1ee9c2):null;}
@@ -1 +1 @@
1
- (function(_0x395133,_0x51de45){const _0x3e0959=a52_0x22c7,_0x416842=_0x395133();while(!![]){try{const _0x2d0a63=parseInt(_0x3e0959(0x152))/0x1+-parseInt(_0x3e0959(0x151))/0x2*(-parseInt(_0x3e0959(0x140))/0x3)+-parseInt(_0x3e0959(0x14e))/0x4+parseInt(_0x3e0959(0x146))/0x5*(-parseInt(_0x3e0959(0x13f))/0x6)+-parseInt(_0x3e0959(0x12f))/0x7*(parseInt(_0x3e0959(0x12e))/0x8)+-parseInt(_0x3e0959(0x134))/0x9*(parseInt(_0x3e0959(0x14a))/0xa)+parseInt(_0x3e0959(0x133))/0xb*(parseInt(_0x3e0959(0x144))/0xc);if(_0x2d0a63===_0x51de45)break;else _0x416842['push'](_0x416842['shift']());}catch(_0x18534e){_0x416842['push'](_0x416842['shift']());}}}(a52_0x3d3c,0x9c9e3));import*as a52_0x40a08c from'node:fs';import*as a52_0x19ea61 from'node:path';import*as a52_0x43c214 from'node:os';function a52_0x3d3c(){const _0x5692d9=['471572FJCEDX','writeFileSync','.json','7551328YRluJY','7xIMfnp','api_key','test','stringify','13038443wcvQVD','526158ctvPzW','warn','now','.\x20This\x20is\x20insecure.\x20Removing\x20session.','endsWith','readdirSync','createdAt','includes','utf-8','tdx','join','6YnoYJK','60IRUDWU','TD_API_KEY','apiKey','unlinkSync','24RVchRN','toISOString','6026470aZeCEJ','push','parse','homedir','10klHfMU','replace','toString','getTime','3910796shcXlH','existsSync','readFileSync','98468ynGvHl'];a52_0x3d3c=function(){return _0x5692d9;};return a52_0x3d3c();}import{getPPID,isProcessRunning}from'../utils/process.js';function a52_0x22c7(_0x1d725c,_0x237a50){_0x1d725c=_0x1d725c-0x12e;const _0x3d3c4d=a52_0x3d3c();let _0x22c7a2=_0x3d3c4d[_0x1d725c];return _0x22c7a2;}import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x104211=a52_0x22c7,_0x3c8bd4=process['env']['TDX_CONFIG_DIR']||a52_0x19ea61[_0x104211(0x13e)](a52_0x43c214[_0x104211(0x149)](),'.config',_0x104211(0x13d));return a52_0x19ea61[_0x104211(0x13e)](_0x3c8bd4,'sessions');}function getSessionPath(_0x4d9fcd){const _0x2b856f=a52_0x22c7;return a52_0x19ea61[_0x2b856f(0x13e)](getSessionsDir(),_0x4d9fcd+_0x2b856f(0x154));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x384a32){const _0x42bff7=a52_0x22c7;if(_0x384a32)return _0x384a32;return getCurrentSessionPID()[_0x42bff7(0x14c)]();}export function loadSessionContext(_0x92e560){const _0x56df89=a52_0x22c7,_0x39e007=_0x92e560||getCurrentSessionPID()[_0x56df89(0x14c)](),_0x596ebd=/^\d+$/[_0x56df89(0x131)](_0x39e007)?parseInt(_0x39e007,0xa):null;return _0x596ebd!==null?loadSessionContextByPID(_0x596ebd):loadSessionContextByString(_0x39e007);}export function loadSessionContextByPID(_0xd6289b){const _0x56fc70=a52_0x22c7,_0x11457c=getSessionPath(_0xd6289b);if(!a52_0x40a08c['existsSync'](_0x11457c))return null;try{const _0x2573f0=a52_0x40a08c[_0x56fc70(0x150)](_0x11457c,'utf-8'),_0x3e3150=JSON[_0x56fc70(0x148)](_0x2573f0),_0xa2d734=new Date(_0x3e3150[_0x56fc70(0x13a)])[_0x56fc70(0x14d)](),_0x329c01=Date[_0x56fc70(0x136)]();if(_0x329c01-_0xa2d734>SESSION_EXPIRATION_MS)return a52_0x40a08c[_0x56fc70(0x143)](_0x11457c),null;const _0x32af66=JSON[_0x56fc70(0x132)](_0x3e3150);if(_0x32af66['includes'](_0x56fc70(0x141))||_0x32af66[_0x56fc70(0x13b)](_0x56fc70(0x142))||_0x32af66[_0x56fc70(0x13b)](_0x56fc70(0x130)))return console[_0x56fc70(0x135)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x11457c+_0x56fc70(0x137)),a52_0x40a08c['unlinkSync'](_0x11457c),null;return _0x3e3150;}catch{try{a52_0x40a08c[_0x56fc70(0x143)](_0x11457c);}catch{}return null;}}function loadSessionContextByString(_0x3ccd6a){const _0x38bc27=a52_0x22c7,_0xfd0d8d=a52_0x19ea61['join'](getSessionsDir(),_0x3ccd6a+'.json');if(!a52_0x40a08c['existsSync'](_0xfd0d8d))return null;try{const _0x58181a=a52_0x40a08c[_0x38bc27(0x150)](_0xfd0d8d,_0x38bc27(0x13c)),_0xd8935=JSON[_0x38bc27(0x148)](_0x58181a),_0x59bdec=new Date(_0xd8935[_0x38bc27(0x13a)])[_0x38bc27(0x14d)](),_0x556bf9=Date[_0x38bc27(0x136)]();if(_0x556bf9-_0x59bdec>SESSION_EXPIRATION_MS)return a52_0x40a08c[_0x38bc27(0x143)](_0xfd0d8d),null;const _0x5359c1=JSON[_0x38bc27(0x132)](_0xd8935);if(_0x5359c1[_0x38bc27(0x13b)](_0x38bc27(0x141))||_0x5359c1['includes'](_0x38bc27(0x142))||_0x5359c1['includes']('api_key'))return console[_0x38bc27(0x135)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0xfd0d8d+_0x38bc27(0x137)),a52_0x40a08c['unlinkSync'](_0xfd0d8d),null;return _0xd8935;}catch{try{a52_0x40a08c['unlinkSync'](_0xfd0d8d);}catch{}return null;}}export function saveSessionContext(_0x3fe66f,_0xde27e4){const _0x550d54=a52_0x22c7,_0x1d2de0=_0xde27e4||getCurrentSessionPID()[_0x550d54(0x14c)](),_0x4feb2d=/^\d+$/[_0x550d54(0x131)](_0x1d2de0)?parseInt(_0x1d2de0,0xa):getCurrentSessionPID(),_0x309d9f=a52_0x19ea61[_0x550d54(0x13e)](getSessionsDir(),_0x1d2de0+'.json'),_0x2e9f22=getSessionsDir();createSecureDirectory(_0x2e9f22);const _0x2cc780=JSON[_0x550d54(0x132)](_0x3fe66f);if(_0x2cc780[_0x550d54(0x13b)](_0x550d54(0x141))||_0x2cc780['includes'](_0x550d54(0x142))||_0x2cc780[_0x550d54(0x13b)](_0x550d54(0x130)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x4bdcf8;const _0x37cfa2=/^\d+$/[_0x550d54(0x131)](_0x1d2de0)?loadSessionContextByPID(parseInt(_0x1d2de0,0xa)):loadSessionContextByString(_0x1d2de0);_0x37cfa2?_0x4bdcf8={..._0x37cfa2,..._0x3fe66f,'pid':_0x4feb2d,'sessionId':_0x1d2de0!==_0x4feb2d['toString']()?_0x1d2de0:undefined,'updatedAt':new Date()[_0x550d54(0x145)]()}:_0x4bdcf8={'pid':_0x4feb2d,'sessionId':_0x1d2de0!==_0x4feb2d['toString']()?_0x1d2de0:undefined,..._0x3fe66f,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x550d54(0x145)]()},a52_0x40a08c[_0x550d54(0x153)](_0x309d9f,JSON[_0x550d54(0x132)](_0x4bdcf8,null,0x2));}export function clearSessionContext(_0x5394b9){const _0x67df04=a52_0x22c7,_0x578b24=_0x5394b9||getCurrentSessionPID()[_0x67df04(0x14c)](),_0x1bcefd=a52_0x19ea61[_0x67df04(0x13e)](getSessionsDir(),_0x578b24+_0x67df04(0x154));a52_0x40a08c[_0x67df04(0x14f)](_0x1bcefd)&&a52_0x40a08c[_0x67df04(0x143)](_0x1bcefd);}export function cleanExpiredSessions(){const _0x11f6eb=a52_0x22c7,_0x36934a=getSessionsDir();if(!a52_0x40a08c[_0x11f6eb(0x14f)](_0x36934a))return 0x0;let _0x1b0b71=0x0;const _0x216fa2=Date[_0x11f6eb(0x136)]();try{const _0x213e03=a52_0x40a08c['readdirSync'](_0x36934a);for(const _0x6a7cb3 of _0x213e03){if(!_0x6a7cb3[_0x11f6eb(0x138)]('.json'))continue;const _0x26286f=a52_0x19ea61['join'](_0x36934a,_0x6a7cb3),_0x5b9e5e=_0x6a7cb3['replace'](_0x11f6eb(0x154),''),_0x56cf01=parseInt(_0x5b9e5e,0xa),_0x3a5a9e=!isNaN(_0x56cf01);if(_0x3a5a9e){if(!isProcessRunning(_0x56cf01)){a52_0x40a08c[_0x11f6eb(0x143)](_0x26286f),_0x1b0b71++;continue;}}try{const _0xa402db=a52_0x40a08c['readFileSync'](_0x26286f,_0x11f6eb(0x13c)),_0x2ced83=JSON['parse'](_0xa402db),_0x3fb931=new Date(_0x2ced83['createdAt'])[_0x11f6eb(0x14d)]();_0x216fa2-_0x3fb931>SESSION_EXPIRATION_MS&&(a52_0x40a08c[_0x11f6eb(0x143)](_0x26286f),_0x1b0b71++);}catch{a52_0x40a08c[_0x11f6eb(0x143)](_0x26286f),_0x1b0b71++;}}}catch{}return _0x1b0b71;}export function listActiveSessions(){const _0x5ab2b6=a52_0x22c7,_0x2b8daa=getSessionsDir();if(!a52_0x40a08c[_0x5ab2b6(0x14f)](_0x2b8daa))return[];try{const _0x302ceb=a52_0x40a08c[_0x5ab2b6(0x139)](_0x2b8daa),_0x3052d1=[];for(const _0x712f1d of _0x302ceb){if(!_0x712f1d[_0x5ab2b6(0x138)](_0x5ab2b6(0x154)))continue;const _0x1ffef8=_0x712f1d[_0x5ab2b6(0x14b)](_0x5ab2b6(0x154),''),_0x162eac=parseInt(_0x1ffef8,0xa);!isNaN(_0x162eac)&&isProcessRunning(_0x162eac)&&_0x3052d1[_0x5ab2b6(0x147)](_0x162eac);}return _0x3052d1['sort']((_0x105e13,_0x20c50f)=>_0x105e13-_0x20c50f);}catch{return[];}}
1
+ (function(_0x180d3a,_0xc156c5){const _0x5d5cc0=a52_0x71eb,_0x22bff7=_0x180d3a();while(!![]){try{const _0x593527=-parseInt(_0x5d5cc0(0x1e6))/0x1*(-parseInt(_0x5d5cc0(0x1ed))/0x2)+-parseInt(_0x5d5cc0(0x1e0))/0x3+-parseInt(_0x5d5cc0(0x1cb))/0x4+-parseInt(_0x5d5cc0(0x1dd))/0x5+parseInt(_0x5d5cc0(0x1d2))/0x6+-parseInt(_0x5d5cc0(0x1dc))/0x7*(parseInt(_0x5d5cc0(0x1e2))/0x8)+parseInt(_0x5d5cc0(0x1f1))/0x9;if(_0x593527===_0xc156c5)break;else _0x22bff7['push'](_0x22bff7['shift']());}catch(_0xaf5caa){_0x22bff7['push'](_0x22bff7['shift']());}}}(a52_0x86ad,0xb684c));function a52_0x71eb(_0x339d3e,_0x296e14){_0x339d3e=_0x339d3e-0x1ca;const _0x86ad58=a52_0x86ad();let _0x71eb68=_0x86ad58[_0x339d3e];return _0x71eb68;}import*as a52_0xa3e1dd from'node:fs';import*as a52_0x374f8a from'node:path';import*as a52_0x2d2630 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 _0x2762e9=a52_0x71eb,_0x2099cd=process[_0x2762e9(0x1ef)][_0x2762e9(0x1d3)]||a52_0x374f8a[_0x2762e9(0x1df)](a52_0x2d2630['homedir'](),_0x2762e9(0x1ea),_0x2762e9(0x1d1));return a52_0x374f8a[_0x2762e9(0x1df)](_0x2099cd,_0x2762e9(0x1e9));}function getSessionPath(_0x3c0939){const _0x54b870=a52_0x71eb;return a52_0x374f8a[_0x54b870(0x1df)](getSessionsDir(),_0x3c0939+_0x54b870(0x1e1));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x2207a4){if(_0x2207a4)return _0x2207a4;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x56f0ce){const _0x2b2bff=a52_0x71eb,_0x228948=_0x56f0ce||getCurrentSessionPID()[_0x2b2bff(0x1d9)](),_0x3bfc9d=/^\d+$/[_0x2b2bff(0x1d6)](_0x228948)?parseInt(_0x228948,0xa):null;return _0x3bfc9d!==null?loadSessionContextByPID(_0x3bfc9d):loadSessionContextByString(_0x228948);}export function loadSessionContextByPID(_0x299302){const _0x5851ef=a52_0x71eb,_0x7b755=getSessionPath(_0x299302);if(!a52_0xa3e1dd[_0x5851ef(0x1da)](_0x7b755))return null;try{const _0x502084=a52_0xa3e1dd[_0x5851ef(0x1e5)](_0x7b755,_0x5851ef(0x1ee)),_0x5cbf39=JSON[_0x5851ef(0x1cf)](_0x502084),_0x14d6b2=new Date(_0x5cbf39[_0x5851ef(0x1ce)])['getTime'](),_0x269a8b=Date[_0x5851ef(0x1de)]();if(_0x269a8b-_0x14d6b2>SESSION_EXPIRATION_MS)return a52_0xa3e1dd[_0x5851ef(0x1f0)](_0x7b755),null;const _0x557418=JSON[_0x5851ef(0x1db)](_0x5cbf39);if(_0x557418['includes'](_0x5851ef(0x1e8))||_0x557418[_0x5851ef(0x1d0)](_0x5851ef(0x1ca))||_0x557418[_0x5851ef(0x1d0)](_0x5851ef(0x1e3)))return console['warn'](_0x5851ef(0x1ec)+_0x7b755+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a52_0xa3e1dd[_0x5851ef(0x1f0)](_0x7b755),null;return _0x5cbf39;}catch{try{a52_0xa3e1dd[_0x5851ef(0x1f0)](_0x7b755);}catch{}return null;}}function loadSessionContextByString(_0x48856c){const _0x5c1eec=a52_0x71eb,_0x3ce21f=a52_0x374f8a['join'](getSessionsDir(),_0x48856c+'.json');if(!a52_0xa3e1dd[_0x5c1eec(0x1da)](_0x3ce21f))return null;try{const _0x4bbae8=a52_0xa3e1dd[_0x5c1eec(0x1e5)](_0x3ce21f,_0x5c1eec(0x1ee)),_0x13e7d7=JSON['parse'](_0x4bbae8),_0x3a8e9f=new Date(_0x13e7d7[_0x5c1eec(0x1ce)])[_0x5c1eec(0x1e4)](),_0x555885=Date['now']();if(_0x555885-_0x3a8e9f>SESSION_EXPIRATION_MS)return a52_0xa3e1dd[_0x5c1eec(0x1f0)](_0x3ce21f),null;const _0xeaa581=JSON[_0x5c1eec(0x1db)](_0x13e7d7);if(_0xeaa581['includes'](_0x5c1eec(0x1e8))||_0xeaa581['includes'](_0x5c1eec(0x1ca))||_0xeaa581[_0x5c1eec(0x1d0)]('api_key'))return console[_0x5c1eec(0x1cc)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x3ce21f+_0x5c1eec(0x1eb)),a52_0xa3e1dd['unlinkSync'](_0x3ce21f),null;return _0x13e7d7;}catch{try{a52_0xa3e1dd[_0x5c1eec(0x1f0)](_0x3ce21f);}catch{}return null;}}export function saveSessionContext(_0x47ce09,_0xc403d){const _0x5146a0=a52_0x71eb,_0xf867bf=_0xc403d||getCurrentSessionPID()[_0x5146a0(0x1d9)](),_0x1825ac=/^\d+$/[_0x5146a0(0x1d6)](_0xf867bf)?parseInt(_0xf867bf,0xa):getCurrentSessionPID(),_0x437cc5=a52_0x374f8a[_0x5146a0(0x1df)](getSessionsDir(),_0xf867bf+_0x5146a0(0x1e1)),_0x53a94c=getSessionsDir();createSecureDirectory(_0x53a94c);const _0x4d7532=JSON[_0x5146a0(0x1db)](_0x47ce09);if(_0x4d7532[_0x5146a0(0x1d0)](_0x5146a0(0x1e8))||_0x4d7532[_0x5146a0(0x1d0)](_0x5146a0(0x1ca))||_0x4d7532[_0x5146a0(0x1d0)](_0x5146a0(0x1e3)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x58c718;const _0x721443=/^\d+$/['test'](_0xf867bf)?loadSessionContextByPID(parseInt(_0xf867bf,0xa)):loadSessionContextByString(_0xf867bf);_0x721443?_0x58c718={..._0x721443,..._0x47ce09,'pid':_0x1825ac,'sessionId':_0xf867bf!==_0x1825ac['toString']()?_0xf867bf:undefined,'updatedAt':new Date()[_0x5146a0(0x1cd)]()}:_0x58c718={'pid':_0x1825ac,'sessionId':_0xf867bf!==_0x1825ac['toString']()?_0xf867bf:undefined,..._0x47ce09,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x5146a0(0x1cd)]()},a52_0xa3e1dd[_0x5146a0(0x1d5)](_0x437cc5,JSON[_0x5146a0(0x1db)](_0x58c718,null,0x2));}function a52_0x86ad(){const _0x10bf50=['2532465mBWFEK','now','join','1941003WiXwie','.json','3698584BIaVrl','api_key','getTime','readFileSync','267908fHHSDr','replace','TD_API_KEY','sessions','.config','.\x20This\x20is\x20insecure.\x20Removing\x20session.','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','2oQHDSY','utf-8','env','unlinkSync','26077131ISIziy','apiKey','5837384PaoIMV','warn','toISOString','createdAt','parse','includes','tdx','3944352zsboPb','TDX_CONFIG_DIR','readdirSync','writeFileSync','test','push','endsWith','toString','existsSync','stringify','7XCZrrB'];a52_0x86ad=function(){return _0x10bf50;};return a52_0x86ad();}export function clearSessionContext(_0x42381f){const _0x3d1997=a52_0x71eb,_0x4886ae=_0x42381f||getCurrentSessionPID()[_0x3d1997(0x1d9)](),_0x4f408a=a52_0x374f8a[_0x3d1997(0x1df)](getSessionsDir(),_0x4886ae+'.json');a52_0xa3e1dd[_0x3d1997(0x1da)](_0x4f408a)&&a52_0xa3e1dd[_0x3d1997(0x1f0)](_0x4f408a);}export function cleanExpiredSessions(){const _0x315b96=a52_0x71eb,_0x4d1f99=getSessionsDir();if(!a52_0xa3e1dd[_0x315b96(0x1da)](_0x4d1f99))return 0x0;let _0xa5bcd=0x0;const _0x535888=Date[_0x315b96(0x1de)]();try{const _0x43cbaa=a52_0xa3e1dd[_0x315b96(0x1d4)](_0x4d1f99);for(const _0x2c4813 of _0x43cbaa){if(!_0x2c4813[_0x315b96(0x1d8)](_0x315b96(0x1e1)))continue;const _0x21c3ca=a52_0x374f8a[_0x315b96(0x1df)](_0x4d1f99,_0x2c4813),_0x14d0a0=_0x2c4813[_0x315b96(0x1e7)](_0x315b96(0x1e1),''),_0xc35f7c=parseInt(_0x14d0a0,0xa),_0x46fa43=!isNaN(_0xc35f7c);if(_0x46fa43){if(!isProcessRunning(_0xc35f7c)){a52_0xa3e1dd[_0x315b96(0x1f0)](_0x21c3ca),_0xa5bcd++;continue;}}try{const _0x574204=a52_0xa3e1dd[_0x315b96(0x1e5)](_0x21c3ca,_0x315b96(0x1ee)),_0x5d35d4=JSON[_0x315b96(0x1cf)](_0x574204),_0x12e11f=new Date(_0x5d35d4[_0x315b96(0x1ce)])[_0x315b96(0x1e4)]();_0x535888-_0x12e11f>SESSION_EXPIRATION_MS&&(a52_0xa3e1dd[_0x315b96(0x1f0)](_0x21c3ca),_0xa5bcd++);}catch{a52_0xa3e1dd[_0x315b96(0x1f0)](_0x21c3ca),_0xa5bcd++;}}}catch{}return _0xa5bcd;}export function listActiveSessions(){const _0x335725=a52_0x71eb,_0x47e15c=getSessionsDir();if(!a52_0xa3e1dd[_0x335725(0x1da)](_0x47e15c))return[];try{const _0x4d5742=a52_0xa3e1dd['readdirSync'](_0x47e15c),_0x4d1027=[];for(const _0x3b5f0d of _0x4d5742){if(!_0x3b5f0d['endsWith']('.json'))continue;const _0x58967d=_0x3b5f0d[_0x335725(0x1e7)]('.json',''),_0x2b1db0=parseInt(_0x58967d,0xa);!isNaN(_0x2b1db0)&&isProcessRunning(_0x2b1db0)&&_0x4d1027[_0x335725(0x1d7)](_0x2b1db0);}return _0x4d1027['sort']((_0x5c1642,_0x5e9e00)=>_0x5c1642-_0x5e9e00);}catch{return[];}}
@@ -1 +1 @@
1
- (function(_0xf2f757,_0x310c44){const _0x80fe1c=a53_0x318a,_0x157b7e=_0xf2f757();while(!![]){try{const _0x1eb39b=-parseInt(_0x80fe1c(0x123))/0x1*(parseInt(_0x80fe1c(0x122))/0x2)+-parseInt(_0x80fe1c(0x11f))/0x3+-parseInt(_0x80fe1c(0x11b))/0x4+-parseInt(_0x80fe1c(0x11c))/0x5+parseInt(_0x80fe1c(0x117))/0x6+parseInt(_0x80fe1c(0x116))/0x7+-parseInt(_0x80fe1c(0x121))/0x8*(-parseInt(_0x80fe1c(0x124))/0x9);if(_0x1eb39b===_0x310c44)break;else _0x157b7e['push'](_0x157b7e['shift']());}catch(_0x596252){_0x157b7e['push'](_0x157b7e['shift']());}}}(a53_0x26ff,0xc94f7));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x1dbfe8){const _0x5ab187=a53_0x318a,_0x2af296=_0x1dbfe8||_0x5ab187(0x118);return join(getCacheDir(),_0x5ab187(0x11a)+_0x2af296+'.json');}function a53_0x318a(_0xf7d48c,_0x50914c){_0xf7d48c=_0xf7d48c-0x116;const _0x26ff98=a53_0x26ff();let _0x318a92=_0x26ff98[_0xf7d48c];return _0x318a92;}export function loadCachedUsers(_0x7da47d){const _0x581caa=a53_0x318a,_0x5d5779=getCacheFilePath(_0x7da47d);if(!existsSync(_0x5d5779))return null;try{const _0x56082d=readFileSync(_0x5d5779,_0x581caa(0x120)),_0x201ff1=JSON[_0x581caa(0x11d)](_0x56082d);return _0x201ff1[_0x581caa(0x11e)];}catch{return null;}}export function saveCachedUsers(_0x59324e,_0x25c846){const _0x3fda1a=a53_0x318a,_0x302171=getCacheDir();!existsSync(_0x302171)&&mkdirSync(_0x302171,{'recursive':!![]});const _0x19720f=getCacheFilePath(_0x59324e),_0x420479={'users':_0x25c846,'cachedAt':Date['now']()};writeFileSync(_0x19720f,JSON[_0x3fda1a(0x119)](_0x420479,null,0x2),'utf-8');}function a53_0x26ff(){const _0x338b06=['stringify','users-','4984472hohmBH','5671020DZzDRA','parse','users','3522714DHcRBZ','utf-8','129848jLFMYA','2YWZJHH','1243444NGaMhR','2151dbVCsp','1787142uBinCC','8928336hByHyW','default'];a53_0x26ff=function(){return _0x338b06;};return a53_0x26ff();}export function clearUserCache(_0x36d6a9){const _0x46d7a9=getCacheFilePath(_0x36d6a9);if(existsSync(_0x46d7a9))try{unlinkSync(_0x46d7a9);}catch{}}
1
+ (function(_0x3419b6,_0x3d68aa){const _0x12ea94=a53_0x35c2,_0x20dede=_0x3419b6();while(!![]){try{const _0x540f2b=-parseInt(_0x12ea94(0x136))/0x1*(parseInt(_0x12ea94(0x12b))/0x2)+-parseInt(_0x12ea94(0x131))/0x3*(-parseInt(_0x12ea94(0x134))/0x4)+-parseInt(_0x12ea94(0x135))/0x5+-parseInt(_0x12ea94(0x12c))/0x6+-parseInt(_0x12ea94(0x133))/0x7*(-parseInt(_0x12ea94(0x127))/0x8)+parseInt(_0x12ea94(0x12f))/0x9*(-parseInt(_0x12ea94(0x12d))/0xa)+parseInt(_0x12ea94(0x130))/0xb*(parseInt(_0x12ea94(0x128))/0xc);if(_0x540f2b===_0x3d68aa)break;else _0x20dede['push'](_0x20dede['shift']());}catch(_0x19704e){_0x20dede['push'](_0x20dede['shift']());}}}(a53_0x4bbc,0xa3b5c));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function a53_0x4bbc(){const _0x452785=['129800LcAqPC','12MrjBGc','now','utf-8','2639354VfSxat','7297800iisrPW','3639710AjOmBl','parse','18siJdeu','38099534dIziGY','1881rEKIJY','stringify','329NWQlcC','2324UmEWEq','3279905WJpiaW','1EqjxVt','default'];a53_0x4bbc=function(){return _0x452785;};return a53_0x4bbc();}function getCacheFilePath(_0x4c4a1d){const _0x491b1d=a53_0x35c2,_0x32c987=_0x4c4a1d||_0x491b1d(0x137);return join(getCacheDir(),'users-'+_0x32c987+'.json');}function a53_0x35c2(_0xcd03e1,_0x167599){_0xcd03e1=_0xcd03e1-0x127;const _0x4bbcab=a53_0x4bbc();let _0x35c254=_0x4bbcab[_0xcd03e1];return _0x35c254;}export function loadCachedUsers(_0x43cd71){const _0x5eb7b6=a53_0x35c2,_0x3c8998=getCacheFilePath(_0x43cd71);if(!existsSync(_0x3c8998))return null;try{const _0x7c0543=readFileSync(_0x3c8998,_0x5eb7b6(0x12a)),_0x2c53c7=JSON[_0x5eb7b6(0x12e)](_0x7c0543);return _0x2c53c7['users'];}catch{return null;}}export function saveCachedUsers(_0x35faf6,_0x323ffa){const _0x52f3af=a53_0x35c2,_0x2a9e9f=getCacheDir();!existsSync(_0x2a9e9f)&&mkdirSync(_0x2a9e9f,{'recursive':!![]});const _0x1ec9b6=getCacheFilePath(_0x35faf6),_0x465915={'users':_0x323ffa,'cachedAt':Date[_0x52f3af(0x129)]()};writeFileSync(_0x1ec9b6,JSON[_0x52f3af(0x132)](_0x465915,null,0x2),'utf-8');}export function clearUserCache(_0x1f8575){const _0x13ce02=getCacheFilePath(_0x1f8575);if(existsSync(_0x13ce02))try{unlinkSync(_0x13ce02);}catch{}}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x403d87,_0x37c606){var _0x1ee6df=a54_0x51b1,_0x1b32de=_0x403d87();while(!![]){try{var _0x269c70=-parseInt(_0x1ee6df(0x185))/0x1*(parseInt(_0x1ee6df(0x184))/0x2)+parseInt(_0x1ee6df(0x18a))/0x3+parseInt(_0x1ee6df(0x187))/0x4*(-parseInt(_0x1ee6df(0x189))/0x5)+-parseInt(_0x1ee6df(0x182))/0x6+-parseInt(_0x1ee6df(0x188))/0x7+-parseInt(_0x1ee6df(0x183))/0x8+parseInt(_0x1ee6df(0x181))/0x9*(parseInt(_0x1ee6df(0x186))/0xa);if(_0x269c70===_0x37c606)break;else _0x1b32de['push'](_0x1b32de['shift']());}catch(_0x5c63f6){_0x1b32de['push'](_0x1b32de['shift']());}}}(a54_0x5e3b,0xdbadb));export*from'./types/index.js';export*from'./core/config.js';function a54_0x5e3b(){var _0x32b7f9=['2juqduE','10PyYUXS','8176PuyLfW','8517684WAPUit','2260bdRCUe','3452802UMZAFY','33225219xAcWbL','2479548dXoJeO','5465456HBxppI','705682KeNccB'];a54_0x5e3b=function(){return _0x32b7f9;};return a54_0x5e3b();}export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-api-client.js';export{TrinoApiClient}from'./client/trino-api-client.js';export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';function a54_0x51b1(_0x3b8cb7,_0x3acb30){_0x3b8cb7=_0x3b8cb7-0x181;var _0x5e3be6=a54_0x5e3b();var _0x51b10b=_0x5e3be6[_0x3b8cb7];return _0x51b10b;}export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x1058b4,_0x322e6a){var _0x3b237e=a54_0x5ccc,_0x2e3391=_0x1058b4();while(!![]){try{var _0x1a592e=parseInt(_0x3b237e(0x161))/0x1*(-parseInt(_0x3b237e(0x15a))/0x2)+-parseInt(_0x3b237e(0x160))/0x3+parseInt(_0x3b237e(0x15e))/0x4+-parseInt(_0x3b237e(0x15b))/0x5*(parseInt(_0x3b237e(0x15f))/0x6)+parseInt(_0x3b237e(0x159))/0x7+-parseInt(_0x3b237e(0x158))/0x8+-parseInt(_0x3b237e(0x15d))/0x9*(-parseInt(_0x3b237e(0x15c))/0xa);if(_0x1a592e===_0x322e6a)break;else _0x2e3391['push'](_0x2e3391['shift']());}catch(_0x501581){_0x2e3391['push'](_0x2e3391['shift']());}}}(a54_0x2e0b,0xb15f9));export*from'./types/index.js';export*from'./core/config.js';function a54_0x2e0b(){var _0x522cee=['25ZNHonz','84790wWoShv','3447kOiPKd','986148noxFAu','1049778JceKZL','3912012uLDGFc','18229ocjGMU','9572488xsTHZH','8976660dPwsSt','74orONkD'];a54_0x2e0b=function(){return _0x522cee;};return a54_0x2e0b();}export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-api-client.js';export{TrinoApiClient}from'./client/trino-api-client.js';export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';function a54_0x5ccc(_0x128c41,_0x5109bb){_0x128c41=_0x128c41-0x158;var _0x2e0b59=a54_0x2e0b();var _0x5ccc63=_0x2e0b59[_0x128c41];return _0x5ccc63;}export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';