@treasuredata/tdx 0.9.4 → 0.9.6

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 (157) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/engage-api-client.js +1 -1
  9. package/dist/client/http-client.js +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/rate-limiter.js +1 -1
  12. package/dist/client/td-api-client.d.ts +45 -1
  13. package/dist/client/td-api-client.d.ts.map +1 -1
  14. package/dist/client/td-api-client.js +1 -1
  15. package/dist/client/td-api-client.js.map +1 -1
  16. package/dist/client/trino-api-client.js +1 -1
  17. package/dist/client/workflow-client.js +1 -1
  18. package/dist/commands/activations.js +1 -1
  19. package/dist/commands/agent-command.js +1 -1
  20. package/dist/commands/api-command.js +1 -1
  21. package/dist/commands/auth-command.js +1 -1
  22. package/dist/commands/chat-command.js +1 -1
  23. package/dist/commands/claude-command.js +1 -1
  24. package/dist/commands/claude-statusline-command.js +1 -1
  25. package/dist/commands/claude-usage-command.js +1 -1
  26. package/dist/commands/command.js +1 -1
  27. package/dist/commands/connection-command.d.ts +35 -0
  28. package/dist/commands/connection-command.d.ts.map +1 -1
  29. package/dist/commands/connection-command.js +1 -1
  30. package/dist/commands/connection-command.js.map +1 -1
  31. package/dist/commands/context-command.js +1 -1
  32. package/dist/commands/databases.js +1 -1
  33. package/dist/commands/describe.js +1 -1
  34. package/dist/commands/engage-command.js +1 -1
  35. package/dist/commands/job-command.js +1 -1
  36. package/dist/commands/journey-command.d.ts.map +1 -1
  37. package/dist/commands/journey-command.js +1 -1
  38. package/dist/commands/journey-command.js.map +1 -1
  39. package/dist/commands/llm-command.js +1 -1
  40. package/dist/commands/llm-proxy.js +1 -1
  41. package/dist/commands/parent-segment-command.js +1 -1
  42. package/dist/commands/profiles-command.js +1 -1
  43. package/dist/commands/query-command.js +1 -1
  44. package/dist/commands/segment-command.js +1 -1
  45. package/dist/commands/segment-create-command.js +1 -1
  46. package/dist/commands/segment-fields-command.js +1 -1
  47. package/dist/commands/segment-pull-command.d.ts +6 -0
  48. package/dist/commands/segment-pull-command.d.ts.map +1 -1
  49. package/dist/commands/segment-pull-command.js +1 -1
  50. package/dist/commands/segment-pull-command.js.map +1 -1
  51. package/dist/commands/segment-push-command.d.ts.map +1 -1
  52. package/dist/commands/segment-push-command.js +1 -1
  53. package/dist/commands/segment-push-command.js.map +1 -1
  54. package/dist/commands/segment-update-command.js +1 -1
  55. package/dist/commands/segment-use-command.js +1 -1
  56. package/dist/commands/segments.js +1 -1
  57. package/dist/commands/show.js +1 -1
  58. package/dist/commands/tables.js +1 -1
  59. package/dist/commands/use-command.js +1 -1
  60. package/dist/commands/user-command.js +1 -1
  61. package/dist/commands/workflow-command.js +1 -1
  62. package/dist/core/auth.js +1 -1
  63. package/dist/core/config.js +1 -1
  64. package/dist/core/connection-cache.js +1 -1
  65. package/dist/core/credential-cache.js +1 -1
  66. package/dist/core/global-context.js +1 -1
  67. package/dist/core/keychain.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/proxy/anthropic-adapter.js +1 -1
  74. package/dist/proxy/claude-usage-tracker.js +1 -1
  75. package/dist/proxy/context-signature.js +1 -1
  76. package/dist/proxy/conversation-utils.js +1 -1
  77. package/dist/proxy/server.js +1 -1
  78. package/dist/proxy/session-cache.js +1 -1
  79. package/dist/sdk/agent/agent-yaml.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/connection-validator.d.ts +119 -0
  82. package/dist/sdk/connection-validator.d.ts.map +1 -0
  83. package/dist/sdk/connection-validator.js +1 -0
  84. package/dist/sdk/connection-validator.js.map +1 -0
  85. package/dist/sdk/connection.d.ts +120 -1
  86. package/dist/sdk/connection.d.ts.map +1 -1
  87. package/dist/sdk/connection.js +1 -1
  88. package/dist/sdk/connection.js.map +1 -1
  89. package/dist/sdk/engage.js +1 -1
  90. package/dist/sdk/errors.d.ts +4 -0
  91. package/dist/sdk/errors.d.ts.map +1 -1
  92. package/dist/sdk/errors.js +1 -1
  93. package/dist/sdk/errors.js.map +1 -1
  94. package/dist/sdk/index.js +1 -1
  95. package/dist/sdk/job.js +1 -1
  96. package/dist/sdk/journey.js +1 -1
  97. package/dist/sdk/llm.js +1 -1
  98. package/dist/sdk/query.js +1 -1
  99. package/dist/sdk/segment/child-segment-yaml.d.ts +135 -7
  100. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  101. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  102. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  103. package/dist/sdk/segment/journey-yaml.d.ts +1 -1
  104. package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
  105. package/dist/sdk/segment/journey-yaml.js +1 -1
  106. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  107. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  108. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  109. package/dist/sdk/segment.js +1 -1
  110. package/dist/sdk/user.js +1 -1
  111. package/dist/sdk/workflow.js +1 -1
  112. package/dist/types/cdp.d.ts +2 -1
  113. package/dist/types/cdp.d.ts.map +1 -1
  114. package/dist/types/connector-schema.d.ts +182 -0
  115. package/dist/types/connector-schema.d.ts.map +1 -0
  116. package/dist/types/connector-schema.js +1 -0
  117. package/dist/types/connector-schema.js.map +1 -0
  118. package/dist/types/endpoints.js +1 -1
  119. package/dist/types/index.d.ts +2 -0
  120. package/dist/types/index.d.ts.map +1 -1
  121. package/dist/types/index.js +1 -1
  122. package/dist/utils/agent-config.js +1 -1
  123. package/dist/utils/agent-ref-parser.js +1 -1
  124. package/dist/utils/async.js +1 -1
  125. package/dist/utils/chat-cache.js +1 -1
  126. package/dist/utils/colors.js +1 -1
  127. package/dist/utils/command-output.js +1 -1
  128. package/dist/utils/constants.js +1 -1
  129. package/dist/utils/diff.js +1 -1
  130. package/dist/utils/fields-display.js +1 -1
  131. package/dist/utils/file-permissions.js +1 -1
  132. package/dist/utils/format-detector.js +1 -1
  133. package/dist/utils/formatters.js +1 -1
  134. package/dist/utils/journey-utils.d.ts.map +1 -1
  135. package/dist/utils/journey-utils.js +1 -1
  136. package/dist/utils/journey-utils.js.map +1 -1
  137. package/dist/utils/json-loader.js +1 -1
  138. package/dist/utils/llm-backup-utils.js +1 -1
  139. package/dist/utils/model-aliases.js +1 -1
  140. package/dist/utils/model-factors.js +1 -1
  141. package/dist/utils/option-validation.js +1 -1
  142. package/dist/utils/port.js +1 -1
  143. package/dist/utils/process.js +1 -1
  144. package/dist/utils/prompt.js +1 -1
  145. package/dist/utils/segment-path-parser.js +1 -1
  146. package/dist/utils/segment-ref-parser.js +1 -1
  147. package/dist/utils/spinner.js +1 -1
  148. package/dist/utils/sql-parser.js +1 -1
  149. package/dist/utils/sse-parser.js +1 -1
  150. package/dist/utils/string-utils.js +1 -1
  151. package/dist/utils/table-ref-parser.js +1 -1
  152. package/dist/utils/tdx-config.js +1 -1
  153. package/dist/utils/tdx-logger.js +1 -1
  154. package/dist/utils/tree-formatter.js +1 -1
  155. package/dist/utils/version-check.js +1 -1
  156. package/dist/utils/workflow-utils.js +1 -1
  157. package/package.json +1 -1
