@treasuredata/tdx 2026.3.9 → 2026.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/auth-login-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.d.ts.map +1 -1
  55. package/dist/commands/workflow-command.js +1 -1
  56. package/dist/commands/workflow-command.js.map +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/utils.js +1 -1
  78. package/dist/proxy/claude-usage-tracker.js +1 -1
  79. package/dist/proxy/passthrough-server.js +1 -1
  80. package/dist/proxy/sse-usage-parser.js +1 -1
  81. package/dist/sdk/agent/agent-config.js +1 -1
  82. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  83. package/dist/sdk/agent/agent-yaml.js +1 -1
  84. package/dist/sdk/agent/test/evaluator.js +1 -1
  85. package/dist/sdk/agent/test/executor.js +1 -1
  86. package/dist/sdk/agent/test/index.js +1 -1
  87. package/dist/sdk/agent/test/output.js +1 -1
  88. package/dist/sdk/agent/test/parser.js +1 -1
  89. package/dist/sdk/agent/tool-target-registry.js +1 -1
  90. package/dist/sdk/api.js +1 -1
  91. package/dist/sdk/client/cdp-api-client.js +1 -1
  92. package/dist/sdk/client/delivery-api-client.js +1 -1
  93. package/dist/sdk/client/endpoints.js +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/oauth-refresh.js +1 -1
  98. package/dist/sdk/client/rate-limiter.js +1 -1
  99. package/dist/sdk/client/td-api-client.js +1 -1
  100. package/dist/sdk/client/trino-api-client.js +1 -1
  101. package/dist/sdk/client/workflow-client.js +1 -1
  102. package/dist/sdk/connection-validator.js +1 -1
  103. package/dist/sdk/connection.js +1 -1
  104. package/dist/sdk/delivery.js +1 -1
  105. package/dist/sdk/engage/campaign-pull.js +1 -1
  106. package/dist/sdk/engage/campaign-push.js +1 -1
  107. package/dist/sdk/engage/campaign-validator.js +1 -1
  108. package/dist/sdk/engage/campaign-yaml.js +1 -1
  109. package/dist/sdk/engage/template-pull.js +1 -1
  110. package/dist/sdk/engage/template-push.js +1 -1
  111. package/dist/sdk/engage/template-validator.js +1 -1
  112. package/dist/sdk/engage/template-yaml.js +1 -1
  113. package/dist/sdk/engage/types/campaign-def.js +1 -1
  114. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  115. package/dist/sdk/engage/types/template-schema.js +1 -1
  116. package/dist/sdk/engage.js +1 -1
  117. package/dist/sdk/errors.d.ts +2 -0
  118. package/dist/sdk/errors.d.ts.map +1 -1
  119. package/dist/sdk/errors.js +1 -1
  120. package/dist/sdk/errors.js.map +1 -1
  121. package/dist/sdk/index.js +1 -1
  122. package/dist/sdk/io/index.js +1 -1
  123. package/dist/sdk/io/node-filesystem.js +1 -1
  124. package/dist/sdk/job.js +1 -1
  125. package/dist/sdk/journey.js +1 -1
  126. package/dist/sdk/llm/chat-cache.js +1 -1
  127. package/dist/sdk/llm/index.js +1 -1
  128. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  129. package/dist/sdk/llm/model-factors.js +1 -1
  130. package/dist/sdk/personalization.js +1 -1
  131. package/dist/sdk/query/index.js +1 -1
  132. package/dist/sdk/query/sql-parser.js +1 -1
  133. package/dist/sdk/realtime.js +1 -1
  134. package/dist/sdk/schedule.js +1 -1
  135. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  136. package/dist/sdk/segment/fields-display.js +1 -1
  137. package/dist/sdk/segment/file-discovery.js +1 -1
  138. package/dist/sdk/segment/journey-utils.js +1 -1
  139. package/dist/sdk/segment/journey-validator.js +1 -1
  140. package/dist/sdk/segment/journey-yaml.js +1 -1
  141. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  142. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/pull-workflow.js +1 -1
  144. package/dist/sdk/segment/push-recovery.js +1 -1
  145. package/dist/sdk/segment/push-workflow.js +1 -1
  146. package/dist/sdk/segment/resolution-context.js +1 -1
  147. package/dist/sdk/segment/segment-path-parser.js +1 -1
  148. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  149. package/dist/sdk/segment/segment-validator.js +1 -1
  150. package/dist/sdk/segment/target-resolution.js +1 -1
  151. package/dist/sdk/segment/tdx-config.js +1 -1
  152. package/dist/sdk/segment/types/activation-schema.js +1 -1
  153. package/dist/sdk/segment/types/journey-def.js +1 -1
  154. package/dist/sdk/segment/types/journey-schema.js +1 -1
  155. package/dist/sdk/segment/types/segment-def.js +1 -1
  156. package/dist/sdk/segment/types/segment-schema.js +1 -1
  157. package/dist/sdk/segment/validate-files.js +1 -1
  158. package/dist/sdk/segment/yaml-validator.js +1 -1
  159. package/dist/sdk/segment.js +1 -1
  160. package/dist/sdk/types/index.js +1 -1
  161. package/dist/sdk/types/progress.js +1 -1
  162. package/dist/sdk/user.js +1 -1
  163. package/dist/sdk/util/format-detector.js +1 -1
  164. package/dist/sdk/util/formatters.js +1 -1
  165. package/dist/sdk/util/index.js +1 -1
  166. package/dist/sdk/util/paginate.js +1 -1
  167. package/dist/sdk/util/tree-formatter.js +1 -1
  168. package/dist/sdk/workflow/archive-validation.js +1 -1
  169. package/dist/sdk/workflow/clone-workflow.js +1 -1
  170. package/dist/sdk/workflow/index.d.ts +12 -0
  171. package/dist/sdk/workflow/index.d.ts.map +1 -1
  172. package/dist/sdk/workflow/index.js +1 -1
  173. package/dist/sdk/workflow/index.js.map +1 -1
  174. package/dist/sdk/workflow/pull-workflow.js +1 -1
  175. package/dist/sdk/workflow/push-workflow.js +1 -1
  176. package/dist/sdk/workflow/tdx-config.js +1 -1
  177. package/dist/sdk/workflow/workflow-utils.js +1 -1
  178. package/dist/test-utils/command-runner.js +1 -1
  179. package/dist/test-utils/factories.js +1 -1
  180. package/dist/test-utils/fixtures.js +1 -1
  181. package/dist/test-utils/http-mock.js +1 -1
  182. package/dist/test-utils/index.js +1 -1
  183. package/dist/utils/async.js +1 -1
  184. package/dist/utils/colors.js +1 -1
  185. package/dist/utils/diff.js +1 -1
  186. package/dist/utils/file-permissions.js +1 -1
  187. package/dist/utils/file-reader.js +1 -1
  188. package/dist/utils/github-releases.js +1 -1
  189. package/dist/utils/global-cache.js +1 -1
  190. package/dist/utils/json-loader.js +1 -1
  191. package/dist/utils/local-cache.js +1 -1
  192. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  193. package/dist/utils/logger/formatters/index.js +1 -1
  194. package/dist/utils/logger/handlers/console-handler.js +1 -1
  195. package/dist/utils/logger/handlers/file-handler.js +1 -1
  196. package/dist/utils/logger/handlers/index.js +1 -1
  197. package/dist/utils/logger/handlers/null-handler.js +1 -1
  198. package/dist/utils/logger/index.js +1 -1
  199. package/dist/utils/logger/logger.js +1 -1
  200. package/dist/utils/logger/types.js +1 -1
  201. package/dist/utils/option-validation.js +1 -1
  202. package/dist/utils/process.js +1 -1
  203. package/dist/utils/prompt.js +1 -1
  204. package/dist/utils/spinner.js +1 -1
  205. package/dist/utils/sse-parser.js +1 -1
  206. package/dist/utils/string-utils.js +1 -1
  207. package/dist/utils/table-ref-parser.js +1 -1
  208. package/dist/utils/tdx-logger.js +1 -1
  209. package/dist/utils/version-check.js +1 -1
  210. package/package.json +1 -1
