@treasuredata/tdx 0.8.8 → 0.8.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 (152) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.d.ts +25 -1
  6. package/dist/client/cdp-api-client.d.ts.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/cdp-api-client.js.map +1 -1
  9. package/dist/client/engage-api-client.js +1 -1
  10. package/dist/client/http-client.js +1 -1
  11. package/dist/client/llm-api-client.js +1 -1
  12. package/dist/client/rate-limiter.js +1 -1
  13. package/dist/client/td-api-client.js +1 -1
  14. package/dist/client/trino-api-client.js +1 -1
  15. package/dist/client/workflow-client.js +1 -1
  16. package/dist/commands/activations.js +1 -1
  17. package/dist/commands/api-command.js +1 -1
  18. package/dist/commands/auth-command.js +1 -1
  19. package/dist/commands/chat-command.js +1 -1
  20. package/dist/commands/claude-command.js +1 -1
  21. package/dist/commands/claude-statusline-command.js +1 -1
  22. package/dist/commands/claude-usage-command.js +1 -1
  23. package/dist/commands/command.js +1 -1
  24. package/dist/commands/connection-command.js +1 -1
  25. package/dist/commands/context-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/describe.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.d.ts.map +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-command.js.map +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/llm-proxy.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/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.d.ts +6 -6
  42. package/dist/commands/segment-pull-command.d.ts.map +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js.map +1 -1
  45. package/dist/commands/segment-push-command.d.ts +6 -6
  46. package/dist/commands/segment-push-command.d.ts.map +1 -1
  47. package/dist/commands/segment-push-command.js +1 -1
  48. package/dist/commands/segment-push-command.js.map +1 -1
  49. package/dist/commands/segment-update-command.js +1 -1
  50. package/dist/commands/segment-use-command.js +1 -1
  51. package/dist/commands/segments.d.ts +2 -2
  52. package/dist/commands/segments.d.ts.map +1 -1
  53. package/dist/commands/segments.js +1 -1
  54. package/dist/commands/segments.js.map +1 -1
  55. package/dist/commands/show.js +1 -1
  56. package/dist/commands/tables.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/profile.js +1 -1
  67. package/dist/core/project-config.js +1 -1
  68. package/dist/core/session.js +1 -1
  69. package/dist/core/user-cache.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/proxy/anthropic-adapter.js +1 -1
  72. package/dist/proxy/claude-usage-tracker.js +1 -1
  73. package/dist/proxy/context-signature.js +1 -1
  74. package/dist/proxy/conversation-utils.js +1 -1
  75. package/dist/proxy/server.js +1 -1
  76. package/dist/proxy/session-cache.js +1 -1
  77. package/dist/sdk/api.js +1 -1
  78. package/dist/sdk/connection.js +1 -1
  79. package/dist/sdk/engage.js +1 -1
  80. package/dist/sdk/errors.d.ts +2 -0
  81. package/dist/sdk/errors.d.ts.map +1 -1
  82. package/dist/sdk/errors.js +1 -1
  83. package/dist/sdk/errors.js.map +1 -1
  84. package/dist/sdk/index.js +1 -1
  85. package/dist/sdk/job.js +1 -1
  86. package/dist/sdk/journey.d.ts +16 -1
  87. package/dist/sdk/journey.d.ts.map +1 -1
  88. package/dist/sdk/journey.js +1 -1
  89. package/dist/sdk/journey.js.map +1 -1
  90. package/dist/sdk/llm.js +1 -1
  91. package/dist/sdk/query.js +1 -1
  92. package/dist/sdk/segment/child-segment-yaml.d.ts +15 -2
  93. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  94. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  95. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  96. package/dist/sdk/segment/journey-yaml.d.ts +224 -46
  97. package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
  98. package/dist/sdk/segment/journey-yaml.js +1 -1
  99. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  100. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  101. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  102. package/dist/sdk/segment.d.ts +15 -1
  103. package/dist/sdk/segment.d.ts.map +1 -1
  104. package/dist/sdk/segment.js +1 -1
  105. package/dist/sdk/segment.js.map +1 -1
  106. package/dist/sdk/user.js +1 -1
  107. package/dist/sdk/workflow.js +1 -1
  108. package/dist/types/cdp.d.ts +76 -0
  109. package/dist/types/cdp.d.ts.map +1 -1
  110. package/dist/types/endpoints.js +1 -1
  111. package/dist/types/index.d.ts +1 -1
  112. package/dist/types/index.d.ts.map +1 -1
  113. package/dist/types/index.js +1 -1
  114. package/dist/utils/agent-ref-parser.js +1 -1
  115. package/dist/utils/async.js +1 -1
  116. package/dist/utils/chat-cache.js +1 -1
  117. package/dist/utils/colors.js +1 -1
  118. package/dist/utils/command-output.js +1 -1
  119. package/dist/utils/constants.js +1 -1
  120. package/dist/utils/diff.js +1 -1
  121. package/dist/utils/fields-display.js +1 -1
  122. package/dist/utils/file-permissions.js +1 -1
  123. package/dist/utils/format-detector.js +1 -1
  124. package/dist/utils/formatters.js +1 -1
  125. package/dist/utils/journey-utils.d.ts +110 -0
  126. package/dist/utils/journey-utils.d.ts.map +1 -0
  127. package/dist/utils/journey-utils.js +1 -0
  128. package/dist/utils/journey-utils.js.map +1 -0
  129. package/dist/utils/json-loader.js +1 -1
  130. package/dist/utils/llm-backup-utils.js +1 -1
  131. package/dist/utils/model-aliases.js +1 -1
  132. package/dist/utils/model-factors.js +1 -1
  133. package/dist/utils/option-validation.js +1 -1
  134. package/dist/utils/port.js +1 -1
  135. package/dist/utils/process.js +1 -1
  136. package/dist/utils/prompt.js +1 -1
  137. package/dist/utils/segment-path-parser.js +1 -1
  138. package/dist/utils/segment-ref-parser.js +1 -1
  139. package/dist/utils/spinner.js +1 -1
  140. package/dist/utils/sql-parser.js +1 -1
  141. package/dist/utils/sse-parser.js +1 -1
  142. package/dist/utils/string-utils.js +1 -1
  143. package/dist/utils/table-ref-parser.js +1 -1
  144. package/dist/utils/tdx-config.js +1 -1
  145. package/dist/utils/tdx-logger.js +1 -1
  146. package/dist/utils/tree-formatter.d.ts +9 -8
  147. package/dist/utils/tree-formatter.d.ts.map +1 -1
  148. package/dist/utils/tree-formatter.js +1 -1
  149. package/dist/utils/tree-formatter.js.map +1 -1
  150. package/dist/utils/version-check.js +1 -1
  151. package/dist/utils/workflow-utils.js +1 -1
  152. package/package.json +1 -1