@@ -1 +1 @@
1
- function a42_0x4aff(_0xb937c8,_0x57dc46){_0xb937c8=_0xb937c8-0x169;const _0x1c655b=a42_0x1c65();let _0x4aff38=_0x1c655b[_0xb937c8];return _0x4aff38;}const a42_0x3a8491=a42_0x4aff;(function(_0x3b3779,_0x1995ee){const _0x32ee9a=a42_0x4aff,_0x526651=_0x3b3779();while(!![]){try{const _0x1f086a=-parseInt(_0x32ee9a(0x16e))/0x1*(parseInt(_0x32ee9a(0x180))/0x2)+parseInt(_0x32ee9a(0x170))/0x3*(parseInt(_0x32ee9a(0x199))/0x4)+-parseInt(_0x32ee9a(0x19b))/0x5*(-parseInt(_0x32ee9a(0x18c))/0x6)+parseInt(_0x32ee9a(0x172))/0x7+-parseInt(_0x32ee9a(0x16d))/0x8+-parseInt(_0x32ee9a(0x193))/0x9+parseInt(_0x32ee9a(0x17f))/0xa*(parseInt(_0x32ee9a(0x19c))/0xb);if(_0x1f086a===_0x1995ee)break;else _0x526651['push'](_0x526651['shift']());}catch(_0x2b0053){_0x526651['push'](_0x526651['shift']());}}}(a42_0x1c65,0x8c322));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import a42_0x1fc17b from'chalk';export class UseCommand extends BaseCommand{[a42_0x3a8491(0x196)]=a42_0x3a8491(0x18e);[a42_0x3a8491(0x16c)]=a42_0x3a8491(0x19e);[a42_0x3a8491(0x173)](_0x421901){const _0x21e6ed=a42_0x3a8491,{args:_0x2a7977}=_0x421901;if(_0x2a7977[_0x21e6ed(0x185)]===0x0)return undefined;if(_0x2a7977[_0x21e6ed(0x185)]===0x1)return _0x21e6ed(0x17d)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20current\x20context\x0a'+_0x21e6ed(0x182)+_0x21e6ed(0x189)+_0x21e6ed(0x18d);const _0x16eb53=_0x2a7977[0x0],_0x4b2b34=[_0x21e6ed(0x198),'parent_segment',_0x21e6ed(0x19d),_0x21e6ed(0x17c),_0x21e6ed(0x188),_0x21e6ed(0x17a)];if(!_0x4b2b34[_0x21e6ed(0x18f)](_0x16eb53))return _0x21e6ed(0x184)+_0x16eb53+_0x21e6ed(0x181)+_0x4b2b34[_0x21e6ed(0x19a)](',\x20');return undefined;}async[a42_0x3a8491(0x169)](_0x4d414c){const _0x436f16=a42_0x3a8491,{args:_0xb78392,options:_0x3a6a25}=_0x4d414c,_0x5eeb11=_0x3a6a25['debug'],_0x276c42=_0x3a6a25['clear'];cleanExpiredSessions();try{if(_0x276c42){clearSessionContext(_0x3a6a25[_0x436f16(0x176)]);const _0x347f14=_0x3a6a25[_0x436f16(0x176)]||getCurrentSessionPID()['toString']();return console[_0x436f16(0x186)](_0x436f16(0x16f)+a42_0x1fc17b[_0x436f16(0x179)](_0x436f16(0x187))+'\x20'+a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x194)+_0x347f14+')')),0x0;}if(_0xb78392['length']===0x0){const _0x41a506=new GlobalContext(_0x3a6a25);return _0x5eeb11?_0x41a506[_0x436f16(0x177)]():_0x41a506[_0x436f16(0x18b)](),console[_0x436f16(0x186)](a42_0x1fc17b['dim'](_0x436f16(0x178))),console[_0x436f16(0x186)](a42_0x1fc17b[_0x436f16(0x195)]('Resources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace')),0x0;}const _0xd3f776=_0xb78392[0x0],_0x562f60=_0xb78392[0x1];if(_0xd3f776==='profile'){if(!profileExists(_0x562f60))return console[_0x436f16(0x17e)]('Error:\x20Profile\x20\x27'+_0x562f60+_0x436f16(0x18a)),console['error'](_0x436f16(0x16a)),0x1;const _0x3f41af=_0x3a6a25[_0x436f16(0x176)]||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x562f60},_0x3a6a25[_0x436f16(0x176)]),console[_0x436f16(0x186)](_0x436f16(0x17b)+a42_0x1fc17b[_0x436f16(0x179)](_0x562f60)+'\x20'+a42_0x1fc17b[_0x436f16(0x195)]('(session:\x20'+_0x3f41af+')')),console[_0x436f16(0x186)](a42_0x1fc17b[_0x436f16(0x195)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides')),0x0;}const _0x35d93f={},_0x272f92=_0x3a6a25['session']||getCurrentSessionPID()['toString']();switch(_0xd3f776){case _0x436f16(0x198):_0x35d93f['database']=_0x562f60,console['log'](_0x436f16(0x197)+a42_0x1fc17b[_0x436f16(0x179)](_0x562f60)+'\x20'+a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x194)+_0x272f92+')'));break;case _0x436f16(0x183):_0x35d93f['parent_segment']=_0x562f60,console['log'](_0x436f16(0x192)+a42_0x1fc17b['green'](_0x562f60)+'\x20'+a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x194)+_0x272f92+')'));break;case _0x436f16(0x19d):_0x35d93f['llm_project']=_0x562f60,console[_0x436f16(0x186)]('Session\x20llm_project\x20set\x20to:\x20'+a42_0x1fc17b[_0x436f16(0x179)](_0x562f60)+'\x20'+a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x194)+_0x272f92+')'));break;case _0x436f16(0x17c):{const {projectName:_0x38cd9c,agentName:_0x100379}=parseAgentRef(_0x562f60);_0x100379?(_0x35d93f[_0x436f16(0x19d)]=_0x38cd9c,_0x35d93f[_0x436f16(0x190)]=_0x100379,console[_0x436f16(0x186)](_0x436f16(0x174)+a42_0x1fc17b[_0x436f16(0x179)](_0x38cd9c)+'\x20'+a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x194)+_0x272f92+')')),console[_0x436f16(0x186)](_0x436f16(0x16b)+a42_0x1fc17b['green'](_0x100379)+'\x20'+a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x194)+_0x272f92+')'))):(_0x35d93f[_0x436f16(0x190)]=_0x562f60,console['log'](_0x436f16(0x16b)+a42_0x1fc17b[_0x436f16(0x179)](_0x562f60)+'\x20'+a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x194)+_0x272f92+')')));break;}case _0x436f16(0x17a):_0x35d93f[_0x436f16(0x17a)]=_0x562f60,console[_0x436f16(0x186)]('Session\x20engage_workspace\x20set\x20to:\x20'+a42_0x1fc17b[_0x436f16(0x179)](_0x562f60)+'\x20'+a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x194)+_0x272f92+')'));break;}return saveSessionContext(_0x35d93f,_0x3a6a25[_0x436f16(0x176)]),console[_0x436f16(0x186)](a42_0x1fc17b[_0x436f16(0x195)](_0x436f16(0x175))),0x0;}catch(_0x38881d){return _0x38881d instanceof Error&&console[_0x436f16(0x17e)](_0x436f16(0x171)+_0x38881d[_0x436f16(0x191)]),0x1;}}}function a42_0x1c65(){const _0x4e5ed0=['14084170ydthxv','2jXriDs','.\x20Must\x20be\x20one\x20of:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a','parent_segment','Invalid\x20resource:\x20','length','log','cleared','profile','\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace\x0a','\x27\x20does\x20not\x20exist','display','120GKkikP','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','use','includes','llm_agent','message','Session\x20parent_segment\x20set\x20to:\x20','4924431RmsjzG','(session:\x20','dim','name','Session\x20database\x20set\x20to:\x20','database','4MPsvkW','join','184290lRobQO','11YVLMqh','llm_project','Set\x20session-level\x20context','execute','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','Session\x20agent\x20set\x20to:\x20','description','9007072wajLhr','580840rqeJiJ','Session\x20context\x20','2041734asdJGb','Error:\x20','13790zraztV','validate','Session\x20llm_project\x20set\x20to:\x20','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','session','displayWithSources','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','green','engage_workspace','Session\x20profile\x20set\x20to:\x20','agent','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','error'];a42_0x1c65=function(){return _0x4e5ed0;};return a42_0x1c65();}
1
+ function a42_0x3f9f(){const _0x1a3ac7=['60807tqJLQl','llm_agent','128VZKpiM','Session\x20agent\x20set\x20to:\x20','148ApgsjB','\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace\x0a','Session\x20engage_workspace\x20set\x20to:\x20','5752UxoQHp','Session\x20database\x20set\x20to:\x20','use','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','parent_segment','Error:\x20Profile\x20\x27','7125700CQZlng','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','toString','includes','(session:\x20','display','name','2659240oopEfX','execute','displayWithSources','join','message','dim','Session\x20llm_project\x20set\x20to:\x20','11835YFwtiP','6wqWFiV','llm_project','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20current\x20context\x0a','debug','Session\x20parent_segment\x20set\x20to:\x20','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace','validate','cleared','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','\x27\x20does\x20not\x20exist','engage_workspace','Session\x20profile\x20set\x20to:\x20','length','15358nGsgoq','profile','18573467Udmojb','session','1714419wXZEVX','green','12QYTKQz','Invalid\x20resource:\x20','database','.\x20Must\x20be\x20one\x20of:\x20','error','log'];a42_0x3f9f=function(){return _0x1a3ac7;};return a42_0x3f9f();}const a42_0x3fd59e=a42_0xe761;(function(_0x545040,_0x58dd40){const _0x1e1483=a42_0xe761,_0x3ada3f=_0x545040();while(!![]){try{const _0x4b8e6b=parseInt(_0x1e1483(0x1cc))/0x1*(parseInt(_0x1e1483(0x1a5))/0x2)+-parseInt(_0x1e1483(0x1a3))/0x3*(-parseInt(_0x1e1483(0x1a7))/0x4)+-parseInt(_0x1e1483(0x1b7))/0x5*(-parseInt(_0x1e1483(0x1bf))/0x6)+-parseInt(_0x1e1483(0x1d0))/0x7+parseInt(_0x1e1483(0x1aa))/0x8*(parseInt(_0x1e1483(0x1be))/0x9)+-parseInt(_0x1e1483(0x1b0))/0xa+-parseInt(_0x1e1483(0x1ce))/0xb*(parseInt(_0x1e1483(0x19d))/0xc);if(_0x4b8e6b===_0x58dd40)break;else _0x3ada3f['push'](_0x3ada3f['shift']());}catch(_0x36e84e){_0x3ada3f['push'](_0x3ada3f['shift']());}}}(a42_0x3f9f,0x89bf6));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import a42_0x3127bd from'chalk';function a42_0xe761(_0x3d77d8,_0x4004ad){_0x3d77d8=_0x3d77d8-0x19c;const _0x3f9f96=a42_0x3f9f();let _0xe761a1=_0x3f9f96[_0x3d77d8];return _0xe761a1;}export class UseCommand extends BaseCommand{[a42_0x3fd59e(0x1b6)]=a42_0x3fd59e(0x1ac);['description']='Set\x20session-level\x20context';[a42_0x3fd59e(0x1c5)](_0x20fba1){const _0x442e43=a42_0x3fd59e,{args:_0x5e6be6}=_0x20fba1;if(_0x5e6be6[_0x442e43(0x1cb)]===0x0)return undefined;if(_0x5e6be6[_0x442e43(0x1cb)]===0x1)return _0x442e43(0x1b1)+_0x442e43(0x1c1)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a'+_0x442e43(0x1a8)+_0x442e43(0x1c7);const _0x432e85=_0x5e6be6[0x0],_0x2397f4=['database',_0x442e43(0x1ae),'llm_project','agent',_0x442e43(0x1cd),_0x442e43(0x1c9)];if(!_0x2397f4[_0x442e43(0x1b3)](_0x432e85))return _0x442e43(0x19e)+_0x432e85+_0x442e43(0x1a0)+_0x2397f4[_0x442e43(0x1ba)](',\x20');return undefined;}async[a42_0x3fd59e(0x1b8)](_0x4063bc){const _0x3a7253=a42_0x3fd59e,{args:_0x5a54bb,options:_0xe7ca36}=_0x4063bc,_0x9fc924=_0xe7ca36[_0x3a7253(0x1c2)],_0x1b821c=_0xe7ca36['clear'];cleanExpiredSessions();try{if(_0x1b821c){clearSessionContext(_0xe7ca36[_0x3a7253(0x1cf)]);const _0x3b3403=_0xe7ca36[_0x3a7253(0x1cf)]||getCurrentSessionPID()[_0x3a7253(0x1b2)]();return console['log']('Session\x20context\x20'+a42_0x3127bd[_0x3a7253(0x19c)](_0x3a7253(0x1c6))+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x3b3403+')')),0x0;}if(_0x5a54bb[_0x3a7253(0x1cb)]===0x0){const _0x1eff2a=new GlobalContext(_0xe7ca36);return _0x9fc924?_0x1eff2a[_0x3a7253(0x1b9)]():_0x1eff2a[_0x3a7253(0x1b5)](),console[_0x3a7253(0x1a2)](a42_0x3127bd[_0x3a7253(0x1bc)]('\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>')),console[_0x3a7253(0x1a2)](a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1c4))),0x0;}const _0x157499=_0x5a54bb[0x0],_0x583e8d=_0x5a54bb[0x1];if(_0x157499===_0x3a7253(0x1cd)){if(!profileExists(_0x583e8d))return console['error'](_0x3a7253(0x1af)+_0x583e8d+_0x3a7253(0x1c8)),console['error']('\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles'),0x1;const _0x5c6b3b=_0xe7ca36['session']||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x583e8d},_0xe7ca36['session']),console[_0x3a7253(0x1a2)](_0x3a7253(0x1ca)+a42_0x3127bd[_0x3a7253(0x19c)](_0x583e8d)+'\x20'+a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1b4)+_0x5c6b3b+')')),console[_0x3a7253(0x1a2)](a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1ad))),0x0;}const _0x6217e0={},_0x58505f=_0xe7ca36['session']||getCurrentSessionPID()[_0x3a7253(0x1b2)]();switch(_0x157499){case _0x3a7253(0x19f):_0x6217e0[_0x3a7253(0x19f)]=_0x583e8d,console[_0x3a7253(0x1a2)](_0x3a7253(0x1ab)+a42_0x3127bd[_0x3a7253(0x19c)](_0x583e8d)+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x58505f+')'));break;case _0x3a7253(0x1ae):_0x6217e0['parent_segment']=_0x583e8d,console[_0x3a7253(0x1a2)](_0x3a7253(0x1c3)+a42_0x3127bd[_0x3a7253(0x19c)](_0x583e8d)+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x58505f+')'));break;case'llm_project':_0x6217e0['llm_project']=_0x583e8d,console['log'](_0x3a7253(0x1bd)+a42_0x3127bd['green'](_0x583e8d)+'\x20'+a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1b4)+_0x58505f+')'));break;case'agent':{const {projectName:_0x581b91,agentName:_0x2182ab}=parseAgentRef(_0x583e8d);_0x2182ab?(_0x6217e0[_0x3a7253(0x1c0)]=_0x581b91,_0x6217e0[_0x3a7253(0x1a4)]=_0x2182ab,console['log']('Session\x20llm_project\x20set\x20to:\x20'+a42_0x3127bd[_0x3a7253(0x19c)](_0x581b91)+'\x20'+a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1b4)+_0x58505f+')')),console[_0x3a7253(0x1a2)]('Session\x20agent\x20set\x20to:\x20'+a42_0x3127bd['green'](_0x2182ab)+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x58505f+')'))):(_0x6217e0[_0x3a7253(0x1a4)]=_0x583e8d,console['log'](_0x3a7253(0x1a6)+a42_0x3127bd['green'](_0x583e8d)+'\x20'+a42_0x3127bd['dim'](_0x3a7253(0x1b4)+_0x58505f+')')));break;}case'engage_workspace':_0x6217e0[_0x3a7253(0x1c9)]=_0x583e8d,console[_0x3a7253(0x1a2)](_0x3a7253(0x1a9)+a42_0x3127bd[_0x3a7253(0x19c)](_0x583e8d)+'\x20'+a42_0x3127bd[_0x3a7253(0x1bc)](_0x3a7253(0x1b4)+_0x58505f+')'));break;}return saveSessionContext(_0x6217e0,_0xe7ca36['session']),console['log'](a42_0x3127bd[_0x3a7253(0x1bc)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides')),0x0;}catch(_0x300f1f){return _0x300f1f instanceof Error&&console[_0x3a7253(0x1a1)]('Error:\x20'+_0x300f1f[_0x3a7253(0x1bb)]),0x1;}}}
@@ -1 +1 @@
1
- const a43_0x4294e1=a43_0x45ba;(function(_0x3b53f9,_0x51a5c3){const _0x1c0841=a43_0x45ba,_0x33499d=_0x3b53f9();while(!![]){try{const _0x5c4077=parseInt(_0x1c0841(0xe6))/0x1*(-parseInt(_0x1c0841(0xe9))/0x2)+parseInt(_0x1c0841(0xdc))/0x3+-parseInt(_0x1c0841(0xf6))/0x4+parseInt(_0x1c0841(0xdd))/0x5+parseInt(_0x1c0841(0xed))/0x6+-parseInt(_0x1c0841(0xe1))/0x7*(-parseInt(_0x1c0841(0xe8))/0x8)+parseInt(_0x1c0841(0xe2))/0x9*(-parseInt(_0x1c0841(0xf1))/0xa);if(_0x5c4077===_0x51a5c3)break;else _0x33499d['push'](_0x33499d['shift']());}catch(_0x46225f){_0x33499d['push'](_0x33499d['shift']());}}}(a43_0x45f7,0xe1a87));function a43_0x45f7(){const _0x32ef2d=['\x20user','message','17038RzkTNg','126JRmTcT','Show\x20current\x20user\x20information','List\x20all\x20users\x20in\x20the\x20account','Fetching\x20user\x20info...','551qahasg','list','2024NnOIrU','3962uPLbVy','execute','user','✔\x20Found\x20','5958858EGrDHd','getCurrent','cause','length','234790TWvBFJ','data','Error:\x20','Listing\x20users...','verbose','2519788lXfpfP','error','user\x20list','3010968TAiZun','1809390lYZKpb','description'];a43_0x45f7=function(){return _0x32ef2d;};return a43_0x45f7();}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';function a43_0x45ba(_0x2e9278,_0x4533f0){_0x2e9278=_0x2e9278-0xdc;const _0x45f7a4=a43_0x45f7();let _0x45ba1a=_0x45f7a4[_0x2e9278];return _0x45ba1a;}export class UserCommand extends BaseCommand{['name']=a43_0x4294e1(0xeb);[a43_0x4294e1(0xde)]=a43_0x4294e1(0xe3);async[a43_0x4294e1(0xea)](_0x16dca1){const _0x298888=a43_0x4294e1,{options:_0x42f994,tdx:_0x204709}=_0x16dca1;try{const _0x57d19b=await withSpinner(_0x298888(0xe5),()=>_0x204709[_0x298888(0xeb)][_0x298888(0xee)](),{'verbose':_0x42f994[_0x298888(0xf5)]}),_0x125309=_0x57d19b[_0x298888(0xf2)];return await handleSingleObjectOutput(_0x125309,_0x42f994),0x0;}catch(_0x3b80b4){if(_0x3b80b4 instanceof SDKError)return console[_0x298888(0xf7)](_0x298888(0xf3)+_0x3b80b4['message']),_0x3b80b4[_0x298888(0xef)]&&console['error']('\x20\x20Cause:\x20'+_0x3b80b4[_0x298888(0xef)]),0x1;throw _0x3b80b4;}}}export class UserListCommand extends BaseCommand{['name']=a43_0x4294e1(0xf8);[a43_0x4294e1(0xde)]=a43_0x4294e1(0xe4);async[a43_0x4294e1(0xea)](_0x3915b9){const _0x3da1c=a43_0x4294e1,{options:_0x14fd1c,tdx:_0x57aa7a}=_0x3915b9;try{const _0x28d8fb=await withSpinner(_0x3da1c(0xf4),()=>_0x57aa7a[_0x3da1c(0xeb)][_0x3da1c(0xe7)](),{'verbose':_0x14fd1c[_0x3da1c(0xf5)]}),_0x20926a=_0x28d8fb[_0x3da1c(0xf2)];return console[_0x3da1c(0xf7)](_0x3da1c(0xec)+_0x20926a[_0x3da1c(0xf0)]+_0x3da1c(0xdf)+(_0x20926a[_0x3da1c(0xf0)]!==0x1?'s':'')),await handleSDKOutput(_0x20926a,_0x14fd1c),0x0;}catch(_0x263704){if(_0x263704 instanceof SDKError)return console[_0x3da1c(0xf7)](_0x3da1c(0xf3)+_0x263704[_0x3da1c(0xe0)]),_0x263704[_0x3da1c(0xef)]&&console[_0x3da1c(0xf7)]('\x20\x20Cause:\x20'+_0x263704[_0x3da1c(0xef)]),0x1;throw _0x263704;}}}
1
+ const a43_0x249d60=a43_0x3645;(function(_0x4e52e3,_0x46f969){const _0x3faedc=a43_0x3645,_0x99d13a=_0x4e52e3();while(!![]){try{const _0x49366e=-parseInt(_0x3faedc(0x158))/0x1+-parseInt(_0x3faedc(0x153))/0x2+-parseInt(_0x3faedc(0x152))/0x3+-parseInt(_0x3faedc(0x151))/0x4*(-parseInt(_0x3faedc(0x15c))/0x5)+-parseInt(_0x3faedc(0x149))/0x6+parseInt(_0x3faedc(0x14d))/0x7+parseInt(_0x3faedc(0x15d))/0x8*(parseInt(_0x3faedc(0x14a))/0x9);if(_0x49366e===_0x46f969)break;else _0x99d13a['push'](_0x99d13a['shift']());}catch(_0x48985f){_0x99d13a['push'](_0x99d13a['shift']());}}}(a43_0x45b0,0x2d996));function a43_0x3645(_0xb0f238,_0x378d78){_0xb0f238=_0xb0f238-0x148;const _0x45b0ae=a43_0x45b0();let _0x364515=_0x45b0ae[_0xb0f238];return _0x364515;}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{[a43_0x249d60(0x14e)]=a43_0x249d60(0x163);['description']=a43_0x249d60(0x14c);async[a43_0x249d60(0x156)](_0x26d44c){const _0x3d7157=a43_0x249d60,{options:_0x3fc8f2,tdx:_0x2ecd94}=_0x26d44c;try{const _0x3f2592=await withSpinner(_0x3d7157(0x150),()=>_0x2ecd94[_0x3d7157(0x163)]['getCurrent'](),{'verbose':_0x3fc8f2[_0x3d7157(0x155)]}),_0x461561=_0x3f2592[_0x3d7157(0x154)];return await handleSingleObjectOutput(_0x461561,_0x3fc8f2),0x0;}catch(_0x59be69){if(_0x59be69 instanceof SDKError)return console[_0x3d7157(0x15a)](_0x3d7157(0x161)+_0x59be69[_0x3d7157(0x157)]),_0x59be69[_0x3d7157(0x160)]&&console[_0x3d7157(0x15a)]('\x20\x20Cause:\x20'+_0x59be69['cause']),0x1;throw _0x59be69;}}}function a43_0x45b0(){const _0x3e73fb=['407912ympCUD','data','verbose','execute','message','150365cmtzTi','List\x20all\x20users\x20in\x20the\x20account','error','description','351635pPKvKi','5721456ztlWjn','user\x20list','length','cause','Error:\x20','list','user','Listing\x20users...','2212932nhfDzf','9VbyaEJ','\x20user','Show\x20current\x20user\x20information','1261498eUMrWl','name','✔\x20Found\x20','Fetching\x20user\x20info...','12wYRESe','589380EmLmkH'];a43_0x45b0=function(){return _0x3e73fb;};return a43_0x45b0();}export class UserListCommand extends BaseCommand{[a43_0x249d60(0x14e)]=a43_0x249d60(0x15e);[a43_0x249d60(0x15b)]=a43_0x249d60(0x159);async[a43_0x249d60(0x156)](_0x13eff4){const _0x320f44=a43_0x249d60,{options:_0x23cb98,tdx:_0x562ed9}=_0x13eff4;try{const _0x1f2a75=await withSpinner(_0x320f44(0x148),()=>_0x562ed9[_0x320f44(0x163)][_0x320f44(0x162)](),{'verbose':_0x23cb98[_0x320f44(0x155)]}),_0x20a0c4=_0x1f2a75['data'];return console['error'](_0x320f44(0x14f)+_0x20a0c4[_0x320f44(0x15f)]+_0x320f44(0x14b)+(_0x20a0c4[_0x320f44(0x15f)]!==0x1?'s':'')),await handleSDKOutput(_0x20a0c4,_0x23cb98),0x0;}catch(_0x25ee31){if(_0x25ee31 instanceof SDKError)return console['error']('Error:\x20'+_0x25ee31['message']),_0x25ee31['cause']&&console[_0x320f44(0x15a)]('\x20\x20Cause:\x20'+_0x25ee31[_0x320f44(0x160)]),0x1;throw _0x25ee31;}}}
@@ -1 +1 @@
1
- const a44_0x5525a1=a44_0x31da;(function(_0x97c196,_0x23190b){const _0xbf111c=a44_0x31da,_0x264ded=_0x97c196();while(!![]){try{const _0x2d0e0a=parseInt(_0xbf111c(0x227))/0x1+-parseInt(_0xbf111c(0x20b))/0x2+parseInt(_0xbf111c(0x1ed))/0x3*(-parseInt(_0xbf111c(0x212))/0x4)+-parseInt(_0xbf111c(0x239))/0x5*(-parseInt(_0xbf111c(0x1b1))/0x6)+parseInt(_0xbf111c(0x1fe))/0x7*(parseInt(_0xbf111c(0x21b))/0x8)+parseInt(_0xbf111c(0x1c2))/0x9+-parseInt(_0xbf111c(0x207))/0xa;if(_0x2d0e0a===_0x23190b)break;else _0x264ded['push'](_0x264ded['shift']());}catch(_0x4c5318){_0x264ded['push'](_0x264ded['shift']());}}}(a44_0x225d,0xbe44a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a44_0x31da(_0x35b105,_0x2c6c27){_0x35b105=_0x35b105-0x1b0;const _0x225d53=a44_0x225d();let _0x31da06=_0x225d53[_0x35b105];return _0x31da06;}import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a44_0x225d(){const _0x507fbe=['Error:\x20Attempt\x20ID\x20is\x20required','Expected\x20format:\x20--param\x20key=value','Show\x20logs\x20for\x20a\x20workflow\x20attempt','name','substring','workflow:run','params','Filter:\x20project=','\x20session','isDirectory','logFiles','workflow:attempt','workflow:logs','\x20\x20Attempt\x20ID:\x20','attempts','List\x20workflows','Show\x20specific\x20attempt\x20details','session','workflows','\x20\x20New\x20attempt\x20ID:\x20','Error:\x20Workflow\x20identifier\x20is\x20required','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','download','✔\x20Retry\x20started','\x20\x20Files\x20extracted:\x20','\x20task','✔\x20Found\x20','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','\x20\x20Project\x20ID:\x20','Filter:\x20','717gOodNB','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','List\x20workflow\x20attempts','workflow:delete','Project\x20name:\x20','message','Error:\x20Invalid\x20JSON\x20in\x20--params','sessionId','Task\x20name:\x20','Error:\x20Invalid\x20parameter\x20format:\x20','logs','yes','success','canceling','\x20\x20Cause:\x20','...','Validation:\x20skipped','9153767VannTt','attempt','verbose','projects','split','project','task','Error:\x20','workflow:projects','3984930yYnnVT','Select\x20a\x20task\x20to\x20view\x20logs:','Usage:\x20workflow:delete\x20<project-name-or-id>','Attempt\x20ID:\x20','2506410aTZpbe','Force:\x20yes','Including\x20subtasks:\x20yes','Params:\x20','List\x20all\x20workflow\x20projects','includeRetried','Session\x20time:\x20','10196VPihPR','stringify','skipValidation','workflow:push','\x20\x20Session\x20ID:\x20','Listing\x20workflows...','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','sessions','\x20\x20Revision:\x20','8NGCTdc','\x20project','stat','getTime','Retrying\x20session...','Listing\x20workflow\x20sessions...','Revision:\x20','Starting\x20workflow\x20run...','Pattern:\x20','execute','readFile','revision','1319150eWXnHu','startsWith','\x20\x20Location:\x20','error','session:','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','retrySession','retryAttemptName','param','limit','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','✔\x20Workflow\x20run\x20started','running','description','\x20\x20Workflow:\x20','\x20is\x20not\x20a\x20directory','Retry\x20a\x20session\x20or\x20attempt','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','535CEdFYI','Downloading\x20logs...','Parameters:\x20','fs/promises','isArray','round','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','projectId','Project\x20filter:\x20','Output\x20directory:\x20','Getting\x20attempt\x20details...','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','length','\x22?\x20This\x20cannot\x20be\x20undone.','indexOf','keys','Project:\x20','Target:\x20','force','format','workflow','Error:\x20Project\x20name\x20is\x20required','From\x20task:\x20','workflow:attempts','cause','json','Getting\x20attempt\x20tasks...','workflow:workflows','7422sNiZrb','parse','Reason:\x20','utf-8','\x20\x20Project:\x20','index','No\x20log\x20content\x20found','Workflow:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Cancelled','✔\x20Pushed\x20','Listing\x20workflow\x20projects...','delete','status','finishedAt','attempt:','filesExtracted','2529513jzHslZ','data','workflow:tasks','select','from','Include\x20retried:\x20yes','createdAt','run','Retrying\x20attempt...','cancelRequested','fromTask','sessionTime','projectName'];a44_0x225d=function(){return _0x507fbe;};return a44_0x225d();}import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a44_0x2ce703 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{['name']=a44_0x5525a1(0x206);[a44_0x5525a1(0x234)]=a44_0x5525a1(0x20f);async[a44_0x5525a1(0x224)](_0x555a72){const _0x18dce0=a44_0x5525a1,{options:_0x5ba918,args:_0x3584af,tdx:_0x50e85}=_0x555a72,_0x136f33=_0x3584af[0x0];try{_0x5ba918[_0x18dce0(0x200)]&&_0x136f33&&console['error'](_0x18dce0(0x223)+_0x136f33);const _0x2f36bb=await withSpinner(_0x18dce0(0x1bc),()=>_0x50e85['workflow'][_0x18dce0(0x201)](_0x136f33,{'limit':_0x5ba918[_0x18dce0(0x230)]}),{'verbose':_0x5ba918[_0x18dce0(0x200)]}),_0x719909=_0x2f36bb['data'];return console[_0x18dce0(0x22a)](_0x18dce0(0x1e9)+_0x719909['length']+_0x18dce0(0x21c)+(_0x719909[_0x18dce0(0x246)]!==0x1?'s':'')),await handleSDKOutput(_0x719909,_0x5ba918),0x0;}catch(_0x308acb){if(_0x308acb instanceof SDKError)return console[_0x18dce0(0x22a)]('Error:\x20'+_0x308acb[_0x18dce0(0x1f2)]),_0x308acb[_0x18dce0(0x252)]&&console[_0x18dce0(0x22a)](_0x18dce0(0x1fb)+_0x308acb[_0x18dce0(0x252)]),0x1;throw _0x308acb;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]=a44_0x5525a1(0x1b0);[a44_0x5525a1(0x234)]=a44_0x5525a1(0x1de);async[a44_0x5525a1(0x224)](_0x3a229c){const _0x50ef67=a44_0x5525a1,{options:_0x414d2f,args:_0x3c6cf7,tdx:_0x1cd558}=_0x3a229c,_0x2c468a=_0x3c6cf7[0x0];try{_0x414d2f[_0x50ef67(0x200)]&&_0x2c468a&&console['error'](_0x50ef67(0x241)+_0x2c468a);const _0x597701=await withSpinner(_0x50ef67(0x217),()=>_0x1cd558['workflow'][_0x50ef67(0x1e1)](_0x2c468a,{'limit':_0x414d2f[_0x50ef67(0x230)]}),{'verbose':_0x414d2f[_0x50ef67(0x200)]}),_0x353025=_0x597701['data'];return console['error']('✔\x20Found\x20'+_0x353025[_0x50ef67(0x246)]+'\x20workflow'+(_0x353025[_0x50ef67(0x246)]!==0x1?'s':'')),await handleSDKOutput(_0x353025,_0x414d2f),0x0;}catch(_0x65d068){if(_0x65d068 instanceof SDKError)return console[_0x50ef67(0x22a)](_0x50ef67(0x205)+_0x65d068[_0x50ef67(0x1f2)]),_0x65d068[_0x50ef67(0x252)]&&console['error'](_0x50ef67(0x1fb)+_0x65d068['cause']),0x1;throw _0x65d068;}}}export class WorkflowSessionsCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]='workflow:sessions';[a44_0x5525a1(0x234)]='List\x20workflow\x20execution\x20sessions';async[a44_0x5525a1(0x224)](_0x1e93ad){const _0x5b496e=a44_0x5525a1,{options:_0x1583b9,args:_0x2a4744,tdx:_0xabb219}=_0x1e93ad;let _0x51f15f,_0x3df0c6;if(_0x2a4744[0x0]){const _0x4bf160=_0x2a4744[0x0][_0x5b496e(0x202)]('.');if(_0x4bf160[_0x5b496e(0x246)]===0x1)_0x51f15f=_0x4bf160[0x0];else{if(_0x4bf160[_0x5b496e(0x246)]===0x2)[_0x51f15f,_0x3df0c6]=_0x4bf160;else return console[_0x5b496e(0x22a)](_0x5b496e(0x1ee)),0x1;}}try{if(_0x1583b9[_0x5b496e(0x200)]){if(_0x51f15f&&_0x3df0c6)console[_0x5b496e(0x22a)](_0x5b496e(0x1ec)+_0x51f15f+'.'+_0x3df0c6);else _0x51f15f&&console[_0x5b496e(0x22a)]('Filter:\x20project='+_0x51f15f);const _0x18ab7d=_0x1583b9['status'];_0x18ab7d&&console['error']('Status:\x20'+_0x18ab7d);}const _0x27f40a=await withSpinner(_0x5b496e(0x220),()=>_0xabb219[_0x5b496e(0x24e)][_0x5b496e(0x219)]({'projectName':_0x51f15f,'workflowName':_0x3df0c6,'status':_0x1583b9[_0x5b496e(0x1be)],'fromTime':_0x1583b9[_0x5b496e(0x1c6)],'toTime':_0x1583b9['to'],'limit':_0x1583b9[_0x5b496e(0x230)]}),{'verbose':_0x1583b9[_0x5b496e(0x200)]}),_0x52bfd3=_0x27f40a[_0x5b496e(0x1c3)];return console['error']('✔\x20Found\x20'+_0x52bfd3[_0x5b496e(0x246)]+_0x5b496e(0x1d7)+(_0x52bfd3['length']!==0x1?'s':'')),await handleSDKOutput(_0x52bfd3,_0x1583b9),0x0;}catch(_0x148dae){if(_0x148dae instanceof SDKError)return console[_0x5b496e(0x22a)](_0x5b496e(0x205)+_0x148dae[_0x5b496e(0x1f2)]),_0x148dae['cause']&&console[_0x5b496e(0x22a)](_0x5b496e(0x1fb)+_0x148dae['cause']),0x1;throw _0x148dae;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]=a44_0x5525a1(0x251);[a44_0x5525a1(0x234)]=a44_0x5525a1(0x1ef);async[a44_0x5525a1(0x224)](_0x494031){const _0x18bf1e=a44_0x5525a1,{options:_0x2402aa,args:_0x1b5bea,tdx:_0x4010a6}=_0x494031;let _0x365b65,_0x3fc83e;if(_0x1b5bea[0x0]){const _0x58ef33=_0x1b5bea[0x0][_0x18bf1e(0x202)]('.');if(_0x58ef33[_0x18bf1e(0x246)]===0x1)_0x365b65=_0x58ef33[0x0];else{if(_0x58ef33[_0x18bf1e(0x246)]===0x2)[_0x365b65,_0x3fc83e]=_0x58ef33;else return console[_0x18bf1e(0x22a)](_0x18bf1e(0x1ee)),0x1;}}try{const _0xfbde9b=_0x2402aa[_0x18bf1e(0x210)];if(_0x2402aa[_0x18bf1e(0x200)]){if(_0x365b65&&_0x3fc83e)console[_0x18bf1e(0x22a)](_0x18bf1e(0x1ec)+_0x365b65+'.'+_0x3fc83e);else _0x365b65&&console[_0x18bf1e(0x22a)](_0x18bf1e(0x1d6)+_0x365b65);_0xfbde9b&&console[_0x18bf1e(0x22a)](_0x18bf1e(0x1c7));}const _0x5ef6ba=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x4010a6[_0x18bf1e(0x24e)][_0x18bf1e(0x1dd)]({'projectName':_0x365b65,'workflowName':_0x3fc83e,'includeRetried':_0xfbde9b,'limit':_0x2402aa[_0x18bf1e(0x230)]}),{'verbose':_0x2402aa[_0x18bf1e(0x200)]}),_0x2bcf02=_0x5ef6ba[_0x18bf1e(0x1c3)];return console[_0x18bf1e(0x22a)](_0x18bf1e(0x1e9)+_0x2bcf02[_0x18bf1e(0x246)]+'\x20attempt'+(_0x2bcf02['length']!==0x1?'s':'')),await handleSDKOutput(_0x2bcf02,_0x2402aa),0x0;}catch(_0x1ae297){if(_0x1ae297 instanceof SDKError)return console[_0x18bf1e(0x22a)](_0x18bf1e(0x205)+_0x1ae297[_0x18bf1e(0x1f2)]),_0x1ae297[_0x18bf1e(0x252)]&&console[_0x18bf1e(0x22a)](_0x18bf1e(0x1fb)+_0x1ae297[_0x18bf1e(0x252)]),0x1;throw _0x1ae297;}}}export class WorkflowAttemptCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]=a44_0x5525a1(0x1da);[a44_0x5525a1(0x234)]=a44_0x5525a1(0x1df);async[a44_0x5525a1(0x224)](_0x343fdd){const _0x341b5a=a44_0x5525a1,{options:_0x2bee2a,args:_0x172069,tdx:_0x56c341}=_0x343fdd,_0x26c4b0=_0x172069[0x0];if(!_0x26c4b0)return console[_0x341b5a(0x22a)](_0x341b5a(0x1cf)),0x1;try{_0x2bee2a[_0x341b5a(0x200)]&&console[_0x341b5a(0x22a)](_0x341b5a(0x20a)+_0x26c4b0);const _0x305cb3=await withSpinner(_0x341b5a(0x243),()=>_0x56c341['workflow'][_0x341b5a(0x1ff)](_0x26c4b0),{'verbose':_0x2bee2a[_0x341b5a(0x200)]}),_0x337f3a=_0x305cb3[_0x341b5a(0x1c3)];let _0x372b7a;!_0x337f3a['done']?_0x372b7a=_0x337f3a[_0x341b5a(0x1cb)]?_0x341b5a(0x1fa):_0x341b5a(0x233):_0x372b7a=_0x337f3a[_0x341b5a(0x1f9)]?_0x341b5a(0x1f9):'error';let _0x87c742;if(_0x337f3a[_0x341b5a(0x1c8)]&&_0x337f3a[_0x341b5a(0x1bf)]){const _0x58f2d5=new Date(_0x337f3a[_0x341b5a(0x1c8)])[_0x341b5a(0x21e)](),_0x523d73=new Date(_0x337f3a[_0x341b5a(0x1bf)])[_0x341b5a(0x21e)]();_0x87c742=Math[_0x341b5a(0x23e)]((_0x523d73-_0x58f2d5)/0x3e8);}const _0x14a73e={'attempt_id':_0x337f3a['id'],'status':_0x372b7a,..._0x337f3a[_0x341b5a(0x1b6)]!==undefined&&{'index':_0x337f3a[_0x341b5a(0x1b6)]},..._0x337f3a[_0x341b5a(0x203)]&&{'project':_0x337f3a[_0x341b5a(0x203)][_0x341b5a(0x1d2)]},..._0x337f3a[_0x341b5a(0x24e)]&&{'workflow':_0x337f3a[_0x341b5a(0x24e)][_0x341b5a(0x1d2)]},..._0x337f3a[_0x341b5a(0x1f4)]&&{'session_id':_0x337f3a[_0x341b5a(0x1f4)]},..._0x337f3a[_0x341b5a(0x1cd)]&&{'session_time':_0x337f3a['sessionTime']},..._0x337f3a['retryAttemptName']&&{'retry_attempt':_0x337f3a[_0x341b5a(0x22e)]},..._0x87c742!==undefined&&{'duration_sec':_0x87c742},..._0x337f3a[_0x341b5a(0x1c8)]&&{'created_at':_0x337f3a['createdAt']},..._0x337f3a[_0x341b5a(0x1bf)]&&{'finished_at':_0x337f3a[_0x341b5a(0x1bf)]},...Object[_0x341b5a(0x249)](_0x337f3a[_0x341b5a(0x1d5)])['length']>0x0&&{'params':_0x337f3a[_0x341b5a(0x1d5)]}};return await handleSingleObjectOutput(_0x14a73e,_0x2bee2a),0x0;}catch(_0x2c1374){if(_0x2c1374 instanceof SDKError)return console[_0x341b5a(0x22a)](_0x341b5a(0x205)+_0x2c1374['message']),_0x2c1374[_0x341b5a(0x252)]&&console[_0x341b5a(0x22a)](_0x341b5a(0x1fb)+_0x2c1374['cause']),0x1;throw _0x2c1374;}}}export class WorkflowTasksCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]=a44_0x5525a1(0x1c4);[a44_0x5525a1(0x234)]='Show\x20tasks\x20for\x20an\x20attempt';async['execute'](_0x432148){const _0x13a096=a44_0x5525a1,{options:_0x486e63,args:_0x7481b6,tdx:_0x16444c}=_0x432148,_0x44a01e=_0x7481b6[0x0];if(!_0x44a01e)return console[_0x13a096(0x22a)](_0x13a096(0x1cf)),0x1;try{const _0x14ea17=_0x486e63['includeSubtasks'];_0x486e63[_0x13a096(0x200)]&&(console[_0x13a096(0x22a)](_0x13a096(0x20a)+_0x44a01e),_0x14ea17&&console[_0x13a096(0x22a)](_0x13a096(0x20d)));const _0x3687f7=await withSpinner(_0x13a096(0x254),()=>_0x16444c['workflow']['tasks'](_0x44a01e,_0x14ea17||![]),{'verbose':_0x486e63[_0x13a096(0x200)]}),_0x29511e=_0x3687f7[_0x13a096(0x1c3)];return console[_0x13a096(0x22a)](_0x13a096(0x1e9)+_0x29511e['length']+_0x13a096(0x1e8)+(_0x29511e[_0x13a096(0x246)]!==0x1?'s':'')),await handleSDKOutput(_0x29511e,_0x486e63),0x0;}catch(_0x2f5769){if(_0x2f5769 instanceof SDKError)return console[_0x13a096(0x22a)](_0x13a096(0x205)+_0x2f5769['message']),_0x2f5769['cause']&&console['error'](_0x13a096(0x1fb)+_0x2f5769[_0x13a096(0x252)]),0x1;throw _0x2f5769;}}}export class WorkflowLogsCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]=a44_0x5525a1(0x1db);[a44_0x5525a1(0x234)]=a44_0x5525a1(0x1d1);async[a44_0x5525a1(0x224)](_0x4fed4f){const _0x47405a=a44_0x5525a1,{options:_0x121e48,args:_0x230718,tdx:_0x1c1a54}=_0x4fed4f,_0x102357=_0x230718[0x0];let _0x2a8a29=_0x230718[0x1];if(!_0x102357)return console[_0x47405a(0x22a)](_0x47405a(0x1cf)),0x1;try{_0x121e48[_0x47405a(0x200)]&&(console[_0x47405a(0x22a)](_0x47405a(0x20a)+_0x102357),_0x2a8a29&&console['error'](_0x47405a(0x1f5)+_0x2a8a29));const _0x2439a8=await withSpinner('Fetching\x20log\x20files...',()=>_0x1c1a54[_0x47405a(0x24e)][_0x47405a(0x1d9)](_0x102357,_0x2a8a29),{'verbose':_0x121e48[_0x47405a(0x200)]}),_0xfb55a8=_0x2439a8['data'];if(_0xfb55a8[_0x47405a(0x246)]===0x0)return console[_0x47405a(0x22a)]('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x2a8a29&&(_0x121e48[_0x47405a(0x253)]||_0x121e48[_0x47405a(0x24d)]))return await handleSDKOutput(_0xfb55a8,_0x121e48),0x0;if(!_0x2a8a29){const _0x3a1486=_0xfb55a8['map'](_0x2db09a=>({'title':_0x2db09a['taskName']+'\x20('+formatBytes(_0x2db09a['fileSize'])+')','value':_0x2db09a['taskName']})),_0x18ff62=await a44_0x2ce703({'type':_0x47405a(0x1c5),'name':_0x47405a(0x204),'message':_0x47405a(0x208),'choices':_0x3a1486});if(!_0x18ff62[_0x47405a(0x204)])return console['error'](_0x47405a(0x1ba)),0x0;_0x2a8a29=_0x18ff62[_0x47405a(0x204)];}const _0x260901=await withSpinner(_0x47405a(0x23a),()=>_0x1c1a54[_0x47405a(0x24e)][_0x47405a(0x1f7)](_0x102357,_0x2a8a29),{'verbose':_0x121e48['verbose']}),_0x5e173c=_0x260901[_0x47405a(0x1c3)];return _0x5e173c?console['log'](_0x5e173c):console['error'](_0x47405a(0x1b7)),0x0;}catch(_0x77444a){if(_0x77444a instanceof SDKError)return console[_0x47405a(0x22a)](_0x47405a(0x205)+_0x77444a[_0x47405a(0x1f2)]),_0x77444a[_0x47405a(0x252)]&&console[_0x47405a(0x22a)]('\x20\x20Cause:\x20'+_0x77444a[_0x47405a(0x252)]),0x1;throw _0x77444a;}}}export class WorkflowKillCommand extends BaseCommand{['name']='workflow:kill';[a44_0x5525a1(0x234)]='Kill\x20a\x20running\x20attempt';async['execute'](_0x1ff8ff){const _0x572643=a44_0x5525a1,{options:_0x4faf3d,args:_0x36f5d9,tdx:_0x2ba218}=_0x1ff8ff,_0x97dd53=_0x36f5d9[0x0];if(!_0x97dd53)return console['error'](_0x572643(0x1cf)),0x1;try{const _0x3f29a9=_0x4faf3d['reason'];_0x4faf3d[_0x572643(0x200)]&&(console['error'](_0x572643(0x20a)+_0x97dd53),_0x3f29a9&&console[_0x572643(0x22a)](_0x572643(0x1b3)+_0x3f29a9));if(!_0x4faf3d[_0x572643(0x1f8)]){const _0x41383b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x97dd53+'?');if(!_0x41383b)return console[_0x572643(0x22a)](_0x572643(0x1ba)),0x0;}const _0x1b1b41=await withSpinner('Killing\x20attempt...',()=>_0x2ba218[_0x572643(0x24e)]['kill'](_0x97dd53,_0x3f29a9),{'verbose':_0x4faf3d[_0x572643(0x200)]}),_0x17b44a=_0x1b1b41[_0x572643(0x1c3)];return console[_0x572643(0x22a)]('✔\x20'+_0x17b44a),0x0;}catch(_0x56e9fc){if(_0x56e9fc instanceof SDKError)return console[_0x572643(0x22a)](_0x572643(0x205)+_0x56e9fc[_0x572643(0x1f2)]),_0x56e9fc[_0x572643(0x252)]&&console[_0x572643(0x22a)](_0x572643(0x1fb)+_0x56e9fc[_0x572643(0x252)]),0x1;throw _0x56e9fc;}}}export class WorkflowRetryCommand extends BaseCommand{['name']='workflow:retry';['description']=a44_0x5525a1(0x237);async[a44_0x5525a1(0x224)](_0x24ef6b){const _0x4572d6=a44_0x5525a1,{options:_0x35e8b5,args:_0x5081c9,tdx:_0x263f99}=_0x24ef6b,_0x2acf4b=_0x5081c9[0x0];if(!_0x2acf4b)return console[_0x4572d6(0x22a)](_0x4572d6(0x1e4)),console[_0x4572d6(0x22a)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x2b21a8=![],_0x5a90cf=_0x2acf4b;if(_0x2acf4b[_0x4572d6(0x228)](_0x4572d6(0x22b)))_0x2b21a8=!![],_0x5a90cf=_0x2acf4b['substring'](0x8);else{if(_0x2acf4b[_0x4572d6(0x228)](_0x4572d6(0x1c0)))_0x2b21a8=![],_0x5a90cf=_0x2acf4b[_0x4572d6(0x1d3)](0x8);else return console[_0x4572d6(0x22a)](_0x4572d6(0x231)),console['error'](_0x4572d6(0x22c)),0x1;}try{const _0x247209=_0x35e8b5[_0x4572d6(0x1cc)],_0x469575=_0x35e8b5['resumeFrom'],_0x2768b2=_0x35e8b5[_0x4572d6(0x1d5)],_0x332d2b=_0x35e8b5[_0x4572d6(0x24c)];_0x35e8b5[_0x4572d6(0x200)]&&(console['error'](_0x4572d6(0x24b)+(_0x2b21a8?_0x4572d6(0x1e0):_0x4572d6(0x1ff))+'\x20'+_0x5a90cf),_0x247209&&console[_0x4572d6(0x22a)](_0x4572d6(0x250)+_0x247209),_0x469575&&console[_0x4572d6(0x22a)]('Resume\x20from:\x20'+_0x469575),_0x2768b2&&console['error'](_0x4572d6(0x20e)+_0x2768b2),_0x332d2b&&console[_0x4572d6(0x22a)](_0x4572d6(0x20c)));let _0x16d5ff;if(_0x2768b2)try{if(_0x2768b2['startsWith']('@')){const _0x5118c7=await import(_0x4572d6(0x23c)),_0x19dba0=_0x2768b2[_0x4572d6(0x1d3)](0x1),_0x5dfb68=await _0x5118c7[_0x4572d6(0x225)](_0x19dba0,_0x4572d6(0x1b4));_0x16d5ff=JSON['parse'](_0x5dfb68);}else _0x16d5ff=JSON[_0x4572d6(0x1b2)](_0x2768b2);}catch{return console[_0x4572d6(0x22a)](_0x4572d6(0x1f3)),0x1;}if(!_0x35e8b5[_0x4572d6(0x1f8)]){const _0x44fd52=await confirm(_0x4572d6(0x218)+(_0x2b21a8?_0x4572d6(0x1e0):_0x4572d6(0x1ff))+'\x20'+_0x5a90cf+'?');if(!_0x44fd52)return console[_0x4572d6(0x22a)]('Cancelled'),0x0;}let _0x5da4f0;_0x2b21a8?_0x5da4f0=await withSpinner(_0x4572d6(0x21f),()=>_0x263f99[_0x4572d6(0x24e)][_0x4572d6(0x22d)](_0x5a90cf,{'fromTask':_0x247209,'retryParams':_0x16d5ff}),{'verbose':_0x35e8b5[_0x4572d6(0x200)]}):_0x5da4f0=await withSpinner(_0x4572d6(0x1ca),()=>_0x263f99[_0x4572d6(0x24e)]['retryAttempt'](_0x5a90cf,{'resumeFrom':_0x469575,'retryParams':_0x16d5ff,'force':_0x332d2b}),{'verbose':_0x35e8b5[_0x4572d6(0x200)]});const _0x1bf875=_0x5da4f0[_0x4572d6(0x1c3)];return console[_0x4572d6(0x22a)](_0x4572d6(0x1e6)),console[_0x4572d6(0x22a)](_0x4572d6(0x1e2)+_0x1bf875['attemptId']),console[_0x4572d6(0x22a)](_0x4572d6(0x216)+_0x1bf875[_0x4572d6(0x1f4)]),0x0;}catch(_0x33088f){if(_0x33088f instanceof SDKError)return console[_0x4572d6(0x22a)](_0x4572d6(0x205)+_0x33088f[_0x4572d6(0x1f2)]),_0x33088f[_0x4572d6(0x252)]&&console['error'](_0x4572d6(0x1fb)+_0x33088f['cause']),0x1;throw _0x33088f;}}}export class WorkflowRunCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]=a44_0x5525a1(0x1d4);[a44_0x5525a1(0x234)]='Start\x20a\x20workflow\x20run';async[a44_0x5525a1(0x224)](_0x24e253){const _0x23c951=a44_0x5525a1,{options:_0x5c0a46,args:_0x4d6c56,tdx:_0x31e7a2}=_0x24e253,_0x2041db=_0x4d6c56[0x0];if(!_0x2041db)return console[_0x23c951(0x22a)](_0x23c951(0x1e3)),console['error'](_0x23c951(0x245)),0x1;const _0x3d43e9=_0x5c0a46[_0x23c951(0x22f)],_0x4b5ffa=_0x5c0a46['sessionTime'],_0x17e849={};if(_0x3d43e9&&Array[_0x23c951(0x23d)](_0x3d43e9))for(const _0x293b69 of _0x3d43e9){const _0x3328c9=_0x293b69[_0x23c951(0x248)]('=');if(_0x3328c9===-0x1)return console[_0x23c951(0x22a)](_0x23c951(0x1f6)+_0x293b69),console['error'](_0x23c951(0x1d0)),0x1;const _0x487377=_0x293b69[_0x23c951(0x1d3)](0x0,_0x3328c9),_0x15552d=_0x293b69['substring'](_0x3328c9+0x1);try{_0x17e849[_0x487377]=JSON[_0x23c951(0x1b2)](_0x15552d);}catch{_0x17e849[_0x487377]=_0x15552d;}}_0x5c0a46[_0x23c951(0x200)]&&(console['error'](_0x23c951(0x1b8)+_0x2041db),Object['keys'](_0x17e849)[_0x23c951(0x246)]>0x0&&console[_0x23c951(0x22a)](_0x23c951(0x23b)+JSON[_0x23c951(0x213)](_0x17e849)),_0x4b5ffa&&console[_0x23c951(0x22a)](_0x23c951(0x211)+_0x4b5ffa));const _0x27af1e=await withSpinner(_0x23c951(0x222),()=>_0x31e7a2[_0x23c951(0x24e)][_0x23c951(0x1c9)](_0x2041db,_0x17e849,{'sessionTime':_0x4b5ffa}),{'verbose':_0x5c0a46['verbose']}),_0x1ffda2=_0x27af1e[_0x23c951(0x1c3)];return console[_0x23c951(0x22a)](_0x23c951(0x232)),console[_0x23c951(0x22a)](_0x23c951(0x1dc)+_0x1ffda2['id']),console['error']('\x20\x20Session\x20ID:\x20'+_0x1ffda2[_0x23c951(0x1f4)]),console[_0x23c951(0x22a)](_0x23c951(0x1b5)+_0x1ffda2[_0x23c951(0x203)]?.['name']),console['error'](_0x23c951(0x235)+_0x1ffda2[_0x23c951(0x24e)]?.[_0x23c951(0x1d2)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]='workflow:download';[a44_0x5525a1(0x234)]=a44_0x5525a1(0x244);async[a44_0x5525a1(0x224)](_0x1adf41){const _0xffacb3=a44_0x5525a1,{options:_0x3c739c,args:_0x57f4fc,tdx:_0xd76216}=_0x1adf41,_0x5dd22d=_0x57f4fc[0x0],_0x582422=_0x57f4fc[0x1]||'.';if(!_0x5dd22d)return console[_0xffacb3(0x22a)](_0xffacb3(0x24f)),console['error'](_0xffacb3(0x238)),0x1;const _0x2089a0=_0x3c739c[_0xffacb3(0x226)];_0x3c739c[_0xffacb3(0x200)]&&(console[_0xffacb3(0x22a)](_0xffacb3(0x24a)+_0x5dd22d),console[_0xffacb3(0x22a)](_0xffacb3(0x242)+_0x582422),_0x2089a0&&console['error']('Revision:\x20'+_0x2089a0));const _0x569880=await withSpinner('Downloading\x20project\x20'+_0x5dd22d+_0xffacb3(0x1fc),()=>_0xd76216[_0xffacb3(0x24e)][_0xffacb3(0x1e5)](_0x5dd22d,_0x582422,{'revision':_0x2089a0}),{'verbose':_0x3c739c[_0xffacb3(0x200)]}),_0x34421b=_0x569880[_0xffacb3(0x1c3)];return console[_0xffacb3(0x22a)]('✔\x20Downloaded\x20'+_0x34421b[_0xffacb3(0x1ce)]),console[_0xffacb3(0x22a)](_0xffacb3(0x21a)+_0x34421b[_0xffacb3(0x226)]),console[_0xffacb3(0x22a)](_0xffacb3(0x1e7)+_0x34421b[_0xffacb3(0x1c1)]),console[_0xffacb3(0x22a)](_0xffacb3(0x229)+_0x582422+'/'+_0x34421b[_0xffacb3(0x1ce)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]=a44_0x5525a1(0x215);[a44_0x5525a1(0x234)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a44_0x5525a1(0x224)](_0x3fbdaf){const _0x697190=a44_0x5525a1,{options:_0x2f86d8,args:_0x227533,tdx:_0x1c0a86}=_0x3fbdaf;let _0x1db126='.',_0x474d6e=_0x2f86d8[_0x697190(0x1d2)];if(_0x227533[0x0]){const {promises:_0x514ebf}=await import('fs');try{const _0x528fbc=await _0x514ebf[_0x697190(0x21d)](_0x227533[0x0]);if(_0x528fbc[_0x697190(0x1d8)]())_0x1db126=_0x227533[0x0];else return console[_0x697190(0x22a)](_0x697190(0x205)+_0x227533[0x0]+_0x697190(0x236)),0x1;}catch{_0x474d6e=_0x227533[0x0],_0x1db126='.';}}const _0x41767e=_0x2f86d8[_0x697190(0x226)],_0x30cc5d=_0x2f86d8[_0x697190(0x214)];_0x2f86d8['verbose']&&(console[_0x697190(0x22a)]('Project\x20directory:\x20'+_0x1db126),_0x474d6e&&console[_0x697190(0x22a)](_0x697190(0x1f1)+_0x474d6e),_0x41767e&&console[_0x697190(0x22a)](_0x697190(0x221)+_0x41767e),_0x30cc5d&&console['error'](_0x697190(0x1fd)));const _0x3d1e85=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x1c0a86[_0x697190(0x24e)]['push'](_0x1db126,{'projectName':_0x474d6e,'revision':_0x41767e,'skipValidation':_0x30cc5d}),{'verbose':_0x2f86d8[_0x697190(0x200)]}),_0x1fb749=_0x3d1e85[_0x697190(0x1c3)];return console[_0x697190(0x22a)](_0x697190(0x1bb)+_0x1fb749[_0x697190(0x1ce)]),console['error'](_0x697190(0x1eb)+_0x1fb749['projectId']),console[_0x697190(0x22a)](_0x697190(0x21a)+_0x1fb749[_0x697190(0x226)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x5525a1(0x1d2)]=a44_0x5525a1(0x1f0);[a44_0x5525a1(0x234)]=a44_0x5525a1(0x23f);async[a44_0x5525a1(0x224)](_0x58ca15){const _0x525578=a44_0x5525a1,{options:_0x15974e,args:_0x458c40,tdx:_0x35586a}=_0x58ca15,_0x460f3d=_0x458c40[0x0];if(!_0x460f3d)return console[_0x525578(0x22a)](_0x525578(0x1ea)),console[_0x525578(0x22a)](_0x525578(0x209)),0x1;_0x15974e[_0x525578(0x200)]&&console[_0x525578(0x22a)](_0x525578(0x24a)+_0x460f3d);if(!_0x15974e['yes']){const _0x323254=await confirm(_0x525578(0x1b9)+_0x460f3d+_0x525578(0x247));if(!_0x323254)return console[_0x525578(0x22a)]('Cancelled'),0x0;}const _0x1ae94f=await withSpinner('Deleting\x20project\x20'+_0x460f3d+_0x525578(0x1fc),()=>_0x35586a[_0x525578(0x24e)][_0x525578(0x1bd)](_0x460f3d),{'verbose':_0x15974e[_0x525578(0x200)]}),_0x1b0e68=_0x1ae94f[_0x525578(0x1c3)];return console[_0x525578(0x22a)]('✔\x20Deleted\x20project\x20'+_0x1b0e68['projectName']),console[_0x525578(0x22a)](_0x525578(0x1eb)+_0x1b0e68[_0x525578(0x240)]),0x0;}}
1
+ const a44_0x16383b=a44_0x3f12;(function(_0x263e41,_0x400f82){const _0xe93d38=a44_0x3f12,_0x6da8bc=_0x263e41();while(!![]){try{const _0x33bf3b=parseInt(_0xe93d38(0x96))/0x1*(-parseInt(_0xe93d38(0xa3))/0x2)+parseInt(_0xe93d38(0xf2))/0x3*(parseInt(_0xe93d38(0xf7))/0x4)+-parseInt(_0xe93d38(0xb2))/0x5+-parseInt(_0xe93d38(0xbb))/0x6+parseInt(_0xe93d38(0xc9))/0x7+-parseInt(_0xe93d38(0xdc))/0x8+parseInt(_0xe93d38(0xd1))/0x9;if(_0x33bf3b===_0x400f82)break;else _0x6da8bc['push'](_0x6da8bc['shift']());}catch(_0x524d1d){_0x6da8bc['push'](_0x6da8bc['shift']());}}}(a44_0x5e5d,0x7265b));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 a44_0x210539 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0xd5);[a44_0x16383b(0xde)]=a44_0x16383b(0xd7);async[a44_0x16383b(0x121)](_0x5cc5f){const _0x5423e6=a44_0x16383b,{options:_0x27e056,args:_0x51547b,tdx:_0x264647}=_0x5cc5f,_0x545d4d=_0x51547b[0x0];try{_0x27e056[_0x5423e6(0x10d)]&&_0x545d4d&&console[_0x5423e6(0xdf)](_0x5423e6(0x10b)+_0x545d4d);const _0x1f63b3=await withSpinner(_0x5423e6(0x112),()=>_0x264647[_0x5423e6(0x10f)][_0x5423e6(0x87)](_0x545d4d,{'limit':_0x27e056[_0x5423e6(0xb8)]}),{'verbose':_0x27e056['verbose']}),_0x3c5f87=_0x1f63b3['data'];return console[_0x5423e6(0xdf)](_0x5423e6(0xbd)+_0x3c5f87[_0x5423e6(0x118)]+_0x5423e6(0x105)+(_0x3c5f87[_0x5423e6(0x118)]!==0x1?'s':'')),await handleSDKOutput(_0x3c5f87,_0x27e056),0x0;}catch(_0x1dec0d){if(_0x1dec0d instanceof SDKError)return console[_0x5423e6(0xdf)](_0x5423e6(0xf4)+_0x1dec0d[_0x5423e6(0x8c)]),_0x1dec0d['cause']&&console[_0x5423e6(0xdf)](_0x5423e6(0xb1)+_0x1dec0d[_0x5423e6(0xbf)]),0x1;throw _0x1dec0d;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x124);[a44_0x16383b(0xde)]='List\x20workflows';async[a44_0x16383b(0x121)](_0x5452ba){const _0x3148b4=a44_0x16383b,{options:_0x3c269a,args:_0x31a0a3,tdx:_0x37af11}=_0x5452ba,_0x5253da=_0x31a0a3[0x0];try{_0x3c269a[_0x3148b4(0x10d)]&&_0x5253da&&console[_0x3148b4(0xdf)](_0x3148b4(0x122)+_0x5253da);const _0xd1661e=await withSpinner(_0x3148b4(0x10e),()=>_0x37af11['workflow'][_0x3148b4(0x107)](_0x5253da,{'limit':_0x3c269a[_0x3148b4(0xb8)]}),{'verbose':_0x3c269a[_0x3148b4(0x10d)]}),_0x5609eb=_0xd1661e[_0x3148b4(0xb7)];return console[_0x3148b4(0xdf)](_0x3148b4(0xbd)+_0x5609eb[_0x3148b4(0x118)]+_0x3148b4(0xc1)+(_0x5609eb['length']!==0x1?'s':'')),await handleSDKOutput(_0x5609eb,_0x3c269a),0x0;}catch(_0x36a81a){if(_0x36a81a instanceof SDKError)return console['error'](_0x3148b4(0xf4)+_0x36a81a[_0x3148b4(0x8c)]),_0x36a81a['cause']&&console[_0x3148b4(0xdf)](_0x3148b4(0xb1)+_0x36a81a[_0x3148b4(0xbf)]),0x1;throw _0x36a81a;}}}function a44_0x5e5d(){const _0x28166a=['workflow:kill','\x22?\x20This\x20cannot\x20be\x20undone.','List\x20workflow\x20execution\x20sessions','Retry\x20a\x20session\x20or\x20attempt','kill','Error:\x20Invalid\x20parameter\x20format:\x20','...','stringify','log','23mTuaUv','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Error:\x20Project\x20name\x20is\x20required','\x20\x20Revision:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Including\x20subtasks:\x20yes','workflow:delete','\x20\x20Project\x20ID:\x20','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','parse','split','\x20session','retryAttemptName','59886hFLOzi','Project:\x20','Session\x20time:\x20','fileSize','Error:\x20Attempt\x20ID\x20is\x20required','json','\x20is\x20not\x20a\x20directory','projectId','projectName','getTime','workflow:sessions','stat','done','running','\x20\x20Cause:\x20','1247905eFDvNc','name','\x20task','Getting\x20attempt\x20tasks...','Filter:\x20','data','limit','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','substring','5179044hQYUBZ','Pushing\x20workflow\x20project...','✔\x20Found\x20','task','cause','revision','\x20workflow','✔\x20Downloaded\x20','Error:\x20Workflow\x20identifier\x20is\x20required','project','logs','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','delete','Include\x20retried:\x20yes','6144257PFOZSl','cancelRequested','attempt','canceling','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Resume\x20from:\x20','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','reason','19123542biCsBs','Filter:\x20project=','isArray','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','workflow:projects','createdAt','List\x20all\x20workflow\x20projects','format','utf-8','finishedAt','attemptId','6113264UhAIyc','Project\x20directory:\x20','description','error','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Kill\x20a\x20running\x20attempt','success','Show\x20specific\x20attempt\x20details','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','From\x20task:\x20','No\x20log\x20content\x20found','map','params','Task\x20name:\x20','workflow:push','Retrying\x20session...','param','✔\x20Retry\x20started','retryAttempt','Show\x20tasks\x20for\x20an\x20attempt','\x20\x20Location:\x20','sessionTime','21OohWyl','Deleting\x20project\x20','Error:\x20','List\x20workflow\x20attempts','workflow:attempts','18048OFpkmT','yes','index','skipValidation','taskName','status','filesExtracted','attempt:','Attempt\x20ID:\x20','fs/promises','workflow:retry','✔\x20Pushed\x20','Expected\x20format:\x20--param\x20key=value','attempts','\x20project','Reason:\x20','workflows','\x20\x20Workflow:\x20','download','Validation:\x20skipped','Pattern:\x20','Listing\x20workflow\x20sessions...','verbose','Listing\x20workflows...','workflow','startsWith','workflow:attempt','Listing\x20workflow\x20projects...','Parameters:\x20','session:','workflow:logs','Start\x20a\x20workflow\x20run','Starting\x20workflow\x20run...','length','✔\x20Deleted\x20project\x20','includeSubtasks','includeRetried','Revision:\x20','No\x20log\x20files\x20found\x20for\x20this\x20attempt','retrySession','Show\x20logs\x20for\x20a\x20workflow\x20attempt','sessions','execute','Project\x20filter:\x20','sessionId','workflow:workflows','session','Listing\x20workflow\x20attempts...','readFile','Target:\x20','keys','\x20attempt','force','from','\x20\x20Session\x20ID:\x20','projects','select','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20\x20Attempt\x20ID:\x20','Usage:\x20workflow:delete\x20<project-name-or-id>','message'];a44_0x5e5d=function(){return _0x28166a;};return a44_0x5e5d();}export class WorkflowSessionsCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0xad);[a44_0x16383b(0xde)]=a44_0x16383b(0x8f);async[a44_0x16383b(0x121)](_0x37ef64){const _0x44f5ab=a44_0x16383b,{options:_0x5ed4a0,args:_0x260cf0,tdx:_0x44fbd8}=_0x37ef64;let _0x433ffc,_0x56b037;if(_0x260cf0[0x0]){const _0x40f46f=_0x260cf0[0x0][_0x44f5ab(0xa0)]('.');if(_0x40f46f[_0x44f5ab(0x118)]===0x1)_0x433ffc=_0x40f46f[0x0];else{if(_0x40f46f['length']===0x2)[_0x433ffc,_0x56b037]=_0x40f46f;else return console[_0x44f5ab(0xdf)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x5ed4a0[_0x44f5ab(0x10d)]){if(_0x433ffc&&_0x56b037)console['error'](_0x44f5ab(0xb6)+_0x433ffc+'.'+_0x56b037);else _0x433ffc&&console['error'](_0x44f5ab(0xd2)+_0x433ffc);const _0xd04765=_0x5ed4a0[_0x44f5ab(0xfc)];_0xd04765&&console[_0x44f5ab(0xdf)]('Status:\x20'+_0xd04765);}const _0x26968f=await withSpinner(_0x44f5ab(0x10c),()=>_0x44fbd8[_0x44f5ab(0x10f)][_0x44f5ab(0x120)]({'projectName':_0x433ffc,'workflowName':_0x56b037,'status':_0x5ed4a0['status'],'fromTime':_0x5ed4a0[_0x44f5ab(0x85)],'toTime':_0x5ed4a0['to'],'limit':_0x5ed4a0[_0x44f5ab(0xb8)]}),{'verbose':_0x5ed4a0[_0x44f5ab(0x10d)]}),_0x280687=_0x26968f[_0x44f5ab(0xb7)];return console[_0x44f5ab(0xdf)]('✔\x20Found\x20'+_0x280687[_0x44f5ab(0x118)]+_0x44f5ab(0xa1)+(_0x280687[_0x44f5ab(0x118)]!==0x1?'s':'')),await handleSDKOutput(_0x280687,_0x5ed4a0),0x0;}catch(_0x4634f0){if(_0x4634f0 instanceof SDKError)return console[_0x44f5ab(0xdf)](_0x44f5ab(0xf4)+_0x4634f0[_0x44f5ab(0x8c)]),_0x4634f0['cause']&&console['error'](_0x44f5ab(0xb1)+_0x4634f0[_0x44f5ab(0xbf)]),0x1;throw _0x4634f0;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a44_0x16383b(0xf6);['description']=a44_0x16383b(0xf5);async['execute'](_0x3812a1){const _0x257218=a44_0x16383b,{options:_0x2671c8,args:_0x4eaf41,tdx:_0x3a40a5}=_0x3812a1;let _0x1b32dd,_0x1ef97f;if(_0x4eaf41[0x0]){const _0x27d70a=_0x4eaf41[0x0][_0x257218(0xa0)]('.');if(_0x27d70a[_0x257218(0x118)]===0x1)_0x1b32dd=_0x27d70a[0x0];else{if(_0x27d70a[_0x257218(0x118)]===0x2)[_0x1b32dd,_0x1ef97f]=_0x27d70a;else return console[_0x257218(0xdf)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x44c3c6=_0x2671c8[_0x257218(0x11b)];if(_0x2671c8[_0x257218(0x10d)]){if(_0x1b32dd&&_0x1ef97f)console['error'](_0x257218(0xb6)+_0x1b32dd+'.'+_0x1ef97f);else _0x1b32dd&&console[_0x257218(0xdf)](_0x257218(0xd2)+_0x1b32dd);_0x44c3c6&&console[_0x257218(0xdf)](_0x257218(0xc8));}const _0x5d105e=await withSpinner(_0x257218(0x126),()=>_0x3a40a5[_0x257218(0x10f)][_0x257218(0x104)]({'projectName':_0x1b32dd,'workflowName':_0x1ef97f,'includeRetried':_0x44c3c6,'limit':_0x2671c8[_0x257218(0xb8)]}),{'verbose':_0x2671c8[_0x257218(0x10d)]}),_0x3d400c=_0x5d105e[_0x257218(0xb7)];return console['error'](_0x257218(0xbd)+_0x3d400c['length']+_0x257218(0x83)+(_0x3d400c[_0x257218(0x118)]!==0x1?'s':'')),await handleSDKOutput(_0x3d400c,_0x2671c8),0x0;}catch(_0x267a4b){if(_0x267a4b instanceof SDKError)return console[_0x257218(0xdf)](_0x257218(0xf4)+_0x267a4b['message']),_0x267a4b[_0x257218(0xbf)]&&console['error'](_0x257218(0xb1)+_0x267a4b[_0x257218(0xbf)]),0x1;throw _0x267a4b;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a44_0x16383b(0x111);[a44_0x16383b(0xde)]=a44_0x16383b(0xe3);async[a44_0x16383b(0x121)](_0x589922){const _0x41c770=a44_0x16383b,{options:_0x55d90b,args:_0x4a68a6,tdx:_0x5e67c1}=_0x589922,_0x2952f0=_0x4a68a6[0x0];if(!_0x2952f0)return console[_0x41c770(0xdf)](_0x41c770(0xa7)),0x1;try{_0x55d90b[_0x41c770(0x10d)]&&console['error'](_0x41c770(0xff)+_0x2952f0);const _0x12d7cc=await withSpinner('Getting\x20attempt\x20details...',()=>_0x5e67c1['workflow'][_0x41c770(0xcb)](_0x2952f0),{'verbose':_0x55d90b[_0x41c770(0x10d)]}),_0x2932fa=_0x12d7cc[_0x41c770(0xb7)];let _0x5d37c1;!_0x2932fa[_0x41c770(0xaf)]?_0x5d37c1=_0x2932fa[_0x41c770(0xca)]?_0x41c770(0xcc):_0x41c770(0xb0):_0x5d37c1=_0x2932fa[_0x41c770(0xe2)]?'success':_0x41c770(0xdf);let _0x58c0e2;if(_0x2932fa['createdAt']&&_0x2932fa[_0x41c770(0xda)]){const _0x435560=new Date(_0x2932fa[_0x41c770(0xd6)])[_0x41c770(0xac)](),_0x406eb5=new Date(_0x2932fa[_0x41c770(0xda)])['getTime']();_0x58c0e2=Math['round']((_0x406eb5-_0x435560)/0x3e8);}const _0x3dddb3={'attempt_id':_0x2932fa['id'],'status':_0x5d37c1,..._0x2932fa[_0x41c770(0xf9)]!==undefined&&{'index':_0x2932fa[_0x41c770(0xf9)]},..._0x2932fa[_0x41c770(0xc4)]&&{'project':_0x2932fa['project'][_0x41c770(0xb3)]},..._0x2932fa[_0x41c770(0x10f)]&&{'workflow':_0x2932fa[_0x41c770(0x10f)][_0x41c770(0xb3)]},..._0x2932fa[_0x41c770(0x123)]&&{'session_id':_0x2932fa[_0x41c770(0x123)]},..._0x2932fa[_0x41c770(0xf1)]&&{'session_time':_0x2932fa[_0x41c770(0xf1)]},..._0x2932fa[_0x41c770(0xa2)]&&{'retry_attempt':_0x2932fa[_0x41c770(0xa2)]},..._0x58c0e2!==undefined&&{'duration_sec':_0x58c0e2},..._0x2932fa[_0x41c770(0xd6)]&&{'created_at':_0x2932fa[_0x41c770(0xd6)]},..._0x2932fa[_0x41c770(0xda)]&&{'finished_at':_0x2932fa[_0x41c770(0xda)]},...Object[_0x41c770(0x82)](_0x2932fa[_0x41c770(0xe8)])[_0x41c770(0x118)]>0x0&&{'params':_0x2932fa[_0x41c770(0xe8)]}};return await handleSingleObjectOutput(_0x3dddb3,_0x55d90b),0x0;}catch(_0x55c629){if(_0x55c629 instanceof SDKError)return console[_0x41c770(0xdf)]('Error:\x20'+_0x55c629[_0x41c770(0x8c)]),_0x55c629[_0x41c770(0xbf)]&&console['error']('\x20\x20Cause:\x20'+_0x55c629[_0x41c770(0xbf)]),0x1;throw _0x55c629;}}}export class WorkflowTasksCommand extends BaseCommand{['name']='workflow:tasks';[a44_0x16383b(0xde)]=a44_0x16383b(0xef);async[a44_0x16383b(0x121)](_0x4457dc){const _0x49ee9e=a44_0x16383b,{options:_0x3734a3,args:_0x34ee58,tdx:_0x4c30a3}=_0x4457dc,_0x354d24=_0x34ee58[0x0];if(!_0x354d24)return console[_0x49ee9e(0xdf)](_0x49ee9e(0xa7)),0x1;try{const _0x3504b8=_0x3734a3[_0x49ee9e(0x11a)];_0x3734a3['verbose']&&(console[_0x49ee9e(0xdf)]('Attempt\x20ID:\x20'+_0x354d24),_0x3504b8&&console[_0x49ee9e(0xdf)](_0x49ee9e(0x9b)));const _0x57d41c=await withSpinner(_0x49ee9e(0xb5),()=>_0x4c30a3['workflow']['tasks'](_0x354d24,_0x3504b8||![]),{'verbose':_0x3734a3['verbose']}),_0x24bc0a=_0x57d41c[_0x49ee9e(0xb7)];return console[_0x49ee9e(0xdf)](_0x49ee9e(0xbd)+_0x24bc0a[_0x49ee9e(0x118)]+_0x49ee9e(0xb4)+(_0x24bc0a[_0x49ee9e(0x118)]!==0x1?'s':'')),await handleSDKOutput(_0x24bc0a,_0x3734a3),0x0;}catch(_0x5c1d28){if(_0x5c1d28 instanceof SDKError)return console[_0x49ee9e(0xdf)](_0x49ee9e(0xf4)+_0x5c1d28[_0x49ee9e(0x8c)]),_0x5c1d28[_0x49ee9e(0xbf)]&&console['error'](_0x49ee9e(0xb1)+_0x5c1d28[_0x49ee9e(0xbf)]),0x1;throw _0x5c1d28;}}}export class WorkflowLogsCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x115);['description']=a44_0x16383b(0x11f);async[a44_0x16383b(0x121)](_0x53e90d){const _0x2df433=a44_0x16383b,{options:_0x46b1c6,args:_0x132e90,tdx:_0x3c5cce}=_0x53e90d,_0x50187b=_0x132e90[0x0];let _0xcbaaa6=_0x132e90[0x1];if(!_0x50187b)return console[_0x2df433(0xdf)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x46b1c6['verbose']&&(console['error']('Attempt\x20ID:\x20'+_0x50187b),_0xcbaaa6&&console['error'](_0x2df433(0xe9)+_0xcbaaa6));const _0x2eb8dd=await withSpinner('Fetching\x20log\x20files...',()=>_0x3c5cce[_0x2df433(0x10f)]['logFiles'](_0x50187b,_0xcbaaa6),{'verbose':_0x46b1c6[_0x2df433(0x10d)]}),_0x1ed0ee=_0x2eb8dd['data'];if(_0x1ed0ee[_0x2df433(0x118)]===0x0)return console[_0x2df433(0xdf)](_0x2df433(0x11d)),0x0;if(!_0xcbaaa6&&(_0x46b1c6[_0x2df433(0xa8)]||_0x46b1c6[_0x2df433(0xd8)]))return await handleSDKOutput(_0x1ed0ee,_0x46b1c6),0x0;if(!_0xcbaaa6){const _0x41c615=_0x1ed0ee[_0x2df433(0xe7)](_0x54608d=>({'title':_0x54608d[_0x2df433(0xfb)]+'\x20('+formatBytes(_0x54608d[_0x2df433(0xa6)])+')','value':_0x54608d['taskName']})),_0x4ea3a8=await a44_0x210539({'type':_0x2df433(0x88),'name':'task','message':'Select\x20a\x20task\x20to\x20view\x20logs:','choices':_0x41c615});if(!_0x4ea3a8[_0x2df433(0xbe)])return console[_0x2df433(0xdf)]('Cancelled'),0x0;_0xcbaaa6=_0x4ea3a8[_0x2df433(0xbe)];}const _0x1cc2f8=await withSpinner('Downloading\x20logs...',()=>_0x3c5cce[_0x2df433(0x10f)][_0x2df433(0xc5)](_0x50187b,_0xcbaaa6),{'verbose':_0x46b1c6[_0x2df433(0x10d)]}),_0x47d34b=_0x1cc2f8[_0x2df433(0xb7)];return _0x47d34b?console[_0x2df433(0x95)](_0x47d34b):console[_0x2df433(0xdf)](_0x2df433(0xe6)),0x0;}catch(_0x17ba09){if(_0x17ba09 instanceof SDKError)return console[_0x2df433(0xdf)](_0x2df433(0xf4)+_0x17ba09[_0x2df433(0x8c)]),_0x17ba09['cause']&&console['error'](_0x2df433(0xb1)+_0x17ba09['cause']),0x1;throw _0x17ba09;}}}export class WorkflowKillCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x8d);['description']=a44_0x16383b(0xe1);async[a44_0x16383b(0x121)](_0x54c24d){const _0x240e34=a44_0x16383b,{options:_0x566222,args:_0x40b127,tdx:_0x4d8465}=_0x54c24d,_0x544350=_0x40b127[0x0];if(!_0x544350)return console[_0x240e34(0xdf)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x13a890=_0x566222[_0x240e34(0xd0)];_0x566222[_0x240e34(0x10d)]&&(console[_0x240e34(0xdf)](_0x240e34(0xff)+_0x544350),_0x13a890&&console['error'](_0x240e34(0x106)+_0x13a890));if(!_0x566222[_0x240e34(0xf8)]){const _0x189b2e=await confirm(_0x240e34(0xb9)+_0x544350+'?');if(!_0x189b2e)return console['error']('Cancelled'),0x0;}const _0x11a16f=await withSpinner('Killing\x20attempt...',()=>_0x4d8465['workflow'][_0x240e34(0x91)](_0x544350,_0x13a890),{'verbose':_0x566222[_0x240e34(0x10d)]}),_0x5f20ae=_0x11a16f[_0x240e34(0xb7)];return console[_0x240e34(0xdf)]('✔\x20'+_0x5f20ae),0x0;}catch(_0x5b94c4){if(_0x5b94c4 instanceof SDKError)return console['error'](_0x240e34(0xf4)+_0x5b94c4[_0x240e34(0x8c)]),_0x5b94c4[_0x240e34(0xbf)]&&console[_0x240e34(0xdf)](_0x240e34(0xb1)+_0x5b94c4[_0x240e34(0xbf)]),0x1;throw _0x5b94c4;}}}export class WorkflowRetryCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x101);[a44_0x16383b(0xde)]=a44_0x16383b(0x90);async[a44_0x16383b(0x121)](_0x30679b){const _0x16589e=a44_0x16383b,{options:_0x3ae809,args:_0x5e6450,tdx:_0x141df6}=_0x30679b,_0x17fd86=_0x5e6450[0x0];if(!_0x17fd86)return console[_0x16589e(0xdf)](_0x16589e(0xe0)),console[_0x16589e(0xdf)](_0x16589e(0xc6)),0x1;let _0x341955=![],_0x541a41=_0x17fd86;if(_0x17fd86[_0x16589e(0x110)](_0x16589e(0x114)))_0x341955=!![],_0x541a41=_0x17fd86[_0x16589e(0xba)](0x8);else{if(_0x17fd86['startsWith'](_0x16589e(0xfe)))_0x341955=![],_0x541a41=_0x17fd86[_0x16589e(0xba)](0x8);else return console[_0x16589e(0xdf)]('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x16589e(0xdf)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;}try{const _0x11cc20=_0x3ae809['fromTask'],_0x4418ca=_0x3ae809['resumeFrom'],_0x1b2402=_0x3ae809['params'],_0x312ac3=_0x3ae809[_0x16589e(0x84)];_0x3ae809['verbose']&&(console[_0x16589e(0xdf)](_0x16589e(0x81)+(_0x341955?_0x16589e(0x125):'attempt')+'\x20'+_0x541a41),_0x11cc20&&console[_0x16589e(0xdf)](_0x16589e(0xe5)+_0x11cc20),_0x4418ca&&console[_0x16589e(0xdf)](_0x16589e(0xce)+_0x4418ca),_0x1b2402&&console[_0x16589e(0xdf)]('Params:\x20'+_0x1b2402),_0x312ac3&&console['error']('Force:\x20yes'));let _0x1a60e9;if(_0x1b2402)try{if(_0x1b2402[_0x16589e(0x110)]('@')){const _0xb395ff=await import(_0x16589e(0x100)),_0x1919eb=_0x1b2402[_0x16589e(0xba)](0x1),_0x2ab894=await _0xb395ff[_0x16589e(0x80)](_0x1919eb,_0x16589e(0xd9));_0x1a60e9=JSON[_0x16589e(0x9f)](_0x2ab894);}else _0x1a60e9=JSON['parse'](_0x1b2402);}catch{return console[_0x16589e(0xdf)](_0x16589e(0x89)),0x1;}if(!_0x3ae809[_0x16589e(0xf8)]){const _0x418eec=await confirm(_0x16589e(0xd4)+(_0x341955?_0x16589e(0x125):_0x16589e(0xcb))+'\x20'+_0x541a41+'?');if(!_0x418eec)return console[_0x16589e(0xdf)]('Cancelled'),0x0;}let _0x2c5cfc;_0x341955?_0x2c5cfc=await withSpinner(_0x16589e(0xeb),()=>_0x141df6[_0x16589e(0x10f)][_0x16589e(0x11e)](_0x541a41,{'fromTask':_0x11cc20,'retryParams':_0x1a60e9}),{'verbose':_0x3ae809['verbose']}):_0x2c5cfc=await withSpinner('Retrying\x20attempt...',()=>_0x141df6[_0x16589e(0x10f)][_0x16589e(0xee)](_0x541a41,{'resumeFrom':_0x4418ca,'retryParams':_0x1a60e9,'force':_0x312ac3}),{'verbose':_0x3ae809[_0x16589e(0x10d)]});const _0x462d46=_0x2c5cfc[_0x16589e(0xb7)];return console[_0x16589e(0xdf)](_0x16589e(0xed)),console[_0x16589e(0xdf)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x462d46[_0x16589e(0xdb)]),console['error'](_0x16589e(0x86)+_0x462d46[_0x16589e(0x123)]),0x0;}catch(_0xac485e){if(_0xac485e instanceof SDKError)return console[_0x16589e(0xdf)](_0x16589e(0xf4)+_0xac485e['message']),_0xac485e['cause']&&console['error']('\x20\x20Cause:\x20'+_0xac485e[_0x16589e(0xbf)]),0x1;throw _0xac485e;}}}function a44_0x3f12(_0x5d86a1,_0xc2ecc0){_0x5d86a1=_0x5d86a1-0x80;const _0x5e5da7=a44_0x5e5d();let _0x3f1251=_0x5e5da7[_0x5d86a1];return _0x3f1251;}export class WorkflowRunCommand extends BaseCommand{['name']='workflow:run';[a44_0x16383b(0xde)]=a44_0x16383b(0x116);async[a44_0x16383b(0x121)](_0x43b471){const _0xf2da62=a44_0x16383b,{options:_0x20b7cc,args:_0x49a86e,tdx:_0x3739f5}=_0x43b471,_0x12fbe2=_0x49a86e[0x0];if(!_0x12fbe2)return console[_0xf2da62(0xdf)](_0xf2da62(0xc3)),console[_0xf2da62(0xdf)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0x2b27e9=_0x20b7cc[_0xf2da62(0xec)],_0x3c22b2=_0x20b7cc['sessionTime'],_0x4ac0e3={};if(_0x2b27e9&&Array[_0xf2da62(0xd3)](_0x2b27e9))for(const _0x3d11be of _0x2b27e9){const _0x2604cf=_0x3d11be['indexOf']('=');if(_0x2604cf===-0x1)return console[_0xf2da62(0xdf)](_0xf2da62(0x92)+_0x3d11be),console[_0xf2da62(0xdf)](_0xf2da62(0x103)),0x1;const _0x2566c2=_0x3d11be[_0xf2da62(0xba)](0x0,_0x2604cf),_0x18247f=_0x3d11be[_0xf2da62(0xba)](_0x2604cf+0x1);try{_0x4ac0e3[_0x2566c2]=JSON[_0xf2da62(0x9f)](_0x18247f);}catch{_0x4ac0e3[_0x2566c2]=_0x18247f;}}_0x20b7cc['verbose']&&(console['error']('Workflow:\x20'+_0x12fbe2),Object[_0xf2da62(0x82)](_0x4ac0e3)[_0xf2da62(0x118)]>0x0&&console[_0xf2da62(0xdf)](_0xf2da62(0x113)+JSON[_0xf2da62(0x94)](_0x4ac0e3)),_0x3c22b2&&console[_0xf2da62(0xdf)](_0xf2da62(0xa5)+_0x3c22b2));const _0x3a4ae1=await withSpinner(_0xf2da62(0x117),()=>_0x3739f5[_0xf2da62(0x10f)]['run'](_0x12fbe2,_0x4ac0e3,{'sessionTime':_0x3c22b2}),{'verbose':_0x20b7cc['verbose']}),_0x46340c=_0x3a4ae1['data'];return console['error']('✔\x20Workflow\x20run\x20started'),console[_0xf2da62(0xdf)](_0xf2da62(0x8a)+_0x46340c['id']),console['error'](_0xf2da62(0x86)+_0x46340c[_0xf2da62(0x123)]),console[_0xf2da62(0xdf)]('\x20\x20Project:\x20'+_0x46340c[_0xf2da62(0xc4)]?.[_0xf2da62(0xb3)]),console['error'](_0xf2da62(0x108)+_0x46340c[_0xf2da62(0x10f)]?.[_0xf2da62(0xb3)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']='workflow:download';[a44_0x16383b(0xde)]=a44_0x16383b(0xcf);async[a44_0x16383b(0x121)](_0x5525a7){const _0x2e9b9c=a44_0x16383b,{options:_0x7d48dc,args:_0x2cf29e,tdx:_0x401a5e}=_0x5525a7,_0x47dcf2=_0x2cf29e[0x0],_0x2129b3=_0x2cf29e[0x1]||'.';if(!_0x47dcf2)return console[_0x2e9b9c(0xdf)](_0x2e9b9c(0x98)),console[_0x2e9b9c(0xdf)](_0x2e9b9c(0xe4)),0x1;const _0x5dbd3a=_0x7d48dc['revision'];_0x7d48dc[_0x2e9b9c(0x10d)]&&(console[_0x2e9b9c(0xdf)](_0x2e9b9c(0xa4)+_0x47dcf2),console['error']('Output\x20directory:\x20'+_0x2129b3),_0x5dbd3a&&console['error'](_0x2e9b9c(0x11c)+_0x5dbd3a));const _0x22c702=await withSpinner('Downloading\x20project\x20'+_0x47dcf2+_0x2e9b9c(0x93),()=>_0x401a5e['workflow'][_0x2e9b9c(0x109)](_0x47dcf2,_0x2129b3,{'revision':_0x5dbd3a}),{'verbose':_0x7d48dc[_0x2e9b9c(0x10d)]}),_0x26d570=_0x22c702[_0x2e9b9c(0xb7)];return console['error'](_0x2e9b9c(0xc2)+_0x26d570[_0x2e9b9c(0xab)]),console[_0x2e9b9c(0xdf)](_0x2e9b9c(0x99)+_0x26d570['revision']),console[_0x2e9b9c(0xdf)]('\x20\x20Files\x20extracted:\x20'+_0x26d570[_0x2e9b9c(0xfd)]),console[_0x2e9b9c(0xdf)](_0x2e9b9c(0xf0)+_0x2129b3+'/'+_0x26d570[_0x2e9b9c(0xab)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']=a44_0x16383b(0xea);[a44_0x16383b(0xde)]=a44_0x16383b(0x9e);async[a44_0x16383b(0x121)](_0x667f53){const _0x4b5a8b=a44_0x16383b,{options:_0x1f876b,args:_0x45cac5,tdx:_0x593855}=_0x667f53;let _0x5ca53b='.',_0x5a8a5a=_0x1f876b[_0x4b5a8b(0xb3)];if(_0x45cac5[0x0]){const {promises:_0x1773f8}=await import('fs');try{const _0x2ea449=await _0x1773f8[_0x4b5a8b(0xae)](_0x45cac5[0x0]);if(_0x2ea449['isDirectory']())_0x5ca53b=_0x45cac5[0x0];else return console[_0x4b5a8b(0xdf)]('Error:\x20'+_0x45cac5[0x0]+_0x4b5a8b(0xa9)),0x1;}catch{_0x5a8a5a=_0x45cac5[0x0],_0x5ca53b='.';}}const _0x51bd47=_0x1f876b['revision'],_0x487e11=_0x1f876b[_0x4b5a8b(0xfa)];_0x1f876b['verbose']&&(console[_0x4b5a8b(0xdf)](_0x4b5a8b(0xdd)+_0x5ca53b),_0x5a8a5a&&console[_0x4b5a8b(0xdf)]('Project\x20name:\x20'+_0x5a8a5a),_0x51bd47&&console[_0x4b5a8b(0xdf)](_0x4b5a8b(0x11c)+_0x51bd47),_0x487e11&&console[_0x4b5a8b(0xdf)](_0x4b5a8b(0x10a)));const _0xfcbec=await withSpinner(_0x4b5a8b(0xbc),()=>_0x593855['workflow']['push'](_0x5ca53b,{'projectName':_0x5a8a5a,'revision':_0x51bd47,'skipValidation':_0x487e11}),{'verbose':_0x1f876b['verbose']}),_0x995a01=_0xfcbec[_0x4b5a8b(0xb7)];return console[_0x4b5a8b(0xdf)](_0x4b5a8b(0x102)+_0x995a01[_0x4b5a8b(0xab)]),console[_0x4b5a8b(0xdf)](_0x4b5a8b(0x9d)+_0x995a01[_0x4b5a8b(0xaa)]),console['error'](_0x4b5a8b(0x99)+_0x995a01[_0x4b5a8b(0xc0)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x16383b(0xb3)]=a44_0x16383b(0x9c);[a44_0x16383b(0xde)]=a44_0x16383b(0xcd);async[a44_0x16383b(0x121)](_0x38d1ef){const _0x4338cb=a44_0x16383b,{options:_0x254838,args:_0x592624,tdx:_0x5b2de8}=_0x38d1ef,_0x5cdc1c=_0x592624[0x0];if(!_0x5cdc1c)return console[_0x4338cb(0xdf)](_0x4338cb(0x97)),console[_0x4338cb(0xdf)](_0x4338cb(0x8b)),0x1;_0x254838[_0x4338cb(0x10d)]&&console['error'](_0x4338cb(0xa4)+_0x5cdc1c);if(!_0x254838[_0x4338cb(0xf8)]){const _0x2ffe1c=await confirm(_0x4338cb(0x9a)+_0x5cdc1c+_0x4338cb(0x8e));if(!_0x2ffe1c)return console['error']('Cancelled'),0x0;}const _0x43defc=await withSpinner(_0x4338cb(0xf3)+_0x5cdc1c+'...',()=>_0x5b2de8[_0x4338cb(0x10f)][_0x4338cb(0xc7)](_0x5cdc1c),{'verbose':_0x254838[_0x4338cb(0x10d)]}),_0x523887=_0x43defc[_0x4338cb(0xb7)];return console[_0x4338cb(0xdf)](_0x4338cb(0x119)+_0x523887[_0x4338cb(0xab)]),console['error'](_0x4338cb(0x9d)+_0x523887[_0x4338cb(0xaa)]),0x0;}}
package/dist/core/auth.js CHANGED
@@ -1 +1 @@
1
- (function(_0x3a4921,_0x2ec841){const _0x3a43d6=a45_0x1d18,_0x3a9a22=_0x3a4921();while(!![]){try{const _0x2bf37b=-parseInt(_0x3a43d6(0x179))/0x1+-parseInt(_0x3a43d6(0x168))/0x2*(parseInt(_0x3a43d6(0x175))/0x3)+-parseInt(_0x3a43d6(0x172))/0x4*(parseInt(_0x3a43d6(0x16f))/0x5)+parseInt(_0x3a43d6(0x16d))/0x6*(parseInt(_0x3a43d6(0x171))/0x7)+parseInt(_0x3a43d6(0x178))/0x8+-parseInt(_0x3a43d6(0x16b))/0x9+parseInt(_0x3a43d6(0x17a))/0xa;if(_0x2bf37b===_0x2ec841)break;else _0x3a9a22['push'](_0x3a9a22['shift']());}catch(_0x17220a){_0x3a9a22['push'](_0x3a9a22['shift']());}}}(a45_0x593d,0xa44bc));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a45_0x593d(){const _0x13416b=['571516hwEGDi','parse','version','4714722QWQNeX','entries','4482ChzKxN','length','8065xEncMz','0.0.0','4837pSuFHF','424zfFwFN','Authorization','../../package.json','6zJDZue','tdx','tdx/','4717560KgZrOe','108708YrAocL','9421440LHJpVT','TD1\x20'];a45_0x593d=function(){return _0x13416b;};return a45_0x593d();}import{getAPIKey}from'./config.js';function a45_0x1d18(_0x23893c,_0x4cedfa){_0x23893c=_0x23893c-0x168;const _0x593ddf=a45_0x593d();let _0x1d18e3=_0x593ddf[_0x23893c];return _0x1d18e3;}export function getVersion(){const _0x184e7f=a45_0x1d18;try{const _0x194173=fileURLToPath(import.meta.url),_0x465b99=dirname(_0x194173),_0x4f087e=join(_0x465b99,_0x184e7f(0x174)),_0x48f937=JSON[_0x184e7f(0x169)](readFileSync(_0x4f087e,'utf-8'));return _0x48f937[_0x184e7f(0x16a)];}catch{return _0x184e7f(0x170);}}export function getUserAgent(){const _0x125fc6=a45_0x1d18,_0x15d5c3=getVersion(),_0xcb013d=platform(),_0xe523bc=process[_0x125fc6(0x16a)]['replace']('v','');return _0x125fc6(0x177)+_0x15d5c3+'\x20('+_0xcb013d+';\x20node/'+_0xe523bc+')';}export function getAuthHeaders(_0x30b5de,_0x143f63){const _0x3bddd6=a45_0x1d18,_0x3333bb=getVersion(),_0x20bdd6={'User-Agent':getUserAgent(),'X-TD-Client':_0x3bddd6(0x176),'X-TD-Client-Version':_0x3333bb};return _0x143f63&&(_0x20bdd6[_0x3bddd6(0x173)]=_0x3bddd6(0x17b)+_0x143f63),_0x20bdd6;}export function toHeaderRecord(_0x485aaf){const _0x4a504e=a45_0x1d18,_0x99efb9={};for(const [_0x3a9294,_0x49e597]of Object[_0x4a504e(0x16c)](_0x485aaf)){_0x49e597!==undefined&&(_0x99efb9[_0x3a9294]=_0x49e597);}return _0x99efb9;}export function getTrinoHeaders(_0x1f68e8,_0x24564a){const _0x32f238=a45_0x1d18,_0x186b8d=getAuthHeaders(_0x1f68e8,_0x24564a),_0x5aff8b=toHeaderRecord(_0x186b8d);return delete _0x5aff8b[_0x32f238(0x173)],_0x24564a&&(_0x5aff8b['X-Trino-User']=_0x24564a),_0x5aff8b;}export function hasAPIKey(_0x739473){const _0x3ee382=a45_0x1d18,_0x2ffddc=getAPIKey(_0x739473);return _0x2ffddc!==undefined&&_0x2ffddc[_0x3ee382(0x16e)]>0x0;}
1
+ (function(_0x503778,_0x44804b){const _0xdd5eef=a45_0x4c30,_0x278333=_0x503778();while(!![]){try{const _0x5e8b31=parseInt(_0xdd5eef(0x149))/0x1+-parseInt(_0xdd5eef(0x13f))/0x2+parseInt(_0xdd5eef(0x14a))/0x3*(-parseInt(_0xdd5eef(0x150))/0x4)+parseInt(_0xdd5eef(0x143))/0x5*(-parseInt(_0xdd5eef(0x14d))/0x6)+-parseInt(_0xdd5eef(0x142))/0x7+-parseInt(_0xdd5eef(0x141))/0x8+parseInt(_0xdd5eef(0x14e))/0x9;if(_0x5e8b31===_0x44804b)break;else _0x278333['push'](_0x278333['shift']());}catch(_0x3d322d){_0x278333['push'](_0x278333['shift']());}}}(a45_0x149a,0xac936));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';function a45_0x4c30(_0x428462,_0x4a0a4c){_0x428462=_0x428462-0x13d;const _0x149aaa=a45_0x149a();let _0x4c309e=_0x149aaa[_0x428462];return _0x4c309e;}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x2c3f5c=a45_0x4c30;try{const _0xafb4f9=fileURLToPath(import.meta.url),_0x1a53de=dirname(_0xafb4f9),_0x20146d=join(_0x1a53de,_0x2c3f5c(0x145)),_0x39adff=JSON[_0x2c3f5c(0x148)](readFileSync(_0x20146d,_0x2c3f5c(0x147)));return _0x39adff[_0x2c3f5c(0x144)];}catch{return _0x2c3f5c(0x14f);}}export function getUserAgent(){const _0x5f35be=a45_0x4c30,_0x27be85=getVersion(),_0x56ce82=platform(),_0x23592a=process[_0x5f35be(0x144)][_0x5f35be(0x13e)]('v','');return _0x5f35be(0x14b)+_0x27be85+'\x20('+_0x56ce82+_0x5f35be(0x140)+_0x23592a+')';}export function getAuthHeaders(_0x527423,_0x6d5b47){const _0x3f5d62=a45_0x4c30,_0xd933d9=getVersion(),_0x44b7af={'User-Agent':getUserAgent(),'X-TD-Client':_0x3f5d62(0x151),'X-TD-Client-Version':_0xd933d9};return _0x6d5b47&&(_0x44b7af[_0x3f5d62(0x14c)]='TD1\x20'+_0x6d5b47),_0x44b7af;}export function toHeaderRecord(_0x5344c8){const _0xfcd8ac=a45_0x4c30,_0x2a5a70={};for(const [_0x36c676,_0x5c4aa3]of Object[_0xfcd8ac(0x146)](_0x5344c8)){_0x5c4aa3!==undefined&&(_0x2a5a70[_0x36c676]=_0x5c4aa3);}return _0x2a5a70;}export function getTrinoHeaders(_0x1fe294,_0x468e4a){const _0x3ff48a=a45_0x4c30,_0x16dbb1=getAuthHeaders(_0x1fe294,_0x468e4a),_0x512646=toHeaderRecord(_0x16dbb1);return delete _0x512646[_0x3ff48a(0x14c)],_0x468e4a&&(_0x512646[_0x3ff48a(0x13d)]=_0x468e4a),_0x512646;}function a45_0x149a(){const _0x239e40=['683932tUFgFZ','tdx','X-Trino-User','replace','2256336joJggY',';\x20node/','2929600rEHcFJ','1773975CfFgqL','5MJgaRj','version','../../package.json','entries','utf-8','parse','918367YHkxeG','9BVtZcE','tdx/','Authorization','1685874qMYpFk','20972016oDsXAJ','0.0.0'];a45_0x149a=function(){return _0x239e40;};return a45_0x149a();}export function hasAPIKey(_0x369f15){const _0x6ebd1a=getAPIKey(_0x369f15);return _0x6ebd1a!==undefined&&_0x6ebd1a['length']>0x0;}
@@ -1 +1 @@
1
- (function(_0x5e7f04,_0x2048c3){const _0x347116=a46_0x2771,_0x18f517=_0x5e7f04();while(!![]){try{const _0x4e1482=parseInt(_0x347116(0x1fb))/0x1+parseInt(_0x347116(0x200))/0x2+parseInt(_0x347116(0x230))/0x3*(parseInt(_0x347116(0x211))/0x4)+parseInt(_0x347116(0x21b))/0x5+parseInt(_0x347116(0x20e))/0x6+-parseInt(_0x347116(0x202))/0x7*(-parseInt(_0x347116(0x208))/0x8)+-parseInt(_0x347116(0x22d))/0x9;if(_0x4e1482===_0x2048c3)break;else _0x18f517['push'](_0x18f517['shift']());}catch(_0x4a978d){_0x18f517['push'](_0x18f517['shift']());}}}(a46_0x3730,0x7cf6b));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x617de2 from'node:fs';import*as a46_0x2892f0 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 a46_0x5aff50 from'chalk';export function getConfigDir(){const _0x5d50eb=a46_0x2771;return process[_0x5d50eb(0x1fc)][_0x5d50eb(0x1f9)]||join(homedir(),'.config',_0x5d50eb(0x223));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x3e8665){const _0x5108f1=a46_0x2771,_0xd6ec3c=getConfigDir();return _0x3e8665?a46_0x2892f0[_0x5108f1(0x232)](_0xd6ec3c,_0x5108f1(0x21f)+_0x3e8665):getConfigFile();}export function getCacheDir(){const _0x58fe5a=a46_0x2771;return process['env'][_0x58fe5a(0x1fd)]||join(homedir(),_0x58fe5a(0x22c),_0x58fe5a(0x223));}export function getLLMProjectCacheFile(_0x5384fd){const _0xce1dc9=a46_0x2771,_0x3fecd4=_0x5384fd?'llm_default_project.'+_0x5384fd:_0xce1dc9(0x1f2);return join(getCacheDir(),_0x3fecd4);}export function readCachedLLMProject(_0x46fdf7){const _0x39cb7d=a46_0x2771;try{const _0x1160a3=getLLMProjectCacheFile(_0x46fdf7);if(!existsSync(_0x1160a3))return null;const _0x22acd8=readFileSync(_0x1160a3,_0x39cb7d(0x20f))[_0x39cb7d(0x1f3)]();try{const _0x42f0a8=JSON[_0x39cb7d(0x1e8)](_0x22acd8);if(_0x42f0a8&&typeof _0x42f0a8['id']===_0x39cb7d(0x20d)&&typeof _0x42f0a8['name']==='string')return _0x42f0a8;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x155254,_0x2f2a78,_0x108464){try{const _0x5aa63e=getCacheDir(),_0x219f7b=getLLMProjectCacheFile(_0x108464);!existsSync(_0x5aa63e)&&mkdirSync(_0x5aa63e,{'recursive':!![]});const _0x60d416={'name':_0x155254,'id':_0x2f2a78};writeFileSync(_0x219f7b,JSON['stringify'](_0x60d416),'utf-8');}catch{}}export function getLLMAgentCacheFile(_0x18ec23){const _0x4476b9=a46_0x2771,_0x14202f=_0x18ec23?_0x4476b9(0x1f4)+_0x18ec23:'llm_default_agent';return join(getCacheDir(),_0x14202f);}export function readCachedLLMAgent(_0x3c8c5e){const _0x1ddd6e=a46_0x2771;try{const _0x1e62e0=getLLMAgentCacheFile(_0x3c8c5e);if(!existsSync(_0x1e62e0))return null;const _0x5aca1f=readFileSync(_0x1e62e0,_0x1ddd6e(0x20f))[_0x1ddd6e(0x1f3)]();try{const _0x47303c=JSON[_0x1ddd6e(0x1e8)](_0x5aca1f);if(_0x47303c&&typeof _0x47303c['id']===_0x1ddd6e(0x20d)&&typeof _0x47303c['name']===_0x1ddd6e(0x20d)&&typeof _0x47303c[_0x1ddd6e(0x1eb)]===_0x1ddd6e(0x20d))return _0x47303c;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x2425cd,_0x46c3a6,_0x16b9c9,_0x29c080){const _0xd47d15=a46_0x2771;try{const _0x2cbc0c=getCacheDir(),_0x1f86b7=getLLMAgentCacheFile(_0x29c080);!existsSync(_0x2cbc0c)&&mkdirSync(_0x2cbc0c,{'recursive':!![]});const _0x280451={'name':_0x2425cd,'id':_0x46c3a6,'projectId':_0x16b9c9};writeFileSync(_0x1f86b7,JSON[_0xd47d15(0x214)](_0x280451),_0xd47d15(0x20f));}catch{}}export function clearCachedLLMAgent(_0x2fe218){try{const _0x5d9879=getLLMAgentCacheFile(_0x2fe218);existsSync(_0x5d9879)&&unlinkSync(_0x5d9879);}catch{}}export function getAccountInfoCacheFile(_0x1a720a){const _0x2f0067=a46_0x2771,_0x5aa396=_0x1a720a?'account_info.'+_0x1a720a+'.json':_0x2f0067(0x222);return join(getCacheDir(),_0x5aa396);}export function readCachedAccountInfo(_0x3ff646){const _0x492662=a46_0x2771;try{const _0x17631e=getAccountInfoCacheFile(_0x3ff646);if(!existsSync(_0x17631e))return null;const _0x2bb5eb=readFileSync(_0x17631e,_0x492662(0x20f))[_0x492662(0x1f3)](),_0x17282e=JSON['parse'](_0x2bb5eb);if(_0x17282e&&typeof _0x17282e[_0x492662(0x204)]==='string'&&typeof _0x17282e[_0x492662(0x21c)]===_0x492662(0x231))return _0x17282e;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x57ec36,_0x523c0d,_0x4a7832){const _0x1e6fb8=a46_0x2771;try{const _0x2646ed=getCacheDir(),_0x3e1743=getAccountInfoCacheFile(_0x4a7832);!existsSync(_0x2646ed)&&mkdirSync(_0x2646ed,{'recursive':!![]});const _0x2c5e5d={'site':_0x57ec36,'accountId':_0x523c0d,'cachedAt':new Date()[_0x1e6fb8(0x21d)]()};writeFileSync(_0x3e1743,JSON[_0x1e6fb8(0x214)](_0x2c5e5d),_0x1e6fb8(0x20f));}catch{}}export function parseEnvFile(_0x5d7ead){const _0x293481=a46_0x2771,_0x59d42e={};for(const _0x1b2088 of _0x5d7ead[_0x293481(0x228)]('\x0a')){const _0x401954=_0x1b2088[_0x293481(0x1f3)]();if(!_0x401954||_0x401954[_0x293481(0x216)]('#'))continue;const _0x380727=_0x401954['match'](/^([^=]+)=(.*)$/);if(_0x380727){const _0xaf5345=_0x380727[0x1]['trim']();let _0xd26b28=_0x380727[0x2][_0x293481(0x1f3)]();(_0xd26b28[_0x293481(0x216)]('\x22')&&_0xd26b28[_0x293481(0x224)]('\x22')||_0xd26b28[_0x293481(0x216)]('\x27')&&_0xd26b28[_0x293481(0x224)]('\x27'))&&(_0xd26b28=_0xd26b28[_0x293481(0x218)](0x1,-0x1)),_0x59d42e[_0xaf5345]=_0xd26b28;}}return _0x59d42e;}export function readUserConfig(){const _0x1e99d4=a46_0x2771,_0x39a64c=getConfigFile();if(!existsSync(_0x39a64c))return{};try{const _0x3853e4=readFileSync(_0x39a64c,'utf-8');return parseEnvFile(_0x3853e4);}catch(_0x6c5b19){return console[_0x1e99d4(0x20a)](_0x1e99d4(0x1ff)+_0x39a64c+':',_0x6c5b19),{};}}export function resolveSite(_0x49a8ce){const _0x3e9cfb=a46_0x2771,_0x4bb24d=[_0x3e9cfb(0x1fe),_0x3e9cfb(0x20c),_0x3e9cfb(0x22f),_0x3e9cfb(0x217),'ap03',_0x3e9cfb(0x229),_0x3e9cfb(0x1ec),'stg-us01','stg-jp01',_0x3e9cfb(0x1ee)];if(_0x4bb24d['includes'](_0x49a8ce))return _0x49a8ce;if(_0x49a8ce in SITE_ALIASES)return SITE_ALIASES[_0x49a8ce];return console[_0x3e9cfb(0x20a)](_0x3e9cfb(0x233)+_0x49a8ce+_0x3e9cfb(0x1f5)),_0x3e9cfb(0x1fe);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x4a80da,_0x30f259){const _0x45af9a=a46_0x2771,_0x15fc37=_0x30f259||getActiveProfileName();if(_0x15fc37){const _0x511db2=_0x45af9a(0x207)+normalizeProfileForEnvVar(_0x15fc37);if(process[_0x45af9a(0x1fc)][_0x511db2])return process[_0x45af9a(0x1fc)][_0x511db2];}if(process[_0x45af9a(0x1fc)][_0x45af9a(0x21a)])return process[_0x45af9a(0x1fc)][_0x45af9a(0x21a)];if(process[_0x45af9a(0x1fc)][_0x45af9a(0x209)])return process[_0x45af9a(0x1fc)]['TD_API_KEY'];const _0x4a901e=_0x4a80da['toUpperCase']()[_0x45af9a(0x227)](/-/g,'_'),_0x158188=_0x45af9a(0x234)+_0x4a901e;if(_0x15fc37){const _0xfc4a14=loadProfileEnv(_0x15fc37);if(_0xfc4a14){if(_0xfc4a14[_0x158188])return _0xfc4a14[_0x158188];if(_0xfc4a14[_0x45af9a(0x209)])return _0xfc4a14[_0x45af9a(0x209)];}}const _0x52c637=loadUserConfigOnce();if(_0x52c637[_0x158188])return _0x52c637[_0x158188];if(_0x52c637['TD_API_KEY'])return _0x52c637[_0x45af9a(0x209)];return undefined;}export function normalizeProfileForEnvVar(_0x2f62d2){const _0x5ce1ed=a46_0x2771;return _0x2f62d2[_0x5ce1ed(0x1f1)]()[_0x5ce1ed(0x227)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x41b408,_0x3c09e5){const _0x1f1a6f=a46_0x2771,_0x49b207=_0x3c09e5||getActiveProfileName()||undefined;if(_0x49b207){const _0x2c90c0=_0x1f1a6f(0x207)+normalizeProfileForEnvVar(_0x49b207);if(process[_0x1f1a6f(0x1fc)][_0x2c90c0])return{'apiKey':process[_0x1f1a6f(0x1fc)][_0x2c90c0],'source':_0x2c90c0+_0x1f1a6f(0x226),'isDeprecated':![]};const _0x555f1c=getCachedCredential(_0x41b408,_0x49b207);if(_0x555f1c)return{'apiKey':_0x555f1c,'source':_0x1f1a6f(0x206)+_0x49b207+')','isDeprecated':![]};const _0x3f3d53=await getKeychainAPIKey(_0x49b207);if(_0x3f3d53)return setCachedCredential(_0x3f3d53,_0x41b408,_0x49b207),{'apiKey':_0x3f3d53,'source':_0x1f1a6f(0x206)+_0x49b207+')','isDeprecated':![]};}if(process['env'][_0x1f1a6f(0x21a)])return{'apiKey':process['env'][_0x1f1a6f(0x21a)],'source':_0x1f1a6f(0x20b),'isDeprecated':![]};if(!_0x49b207){const _0x41cdf6=getCachedCredential(_0x41b408,undefined);if(_0x41cdf6)return{'apiKey':_0x41cdf6,'source':_0x1f1a6f(0x212),'isDeprecated':![]};const _0x1ce979=await getKeychainAPIKey(undefined);if(_0x1ce979)return setCachedCredential(_0x1ce979,_0x41b408,undefined),{'apiKey':_0x1ce979,'source':_0x1f1a6f(0x212),'isDeprecated':![]};}if(process[_0x1f1a6f(0x1fc)][_0x1f1a6f(0x209)])return{'apiKey':process[_0x1f1a6f(0x1fc)][_0x1f1a6f(0x209)],'source':_0x1f1a6f(0x22e),'isDeprecated':!![]};const _0x163b30=getLegacyEnvAPIKey(_0x41b408,_0x49b207);if(_0x163b30){const _0x1dab07=await isKeychainAvailable();if(_0x1dab07)try{await saveKeychainAPIKey(_0x163b30,_0x49b207),setCachedCredential(_0x163b30,_0x41b408,_0x49b207);const _0x5dd26d=getConfigFilePath(_0x49b207);cleanupLegacyEnvFile(_0x5dd26d)&&console[_0x1f1a6f(0x20a)](a46_0x5aff50[_0x1f1a6f(0x205)](_0x1f1a6f(0x1e6)));}catch(_0xcb83c1){console[_0x1f1a6f(0x20a)](a46_0x5aff50[_0x1f1a6f(0x205)]('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0xcb83c1));}const _0x4c818f=_0x49b207?_0x1f1a6f(0x215)+_0x49b207+')':_0x1f1a6f(0x22a);return{'apiKey':_0x163b30,'source':_0x4c818f,'isDeprecated':!![]};}return null;}function a46_0x3730(){const _0x3de4c6=['Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','1695258dvumqR','readFileSync','35084TqVXVI','Warning:\x20Failed\x20to\x20load\x20','site','yellow','keychain\x20(profile:\x20','TDX_API_KEY_','64eDxKnJ','TD_API_KEY','warn','TDX_API_KEY\x20env\x20var','jp01','string','1352076hxAzFU','utf-8','Warning:\x20Failed\x20to\x20read\x20','296DAVjPZ','keychain','profiles','stringify','legacy\x20.env\x20file\x20(profile:\x20','startsWith','ap02','slice','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','TDX_API_KEY','8130qRHUKj','accountId','toISOString','TDX_API_KEY_<PROFILE>','.env.','existsSync','entries','account_info.json','tdx','endsWith','apiKey','\x20env\x20var','replace','split','dev-us01','legacy\x20.env\x20file','filter','.cache','19778382Vdvctn','TD_API_KEY\x20env\x20var\x20(deprecated)','eu01','38061tJyDjo','number','join','Warning:\x20Unknown\x20site\x20\x27','TD_API_KEY_','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','profile','parse','stg-jp01','isDeprecated','projectId','dev-eu01','apiKeys','stg-ap03','map','includes','toUpperCase','llm_default_project','trim','llm_default_agent.','\x27,\x20defaulting\x20to\x20us01','source','ap03','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','TDX_CONFIG_DIR','.env','655914DHxngy','env','TDX_CACHE_DIR','us01'];a46_0x3730=function(){return _0x3de4c6;};return a46_0x3730();}export async function getAPIKeyAsync(_0x533cfc,_0x36f1b1,_0x500723=!![]){const _0x172c74=a46_0x2771,_0x72309b=await resolveAPIKeyAsync(_0x533cfc,_0x36f1b1);if(!_0x72309b)return undefined;if(_0x500723&&_0x72309b[_0x172c74(0x1ea)]&&_0x72309b[_0x172c74(0x1f6)][_0x172c74(0x1f0)]('TD_API_KEY')){const _0x64e2d8=_0x36f1b1||getActiveProfileName()||undefined,_0xb5bdf2=_0x64e2d8?_0x172c74(0x207)+normalizeProfileForEnvVar(_0x64e2d8):_0x172c74(0x21e);console['warn'](a46_0x5aff50['yellow']('Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a'+(_0x172c74(0x219)+_0xb5bdf2+').')));}return _0x72309b[_0x172c74(0x225)];}function getLegacyEnvAPIKey(_0x599d83,_0x2a5dde){const _0x1a8937=a46_0x2771,_0x3fb550=_0x599d83[_0x1a8937(0x1f1)]()[_0x1a8937(0x227)](/-/g,'_'),_0x54a2e9=_0x1a8937(0x234)+_0x3fb550;if(_0x2a5dde){const _0x3908f7=loadProfileEnv(_0x2a5dde);if(_0x3908f7){if(_0x3908f7[_0x54a2e9])return _0x3908f7[_0x54a2e9];if(_0x3908f7[_0x1a8937(0x209)])return _0x3908f7[_0x1a8937(0x209)];}}const _0x55e5de=loadUserConfigOnce();if(_0x55e5de[_0x54a2e9])return _0x55e5de[_0x54a2e9];if(_0x55e5de[_0x1a8937(0x209)])return _0x55e5de[_0x1a8937(0x209)];return undefined;}function cleanupLegacyEnvFile(_0x503449){const _0x4b8f15=a46_0x2771;if(!existsSync(_0x503449))return![];try{const _0x9a899f=readFileSync(_0x503449,_0x4b8f15(0x20f)),_0x241300=_0x9a899f[_0x4b8f15(0x228)]('\x0a'),_0x3cf3c3=_0x241300[_0x4b8f15(0x22b)](_0x4cc501=>{const _0x4ae62a=_0x4b8f15,_0x1d4523=_0x4cc501[_0x4ae62a(0x1f3)]();if(!_0x1d4523||_0x1d4523[_0x4ae62a(0x216)]('#'))return!![];const [_0x2c59d7]=_0x1d4523[_0x4ae62a(0x228)]('=');return!_0x2c59d7[_0x4ae62a(0x216)]('TD_API_KEY');}),_0x385dd4=_0x3cf3c3['some'](_0x4d55d9=>{const _0x44a270=_0x4b8f15,_0x24d1c7=_0x4d55d9[_0x44a270(0x1f3)]();return _0x24d1c7&&!_0x24d1c7[_0x44a270(0x216)]('#');});if(!_0x385dd4)return unlinkSync(_0x503449),!![];return writeFileSync(_0x503449,_0x3cf3c3[_0x4b8f15(0x232)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x1f1b2d){const _0x5ba574=a46_0x2771,_0x47e5ce=a46_0x2892f0[_0x5ba574(0x232)](getConfigDir(),_0x5ba574(0x21f)+_0x1f1b2d);if(a46_0x617de2[_0x5ba574(0x220)](_0x47e5ce)){validateSecureFilePermissions(_0x47e5ce);try{const _0x43a836=a46_0x617de2[_0x5ba574(0x201)](_0x47e5ce,'utf-8');return parseEnvFile(_0x43a836);}catch(_0x469da2){console['warn'](_0x5ba574(0x203)+_0x47e5ce+':\x20'+_0x469da2);}}const _0x2cffed=a46_0x2892f0[_0x5ba574(0x232)](getConfigDir(),_0x5ba574(0x213),_0x1f1b2d,_0x5ba574(0x1fa));if(a46_0x617de2[_0x5ba574(0x220)](_0x2cffed)){validateSecureFilePermissions(_0x2cffed);try{const _0x21cd76=a46_0x617de2[_0x5ba574(0x201)](_0x2cffed,'utf-8');return parseEnvFile(_0x21cd76);}catch(_0x42faae){return console[_0x5ba574(0x20a)](_0x5ba574(0x203)+_0x2cffed+':\x20'+_0x42faae),null;}}return null;}function getActiveProfileName(){const _0x8a110d=a46_0x2771,_0x3da0a5=a46_0x2892f0[_0x8a110d(0x232)](getConfigDir(),'tdx.json');if(!a46_0x617de2['existsSync'](_0x3da0a5))return null;try{const _0x36b622=a46_0x617de2[_0x8a110d(0x201)](_0x3da0a5,_0x8a110d(0x20f)),_0x440611=JSON['parse'](_0x36b622);return _0x440611[_0x8a110d(0x1e7)]||null;}catch{return null;}}export function saveAPIKey(_0x2e347a,_0x451689,_0x21906b){const _0xcedbd4=a46_0x2771,_0x47b412=getConfigDir(),_0x30f685=getConfigFilePath(_0x21906b);!existsSync(_0x47b412)&&mkdirSync(_0x47b412,{'recursive':!![],'mode':0x1c0});let _0x3145a1={};if(existsSync(_0x30f685))try{const _0x27383d=readFileSync(_0x30f685,_0xcedbd4(0x20f));_0x3145a1=parseEnvFile(_0x27383d);}catch(_0x130be2){console[_0xcedbd4(0x20a)](_0xcedbd4(0x210)+_0x30f685+':',_0x130be2);}const _0x44544b=_0x2e347a[_0xcedbd4(0x1f1)]()['replace'](/-/g,'_');_0x3145a1['TD_API_KEY_'+_0x44544b]=_0x451689;const _0x18bf7a=Object[_0xcedbd4(0x221)](_0x3145a1)[_0xcedbd4(0x1ef)](([_0x25079e,_0x30b8d1])=>_0x25079e+'='+_0x30b8d1);writeFileSync(_0x30f685,_0x18bf7a[_0xcedbd4(0x232)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x58a9bf,_0xf49682,_0x287bec){const _0x3d8b5e=a46_0x2771;await saveKeychainAPIKey(_0x58a9bf,_0x287bec),setCachedCredential(_0x58a9bf,_0xf49682,_0x287bec);const _0xbe1b3d=getConfigFilePath(_0x287bec);cleanupLegacyEnvFile(_0xbe1b3d)&&console[_0x3d8b5e(0x20a)](a46_0x5aff50['yellow'](_0x3d8b5e(0x1f8)));}function a46_0x2771(_0xd7209f,_0x54f474){_0xd7209f=_0xd7209f-0x1e6;const _0x3730eb=a46_0x3730();let _0x277160=_0x3730eb[_0xd7209f];return _0x277160;}export function loadConfig(){const _0x59f403=a46_0x2771,_0x3d08eb={'apiKeys':{},'defaultSite':_0x59f403(0x1fe)},_0x138cf9=[_0x59f403(0x1fe),_0x59f403(0x20c),_0x59f403(0x22f),_0x59f403(0x217),_0x59f403(0x1f7),'dev-us01',_0x59f403(0x1ec),'stg-us01',_0x59f403(0x1e9),'stg-ap03'];for(const _0x265b4b of _0x138cf9){const _0x4ef2f5=getAPIKey(_0x265b4b);_0x4ef2f5&&(_0x3d08eb[_0x59f403(0x1ed)][_0x265b4b]=_0x4ef2f5);}return _0x3d08eb;}
1
+ (function(_0xd44700,_0x1e2b76){const _0x3d2517=a46_0x455e,_0x3a192e=_0xd44700();while(!![]){try{const _0x10d5f4=-parseInt(_0x3d2517(0x1d6))/0x1*(parseInt(_0x3d2517(0x1eb))/0x2)+-parseInt(_0x3d2517(0x1ee))/0x3+parseInt(_0x3d2517(0x1f1))/0x4*(-parseInt(_0x3d2517(0x1d4))/0x5)+-parseInt(_0x3d2517(0x1cb))/0x6+-parseInt(_0x3d2517(0x1df))/0x7+-parseInt(_0x3d2517(0x1c8))/0x8*(parseInt(_0x3d2517(0x1cf))/0x9)+-parseInt(_0x3d2517(0x1d9))/0xa*(-parseInt(_0x3d2517(0x1d0))/0xb);if(_0x10d5f4===_0x1e2b76)break;else _0x3a192e['push'](_0x3a192e['shift']());}catch(_0x50b168){_0x3a192e['push'](_0x3a192e['shift']());}}}(a46_0x150e,0x6c3cd));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x4b4054 from'node:fs';import*as a46_0x3ba6ea 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 a46_0xdb86fc from'chalk';export function getConfigDir(){const _0x505a27=a46_0x455e;return process[_0x505a27(0x1ab)]['TDX_CONFIG_DIR']||join(homedir(),_0x505a27(0x1bd),_0x505a27(0x1b4));}export function getConfigFile(){const _0x26d68a=a46_0x455e;return join(getConfigDir(),_0x26d68a(0x1c4));}export function getConfigFilePath(_0x529418){const _0x210fba=a46_0x455e,_0x56123e=getConfigDir();return _0x529418?a46_0x3ba6ea['join'](_0x56123e,_0x210fba(0x1d8)+_0x529418):getConfigFile();}export function getCacheDir(){const _0x333100=a46_0x455e;return process[_0x333100(0x1ab)]['TDX_CACHE_DIR']||join(homedir(),_0x333100(0x1e3),'tdx');}export function getLLMProjectCacheFile(_0x51dd82){const _0x2cf61c=a46_0x455e,_0xee818e=_0x51dd82?'llm_default_project.'+_0x51dd82:_0x2cf61c(0x1ea);return join(getCacheDir(),_0xee818e);}export function readCachedLLMProject(_0x3430d5){const _0x11acf7=a46_0x455e;try{const _0x4c2c16=getLLMProjectCacheFile(_0x3430d5);if(!existsSync(_0x4c2c16))return null;const _0x22e017=readFileSync(_0x4c2c16,_0x11acf7(0x1cd))['trim']();try{const _0x3ff4f4=JSON[_0x11acf7(0x1e6)](_0x22e017);if(_0x3ff4f4&&typeof _0x3ff4f4['id']===_0x11acf7(0x1ed)&&typeof _0x3ff4f4[_0x11acf7(0x1ac)]===_0x11acf7(0x1ed))return _0x3ff4f4;}catch{}return null;}catch{return null;}}function a46_0x455e(_0x41d9c0,_0x1752e3){_0x41d9c0=_0x41d9c0-0x1aa;const _0x150efc=a46_0x150e();let _0x455e00=_0x150efc[_0x41d9c0];return _0x455e00;}export function writeCachedLLMProject(_0x4f54b9,_0x4e5e83,_0xe79617){const _0x2a1ffc=a46_0x455e;try{const _0x2adede=getCacheDir(),_0x462c57=getLLMProjectCacheFile(_0xe79617);!existsSync(_0x2adede)&&mkdirSync(_0x2adede,{'recursive':!![]});const _0x23826d={'name':_0x4f54b9,'id':_0x4e5e83};writeFileSync(_0x462c57,JSON[_0x2a1ffc(0x1ae)](_0x23826d),'utf-8');}catch{}}export function getLLMAgentCacheFile(_0x1a76e1){const _0x8130b=_0x1a76e1?'llm_default_agent.'+_0x1a76e1:'llm_default_agent';return join(getCacheDir(),_0x8130b);}export function readCachedLLMAgent(_0x242903){const _0x300ed7=a46_0x455e;try{const _0x321a67=getLLMAgentCacheFile(_0x242903);if(!existsSync(_0x321a67))return null;const _0x3edbf6=readFileSync(_0x321a67,_0x300ed7(0x1cd))[_0x300ed7(0x1d5)]();try{const _0xb68f32=JSON[_0x300ed7(0x1e6)](_0x3edbf6);if(_0xb68f32&&typeof _0xb68f32['id']===_0x300ed7(0x1ed)&&typeof _0xb68f32[_0x300ed7(0x1ac)]==='string'&&typeof _0xb68f32['projectId']===_0x300ed7(0x1ed))return _0xb68f32;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x2f233c,_0x44cebd,_0x315910,_0x11d0a6){try{const _0x15a6fe=getCacheDir(),_0x5f578c=getLLMAgentCacheFile(_0x11d0a6);!existsSync(_0x15a6fe)&&mkdirSync(_0x15a6fe,{'recursive':!![]});const _0xa7b6c6={'name':_0x2f233c,'id':_0x44cebd,'projectId':_0x315910};writeFileSync(_0x5f578c,JSON['stringify'](_0xa7b6c6),'utf-8');}catch{}}export function clearCachedLLMAgent(_0x1bef79){try{const _0x32e0ff=getLLMAgentCacheFile(_0x1bef79);existsSync(_0x32e0ff)&&unlinkSync(_0x32e0ff);}catch{}}export function getAccountInfoCacheFile(_0x18fadf){const _0x5ec345=a46_0x455e,_0x5d1691=_0x18fadf?_0x5ec345(0x1c5)+_0x18fadf+_0x5ec345(0x1e4):_0x5ec345(0x1c6);return join(getCacheDir(),_0x5d1691);}export function readCachedAccountInfo(_0x3291dd){const _0x4d2347=a46_0x455e;try{const _0x1d3ed6=getAccountInfoCacheFile(_0x3291dd);if(!existsSync(_0x1d3ed6))return null;const _0x5822ce=readFileSync(_0x1d3ed6,_0x4d2347(0x1cd))[_0x4d2347(0x1d5)](),_0x55db5e=JSON[_0x4d2347(0x1e6)](_0x5822ce);if(_0x55db5e&&typeof _0x55db5e['site']==='string'&&typeof _0x55db5e[_0x4d2347(0x1b7)]===_0x4d2347(0x1db))return _0x55db5e;return null;}catch{return null;}}export function writeCachedAccountInfo(_0xb60133,_0xbb3055,_0x190043){const _0x19f002=a46_0x455e;try{const _0x19aef5=getCacheDir(),_0x483244=getAccountInfoCacheFile(_0x190043);!existsSync(_0x19aef5)&&mkdirSync(_0x19aef5,{'recursive':!![]});const _0x5f13c8={'site':_0xb60133,'accountId':_0xbb3055,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x483244,JSON['stringify'](_0x5f13c8),_0x19f002(0x1cd));}catch{}}export function parseEnvFile(_0x24a612){const _0x4edd9e=a46_0x455e,_0x1395c5={};for(const _0x531bf0 of _0x24a612[_0x4edd9e(0x1bc)]('\x0a')){const _0x3c9fe2=_0x531bf0[_0x4edd9e(0x1d5)]();if(!_0x3c9fe2||_0x3c9fe2['startsWith']('#'))continue;const _0x42cc93=_0x3c9fe2['match'](/^([^=]+)=(.*)$/);if(_0x42cc93){const _0x4d31de=_0x42cc93[0x1][_0x4edd9e(0x1d5)]();let _0x4247f7=_0x42cc93[0x2][_0x4edd9e(0x1d5)]();(_0x4247f7['startsWith']('\x22')&&_0x4247f7[_0x4edd9e(0x1d2)]('\x22')||_0x4247f7['startsWith']('\x27')&&_0x4247f7[_0x4edd9e(0x1d2)]('\x27'))&&(_0x4247f7=_0x4247f7['slice'](0x1,-0x1)),_0x1395c5[_0x4d31de]=_0x4247f7;}}return _0x1395c5;}export function readUserConfig(){const _0x308b5c=a46_0x455e,_0x39e367=getConfigFile();if(!existsSync(_0x39e367))return{};try{const _0x2eee92=readFileSync(_0x39e367,_0x308b5c(0x1cd));return parseEnvFile(_0x2eee92);}catch(_0x5d46e6){return console[_0x308b5c(0x1ce)](_0x308b5c(0x1aa)+_0x39e367+':',_0x5d46e6),{};}}export function resolveSite(_0x33191e){const _0x207be9=a46_0x455e,_0x54ea8b=['us01','jp01',_0x207be9(0x1b9),_0x207be9(0x1e9),_0x207be9(0x1ba),_0x207be9(0x1dd),_0x207be9(0x1b8),_0x207be9(0x1d7),_0x207be9(0x1f0),_0x207be9(0x1c7)];if(_0x54ea8b['includes'](_0x33191e))return _0x33191e;if(_0x33191e in SITE_ALIASES)return SITE_ALIASES[_0x33191e];return console[_0x207be9(0x1ce)](_0x207be9(0x1f2)+_0x33191e+_0x207be9(0x1bf)),_0x207be9(0x1e8);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}function a46_0x150e(){const _0x1dc5f1=['ap02','llm_default_project','6SJvWrN','profile','string','23013JUhhRr','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','stg-jp01','8tJlaZn','Warning:\x20Unknown\x20site\x20\x27','keychain','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','env','name','legacy\x20.env\x20file','stringify','yellow','map','replace','keychain\x20(profile:\x20','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','tdx','TD_API_KEY\x20env\x20var\x20(deprecated)','TDX_API_KEY','accountId','dev-eu01','eu01','ap03','TDX_API_KEY_<PROFILE>','split','.config','TD_API_KEY_','\x27,\x20defaulting\x20to\x20us01','includes','Warning:\x20Failed\x20to\x20load\x20','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','toUpperCase','.env','account_info.','account_info.json','stg-ap03','8OmNNXU','readFileSync','join','4186134IRhQdT','TDX_API_KEY_','utf-8','warn','5765301HLiTUv','11Cnaqys','filter','endsWith','profiles','959205DiiYen','trim','4586GHQYKe','stg-us01','.env.','29282170AQbZug','legacy\x20.env\x20file\x20(profile:\x20','number','existsSync','dev-us01','TDX_API_KEY\x20env\x20var','5190409oNidBE','startsWith','apiKey','TD_API_KEY','.cache','.json','apiKeys','parse','source','us01'];a46_0x150e=function(){return _0x1dc5f1;};return a46_0x150e();}export function getAPIKey(_0x290cf4,_0x18f296){const _0x15a840=a46_0x455e,_0x439cfe=_0x18f296||getActiveProfileName();if(_0x439cfe){const _0x2af58a=_0x15a840(0x1cc)+normalizeProfileForEnvVar(_0x439cfe);if(process[_0x15a840(0x1ab)][_0x2af58a])return process[_0x15a840(0x1ab)][_0x2af58a];}if(process[_0x15a840(0x1ab)][_0x15a840(0x1b6)])return process[_0x15a840(0x1ab)]['TDX_API_KEY'];if(process['env']['TD_API_KEY'])return process['env'][_0x15a840(0x1e2)];const _0x1948e6=_0x290cf4[_0x15a840(0x1c3)]()[_0x15a840(0x1b1)](/-/g,'_'),_0x27d2c5='TD_API_KEY_'+_0x1948e6;if(_0x439cfe){const _0x5e01e7=loadProfileEnv(_0x439cfe);if(_0x5e01e7){if(_0x5e01e7[_0x27d2c5])return _0x5e01e7[_0x27d2c5];if(_0x5e01e7[_0x15a840(0x1e2)])return _0x5e01e7['TD_API_KEY'];}}const _0x1c63ca=loadUserConfigOnce();if(_0x1c63ca[_0x27d2c5])return _0x1c63ca[_0x27d2c5];if(_0x1c63ca['TD_API_KEY'])return _0x1c63ca['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x46f1f){const _0x17c62d=a46_0x455e;return _0x46f1f[_0x17c62d(0x1c3)]()[_0x17c62d(0x1b1)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x4954de,_0x2bb592){const _0x249936=a46_0x455e,_0x3c1b02=_0x2bb592||getActiveProfileName()||undefined;if(_0x3c1b02){const _0xd432a2=_0x249936(0x1cc)+normalizeProfileForEnvVar(_0x3c1b02);if(process[_0x249936(0x1ab)][_0xd432a2])return{'apiKey':process['env'][_0xd432a2],'source':_0xd432a2+'\x20env\x20var','isDeprecated':![]};const _0x556e21=getCachedCredential(_0x4954de,_0x3c1b02);if(_0x556e21)return{'apiKey':_0x556e21,'source':'keychain\x20(profile:\x20'+_0x3c1b02+')','isDeprecated':![]};const _0x37076d=await getKeychainAPIKey(_0x3c1b02);if(_0x37076d)return setCachedCredential(_0x37076d,_0x4954de,_0x3c1b02),{'apiKey':_0x37076d,'source':_0x249936(0x1b2)+_0x3c1b02+')','isDeprecated':![]};}if(process['env'][_0x249936(0x1b6)])return{'apiKey':process[_0x249936(0x1ab)]['TDX_API_KEY'],'source':_0x249936(0x1de),'isDeprecated':![]};if(!_0x3c1b02){const _0x4d95a7=getCachedCredential(_0x4954de,undefined);if(_0x4d95a7)return{'apiKey':_0x4d95a7,'source':'keychain','isDeprecated':![]};const _0x5f44ad=await getKeychainAPIKey(undefined);if(_0x5f44ad)return setCachedCredential(_0x5f44ad,_0x4954de,undefined),{'apiKey':_0x5f44ad,'source':_0x249936(0x1f3),'isDeprecated':![]};}if(process[_0x249936(0x1ab)]['TD_API_KEY'])return{'apiKey':process['env'][_0x249936(0x1e2)],'source':_0x249936(0x1b5),'isDeprecated':!![]};const _0x2271f5=getLegacyEnvAPIKey(_0x4954de,_0x3c1b02);if(_0x2271f5){const _0x4e62fe=await isKeychainAvailable();if(_0x4e62fe)try{await saveKeychainAPIKey(_0x2271f5,_0x3c1b02),setCachedCredential(_0x2271f5,_0x4954de,_0x3c1b02);const _0x20416a=getConfigFilePath(_0x3c1b02);cleanupLegacyEnvFile(_0x20416a)&&console[_0x249936(0x1ce)](a46_0xdb86fc[_0x249936(0x1af)](_0x249936(0x1c2)));}catch(_0x1244bb){console[_0x249936(0x1ce)](a46_0xdb86fc['yellow']('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x1244bb));}const _0x4e5026=_0x3c1b02?_0x249936(0x1da)+_0x3c1b02+')':_0x249936(0x1ad);return{'apiKey':_0x2271f5,'source':_0x4e5026,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x2b199f,_0x3c2687,_0x263ef8=!![]){const _0x22b169=a46_0x455e,_0x4a5fd7=await resolveAPIKeyAsync(_0x2b199f,_0x3c2687);if(!_0x4a5fd7)return undefined;if(_0x263ef8&&_0x4a5fd7['isDeprecated']&&_0x4a5fd7[_0x22b169(0x1e7)][_0x22b169(0x1c0)](_0x22b169(0x1e2))){const _0x37f486=_0x3c2687||getActiveProfileName()||undefined,_0x3d7eac=_0x37f486?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x37f486):_0x22b169(0x1bb);console[_0x22b169(0x1ce)](a46_0xdb86fc[_0x22b169(0x1af)](_0x22b169(0x1b3)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x3d7eac+').')));}return _0x4a5fd7[_0x22b169(0x1e1)];}function getLegacyEnvAPIKey(_0x59d29d,_0x4bae80){const _0xfdaedc=a46_0x455e,_0x4c4127=_0x59d29d[_0xfdaedc(0x1c3)]()[_0xfdaedc(0x1b1)](/-/g,'_'),_0x3ccc25=_0xfdaedc(0x1be)+_0x4c4127;if(_0x4bae80){const _0x597007=loadProfileEnv(_0x4bae80);if(_0x597007){if(_0x597007[_0x3ccc25])return _0x597007[_0x3ccc25];if(_0x597007['TD_API_KEY'])return _0x597007[_0xfdaedc(0x1e2)];}}const _0x11f2fa=loadUserConfigOnce();if(_0x11f2fa[_0x3ccc25])return _0x11f2fa[_0x3ccc25];if(_0x11f2fa['TD_API_KEY'])return _0x11f2fa[_0xfdaedc(0x1e2)];return undefined;}function cleanupLegacyEnvFile(_0x5db281){const _0x1e333b=a46_0x455e;if(!existsSync(_0x5db281))return![];try{const _0x194aa2=readFileSync(_0x5db281,_0x1e333b(0x1cd)),_0x20c0b4=_0x194aa2[_0x1e333b(0x1bc)]('\x0a'),_0x5113f1=_0x20c0b4[_0x1e333b(0x1d1)](_0x2ef571=>{const _0x58e9af=_0x1e333b,_0x3ca357=_0x2ef571['trim']();if(!_0x3ca357||_0x3ca357[_0x58e9af(0x1e0)]('#'))return!![];const [_0x50ac71]=_0x3ca357[_0x58e9af(0x1bc)]('=');return!_0x50ac71[_0x58e9af(0x1e0)](_0x58e9af(0x1e2));}),_0x421b9e=_0x5113f1['some'](_0x4787c7=>{const _0x4df17b=_0x1e333b,_0x3f8d18=_0x4787c7[_0x4df17b(0x1d5)]();return _0x3f8d18&&!_0x3f8d18[_0x4df17b(0x1e0)]('#');});if(!_0x421b9e)return unlinkSync(_0x5db281),!![];return writeFileSync(_0x5db281,_0x5113f1[_0x1e333b(0x1ca)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x2dba29){const _0x59d2aa=a46_0x455e,_0xb010e3=a46_0x3ba6ea['join'](getConfigDir(),_0x59d2aa(0x1d8)+_0x2dba29);if(a46_0x4b4054[_0x59d2aa(0x1dc)](_0xb010e3)){validateSecureFilePermissions(_0xb010e3);try{const _0x1a2318=a46_0x4b4054[_0x59d2aa(0x1c9)](_0xb010e3,'utf-8');return parseEnvFile(_0x1a2318);}catch(_0x2867ca){console[_0x59d2aa(0x1ce)](_0x59d2aa(0x1c1)+_0xb010e3+':\x20'+_0x2867ca);}}const _0x648241=a46_0x3ba6ea[_0x59d2aa(0x1ca)](getConfigDir(),_0x59d2aa(0x1d3),_0x2dba29,_0x59d2aa(0x1c4));if(a46_0x4b4054['existsSync'](_0x648241)){validateSecureFilePermissions(_0x648241);try{const _0x3d5929=a46_0x4b4054[_0x59d2aa(0x1c9)](_0x648241,_0x59d2aa(0x1cd));return parseEnvFile(_0x3d5929);}catch(_0x4d6c68){return console[_0x59d2aa(0x1ce)](_0x59d2aa(0x1c1)+_0x648241+':\x20'+_0x4d6c68),null;}}return null;}function getActiveProfileName(){const _0x33d99b=a46_0x455e,_0x46a0c5=a46_0x3ba6ea[_0x33d99b(0x1ca)](getConfigDir(),'tdx.json');if(!a46_0x4b4054[_0x33d99b(0x1dc)](_0x46a0c5))return null;try{const _0x31e1a4=a46_0x4b4054[_0x33d99b(0x1c9)](_0x46a0c5,_0x33d99b(0x1cd)),_0x453097=JSON['parse'](_0x31e1a4);return _0x453097[_0x33d99b(0x1ec)]||null;}catch{return null;}}export function saveAPIKey(_0x7ac853,_0x3d20cb,_0x5e9dab){const _0x39eafd=a46_0x455e,_0x584012=getConfigDir(),_0x157ecf=getConfigFilePath(_0x5e9dab);!existsSync(_0x584012)&&mkdirSync(_0x584012,{'recursive':!![],'mode':0x1c0});let _0x24cdc6={};if(existsSync(_0x157ecf))try{const _0x53696b=readFileSync(_0x157ecf,'utf-8');_0x24cdc6=parseEnvFile(_0x53696b);}catch(_0x15ab34){console[_0x39eafd(0x1ce)]('Warning:\x20Failed\x20to\x20read\x20'+_0x157ecf+':',_0x15ab34);}const _0x4430c0=_0x7ac853[_0x39eafd(0x1c3)]()[_0x39eafd(0x1b1)](/-/g,'_');_0x24cdc6[_0x39eafd(0x1be)+_0x4430c0]=_0x3d20cb;const _0x1de105=Object['entries'](_0x24cdc6)[_0x39eafd(0x1b0)](([_0x3e91b4,_0x4831d6])=>_0x3e91b4+'='+_0x4831d6);writeFileSync(_0x157ecf,_0x1de105[_0x39eafd(0x1ca)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x4395ca,_0x224f5d,_0x15e99e){const _0x4ba267=a46_0x455e;await saveKeychainAPIKey(_0x4395ca,_0x15e99e),setCachedCredential(_0x4395ca,_0x224f5d,_0x15e99e);const _0x492a2c=getConfigFilePath(_0x15e99e);cleanupLegacyEnvFile(_0x492a2c)&&console['warn'](a46_0xdb86fc[_0x4ba267(0x1af)](_0x4ba267(0x1ef)));}export function loadConfig(){const _0xe65587=a46_0x455e,_0x23395d={'apiKeys':{},'defaultSite':_0xe65587(0x1e8)},_0x436271=[_0xe65587(0x1e8),'jp01','eu01',_0xe65587(0x1e9),_0xe65587(0x1ba),_0xe65587(0x1dd),_0xe65587(0x1b8),_0xe65587(0x1d7),_0xe65587(0x1f0),'stg-ap03'];for(const _0xfd0d05 of _0x436271){const _0x8bcba=getAPIKey(_0xfd0d05);_0x8bcba&&(_0x23395d[_0xe65587(0x1e5)][_0xfd0d05]=_0x8bcba);}return _0x23395d;}
@@ -1 +1 @@
1
- (function(_0x3744c9,_0x220d1d){const _0x335ec9=a47_0xa425,_0x4a1633=_0x3744c9();while(!![]){try{const _0x4a0889=parseInt(_0x335ec9(0x106))/0x1*(-parseInt(_0x335ec9(0x102))/0x2)+parseInt(_0x335ec9(0x10a))/0x3+parseInt(_0x335ec9(0x109))/0x4+-parseInt(_0x335ec9(0xfe))/0x5*(-parseInt(_0x335ec9(0x107))/0x6)+-parseInt(_0x335ec9(0x10d))/0x7*(-parseInt(_0x335ec9(0x105))/0x8)+parseInt(_0x335ec9(0x103))/0x9+-parseInt(_0x335ec9(0x10b))/0xa*(parseInt(_0x335ec9(0xff))/0xb);if(_0x4a0889===_0x220d1d)break;else _0x4a1633['push'](_0x4a1633['shift']());}catch(_0x4dadfe){_0x4a1633['push'](_0x4a1633['shift']());}}}(a47_0x122e,0x8c1f6));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';function a47_0xa425(_0x1185c9,_0x53625a){_0x1185c9=_0x1185c9-0xfe;const _0x122ecb=a47_0x122e();let _0xa42567=_0x122ecb[_0x1185c9];return _0xa42567;}import{join}from'path';import{getCacheDir}from'./config.js';function a47_0x122e(){const _0x1a3e3e=['3464vpKgMn','23smCCCg','850548IbWOOt','connections','2500196YZWJLa','1134966LqqQKT','20BFWDdB','utf-8','11235UvCYWy','30eoIsaO','7638279BqCpyZ','now','stringify','88682RnXRhF','3903111tieIxy','connections-'];a47_0x122e=function(){return _0x1a3e3e;};return a47_0x122e();}function getCacheFilePath(_0x897cdf){const _0xb4a261=a47_0xa425,_0x3a2bc5=_0x897cdf||'default';return join(getCacheDir(),_0xb4a261(0x104)+_0x3a2bc5+'.json');}export function loadCachedConnections(_0x438cd0){const _0x1b127f=a47_0xa425,_0x37a992=getCacheFilePath(_0x438cd0);if(!existsSync(_0x37a992))return null;try{const _0x4883c3=readFileSync(_0x37a992,'utf-8'),_0x1cfc1a=JSON['parse'](_0x4883c3);return _0x1cfc1a[_0x1b127f(0x108)];}catch{return null;}}export function saveCachedConnections(_0x72d0a1,_0x1d80e7){const _0x57d1d0=a47_0xa425,_0x33c890=getCacheDir();!existsSync(_0x33c890)&&mkdirSync(_0x33c890,{'recursive':!![]});const _0x880c05=getCacheFilePath(_0x72d0a1),_0x3275e9={'connections':_0x1d80e7,'cachedAt':Date[_0x57d1d0(0x100)]()};writeFileSync(_0x880c05,JSON[_0x57d1d0(0x101)](_0x3275e9,null,0x2),_0x57d1d0(0x10c));}export function clearConnectionCache(_0x326dd9){const _0x32f666=getCacheFilePath(_0x326dd9);if(existsSync(_0x32f666))try{unlinkSync(_0x32f666);}catch{}}
1
+ (function(_0x43d34c,_0x568624){const _0x6e616d=a47_0x3ed7,_0x229566=_0x43d34c();while(!![]){try{const _0x15651c=parseInt(_0x6e616d(0x1a3))/0x1*(parseInt(_0x6e616d(0x1a2))/0x2)+-parseInt(_0x6e616d(0x19d))/0x3*(parseInt(_0x6e616d(0x1a0))/0x4)+parseInt(_0x6e616d(0x19b))/0x5*(-parseInt(_0x6e616d(0x19f))/0x6)+parseInt(_0x6e616d(0x1a9))/0x7+-parseInt(_0x6e616d(0x1aa))/0x8*(parseInt(_0x6e616d(0x1a4))/0x9)+parseInt(_0x6e616d(0x19c))/0xa+parseInt(_0x6e616d(0x19e))/0xb;if(_0x15651c===_0x568624)break;else _0x229566['push'](_0x229566['shift']());}catch(_0x8eab7f){_0x229566['push'](_0x229566['shift']());}}}(a47_0x2e15,0x6172d));function a47_0x3ed7(_0x44327c,_0x6f8541){_0x44327c=_0x44327c-0x19b;const _0x2e157f=a47_0x2e15();let _0x3ed7c2=_0x2e157f[_0x44327c];return _0x3ed7c2;}import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function a47_0x2e15(){const _0x206da9=['stringify','.json','utf-8','now','3145870gmhtBU','2224lPpDON','1945JHWoKl','5530010DqOoAA','79026qRnyrw','3836789bIcrdu','5568fRUtpm','48marKnK','connections','2yPcZVb','125911ZiqeMC','12978PAflIK'];a47_0x2e15=function(){return _0x206da9;};return a47_0x2e15();}function getCacheFilePath(_0x3984a4){const _0x58d076=a47_0x3ed7,_0x373963=_0x3984a4||'default';return join(getCacheDir(),'connections-'+_0x373963+_0x58d076(0x1a6));}export function loadCachedConnections(_0x138f6e){const _0x41a7a3=a47_0x3ed7,_0x305543=getCacheFilePath(_0x138f6e);if(!existsSync(_0x305543))return null;try{const _0x55ca1d=readFileSync(_0x305543,_0x41a7a3(0x1a7)),_0x53c127=JSON['parse'](_0x55ca1d);return _0x53c127[_0x41a7a3(0x1a1)];}catch{return null;}}export function saveCachedConnections(_0x28306d,_0x5f3dc5){const _0x15a6ce=a47_0x3ed7,_0x297a1b=getCacheDir();!existsSync(_0x297a1b)&&mkdirSync(_0x297a1b,{'recursive':!![]});const _0x1f55ed=getCacheFilePath(_0x28306d),_0x13a906={'connections':_0x5f3dc5,'cachedAt':Date[_0x15a6ce(0x1a8)]()};writeFileSync(_0x1f55ed,JSON[_0x15a6ce(0x1a5)](_0x13a906,null,0x2),'utf-8');}export function clearConnectionCache(_0x552d8d){const _0x179f27=getCacheFilePath(_0x552d8d);if(existsSync(_0x179f27))try{unlinkSync(_0x179f27);}catch{}}
@@ -1 +1 @@
1
- (function(_0x3a0afe,_0x43f7f2){const _0x5e0920=a48_0x3b73,_0x4d7eb5=_0x3a0afe();while(!![]){try{const _0xc75b8f=-parseInt(_0x5e0920(0x7c))/0x1+parseInt(_0x5e0920(0x75))/0x2*(-parseInt(_0x5e0920(0x6b))/0x3)+-parseInt(_0x5e0920(0x6e))/0x4+parseInt(_0x5e0920(0x72))/0x5+-parseInt(_0x5e0920(0x6d))/0x6*(-parseInt(_0x5e0920(0x6a))/0x7)+parseInt(_0x5e0920(0x6c))/0x8*(-parseInt(_0x5e0920(0x79))/0x9)+parseInt(_0x5e0920(0x77))/0xa;if(_0xc75b8f===_0x43f7f2)break;else _0x4d7eb5['push'](_0x4d7eb5['shift']());}catch(_0x3029de){_0x4d7eb5['push'](_0x4d7eb5['shift']());}}}(a48_0x48a3,0x572d3));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x4921d9,_0x4626fa){const _0x54e43f=a48_0x3b73,_0x1dd395=_0x4921d9||_0x54e43f(0x74),_0x49856a=_0x4626fa||_0x54e43f(0x6f);return _0x1dd395+':'+_0x49856a;}export function getCachedCredential(_0x2c66e7,_0x2d816f){const _0xd432f3=a48_0x3b73,_0x3a376d=getCacheKey(_0x2c66e7,_0x2d816f),_0x414485=cache[_0xd432f3(0x73)](_0x3a376d);if(!_0x414485)return null;if(Date['now']()-_0x414485[_0xd432f3(0x71)]>CACHE_TTL_MS)return cache[_0xd432f3(0x7a)](_0x3a376d),null;return _0x414485[_0xd432f3(0x70)];}export function setCachedCredential(_0x31e3ee,_0x4eec78,_0x3cca1e){const _0xe2b1ed=a48_0x3b73,_0x9062b6=getCacheKey(_0x4eec78,_0x3cca1e);cache[_0xe2b1ed(0x76)](_0x9062b6,{'apiKey':_0x31e3ee,'loadedAt':Date[_0xe2b1ed(0x7b)]()});}function a48_0x3b73(_0x4e1678,_0x2c5041){_0x4e1678=_0x4e1678-0x6a;const _0x48a3a7=a48_0x48a3();let _0x3b738a=_0x48a3a7[_0x4e1678];return _0x3b738a;}function a48_0x48a3(){const _0x1414b9=['set','6107610VzxSTm','clear','204813KYfoMD','delete','now','109656lCgpPG','5761ZKfLkg','396315CLvMYH','8ZiAqUf','4614RoDtkO','1930140eVwBhV','__default_profile__','apiKey','loadedAt','623450GoYXQV','get','__default_site__','6BfLRLm'];a48_0x48a3=function(){return _0x1414b9;};return a48_0x48a3();}export function clearCredentialCache(){const _0x1a1e34=a48_0x3b73;cache[_0x1a1e34(0x78)]();}export function clearCachedCredential(_0x2415b9,_0x3d2f9a){const _0x3ccbc2=a48_0x3b73,_0x47b0f3=getCacheKey(_0x2415b9,_0x3d2f9a);cache[_0x3ccbc2(0x7a)](_0x47b0f3);}
1
+ (function(_0x25421e,_0x5a12a6){const _0x50fd26=a48_0x56ce,_0x2fed0e=_0x25421e();while(!![]){try{const _0x5e3ecf=parseInt(_0x50fd26(0x86))/0x1*(parseInt(_0x50fd26(0x88))/0x2)+parseInt(_0x50fd26(0x8c))/0x3+parseInt(_0x50fd26(0x7e))/0x4*(parseInt(_0x50fd26(0x82))/0x5)+-parseInt(_0x50fd26(0x89))/0x6+-parseInt(_0x50fd26(0x8d))/0x7*(parseInt(_0x50fd26(0x84))/0x8)+parseInt(_0x50fd26(0x8e))/0x9*(parseInt(_0x50fd26(0x87))/0xa)+parseInt(_0x50fd26(0x7b))/0xb;if(_0x5e3ecf===_0x5a12a6)break;else _0x2fed0e['push'](_0x2fed0e['shift']());}catch(_0x1562db){_0x2fed0e['push'](_0x2fed0e['shift']());}}}(a48_0x265c,0x7758f));function a48_0x265c(){const _0x365945=['166923BfRmmQ','2746172VzYcNH','__default_profile__','__default_site__','98776iPRiUW','loadedAt','get','clear','20xdeUbj','apiKey','11528rLcEJp','delete','1umHvCA','60aJBxXo','1227086asvZpu','4079298xLsicw','set','now','1293690nRaJev','1631wZWAVS'];a48_0x265c=function(){return _0x365945;};return a48_0x265c();}function a48_0x56ce(_0x123118,_0x4fbeb2){_0x123118=_0x123118-0x7b;const _0x265c35=a48_0x265c();let _0x56ce6d=_0x265c35[_0x123118];return _0x56ce6d;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x390a00,_0x386a3c){const _0x4ed6fd=a48_0x56ce,_0x4ce47b=_0x390a00||_0x4ed6fd(0x7d),_0x2039a0=_0x386a3c||_0x4ed6fd(0x7c);return _0x4ce47b+':'+_0x2039a0;}export function getCachedCredential(_0x5255f6,_0x3a55f2){const _0x1586ce=a48_0x56ce,_0x51e909=getCacheKey(_0x5255f6,_0x3a55f2),_0x438d61=cache[_0x1586ce(0x80)](_0x51e909);if(!_0x438d61)return null;if(Date[_0x1586ce(0x8b)]()-_0x438d61[_0x1586ce(0x7f)]>CACHE_TTL_MS)return cache['delete'](_0x51e909),null;return _0x438d61[_0x1586ce(0x83)];}export function setCachedCredential(_0x1acac9,_0x12eeb4,_0x5ba3af){const _0x587e85=a48_0x56ce,_0x347aa=getCacheKey(_0x12eeb4,_0x5ba3af);cache[_0x587e85(0x8a)](_0x347aa,{'apiKey':_0x1acac9,'loadedAt':Date[_0x587e85(0x8b)]()});}export function clearCredentialCache(){const _0x450927=a48_0x56ce;cache[_0x450927(0x81)]();}export function clearCachedCredential(_0x3d496e,_0x6a5c72){const _0x5c7766=a48_0x56ce,_0x4c9cf0=getCacheKey(_0x3d496e,_0x6a5c72);cache[_0x5c7766(0x85)](_0x4c9cf0);}
@@ -1 +1 @@
1
- function a49_0x5ab2(){const _0x3fddc9=['string','verbose','97610gxoYod','global','profiles','sessionId','join','llmProject','loadGlobalConfig','injectIntoOptions','Profile\x20Credentials','database','getSource','sessions','CLI\x20flag:\x20--','activeProfile','profile','site','16056XhQozw','resolveAPIKeyAsync','layers',':\x20none','Profile','utf-8','createAsync','entries','us01','apiKey','Global','session','log','llm_project','4554976CZYQwP','project','config','2351658dRQCDE','llm_agent','profileCredentials','profile:\x20','(session:\x20','.env','parentSegment','1688335YqPukP','465156TGqZBQ','Session','parent_segment','segmentPath','llmAgent','readFileSync','Project','replace','existsSync','not\x20set','segment_path','globalCredentials','tdx.json','configFiles','99861lBsOZP','1974tFvpaS','getParameters',':\x20none\x20(using\x20session:\x20','cliFlags'];a49_0x5ab2=function(){return _0x3fddc9;};return a49_0x5ab2();}const a49_0x40c397=a49_0x3725;(function(_0x50bf56,_0x2c476a){const _0x3461b6=a49_0x3725,_0x8da48b=_0x50bf56();while(!![]){try{const _0x2f7255=parseInt(_0x3461b6(0x9c))/0x1+parseInt(_0x3461b6(0xa3))/0x2+parseInt(_0x3461b6(0x86))/0x3+parseInt(_0x3461b6(0x8e))/0x4+-parseInt(_0x3461b6(0x8d))/0x5+parseInt(_0x3461b6(0x75))/0x6*(-parseInt(_0x3461b6(0x9d))/0x7)+parseInt(_0x3461b6(0x83))/0x8;if(_0x2f7255===_0x2c476a)break;else _0x8da48b['push'](_0x8da48b['shift']());}catch(_0x329780){_0x8da48b['push'](_0x8da48b['shift']());}}}(a49_0x5ab2,0x8065a));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';function a49_0x3725(_0x8de70f,_0x3a104a){_0x8de70f=_0x8de70f-0x68;const _0x5ab2c2=a49_0x5ab2();let _0x372518=_0x5ab2c2[_0x8de70f];return _0x372518;}import*as a49_0x32cedd from'node:fs';import*as a49_0x5f0929 from'node:path';export class GlobalContext{['site'];[a49_0x40c397(0x6e)];['parent_segment'];[a49_0x40c397(0x98)];['llm_project'];['llm_agent'];[a49_0x40c397(0x7e)];[a49_0x40c397(0xa2)];['logLevel'];['profile'];[a49_0x40c397(0x77)];[a49_0x40c397(0x72)];[a49_0x40c397(0x68)];['configFiles'];constructor(_0x13a946){const _0x49b4db=a49_0x40c397;this[_0x49b4db(0x68)]=_0x13a946[_0x49b4db(0x80)]||getCurrentSessionPID()['toString']();const _0x14e61b=loadSessionContext(_0x13a946[_0x49b4db(0x80)]),_0x440949=loadProjectConfig(),_0x329724=this[_0x49b4db(0x6b)]();this[_0x49b4db(0x72)]=_0x13a946[_0x49b4db(0x73)]||_0x14e61b?.[_0x49b4db(0x73)]||_0x329724[_0x49b4db(0x73)]||getActiveProfile();const _0x1ecae5=this[_0x49b4db(0x72)]?loadProfile(this[_0x49b4db(0x72)]):null,_0x5d44dc=_0x5e53b4=>{const _0x3e1a78=_0x49b4db;if(!_0x5e53b4)return{};const _0x1746bf=_0x5e53b4,_0x173495={};for(const [_0x567303,_0x87c938]of Object[_0x3e1a78(0x7c)](_0x1746bf)){typeof _0x87c938===_0x3e1a78(0xa1)&&(_0x173495[_0x567303]=_0x87c938);}return _0x173495;},_0x3cdfde={};if(_0x13a946[_0x49b4db(0x74)]&&_0x13a946[_0x49b4db(0x74)]!=='us01')_0x3cdfde[_0x49b4db(0x74)]=_0x13a946['site'];const _0x441b99=_0x14e61b?.[_0x49b4db(0x6e)],_0x8ecd55=_0x440949?.['database'],_0x516ff7=_0x1ecae5?.[_0x49b4db(0x85)]?.[_0x49b4db(0x6e)],_0x2ebb18=_0x329724[_0x49b4db(0x6e)];_0x13a946[_0x49b4db(0x6e)]&&(_0x13a946[_0x49b4db(0x6e)]!==_0x441b99&&_0x13a946[_0x49b4db(0x6e)]!==_0x8ecd55&&_0x13a946['database']!==_0x516ff7&&_0x13a946[_0x49b4db(0x6e)]!==_0x2ebb18)&&(_0x3cdfde[_0x49b4db(0x6e)]=_0x13a946['database']);if(_0x13a946[_0x49b4db(0x8c)])_0x3cdfde['parent_segment']=_0x13a946[_0x49b4db(0x8c)];if(_0x13a946['llmProject'])_0x3cdfde[_0x49b4db(0x82)]=_0x13a946[_0x49b4db(0x6a)];if(_0x13a946['llmAgent'])_0x3cdfde[_0x49b4db(0x87)]=_0x13a946[_0x49b4db(0x92)];if(_0x13a946['profile'])_0x3cdfde[_0x49b4db(0x73)]=_0x13a946[_0x49b4db(0x73)];this[_0x49b4db(0x77)]={'cliFlags':_0x3cdfde,'session':_0x5d44dc(_0x14e61b),'project':_0x5d44dc(_0x440949),'profile':_0x5d44dc(_0x1ecae5?.[_0x49b4db(0x85)]),'global':_0x5d44dc(_0x329724)};const _0x306f0e={...this['layers']['global'],...this['layers']['profile'],...this[_0x49b4db(0x77)][_0x49b4db(0x84)],...this[_0x49b4db(0x77)][_0x49b4db(0x80)],...this[_0x49b4db(0x77)][_0x49b4db(0xa0)]},_0x14ec5f=_0x306f0e[_0x49b4db(0x74)]||_0x49b4db(0x7d);this[_0x49b4db(0x74)]=resolveSite(_0x14ec5f),this[_0x49b4db(0x6e)]=_0x306f0e['database'],this[_0x49b4db(0x90)]=_0x306f0e[_0x49b4db(0x90)],this[_0x49b4db(0x98)]=_0x306f0e[_0x49b4db(0x98)],this[_0x49b4db(0x82)]=_0x306f0e[_0x49b4db(0x82)],this['llm_agent']=_0x306f0e[_0x49b4db(0x87)],this['verbose']=_0x13a946['verbose']||![],this['logLevel']=_0x13a946['logLevel']??LogLevel['INFO'],this[_0x49b4db(0x73)]=this[_0x49b4db(0x72)]||undefined,this['apiKey']=getAPIKey(this[_0x49b4db(0x74)],this[_0x49b4db(0x72)]||undefined);const _0x537454=getConfigDir(),_0x34686d=a49_0x5f0929[_0x49b4db(0x69)](_0x537454,_0x49b4db(0x70),this['sessionId']+'.json'),_0x2ea5b0=findProjectConfigPath(),_0x25b481=a49_0x5f0929[_0x49b4db(0x69)](_0x537454,_0x49b4db(0x9a)),_0x447548=a49_0x5f0929['join'](_0x537454,'.env');let _0x3647ec=null,_0x4b86c2=null;this[_0x49b4db(0x72)]&&(_0x3647ec=a49_0x5f0929[_0x49b4db(0x69)](_0x537454,_0x49b4db(0xa5),this['activeProfile'],_0x49b4db(0x9a)),_0x4b86c2=a49_0x5f0929[_0x49b4db(0x69)](_0x537454,'profiles',this[_0x49b4db(0x72)],_0x49b4db(0x8b))),this['configFiles']={'session':a49_0x32cedd['existsSync'](_0x34686d)?_0x34686d:null,'project':_0x2ea5b0,'profile':_0x3647ec&&a49_0x32cedd[_0x49b4db(0x96)](_0x3647ec)?_0x3647ec:null,'profileCredentials':_0x4b86c2&&a49_0x32cedd[_0x49b4db(0x96)](_0x4b86c2)?_0x4b86c2:null,'global':a49_0x32cedd[_0x49b4db(0x96)](_0x25b481)?_0x25b481:null,'globalCredentials':a49_0x32cedd['existsSync'](_0x447548)?_0x447548:null};}[a49_0x40c397(0x6f)](_0x3ac829,_0x21b667){const _0x2d7162=a49_0x40c397;if(!_0x21b667)return _0x2d7162(0x97);const _0x1ea02f=_0x21b667;if(this[_0x2d7162(0x77)][_0x2d7162(0xa0)][_0x3ac829]===_0x1ea02f){if(_0x3ac829==='site'&&_0x1ea02f==='us01'&&!this['layers'][_0x2d7162(0x80)][_0x2d7162(0x74)]&&!this[_0x2d7162(0x77)][_0x2d7162(0x84)][_0x2d7162(0x74)]&&!this['layers']['profile'][_0x2d7162(0x74)]&&!this[_0x2d7162(0x77)]['global'][_0x2d7162(0x74)])return'default';return _0x2d7162(0x71)+_0x3ac829[_0x2d7162(0x95)](/_/g,'-');}if(this[_0x2d7162(0x77)]['session'][_0x3ac829]===_0x1ea02f)return _0x2d7162(0x80);if(this['layers'][_0x2d7162(0x84)][_0x3ac829]===_0x1ea02f)return _0x2d7162(0x84);if(this[_0x2d7162(0x77)][_0x2d7162(0x73)][_0x3ac829]===_0x1ea02f)return _0x2d7162(0x89)+this[_0x2d7162(0x72)];if(this[_0x2d7162(0x77)][_0x2d7162(0xa4)][_0x3ac829]===_0x1ea02f)return _0x2d7162(0xa4);return'default';}[a49_0x40c397(0x6b)](){const _0x4b277a=a49_0x40c397,_0x203530=a49_0x5f0929[_0x4b277a(0x69)](getConfigDir(),_0x4b277a(0x9a));if(!a49_0x32cedd[_0x4b277a(0x96)](_0x203530))return{};try{const _0x1a40e8=a49_0x32cedd[_0x4b277a(0x93)](_0x203530,_0x4b277a(0x7a));return JSON['parse'](_0x1a40e8);}catch{return{};}}[a49_0x40c397(0x6c)](_0x1e720b){const _0x4f19d8=a49_0x40c397;_0x1e720b['site']=this['site'],!_0x1e720b[_0x4f19d8(0x6e)]&&this[_0x4f19d8(0x6e)]&&(_0x1e720b[_0x4f19d8(0x6e)]=this[_0x4f19d8(0x6e)]),!_0x1e720b[_0x4f19d8(0x8c)]&&this[_0x4f19d8(0x90)]&&(_0x1e720b['parentSegment']=this[_0x4f19d8(0x90)]),!_0x1e720b[_0x4f19d8(0x91)]&&this['segment_path']&&(_0x1e720b[_0x4f19d8(0x91)]=this[_0x4f19d8(0x98)]),!_0x1e720b['llmProject']&&this[_0x4f19d8(0x82)]&&(_0x1e720b[_0x4f19d8(0x6a)]=this['llm_project']),!_0x1e720b[_0x4f19d8(0x92)]&&this[_0x4f19d8(0x87)]&&(_0x1e720b[_0x4f19d8(0x92)]=this[_0x4f19d8(0x87)]);}['getParameters'](){const _0x1c4e26=a49_0x40c397;return[{'key':_0x1c4e26(0x74),'value':this[_0x1c4e26(0x74)]},{'key':_0x1c4e26(0x6e),'value':this[_0x1c4e26(0x6e)]},{'key':'parent_segment','value':this[_0x1c4e26(0x90)]},{'key':_0x1c4e26(0x98),'value':this[_0x1c4e26(0x98)]},{'key':_0x1c4e26(0x82),'value':this[_0x1c4e26(0x82)]},{'key':_0x1c4e26(0x87),'value':this[_0x1c4e26(0x87)]},{'key':'profile','value':this[_0x1c4e26(0x72)]||undefined}];}['display'](){const _0xdf6da=a49_0x40c397;console[_0xdf6da(0x81)]('[context]');for(const {key:_0x189208,value:_0xbc6c5c}of this[_0xdf6da(0x9e)]()){_0xbc6c5c&&console['log'](_0x189208+':\x20'+_0xbc6c5c);}}['displayWithSources'](){const _0x23773f=a49_0x40c397;console[_0x23773f(0x81)]('[context]');for(const {key:_0x3449e1,value:_0x355973}of this[_0x23773f(0x9e)]()){if(_0x355973){const _0x30952b=_0x3449e1===_0x23773f(0x73)?'(active)':'('+this[_0x23773f(0x6f)](_0x3449e1,_0x355973)+')';console['log'](_0x3449e1+':\x20'+_0x355973+'\x20'+_0x30952b);}}console[_0x23773f(0x81)]('\x0a[configuration\x20files]');const _0x1ac168=[{'label':_0x23773f(0x8f),'path':this['configFiles'][_0x23773f(0x80)],'extra':_0x23773f(0x8a)+this[_0x23773f(0x68)]+')'},{'label':'Project','path':this['configFiles'][_0x23773f(0x84)]},{'label':_0x23773f(0x79),'path':this[_0x23773f(0x9b)][_0x23773f(0x73)]},{'label':_0x23773f(0x6d),'path':this[_0x23773f(0x9b)][_0x23773f(0x88)]},{'label':_0x23773f(0x7f),'path':this[_0x23773f(0x9b)][_0x23773f(0xa4)]},{'label':'Global\x20Credentials','path':this[_0x23773f(0x9b)][_0x23773f(0x99)]}];for(const {label:_0x5b35ae,path:_0xa6d9c4,extra:_0x238c47}of _0x1ac168){if(_0xa6d9c4)console[_0x23773f(0x81)](_0x5b35ae+':\x20'+_0xa6d9c4+'\x20✓'+(_0x238c47?'\x20'+_0x238c47:''));else{if(_0x5b35ae===_0x23773f(0x8f))console[_0x23773f(0x81)](_0x5b35ae+_0x23773f(0x9f)+this[_0x23773f(0x68)]+')');else(_0x5b35ae===_0x23773f(0x94)||_0x5b35ae===_0x23773f(0x7f))&&console['log'](_0x5b35ae+_0x23773f(0x78));}}}async[a49_0x40c397(0x76)](){const _0x494ee2=a49_0x40c397;return this['apiKey']=await getAPIKeyAsync(this['site'],this['activeProfile']||undefined),this[_0x494ee2(0x7e)];}static async[a49_0x40c397(0x7b)](_0x77627e){const _0x35ad1a=a49_0x40c397,_0x17e13f=new GlobalContext(_0x77627e);return await _0x17e13f[_0x35ad1a(0x76)](),_0x17e13f;}}
1
+ const a49_0x2c5ae3=a49_0x5118;(function(_0x43452e,_0x1933f8){const _0x19b5c4=a49_0x5118,_0x281496=_0x43452e();while(!![]){try{const _0x1b0515=parseInt(_0x19b5c4(0x173))/0x1*(parseInt(_0x19b5c4(0x1a0))/0x2)+parseInt(_0x19b5c4(0x16a))/0x3+parseInt(_0x19b5c4(0x19f))/0x4*(-parseInt(_0x19b5c4(0x1a2))/0x5)+-parseInt(_0x19b5c4(0x187))/0x6+parseInt(_0x19b5c4(0x1a5))/0x7+-parseInt(_0x19b5c4(0x177))/0x8*(parseInt(_0x19b5c4(0x169))/0x9)+parseInt(_0x19b5c4(0x16f))/0xa;if(_0x1b0515===_0x1933f8)break;else _0x281496['push'](_0x281496['shift']());}catch(_0x9f0fab){_0x281496['push'](_0x281496['shift']());}}}(a49_0xfb5c,0xd2549));function a49_0x5118(_0x2e95ac,_0x5c11b9){_0x2e95ac=_0x2e95ac-0x164;const _0xfb5c8=a49_0xfb5c();let _0x5118e3=_0xfb5c8[_0x2e95ac];return _0x5118e3;}import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';function a49_0xfb5c(){const _0x37f9de=['Global','llmAgent','session','73440vIOUwd','782964hScWYQ','getSource','injectIntoOptions','parse','llm_project','4879880YgVarl','Project','global','display','9IjquXi','profiles','log','database','384mLsczM','utf-8','default','verbose','(session:\x20','logLevel','site','config','Profile\x20Credentials','existsSync','llmProject',':\x20none\x20(using\x20session:\x20','configFiles','entries','profile','getParameters','8771682rGdqZP','us01','loadGlobalConfig','llm_agent','.env','Session','CLI\x20flag:\x20--','tdx.json','apiKey','cliFlags','readFileSync','[context]','Global\x20Credentials','sessionId','parent_segment','profileCredentials','.json','parentSegment','not\x20set','join',':\x20none','displayWithSources','project','globalCredentials','32212DiuNgN','352226KXeHXA','createAsync','795koDNCi','segment_path','Profile','11631018wLQWhH','activeProfile','(active)','layers','\x0a[configuration\x20files]'];a49_0xfb5c=function(){return _0x37f9de;};return a49_0xfb5c();}import*as a49_0xd95b99 from'node:fs';import*as a49_0x546cda from'node:path';export class GlobalContext{[a49_0x2c5ae3(0x17d)];[a49_0x2c5ae3(0x176)];[a49_0x2c5ae3(0x195)];[a49_0x2c5ae3(0x1a3)];['llm_project'];['llm_agent'];[a49_0x2c5ae3(0x18f)];[a49_0x2c5ae3(0x17a)];['logLevel'];[a49_0x2c5ae3(0x185)];[a49_0x2c5ae3(0x164)];[a49_0x2c5ae3(0x1a6)];[a49_0x2c5ae3(0x194)];[a49_0x2c5ae3(0x183)];constructor(_0xb65707){const _0x2a4a31=a49_0x2c5ae3;this[_0x2a4a31(0x194)]=_0xb65707[_0x2a4a31(0x168)]||getCurrentSessionPID()['toString']();const _0x16ff74=loadSessionContext(_0xb65707[_0x2a4a31(0x168)]),_0x5396c7=loadProjectConfig(),_0x12b508=this[_0x2a4a31(0x189)]();this[_0x2a4a31(0x1a6)]=_0xb65707[_0x2a4a31(0x185)]||_0x16ff74?.[_0x2a4a31(0x185)]||_0x12b508['profile']||getActiveProfile();const _0x357168=this['activeProfile']?loadProfile(this[_0x2a4a31(0x1a6)]):null,_0x30a9d1=_0x2a612c=>{const _0x582924=_0x2a4a31;if(!_0x2a612c)return{};const _0x38c989=_0x2a612c,_0x42aa84={};for(const [_0x5d3f80,_0x513857]of Object[_0x582924(0x184)](_0x38c989)){typeof _0x513857==='string'&&(_0x42aa84[_0x5d3f80]=_0x513857);}return _0x42aa84;},_0x130cfd={};if(_0xb65707[_0x2a4a31(0x17d)]&&_0xb65707[_0x2a4a31(0x17d)]!=='us01')_0x130cfd[_0x2a4a31(0x17d)]=_0xb65707['site'];const _0x1914b5=_0x16ff74?.[_0x2a4a31(0x176)],_0x7ec6e5=_0x5396c7?.[_0x2a4a31(0x176)],_0x43255c=_0x357168?.[_0x2a4a31(0x17e)]?.[_0x2a4a31(0x176)],_0x567ed9=_0x12b508[_0x2a4a31(0x176)];_0xb65707[_0x2a4a31(0x176)]&&(_0xb65707['database']!==_0x1914b5&&_0xb65707[_0x2a4a31(0x176)]!==_0x7ec6e5&&_0xb65707['database']!==_0x43255c&&_0xb65707[_0x2a4a31(0x176)]!==_0x567ed9)&&(_0x130cfd[_0x2a4a31(0x176)]=_0xb65707[_0x2a4a31(0x176)]);if(_0xb65707[_0x2a4a31(0x198)])_0x130cfd[_0x2a4a31(0x195)]=_0xb65707[_0x2a4a31(0x198)];if(_0xb65707['llmProject'])_0x130cfd[_0x2a4a31(0x16e)]=_0xb65707[_0x2a4a31(0x181)];if(_0xb65707[_0x2a4a31(0x167)])_0x130cfd[_0x2a4a31(0x18a)]=_0xb65707['llmAgent'];if(_0xb65707[_0x2a4a31(0x185)])_0x130cfd['profile']=_0xb65707[_0x2a4a31(0x185)];this[_0x2a4a31(0x164)]={'cliFlags':_0x130cfd,'session':_0x30a9d1(_0x16ff74),'project':_0x30a9d1(_0x5396c7),'profile':_0x30a9d1(_0x357168?.['config']),'global':_0x30a9d1(_0x12b508)};const _0x4a43cf={...this[_0x2a4a31(0x164)][_0x2a4a31(0x171)],...this[_0x2a4a31(0x164)]['profile'],...this[_0x2a4a31(0x164)][_0x2a4a31(0x19d)],...this['layers'][_0x2a4a31(0x168)],...this['layers'][_0x2a4a31(0x190)]},_0x23247f=_0x4a43cf['site']||_0x2a4a31(0x188);this[_0x2a4a31(0x17d)]=resolveSite(_0x23247f),this[_0x2a4a31(0x176)]=_0x4a43cf[_0x2a4a31(0x176)],this[_0x2a4a31(0x195)]=_0x4a43cf[_0x2a4a31(0x195)],this['segment_path']=_0x4a43cf[_0x2a4a31(0x1a3)],this[_0x2a4a31(0x16e)]=_0x4a43cf[_0x2a4a31(0x16e)],this['llm_agent']=_0x4a43cf[_0x2a4a31(0x18a)],this[_0x2a4a31(0x17a)]=_0xb65707[_0x2a4a31(0x17a)]||![],this['logLevel']=_0xb65707[_0x2a4a31(0x17c)]??LogLevel['INFO'],this[_0x2a4a31(0x185)]=this[_0x2a4a31(0x1a6)]||undefined,this[_0x2a4a31(0x18f)]=getAPIKey(this['site'],this['activeProfile']||undefined);const _0x29a5bb=getConfigDir(),_0x58e9a8=a49_0x546cda['join'](_0x29a5bb,'sessions',this[_0x2a4a31(0x194)]+_0x2a4a31(0x197)),_0x473b8f=findProjectConfigPath(),_0x3f1d39=a49_0x546cda[_0x2a4a31(0x19a)](_0x29a5bb,_0x2a4a31(0x18e)),_0x6587fc=a49_0x546cda[_0x2a4a31(0x19a)](_0x29a5bb,_0x2a4a31(0x18b));let _0x1cd6b9=null,_0x3f0b76=null;this[_0x2a4a31(0x1a6)]&&(_0x1cd6b9=a49_0x546cda['join'](_0x29a5bb,_0x2a4a31(0x174),this['activeProfile'],'tdx.json'),_0x3f0b76=a49_0x546cda[_0x2a4a31(0x19a)](_0x29a5bb,_0x2a4a31(0x174),this['activeProfile'],_0x2a4a31(0x18b))),this[_0x2a4a31(0x183)]={'session':a49_0xd95b99[_0x2a4a31(0x180)](_0x58e9a8)?_0x58e9a8:null,'project':_0x473b8f,'profile':_0x1cd6b9&&a49_0xd95b99['existsSync'](_0x1cd6b9)?_0x1cd6b9:null,'profileCredentials':_0x3f0b76&&a49_0xd95b99[_0x2a4a31(0x180)](_0x3f0b76)?_0x3f0b76:null,'global':a49_0xd95b99[_0x2a4a31(0x180)](_0x3f1d39)?_0x3f1d39:null,'globalCredentials':a49_0xd95b99[_0x2a4a31(0x180)](_0x6587fc)?_0x6587fc:null};}[a49_0x2c5ae3(0x16b)](_0x190b74,_0xea362b){const _0x195b67=a49_0x2c5ae3;if(!_0xea362b)return _0x195b67(0x199);const _0x3cdd50=_0xea362b;if(this[_0x195b67(0x164)][_0x195b67(0x190)][_0x190b74]===_0x3cdd50){if(_0x190b74===_0x195b67(0x17d)&&_0x3cdd50===_0x195b67(0x188)&&!this[_0x195b67(0x164)][_0x195b67(0x168)]['site']&&!this[_0x195b67(0x164)][_0x195b67(0x19d)][_0x195b67(0x17d)]&&!this[_0x195b67(0x164)][_0x195b67(0x185)][_0x195b67(0x17d)]&&!this[_0x195b67(0x164)][_0x195b67(0x171)]['site'])return _0x195b67(0x179);return _0x195b67(0x18d)+_0x190b74['replace'](/_/g,'-');}if(this[_0x195b67(0x164)][_0x195b67(0x168)][_0x190b74]===_0x3cdd50)return _0x195b67(0x168);if(this[_0x195b67(0x164)]['project'][_0x190b74]===_0x3cdd50)return _0x195b67(0x19d);if(this[_0x195b67(0x164)][_0x195b67(0x185)][_0x190b74]===_0x3cdd50)return'profile:\x20'+this[_0x195b67(0x1a6)];if(this[_0x195b67(0x164)][_0x195b67(0x171)][_0x190b74]===_0x3cdd50)return _0x195b67(0x171);return _0x195b67(0x179);}[a49_0x2c5ae3(0x189)](){const _0x35b396=a49_0x2c5ae3,_0x474312=a49_0x546cda['join'](getConfigDir(),_0x35b396(0x18e));if(!a49_0xd95b99[_0x35b396(0x180)](_0x474312))return{};try{const _0x2193b3=a49_0xd95b99[_0x35b396(0x191)](_0x474312,_0x35b396(0x178));return JSON[_0x35b396(0x16d)](_0x2193b3);}catch{return{};}}[a49_0x2c5ae3(0x16c)](_0xa2537b){const _0x22b034=a49_0x2c5ae3;_0xa2537b[_0x22b034(0x17d)]=this[_0x22b034(0x17d)],!_0xa2537b[_0x22b034(0x176)]&&this[_0x22b034(0x176)]&&(_0xa2537b[_0x22b034(0x176)]=this[_0x22b034(0x176)]),!_0xa2537b['parentSegment']&&this[_0x22b034(0x195)]&&(_0xa2537b[_0x22b034(0x198)]=this[_0x22b034(0x195)]),!_0xa2537b['segmentPath']&&this[_0x22b034(0x1a3)]&&(_0xa2537b['segmentPath']=this['segment_path']),!_0xa2537b['llmProject']&&this[_0x22b034(0x16e)]&&(_0xa2537b[_0x22b034(0x181)]=this[_0x22b034(0x16e)]),!_0xa2537b[_0x22b034(0x167)]&&this[_0x22b034(0x18a)]&&(_0xa2537b[_0x22b034(0x167)]=this[_0x22b034(0x18a)]);}['getParameters'](){const _0x5b5ac3=a49_0x2c5ae3;return[{'key':_0x5b5ac3(0x17d),'value':this[_0x5b5ac3(0x17d)]},{'key':_0x5b5ac3(0x176),'value':this['database']},{'key':_0x5b5ac3(0x195),'value':this[_0x5b5ac3(0x195)]},{'key':_0x5b5ac3(0x1a3),'value':this[_0x5b5ac3(0x1a3)]},{'key':'llm_project','value':this['llm_project']},{'key':_0x5b5ac3(0x18a),'value':this[_0x5b5ac3(0x18a)]},{'key':_0x5b5ac3(0x185),'value':this[_0x5b5ac3(0x1a6)]||undefined}];}[a49_0x2c5ae3(0x172)](){const _0x2308db=a49_0x2c5ae3;console[_0x2308db(0x175)](_0x2308db(0x192));for(const {key:_0x28f190,value:_0x9f022c}of this[_0x2308db(0x186)]()){_0x9f022c&&console[_0x2308db(0x175)](_0x28f190+':\x20'+_0x9f022c);}}[a49_0x2c5ae3(0x19c)](){const _0x6294e2=a49_0x2c5ae3;console['log']('[context]');for(const {key:_0x1c968a,value:_0x429593}of this['getParameters']()){if(_0x429593){const _0x59b4ac=_0x1c968a===_0x6294e2(0x185)?_0x6294e2(0x1a7):'('+this['getSource'](_0x1c968a,_0x429593)+')';console[_0x6294e2(0x175)](_0x1c968a+':\x20'+_0x429593+'\x20'+_0x59b4ac);}}console[_0x6294e2(0x175)](_0x6294e2(0x165));const _0x4ac46f=[{'label':_0x6294e2(0x18c),'path':this[_0x6294e2(0x183)][_0x6294e2(0x168)],'extra':_0x6294e2(0x17b)+this[_0x6294e2(0x194)]+')'},{'label':_0x6294e2(0x170),'path':this['configFiles'][_0x6294e2(0x19d)]},{'label':_0x6294e2(0x1a4),'path':this['configFiles'][_0x6294e2(0x185)]},{'label':_0x6294e2(0x17f),'path':this[_0x6294e2(0x183)][_0x6294e2(0x196)]},{'label':_0x6294e2(0x166),'path':this[_0x6294e2(0x183)][_0x6294e2(0x171)]},{'label':_0x6294e2(0x193),'path':this['configFiles'][_0x6294e2(0x19e)]}];for(const {label:_0x5df64d,path:_0x322965,extra:_0x4ae84e}of _0x4ac46f){if(_0x322965)console[_0x6294e2(0x175)](_0x5df64d+':\x20'+_0x322965+'\x20✓'+(_0x4ae84e?'\x20'+_0x4ae84e:''));else{if(_0x5df64d===_0x6294e2(0x18c))console[_0x6294e2(0x175)](_0x5df64d+_0x6294e2(0x182)+this[_0x6294e2(0x194)]+')');else(_0x5df64d===_0x6294e2(0x170)||_0x5df64d===_0x6294e2(0x166))&&console['log'](_0x5df64d+_0x6294e2(0x19b));}}}async['resolveAPIKeyAsync'](){const _0x4ef631=a49_0x2c5ae3;return this[_0x4ef631(0x18f)]=await getAPIKeyAsync(this[_0x4ef631(0x17d)],this[_0x4ef631(0x1a6)]||undefined),this[_0x4ef631(0x18f)];}static async[a49_0x2c5ae3(0x1a1)](_0x2ed0a2){const _0x291697=new GlobalContext(_0x2ed0a2);return await _0x291697['resolveAPIKeyAsync'](),_0x291697;}}
@@ -1 +1 @@
1
- const a50_0x5f2235=a50_0x2e8a;(function(_0xe2a608,_0x48dcc1){const _0x50b5be=a50_0x2e8a,_0x102ce=_0xe2a608();while(!![]){try{const _0x513e4f=-parseInt(_0x50b5be(0x1d7))/0x1*(parseInt(_0x50b5be(0x1d3))/0x2)+parseInt(_0x50b5be(0x1db))/0x3+-parseInt(_0x50b5be(0x1c9))/0x4+-parseInt(_0x50b5be(0x1c7))/0x5+-parseInt(_0x50b5be(0x1c8))/0x6*(-parseInt(_0x50b5be(0x1bf))/0x7)+parseInt(_0x50b5be(0x1c6))/0x8+-parseInt(_0x50b5be(0x1dc))/0x9*(-parseInt(_0x50b5be(0x1cb))/0xa);if(_0x513e4f===_0x48dcc1)break;else _0x102ce['push'](_0x102ce['shift']());}catch(_0x3acab0){_0x102ce['push'](_0x102ce['shift']());}}}(a50_0x5eb9,0xdabd3));function a50_0x5eb9(){const _0x41847b=['not_found','getPassword','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.','includes','__keychain_test__','restricted','1158866zoyeUz','message','tdx','setPassword','1vPuSZD','-25293','keyring','success','994332mEvfQH','18AmYJXC','access_denied','value','toLowerCase','7cAhxlx','access','not\x20found','System\x20keychain\x20is\x20not\x20available','cannot\x20find','reason','could\x20not\x20be\x20found','5531776ZOKQoW','8665760ChGKXV','3234414JnvDxs','3202508TbRsWO','deletePassword','12235910xYHqkR','unavailable'];a50_0x5eb9=function(){return _0x41847b;};return a50_0x5eb9();}const SERVICE_NAME=a50_0x5f2235(0x1d5);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x3b1e84=a50_0x5f2235;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x47d4c3=await import('@zowe/secrets-for-zowe-sdk');return keyringModule=_0x47d4c3[_0x3b1e84(0x1d9)],keyringModule;}catch(_0x3406fb){return keyringLoadError=_0x3406fb instanceof Error?_0x3406fb:new Error(String(_0x3406fb)),null;}}function getAccountName(_0x53eff8){const _0x1f61b3=_0x53eff8||'';return'profile:'+_0x1f61b3+':api_key';}export async function getKeychainAPIKey(_0x187340){const _0x11c2df=a50_0x5f2235,_0x5e6725=await getKeychainAPIKeyWithStatus(_0x187340);if(_0x5e6725[_0x11c2df(0x1da)])return _0x5e6725[_0x11c2df(0x1de)];return _0x5e6725[_0x11c2df(0x1c4)]===_0x11c2df(0x1dd)&&console['error']('Warning:\x20'+_0x5e6725[_0x11c2df(0x1d4)]),null;}function a50_0x2e8a(_0x1ff9e9,_0x409697){_0x1ff9e9=_0x1ff9e9-0x1bf;const _0x5eb9f8=a50_0x5eb9();let _0x2e8a90=_0x5eb9f8[_0x1ff9e9];return _0x2e8a90;}export async function getKeychainAPIKeyWithStatus(_0x153eae){const _0x52afb7=a50_0x5f2235;try{const _0x370e5b=await getKeyring();if(!_0x370e5b)return{'success':![],'reason':_0x52afb7(0x1cc)};const _0x5dd40f=getAccountName(_0x153eae),_0x1cca88=await _0x370e5b[_0x52afb7(0x1ce)](SERVICE_NAME,_0x5dd40f);if(_0x1cca88)return{'success':!![],'value':_0x1cca88};return{'success':![],'reason':_0x52afb7(0x1cd)};}catch(_0x364d2c){const _0x3da78d=_0x364d2c instanceof Error?_0x364d2c[_0x52afb7(0x1d4)]:String(_0x364d2c);if(_0x3da78d['includes']('-25300')||_0x3da78d[_0x52afb7(0x1df)]()['includes'](_0x52afb7(0x1c5))||_0x3da78d[_0x52afb7(0x1df)]()['includes'](_0x52afb7(0x1c1)))return{'success':![],'reason':'not_found'};if(_0x3da78d[_0x52afb7(0x1d0)](_0x52afb7(0x1d8))||_0x3da78d['toLowerCase']()[_0x52afb7(0x1d0)](_0x52afb7(0x1d2))||_0x3da78d[_0x52afb7(0x1df)]()[_0x52afb7(0x1d0)](_0x52afb7(0x1c0)))return{'success':![],'reason':_0x52afb7(0x1dd),'message':_0x52afb7(0x1cf)};return{'success':![],'reason':'unavailable','message':_0x3da78d};}}export async function saveKeychainAPIKey(_0x3fad6e,_0x2eb711){const _0x311d07=a50_0x5f2235,_0x305a66=await getKeyring();if(!_0x305a66)throw new Error(_0x311d07(0x1c2));const _0x5c11ee=getAccountName(_0x2eb711);await _0x305a66[_0x311d07(0x1d6)](SERVICE_NAME,_0x5c11ee,_0x3fad6e);}export async function deleteKeychainAPIKey(_0x18d8ec){const _0xeca3d2=a50_0x5f2235;try{const _0x4eba69=await getKeyring();if(!_0x4eba69)return![];const _0x403c8b=getAccountName(_0x18d8ec);return await _0x4eba69[_0xeca3d2(0x1ca)](SERVICE_NAME,_0x403c8b);}catch{return![];}}export async function isKeychainAvailable(){const _0x53b570=a50_0x5f2235;try{const _0x31897e=await getKeyring();if(!_0x31897e)return![];return await _0x31897e[_0x53b570(0x1ce)](SERVICE_NAME,_0x53b570(0x1d1)),!![];}catch(_0x4b5534){const _0x1c3a98=_0x4b5534 instanceof Error?_0x4b5534[_0x53b570(0x1d4)][_0x53b570(0x1df)]():'';if(_0x1c3a98[_0x53b570(0x1d0)]('not\x20available')||_0x1c3a98[_0x53b570(0x1d0)]('not\x20supported')||_0x1c3a98[_0x53b570(0x1d0)](_0x53b570(0x1c3)))return![];return!![];}}
1
+ const a50_0x19e73d=a50_0x392f;(function(_0x30d1ce,_0x2d50a9){const _0x4c2605=a50_0x392f,_0x3bcbb6=_0x30d1ce();while(!![]){try{const _0x405601=parseInt(_0x4c2605(0x103))/0x1+parseInt(_0x4c2605(0xe3))/0x2*(parseInt(_0x4c2605(0x104))/0x3)+parseInt(_0x4c2605(0xe7))/0x4*(-parseInt(_0x4c2605(0xfc))/0x5)+-parseInt(_0x4c2605(0xeb))/0x6*(parseInt(_0x4c2605(0xfe))/0x7)+parseInt(_0x4c2605(0xed))/0x8*(parseInt(_0x4c2605(0xef))/0x9)+parseInt(_0x4c2605(0xe4))/0xa+-parseInt(_0x4c2605(0x105))/0xb;if(_0x405601===_0x2d50a9)break;else _0x3bcbb6['push'](_0x3bcbb6['shift']());}catch(_0x2d992f){_0x3bcbb6['push'](_0x3bcbb6['shift']());}}}(a50_0x37b3,0xb461d));const SERVICE_NAME=a50_0x19e73d(0xf3);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x516be0=a50_0x19e73d;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x4b287f=await import(_0x516be0(0xe5));return keyringModule=_0x4b287f[_0x516be0(0xfd)],keyringModule;}catch(_0x3d1da5){return keyringLoadError=_0x3d1da5 instanceof Error?_0x3d1da5:new Error(String(_0x3d1da5)),null;}}function getAccountName(_0x53abc5){const _0x1b19b5=a50_0x19e73d,_0xe48813=_0x53abc5||'';return _0x1b19b5(0xf5)+_0xe48813+_0x1b19b5(0x100);}export async function getKeychainAPIKey(_0x4b2039){const _0x2a29e0=a50_0x19e73d,_0x56ed64=await getKeychainAPIKeyWithStatus(_0x4b2039);if(_0x56ed64[_0x2a29e0(0xe8)])return _0x56ed64['value'];return _0x56ed64[_0x2a29e0(0xe1)]===_0x2a29e0(0xf7)&&console['error'](_0x2a29e0(0x102)+_0x56ed64[_0x2a29e0(0xf0)]),null;}function a50_0x392f(_0x360b6c,_0x32ff35){_0x360b6c=_0x360b6c-0xe1;const _0x37b386=a50_0x37b3();let _0x392fbf=_0x37b386[_0x360b6c];return _0x392fbf;}function a50_0x37b3(){const _0x553e0c=['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.','30piAVdu','toLowerCase','111496vkSRMo','not\x20found','423iScJPB','message','-25293','restricted','tdx','not_found','profile:','getPassword','access_denied','could\x20not\x20be\x20found','setPassword','__keychain_test__','unavailable','5051485qbsSpQ','keyring','1814491JjzaIR','deletePassword',':api_key','-25300','Warning:\x20','942745gIGSOs','3dmNjzQ','4836117RQPgor','System\x20keychain\x20is\x20not\x20available','reason','includes','2382914rNDPJp','6956130tijFDm','@zowe/secrets-for-zowe-sdk','not\x20supported','4jMJfFL','success','access'];a50_0x37b3=function(){return _0x553e0c;};return a50_0x37b3();}export async function getKeychainAPIKeyWithStatus(_0x5f5b55){const _0x1d8952=a50_0x19e73d;try{const _0x568405=await getKeyring();if(!_0x568405)return{'success':![],'reason':_0x1d8952(0xfb)};const _0x54629e=getAccountName(_0x5f5b55),_0x598b0d=await _0x568405['getPassword'](SERVICE_NAME,_0x54629e);if(_0x598b0d)return{'success':!![],'value':_0x598b0d};return{'success':![],'reason':_0x1d8952(0xf4)};}catch(_0x12a97f){const _0x42f61f=_0x12a97f instanceof Error?_0x12a97f[_0x1d8952(0xf0)]:String(_0x12a97f);if(_0x42f61f['includes'](_0x1d8952(0x101))||_0x42f61f['toLowerCase']()['includes'](_0x1d8952(0xf8))||_0x42f61f[_0x1d8952(0xec)]()['includes'](_0x1d8952(0xee)))return{'success':![],'reason':_0x1d8952(0xf4)};if(_0x42f61f[_0x1d8952(0xe2)](_0x1d8952(0xf1))||_0x42f61f[_0x1d8952(0xec)]()['includes'](_0x1d8952(0xf2))||_0x42f61f[_0x1d8952(0xec)]()[_0x1d8952(0xe2)](_0x1d8952(0xe9)))return{'success':![],'reason':_0x1d8952(0xf7),'message':_0x1d8952(0xea)};return{'success':![],'reason':_0x1d8952(0xfb),'message':_0x42f61f};}}export async function saveKeychainAPIKey(_0xbb07f8,_0x18b979){const _0x4d73a1=a50_0x19e73d,_0x2b365e=await getKeyring();if(!_0x2b365e)throw new Error(_0x4d73a1(0x106));const _0x1d9f36=getAccountName(_0x18b979);await _0x2b365e[_0x4d73a1(0xf9)](SERVICE_NAME,_0x1d9f36,_0xbb07f8);}export async function deleteKeychainAPIKey(_0x9248bf){const _0x502a17=a50_0x19e73d;try{const _0x385314=await getKeyring();if(!_0x385314)return![];const _0x3f7dd7=getAccountName(_0x9248bf);return await _0x385314[_0x502a17(0xff)](SERVICE_NAME,_0x3f7dd7);}catch{return![];}}export async function isKeychainAvailable(){const _0x4d69fb=a50_0x19e73d;try{const _0x230e35=await getKeyring();if(!_0x230e35)return![];return await _0x230e35[_0x4d69fb(0xf6)](SERVICE_NAME,_0x4d69fb(0xfa)),!![];}catch(_0x2b5dc8){const _0x2c3f22=_0x2b5dc8 instanceof Error?_0x2b5dc8[_0x4d69fb(0xf0)][_0x4d69fb(0xec)]():'';if(_0x2c3f22[_0x4d69fb(0xe2)]('not\x20available')||_0x2c3f22[_0x4d69fb(0xe2)](_0x4d69fb(0xe6))||_0x2c3f22['includes']('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0xc23ce6,_0x5297ad){const _0x1bd069=a51_0x445c,_0xee21a8=_0xc23ce6();while(!![]){try{const _0x51a7dd=parseInt(_0x1bd069(0x195))/0x1+-parseInt(_0x1bd069(0x193))/0x2+parseInt(_0x1bd069(0x190))/0x3*(-parseInt(_0x1bd069(0x1bb))/0x4)+parseInt(_0x1bd069(0x1b8))/0x5*(parseInt(_0x1bd069(0x18a))/0x6)+parseInt(_0x1bd069(0x1b4))/0x7+-parseInt(_0x1bd069(0x1ba))/0x8*(parseInt(_0x1bd069(0x1a7))/0x9)+parseInt(_0x1bd069(0x1a9))/0xa;if(_0x51a7dd===_0x5297ad)break;else _0xee21a8['push'](_0xee21a8['shift']());}catch(_0xd3a1d0){_0xee21a8['push'](_0xee21a8['shift']());}}}(a51_0x4fda,0xc0420));import*as a51_0x4fb112 from'node:fs';import*as a51_0x5128da from'node:path';function a51_0x445c(_0x292cf1,_0x531917){_0x292cf1=_0x292cf1-0x172;const _0x4fda1f=a51_0x4fda();let _0x445cc4=_0x4fda1f[_0x292cf1];return _0x445cc4;}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(_0x49b81b){const _0x52db84=a51_0x445c,_0x1d43fa={};if(!_0x49b81b)return _0x1d43fa;for(const [_0x4a7105,_0x3daf77]of Object['entries'](_0x49b81b)){_0x4a7105!==_0x52db84(0x17e)&&_0x3daf77!==undefined&&(_0x1d43fa[_0x4a7105]=_0x3daf77);}return _0x1d43fa;}export function getProfilesDir(){const _0xd48be3=a51_0x445c;return a51_0x5128da['join'](getConfigDir(),_0xd48be3(0x185));}function getProfileDir(_0x20a7fa){const _0x47cb16=a51_0x445c;return a51_0x5128da[_0x47cb16(0x196)](getProfilesDir(),_0x20a7fa);}function getProfileConfigPath(_0xe41862){const _0xeda995=a51_0x445c;return a51_0x5128da[_0xeda995(0x196)](getProfileDir(_0xe41862),_0xeda995(0x19a));}function getProfileEnvPath(_0x5bf08e){const _0x45742c=a51_0x445c;return a51_0x5128da[_0x45742c(0x196)](getProfileDir(_0x5bf08e),_0x45742c(0x184));}function getGlobalConfigPath(){return a51_0x5128da['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x35efc1){const _0x504cb4=a51_0x445c;if(!/^[a-zA-Z0-9_-]+$/[_0x504cb4(0x1ad)](_0x35efc1))throw new Error(_0x504cb4(0x182)+_0x35efc1+_0x504cb4(0x189));}function validateProfileConfig(_0x24b515,_0x4d8075){const _0x4add87=a51_0x445c;if(typeof _0x24b515!==_0x4add87(0x1a2)||_0x24b515===null)throw new Error(_0x4add87(0x1bd)+_0x4d8075+_0x4add87(0x1a4));const _0x4e566a=[_0x4add87(0x17e),_0x4add87(0x175),_0x4add87(0x18e),_0x4add87(0x17c),_0x4add87(0x18f),_0x4add87(0x178)],_0x455ea1=_0x24b515;for(const _0x5aed77 of Object[_0x4add87(0x173)](_0x455ea1)){!_0x4e566a['includes'](_0x5aed77)&&console[_0x4add87(0x181)](_0x4add87(0x1b5)+_0x4d8075+_0x4add87(0x1a8)+_0x5aed77+_0x4add87(0x186));}if(_0x455ea1['description']!==undefined&&typeof _0x455ea1['description']!==_0x4add87(0x180))throw new Error(_0x4add87(0x1bd)+_0x4d8075+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x455ea1[_0x4add87(0x175)]!==undefined&&typeof _0x455ea1[_0x4add87(0x175)]!==_0x4add87(0x180))throw new Error(_0x4add87(0x1bd)+_0x4d8075+_0x4add87(0x1a3));if(_0x455ea1['database']!==undefined&&typeof _0x455ea1[_0x4add87(0x18e)]!==_0x4add87(0x180))throw new Error('Profile\x20\x27'+_0x4d8075+_0x4add87(0x19e));if(_0x455ea1[_0x4add87(0x17c)]!==undefined&&typeof _0x455ea1[_0x4add87(0x17c)]!=='string')throw new Error('Profile\x20\x27'+_0x4d8075+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x455ea1[_0x4add87(0x18f)]!==undefined&&typeof _0x455ea1[_0x4add87(0x18f)]!==_0x4add87(0x180))throw new Error(_0x4add87(0x1bd)+_0x4d8075+_0x4add87(0x198));if(_0x455ea1[_0x4add87(0x178)]!==undefined&&typeof _0x455ea1[_0x4add87(0x178)]!==_0x4add87(0x180))throw new Error(_0x4add87(0x1bd)+_0x4d8075+_0x4add87(0x17f));return!![];}function loadProfilesFromTdxJson(_0x4200cc,_0x30b48e){const _0x592733=a51_0x445c;if(!a51_0x4fb112[_0x592733(0x1b6)](_0x4200cc))return[];try{const _0x5b5651=a51_0x4fb112[_0x592733(0x192)](_0x4200cc,_0x592733(0x176)),_0x2981a9=JSON['parse'](_0x5b5651);if(!_0x2981a9[_0x592733(0x185)]||typeof _0x2981a9['profiles']!==_0x592733(0x1a2))return[];const _0x1c4b09=[];for(const [_0x3b9c82,_0x41ecd2]of Object[_0x592733(0x183)](_0x2981a9[_0x592733(0x185)])){try{validateProfileConfig(_0x41ecd2,_0x3b9c82);const _0x5b1d06=getNewCredentialPath(_0x3b9c82),_0x32c9da=getOldCredentialPath(_0x3b9c82),_0x520746=a51_0x4fb112[_0x592733(0x1b6)](_0x5b1d06)||a51_0x4fb112['existsSync'](_0x32c9da);_0x1c4b09['push']({'name':_0x3b9c82,'config':_0x41ecd2,'metadata':{'name':_0x3b9c82,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x520746,'scope':_0x30b48e});}catch(_0x242ee2){_0x242ee2 instanceof Error&&(console[_0x592733(0x181)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x4200cc+':'),console[_0x592733(0x181)]('\x20\x20'+_0x242ee2[_0x592733(0x1ab)]+'\x0a'));}}return _0x1c4b09;}catch(_0x442c2d){return _0x442c2d instanceof SyntaxError?(console['warn'](_0x592733(0x18d)+_0x4200cc+_0x592733(0x1b9)),console[_0x592733(0x181)](_0x592733(0x1b7)+_0x442c2d[_0x592733(0x1ab)]+'\x0a')):console[_0x592733(0x181)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x4200cc+':\x20'+_0x442c2d+'\x0a'),[];}}export function getNewCredentialPath(_0x1a9edb){const _0x3a2c76=a51_0x445c;return a51_0x5128da[_0x3a2c76(0x196)](getConfigDir(),_0x3a2c76(0x19c)+_0x1a9edb);}function getOldCredentialPath(_0xd0ea8){const _0x10b8b9=a51_0x445c;return a51_0x5128da[_0x10b8b9(0x196)](getProfilesDir(),_0xd0ea8,_0x10b8b9(0x184));}function loadProfilesFromTdxJsonFiles(){const _0x43bf15=a51_0x445c,_0x3d0da1=[],_0x333f09=findProjectConfigPath();_0x333f09&&_0x3d0da1[_0x43bf15(0x19f)](...loadProfilesFromTdxJson(_0x333f09,_0x43bf15(0x1bc)));const _0x32698d=a51_0x5128da[_0x43bf15(0x196)](getConfigDir(),_0x43bf15(0x19a));return _0x3d0da1['push'](...loadProfilesFromTdxJson(_0x32698d,_0x43bf15(0x187))),_0x3d0da1;}function loadProfilesFromDirectories(){const _0x179b44=a51_0x445c,_0x3cd171=getProfilesDir();if(!a51_0x4fb112[_0x179b44(0x1b6)](_0x3cd171))return[];try{return a51_0x4fb112['readdirSync'](_0x3cd171,{'withFileTypes':!![]})[_0x179b44(0x1af)](_0x1eb6d6=>_0x1eb6d6['isDirectory']())[_0x179b44(0x1ac)](_0x3c0d80=>_0x3c0d80['name'])[_0x179b44(0x1af)](_0x368968=>{const _0x2cd7e7=_0x179b44,_0x553a4e=getProfileConfigPath(_0x368968),_0x48b66a=getProfileEnvPath(_0x368968);return a51_0x4fb112[_0x2cd7e7(0x1b6)](_0x553a4e)||a51_0x4fb112[_0x2cd7e7(0x1b6)](_0x48b66a);})[_0x179b44(0x1ac)](_0xd9db9e=>{const _0x940f92=_0x179b44,_0x5b60da=loadProfileFromDirectory(_0xd9db9e);if(_0x5b60da)return{..._0x5b60da,'scope':_0x940f92(0x1aa)};return null;})[_0x179b44(0x1af)](_0x384812=>_0x384812!==null);}catch{return[];}}function loadProfileFromDirectory(_0x48e031){const _0x4d1874=a51_0x445c,_0x6abc03=getProfileConfigPath(_0x48e031),_0x15cee4=getOldCredentialPath(_0x48e031);if(!a51_0x4fb112[_0x4d1874(0x1b6)](_0x6abc03)&&!a51_0x4fb112[_0x4d1874(0x1b6)](_0x15cee4))return null;let _0x27655c={},_0x19eb1e={'name':_0x48e031,'createdAt':new Date()[_0x4d1874(0x19b)]()};if(a51_0x4fb112[_0x4d1874(0x1b6)](_0x6abc03))try{const _0x256099=a51_0x4fb112[_0x4d1874(0x192)](_0x6abc03,_0x4d1874(0x176)),_0x313934=JSON[_0x4d1874(0x194)](_0x256099),{metadata:_0x21fcdf,..._0x210845}=_0x313934;_0x27655c=_0x210845,_0x21fcdf&&(_0x19eb1e=_0x21fcdf);}catch{}return{'name':_0x48e031,'config':_0x27655c,'metadata':_0x19eb1e,'hasCredentials':a51_0x4fb112[_0x4d1874(0x1b6)](_0x15cee4),'scope':_0x4d1874(0x1aa)};}export function listProfiles(){const _0x20406e=a51_0x445c,_0x546045=loadProfilesFromTdxJsonFiles(),_0x136b9a=loadProfilesFromDirectories();if(_0x136b9a['length']>0x0){const _0x1f2f1c=_0x136b9a['map'](_0x2e57de=>_0x2e57de[_0x20406e(0x191)])[_0x20406e(0x196)](',\x20'),_0x35951b=getConfigDir();console[_0x20406e(0x181)](_0x20406e(0x1a6)+_0x1f2f1c),console['warn'](_0x20406e(0x1b2)),console[_0x20406e(0x181)]('\x20\x201.\x20Edit:\x20'+a51_0x5128da[_0x20406e(0x196)](_0x35951b,_0x20406e(0x19a))),console[_0x20406e(0x181)](_0x20406e(0x17b)),console[_0x20406e(0x181)](_0x20406e(0x1a5));}const _0x2b0bb2=[..._0x546045,..._0x136b9a],_0x46df7c=new Map();for(const _0x16c22b of _0x2b0bb2){!_0x46df7c[_0x20406e(0x18c)](_0x16c22b[_0x20406e(0x191)])&&_0x46df7c[_0x20406e(0x188)](_0x16c22b[_0x20406e(0x191)],_0x16c22b);}return Array['from'](_0x46df7c[_0x20406e(0x174)]())[_0x20406e(0x1a0)]((_0x355d89,_0x441311)=>_0x355d89[_0x20406e(0x191)][_0x20406e(0x177)](_0x441311[_0x20406e(0x191)]));}export function profileExists(_0x25cd40){const _0x1d061a=a51_0x445c,_0xfe1d6a=listProfiles();return _0xfe1d6a[_0x1d061a(0x17a)](_0x2cce1f=>_0x2cce1f['name']===_0x25cd40);}export function loadProfile(_0x5c5712){const _0x1f4384=a51_0x445c;validateProfileName(_0x5c5712);const _0x13670c=listProfiles(),_0x52b1d5=_0x13670c[_0x1f4384(0x179)](_0x429bb5=>_0x429bb5['name']===_0x5c5712);return _0x52b1d5||null;}export function saveProfile(_0x1ff5bb,_0x524dbe,_0x4074b9=![]){saveProfileToUserConfig(_0x1ff5bb,_0x524dbe);}export function deleteProfile(_0x5ec211){const _0x33f151=a51_0x445c;validateProfileName(_0x5ec211);const _0x48a0d9=getProfileDir(_0x5ec211);if(!a51_0x4fb112[_0x33f151(0x1b6)](_0x48a0d9))throw new Error(_0x33f151(0x1b1)+_0x5ec211+_0x33f151(0x1a1));a51_0x4fb112[_0x33f151(0x199)](_0x48a0d9,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x49ac99,_0x12111d){const _0x57f8b5=a51_0x445c;validateProfileName(_0x49ac99);const _0x4f1681=getGlobalConfigPath(),_0x310b36=getConfigDir();!a51_0x4fb112[_0x57f8b5(0x1b6)](_0x310b36)&&createSecureDirectory(_0x310b36);let _0x1fa54f={};if(a51_0x4fb112[_0x57f8b5(0x1b6)](_0x4f1681))try{const _0x52eb03=a51_0x4fb112['readFileSync'](_0x4f1681,'utf-8');_0x1fa54f=JSON[_0x57f8b5(0x194)](_0x52eb03);}catch{console[_0x57f8b5(0x181)](_0x57f8b5(0x1b0)+_0x4f1681+_0x57f8b5(0x19d));}!_0x1fa54f['profiles']&&(_0x1fa54f['profiles']={}),_0x1fa54f['profiles'][_0x49ac99]=_0x12111d,writeSecureFile(_0x4f1681,JSON[_0x57f8b5(0x17d)](_0x1fa54f,null,0x2));}export function getActiveProfile(){const _0x22db29=a51_0x445c,_0x26fc26=loadSessionContext();if(_0x26fc26?.['profile'])return _0x26fc26['profile'];const _0x141375=getGlobalConfigPath();if(!a51_0x4fb112[_0x22db29(0x1b6)](_0x141375))return null;try{const _0x122d4e=a51_0x4fb112[_0x22db29(0x192)](_0x141375,'utf-8'),_0x1585f4=JSON[_0x22db29(0x194)](_0x122d4e);return _0x1585f4[_0x22db29(0x172)]||null;}catch{return null;}}export function createProfile(_0x298d9e,_0x1fd032){const _0x47c7e4=a51_0x445c;validateProfileName(_0x298d9e);if(profileExists(_0x298d9e))throw new Error('Profile\x20'+_0x298d9e+_0x47c7e4(0x197));saveProfile(_0x298d9e,_0x1fd032);}export function saveProfileCredentials(_0x2f616c,_0x397adf){const _0x3286d8=a51_0x445c;validateProfileName(_0x2f616c);if(!profileExists(_0x2f616c))throw new Error(_0x3286d8(0x1b1)+_0x2f616c+_0x3286d8(0x1a1));const _0x1fd233=getNewCredentialPath(_0x2f616c);writeSecureFile(_0x1fd233,_0x397adf);}export function loadProfileCredentials(_0x20b90b){const _0x2d43f4=a51_0x445c;validateProfileName(_0x20b90b);const _0x47b3f0=getNewCredentialPath(_0x20b90b);if(a51_0x4fb112[_0x2d43f4(0x1b6)](_0x47b3f0))try{return a51_0x4fb112[_0x2d43f4(0x192)](_0x47b3f0,_0x2d43f4(0x176));}catch{}const _0xed19d7=getOldCredentialPath(_0x20b90b);if(a51_0x4fb112[_0x2d43f4(0x1b6)](_0xed19d7)){console[_0x2d43f4(0x181)](_0x2d43f4(0x1b3)+_0x20b90b+'\x27'),console[_0x2d43f4(0x181)]('To\x20migrate:'),console[_0x2d43f4(0x181)](_0x2d43f4(0x1ae)+_0xed19d7+'\x22\x20\x22'+_0x47b3f0+'\x22'),console[_0x2d43f4(0x181)](_0x2d43f4(0x18b));try{return a51_0x4fb112['readFileSync'](_0xed19d7,_0x2d43f4(0x176));}catch{return null;}}return null;}function a51_0x4fda(){const _0x12f7ba=['\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','9kyHdWx','\x27:\x20unknown\x20config\x20key\x20\x27','25213040hTTeGL','directory','message','map','test','\x20\x20mv\x20\x22','filter','Warning:\x20Failed\x20to\x20parse\x20','Profile\x20','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','5563250KLJynw','Warning:\x20Profile\x20\x27','existsSync','Error:\x20','1975885jecVMC',':\x20Invalid\x20JSON\x20syntax','9832472NDqlsX','4PnYnvk','local','Profile\x20\x27','profile','keys','values','site','utf-8','localeCompare','llm_agent','find','some','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','parent_segment','stringify','description','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','string','warn','Invalid\x20profile\x20name:\x20','entries','.env','profiles','\x27\x20will\x20be\x20ignored','user','set','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','6adXUGe','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','has','\x0aWarning:\x20Failed\x20to\x20parse\x20','database','llm_project','3716079qgebbn','name','readFileSync','2706432tNbmaZ','parse','897225NNNBAz','join','\x20already\x20exists','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','rmSync','tdx.json','toISOString','.env.',',\x20creating\x20new\x20file','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','push','sort','\x20does\x20not\x20exist','object','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x27:\x20config\x20must\x20be\x20an\x20object','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a'];a51_0x4fda=function(){return _0x12f7ba;};return a51_0x4fda();}
1
+ (function(_0x4cd448,_0x5ee62b){const _0xa20f5f=a51_0x2175,_0x248110=_0x4cd448();while(!![]){try{const _0x205615=-parseInt(_0xa20f5f(0x1fe))/0x1*(-parseInt(_0xa20f5f(0x209))/0x2)+-parseInt(_0xa20f5f(0x203))/0x3+parseInt(_0xa20f5f(0x1e7))/0x4*(parseInt(_0xa20f5f(0x212))/0x5)+parseInt(_0xa20f5f(0x1ec))/0x6*(parseInt(_0xa20f5f(0x1e5))/0x7)+-parseInt(_0xa20f5f(0x1fa))/0x8+-parseInt(_0xa20f5f(0x1df))/0x9*(-parseInt(_0xa20f5f(0x21e))/0xa)+parseInt(_0xa20f5f(0x20b))/0xb*(parseInt(_0xa20f5f(0x20a))/0xc);if(_0x205615===_0x5ee62b)break;else _0x248110['push'](_0x248110['shift']());}catch(_0x53c6ec){_0x248110['push'](_0x248110['shift']());}}}(a51_0x1d6f,0xacc47));import*as a51_0x266790 from'node:fs';import*as a51_0x41b3a1 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(_0x189071){const _0x21962b=a51_0x2175,_0x475361={};if(!_0x189071)return _0x475361;for(const [_0x36cb2e,_0x540cee]of Object[_0x21962b(0x1f4)](_0x189071)){_0x36cb2e!=='description'&&_0x540cee!==undefined&&(_0x475361[_0x36cb2e]=_0x540cee);}return _0x475361;}export function getProfilesDir(){const _0x197882=a51_0x2175;return a51_0x41b3a1[_0x197882(0x201)](getConfigDir(),_0x197882(0x1f6));}function getProfileDir(_0x4a74b3){const _0x282182=a51_0x2175;return a51_0x41b3a1[_0x282182(0x201)](getProfilesDir(),_0x4a74b3);}function getProfileConfigPath(_0x38f9f5){const _0x5537d9=a51_0x2175;return a51_0x41b3a1[_0x5537d9(0x201)](getProfileDir(_0x38f9f5),_0x5537d9(0x1f5));}function getProfileEnvPath(_0x5a189e){const _0x241950=a51_0x2175;return a51_0x41b3a1[_0x241950(0x201)](getProfileDir(_0x5a189e),_0x241950(0x1f1));}function getGlobalConfigPath(){return a51_0x41b3a1['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x3969ca){const _0x393fbd=a51_0x2175;if(!/^[a-zA-Z0-9_-]+$/[_0x393fbd(0x1e9)](_0x3969ca))throw new Error(_0x393fbd(0x213)+_0x3969ca+_0x393fbd(0x207));}function validateProfileConfig(_0x1da3f,_0x3ef6a7){const _0xacfa44=a51_0x2175;if(typeof _0x1da3f!=='object'||_0x1da3f===null)throw new Error('Profile\x20\x27'+_0x3ef6a7+_0xacfa44(0x20f));const _0x334ff6=['description',_0xacfa44(0x1f2),'database','parent_segment','llm_project',_0xacfa44(0x20e)],_0x198596=_0x1da3f;for(const _0x3727b7 of Object[_0xacfa44(0x217)](_0x198596)){!_0x334ff6[_0xacfa44(0x21a)](_0x3727b7)&&console[_0xacfa44(0x21c)](_0xacfa44(0x200)+_0x3ef6a7+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x3727b7+_0xacfa44(0x1e3));}if(_0x198596[_0xacfa44(0x210)]!==undefined&&typeof _0x198596['description']!==_0xacfa44(0x220))throw new Error('Profile\x20\x27'+_0x3ef6a7+_0xacfa44(0x205));if(_0x198596['site']!==undefined&&typeof _0x198596[_0xacfa44(0x1f2)]!==_0xacfa44(0x220))throw new Error('Profile\x20\x27'+_0x3ef6a7+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x198596[_0xacfa44(0x202)]!==undefined&&typeof _0x198596[_0xacfa44(0x202)]!=='string')throw new Error(_0xacfa44(0x218)+_0x3ef6a7+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x198596[_0xacfa44(0x215)]!==undefined&&typeof _0x198596[_0xacfa44(0x215)]!==_0xacfa44(0x220))throw new Error('Profile\x20\x27'+_0x3ef6a7+_0xacfa44(0x222));if(_0x198596['llm_project']!==undefined&&typeof _0x198596[_0xacfa44(0x221)]!=='string')throw new Error(_0xacfa44(0x218)+_0x3ef6a7+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x198596['llm_agent']!==undefined&&typeof _0x198596[_0xacfa44(0x20e)]!==_0xacfa44(0x220))throw new Error(_0xacfa44(0x218)+_0x3ef6a7+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x32ad23,_0x27c68c){const _0x1dba89=a51_0x2175;if(!a51_0x266790[_0x1dba89(0x1f3)](_0x32ad23))return[];try{const _0x705f0a=a51_0x266790['readFileSync'](_0x32ad23,'utf-8'),_0x4b9a90=JSON[_0x1dba89(0x1ff)](_0x705f0a);if(!_0x4b9a90['profiles']||typeof _0x4b9a90['profiles']!=='object')return[];const _0x2d47ea=[];for(const [_0x484d39,_0x292c3d]of Object['entries'](_0x4b9a90['profiles'])){try{validateProfileConfig(_0x292c3d,_0x484d39);const _0x41a0af=getNewCredentialPath(_0x484d39),_0x5436eb=getOldCredentialPath(_0x484d39),_0x1ee94d=a51_0x266790[_0x1dba89(0x1f3)](_0x41a0af)||a51_0x266790[_0x1dba89(0x1f3)](_0x5436eb);_0x2d47ea[_0x1dba89(0x1f7)]({'name':_0x484d39,'config':_0x292c3d,'metadata':{'name':_0x484d39,'createdAt':new Date()[_0x1dba89(0x1de)]()},'hasCredentials':_0x1ee94d,'scope':_0x27c68c});}catch(_0x285652){_0x285652 instanceof Error&&(console[_0x1dba89(0x21c)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x32ad23+':'),console[_0x1dba89(0x21c)]('\x20\x20'+_0x285652['message']+'\x0a'));}}return _0x2d47ea;}catch(_0x342ed3){return _0x342ed3 instanceof SyntaxError?(console[_0x1dba89(0x21c)](_0x1dba89(0x1fb)+_0x32ad23+_0x1dba89(0x1e2)),console[_0x1dba89(0x21c)](_0x1dba89(0x204)+_0x342ed3[_0x1dba89(0x1da)]+'\x0a')):console[_0x1dba89(0x21c)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x32ad23+':\x20'+_0x342ed3+'\x0a'),[];}}export function getNewCredentialPath(_0x217813){const _0xc5b24=a51_0x2175;return a51_0x41b3a1[_0xc5b24(0x201)](getConfigDir(),_0xc5b24(0x1ed)+_0x217813);}function getOldCredentialPath(_0x4f8b80){const _0x17186d=a51_0x2175;return a51_0x41b3a1[_0x17186d(0x201)](getProfilesDir(),_0x4f8b80,_0x17186d(0x1f1));}function loadProfilesFromTdxJsonFiles(){const _0xc35583=a51_0x2175,_0x1499f5=[],_0x4b73ed=findProjectConfigPath();_0x4b73ed&&_0x1499f5[_0xc35583(0x1f7)](...loadProfilesFromTdxJson(_0x4b73ed,_0xc35583(0x1dc)));const _0x136b4d=a51_0x41b3a1['join'](getConfigDir(),_0xc35583(0x1f5));return _0x1499f5[_0xc35583(0x1f7)](...loadProfilesFromTdxJson(_0x136b4d,_0xc35583(0x1f0))),_0x1499f5;}function a51_0x2175(_0x5149b7,_0x38876a){_0x5149b7=_0x5149b7-0x1d7;const _0x1d6f18=a51_0x1d6f();let _0x21756d=_0x1d6f18[_0x5149b7];return _0x21756d;}function loadProfilesFromDirectories(){const _0x29689b=a51_0x2175,_0x5c5c87=getProfilesDir();if(!a51_0x266790[_0x29689b(0x1f3)](_0x5c5c87))return[];try{return a51_0x266790['readdirSync'](_0x5c5c87,{'withFileTypes':!![]})['filter'](_0x4a007d=>_0x4a007d[_0x29689b(0x20c)]())['map'](_0x3092cb=>_0x3092cb[_0x29689b(0x21b)])[_0x29689b(0x1fc)](_0x228e82=>{const _0x460fec=_0x29689b,_0x370eab=getProfileConfigPath(_0x228e82),_0x468f5c=getProfileEnvPath(_0x228e82);return a51_0x266790[_0x460fec(0x1f3)](_0x370eab)||a51_0x266790['existsSync'](_0x468f5c);})['map'](_0x134fed=>{const _0x5a6b28=_0x29689b,_0x4bc6a6=loadProfileFromDirectory(_0x134fed);if(_0x4bc6a6)return{..._0x4bc6a6,'scope':_0x5a6b28(0x1f9)};return null;})[_0x29689b(0x1fc)](_0x253631=>_0x253631!==null);}catch{return[];}}function loadProfileFromDirectory(_0x727f02){const _0x40d973=a51_0x2175,_0x43d931=getProfileConfigPath(_0x727f02),_0xc1bfcc=getOldCredentialPath(_0x727f02);if(!a51_0x266790[_0x40d973(0x1f3)](_0x43d931)&&!a51_0x266790[_0x40d973(0x1f3)](_0xc1bfcc))return null;let _0x4da8af={},_0x4a95a8={'name':_0x727f02,'createdAt':new Date()['toISOString']()};if(a51_0x266790['existsSync'](_0x43d931))try{const _0xcc19e6=a51_0x266790['readFileSync'](_0x43d931,'utf-8'),_0x4a56fc=JSON['parse'](_0xcc19e6),{metadata:_0x3cec0c,..._0x2ef86b}=_0x4a56fc;_0x4da8af=_0x2ef86b,_0x3cec0c&&(_0x4a95a8=_0x3cec0c);}catch{}return{'name':_0x727f02,'config':_0x4da8af,'metadata':_0x4a95a8,'hasCredentials':a51_0x266790[_0x40d973(0x1f3)](_0xc1bfcc),'scope':_0x40d973(0x1f9)};}export function listProfiles(){const _0x54112d=a51_0x2175,_0x2ba7fb=loadProfilesFromTdxJsonFiles(),_0x1f0cf6=loadProfilesFromDirectories();if(_0x1f0cf6['length']>0x0){const _0x18a0f1=_0x1f0cf6[_0x54112d(0x223)](_0x43588f=>_0x43588f[_0x54112d(0x21b)])['join'](',\x20'),_0x3e3b30=getConfigDir();console[_0x54112d(0x21c)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x18a0f1),console[_0x54112d(0x21c)](_0x54112d(0x216)),console[_0x54112d(0x21c)](_0x54112d(0x1dd)+a51_0x41b3a1[_0x54112d(0x201)](_0x3e3b30,'tdx.json')),console[_0x54112d(0x21c)](_0x54112d(0x211)),console[_0x54112d(0x21c)](_0x54112d(0x1e8));}const _0x2db01e=[..._0x2ba7fb,..._0x1f0cf6],_0x2fc966=new Map();for(const _0x572ae4 of _0x2db01e){!_0x2fc966[_0x54112d(0x1ea)](_0x572ae4[_0x54112d(0x21b)])&&_0x2fc966[_0x54112d(0x20d)](_0x572ae4[_0x54112d(0x21b)],_0x572ae4);}return Array[_0x54112d(0x1ee)](_0x2fc966[_0x54112d(0x1db)]())[_0x54112d(0x1e1)]((_0x5cd9c0,_0x4a465c)=>_0x5cd9c0[_0x54112d(0x21b)]['localeCompare'](_0x4a465c[_0x54112d(0x21b)]));}export function profileExists(_0x555ab5){const _0x3942f7=a51_0x2175,_0x38e6a9=listProfiles();return _0x38e6a9[_0x3942f7(0x208)](_0x3c45e0=>_0x3c45e0[_0x3942f7(0x21b)]===_0x555ab5);}export function loadProfile(_0x433575){const _0x16b5fa=a51_0x2175;validateProfileName(_0x433575);const _0x3cb66b=listProfiles(),_0x4ad840=_0x3cb66b[_0x16b5fa(0x1e0)](_0xc42240=>_0xc42240['name']===_0x433575);return _0x4ad840||null;}function a51_0x1d6f(){const _0x5ec452=['\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','590RoGMuK','Profile\x20','string','llm_project','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','map','readFileSync','\x20already\x20exists','profile','message','values','local','\x20\x201.\x20Edit:\x20','toISOString','2286cHBAqY','find','sort',':\x20Invalid\x20JSON\x20syntax','\x27\x20will\x20be\x20ignored','To\x20migrate:','2470363JdrCWq','\x20\x20mv\x20\x22','86140aDtDQq','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','test','has',',\x20creating\x20new\x20file','6RMRpNz','.env.','from','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','user','.env','site','existsSync','entries','tdx.json','profiles','push','\x22\x20\x22','directory','1927816SIINzI','\x0aWarning:\x20Failed\x20to\x20parse\x20','filter','rmSync','1kgKVck','parse','Warning:\x20Profile\x20\x27','join','database','2959752HFGHpq','Error:\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','stringify','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','some','1271052wvLzXE','36XMcAAS','731885tpnbIa','isDirectory','set','llm_agent','\x27:\x20config\x20must\x20be\x20an\x20object','description','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','170KHaomf','Invalid\x20profile\x20name:\x20','\x20does\x20not\x20exist','parent_segment','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','keys','Profile\x20\x27','utf-8','includes','name','warn'];a51_0x1d6f=function(){return _0x5ec452;};return a51_0x1d6f();}export function saveProfile(_0x31e53d,_0x4060a1,_0x241172=![]){saveProfileToUserConfig(_0x31e53d,_0x4060a1);}export function deleteProfile(_0x589165){const _0x1381a8=a51_0x2175;validateProfileName(_0x589165);const _0x42ec06=getProfileDir(_0x589165);if(!a51_0x266790[_0x1381a8(0x1f3)](_0x42ec06))throw new Error(_0x1381a8(0x21f)+_0x589165+_0x1381a8(0x214));a51_0x266790[_0x1381a8(0x1fd)](_0x42ec06,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1f63e2,_0x2ba7ca){const _0x1841dd=a51_0x2175;validateProfileName(_0x1f63e2);const _0x48106b=getGlobalConfigPath(),_0x60c05b=getConfigDir();!a51_0x266790[_0x1841dd(0x1f3)](_0x60c05b)&&createSecureDirectory(_0x60c05b);let _0x1f3bc9={};if(a51_0x266790['existsSync'](_0x48106b))try{const _0x114cd7=a51_0x266790[_0x1841dd(0x1d7)](_0x48106b,_0x1841dd(0x219));_0x1f3bc9=JSON['parse'](_0x114cd7);}catch{console[_0x1841dd(0x21c)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x48106b+_0x1841dd(0x1eb));}!_0x1f3bc9[_0x1841dd(0x1f6)]&&(_0x1f3bc9[_0x1841dd(0x1f6)]={}),_0x1f3bc9[_0x1841dd(0x1f6)][_0x1f63e2]=_0x2ba7ca,writeSecureFile(_0x48106b,JSON[_0x1841dd(0x206)](_0x1f3bc9,null,0x2));}export function getActiveProfile(){const _0x351a22=a51_0x2175,_0x351ef5=loadSessionContext();if(_0x351ef5?.[_0x351a22(0x1d9)])return _0x351ef5[_0x351a22(0x1d9)];const _0x4d0eb7=getGlobalConfigPath();if(!a51_0x266790[_0x351a22(0x1f3)](_0x4d0eb7))return null;try{const _0x406c8c=a51_0x266790[_0x351a22(0x1d7)](_0x4d0eb7,_0x351a22(0x219)),_0x41f637=JSON[_0x351a22(0x1ff)](_0x406c8c);return _0x41f637[_0x351a22(0x1d9)]||null;}catch{return null;}}export function createProfile(_0xfc8ca,_0x221997){const _0xae32ba=a51_0x2175;validateProfileName(_0xfc8ca);if(profileExists(_0xfc8ca))throw new Error(_0xae32ba(0x21f)+_0xfc8ca+_0xae32ba(0x1d8));saveProfile(_0xfc8ca,_0x221997);}export function saveProfileCredentials(_0x51b9e3,_0x5377b6){const _0x2aace9=a51_0x2175;validateProfileName(_0x51b9e3);if(!profileExists(_0x51b9e3))throw new Error('Profile\x20'+_0x51b9e3+_0x2aace9(0x214));const _0x1caf1a=getNewCredentialPath(_0x51b9e3);writeSecureFile(_0x1caf1a,_0x5377b6);}export function loadProfileCredentials(_0x105f7c){const _0x535dab=a51_0x2175;validateProfileName(_0x105f7c);const _0x225c2b=getNewCredentialPath(_0x105f7c);if(a51_0x266790[_0x535dab(0x1f3)](_0x225c2b))try{return a51_0x266790[_0x535dab(0x1d7)](_0x225c2b,_0x535dab(0x219));}catch{}const _0x4260b3=getOldCredentialPath(_0x105f7c);if(a51_0x266790[_0x535dab(0x1f3)](_0x4260b3)){console[_0x535dab(0x21c)](_0x535dab(0x21d)+_0x105f7c+'\x27'),console[_0x535dab(0x21c)](_0x535dab(0x1e4)),console['warn'](_0x535dab(0x1e6)+_0x4260b3+_0x535dab(0x1f8)+_0x225c2b+'\x22'),console[_0x535dab(0x21c)](_0x535dab(0x1ef));try{return a51_0x266790[_0x535dab(0x1d7)](_0x4260b3,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a52_0x4487ae=a52_0x2c47;(function(_0x431692,_0x584be9){const _0x332711=a52_0x2c47,_0x5ef9eb=_0x431692();while(!![]){try{const _0x47843e=-parseInt(_0x332711(0x1d4))/0x1*(parseInt(_0x332711(0x1da))/0x2)+parseInt(_0x332711(0x1e9))/0x3*(-parseInt(_0x332711(0x1e4))/0x4)+parseInt(_0x332711(0x1ee))/0x5+-parseInt(_0x332711(0x1e6))/0x6+parseInt(_0x332711(0x1f0))/0x7+-parseInt(_0x332711(0x1ed))/0x8*(-parseInt(_0x332711(0x1f4))/0x9)+-parseInt(_0x332711(0x1f3))/0xa*(-parseInt(_0x332711(0x1d5))/0xb);if(_0x47843e===_0x584be9)break;else _0x5ef9eb['push'](_0x5ef9eb['shift']());}catch(_0x12debd){_0x5ef9eb['push'](_0x5ef9eb['shift']());}}}(a52_0x1409,0xa5958));import*as a52_0x17e75b from'node:fs';function a52_0x2c47(_0x49238a,_0x377cdd){_0x49238a=_0x49238a-0x1d4;const _0x14096a=a52_0x1409();let _0x2c4773=_0x14096a[_0x49238a];return _0x2c4773;}import*as a52_0x223f63 from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x4487ae(0x1f1);export function findProjectConfigPath(_0x159eb1){const _0x49a852=a52_0x4487ae;let _0x5bc330=_0x159eb1||process[_0x49a852(0x1dd)]();while(!![]){const _0x5d9dde=a52_0x223f63[_0x49a852(0x1eb)](_0x5bc330,PROJECT_CONFIG_FILENAME);if(a52_0x17e75b[_0x49a852(0x1e3)](_0x5d9dde))return _0x5d9dde;const _0x2f795e=a52_0x223f63[_0x49a852(0x1dc)](_0x5bc330);if(_0x2f795e===_0x5bc330)return null;_0x5bc330=_0x2f795e;}}function a52_0x1409(){const _0x4d5226=['\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','writeFileSync','TD_API_KEY','stringify','apiKey','existsSync','136288pByDuC','utf-8','2196066MUKEIa','readFileSync','code','87kjOLdM','api_key','join','Warning:\x20\x27profile\x27\x20field\x20in\x20','104IHRwbY','4026545JMxYHS','includes','8197413sOCWQq','tdx.json','profile','10PSSCkL','237357HEkVGA','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','1272419Hphvds','10840863oqNvOW','parse',').\x20','Failed\x20to\x20load\x20project\x20config\x20from\x20','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','2QPVmnM','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','dirname','cwd'];a52_0x1409=function(){return _0x4d5226;};return a52_0x1409();}export function loadProjectConfig(_0x436ed5){const _0x57f986=a52_0x4487ae,_0x48fac1=findProjectConfigPath(_0x436ed5);if(!_0x48fac1)return null;try{const _0x4f9546=a52_0x17e75b[_0x57f986(0x1e7)](_0x48fac1,_0x57f986(0x1e5)),_0x4a0ba8=JSON[_0x57f986(0x1d6)](_0x4f9546),_0x933260=JSON['stringify'](_0x4a0ba8);if(_0x933260[_0x57f986(0x1ef)](_0x57f986(0x1e0))||_0x933260[_0x57f986(0x1ef)]('apiKey')||_0x933260[_0x57f986(0x1ef)](_0x57f986(0x1ea)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x48fac1+_0x57f986(0x1d7)+_0x57f986(0x1d9));const {metadata:_0x47645e,profile:_0xabfc0f,..._0x5ba684}=_0x4a0ba8;return _0xabfc0f&&console['warn'](_0x57f986(0x1ec)+_0x48fac1+'\x20is\x20ignored.\x20'+_0x57f986(0x1db)),_0x5ba684;}catch(_0x5b2b8a){if(_0x5b2b8a instanceof Error&&'code'in _0x5b2b8a&&_0x5b2b8a[_0x57f986(0x1e8)]==='ENOENT')return null;throw new Error(_0x57f986(0x1d8)+_0x48fac1+':\x20'+_0x5b2b8a);}}export function saveProjectConfig(_0x59eded,_0x9f070){const _0xffa396=a52_0x4487ae,_0x2bb0d1=_0x9f070||process['cwd'](),_0x2f1063=a52_0x223f63[_0xffa396(0x1eb)](_0x2bb0d1,PROJECT_CONFIG_FILENAME),_0x5dac44=JSON['stringify'](_0x59eded);if(_0x5dac44[_0xffa396(0x1ef)](_0xffa396(0x1e0))||_0x5dac44[_0xffa396(0x1ef)](_0xffa396(0x1e2))||_0x5dac44[_0xffa396(0x1ef)](_0xffa396(0x1ea)))throw new Error(_0xffa396(0x1f5));if(_0xffa396(0x1f2)in _0x59eded)throw new Error(_0xffa396(0x1de));a52_0x17e75b[_0xffa396(0x1df)](_0x2f1063,JSON[_0xffa396(0x1e1)](_0x59eded,null,0x2));}export function hasProjectConfig(_0x14585c){return findProjectConfigPath(_0x14585c)!==null;}export function getProjectRoot(_0x9170f){const _0x249ec8=findProjectConfigPath(_0x9170f);return _0x249ec8?a52_0x223f63['dirname'](_0x249ec8):null;}
1
+ const a52_0x1614e4=a52_0x4cf5;function a52_0x4a16(){const _0x217db8=['Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8','includes','ENOENT','1642096EfaTFv','writeFileSync','Failed\x20to\x20load\x20project\x20config\x20from\x20',').\x20','cwd','dirname','Warning:\x20\x27profile\x27\x20field\x20in\x20','7oQYKbP','tdx.json','36885IMZSpi','507528VXnayz','join','3861801qSUSjU','1165632cHkeQB','267gHMepC','TD_API_KEY','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','\x20is\x20ignored.\x20','294016oQTqxh','api_key','654TvKDVG','stringify','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'];a52_0x4a16=function(){return _0x217db8;};return a52_0x4a16();}function a52_0x4cf5(_0x173838,_0x4791a7){_0x173838=_0x173838-0x10a;const _0x4a1650=a52_0x4a16();let _0x4cf5cf=_0x4a1650[_0x173838];return _0x4cf5cf;}(function(_0x4ac4ee,_0x4f6ca6){const _0x3e25de=a52_0x4cf5,_0x399ae1=_0x4ac4ee();while(!![]){try{const _0x14b287=-parseInt(_0x3e25de(0x119))/0x1+parseInt(_0x3e25de(0x11b))/0x2*(parseInt(_0x3e25de(0x115))/0x3)+-parseInt(_0x3e25de(0x114))/0x4+parseInt(_0x3e25de(0x110))/0x5+parseInt(_0x3e25de(0x111))/0x6+-parseInt(_0x3e25de(0x10e))/0x7*(-parseInt(_0x3e25de(0x122))/0x8)+parseInt(_0x3e25de(0x113))/0x9;if(_0x14b287===_0x4f6ca6)break;else _0x399ae1['push'](_0x399ae1['shift']());}catch(_0x3a7579){_0x399ae1['push'](_0x399ae1['shift']());}}}(a52_0x4a16,0x2980b));import*as a52_0x4b46b9 from'node:fs';import*as a52_0xc81cf9 from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x1614e4(0x10f);export function findProjectConfigPath(_0x577a31){const _0x555791=a52_0x1614e4;let _0x14c7f6=_0x577a31||process[_0x555791(0x10b)]();while(!![]){const _0x502396=a52_0xc81cf9['join'](_0x14c7f6,PROJECT_CONFIG_FILENAME);if(a52_0x4b46b9['existsSync'](_0x502396))return _0x502396;const _0x4c6d9b=a52_0xc81cf9['dirname'](_0x14c7f6);if(_0x4c6d9b===_0x14c7f6)return null;_0x14c7f6=_0x4c6d9b;}}export function loadProjectConfig(_0x527220){const _0x2ff044=a52_0x1614e4,_0x1d6b3f=findProjectConfigPath(_0x527220);if(!_0x1d6b3f)return null;try{const _0x34690d=a52_0x4b46b9['readFileSync'](_0x1d6b3f,_0x2ff044(0x11f)),_0x5d6751=JSON['parse'](_0x34690d),_0x14359c=JSON[_0x2ff044(0x11c)](_0x5d6751);if(_0x14359c[_0x2ff044(0x120)]('TD_API_KEY')||_0x14359c[_0x2ff044(0x120)]('apiKey')||_0x14359c[_0x2ff044(0x120)](_0x2ff044(0x11a)))throw new Error(_0x2ff044(0x11e)+_0x1d6b3f+_0x2ff044(0x10a)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x108bbc,profile:_0x4cd7a0,..._0x2c2dee}=_0x5d6751;return _0x4cd7a0&&console['warn'](_0x2ff044(0x10d)+_0x1d6b3f+_0x2ff044(0x118)+_0x2ff044(0x11d)),_0x2c2dee;}catch(_0x1090a3){if(_0x1090a3 instanceof Error&&'code'in _0x1090a3&&_0x1090a3['code']===_0x2ff044(0x121))return null;throw new Error(_0x2ff044(0x124)+_0x1d6b3f+':\x20'+_0x1090a3);}}export function saveProjectConfig(_0x35ee5e,_0x36ac0a){const _0x19afa3=a52_0x1614e4,_0x10baf1=_0x36ac0a||process[_0x19afa3(0x10b)](),_0x444f57=a52_0xc81cf9[_0x19afa3(0x112)](_0x10baf1,PROJECT_CONFIG_FILENAME),_0x477f76=JSON['stringify'](_0x35ee5e);if(_0x477f76[_0x19afa3(0x120)](_0x19afa3(0x116))||_0x477f76[_0x19afa3(0x120)]('apiKey')||_0x477f76[_0x19afa3(0x120)]('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if('profile'in _0x35ee5e)throw new Error(_0x19afa3(0x117));a52_0x4b46b9[_0x19afa3(0x123)](_0x444f57,JSON['stringify'](_0x35ee5e,null,0x2));}export function hasProjectConfig(_0x1ac66c){return findProjectConfigPath(_0x1ac66c)!==null;}export function getProjectRoot(_0x2b37da){const _0x4838b9=a52_0x1614e4,_0xde75d=findProjectConfigPath(_0x2b37da);return _0xde75d?a52_0xc81cf9[_0x4838b9(0x10c)](_0xde75d):null;}