@@ -1 +1 @@
1
- function a56_0x253c(_0x240c9b,_0x715500){_0x240c9b=_0x240c9b-0x124;const _0x36f3a5=a56_0x36f3();let _0x253c72=_0x36f3a5[_0x240c9b];return _0x253c72;}const a56_0x38e31b=a56_0x253c;(function(_0x39260a,_0x18d243){const _0x4824c6=a56_0x253c,_0x5b4cd4=_0x39260a();while(!![]){try{const _0x39b094=-parseInt(_0x4824c6(0x12a))/0x1*(-parseInt(_0x4824c6(0x124))/0x2)+-parseInt(_0x4824c6(0x12c))/0x3*(parseInt(_0x4824c6(0x13e))/0x4)+-parseInt(_0x4824c6(0x12b))/0x5*(-parseInt(_0x4824c6(0x139))/0x6)+parseInt(_0x4824c6(0x137))/0x7+parseInt(_0x4824c6(0x12d))/0x8*(-parseInt(_0x4824c6(0x13f))/0x9)+-parseInt(_0x4824c6(0x13a))/0xa*(-parseInt(_0x4824c6(0x125))/0xb)+parseInt(_0x4824c6(0x12f))/0xc*(-parseInt(_0x4824c6(0x13c))/0xd);if(_0x39b094===_0x18d243)break;else _0x5b4cd4['push'](_0x5b4cd4['shift']());}catch(_0x311dff){_0x5b4cd4['push'](_0x5b4cd4['shift']());}}}(a56_0x36f3,0x8d6a6));import a56_0x5cc0a0 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;function a56_0x36f3(){const _0x26f388=['us01','248044PMGxPn','2297313qSyHVk','log','push','2HzrqeD','1553651LhQzhD','customSite','other','test','Enter\x20custom\x20site','1048618GgEIzw','203955xZyRIq','45KkCZEm','8kMVUrl','select','12gUaCQV','Enter\x20site\x20name:','trim','text','us\x20\x20\x20-\x20United\x20States','findIndex','site','Cancelled','4965198szVeji','Site\x20name\x20cannot\x20be\x20empty','102tDtYhV','70ozEYFu','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','21780278BwSWUm'];a56_0x36f3=function(){return _0x26f388;};return a56_0x36f3();}export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x749eb,_0x1e5747){if(_0x749eb===undefined)return _0x1e5747;if(typeof _0x749eb==='number')return _0x749eb;return parseInt(_0x749eb,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a56_0x38e31b(0x133),'value':a56_0x38e31b(0x13d)},{'title':'jp\x20\x20\x20-\x20Japan','value':'ap01'},{'title':'eu\x20\x20\x20-\x20Europe','value':'eu01'},{'title':'ap02\x20-\x20Korea','value':'ap02'}];export function buildSiteChoices(_0x4e0768){const _0x4d778f=a56_0x38e31b,_0xba8b0b=[...STANDARD_SITE_CHOICES];let _0x16eb59=_0xba8b0b[_0x4d778f(0x134)](_0x539ae7=>_0x539ae7['value']===_0x4e0768);return _0x16eb59===-0x1&&_0x4e0768!==_0x4d778f(0x13d)&&(_0xba8b0b['push']({'title':_0x4e0768,'value':_0x4e0768}),_0x16eb59=_0xba8b0b['length']-0x1),_0xba8b0b[_0x4d778f(0x141)]({'title':_0x4d778f(0x129),'value':'other'}),{'choices':_0xba8b0b,'initialIndex':_0x16eb59>=0x0?_0x16eb59:0x0};}export async function promptSiteSelection(_0x571b8a,_0x290a34,_0x1c6764=a56_0x38e31b(0x136)){const _0x18593e=a56_0x38e31b,{choices:_0x4784b7,initialIndex:_0x2212cc}=buildSiteChoices(_0x571b8a),_0x2b1dc5=_0x290a34?_0x18593e(0x13b)+_0x290a34+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x10f474=await a56_0x5cc0a0({'type':_0x18593e(0x12e),'name':_0x18593e(0x135),'message':_0x2b1dc5,'choices':_0x4784b7,'initial':_0x2212cc});if(!_0x10f474[_0x18593e(0x135)])return console[_0x18593e(0x140)]('\x0a'+_0x1c6764),null;if(_0x10f474['site']!==_0x18593e(0x127))return _0x10f474[_0x18593e(0x135)];const _0x56bc6c=await a56_0x5cc0a0({'type':_0x18593e(0x132),'name':_0x18593e(0x126),'message':_0x18593e(0x130),'initial':'us01','validate':_0x282d14=>{const _0x176381=_0x18593e;if(!_0x282d14||!_0x282d14['trim']())return _0x176381(0x138);if(!/^[a-z0-9-]+$/[_0x176381(0x128)](_0x282d14[_0x176381(0x131)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x56bc6c['customSite'])return console[_0x18593e(0x140)]('\x0a'+_0x1c6764),null;return _0x56bc6c['customSite'];}
1
+ const a56_0x214415=a56_0x30bb;function a56_0x30bb(_0x2e8279,_0x190b04){_0x2e8279=_0x2e8279-0x9d;const _0x5573bb=a56_0x5573();let _0x30bbce=_0x5573bb[_0x2e8279];return _0x30bbce;}(function(_0x221815,_0x283d75){const _0x2dffcb=a56_0x30bb,_0x2aaf70=_0x221815();while(!![]){try{const _0x4deb39=-parseInt(_0x2dffcb(0xa7))/0x1+parseInt(_0x2dffcb(0xb3))/0x2*(parseInt(_0x2dffcb(0xb8))/0x3)+-parseInt(_0x2dffcb(0xb0))/0x4*(-parseInt(_0x2dffcb(0xac))/0x5)+parseInt(_0x2dffcb(0x9d))/0x6+-parseInt(_0x2dffcb(0xb7))/0x7*(-parseInt(_0x2dffcb(0xc1))/0x8)+parseInt(_0x2dffcb(0xb6))/0x9*(parseInt(_0x2dffcb(0xa4))/0xa)+-parseInt(_0x2dffcb(0xa6))/0xb;if(_0x4deb39===_0x283d75)break;else _0x2aaf70['push'](_0x2aaf70['shift']());}catch(_0x3d0b9a){_0x2aaf70['push'](_0x2aaf70['shift']());}}}(a56_0x5573,0xa9cae));import a56_0x30ea99 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0xefda07,_0x3749a4){const _0x3507f1=a56_0x30bb;if(_0xefda07===undefined)return _0x3749a4;if(typeof _0xefda07===_0x3507f1(0xa9))return _0xefda07;return parseInt(_0xefda07,0xa);}function a56_0x5573(){const _0x4b68e6=['12CfKqIu','us01','value','site','ap02','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','us\x20\x20\x20-\x20United\x20States','findIndex','length','40qRGgGL','3976182dgwBns','Enter\x20site\x20name:','other','jp\x20\x20\x20-\x20Japan','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Enter\x20custom\x20site','customSite','30CrNXET','trim','8199235hmZiXG','1151995KfIfHb','Select\x20your\x20Treasure\x20Data\x20site:','number','ap02\x20-\x20Korea','Site\x20name\x20cannot\x20be\x20empty','1310AoXSkv','Cancelled','test','eu\x20\x20\x20-\x20Europe','5864ShPRfP','eu01','text','454404kyMbDB','push','log','1763154lnQmZB','69349JgplgD'];a56_0x5573=function(){return _0x4b68e6;};return a56_0x5573();}export const STANDARD_SITE_CHOICES=[{'title':a56_0x214415(0xbe),'value':a56_0x214415(0xb9)},{'title':a56_0x214415(0xa0),'value':'ap01'},{'title':a56_0x214415(0xaf),'value':a56_0x214415(0xb1)},{'title':a56_0x214415(0xaa),'value':a56_0x214415(0xbc)}];export function buildSiteChoices(_0x44fe1b){const _0xe041d6=a56_0x214415,_0x38dee9=[...STANDARD_SITE_CHOICES];let _0x306546=_0x38dee9[_0xe041d6(0xbf)](_0x4a1f73=>_0x4a1f73[_0xe041d6(0xba)]===_0x44fe1b);return _0x306546===-0x1&&_0x44fe1b!==_0xe041d6(0xb9)&&(_0x38dee9[_0xe041d6(0xb4)]({'title':_0x44fe1b,'value':_0x44fe1b}),_0x306546=_0x38dee9[_0xe041d6(0xc0)]-0x1),_0x38dee9['push']({'title':_0xe041d6(0xa2),'value':_0xe041d6(0x9f)}),{'choices':_0x38dee9,'initialIndex':_0x306546>=0x0?_0x306546:0x0};}export async function promptSiteSelection(_0x5c10e8,_0xb4018c,_0x4b91ca=a56_0x214415(0xad)){const _0x43bc3a=a56_0x214415,{choices:_0x1feabb,initialIndex:_0x1e88d4}=buildSiteChoices(_0x5c10e8),_0x5a3bbd=_0xb4018c?_0x43bc3a(0xbd)+_0xb4018c+'):':_0x43bc3a(0xa8),_0x5a6669=await a56_0x30ea99({'type':'select','name':_0x43bc3a(0xbb),'message':_0x5a3bbd,'choices':_0x1feabb,'initial':_0x1e88d4});if(!_0x5a6669[_0x43bc3a(0xbb)])return console['log']('\x0a'+_0x4b91ca),null;if(_0x5a6669[_0x43bc3a(0xbb)]!==_0x43bc3a(0x9f))return _0x5a6669[_0x43bc3a(0xbb)];const _0x4e0724=await a56_0x30ea99({'type':_0x43bc3a(0xb2),'name':_0x43bc3a(0xa3),'message':_0x43bc3a(0x9e),'initial':'us01','validate':_0x1f1f5e=>{const _0x2a03ca=_0x43bc3a;if(!_0x1f1f5e||!_0x1f1f5e[_0x2a03ca(0xa5)]())return _0x2a03ca(0xab);if(!/^[a-z0-9-]+$/[_0x2a03ca(0xae)](_0x1f1f5e[_0x2a03ca(0xa5)]()))return _0x2a03ca(0xa1);return!![];}});if(!_0x4e0724['customSite'])return console[_0x43bc3a(0xb5)]('\x0a'+_0x4b91ca),null;return _0x4e0724[_0x43bc3a(0xa3)];}
@@ -1 +1 @@
1
- function a57_0x2438(){const _0x1d783f=['loadedAt','18fridMc','3qVinRp','now','2314989GzztwV','get','98180InLTHp','2571836dzHPbG','8sesrQi','__default_site__','delete','901855VUqkSf','12369750lXnKjh','apiKey','__default_profile__','2700068ArlCsO','set','clear','56622EEGhnE'];a57_0x2438=function(){return _0x1d783f;};return a57_0x2438();}(function(_0x10c3d8,_0x599028){const _0x3fdfd9=a57_0x2b45,_0x532dad=_0x10c3d8();while(!![]){try{const _0x136838=-parseInt(_0x3fdfd9(0xd5))/0x1+-parseInt(_0x3fdfd9(0xce))/0x2+parseInt(_0x3fdfd9(0xd1))/0x3*(-parseInt(_0x3fdfd9(0xd6))/0x4)+-parseInt(_0x3fdfd9(0xda))/0x5*(-parseInt(_0x3fdfd9(0xd0))/0x6)+-parseInt(_0x3fdfd9(0xcb))/0x7+-parseInt(_0x3fdfd9(0xd7))/0x8*(parseInt(_0x3fdfd9(0xd3))/0x9)+parseInt(_0x3fdfd9(0xc8))/0xa;if(_0x136838===_0x599028)break;else _0x532dad['push'](_0x532dad['shift']());}catch(_0x1e9e47){_0x532dad['push'](_0x532dad['shift']());}}}(a57_0x2438,0x5947d));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x56cfbc,_0x1a5c00){const _0x5582d9=a57_0x2b45,_0x5139c8=_0x56cfbc||_0x5582d9(0xd8),_0x4fc0a8=_0x1a5c00||_0x5582d9(0xca);return _0x5139c8+':'+_0x4fc0a8;}export function getCachedCredential(_0x10fd32,_0x385f29){const _0x24ced9=a57_0x2b45,_0x421ba9=getCacheKey(_0x10fd32,_0x385f29),_0x2673d0=cache[_0x24ced9(0xd4)](_0x421ba9);if(!_0x2673d0)return null;if(Date[_0x24ced9(0xd2)]()-_0x2673d0[_0x24ced9(0xcf)]>CACHE_TTL_MS)return cache[_0x24ced9(0xd9)](_0x421ba9),null;return _0x2673d0[_0x24ced9(0xc9)];}export function setCachedCredential(_0xc68cc1,_0xa14a42,_0xfab971){const _0x164d11=a57_0x2b45,_0x583f98=getCacheKey(_0xa14a42,_0xfab971);cache[_0x164d11(0xcc)](_0x583f98,{'apiKey':_0xc68cc1,'loadedAt':Date[_0x164d11(0xd2)]()});}function a57_0x2b45(_0x11b09a,_0x46e0b8){_0x11b09a=_0x11b09a-0xc8;const _0x243824=a57_0x2438();let _0x2b451c=_0x243824[_0x11b09a];return _0x2b451c;}export function clearCredentialCache(){const _0x1727d2=a57_0x2b45;cache[_0x1727d2(0xcd)]();}export function clearCachedCredential(_0x3883c9,_0x2de807){const _0x2b8169=a57_0x2b45,_0x11e34a=getCacheKey(_0x3883c9,_0x2de807);cache[_0x2b8169(0xd9)](_0x11e34a);}
1
+ (function(_0xf88106,_0x29f05b){const _0x3ffc5c=a57_0x43a3,_0x92c3dd=_0xf88106();while(!![]){try{const _0x483dc4=-parseInt(_0x3ffc5c(0x115))/0x1*(parseInt(_0x3ffc5c(0x114))/0x2)+-parseInt(_0x3ffc5c(0x116))/0x3*(parseInt(_0x3ffc5c(0x10b))/0x4)+-parseInt(_0x3ffc5c(0x109))/0x5+parseInt(_0x3ffc5c(0x112))/0x6*(-parseInt(_0x3ffc5c(0x10f))/0x7)+parseInt(_0x3ffc5c(0x110))/0x8+parseInt(_0x3ffc5c(0x113))/0x9+parseInt(_0x3ffc5c(0x10d))/0xa;if(_0x483dc4===_0x29f05b)break;else _0x92c3dd['push'](_0x92c3dd['shift']());}catch(_0xad294){_0x92c3dd['push'](_0x92c3dd['shift']());}}}(a57_0x2cd7,0x82e32));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3bbc25,_0x5ce62d){const _0x1cf0c0=a57_0x43a3,_0x4eee0a=_0x3bbc25||'__default_site__',_0x304134=_0x5ce62d||_0x1cf0c0(0x10a);return _0x4eee0a+':'+_0x304134;}export function getCachedCredential(_0x569b1f,_0x309662){const _0x21473a=a57_0x43a3,_0x547c6a=getCacheKey(_0x569b1f,_0x309662),_0x493cc6=cache[_0x21473a(0x105)](_0x547c6a);if(!_0x493cc6)return null;if(Date[_0x21473a(0x107)]()-_0x493cc6[_0x21473a(0x108)]>CACHE_TTL_MS)return cache[_0x21473a(0x111)](_0x547c6a),null;return _0x493cc6[_0x21473a(0x10e)];}export function setCachedCredential(_0x344921,_0x361025,_0x5b2948){const _0x1ca890=a57_0x43a3,_0x55656d=getCacheKey(_0x361025,_0x5b2948);cache[_0x1ca890(0x10c)](_0x55656d,{'apiKey':_0x344921,'loadedAt':Date[_0x1ca890(0x107)]()});}function a57_0x43a3(_0x4b8279,_0x3ff7f8){_0x4b8279=_0x4b8279-0x105;const _0x2cd7c3=a57_0x2cd7();let _0x43a3fe=_0x2cd7c3[_0x4b8279];return _0x43a3fe;}function a57_0x2cd7(){const _0x33a150=['delete','5979612iLOyRJ','2273697YpixSs','245122nFeEha','5ijcoRS','1282614vzPaPQ','get','clear','now','loadedAt','656155wOIuow','__default_profile__','4dzfXDx','set','18268720moQyBp','apiKey','7WuwuMi','4998280LKDJbr'];a57_0x2cd7=function(){return _0x33a150;};return a57_0x2cd7();}export function clearCredentialCache(){const _0x549433=a57_0x43a3;cache[_0x549433(0x106)]();}export function clearCachedCredential(_0x3d5921,_0x305f92){const _0x3f97ab=getCacheKey(_0x3d5921,_0x305f92);cache['delete'](_0x3f97ab);}
@@ -1 +1 @@
1
- const a58_0x19bb67=a58_0x47ac;(function(_0x3ebc33,_0x2f44db){const _0x440b3c=a58_0x47ac,_0x5801cb=_0x3ebc33();while(!![]){try{const _0x101ad7=parseInt(_0x440b3c(0x1bd))/0x1*(parseInt(_0x440b3c(0x1c9))/0x2)+-parseInt(_0x440b3c(0x1c2))/0x3+parseInt(_0x440b3c(0x1c8))/0x4+parseInt(_0x440b3c(0x1cd))/0x5+-parseInt(_0x440b3c(0x1b4))/0x6*(-parseInt(_0x440b3c(0x1aa))/0x7)+-parseInt(_0x440b3c(0x1b8))/0x8*(parseInt(_0x440b3c(0x1b1))/0x9)+-parseInt(_0x440b3c(0x1ed))/0xa*(parseInt(_0x440b3c(0x1bc))/0xb);if(_0x101ad7===_0x2f44db)break;else _0x5801cb['push'](_0x5801cb['shift']());}catch(_0x21ceea){_0x5801cb['push'](_0x5801cb['shift']());}}}(a58_0x3ee5,0x75cc4));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a58_0x3ee5(){const _0x4c81cb=['activeProfile','segmentPath','CLI\x20flag:\x20--','2402424AOqDcJ','809054kGMGll','env','accessToken','sessions','1229370FeWXPq','display','profile','proxy','llmAgent','session','llmProject','Session','database','existsSync','parentSegment','global','parse','config','configFiles','createAsync','tdx.json','displayWithSources','assign','profiles','injectIntoOptions','default','join','parent_segment','bold','site','(using\x20session:\x20','none','verbose','INFO','(session:\x20','utf-8','66650zWpKcx','getSource','apiKey','logLevel','Global\x20Credentials','workflowProject','us01','loadGlobalConfig','Profile\x20Credentials','not\x20set','sessionId','project','llm_project','7kAMoOU','cliFlags','[configuration\x20files]','workflow_project','getParameters','string','dim','72tNWJZP','segment_path','layers','2833026oBWGPf','Global','Project','profileSource','364088aNdVrz','cyan','access_token','log','1023mCOesr','1VnpASf','.env','llm_agent','globalCredentials','(active)','770235JQnTYo','.json','[context]'];a58_0x3ee5=function(){return _0x4c81cb;};return a58_0x3ee5();}import{getOAuthTokens}from'./oauth-keychain.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a58_0x47ac(_0x5e5dec,_0x3b0d9b){_0x5e5dec=_0x5e5dec-0x1a1;const _0x3ee576=a58_0x3ee5();let _0x47acad=_0x3ee576[_0x5e5dec];return _0x47acad;}import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a58_0x408153 from'node:fs';import*as a58_0x2654bc from'node:path';import a58_0x2a0c05 from'chalk';export class GlobalContext{[a58_0x19bb67(0x1e6)];[a58_0x19bb67(0x1d5)];[a58_0x19bb67(0x1e4)];[a58_0x19bb67(0x1b2)];[a58_0x19bb67(0x1a9)];['llm_agent'];[a58_0x19bb67(0x1ad)];['apiKey'];[a58_0x19bb67(0x1cb)];[a58_0x19bb67(0x1d0)];['verbose'];[a58_0x19bb67(0x1f0)];[a58_0x19bb67(0x1cf)];[a58_0x19bb67(0x1b7)]=null;[a58_0x19bb67(0x1b3)];['activeProfile'];[a58_0x19bb67(0x1a7)];[a58_0x19bb67(0x1db)];constructor(_0x3605bb){const _0xdadc8b=a58_0x19bb67;this['sessionId']=getSessionID(_0x3605bb['session']);const _0x64706f=loadSessionContext(_0x3605bb['session']),_0x34cb3b=loadProjectConfig(),_0x2573b7=this[_0xdadc8b(0x1a4)]();if(_0x3605bb[_0xdadc8b(0x1cf)])this[_0xdadc8b(0x1c5)]=_0x3605bb['profile'],this['profileSource']='cli';else{if(_0x64706f?.[_0xdadc8b(0x1cf)])this[_0xdadc8b(0x1c5)]=_0x64706f[_0xdadc8b(0x1cf)],this[_0xdadc8b(0x1b7)]='session';else{if(_0x2573b7[_0xdadc8b(0x1cf)])this[_0xdadc8b(0x1c5)]=_0x2573b7[_0xdadc8b(0x1cf)],this['profileSource']=_0xdadc8b(0x1da);else process.env.TDX_PROFILE?(this[_0xdadc8b(0x1c5)]=process.env.TDX_PROFILE,this[_0xdadc8b(0x1b7)]=_0xdadc8b(0x1ca)):(this[_0xdadc8b(0x1c5)]=null,this[_0xdadc8b(0x1b7)]=null);}}const _0x1dbe43=this[_0xdadc8b(0x1c5)]?loadProfile(this[_0xdadc8b(0x1c5)]):null,_0x3e143d=_0x15f3a3=>{const _0x662d46=_0xdadc8b;if(!_0x15f3a3)return{};const _0x23ecef=_0x15f3a3,_0x2b7678={};for(const [_0xd246fe,_0x3d9b4f]of Object['entries'](_0x23ecef)){typeof _0x3d9b4f===_0x662d46(0x1af)&&(_0x2b7678[_0xd246fe]=_0x3d9b4f);}return _0x2b7678;},_0x481ff6={},_0x1341cf=(_0x45c4e9,_0x3480e1,_0x43c9a4)=>{const _0x1c5eb0=_0xdadc8b;if(!_0x45c4e9)return![];if(_0x43c9a4&&_0x45c4e9===_0x43c9a4)return![];const _0x2ef735=_0x64706f,_0x479cd9=_0x34cb3b,_0x272440=_0x1dbe43?.[_0x1c5eb0(0x1da)],_0x3a4074=_0x2573b7,_0x1bfbe3=_0x2ef735?.[_0x3480e1],_0x11e926=_0x479cd9?.[_0x3480e1],_0x29b28a=_0x272440?.[_0x3480e1],_0x25feac=_0x3a4074[_0x3480e1];return _0x45c4e9!==_0x1bfbe3&&_0x45c4e9!==_0x11e926&&_0x45c4e9!==_0x29b28a&&_0x45c4e9!==_0x25feac;},_0x708887=[{'optionKey':_0xdadc8b(0x1e6),'contextKey':_0xdadc8b(0x1e6),'defaultValue':_0xdadc8b(0x1a3)},{'optionKey':'database','contextKey':_0xdadc8b(0x1d5)},{'optionKey':_0xdadc8b(0x1d7),'contextKey':'parent_segment'},{'optionKey':_0xdadc8b(0x1d3),'contextKey':'llm_project'},{'optionKey':'llmAgent','contextKey':'llm_agent'},{'optionKey':_0xdadc8b(0x1cf),'contextKey':'profile'}];for(const {optionKey:_0x63393f,contextKey:_0x5f283b,defaultValue:_0x3c9ec8}of _0x708887){const _0x46f709=_0x3605bb[_0x63393f];_0x1341cf(_0x46f709,_0x5f283b,_0x3c9ec8)&&(_0x481ff6[_0x5f283b]=_0x46f709);}this[_0xdadc8b(0x1b3)]={'cliFlags':_0x481ff6,'session':_0x3e143d(_0x64706f),'project':_0x3e143d(_0x34cb3b),'profile':_0x3e143d(_0x1dbe43?.[_0xdadc8b(0x1da)]),'global':_0x3e143d(_0x2573b7)};const _0x5c5ae7={...this[_0xdadc8b(0x1b3)][_0xdadc8b(0x1d8)],...this[_0xdadc8b(0x1b3)][_0xdadc8b(0x1cf)],...this[_0xdadc8b(0x1b3)]['project']};process.env.TDX_SITE&&!this[_0xdadc8b(0x1b3)][_0xdadc8b(0x1d2)]['site']&&!this['layers'][_0xdadc8b(0x1ab)][_0xdadc8b(0x1e6)]&&(_0x5c5ae7[_0xdadc8b(0x1e6)]=process.env.TDX_SITE);Object[_0xdadc8b(0x1df)](_0x5c5ae7,this[_0xdadc8b(0x1b3)][_0xdadc8b(0x1d2)]),Object[_0xdadc8b(0x1df)](_0x5c5ae7,this['layers'][_0xdadc8b(0x1ab)]);const _0x38a8ee=_0x5c5ae7[_0xdadc8b(0x1e6)]||'us01';this[_0xdadc8b(0x1e6)]=resolveSite(_0x38a8ee),this[_0xdadc8b(0x1d5)]=_0x5c5ae7[_0xdadc8b(0x1d5)],this[_0xdadc8b(0x1e4)]=_0x5c5ae7[_0xdadc8b(0x1e4)],this[_0xdadc8b(0x1b2)]=_0x5c5ae7[_0xdadc8b(0x1b2)],this[_0xdadc8b(0x1a9)]=_0x5c5ae7['llm_project'],this[_0xdadc8b(0x1bf)]=_0x5c5ae7[_0xdadc8b(0x1bf)],this[_0xdadc8b(0x1ad)]=_0x5c5ae7[_0xdadc8b(0x1ad)],this[_0xdadc8b(0x1e9)]=_0x3605bb['verbose']||![],this['logLevel']=_0x3605bb[_0xdadc8b(0x1f0)]??LogLevel[_0xdadc8b(0x1ea)],this['profile']=this[_0xdadc8b(0x1c5)]||undefined,this[_0xdadc8b(0x1cb)]=getAccessToken(this[_0xdadc8b(0x1c5)]||undefined),this[_0xdadc8b(0x1ef)]=getAPIKey(this[_0xdadc8b(0x1c5)]||undefined);const _0x30b8e6=typeof _0x2573b7['proxy']===_0xdadc8b(0x1af)?_0x2573b7['proxy']:undefined;this[_0xdadc8b(0x1d0)]=_0x30b8e6||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x21fa4f=getConfigDir(),_0xb0bac8=a58_0x2654bc[_0xdadc8b(0x1e3)](_0x21fa4f,_0xdadc8b(0x1cc),this['sessionId']+_0xdadc8b(0x1c3)),_0x2f6f07=findProjectConfigPath(),_0xc61be9=a58_0x2654bc[_0xdadc8b(0x1e3)](_0x21fa4f,'tdx.json'),_0xc5e48=a58_0x2654bc[_0xdadc8b(0x1e3)](_0x21fa4f,_0xdadc8b(0x1be));let _0x46d841=null,_0xa50584=null;this[_0xdadc8b(0x1c5)]&&(_0x46d841=a58_0x2654bc['join'](_0x21fa4f,_0xdadc8b(0x1e0),this[_0xdadc8b(0x1c5)],'tdx.json'),_0xa50584=a58_0x2654bc['join'](_0x21fa4f,_0xdadc8b(0x1e0),this[_0xdadc8b(0x1c5)],'.env')),this[_0xdadc8b(0x1db)]={'session':a58_0x408153[_0xdadc8b(0x1d6)](_0xb0bac8)?_0xb0bac8:null,'project':_0x2f6f07,'profile':_0x46d841&&a58_0x408153['existsSync'](_0x46d841)?_0x46d841:null,'profileCredentials':_0xa50584&&a58_0x408153[_0xdadc8b(0x1d6)](_0xa50584)?_0xa50584:null,'global':a58_0x408153[_0xdadc8b(0x1d6)](_0xc61be9)?_0xc61be9:null,'globalCredentials':a58_0x408153['existsSync'](_0xc5e48)?_0xc5e48:null};}[a58_0x19bb67(0x1ee)](_0x3d9955,_0x199afe){const _0x3f1293=a58_0x19bb67;if(!_0x199afe)return _0x3f1293(0x1a6);const _0x59c218=_0x199afe;if(this[_0x3f1293(0x1b3)][_0x3f1293(0x1ab)][_0x3d9955]===_0x59c218){if(_0x3d9955===_0x3f1293(0x1e6)&&_0x59c218===_0x3f1293(0x1a3)&&!this[_0x3f1293(0x1b3)][_0x3f1293(0x1d2)][_0x3f1293(0x1e6)]&&!this['layers'][_0x3f1293(0x1a8)][_0x3f1293(0x1e6)]&&!this[_0x3f1293(0x1b3)]['profile'][_0x3f1293(0x1e6)]&&!this['layers'][_0x3f1293(0x1d8)][_0x3f1293(0x1e6)])return'default';return _0x3f1293(0x1c7)+_0x3d9955['replace'](/_/g,'-');}if(this['layers'][_0x3f1293(0x1d2)][_0x3d9955]===_0x59c218)return _0x3f1293(0x1d2);if(this[_0x3f1293(0x1b3)][_0x3f1293(0x1a8)][_0x3d9955]===_0x59c218)return _0x3f1293(0x1a8);if(this[_0x3f1293(0x1b3)][_0x3f1293(0x1cf)][_0x3d9955]===_0x59c218)return'profile:\x20'+this[_0x3f1293(0x1c5)];if(this[_0x3f1293(0x1b3)][_0x3f1293(0x1d8)][_0x3d9955]===_0x59c218)return _0x3f1293(0x1d8);return _0x3f1293(0x1e2);}[a58_0x19bb67(0x1a4)](){const _0x5a1b02=a58_0x19bb67,_0x275a45=a58_0x2654bc['join'](getConfigDir(),_0x5a1b02(0x1dd));if(!a58_0x408153[_0x5a1b02(0x1d6)](_0x275a45))return{};try{const _0x1ab3cd=a58_0x408153['readFileSync'](_0x275a45,_0x5a1b02(0x1ec));return JSON[_0x5a1b02(0x1d9)](_0x1ab3cd);}catch{return{};}}[a58_0x19bb67(0x1e1)](_0x513fcd){const _0x706025=a58_0x19bb67;_0x513fcd['site']=this['site'],!_0x513fcd[_0x706025(0x1d5)]&&this['database']&&(_0x513fcd[_0x706025(0x1d5)]=this['database']),!_0x513fcd[_0x706025(0x1d7)]&&this[_0x706025(0x1e4)]&&(_0x513fcd[_0x706025(0x1d7)]=this[_0x706025(0x1e4)]),!_0x513fcd[_0x706025(0x1c6)]&&this[_0x706025(0x1b2)]&&(_0x513fcd[_0x706025(0x1c6)]=this['segment_path']),!_0x513fcd[_0x706025(0x1d3)]&&this[_0x706025(0x1a9)]&&(_0x513fcd[_0x706025(0x1d3)]=this[_0x706025(0x1a9)]),!_0x513fcd[_0x706025(0x1d1)]&&this[_0x706025(0x1bf)]&&(_0x513fcd[_0x706025(0x1d1)]=this[_0x706025(0x1bf)]),!_0x513fcd['workflowProject']&&this['workflow_project']&&(_0x513fcd[_0x706025(0x1a2)]=this[_0x706025(0x1ad)]);}[a58_0x19bb67(0x1ae)](){const _0xda45b8=a58_0x19bb67;return[{'key':_0xda45b8(0x1e6),'value':this[_0xda45b8(0x1e6)]},{'key':'database','value':this['database']},{'key':_0xda45b8(0x1e4),'value':this[_0xda45b8(0x1e4)]},{'key':_0xda45b8(0x1b2),'value':this['segment_path']},{'key':'llm_project','value':this[_0xda45b8(0x1a9)]},{'key':_0xda45b8(0x1bf),'value':this[_0xda45b8(0x1bf)]},{'key':_0xda45b8(0x1ad),'value':this[_0xda45b8(0x1ad)]},{'key':_0xda45b8(0x1cf),'value':this['activeProfile']||undefined}];}[a58_0x19bb67(0x1ce)](){const _0x1ebb1b=a58_0x19bb67;console[_0x1ebb1b(0x1bb)](a58_0x2a0c05[_0x1ebb1b(0x1e5)](_0x1ebb1b(0x1c4)));for(const {key:_0x5169c7,value:_0xc6eec8}of this[_0x1ebb1b(0x1ae)]()){_0xc6eec8&&console[_0x1ebb1b(0x1bb)](a58_0x2a0c05[_0x1ebb1b(0x1b9)](_0x5169c7)+':\x20'+_0xc6eec8);}}[a58_0x19bb67(0x1de)](){const _0x51db85=a58_0x19bb67;console['log'](a58_0x2a0c05[_0x51db85(0x1e5)](_0x51db85(0x1c4)));for(const {key:_0xad9965,value:_0x562bfc}of this[_0x51db85(0x1ae)]()){if(_0x562bfc){const _0x14233c=_0xad9965===_0x51db85(0x1cf)?_0x51db85(0x1c1):'('+this[_0x51db85(0x1ee)](_0xad9965,_0x562bfc)+')';console[_0x51db85(0x1bb)](a58_0x2a0c05['cyan'](_0xad9965)+':\x20'+_0x562bfc+'\x20'+a58_0x2a0c05[_0x51db85(0x1b0)](_0x14233c));}}console[_0x51db85(0x1bb)]('\x0a'+a58_0x2a0c05[_0x51db85(0x1e5)](_0x51db85(0x1ac)));const _0x499279=[{'label':_0x51db85(0x1d4),'path':this['configFiles'][_0x51db85(0x1d2)],'extra':_0x51db85(0x1eb)+this[_0x51db85(0x1a7)]+')'},{'label':_0x51db85(0x1b6),'path':this[_0x51db85(0x1db)][_0x51db85(0x1a8)]},{'label':'Profile','path':this[_0x51db85(0x1db)]['profile']},{'label':_0x51db85(0x1a5),'path':this[_0x51db85(0x1db)]['profileCredentials']},{'label':_0x51db85(0x1b5),'path':this['configFiles'][_0x51db85(0x1d8)]},{'label':_0x51db85(0x1a1),'path':this[_0x51db85(0x1db)][_0x51db85(0x1c0)]}];for(const {label:_0x55e751,path:_0x31a2e1,extra:_0x12e8f9}of _0x499279){if(_0x31a2e1)console[_0x51db85(0x1bb)](a58_0x2a0c05[_0x51db85(0x1b9)](_0x55e751)+':\x20'+_0x31a2e1+'\x20'+a58_0x2a0c05['green']('✓')+(_0x12e8f9?'\x20'+a58_0x2a0c05[_0x51db85(0x1b0)](_0x12e8f9):''));else{if(_0x55e751==='Session')console['log'](a58_0x2a0c05[_0x51db85(0x1b9)](_0x55e751)+':\x20'+a58_0x2a0c05[_0x51db85(0x1b0)](_0x51db85(0x1e8))+'\x20'+a58_0x2a0c05[_0x51db85(0x1b0)](_0x51db85(0x1e7)+this[_0x51db85(0x1a7)]+')'));else(_0x55e751===_0x51db85(0x1b6)||_0x55e751===_0x51db85(0x1b5))&&console['log'](a58_0x2a0c05['cyan'](_0x55e751)+':\x20'+a58_0x2a0c05[_0x51db85(0x1b0)]('none'));}}}async['resolveAPIKeyAsync'](){const _0x3c2b89=a58_0x19bb67;if(!this[_0x3c2b89(0x1cb)]){const _0x541aa6=await getOAuthTokens(this['activeProfile']||undefined);if(_0x541aa6)return this[_0x3c2b89(0x1cb)]=_0x541aa6[_0x3c2b89(0x1ba)],undefined;}return this[_0x3c2b89(0x1ef)]=await getAPIKeyAsync(this[_0x3c2b89(0x1e6)],this[_0x3c2b89(0x1c5)]||undefined),this['apiKey'];}static async[a58_0x19bb67(0x1dc)](_0x5a0512){const _0x1ef172=new GlobalContext(_0x5a0512);return await _0x1ef172['resolveAPIKeyAsync'](),_0x1ef172;}}
1
+ const a58_0x382f64=a58_0x41eb;(function(_0x4e51b9,_0x2d6744){const _0x2218fa=a58_0x41eb,_0x595da5=_0x4e51b9();while(!![]){try{const _0x2f6b46=-parseInt(_0x2218fa(0x11c))/0x1+parseInt(_0x2218fa(0x118))/0x2+-parseInt(_0x2218fa(0x101))/0x3+-parseInt(_0x2218fa(0x124))/0x4+parseInt(_0x2218fa(0x10e))/0x5*(parseInt(_0x2218fa(0x135))/0x6)+parseInt(_0x2218fa(0x14a))/0x7+parseInt(_0x2218fa(0x12d))/0x8;if(_0x2f6b46===_0x2d6744)break;else _0x595da5['push'](_0x595da5['shift']());}catch(_0x33efc4){_0x595da5['push'](_0x595da5['shift']());}}}(a58_0x2717,0x1a65f));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens}from'./oauth-keychain.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a58_0x102de4 from'node:fs';function a58_0x41eb(_0x20d307,_0x46997d){_0x20d307=_0x20d307-0x101;const _0x2717ce=a58_0x2717();let _0x41ebbb=_0x2717ce[_0x20d307];return _0x41ebbb;}import*as a58_0x268243 from'node:path';function a58_0x2717(){const _0x4ca064=['join','segmentPath','not\x20set','Global\x20Credentials','workflow_project','Profile\x20Credentials','workflowProject','[configuration\x20files]','logLevel','Project','readFileSync','profileCredentials','760fTPrqy','resolveAPIKeyAsync','verbose','display','session','us01','assign','loadGlobalConfig','layers','(active)','24374qTrAlK','global','llmAgent','llm_project','106778qWGwBa','segment_path','access_token','bold','createAsync','project','apiKey','getParameters','686516DsDPLJ','getSource','parentSegment','activeProfile','.env','profile','string','cliFlags','database','3688608PXanXw','globalCredentials','existsSync','(session:\x20','replace','sessionId','log','entries','2412gzhevS','profileSource','Profile','cyan','displayWithSources','INFO','llm_agent','default','(using\x20session:\x20','proxy','[context]','env','configFiles','site','injectIntoOptions','profile:\x20','accessToken','config','Session','sessions','dim','337155cQNhUq','tdx.json','parent_segment','587994CjJiAR'];a58_0x2717=function(){return _0x4ca064;};return a58_0x2717();}import a58_0x30f6ee from'chalk';export class GlobalContext{[a58_0x382f64(0x142)];[a58_0x382f64(0x12c)];[a58_0x382f64(0x14c)];[a58_0x382f64(0x11d)];[a58_0x382f64(0x11b)];[a58_0x382f64(0x13b)];[a58_0x382f64(0x106)];[a58_0x382f64(0x122)];[a58_0x382f64(0x145)];['proxy'];['verbose'];['logLevel'];['profile'];['profileSource']=null;[a58_0x382f64(0x116)];[a58_0x382f64(0x127)];['sessionId'];[a58_0x382f64(0x141)];constructor(_0x2fbe98){const _0x2a5463=a58_0x382f64;this[_0x2a5463(0x132)]=getSessionID(_0x2fbe98[_0x2a5463(0x112)]);const _0x256ca5=loadSessionContext(_0x2fbe98[_0x2a5463(0x112)]),_0x55f2ed=loadProjectConfig(),_0x231122=this[_0x2a5463(0x115)]();if(_0x2fbe98[_0x2a5463(0x129)])this[_0x2a5463(0x127)]=_0x2fbe98['profile'],this['profileSource']='cli';else{if(_0x256ca5?.[_0x2a5463(0x129)])this[_0x2a5463(0x127)]=_0x256ca5[_0x2a5463(0x129)],this['profileSource']=_0x2a5463(0x112);else{if(_0x231122[_0x2a5463(0x129)])this[_0x2a5463(0x127)]=_0x231122['profile'],this[_0x2a5463(0x136)]='config';else process.env.TDX_PROFILE?(this[_0x2a5463(0x127)]=process.env.TDX_PROFILE,this['profileSource']=_0x2a5463(0x140)):(this[_0x2a5463(0x127)]=null,this[_0x2a5463(0x136)]=null);}}const _0x1b4f6d=this[_0x2a5463(0x127)]?loadProfile(this[_0x2a5463(0x127)]):null,_0x5ebed2=_0x4e6c35=>{const _0x179d42=_0x2a5463;if(!_0x4e6c35)return{};const _0x4a6ebf=_0x4e6c35,_0x49cdca={};for(const [_0x42eaff,_0x3534d2]of Object[_0x179d42(0x134)](_0x4a6ebf)){typeof _0x3534d2===_0x179d42(0x12a)&&(_0x49cdca[_0x42eaff]=_0x3534d2);}return _0x49cdca;},_0x9efd90={},_0x22aeee=(_0x16cf3e,_0x3395f9,_0x113cc5)=>{const _0x3b30a0=_0x2a5463;if(!_0x16cf3e)return![];if(_0x113cc5&&_0x16cf3e===_0x113cc5)return![];const _0x3545ff=_0x256ca5,_0x2541ac=_0x55f2ed,_0x26a89e=_0x1b4f6d?.[_0x3b30a0(0x146)],_0x188f72=_0x231122,_0x3e3ea3=_0x3545ff?.[_0x3395f9],_0x402433=_0x2541ac?.[_0x3395f9],_0x262349=_0x26a89e?.[_0x3395f9],_0x238d9d=_0x188f72[_0x3395f9];return _0x16cf3e!==_0x3e3ea3&&_0x16cf3e!==_0x402433&&_0x16cf3e!==_0x262349&&_0x16cf3e!==_0x238d9d;},_0x4d4d42=[{'optionKey':_0x2a5463(0x142),'contextKey':'site','defaultValue':_0x2a5463(0x113)},{'optionKey':_0x2a5463(0x12c),'contextKey':_0x2a5463(0x12c)},{'optionKey':_0x2a5463(0x126),'contextKey':'parent_segment'},{'optionKey':'llmProject','contextKey':_0x2a5463(0x11b)},{'optionKey':_0x2a5463(0x11a),'contextKey':_0x2a5463(0x13b)},{'optionKey':_0x2a5463(0x129),'contextKey':_0x2a5463(0x129)}];for(const {optionKey:_0x15c130,contextKey:_0x2eb865,defaultValue:_0x4b23a3}of _0x4d4d42){const _0x19a7af=_0x2fbe98[_0x15c130];_0x22aeee(_0x19a7af,_0x2eb865,_0x4b23a3)&&(_0x9efd90[_0x2eb865]=_0x19a7af);}this[_0x2a5463(0x116)]={'cliFlags':_0x9efd90,'session':_0x5ebed2(_0x256ca5),'project':_0x5ebed2(_0x55f2ed),'profile':_0x5ebed2(_0x1b4f6d?.[_0x2a5463(0x146)]),'global':_0x5ebed2(_0x231122)};const _0x1385b8={...this[_0x2a5463(0x116)][_0x2a5463(0x119)],...this[_0x2a5463(0x116)][_0x2a5463(0x129)],...this[_0x2a5463(0x116)][_0x2a5463(0x121)]};process.env.TDX_SITE&&!this[_0x2a5463(0x116)][_0x2a5463(0x112)][_0x2a5463(0x142)]&&!this[_0x2a5463(0x116)]['cliFlags']['site']&&(_0x1385b8[_0x2a5463(0x142)]=process.env.TDX_SITE);Object[_0x2a5463(0x114)](_0x1385b8,this[_0x2a5463(0x116)][_0x2a5463(0x112)]),Object[_0x2a5463(0x114)](_0x1385b8,this[_0x2a5463(0x116)][_0x2a5463(0x12b)]);const _0x4b8abc=_0x1385b8['site']||_0x2a5463(0x113);this['site']=resolveSite(_0x4b8abc),this[_0x2a5463(0x12c)]=_0x1385b8['database'],this[_0x2a5463(0x14c)]=_0x1385b8[_0x2a5463(0x14c)],this['segment_path']=_0x1385b8[_0x2a5463(0x11d)],this[_0x2a5463(0x11b)]=_0x1385b8[_0x2a5463(0x11b)],this['llm_agent']=_0x1385b8[_0x2a5463(0x13b)],this['workflow_project']=_0x1385b8['workflow_project'],this['verbose']=_0x2fbe98[_0x2a5463(0x110)]||![],this[_0x2a5463(0x10a)]=_0x2fbe98[_0x2a5463(0x10a)]??LogLevel[_0x2a5463(0x13a)],this[_0x2a5463(0x129)]=this[_0x2a5463(0x127)]||undefined,this[_0x2a5463(0x145)]=getAccessToken(this[_0x2a5463(0x127)]||undefined),this[_0x2a5463(0x122)]=getAPIKey(this[_0x2a5463(0x127)]||undefined);const _0x2ef11f=typeof _0x231122['proxy']==='string'?_0x231122[_0x2a5463(0x13e)]:undefined;this[_0x2a5463(0x13e)]=_0x2ef11f||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x570f1a=getConfigDir(),_0x3b09fc=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,_0x2a5463(0x148),this['sessionId']+'.json'),_0x5f4ec1=findProjectConfigPath(),_0x483881=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,_0x2a5463(0x14b)),_0x22c96b=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,_0x2a5463(0x128));let _0x5c4359=null,_0x231d17=null;this[_0x2a5463(0x127)]&&(_0x5c4359=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,'profiles',this['activeProfile'],_0x2a5463(0x14b)),_0x231d17=a58_0x268243[_0x2a5463(0x102)](_0x570f1a,'profiles',this['activeProfile'],'.env')),this[_0x2a5463(0x141)]={'session':a58_0x102de4[_0x2a5463(0x12f)](_0x3b09fc)?_0x3b09fc:null,'project':_0x5f4ec1,'profile':_0x5c4359&&a58_0x102de4['existsSync'](_0x5c4359)?_0x5c4359:null,'profileCredentials':_0x231d17&&a58_0x102de4[_0x2a5463(0x12f)](_0x231d17)?_0x231d17:null,'global':a58_0x102de4[_0x2a5463(0x12f)](_0x483881)?_0x483881:null,'globalCredentials':a58_0x102de4[_0x2a5463(0x12f)](_0x22c96b)?_0x22c96b:null};}[a58_0x382f64(0x125)](_0x52b1ab,_0x585211){const _0x2a3ad9=a58_0x382f64;if(!_0x585211)return _0x2a3ad9(0x104);const _0x32308d=_0x585211;if(this[_0x2a3ad9(0x116)]['cliFlags'][_0x52b1ab]===_0x32308d){if(_0x52b1ab===_0x2a3ad9(0x142)&&_0x32308d===_0x2a3ad9(0x113)&&!this['layers'][_0x2a3ad9(0x112)][_0x2a3ad9(0x142)]&&!this['layers'][_0x2a3ad9(0x121)][_0x2a3ad9(0x142)]&&!this['layers'][_0x2a3ad9(0x129)][_0x2a3ad9(0x142)]&&!this[_0x2a3ad9(0x116)][_0x2a3ad9(0x119)][_0x2a3ad9(0x142)])return _0x2a3ad9(0x13c);return'CLI\x20flag:\x20--'+_0x52b1ab[_0x2a3ad9(0x131)](/_/g,'-');}if(this['layers'][_0x2a3ad9(0x112)][_0x52b1ab]===_0x32308d)return'session';if(this[_0x2a3ad9(0x116)]['project'][_0x52b1ab]===_0x32308d)return _0x2a3ad9(0x121);if(this[_0x2a3ad9(0x116)]['profile'][_0x52b1ab]===_0x32308d)return _0x2a3ad9(0x144)+this[_0x2a3ad9(0x127)];if(this[_0x2a3ad9(0x116)][_0x2a3ad9(0x119)][_0x52b1ab]===_0x32308d)return _0x2a3ad9(0x119);return _0x2a3ad9(0x13c);}[a58_0x382f64(0x115)](){const _0x2eff22=a58_0x382f64,_0x72887=a58_0x268243['join'](getConfigDir(),_0x2eff22(0x14b));if(!a58_0x102de4[_0x2eff22(0x12f)](_0x72887))return{};try{const _0x1cfa6e=a58_0x102de4[_0x2eff22(0x10c)](_0x72887,'utf-8');return JSON['parse'](_0x1cfa6e);}catch{return{};}}[a58_0x382f64(0x143)](_0x3fc9e9){const _0x5ac31c=a58_0x382f64;_0x3fc9e9[_0x5ac31c(0x142)]=this['site'],!_0x3fc9e9[_0x5ac31c(0x12c)]&&this['database']&&(_0x3fc9e9['database']=this[_0x5ac31c(0x12c)]),!_0x3fc9e9[_0x5ac31c(0x126)]&&this[_0x5ac31c(0x14c)]&&(_0x3fc9e9[_0x5ac31c(0x126)]=this['parent_segment']),!_0x3fc9e9[_0x5ac31c(0x103)]&&this[_0x5ac31c(0x11d)]&&(_0x3fc9e9[_0x5ac31c(0x103)]=this[_0x5ac31c(0x11d)]),!_0x3fc9e9['llmProject']&&this[_0x5ac31c(0x11b)]&&(_0x3fc9e9['llmProject']=this['llm_project']),!_0x3fc9e9[_0x5ac31c(0x11a)]&&this['llm_agent']&&(_0x3fc9e9[_0x5ac31c(0x11a)]=this[_0x5ac31c(0x13b)]),!_0x3fc9e9['workflowProject']&&this[_0x5ac31c(0x106)]&&(_0x3fc9e9[_0x5ac31c(0x108)]=this[_0x5ac31c(0x106)]);}[a58_0x382f64(0x123)](){const _0x4990d6=a58_0x382f64;return[{'key':_0x4990d6(0x142),'value':this[_0x4990d6(0x142)]},{'key':'database','value':this[_0x4990d6(0x12c)]},{'key':_0x4990d6(0x14c),'value':this[_0x4990d6(0x14c)]},{'key':_0x4990d6(0x11d),'value':this[_0x4990d6(0x11d)]},{'key':'llm_project','value':this[_0x4990d6(0x11b)]},{'key':_0x4990d6(0x13b),'value':this[_0x4990d6(0x13b)]},{'key':_0x4990d6(0x106),'value':this['workflow_project']},{'key':_0x4990d6(0x129),'value':this['activeProfile']||undefined}];}[a58_0x382f64(0x111)](){const _0x40b201=a58_0x382f64;console[_0x40b201(0x133)](a58_0x30f6ee[_0x40b201(0x11f)](_0x40b201(0x13f)));for(const {key:_0x4ab475,value:_0x420bf3}of this['getParameters']()){_0x420bf3&&console['log'](a58_0x30f6ee['cyan'](_0x4ab475)+':\x20'+_0x420bf3);}}[a58_0x382f64(0x139)](){const _0x184ff8=a58_0x382f64;console[_0x184ff8(0x133)](a58_0x30f6ee[_0x184ff8(0x11f)]('[context]'));for(const {key:_0x4a0239,value:_0x2612c9}of this['getParameters']()){if(_0x2612c9){const _0x2d0df7=_0x4a0239===_0x184ff8(0x129)?_0x184ff8(0x117):'('+this[_0x184ff8(0x125)](_0x4a0239,_0x2612c9)+')';console[_0x184ff8(0x133)](a58_0x30f6ee[_0x184ff8(0x138)](_0x4a0239)+':\x20'+_0x2612c9+'\x20'+a58_0x30f6ee[_0x184ff8(0x149)](_0x2d0df7));}}console[_0x184ff8(0x133)]('\x0a'+a58_0x30f6ee[_0x184ff8(0x11f)](_0x184ff8(0x109)));const _0x114084=[{'label':_0x184ff8(0x147),'path':this[_0x184ff8(0x141)][_0x184ff8(0x112)],'extra':_0x184ff8(0x130)+this[_0x184ff8(0x132)]+')'},{'label':_0x184ff8(0x10b),'path':this[_0x184ff8(0x141)][_0x184ff8(0x121)]},{'label':_0x184ff8(0x137),'path':this[_0x184ff8(0x141)][_0x184ff8(0x129)]},{'label':_0x184ff8(0x107),'path':this[_0x184ff8(0x141)][_0x184ff8(0x10d)]},{'label':'Global','path':this[_0x184ff8(0x141)][_0x184ff8(0x119)]},{'label':_0x184ff8(0x105),'path':this[_0x184ff8(0x141)][_0x184ff8(0x12e)]}];for(const {label:_0x28d48c,path:_0x1f21d0,extra:_0x18d208}of _0x114084){if(_0x1f21d0)console[_0x184ff8(0x133)](a58_0x30f6ee['cyan'](_0x28d48c)+':\x20'+_0x1f21d0+'\x20'+a58_0x30f6ee['green']('✓')+(_0x18d208?'\x20'+a58_0x30f6ee[_0x184ff8(0x149)](_0x18d208):''));else{if(_0x28d48c==='Session')console['log'](a58_0x30f6ee[_0x184ff8(0x138)](_0x28d48c)+':\x20'+a58_0x30f6ee[_0x184ff8(0x149)]('none')+'\x20'+a58_0x30f6ee[_0x184ff8(0x149)](_0x184ff8(0x13d)+this[_0x184ff8(0x132)]+')'));else(_0x28d48c===_0x184ff8(0x10b)||_0x28d48c==='Global')&&console[_0x184ff8(0x133)](a58_0x30f6ee[_0x184ff8(0x138)](_0x28d48c)+':\x20'+a58_0x30f6ee[_0x184ff8(0x149)]('none'));}}}async['resolveAPIKeyAsync'](){const _0x26360b=a58_0x382f64;if(!this['accessToken']){const _0x5da118=await getOAuthTokens(this['activeProfile']||undefined);if(_0x5da118)return this[_0x26360b(0x145)]=_0x5da118[_0x26360b(0x11e)],undefined;}return this[_0x26360b(0x122)]=await getAPIKeyAsync(this[_0x26360b(0x142)],this[_0x26360b(0x127)]||undefined),this['apiKey'];}static async[a58_0x382f64(0x120)](_0x437b2a){const _0x3d04a5=a58_0x382f64,_0x2048c8=new GlobalContext(_0x437b2a);return await _0x2048c8[_0x3d04a5(0x10f)](),_0x2048c8;}}
@@ -1 +1 @@
1
- const a59_0x2807c3=a59_0x2039;(function(_0x504d06,_0x36d4ee){const _0x4a8eec=a59_0x2039,_0x4c9915=_0x504d06();while(!![]){try{const _0x32d5b9=-parseInt(_0x4a8eec(0x13e))/0x1+parseInt(_0x4a8eec(0x123))/0x2+parseInt(_0x4a8eec(0x13a))/0x3+-parseInt(_0x4a8eec(0x125))/0x4+parseInt(_0x4a8eec(0x124))/0x5*(-parseInt(_0x4a8eec(0x129))/0x6)+-parseInt(_0x4a8eec(0x12d))/0x7+parseInt(_0x4a8eec(0x133))/0x8;if(_0x32d5b9===_0x36d4ee)break;else _0x4c9915['push'](_0x4c9915['shift']());}catch(_0x5ca85f){_0x4c9915['push'](_0x4c9915['shift']());}}}(a59_0x3043,0xa24a9));const SERVICE_NAME=a59_0x2807c3(0x122);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x45644b=a59_0x2807c3;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x5e25ad=await import(_0x45644b(0x128));return EntryClass=_0x5e25ad[_0x45644b(0x140)],EntryClass;}catch(_0x480e9f){return keyringLoadError=_0x480e9f instanceof Error?_0x480e9f:new Error(String(_0x480e9f)),null;}}function getAccountName(_0xd414c0){const _0x3f3a96=a59_0x2807c3,_0x56a5c8=_0xd414c0||'';return _0x3f3a96(0x141)+_0x56a5c8+_0x3f3a96(0x138);}export async function getKeychainAPIKey(_0x50b196){const _0x1c814e=a59_0x2807c3,_0x2fe25f=await getKeychainAPIKeyWithStatus(_0x50b196);if(_0x2fe25f[_0x1c814e(0x127)])return _0x2fe25f['value'];return _0x2fe25f[_0x1c814e(0x134)]===_0x1c814e(0x126)&&console[_0x1c814e(0x12b)](_0x1c814e(0x130)+_0x2fe25f[_0x1c814e(0x132)]),null;}export async function getKeychainAPIKeyWithStatus(_0x9a4aa4){const _0x1ff0b5=a59_0x2807c3;try{const _0x41006c=await getEntryClass();if(!_0x41006c)return{'success':![],'reason':_0x1ff0b5(0x135)};const _0x28ea9a=getAccountName(_0x9a4aa4),_0x351d67=new _0x41006c(SERVICE_NAME,_0x28ea9a),_0x278c14=_0x351d67[_0x1ff0b5(0x137)]();if(_0x278c14)return{'success':!![],'value':_0x278c14};return{'success':![],'reason':_0x1ff0b5(0x13d)};}catch(_0x1f976b){const _0x5f43=_0x1f976b instanceof Error?_0x1f976b[_0x1ff0b5(0x132)]:String(_0x1f976b);if(_0x5f43[_0x1ff0b5(0x12e)](_0x1ff0b5(0x12a))||_0x5f43[_0x1ff0b5(0x13b)]()[_0x1ff0b5(0x12e)]('could\x20not\x20be\x20found')||_0x5f43[_0x1ff0b5(0x13b)]()['includes']('not\x20found')||_0x5f43['toLowerCase']()[_0x1ff0b5(0x12e)](_0x1ff0b5(0x139)))return{'success':![],'reason':'not_found'};if(_0x5f43[_0x1ff0b5(0x12e)](_0x1ff0b5(0x12f))||_0x5f43[_0x1ff0b5(0x13b)]()[_0x1ff0b5(0x12e)](_0x1ff0b5(0x136))||_0x5f43[_0x1ff0b5(0x13b)]()[_0x1ff0b5(0x12e)](_0x1ff0b5(0x142)))return{'success':![],'reason':_0x1ff0b5(0x126),'message':_0x1ff0b5(0x12c)};return{'success':![],'reason':'unavailable','message':_0x5f43};}}export async function saveKeychainAPIKey(_0x31bd82,_0x11a72){const _0x2a8bec=a59_0x2807c3,_0x13d28f=await getEntryClass();if(!_0x13d28f)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x155f82=getAccountName(_0x11a72),_0x3e2fe4=new _0x13d28f(SERVICE_NAME,_0x155f82);_0x3e2fe4[_0x2a8bec(0x13f)](_0x31bd82);}function a59_0x3043(){const _0x53649b=['restricted','getPassword',':api_key','no\x20matching\x20entry','1336329WnZZOZ','toLowerCase','__keychain_test__','not_found','981185tScPdP','setPassword','Entry','profile:','access','tdx','2657928mukllO','2919025aBhELD','5038456YFKryp','access_denied','success','@napi-rs/keyring','6yUTbLA','-25300','error','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.','2756103VASQBU','includes','-25293','Warning:\x20','not\x20supported','message','16869368uDlZqy','reason','unavailable'];a59_0x3043=function(){return _0x53649b;};return a59_0x3043();}export async function deleteKeychainAPIKey(_0x2cf875){try{const _0x829026=await getEntryClass();if(!_0x829026)return![];const _0x67277a=getAccountName(_0x2cf875),_0x3a77bc=new _0x829026(SERVICE_NAME,_0x67277a);return _0x3a77bc['deleteCredential'](),!![];}catch{return![];}}function a59_0x2039(_0x165fe1,_0x1a0abc){_0x165fe1=_0x165fe1-0x122;const _0x3043f5=a59_0x3043();let _0x2039d1=_0x3043f5[_0x165fe1];return _0x2039d1;}export async function isKeychainAvailable(){const _0x4e72d7=a59_0x2807c3;try{const _0x3125b7=await getEntryClass();if(!_0x3125b7)return![];const _0x280c34=new _0x3125b7(SERVICE_NAME,_0x4e72d7(0x13c));return _0x280c34[_0x4e72d7(0x137)](),!![];}catch(_0x32cac9){const _0x186ecc=_0x32cac9 instanceof Error?_0x32cac9[_0x4e72d7(0x132)][_0x4e72d7(0x13b)]():'';if(_0x186ecc[_0x4e72d7(0x12e)]('not\x20available')||_0x186ecc[_0x4e72d7(0x12e)](_0x4e72d7(0x131))||_0x186ecc[_0x4e72d7(0x12e)]('cannot\x20find'))return![];return!![];}}
1
+ function a59_0x2711(_0x56c454,_0x4951a5){_0x56c454=_0x56c454-0x197;const _0x3bf38c=a59_0x3bf3();let _0x27116b=_0x3bf38c[_0x56c454];return _0x27116b;}(function(_0x2ded6a,_0x3e84e2){const _0x44cf9c=a59_0x2711,_0xf5af13=_0x2ded6a();while(!![]){try{const _0x27d620=-parseInt(_0x44cf9c(0x19c))/0x1+parseInt(_0x44cf9c(0x1b5))/0x2+parseInt(_0x44cf9c(0x1a3))/0x3*(-parseInt(_0x44cf9c(0x19b))/0x4)+parseInt(_0x44cf9c(0x1a9))/0x5+parseInt(_0x44cf9c(0x1a8))/0x6+-parseInt(_0x44cf9c(0x19d))/0x7+parseInt(_0x44cf9c(0x1a2))/0x8;if(_0x27d620===_0x3e84e2)break;else _0xf5af13['push'](_0xf5af13['shift']());}catch(_0xe1cfeb){_0xf5af13['push'](_0xf5af13['shift']());}}}(a59_0x3bf3,0xdc57e));function a59_0x3bf3(){const _0x365412=['1191900sJTyKJ','4232060dOrtlW','deleteCredential','not\x20supported','value','setPassword','success','getPassword','message','toLowerCase','cannot\x20find','not\x20found','-25293','1179342NPiSAu','restricted','access_denied','includes','unavailable','profile:','error','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.','@napi-rs/keyring','3220VIxmba','1770120ohubva','4673095hbsBOu','-25300','no\x20matching\x20entry','not_found','Warning:\x20','16020344cJDKjp','1107IaAdCp','could\x20not\x20be\x20found','reason','Entry',':api_key'];a59_0x3bf3=function(){return _0x365412;};return a59_0x3bf3();}const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2b2e89=a59_0x2711;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x2aec05=await import(_0x2b2e89(0x19a));return EntryClass=_0x2aec05[_0x2b2e89(0x1a6)],EntryClass;}catch(_0x256cd8){return keyringLoadError=_0x256cd8 instanceof Error?_0x256cd8:new Error(String(_0x256cd8)),null;}}function getAccountName(_0x1f50ec){const _0x258054=a59_0x2711,_0x204364=_0x1f50ec||'';return _0x258054(0x197)+_0x204364+_0x258054(0x1a7);}export async function getKeychainAPIKey(_0x2d0a84){const _0x263d04=a59_0x2711,_0x140477=await getKeychainAPIKeyWithStatus(_0x2d0a84);if(_0x140477[_0x263d04(0x1ae)])return _0x140477[_0x263d04(0x1ac)];return _0x140477[_0x263d04(0x1a5)]===_0x263d04(0x1b7)&&console[_0x263d04(0x198)](_0x263d04(0x1a1)+_0x140477[_0x263d04(0x1b0)]),null;}export async function getKeychainAPIKeyWithStatus(_0xb7f4aa){const _0x1a6afb=a59_0x2711;try{const _0x41da38=await getEntryClass();if(!_0x41da38)return{'success':![],'reason':_0x1a6afb(0x1b9)};const _0x1b9ad1=getAccountName(_0xb7f4aa),_0x21a242=new _0x41da38(SERVICE_NAME,_0x1b9ad1),_0x530a86=_0x21a242[_0x1a6afb(0x1af)]();if(_0x530a86)return{'success':!![],'value':_0x530a86};return{'success':![],'reason':'not_found'};}catch(_0xf3cda5){const _0x5f28be=_0xf3cda5 instanceof Error?_0xf3cda5[_0x1a6afb(0x1b0)]:String(_0xf3cda5);if(_0x5f28be[_0x1a6afb(0x1b8)](_0x1a6afb(0x19e))||_0x5f28be[_0x1a6afb(0x1b1)]()[_0x1a6afb(0x1b8)](_0x1a6afb(0x1a4))||_0x5f28be[_0x1a6afb(0x1b1)]()[_0x1a6afb(0x1b8)](_0x1a6afb(0x1b3))||_0x5f28be[_0x1a6afb(0x1b1)]()[_0x1a6afb(0x1b8)](_0x1a6afb(0x19f)))return{'success':![],'reason':_0x1a6afb(0x1a0)};if(_0x5f28be[_0x1a6afb(0x1b8)](_0x1a6afb(0x1b4))||_0x5f28be['toLowerCase']()['includes'](_0x1a6afb(0x1b6))||_0x5f28be[_0x1a6afb(0x1b1)]()[_0x1a6afb(0x1b8)]('access'))return{'success':![],'reason':_0x1a6afb(0x1b7),'message':_0x1a6afb(0x199)};return{'success':![],'reason':_0x1a6afb(0x1b9),'message':_0x5f28be};}}export async function saveKeychainAPIKey(_0x6e2851,_0x2c585d){const _0x1f207d=a59_0x2711,_0x2fc69e=await getEntryClass();if(!_0x2fc69e)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x1f64a8=getAccountName(_0x2c585d),_0x30e14c=new _0x2fc69e(SERVICE_NAME,_0x1f64a8);_0x30e14c[_0x1f207d(0x1ad)](_0x6e2851);}export async function deleteKeychainAPIKey(_0x16914f){const _0x263a9c=a59_0x2711;try{const _0x124624=await getEntryClass();if(!_0x124624)return![];const _0x30f2cd=getAccountName(_0x16914f),_0x59d654=new _0x124624(SERVICE_NAME,_0x30f2cd);return _0x59d654[_0x263a9c(0x1aa)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x427fb0=a59_0x2711;try{const _0x538fda=await getEntryClass();if(!_0x538fda)return![];const _0x5496e7=new _0x538fda(SERVICE_NAME,'__keychain_test__');return _0x5496e7[_0x427fb0(0x1af)](),!![];}catch(_0x443743){const _0x485885=_0x443743 instanceof Error?_0x443743[_0x427fb0(0x1b0)][_0x427fb0(0x1b1)]():'';if(_0x485885[_0x427fb0(0x1b8)]('not\x20available')||_0x485885[_0x427fb0(0x1b8)](_0x427fb0(0x1ab))||_0x485885['includes'](_0x427fb0(0x1b2)))return![];return!![];}}
@@ -1 +1 @@
1
- function a60_0x77f5(_0x4bea01,_0x25c4d3){_0x4bea01=_0x4bea01-0xa6;const _0x263ec4=a60_0x263e();let _0x77f50=_0x263ec4[_0x4bea01];return _0x77f50;}const a60_0x5817b6=a60_0x77f5;(function(_0x190069,_0xcece2){const _0x442b85=a60_0x77f5,_0x128738=_0x190069();while(!![]){try{const _0x4761ca=-parseInt(_0x442b85(0xaf))/0x1*(parseInt(_0x442b85(0xaa))/0x2)+parseInt(_0x442b85(0xa7))/0x3+-parseInt(_0x442b85(0xa9))/0x4*(-parseInt(_0x442b85(0xb5))/0x5)+-parseInt(_0x442b85(0xb4))/0x6+-parseInt(_0x442b85(0xae))/0x7+parseInt(_0x442b85(0xb1))/0x8+parseInt(_0x442b85(0xb0))/0x9*(-parseInt(_0x442b85(0xab))/0xa);if(_0x4761ca===_0xcece2)break;else _0x128738['push'](_0x128738['shift']());}catch(_0x523a60){_0x128738['push'](_0x128738['shift']());}}}(a60_0x263e,0x37ee2));const SERVICE_NAME=a60_0x5817b6(0xa8);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x295c11=a60_0x5817b6;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x16e2d4=await import('@napi-rs/keyring');return EntryClass=_0x16e2d4[_0x295c11(0xb6)],EntryClass;}catch(_0x54a6ab){return keyringLoadError=_0x54a6ab instanceof Error?_0x54a6ab:new Error(String(_0x54a6ab)),null;}}function a60_0x263e(){const _0x3b04c0=['338094zPSnrU','15020gRrXsy','Entry','System\x20keychain\x20is\x20not\x20available','1175226DcGYXO','tdx','508BUyjuM','62OuwxeG','1490lwpDOF','parse','getPassword','2778727yMApim','949FLfaNf','3825VlQZYa','15152bGhBJe','deleteCredential','stringify'];a60_0x263e=function(){return _0x3b04c0;};return a60_0x263e();}function getOAuthAccountName(_0x30488f){const _0x22dd91=_0x30488f||'';return'profile:'+_0x22dd91+':oauth_tokens';}export async function saveOAuthTokens(_0x1a7bf0,_0x19a741){const _0xda4824=a60_0x5817b6,_0x5660cb=await getEntryClass();if(!_0x5660cb)throw new Error(_0xda4824(0xa6));const _0x19ad92=getOAuthAccountName(_0x19a741),_0x48d97b=new _0x5660cb(SERVICE_NAME,_0x19ad92);_0x48d97b['setPassword'](JSON[_0xda4824(0xb3)](_0x1a7bf0));}export async function getOAuthTokens(_0x411e3a){const _0x10a951=a60_0x5817b6;try{const _0x4a95b5=await getEntryClass();if(!_0x4a95b5)return null;const _0x1f958b=getOAuthAccountName(_0x411e3a),_0x36462f=new _0x4a95b5(SERVICE_NAME,_0x1f958b),_0x22b2e3=_0x36462f[_0x10a951(0xad)]();if(_0x22b2e3)return JSON[_0x10a951(0xac)](_0x22b2e3);return null;}catch{return null;}}export async function deleteOAuthTokens(_0xfb2038){const _0x4b2b35=a60_0x5817b6;try{const _0x5ac956=await getEntryClass();if(!_0x5ac956)return![];const _0x5449c1=getOAuthAccountName(_0xfb2038),_0x3382e1=new _0x5ac956(SERVICE_NAME,_0x5449c1);return _0x3382e1[_0x4b2b35(0xb2)](),!![];}catch{return![];}}
1
+ const a60_0x5ace9c=a60_0x31f3;(function(_0x4d5da8,_0x5ca219){const _0x3971e3=a60_0x31f3,_0x501c45=_0x4d5da8();while(!![]){try{const _0x423761=-parseInt(_0x3971e3(0x1cb))/0x1*(-parseInt(_0x3971e3(0x1bf))/0x2)+-parseInt(_0x3971e3(0x1bd))/0x3+-parseInt(_0x3971e3(0x1cf))/0x4*(parseInt(_0x3971e3(0x1be))/0x5)+-parseInt(_0x3971e3(0x1c6))/0x6*(-parseInt(_0x3971e3(0x1bb))/0x7)+parseInt(_0x3971e3(0x1c7))/0x8+parseInt(_0x3971e3(0x1cc))/0x9*(parseInt(_0x3971e3(0x1cd))/0xa)+parseInt(_0x3971e3(0x1c0))/0xb*(-parseInt(_0x3971e3(0x1bc))/0xc);if(_0x423761===_0x5ca219)break;else _0x501c45['push'](_0x501c45['shift']());}catch(_0x225fcd){_0x501c45['push'](_0x501c45['shift']());}}}(a60_0x57aa,0xed0a1));function a60_0x31f3(_0x3f3c2a,_0x127259){_0x3f3c2a=_0x3f3c2a-0x1bb;const _0x57aa9d=a60_0x57aa();let _0x31f389=_0x57aa9d[_0x3f3c2a];return _0x31f389;}function a60_0x57aa(){const _0x4fbffd=['5411172FHZNpo','21HBWwYT','4292268GumwpB','4952499FRvmyx','5MYIvxx','6rBpIKM','22idLCig','deleteCredential','parse','setPassword','tdx','Entry','2366886AQwivl','7763952tKGzcR','System\x20keychain\x20is\x20not\x20available',':oauth_tokens','stringify','625450GOBcuP','593667EyJWMC','100qeIKuD','@napi-rs/keyring'];a60_0x57aa=function(){return _0x4fbffd;};return a60_0x57aa();}const SERVICE_NAME=a60_0x5ace9c(0x1c4);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x5e44e1=a60_0x5ace9c;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x6b3821=await import(_0x5e44e1(0x1ce));return EntryClass=_0x6b3821[_0x5e44e1(0x1c5)],EntryClass;}catch(_0x1c0efd){return keyringLoadError=_0x1c0efd instanceof Error?_0x1c0efd:new Error(String(_0x1c0efd)),null;}}function getOAuthAccountName(_0x3c32c8){const _0x33b8fe=a60_0x5ace9c,_0x334ed8=_0x3c32c8||'';return'profile:'+_0x334ed8+_0x33b8fe(0x1c9);}export async function saveOAuthTokens(_0x1baf72,_0x1c1814){const _0x50dfc5=a60_0x5ace9c,_0x4d3b69=await getEntryClass();if(!_0x4d3b69)throw new Error(_0x50dfc5(0x1c8));const _0x12626a=getOAuthAccountName(_0x1c1814),_0x2e97e4=new _0x4d3b69(SERVICE_NAME,_0x12626a);_0x2e97e4[_0x50dfc5(0x1c3)](JSON[_0x50dfc5(0x1ca)](_0x1baf72));}export async function getOAuthTokens(_0x4c999a){const _0x5a2b50=a60_0x5ace9c;try{const _0x4d750c=await getEntryClass();if(!_0x4d750c)return null;const _0x5a4235=getOAuthAccountName(_0x4c999a),_0x54fbf1=new _0x4d750c(SERVICE_NAME,_0x5a4235),_0x306754=_0x54fbf1['getPassword']();if(_0x306754)return JSON[_0x5a2b50(0x1c2)](_0x306754);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x17cabe){const _0x5a4d3c=a60_0x5ace9c;try{const _0x3e24d0=await getEntryClass();if(!_0x3e24d0)return![];const _0x379e9f=getOAuthAccountName(_0x17cabe),_0x37bba4=new _0x3e24d0(SERVICE_NAME,_0x379e9f);return _0x37bba4[_0x5a4d3c(0x1c1)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a61_0x5b6af2=a61_0x4443;(function(_0x423a90,_0x1ea3f4){const _0x1c0577=a61_0x4443,_0x438eac=_0x423a90();while(!![]){try{const _0x815290=-parseInt(_0x1c0577(0xd9))/0x1*(parseInt(_0x1c0577(0xc3))/0x2)+parseInt(_0x1c0577(0xc4))/0x3*(-parseInt(_0x1c0577(0xd4))/0x4)+-parseInt(_0x1c0577(0xcc))/0x5*(parseInt(_0x1c0577(0xe2))/0x6)+-parseInt(_0x1c0577(0xca))/0x7*(-parseInt(_0x1c0577(0xd8))/0x8)+parseInt(_0x1c0577(0xbd))/0x9*(parseInt(_0x1c0577(0xd0))/0xa)+parseInt(_0x1c0577(0xbf))/0xb*(-parseInt(_0x1c0577(0xa7))/0xc)+parseInt(_0x1c0577(0xab))/0xd;if(_0x815290===_0x1ea3f4)break;else _0x438eac['push'](_0x438eac['shift']());}catch(_0x484abb){_0x438eac['push'](_0x438eac['shift']());}}}(a61_0x52ee,0xbb405));function a61_0x4443(_0x322070,_0x3fe229){_0x322070=_0x322070-0xa4;const _0x52ee4c=a61_0x52ee();let _0x444302=_0x52ee4c[_0x322070];return _0x444302;}import*as a61_0x7aba48 from'node:crypto';import*as a61_0x291e27 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set(['dev-us01',a61_0x5b6af2(0xae),a61_0x5b6af2(0xde),a61_0x5b6af2(0xbb),a61_0x5b6af2(0xdb)]);export function isOAuthSupported(_0x2b9ff8){const _0x236156=a61_0x5b6af2;return OAUTH_SUPPORTED_SITES[_0x236156(0xcd)](_0x2b9ff8);}export const OAUTH_CALLBACK_PORT=0xaa4a;function a61_0x52ee(){const _0x5148e9=['text/plain','waitForCallback','close','text','84XGMVOy','writeHead','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','OAuth\x20token\x20request\x20failed\x20(','23514283ewLRgt','scope','/oauth/token','dev-eu01','json','status','code','get','end','Not\x20Found','POST','codeChallenge','/oauth/callback','randomBytes','authorization_code','code_challenge','stg-ap01','hex','2085696TpARVA','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','1699291ILjvqx','redirectUri','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','/oauth/authorize','358FfxpAw','304173WvGQha','client_id','createHash','error','response_type','base64url','52829YskmTC','toString','4715XeFMns','has','S256','set','60tKwUQs','searchParams','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','createServer','36KxImyN','):\x20','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','listen','1424jhCswT','2647nhjlEM','redirect_uri','stg-ap03','text/html','message','stg-us01','clientId','code_challenge_method','state','8322DzKIWj'];a61_0x52ee=function(){return _0x5148e9;};return a61_0x52ee();}export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a61_0x5b6af2(0xb7);export function getOAuthClientId(){return process.env.TD_OAUTH_CLIENT_ID||'tdx';}export function generatePKCEPair(){const _0x5f690d=a61_0x5b6af2,_0x3b4ab8=a61_0x7aba48[_0x5f690d(0xb8)](0x20)['toString'](_0x5f690d(0xc9)),_0x527b2c=a61_0x7aba48[_0x5f690d(0xc6)]('sha256')['update'](_0x3b4ab8)['digest'](_0x5f690d(0xc9));return{'verifier':_0x3b4ab8,'challenge':_0x527b2c};}export function buildAuthorizeURL(_0x565b40,_0x1b066c){const _0x33ab52=a61_0x5b6af2,_0x2ba733=new URL(_0x33ab52(0xc2),_0x565b40);return _0x2ba733[_0x33ab52(0xd1)][_0x33ab52(0xcf)](_0x33ab52(0xc8),_0x33ab52(0xb1)),_0x2ba733[_0x33ab52(0xd1)][_0x33ab52(0xcf)](_0x33ab52(0xc5),_0x1b066c[_0x33ab52(0xdf)]),_0x2ba733[_0x33ab52(0xd1)][_0x33ab52(0xcf)](_0x33ab52(0xda),_0x1b066c[_0x33ab52(0xc0)]),_0x2ba733[_0x33ab52(0xd1)][_0x33ab52(0xcf)](_0x33ab52(0xe1),_0x1b066c[_0x33ab52(0xe1)]),_0x2ba733[_0x33ab52(0xd1)][_0x33ab52(0xcf)](_0x33ab52(0xba),_0x1b066c[_0x33ab52(0xb6)]),_0x2ba733[_0x33ab52(0xd1)]['set'](_0x33ab52(0xe0),_0x33ab52(0xce)),_0x1b066c[_0x33ab52(0xac)]&&_0x2ba733[_0x33ab52(0xd1)][_0x33ab52(0xcf)](_0x33ab52(0xac),_0x1b066c['scope']),_0x2ba733[_0x33ab52(0xcb)]();}export async function postTokenRequest(_0x42d17b,_0xb39746){const _0x16115c=a61_0x5b6af2,_0x5154da=new URLSearchParams(_0xb39746)[_0x16115c(0xcb)](),_0xc96af8=await fetch(_0x42d17b,{'method':_0x16115c(0xb5),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x5154da});if(!_0xc96af8['ok']){const _0x2de2b9=await _0xc96af8[_0x16115c(0xa6)]();throw new Error(_0x16115c(0xaa)+_0xc96af8[_0x16115c(0xb0)]+_0x16115c(0xd5)+_0x2de2b9);}return await _0xc96af8[_0x16115c(0xaf)]();}export async function exchangeCodeForTokens(_0x1f64ee,_0x513b92,_0x2b48ec,_0x438ac1){const _0x4317a2=a61_0x5b6af2,_0x260f05=_0x1f64ee+_0x4317a2(0xad);return postTokenRequest(_0x260f05,{'grant_type':_0x4317a2(0xb9),'client_id':getOAuthClientId(),'code':_0x513b92,'code_verifier':_0x2b48ec,'redirect_uri':_0x438ac1});}export function startLocalCallbackServer(){const _0x51f43e=a61_0x5b6af2;let _0x24b097,_0x2ee702;const _0x2a0ca3=new Promise((_0x369670,_0x1e8fb6)=>{_0x24b097=_0x369670,_0x2ee702=_0x1e8fb6;}),_0x47f85e=a61_0x291e27[_0x51f43e(0xd3)]((_0x289213,_0x3f4f52)=>{const _0x2658c2=_0x51f43e,_0x3c4bbc=new URL(_0x289213['url']||'/','http://127.0.0.1');if(_0x3c4bbc['pathname']!=='/oauth/callback'){_0x3f4f52[_0x2658c2(0xa8)](0x194,{'Content-Type':_0x2658c2(0xe3)}),_0x3f4f52['end'](_0x2658c2(0xb4));return;}const _0x33c99d=_0x3c4bbc[_0x2658c2(0xd1)][_0x2658c2(0xb2)](_0x2658c2(0xb1)),_0x2a6276=_0x3c4bbc[_0x2658c2(0xd1)]['get'](_0x2658c2(0xe1)),_0x3cd072=_0x3c4bbc['searchParams'][_0x2658c2(0xb2)](_0x2658c2(0xc7));if(_0x3cd072||!_0x33c99d||!_0x2a6276){_0x3f4f52[_0x2658c2(0xa8)](0x190,{'Content-Type':_0x2658c2(0xdc)}),_0x3f4f52['end']('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0x2ee702(new Error(_0x2658c2(0xd6)));return;}_0x3f4f52['writeHead'](0xc8,{'Content-Type':_0x2658c2(0xdc)}),_0x3f4f52[_0x2658c2(0xb3)](_0x2658c2(0xa9)),_0x24b097({'code':_0x33c99d,'state':_0x2a6276});});_0x47f85e['on'](_0x51f43e(0xc7),_0x3cb7b5=>{const _0x268b02=_0x51f43e;_0x3cb7b5[_0x268b02(0xb1)]==='EADDRINUSE'?_0x2ee702(new Error('Port\x20'+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x2ee702(new Error(_0x268b02(0xd2)+_0x3cb7b5[_0x268b02(0xdd)]));}),_0x47f85e[_0x51f43e(0xd7)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x239b48=setTimeout(()=>{const _0xd4bb40=_0x51f43e;_0x2ee702(new Error(_0xd4bb40(0xc1))),_0x47f85e[_0xd4bb40(0xa5)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x2a0ca3,'close':()=>{const _0x5788bc=_0x51f43e;clearTimeout(_0x239b48),_0x47f85e[_0x5788bc(0xa5)]();}};}export async function startOAuthFlow(_0xcc69ef){const _0x25ffba=a61_0x5b6af2,_0x226d2e=getConsoleUrl(_0xcc69ef),_0x45890c=getOAuthClientId(),{verifier:_0x3151b4,challenge:_0x31cf83}=generatePKCEPair(),_0x42b896=a61_0x7aba48[_0x25ffba(0xb8)](0x10)['toString'](_0x25ffba(0xbc)),_0x4287dc=startLocalCallbackServer();try{const _0x74f53e=OAUTH_REDIRECT_URI,_0x4b9d84=buildAuthorizeURL(_0x226d2e,{'clientId':_0x45890c,'redirectUri':_0x74f53e,'state':_0x42b896,'codeChallenge':_0x31cf83});openBrowser(_0x4b9d84);const _0x21ff5b=await _0x4287dc[_0x25ffba(0xa4)]();if(_0x21ff5b[_0x25ffba(0xe1)]!==_0x42b896)throw new Error(_0x25ffba(0xbe));return await exchangeCodeForTokens(_0x226d2e,_0x21ff5b[_0x25ffba(0xb1)],_0x3151b4,_0x74f53e);}finally{_0x4287dc[_0x25ffba(0xa5)]();}}
1
+ const a61_0x24aa75=a61_0x5f2d;function a61_0x5f2d(_0x2ac4f7,_0x518dfd){_0x2ac4f7=_0x2ac4f7-0x1b0;const _0x1112a5=a61_0x1112();let _0x5f2d65=_0x1112a5[_0x2ac4f7];return _0x5f2d65;}(function(_0x19bf43,_0x2e6c27){const _0x58e722=a61_0x5f2d,_0x1e498c=_0x19bf43();while(!![]){try{const _0x117aee=parseInt(_0x58e722(0x1d5))/0x1*(-parseInt(_0x58e722(0x1b5))/0x2)+-parseInt(_0x58e722(0x1d7))/0x3*(-parseInt(_0x58e722(0x1d1))/0x4)+-parseInt(_0x58e722(0x1be))/0x5*(-parseInt(_0x58e722(0x1cc))/0x6)+parseInt(_0x58e722(0x1ba))/0x7+parseInt(_0x58e722(0x1ea))/0x8*(-parseInt(_0x58e722(0x1c3))/0x9)+parseInt(_0x58e722(0x1b9))/0xa*(parseInt(_0x58e722(0x1e8))/0xb)+-parseInt(_0x58e722(0x1d4))/0xc;if(_0x117aee===_0x2e6c27)break;else _0x1e498c['push'](_0x1e498c['shift']());}catch(_0x59d22c){_0x1e498c['push'](_0x1e498c['shift']());}}}(a61_0x1112,0xec068));import*as a61_0x113879 from'node:crypto';import*as a61_0xb568a5 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set(['dev-us01',a61_0x24aa75(0x1c5),'stg-us01',a61_0x24aa75(0x1b8),'stg-ap03']);export function isOAuthSupported(_0x401f24){const _0x50695b=a61_0x24aa75;return OAUTH_SUPPORTED_SITES[_0x50695b(0x1e6)](_0x401f24);}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+'/oauth/callback';export function getOAuthClientId(){const _0x3b57ec=a61_0x24aa75;return process.env.TD_OAUTH_CLIENT_ID||_0x3b57ec(0x1bf);}export function generatePKCEPair(){const _0x40507b=a61_0x24aa75,_0xcb62fe=a61_0x113879[_0x40507b(0x1b1)](0x20)[_0x40507b(0x1e7)](_0x40507b(0x1b6)),_0x3c78fa=a61_0x113879[_0x40507b(0x1e5)](_0x40507b(0x1d6))[_0x40507b(0x1e1)](_0xcb62fe)['digest'](_0x40507b(0x1b6));return{'verifier':_0xcb62fe,'challenge':_0x3c78fa};}export function buildAuthorizeURL(_0x3d09d6,_0x4886d1){const _0x54d170=a61_0x24aa75,_0x1ec51d=new URL(_0x54d170(0x1de),_0x3d09d6);return _0x1ec51d['searchParams'][_0x54d170(0x1e4)]('response_type',_0x54d170(0x1b3)),_0x1ec51d[_0x54d170(0x1e3)][_0x54d170(0x1e4)](_0x54d170(0x1b2),_0x4886d1['clientId']),_0x1ec51d['searchParams'][_0x54d170(0x1e4)](_0x54d170(0x1d0),_0x4886d1[_0x54d170(0x1da)]),_0x1ec51d[_0x54d170(0x1e3)]['set'](_0x54d170(0x1ca),_0x4886d1['state']),_0x1ec51d[_0x54d170(0x1e3)][_0x54d170(0x1e4)](_0x54d170(0x1c6),_0x4886d1['codeChallenge']),_0x1ec51d[_0x54d170(0x1e3)][_0x54d170(0x1e4)](_0x54d170(0x1c4),'S256'),_0x4886d1['scope']&&_0x1ec51d[_0x54d170(0x1e3)]['set'](_0x54d170(0x1c8),_0x4886d1['scope']),_0x1ec51d['toString']();}export async function postTokenRequest(_0x34038c,_0x31749a){const _0x2ffe45=a61_0x24aa75,_0x158580=new URLSearchParams(_0x31749a)[_0x2ffe45(0x1e7)](),_0x52d15d=await fetch(_0x34038c,{'method':_0x2ffe45(0x1c2),'headers':{'Content-Type':_0x2ffe45(0x1d2)},'body':_0x158580});if(!_0x52d15d['ok']){const _0x1109a6=await _0x52d15d[_0x2ffe45(0x1b0)]();throw new Error(_0x2ffe45(0x1cd)+_0x52d15d[_0x2ffe45(0x1d9)]+_0x2ffe45(0x1cb)+_0x1109a6);}return await _0x52d15d[_0x2ffe45(0x1db)]();}export async function exchangeCodeForTokens(_0x44f2be,_0x5979ca,_0x1b9aa2,_0x546d00){const _0x2da2e2=a61_0x24aa75,_0x1b9b84=_0x44f2be+_0x2da2e2(0x1b4);return postTokenRequest(_0x1b9b84,{'grant_type':_0x2da2e2(0x1d3),'client_id':getOAuthClientId(),'code':_0x5979ca,'code_verifier':_0x1b9aa2,'redirect_uri':_0x546d00});}function a61_0x1112(){const _0x3010b1=['close','POST','405qYjvLG','code_challenge_method','dev-eu01','code_challenge','error','scope','end','state','):\x20','12wezAXC','OAuth\x20token\x20request\x20failed\x20(','text/plain','127.0.0.1','redirect_uri','1269956ZecFsQ','application/x-www-form-urlencoded','authorization_code','10384368icaLek','467NGWURG','sha256','3qXSRgH','url','status','redirectUri','json','waitForCallback','pathname','/oauth/authorize','http://127.0.0.1','Port\x20','update','hex','searchParams','set','createHash','has','toString','399377AEiivW','get','227512lFlopG','text','randomBytes','client_id','code','/oauth/token','362LpZZYS','base64url','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','stg-ap01','70WLbCTf','8913282PedjyW','createServer','EADDRINUSE','text/html','3378605uUibrl','tdx','Not\x20Found'];a61_0x1112=function(){return _0x3010b1;};return a61_0x1112();}export function startLocalCallbackServer(){const _0x35f8b0=a61_0x24aa75;let _0x49bb1b,_0xe49717;const _0x5b15cf=new Promise((_0x18b9ce,_0x4778c2)=>{_0x49bb1b=_0x18b9ce,_0xe49717=_0x4778c2;}),_0x1177f4=a61_0xb568a5[_0x35f8b0(0x1bb)]((_0x11e0f7,_0x5959e3)=>{const _0x22cc9e=_0x35f8b0,_0x17bf2c=new URL(_0x11e0f7[_0x22cc9e(0x1d8)]||'/',_0x22cc9e(0x1df));if(_0x17bf2c[_0x22cc9e(0x1dd)]!=='/oauth/callback'){_0x5959e3['writeHead'](0x194,{'Content-Type':_0x22cc9e(0x1ce)}),_0x5959e3[_0x22cc9e(0x1c9)](_0x22cc9e(0x1c0));return;}const _0x7d0009=_0x17bf2c[_0x22cc9e(0x1e3)][_0x22cc9e(0x1e9)](_0x22cc9e(0x1b3)),_0x5ee972=_0x17bf2c[_0x22cc9e(0x1e3)][_0x22cc9e(0x1e9)]('state'),_0x224bd3=_0x17bf2c['searchParams'][_0x22cc9e(0x1e9)](_0x22cc9e(0x1c7));if(_0x224bd3||!_0x7d0009||!_0x5ee972){_0x5959e3['writeHead'](0x190,{'Content-Type':_0x22cc9e(0x1bd)}),_0x5959e3[_0x22cc9e(0x1c9)]('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0xe49717(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x5959e3['writeHead'](0xc8,{'Content-Type':_0x22cc9e(0x1bd)}),_0x5959e3[_0x22cc9e(0x1c9)]('<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>'),_0x49bb1b({'code':_0x7d0009,'state':_0x5ee972});});_0x1177f4['on']('error',_0x38f306=>{const _0x1a21fc=_0x35f8b0;_0x38f306[_0x1a21fc(0x1b3)]===_0x1a21fc(0x1bc)?_0xe49717(new Error(_0x1a21fc(0x1e0)+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0xe49717(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x38f306['message']));}),_0x1177f4['listen'](OAUTH_CALLBACK_PORT,_0x35f8b0(0x1cf));const _0x17a01a=setTimeout(()=>{const _0x3eff32=_0x35f8b0;_0xe49717(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x1177f4[_0x3eff32(0x1c1)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x5b15cf,'close':()=>{const _0x14a8cf=_0x35f8b0;clearTimeout(_0x17a01a),_0x1177f4[_0x14a8cf(0x1c1)]();}};}export async function startOAuthFlow(_0x29fe2e){const _0x3015bc=a61_0x24aa75,_0x4ee3e9=getConsoleUrl(_0x29fe2e),_0x1ee7ed=getOAuthClientId(),{verifier:_0x23026a,challenge:_0xd82a54}=generatePKCEPair(),_0x2bc300=a61_0x113879[_0x3015bc(0x1b1)](0x10)['toString'](_0x3015bc(0x1e2)),_0x3613a3=startLocalCallbackServer();try{const _0x286ecf=OAUTH_REDIRECT_URI,_0x5b2374=buildAuthorizeURL(_0x4ee3e9,{'clientId':_0x1ee7ed,'redirectUri':_0x286ecf,'state':_0x2bc300,'codeChallenge':_0xd82a54});openBrowser(_0x5b2374);const _0x3bad62=await _0x3613a3[_0x3015bc(0x1dc)]();if(_0x3bad62['state']!==_0x2bc300)throw new Error(_0x3015bc(0x1b7));return await exchangeCodeForTokens(_0x4ee3e9,_0x3bad62[_0x3015bc(0x1b3)],_0x23026a,_0x286ecf);}finally{_0x3613a3[_0x3015bc(0x1c1)]();}}
@@ -1 +1 @@
1
- const a62_0x10cd4f=a62_0x1bf1;(function(_0x2b8826,_0x3f280b){const _0x4a2c6d=a62_0x1bf1,_0x2eb951=_0x2b8826();while(!![]){try{const _0x4ba66a=-parseInt(_0x4a2c6d(0x131))/0x1+parseInt(_0x4a2c6d(0x15e))/0x2*(-parseInt(_0x4a2c6d(0x163))/0x3)+parseInt(_0x4a2c6d(0x142))/0x4*(parseInt(_0x4a2c6d(0x151))/0x5)+parseInt(_0x4a2c6d(0x123))/0x6+parseInt(_0x4a2c6d(0x15f))/0x7*(parseInt(_0x4a2c6d(0x148))/0x8)+-parseInt(_0x4a2c6d(0x128))/0x9*(parseInt(_0x4a2c6d(0x125))/0xa)+-parseInt(_0x4a2c6d(0x132))/0xb*(-parseInt(_0x4a2c6d(0x145))/0xc);if(_0x4ba66a===_0x3f280b)break;else _0x2eb951['push'](_0x2eb951['shift']());}catch(_0x5558a9){_0x2eb951['push'](_0x2eb951['shift']());}}}(a62_0x3cd0,0xc0cb1));import*as a62_0x4de636 from'node:fs';import*as a62_0x4c9bc2 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a62_0x10cd4f(0x141);export function getProfileParams(_0x5c3b25){const _0x345419=a62_0x10cd4f,_0x567f1c={};if(!_0x5c3b25)return _0x567f1c;for(const [_0x44df2f,_0x2856b8]of Object[_0x345419(0x150)](_0x5c3b25)){_0x44df2f!==_0x345419(0x14a)&&_0x2856b8!==undefined&&(_0x567f1c[_0x44df2f]=_0x2856b8);}return _0x567f1c;}export function getProfilesDir(){const _0x12ea44=a62_0x10cd4f;return a62_0x4c9bc2[_0x12ea44(0x130)](getConfigDir(),_0x12ea44(0x124));}function getProfileDir(_0x1ec1be){const _0x15ef2d=a62_0x10cd4f;return a62_0x4c9bc2[_0x15ef2d(0x130)](getProfilesDir(),_0x1ec1be);}function getProfileConfigPath(_0x280953){const _0x3bb70e=a62_0x10cd4f;return a62_0x4c9bc2[_0x3bb70e(0x130)](getProfileDir(_0x280953),'tdx.json');}function getProfileEnvPath(_0x54eb38){const _0x2ca7c0=a62_0x10cd4f;return a62_0x4c9bc2[_0x2ca7c0(0x130)](getProfileDir(_0x54eb38),_0x2ca7c0(0x13f));}function getGlobalConfigPath(){const _0x3ed335=a62_0x10cd4f;return a62_0x4c9bc2[_0x3ed335(0x130)](getConfigDir(),_0x3ed335(0x160));}function validateProfileName(_0x36a72d){const _0x43c8f8=a62_0x10cd4f;if(/^@?[a-zA-Z0-9_-]+$/[_0x43c8f8(0x13a)](_0x36a72d))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x43c8f8(0x13a)](_0x36a72d))return;throw new Error(_0x43c8f8(0x127)+_0x36a72d+_0x43c8f8(0x152));}function validateProfileConfig(_0x2dc3fa,_0x17a6e0){const _0x5554d0=a62_0x10cd4f;if(typeof _0x2dc3fa!==_0x5554d0(0x13d)||_0x2dc3fa===null)throw new SDKError(ErrorCode[_0x5554d0(0x117)],_0x5554d0(0x12a)+_0x17a6e0+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x5c2292=[_0x5554d0(0x14a),'site','database','parent_segment','llm_project',_0x5554d0(0x146),_0x5554d0(0x121)],_0x168794=_0x2dc3fa;for(const _0x490e29 of Object['keys'](_0x168794)){!_0x5c2292['includes'](_0x490e29)&&console[_0x5554d0(0x15c)]('Warning:\x20Profile\x20\x27'+_0x17a6e0+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x490e29+_0x5554d0(0x11d));}if(_0x168794['description']!==undefined&&typeof _0x168794[_0x5554d0(0x14a)]!==_0x5554d0(0x14b))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5554d0(0x12a)+_0x17a6e0+_0x5554d0(0x11a));if(_0x168794[_0x5554d0(0x164)]!==undefined&&typeof _0x168794[_0x5554d0(0x164)]!==_0x5554d0(0x14b))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5554d0(0x12a)+_0x17a6e0+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x168794[_0x5554d0(0x147)]!==undefined&&typeof _0x168794[_0x5554d0(0x147)]!==_0x5554d0(0x14b))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x5554d0(0x12a)+_0x17a6e0+_0x5554d0(0x11f));if(_0x168794[_0x5554d0(0x157)]!==undefined&&typeof _0x168794['parent_segment']!==_0x5554d0(0x14b))throw new SDKError(ErrorCode[_0x5554d0(0x117)],_0x5554d0(0x12a)+_0x17a6e0+_0x5554d0(0x136));if(_0x168794[_0x5554d0(0x116)]!==undefined&&typeof _0x168794[_0x5554d0(0x116)]!==_0x5554d0(0x14b))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x17a6e0+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x168794[_0x5554d0(0x146)]!==undefined&&typeof _0x168794[_0x5554d0(0x146)]!==_0x5554d0(0x14b))throw new SDKError(ErrorCode[_0x5554d0(0x117)],'Profile\x20\x27'+_0x17a6e0+_0x5554d0(0x138));return!![];}function loadProfilesFromTdxJson(_0x5ea7e9,_0x1c5f1a){const _0x5f08a8=a62_0x10cd4f;if(!a62_0x4de636[_0x5f08a8(0x14f)](_0x5ea7e9))return[];try{const _0x414f3c=a62_0x4de636[_0x5f08a8(0x158)](_0x5ea7e9,'utf-8'),_0x46e9f1=JSON[_0x5f08a8(0x15d)](_0x414f3c);if(!_0x46e9f1[_0x5f08a8(0x124)]||typeof _0x46e9f1[_0x5f08a8(0x124)]!=='object')return[];const _0x2d8c75=[];for(const [_0x49dbc8,_0x58d55f]of Object[_0x5f08a8(0x150)](_0x46e9f1[_0x5f08a8(0x124)])){try{validateProfileConfig(_0x58d55f,_0x49dbc8);const _0x46eb27=getNewCredentialPath(_0x49dbc8),_0x46d94f=getOldCredentialPath(_0x49dbc8),_0x480a74=a62_0x4de636[_0x5f08a8(0x14f)](_0x46eb27)||a62_0x4de636[_0x5f08a8(0x14f)](_0x46d94f);_0x2d8c75['push']({'name':_0x49dbc8,'config':_0x58d55f,'metadata':{'name':_0x49dbc8,'createdAt':new Date()[_0x5f08a8(0x119)]()},'hasCredentials':_0x480a74,'scope':_0x1c5f1a});}catch(_0x24c614){_0x24c614 instanceof Error&&(console[_0x5f08a8(0x15c)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x5ea7e9+':'),console[_0x5f08a8(0x15c)]('\x20\x20'+_0x24c614[_0x5f08a8(0x13c)]+'\x0a'));}}return _0x2d8c75;}catch(_0x5412c0){return _0x5412c0 instanceof SyntaxError?(console['warn'](_0x5f08a8(0x11b)+_0x5ea7e9+_0x5f08a8(0x133)),console[_0x5f08a8(0x15c)]('Error:\x20'+_0x5412c0[_0x5f08a8(0x13c)]+'\x0a')):console[_0x5f08a8(0x15c)](_0x5f08a8(0x135)+_0x5ea7e9+':\x20'+_0x5412c0+'\x0a'),[];}}export function getNewCredentialPath(_0x331d61){const _0x3d137b=a62_0x10cd4f;return a62_0x4c9bc2[_0x3d137b(0x130)](getConfigDir(),_0x3d137b(0x12b)+_0x331d61);}function getOldCredentialPath(_0x504586){const _0x1a4097=a62_0x10cd4f;return a62_0x4c9bc2[_0x1a4097(0x130)](getProfilesDir(),_0x504586,_0x1a4097(0x13f));}function loadProfilesFromTdxJsonFiles(){const _0x211e8c=a62_0x10cd4f,_0x5a54bb=[],_0x1ff054=findProjectConfigPath();_0x1ff054&&_0x5a54bb['push'](...loadProfilesFromTdxJson(_0x1ff054,_0x211e8c(0x140)));const _0x27af5b=a62_0x4c9bc2[_0x211e8c(0x130)](getConfigDir(),_0x211e8c(0x160));return _0x5a54bb[_0x211e8c(0x12e)](...loadProfilesFromTdxJson(_0x27af5b,_0x211e8c(0x14c))),_0x5a54bb;}function loadProfilesFromDirectories(){const _0xfe04a3=a62_0x10cd4f,_0x2722c0=getProfilesDir();if(!a62_0x4de636[_0xfe04a3(0x14f)](_0x2722c0))return[];try{return a62_0x4de636['readdirSync'](_0x2722c0,{'withFileTypes':!![]})[_0xfe04a3(0x153)](_0x390ca0=>_0x390ca0['isDirectory']())[_0xfe04a3(0x13b)](_0x524759=>_0x524759[_0xfe04a3(0x118)])[_0xfe04a3(0x153)](_0x16710a=>{const _0x1fec8c=_0xfe04a3,_0x469148=getProfileConfigPath(_0x16710a),_0x3fb624=getProfileEnvPath(_0x16710a);return a62_0x4de636[_0x1fec8c(0x14f)](_0x469148)||a62_0x4de636[_0x1fec8c(0x14f)](_0x3fb624);})[_0xfe04a3(0x13b)](_0x5186eb=>{const _0x341aad=_0xfe04a3,_0x297ff8=loadProfileFromDirectory(_0x5186eb);if(_0x297ff8)return{..._0x297ff8,'scope':_0x341aad(0x129)};return null;})[_0xfe04a3(0x153)](_0xbf9d02=>_0xbf9d02!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2ddc4b){const _0x1230e6=a62_0x10cd4f,_0x576353=getProfileConfigPath(_0x2ddc4b),_0x20a159=getOldCredentialPath(_0x2ddc4b);if(!a62_0x4de636[_0x1230e6(0x14f)](_0x576353)&&!a62_0x4de636['existsSync'](_0x20a159))return null;let _0x40c9e6={},_0x1ab315={'name':_0x2ddc4b,'createdAt':new Date()[_0x1230e6(0x119)]()};if(a62_0x4de636[_0x1230e6(0x14f)](_0x576353))try{const _0x354e2c=a62_0x4de636['readFileSync'](_0x576353,'utf-8'),_0x26c2ac=JSON[_0x1230e6(0x15d)](_0x354e2c),{metadata:_0x5bd7fa,..._0x3a4295}=_0x26c2ac;_0x40c9e6=_0x3a4295,_0x5bd7fa&&(_0x1ab315=_0x5bd7fa);}catch{}return{'name':_0x2ddc4b,'config':_0x40c9e6,'metadata':_0x1ab315,'hasCredentials':a62_0x4de636['existsSync'](_0x20a159),'scope':_0x1230e6(0x129)};}export function listProfiles(){const _0xb67348=a62_0x10cd4f,_0x6febd5=loadProfilesFromTdxJsonFiles(),_0x24889d=loadProfilesFromDirectories();if(_0x24889d[_0xb67348(0x149)]>0x0){const _0x52980b=_0x24889d[_0xb67348(0x13b)](_0xc91817=>_0xc91817['name'])[_0xb67348(0x130)](',\x20'),_0x5447b3=getConfigDir();console[_0xb67348(0x15c)](_0xb67348(0x122)+_0x52980b),console[_0xb67348(0x15c)](_0xb67348(0x143)),console[_0xb67348(0x15c)](_0xb67348(0x14d)+a62_0x4c9bc2[_0xb67348(0x130)](_0x5447b3,_0xb67348(0x160))),console[_0xb67348(0x15c)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0xb67348(0x15c)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x4caa20=[..._0x6febd5,..._0x24889d],_0x422146=new Map();for(const _0x4c10d6 of _0x4caa20){!_0x422146[_0xb67348(0x156)](_0x4c10d6[_0xb67348(0x118)])&&_0x422146[_0xb67348(0x12f)](_0x4c10d6[_0xb67348(0x118)],_0x4c10d6);}return Array[_0xb67348(0x144)](_0x422146['values']())[_0xb67348(0x15a)]((_0x1c5010,_0x380867)=>_0x1c5010[_0xb67348(0x118)][_0xb67348(0x11e)](_0x380867[_0xb67348(0x118)]));}export function profileExists(_0x40c38){const _0x118182=a62_0x10cd4f,_0x5010e4=listProfiles();return _0x5010e4[_0x118182(0x134)](_0xfa352d=>_0xfa352d[_0x118182(0x118)]===_0x40c38);}export function loadProfile(_0x3ae0e9){const _0x20bb57=a62_0x10cd4f;validateProfileName(_0x3ae0e9);const _0x48a1c8=listProfiles(),_0x5ad199=_0x48a1c8[_0x20bb57(0x159)](_0x41c68a=>_0x41c68a['name']===_0x3ae0e9);return _0x5ad199||null;}export function saveProfile(_0x11cc1e,_0x25068c,_0x554c9e=![]){saveProfileToUserConfig(_0x11cc1e,_0x25068c);}export function deleteProfile(_0x3d9b14){const _0xabfda9=a62_0x10cd4f;validateProfileName(_0x3d9b14);const _0x128f65=getProfileDir(_0x3d9b14);if(!a62_0x4de636[_0xabfda9(0x14f)](_0x128f65))throw new Error(_0xabfda9(0x126)+_0x3d9b14+'\x20does\x20not\x20exist');a62_0x4de636['rmSync'](_0x128f65,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1ded8f,_0x361838){const _0x352496=a62_0x10cd4f;validateProfileName(_0x1ded8f);const _0xf63231=getGlobalConfigPath(),_0x35ddf8=getConfigDir();!a62_0x4de636[_0x352496(0x14f)](_0x35ddf8)&&createSecureDirectory(_0x35ddf8);let _0x1d677={};if(a62_0x4de636[_0x352496(0x14f)](_0xf63231))try{const _0x364b69=a62_0x4de636['readFileSync'](_0xf63231,_0x352496(0x11c));_0x1d677=JSON[_0x352496(0x15d)](_0x364b69);}catch{console[_0x352496(0x15c)](_0x352496(0x162)+_0xf63231+_0x352496(0x13e));}!_0x1d677[_0x352496(0x124)]&&(_0x1d677[_0x352496(0x124)]={}),_0x1d677[_0x352496(0x124)][_0x1ded8f]=_0x361838,writeSecureFile(_0xf63231,JSON['stringify'](_0x1d677,null,0x2));}export function removeProfileFromUserConfig(_0x3f569c){const _0x553788=a62_0x10cd4f;validateProfileName(_0x3f569c);const _0x320363=getGlobalConfigPath();if(!a62_0x4de636[_0x553788(0x14f)](_0x320363))throw new Error(_0x553788(0x12a)+_0x3f569c+_0x553788(0x12d));let _0x45f5ed={};try{const _0xde2906=a62_0x4de636[_0x553788(0x158)](_0x320363,_0x553788(0x11c));_0x45f5ed=JSON[_0x553788(0x15d)](_0xde2906);}catch{throw new Error(_0x553788(0x137)+_0x320363);}if(!_0x45f5ed[_0x553788(0x124)]||!_0x45f5ed[_0x553788(0x124)][_0x3f569c])throw new Error(_0x553788(0x12a)+_0x3f569c+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x45f5ed[_0x553788(0x124)][_0x3f569c],_0x45f5ed[_0x553788(0x155)]===_0x3f569c&&delete _0x45f5ed[_0x553788(0x155)],writeSecureFile(_0x320363,JSON['stringify'](_0x45f5ed,null,0x2));}export function getActiveProfile(){const _0x2e1f0b=a62_0x10cd4f,_0x3198fd=loadSessionContext();if(_0x3198fd?.['profile'])return _0x3198fd['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x28d408=getGlobalConfigPath();if(!a62_0x4de636[_0x2e1f0b(0x14f)](_0x28d408))return null;try{const _0x1aa613=a62_0x4de636[_0x2e1f0b(0x158)](_0x28d408,'utf-8'),_0x13b19b=JSON[_0x2e1f0b(0x15d)](_0x1aa613);return _0x13b19b[_0x2e1f0b(0x155)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x2447fc){const _0x5a5373=a62_0x10cd4f,_0x58f1f8=getGlobalConfigPath(),_0x12e89d=getConfigDir();!a62_0x4de636[_0x5a5373(0x14f)](_0x12e89d)&&createSecureDirectory(_0x12e89d);let _0x2e1b62={};if(a62_0x4de636[_0x5a5373(0x14f)](_0x58f1f8))try{const _0x5a4536=a62_0x4de636[_0x5a5373(0x158)](_0x58f1f8,_0x5a5373(0x11c));_0x2e1b62=JSON[_0x5a5373(0x15d)](_0x5a4536);}catch{console['warn'](_0x5a5373(0x162)+_0x58f1f8+_0x5a5373(0x13e));}_0x2e1b62[_0x5a5373(0x164)]=_0x2447fc,writeSecureFile(_0x58f1f8,JSON[_0x5a5373(0x120)](_0x2e1b62,null,0x2));}function a62_0x1bf1(_0x5599b4,_0x1bf690){_0x5599b4=_0x5599b4-0x116;const _0x3cd0fd=a62_0x3cd0();let _0x1bf16e=_0x3cd0fd[_0x5599b4];return _0x1bf16e;}export function saveActiveProfileToUserConfig(_0x12af87){const _0x468c0a=a62_0x10cd4f;validateProfileName(_0x12af87);const _0xc21376=getGlobalConfigPath(),_0x1f23dc=getConfigDir();!a62_0x4de636[_0x468c0a(0x14f)](_0x1f23dc)&&createSecureDirectory(_0x1f23dc);let _0x212e4c={};if(a62_0x4de636[_0x468c0a(0x14f)](_0xc21376))try{const _0x2bcf27=a62_0x4de636['readFileSync'](_0xc21376,_0x468c0a(0x11c));_0x212e4c=JSON['parse'](_0x2bcf27);}catch{console[_0x468c0a(0x15c)](_0x468c0a(0x162)+_0xc21376+',\x20creating\x20new\x20file');}_0x212e4c[_0x468c0a(0x155)]=_0x12af87,writeSecureFile(_0xc21376,JSON[_0x468c0a(0x120)](_0x212e4c,null,0x2));}function clearFieldFromUserConfig(_0x2a4afa){const _0xf5023e=a62_0x10cd4f,_0x50e765=getGlobalConfigPath();if(!a62_0x4de636[_0xf5023e(0x14f)](_0x50e765))return;let _0x5aada3={};try{const _0x3b0791=a62_0x4de636[_0xf5023e(0x158)](_0x50e765,'utf-8');_0x5aada3=JSON['parse'](_0x3b0791);}catch{return;}delete _0x5aada3[_0x2a4afa],writeSecureFile(_0x50e765,JSON[_0xf5023e(0x120)](_0x5aada3,null,0x2));}function a62_0x3cd0(){const _0x4cd5c1=['profiles','14185610IrvONl','Profile\x20','Invalid\x20profile\x20name:\x20','9JcxfeO','directory','Profile\x20\x27','.env.','\x20already\x20exists','\x27\x20not\x20found\x20in\x20user\x20configuration','push','set','join','547778gnycZK','429VlGWtB',':\x20Invalid\x20JSON\x20syntax','some','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Failed\x20to\x20parse\x20','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','test','map','message','object',',\x20creating\x20new\x20file','.env','local','@tdx-studio','1310488sdtJvT','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','from','158124UAlZml','llm_agent','database','12620840CtQMRH','length','description','string','user','\x20\x201.\x20Edit:\x20','\x20does\x20not\x20exist','existsSync','entries','5CXjazj','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','filter','To\x20migrate:','profile','has','parent_segment','readFileSync','find','sort','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','warn','parse','158xgFpzo','7jxGdrP','tdx.json','\x22\x20\x22','Warning:\x20Failed\x20to\x20parse\x20','35853JxrSrV','site','llm_project','INVALID_PROFILE_CONFIG','name','toISOString','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20parse\x20','utf-8','\x27\x20will\x20be\x20ignored','localeCompare','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','stringify','user_info','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','7686114NlhZHn'];a62_0x3cd0=function(){return _0x4cd5c1;};return a62_0x3cd0();}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x270bfc=a62_0x10cd4f;clearFieldFromUserConfig(_0x270bfc(0x155));}export function createProfile(_0x297cd1,_0x203ca6){const _0x46c3dd=a62_0x10cd4f;validateProfileName(_0x297cd1);if(profileExists(_0x297cd1))throw new Error('Profile\x20'+_0x297cd1+_0x46c3dd(0x12c));saveProfile(_0x297cd1,_0x203ca6);}export function saveProfileCredentials(_0x1d3c06,_0x3b7c2b){const _0x2606ba=a62_0x10cd4f;validateProfileName(_0x1d3c06);if(!profileExists(_0x1d3c06))throw new Error('Profile\x20'+_0x1d3c06+_0x2606ba(0x14e));const _0x251279=getNewCredentialPath(_0x1d3c06);writeSecureFile(_0x251279,_0x3b7c2b);}export function loadProfileCredentials(_0x50a210){const _0x4cd3fa=a62_0x10cd4f;validateProfileName(_0x50a210);const _0x329e51=getNewCredentialPath(_0x50a210);if(a62_0x4de636[_0x4cd3fa(0x14f)](_0x329e51))try{return a62_0x4de636[_0x4cd3fa(0x158)](_0x329e51,_0x4cd3fa(0x11c));}catch{}const _0x1a37f1=getOldCredentialPath(_0x50a210);if(a62_0x4de636[_0x4cd3fa(0x14f)](_0x1a37f1)){console[_0x4cd3fa(0x15c)](_0x4cd3fa(0x139)+_0x50a210+'\x27'),console[_0x4cd3fa(0x15c)](_0x4cd3fa(0x154)),console['warn']('\x20\x20mv\x20\x22'+_0x1a37f1+_0x4cd3fa(0x161)+_0x329e51+'\x22'),console['warn'](_0x4cd3fa(0x15b));try{return a62_0x4de636[_0x4cd3fa(0x158)](_0x1a37f1,_0x4cd3fa(0x11c));}catch{return null;}}return null;}
1
+ function a62_0x4052(){const _0x3b913a=['warn','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x27:\x20config\x20must\x20be\x20an\x20object','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','Error:\x20','profiles','parse','set','readFileSync','1022511akYQbp','stringify','message','\x27\x20will\x20be\x20ignored','\x20does\x20not\x20exist','from','\x22\x20\x22','test','filter','database','entries','Invalid\x20profile\x20name:\x20','To\x20migrate:','has','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','some','localeCompare','Warning:\x20Profile\x20\x27','sort','2QIhzXc','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x27\x20not\x20found\x20in\x20user\x20configuration','site','utf-8','existsSync','object','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x27:\x20unknown\x20config\x20key\x20\x27','length','string','Failed\x20to\x20parse\x20','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','3054648FWyWfy','.env','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','@tdx-studio','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','description','parent_segment','readdirSync','2262305SJJAuG','profile','user_info','local','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','.env.','3191447xCHaxd','Profile\x20','\x0aWarning:\x20Failed\x20to\x20parse\x20','1210704WMBxBv','llm_agent','Warning:\x20Failed\x20to\x20parse\x20','Profile\x20\x27','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','480268bVNCfS','map',',\x20creating\x20new\x20file','join','find','2425122yaPxHx','tdx.json','values','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','directory','name','push','toISOString','keys',':\x20Invalid\x20JSON\x20syntax','llm_project','rmSync','INVALID_PROFILE_CONFIG'];a62_0x4052=function(){return _0x3b913a;};return a62_0x4052();}const a62_0x153bd8=a62_0x1278;(function(_0x622c4a,_0x2c628d){const _0x2a69ea=a62_0x1278,_0x22f654=_0x622c4a();while(!![]){try{const _0xcb9566=-parseInt(_0x2a69ea(0x1c3))/0x1*(parseInt(_0x2a69ea(0x19f))/0x2)+-parseInt(_0x2a69ea(0x1df))/0x3+parseInt(_0x2a69ea(0x1bd))/0x4+parseInt(_0x2a69ea(0x1b4))/0x5+parseInt(_0x2a69ea(0x1c8))/0x6+-parseInt(_0x2a69ea(0x1ba))/0x7+parseInt(_0x2a69ea(0x1ac))/0x8;if(_0xcb9566===_0x2c628d)break;else _0x22f654['push'](_0x22f654['shift']());}catch(_0x4809b0){_0x22f654['push'](_0x22f654['shift']());}}}(a62_0x4052,0x407c1));import*as a62_0x15430e from'node:fs';import*as a62_0x3d50b8 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a62_0x153bd8(0x1af);export function getProfileParams(_0x4f9c08){const _0x55b788=a62_0x153bd8,_0x37aaa4={};if(!_0x4f9c08)return _0x37aaa4;for(const [_0x452da8,_0x11d232]of Object[_0x55b788(0x196)](_0x4f9c08)){_0x452da8!=='description'&&_0x11d232!==undefined&&(_0x37aaa4[_0x452da8]=_0x11d232);}return _0x37aaa4;}export function getProfilesDir(){const _0x2a8dea=a62_0x153bd8;return a62_0x3d50b8[_0x2a8dea(0x1c6)](getConfigDir(),_0x2a8dea(0x1db));}function getProfileDir(_0x4c2344){const _0x48f36a=a62_0x153bd8;return a62_0x3d50b8[_0x48f36a(0x1c6)](getProfilesDir(),_0x4c2344);}function getProfileConfigPath(_0x2b79c3){const _0x47699a=a62_0x153bd8;return a62_0x3d50b8[_0x47699a(0x1c6)](getProfileDir(_0x2b79c3),'tdx.json');}function getProfileEnvPath(_0x15ea1f){const _0x2e8f9d=a62_0x153bd8;return a62_0x3d50b8['join'](getProfileDir(_0x15ea1f),_0x2e8f9d(0x1ad));}function getGlobalConfigPath(){const _0x434eef=a62_0x153bd8;return a62_0x3d50b8[_0x434eef(0x1c6)](getConfigDir(),'tdx.json');}function validateProfileName(_0x380ff0){const _0x2d6d98=a62_0x153bd8;if(/^@?[a-zA-Z0-9_-]+$/[_0x2d6d98(0x1e6)](_0x380ff0))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x2d6d98(0x1e6)](_0x380ff0))return;throw new Error(_0x2d6d98(0x197)+_0x380ff0+_0x2d6d98(0x19a));}function validateProfileConfig(_0x4c251e,_0x2280a9){const _0x2dc79f=a62_0x153bd8;if(typeof _0x4c251e!=='object'||_0x4c251e===null)throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1d8));const _0x162c56=[_0x2dc79f(0x1b1),_0x2dc79f(0x1a2),_0x2dc79f(0x1e8),'parent_segment',_0x2dc79f(0x1d2),_0x2dc79f(0x1be),_0x2dc79f(0x1b6)],_0x2d79e1=_0x4c251e;for(const _0x2f2efc of Object[_0x2dc79f(0x1d0)](_0x2d79e1)){!_0x162c56['includes'](_0x2f2efc)&&console[_0x2dc79f(0x1d5)](_0x2dc79f(0x19d)+_0x2280a9+_0x2dc79f(0x1a7)+_0x2f2efc+_0x2dc79f(0x1e2));}if(_0x2d79e1[_0x2dc79f(0x1b1)]!==undefined&&typeof _0x2d79e1['description']!==_0x2dc79f(0x1a9))throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],_0x2dc79f(0x1c0)+_0x2280a9+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x2d79e1[_0x2dc79f(0x1a2)]!==undefined&&typeof _0x2d79e1['site']!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1c1));if(_0x2d79e1[_0x2dc79f(0x1e8)]!==undefined&&typeof _0x2d79e1['database']!==_0x2dc79f(0x1a9))throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1d6));if(_0x2d79e1[_0x2dc79f(0x1b2)]!==undefined&&typeof _0x2d79e1[_0x2dc79f(0x1b2)]!=='string')throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],'Profile\x20\x27'+_0x2280a9+_0x2dc79f(0x1a0));if(_0x2d79e1[_0x2dc79f(0x1d2)]!==undefined&&typeof _0x2d79e1[_0x2dc79f(0x1d2)]!==_0x2dc79f(0x1a9))throw new SDKError(ErrorCode[_0x2dc79f(0x1d4)],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1ae));if(_0x2d79e1['llm_agent']!==undefined&&typeof _0x2d79e1['llm_agent']!==_0x2dc79f(0x1a9))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x2dc79f(0x1c0)+_0x2280a9+_0x2dc79f(0x1a6));return!![];}function loadProfilesFromTdxJson(_0x2e0048,_0x5bbd8d){const _0x208dfa=a62_0x153bd8;if(!a62_0x15430e[_0x208dfa(0x1a4)](_0x2e0048))return[];try{const _0x5ce378=a62_0x15430e[_0x208dfa(0x1de)](_0x2e0048,_0x208dfa(0x1a3)),_0x48d528=JSON[_0x208dfa(0x1dc)](_0x5ce378);if(!_0x48d528[_0x208dfa(0x1db)]||typeof _0x48d528[_0x208dfa(0x1db)]!==_0x208dfa(0x1a5))return[];const _0x2732e2=[];for(const [_0x5d8941,_0x573f98]of Object[_0x208dfa(0x196)](_0x48d528['profiles'])){try{validateProfileConfig(_0x573f98,_0x5d8941);const _0x41aae3=getNewCredentialPath(_0x5d8941),_0x278446=getOldCredentialPath(_0x5d8941),_0x289578=a62_0x15430e['existsSync'](_0x41aae3)||a62_0x15430e[_0x208dfa(0x1a4)](_0x278446);_0x2732e2[_0x208dfa(0x1ce)]({'name':_0x5d8941,'config':_0x573f98,'metadata':{'name':_0x5d8941,'createdAt':new Date()[_0x208dfa(0x1cf)]()},'hasCredentials':_0x289578,'scope':_0x5bbd8d});}catch(_0x32a615){_0x32a615 instanceof Error&&(console[_0x208dfa(0x1d5)](_0x208dfa(0x1b8)+_0x2e0048+':'),console[_0x208dfa(0x1d5)]('\x20\x20'+_0x32a615[_0x208dfa(0x1e1)]+'\x0a'));}}return _0x2732e2;}catch(_0x59a23b){return _0x59a23b instanceof SyntaxError?(console[_0x208dfa(0x1d5)](_0x208dfa(0x1bc)+_0x2e0048+_0x208dfa(0x1d1)),console['warn'](_0x208dfa(0x1da)+_0x59a23b[_0x208dfa(0x1e1)]+'\x0a')):console['warn']('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x2e0048+':\x20'+_0x59a23b+'\x0a'),[];}}export function getNewCredentialPath(_0x2d6a79){const _0x80820b=a62_0x153bd8;return a62_0x3d50b8[_0x80820b(0x1c6)](getConfigDir(),_0x80820b(0x1b9)+_0x2d6a79);}function getOldCredentialPath(_0x23c250){const _0x3d0e1d=a62_0x153bd8;return a62_0x3d50b8[_0x3d0e1d(0x1c6)](getProfilesDir(),_0x23c250,_0x3d0e1d(0x1ad));}function loadProfilesFromTdxJsonFiles(){const _0x472904=a62_0x153bd8,_0x1a6258=[],_0x3c8a17=findProjectConfigPath();_0x3c8a17&&_0x1a6258[_0x472904(0x1ce)](...loadProfilesFromTdxJson(_0x3c8a17,_0x472904(0x1b7)));const _0x4febc9=a62_0x3d50b8[_0x472904(0x1c6)](getConfigDir(),_0x472904(0x1c9));return _0x1a6258['push'](...loadProfilesFromTdxJson(_0x4febc9,'user')),_0x1a6258;}function loadProfilesFromDirectories(){const _0x51d0a7=a62_0x153bd8,_0x2c94b4=getProfilesDir();if(!a62_0x15430e[_0x51d0a7(0x1a4)](_0x2c94b4))return[];try{return a62_0x15430e[_0x51d0a7(0x1b3)](_0x2c94b4,{'withFileTypes':!![]})[_0x51d0a7(0x1e7)](_0xc11108=>_0xc11108['isDirectory']())[_0x51d0a7(0x1c4)](_0x27b924=>_0x27b924['name'])[_0x51d0a7(0x1e7)](_0x3bc40b=>{const _0x227ca9=_0x51d0a7,_0x4e086f=getProfileConfigPath(_0x3bc40b),_0x5ecda8=getProfileEnvPath(_0x3bc40b);return a62_0x15430e[_0x227ca9(0x1a4)](_0x4e086f)||a62_0x15430e[_0x227ca9(0x1a4)](_0x5ecda8);})[_0x51d0a7(0x1c4)](_0x7d8e45=>{const _0x84f810=_0x51d0a7,_0x398c5e=loadProfileFromDirectory(_0x7d8e45);if(_0x398c5e)return{..._0x398c5e,'scope':_0x84f810(0x1cc)};return null;})[_0x51d0a7(0x1e7)](_0x4a34fc=>_0x4a34fc!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4a36ae){const _0x4af2c3=a62_0x153bd8,_0x48b5d7=getProfileConfigPath(_0x4a36ae),_0x1aeedc=getOldCredentialPath(_0x4a36ae);if(!a62_0x15430e[_0x4af2c3(0x1a4)](_0x48b5d7)&&!a62_0x15430e[_0x4af2c3(0x1a4)](_0x1aeedc))return null;let _0x8cc0d={},_0x164bf4={'name':_0x4a36ae,'createdAt':new Date()[_0x4af2c3(0x1cf)]()};if(a62_0x15430e['existsSync'](_0x48b5d7))try{const _0x490e2e=a62_0x15430e[_0x4af2c3(0x1de)](_0x48b5d7,_0x4af2c3(0x1a3)),_0x188be2=JSON[_0x4af2c3(0x1dc)](_0x490e2e),{metadata:_0xfe9e70,..._0x55ab10}=_0x188be2;_0x8cc0d=_0x55ab10,_0xfe9e70&&(_0x164bf4=_0xfe9e70);}catch{}return{'name':_0x4a36ae,'config':_0x8cc0d,'metadata':_0x164bf4,'hasCredentials':a62_0x15430e['existsSync'](_0x1aeedc),'scope':'directory'};}export function listProfiles(){const _0xde44cd=a62_0x153bd8,_0x24aef0=loadProfilesFromTdxJsonFiles(),_0x1c9dcf=loadProfilesFromDirectories();if(_0x1c9dcf[_0xde44cd(0x1a8)]>0x0){const _0x226cf6=_0x1c9dcf[_0xde44cd(0x1c4)](_0x656c1c=>_0x656c1c[_0xde44cd(0x1cd)])[_0xde44cd(0x1c6)](',\x20'),_0x337feb=getConfigDir();console[_0xde44cd(0x1d5)](_0xde44cd(0x1b0)+_0x226cf6),console[_0xde44cd(0x1d5)](_0xde44cd(0x1cb)),console['warn']('\x20\x201.\x20Edit:\x20'+a62_0x3d50b8['join'](_0x337feb,_0xde44cd(0x1c9))),console['warn'](_0xde44cd(0x1c2)),console[_0xde44cd(0x1d5)](_0xde44cd(0x1d7));}const _0xf1e938=[..._0x24aef0,..._0x1c9dcf],_0x3a58e4=new Map();for(const _0x46a6b3 of _0xf1e938){!_0x3a58e4[_0xde44cd(0x199)](_0x46a6b3[_0xde44cd(0x1cd)])&&_0x3a58e4[_0xde44cd(0x1dd)](_0x46a6b3['name'],_0x46a6b3);}return Array[_0xde44cd(0x1e4)](_0x3a58e4[_0xde44cd(0x1ca)]())[_0xde44cd(0x19e)]((_0x330878,_0x37d62f)=>_0x330878[_0xde44cd(0x1cd)][_0xde44cd(0x19c)](_0x37d62f['name']));}export function profileExists(_0x268b71){const _0x3ad16f=a62_0x153bd8,_0x1bdbc0=listProfiles();return _0x1bdbc0[_0x3ad16f(0x19b)](_0x2d78ac=>_0x2d78ac[_0x3ad16f(0x1cd)]===_0x268b71);}export function loadProfile(_0x5178b9){const _0x59a5e3=a62_0x153bd8;validateProfileName(_0x5178b9);const _0x5b9aea=listProfiles(),_0x307767=_0x5b9aea[_0x59a5e3(0x1c7)](_0x4ace15=>_0x4ace15[_0x59a5e3(0x1cd)]===_0x5178b9);return _0x307767||null;}export function saveProfile(_0x44162f,_0x582c8c,_0x5424fc=![]){saveProfileToUserConfig(_0x44162f,_0x582c8c);}function a62_0x1278(_0x15b68a,_0x554be9){_0x15b68a=_0x15b68a-0x196;const _0x405226=a62_0x4052();let _0x1278c7=_0x405226[_0x15b68a];return _0x1278c7;}export function deleteProfile(_0x1b3229){const _0x2e9bd5=a62_0x153bd8;validateProfileName(_0x1b3229);const _0x224894=getProfileDir(_0x1b3229);if(!a62_0x15430e[_0x2e9bd5(0x1a4)](_0x224894))throw new Error(_0x2e9bd5(0x1bb)+_0x1b3229+_0x2e9bd5(0x1e3));a62_0x15430e[_0x2e9bd5(0x1d3)](_0x224894,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x48755e,_0x312025){const _0x886227=a62_0x153bd8;validateProfileName(_0x48755e);const _0x263ecf=getGlobalConfigPath(),_0x36e259=getConfigDir();!a62_0x15430e['existsSync'](_0x36e259)&&createSecureDirectory(_0x36e259);let _0x28a495={};if(a62_0x15430e[_0x886227(0x1a4)](_0x263ecf))try{const _0x32dda0=a62_0x15430e[_0x886227(0x1de)](_0x263ecf,_0x886227(0x1a3));_0x28a495=JSON[_0x886227(0x1dc)](_0x32dda0);}catch{console[_0x886227(0x1d5)](_0x886227(0x1bf)+_0x263ecf+_0x886227(0x1c5));}!_0x28a495[_0x886227(0x1db)]&&(_0x28a495['profiles']={}),_0x28a495[_0x886227(0x1db)][_0x48755e]=_0x312025,writeSecureFile(_0x263ecf,JSON[_0x886227(0x1e0)](_0x28a495,null,0x2));}export function removeProfileFromUserConfig(_0x261ddb){const _0x4abff2=a62_0x153bd8;validateProfileName(_0x261ddb);const _0x536b17=getGlobalConfigPath();if(!a62_0x15430e[_0x4abff2(0x1a4)](_0x536b17))throw new Error(_0x4abff2(0x1c0)+_0x261ddb+_0x4abff2(0x1a1));let _0x2dd0c4={};try{const _0x5e577a=a62_0x15430e['readFileSync'](_0x536b17,_0x4abff2(0x1a3));_0x2dd0c4=JSON['parse'](_0x5e577a);}catch{throw new Error(_0x4abff2(0x1aa)+_0x536b17);}if(!_0x2dd0c4[_0x4abff2(0x1db)]||!_0x2dd0c4[_0x4abff2(0x1db)][_0x261ddb])throw new Error('Profile\x20\x27'+_0x261ddb+_0x4abff2(0x1a1));delete _0x2dd0c4[_0x4abff2(0x1db)][_0x261ddb],_0x2dd0c4[_0x4abff2(0x1b5)]===_0x261ddb&&delete _0x2dd0c4[_0x4abff2(0x1b5)],writeSecureFile(_0x536b17,JSON[_0x4abff2(0x1e0)](_0x2dd0c4,null,0x2));}export function getActiveProfile(){const _0x1ddd9f=a62_0x153bd8,_0x3899c8=loadSessionContext();if(_0x3899c8?.[_0x1ddd9f(0x1b5)])return _0x3899c8['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x32a9d2=getGlobalConfigPath();if(!a62_0x15430e[_0x1ddd9f(0x1a4)](_0x32a9d2))return null;try{const _0x4ac8a3=a62_0x15430e[_0x1ddd9f(0x1de)](_0x32a9d2,_0x1ddd9f(0x1a3)),_0x1df41c=JSON['parse'](_0x4ac8a3);return _0x1df41c[_0x1ddd9f(0x1b5)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x2ab2db){const _0x350afc=a62_0x153bd8,_0x59f664=getGlobalConfigPath(),_0x48d729=getConfigDir();!a62_0x15430e['existsSync'](_0x48d729)&&createSecureDirectory(_0x48d729);let _0x1bf7c5={};if(a62_0x15430e[_0x350afc(0x1a4)](_0x59f664))try{const _0x41c88d=a62_0x15430e[_0x350afc(0x1de)](_0x59f664,_0x350afc(0x1a3));_0x1bf7c5=JSON[_0x350afc(0x1dc)](_0x41c88d);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x59f664+_0x350afc(0x1c5));}_0x1bf7c5[_0x350afc(0x1a2)]=_0x2ab2db,writeSecureFile(_0x59f664,JSON[_0x350afc(0x1e0)](_0x1bf7c5,null,0x2));}export function saveActiveProfileToUserConfig(_0x42110d){const _0x37dd97=a62_0x153bd8;validateProfileName(_0x42110d);const _0x57f9ae=getGlobalConfigPath(),_0x2ad1ad=getConfigDir();!a62_0x15430e[_0x37dd97(0x1a4)](_0x2ad1ad)&&createSecureDirectory(_0x2ad1ad);let _0x545c6d={};if(a62_0x15430e[_0x37dd97(0x1a4)](_0x57f9ae))try{const _0x588d3b=a62_0x15430e['readFileSync'](_0x57f9ae,_0x37dd97(0x1a3));_0x545c6d=JSON[_0x37dd97(0x1dc)](_0x588d3b);}catch{console['warn'](_0x37dd97(0x1bf)+_0x57f9ae+_0x37dd97(0x1c5));}_0x545c6d[_0x37dd97(0x1b5)]=_0x42110d,writeSecureFile(_0x57f9ae,JSON['stringify'](_0x545c6d,null,0x2));}function clearFieldFromUserConfig(_0x267db1){const _0x2148bd=a62_0x153bd8,_0x2efb38=getGlobalConfigPath();if(!a62_0x15430e['existsSync'](_0x2efb38))return;let _0x410231={};try{const _0xb09b49=a62_0x15430e[_0x2148bd(0x1de)](_0x2efb38,_0x2148bd(0x1a3));_0x410231=JSON[_0x2148bd(0x1dc)](_0xb09b49);}catch{return;}delete _0x410231[_0x267db1],writeSecureFile(_0x2efb38,JSON[_0x2148bd(0x1e0)](_0x410231,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x1e4475=a62_0x153bd8;clearFieldFromUserConfig(_0x1e4475(0x1a2));}export function clearActiveProfileFromUserConfig(){const _0x59bbbc=a62_0x153bd8;clearFieldFromUserConfig(_0x59bbbc(0x1b5));}export function createProfile(_0x3176ed,_0x54e89a){const _0x135897=a62_0x153bd8;validateProfileName(_0x3176ed);if(profileExists(_0x3176ed))throw new Error(_0x135897(0x1bb)+_0x3176ed+'\x20already\x20exists');saveProfile(_0x3176ed,_0x54e89a);}export function saveProfileCredentials(_0x433d8e,_0x130751){const _0x207081=a62_0x153bd8;validateProfileName(_0x433d8e);if(!profileExists(_0x433d8e))throw new Error('Profile\x20'+_0x433d8e+_0x207081(0x1e3));const _0x32bef7=getNewCredentialPath(_0x433d8e);writeSecureFile(_0x32bef7,_0x130751);}export function loadProfileCredentials(_0x448e95){const _0x28ae1f=a62_0x153bd8;validateProfileName(_0x448e95);const _0x4fc2ed=getNewCredentialPath(_0x448e95);if(a62_0x15430e['existsSync'](_0x4fc2ed))try{return a62_0x15430e[_0x28ae1f(0x1de)](_0x4fc2ed,_0x28ae1f(0x1a3));}catch{}const _0x29103e=getOldCredentialPath(_0x448e95);if(a62_0x15430e['existsSync'](_0x29103e)){console[_0x28ae1f(0x1d5)](_0x28ae1f(0x1ab)+_0x448e95+'\x27'),console['warn'](_0x28ae1f(0x198)),console[_0x28ae1f(0x1d5)]('\x20\x20mv\x20\x22'+_0x29103e+_0x28ae1f(0x1e5)+_0x4fc2ed+'\x22'),console[_0x28ae1f(0x1d5)](_0x28ae1f(0x1d9));try{return a62_0x15430e[_0x28ae1f(0x1de)](_0x29103e,_0x28ae1f(0x1a3));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a63_0x29b1d1=a63_0x1f46;function a63_0x899e(){const _0x1b50d7=['792088ZyfovE','6PKLlMk','writeFileSync','cwd','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','2341825jcngXN','api_key','dirname','3419059woFQbU','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','342dbIDuz','join','15852780ymvOpC','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','profile','apiKey','tdx.json','3122032UbHdtJ','existsSync','8727fvLfHL',').\x20','Failed\x20to\x20load\x20project\x20config\x20from\x20','TD_API_KEY','includes','ENOENT','29858IkkVIT','code','parse','readFileSync','stringify'];a63_0x899e=function(){return _0x1b50d7;};return a63_0x899e();}(function(_0x5cefbe,_0x29a563){const _0x1e6bb2=a63_0x1f46,_0x5b8dc0=_0x5cefbe();while(!![]){try{const _0x2017db=-parseInt(_0x1e6bb2(0x1ac))/0x1+parseInt(_0x1e6bb2(0x1bb))/0x2*(parseInt(_0x1e6bb2(0x1c4))/0x3)+parseInt(_0x1e6bb2(0x1b1))/0x4+parseInt(_0x1e6bb2(0x1b6))/0x5+parseInt(_0x1e6bb2(0x1b2))/0x6*(parseInt(_0x1e6bb2(0x1b9))/0x7)+parseInt(_0x1e6bb2(0x1c2))/0x8+-parseInt(_0x1e6bb2(0x1bd))/0x9;if(_0x2017db===_0x29a563)break;else _0x5b8dc0['push'](_0x5b8dc0['shift']());}catch(_0x58250f){_0x5b8dc0['push'](_0x5b8dc0['shift']());}}}(a63_0x899e,0x3d567));function a63_0x1f46(_0x4b4ead,_0x4ed024){_0x4b4ead=_0x4b4ead-0x1ac;const _0x899ea5=a63_0x899e();let _0x1f467b=_0x899ea5[_0x4b4ead];return _0x1f467b;}import*as a63_0xdf3dd1 from'node:fs';import*as a63_0xe3d854 from'node:path';const PROJECT_CONFIG_FILENAME=a63_0x29b1d1(0x1c1);export function findProjectConfigPath(_0x2731cc){const _0x5f450c=a63_0x29b1d1;let _0xf7b720=_0x2731cc||process[_0x5f450c(0x1b4)]();while(!![]){const _0x597212=a63_0xe3d854[_0x5f450c(0x1bc)](_0xf7b720,PROJECT_CONFIG_FILENAME);if(a63_0xdf3dd1[_0x5f450c(0x1c3)](_0x597212))return _0x597212;const _0x3c74b5=a63_0xe3d854['dirname'](_0xf7b720);if(_0x3c74b5===_0xf7b720)return null;_0xf7b720=_0x3c74b5;}}export function loadProjectConfig(_0x351654){const _0x21d584=a63_0x29b1d1,_0x8a10dd=findProjectConfigPath(_0x351654);if(!_0x8a10dd)return null;try{const _0x9c0ca8=a63_0xdf3dd1[_0x21d584(0x1af)](_0x8a10dd,'utf-8'),_0x54681d=JSON[_0x21d584(0x1ae)](_0x9c0ca8),_0x4d9e10=JSON['stringify'](_0x54681d);if(_0x4d9e10[_0x21d584(0x1c8)](_0x21d584(0x1c7))||_0x4d9e10[_0x21d584(0x1c8)](_0x21d584(0x1c0))||_0x4d9e10[_0x21d584(0x1c8)](_0x21d584(0x1b7)))throw new Error(_0x21d584(0x1ba)+_0x8a10dd+_0x21d584(0x1c5)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x3cf032,profile:_0x4d129f,..._0x36b1fc}=_0x54681d;return _0x4d129f&&console['warn']('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x8a10dd+'\x20is\x20ignored.\x20'+_0x21d584(0x1b5)),_0x36b1fc;}catch(_0x152ab8){if(_0x152ab8 instanceof Error&&_0x21d584(0x1ad)in _0x152ab8&&_0x152ab8[_0x21d584(0x1ad)]===_0x21d584(0x1c9))return null;throw new Error(_0x21d584(0x1c6)+_0x8a10dd+':\x20'+_0x152ab8);}}export function saveProjectConfig(_0x279d1d,_0x57baf4){const _0x5e21fd=a63_0x29b1d1,_0x22c8ce=_0x57baf4||process[_0x5e21fd(0x1b4)](),_0x18943d=a63_0xe3d854['join'](_0x22c8ce,PROJECT_CONFIG_FILENAME),_0x2b0d02=JSON[_0x5e21fd(0x1b0)](_0x279d1d);if(_0x2b0d02[_0x5e21fd(0x1c8)](_0x5e21fd(0x1c7))||_0x2b0d02['includes'](_0x5e21fd(0x1c0))||_0x2b0d02[_0x5e21fd(0x1c8)](_0x5e21fd(0x1b7)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x5e21fd(0x1bf)in _0x279d1d)throw new Error(_0x5e21fd(0x1be));a63_0xdf3dd1[_0x5e21fd(0x1b3)](_0x18943d,JSON[_0x5e21fd(0x1b0)](_0x279d1d,null,0x2));}export function hasProjectConfig(_0x18dd42){return findProjectConfigPath(_0x18dd42)!==null;}export function getProjectRoot(_0x1cea5e){const _0x1a51b8=a63_0x29b1d1,_0x57c7e5=findProjectConfigPath(_0x1cea5e);return _0x57c7e5?a63_0xe3d854[_0x1a51b8(0x1b8)](_0x57c7e5):null;}
1
+ const a63_0x2a656e=a63_0x4d69;function a63_0x4d69(_0x49674d,_0x2d3121){_0x49674d=_0x49674d-0x153;const _0x39e893=a63_0x39e8();let _0x4d69f1=_0x39e893[_0x49674d];return _0x4d69f1;}(function(_0x411f30,_0x31d939){const _0x38dab5=a63_0x4d69,_0xb049ff=_0x411f30();while(!![]){try{const _0x4434f4=parseInt(_0x38dab5(0x15e))/0x1*(parseInt(_0x38dab5(0x167))/0x2)+parseInt(_0x38dab5(0x168))/0x3+-parseInt(_0x38dab5(0x155))/0x4*(parseInt(_0x38dab5(0x154))/0x5)+-parseInt(_0x38dab5(0x165))/0x6+parseInt(_0x38dab5(0x157))/0x7+-parseInt(_0x38dab5(0x16f))/0x8+parseInt(_0x38dab5(0x15c))/0x9;if(_0x4434f4===_0x31d939)break;else _0xb049ff['push'](_0xb049ff['shift']());}catch(_0x5c319d){_0xb049ff['push'](_0xb049ff['shift']());}}}(a63_0x39e8,0xaaa27));import*as a63_0x225589 from'node:fs';import*as a63_0x22c9d6 from'node:path';const PROJECT_CONFIG_FILENAME=a63_0x2a656e(0x156);export function findProjectConfigPath(_0x532e27){const _0x433912=a63_0x2a656e;let _0x42effd=_0x532e27||process[_0x433912(0x16e)]();while(!![]){const _0x12da6c=a63_0x22c9d6['join'](_0x42effd,PROJECT_CONFIG_FILENAME);if(a63_0x225589[_0x433912(0x161)](_0x12da6c))return _0x12da6c;const _0x23abc3=a63_0x22c9d6[_0x433912(0x166)](_0x42effd);if(_0x23abc3===_0x42effd)return null;_0x42effd=_0x23abc3;}}export function loadProjectConfig(_0x42d443){const _0x496545=a63_0x2a656e,_0x4d81e8=findProjectConfigPath(_0x42d443);if(!_0x4d81e8)return null;try{const _0x5138d5=a63_0x225589['readFileSync'](_0x4d81e8,_0x496545(0x16a)),_0x3813b2=JSON[_0x496545(0x16c)](_0x5138d5),_0x482f68=JSON[_0x496545(0x153)](_0x3813b2);if(_0x482f68[_0x496545(0x173)]('TD_API_KEY')||_0x482f68[_0x496545(0x173)](_0x496545(0x170))||_0x482f68[_0x496545(0x173)](_0x496545(0x15d)))throw new Error(_0x496545(0x169)+_0x4d81e8+_0x496545(0x16d)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x41afb2,profile:_0x16078d,..._0x5e5e8a}=_0x3813b2;return _0x16078d&&console[_0x496545(0x158)](_0x496545(0x15f)+_0x4d81e8+_0x496545(0x162)+_0x496545(0x15a)),_0x5e5e8a;}catch(_0x228bd9){if(_0x228bd9 instanceof Error&&_0x496545(0x163)in _0x228bd9&&_0x228bd9[_0x496545(0x163)]===_0x496545(0x160))return null;throw new Error(_0x496545(0x159)+_0x4d81e8+':\x20'+_0x228bd9);}}export function saveProjectConfig(_0x41efbe,_0x1c667c){const _0x1346b5=a63_0x2a656e,_0x541724=_0x1c667c||process[_0x1346b5(0x16e)](),_0x2e3405=a63_0x22c9d6[_0x1346b5(0x16b)](_0x541724,PROJECT_CONFIG_FILENAME),_0x13c530=JSON[_0x1346b5(0x153)](_0x41efbe);if(_0x13c530['includes'](_0x1346b5(0x171))||_0x13c530[_0x1346b5(0x173)](_0x1346b5(0x170))||_0x13c530[_0x1346b5(0x173)](_0x1346b5(0x15d)))throw new Error(_0x1346b5(0x172));if(_0x1346b5(0x164)in _0x41efbe)throw new Error(_0x1346b5(0x15b));a63_0x225589['writeFileSync'](_0x2e3405,JSON[_0x1346b5(0x153)](_0x41efbe,null,0x2));}export function hasProjectConfig(_0x3d3260){return findProjectConfigPath(_0x3d3260)!==null;}export function getProjectRoot(_0x22df22){const _0x32e67c=a63_0x2a656e,_0x592867=findProjectConfigPath(_0x22df22);return _0x592867?a63_0x22c9d6[_0x32e67c(0x166)](_0x592867):null;}function a63_0x39e8(){const _0x2cb895=['join','parse',').\x20','cwd','327248FSHOBn','apiKey','TD_API_KEY','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','includes','stringify','1120IxihFZ','200rITEJA','tdx.json','1436120ntVnLf','warn','Failed\x20to\x20load\x20project\x20config\x20from\x20','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','2915055icerOd','api_key','499FCfjBq','Warning:\x20\x27profile\x27\x20field\x20in\x20','ENOENT','existsSync','\x20is\x20ignored.\x20','code','profile','8153712JNMJJF','dirname','3004BarhfY','2494272PrihSc','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8'];a63_0x39e8=function(){return _0x2cb895;};return a63_0x39e8();}
@@ -1 +1 @@
1
- (function(_0x480bc6,_0x134c7b){const _0x5cc812=a64_0x151a,_0x1171a7=_0x480bc6();while(!![]){try{const _0x45643b=-parseInt(_0x5cc812(0x16c))/0x1+-parseInt(_0x5cc812(0x15f))/0x2+-parseInt(_0x5cc812(0x17f))/0x3+-parseInt(_0x5cc812(0x166))/0x4*(parseInt(_0x5cc812(0x17e))/0x5)+-parseInt(_0x5cc812(0x175))/0x6+parseInt(_0x5cc812(0x163))/0x7*(parseInt(_0x5cc812(0x179))/0x8)+parseInt(_0x5cc812(0x171))/0x9;if(_0x45643b===_0x134c7b)break;else _0x1171a7['push'](_0x1171a7['shift']());}catch(_0x46c64a){_0x1171a7['push'](_0x1171a7['shift']());}}}(a64_0x4b47,0xab66c));import*as a64_0x41d8fc from'node:fs';import*as a64_0xe4b07a from'node:path';import*as a64_0x170d66 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 a64_0x4b47(){const _0x5bb262=['now','2302824xRQiCa','sort','TD_API_KEY','.\x20This\x20is\x20insecure.\x20Removing\x20session.','272VcHvSd','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','endsWith','toISOString','toString','13485CLOdQT','1413201Pgaupx','join','parse','tdx','1908914fETpXH','.json','replace','includes','79359PVQUgr','readFileSync','.config','120cWIpiZ','createdAt','api_key','push','apiKey','test','574215ZxSbLo','utf-8','readdirSync','existsSync','getTime','25029495OjsMih','unlinkSync','stringify'];a64_0x4b47=function(){return _0x5bb262;};return a64_0x4b47();}function getSessionsDir(){const _0x55f872=a64_0x151a,_0x3782dd=process.env.TDX_CONFIG_DIR||a64_0xe4b07a[_0x55f872(0x15c)](a64_0x170d66['homedir'](),_0x55f872(0x165),_0x55f872(0x15e));return a64_0xe4b07a[_0x55f872(0x15c)](_0x3782dd,'sessions');}function getSessionPath(_0x224939){const _0x1b573c=a64_0x151a;return a64_0xe4b07a['join'](getSessionsDir(),_0x224939+_0x1b573c(0x160));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0xc27a7){if(_0xc27a7)return _0xc27a7;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x144119){const _0x453f59=a64_0x151a,_0x3a31fd=getSessionID(_0x144119),_0xf13eb7=/^\d+$/[_0x453f59(0x16b)](_0x3a31fd)?parseInt(_0x3a31fd,0xa):null;return _0xf13eb7!==null?loadSessionContextByPID(_0xf13eb7):loadSessionContextByString(_0x3a31fd);}export function loadSessionContextByPID(_0x4f81d4){const _0x1abac7=a64_0x151a,_0x5cafbe=getSessionPath(_0x4f81d4);if(!a64_0x41d8fc['existsSync'](_0x5cafbe))return null;try{const _0x5009b7=a64_0x41d8fc['readFileSync'](_0x5cafbe,_0x1abac7(0x16d)),_0x2b94af=JSON[_0x1abac7(0x15d)](_0x5009b7),_0x9e412b=new Date(_0x2b94af[_0x1abac7(0x167)])[_0x1abac7(0x170)](),_0x4d279b=Date['now']();if(_0x4d279b-_0x9e412b>SESSION_EXPIRATION_MS)return a64_0x41d8fc[_0x1abac7(0x172)](_0x5cafbe),null;const _0x95fe3=JSON[_0x1abac7(0x173)](_0x2b94af);if(_0x95fe3[_0x1abac7(0x162)](_0x1abac7(0x177))||_0x95fe3[_0x1abac7(0x162)]('apiKey')||_0x95fe3[_0x1abac7(0x162)](_0x1abac7(0x168)))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x5cafbe+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a64_0x41d8fc[_0x1abac7(0x172)](_0x5cafbe),null;return _0x2b94af;}catch{try{a64_0x41d8fc[_0x1abac7(0x172)](_0x5cafbe);}catch{}return null;}}function a64_0x151a(_0x13e017,_0x2ae065){_0x13e017=_0x13e017-0x15c;const _0x4b475b=a64_0x4b47();let _0x151a24=_0x4b475b[_0x13e017];return _0x151a24;}function loadSessionContextByString(_0x174a16){const _0x285ea3=a64_0x151a,_0x41673d=a64_0xe4b07a[_0x285ea3(0x15c)](getSessionsDir(),_0x174a16+_0x285ea3(0x160));if(!a64_0x41d8fc[_0x285ea3(0x16f)](_0x41673d))return null;try{const _0x53c566=a64_0x41d8fc[_0x285ea3(0x164)](_0x41673d,_0x285ea3(0x16d)),_0x5b9153=JSON[_0x285ea3(0x15d)](_0x53c566),_0x28f52b=new Date(_0x5b9153[_0x285ea3(0x167)])[_0x285ea3(0x170)](),_0x1b670c=Date['now']();if(_0x1b670c-_0x28f52b>SESSION_EXPIRATION_MS)return a64_0x41d8fc[_0x285ea3(0x172)](_0x41673d),null;const _0x6d4908=JSON[_0x285ea3(0x173)](_0x5b9153);if(_0x6d4908['includes']('TD_API_KEY')||_0x6d4908[_0x285ea3(0x162)](_0x285ea3(0x16a))||_0x6d4908[_0x285ea3(0x162)](_0x285ea3(0x168)))return console['warn'](_0x285ea3(0x17a)+_0x41673d+_0x285ea3(0x178)),a64_0x41d8fc[_0x285ea3(0x172)](_0x41673d),null;return _0x5b9153;}catch{try{a64_0x41d8fc[_0x285ea3(0x172)](_0x41673d);}catch{}return null;}}export function saveSessionContext(_0x26c64b,_0x1c9bbc){const _0xb9c9ed=a64_0x151a,_0x3b005a=getSessionID(_0x1c9bbc),_0x39d481=/^\d+$/[_0xb9c9ed(0x16b)](_0x3b005a)?parseInt(_0x3b005a,0xa):getCurrentSessionPID(),_0x245f68=a64_0xe4b07a[_0xb9c9ed(0x15c)](getSessionsDir(),_0x3b005a+_0xb9c9ed(0x160)),_0x2c36ca=getSessionsDir();createSecureDirectory(_0x2c36ca);const _0x54d59f=JSON[_0xb9c9ed(0x173)](_0x26c64b);if(_0x54d59f[_0xb9c9ed(0x162)](_0xb9c9ed(0x177))||_0x54d59f[_0xb9c9ed(0x162)](_0xb9c9ed(0x16a))||_0x54d59f['includes'](_0xb9c9ed(0x168)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x276e9d;const _0x491f85=/^\d+$/[_0xb9c9ed(0x16b)](_0x3b005a)?loadSessionContextByPID(parseInt(_0x3b005a,0xa)):loadSessionContextByString(_0x3b005a);_0x491f85?_0x276e9d={..._0x491f85,..._0x26c64b,'pid':_0x39d481,'sessionId':_0x3b005a!==_0x39d481[_0xb9c9ed(0x17d)]()?_0x3b005a:undefined,'updatedAt':new Date()[_0xb9c9ed(0x17c)]()}:_0x276e9d={'pid':_0x39d481,'sessionId':_0x3b005a!==_0x39d481[_0xb9c9ed(0x17d)]()?_0x3b005a:undefined,..._0x26c64b,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0xb9c9ed(0x17c)]()},a64_0x41d8fc['writeFileSync'](_0x245f68,JSON[_0xb9c9ed(0x173)](_0x276e9d,null,0x2));}export function clearSessionContext(_0x1cd12d){const _0xf299d0=a64_0x151a,_0x171237=getSessionID(_0x1cd12d),_0x2f37ff=a64_0xe4b07a[_0xf299d0(0x15c)](getSessionsDir(),_0x171237+_0xf299d0(0x160));a64_0x41d8fc[_0xf299d0(0x16f)](_0x2f37ff)&&a64_0x41d8fc['unlinkSync'](_0x2f37ff);}export function clearSessionContextField(_0x212f66,_0x3989dd){const _0x3ca4ba=a64_0x151a,_0x2da6b1=getSessionID(_0x3989dd),_0x52e97c=a64_0xe4b07a[_0x3ca4ba(0x15c)](getSessionsDir(),_0x2da6b1+_0x3ca4ba(0x160));if(!a64_0x41d8fc[_0x3ca4ba(0x16f)](_0x52e97c))return;try{const _0x5bc573=a64_0x41d8fc[_0x3ca4ba(0x164)](_0x52e97c,_0x3ca4ba(0x16d)),_0x4b9087=JSON[_0x3ca4ba(0x15d)](_0x5bc573);delete _0x4b9087[_0x212f66],a64_0x41d8fc['writeFileSync'](_0x52e97c,JSON[_0x3ca4ba(0x173)](_0x4b9087,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x167f64=a64_0x151a,_0x4ed810=getSessionsDir();if(!a64_0x41d8fc[_0x167f64(0x16f)](_0x4ed810))return 0x0;let _0x48495f=0x0;const _0x205eec=Date[_0x167f64(0x174)]();try{const _0x963ef2=a64_0x41d8fc[_0x167f64(0x16e)](_0x4ed810);for(const _0x40fff6 of _0x963ef2){if(!_0x40fff6[_0x167f64(0x17b)](_0x167f64(0x160)))continue;const _0x5655e9=a64_0xe4b07a['join'](_0x4ed810,_0x40fff6),_0x3d84ad=_0x40fff6[_0x167f64(0x161)](_0x167f64(0x160),''),_0x48513d=parseInt(_0x3d84ad,0xa),_0x3acac2=!isNaN(_0x48513d);if(_0x3acac2){if(!isProcessRunning(_0x48513d)){a64_0x41d8fc[_0x167f64(0x172)](_0x5655e9),_0x48495f++;continue;}}try{const _0x25596a=a64_0x41d8fc[_0x167f64(0x164)](_0x5655e9,'utf-8'),_0x3fec11=JSON[_0x167f64(0x15d)](_0x25596a),_0x529b98=new Date(_0x3fec11['createdAt'])[_0x167f64(0x170)]();_0x205eec-_0x529b98>SESSION_EXPIRATION_MS&&(a64_0x41d8fc['unlinkSync'](_0x5655e9),_0x48495f++);}catch{a64_0x41d8fc['unlinkSync'](_0x5655e9),_0x48495f++;}}}catch{}return _0x48495f;}export function listActiveSessions(){const _0x4e28fc=a64_0x151a,_0x21af04=getSessionsDir();if(!a64_0x41d8fc['existsSync'](_0x21af04))return[];try{const _0x140cdd=a64_0x41d8fc[_0x4e28fc(0x16e)](_0x21af04),_0x56f9eb=[];for(const _0x974965 of _0x140cdd){if(!_0x974965[_0x4e28fc(0x17b)](_0x4e28fc(0x160)))continue;const _0x5276fa=_0x974965[_0x4e28fc(0x161)](_0x4e28fc(0x160),''),_0x4eb6fd=parseInt(_0x5276fa,0xa);!isNaN(_0x4eb6fd)&&isProcessRunning(_0x4eb6fd)&&_0x56f9eb[_0x4e28fc(0x169)](_0x4eb6fd);}return _0x56f9eb[_0x4e28fc(0x176)]((_0x7fb384,_0x15e4df)=>_0x7fb384-_0x15e4df);}catch{return[];}}
1
+ (function(_0x737118,_0x9cdcf2){const _0x17be4d=a64_0x4472,_0x1abeff=_0x737118();while(!![]){try{const _0x2500c8=parseInt(_0x17be4d(0xfd))/0x1+parseInt(_0x17be4d(0x104))/0x2*(-parseInt(_0x17be4d(0xf1))/0x3)+-parseInt(_0x17be4d(0xed))/0x4+parseInt(_0x17be4d(0x103))/0x5+parseInt(_0x17be4d(0x10d))/0x6+-parseInt(_0x17be4d(0xf3))/0x7*(-parseInt(_0x17be4d(0x10c))/0x8)+parseInt(_0x17be4d(0x107))/0x9*(parseInt(_0x17be4d(0x100))/0xa);if(_0x2500c8===_0x9cdcf2)break;else _0x1abeff['push'](_0x1abeff['shift']());}catch(_0x5c8b15){_0x1abeff['push'](_0x1abeff['shift']());}}}(a64_0x1ade,0x49c60));import*as a64_0x1dc335 from'node:fs';import*as a64_0x9efef9 from'node:path';import*as a64_0x4e1c01 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 _0x11236a=a64_0x4472,_0x4efcec=process.env.TDX_CONFIG_DIR||a64_0x9efef9[_0x11236a(0xfb)](a64_0x4e1c01[_0x11236a(0xef)](),_0x11236a(0xee),'tdx');return a64_0x9efef9[_0x11236a(0xfb)](_0x4efcec,_0x11236a(0xea));}function getSessionPath(_0x55189b){const _0x4daf9d=a64_0x4472;return a64_0x9efef9['join'](getSessionsDir(),_0x55189b+_0x4daf9d(0xfa));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x8a6010){const _0x539770=a64_0x4472;if(_0x8a6010)return _0x8a6010;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x539770(0xf8)]();}export function loadSessionContext(_0x29cfb8){const _0x3eddfc=a64_0x4472,_0x50e049=getSessionID(_0x29cfb8),_0xc42a66=/^\d+$/[_0x3eddfc(0xf2)](_0x50e049)?parseInt(_0x50e049,0xa):null;return _0xc42a66!==null?loadSessionContextByPID(_0xc42a66):loadSessionContextByString(_0x50e049);}export function loadSessionContextByPID(_0x4b73cf){const _0x345bc1=a64_0x4472,_0x6364b9=getSessionPath(_0x4b73cf);if(!a64_0x1dc335[_0x345bc1(0x105)](_0x6364b9))return null;try{const _0x6960ec=a64_0x1dc335[_0x345bc1(0xeb)](_0x6364b9,_0x345bc1(0xf0)),_0x1e5619=JSON[_0x345bc1(0xf9)](_0x6960ec),_0x3cac0a=new Date(_0x1e5619[_0x345bc1(0x10b)])['getTime'](),_0x552d61=Date[_0x345bc1(0x10f)]();if(_0x552d61-_0x3cac0a>SESSION_EXPIRATION_MS)return a64_0x1dc335[_0x345bc1(0xfe)](_0x6364b9),null;const _0x1f8dd1=JSON[_0x345bc1(0xf7)](_0x1e5619);if(_0x1f8dd1[_0x345bc1(0xe8)](_0x345bc1(0x106))||_0x1f8dd1[_0x345bc1(0xe8)](_0x345bc1(0x10a))||_0x1f8dd1['includes'](_0x345bc1(0x108)))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x6364b9+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a64_0x1dc335[_0x345bc1(0xfe)](_0x6364b9),null;return _0x1e5619;}catch{try{a64_0x1dc335[_0x345bc1(0xfe)](_0x6364b9);}catch{}return null;}}function a64_0x1ade(){const _0x29c086=['toISOString','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','446495dZerHu','732jkvTDW','existsSync','TD_API_KEY','9AIoGxM','api_key','endsWith','apiKey','createdAt','136JOwORK','483678uyatao','.\x20This\x20is\x20insecure.\x20Removing\x20session.','now','includes','readdirSync','sessions','readFileSync','sort','546584CuxkAQ','.config','homedir','utf-8','4059ZPswAf','test','64421WrfQJT','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','replace','writeFileSync','stringify','toString','parse','.json','join','getTime','399324apWbFY','unlinkSync','push','2083330YXJbTs'];a64_0x1ade=function(){return _0x29c086;};return a64_0x1ade();}function loadSessionContextByString(_0x4618ae){const _0x42e89d=a64_0x4472,_0x5afb9a=a64_0x9efef9['join'](getSessionsDir(),_0x4618ae+_0x42e89d(0xfa));if(!a64_0x1dc335['existsSync'](_0x5afb9a))return null;try{const _0x36644a=a64_0x1dc335['readFileSync'](_0x5afb9a,_0x42e89d(0xf0)),_0xc50813=JSON[_0x42e89d(0xf9)](_0x36644a),_0x5daf07=new Date(_0xc50813[_0x42e89d(0x10b)])[_0x42e89d(0xfc)](),_0x376183=Date[_0x42e89d(0x10f)]();if(_0x376183-_0x5daf07>SESSION_EXPIRATION_MS)return a64_0x1dc335[_0x42e89d(0xfe)](_0x5afb9a),null;const _0x319cd2=JSON['stringify'](_0xc50813);if(_0x319cd2[_0x42e89d(0xe8)](_0x42e89d(0x106))||_0x319cd2[_0x42e89d(0xe8)](_0x42e89d(0x10a))||_0x319cd2[_0x42e89d(0xe8)](_0x42e89d(0x108)))return console['warn'](_0x42e89d(0x102)+_0x5afb9a+_0x42e89d(0x10e)),a64_0x1dc335['unlinkSync'](_0x5afb9a),null;return _0xc50813;}catch{try{a64_0x1dc335[_0x42e89d(0xfe)](_0x5afb9a);}catch{}return null;}}function a64_0x4472(_0x26898a,_0x1ae618){_0x26898a=_0x26898a-0xe8;const _0x1ade3f=a64_0x1ade();let _0x4472f2=_0x1ade3f[_0x26898a];return _0x4472f2;}export function saveSessionContext(_0x590728,_0x7659f4){const _0x49a643=a64_0x4472,_0x8683a4=getSessionID(_0x7659f4),_0x23070b=/^\d+$/[_0x49a643(0xf2)](_0x8683a4)?parseInt(_0x8683a4,0xa):getCurrentSessionPID(),_0x7c96c6=a64_0x9efef9[_0x49a643(0xfb)](getSessionsDir(),_0x8683a4+_0x49a643(0xfa)),_0x14db55=getSessionsDir();createSecureDirectory(_0x14db55);const _0x487812=JSON[_0x49a643(0xf7)](_0x590728);if(_0x487812['includes'](_0x49a643(0x106))||_0x487812[_0x49a643(0xe8)](_0x49a643(0x10a))||_0x487812[_0x49a643(0xe8)](_0x49a643(0x108)))throw new Error(_0x49a643(0xf4));let _0x4e41d2;const _0x10353f=/^\d+$/[_0x49a643(0xf2)](_0x8683a4)?loadSessionContextByPID(parseInt(_0x8683a4,0xa)):loadSessionContextByString(_0x8683a4);_0x10353f?_0x4e41d2={..._0x10353f,..._0x590728,'pid':_0x23070b,'sessionId':_0x8683a4!==_0x23070b[_0x49a643(0xf8)]()?_0x8683a4:undefined,'updatedAt':new Date()[_0x49a643(0x101)]()}:_0x4e41d2={'pid':_0x23070b,'sessionId':_0x8683a4!==_0x23070b[_0x49a643(0xf8)]()?_0x8683a4:undefined,..._0x590728,'createdAt':new Date()[_0x49a643(0x101)](),'updatedAt':new Date()['toISOString']()},a64_0x1dc335[_0x49a643(0xf6)](_0x7c96c6,JSON[_0x49a643(0xf7)](_0x4e41d2,null,0x2));}export function clearSessionContext(_0x1af71a){const _0x4d659c=a64_0x4472,_0x362285=getSessionID(_0x1af71a),_0x7abbdf=a64_0x9efef9[_0x4d659c(0xfb)](getSessionsDir(),_0x362285+_0x4d659c(0xfa));a64_0x1dc335['existsSync'](_0x7abbdf)&&a64_0x1dc335[_0x4d659c(0xfe)](_0x7abbdf);}export function clearSessionContextField(_0x53a9c2,_0xf39e2e){const _0x253565=a64_0x4472,_0x4ea55a=getSessionID(_0xf39e2e),_0x2c3a8a=a64_0x9efef9[_0x253565(0xfb)](getSessionsDir(),_0x4ea55a+_0x253565(0xfa));if(!a64_0x1dc335[_0x253565(0x105)](_0x2c3a8a))return;try{const _0x1127ed=a64_0x1dc335[_0x253565(0xeb)](_0x2c3a8a,_0x253565(0xf0)),_0x3f09f8=JSON[_0x253565(0xf9)](_0x1127ed);delete _0x3f09f8[_0x53a9c2],a64_0x1dc335[_0x253565(0xf6)](_0x2c3a8a,JSON[_0x253565(0xf7)](_0x3f09f8,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x720ebd=a64_0x4472,_0x2b7828=getSessionsDir();if(!a64_0x1dc335['existsSync'](_0x2b7828))return 0x0;let _0x400ab2=0x0;const _0x16dd3a=Date[_0x720ebd(0x10f)]();try{const _0x173e1b=a64_0x1dc335['readdirSync'](_0x2b7828);for(const _0x415be3 of _0x173e1b){if(!_0x415be3[_0x720ebd(0x109)]('.json'))continue;const _0x5d4b14=a64_0x9efef9['join'](_0x2b7828,_0x415be3),_0xfdd1a4=_0x415be3['replace'](_0x720ebd(0xfa),''),_0x141a41=parseInt(_0xfdd1a4,0xa),_0x413695=!isNaN(_0x141a41);if(_0x413695){if(!isProcessRunning(_0x141a41)){a64_0x1dc335[_0x720ebd(0xfe)](_0x5d4b14),_0x400ab2++;continue;}}try{const _0x2a0567=a64_0x1dc335['readFileSync'](_0x5d4b14,_0x720ebd(0xf0)),_0x1863af=JSON[_0x720ebd(0xf9)](_0x2a0567),_0x4c677c=new Date(_0x1863af['createdAt'])[_0x720ebd(0xfc)]();_0x16dd3a-_0x4c677c>SESSION_EXPIRATION_MS&&(a64_0x1dc335[_0x720ebd(0xfe)](_0x5d4b14),_0x400ab2++);}catch{a64_0x1dc335['unlinkSync'](_0x5d4b14),_0x400ab2++;}}}catch{}return _0x400ab2;}export function listActiveSessions(){const _0x178476=a64_0x4472,_0x232f44=getSessionsDir();if(!a64_0x1dc335[_0x178476(0x105)](_0x232f44))return[];try{const _0x11809f=a64_0x1dc335[_0x178476(0xe9)](_0x232f44),_0x378e00=[];for(const _0x42e2ba of _0x11809f){if(!_0x42e2ba[_0x178476(0x109)](_0x178476(0xfa)))continue;const _0x399e33=_0x42e2ba[_0x178476(0xf5)]('.json',''),_0x52bc74=parseInt(_0x399e33,0xa);!isNaN(_0x52bc74)&&isProcessRunning(_0x52bc74)&&_0x378e00[_0x178476(0xff)](_0x52bc74);}return _0x378e00[_0x178476(0xec)]((_0x5cdbc2,_0x20b62b)=>_0x5cdbc2-_0x20b62b);}catch{return[];}}
@@ -1 +1 @@
1
- const a65_0x42f72a=a65_0x3cc9;function a65_0x4455(){const _0x32dd11=['24DTdgSx','4260732jjKnEa','2194115wVleUU','core/user-cache','206HSzRFX','now','3416193VwFHpn','2387875HaGEhC','users-{profile}.json','30hTmkfA','users','3BvuQAv','3141VhzvTv','539286PjyAEk','50NoKMMA','read','7081140fspoMe','clear'];a65_0x4455=function(){return _0x32dd11;};return a65_0x4455();}(function(_0x2c8e2b,_0x29aaaa){const _0x5f05ae=a65_0x3cc9,_0x3543d9=_0x2c8e2b();while(!![]){try{const _0x382d1f=-parseInt(_0x5f05ae(0xbe))/0x1*(parseInt(_0x5f05ae(0xb6))/0x2)+parseInt(_0x5f05ae(0xbd))/0x3*(parseInt(_0x5f05ae(0xb3))/0x4)+-parseInt(_0x5f05ae(0xae))/0x5*(-parseInt(_0x5f05ae(0xad))/0x6)+-parseInt(_0x5f05ae(0xb9))/0x7*(-parseInt(_0x5f05ae(0xb2))/0x8)+-parseInt(_0x5f05ae(0xb8))/0x9*(parseInt(_0x5f05ae(0xbb))/0xa)+-parseInt(_0x5f05ae(0xb4))/0xb+-parseInt(_0x5f05ae(0xb0))/0xc;if(_0x382d1f===_0x29aaaa)break;else _0x3543d9['push'](_0x3543d9['shift']());}catch(_0x20a991){_0x3543d9['push'](_0x3543d9['shift']());}}}(a65_0x4455,0xb3942));function a65_0x3cc9(_0x35fd48,_0x371df4){_0x35fd48=_0x35fd48-0xad;const _0x445581=a65_0x4455();let _0x3cc9df=_0x445581[_0x35fd48];return _0x3cc9df;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a65_0x42f72a(0xba),a65_0x42f72a(0xb5));export function loadCachedUsers(_0x9e8d52){const _0x470abd=a65_0x42f72a,_0x330784=userCache[_0x470abd(0xaf)](_0x9e8d52);return _0x330784?.[_0x470abd(0xbc)]??null;}export function saveCachedUsers(_0x2064a2,_0xacfd51){const _0x131c79=a65_0x42f72a;userCache['write'](_0x2064a2,{'users':_0xacfd51,'cachedAt':Date[_0x131c79(0xb7)]()});}export function clearUserCache(_0x325bc7){const _0xe110e0=a65_0x42f72a;userCache[_0xe110e0(0xb1)](_0x325bc7);}
1
+ function a65_0x340b(){const _0x512edd=['232zbannO','write','764990FpVjgM','1979838MzBMox','966PSamJI','clear','685gFmjph','read','users-{profile}.json','14882eESMLc','454278hFxWRc','22956ehKiSV','86382DOpeXW','5360970riXmhq','core/user-cache'];a65_0x340b=function(){return _0x512edd;};return a65_0x340b();}const a65_0x4205fd=a65_0x385a;(function(_0x5482e1,_0x6d103e){const _0x2ded1f=a65_0x385a,_0x52d8d7=_0x5482e1();while(!![]){try{const _0x43c1d9=parseInt(_0x2ded1f(0x159))/0x1+parseInt(_0x2ded1f(0x15a))/0x2+-parseInt(_0x2ded1f(0x152))/0x3+parseInt(_0x2ded1f(0x153))/0x4*(-parseInt(_0x2ded1f(0x14e))/0x5)+-parseInt(_0x2ded1f(0x14c))/0x6*(parseInt(_0x2ded1f(0x151))/0x7)+parseInt(_0x2ded1f(0x157))/0x8*(-parseInt(_0x2ded1f(0x154))/0x9)+parseInt(_0x2ded1f(0x155))/0xa;if(_0x43c1d9===_0x6d103e)break;else _0x52d8d7['push'](_0x52d8d7['shift']());}catch(_0x57dd70){_0x52d8d7['push'](_0x52d8d7['shift']());}}}(a65_0x340b,0xb2e25));function a65_0x385a(_0x31ddf8,_0x4588d4){_0x31ddf8=_0x31ddf8-0x14c;const _0x340b58=a65_0x340b();let _0x385a86=_0x340b58[_0x31ddf8];return _0x385a86;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a65_0x4205fd(0x150),a65_0x4205fd(0x156));export function loadCachedUsers(_0xccef78){const _0x40183f=a65_0x4205fd,_0x3d22ed=userCache[_0x40183f(0x14f)](_0xccef78);return _0x3d22ed?.['users']??null;}export function saveCachedUsers(_0x5b0c09,_0x11db83){const _0x319b91=a65_0x4205fd;userCache[_0x319b91(0x158)](_0x5b0c09,{'users':_0x11db83,'cachedAt':Date['now']()});}export function clearUserCache(_0x552f75){const _0x59d9c2=a65_0x4205fd;userCache[_0x59d9c2(0x14d)](_0x552f75);}
@@ -1 +1 @@
1
- function a66_0x50b6(_0x3f47dd,_0xdcbdd9){_0x3f47dd=_0x3f47dd-0x1e8;const _0x20ae05=a66_0x20ae();let _0x50b608=_0x20ae05[_0x3f47dd];return _0x50b608;}(function(_0x3a823c,_0x52848a){const _0x1ba615=a66_0x50b6,_0xaafaad=_0x3a823c();while(!![]){try{const _0x2f193b=parseInt(_0x1ba615(0x1ec))/0x1*(parseInt(_0x1ba615(0x1f2))/0x2)+parseInt(_0x1ba615(0x1ee))/0x3+-parseInt(_0x1ba615(0x1f7))/0x4+-parseInt(_0x1ba615(0x1f8))/0x5*(-parseInt(_0x1ba615(0x1f0))/0x6)+parseInt(_0x1ba615(0x1f4))/0x7+-parseInt(_0x1ba615(0x1ed))/0x8+parseInt(_0x1ba615(0x1e8))/0x9;if(_0x2f193b===_0x52848a)break;else _0xaafaad['push'](_0xaafaad['shift']());}catch(_0x436788){_0xaafaad['push'](_0xaafaad['shift']());}}}(a66_0x20ae,0x416dd));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;function a66_0x20ae(){const _0x22cb7e=['1197976qIbODz','5dUGDAs','720585hZdMoJ','utf-8','version','../build-info.json','1Nwryfh','2388600OdUxwN','555057jRpDCm','.dev','2155116MFrDns','includes','344066BIJBaw','0.0.0','488341bYQQFS','parse','../../package.json'];a66_0x20ae=function(){return _0x22cb7e;};return a66_0x20ae();}export function getBuildInfo(){const _0x266b01=a66_0x50b6;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4bd5cd=fileURLToPath(import.meta.url),_0x4fdc7c=dirname(_0x4bd5cd);try{const _0x13fb0a=join(_0x4fdc7c,_0x266b01(0x1eb));cachedBuildInfo=JSON['parse'](readFileSync(_0x13fb0a,_0x266b01(0x1e9)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x1a573c=a66_0x50b6;if(cachedVersion!==null)return cachedVersion;const _0x111590=fileURLToPath(import.meta.url),_0x26dfe2=dirname(_0x111590),_0x2bc79e=getBuildInfo();if(_0x2bc79e[_0x1a573c(0x1ea)])return cachedVersion=_0x2bc79e[_0x1a573c(0x1ea)],cachedVersion;try{const _0x35f244=join(_0x26dfe2,_0x1a573c(0x1f6)),_0x2e8423=JSON[_0x1a573c(0x1f5)](readFileSync(_0x35f244,_0x1a573c(0x1e9)));cachedVersion=_0x2e8423['version'];}catch{cachedVersion=_0x1a573c(0x1f3);}return cachedVersion;}export function isDevVersion(){const _0x41b562=a66_0x50b6,_0x21a56d=getVersion();return _0x21a56d[_0x41b562(0x1f1)](_0x41b562(0x1ef))||_0x21a56d['includes']('-');}
1
+ (function(_0x333b0a,_0x4004b6){const _0x4c21be=a66_0x15f2,_0x447adc=_0x333b0a();while(!![]){try{const _0x4fdc08=-parseInt(_0x4c21be(0x149))/0x1+parseInt(_0x4c21be(0x152))/0x2*(-parseInt(_0x4c21be(0x147))/0x3)+parseInt(_0x4c21be(0x148))/0x4+-parseInt(_0x4c21be(0x156))/0x5*(parseInt(_0x4c21be(0x14f))/0x6)+parseInt(_0x4c21be(0x14b))/0x7*(-parseInt(_0x4c21be(0x150))/0x8)+parseInt(_0x4c21be(0x14e))/0x9+parseInt(_0x4c21be(0x151))/0xa;if(_0x4fdc08===_0x4004b6)break;else _0x447adc['push'](_0x447adc['shift']());}catch(_0x545ed5){_0x447adc['push'](_0x447adc['shift']());}}}(a66_0x1bba,0xcbcd0));function a66_0x15f2(_0xff545a,_0x4629f){_0xff545a=_0xff545a-0x146;const _0x1bba52=a66_0x1bba();let _0x15f2fa=_0x1bba52[_0xff545a];return _0x15f2fa;}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;function a66_0x1bba(){const _0x1b800d=['5362OSyHZT','version','../build-info.json','parse','275awecMg','includes','549ryzild','1789840PRVZbg','121366ieexYP','.dev','1057TYuPzQ','../../package.json','0.0.0','13448817KtkxTP','41430yUUBXb','28312odrFgg','4191480EOBosv'];a66_0x1bba=function(){return _0x1b800d;};return a66_0x1bba();}export function getBuildInfo(){const _0xbd04e3=a66_0x15f2;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x157708=fileURLToPath(import.meta.url),_0x25cd19=dirname(_0x157708);try{const _0x5c396d=join(_0x25cd19,_0xbd04e3(0x154));cachedBuildInfo=JSON[_0xbd04e3(0x155)](readFileSync(_0x5c396d,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x57443c=a66_0x15f2;if(cachedVersion!==null)return cachedVersion;const _0x368132=fileURLToPath(import.meta.url),_0x479021=dirname(_0x368132),_0x431b2e=getBuildInfo();if(_0x431b2e[_0x57443c(0x153)])return cachedVersion=_0x431b2e[_0x57443c(0x153)],cachedVersion;try{const _0x59b788=join(_0x479021,_0x57443c(0x14c)),_0x1d8e4f=JSON['parse'](readFileSync(_0x59b788,'utf-8'));cachedVersion=_0x1d8e4f['version'];}catch{cachedVersion=_0x57443c(0x14d);}return cachedVersion;}export function isDevVersion(){const _0xccb07c=a66_0x15f2,_0x43c88a=getVersion();return _0x43c88a['includes'](_0xccb07c(0x14a))||_0x43c88a[_0xccb07c(0x146)]('-');}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x112e63,_0x5079dd){var _0x48ef02=a67_0x2741,_0x34d508=_0x112e63();while(!![]){try{var _0x144cd1=parseInt(_0x48ef02(0x194))/0x1*(-parseInt(_0x48ef02(0x192))/0x2)+parseInt(_0x48ef02(0x198))/0x3+parseInt(_0x48ef02(0x191))/0x4+parseInt(_0x48ef02(0x196))/0x5+-parseInt(_0x48ef02(0x197))/0x6*(-parseInt(_0x48ef02(0x195))/0x7)+parseInt(_0x48ef02(0x190))/0x8+-parseInt(_0x48ef02(0x193))/0x9*(parseInt(_0x48ef02(0x18f))/0xa);if(_0x144cd1===_0x5079dd)break;else _0x34d508['push'](_0x34d508['shift']());}catch(_0x4d736a){_0x34d508['push'](_0x34d508['shift']());}}}(a67_0xc9a2,0x97b66));function a67_0xc9a2(){var _0x2bbba3=['7429176KguwLq','1815720CjJWlt','12rcYRuk','9PqVUmT','75885DHeoLV','1273867rSSaZm','5692350FBAeiN','18wVQEMl','316383WokxcF','20957270TFoqgM'];a67_0xc9a2=function(){return _0x2bbba3;};return a67_0xc9a2();}export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';function a67_0x2741(_0x25773e,_0x4bf26d){_0x25773e=_0x25773e-0x18f;var _0xc9a21c=a67_0xc9a2();var _0x2741f9=_0xc9a21c[_0x25773e];return _0x2741f9;}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';
1
+ (function(_0xeb325b,_0x2345f4){var _0x59dcb5=a67_0x574a,_0x18c49e=_0xeb325b();while(!![]){try{var _0x79a5b1=parseInt(_0x59dcb5(0x1ad))/0x1*(-parseInt(_0x59dcb5(0x1ae))/0x2)+-parseInt(_0x59dcb5(0x1a7))/0x3+parseInt(_0x59dcb5(0x1a2))/0x4*(-parseInt(_0x59dcb5(0x1a4))/0x5)+parseInt(_0x59dcb5(0x1a3))/0x6*(-parseInt(_0x59dcb5(0x1a8))/0x7)+-parseInt(_0x59dcb5(0x1a5))/0x8*(parseInt(_0x59dcb5(0x1aa))/0x9)+parseInt(_0x59dcb5(0x1a6))/0xa*(-parseInt(_0x59dcb5(0x1a9))/0xb)+parseInt(_0x59dcb5(0x1ac))/0xc*(parseInt(_0x59dcb5(0x1ab))/0xd);if(_0x79a5b1===_0x2345f4)break;else _0x18c49e['push'](_0x18c49e['shift']());}catch(_0x4d9a73){_0x18c49e['push'](_0x18c49e['shift']());}}}(a67_0x253c,0x9976c));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';function a67_0x574a(_0x4b8c18,_0x4e936b){_0x4b8c18=_0x4b8c18-0x1a2;var _0x253c01=a67_0x253c();var _0x574a57=_0x253c01[_0x4b8c18];return _0x574a57;}export*from'./sdk/client/http-client.js';export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';function a67_0x253c(){var _0x1c321f=['52TVPabi','6MpzjaS','436735IfkTkU','3807128zKnTmz','4430xPmAPd','637737QQHtgm','7085057VpHQhF','6017EQluom','18RQpMAj','13BZkZsk','63069156nakigI','1072831PICclq','2eFbZhP'];a67_0x253c=function(){return _0x1c321f;};return a67_0x253c();}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';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
@@ -1 +1 @@
1
- function a68_0x3bd1(){const _0x3b38eb=['connect','once','Search\x20for\x20relevant\x20tdx\x20commands\x20based\x20on\x20what\x20you\x20want\x20to\x20do.\x0a\x0aExamples:\x0a-\x20{\x22query\x22:\x20\x22how\x20to\x20run\x20SQL\x20queries\x22}\x0a-\x20{\x22query\x22:\x20\x22list\x20databases\x20and\x20tables\x22}\x0a-\x20{\x22query\x22:\x20\x22manage\x20customer\x20segments\x22,\x20\x22category\x22:\x20\x22CDP\x22}\x0a-\x20{\x22query\x22:\x20\x22workflow\x20logs\x22}\x0a\x0aCategories:\x20Data,\x20CDP,\x20AI,\x20Context,\x20Utilities\x0a\x0aReturns\x20matching\x20commands\x20with\x20descriptions\x20and\x20example\x20usage.','success','describe','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','5955544TbUbfI','Command\x20failed','tdx','3380340KxjUfh','error','map','name','14939056DwiDhR','1.0.0','string','text','Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)','\x0a\x0a---\x0a\x0a','51806QTBFOt','registerTool','Data','join','length','array','Optional\x20filter\x20by\x20category','6247265cXjyUD','40LYjQdl','close','enum','stdin','**\x20(','category','output','No\x20commands\x20found\x20matching\x20\x22','env','5334836SsnttS','2157090oikqXi','Command\x20completed\x20successfully','description','Utilities'];a68_0x3bd1=function(){return _0x3b38eb;};return a68_0x3bd1();}(function(_0x2933de,_0x53bea6){const _0x3311ca=a68_0x54b1,_0x361020=_0x2933de();while(!![]){try{const _0x367392=-parseInt(_0x3311ca(0xc3))/0x1*(parseInt(_0x3311ca(0xcb))/0x2)+parseInt(_0x3311ca(0xd5))/0x3+parseInt(_0x3311ca(0xd4))/0x4+parseInt(_0x3311ca(0xca))/0x5+-parseInt(_0x3311ca(0xe2))/0x6+parseInt(_0x3311ca(0xdf))/0x7+-parseInt(_0x3311ca(0xbd))/0x8;if(_0x367392===_0x53bea6)break;else _0x361020['push'](_0x361020['shift']());}catch(_0x23e811){_0x361020['push'](_0x361020['shift']());}}}(a68_0x3bd1,0xa780c));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x406c16={}){const _0x49f2d9=a68_0x54b1,_0x55b733=new McpServer({'name':_0x49f2d9(0xe1),'version':_0x49f2d9(0xbe)});return _0x55b733[_0x49f2d9(0xc4)]('tdx_run',{'description':'Execute\x20any\x20tdx\x20CLI\x20command.\x20Returns\x20JSON\x20output.\x0a\x0aExamples:\x0a-\x20List\x20databases:\x20{\x22args\x22:\x20[\x22databases\x22]}\x0a-\x20Run\x20SQL\x20query:\x20{\x22args\x22:\x20[\x22query\x22,\x20\x22SELECT\x20*\x20FROM\x20mydb.users\x20LIMIT\x2010\x22]}\x0a-\x20List\x20segments:\x20{\x22args\x22:\x20[\x22segments\x22,\x20\x22--recursive\x22]}\x0a-\x20Show\x20job\x20details:\x20{\x22args\x22:\x20[\x22job\x22,\x20\x22show\x22,\x20\x2212345\x22]}\x0a-\x20List\x20tables:\x20{\x22args\x22:\x20[\x22tables\x22,\x20\x22mydb.*\x22]}\x0a\x0aNote:\x20Some\x20commands\x20(auth,\x20profile\x20management,\x20mcp)\x20are\x20blocked\x20for\x20security.','inputSchema':{'args':z[_0x49f2d9(0xc8)](z[_0x49f2d9(0xbf)]())[_0x49f2d9(0xdd)](_0x49f2d9(0xde))}},async({args:_0x5aa2fe})=>{const _0x25fdec=_0x49f2d9,_0x1bd773=await executeTdxRun({'args':_0x5aa2fe},_0x406c16[_0x25fdec(0xd3)]||{});return _0x1bd773[_0x25fdec(0xdc)]?{'content':[{'type':_0x25fdec(0xc0),'text':_0x1bd773['output']||_0x25fdec(0xd6)}]}:{'content':[{'type':'text','text':_0x1bd773[_0x25fdec(0xe3)]||_0x1bd773[_0x25fdec(0xd1)]||_0x25fdec(0xe0)}],'isError':!![]};}),_0x55b733[_0x49f2d9(0xc4)]('tdx_search',{'description':_0x49f2d9(0xdb),'inputSchema':{'query':z[_0x49f2d9(0xbf)]()[_0x49f2d9(0xdd)](_0x49f2d9(0xc1)),'category':z[_0x49f2d9(0xcd)]([_0x49f2d9(0xc5),'CDP','AI','Context',_0x49f2d9(0xd8)])['optional']()[_0x49f2d9(0xdd)](_0x49f2d9(0xc9))}},async({query:_0x5698aa,category:_0x1616bb})=>{const _0x454bbb=_0x49f2d9,_0x4311bb=searchCommands({'query':_0x5698aa,'category':_0x1616bb});if(_0x4311bb[_0x454bbb(0xc7)]===0x0)return{'content':[{'type':_0x454bbb(0xc0),'text':_0x454bbb(0xd2)+_0x5698aa+'\x22'}]};const _0x154183=_0x4311bb[_0x454bbb(0xbb)](_0x375583=>{const _0x174a2f=_0x454bbb,_0x111c63=_0x375583['examples']['map'](_0x43fbfa=>'\x20\x20'+_0x43fbfa)[_0x174a2f(0xc6)]('\x0a');return'**'+_0x375583[_0x174a2f(0xbc)]+_0x174a2f(0xcf)+_0x375583[_0x174a2f(0xd0)]+')\x0a'+_0x375583[_0x174a2f(0xd7)]+'\x0a\x0aExamples:\x0a'+_0x111c63;})['join'](_0x454bbb(0xc2));return{'content':[{'type':_0x454bbb(0xc0),'text':_0x154183}]};}),_0x55b733;}function a68_0x54b1(_0x5cb515,_0x31e11a){_0x5cb515=_0x5cb515-0xbb;const _0x3bd181=a68_0x3bd1();let _0x54b138=_0x3bd181[_0x5cb515];return _0x54b138;}export async function startMCPServer(_0x1a6192={}){const _0x130c5b=a68_0x54b1,_0x56a33d=createMCPServer(_0x1a6192),_0x2beb8d=new StdioServerTransport();return await _0x56a33d[_0x130c5b(0xd9)](_0x2beb8d),new Promise(_0x93845c=>{const _0x54387d=_0x130c5b;let _0x53e0ad=![];const _0xe14c0a=async()=>{if(_0x53e0ad)return;_0x53e0ad=!![],await _0x56a33d['close'](),_0x93845c();};process[_0x54387d(0xda)]('SIGINT',_0xe14c0a),process['once']('SIGTERM',_0xe14c0a),process[_0x54387d(0xce)][_0x54387d(0xda)](_0x54387d(0xcc),_0xe14c0a);});}
1
+ (function(_0x50566b,_0x38407c){const _0x4a0c39=a68_0x4a81,_0x17dea2=_0x50566b();while(!![]){try{const _0x4c82f6=-parseInt(_0x4a0c39(0x20c))/0x1+-parseInt(_0x4a0c39(0x204))/0x2*(-parseInt(_0x4a0c39(0x1fd))/0x3)+-parseInt(_0x4a0c39(0x1eb))/0x4+parseInt(_0x4a0c39(0x1f7))/0x5+parseInt(_0x4a0c39(0x1e9))/0x6+parseInt(_0x4a0c39(0x1fb))/0x7*(-parseInt(_0x4a0c39(0x208))/0x8)+-parseInt(_0x4a0c39(0x1f9))/0x9*(-parseInt(_0x4a0c39(0x1fe))/0xa);if(_0x4c82f6===_0x38407c)break;else _0x17dea2['push'](_0x17dea2['shift']());}catch(_0x403469){_0x17dea2['push'](_0x17dea2['shift']());}}}(a68_0x5aa8,0x691e6));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';function a68_0x4a81(_0x2ccb32,_0x21f10e){_0x2ccb32=_0x2ccb32-0x1e0;const _0x5aa840=a68_0x5aa8();let _0x4a8176=_0x5aa840[_0x2ccb32];return _0x4a8176;}function a68_0x5aa8(){const _0x5431ee=['2638005RLjcuK','tdx_run','9EMWFHY','length','63BVRDVH','text','41277DvVGaZ','1080650DZkTnB','1.0.0','error','registerTool','map','Data','54CeZKRz','SIGTERM','string','Command\x20and\x20arguments\x20as\x20array\x20(e.g.,\x20[\x22query\x22,\x20\x22SELECT\x20...\x22])','416736SoTqaI','category','stdin','description','739478QBRGpZ','Utilities','Optional\x20filter\x20by\x20category','tdx','optional','tdx_search','Command\x20completed\x20successfully','once','\x0a\x0a---\x0a\x0a','output','env','name','4472394NuTWOk','**\x20(','454744vqKamI','connect','SIGINT','examples','describe','CDP','Command\x20failed','enum','join','close','Execute\x20any\x20tdx\x20CLI\x20command.\x20Returns\x20JSON\x20output.\x0a\x0aExamples:\x0a-\x20List\x20databases:\x20{\x22args\x22:\x20[\x22databases\x22]}\x0a-\x20Run\x20SQL\x20query:\x20{\x22args\x22:\x20[\x22query\x22,\x20\x22SELECT\x20*\x20FROM\x20mydb.users\x20LIMIT\x2010\x22]}\x0a-\x20List\x20segments:\x20{\x22args\x22:\x20[\x22segments\x22,\x20\x22--recursive\x22]}\x0a-\x20Show\x20job\x20details:\x20{\x22args\x22:\x20[\x22job\x22,\x20\x22show\x22,\x20\x2212345\x22]}\x0a-\x20List\x20tables:\x20{\x22args\x22:\x20[\x22tables\x22,\x20\x22mydb.*\x22]}\x0a\x0aNote:\x20Some\x20commands\x20(auth,\x20profile\x20management,\x20mcp)\x20are\x20blocked\x20for\x20security.','array'];a68_0x5aa8=function(){return _0x5431ee;};return a68_0x5aa8();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{z}from'zod';import{executeTdxRun,searchCommands}from'./tools/index.js';export function createMCPServer(_0x40a13e={}){const _0x183001=a68_0x4a81,_0x4f800a=new McpServer({'name':_0x183001(0x1e0),'version':_0x183001(0x1ff)});return _0x4f800a[_0x183001(0x201)](_0x183001(0x1f8),{'description':_0x183001(0x1f5),'inputSchema':{'args':z[_0x183001(0x1f6)](z[_0x183001(0x206)]())['describe'](_0x183001(0x207))}},async({args:_0x75e97})=>{const _0x62f8c8=_0x183001,_0x33895d=await executeTdxRun({'args':_0x75e97},_0x40a13e[_0x62f8c8(0x1e7)]||{});return _0x33895d['success']?{'content':[{'type':_0x62f8c8(0x1fc),'text':_0x33895d[_0x62f8c8(0x1e6)]||_0x62f8c8(0x1e3)}]}:{'content':[{'type':_0x62f8c8(0x1fc),'text':_0x33895d[_0x62f8c8(0x200)]||_0x33895d['output']||_0x62f8c8(0x1f1)}],'isError':!![]};}),_0x4f800a['registerTool'](_0x183001(0x1e2),{'description':'Search\x20for\x20relevant\x20tdx\x20commands\x20based\x20on\x20what\x20you\x20want\x20to\x20do.\x0a\x0aExamples:\x0a-\x20{\x22query\x22:\x20\x22how\x20to\x20run\x20SQL\x20queries\x22}\x0a-\x20{\x22query\x22:\x20\x22list\x20databases\x20and\x20tables\x22}\x0a-\x20{\x22query\x22:\x20\x22manage\x20customer\x20segments\x22,\x20\x22category\x22:\x20\x22CDP\x22}\x0a-\x20{\x22query\x22:\x20\x22workflow\x20logs\x22}\x0a\x0aCategories:\x20Data,\x20CDP,\x20AI,\x20Context,\x20Utilities\x0a\x0aReturns\x20matching\x20commands\x20with\x20descriptions\x20and\x20example\x20usage.','inputSchema':{'query':z[_0x183001(0x206)]()['describe']('Natural\x20language\x20query\x20(e.g.,\x20\x22list\x20databases\x22,\x20\x22run\x20SQL\x22,\x20\x22manage\x20segments\x22)'),'category':z[_0x183001(0x1f2)]([_0x183001(0x203),_0x183001(0x1f0),'AI','Context',_0x183001(0x20d)])[_0x183001(0x1e1)]()[_0x183001(0x1ef)](_0x183001(0x20e))}},async({query:_0x171f73,category:_0x3be91e})=>{const _0x3f7a24=_0x183001,_0xddffcb=searchCommands({'query':_0x171f73,'category':_0x3be91e});if(_0xddffcb[_0x3f7a24(0x1fa)]===0x0)return{'content':[{'type':'text','text':'No\x20commands\x20found\x20matching\x20\x22'+_0x171f73+'\x22'}]};const _0x2d7de1=_0xddffcb[_0x3f7a24(0x202)](_0x31ae57=>{const _0x4ea83e=_0x3f7a24,_0x4a1cf3=_0x31ae57[_0x4ea83e(0x1ee)][_0x4ea83e(0x202)](_0x1aa3ee=>'\x20\x20'+_0x1aa3ee)[_0x4ea83e(0x1f3)]('\x0a');return'**'+_0x31ae57[_0x4ea83e(0x1e8)]+_0x4ea83e(0x1ea)+_0x31ae57[_0x4ea83e(0x209)]+')\x0a'+_0x31ae57[_0x4ea83e(0x20b)]+'\x0a\x0aExamples:\x0a'+_0x4a1cf3;})[_0x3f7a24(0x1f3)](_0x3f7a24(0x1e5));return{'content':[{'type':'text','text':_0x2d7de1}]};}),_0x4f800a;}export async function startMCPServer(_0x2a406d={}){const _0x82e1e1=a68_0x4a81,_0x54e077=createMCPServer(_0x2a406d),_0x3671fe=new StdioServerTransport();return await _0x54e077[_0x82e1e1(0x1ec)](_0x3671fe),new Promise(_0x4be21f=>{const _0x6f0b44=_0x82e1e1;let _0x2b4c8a=![];const _0x5c2201=async()=>{if(_0x2b4c8a)return;_0x2b4c8a=!![],await _0x54e077['close'](),_0x4be21f();};process[_0x6f0b44(0x1e4)](_0x6f0b44(0x1ed),_0x5c2201),process[_0x6f0b44(0x1e4)](_0x6f0b44(0x205),_0x5c2201),process[_0x6f0b44(0x20a)][_0x6f0b44(0x1e4)](_0x6f0b44(0x1f4),_0x5c2201);});}
@@ -1 +1 @@
1
- (function(_0x584091,_0x178bb5){var _0x2f70f1=a69_0x5dff,_0x3c02d4=_0x584091();while(!![]){try{var _0xac1573=parseInt(_0x2f70f1(0x9d))/0x1+parseInt(_0x2f70f1(0x9f))/0x2+parseInt(_0x2f70f1(0xa0))/0x3+parseInt(_0x2f70f1(0xa1))/0x4*(parseInt(_0x2f70f1(0xa2))/0x5)+parseInt(_0x2f70f1(0x9b))/0x6+-parseInt(_0x2f70f1(0x9a))/0x7*(parseInt(_0x2f70f1(0x9e))/0x8)+-parseInt(_0x2f70f1(0x9c))/0x9;if(_0xac1573===_0x178bb5)break;else _0x3c02d4['push'](_0x3c02d4['shift']());}catch(_0x58c1c6){_0x3c02d4['push'](_0x3c02d4['shift']());}}}(a69_0x450f,0x26944));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';function a69_0x5dff(_0xe4f1cb,_0x3c5c96){_0xe4f1cb=_0xe4f1cb-0x9a;var _0x450fe0=a69_0x450f();var _0x5dffc4=_0x450fe0[_0xe4f1cb];return _0x5dffc4;}function a69_0x450f(){var _0x11d8e8=['72CotmaL','350728KTHELh','650805akJYwr','27252KoenVz','130yskzkJ','77063KufCMr','590652LgnOBu','5869818EDaEmc','241424qCpNkE'];a69_0x450f=function(){return _0x11d8e8;};return a69_0x450f();}
1
+ function a69_0x3870(_0x3b3526,_0x2cc5b4){_0x3b3526=_0x3b3526-0x1b0;var _0x2ca70f=a69_0x2ca7();var _0x3870a9=_0x2ca70f[_0x3b3526];return _0x3870a9;}function a69_0x2ca7(){var _0x2ad86f=['36056840tOnsSX','9561780vAVqfW','2RqwpOI','1498485Skbxyw','2597483CAedut','26332wYHZUl','2934ElaDrC','597tprwtJ','8ruZKDb','318203HDIPOw'];a69_0x2ca7=function(){return _0x2ad86f;};return a69_0x2ca7();}(function(_0xbbb62c,_0x3bac11){var _0x56788e=a69_0x3870,_0x131bc7=_0xbbb62c();while(!![]){try{var _0x26bef1=-parseInt(_0x56788e(0x1b0))/0x1*(-parseInt(_0x56788e(0x1b3))/0x2)+-parseInt(_0x56788e(0x1b8))/0x3*(parseInt(_0x56788e(0x1b6))/0x4)+-parseInt(_0x56788e(0x1b4))/0x5+parseInt(_0x56788e(0x1b7))/0x6+parseInt(_0x56788e(0x1b5))/0x7*(-parseInt(_0x56788e(0x1b9))/0x8)+-parseInt(_0x56788e(0x1b2))/0x9+parseInt(_0x56788e(0x1b1))/0xa;if(_0x26bef1===_0x3bac11)break;else _0x131bc7['push'](_0x131bc7['shift']());}catch(_0x5b520b){_0x131bc7['push'](_0x131bc7['shift']());}}}(a69_0x2ca7,0xd7215));export{executeTdxRun,TdxRunInputSchema}from'./tdx-run.js';export{searchCommands,TdxSearchInputSchema}from'./tdx-search.js';