@@ -1 +1 @@
1
- const a42_0x387fe0=a42_0x5658;function a42_0x5658(_0x16e3fd,_0x4e5b05){_0x16e3fd=_0x16e3fd-0xea;const _0x2642b5=a42_0x2642();let _0x56587d=_0x2642b5[_0x16e3fd];return _0x56587d;}function a42_0x2642(){const _0x5031cb=['12429172GPmXuu','length','✔\x20Found\x20','Error:\x20','Show\x20current\x20user\x20information','8suUUZR','user\x20list','Fetching\x20user\x20info...','message','cause','6UcBKLb','4327964bmWCrk','808683dCHOgf','user','verbose','error','922372MZYRan','10DqPhaW','Listing\x20users...','1326235xIKYYO','execute','name','description','2547130bWgRlV','45sbqTvj','18511229lvHZFy'];a42_0x2642=function(){return _0x5031cb;};return a42_0x2642();}(function(_0x58ccfb,_0x82b1b3){const _0x1861b1=a42_0x5658,_0xe7b1f8=_0x58ccfb();while(!![]){try{const _0x53dbb1=parseInt(_0x1861b1(0xfc))/0x1+-parseInt(_0x1861b1(0xfd))/0x2*(-parseInt(_0x1861b1(0xf8))/0x3)+parseInt(_0x1861b1(0xf7))/0x4+parseInt(_0x1861b1(0xff))/0x5*(-parseInt(_0x1861b1(0xf6))/0x6)+parseInt(_0x1861b1(0xec))/0x7*(-parseInt(_0x1861b1(0xf1))/0x8)+parseInt(_0x1861b1(0xea))/0x9*(parseInt(_0x1861b1(0x103))/0xa)+-parseInt(_0x1861b1(0xeb))/0xb;if(_0x53dbb1===_0x82b1b3)break;else _0xe7b1f8['push'](_0xe7b1f8['shift']());}catch(_0x3cfa32){_0xe7b1f8['push'](_0xe7b1f8['shift']());}}}(a42_0x2642,0xdc3a3));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{['name']=a42_0x387fe0(0xf9);[a42_0x387fe0(0x102)]=a42_0x387fe0(0xf0);async[a42_0x387fe0(0x100)](_0x22503d){const _0x2004b8=a42_0x387fe0,{options:_0x2c905b,tdx:_0x20cd12}=_0x22503d;try{const _0x40f2e1=await withSpinner(_0x2004b8(0xf3),()=>_0x20cd12[_0x2004b8(0xf9)]['getCurrent'](),{'verbose':_0x2c905b[_0x2004b8(0xfa)]}),_0x3d8a8b=_0x40f2e1['data'];return await handleSingleObjectOutput(_0x3d8a8b,_0x2c905b),0x0;}catch(_0x4c64c2){if(_0x4c64c2 instanceof SDKError)return console[_0x2004b8(0xfb)](_0x2004b8(0xef)+_0x4c64c2[_0x2004b8(0xf4)]),_0x4c64c2['cause']&&console[_0x2004b8(0xfb)]('\x20\x20Cause:\x20'+_0x4c64c2[_0x2004b8(0xf5)]),0x1;throw _0x4c64c2;}}}export class UserListCommand extends BaseCommand{[a42_0x387fe0(0x101)]=a42_0x387fe0(0xf2);[a42_0x387fe0(0x102)]='List\x20all\x20users\x20in\x20the\x20account';async[a42_0x387fe0(0x100)](_0x2384c3){const _0x6ef686=a42_0x387fe0,{options:_0x3b2d0b,tdx:_0x5a83d7}=_0x2384c3;try{const _0x4fa4ec=await withSpinner(_0x6ef686(0xfe),()=>_0x5a83d7['user']['list'](),{'verbose':_0x3b2d0b[_0x6ef686(0xfa)]}),_0xc29e55=_0x4fa4ec['data'];return console[_0x6ef686(0xfb)](_0x6ef686(0xee)+_0xc29e55[_0x6ef686(0xed)]+'\x20user'+(_0xc29e55[_0x6ef686(0xed)]!==0x1?'s':'')),await handleSDKOutput(_0xc29e55,_0x3b2d0b),0x0;}catch(_0x279d17){if(_0x279d17 instanceof SDKError)return console[_0x6ef686(0xfb)](_0x6ef686(0xef)+_0x279d17[_0x6ef686(0xf4)]),_0x279d17[_0x6ef686(0xf5)]&&console['error']('\x20\x20Cause:\x20'+_0x279d17[_0x6ef686(0xf5)]),0x1;throw _0x279d17;}}}
1
+ const a42_0x52ef73=a42_0x119a;(function(_0xecfd95,_0x5e2606){const _0x18d0fd=a42_0x119a,_0x47bec7=_0xecfd95();while(!![]){try{const _0x34f5a6=-parseInt(_0x18d0fd(0x99))/0x1+-parseInt(_0x18d0fd(0x89))/0x2*(-parseInt(_0x18d0fd(0x8f))/0x3)+parseInt(_0x18d0fd(0xa2))/0x4*(parseInt(_0x18d0fd(0x9f))/0x5)+parseInt(_0x18d0fd(0x9c))/0x6*(-parseInt(_0x18d0fd(0x8a))/0x7)+parseInt(_0x18d0fd(0x8c))/0x8+-parseInt(_0x18d0fd(0x90))/0x9+parseInt(_0x18d0fd(0x8d))/0xa;if(_0x34f5a6===_0x5e2606)break;else _0x47bec7['push'](_0x47bec7['shift']());}catch(_0x5ccef6){_0x47bec7['push'](_0x47bec7['shift']());}}}(a42_0x5a9d,0x80bd0));function a42_0x119a(_0x119700,_0xcd57d3){_0x119700=_0x119700-0x89;const _0x5a9dd6=a42_0x5a9d();let _0x119a22=_0x5a9dd6[_0x119700];return _0x119a22;}function a42_0x5a9d(){const _0x2c43c4=['\x20\x20Cause:\x20','List\x20all\x20users\x20in\x20the\x20account','Show\x20current\x20user\x20information','Listing\x20users...','Error:\x20','data','length','user','717791ehKNgo','✔\x20Found\x20','cause','402xPOraG','error','description','40505HAvvmx','user\x20list','message','116UZuBgE','name','getCurrent','2010lCmFZK','20363SrpdKr','verbose','840880ESWtuA','14618870stXoMv','execute','1920FJGdpC','9046080HZhMAB'];a42_0x5a9d=function(){return _0x2c43c4;};return a42_0x5a9d();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{[a42_0x52ef73(0xa3)]=a42_0x52ef73(0x98);[a42_0x52ef73(0x9e)]=a42_0x52ef73(0x93);async[a42_0x52ef73(0x8e)](_0x397f0e){const _0x14c98=a42_0x52ef73,{options:_0x4f8b9c,tdx:_0x5187b9}=_0x397f0e;try{const _0x2caa33=await withSpinner('Fetching\x20user\x20info...',()=>_0x5187b9[_0x14c98(0x98)][_0x14c98(0xa4)](),{'verbose':_0x4f8b9c[_0x14c98(0x8b)]}),_0xdcc789=_0x2caa33[_0x14c98(0x96)];return await handleSingleObjectOutput(_0xdcc789,_0x4f8b9c),0x0;}catch(_0x8d047f){if(_0x8d047f instanceof SDKError)return console[_0x14c98(0x9d)](_0x14c98(0x95)+_0x8d047f[_0x14c98(0xa1)]),_0x8d047f[_0x14c98(0x9b)]&&console[_0x14c98(0x9d)](_0x14c98(0x91)+_0x8d047f['cause']),0x1;throw _0x8d047f;}}}export class UserListCommand extends BaseCommand{['name']=a42_0x52ef73(0xa0);[a42_0x52ef73(0x9e)]=a42_0x52ef73(0x92);async[a42_0x52ef73(0x8e)](_0x38bd1b){const _0x19dfad=a42_0x52ef73,{options:_0x2268e3,tdx:_0x17221d}=_0x38bd1b;try{const _0x18e0d5=await withSpinner(_0x19dfad(0x94),()=>_0x17221d['user']['list'](),{'verbose':_0x2268e3['verbose']}),_0x4be6db=_0x18e0d5['data'];return console[_0x19dfad(0x9d)](_0x19dfad(0x9a)+_0x4be6db[_0x19dfad(0x97)]+'\x20user'+(_0x4be6db['length']!==0x1?'s':'')),await handleSDKOutput(_0x4be6db,_0x2268e3),0x0;}catch(_0x310c03){if(_0x310c03 instanceof SDKError)return console['error'](_0x19dfad(0x95)+_0x310c03['message']),_0x310c03[_0x19dfad(0x9b)]&&console[_0x19dfad(0x9d)](_0x19dfad(0x91)+_0x310c03['cause']),0x1;throw _0x310c03;}}}
@@ -1 +1 @@
1
- const a43_0x26092c=a43_0x397f;function a43_0x397f(_0x3d6a47,_0x35c756){_0x3d6a47=_0x3d6a47-0xd2;const _0x6a1dc9=a43_0x6a1d();let _0x397f32=_0x6a1dc9[_0x3d6a47];return _0x397f32;}(function(_0x592f68,_0x3a4dac){const _0x55263d=a43_0x397f,_0x18764d=_0x592f68();while(!![]){try{const _0x1fabb3=parseInt(_0x55263d(0xe4))/0x1*(parseInt(_0x55263d(0x142))/0x2)+-parseInt(_0x55263d(0x169))/0x3+parseInt(_0x55263d(0x141))/0x4*(-parseInt(_0x55263d(0x157))/0x5)+-parseInt(_0x55263d(0x13c))/0x6+parseInt(_0x55263d(0xee))/0x7+parseInt(_0x55263d(0xea))/0x8*(-parseInt(_0x55263d(0x143))/0x9)+-parseInt(_0x55263d(0x133))/0xa*(-parseInt(_0x55263d(0x152))/0xb);if(_0x1fabb3===_0x3a4dac)break;else _0x18764d['push'](_0x18764d['shift']());}catch(_0x438897){_0x18764d['push'](_0x18764d['shift']());}}}(a43_0x6a1d,0x684c7));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a43_0x140319 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0xe5);['description']='List\x20all\x20workflow\x20projects';async[a43_0x26092c(0xf6)](_0x165c46){const _0x140c6f=a43_0x26092c,{options:_0xbf039,args:_0x105a9b,tdx:_0x569692}=_0x165c46,_0x98245f=_0x105a9b[0x0];try{_0xbf039['verbose']&&_0x98245f&&console[_0x140c6f(0xf1)](_0x140c6f(0x102)+_0x98245f);const _0x20bed2=await withSpinner(_0x140c6f(0x10e),()=>_0x569692[_0x140c6f(0x149)][_0x140c6f(0x13b)](_0x98245f,{'limit':_0xbf039[_0x140c6f(0x111)]}),{'verbose':_0xbf039[_0x140c6f(0x163)]}),_0x365490=_0x20bed2['data'];return console[_0x140c6f(0xf1)](_0x140c6f(0xf7)+_0x365490[_0x140c6f(0x12a)]+_0x140c6f(0x122)+(_0x365490[_0x140c6f(0x12a)]!==0x1?'s':'')),await handleSDKOutput(_0x365490,_0xbf039),0x0;}catch(_0x2888f5){if(_0x2888f5 instanceof SDKError)return console[_0x140c6f(0xf1)](_0x140c6f(0xf5)+_0x2888f5[_0x140c6f(0x14a)]),_0x2888f5[_0x140c6f(0x14e)]&&console['error'](_0x140c6f(0x114)+_0x2888f5['cause']),0x1;throw _0x2888f5;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0x123);[a43_0x26092c(0xe6)]=a43_0x26092c(0x15d);async[a43_0x26092c(0xf6)](_0x591cfd){const _0xb81e02=a43_0x26092c,{options:_0x3b857e,args:_0x5f10e5,tdx:_0x4601eb}=_0x591cfd,_0x5924be=_0x5f10e5[0x0];try{_0x3b857e[_0xb81e02(0x163)]&&_0x5924be&&console[_0xb81e02(0xf1)](_0xb81e02(0x105)+_0x5924be);const _0x2354a7=await withSpinner(_0xb81e02(0x130),()=>_0x4601eb[_0xb81e02(0x149)]['workflows'](_0x5924be,{'limit':_0x3b857e[_0xb81e02(0x111)]}),{'verbose':_0x3b857e[_0xb81e02(0x163)]}),_0x494583=_0x2354a7[_0xb81e02(0xeb)];return console[_0xb81e02(0xf1)]('✔\x20Found\x20'+_0x494583[_0xb81e02(0x12a)]+_0xb81e02(0xd4)+(_0x494583[_0xb81e02(0x12a)]!==0x1?'s':'')),await handleSDKOutput(_0x494583,_0x3b857e),0x0;}catch(_0x2f8f5e){if(_0x2f8f5e instanceof SDKError)return console[_0xb81e02(0xf1)](_0xb81e02(0xf5)+_0x2f8f5e[_0xb81e02(0x14a)]),_0x2f8f5e[_0xb81e02(0x14e)]&&console['error'](_0xb81e02(0x114)+_0x2f8f5e[_0xb81e02(0x14e)]),0x1;throw _0x2f8f5e;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a43_0x26092c(0xfb);[a43_0x26092c(0xe6)]=a43_0x26092c(0xff);async['execute'](_0x57b825){const _0x447a95=a43_0x26092c,{options:_0x217b5e,args:_0x4d4aa6,tdx:_0x1cfa06}=_0x57b825;let _0x5ef0f0,_0x536817;if(_0x4d4aa6[0x0]){const _0x539f3f=_0x4d4aa6[0x0][_0x447a95(0xfd)]('.');if(_0x539f3f[_0x447a95(0x12a)]===0x1)_0x5ef0f0=_0x539f3f[0x0];else{if(_0x539f3f[_0x447a95(0x12a)]===0x2)[_0x5ef0f0,_0x536817]=_0x539f3f;else return console[_0x447a95(0xf1)](_0x447a95(0x117)),0x1;}}try{if(_0x217b5e['verbose']){if(_0x5ef0f0&&_0x536817)console[_0x447a95(0xf1)]('Filter:\x20'+_0x5ef0f0+'.'+_0x536817);else _0x5ef0f0&&console[_0x447a95(0xf1)](_0x447a95(0xf2)+_0x5ef0f0);const _0x5d4e1b=_0x217b5e[_0x447a95(0xf4)];_0x5d4e1b&&console['error']('Status:\x20'+_0x5d4e1b);}const _0x10b310=await withSpinner(_0x447a95(0xe3),()=>_0x1cfa06['workflow'][_0x447a95(0x135)]({'projectName':_0x5ef0f0,'workflowName':_0x536817,'status':_0x217b5e[_0x447a95(0xf4)],'fromTime':_0x217b5e['from'],'toTime':_0x217b5e['to'],'limit':_0x217b5e[_0x447a95(0x111)]}),{'verbose':_0x217b5e[_0x447a95(0x163)]}),_0x58c3d3=_0x10b310[_0x447a95(0xeb)];return console['error'](_0x447a95(0xf7)+_0x58c3d3[_0x447a95(0x12a)]+_0x447a95(0x14d)+(_0x58c3d3[_0x447a95(0x12a)]!==0x1?'s':'')),await handleSDKOutput(_0x58c3d3,_0x217b5e),0x0;}catch(_0x4e0da1){if(_0x4e0da1 instanceof SDKError)return console[_0x447a95(0xf1)](_0x447a95(0xf5)+_0x4e0da1[_0x447a95(0x14a)]),_0x4e0da1[_0x447a95(0x14e)]&&console[_0x447a95(0xf1)](_0x447a95(0x114)+_0x4e0da1[_0x447a95(0x14e)]),0x1;throw _0x4e0da1;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0x145);[a43_0x26092c(0xe6)]=a43_0x26092c(0x164);async[a43_0x26092c(0xf6)](_0x67a400){const _0x23d4fc=a43_0x26092c,{options:_0x20847,args:_0x144327,tdx:_0x24a4a6}=_0x67a400;let _0x3f3377,_0x51ff55;if(_0x144327[0x0]){const _0x220d9f=_0x144327[0x0]['split']('.');if(_0x220d9f['length']===0x1)_0x3f3377=_0x220d9f[0x0];else{if(_0x220d9f[_0x23d4fc(0x12a)]===0x2)[_0x3f3377,_0x51ff55]=_0x220d9f;else return console[_0x23d4fc(0xf1)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x3f8703=_0x20847[_0x23d4fc(0xe1)];if(_0x20847[_0x23d4fc(0x163)]){if(_0x3f3377&&_0x51ff55)console[_0x23d4fc(0xf1)]('Filter:\x20'+_0x3f3377+'.'+_0x51ff55);else _0x3f3377&&console['error'](_0x23d4fc(0xf2)+_0x3f3377);_0x3f8703&&console['error']('Include\x20retried:\x20yes');}const _0x49412c=await withSpinner(_0x23d4fc(0x10d),()=>_0x24a4a6[_0x23d4fc(0x149)][_0x23d4fc(0xd2)]({'projectName':_0x3f3377,'workflowName':_0x51ff55,'includeRetried':_0x3f8703,'limit':_0x20847['limit']}),{'verbose':_0x20847[_0x23d4fc(0x163)]}),_0x138a32=_0x49412c[_0x23d4fc(0xeb)];return console[_0x23d4fc(0xf1)](_0x23d4fc(0xf7)+_0x138a32[_0x23d4fc(0x12a)]+_0x23d4fc(0x115)+(_0x138a32['length']!==0x1?'s':'')),await handleSDKOutput(_0x138a32,_0x20847),0x0;}catch(_0x186055){if(_0x186055 instanceof SDKError)return console[_0x23d4fc(0xf1)]('Error:\x20'+_0x186055[_0x23d4fc(0x14a)]),_0x186055[_0x23d4fc(0x14e)]&&console[_0x23d4fc(0xf1)](_0x23d4fc(0x114)+_0x186055[_0x23d4fc(0x14e)]),0x1;throw _0x186055;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0x156);[a43_0x26092c(0xe6)]=a43_0x26092c(0x12b);async['execute'](_0x338493){const _0x323d23=a43_0x26092c,{options:_0x2152c3,args:_0x4d071e,tdx:_0x3d6930}=_0x338493,_0x503e36=_0x4d071e[0x0];if(!_0x503e36)return console[_0x323d23(0xf1)](_0x323d23(0xe2)),0x1;try{_0x2152c3[_0x323d23(0x163)]&&console[_0x323d23(0xf1)](_0x323d23(0x150)+_0x503e36);const _0x3fbdbc=await withSpinner('Getting\x20attempt\x20details...',()=>_0x3d6930[_0x323d23(0x149)][_0x323d23(0x15a)](_0x503e36),{'verbose':_0x2152c3[_0x323d23(0x163)]}),_0x5ee70e=_0x3fbdbc[_0x323d23(0xeb)];let _0x3f5f79;!_0x5ee70e[_0x323d23(0x106)]?_0x3f5f79=_0x5ee70e[_0x323d23(0xdc)]?_0x323d23(0xd3):'running':_0x3f5f79=_0x5ee70e['success']?_0x323d23(0x110):_0x323d23(0xf1);let _0x35f4c7;if(_0x5ee70e[_0x323d23(0x159)]&&_0x5ee70e[_0x323d23(0x11f)]){const _0x563024=new Date(_0x5ee70e[_0x323d23(0x159)])[_0x323d23(0xfa)](),_0x3f5afa=new Date(_0x5ee70e[_0x323d23(0x11f)])[_0x323d23(0xfa)]();_0x35f4c7=Math[_0x323d23(0xe0)]((_0x3f5afa-_0x563024)/0x3e8);}const _0x1b436e={'attempt_id':_0x5ee70e['id'],'status':_0x3f5f79,..._0x5ee70e[_0x323d23(0xed)]!==undefined&&{'index':_0x5ee70e[_0x323d23(0xed)]},..._0x5ee70e['project']&&{'project':_0x5ee70e[_0x323d23(0x154)]['name']},..._0x5ee70e[_0x323d23(0x149)]&&{'workflow':_0x5ee70e[_0x323d23(0x149)][_0x323d23(0x131)]},..._0x5ee70e[_0x323d23(0x10b)]&&{'session_id':_0x5ee70e['sessionId']},..._0x5ee70e['sessionTime']&&{'session_time':_0x5ee70e[_0x323d23(0x171)]},..._0x5ee70e['retryAttemptName']&&{'retry_attempt':_0x5ee70e[_0x323d23(0xe8)]},..._0x35f4c7!==undefined&&{'duration_sec':_0x35f4c7},..._0x5ee70e[_0x323d23(0x159)]&&{'created_at':_0x5ee70e[_0x323d23(0x159)]},..._0x5ee70e['finishedAt']&&{'finished_at':_0x5ee70e['finishedAt']},...Object[_0x323d23(0x134)](_0x5ee70e['params'])[_0x323d23(0x12a)]>0x0&&{'params':_0x5ee70e[_0x323d23(0xec)]}};return await handleSingleObjectOutput(_0x1b436e,_0x2152c3),0x0;}catch(_0x3b8505){if(_0x3b8505 instanceof SDKError)return console[_0x323d23(0xf1)]('Error:\x20'+_0x3b8505[_0x323d23(0x14a)]),_0x3b8505['cause']&&console[_0x323d23(0xf1)](_0x323d23(0x114)+_0x3b8505[_0x323d23(0x14e)]),0x1;throw _0x3b8505;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a43_0x26092c(0x148);[a43_0x26092c(0xe6)]=a43_0x26092c(0x15b);async['execute'](_0x2e0ab2){const _0x36736d=a43_0x26092c,{options:_0x1ab2d1,args:_0x3b8c50,tdx:_0x121ace}=_0x2e0ab2,_0x3cf200=_0x3b8c50[0x0];if(!_0x3cf200)return console[_0x36736d(0xf1)](_0x36736d(0xe2)),0x1;try{const _0x4f473b=_0x1ab2d1['includeSubtasks'];_0x1ab2d1[_0x36736d(0x163)]&&(console[_0x36736d(0xf1)]('Attempt\x20ID:\x20'+_0x3cf200),_0x4f473b&&console['error']('Including\x20subtasks:\x20yes'));const _0x7d3a19=await withSpinner(_0x36736d(0x165),()=>_0x121ace['workflow']['tasks'](_0x3cf200,_0x4f473b||![]),{'verbose':_0x1ab2d1[_0x36736d(0x163)]}),_0x23562a=_0x7d3a19[_0x36736d(0xeb)];return console['error']('✔\x20Found\x20'+_0x23562a['length']+_0x36736d(0x11c)+(_0x23562a['length']!==0x1?'s':'')),await handleSDKOutput(_0x23562a,_0x1ab2d1),0x0;}catch(_0x442ded){if(_0x442ded instanceof SDKError)return console[_0x36736d(0xf1)](_0x36736d(0xf5)+_0x442ded[_0x36736d(0x14a)]),_0x442ded['cause']&&console['error'](_0x36736d(0x114)+_0x442ded[_0x36736d(0x14e)]),0x1;throw _0x442ded;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a43_0x26092c(0x118);[a43_0x26092c(0xe6)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a43_0x26092c(0xf6)](_0x4a0c85){const _0x2ad9da=a43_0x26092c,{options:_0x310eb8,args:_0x2180a3,tdx:_0x38c6ce}=_0x4a0c85,_0x3aab5a=_0x2180a3[0x0];let _0x80004=_0x2180a3[0x1];if(!_0x3aab5a)return console['error']('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x310eb8[_0x2ad9da(0x163)]&&(console['error'](_0x2ad9da(0x150)+_0x3aab5a),_0x80004&&console['error'](_0x2ad9da(0x112)+_0x80004));const _0x39d914=await withSpinner(_0x2ad9da(0x16d),()=>_0x38c6ce[_0x2ad9da(0x149)]['logFiles'](_0x3aab5a,_0x80004),{'verbose':_0x310eb8['verbose']}),_0x13fc51=_0x39d914[_0x2ad9da(0xeb)];if(_0x13fc51['length']===0x0)return console[_0x2ad9da(0xf1)]('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x80004&&(_0x310eb8['json']||_0x310eb8[_0x2ad9da(0x16e)]))return await handleSDKOutput(_0x13fc51,_0x310eb8),0x0;if(!_0x80004){const _0x383430=_0x13fc51[_0x2ad9da(0xf8)](_0xb611a9=>({'title':_0xb611a9['taskName']+'\x20('+formatBytes(_0xb611a9[_0x2ad9da(0x119)])+')','value':_0xb611a9[_0x2ad9da(0x12f)]})),_0x22fa1c=await a43_0x140319({'type':_0x2ad9da(0x125),'name':_0x2ad9da(0x138),'message':_0x2ad9da(0x147),'choices':_0x383430});if(!_0x22fa1c[_0x2ad9da(0x138)])return console[_0x2ad9da(0xf1)](_0x2ad9da(0x121)),0x0;_0x80004=_0x22fa1c['task'];}const _0x5eb5e4=await withSpinner('Downloading\x20logs...',()=>_0x38c6ce[_0x2ad9da(0x149)][_0x2ad9da(0x136)](_0x3aab5a,_0x80004),{'verbose':_0x310eb8['verbose']}),_0x2c1fd1=_0x5eb5e4['data'];return _0x2c1fd1?console['log'](_0x2c1fd1):console[_0x2ad9da(0xf1)](_0x2ad9da(0x14f)),0x0;}catch(_0x3c8444){if(_0x3c8444 instanceof SDKError)return console[_0x2ad9da(0xf1)]('Error:\x20'+_0x3c8444['message']),_0x3c8444['cause']&&console[_0x2ad9da(0xf1)](_0x2ad9da(0x114)+_0x3c8444['cause']),0x1;throw _0x3c8444;}}}function a43_0x6a1d(){const _0x2380cb=['message','isDirectory','Expected\x20format:\x20--param\x20key=value','\x20session','cause','No\x20log\x20content\x20found','Attempt\x20ID:\x20','\x20\x20Project:\x20','10006832mOIOBB','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','project','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','workflow:attempt','1061845dtgSft','download','createdAt','attempt','Show\x20tasks\x20for\x20an\x20attempt','Resume\x20from:\x20','List\x20workflows','Session\x20time:\x20','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','readFile','\x20\x20Files\x20extracted:\x20','Output\x20directory:\x20','verbose','List\x20workflow\x20attempts','Getting\x20attempt\x20tasks...','✔\x20Retry\x20started','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','startsWith','1130034obFSgq','✔\x20Workflow\x20run\x20started','workflow:kill','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Fetching\x20log\x20files...','format','Params:\x20','✔\x20Deleted\x20project\x20','sessionTime','Pushing\x20workflow\x20project...','attempts','canceling','\x20workflow','Usage:\x20workflow:delete\x20<project-name-or-id>','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Retrying\x20attempt...','Reason:\x20','isArray','cancelRequested','\x20\x20Project\x20ID:\x20','Project\x20directory:\x20','Error:\x20Workflow\x20identifier\x20is\x20required','round','includeRetried','Error:\x20Attempt\x20ID\x20is\x20required','Listing\x20workflow\x20sessions...','1OqTedT','workflow:projects','description','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','retryAttemptName','session','16kxJPvY','data','params','index','944328UBlkNV','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','kill','error','Filter:\x20project=','Retry\x20a\x20session\x20or\x20attempt','status','Error:\x20','execute','✔\x20Found\x20','map','param','getTime','workflow:sessions','Force:\x20yes','split','\x20\x20Revision:\x20','List\x20workflow\x20execution\x20sessions','\x20\x20Session\x20ID:\x20','...','Pattern:\x20','Validation:\x20skipped','Downloading\x20project\x20','Project\x20filter:\x20','done','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Project\x20name:\x20','revision','workflow:run','sessionId','stat','Listing\x20workflow\x20attempts...','Listing\x20workflow\x20projects...','\x20\x20Location:\x20','success','limit','Task\x20name:\x20','delete','\x20\x20Cause:\x20','\x20attempt','skipValidation','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','workflow:logs','fileSize','projectId','Retrying\x20session...','\x20task','\x20\x20New\x20attempt\x20ID:\x20','yes','finishedAt','\x22?\x20This\x20cannot\x20be\x20undone.','Cancelled','\x20project','workflow:workflows','filesExtracted','select','parse','Deleting\x20project\x20','retryAttempt','workflow:download','length','Show\x20specific\x20attempt\x20details','\x20\x20Workflow:\x20','Revision:\x20','Error:\x20Project\x20name\x20is\x20required','taskName','Listing\x20workflows...','name','Killing\x20attempt...','20qJBvTT','keys','sessions','logs','fromTask','task','Project:\x20','Error:\x20Invalid\x20parameter\x20format:\x20','projects','1517892hoRglX','substring','workflow:delete','✔\x20Pushed\x20','Target:\x20','16LMezph','569626lEcQNu','1497591ITCzvQ','Workflow:\x20','workflow:attempts','projectName','Select\x20a\x20task\x20to\x20view\x20logs:','workflow:tasks','workflow'];a43_0x6a1d=function(){return _0x2380cb;};return a43_0x6a1d();}export class WorkflowKillCommand extends BaseCommand{['name']=a43_0x26092c(0x16b);['description']='Kill\x20a\x20running\x20attempt';async['execute'](_0x4ba037){const _0x3096fe=a43_0x26092c,{options:_0x48e5f0,args:_0x271acb,tdx:_0x13ea0d}=_0x4ba037,_0x5db049=_0x271acb[0x0];if(!_0x5db049)return console[_0x3096fe(0xf1)](_0x3096fe(0xe2)),0x1;try{const _0x4bf268=_0x48e5f0['reason'];_0x48e5f0['verbose']&&(console[_0x3096fe(0xf1)]('Attempt\x20ID:\x20'+_0x5db049),_0x4bf268&&console[_0x3096fe(0xf1)](_0x3096fe(0xda)+_0x4bf268));if(!_0x48e5f0[_0x3096fe(0x11e)]){const _0x3e9fa4=await confirm(_0x3096fe(0xe7)+_0x5db049+'?');if(!_0x3e9fa4)return console[_0x3096fe(0xf1)](_0x3096fe(0x121)),0x0;}const _0x4377eb=await withSpinner(_0x3096fe(0x132),()=>_0x13ea0d['workflow'][_0x3096fe(0xf0)](_0x5db049,_0x4bf268),{'verbose':_0x48e5f0[_0x3096fe(0x163)]}),_0x3a2942=_0x4377eb[_0x3096fe(0xeb)];return console[_0x3096fe(0xf1)]('✔\x20'+_0x3a2942),0x0;}catch(_0x540f09){if(_0x540f09 instanceof SDKError)return console[_0x3096fe(0xf1)](_0x3096fe(0xf5)+_0x540f09['message']),_0x540f09[_0x3096fe(0x14e)]&&console[_0x3096fe(0xf1)](_0x3096fe(0x114)+_0x540f09[_0x3096fe(0x14e)]),0x1;throw _0x540f09;}}}export class WorkflowRetryCommand extends BaseCommand{[a43_0x26092c(0x131)]='workflow:retry';[a43_0x26092c(0xe6)]=a43_0x26092c(0xf3);async['execute'](_0x5a8ded){const _0x3cbf41=a43_0x26092c,{options:_0x5ed9c2,args:_0x107442,tdx:_0x2b4a20}=_0x5a8ded,_0x220916=_0x107442[0x0];if(!_0x220916)return console[_0x3cbf41(0xf1)](_0x3cbf41(0x167)),console[_0x3cbf41(0xf1)](_0x3cbf41(0xd6)),0x1;let _0x3b9fc5=![],_0x24e073=_0x220916;if(_0x220916[_0x3cbf41(0x168)]('session:'))_0x3b9fc5=!![],_0x24e073=_0x220916[_0x3cbf41(0x13d)](0x8);else{if(_0x220916[_0x3cbf41(0x168)]('attempt:'))_0x3b9fc5=![],_0x24e073=_0x220916[_0x3cbf41(0x13d)](0x8);else return console[_0x3cbf41(0xf1)](_0x3cbf41(0xd7)),console[_0x3cbf41(0xf1)](_0x3cbf41(0xd6)),0x1;}try{const _0x358078=_0x5ed9c2[_0x3cbf41(0x137)],_0x58f730=_0x5ed9c2['resumeFrom'],_0xdd35bd=_0x5ed9c2[_0x3cbf41(0xec)],_0x1aec14=_0x5ed9c2['force'];_0x5ed9c2['verbose']&&(console['error'](_0x3cbf41(0x140)+(_0x3b9fc5?_0x3cbf41(0xe9):_0x3cbf41(0x15a))+'\x20'+_0x24e073),_0x358078&&console[_0x3cbf41(0xf1)]('From\x20task:\x20'+_0x358078),_0x58f730&&console[_0x3cbf41(0xf1)](_0x3cbf41(0x15c)+_0x58f730),_0xdd35bd&&console[_0x3cbf41(0xf1)](_0x3cbf41(0x16f)+_0xdd35bd),_0x1aec14&&console[_0x3cbf41(0xf1)](_0x3cbf41(0xfc)));let _0xe46e14;if(_0xdd35bd)try{if(_0xdd35bd[_0x3cbf41(0x168)]('@')){const _0x27e5c5=await import('fs/promises'),_0x21c8fa=_0xdd35bd[_0x3cbf41(0x13d)](0x1),_0x518d31=await _0x27e5c5[_0x3cbf41(0x160)](_0x21c8fa,'utf-8');_0xe46e14=JSON[_0x3cbf41(0x126)](_0x518d31);}else _0xe46e14=JSON['parse'](_0xdd35bd);}catch{return console[_0x3cbf41(0xf1)]('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x5ed9c2[_0x3cbf41(0x11e)]){const _0x121e74=await confirm(_0x3cbf41(0xef)+(_0x3b9fc5?'session':_0x3cbf41(0x15a))+'\x20'+_0x24e073+'?');if(!_0x121e74)return console[_0x3cbf41(0xf1)](_0x3cbf41(0x121)),0x0;}let _0x45d103;_0x3b9fc5?_0x45d103=await withSpinner(_0x3cbf41(0x11b),()=>_0x2b4a20[_0x3cbf41(0x149)]['retrySession'](_0x24e073,{'fromTask':_0x358078,'retryParams':_0xe46e14}),{'verbose':_0x5ed9c2[_0x3cbf41(0x163)]}):_0x45d103=await withSpinner(_0x3cbf41(0xd9),()=>_0x2b4a20[_0x3cbf41(0x149)][_0x3cbf41(0x128)](_0x24e073,{'resumeFrom':_0x58f730,'retryParams':_0xe46e14,'force':_0x1aec14}),{'verbose':_0x5ed9c2[_0x3cbf41(0x163)]});const _0x4226e8=_0x45d103[_0x3cbf41(0xeb)];return console['error'](_0x3cbf41(0x166)),console[_0x3cbf41(0xf1)](_0x3cbf41(0x11d)+_0x4226e8['attemptId']),console[_0x3cbf41(0xf1)](_0x3cbf41(0x100)+_0x4226e8[_0x3cbf41(0x10b)]),0x0;}catch(_0x197568){if(_0x197568 instanceof SDKError)return console[_0x3cbf41(0xf1)](_0x3cbf41(0xf5)+_0x197568[_0x3cbf41(0x14a)]),_0x197568[_0x3cbf41(0x14e)]&&console['error'](_0x3cbf41(0x114)+_0x197568[_0x3cbf41(0x14e)]),0x1;throw _0x197568;}}}export class WorkflowRunCommand extends BaseCommand{['name']=a43_0x26092c(0x10a);[a43_0x26092c(0xe6)]='Start\x20a\x20workflow\x20run';async[a43_0x26092c(0xf6)](_0x612b8c){const _0x233d34=a43_0x26092c,{options:_0x204382,args:_0x5c3a38,tdx:_0x42f6dd}=_0x612b8c,_0x162c1b=_0x5c3a38[0x0];if(!_0x162c1b)return console[_0x233d34(0xf1)](_0x233d34(0xdf)),console[_0x233d34(0xf1)](_0x233d34(0x15f)),0x1;const _0x5838c4=_0x204382[_0x233d34(0xf9)],_0x8c1de2=_0x204382[_0x233d34(0x171)],_0x1a692a={};if(_0x5838c4&&Array[_0x233d34(0xdb)](_0x5838c4))for(const _0x1d285c of _0x5838c4){const _0x18aaf9=_0x1d285c['indexOf']('=');if(_0x18aaf9===-0x1)return console[_0x233d34(0xf1)](_0x233d34(0x13a)+_0x1d285c),console['error'](_0x233d34(0x14c)),0x1;const _0x399616=_0x1d285c[_0x233d34(0x13d)](0x0,_0x18aaf9),_0xaa056b=_0x1d285c[_0x233d34(0x13d)](_0x18aaf9+0x1);try{_0x1a692a[_0x399616]=JSON[_0x233d34(0x126)](_0xaa056b);}catch{_0x1a692a[_0x399616]=_0xaa056b;}}_0x204382['verbose']&&(console[_0x233d34(0xf1)](_0x233d34(0x144)+_0x162c1b),Object[_0x233d34(0x134)](_0x1a692a)[_0x233d34(0x12a)]>0x0&&console[_0x233d34(0xf1)]('Parameters:\x20'+JSON['stringify'](_0x1a692a)),_0x8c1de2&&console[_0x233d34(0xf1)](_0x233d34(0x15e)+_0x8c1de2));const _0x31c020=await withSpinner('Starting\x20workflow\x20run...',()=>_0x42f6dd[_0x233d34(0x149)]['run'](_0x162c1b,_0x1a692a,{'sessionTime':_0x8c1de2}),{'verbose':_0x204382[_0x233d34(0x163)]}),_0xda3f31=_0x31c020[_0x233d34(0xeb)];return console[_0x233d34(0xf1)](_0x233d34(0x16a)),console[_0x233d34(0xf1)]('\x20\x20Attempt\x20ID:\x20'+_0xda3f31['id']),console[_0x233d34(0xf1)](_0x233d34(0x100)+_0xda3f31[_0x233d34(0x10b)]),console['error'](_0x233d34(0x151)+_0xda3f31['project']?.[_0x233d34(0x131)]),console[_0x233d34(0xf1)](_0x233d34(0x12c)+_0xda3f31[_0x233d34(0x149)]?.[_0x233d34(0x131)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0x129);[a43_0x26092c(0xe6)]=a43_0x26092c(0x153);async[a43_0x26092c(0xf6)](_0x238baa){const _0x53d218=a43_0x26092c,{options:_0x5c11d5,args:_0x28ed91,tdx:_0x176e97}=_0x238baa,_0x25fa9c=_0x28ed91[0x0],_0x529dc2=_0x28ed91[0x1]||'.';if(!_0x25fa9c)return console['error'](_0x53d218(0x12e)),console[_0x53d218(0xf1)](_0x53d218(0x107)),0x1;const _0x88aa6f=_0x5c11d5[_0x53d218(0x109)];_0x5c11d5[_0x53d218(0x163)]&&(console[_0x53d218(0xf1)](_0x53d218(0x139)+_0x25fa9c),console[_0x53d218(0xf1)](_0x53d218(0x162)+_0x529dc2),_0x88aa6f&&console[_0x53d218(0xf1)](_0x53d218(0x12d)+_0x88aa6f));const _0x1580e4=await withSpinner(_0x53d218(0x104)+_0x25fa9c+_0x53d218(0x101),()=>_0x176e97[_0x53d218(0x149)][_0x53d218(0x158)](_0x25fa9c,_0x529dc2,{'revision':_0x88aa6f}),{'verbose':_0x5c11d5[_0x53d218(0x163)]}),_0x59d734=_0x1580e4[_0x53d218(0xeb)];return console[_0x53d218(0xf1)]('✔\x20Downloaded\x20'+_0x59d734[_0x53d218(0x146)]),console[_0x53d218(0xf1)](_0x53d218(0xfe)+_0x59d734[_0x53d218(0x109)]),console[_0x53d218(0xf1)](_0x53d218(0x161)+_0x59d734[_0x53d218(0x124)]),console['error'](_0x53d218(0x10f)+_0x529dc2+'/'+_0x59d734[_0x53d218(0x146)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a43_0x26092c(0x131)]='workflow:push';[a43_0x26092c(0xe6)]=a43_0x26092c(0x16c);async[a43_0x26092c(0xf6)](_0x54dad8){const _0x2628e8=a43_0x26092c,{options:_0x2fa658,args:_0x228e0e,tdx:_0x5ab6fe}=_0x54dad8;let _0x30d8e9='.',_0x44820a=_0x2fa658[_0x2628e8(0x131)];if(_0x228e0e[0x0]){const {promises:_0x2c526f}=await import('fs');try{const _0x469d4b=await _0x2c526f[_0x2628e8(0x10c)](_0x228e0e[0x0]);if(_0x469d4b[_0x2628e8(0x14b)]())_0x30d8e9=_0x228e0e[0x0];else return console[_0x2628e8(0xf1)](_0x2628e8(0xf5)+_0x228e0e[0x0]+'\x20is\x20not\x20a\x20directory'),0x1;}catch{_0x44820a=_0x228e0e[0x0],_0x30d8e9='.';}}const _0x341601=_0x2fa658['revision'],_0x2afda6=_0x2fa658[_0x2628e8(0x116)];_0x2fa658[_0x2628e8(0x163)]&&(console['error'](_0x2628e8(0xde)+_0x30d8e9),_0x44820a&&console[_0x2628e8(0xf1)](_0x2628e8(0x108)+_0x44820a),_0x341601&&console[_0x2628e8(0xf1)](_0x2628e8(0x12d)+_0x341601),_0x2afda6&&console[_0x2628e8(0xf1)](_0x2628e8(0x103)));const _0x142270=await withSpinner(_0x2628e8(0x172),()=>_0x5ab6fe[_0x2628e8(0x149)]['push'](_0x30d8e9,{'projectName':_0x44820a,'revision':_0x341601,'skipValidation':_0x2afda6}),{'verbose':_0x2fa658[_0x2628e8(0x163)]}),_0x15b200=_0x142270[_0x2628e8(0xeb)];return console[_0x2628e8(0xf1)](_0x2628e8(0x13f)+_0x15b200['projectName']),console['error'](_0x2628e8(0xdd)+_0x15b200[_0x2628e8(0x11a)]),console[_0x2628e8(0xf1)](_0x2628e8(0xfe)+_0x15b200['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a43_0x26092c(0x13e);[a43_0x26092c(0xe6)]=a43_0x26092c(0x155);async[a43_0x26092c(0xf6)](_0x598ec3){const _0x14d99d=a43_0x26092c,{options:_0x11431d,args:_0x4968da,tdx:_0x2dbce2}=_0x598ec3,_0xce6355=_0x4968da[0x0];if(!_0xce6355)return console[_0x14d99d(0xf1)]('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x14d99d(0xd5)),0x1;_0x11431d[_0x14d99d(0x163)]&&console[_0x14d99d(0xf1)](_0x14d99d(0x139)+_0xce6355);if(!_0x11431d[_0x14d99d(0x11e)]){const _0x4f04bf=await confirm(_0x14d99d(0xd8)+_0xce6355+_0x14d99d(0x120));if(!_0x4f04bf)return console[_0x14d99d(0xf1)](_0x14d99d(0x121)),0x0;}const _0x4ff4c1=await withSpinner(_0x14d99d(0x127)+_0xce6355+_0x14d99d(0x101),()=>_0x2dbce2[_0x14d99d(0x149)][_0x14d99d(0x113)](_0xce6355),{'verbose':_0x11431d[_0x14d99d(0x163)]}),_0xbf1e02=_0x4ff4c1['data'];return console['error'](_0x14d99d(0x170)+_0xbf1e02[_0x14d99d(0x146)]),console[_0x14d99d(0xf1)](_0x14d99d(0xdd)+_0xbf1e02[_0x14d99d(0x11a)]),0x0;}}
1
+ const a43_0x5759ce=a43_0x54fe;(function(_0x31542d,_0x23bbe7){const _0x5c72d9=a43_0x54fe,_0x5600da=_0x31542d();while(!![]){try{const _0x4156ae=-parseInt(_0x5c72d9(0x19f))/0x1+parseInt(_0x5c72d9(0x16f))/0x2*(parseInt(_0x5c72d9(0x160))/0x3)+-parseInt(_0x5c72d9(0x17d))/0x4+-parseInt(_0x5c72d9(0x149))/0x5+-parseInt(_0x5c72d9(0x1b8))/0x6+parseInt(_0x5c72d9(0x190))/0x7+-parseInt(_0x5c72d9(0x1cc))/0x8*(-parseInt(_0x5c72d9(0x193))/0x9);if(_0x4156ae===_0x23bbe7)break;else _0x5600da['push'](_0x5600da['shift']());}catch(_0x16bcc4){_0x5600da['push'](_0x5600da['shift']());}}}(a43_0x2a3e,0x66fc1));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a43_0x5d36d4 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x1af);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x187);async['execute'](_0x4fcdbf){const _0x49b9ac=a43_0x5759ce,{options:_0x237c22,args:_0x45a166,tdx:_0x1d745e}=_0x4fcdbf,_0x3494df=_0x45a166[0x0];try{_0x237c22[_0x49b9ac(0x1db)]&&_0x3494df&&console['error']('Pattern:\x20'+_0x3494df);const _0x30a304=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x1d745e['workflow'][_0x49b9ac(0x1c8)](_0x3494df,{'limit':_0x237c22['limit']}),{'verbose':_0x237c22[_0x49b9ac(0x1db)]}),_0x1dc60c=_0x30a304[_0x49b9ac(0x1cb)];return console[_0x49b9ac(0x1a6)]('✔\x20Found\x20'+_0x1dc60c[_0x49b9ac(0x179)]+_0x49b9ac(0x175)+(_0x1dc60c[_0x49b9ac(0x179)]!==0x1?'s':'')),await handleSDKOutput(_0x1dc60c,_0x237c22),0x0;}catch(_0x1015b1){if(_0x1015b1 instanceof SDKError)return console[_0x49b9ac(0x1a6)](_0x49b9ac(0x1a9)+_0x1015b1[_0x49b9ac(0x17f)]),_0x1015b1[_0x49b9ac(0x184)]&&console[_0x49b9ac(0x1a6)](_0x49b9ac(0x168)+_0x1015b1['cause']),0x1;throw _0x1015b1;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x19e);[a43_0x5759ce(0x1ab)]='List\x20workflows';async[a43_0x5759ce(0x14d)](_0x274e2d){const _0x4e90a1=a43_0x5759ce,{options:_0x4c1e87,args:_0x54c618,tdx:_0x4c20f5}=_0x274e2d,_0x53f30f=_0x54c618[0x0];try{_0x4c1e87[_0x4e90a1(0x1db)]&&_0x53f30f&&console['error'](_0x4e90a1(0x1be)+_0x53f30f);const _0x1baa7a=await withSpinner(_0x4e90a1(0x1c3),()=>_0x4c20f5['workflow']['workflows'](_0x53f30f,{'limit':_0x4c1e87['limit']}),{'verbose':_0x4c1e87['verbose']}),_0x3cf3f1=_0x1baa7a[_0x4e90a1(0x1cb)];return console[_0x4e90a1(0x1a6)](_0x4e90a1(0x1d2)+_0x3cf3f1[_0x4e90a1(0x179)]+_0x4e90a1(0x1a4)+(_0x3cf3f1[_0x4e90a1(0x179)]!==0x1?'s':'')),await handleSDKOutput(_0x3cf3f1,_0x4c1e87),0x0;}catch(_0x4c790a){if(_0x4c790a instanceof SDKError)return console[_0x4e90a1(0x1a6)](_0x4e90a1(0x1a9)+_0x4c790a[_0x4e90a1(0x17f)]),_0x4c790a[_0x4e90a1(0x184)]&&console['error']('\x20\x20Cause:\x20'+_0x4c790a[_0x4e90a1(0x184)]),0x1;throw _0x4c790a;}}}export class WorkflowSessionsCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]='workflow:sessions';['description']='List\x20workflow\x20execution\x20sessions';async[a43_0x5759ce(0x14d)](_0x489340){const _0x328d88=a43_0x5759ce,{options:_0x33ed87,args:_0x1bbe36,tdx:_0x2f100e}=_0x489340;let _0xdedd27,_0x53ee91;if(_0x1bbe36[0x0]){const _0x1eed44=_0x1bbe36[0x0][_0x328d88(0x1b2)]('.');if(_0x1eed44[_0x328d88(0x179)]===0x1)_0xdedd27=_0x1eed44[0x0];else{if(_0x1eed44['length']===0x2)[_0xdedd27,_0x53ee91]=_0x1eed44;else return console[_0x328d88(0x1a6)](_0x328d88(0x173)),0x1;}}try{if(_0x33ed87[_0x328d88(0x1db)]){if(_0xdedd27&&_0x53ee91)console[_0x328d88(0x1a6)](_0x328d88(0x15c)+_0xdedd27+'.'+_0x53ee91);else _0xdedd27&&console['error'](_0x328d88(0x170)+_0xdedd27);const _0x4fc865=_0x33ed87['status'];_0x4fc865&&console[_0x328d88(0x1a6)]('Status:\x20'+_0x4fc865);}const _0x125bb4=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x2f100e[_0x328d88(0x178)][_0x328d88(0x150)]({'projectName':_0xdedd27,'workflowName':_0x53ee91,'status':_0x33ed87[_0x328d88(0x1c7)],'fromTime':_0x33ed87[_0x328d88(0x1ad)],'toTime':_0x33ed87['to'],'limit':_0x33ed87[_0x328d88(0x1b7)]}),{'verbose':_0x33ed87[_0x328d88(0x1db)]}),_0x4a718b=_0x125bb4[_0x328d88(0x1cb)];return console[_0x328d88(0x1a6)](_0x328d88(0x1d2)+_0x4a718b[_0x328d88(0x179)]+'\x20session'+(_0x4a718b[_0x328d88(0x179)]!==0x1?'s':'')),await handleSDKOutput(_0x4a718b,_0x33ed87),0x0;}catch(_0x5d4021){if(_0x5d4021 instanceof SDKError)return console[_0x328d88(0x1a6)]('Error:\x20'+_0x5d4021[_0x328d88(0x17f)]),_0x5d4021[_0x328d88(0x184)]&&console[_0x328d88(0x1a6)](_0x328d88(0x168)+_0x5d4021[_0x328d88(0x184)]),0x1;throw _0x5d4021;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a43_0x5759ce(0x164);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x1b9);async[a43_0x5759ce(0x14d)](_0x5ec42b){const _0x2fb267=a43_0x5759ce,{options:_0x47e97e,args:_0x10ce82,tdx:_0x46ddd9}=_0x5ec42b;let _0x590969,_0x3d5d8b;if(_0x10ce82[0x0]){const _0x26b0fc=_0x10ce82[0x0][_0x2fb267(0x1b2)]('.');if(_0x26b0fc['length']===0x1)_0x590969=_0x26b0fc[0x0];else{if(_0x26b0fc[_0x2fb267(0x179)]===0x2)[_0x590969,_0x3d5d8b]=_0x26b0fc;else return console[_0x2fb267(0x1a6)](_0x2fb267(0x173)),0x1;}}try{const _0x2ce844=_0x47e97e[_0x2fb267(0x1b6)];if(_0x47e97e['verbose']){if(_0x590969&&_0x3d5d8b)console[_0x2fb267(0x1a6)]('Filter:\x20'+_0x590969+'.'+_0x3d5d8b);else _0x590969&&console[_0x2fb267(0x1a6)](_0x2fb267(0x170)+_0x590969);_0x2ce844&&console[_0x2fb267(0x1a6)](_0x2fb267(0x1d1));}const _0x25c689=await withSpinner(_0x2fb267(0x13f),()=>_0x46ddd9['workflow']['attempts']({'projectName':_0x590969,'workflowName':_0x3d5d8b,'includeRetried':_0x2ce844,'limit':_0x47e97e['limit']}),{'verbose':_0x47e97e[_0x2fb267(0x1db)]}),_0x2d8e88=_0x25c689[_0x2fb267(0x1cb)];return console[_0x2fb267(0x1a6)](_0x2fb267(0x1d2)+_0x2d8e88['length']+_0x2fb267(0x1a5)+(_0x2d8e88['length']!==0x1?'s':'')),await handleSDKOutput(_0x2d8e88,_0x47e97e),0x0;}catch(_0x1370fb){if(_0x1370fb instanceof SDKError)return console[_0x2fb267(0x1a6)]('Error:\x20'+_0x1370fb[_0x2fb267(0x17f)]),_0x1370fb[_0x2fb267(0x184)]&&console[_0x2fb267(0x1a6)]('\x20\x20Cause:\x20'+_0x1370fb[_0x2fb267(0x184)]),0x1;throw _0x1370fb;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]='workflow:attempt';[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x152);async[a43_0x5759ce(0x14d)](_0x342b51){const _0x46ac1b=a43_0x5759ce,{options:_0x45208e,args:_0x527af7,tdx:_0x3ba499}=_0x342b51,_0x112b04=_0x527af7[0x0];if(!_0x112b04)return console['error'](_0x46ac1b(0x1b4)),0x1;try{_0x45208e[_0x46ac1b(0x1db)]&&console[_0x46ac1b(0x1a6)](_0x46ac1b(0x153)+_0x112b04);const _0x4e37f7=await withSpinner(_0x46ac1b(0x183),()=>_0x3ba499[_0x46ac1b(0x178)][_0x46ac1b(0x1a2)](_0x112b04),{'verbose':_0x45208e[_0x46ac1b(0x1db)]}),_0xfe7828=_0x4e37f7['data'];let _0x2ac0a4;!_0xfe7828[_0x46ac1b(0x1da)]?_0x2ac0a4=_0xfe7828[_0x46ac1b(0x1d6)]?_0x46ac1b(0x158):_0x46ac1b(0x165):_0x2ac0a4=_0xfe7828[_0x46ac1b(0x16c)]?_0x46ac1b(0x16c):_0x46ac1b(0x1a6);let _0x451cf4;if(_0xfe7828[_0x46ac1b(0x1bd)]&&_0xfe7828[_0x46ac1b(0x1c2)]){const _0x56c6c2=new Date(_0xfe7828[_0x46ac1b(0x1bd)])['getTime'](),_0x310b66=new Date(_0xfe7828[_0x46ac1b(0x1c2)])[_0x46ac1b(0x1c9)]();_0x451cf4=Math[_0x46ac1b(0x1c1)]((_0x310b66-_0x56c6c2)/0x3e8);}const _0x24abc4={'attempt_id':_0xfe7828['id'],'status':_0x2ac0a4,..._0xfe7828[_0x46ac1b(0x1c0)]!==undefined&&{'index':_0xfe7828['index']},..._0xfe7828[_0x46ac1b(0x191)]&&{'project':_0xfe7828[_0x46ac1b(0x191)]['name']},..._0xfe7828[_0x46ac1b(0x178)]&&{'workflow':_0xfe7828[_0x46ac1b(0x178)]['name']},..._0xfe7828[_0x46ac1b(0x1cf)]&&{'session_id':_0xfe7828[_0x46ac1b(0x1cf)]},..._0xfe7828[_0x46ac1b(0x199)]&&{'session_time':_0xfe7828[_0x46ac1b(0x199)]},..._0xfe7828[_0x46ac1b(0x15e)]&&{'retry_attempt':_0xfe7828['retryAttemptName']},..._0x451cf4!==undefined&&{'duration_sec':_0x451cf4},..._0xfe7828[_0x46ac1b(0x1bd)]&&{'created_at':_0xfe7828[_0x46ac1b(0x1bd)]},..._0xfe7828[_0x46ac1b(0x1c2)]&&{'finished_at':_0xfe7828[_0x46ac1b(0x1c2)]},...Object[_0x46ac1b(0x1c5)](_0xfe7828['params'])[_0x46ac1b(0x179)]>0x0&&{'params':_0xfe7828[_0x46ac1b(0x1e1)]}};return await handleSingleObjectOutput(_0x24abc4,_0x45208e),0x0;}catch(_0x204156){if(_0x204156 instanceof SDKError)return console[_0x46ac1b(0x1a6)](_0x46ac1b(0x1a9)+_0x204156[_0x46ac1b(0x17f)]),_0x204156[_0x46ac1b(0x184)]&&console[_0x46ac1b(0x1a6)](_0x46ac1b(0x168)+_0x204156[_0x46ac1b(0x184)]),0x1;throw _0x204156;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]='workflow:tasks';[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x19a);async['execute'](_0x477a20){const _0x3eae38=a43_0x5759ce,{options:_0x26d271,args:_0x4d0c6f,tdx:_0x1c10f6}=_0x477a20,_0x2f752d=_0x4d0c6f[0x0];if(!_0x2f752d)return console[_0x3eae38(0x1a6)](_0x3eae38(0x1b4)),0x1;try{const _0x225f10=_0x26d271[_0x3eae38(0x192)];_0x26d271[_0x3eae38(0x1db)]&&(console[_0x3eae38(0x1a6)](_0x3eae38(0x153)+_0x2f752d),_0x225f10&&console[_0x3eae38(0x1a6)]('Including\x20subtasks:\x20yes'));const _0x3c9d42=await withSpinner(_0x3eae38(0x17e),()=>_0x1c10f6['workflow'][_0x3eae38(0x185)](_0x2f752d,_0x225f10||![]),{'verbose':_0x26d271[_0x3eae38(0x1db)]}),_0x99f482=_0x3c9d42[_0x3eae38(0x1cb)];return console[_0x3eae38(0x1a6)](_0x3eae38(0x1d2)+_0x99f482['length']+_0x3eae38(0x1b0)+(_0x99f482[_0x3eae38(0x179)]!==0x1?'s':'')),await handleSDKOutput(_0x99f482,_0x26d271),0x0;}catch(_0x27331f){if(_0x27331f instanceof SDKError)return console[_0x3eae38(0x1a6)](_0x3eae38(0x1a9)+_0x27331f[_0x3eae38(0x17f)]),_0x27331f['cause']&&console[_0x3eae38(0x1a6)](_0x3eae38(0x168)+_0x27331f[_0x3eae38(0x184)]),0x1;throw _0x27331f;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a43_0x5759ce(0x19c);[a43_0x5759ce(0x1ab)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a43_0x5759ce(0x14d)](_0x535770){const _0x62d5e6=a43_0x5759ce,{options:_0x39e7ed,args:_0x25e685,tdx:_0x3bd9b2}=_0x535770,_0x12a159=_0x25e685[0x0];let _0x3d56c4=_0x25e685[0x1];if(!_0x12a159)return console[_0x62d5e6(0x1a6)](_0x62d5e6(0x1b4)),0x1;try{_0x39e7ed[_0x62d5e6(0x1db)]&&(console[_0x62d5e6(0x1a6)](_0x62d5e6(0x153)+_0x12a159),_0x3d56c4&&console[_0x62d5e6(0x1a6)](_0x62d5e6(0x1ca)+_0x3d56c4));const _0x523831=await withSpinner(_0x62d5e6(0x144),()=>_0x3bd9b2['workflow'][_0x62d5e6(0x180)](_0x12a159,_0x3d56c4),{'verbose':_0x39e7ed[_0x62d5e6(0x1db)]}),_0xc9ccbc=_0x523831[_0x62d5e6(0x1cb)];if(_0xc9ccbc[_0x62d5e6(0x179)]===0x0)return console['error']('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x3d56c4&&(_0x39e7ed[_0x62d5e6(0x140)]||_0x39e7ed[_0x62d5e6(0x189)]))return await handleSDKOutput(_0xc9ccbc,_0x39e7ed),0x0;if(!_0x3d56c4){const _0x488a14=_0xc9ccbc[_0x62d5e6(0x1d8)](_0x2a9b66=>({'title':_0x2a9b66[_0x62d5e6(0x15f)]+'\x20('+formatBytes(_0x2a9b66[_0x62d5e6(0x141)])+')','value':_0x2a9b66[_0x62d5e6(0x15f)]})),_0x12f68f=await a43_0x5d36d4({'type':_0x62d5e6(0x1aa),'name':_0x62d5e6(0x1cd),'message':_0x62d5e6(0x14c),'choices':_0x488a14});if(!_0x12f68f[_0x62d5e6(0x1cd)])return console['error'](_0x62d5e6(0x19b)),0x0;_0x3d56c4=_0x12f68f['task'];}const _0x6e91af=await withSpinner('Downloading\x20logs...',()=>_0x3bd9b2[_0x62d5e6(0x178)][_0x62d5e6(0x14e)](_0x12a159,_0x3d56c4),{'verbose':_0x39e7ed[_0x62d5e6(0x1db)]}),_0x83b3d3=_0x6e91af[_0x62d5e6(0x1cb)];return _0x83b3d3?console['log'](_0x83b3d3):console[_0x62d5e6(0x1a6)](_0x62d5e6(0x177)),0x0;}catch(_0x33429e){if(_0x33429e instanceof SDKError)return console['error']('Error:\x20'+_0x33429e['message']),_0x33429e['cause']&&console[_0x62d5e6(0x1a6)](_0x62d5e6(0x168)+_0x33429e['cause']),0x1;throw _0x33429e;}}}export class WorkflowKillCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x1d9);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x1a7);async[a43_0x5759ce(0x14d)](_0x1f559a){const _0x866bcd=a43_0x5759ce,{options:_0x29eceb,args:_0x24d592,tdx:_0x4e406c}=_0x1f559a,_0x5eaac1=_0x24d592[0x0];if(!_0x5eaac1)return console['error'](_0x866bcd(0x1b4)),0x1;try{const _0x243e84=_0x29eceb['reason'];_0x29eceb[_0x866bcd(0x1db)]&&(console[_0x866bcd(0x1a6)]('Attempt\x20ID:\x20'+_0x5eaac1),_0x243e84&&console[_0x866bcd(0x1a6)](_0x866bcd(0x1d7)+_0x243e84));if(!_0x29eceb[_0x866bcd(0x17b)]){const _0xedb1f=await confirm(_0x866bcd(0x18b)+_0x5eaac1+'?');if(!_0xedb1f)return console[_0x866bcd(0x1a6)](_0x866bcd(0x19b)),0x0;}const _0x5534a3=await withSpinner(_0x866bcd(0x1df),()=>_0x4e406c[_0x866bcd(0x178)][_0x866bcd(0x154)](_0x5eaac1,_0x243e84),{'verbose':_0x29eceb['verbose']}),_0x331ee5=_0x5534a3[_0x866bcd(0x1cb)];return console['error']('✔\x20'+_0x331ee5),0x0;}catch(_0x903343){if(_0x903343 instanceof SDKError)return console[_0x866bcd(0x1a6)](_0x866bcd(0x1a9)+_0x903343[_0x866bcd(0x17f)]),_0x903343[_0x866bcd(0x184)]&&console[_0x866bcd(0x1a6)]('\x20\x20Cause:\x20'+_0x903343[_0x866bcd(0x184)]),0x1;throw _0x903343;}}}function a43_0x54fe(_0x3327e1,_0x3187e9){_0x3327e1=_0x3327e1-0x13f;const _0x2a3e56=a43_0x2a3e();let _0x54fe70=_0x2a3e56[_0x3327e1];return _0x54fe70;}export class WorkflowRetryCommand extends BaseCommand{['name']=a43_0x5759ce(0x161);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x1a3);async[a43_0x5759ce(0x14d)](_0x1d0714){const _0x13aba4=a43_0x5759ce,{options:_0x359570,args:_0x2a76aa,tdx:_0x11a04f}=_0x1d0714,_0x5ce68e=_0x2a76aa[0x0];if(!_0x5ce68e)return console[_0x13aba4(0x1a6)](_0x13aba4(0x196)),console[_0x13aba4(0x1a6)](_0x13aba4(0x1a0)),0x1;let _0x1c3831=![],_0x2dc192=_0x5ce68e;if(_0x5ce68e[_0x13aba4(0x1e3)](_0x13aba4(0x188)))_0x1c3831=!![],_0x2dc192=_0x5ce68e[_0x13aba4(0x1a8)](0x8);else{if(_0x5ce68e[_0x13aba4(0x1e3)](_0x13aba4(0x15d)))_0x1c3831=![],_0x2dc192=_0x5ce68e[_0x13aba4(0x1a8)](0x8);else return console[_0x13aba4(0x1a6)](_0x13aba4(0x17c)),console['error'](_0x13aba4(0x1a0)),0x1;}try{const _0x1416dc=_0x359570[_0x13aba4(0x148)],_0x4d9e5a=_0x359570[_0x13aba4(0x15b)],_0x4b5d67=_0x359570[_0x13aba4(0x1e1)],_0x3a4be4=_0x359570[_0x13aba4(0x16d)];_0x359570[_0x13aba4(0x1db)]&&(console['error']('Target:\x20'+(_0x1c3831?_0x13aba4(0x18f):_0x13aba4(0x1a2))+'\x20'+_0x2dc192),_0x1416dc&&console[_0x13aba4(0x1a6)]('From\x20task:\x20'+_0x1416dc),_0x4d9e5a&&console[_0x13aba4(0x1a6)]('Resume\x20from:\x20'+_0x4d9e5a),_0x4b5d67&&console[_0x13aba4(0x1a6)](_0x13aba4(0x198)+_0x4b5d67),_0x3a4be4&&console['error'](_0x13aba4(0x16a)));let _0x4479fd;if(_0x4b5d67)try{if(_0x4b5d67[_0x13aba4(0x1e3)]('@')){const _0x2ffd4e=await import('fs/promises'),_0x43aa7f=_0x4b5d67[_0x13aba4(0x1a8)](0x1),_0x3bf86d=await _0x2ffd4e[_0x13aba4(0x147)](_0x43aa7f,_0x13aba4(0x159));_0x4479fd=JSON[_0x13aba4(0x151)](_0x3bf86d);}else _0x4479fd=JSON[_0x13aba4(0x151)](_0x4b5d67);}catch{return console[_0x13aba4(0x1a6)](_0x13aba4(0x174)),0x1;}if(!_0x359570[_0x13aba4(0x17b)]){const _0x385517=await confirm(_0x13aba4(0x1bf)+(_0x1c3831?_0x13aba4(0x18f):_0x13aba4(0x1a2))+'\x20'+_0x2dc192+'?');if(!_0x385517)return console[_0x13aba4(0x1a6)]('Cancelled'),0x0;}let _0x556ea3;_0x1c3831?_0x556ea3=await withSpinner('Retrying\x20session...',()=>_0x11a04f[_0x13aba4(0x178)][_0x13aba4(0x17a)](_0x2dc192,{'fromTask':_0x1416dc,'retryParams':_0x4479fd}),{'verbose':_0x359570['verbose']}):_0x556ea3=await withSpinner('Retrying\x20attempt...',()=>_0x11a04f[_0x13aba4(0x178)][_0x13aba4(0x1ba)](_0x2dc192,{'resumeFrom':_0x4d9e5a,'retryParams':_0x4479fd,'force':_0x3a4be4}),{'verbose':_0x359570[_0x13aba4(0x1db)]});const _0x4136c9=_0x556ea3[_0x13aba4(0x1cb)];return console['error'](_0x13aba4(0x1ae)),console[_0x13aba4(0x1a6)](_0x13aba4(0x162)+_0x4136c9[_0x13aba4(0x1bc)]),console[_0x13aba4(0x1a6)](_0x13aba4(0x1c6)+_0x4136c9[_0x13aba4(0x1cf)]),0x0;}catch(_0x52f6a0){if(_0x52f6a0 instanceof SDKError)return console['error'](_0x13aba4(0x1a9)+_0x52f6a0[_0x13aba4(0x17f)]),_0x52f6a0[_0x13aba4(0x184)]&&console[_0x13aba4(0x1a6)](_0x13aba4(0x168)+_0x52f6a0[_0x13aba4(0x184)]),0x1;throw _0x52f6a0;}}}function a43_0x2a3e(){const _0x36a9f3=['No\x20log\x20content\x20found','workflow','length','retrySession','yes','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','3234064BuHIiy','Getting\x20attempt\x20tasks...','message','logFiles','Error:\x20Invalid\x20parameter\x20format:\x20','\x20\x20Revision:\x20','Getting\x20attempt\x20details...','cause','tasks','✔\x20Downloaded\x20','List\x20all\x20workflow\x20projects','session:','format','param','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','workflow:push','\x20\x20Workflow:\x20','projectName','session','4204382YiYrAQ','project','includeSubtasks','9TOtZWk','Workflow:\x20','run','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','✔\x20Pushed\x20','Params:\x20','sessionTime','Show\x20tasks\x20for\x20an\x20attempt','Cancelled','workflow:logs','Revision:\x20','workflow:workflows','613258WHMOny','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','\x20\x20Location:\x20','attempt','Retry\x20a\x20session\x20or\x20attempt','\x20workflow','\x20attempt','error','Kill\x20a\x20running\x20attempt','substring','Error:\x20','select','description','Start\x20a\x20workflow\x20run','from','✔\x20Retry\x20started','workflow:projects','\x20task','projectId','split','\x22?\x20This\x20cannot\x20be\x20undone.','Error:\x20Attempt\x20ID\x20is\x20required','workflow:run','includeRetried','limit','4359420QrrSDm','List\x20workflow\x20attempts','retryAttempt','\x20\x20Project\x20ID:\x20','attemptId','createdAt','Project\x20filter:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','index','round','finishedAt','Listing\x20workflows...','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','keys','\x20\x20Session\x20ID:\x20','status','projects','getTime','Task\x20name:\x20','data','14586344kMWliM','task','name','sessionId','download','Include\x20retried:\x20yes','✔\x20Found\x20','stat','\x20\x20Files\x20extracted:\x20','filesExtracted','cancelRequested','Reason:\x20','map','workflow:kill','done','verbose','Parameters:\x20','revision','\x20\x20Project:\x20','Killing\x20attempt...','isDirectory','params','Output\x20directory:\x20','startsWith','Listing\x20workflow\x20attempts...','json','fileSize','Downloading\x20project\x20','\x20is\x20not\x20a\x20directory','Fetching\x20log\x20files...','indexOf','workflow:delete','readFile','fromTask','2316855GFObgp','Deleting\x20project\x20','Project\x20directory:\x20','Select\x20a\x20task\x20to\x20view\x20logs:','execute','logs','Error:\x20Workflow\x20identifier\x20is\x20required','sessions','parse','Show\x20specific\x20attempt\x20details','Attempt\x20ID:\x20','kill','Validation:\x20skipped','✔\x20Workflow\x20run\x20started','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','canceling','utf-8','workflow:download','resumeFrom','Filter:\x20','attempt:','retryAttemptName','taskName','1828863EIouVl','workflow:retry','\x20\x20New\x20attempt\x20ID:\x20','Expected\x20format:\x20--param\x20key=value','workflow:attempts','running','...','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','\x20\x20Cause:\x20','delete','Force:\x20yes','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','success','force','skipValidation','2eBmSHm','Filter:\x20project=','✔\x20Deleted\x20project\x20','Session\x20time:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20project','Error:\x20Project\x20name\x20is\x20required'];a43_0x2a3e=function(){return _0x36a9f3;};return a43_0x2a3e();}export class WorkflowRunCommand extends BaseCommand{['name']=a43_0x5759ce(0x1b5);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x1ac);async[a43_0x5759ce(0x14d)](_0x5e468c){const _0x492439=a43_0x5759ce,{options:_0x4e78f0,args:_0x3fb2f4,tdx:_0x3cd2c4}=_0x5e468c,_0x3ffe86=_0x3fb2f4[0x0];if(!_0x3ffe86)return console[_0x492439(0x1a6)](_0x492439(0x14f)),console[_0x492439(0x1a6)](_0x492439(0x16b)),0x1;const _0x17aaea=_0x4e78f0[_0x492439(0x18a)],_0x33d165=_0x4e78f0[_0x492439(0x199)],_0x3206d8={};if(_0x17aaea&&Array['isArray'](_0x17aaea))for(const _0x4a35c7 of _0x17aaea){const _0x276231=_0x4a35c7[_0x492439(0x145)]('=');if(_0x276231===-0x1)return console[_0x492439(0x1a6)](_0x492439(0x181)+_0x4a35c7),console[_0x492439(0x1a6)](_0x492439(0x163)),0x1;const _0x157d22=_0x4a35c7['substring'](0x0,_0x276231),_0x326b30=_0x4a35c7['substring'](_0x276231+0x1);try{_0x3206d8[_0x157d22]=JSON[_0x492439(0x151)](_0x326b30);}catch{_0x3206d8[_0x157d22]=_0x326b30;}}_0x4e78f0['verbose']&&(console[_0x492439(0x1a6)](_0x492439(0x194)+_0x3ffe86),Object[_0x492439(0x1c5)](_0x3206d8)[_0x492439(0x179)]>0x0&&console[_0x492439(0x1a6)](_0x492439(0x1dc)+JSON['stringify'](_0x3206d8)),_0x33d165&&console['error'](_0x492439(0x172)+_0x33d165));const _0x5afb00=await withSpinner('Starting\x20workflow\x20run...',()=>_0x3cd2c4[_0x492439(0x178)][_0x492439(0x195)](_0x3ffe86,_0x3206d8,{'sessionTime':_0x33d165}),{'verbose':_0x4e78f0[_0x492439(0x1db)]}),_0x1e5e25=_0x5afb00[_0x492439(0x1cb)];return console['error'](_0x492439(0x156)),console[_0x492439(0x1a6)]('\x20\x20Attempt\x20ID:\x20'+_0x1e5e25['id']),console[_0x492439(0x1a6)](_0x492439(0x1c6)+_0x1e5e25[_0x492439(0x1cf)]),console[_0x492439(0x1a6)](_0x492439(0x1de)+_0x1e5e25['project']?.[_0x492439(0x1ce)]),console[_0x492439(0x1a6)](_0x492439(0x18d)+_0x1e5e25['workflow']?.[_0x492439(0x1ce)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a43_0x5759ce(0x15a);[a43_0x5759ce(0x1ab)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a43_0x5759ce(0x14d)](_0x304240){const _0x282188=a43_0x5759ce,{options:_0x341349,args:_0x5bdf6d,tdx:_0x5411aa}=_0x304240,_0x159a24=_0x5bdf6d[0x0],_0xf0606d=_0x5bdf6d[0x1]||'.';if(!_0x159a24)return console[_0x282188(0x1a6)](_0x282188(0x176)),console[_0x282188(0x1a6)](_0x282188(0x1c4)),0x1;const _0x1f877c=_0x341349[_0x282188(0x1dd)];_0x341349[_0x282188(0x1db)]&&(console[_0x282188(0x1a6)]('Project:\x20'+_0x159a24),console[_0x282188(0x1a6)](_0x282188(0x1e2)+_0xf0606d),_0x1f877c&&console[_0x282188(0x1a6)](_0x282188(0x19d)+_0x1f877c));const _0x59e7da=await withSpinner(_0x282188(0x142)+_0x159a24+_0x282188(0x166),()=>_0x5411aa[_0x282188(0x178)][_0x282188(0x1d0)](_0x159a24,_0xf0606d,{'revision':_0x1f877c}),{'verbose':_0x341349[_0x282188(0x1db)]}),_0x4debd5=_0x59e7da[_0x282188(0x1cb)];return console[_0x282188(0x1a6)](_0x282188(0x186)+_0x4debd5[_0x282188(0x18e)]),console[_0x282188(0x1a6)]('\x20\x20Revision:\x20'+_0x4debd5[_0x282188(0x1dd)]),console[_0x282188(0x1a6)](_0x282188(0x1d4)+_0x4debd5[_0x282188(0x1d5)]),console['error'](_0x282188(0x1a1)+_0xf0606d+'/'+_0x4debd5[_0x282188(0x18e)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x18c);[a43_0x5759ce(0x1ab)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a43_0x5759ce(0x14d)](_0x488b7e){const _0x352a0d=a43_0x5759ce,{options:_0x1ce9df,args:_0x1e4888,tdx:_0x546ef5}=_0x488b7e;let _0x2ae18d='.',_0x2e9ac7=_0x1ce9df[_0x352a0d(0x1ce)];if(_0x1e4888[0x0]){const {promises:_0x29aa8c}=await import('fs');try{const _0x2fd756=await _0x29aa8c[_0x352a0d(0x1d3)](_0x1e4888[0x0]);if(_0x2fd756[_0x352a0d(0x1e0)]())_0x2ae18d=_0x1e4888[0x0];else return console[_0x352a0d(0x1a6)](_0x352a0d(0x1a9)+_0x1e4888[0x0]+_0x352a0d(0x143)),0x1;}catch{_0x2e9ac7=_0x1e4888[0x0],_0x2ae18d='.';}}const _0x2b8f45=_0x1ce9df[_0x352a0d(0x1dd)],_0x3413ab=_0x1ce9df[_0x352a0d(0x16e)];_0x1ce9df[_0x352a0d(0x1db)]&&(console[_0x352a0d(0x1a6)](_0x352a0d(0x14b)+_0x2ae18d),_0x2e9ac7&&console['error']('Project\x20name:\x20'+_0x2e9ac7),_0x2b8f45&&console[_0x352a0d(0x1a6)](_0x352a0d(0x19d)+_0x2b8f45),_0x3413ab&&console['error'](_0x352a0d(0x155)));const _0x2189a7=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x546ef5[_0x352a0d(0x178)]['push'](_0x2ae18d,{'projectName':_0x2e9ac7,'revision':_0x2b8f45,'skipValidation':_0x3413ab}),{'verbose':_0x1ce9df[_0x352a0d(0x1db)]}),_0x2d1503=_0x2189a7[_0x352a0d(0x1cb)];return console[_0x352a0d(0x1a6)](_0x352a0d(0x197)+_0x2d1503[_0x352a0d(0x18e)]),console[_0x352a0d(0x1a6)](_0x352a0d(0x1bb)+_0x2d1503[_0x352a0d(0x1b1)]),console[_0x352a0d(0x1a6)](_0x352a0d(0x182)+_0x2d1503['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x146);[a43_0x5759ce(0x1ab)]='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a43_0x5759ce(0x14d)](_0x2894bf){const _0x16ab89=a43_0x5759ce,{options:_0x477eba,args:_0x5586f1,tdx:_0x540838}=_0x2894bf,_0x5882c0=_0x5586f1[0x0];if(!_0x5882c0)return console[_0x16ab89(0x1a6)](_0x16ab89(0x167)),console['error']('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x477eba[_0x16ab89(0x1db)]&&console[_0x16ab89(0x1a6)]('Project:\x20'+_0x5882c0);if(!_0x477eba[_0x16ab89(0x17b)]){const _0x58f57c=await confirm(_0x16ab89(0x157)+_0x5882c0+_0x16ab89(0x1b3));if(!_0x58f57c)return console[_0x16ab89(0x1a6)](_0x16ab89(0x19b)),0x0;}const _0x15692d=await withSpinner(_0x16ab89(0x14a)+_0x5882c0+_0x16ab89(0x166),()=>_0x540838[_0x16ab89(0x178)][_0x16ab89(0x169)](_0x5882c0),{'verbose':_0x477eba[_0x16ab89(0x1db)]}),_0x238642=_0x15692d[_0x16ab89(0x1cb)];return console[_0x16ab89(0x1a6)](_0x16ab89(0x171)+_0x238642[_0x16ab89(0x18e)]),console[_0x16ab89(0x1a6)](_0x16ab89(0x1bb)+_0x238642[_0x16ab89(0x1b1)]),0x0;}}
package/dist/core/auth.js CHANGED
@@ -1 +1 @@
1
- (function(_0x1a3189,_0x1541f8){const _0xfb166b=a44_0x471d,_0x53f0c9=_0x1a3189();while(!![]){try{const _0x25d40e=parseInt(_0xfb166b(0x114))/0x1+parseInt(_0xfb166b(0x128))/0x2*(parseInt(_0xfb166b(0x11e))/0x3)+parseInt(_0xfb166b(0x123))/0x4*(-parseInt(_0xfb166b(0x124))/0x5)+-parseInt(_0xfb166b(0x119))/0x6*(-parseInt(_0xfb166b(0x126))/0x7)+parseInt(_0xfb166b(0x118))/0x8+-parseInt(_0xfb166b(0x11a))/0x9+-parseInt(_0xfb166b(0x129))/0xa;if(_0x25d40e===_0x1541f8)break;else _0x53f0c9['push'](_0x53f0c9['shift']());}catch(_0x59bc6c){_0x53f0c9['push'](_0x53f0c9['shift']());}}}(a44_0x54bf,0x9427c));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';function a44_0x54bf(){const _0x5e47bb=['313820cSQxFX','utf-8','length','tdx/','8412856cPHwqT','18YaCfuX','3019725HNESvW','0.0.0','X-Trino-User','tdx','1695iojuos','TD1\x20','Authorization','parse','entries','1272geOZPc','7905iiyuRL','version','850976kmeTwa','replace','688GqCbJQ','4793640ukYAnq'];a44_0x54bf=function(){return _0x5e47bb;};return a44_0x54bf();}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x8193b6=a44_0x471d;try{const _0x28381a=fileURLToPath(import.meta.url),_0x1fac34=dirname(_0x28381a),_0x3e0d21=join(_0x1fac34,'../../package.json'),_0xe4db34=JSON[_0x8193b6(0x121)](readFileSync(_0x3e0d21,_0x8193b6(0x115)));return _0xe4db34[_0x8193b6(0x125)];}catch{return _0x8193b6(0x11b);}}function a44_0x471d(_0x273218,_0x4df715){_0x273218=_0x273218-0x114;const _0x54bf09=a44_0x54bf();let _0x471d27=_0x54bf09[_0x273218];return _0x471d27;}export function getUserAgent(){const _0x43e286=a44_0x471d,_0x177729=getVersion(),_0x1acbf4=platform(),_0x3eef4b=process['version'][_0x43e286(0x127)]('v','');return _0x43e286(0x117)+_0x177729+'\x20('+_0x1acbf4+';\x20node/'+_0x3eef4b+')';}export function getAuthHeaders(_0xd54a30,_0x52ce9a){const _0x2e0085=a44_0x471d,_0xca107f=getVersion(),_0x10a9e3={'User-Agent':getUserAgent(),'X-TD-Client':_0x2e0085(0x11d),'X-TD-Client-Version':_0xca107f};return _0x52ce9a&&(_0x10a9e3[_0x2e0085(0x120)]=_0x2e0085(0x11f)+_0x52ce9a),_0x10a9e3;}export function toHeaderRecord(_0x2e377c){const _0x4f206f=a44_0x471d,_0x84bbf0={};for(const [_0x570a6a,_0x428501]of Object[_0x4f206f(0x122)](_0x2e377c)){_0x428501!==undefined&&(_0x84bbf0[_0x570a6a]=_0x428501);}return _0x84bbf0;}export function getTrinoHeaders(_0x259a78,_0x30a129){const _0x32f342=a44_0x471d,_0x59b1a2=getAuthHeaders(_0x259a78,_0x30a129),_0x3e1fb0=toHeaderRecord(_0x59b1a2);return delete _0x3e1fb0[_0x32f342(0x120)],_0x30a129&&(_0x3e1fb0[_0x32f342(0x11c)]=_0x30a129),_0x3e1fb0;}export function hasAPIKey(_0x289309){const _0x2121a6=a44_0x471d,_0x2baf70=getAPIKey(_0x289309);return _0x2baf70!==undefined&&_0x2baf70[_0x2121a6(0x116)]>0x0;}
1
+ (function(_0x5534aa,_0x4a21ff){const _0x34c545=a44_0x3980,_0x12f7e5=_0x5534aa();while(!![]){try{const _0x331509=-parseInt(_0x34c545(0x1a8))/0x1*(-parseInt(_0x34c545(0x1aa))/0x2)+parseInt(_0x34c545(0x1a9))/0x3+-parseInt(_0x34c545(0x19e))/0x4+-parseInt(_0x34c545(0x1a6))/0x5+-parseInt(_0x34c545(0x1ae))/0x6+-parseInt(_0x34c545(0x1ad))/0x7+-parseInt(_0x34c545(0x1ab))/0x8*(-parseInt(_0x34c545(0x1ac))/0x9);if(_0x331509===_0x4a21ff)break;else _0x12f7e5['push'](_0x12f7e5['shift']());}catch(_0x2c1cd8){_0x12f7e5['push'](_0x12f7e5['shift']());}}}(a44_0x3682,0x4c4b5));import{platform}from'os';import{readFileSync}from'fs';function a44_0x3980(_0x295ccb,_0x3d9b29){_0x295ccb=_0x295ccb-0x19d;const _0x368258=a44_0x3682();let _0x398006=_0x368258[_0x295ccb];return _0x398006;}import{fileURLToPath}from'url';function a44_0x3682(){const _0x34125e=['../../package.json','Authorization','tdx/','2516535XwBRMV','X-Trino-User','16403wnjHDL','1503660eXyHfP','28GgOnTn','29096NfnZfH','2511vZAYcS','3621653DKEhQi','2331810PAPCrF','replace','95052KDrZtl','length','tdx','entries','version'];a44_0x3682=function(){return _0x34125e;};return a44_0x3682();}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0xc538c7=a44_0x3980;try{const _0x4963de=fileURLToPath(import.meta.url),_0x41c693=dirname(_0x4963de),_0x53c3fd=join(_0x41c693,_0xc538c7(0x1a3)),_0xf15eb8=JSON['parse'](readFileSync(_0x53c3fd,'utf-8'));return _0xf15eb8[_0xc538c7(0x1a2)];}catch{return'0.0.0';}}export function getUserAgent(){const _0x555ba4=a44_0x3980,_0x36b529=getVersion(),_0x13f43d=platform(),_0x3b20a5=process[_0x555ba4(0x1a2)][_0x555ba4(0x19d)]('v','');return _0x555ba4(0x1a5)+_0x36b529+'\x20('+_0x13f43d+';\x20node/'+_0x3b20a5+')';}export function getAuthHeaders(_0x6861ca,_0x189e36){const _0x60f046=a44_0x3980,_0x5edb32=getVersion(),_0x16351c={'User-Agent':getUserAgent(),'X-TD-Client':_0x60f046(0x1a0),'X-TD-Client-Version':_0x5edb32};return _0x189e36&&(_0x16351c['Authorization']='TD1\x20'+_0x189e36),_0x16351c;}export function toHeaderRecord(_0x3a05d6){const _0x23810e=a44_0x3980,_0x71258b={};for(const [_0x10f21e,_0x52de10]of Object[_0x23810e(0x1a1)](_0x3a05d6)){_0x52de10!==undefined&&(_0x71258b[_0x10f21e]=_0x52de10);}return _0x71258b;}export function getTrinoHeaders(_0x3f4a09,_0x259314){const _0x42c8da=a44_0x3980,_0x12ad7d=getAuthHeaders(_0x3f4a09,_0x259314),_0x2b2540=toHeaderRecord(_0x12ad7d);return delete _0x2b2540[_0x42c8da(0x1a4)],_0x259314&&(_0x2b2540[_0x42c8da(0x1a7)]=_0x259314),_0x2b2540;}export function hasAPIKey(_0x1e7eee){const _0x3c3fa6=a44_0x3980,_0x240ecf=getAPIKey(_0x1e7eee);return _0x240ecf!==undefined&&_0x240ecf[_0x3c3fa6(0x19f)]>0x0;}
@@ -1 +1 @@
1
- (function(_0x52fbef,_0xae2636){const _0x79e5ff=a45_0x8daa,_0x46b9dd=_0x52fbef();while(!![]){try{const _0x3404ac=-parseInt(_0x79e5ff(0x128))/0x1+-parseInt(_0x79e5ff(0x14d))/0x2+parseInt(_0x79e5ff(0x109))/0x3*(-parseInt(_0x79e5ff(0x123))/0x4)+-parseInt(_0x79e5ff(0x153))/0x5*(-parseInt(_0x79e5ff(0x13e))/0x6)+parseInt(_0x79e5ff(0x12a))/0x7*(parseInt(_0x79e5ff(0x152))/0x8)+parseInt(_0x79e5ff(0x144))/0x9*(-parseInt(_0x79e5ff(0x129))/0xa)+parseInt(_0x79e5ff(0x116))/0xb*(parseInt(_0x79e5ff(0x111))/0xc);if(_0x3404ac===_0xae2636)break;else _0x46b9dd['push'](_0x46b9dd['shift']());}catch(_0x4f67b3){_0x46b9dd['push'](_0x46b9dd['shift']());}}}(a45_0x3d5f,0xd1cbb));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x45aaad from'node:fs';import*as a45_0x364fa5 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x19930c from'chalk';export function getConfigDir(){const _0x1ee5eb=a45_0x8daa;return process[_0x1ee5eb(0x107)][_0x1ee5eb(0x10c)]||join(homedir(),_0x1ee5eb(0x14b),_0x1ee5eb(0x131));}export function getConfigFile(){const _0x124bba=a45_0x8daa;return join(getConfigDir(),_0x124bba(0x125));}export function getConfigFilePath(_0x787bb4){const _0x594c51=a45_0x8daa,_0x44aa61=getConfigDir();return _0x787bb4?a45_0x364fa5[_0x594c51(0x11c)](_0x44aa61,'.env.'+_0x787bb4):getConfigFile();}function a45_0x3d5f(){const _0x1b3199=['llm_default_project.','number','.config','profiles','1881000Zqxtom','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','TDX_API_KEY_','keychain\x20(profile:\x20','keychain','2184uLSiHX','5BQawQN','account_info.','\x20env\x20var','env','TD_API_KEY_','102iYNIar','split','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','TDX_CONFIG_DIR','TDX_API_KEY\x20env\x20var','dev-eu01','accountId','ap02','3348564wtmdWg','trim','yellow','TDX_API_KEY','apiKey','99wYMNPy','isDeprecated','existsSync','startsWith','.json','ap03','join','toUpperCase','map','replace','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','legacy\x20.env\x20file\x20(profile:\x20','.env.','111868ccFauT','llm_default_project','.env','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','source','173076jaeznL','4632120jUvQEk','4501PXdyQS','site','.cache','us01','warn','TD_API_KEY\x20env\x20var\x20(deprecated)','Warning:\x20Failed\x20to\x20read\x20','tdx','stringify','parse','TDX_CACHE_DIR','name','stg-us01','utf-8','Warning:\x20Unknown\x20site\x20\x27','jp01','includes','toISOString','string','TD_API_KEY','6979434uWondX','stg-jp01','stg-ap03','entries','endsWith','profile','18lYiOuG','readFileSync','filter','eu01','dev-us01'];a45_0x3d5f=function(){return _0x1b3199;};return a45_0x3d5f();}export function getCacheDir(){const _0x1d64a7=a45_0x8daa;return process[_0x1d64a7(0x107)][_0x1d64a7(0x134)]||join(homedir(),_0x1d64a7(0x12c),_0x1d64a7(0x131));}export function getLLMProjectCacheFile(_0x39d0a2){const _0xcb1c61=a45_0x8daa,_0x1eb846=_0x39d0a2?_0xcb1c61(0x149)+_0x39d0a2:_0xcb1c61(0x124);return join(getCacheDir(),_0x1eb846);}export function readCachedLLMProject(_0x54b886){const _0x542531=a45_0x8daa;try{const _0x1228d4=getLLMProjectCacheFile(_0x54b886);if(!existsSync(_0x1228d4))return null;const _0x2dcf6e=readFileSync(_0x1228d4,_0x542531(0x137))['trim']();try{const _0xdcce64=JSON[_0x542531(0x133)](_0x2dcf6e);if(_0xdcce64&&typeof _0xdcce64['id']===_0x542531(0x13c)&&typeof _0xdcce64[_0x542531(0x135)]===_0x542531(0x13c))return _0xdcce64;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x190967,_0x133ca8,_0x1cf823){const _0x49e5db=a45_0x8daa;try{const _0x4381de=getCacheDir(),_0x3e2383=getLLMProjectCacheFile(_0x1cf823);!existsSync(_0x4381de)&&mkdirSync(_0x4381de,{'recursive':!![]});const _0x57594e={'name':_0x190967,'id':_0x133ca8};writeFileSync(_0x3e2383,JSON['stringify'](_0x57594e),_0x49e5db(0x137));}catch{}}export function getAccountInfoCacheFile(_0xa1c736){const _0x57cd5f=a45_0x8daa,_0x380214=_0xa1c736?_0x57cd5f(0x154)+_0xa1c736+_0x57cd5f(0x11a):'account_info.json';return join(getCacheDir(),_0x380214);}export function readCachedAccountInfo(_0x4f7b14){const _0x4cdcd7=a45_0x8daa;try{const _0x1da536=getAccountInfoCacheFile(_0x4f7b14);if(!existsSync(_0x1da536))return null;const _0x3e6f9e=readFileSync(_0x1da536,_0x4cdcd7(0x137))[_0x4cdcd7(0x112)](),_0x14c562=JSON[_0x4cdcd7(0x133)](_0x3e6f9e);if(_0x14c562&&typeof _0x14c562[_0x4cdcd7(0x12b)]===_0x4cdcd7(0x13c)&&typeof _0x14c562[_0x4cdcd7(0x10f)]===_0x4cdcd7(0x14a))return _0x14c562;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x4dd6ee,_0x5b8e67,_0x316e8d){const _0x355cb3=a45_0x8daa;try{const _0x4655f0=getCacheDir(),_0x5739a2=getAccountInfoCacheFile(_0x316e8d);!existsSync(_0x4655f0)&&mkdirSync(_0x4655f0,{'recursive':!![]});const _0xd5b045={'site':_0x4dd6ee,'accountId':_0x5b8e67,'cachedAt':new Date()[_0x355cb3(0x13b)]()};writeFileSync(_0x5739a2,JSON[_0x355cb3(0x132)](_0xd5b045),'utf-8');}catch{}}export function parseEnvFile(_0xb50d75){const _0x24791f=a45_0x8daa,_0x5974fc={};for(const _0xadd129 of _0xb50d75['split']('\x0a')){const _0x3783f4=_0xadd129[_0x24791f(0x112)]();if(!_0x3783f4||_0x3783f4['startsWith']('#'))continue;const _0x5698b2=_0x3783f4['match'](/^([^=]+)=(.*)$/);if(_0x5698b2){const _0x319e88=_0x5698b2[0x1][_0x24791f(0x112)]();let _0x9f0dd1=_0x5698b2[0x2][_0x24791f(0x112)]();(_0x9f0dd1[_0x24791f(0x119)]('\x22')&&_0x9f0dd1[_0x24791f(0x142)]('\x22')||_0x9f0dd1[_0x24791f(0x119)]('\x27')&&_0x9f0dd1[_0x24791f(0x142)]('\x27'))&&(_0x9f0dd1=_0x9f0dd1['slice'](0x1,-0x1)),_0x5974fc[_0x319e88]=_0x9f0dd1;}}return _0x5974fc;}export function readUserConfig(){const _0x2ce988=a45_0x8daa,_0x2026c5=getConfigFile();if(!existsSync(_0x2026c5))return{};try{const _0x4eca22=readFileSync(_0x2026c5,'utf-8');return parseEnvFile(_0x4eca22);}catch(_0x3d6e16){return console[_0x2ce988(0x12e)](_0x2ce988(0x10b)+_0x2026c5+':',_0x3d6e16),{};}}export function resolveSite(_0x3329a0){const _0xb73ff4=a45_0x8daa,_0x51aaca=[_0xb73ff4(0x12d),_0xb73ff4(0x139),_0xb73ff4(0x147),'ap02','ap03',_0xb73ff4(0x148),_0xb73ff4(0x10e),_0xb73ff4(0x136),_0xb73ff4(0x13f),_0xb73ff4(0x140)];if(_0x51aaca[_0xb73ff4(0x13a)](_0x3329a0))return _0x3329a0;if(_0x3329a0 in SITE_ALIASES)return SITE_ALIASES[_0x3329a0];return console[_0xb73ff4(0x12e)](_0xb73ff4(0x138)+_0x3329a0+'\x27,\x20defaulting\x20to\x20us01'),_0xb73ff4(0x12d);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x4244a9,_0x4d7ff4){const _0x2461a8=a45_0x8daa,_0x5a1f8e=_0x4d7ff4||getActiveProfileName();if(_0x5a1f8e){const _0x54e29d=_0x2461a8(0x14f)+normalizeProfileForEnvVar(_0x5a1f8e);if(process[_0x2461a8(0x107)][_0x54e29d])return process[_0x2461a8(0x107)][_0x54e29d];}if(process[_0x2461a8(0x107)][_0x2461a8(0x114)])return process[_0x2461a8(0x107)][_0x2461a8(0x114)];if(process[_0x2461a8(0x107)]['TD_API_KEY'])return process[_0x2461a8(0x107)][_0x2461a8(0x13d)];const _0x239085=_0x4244a9[_0x2461a8(0x11d)]()[_0x2461a8(0x11f)](/-/g,'_'),_0x2272ac=_0x2461a8(0x108)+_0x239085;if(_0x5a1f8e){const _0x211640=loadProfileEnv(_0x5a1f8e);if(_0x211640){if(_0x211640[_0x2272ac])return _0x211640[_0x2272ac];if(_0x211640[_0x2461a8(0x13d)])return _0x211640['TD_API_KEY'];}}const _0x47c92b=loadUserConfigOnce();if(_0x47c92b[_0x2272ac])return _0x47c92b[_0x2272ac];if(_0x47c92b['TD_API_KEY'])return _0x47c92b['TD_API_KEY'];return undefined;}function a45_0x8daa(_0x5d4706,_0x36f4e1){_0x5d4706=_0x5d4706-0x106;const _0x3d5f56=a45_0x3d5f();let _0x8daa6d=_0x3d5f56[_0x5d4706];return _0x8daa6d;}export function normalizeProfileForEnvVar(_0x1b6d5f){const _0x65d210=a45_0x8daa;return _0x1b6d5f[_0x65d210(0x11d)]()[_0x65d210(0x11f)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x316228,_0x9cb428){const _0x28cb8a=a45_0x8daa,_0x123a02=_0x9cb428||getActiveProfileName()||undefined;if(_0x123a02){const _0xedd9de=_0x28cb8a(0x14f)+normalizeProfileForEnvVar(_0x123a02);if(process['env'][_0xedd9de])return{'apiKey':process[_0x28cb8a(0x107)][_0xedd9de],'source':_0xedd9de+_0x28cb8a(0x106),'isDeprecated':![]};const _0x2a1849=getCachedCredential(_0x316228,_0x123a02);if(_0x2a1849)return{'apiKey':_0x2a1849,'source':_0x28cb8a(0x150)+_0x123a02+')','isDeprecated':![]};const _0x19fef7=await getKeychainAPIKey(_0x123a02);if(_0x19fef7)return setCachedCredential(_0x19fef7,_0x316228,_0x123a02),{'apiKey':_0x19fef7,'source':_0x28cb8a(0x150)+_0x123a02+')','isDeprecated':![]};}if(process[_0x28cb8a(0x107)][_0x28cb8a(0x114)])return{'apiKey':process[_0x28cb8a(0x107)]['TDX_API_KEY'],'source':_0x28cb8a(0x10d),'isDeprecated':![]};if(!_0x123a02){const _0x2b96e0=getCachedCredential(_0x316228,undefined);if(_0x2b96e0)return{'apiKey':_0x2b96e0,'source':_0x28cb8a(0x151),'isDeprecated':![]};const _0x4d3b13=await getKeychainAPIKey(undefined);if(_0x4d3b13)return setCachedCredential(_0x4d3b13,_0x316228,undefined),{'apiKey':_0x4d3b13,'source':'keychain','isDeprecated':![]};}if(process['env']['TD_API_KEY'])return{'apiKey':process[_0x28cb8a(0x107)][_0x28cb8a(0x13d)],'source':_0x28cb8a(0x12f),'isDeprecated':!![]};const _0x2f6295=getLegacyEnvAPIKey(_0x316228,_0x123a02);if(_0x2f6295){const _0x5d5d3b=await isKeychainAvailable();if(_0x5d5d3b)try{await saveKeychainAPIKey(_0x2f6295,_0x123a02),setCachedCredential(_0x2f6295,_0x316228,_0x123a02);const _0x43ad75=getConfigFilePath(_0x123a02);cleanupLegacyEnvFile(_0x43ad75)&&console[_0x28cb8a(0x12e)](a45_0x19930c['yellow'](_0x28cb8a(0x120)));}catch(_0x49cd65){console[_0x28cb8a(0x12e)](a45_0x19930c[_0x28cb8a(0x113)]('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x49cd65));}const _0x59ee0c=_0x123a02?_0x28cb8a(0x121)+_0x123a02+')':'legacy\x20.env\x20file';return{'apiKey':_0x2f6295,'source':_0x59ee0c,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x3d864d,_0x453461,_0x33e1a5=!![]){const _0x345bf1=a45_0x8daa,_0x595b43=await resolveAPIKeyAsync(_0x3d864d,_0x453461);if(!_0x595b43)return undefined;if(_0x33e1a5&&_0x595b43[_0x345bf1(0x117)]&&_0x595b43[_0x345bf1(0x127)][_0x345bf1(0x13a)](_0x345bf1(0x13d))){const _0x58c9ff=_0x453461||getActiveProfileName()||undefined,_0x3d9b56=_0x58c9ff?_0x345bf1(0x14f)+normalizeProfileForEnvVar(_0x58c9ff):'TDX_API_KEY_<PROFILE>';console['warn'](a45_0x19930c[_0x345bf1(0x113)](_0x345bf1(0x126)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x3d9b56+').')));}return _0x595b43[_0x345bf1(0x115)];}function getLegacyEnvAPIKey(_0x18e05b,_0x269aae){const _0xdf68fb=a45_0x8daa,_0x47a66c=_0x18e05b[_0xdf68fb(0x11d)]()[_0xdf68fb(0x11f)](/-/g,'_'),_0x2f8cd3=_0xdf68fb(0x108)+_0x47a66c;if(_0x269aae){const _0xb67a9d=loadProfileEnv(_0x269aae);if(_0xb67a9d){if(_0xb67a9d[_0x2f8cd3])return _0xb67a9d[_0x2f8cd3];if(_0xb67a9d[_0xdf68fb(0x13d)])return _0xb67a9d[_0xdf68fb(0x13d)];}}const _0x5a40f7=loadUserConfigOnce();if(_0x5a40f7[_0x2f8cd3])return _0x5a40f7[_0x2f8cd3];if(_0x5a40f7['TD_API_KEY'])return _0x5a40f7[_0xdf68fb(0x13d)];return undefined;}function cleanupLegacyEnvFile(_0x3aaa40){const _0x276699=a45_0x8daa;if(!existsSync(_0x3aaa40))return![];try{const _0x211bc4=readFileSync(_0x3aaa40,'utf-8'),_0x3a332f=_0x211bc4[_0x276699(0x10a)]('\x0a'),_0x3fd6a8=_0x3a332f[_0x276699(0x146)](_0x48b36d=>{const _0x330fd9=_0x276699,_0x6d802c=_0x48b36d[_0x330fd9(0x112)]();if(!_0x6d802c||_0x6d802c['startsWith']('#'))return!![];const [_0x11a476]=_0x6d802c[_0x330fd9(0x10a)]('=');return!_0x11a476[_0x330fd9(0x119)](_0x330fd9(0x13d));}),_0x26d99d=_0x3fd6a8['some'](_0x1f005c=>{const _0x1c9253=_0x276699,_0x5528c2=_0x1f005c[_0x1c9253(0x112)]();return _0x5528c2&&!_0x5528c2[_0x1c9253(0x119)]('#');});if(!_0x26d99d)return unlinkSync(_0x3aaa40),!![];return writeFileSync(_0x3aaa40,_0x3fd6a8[_0x276699(0x11c)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x5ee39b){const _0x3a1a9d=a45_0x8daa,_0x5d6a4a=a45_0x364fa5[_0x3a1a9d(0x11c)](getConfigDir(),_0x3a1a9d(0x122)+_0x5ee39b);if(a45_0x45aaad['existsSync'](_0x5d6a4a)){validateSecureFilePermissions(_0x5d6a4a);try{const _0x3ef1fe=a45_0x45aaad['readFileSync'](_0x5d6a4a,_0x3a1a9d(0x137));return parseEnvFile(_0x3ef1fe);}catch(_0x3438a6){console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x5d6a4a+':\x20'+_0x3438a6);}}const _0x1c3a6f=a45_0x364fa5['join'](getConfigDir(),_0x3a1a9d(0x14c),_0x5ee39b,'.env');if(a45_0x45aaad[_0x3a1a9d(0x118)](_0x1c3a6f)){validateSecureFilePermissions(_0x1c3a6f);try{const _0x45318f=a45_0x45aaad['readFileSync'](_0x1c3a6f,'utf-8');return parseEnvFile(_0x45318f);}catch(_0x22c35b){return console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x1c3a6f+':\x20'+_0x22c35b),null;}}return null;}function getActiveProfileName(){const _0x46967c=a45_0x8daa,_0x4bc1e5=a45_0x364fa5[_0x46967c(0x11c)](getConfigDir(),'tdx.json');if(!a45_0x45aaad['existsSync'](_0x4bc1e5))return null;try{const _0x3e03ba=a45_0x45aaad[_0x46967c(0x145)](_0x4bc1e5,_0x46967c(0x137)),_0x521cae=JSON[_0x46967c(0x133)](_0x3e03ba);return _0x521cae[_0x46967c(0x143)]||null;}catch{return null;}}export function saveAPIKey(_0x5724fa,_0x1a9385,_0xf0478c){const _0x23e7e9=a45_0x8daa,_0x3adf85=getConfigDir(),_0x52f85c=getConfigFilePath(_0xf0478c);!existsSync(_0x3adf85)&&mkdirSync(_0x3adf85,{'recursive':!![],'mode':0x1c0});let _0x800ff1={};if(existsSync(_0x52f85c))try{const _0x1a36a9=readFileSync(_0x52f85c,'utf-8');_0x800ff1=parseEnvFile(_0x1a36a9);}catch(_0x17ffc9){console['warn'](_0x23e7e9(0x130)+_0x52f85c+':',_0x17ffc9);}const _0x4b5220=_0x5724fa[_0x23e7e9(0x11d)]()['replace'](/-/g,'_');_0x800ff1['TD_API_KEY_'+_0x4b5220]=_0x1a9385;const _0x432c4a=Object[_0x23e7e9(0x141)](_0x800ff1)[_0x23e7e9(0x11e)](([_0xc9c8c5,_0x3b6437])=>_0xc9c8c5+'='+_0x3b6437);writeFileSync(_0x52f85c,_0x432c4a['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x44c80c,_0x2a1c55,_0x27dc29){const _0x4193fa=a45_0x8daa;await saveKeychainAPIKey(_0x44c80c,_0x27dc29),setCachedCredential(_0x44c80c,_0x2a1c55,_0x27dc29);const _0xd9ca67=getConfigFilePath(_0x27dc29);cleanupLegacyEnvFile(_0xd9ca67)&&console[_0x4193fa(0x12e)](a45_0x19930c[_0x4193fa(0x113)](_0x4193fa(0x14e)));}export function loadConfig(){const _0x5f3006=a45_0x8daa,_0x23d776={'apiKeys':{},'defaultSite':_0x5f3006(0x12d)},_0x45cb65=[_0x5f3006(0x12d),_0x5f3006(0x139),_0x5f3006(0x147),_0x5f3006(0x110),_0x5f3006(0x11b),_0x5f3006(0x148),_0x5f3006(0x10e),_0x5f3006(0x136),_0x5f3006(0x13f),_0x5f3006(0x140)];for(const _0x5d2f8d of _0x45cb65){const _0x3cf8ba=getAPIKey(_0x5d2f8d);_0x3cf8ba&&(_0x23d776['apiKeys'][_0x5d2f8d]=_0x3cf8ba);}return _0x23d776;}
1
+ (function(_0x1e1ff4,_0x12c630){const _0x396976=a45_0x15c5,_0x1b9e77=_0x1e1ff4();while(!![]){try{const _0x4c904e=-parseInt(_0x396976(0x107))/0x1*(parseInt(_0x396976(0x105))/0x2)+parseInt(_0x396976(0xc5))/0x3*(-parseInt(_0x396976(0xf5))/0x4)+parseInt(_0x396976(0xff))/0x5*(parseInt(_0x396976(0xea))/0x6)+-parseInt(_0x396976(0xf8))/0x7*(-parseInt(_0x396976(0xb8))/0x8)+parseInt(_0x396976(0xd1))/0x9*(parseInt(_0x396976(0xfd))/0xa)+-parseInt(_0x396976(0xe9))/0xb*(parseInt(_0x396976(0xe2))/0xc)+parseInt(_0x396976(0xd3))/0xd*(parseInt(_0x396976(0xca))/0xe);if(_0x4c904e===_0x12c630)break;else _0x1b9e77['push'](_0x1b9e77['shift']());}catch(_0x1e851f){_0x1b9e77['push'](_0x1b9e77['shift']());}}}(a45_0x5d6e,0xe0026));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x3241dd from'node:fs';import*as a45_0x71f558 from'node:path';function a45_0x5d6e(){const _0x35b775=['site','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','TD_API_KEY_','14WKvlvU','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','source','profiles','apiKey','tdx.json','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','36GcblKi','startsWith','11045879eLDmIE','us01','entries','parse','some','Warning:\x20Failed\x20to\x20read\x20','TDX_CACHE_DIR','endsWith','.env.','keychain\x20(profile:\x20','filter','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','TDX_API_KEY_','\x20env\x20var','stg-jp01','33972ozJiNi','TDX_API_KEY\x20env\x20var','warn','TDX_CONFIG_DIR','join','yellow','toUpperCase','2629TilmCp','43698mtpURh','dev-us01','dev-eu01','readFileSync','TD_API_KEY\x20env\x20var\x20(deprecated)','stg-ap03','apiKeys','llm_default_project.','.cache','keychain','name','3067532PMNXMk','existsSync','stg-us01','7lTPKgP','TDX_API_KEY','includes','legacy\x20.env\x20file','jp01','3987930gCKdqw','account_info.json','20BNESqO','llm_default_project','slice','stringify','string','\x27,\x20defaulting\x20to\x20us01','6TBmoGN','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','396682BUkJyV','accountId','split','tdx','8616744MKOgiO','replace','map','.json','Warning:\x20Unknown\x20site\x20\x27','ap02','TD_API_KEY','trim','env','eu01','number','ap03','utf-8','3wRrtIb','.config'];a45_0x5d6e=function(){return _0x35b775;};return a45_0x5d6e();}import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x5a6362 from'chalk';export function getConfigDir(){const _0x256155=a45_0x15c5;return process[_0x256155(0xc0)][_0x256155(0xe5)]||join(homedir(),_0x256155(0xc6),_0x256155(0x10a));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x48cfb1){const _0x4cb2a9=a45_0x15c5,_0xe9d57c=getConfigDir();return _0x48cfb1?a45_0x71f558[_0x4cb2a9(0xe6)](_0xe9d57c,_0x4cb2a9(0xdb)+_0x48cfb1):getConfigFile();}export function getCacheDir(){const _0x19a07e=a45_0x15c5;return process[_0x19a07e(0xc0)][_0x19a07e(0xd9)]||join(homedir(),_0x19a07e(0xf2),_0x19a07e(0x10a));}export function getLLMProjectCacheFile(_0x4c7a47){const _0x1d5794=a45_0x15c5,_0x46968f=_0x4c7a47?_0x1d5794(0xf1)+_0x4c7a47:_0x1d5794(0x100);return join(getCacheDir(),_0x46968f);}export function readCachedLLMProject(_0x5d4961){const _0x2178fe=a45_0x15c5;try{const _0xc0ae09=getLLMProjectCacheFile(_0x5d4961);if(!existsSync(_0xc0ae09))return null;const _0x580f49=readFileSync(_0xc0ae09,_0x2178fe(0xc4))[_0x2178fe(0xbf)]();try{const _0x5659cd=JSON[_0x2178fe(0xd6)](_0x580f49);if(_0x5659cd&&typeof _0x5659cd['id']===_0x2178fe(0x103)&&typeof _0x5659cd[_0x2178fe(0xf4)]===_0x2178fe(0x103))return _0x5659cd;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x409cab,_0x922947,_0x5b5d5a){const _0x5e6541=a45_0x15c5;try{const _0x28cbec=getCacheDir(),_0x54ea0b=getLLMProjectCacheFile(_0x5b5d5a);!existsSync(_0x28cbec)&&mkdirSync(_0x28cbec,{'recursive':!![]});const _0x3ec66e={'name':_0x409cab,'id':_0x922947};writeFileSync(_0x54ea0b,JSON[_0x5e6541(0x102)](_0x3ec66e),_0x5e6541(0xc4));}catch{}}export function getAccountInfoCacheFile(_0x22cfb2){const _0x1b5a56=a45_0x15c5,_0x3614df=_0x22cfb2?'account_info.'+_0x22cfb2+_0x1b5a56(0xbb):_0x1b5a56(0xfe);return join(getCacheDir(),_0x3614df);}export function readCachedAccountInfo(_0x5a09d0){const _0x367d26=a45_0x15c5;try{const _0x52b753=getAccountInfoCacheFile(_0x5a09d0);if(!existsSync(_0x52b753))return null;const _0x4a9111=readFileSync(_0x52b753,'utf-8')[_0x367d26(0xbf)](),_0xba6bc7=JSON['parse'](_0x4a9111);if(_0xba6bc7&&typeof _0xba6bc7[_0x367d26(0xc7)]===_0x367d26(0x103)&&typeof _0xba6bc7[_0x367d26(0x108)]===_0x367d26(0xc2))return _0xba6bc7;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x1c69d8,_0x246dc6,_0x5f9737){const _0xf48100=a45_0x15c5;try{const _0x2308b1=getCacheDir(),_0x54c0f2=getAccountInfoCacheFile(_0x5f9737);!existsSync(_0x2308b1)&&mkdirSync(_0x2308b1,{'recursive':!![]});const _0x59c084={'site':_0x1c69d8,'accountId':_0x246dc6,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x54c0f2,JSON[_0xf48100(0x102)](_0x59c084),_0xf48100(0xc4));}catch{}}export function parseEnvFile(_0x5ece61){const _0x2e15eb=a45_0x15c5,_0x1975dd={};for(const _0x39511c of _0x5ece61[_0x2e15eb(0x109)]('\x0a')){const _0x1b3ab5=_0x39511c[_0x2e15eb(0xbf)]();if(!_0x1b3ab5||_0x1b3ab5[_0x2e15eb(0xd2)]('#'))continue;const _0x18e176=_0x1b3ab5['match'](/^([^=]+)=(.*)$/);if(_0x18e176){const _0x4dde11=_0x18e176[0x1][_0x2e15eb(0xbf)]();let _0x4e51e1=_0x18e176[0x2][_0x2e15eb(0xbf)]();(_0x4e51e1[_0x2e15eb(0xd2)]('\x22')&&_0x4e51e1['endsWith']('\x22')||_0x4e51e1[_0x2e15eb(0xd2)]('\x27')&&_0x4e51e1[_0x2e15eb(0xda)]('\x27'))&&(_0x4e51e1=_0x4e51e1[_0x2e15eb(0x101)](0x1,-0x1)),_0x1975dd[_0x4dde11]=_0x4e51e1;}}return _0x1975dd;}export function readUserConfig(){const _0x8b888c=a45_0x15c5,_0x8c53a2=getConfigFile();if(!existsSync(_0x8c53a2))return{};try{const _0x2cb209=readFileSync(_0x8c53a2,_0x8b888c(0xc4));return parseEnvFile(_0x2cb209);}catch(_0x337f8c){return console[_0x8b888c(0xe4)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x8c53a2+':',_0x337f8c),{};}}export function resolveSite(_0x44ee50){const _0x52215f=a45_0x15c5,_0x3f2f0e=[_0x52215f(0xd4),_0x52215f(0xfc),_0x52215f(0xc1),_0x52215f(0xbd),_0x52215f(0xc3),'dev-us01',_0x52215f(0xec),_0x52215f(0xf7),_0x52215f(0xe1),_0x52215f(0xef)];if(_0x3f2f0e[_0x52215f(0xfa)](_0x44ee50))return _0x44ee50;if(_0x44ee50 in SITE_ALIASES)return SITE_ALIASES[_0x44ee50];return console['warn'](_0x52215f(0xbc)+_0x44ee50+_0x52215f(0x104)),_0x52215f(0xd4);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2e8d04,_0x54bd3f){const _0x1daca4=a45_0x15c5,_0x328775=_0x54bd3f||getActiveProfileName();if(_0x328775){const _0x1b6765=_0x1daca4(0xdf)+normalizeProfileForEnvVar(_0x328775);if(process[_0x1daca4(0xc0)][_0x1b6765])return process[_0x1daca4(0xc0)][_0x1b6765];}if(process['env']['TDX_API_KEY'])return process[_0x1daca4(0xc0)][_0x1daca4(0xf9)];if(process[_0x1daca4(0xc0)][_0x1daca4(0xbe)])return process[_0x1daca4(0xc0)][_0x1daca4(0xbe)];const _0x90408c=_0x2e8d04[_0x1daca4(0xe8)]()['replace'](/-/g,'_'),_0x2c9629=_0x1daca4(0xc9)+_0x90408c;if(_0x328775){const _0x35879b=loadProfileEnv(_0x328775);if(_0x35879b){if(_0x35879b[_0x2c9629])return _0x35879b[_0x2c9629];if(_0x35879b['TD_API_KEY'])return _0x35879b[_0x1daca4(0xbe)];}}const _0x4d7d1d=loadUserConfigOnce();if(_0x4d7d1d[_0x2c9629])return _0x4d7d1d[_0x2c9629];if(_0x4d7d1d[_0x1daca4(0xbe)])return _0x4d7d1d[_0x1daca4(0xbe)];return undefined;}export function normalizeProfileForEnvVar(_0x24dc0e){const _0x16be70=a45_0x15c5;return _0x24dc0e[_0x16be70(0xe8)]()[_0x16be70(0xb9)](/[^A-Z0-9]/g,'_');}function a45_0x15c5(_0x915f48,_0x1ba9dc){_0x915f48=_0x915f48-0xb8;const _0x5d6e74=a45_0x5d6e();let _0x15c5d3=_0x5d6e74[_0x915f48];return _0x15c5d3;}export async function resolveAPIKeyAsync(_0x18982d,_0x31252c){const _0x2cdc6b=a45_0x15c5,_0x1ee92d=_0x31252c||getActiveProfileName()||undefined;if(_0x1ee92d){const _0x2cbe74=_0x2cdc6b(0xdf)+normalizeProfileForEnvVar(_0x1ee92d);if(process['env'][_0x2cbe74])return{'apiKey':process[_0x2cdc6b(0xc0)][_0x2cbe74],'source':_0x2cbe74+_0x2cdc6b(0xe0),'isDeprecated':![]};const _0x47c146=getCachedCredential(_0x18982d,_0x1ee92d);if(_0x47c146)return{'apiKey':_0x47c146,'source':_0x2cdc6b(0xdc)+_0x1ee92d+')','isDeprecated':![]};const _0x385bbf=await getKeychainAPIKey(_0x1ee92d);if(_0x385bbf)return setCachedCredential(_0x385bbf,_0x18982d,_0x1ee92d),{'apiKey':_0x385bbf,'source':_0x2cdc6b(0xdc)+_0x1ee92d+')','isDeprecated':![]};}if(process[_0x2cdc6b(0xc0)]['TDX_API_KEY'])return{'apiKey':process['env'][_0x2cdc6b(0xf9)],'source':_0x2cdc6b(0xe3),'isDeprecated':![]};if(!_0x1ee92d){const _0x19167c=getCachedCredential(_0x18982d,undefined);if(_0x19167c)return{'apiKey':_0x19167c,'source':_0x2cdc6b(0xf3),'isDeprecated':![]};const _0x337c74=await getKeychainAPIKey(undefined);if(_0x337c74)return setCachedCredential(_0x337c74,_0x18982d,undefined),{'apiKey':_0x337c74,'source':_0x2cdc6b(0xf3),'isDeprecated':![]};}if(process[_0x2cdc6b(0xc0)][_0x2cdc6b(0xbe)])return{'apiKey':process[_0x2cdc6b(0xc0)][_0x2cdc6b(0xbe)],'source':_0x2cdc6b(0xee),'isDeprecated':!![]};const _0x363db5=getLegacyEnvAPIKey(_0x18982d,_0x1ee92d);if(_0x363db5){const _0x43e69d=await isKeychainAvailable();if(_0x43e69d)try{await saveKeychainAPIKey(_0x363db5,_0x1ee92d),setCachedCredential(_0x363db5,_0x18982d,_0x1ee92d);const _0x439691=getConfigFilePath(_0x1ee92d);cleanupLegacyEnvFile(_0x439691)&&console[_0x2cdc6b(0xe4)](a45_0x5a6362[_0x2cdc6b(0xe7)](_0x2cdc6b(0x106)));}catch(_0x438168){console[_0x2cdc6b(0xe4)](a45_0x5a6362[_0x2cdc6b(0xe7)](_0x2cdc6b(0xcb)+_0x438168));}const _0x428e0a=_0x1ee92d?'legacy\x20.env\x20file\x20(profile:\x20'+_0x1ee92d+')':_0x2cdc6b(0xfb);return{'apiKey':_0x363db5,'source':_0x428e0a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x47f1a5,_0x5cd59e,_0x498792=!![]){const _0x235667=a45_0x15c5,_0x345f1e=await resolveAPIKeyAsync(_0x47f1a5,_0x5cd59e);if(!_0x345f1e)return undefined;if(_0x498792&&_0x345f1e['isDeprecated']&&_0x345f1e[_0x235667(0xcc)]['includes'](_0x235667(0xbe))){const _0x2eabcf=_0x5cd59e||getActiveProfileName()||undefined,_0x238be3=_0x2eabcf?_0x235667(0xdf)+normalizeProfileForEnvVar(_0x2eabcf):'TDX_API_KEY_<PROFILE>';console[_0x235667(0xe4)](a45_0x5a6362[_0x235667(0xe7)](_0x235667(0xc8)+(_0x235667(0xd0)+_0x238be3+').')));}return _0x345f1e[_0x235667(0xce)];}function getLegacyEnvAPIKey(_0x42b361,_0x221224){const _0x16ba55=a45_0x15c5,_0x242b9c=_0x42b361['toUpperCase']()[_0x16ba55(0xb9)](/-/g,'_'),_0x3f91aa=_0x16ba55(0xc9)+_0x242b9c;if(_0x221224){const _0x4da2ad=loadProfileEnv(_0x221224);if(_0x4da2ad){if(_0x4da2ad[_0x3f91aa])return _0x4da2ad[_0x3f91aa];if(_0x4da2ad[_0x16ba55(0xbe)])return _0x4da2ad[_0x16ba55(0xbe)];}}const _0x2165ec=loadUserConfigOnce();if(_0x2165ec[_0x3f91aa])return _0x2165ec[_0x3f91aa];if(_0x2165ec[_0x16ba55(0xbe)])return _0x2165ec[_0x16ba55(0xbe)];return undefined;}function cleanupLegacyEnvFile(_0x4fb33a){const _0x1035d7=a45_0x15c5;if(!existsSync(_0x4fb33a))return![];try{const _0x685e7e=readFileSync(_0x4fb33a,_0x1035d7(0xc4)),_0x549737=_0x685e7e[_0x1035d7(0x109)]('\x0a'),_0xa0c758=_0x549737[_0x1035d7(0xdd)](_0x207533=>{const _0xcff125=_0x1035d7,_0x28c4bc=_0x207533[_0xcff125(0xbf)]();if(!_0x28c4bc||_0x28c4bc[_0xcff125(0xd2)]('#'))return!![];const [_0x573657]=_0x28c4bc[_0xcff125(0x109)]('=');return!_0x573657[_0xcff125(0xd2)]('TD_API_KEY');}),_0x5beaf7=_0xa0c758[_0x1035d7(0xd7)](_0xe5f56a=>{const _0x212dfd=_0xe5f56a['trim']();return _0x212dfd&&!_0x212dfd['startsWith']('#');});if(!_0x5beaf7)return unlinkSync(_0x4fb33a),!![];return writeFileSync(_0x4fb33a,_0xa0c758[_0x1035d7(0xe6)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x353262){const _0x3c208a=a45_0x15c5,_0x1101e7=a45_0x71f558[_0x3c208a(0xe6)](getConfigDir(),_0x3c208a(0xdb)+_0x353262);if(a45_0x3241dd[_0x3c208a(0xf6)](_0x1101e7)){validateSecureFilePermissions(_0x1101e7);try{const _0x220df8=a45_0x3241dd[_0x3c208a(0xed)](_0x1101e7,'utf-8');return parseEnvFile(_0x220df8);}catch(_0x28aaba){console[_0x3c208a(0xe4)]('Warning:\x20Failed\x20to\x20load\x20'+_0x1101e7+':\x20'+_0x28aaba);}}const _0x22fdac=a45_0x71f558[_0x3c208a(0xe6)](getConfigDir(),_0x3c208a(0xcd),_0x353262,'.env');if(a45_0x3241dd[_0x3c208a(0xf6)](_0x22fdac)){validateSecureFilePermissions(_0x22fdac);try{const _0x289fae=a45_0x3241dd[_0x3c208a(0xed)](_0x22fdac,_0x3c208a(0xc4));return parseEnvFile(_0x289fae);}catch(_0x3ce68b){return console[_0x3c208a(0xe4)]('Warning:\x20Failed\x20to\x20load\x20'+_0x22fdac+':\x20'+_0x3ce68b),null;}}return null;}function getActiveProfileName(){const _0x4951d5=a45_0x15c5,_0x63f5e=a45_0x71f558[_0x4951d5(0xe6)](getConfigDir(),_0x4951d5(0xcf));if(!a45_0x3241dd[_0x4951d5(0xf6)](_0x63f5e))return null;try{const _0x32b386=a45_0x3241dd[_0x4951d5(0xed)](_0x63f5e,'utf-8'),_0x1ff59b=JSON[_0x4951d5(0xd6)](_0x32b386);return _0x1ff59b['profile']||null;}catch{return null;}}export function saveAPIKey(_0x2a326e,_0x2749f8,_0x7c267e){const _0x3ebae7=a45_0x15c5,_0x3e4b4d=getConfigDir(),_0x4dc0dc=getConfigFilePath(_0x7c267e);!existsSync(_0x3e4b4d)&&mkdirSync(_0x3e4b4d,{'recursive':!![],'mode':0x1c0});let _0x21d997={};if(existsSync(_0x4dc0dc))try{const _0x41891d=readFileSync(_0x4dc0dc,_0x3ebae7(0xc4));_0x21d997=parseEnvFile(_0x41891d);}catch(_0x5688d3){console['warn'](_0x3ebae7(0xd8)+_0x4dc0dc+':',_0x5688d3);}const _0x35c91d=_0x2a326e[_0x3ebae7(0xe8)]()[_0x3ebae7(0xb9)](/-/g,'_');_0x21d997[_0x3ebae7(0xc9)+_0x35c91d]=_0x2749f8;const _0x398cf9=Object[_0x3ebae7(0xd5)](_0x21d997)[_0x3ebae7(0xba)](([_0x5f5c73,_0x3908d3])=>_0x5f5c73+'='+_0x3908d3);writeFileSync(_0x4dc0dc,_0x398cf9[_0x3ebae7(0xe6)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x3b587c,_0x1632da,_0x33c14b){const _0x629d92=a45_0x15c5;await saveKeychainAPIKey(_0x3b587c,_0x33c14b),setCachedCredential(_0x3b587c,_0x1632da,_0x33c14b);const _0x396486=getConfigFilePath(_0x33c14b);cleanupLegacyEnvFile(_0x396486)&&console['warn'](a45_0x5a6362['yellow'](_0x629d92(0xde)));}export function loadConfig(){const _0x2c773b=a45_0x15c5,_0xddf1be={'apiKeys':{},'defaultSite':_0x2c773b(0xd4)},_0x25d042=[_0x2c773b(0xd4),'jp01','eu01','ap02',_0x2c773b(0xc3),_0x2c773b(0xeb),_0x2c773b(0xec),'stg-us01','stg-jp01',_0x2c773b(0xef)];for(const _0x7f37f4 of _0x25d042){const _0x333dc0=getAPIKey(_0x7f37f4);_0x333dc0&&(_0xddf1be[_0x2c773b(0xf0)][_0x7f37f4]=_0x333dc0);}return _0xddf1be;}
@@ -1 +1 @@
1
- (function(_0x14f29c,_0x4a8109){const _0x1fd962=a46_0x14c8,_0xc8c52e=_0x14f29c();while(!![]){try{const _0x2de308=-parseInt(_0x1fd962(0xea))/0x1*(parseInt(_0x1fd962(0xec))/0x2)+-parseInt(_0x1fd962(0xe6))/0x3*(parseInt(_0x1fd962(0xf0))/0x4)+parseInt(_0x1fd962(0xe0))/0x5+parseInt(_0x1fd962(0xee))/0x6+parseInt(_0x1fd962(0xe9))/0x7+-parseInt(_0x1fd962(0xe2))/0x8*(parseInt(_0x1fd962(0xe4))/0x9)+parseInt(_0x1fd962(0xe5))/0xa;if(_0x2de308===_0x4a8109)break;else _0xc8c52e['push'](_0xc8c52e['shift']());}catch(_0x46ab98){_0xc8c52e['push'](_0xc8c52e['shift']());}}}(a46_0x226f,0xafe43));function a46_0x14c8(_0x2e6a26,_0x3004c9){_0x2e6a26=_0x2e6a26-0xe0;const _0x226fcd=a46_0x226f();let _0x14c8c7=_0x226fcd[_0x2e6a26];return _0x14c8c7;}import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';function a46_0x226f(){const _0x55611b=['130NoeUay','connections-','770184GZNtcv','default','692oajkCU','3983390ZYNplc','parse','8gPhuLc','.json','11191707ALkLFg','14130180pHSQiT','1791qIyRaB','now','connections','4773300jldxdi','14657iBZBVA','stringify'];a46_0x226f=function(){return _0x55611b;};return a46_0x226f();}import{getCacheDir}from'./config.js';function getCacheFilePath(_0x4923bf){const _0x55ff41=a46_0x14c8,_0x279b06=_0x4923bf||_0x55ff41(0xef);return join(getCacheDir(),_0x55ff41(0xed)+_0x279b06+_0x55ff41(0xe3));}export function loadCachedConnections(_0x32f7ab){const _0x37789c=a46_0x14c8,_0x27806d=getCacheFilePath(_0x32f7ab);if(!existsSync(_0x27806d))return null;try{const _0x13e025=readFileSync(_0x27806d,'utf-8'),_0x4d1bba=JSON[_0x37789c(0xe1)](_0x13e025);return _0x4d1bba[_0x37789c(0xe8)];}catch{return null;}}export function saveCachedConnections(_0x50218c,_0x4fc446){const _0x31709e=a46_0x14c8,_0x3ebb46=getCacheDir();!existsSync(_0x3ebb46)&&mkdirSync(_0x3ebb46,{'recursive':!![]});const _0x4aab17=getCacheFilePath(_0x50218c),_0x1dc588={'connections':_0x4fc446,'cachedAt':Date[_0x31709e(0xe7)]()};writeFileSync(_0x4aab17,JSON[_0x31709e(0xeb)](_0x1dc588,null,0x2),'utf-8');}export function clearConnectionCache(_0x5c4ad8){const _0x4a923d=getCacheFilePath(_0x5c4ad8);if(existsSync(_0x4a923d))try{unlinkSync(_0x4a923d);}catch{}}
1
+ function a46_0x45b8(){const _0x395507=['connections','6324590xkAmzK','stringify','46554ohzjvD','parse','39GNQkxu','475021ydJHpy','1908186VsiTOe','12023330fMEYON','9269144fJvCJs','utf-8','7028073bjZJIA','4tWpoTY','connections-','now','.json','7znEQWe'];a46_0x45b8=function(){return _0x395507;};return a46_0x45b8();}(function(_0x4810fe,_0x80fb13){const _0x641c54=a46_0x3a47,_0x4e2390=_0x4810fe();while(!![]){try{const _0x43caff=-parseInt(_0x641c54(0x1d8))/0x1+-parseInt(_0x641c54(0x1d5))/0x2*(-parseInt(_0x641c54(0x1d7))/0x3)+-parseInt(_0x641c54(0x1cd))/0x4*(-parseInt(_0x641c54(0x1d3))/0x5)+parseInt(_0x641c54(0x1d9))/0x6+-parseInt(_0x641c54(0x1d1))/0x7*(parseInt(_0x641c54(0x1db))/0x8)+-parseInt(_0x641c54(0x1cc))/0x9+parseInt(_0x641c54(0x1da))/0xa;if(_0x43caff===_0x80fb13)break;else _0x4e2390['push'](_0x4e2390['shift']());}catch(_0x18f56b){_0x4e2390['push'](_0x4e2390['shift']());}}}(a46_0x45b8,0xa462a));function a46_0x3a47(_0x3134c9,_0x529739){_0x3134c9=_0x3134c9-0x1cc;const _0x45b8e9=a46_0x45b8();let _0x3a471b=_0x45b8e9[_0x3134c9];return _0x3a471b;}import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x547cf1){const _0xbd7cf1=a46_0x3a47,_0x4d416d=_0x547cf1||'default';return join(getCacheDir(),_0xbd7cf1(0x1ce)+_0x4d416d+_0xbd7cf1(0x1d0));}export function loadCachedConnections(_0x238004){const _0x49c1b2=a46_0x3a47,_0x23fd7b=getCacheFilePath(_0x238004);if(!existsSync(_0x23fd7b))return null;try{const _0x4f8edc=readFileSync(_0x23fd7b,_0x49c1b2(0x1dc)),_0x14644d=JSON[_0x49c1b2(0x1d6)](_0x4f8edc);return _0x14644d[_0x49c1b2(0x1d2)];}catch{return null;}}export function saveCachedConnections(_0x3f4714,_0x5cf131){const _0x4de7c5=a46_0x3a47,_0x35a120=getCacheDir();!existsSync(_0x35a120)&&mkdirSync(_0x35a120,{'recursive':!![]});const _0x5f0a2c=getCacheFilePath(_0x3f4714),_0x1e11a7={'connections':_0x5cf131,'cachedAt':Date[_0x4de7c5(0x1cf)]()};writeFileSync(_0x5f0a2c,JSON[_0x4de7c5(0x1d4)](_0x1e11a7,null,0x2),_0x4de7c5(0x1dc));}export function clearConnectionCache(_0x15bb60){const _0x376878=getCacheFilePath(_0x15bb60);if(existsSync(_0x376878))try{unlinkSync(_0x376878);}catch{}}
@@ -1 +1 @@
1
- (function(_0xd4783,_0x2388e3){const _0x3641da=a47_0x28ba,_0x197e28=_0xd4783();while(!![]){try{const _0x166d8e=-parseInt(_0x3641da(0x158))/0x1+-parseInt(_0x3641da(0x157))/0x2+-parseInt(_0x3641da(0x153))/0x3+parseInt(_0x3641da(0x14e))/0x4*(parseInt(_0x3641da(0x156))/0x5)+parseInt(_0x3641da(0x14f))/0x6*(-parseInt(_0x3641da(0x155))/0x7)+-parseInt(_0x3641da(0x14d))/0x8+parseInt(_0x3641da(0x152))/0x9;if(_0x166d8e===_0x2388e3)break;else _0x197e28['push'](_0x197e28['shift']());}catch(_0x41d0d6){_0x197e28['push'](_0x197e28['shift']());}}}(a47_0x1404,0x19d56));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x41a74f,_0xa2a323){const _0x5d3a4e=a47_0x28ba,_0x2a30bd=_0x41a74f||_0x5d3a4e(0x15a),_0x211b0e=_0xa2a323||'__default_profile__';return _0x2a30bd+':'+_0x211b0e;}function a47_0x28ba(_0x22ccb8,_0x23e67c){_0x22ccb8=_0x22ccb8-0x14d;const _0x1404c7=a47_0x1404();let _0x28bab3=_0x1404c7[_0x22ccb8];return _0x28bab3;}export function getCachedCredential(_0x192215,_0x12a7bb){const _0x26c874=a47_0x28ba,_0x5193b6=getCacheKey(_0x192215,_0x12a7bb),_0x5aa05a=cache[_0x26c874(0x151)](_0x5193b6);if(!_0x5aa05a)return null;if(Date[_0x26c874(0x15c)]()-_0x5aa05a['loadedAt']>CACHE_TTL_MS)return cache[_0x26c874(0x159)](_0x5193b6),null;return _0x5aa05a[_0x26c874(0x150)];}export function setCachedCredential(_0x3a2612,_0x7dde9c,_0x2085fa){const _0x4b1a6f=a47_0x28ba,_0x5562db=getCacheKey(_0x7dde9c,_0x2085fa);cache[_0x4b1a6f(0x15b)](_0x5562db,{'apiKey':_0x3a2612,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x3ceb8d=a47_0x28ba;cache[_0x3ceb8d(0x154)]();}export function clearCachedCredential(_0x5363db,_0x226aad){const _0x4352cb=getCacheKey(_0x5363db,_0x226aad);cache['delete'](_0x4352cb);}function a47_0x1404(){const _0x331494=['4106448kgbJVN','244890GsTuXU','clear','164017gUDwKL','176705eqrxnm','47408miaXBu','69192iYzzAp','delete','__default_site__','set','now','1601128FJBOzs','16FPCkuJ','30JQKuJL','apiKey','get'];a47_0x1404=function(){return _0x331494;};return a47_0x1404();}
1
+ (function(_0x51a977,_0x222714){const _0x23a81a=a47_0xe08d,_0x3e38c5=_0x51a977();while(!![]){try{const _0x240923=parseInt(_0x23a81a(0x17e))/0x1+parseInt(_0x23a81a(0x180))/0x2+parseInt(_0x23a81a(0x176))/0x3*(-parseInt(_0x23a81a(0x179))/0x4)+parseInt(_0x23a81a(0x173))/0x5+parseInt(_0x23a81a(0x17c))/0x6+parseInt(_0x23a81a(0x175))/0x7+parseInt(_0x23a81a(0x178))/0x8*(-parseInt(_0x23a81a(0x17f))/0x9);if(_0x240923===_0x222714)break;else _0x3e38c5['push'](_0x3e38c5['shift']());}catch(_0x479bb6){_0x3e38c5['push'](_0x3e38c5['shift']());}}}(a47_0x5de4,0x3c5ae));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a47_0x5de4(){const _0x19a3df=['60RQXqZL','__default_profile__','loadedAt','2438502PIidjg','now','45413XOZgmi','19233OwWEZf','716330PEMDQN','clear','set','1926220ZBkRDb','__default_site__','2967307eDlEay','59403qrPKYr','delete','4024FCAmHl'];a47_0x5de4=function(){return _0x19a3df;};return a47_0x5de4();}function getCacheKey(_0x5c4e37,_0x570d40){const _0x1ce5c9=a47_0xe08d,_0x36f6bc=_0x5c4e37||_0x1ce5c9(0x174),_0x50364e=_0x570d40||_0x1ce5c9(0x17a);return _0x36f6bc+':'+_0x50364e;}export function getCachedCredential(_0x3cb829,_0x28d144){const _0xeaf6f8=a47_0xe08d,_0x546e19=getCacheKey(_0x3cb829,_0x28d144),_0x5acb42=cache['get'](_0x546e19);if(!_0x5acb42)return null;if(Date['now']()-_0x5acb42[_0xeaf6f8(0x17b)]>CACHE_TTL_MS)return cache[_0xeaf6f8(0x177)](_0x546e19),null;return _0x5acb42['apiKey'];}export function setCachedCredential(_0xecb2b2,_0x1ac7a9,_0x32369c){const _0x4d209b=a47_0xe08d,_0x34a13a=getCacheKey(_0x1ac7a9,_0x32369c);cache[_0x4d209b(0x182)](_0x34a13a,{'apiKey':_0xecb2b2,'loadedAt':Date[_0x4d209b(0x17d)]()});}function a47_0xe08d(_0x339863,_0x382187){_0x339863=_0x339863-0x173;const _0x5de4ff=a47_0x5de4();let _0xe08d27=_0x5de4ff[_0x339863];return _0xe08d27;}export function clearCredentialCache(){const _0x156cae=a47_0xe08d;cache[_0x156cae(0x181)]();}export function clearCachedCredential(_0x54e70a,_0x5d00de){const _0x1ad3a1=a47_0xe08d,_0x43226c=getCacheKey(_0x54e70a,_0x5d00de);cache[_0x1ad3a1(0x177)](_0x43226c);}
@@ -1 +1 @@
1
- const a48_0x519476=a48_0xb504;(function(_0x1ebd11,_0x1b00a8){const _0x5b26cd=a48_0xb504,_0x3410d1=_0x1ebd11();while(!![]){try{const _0x5f58bb=parseInt(_0x5b26cd(0x1bd))/0x1+parseInt(_0x5b26cd(0x1ae))/0x2*(parseInt(_0x5b26cd(0x1af))/0x3)+-parseInt(_0x5b26cd(0x1b1))/0x4+parseInt(_0x5b26cd(0x1b7))/0x5*(parseInt(_0x5b26cd(0x18b))/0x6)+parseInt(_0x5b26cd(0x1aa))/0x7+-parseInt(_0x5b26cd(0x192))/0x8*(-parseInt(_0x5b26cd(0x197))/0x9)+-parseInt(_0x5b26cd(0x182))/0xa;if(_0x5f58bb===_0x1b00a8)break;else _0x3410d1['push'](_0x3410d1['shift']());}catch(_0x44cbb0){_0x3410d1['push'](_0x3410d1['shift']());}}}(a48_0x176b,0x62ba6));function a48_0x176b(){const _0x5b6bb2=['config','Project','apiKey','parentSegment','log','cliFlags','.json','Profile\x20Credentials','llm_project','default','605101wagJef','globalCredentials',':\x20none','sessionId','2VWLjSb','365751WTeJEK','utf-8','629568RwXjHD','verbose','INFO','loadGlobalConfig','profileCredentials','getParameters','580NhGthT','parent_segment','llmProject','site','project','resolveAPIKeyAsync','721767WXMBwf','Session','Global','profile','toString','segmentPath','16135770bcglXh','[context]','segment_path','.env','CLI\x20flag:\x20--','injectIntoOptions','entries','existsSync','tdx.json','23694auQOmS','display','us01','getSource','join','activeProfile','string','1574296zskZHs','profiles','database','session','readFileSync','36HaLtDD','configFiles','layers','\x0a[configuration\x20files]',':\x20none\x20(using\x20session:\x20','global','Profile','logLevel','parse'];a48_0x176b=function(){return _0x5b6bb2;};return a48_0x176b();}import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a48_0xb504(_0xba10f4,_0x398603){_0xba10f4=_0xba10f4-0x17f;const _0x176b65=a48_0x176b();let _0xb5048a=_0x176b65[_0xba10f4];return _0xb5048a;}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x322a6 from'node:fs';import*as a48_0x194e36 from'node:path';export class GlobalContext{[a48_0x519476(0x1ba)];[a48_0x519476(0x194)];[a48_0x519476(0x1b8)];[a48_0x519476(0x184)];['llm_project'];['apiKey'];[a48_0x519476(0x1b2)];[a48_0x519476(0x19e)];['profile'];['layers'];[a48_0x519476(0x190)];[a48_0x519476(0x1ad)];[a48_0x519476(0x198)];constructor(_0x132f64){const _0x3d6ad9=a48_0x519476;this['sessionId']=_0x132f64[_0x3d6ad9(0x195)]||getCurrentSessionPID()[_0x3d6ad9(0x180)]();const _0x4b50a5=loadSessionContext(_0x132f64[_0x3d6ad9(0x195)]),_0x3fe58a=loadProjectConfig(),_0x4dd2f5=this[_0x3d6ad9(0x1b4)]();this[_0x3d6ad9(0x190)]=_0x132f64[_0x3d6ad9(0x17f)]||_0x4b50a5?.['profile']||_0x4dd2f5[_0x3d6ad9(0x17f)]||getActiveProfile();const _0x35bc2a=this['activeProfile']?loadProfile(this[_0x3d6ad9(0x190)]):null,_0x3de2d5=_0x1bd078=>{const _0x1d3199=_0x3d6ad9;if(!_0x1bd078)return{};const _0x2aba22=_0x1bd078,_0x9df060={};for(const [_0x5f59d4,_0x9ffff5]of Object[_0x1d3199(0x188)](_0x2aba22)){typeof _0x9ffff5===_0x1d3199(0x191)&&(_0x9df060[_0x5f59d4]=_0x9ffff5);}return _0x9df060;},_0x1124a6={};if(_0x132f64['site']&&_0x132f64['site']!==_0x3d6ad9(0x18d))_0x1124a6['site']=_0x132f64['site'];const _0x1673b8=_0x4b50a5?.[_0x3d6ad9(0x194)],_0x14eceb=_0x3fe58a?.['database'],_0x53dcee=_0x35bc2a?.['config']?.[_0x3d6ad9(0x194)],_0x467635=_0x4dd2f5[_0x3d6ad9(0x194)];_0x132f64[_0x3d6ad9(0x194)]&&(_0x132f64['database']!==_0x1673b8&&_0x132f64['database']!==_0x14eceb&&_0x132f64[_0x3d6ad9(0x194)]!==_0x53dcee&&_0x132f64[_0x3d6ad9(0x194)]!==_0x467635)&&(_0x1124a6['database']=_0x132f64['database']);if(_0x132f64[_0x3d6ad9(0x1a3)])_0x1124a6[_0x3d6ad9(0x1b8)]=_0x132f64[_0x3d6ad9(0x1a3)];if(_0x132f64['llmProject'])_0x1124a6[_0x3d6ad9(0x1a8)]=_0x132f64[_0x3d6ad9(0x1b9)];if(_0x132f64[_0x3d6ad9(0x17f)])_0x1124a6[_0x3d6ad9(0x17f)]=_0x132f64[_0x3d6ad9(0x17f)];this['layers']={'cliFlags':_0x1124a6,'session':_0x3de2d5(_0x4b50a5),'project':_0x3de2d5(_0x3fe58a),'profile':_0x3de2d5(_0x35bc2a?.[_0x3d6ad9(0x1a0)]),'global':_0x3de2d5(_0x4dd2f5)};const _0x49cefe={...this[_0x3d6ad9(0x199)][_0x3d6ad9(0x19c)],...this[_0x3d6ad9(0x199)][_0x3d6ad9(0x17f)],...this['layers'][_0x3d6ad9(0x1bb)],...this['layers'][_0x3d6ad9(0x195)],...this[_0x3d6ad9(0x199)][_0x3d6ad9(0x1a5)]},_0x351ee8=_0x49cefe['site']||_0x3d6ad9(0x18d);this[_0x3d6ad9(0x1ba)]=resolveSite(_0x351ee8),this[_0x3d6ad9(0x194)]=_0x49cefe['database'],this[_0x3d6ad9(0x1b8)]=_0x49cefe['parent_segment'],this[_0x3d6ad9(0x184)]=_0x49cefe[_0x3d6ad9(0x184)],this[_0x3d6ad9(0x1a8)]=_0x49cefe[_0x3d6ad9(0x1a8)],this[_0x3d6ad9(0x1b2)]=_0x132f64['verbose']||![],this[_0x3d6ad9(0x19e)]=_0x132f64[_0x3d6ad9(0x19e)]??LogLevel[_0x3d6ad9(0x1b3)],this[_0x3d6ad9(0x17f)]=this[_0x3d6ad9(0x190)]||undefined,this[_0x3d6ad9(0x1a2)]=getAPIKey(this[_0x3d6ad9(0x1ba)],this[_0x3d6ad9(0x190)]||undefined);const _0x118b04=getConfigDir(),_0xd93972=a48_0x194e36[_0x3d6ad9(0x18f)](_0x118b04,'sessions',this[_0x3d6ad9(0x1ad)]+_0x3d6ad9(0x1a6)),_0x305c82=findProjectConfigPath(),_0x3f5863=a48_0x194e36[_0x3d6ad9(0x18f)](_0x118b04,_0x3d6ad9(0x18a)),_0x4a29ae=a48_0x194e36[_0x3d6ad9(0x18f)](_0x118b04,_0x3d6ad9(0x185));let _0x47fbd2=null,_0x1bcb6c=null;this[_0x3d6ad9(0x190)]&&(_0x47fbd2=a48_0x194e36['join'](_0x118b04,_0x3d6ad9(0x193),this['activeProfile'],_0x3d6ad9(0x18a)),_0x1bcb6c=a48_0x194e36[_0x3d6ad9(0x18f)](_0x118b04,_0x3d6ad9(0x193),this['activeProfile'],_0x3d6ad9(0x185))),this[_0x3d6ad9(0x198)]={'session':a48_0x322a6[_0x3d6ad9(0x189)](_0xd93972)?_0xd93972:null,'project':_0x305c82,'profile':_0x47fbd2&&a48_0x322a6[_0x3d6ad9(0x189)](_0x47fbd2)?_0x47fbd2:null,'profileCredentials':_0x1bcb6c&&a48_0x322a6['existsSync'](_0x1bcb6c)?_0x1bcb6c:null,'global':a48_0x322a6[_0x3d6ad9(0x189)](_0x3f5863)?_0x3f5863:null,'globalCredentials':a48_0x322a6[_0x3d6ad9(0x189)](_0x4a29ae)?_0x4a29ae:null};}[a48_0x519476(0x18e)](_0x4c5517,_0x4c70a5){const _0x112070=a48_0x519476;if(!_0x4c70a5)return'not\x20set';const _0xfd9081=_0x4c70a5;if(this[_0x112070(0x199)][_0x112070(0x1a5)][_0x4c5517]===_0xfd9081){if(_0x4c5517===_0x112070(0x1ba)&&_0xfd9081===_0x112070(0x18d)&&!this['layers'][_0x112070(0x195)][_0x112070(0x1ba)]&&!this[_0x112070(0x199)]['project']['site']&&!this[_0x112070(0x199)][_0x112070(0x17f)][_0x112070(0x1ba)]&&!this['layers']['global'][_0x112070(0x1ba)])return _0x112070(0x1a9);return _0x112070(0x186)+_0x4c5517['replace'](/_/g,'-');}if(this[_0x112070(0x199)][_0x112070(0x195)][_0x4c5517]===_0xfd9081)return'session';if(this[_0x112070(0x199)][_0x112070(0x1bb)][_0x4c5517]===_0xfd9081)return _0x112070(0x1bb);if(this[_0x112070(0x199)][_0x112070(0x17f)][_0x4c5517]===_0xfd9081)return'profile:\x20'+this['activeProfile'];if(this[_0x112070(0x199)]['global'][_0x4c5517]===_0xfd9081)return _0x112070(0x19c);return'default';}['loadGlobalConfig'](){const _0x5b7f9c=a48_0x519476,_0x336dd8=a48_0x194e36[_0x5b7f9c(0x18f)](getConfigDir(),_0x5b7f9c(0x18a));if(!a48_0x322a6[_0x5b7f9c(0x189)](_0x336dd8))return{};try{const _0x176251=a48_0x322a6[_0x5b7f9c(0x196)](_0x336dd8,_0x5b7f9c(0x1b0));return JSON[_0x5b7f9c(0x19f)](_0x176251);}catch{return{};}}[a48_0x519476(0x187)](_0xc47201){const _0x47d48a=a48_0x519476;_0xc47201[_0x47d48a(0x1ba)]=this[_0x47d48a(0x1ba)],!_0xc47201[_0x47d48a(0x194)]&&this['database']&&(_0xc47201[_0x47d48a(0x194)]=this['database']),!_0xc47201[_0x47d48a(0x1a3)]&&this[_0x47d48a(0x1b8)]&&(_0xc47201['parentSegment']=this['parent_segment']),!_0xc47201[_0x47d48a(0x181)]&&this[_0x47d48a(0x184)]&&(_0xc47201[_0x47d48a(0x181)]=this[_0x47d48a(0x184)]),!_0xc47201[_0x47d48a(0x1b9)]&&this['llm_project']&&(_0xc47201[_0x47d48a(0x1b9)]=this[_0x47d48a(0x1a8)]);}['getParameters'](){const _0xf94347=a48_0x519476;return[{'key':_0xf94347(0x1ba),'value':this[_0xf94347(0x1ba)]},{'key':'database','value':this[_0xf94347(0x194)]},{'key':_0xf94347(0x1b8),'value':this['parent_segment']},{'key':_0xf94347(0x184),'value':this['segment_path']},{'key':'llm_project','value':this[_0xf94347(0x1a8)]},{'key':_0xf94347(0x17f),'value':this['activeProfile']||undefined}];}[a48_0x519476(0x18c)](){const _0x480e25=a48_0x519476;console[_0x480e25(0x1a4)](_0x480e25(0x183));for(const {key:_0x153ac4,value:_0x9364f6}of this[_0x480e25(0x1b6)]()){_0x9364f6&&console['log'](_0x153ac4+':\x20'+_0x9364f6);}}['displayWithSources'](){const _0x39d832=a48_0x519476;console['log'](_0x39d832(0x183));for(const {key:_0x3899bb,value:_0x44824f}of this['getParameters']()){if(_0x44824f){const _0x13afc9=_0x3899bb===_0x39d832(0x17f)?'(active)':'('+this[_0x39d832(0x18e)](_0x3899bb,_0x44824f)+')';console[_0x39d832(0x1a4)](_0x3899bb+':\x20'+_0x44824f+'\x20'+_0x13afc9);}}console[_0x39d832(0x1a4)](_0x39d832(0x19a));const _0x33975e=[{'label':_0x39d832(0x1be),'path':this[_0x39d832(0x198)][_0x39d832(0x195)],'extra':'(session:\x20'+this[_0x39d832(0x1ad)]+')'},{'label':_0x39d832(0x1a1),'path':this[_0x39d832(0x198)][_0x39d832(0x1bb)]},{'label':_0x39d832(0x19d),'path':this[_0x39d832(0x198)][_0x39d832(0x17f)]},{'label':_0x39d832(0x1a7),'path':this[_0x39d832(0x198)][_0x39d832(0x1b5)]},{'label':_0x39d832(0x1bf),'path':this[_0x39d832(0x198)]['global']},{'label':'Global\x20Credentials','path':this[_0x39d832(0x198)][_0x39d832(0x1ab)]}];for(const {label:_0x1c5c62,path:_0x52a870,extra:_0x3a1ee8}of _0x33975e){if(_0x52a870)console['log'](_0x1c5c62+':\x20'+_0x52a870+'\x20✓'+(_0x3a1ee8?'\x20'+_0x3a1ee8:''));else{if(_0x1c5c62===_0x39d832(0x1be))console[_0x39d832(0x1a4)](_0x1c5c62+_0x39d832(0x19b)+this[_0x39d832(0x1ad)]+')');else(_0x1c5c62===_0x39d832(0x1a1)||_0x1c5c62===_0x39d832(0x1bf))&&console[_0x39d832(0x1a4)](_0x1c5c62+_0x39d832(0x1ac));}}}async[a48_0x519476(0x1bc)](){const _0x762fa=a48_0x519476;return this[_0x762fa(0x1a2)]=await getAPIKeyAsync(this[_0x762fa(0x1ba)],this[_0x762fa(0x190)]||undefined),this[_0x762fa(0x1a2)];}static async['createAsync'](_0x46d15a){const _0x2e29a3=new GlobalContext(_0x46d15a);return await _0x2e29a3['resolveAPIKeyAsync'](),_0x2e29a3;}}
1
+ function a48_0x5ba6(){const _0x143e8b=['Project','INFO','site','session','(active)','database','injectIntoOptions','Global\x20Credentials','profile','Profile\x20Credentials','join','930dGqbBJ','default','verbose','9rQOVed','apiKey','getSource','Profile','754ifCKpd','layers','entries','segment_path','createAsync','readFileSync','cliFlags','us01','existsSync','project','Global','1444360fATWDD','\x0a[configuration\x20files]','global','sessions','segmentPath','not\x20set','454321vNqYEm','1743216pecpbV',':\x20none','llm_project','utf-8','logLevel','configFiles','string','profiles','profile:\x20','config','[context]','loadGlobalConfig','parse',':\x20none\x20(using\x20session:\x20','displayWithSources','getParameters','resolveAPIKeyAsync','parent_segment','replace','activeProfile','CLI\x20flag:\x20--','219oqIAkO','.env','parentSegment','tdx.json','sessionId','llmProject','4125uWWCel','1096260ukSkBy','(session:\x20','log','926541rthSww'];a48_0x5ba6=function(){return _0x143e8b;};return a48_0x5ba6();}const a48_0x6bb0aa=a48_0x4786;(function(_0x29bdac,_0x1b96cc){const _0x49c41a=a48_0x4786,_0x59df74=_0x29bdac();while(!![]){try{const _0x45c9cf=-parseInt(_0x49c41a(0x119))/0x1*(-parseInt(_0x49c41a(0xf2))/0x2)+-parseInt(_0x49c41a(0x123))/0x3+parseInt(_0x49c41a(0x120))/0x4+-parseInt(_0x49c41a(0x11f))/0x5*(-parseInt(_0x49c41a(0x12f))/0x6)+parseInt(_0x49c41a(0x103))/0x7+parseInt(_0x49c41a(0x104))/0x8*(-parseInt(_0x49c41a(0x132))/0x9)+parseInt(_0x49c41a(0xfd))/0xa;if(_0x45c9cf===_0x1b96cc)break;else _0x59df74['push'](_0x59df74['shift']());}catch(_0x192e29){_0x59df74['push'](_0x59df74['shift']());}}}(a48_0x5ba6,0x28cb5));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a48_0x4786(_0x5d5dbd,_0x25166b){_0x5d5dbd=_0x5d5dbd-0xf2;const _0x5ba642=a48_0x5ba6();let _0x478661=_0x5ba642[_0x5d5dbd];return _0x478661;}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x23e2a1 from'node:fs';import*as a48_0x4ad2b6 from'node:path';export class GlobalContext{['site'];[a48_0x6bb0aa(0x129)];['parent_segment'];[a48_0x6bb0aa(0xf5)];[a48_0x6bb0aa(0x106)];[a48_0x6bb0aa(0x133)];[a48_0x6bb0aa(0x131)];[a48_0x6bb0aa(0x108)];[a48_0x6bb0aa(0x12c)];['layers'];[a48_0x6bb0aa(0x117)];[a48_0x6bb0aa(0x11d)];[a48_0x6bb0aa(0x109)];constructor(_0x46842a){const _0x21f7d0=a48_0x6bb0aa;this['sessionId']=_0x46842a[_0x21f7d0(0x127)]||getCurrentSessionPID()['toString']();const _0x7bd2f1=loadSessionContext(_0x46842a[_0x21f7d0(0x127)]),_0x312007=loadProjectConfig(),_0x5e59c1=this[_0x21f7d0(0x10f)]();this[_0x21f7d0(0x117)]=_0x46842a[_0x21f7d0(0x12c)]||_0x7bd2f1?.[_0x21f7d0(0x12c)]||_0x5e59c1[_0x21f7d0(0x12c)]||getActiveProfile();const _0x394636=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x385a4c=_0x31675f=>{const _0x4d53f2=_0x21f7d0;if(!_0x31675f)return{};const _0x5bfa90=_0x31675f,_0x55d842={};for(const [_0x39cc57,_0x38e338]of Object[_0x4d53f2(0xf4)](_0x5bfa90)){typeof _0x38e338===_0x4d53f2(0x10a)&&(_0x55d842[_0x39cc57]=_0x38e338);}return _0x55d842;},_0x9d0b7e={};if(_0x46842a[_0x21f7d0(0x126)]&&_0x46842a[_0x21f7d0(0x126)]!==_0x21f7d0(0xf9))_0x9d0b7e[_0x21f7d0(0x126)]=_0x46842a[_0x21f7d0(0x126)];const _0x284eb7=_0x7bd2f1?.['database'],_0x13a9ea=_0x312007?.[_0x21f7d0(0x129)],_0x414525=_0x394636?.[_0x21f7d0(0x10d)]?.[_0x21f7d0(0x129)],_0x333e30=_0x5e59c1[_0x21f7d0(0x129)];_0x46842a['database']&&(_0x46842a[_0x21f7d0(0x129)]!==_0x284eb7&&_0x46842a[_0x21f7d0(0x129)]!==_0x13a9ea&&_0x46842a[_0x21f7d0(0x129)]!==_0x414525&&_0x46842a[_0x21f7d0(0x129)]!==_0x333e30)&&(_0x9d0b7e[_0x21f7d0(0x129)]=_0x46842a[_0x21f7d0(0x129)]);if(_0x46842a[_0x21f7d0(0x11b)])_0x9d0b7e[_0x21f7d0(0x115)]=_0x46842a[_0x21f7d0(0x11b)];if(_0x46842a[_0x21f7d0(0x11e)])_0x9d0b7e[_0x21f7d0(0x106)]=_0x46842a[_0x21f7d0(0x11e)];if(_0x46842a[_0x21f7d0(0x12c)])_0x9d0b7e['profile']=_0x46842a[_0x21f7d0(0x12c)];this[_0x21f7d0(0xf3)]={'cliFlags':_0x9d0b7e,'session':_0x385a4c(_0x7bd2f1),'project':_0x385a4c(_0x312007),'profile':_0x385a4c(_0x394636?.['config']),'global':_0x385a4c(_0x5e59c1)};const _0x33f5c9={...this[_0x21f7d0(0xf3)][_0x21f7d0(0xff)],...this[_0x21f7d0(0xf3)][_0x21f7d0(0x12c)],...this[_0x21f7d0(0xf3)][_0x21f7d0(0xfb)],...this['layers'][_0x21f7d0(0x127)],...this[_0x21f7d0(0xf3)][_0x21f7d0(0xf8)]},_0x22220c=_0x33f5c9[_0x21f7d0(0x126)]||_0x21f7d0(0xf9);this[_0x21f7d0(0x126)]=resolveSite(_0x22220c),this[_0x21f7d0(0x129)]=_0x33f5c9[_0x21f7d0(0x129)],this[_0x21f7d0(0x115)]=_0x33f5c9[_0x21f7d0(0x115)],this[_0x21f7d0(0xf5)]=_0x33f5c9['segment_path'],this['llm_project']=_0x33f5c9['llm_project'],this[_0x21f7d0(0x131)]=_0x46842a['verbose']||![],this[_0x21f7d0(0x108)]=_0x46842a[_0x21f7d0(0x108)]??LogLevel[_0x21f7d0(0x125)],this['profile']=this[_0x21f7d0(0x117)]||undefined,this[_0x21f7d0(0x133)]=getAPIKey(this[_0x21f7d0(0x126)],this[_0x21f7d0(0x117)]||undefined);const _0x29ad12=getConfigDir(),_0x1716be=a48_0x4ad2b6[_0x21f7d0(0x12e)](_0x29ad12,_0x21f7d0(0x100),this['sessionId']+'.json'),_0x329146=findProjectConfigPath(),_0x42ce86=a48_0x4ad2b6[_0x21f7d0(0x12e)](_0x29ad12,_0x21f7d0(0x11c)),_0x417a76=a48_0x4ad2b6[_0x21f7d0(0x12e)](_0x29ad12,_0x21f7d0(0x11a));let _0x369493=null,_0x3ebe73=null;this[_0x21f7d0(0x117)]&&(_0x369493=a48_0x4ad2b6['join'](_0x29ad12,'profiles',this['activeProfile'],'tdx.json'),_0x3ebe73=a48_0x4ad2b6[_0x21f7d0(0x12e)](_0x29ad12,_0x21f7d0(0x10b),this[_0x21f7d0(0x117)],_0x21f7d0(0x11a))),this[_0x21f7d0(0x109)]={'session':a48_0x23e2a1['existsSync'](_0x1716be)?_0x1716be:null,'project':_0x329146,'profile':_0x369493&&a48_0x23e2a1[_0x21f7d0(0xfa)](_0x369493)?_0x369493:null,'profileCredentials':_0x3ebe73&&a48_0x23e2a1[_0x21f7d0(0xfa)](_0x3ebe73)?_0x3ebe73:null,'global':a48_0x23e2a1['existsSync'](_0x42ce86)?_0x42ce86:null,'globalCredentials':a48_0x23e2a1['existsSync'](_0x417a76)?_0x417a76:null};}[a48_0x6bb0aa(0x134)](_0x7a80b5,_0x4d757a){const _0x6151f2=a48_0x6bb0aa;if(!_0x4d757a)return _0x6151f2(0x102);const _0x54fc85=_0x4d757a;if(this['layers'][_0x6151f2(0xf8)][_0x7a80b5]===_0x54fc85){if(_0x7a80b5==='site'&&_0x54fc85===_0x6151f2(0xf9)&&!this[_0x6151f2(0xf3)][_0x6151f2(0x127)][_0x6151f2(0x126)]&&!this[_0x6151f2(0xf3)][_0x6151f2(0xfb)][_0x6151f2(0x126)]&&!this[_0x6151f2(0xf3)][_0x6151f2(0x12c)][_0x6151f2(0x126)]&&!this[_0x6151f2(0xf3)][_0x6151f2(0xff)][_0x6151f2(0x126)])return _0x6151f2(0x130);return _0x6151f2(0x118)+_0x7a80b5[_0x6151f2(0x116)](/_/g,'-');}if(this[_0x6151f2(0xf3)][_0x6151f2(0x127)][_0x7a80b5]===_0x54fc85)return'session';if(this[_0x6151f2(0xf3)]['project'][_0x7a80b5]===_0x54fc85)return _0x6151f2(0xfb);if(this[_0x6151f2(0xf3)]['profile'][_0x7a80b5]===_0x54fc85)return _0x6151f2(0x10c)+this[_0x6151f2(0x117)];if(this[_0x6151f2(0xf3)][_0x6151f2(0xff)][_0x7a80b5]===_0x54fc85)return _0x6151f2(0xff);return _0x6151f2(0x130);}[a48_0x6bb0aa(0x10f)](){const _0x3534c3=a48_0x6bb0aa,_0x2ffc51=a48_0x4ad2b6[_0x3534c3(0x12e)](getConfigDir(),_0x3534c3(0x11c));if(!a48_0x23e2a1[_0x3534c3(0xfa)](_0x2ffc51))return{};try{const _0x17f1f8=a48_0x23e2a1[_0x3534c3(0xf7)](_0x2ffc51,_0x3534c3(0x107));return JSON[_0x3534c3(0x110)](_0x17f1f8);}catch{return{};}}[a48_0x6bb0aa(0x12a)](_0x50f84c){const _0x2555a0=a48_0x6bb0aa;_0x50f84c[_0x2555a0(0x126)]=this[_0x2555a0(0x126)],!_0x50f84c['database']&&this[_0x2555a0(0x129)]&&(_0x50f84c[_0x2555a0(0x129)]=this[_0x2555a0(0x129)]),!_0x50f84c[_0x2555a0(0x11b)]&&this[_0x2555a0(0x115)]&&(_0x50f84c[_0x2555a0(0x11b)]=this[_0x2555a0(0x115)]),!_0x50f84c[_0x2555a0(0x101)]&&this[_0x2555a0(0xf5)]&&(_0x50f84c[_0x2555a0(0x101)]=this['segment_path']),!_0x50f84c['llmProject']&&this[_0x2555a0(0x106)]&&(_0x50f84c['llmProject']=this[_0x2555a0(0x106)]);}[a48_0x6bb0aa(0x113)](){const _0x5a21d1=a48_0x6bb0aa;return[{'key':'site','value':this[_0x5a21d1(0x126)]},{'key':'database','value':this[_0x5a21d1(0x129)]},{'key':'parent_segment','value':this['parent_segment']},{'key':_0x5a21d1(0xf5),'value':this[_0x5a21d1(0xf5)]},{'key':_0x5a21d1(0x106),'value':this[_0x5a21d1(0x106)]},{'key':_0x5a21d1(0x12c),'value':this['activeProfile']||undefined}];}['display'](){const _0x55ee55=a48_0x6bb0aa;console['log'](_0x55ee55(0x10e));for(const {key:_0x434b51,value:_0x3651a2}of this[_0x55ee55(0x113)]()){_0x3651a2&&console[_0x55ee55(0x122)](_0x434b51+':\x20'+_0x3651a2);}}[a48_0x6bb0aa(0x112)](){const _0x4a0886=a48_0x6bb0aa;console[_0x4a0886(0x122)](_0x4a0886(0x10e));for(const {key:_0x34105a,value:_0x17bc34}of this[_0x4a0886(0x113)]()){if(_0x17bc34){const _0xac2fab=_0x34105a===_0x4a0886(0x12c)?_0x4a0886(0x128):'('+this['getSource'](_0x34105a,_0x17bc34)+')';console[_0x4a0886(0x122)](_0x34105a+':\x20'+_0x17bc34+'\x20'+_0xac2fab);}}console[_0x4a0886(0x122)](_0x4a0886(0xfe));const _0x2df1d1=[{'label':'Session','path':this[_0x4a0886(0x109)][_0x4a0886(0x127)],'extra':_0x4a0886(0x121)+this[_0x4a0886(0x11d)]+')'},{'label':_0x4a0886(0x124),'path':this[_0x4a0886(0x109)]['project']},{'label':_0x4a0886(0x135),'path':this[_0x4a0886(0x109)][_0x4a0886(0x12c)]},{'label':_0x4a0886(0x12d),'path':this[_0x4a0886(0x109)]['profileCredentials']},{'label':_0x4a0886(0xfc),'path':this[_0x4a0886(0x109)][_0x4a0886(0xff)]},{'label':_0x4a0886(0x12b),'path':this[_0x4a0886(0x109)]['globalCredentials']}];for(const {label:_0xd0cf75,path:_0x356241,extra:_0x21e9b1}of _0x2df1d1){if(_0x356241)console[_0x4a0886(0x122)](_0xd0cf75+':\x20'+_0x356241+'\x20✓'+(_0x21e9b1?'\x20'+_0x21e9b1:''));else{if(_0xd0cf75==='Session')console[_0x4a0886(0x122)](_0xd0cf75+_0x4a0886(0x111)+this['sessionId']+')');else(_0xd0cf75===_0x4a0886(0x124)||_0xd0cf75==='Global')&&console[_0x4a0886(0x122)](_0xd0cf75+_0x4a0886(0x105));}}}async[a48_0x6bb0aa(0x114)](){const _0x297c0c=a48_0x6bb0aa;return this[_0x297c0c(0x133)]=await getAPIKeyAsync(this[_0x297c0c(0x126)],this['activeProfile']||undefined),this[_0x297c0c(0x133)];}static async[a48_0x6bb0aa(0xf6)](_0x1c2ad1){const _0x2093e9=new GlobalContext(_0x1c2ad1);return await _0x2093e9['resolveAPIKeyAsync'](),_0x2093e9;}}
@@ -1 +1 @@
1
- const a49_0x497d0e=a49_0x2183;(function(_0x2b0831,_0x223410){const _0x1e355b=a49_0x2183,_0x3ced64=_0x2b0831();while(!![]){try{const _0x5e44a6=-parseInt(_0x1e355b(0x83))/0x1*(-parseInt(_0x1e355b(0x78))/0x2)+parseInt(_0x1e355b(0x89))/0x3+parseInt(_0x1e355b(0x6a))/0x4+-parseInt(_0x1e355b(0x6c))/0x5*(parseInt(_0x1e355b(0x75))/0x6)+-parseInt(_0x1e355b(0x73))/0x7+parseInt(_0x1e355b(0x6d))/0x8+parseInt(_0x1e355b(0x84))/0x9*(-parseInt(_0x1e355b(0x87))/0xa);if(_0x5e44a6===_0x223410)break;else _0x3ced64['push'](_0x3ced64['shift']());}catch(_0x50a76a){_0x3ced64['push'](_0x3ced64['shift']());}}}(a49_0x56e6,0xeac33));const SERVICE_NAME=a49_0x497d0e(0x70);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x5c7f8f=a49_0x497d0e;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x129259=await import(_0x5c7f8f(0x79));return keyringModule=_0x129259[_0x5c7f8f(0x7a)],keyringModule;}catch(_0x154a63){return keyringLoadError=_0x154a63 instanceof Error?_0x154a63:new Error(String(_0x154a63)),null;}}function getAccountName(_0x2fd148){const _0x1384d2=a49_0x497d0e,_0x4eebdc=_0x2fd148||'';return _0x1384d2(0x7d)+_0x4eebdc+_0x1384d2(0x86);}export async function getKeychainAPIKey(_0x443ad8){const _0x39bb9c=a49_0x497d0e,_0x5463eb=await getKeychainAPIKeyWithStatus(_0x443ad8);if(_0x5463eb['success'])return _0x5463eb[_0x39bb9c(0x82)];return _0x5463eb[_0x39bb9c(0x71)]==='access_denied'&&console[_0x39bb9c(0x88)](_0x39bb9c(0x80)+_0x5463eb[_0x39bb9c(0x7b)]),null;}export async function getKeychainAPIKeyWithStatus(_0x2232f4){const _0x5e8805=a49_0x497d0e;try{const _0x189603=await getKeyring();if(!_0x189603)return{'success':![],'reason':_0x5e8805(0x77)};const _0x5cf19a=getAccountName(_0x2232f4),_0x2f1490=await _0x189603['getPassword'](SERVICE_NAME,_0x5cf19a);if(_0x2f1490)return{'success':!![],'value':_0x2f1490};return{'success':![],'reason':_0x5e8805(0x76)};}catch(_0x2e537f){const _0x23481e=_0x2e537f instanceof Error?_0x2e537f['message']:String(_0x2e537f);if(_0x23481e[_0x5e8805(0x69)](_0x5e8805(0x72))||_0x23481e['toLowerCase']()[_0x5e8805(0x69)]('could\x20not\x20be\x20found')||_0x23481e[_0x5e8805(0x6b)]()[_0x5e8805(0x69)]('not\x20found'))return{'success':![],'reason':_0x5e8805(0x76)};if(_0x23481e[_0x5e8805(0x69)](_0x5e8805(0x7e))||_0x23481e[_0x5e8805(0x6b)]()[_0x5e8805(0x69)](_0x5e8805(0x6e))||_0x23481e[_0x5e8805(0x6b)]()['includes'](_0x5e8805(0x6f)))return{'success':![],'reason':'access_denied','message':_0x5e8805(0x7f)};return{'success':![],'reason':'unavailable','message':_0x23481e};}}function a49_0x2183(_0x45f299,_0x29c570){_0x45f299=_0x45f299-0x69;const _0x56e61e=a49_0x56e6();let _0x218380=_0x56e61e[_0x45f299];return _0x218380;}export async function saveKeychainAPIKey(_0xf437d3,_0x5ea69f){const _0x54d251=a49_0x497d0e,_0x28f38e=await getKeyring();if(!_0x28f38e)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x3c9aa9=getAccountName(_0x5ea69f);await _0x28f38e[_0x54d251(0x85)](SERVICE_NAME,_0x3c9aa9,_0xf437d3);}function a49_0x56e6(){const _0x31b984=['4465120GxrlWN','toLowerCase','55DQXIjP','3618072nRsfNM','restricted','access','tdx','reason','-25300','2456475qIORil','cannot\x20find','430908FqArGH','not_found','unavailable','2INGbsB','@zowe/secrets-for-zowe-sdk','keyring','message','getPassword','profile:','-25293','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.','Warning:\x20','not\x20supported','value','1505963snGdfS','36iUESQL','setPassword',':api_key','6303130VqLIxL','error','4647780fvnOeR','includes'];a49_0x56e6=function(){return _0x31b984;};return a49_0x56e6();}export async function deleteKeychainAPIKey(_0x3753e1){try{const _0x3bc79d=await getKeyring();if(!_0x3bc79d)return![];const _0x448af4=getAccountName(_0x3753e1);return await _0x3bc79d['deletePassword'](SERVICE_NAME,_0x448af4);}catch{return![];}}export async function isKeychainAvailable(){const _0x1b816e=a49_0x497d0e;try{const _0x13ddc2=await getKeyring();if(!_0x13ddc2)return![];return await _0x13ddc2[_0x1b816e(0x7c)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x46ab05){const _0x44e518=_0x46ab05 instanceof Error?_0x46ab05['message']['toLowerCase']():'';if(_0x44e518[_0x1b816e(0x69)]('not\x20available')||_0x44e518[_0x1b816e(0x69)](_0x1b816e(0x81))||_0x44e518[_0x1b816e(0x69)](_0x1b816e(0x74)))return![];return!![];}}
1
+ const a49_0x408b6d=a49_0x48d9;function a49_0x1278(){const _0x15875b=['not\x20available','setPassword','-25300',':api_key','reason','success','unavailable','-25293','access','30WeTnZA','954759jhtRxu','could\x20not\x20be\x20found','tdx','382041VTlZEk','90KPJSCw','12aaoqqM','852ouBONn','not\x20supported','keyring','restricted','error','not\x20found','not_found','374950GgVEyr','deletePassword','101045lbYdzB','profile:','getPassword','includes','access_denied','1655648sRKNRv','toLowerCase','5021269TsykVW','2105DGPiYR','cannot\x20find','2xrcfuH','System\x20keychain\x20is\x20not\x20available'];a49_0x1278=function(){return _0x15875b;};return a49_0x1278();}(function(_0x2c97d2,_0x55f4b5){const _0x48b927=a49_0x48d9,_0x539cd8=_0x2c97d2();while(!![]){try{const _0x45b0e8=parseInt(_0x48b927(0x1cd))/0x1+-parseInt(_0x48b927(0x1be))/0x2*(parseInt(_0x48b927(0x1ca))/0x3)+parseInt(_0x48b927(0x1d0))/0x4*(parseInt(_0x48b927(0x1bc))/0x5)+-parseInt(_0x48b927(0x1c9))/0x6*(parseInt(_0x48b927(0x1b4))/0x7)+parseInt(_0x48b927(0x1b9))/0x8+parseInt(_0x48b927(0x1ce))/0x9*(parseInt(_0x48b927(0x1d7))/0xa)+parseInt(_0x48b927(0x1bb))/0xb*(-parseInt(_0x48b927(0x1cf))/0xc);if(_0x45b0e8===_0x55f4b5)break;else _0x539cd8['push'](_0x539cd8['shift']());}catch(_0xfaff12){_0x539cd8['push'](_0x539cd8['shift']());}}}(a49_0x1278,0x32779));const SERVICE_NAME=a49_0x408b6d(0x1cc);function a49_0x48d9(_0x4c4e0e,_0x3a0e07){_0x4c4e0e=_0x4c4e0e-0x1b3;const _0x1278fb=a49_0x1278();let _0x48d9af=_0x1278fb[_0x4c4e0e];return _0x48d9af;}let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x3a8f32=a49_0x408b6d;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x10cb8d=await import('@zowe/secrets-for-zowe-sdk');return keyringModule=_0x10cb8d[_0x3a8f32(0x1d2)],keyringModule;}catch(_0x2314d9){return keyringLoadError=_0x2314d9 instanceof Error?_0x2314d9:new Error(String(_0x2314d9)),null;}}function getAccountName(_0x155f41){const _0x255eeb=a49_0x408b6d,_0xf52540=_0x155f41||'';return _0x255eeb(0x1b5)+_0xf52540+_0x255eeb(0x1c3);}export async function getKeychainAPIKey(_0x2a0b79){const _0x3ab492=a49_0x408b6d,_0x442075=await getKeychainAPIKeyWithStatus(_0x2a0b79);if(_0x442075[_0x3ab492(0x1c5)])return _0x442075['value'];return _0x442075[_0x3ab492(0x1c4)]===_0x3ab492(0x1b8)&&console[_0x3ab492(0x1d4)]('Warning:\x20'+_0x442075['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x58af90){const _0x26f7cb=a49_0x408b6d;try{const _0xbead3e=await getKeyring();if(!_0xbead3e)return{'success':![],'reason':'unavailable'};const _0x410e25=getAccountName(_0x58af90),_0x1b3fd2=await _0xbead3e[_0x26f7cb(0x1b6)](SERVICE_NAME,_0x410e25);if(_0x1b3fd2)return{'success':!![],'value':_0x1b3fd2};return{'success':![],'reason':_0x26f7cb(0x1d6)};}catch(_0x121085){const _0x42ba57=_0x121085 instanceof Error?_0x121085['message']:String(_0x121085);if(_0x42ba57[_0x26f7cb(0x1b7)](_0x26f7cb(0x1c2))||_0x42ba57[_0x26f7cb(0x1ba)]()[_0x26f7cb(0x1b7)](_0x26f7cb(0x1cb))||_0x42ba57[_0x26f7cb(0x1ba)]()['includes'](_0x26f7cb(0x1d5)))return{'success':![],'reason':_0x26f7cb(0x1d6)};if(_0x42ba57['includes'](_0x26f7cb(0x1c7))||_0x42ba57[_0x26f7cb(0x1ba)]()[_0x26f7cb(0x1b7)](_0x26f7cb(0x1d3))||_0x42ba57[_0x26f7cb(0x1ba)]()[_0x26f7cb(0x1b7)](_0x26f7cb(0x1c8)))return{'success':![],'reason':_0x26f7cb(0x1b8),'message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x26f7cb(0x1c6),'message':_0x42ba57};}}export async function saveKeychainAPIKey(_0x9590a6,_0x2faf8e){const _0x31dab4=a49_0x408b6d,_0x12bc4e=await getKeyring();if(!_0x12bc4e)throw new Error(_0x31dab4(0x1bf));const _0x4d3a22=getAccountName(_0x2faf8e);await _0x12bc4e[_0x31dab4(0x1c1)](SERVICE_NAME,_0x4d3a22,_0x9590a6);}export async function deleteKeychainAPIKey(_0x2a6863){const _0xcdea08=a49_0x408b6d;try{const _0x4eaa5c=await getKeyring();if(!_0x4eaa5c)return![];const _0xf5c7ed=getAccountName(_0x2a6863);return await _0x4eaa5c[_0xcdea08(0x1b3)](SERVICE_NAME,_0xf5c7ed);}catch{return![];}}export async function isKeychainAvailable(){const _0x21aec0=a49_0x408b6d;try{const _0x27bb55=await getKeyring();if(!_0x27bb55)return![];return await _0x27bb55[_0x21aec0(0x1b6)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x40c932){const _0x7be1b1=_0x40c932 instanceof Error?_0x40c932['message'][_0x21aec0(0x1ba)]():'';if(_0x7be1b1[_0x21aec0(0x1b7)](_0x21aec0(0x1c0))||_0x7be1b1['includes'](_0x21aec0(0x1d1))||_0x7be1b1['includes'](_0x21aec0(0x1bd)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x30af85,_0x389305){const _0x3b58bf=a50_0x4c9a,_0x7c7fa5=_0x30af85();while(!![]){try{const _0x54d020=-parseInt(_0x3b58bf(0x196))/0x1+-parseInt(_0x3b58bf(0x191))/0x2+parseInt(_0x3b58bf(0x194))/0x3+parseInt(_0x3b58bf(0x15a))/0x4+parseInt(_0x3b58bf(0x163))/0x5*(-parseInt(_0x3b58bf(0x18e))/0x6)+parseInt(_0x3b58bf(0x155))/0x7*(parseInt(_0x3b58bf(0x182))/0x8)+parseInt(_0x3b58bf(0x164))/0x9;if(_0x54d020===_0x389305)break;else _0x7c7fa5['push'](_0x7c7fa5['shift']());}catch(_0x1f460e){_0x7c7fa5['push'](_0x7c7fa5['shift']());}}}(a50_0x4e8f,0x320cd));import*as a50_0x127d92 from'node:fs';import*as a50_0x50dba2 from'node:path';function a50_0x4c9a(_0x212949,_0x1c07c7){_0x212949=_0x212949-0x154;const _0x4e8fd6=a50_0x4e8f();let _0x4c9aa5=_0x4e8fd6[_0x212949];return _0x4c9aa5;}import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';function a50_0x4e8f(){const _0x178ea2=['length','local','string','\x20already\x20exists','\x22\x20\x22','isDirectory','object','sort','Error:\x20',',\x20creating\x20new\x20file','set','6FQEbBu','llm_project','parse','199986aYjnZi','warn','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','610770IQYAxS','entries','268951MlIBtD','tdx.json','filter','existsSync','directory','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','database','7YxuYzX','\x20\x201.\x20Edit:\x20','profiles','toISOString','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','588144CxqXvw','.env','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','utf-8','readFileSync','user','test','Invalid\x20profile\x20name:\x20','To\x20migrate:','1290145dzvuHD','1026981ajCXBg','rmSync','site','description','push','map','Profile\x20\x27',':\x20Invalid\x20JSON\x20syntax','\x0aWarning:\x20Failed\x20to\x20parse\x20','values','from','message','readdirSync','find','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','llm_agent','keys','parent_segment','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20\x20mv\x20\x22','name','Profile\x20','includes','has','\x27\x20will\x20be\x20ignored','\x27:\x20config\x20must\x20be\x20an\x20object','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','join','profile','\x20does\x20not\x20exist','2937944pUHhGl'];a50_0x4e8f=function(){return _0x178ea2;};return a50_0x4e8f();}export function getProfileParams(_0x1eb09c){const _0x3e3fdb={};if(!_0x1eb09c)return _0x3e3fdb;for(const [_0x33cafe,_0x59e923]of Object['entries'](_0x1eb09c)){_0x33cafe!=='description'&&_0x59e923!==undefined&&(_0x3e3fdb[_0x33cafe]=_0x59e923);}return _0x3e3fdb;}export function getProfilesDir(){const _0x237933=a50_0x4c9a;return a50_0x50dba2[_0x237933(0x17f)](getConfigDir(),_0x237933(0x157));}function getProfileDir(_0x4b3271){const _0x1c17bb=a50_0x4c9a;return a50_0x50dba2[_0x1c17bb(0x17f)](getProfilesDir(),_0x4b3271);}function getProfileConfigPath(_0x579c89){const _0xba03a7=a50_0x4c9a;return a50_0x50dba2['join'](getProfileDir(_0x579c89),_0xba03a7(0x197));}function getProfileEnvPath(_0x4be6de){const _0x405cba=a50_0x4c9a;return a50_0x50dba2[_0x405cba(0x17f)](getProfileDir(_0x4be6de),_0x405cba(0x15b));}function getGlobalConfigPath(){const _0x5c1d7c=a50_0x4c9a;return a50_0x50dba2[_0x5c1d7c(0x17f)](getConfigDir(),_0x5c1d7c(0x197));}function validateProfileName(_0x50143b){const _0x133cf4=a50_0x4c9a;if(!/^[a-zA-Z0-9_-]+$/[_0x133cf4(0x160)](_0x50143b))throw new Error(_0x133cf4(0x161)+_0x50143b+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x3cfc76,_0x35eff1){const _0x20d4a3=a50_0x4c9a;if(typeof _0x3cfc76!==_0x20d4a3(0x189)||_0x3cfc76===null)throw new Error('Profile\x20\x27'+_0x35eff1+_0x20d4a3(0x17d));const _0xd388a=['description',_0x20d4a3(0x166),_0x20d4a3(0x154),'parent_segment',_0x20d4a3(0x18f),_0x20d4a3(0x173)],_0xe1c2e0=_0x3cfc76;for(const _0x5802c4 of Object[_0x20d4a3(0x174)](_0xe1c2e0)){!_0xd388a[_0x20d4a3(0x17a)](_0x5802c4)&&console['warn']('Warning:\x20Profile\x20\x27'+_0x35eff1+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x5802c4+_0x20d4a3(0x17c));}if(_0xe1c2e0[_0x20d4a3(0x167)]!==undefined&&typeof _0xe1c2e0['description']!==_0x20d4a3(0x185))throw new Error(_0x20d4a3(0x16a)+_0x35eff1+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0xe1c2e0['site']!==undefined&&typeof _0xe1c2e0[_0x20d4a3(0x166)]!==_0x20d4a3(0x185))throw new Error(_0x20d4a3(0x16a)+_0x35eff1+_0x20d4a3(0x172));if(_0xe1c2e0[_0x20d4a3(0x154)]!==undefined&&typeof _0xe1c2e0[_0x20d4a3(0x154)]!==_0x20d4a3(0x185))throw new Error(_0x20d4a3(0x16a)+_0x35eff1+_0x20d4a3(0x17e));if(_0xe1c2e0['parent_segment']!==undefined&&typeof _0xe1c2e0[_0x20d4a3(0x175)]!==_0x20d4a3(0x185))throw new Error(_0x20d4a3(0x16a)+_0x35eff1+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0xe1c2e0[_0x20d4a3(0x18f)]!==undefined&&typeof _0xe1c2e0[_0x20d4a3(0x18f)]!==_0x20d4a3(0x185))throw new Error('Profile\x20\x27'+_0x35eff1+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0xe1c2e0['llm_agent']!==undefined&&typeof _0xe1c2e0[_0x20d4a3(0x173)]!==_0x20d4a3(0x185))throw new Error(_0x20d4a3(0x16a)+_0x35eff1+_0x20d4a3(0x193));return!![];}function loadProfilesFromTdxJson(_0x26aff2,_0x2f1014){const _0x16389f=a50_0x4c9a;if(!a50_0x127d92[_0x16389f(0x199)](_0x26aff2))return[];try{const _0x5ce401=a50_0x127d92['readFileSync'](_0x26aff2,_0x16389f(0x15d)),_0x40a174=JSON[_0x16389f(0x190)](_0x5ce401);if(!_0x40a174['profiles']||typeof _0x40a174[_0x16389f(0x157)]!=='object')return[];const _0x16a57c=[];for(const [_0x574cb9,_0x582c37]of Object[_0x16389f(0x195)](_0x40a174[_0x16389f(0x157)])){try{validateProfileConfig(_0x582c37,_0x574cb9);const _0x19fc39=getNewCredentialPath(_0x574cb9),_0xde2120=getOldCredentialPath(_0x574cb9),_0x4682bf=a50_0x127d92[_0x16389f(0x199)](_0x19fc39)||a50_0x127d92['existsSync'](_0xde2120);_0x16a57c[_0x16389f(0x168)]({'name':_0x574cb9,'config':_0x582c37,'metadata':{'name':_0x574cb9,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x4682bf,'scope':_0x2f1014});}catch(_0x43a6b5){_0x43a6b5 instanceof Error&&(console[_0x16389f(0x192)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x26aff2+':'),console[_0x16389f(0x192)]('\x20\x20'+_0x43a6b5[_0x16389f(0x16f)]+'\x0a'));}}return _0x16a57c;}catch(_0x2eff58){return _0x2eff58 instanceof SyntaxError?(console['warn'](_0x16389f(0x16c)+_0x26aff2+_0x16389f(0x16b)),console['warn'](_0x16389f(0x18b)+_0x2eff58[_0x16389f(0x16f)]+'\x0a')):console[_0x16389f(0x192)](_0x16389f(0x176)+_0x26aff2+':\x20'+_0x2eff58+'\x0a'),[];}}export function getNewCredentialPath(_0x18987e){const _0x4476d1=a50_0x4c9a;return a50_0x50dba2[_0x4476d1(0x17f)](getConfigDir(),'.env.'+_0x18987e);}function getOldCredentialPath(_0x5a12ab){const _0xe25e66=a50_0x4c9a;return a50_0x50dba2[_0xe25e66(0x17f)](getProfilesDir(),_0x5a12ab,_0xe25e66(0x15b));}function loadProfilesFromTdxJsonFiles(){const _0x371f2d=a50_0x4c9a,_0x3494ef=[],_0x59c722=findProjectConfigPath();_0x59c722&&_0x3494ef[_0x371f2d(0x168)](...loadProfilesFromTdxJson(_0x59c722,_0x371f2d(0x184)));const _0x3b3d07=a50_0x50dba2[_0x371f2d(0x17f)](getConfigDir(),'tdx.json');return _0x3494ef['push'](...loadProfilesFromTdxJson(_0x3b3d07,_0x371f2d(0x15f))),_0x3494ef;}function loadProfilesFromDirectories(){const _0x3a129d=a50_0x4c9a,_0x5190fb=getProfilesDir();if(!a50_0x127d92[_0x3a129d(0x199)](_0x5190fb))return[];try{return a50_0x127d92[_0x3a129d(0x170)](_0x5190fb,{'withFileTypes':!![]})['filter'](_0x2776e2=>_0x2776e2[_0x3a129d(0x188)]())['map'](_0x2538bb=>_0x2538bb[_0x3a129d(0x178)])[_0x3a129d(0x198)](_0x3185cf=>{const _0x1e4331=_0x3a129d,_0x3157ec=getProfileConfigPath(_0x3185cf),_0x15646d=getProfileEnvPath(_0x3185cf);return a50_0x127d92[_0x1e4331(0x199)](_0x3157ec)||a50_0x127d92['existsSync'](_0x15646d);})[_0x3a129d(0x169)](_0x1ab54a=>{const _0x28f43c=loadProfileFromDirectory(_0x1ab54a);if(_0x28f43c)return{..._0x28f43c,'scope':'directory'};return null;})[_0x3a129d(0x198)](_0x44f444=>_0x44f444!==null);}catch{return[];}}function loadProfileFromDirectory(_0x59d5e8){const _0x473fc3=a50_0x4c9a,_0xfcb3cd=getProfileConfigPath(_0x59d5e8),_0x52e3c0=getOldCredentialPath(_0x59d5e8);if(!a50_0x127d92['existsSync'](_0xfcb3cd)&&!a50_0x127d92[_0x473fc3(0x199)](_0x52e3c0))return null;let _0x352bf7={},_0x59a8e3={'name':_0x59d5e8,'createdAt':new Date()[_0x473fc3(0x158)]()};if(a50_0x127d92[_0x473fc3(0x199)](_0xfcb3cd))try{const _0x405bf6=a50_0x127d92[_0x473fc3(0x15e)](_0xfcb3cd,_0x473fc3(0x15d)),_0x5dbb28=JSON[_0x473fc3(0x190)](_0x405bf6),{metadata:_0x446373,..._0x1e4619}=_0x5dbb28;_0x352bf7=_0x1e4619,_0x446373&&(_0x59a8e3=_0x446373);}catch{}return{'name':_0x59d5e8,'config':_0x352bf7,'metadata':_0x59a8e3,'hasCredentials':a50_0x127d92[_0x473fc3(0x199)](_0x52e3c0),'scope':_0x473fc3(0x19a)};}export function listProfiles(){const _0x58578e=a50_0x4c9a,_0x1cca82=loadProfilesFromTdxJsonFiles(),_0x757117=loadProfilesFromDirectories();if(_0x757117[_0x58578e(0x183)]>0x0){const _0x2de5f1=_0x757117[_0x58578e(0x169)](_0x49f6d7=>_0x49f6d7[_0x58578e(0x178)])[_0x58578e(0x17f)](',\x20'),_0x2bc096=getConfigDir();console[_0x58578e(0x192)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x2de5f1),console['warn'](_0x58578e(0x15c)),console[_0x58578e(0x192)](_0x58578e(0x156)+a50_0x50dba2[_0x58578e(0x17f)](_0x2bc096,_0x58578e(0x197))),console[_0x58578e(0x192)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x58578e(0x192)](_0x58578e(0x19b));}const _0x500210=[..._0x1cca82,..._0x757117],_0x3868e7=new Map();for(const _0xbeaf8b of _0x500210){!_0x3868e7[_0x58578e(0x17b)](_0xbeaf8b[_0x58578e(0x178)])&&_0x3868e7[_0x58578e(0x18d)](_0xbeaf8b['name'],_0xbeaf8b);}return Array[_0x58578e(0x16e)](_0x3868e7[_0x58578e(0x16d)]())[_0x58578e(0x18a)]((_0x4c85c0,_0x30e956)=>_0x4c85c0[_0x58578e(0x178)]['localeCompare'](_0x30e956['name']));}export function profileExists(_0x1612c6){const _0x3aa8c3=a50_0x4c9a,_0x26f2b5=listProfiles();return _0x26f2b5['some'](_0x468393=>_0x468393[_0x3aa8c3(0x178)]===_0x1612c6);}export function loadProfile(_0xbb33c6){const _0x14ae19=a50_0x4c9a;validateProfileName(_0xbb33c6);const _0xdde5dc=listProfiles(),_0x4f0267=_0xdde5dc[_0x14ae19(0x171)](_0x250ee2=>_0x250ee2[_0x14ae19(0x178)]===_0xbb33c6);return _0x4f0267||null;}export function saveProfile(_0x1e4844,_0x5536ad,_0x2ed383=![]){saveProfileToUserConfig(_0x1e4844,_0x5536ad);}export function deleteProfile(_0x3b090a){const _0x35a242=a50_0x4c9a;validateProfileName(_0x3b090a);const _0x2f7ec3=getProfileDir(_0x3b090a);if(!a50_0x127d92[_0x35a242(0x199)](_0x2f7ec3))throw new Error(_0x35a242(0x179)+_0x3b090a+'\x20does\x20not\x20exist');a50_0x127d92[_0x35a242(0x165)](_0x2f7ec3,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x3592a8,_0x24297b){const _0x5f4dfc=a50_0x4c9a;validateProfileName(_0x3592a8);const _0x213cf5=getGlobalConfigPath(),_0x5967d5=getConfigDir();!a50_0x127d92['existsSync'](_0x5967d5)&&createSecureDirectory(_0x5967d5);let _0x11f62d={};if(a50_0x127d92[_0x5f4dfc(0x199)](_0x213cf5))try{const _0x42adfc=a50_0x127d92[_0x5f4dfc(0x15e)](_0x213cf5,'utf-8');_0x11f62d=JSON['parse'](_0x42adfc);}catch{console[_0x5f4dfc(0x192)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x213cf5+_0x5f4dfc(0x18c));}!_0x11f62d['profiles']&&(_0x11f62d[_0x5f4dfc(0x157)]={}),_0x11f62d[_0x5f4dfc(0x157)][_0x3592a8]=_0x24297b,writeSecureFile(_0x213cf5,JSON['stringify'](_0x11f62d,null,0x2));}export function getActiveProfile(){const _0x337c6a=a50_0x4c9a,_0x19d72e=loadSessionContext();if(_0x19d72e?.[_0x337c6a(0x180)])return _0x19d72e[_0x337c6a(0x180)];const _0x1b7574=getGlobalConfigPath();if(!a50_0x127d92[_0x337c6a(0x199)](_0x1b7574))return null;try{const _0x46585e=a50_0x127d92[_0x337c6a(0x15e)](_0x1b7574,_0x337c6a(0x15d)),_0x276d51=JSON['parse'](_0x46585e);return _0x276d51[_0x337c6a(0x180)]||null;}catch{return null;}}export function createProfile(_0x51a6ae,_0x25069c){const _0x54c9dc=a50_0x4c9a;validateProfileName(_0x51a6ae);if(profileExists(_0x51a6ae))throw new Error(_0x54c9dc(0x179)+_0x51a6ae+_0x54c9dc(0x186));saveProfile(_0x51a6ae,_0x25069c);}export function saveProfileCredentials(_0x291cc0,_0x196e42){const _0x59b00d=a50_0x4c9a;validateProfileName(_0x291cc0);if(!profileExists(_0x291cc0))throw new Error('Profile\x20'+_0x291cc0+_0x59b00d(0x181));const _0x5b9f7b=getNewCredentialPath(_0x291cc0);writeSecureFile(_0x5b9f7b,_0x196e42);}export function loadProfileCredentials(_0x588d35){const _0x10be5f=a50_0x4c9a;validateProfileName(_0x588d35);const _0x198aea=getNewCredentialPath(_0x588d35);if(a50_0x127d92['existsSync'](_0x198aea))try{return a50_0x127d92['readFileSync'](_0x198aea,_0x10be5f(0x15d));}catch{}const _0x3eeb0a=getOldCredentialPath(_0x588d35);if(a50_0x127d92['existsSync'](_0x3eeb0a)){console['warn'](_0x10be5f(0x159)+_0x588d35+'\x27'),console[_0x10be5f(0x192)](_0x10be5f(0x162)),console[_0x10be5f(0x192)](_0x10be5f(0x177)+_0x3eeb0a+_0x10be5f(0x187)+_0x198aea+'\x22'),console['warn']('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a50_0x127d92[_0x10be5f(0x15e)](_0x3eeb0a,'utf-8');}catch{return null;}}return null;}
1
+ (function(_0x343ad9,_0x81e998){const _0x5bf579=a50_0x364f,_0x36600d=_0x343ad9();while(!![]){try{const _0x3b19a0=-parseInt(_0x5bf579(0x128))/0x1*(parseInt(_0x5bf579(0x119))/0x2)+parseInt(_0x5bf579(0x102))/0x3+parseInt(_0x5bf579(0x114))/0x4+parseInt(_0x5bf579(0x129))/0x5+parseInt(_0x5bf579(0x12d))/0x6+-parseInt(_0x5bf579(0x12a))/0x7+-parseInt(_0x5bf579(0x118))/0x8*(parseInt(_0x5bf579(0x134))/0x9);if(_0x3b19a0===_0x81e998)break;else _0x36600d['push'](_0x36600d['shift']());}catch(_0x582ae1){_0x36600d['push'](_0x36600d['shift']());}}}(a50_0x208e,0x79dcd));import*as a50_0xfc2095 from'node:fs';import*as a50_0x3fd238 from'node:path';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 function getProfileParams(_0x3c005e){const _0x3b38d2=a50_0x364f,_0x503245={};if(!_0x3c005e)return _0x503245;for(const [_0x5ea1fb,_0x489d65]of Object[_0x3b38d2(0x13f)](_0x3c005e)){_0x5ea1fb!==_0x3b38d2(0x112)&&_0x489d65!==undefined&&(_0x503245[_0x5ea1fb]=_0x489d65);}return _0x503245;}export function getProfilesDir(){const _0x5caf2a=a50_0x364f;return a50_0x3fd238[_0x5caf2a(0x132)](getConfigDir(),_0x5caf2a(0x139));}function getProfileDir(_0x34e61c){return a50_0x3fd238['join'](getProfilesDir(),_0x34e61c);}function getProfileConfigPath(_0x3a1eca){return a50_0x3fd238['join'](getProfileDir(_0x3a1eca),'tdx.json');}function getProfileEnvPath(_0x1b25d0){const _0x5d499d=a50_0x364f;return a50_0x3fd238['join'](getProfileDir(_0x1b25d0),_0x5d499d(0x104));}function getGlobalConfigPath(){const _0x551cc3=a50_0x364f;return a50_0x3fd238['join'](getConfigDir(),_0x551cc3(0x127));}function validateProfileName(_0x32b0d7){const _0x410951=a50_0x364f;if(!/^[a-zA-Z0-9_-]+$/[_0x410951(0x123)](_0x32b0d7))throw new Error(_0x410951(0x11a)+_0x32b0d7+_0x410951(0x141));}function validateProfileConfig(_0x37e11d,_0x321d74){const _0x50bf8a=a50_0x364f;if(typeof _0x37e11d!==_0x50bf8a(0xfe)||_0x37e11d===null)throw new Error('Profile\x20\x27'+_0x321d74+_0x50bf8a(0x11e));const _0x84b90d=[_0x50bf8a(0x112),_0x50bf8a(0x10f),_0x50bf8a(0xff),'parent_segment',_0x50bf8a(0x138),_0x50bf8a(0x147)],_0x424dfc=_0x37e11d;for(const _0x5a5dbe of Object[_0x50bf8a(0x13b)](_0x424dfc)){!_0x84b90d[_0x50bf8a(0x11d)](_0x5a5dbe)&&console[_0x50bf8a(0x107)](_0x50bf8a(0x140)+_0x321d74+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x5a5dbe+_0x50bf8a(0x133));}if(_0x424dfc[_0x50bf8a(0x112)]!==undefined&&typeof _0x424dfc['description']!==_0x50bf8a(0x122))throw new Error('Profile\x20\x27'+_0x321d74+_0x50bf8a(0x136));if(_0x424dfc[_0x50bf8a(0x10f)]!==undefined&&typeof _0x424dfc[_0x50bf8a(0x10f)]!==_0x50bf8a(0x122))throw new Error(_0x50bf8a(0x111)+_0x321d74+_0x50bf8a(0x10a));if(_0x424dfc[_0x50bf8a(0xff)]!==undefined&&typeof _0x424dfc[_0x50bf8a(0xff)]!==_0x50bf8a(0x122))throw new Error(_0x50bf8a(0x111)+_0x321d74+_0x50bf8a(0x125));if(_0x424dfc['parent_segment']!==undefined&&typeof _0x424dfc['parent_segment']!==_0x50bf8a(0x122))throw new Error(_0x50bf8a(0x111)+_0x321d74+_0x50bf8a(0x13c));if(_0x424dfc[_0x50bf8a(0x138)]!==undefined&&typeof _0x424dfc[_0x50bf8a(0x138)]!=='string')throw new Error(_0x50bf8a(0x111)+_0x321d74+_0x50bf8a(0x12b));if(_0x424dfc[_0x50bf8a(0x147)]!==undefined&&typeof _0x424dfc[_0x50bf8a(0x147)]!==_0x50bf8a(0x122))throw new Error('Profile\x20\x27'+_0x321d74+_0x50bf8a(0x12e));return!![];}function loadProfilesFromTdxJson(_0x312790,_0xaf0e3a){const _0x4ccee0=a50_0x364f;if(!a50_0xfc2095[_0x4ccee0(0x148)](_0x312790))return[];try{const _0x5f03be=a50_0xfc2095[_0x4ccee0(0x130)](_0x312790,'utf-8'),_0x4e041d=JSON['parse'](_0x5f03be);if(!_0x4e041d[_0x4ccee0(0x139)]||typeof _0x4e041d[_0x4ccee0(0x139)]!=='object')return[];const _0x5de596=[];for(const [_0x23e4e5,_0x4d9e01]of Object[_0x4ccee0(0x13f)](_0x4e041d[_0x4ccee0(0x139)])){try{validateProfileConfig(_0x4d9e01,_0x23e4e5);const _0x4e5a56=getNewCredentialPath(_0x23e4e5),_0xc6821d=getOldCredentialPath(_0x23e4e5),_0x3ac471=a50_0xfc2095[_0x4ccee0(0x148)](_0x4e5a56)||a50_0xfc2095['existsSync'](_0xc6821d);_0x5de596['push']({'name':_0x23e4e5,'config':_0x4d9e01,'metadata':{'name':_0x23e4e5,'createdAt':new Date()[_0x4ccee0(0x149)]()},'hasCredentials':_0x3ac471,'scope':_0xaf0e3a});}catch(_0x1a095f){_0x1a095f instanceof Error&&(console[_0x4ccee0(0x107)](_0x4ccee0(0x110)+_0x312790+':'),console[_0x4ccee0(0x107)]('\x20\x20'+_0x1a095f[_0x4ccee0(0x13d)]+'\x0a'));}}return _0x5de596;}catch(_0xd4511d){return _0xd4511d instanceof SyntaxError?(console[_0x4ccee0(0x107)](_0x4ccee0(0x10c)+_0x312790+_0x4ccee0(0x126)),console[_0x4ccee0(0x107)](_0x4ccee0(0x144)+_0xd4511d[_0x4ccee0(0x13d)]+'\x0a')):console[_0x4ccee0(0x107)](_0x4ccee0(0x131)+_0x312790+':\x20'+_0xd4511d+'\x0a'),[];}}export function getNewCredentialPath(_0x2e9a7e){const _0x17f8b9=a50_0x364f;return a50_0x3fd238[_0x17f8b9(0x132)](getConfigDir(),_0x17f8b9(0x11b)+_0x2e9a7e);}function getOldCredentialPath(_0x3fc891){const _0x3c1b73=a50_0x364f;return a50_0x3fd238[_0x3c1b73(0x132)](getProfilesDir(),_0x3fc891,_0x3c1b73(0x104));}function loadProfilesFromTdxJsonFiles(){const _0x48dfa2=a50_0x364f,_0x288b1e=[],_0x57c8f7=findProjectConfigPath();_0x57c8f7&&_0x288b1e[_0x48dfa2(0x108)](...loadProfilesFromTdxJson(_0x57c8f7,_0x48dfa2(0x103)));const _0x55f5b8=a50_0x3fd238['join'](getConfigDir(),_0x48dfa2(0x127));return _0x288b1e[_0x48dfa2(0x108)](...loadProfilesFromTdxJson(_0x55f5b8,_0x48dfa2(0x13a))),_0x288b1e;}function loadProfilesFromDirectories(){const _0x36dcbb=a50_0x364f,_0x3e0172=getProfilesDir();if(!a50_0xfc2095['existsSync'](_0x3e0172))return[];try{return a50_0xfc2095[_0x36dcbb(0x10e)](_0x3e0172,{'withFileTypes':!![]})[_0x36dcbb(0x116)](_0x543817=>_0x543817['isDirectory']())[_0x36dcbb(0x115)](_0x5f057c=>_0x5f057c[_0x36dcbb(0x113)])[_0x36dcbb(0x116)](_0x2c5081=>{const _0x2880bb=getProfileConfigPath(_0x2c5081),_0x502f6c=getProfileEnvPath(_0x2c5081);return a50_0xfc2095['existsSync'](_0x2880bb)||a50_0xfc2095['existsSync'](_0x502f6c);})[_0x36dcbb(0x115)](_0x479733=>{const _0x52e2f9=loadProfileFromDirectory(_0x479733);if(_0x52e2f9)return{..._0x52e2f9,'scope':'directory'};return null;})[_0x36dcbb(0x116)](_0x3be3ea=>_0x3be3ea!==null);}catch{return[];}}function loadProfileFromDirectory(_0x166669){const _0x5424a4=a50_0x364f,_0x5c5a96=getProfileConfigPath(_0x166669),_0x1c7bc0=getOldCredentialPath(_0x166669);if(!a50_0xfc2095['existsSync'](_0x5c5a96)&&!a50_0xfc2095[_0x5424a4(0x148)](_0x1c7bc0))return null;let _0x180351={},_0x5cd1a8={'name':_0x166669,'createdAt':new Date()[_0x5424a4(0x149)]()};if(a50_0xfc2095[_0x5424a4(0x148)](_0x5c5a96))try{const _0x2e61ce=a50_0xfc2095[_0x5424a4(0x130)](_0x5c5a96,_0x5424a4(0x143)),_0xb9952f=JSON[_0x5424a4(0x11f)](_0x2e61ce),{metadata:_0x4f3639,..._0x2e93ae}=_0xb9952f;_0x180351=_0x2e93ae,_0x4f3639&&(_0x5cd1a8=_0x4f3639);}catch{}return{'name':_0x166669,'config':_0x180351,'metadata':_0x5cd1a8,'hasCredentials':a50_0xfc2095[_0x5424a4(0x148)](_0x1c7bc0),'scope':_0x5424a4(0x14a)};}export function listProfiles(){const _0x549d60=a50_0x364f,_0x121fb0=loadProfilesFromTdxJsonFiles(),_0x5e0d47=loadProfilesFromDirectories();if(_0x5e0d47['length']>0x0){const _0x1737ca=_0x5e0d47['map'](_0x5618cd=>_0x5618cd[_0x549d60(0x113)])['join'](',\x20'),_0x17acfe=getConfigDir();console[_0x549d60(0x107)](_0x549d60(0x137)+_0x1737ca),console[_0x549d60(0x107)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x549d60(0x107)]('\x20\x201.\x20Edit:\x20'+a50_0x3fd238['join'](_0x17acfe,_0x549d60(0x127))),console[_0x549d60(0x107)](_0x549d60(0x109)),console[_0x549d60(0x107)](_0x549d60(0x120));}const _0x51b007=[..._0x121fb0,..._0x5e0d47],_0x5743d0=new Map();for(const _0x36efb6 of _0x51b007){!_0x5743d0[_0x549d60(0x12f)](_0x36efb6[_0x549d60(0x113)])&&_0x5743d0[_0x549d60(0x146)](_0x36efb6[_0x549d60(0x113)],_0x36efb6);}return Array[_0x549d60(0x100)](_0x5743d0[_0x549d60(0x145)]())[_0x549d60(0x14b)]((_0x1525a9,_0x4100cd)=>_0x1525a9[_0x549d60(0x113)][_0x549d60(0x135)](_0x4100cd[_0x549d60(0x113)]));}export function profileExists(_0x177cde){const _0x13d915=a50_0x364f,_0x45b81c=listProfiles();return _0x45b81c[_0x13d915(0x11c)](_0x35d281=>_0x35d281[_0x13d915(0x113)]===_0x177cde);}export function loadProfile(_0x59c436){const _0x36f590=a50_0x364f;validateProfileName(_0x59c436);const _0xbf96bc=listProfiles(),_0x75a45a=_0xbf96bc['find'](_0x3e42a2=>_0x3e42a2[_0x36f590(0x113)]===_0x59c436);return _0x75a45a||null;}function a50_0x364f(_0x554cf1,_0x32dccc){_0x554cf1=_0x554cf1-0xfe;const _0x208e51=a50_0x208e();let _0x364ff9=_0x208e51[_0x554cf1];return _0x364ff9;}export function saveProfile(_0x362eab,_0x14d9e0,_0x277301=![]){saveProfileToUserConfig(_0x362eab,_0x14d9e0);}export function deleteProfile(_0x364ce3){const _0x43fbe4=a50_0x364f;validateProfileName(_0x364ce3);const _0x1db382=getProfileDir(_0x364ce3);if(!a50_0xfc2095[_0x43fbe4(0x148)](_0x1db382))throw new Error(_0x43fbe4(0x12c)+_0x364ce3+_0x43fbe4(0x10d));a50_0xfc2095[_0x43fbe4(0x105)](_0x1db382,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x42ccc4,_0x1c13d5){const _0x527d0d=a50_0x364f;validateProfileName(_0x42ccc4);const _0x23c923=getGlobalConfigPath(),_0x3e4514=getConfigDir();!a50_0xfc2095['existsSync'](_0x3e4514)&&createSecureDirectory(_0x3e4514);let _0x5e0047={};if(a50_0xfc2095[_0x527d0d(0x148)](_0x23c923))try{const _0x5ee393=a50_0xfc2095[_0x527d0d(0x130)](_0x23c923,_0x527d0d(0x143));_0x5e0047=JSON['parse'](_0x5ee393);}catch{console[_0x527d0d(0x107)](_0x527d0d(0x13e)+_0x23c923+_0x527d0d(0x121));}!_0x5e0047['profiles']&&(_0x5e0047[_0x527d0d(0x139)]={}),_0x5e0047['profiles'][_0x42ccc4]=_0x1c13d5,writeSecureFile(_0x23c923,JSON[_0x527d0d(0x117)](_0x5e0047,null,0x2));}export function getActiveProfile(){const _0x506136=a50_0x364f,_0x3fdbf3=loadSessionContext();if(_0x3fdbf3?.[_0x506136(0x124)])return _0x3fdbf3[_0x506136(0x124)];const _0x5a972f=getGlobalConfigPath();if(!a50_0xfc2095[_0x506136(0x148)](_0x5a972f))return null;try{const _0x4bc3d1=a50_0xfc2095[_0x506136(0x130)](_0x5a972f,_0x506136(0x143)),_0x2ed4bf=JSON[_0x506136(0x11f)](_0x4bc3d1);return _0x2ed4bf[_0x506136(0x124)]||null;}catch{return null;}}export function createProfile(_0xbc534f,_0x4d44ce){const _0x597266=a50_0x364f;validateProfileName(_0xbc534f);if(profileExists(_0xbc534f))throw new Error(_0x597266(0x12c)+_0xbc534f+_0x597266(0x106));saveProfile(_0xbc534f,_0x4d44ce);}export function saveProfileCredentials(_0x57adcd,_0x16b825){const _0x38084a=a50_0x364f;validateProfileName(_0x57adcd);if(!profileExists(_0x57adcd))throw new Error(_0x38084a(0x12c)+_0x57adcd+_0x38084a(0x10d));const _0x1cf3cc=getNewCredentialPath(_0x57adcd);writeSecureFile(_0x1cf3cc,_0x16b825);}export function loadProfileCredentials(_0x1889b2){const _0x448b4e=a50_0x364f;validateProfileName(_0x1889b2);const _0x20f413=getNewCredentialPath(_0x1889b2);if(a50_0xfc2095['existsSync'](_0x20f413))try{return a50_0xfc2095[_0x448b4e(0x130)](_0x20f413,_0x448b4e(0x143));}catch{}const _0x4726b7=getOldCredentialPath(_0x1889b2);if(a50_0xfc2095['existsSync'](_0x4726b7)){console['warn']('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x1889b2+'\x27'),console['warn']('To\x20migrate:'),console[_0x448b4e(0x107)](_0x448b4e(0x10b)+_0x4726b7+_0x448b4e(0x101)+_0x20f413+'\x22'),console['warn'](_0x448b4e(0x142));try{return a50_0xfc2095['readFileSync'](_0x4726b7,'utf-8');}catch{return null;}}return null;}function a50_0x208e(){const _0x56bcfe=['map','filter','stringify','488bhZdVm','61678FQZSFX','Invalid\x20profile\x20name:\x20','.env.','some','includes','\x27:\x20config\x20must\x20be\x20an\x20object','parse','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a',',\x20creating\x20new\x20file','string','test','profile','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string',':\x20Invalid\x20JSON\x20syntax','tdx.json','1GjfUav','3754595WVkYmg','6662747oWEzSi','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','Profile\x20','3919674AOvBuQ','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','has','readFileSync','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','join','\x27\x20will\x20be\x20ignored','174753qSENOE','localeCompare','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','llm_project','profiles','user','keys','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','message','Warning:\x20Failed\x20to\x20parse\x20','entries','Warning:\x20Profile\x20\x27','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','utf-8','Error:\x20','values','set','llm_agent','existsSync','toISOString','directory','sort','object','database','from','\x22\x20\x22','1622217uqPWdX','local','.env','rmSync','\x20already\x20exists','warn','push','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x20\x20mv\x20\x22','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x20does\x20not\x20exist','readdirSync','site','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Profile\x20\x27','description','name','2885236oeqVXa'];a50_0x208e=function(){return _0x56bcfe;};return a50_0x208e();}
@@ -1 +1 @@
1
- const a51_0x18254a=a51_0x4913;(function(_0x248544,_0xbfa80a){const _0x172f0e=a51_0x4913,_0x5f1ca3=_0x248544();while(!![]){try{const _0x29396a=-parseInt(_0x172f0e(0x180))/0x1+parseInt(_0x172f0e(0x17e))/0x2*(parseInt(_0x172f0e(0x16e))/0x3)+parseInt(_0x172f0e(0x176))/0x4+-parseInt(_0x172f0e(0x163))/0x5+-parseInt(_0x172f0e(0x172))/0x6+parseInt(_0x172f0e(0x17c))/0x7+parseInt(_0x172f0e(0x171))/0x8*(-parseInt(_0x172f0e(0x16a))/0x9);if(_0x29396a===_0xbfa80a)break;else _0x5f1ca3['push'](_0x5f1ca3['shift']());}catch(_0x51b9bc){_0x5f1ca3['push'](_0x5f1ca3['shift']());}}}(a51_0x37f4,0x6e740));import*as a51_0x534b48 from'node:fs';function a51_0x37f4(){const _0x1e1621=['api_key','62cWFZNW',').\x20','99589nEUDBu','profile','Failed\x20to\x20load\x20project\x20config\x20from\x20','Warning:\x20\x27profile\x27\x20field\x20in\x20','warn','2111185ggeeZm','TD_API_KEY','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','writeFileSync','includes','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','cwd','36216vTwPrQ','dirname','stringify','existsSync','81588ZgisHA','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','tdx.json','2208srXjUF','1500000iYsdfm','ENOENT','readFileSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','3443092aqoDzP','\x20is\x20ignored.\x20','join','apiKey','code','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','4417119oEYRvD'];a51_0x37f4=function(){return _0x1e1621;};return a51_0x37f4();}import*as a51_0x8bb73f from'node:path';const PROJECT_CONFIG_FILENAME=a51_0x18254a(0x170);export function findProjectConfigPath(_0x3947b1){const _0x9e4a0f=a51_0x18254a;let _0x1e7a0b=_0x3947b1||process[_0x9e4a0f(0x169)]();while(!![]){const _0x42f96a=a51_0x8bb73f[_0x9e4a0f(0x178)](_0x1e7a0b,PROJECT_CONFIG_FILENAME);if(a51_0x534b48[_0x9e4a0f(0x16d)](_0x42f96a))return _0x42f96a;const _0xb0dfe3=a51_0x8bb73f[_0x9e4a0f(0x16b)](_0x1e7a0b);if(_0xb0dfe3===_0x1e7a0b)return null;_0x1e7a0b=_0xb0dfe3;}}export function loadProjectConfig(_0x151687){const _0xc270f5=a51_0x18254a,_0xc3eee7=findProjectConfigPath(_0x151687);if(!_0xc3eee7)return null;try{const _0x454869=a51_0x534b48[_0xc270f5(0x174)](_0xc3eee7,'utf-8'),_0x2f2f38=JSON['parse'](_0x454869),_0x38f210=JSON[_0xc270f5(0x16c)](_0x2f2f38);if(_0x38f210[_0xc270f5(0x167)](_0xc270f5(0x164))||_0x38f210[_0xc270f5(0x167)](_0xc270f5(0x179))||_0x38f210[_0xc270f5(0x167)](_0xc270f5(0x17d)))throw new Error(_0xc270f5(0x16f)+_0xc3eee7+_0xc270f5(0x17f)+_0xc270f5(0x168));const {metadata:_0x6f24e7,profile:_0x8376f8,..._0x23602e}=_0x2f2f38;return _0x8376f8&&console[_0xc270f5(0x162)](_0xc270f5(0x161)+_0xc3eee7+_0xc270f5(0x177)+_0xc270f5(0x165)),_0x23602e;}catch(_0x418f21){if(_0x418f21 instanceof Error&&'code'in _0x418f21&&_0x418f21[_0xc270f5(0x17a)]===_0xc270f5(0x173))return null;throw new Error(_0xc270f5(0x160)+_0xc3eee7+':\x20'+_0x418f21);}}export function saveProjectConfig(_0x4ae84f,_0x3568da){const _0x5bf44f=a51_0x18254a,_0x3d0423=_0x3568da||process['cwd'](),_0xa87207=a51_0x8bb73f['join'](_0x3d0423,PROJECT_CONFIG_FILENAME),_0x16beb0=JSON[_0x5bf44f(0x16c)](_0x4ae84f);if(_0x16beb0['includes'](_0x5bf44f(0x164))||_0x16beb0['includes']('apiKey')||_0x16beb0['includes'](_0x5bf44f(0x17d)))throw new Error(_0x5bf44f(0x175));if(_0x5bf44f(0x181)in _0x4ae84f)throw new Error(_0x5bf44f(0x17b));a51_0x534b48[_0x5bf44f(0x166)](_0xa87207,JSON[_0x5bf44f(0x16c)](_0x4ae84f,null,0x2));}function a51_0x4913(_0x2e0e7e,_0x26172b){_0x2e0e7e=_0x2e0e7e-0x160;const _0x37f478=a51_0x37f4();let _0x4913c5=_0x37f478[_0x2e0e7e];return _0x4913c5;}export function hasProjectConfig(_0x2e1c07){return findProjectConfigPath(_0x2e1c07)!==null;}export function getProjectRoot(_0x382ab4){const _0x321889=findProjectConfigPath(_0x382ab4);return _0x321889?a51_0x8bb73f['dirname'](_0x321889):null;}
1
+ function a51_0x2a7e(_0x5e47c5,_0x4f99a2){_0x5e47c5=_0x5e47c5-0x19e;const _0x1e3c09=a51_0x1e3c();let _0x2a7ec9=_0x1e3c09[_0x5e47c5];return _0x2a7ec9;}(function(_0x27763e,_0x20a3b8){const _0x1ab277=a51_0x2a7e,_0xd3e92d=_0x27763e();while(!![]){try{const _0x3158e7=parseInt(_0x1ab277(0x1a2))/0x1*(-parseInt(_0x1ab277(0x1b7))/0x2)+-parseInt(_0x1ab277(0x1bb))/0x3*(parseInt(_0x1ab277(0x1b5))/0x4)+-parseInt(_0x1ab277(0x1b0))/0x5+parseInt(_0x1ab277(0x1bc))/0x6*(-parseInt(_0x1ab277(0x1ac))/0x7)+parseInt(_0x1ab277(0x1a4))/0x8*(parseInt(_0x1ab277(0x19f))/0x9)+-parseInt(_0x1ab277(0x1a1))/0xa+-parseInt(_0x1ab277(0x1ab))/0xb*(-parseInt(_0x1ab277(0x1b9))/0xc);if(_0x3158e7===_0x20a3b8)break;else _0xd3e92d['push'](_0xd3e92d['shift']());}catch(_0x17c88c){_0xd3e92d['push'](_0xd3e92d['shift']());}}}(a51_0x1e3c,0x2bea9));import*as a51_0x374bae from'node:fs';function a51_0x1e3c(){const _0xa4d75d=['utf-8','parse','1164YAowFf','Failed\x20to\x20load\x20project\x20config\x20from\x20','74mlwuZc','api_key','11751468aKrIgC','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','2919HTIxRa','1698aVEXWH','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','stringify','81PdDjjY','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','78910AkRvrG','8590YOwDDg','cwd','144696kXkqso','apiKey','ENOENT','\x20is\x20ignored.\x20','join','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','writeFileSync','11ebHCHI','973JdLWQk','warn','Warning:\x20\x27profile\x27\x20field\x20in\x20','TD_API_KEY','1569950EFbAXa','includes',').\x20'];a51_0x1e3c=function(){return _0xa4d75d;};return a51_0x1e3c();}import*as a51_0x4fd378 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x3e327b){const _0x5d8ff2=a51_0x2a7e;let _0x3381fb=_0x3e327b||process[_0x5d8ff2(0x1a3)]();while(!![]){const _0x19337b=a51_0x4fd378['join'](_0x3381fb,PROJECT_CONFIG_FILENAME);if(a51_0x374bae['existsSync'](_0x19337b))return _0x19337b;const _0x201c35=a51_0x4fd378['dirname'](_0x3381fb);if(_0x201c35===_0x3381fb)return null;_0x3381fb=_0x201c35;}}export function loadProjectConfig(_0x3d9380){const _0x61641b=a51_0x2a7e,_0x5cafc4=findProjectConfigPath(_0x3d9380);if(!_0x5cafc4)return null;try{const _0x138a01=a51_0x374bae['readFileSync'](_0x5cafc4,_0x61641b(0x1b3)),_0x4745a5=JSON[_0x61641b(0x1b4)](_0x138a01),_0x21df7d=JSON['stringify'](_0x4745a5);if(_0x21df7d['includes'](_0x61641b(0x1af))||_0x21df7d['includes'](_0x61641b(0x1a5))||_0x21df7d[_0x61641b(0x1b1)](_0x61641b(0x1b8)))throw new Error(_0x61641b(0x1a9)+_0x5cafc4+_0x61641b(0x1b2)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x4adbc3,profile:_0x3ad21d,..._0x478611}=_0x4745a5;return _0x3ad21d&&console[_0x61641b(0x1ad)](_0x61641b(0x1ae)+_0x5cafc4+_0x61641b(0x1a7)+_0x61641b(0x1ba)),_0x478611;}catch(_0x4c358e){if(_0x4c358e instanceof Error&&'code'in _0x4c358e&&_0x4c358e['code']===_0x61641b(0x1a6))return null;throw new Error(_0x61641b(0x1b6)+_0x5cafc4+':\x20'+_0x4c358e);}}export function saveProjectConfig(_0x4cebff,_0x2f79ab){const _0x248456=a51_0x2a7e,_0x5bc87b=_0x2f79ab||process[_0x248456(0x1a3)](),_0x5c0f2e=a51_0x4fd378[_0x248456(0x1a8)](_0x5bc87b,PROJECT_CONFIG_FILENAME),_0x43bf4c=JSON['stringify'](_0x4cebff);if(_0x43bf4c['includes'](_0x248456(0x1af))||_0x43bf4c[_0x248456(0x1b1)](_0x248456(0x1a5))||_0x43bf4c[_0x248456(0x1b1)](_0x248456(0x1b8)))throw new Error(_0x248456(0x1bd));if('profile'in _0x4cebff)throw new Error(_0x248456(0x1a0));a51_0x374bae[_0x248456(0x1aa)](_0x5c0f2e,JSON[_0x248456(0x19e)](_0x4cebff,null,0x2));}export function hasProjectConfig(_0x3fb838){return findProjectConfigPath(_0x3fb838)!==null;}export function getProjectRoot(_0x87c9ac){const _0x2e1e5f=findProjectConfigPath(_0x87c9ac);return _0x2e1e5f?a51_0x4fd378['dirname'](_0x2e1e5f):null;}
@@ -1 +1 @@
1
- (function(_0x231946,_0x5a3366){const _0x52847c=a52_0x2951,_0x1fc66c=_0x231946();while(!![]){try{const _0x4e7687=-parseInt(_0x52847c(0xb4))/0x1+parseInt(_0x52847c(0xc2))/0x2*(-parseInt(_0x52847c(0xc0))/0x3)+parseInt(_0x52847c(0xb5))/0x4*(parseInt(_0x52847c(0xc1))/0x5)+parseInt(_0x52847c(0xc8))/0x6+-parseInt(_0x52847c(0xba))/0x7*(parseInt(_0x52847c(0xac))/0x8)+-parseInt(_0x52847c(0xab))/0x9+parseInt(_0x52847c(0xbb))/0xa;if(_0x4e7687===_0x5a3366)break;else _0x1fc66c['push'](_0x1fc66c['shift']());}catch(_0x6a8c1c){_0x1fc66c['push'](_0x1fc66c['shift']());}}}(a52_0x5970,0xd5fc2));import*as a52_0x11050f from'node:fs';import*as a52_0x21a995 from'node:path';import*as a52_0x879b41 from'node:os';function a52_0x2951(_0x2b4c8f,_0x39a333){_0x2b4c8f=_0x2b4c8f-0xa8;const _0x59700a=a52_0x5970();let _0x29514f=_0x59700a[_0x2b4c8f];return _0x29514f;}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 _0x1f9d05=a52_0x2951,_0x926161=process['env']['TDX_CONFIG_DIR']||a52_0x21a995['join'](a52_0x879b41[_0x1f9d05(0xad)](),_0x1f9d05(0xcf),_0x1f9d05(0xc7));return a52_0x21a995[_0x1f9d05(0xc6)](_0x926161,'sessions');}function getSessionPath(_0x3c3ccf){const _0x1fff13=a52_0x2951;return a52_0x21a995[_0x1fff13(0xc6)](getSessionsDir(),_0x3c3ccf+_0x1fff13(0xbc));}export function getCurrentSessionPID(){return getPPID();}function a52_0x5970(){const _0x4d89a9=['readdirSync','toString','replace','api_key','21swcqDV','15440140jiybQd','.json','createdAt','endsWith','utf-8','509703RZuMyP','10JHFFzy','8UUonoN','.\x20This\x20is\x20insecure.\x20Removing\x20session.','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','warn','join','tdx','5410800lzzzcf','test','readFileSync','existsSync','now','push','apiKey','.config','sort','includes','writeFileSync','12723966pOeeIa','649184OYgkXh','homedir','toISOString','TD_API_KEY','parse','stringify','unlinkSync','getTime','642266utSbea','2819512UJABaA'];a52_0x5970=function(){return _0x4d89a9;};return a52_0x5970();}export function getSessionID(_0x2a176f){const _0x30233d=a52_0x2951;if(_0x2a176f)return _0x2a176f;return getCurrentSessionPID()[_0x30233d(0xb7)]();}export function loadSessionContext(_0x35e18f){const _0x3202a5=a52_0x2951,_0x544a52=_0x35e18f||getCurrentSessionPID()[_0x3202a5(0xb7)](),_0x2a48d8=/^\d+$/[_0x3202a5(0xc9)](_0x544a52)?parseInt(_0x544a52,0xa):null;return _0x2a48d8!==null?loadSessionContextByPID(_0x2a48d8):loadSessionContextByString(_0x544a52);}export function loadSessionContextByPID(_0x4af816){const _0x186172=a52_0x2951,_0x55396e=getSessionPath(_0x4af816);if(!a52_0x11050f[_0x186172(0xcb)](_0x55396e))return null;try{const _0x4c3a25=a52_0x11050f[_0x186172(0xca)](_0x55396e,_0x186172(0xbf)),_0x5b799f=JSON['parse'](_0x4c3a25),_0x27a979=new Date(_0x5b799f['createdAt'])['getTime'](),_0x373330=Date['now']();if(_0x373330-_0x27a979>SESSION_EXPIRATION_MS)return a52_0x11050f['unlinkSync'](_0x55396e),null;const _0x959249=JSON['stringify'](_0x5b799f);if(_0x959249[_0x186172(0xa9)](_0x186172(0xaf))||_0x959249[_0x186172(0xa9)](_0x186172(0xce))||_0x959249[_0x186172(0xa9)](_0x186172(0xb9)))return console[_0x186172(0xc5)](_0x186172(0xc4)+_0x55396e+_0x186172(0xc3)),a52_0x11050f['unlinkSync'](_0x55396e),null;return _0x5b799f;}catch{try{a52_0x11050f['unlinkSync'](_0x55396e);}catch{}return null;}}function loadSessionContextByString(_0x4286e1){const _0x2ebb37=a52_0x2951,_0x28554b=a52_0x21a995[_0x2ebb37(0xc6)](getSessionsDir(),_0x4286e1+'.json');if(!a52_0x11050f[_0x2ebb37(0xcb)](_0x28554b))return null;try{const _0x442ecb=a52_0x11050f[_0x2ebb37(0xca)](_0x28554b,_0x2ebb37(0xbf)),_0x16b5a0=JSON[_0x2ebb37(0xb0)](_0x442ecb),_0x22bec3=new Date(_0x16b5a0[_0x2ebb37(0xbd)])[_0x2ebb37(0xb3)](),_0x593a25=Date[_0x2ebb37(0xcc)]();if(_0x593a25-_0x22bec3>SESSION_EXPIRATION_MS)return a52_0x11050f['unlinkSync'](_0x28554b),null;const _0x1d08fc=JSON['stringify'](_0x16b5a0);if(_0x1d08fc[_0x2ebb37(0xa9)](_0x2ebb37(0xaf))||_0x1d08fc[_0x2ebb37(0xa9)](_0x2ebb37(0xce))||_0x1d08fc[_0x2ebb37(0xa9)](_0x2ebb37(0xb9)))return console[_0x2ebb37(0xc5)](_0x2ebb37(0xc4)+_0x28554b+_0x2ebb37(0xc3)),a52_0x11050f[_0x2ebb37(0xb2)](_0x28554b),null;return _0x16b5a0;}catch{try{a52_0x11050f['unlinkSync'](_0x28554b);}catch{}return null;}}export function saveSessionContext(_0x264b9a,_0x206ee7){const _0x4cef9d=a52_0x2951,_0x1a2e10=_0x206ee7||getCurrentSessionPID()[_0x4cef9d(0xb7)](),_0x4e1767=/^\d+$/[_0x4cef9d(0xc9)](_0x1a2e10)?parseInt(_0x1a2e10,0xa):getCurrentSessionPID(),_0x28b086=a52_0x21a995[_0x4cef9d(0xc6)](getSessionsDir(),_0x1a2e10+_0x4cef9d(0xbc)),_0xf9b7bd=getSessionsDir();createSecureDirectory(_0xf9b7bd);const _0x4bc60c=JSON[_0x4cef9d(0xb1)](_0x264b9a);if(_0x4bc60c[_0x4cef9d(0xa9)]('TD_API_KEY')||_0x4bc60c[_0x4cef9d(0xa9)](_0x4cef9d(0xce))||_0x4bc60c[_0x4cef9d(0xa9)](_0x4cef9d(0xb9)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x53a213;const _0x158522=/^\d+$/['test'](_0x1a2e10)?loadSessionContextByPID(parseInt(_0x1a2e10,0xa)):loadSessionContextByString(_0x1a2e10);_0x158522?_0x53a213={..._0x158522,..._0x264b9a,'pid':_0x4e1767,'sessionId':_0x1a2e10!==_0x4e1767[_0x4cef9d(0xb7)]()?_0x1a2e10:undefined,'updatedAt':new Date()[_0x4cef9d(0xae)]()}:_0x53a213={'pid':_0x4e1767,'sessionId':_0x1a2e10!==_0x4e1767['toString']()?_0x1a2e10:undefined,..._0x264b9a,'createdAt':new Date()[_0x4cef9d(0xae)](),'updatedAt':new Date()['toISOString']()},a52_0x11050f[_0x4cef9d(0xaa)](_0x28b086,JSON['stringify'](_0x53a213,null,0x2));}export function clearSessionContext(_0x5d51d3){const _0x1c5186=a52_0x2951,_0x1c1cfe=_0x5d51d3||getCurrentSessionPID()[_0x1c5186(0xb7)](),_0x15bba3=a52_0x21a995['join'](getSessionsDir(),_0x1c1cfe+_0x1c5186(0xbc));a52_0x11050f[_0x1c5186(0xcb)](_0x15bba3)&&a52_0x11050f['unlinkSync'](_0x15bba3);}export function cleanExpiredSessions(){const _0x51779f=a52_0x2951,_0x437dc1=getSessionsDir();if(!a52_0x11050f[_0x51779f(0xcb)](_0x437dc1))return 0x0;let _0x187231=0x0;const _0x424695=Date[_0x51779f(0xcc)]();try{const _0x2dbaac=a52_0x11050f[_0x51779f(0xb6)](_0x437dc1);for(const _0x2a1435 of _0x2dbaac){if(!_0x2a1435[_0x51779f(0xbe)](_0x51779f(0xbc)))continue;const _0x1ffba4=a52_0x21a995[_0x51779f(0xc6)](_0x437dc1,_0x2a1435),_0x1bc05f=_0x2a1435['replace'](_0x51779f(0xbc),''),_0x22518c=parseInt(_0x1bc05f,0xa),_0x627725=!isNaN(_0x22518c);if(_0x627725){if(!isProcessRunning(_0x22518c)){a52_0x11050f[_0x51779f(0xb2)](_0x1ffba4),_0x187231++;continue;}}try{const _0x4e6932=a52_0x11050f[_0x51779f(0xca)](_0x1ffba4,_0x51779f(0xbf)),_0x2b51f4=JSON[_0x51779f(0xb0)](_0x4e6932),_0x150b2c=new Date(_0x2b51f4[_0x51779f(0xbd)])['getTime']();_0x424695-_0x150b2c>SESSION_EXPIRATION_MS&&(a52_0x11050f['unlinkSync'](_0x1ffba4),_0x187231++);}catch{a52_0x11050f['unlinkSync'](_0x1ffba4),_0x187231++;}}}catch{}return _0x187231;}export function listActiveSessions(){const _0x5bb316=a52_0x2951,_0x3fe564=getSessionsDir();if(!a52_0x11050f[_0x5bb316(0xcb)](_0x3fe564))return[];try{const _0x35404c=a52_0x11050f[_0x5bb316(0xb6)](_0x3fe564),_0x57eb3b=[];for(const _0x86b381 of _0x35404c){if(!_0x86b381[_0x5bb316(0xbe)](_0x5bb316(0xbc)))continue;const _0x639d3a=_0x86b381[_0x5bb316(0xb8)](_0x5bb316(0xbc),''),_0x396d21=parseInt(_0x639d3a,0xa);!isNaN(_0x396d21)&&isProcessRunning(_0x396d21)&&_0x57eb3b[_0x5bb316(0xcd)](_0x396d21);}return _0x57eb3b[_0x5bb316(0xa8)]((_0x3923f5,_0x9a00b9)=>_0x3923f5-_0x9a00b9);}catch{return[];}}
1
+ function a52_0x4036(_0xa9194d,_0x480c2d){_0xa9194d=_0xa9194d-0x16a;const _0x148c81=a52_0x148c();let _0x403695=_0x148c81[_0xa9194d];return _0x403695;}(function(_0x18bdda,_0x281438){const _0x3f6386=a52_0x4036,_0x185fc1=_0x18bdda();while(!![]){try{const _0x5036fc=-parseInt(_0x3f6386(0x193))/0x1*(-parseInt(_0x3f6386(0x17c))/0x2)+parseInt(_0x3f6386(0x184))/0x3*(parseInt(_0x3f6386(0x173))/0x4)+parseInt(_0x3f6386(0x172))/0x5*(-parseInt(_0x3f6386(0x182))/0x6)+-parseInt(_0x3f6386(0x18d))/0x7+-parseInt(_0x3f6386(0x18b))/0x8+-parseInt(_0x3f6386(0x189))/0x9*(parseInt(_0x3f6386(0x188))/0xa)+parseInt(_0x3f6386(0x16d))/0xb*(parseInt(_0x3f6386(0x17e))/0xc);if(_0x5036fc===_0x281438)break;else _0x185fc1['push'](_0x185fc1['shift']());}catch(_0x274a7d){_0x185fc1['push'](_0x185fc1['shift']());}}}(a52_0x148c,0x9dfa7));import*as a52_0x2f1a76 from'node:fs';import*as a52_0x1e82c8 from'node:path';import*as a52_0x7d0398 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 _0x4e2c38=a52_0x4036,_0x16ffd8=process[_0x4e2c38(0x17f)][_0x4e2c38(0x176)]||a52_0x1e82c8['join'](a52_0x7d0398[_0x4e2c38(0x178)](),_0x4e2c38(0x16a),'tdx');return a52_0x1e82c8[_0x4e2c38(0x185)](_0x16ffd8,_0x4e2c38(0x175));}function getSessionPath(_0x15d737){const _0x444a4a=a52_0x4036;return a52_0x1e82c8[_0x444a4a(0x185)](getSessionsDir(),_0x15d737+_0x444a4a(0x17b));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x25b30b){const _0x31c726=a52_0x4036;if(_0x25b30b)return _0x25b30b;return getCurrentSessionPID()[_0x31c726(0x18c)]();}export function loadSessionContext(_0xe1f63d){const _0x49b710=a52_0x4036,_0x114e74=_0xe1f63d||getCurrentSessionPID()[_0x49b710(0x18c)](),_0x124fa2=/^\d+$/[_0x49b710(0x16c)](_0x114e74)?parseInt(_0x114e74,0xa):null;return _0x124fa2!==null?loadSessionContextByPID(_0x124fa2):loadSessionContextByString(_0x114e74);}export function loadSessionContextByPID(_0x5a000d){const _0x298f8f=a52_0x4036,_0x2541a5=getSessionPath(_0x5a000d);if(!a52_0x2f1a76[_0x298f8f(0x16f)](_0x2541a5))return null;try{const _0xac5a2b=a52_0x2f1a76[_0x298f8f(0x170)](_0x2541a5,_0x298f8f(0x16e)),_0x2611eb=JSON['parse'](_0xac5a2b),_0x244f3a=new Date(_0x2611eb[_0x298f8f(0x190)])['getTime'](),_0x391525=Date[_0x298f8f(0x180)]();if(_0x391525-_0x244f3a>SESSION_EXPIRATION_MS)return a52_0x2f1a76[_0x298f8f(0x177)](_0x2541a5),null;const _0x3e4745=JSON[_0x298f8f(0x181)](_0x2611eb);if(_0x3e4745[_0x298f8f(0x174)]('TD_API_KEY')||_0x3e4745[_0x298f8f(0x174)](_0x298f8f(0x179))||_0x3e4745[_0x298f8f(0x174)]('api_key'))return console['warn'](_0x298f8f(0x171)+_0x2541a5+_0x298f8f(0x18a)),a52_0x2f1a76[_0x298f8f(0x177)](_0x2541a5),null;return _0x2611eb;}catch{try{a52_0x2f1a76[_0x298f8f(0x177)](_0x2541a5);}catch{}return null;}}function a52_0x148c(){const _0xc686fe=['getTime','3436431dFQdao','join','endsWith','replace','7780hJpstm','9297TgyEQU','.\x20This\x20is\x20insecure.\x20Removing\x20session.','7876880LWwTHH','toString','690039uatalY','toISOString','push','createdAt','writeFileSync','TD_API_KEY','1169899DWBajR','parse','.config','sort','test','11oHxyUE','utf-8','existsSync','readFileSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','933005nCSsbF','4RPtAvD','includes','sessions','TDX_CONFIG_DIR','unlinkSync','homedir','apiKey','api_key','.json','2VFukuO','warn','13818828NSWoNU','env','now','stringify','30pnvoUw'];a52_0x148c=function(){return _0xc686fe;};return a52_0x148c();}function loadSessionContextByString(_0x384bc2){const _0x5398a9=a52_0x4036,_0x43a112=a52_0x1e82c8[_0x5398a9(0x185)](getSessionsDir(),_0x384bc2+_0x5398a9(0x17b));if(!a52_0x2f1a76[_0x5398a9(0x16f)](_0x43a112))return null;try{const _0x4838fe=a52_0x2f1a76[_0x5398a9(0x170)](_0x43a112,_0x5398a9(0x16e)),_0x41136d=JSON[_0x5398a9(0x194)](_0x4838fe),_0x1daaa9=new Date(_0x41136d[_0x5398a9(0x190)])[_0x5398a9(0x183)](),_0x3c0da6=Date[_0x5398a9(0x180)]();if(_0x3c0da6-_0x1daaa9>SESSION_EXPIRATION_MS)return a52_0x2f1a76[_0x5398a9(0x177)](_0x43a112),null;const _0x1ddd88=JSON[_0x5398a9(0x181)](_0x41136d);if(_0x1ddd88[_0x5398a9(0x174)](_0x5398a9(0x192))||_0x1ddd88[_0x5398a9(0x174)](_0x5398a9(0x179))||_0x1ddd88[_0x5398a9(0x174)](_0x5398a9(0x17a)))return console[_0x5398a9(0x17d)](_0x5398a9(0x171)+_0x43a112+_0x5398a9(0x18a)),a52_0x2f1a76['unlinkSync'](_0x43a112),null;return _0x41136d;}catch{try{a52_0x2f1a76[_0x5398a9(0x177)](_0x43a112);}catch{}return null;}}export function saveSessionContext(_0x2fa759,_0x2afbe5){const _0x170a28=a52_0x4036,_0x3cc3b1=_0x2afbe5||getCurrentSessionPID()[_0x170a28(0x18c)](),_0x47ed4=/^\d+$/['test'](_0x3cc3b1)?parseInt(_0x3cc3b1,0xa):getCurrentSessionPID(),_0xb13020=a52_0x1e82c8[_0x170a28(0x185)](getSessionsDir(),_0x3cc3b1+_0x170a28(0x17b)),_0x460faf=getSessionsDir();createSecureDirectory(_0x460faf);const _0x1b17f1=JSON[_0x170a28(0x181)](_0x2fa759);if(_0x1b17f1[_0x170a28(0x174)](_0x170a28(0x192))||_0x1b17f1[_0x170a28(0x174)](_0x170a28(0x179))||_0x1b17f1[_0x170a28(0x174)](_0x170a28(0x17a)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x422d5f;const _0xb28d89=/^\d+$/[_0x170a28(0x16c)](_0x3cc3b1)?loadSessionContextByPID(parseInt(_0x3cc3b1,0xa)):loadSessionContextByString(_0x3cc3b1);_0xb28d89?_0x422d5f={..._0xb28d89,..._0x2fa759,'pid':_0x47ed4,'sessionId':_0x3cc3b1!==_0x47ed4['toString']()?_0x3cc3b1:undefined,'updatedAt':new Date()[_0x170a28(0x18e)]()}:_0x422d5f={'pid':_0x47ed4,'sessionId':_0x3cc3b1!==_0x47ed4['toString']()?_0x3cc3b1:undefined,..._0x2fa759,'createdAt':new Date()[_0x170a28(0x18e)](),'updatedAt':new Date()['toISOString']()},a52_0x2f1a76[_0x170a28(0x191)](_0xb13020,JSON[_0x170a28(0x181)](_0x422d5f,null,0x2));}export function clearSessionContext(_0x2c12ca){const _0x2b74af=a52_0x4036,_0x4ab925=_0x2c12ca||getCurrentSessionPID()[_0x2b74af(0x18c)](),_0x57204f=a52_0x1e82c8[_0x2b74af(0x185)](getSessionsDir(),_0x4ab925+'.json');a52_0x2f1a76[_0x2b74af(0x16f)](_0x57204f)&&a52_0x2f1a76[_0x2b74af(0x177)](_0x57204f);}export function cleanExpiredSessions(){const _0x4cbe96=a52_0x4036,_0x233d7e=getSessionsDir();if(!a52_0x2f1a76['existsSync'](_0x233d7e))return 0x0;let _0x30f363=0x0;const _0x417b22=Date['now']();try{const _0x2b3ad4=a52_0x2f1a76['readdirSync'](_0x233d7e);for(const _0x238c37 of _0x2b3ad4){if(!_0x238c37[_0x4cbe96(0x186)](_0x4cbe96(0x17b)))continue;const _0x15a029=a52_0x1e82c8[_0x4cbe96(0x185)](_0x233d7e,_0x238c37),_0x4de837=_0x238c37[_0x4cbe96(0x187)]('.json',''),_0x30e264=parseInt(_0x4de837,0xa),_0x17b4ed=!isNaN(_0x30e264);if(_0x17b4ed){if(!isProcessRunning(_0x30e264)){a52_0x2f1a76[_0x4cbe96(0x177)](_0x15a029),_0x30f363++;continue;}}try{const _0x3a2b83=a52_0x2f1a76[_0x4cbe96(0x170)](_0x15a029,_0x4cbe96(0x16e)),_0x106a15=JSON['parse'](_0x3a2b83),_0x2d5ba0=new Date(_0x106a15[_0x4cbe96(0x190)])[_0x4cbe96(0x183)]();_0x417b22-_0x2d5ba0>SESSION_EXPIRATION_MS&&(a52_0x2f1a76[_0x4cbe96(0x177)](_0x15a029),_0x30f363++);}catch{a52_0x2f1a76['unlinkSync'](_0x15a029),_0x30f363++;}}}catch{}return _0x30f363;}export function listActiveSessions(){const _0x1aac98=a52_0x4036,_0x4046e2=getSessionsDir();if(!a52_0x2f1a76[_0x1aac98(0x16f)](_0x4046e2))return[];try{const _0x197e9f=a52_0x2f1a76['readdirSync'](_0x4046e2),_0x34e0e9=[];for(const _0x5a495b of _0x197e9f){if(!_0x5a495b[_0x1aac98(0x186)](_0x1aac98(0x17b)))continue;const _0x187803=_0x5a495b['replace'](_0x1aac98(0x17b),''),_0x32a05a=parseInt(_0x187803,0xa);!isNaN(_0x32a05a)&&isProcessRunning(_0x32a05a)&&_0x34e0e9[_0x1aac98(0x18f)](_0x32a05a);}return _0x34e0e9[_0x1aac98(0x16b)]((_0xe17d13,_0x47e42e)=>_0xe17d13-_0x47e42e);}catch{return[];}}