@treasuredata/tdx 0.9.4 → 0.9.5

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 (151) 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.map +1 -1
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-pull-command.js.map +1 -1
  50. package/dist/commands/segment-push-command.d.ts.map +1 -1
  51. package/dist/commands/segment-push-command.js +1 -1
  52. package/dist/commands/segment-push-command.js.map +1 -1
  53. package/dist/commands/segment-update-command.js +1 -1
  54. package/dist/commands/segment-use-command.js +1 -1
  55. package/dist/commands/segments.js +1 -1
  56. package/dist/commands/show.js +1 -1
  57. package/dist/commands/tables.js +1 -1
  58. package/dist/commands/use-command.js +1 -1
  59. package/dist/commands/user-command.js +1 -1
  60. package/dist/commands/workflow-command.js +1 -1
  61. package/dist/core/auth.js +1 -1
  62. package/dist/core/config.js +1 -1
  63. package/dist/core/connection-cache.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/proxy/anthropic-adapter.js +1 -1
  73. package/dist/proxy/claude-usage-tracker.js +1 -1
  74. package/dist/proxy/context-signature.js +1 -1
  75. package/dist/proxy/conversation-utils.js +1 -1
  76. package/dist/proxy/server.js +1 -1
  77. package/dist/proxy/session-cache.js +1 -1
  78. package/dist/sdk/agent/agent-yaml.js +1 -1
  79. package/dist/sdk/api.js +1 -1
  80. package/dist/sdk/connection-validator.d.ts +119 -0
  81. package/dist/sdk/connection-validator.d.ts.map +1 -0
  82. package/dist/sdk/connection-validator.js +1 -0
  83. package/dist/sdk/connection-validator.js.map +1 -0
  84. package/dist/sdk/connection.d.ts +120 -1
  85. package/dist/sdk/connection.d.ts.map +1 -1
  86. package/dist/sdk/connection.js +1 -1
  87. package/dist/sdk/connection.js.map +1 -1
  88. package/dist/sdk/engage.js +1 -1
  89. package/dist/sdk/errors.d.ts +4 -0
  90. package/dist/sdk/errors.d.ts.map +1 -1
  91. package/dist/sdk/errors.js +1 -1
  92. package/dist/sdk/errors.js.map +1 -1
  93. package/dist/sdk/index.js +1 -1
  94. package/dist/sdk/job.js +1 -1
  95. package/dist/sdk/journey.js +1 -1
  96. package/dist/sdk/llm.js +1 -1
  97. package/dist/sdk/query.js +1 -1
  98. package/dist/sdk/segment/child-segment-yaml.d.ts +22 -6
  99. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  100. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  101. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  102. package/dist/sdk/segment/journey-yaml.js +1 -1
  103. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  104. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  105. package/dist/sdk/segment.js +1 -1
  106. package/dist/sdk/user.js +1 -1
  107. package/dist/sdk/workflow.js +1 -1
  108. package/dist/types/connector-schema.d.ts +182 -0
  109. package/dist/types/connector-schema.d.ts.map +1 -0
  110. package/dist/types/connector-schema.js +1 -0
  111. package/dist/types/connector-schema.js.map +1 -0
  112. package/dist/types/endpoints.js +1 -1
  113. package/dist/types/index.d.ts +2 -0
  114. package/dist/types/index.d.ts.map +1 -1
  115. package/dist/types/index.js +1 -1
  116. package/dist/utils/agent-config.js +1 -1
  117. package/dist/utils/agent-ref-parser.js +1 -1
  118. package/dist/utils/async.js +1 -1
  119. package/dist/utils/chat-cache.js +1 -1
  120. package/dist/utils/colors.js +1 -1
  121. package/dist/utils/command-output.js +1 -1
  122. package/dist/utils/constants.js +1 -1
  123. package/dist/utils/diff.js +1 -1
  124. package/dist/utils/fields-display.js +1 -1
  125. package/dist/utils/file-permissions.js +1 -1
  126. package/dist/utils/format-detector.js +1 -1
  127. package/dist/utils/formatters.js +1 -1
  128. package/dist/utils/journey-utils.d.ts.map +1 -1
  129. package/dist/utils/journey-utils.js +1 -1
  130. package/dist/utils/journey-utils.js.map +1 -1
  131. package/dist/utils/json-loader.js +1 -1
  132. package/dist/utils/llm-backup-utils.js +1 -1
  133. package/dist/utils/model-aliases.js +1 -1
  134. package/dist/utils/model-factors.js +1 -1
  135. package/dist/utils/option-validation.js +1 -1
  136. package/dist/utils/port.js +1 -1
  137. package/dist/utils/process.js +1 -1
  138. package/dist/utils/prompt.js +1 -1
  139. package/dist/utils/segment-path-parser.js +1 -1
  140. package/dist/utils/segment-ref-parser.js +1 -1
  141. package/dist/utils/spinner.js +1 -1
  142. package/dist/utils/sql-parser.js +1 -1
  143. package/dist/utils/sse-parser.js +1 -1
  144. package/dist/utils/string-utils.js +1 -1
  145. package/dist/utils/table-ref-parser.js +1 -1
  146. package/dist/utils/tdx-config.js +1 -1
  147. package/dist/utils/tdx-logger.js +1 -1
  148. package/dist/utils/tree-formatter.js +1 -1
  149. package/dist/utils/version-check.js +1 -1
  150. package/dist/utils/workflow-utils.js +1 -1
  151. 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
+ const a42_0x5d26e8=a42_0x21a0;function a42_0x21a0(_0x1e8243,_0x193f3a){_0x1e8243=_0x1e8243-0x1e3;const _0xa28f2f=a42_0xa28f();let _0x21a089=_0xa28f2f[_0x1e8243];return _0x21a089;}(function(_0x1c6831,_0x33d437){const _0x4f758c=a42_0x21a0,_0x5a7ff0=_0x1c6831();while(!![]){try{const _0x3596be=parseInt(_0x4f758c(0x1f5))/0x1+-parseInt(_0x4f758c(0x1f1))/0x2*(parseInt(_0x4f758c(0x217))/0x3)+-parseInt(_0x4f758c(0x1fc))/0x4*(parseInt(_0x4f758c(0x203))/0x5)+parseInt(_0x4f758c(0x1ea))/0x6+-parseInt(_0x4f758c(0x210))/0x7*(parseInt(_0x4f758c(0x1f3))/0x8)+-parseInt(_0x4f758c(0x20e))/0x9*(-parseInt(_0x4f758c(0x200))/0xa)+-parseInt(_0x4f758c(0x1ee))/0xb*(-parseInt(_0x4f758c(0x1eb))/0xc);if(_0x3596be===_0x33d437)break;else _0x5a7ff0['push'](_0x5a7ff0['shift']());}catch(_0x519273){_0x5a7ff0['push'](_0x5a7ff0['shift']());}}}(a42_0xa28f,0x78c7d));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';function a42_0xa28f(){const _0x25366c=['Session\x20profile\x20set\x20to:\x20','engage_workspace','name','33FJTuhj','Invalid\x20resource:\x20','agent','Error:\x20','Error:\x20Profile\x20\x27','\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace\x0a','parent_segment','green','Session\x20engage_workspace\x20set\x20to:\x20','cleared','error','display','4311492gLkIHW','10167348VAWPZd','Session\x20context\x20','displayWithSources','11oVHqfV','Set\x20session-level\x20context','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','156572AyjmMB','log','1088XUhTyy','dim','666632xxMKtY','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','(session:\x20','llm_project','clear','\x27\x20does\x20not\x20exist','includes','3656948NmnOHk','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace','database','\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','30NqbtEk','use','llm_agent','5DEpUqf','execute','profile','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','join','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a','Session\x20agent\x20set\x20to:\x20','Session\x20llm_project\x20set\x20to:\x20','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','length','113229hgrRkY','Session\x20parent_segment\x20set\x20to:\x20','7MtSqIK','toString','debug','session'];a42_0xa28f=function(){return _0x25366c;};return a42_0xa28f();}import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import a42_0x5f0a37 from'chalk';export class UseCommand extends BaseCommand{[a42_0x5d26e8(0x216)]=a42_0x5d26e8(0x201);[a42_0x5d26e8(0x208)]=a42_0x5d26e8(0x1ef);['validate'](_0x591693){const _0xa40ed=a42_0x5d26e8,{args:_0x15ac56}=_0x591693;if(_0x15ac56[_0xa40ed(0x20d)]===0x0)return undefined;if(_0x15ac56[_0xa40ed(0x20d)]===0x1)return _0xa40ed(0x1f0)+_0xa40ed(0x1ff)+_0xa40ed(0x209)+_0xa40ed(0x1e3)+'\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options';const _0x473ce7=_0x15ac56[0x0],_0x28890f=[_0xa40ed(0x1fe),'parent_segment',_0xa40ed(0x1f8),_0xa40ed(0x219),_0xa40ed(0x205),_0xa40ed(0x215)];if(!_0x28890f[_0xa40ed(0x1fb)](_0x473ce7))return _0xa40ed(0x218)+_0x473ce7+'.\x20Must\x20be\x20one\x20of:\x20'+_0x28890f[_0xa40ed(0x207)](',\x20');return undefined;}async[a42_0x5d26e8(0x204)](_0x51e128){const _0x51ca6d=a42_0x5d26e8,{args:_0x7db326,options:_0x7172cb}=_0x51e128,_0x43776a=_0x7172cb[_0x51ca6d(0x212)],_0x381ee6=_0x7172cb[_0x51ca6d(0x1f9)];cleanExpiredSessions();try{if(_0x381ee6){clearSessionContext(_0x7172cb[_0x51ca6d(0x213)]);const _0x28e539=_0x7172cb[_0x51ca6d(0x213)]||getCurrentSessionPID()[_0x51ca6d(0x211)]();return console[_0x51ca6d(0x1f2)](_0x51ca6d(0x1ec)+a42_0x5f0a37[_0x51ca6d(0x1e5)](_0x51ca6d(0x1e7))+'\x20'+a42_0x5f0a37['dim']('(session:\x20'+_0x28e539+')')),0x0;}if(_0x7db326[_0x51ca6d(0x20d)]===0x0){const _0x43d533=new GlobalContext(_0x7172cb);return _0x43776a?_0x43d533[_0x51ca6d(0x1ed)]():_0x43d533[_0x51ca6d(0x1e9)](),console[_0x51ca6d(0x1f2)](a42_0x5f0a37['dim'](_0x51ca6d(0x20c))),console['log'](a42_0x5f0a37[_0x51ca6d(0x1f4)](_0x51ca6d(0x1fd))),0x0;}const _0x1ba2c7=_0x7db326[0x0],_0xe12859=_0x7db326[0x1];if(_0x1ba2c7===_0x51ca6d(0x205)){if(!profileExists(_0xe12859))return console[_0x51ca6d(0x1e8)](_0x51ca6d(0x21b)+_0xe12859+_0x51ca6d(0x1fa)),console[_0x51ca6d(0x1e8)](_0x51ca6d(0x206)),0x1;const _0x135925=_0x7172cb[_0x51ca6d(0x213)]||getCurrentSessionPID()[_0x51ca6d(0x211)]();return saveSessionContext({'profile':_0xe12859},_0x7172cb[_0x51ca6d(0x213)]),console['log'](_0x51ca6d(0x214)+a42_0x5f0a37[_0x51ca6d(0x1e5)](_0xe12859)+'\x20'+a42_0x5f0a37[_0x51ca6d(0x1f4)](_0x51ca6d(0x1f7)+_0x135925+')')),console[_0x51ca6d(0x1f2)](a42_0x5f0a37[_0x51ca6d(0x1f4)](_0x51ca6d(0x1f6))),0x0;}const _0x429b76={},_0x4a1819=_0x7172cb['session']||getCurrentSessionPID()[_0x51ca6d(0x211)]();switch(_0x1ba2c7){case'database':_0x429b76[_0x51ca6d(0x1fe)]=_0xe12859,console['log']('Session\x20database\x20set\x20to:\x20'+a42_0x5f0a37[_0x51ca6d(0x1e5)](_0xe12859)+'\x20'+a42_0x5f0a37[_0x51ca6d(0x1f4)](_0x51ca6d(0x1f7)+_0x4a1819+')'));break;case'parent_segment':_0x429b76[_0x51ca6d(0x1e4)]=_0xe12859,console[_0x51ca6d(0x1f2)](_0x51ca6d(0x20f)+a42_0x5f0a37[_0x51ca6d(0x1e5)](_0xe12859)+'\x20'+a42_0x5f0a37[_0x51ca6d(0x1f4)](_0x51ca6d(0x1f7)+_0x4a1819+')'));break;case _0x51ca6d(0x1f8):_0x429b76[_0x51ca6d(0x1f8)]=_0xe12859,console[_0x51ca6d(0x1f2)](_0x51ca6d(0x20b)+a42_0x5f0a37[_0x51ca6d(0x1e5)](_0xe12859)+'\x20'+a42_0x5f0a37[_0x51ca6d(0x1f4)]('(session:\x20'+_0x4a1819+')'));break;case _0x51ca6d(0x219):{const {projectName:_0x53a7f4,agentName:_0x5c1bad}=parseAgentRef(_0xe12859);_0x5c1bad?(_0x429b76['llm_project']=_0x53a7f4,_0x429b76[_0x51ca6d(0x202)]=_0x5c1bad,console['log'](_0x51ca6d(0x20b)+a42_0x5f0a37['green'](_0x53a7f4)+'\x20'+a42_0x5f0a37[_0x51ca6d(0x1f4)](_0x51ca6d(0x1f7)+_0x4a1819+')')),console[_0x51ca6d(0x1f2)]('Session\x20agent\x20set\x20to:\x20'+a42_0x5f0a37[_0x51ca6d(0x1e5)](_0x5c1bad)+'\x20'+a42_0x5f0a37[_0x51ca6d(0x1f4)]('(session:\x20'+_0x4a1819+')'))):(_0x429b76[_0x51ca6d(0x202)]=_0xe12859,console[_0x51ca6d(0x1f2)](_0x51ca6d(0x20a)+a42_0x5f0a37[_0x51ca6d(0x1e5)](_0xe12859)+'\x20'+a42_0x5f0a37[_0x51ca6d(0x1f4)](_0x51ca6d(0x1f7)+_0x4a1819+')')));break;}case _0x51ca6d(0x215):_0x429b76['engage_workspace']=_0xe12859,console[_0x51ca6d(0x1f2)](_0x51ca6d(0x1e6)+a42_0x5f0a37[_0x51ca6d(0x1e5)](_0xe12859)+'\x20'+a42_0x5f0a37[_0x51ca6d(0x1f4)]('(session:\x20'+_0x4a1819+')'));break;}return saveSessionContext(_0x429b76,_0x7172cb['session']),console[_0x51ca6d(0x1f2)](a42_0x5f0a37[_0x51ca6d(0x1f4)](_0x51ca6d(0x1f6))),0x0;}catch(_0xad6e37){return _0xad6e37 instanceof Error&&console[_0x51ca6d(0x1e8)](_0x51ca6d(0x21a)+_0xad6e37['message']),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_0x559137=a43_0x2d4d;(function(_0x443be2,_0x248c87){const _0x26a6d4=a43_0x2d4d,_0x18a175=_0x443be2();while(!![]){try{const _0x51d926=-parseInt(_0x26a6d4(0x179))/0x1+-parseInt(_0x26a6d4(0x17e))/0x2*(-parseInt(_0x26a6d4(0x16b))/0x3)+-parseInt(_0x26a6d4(0x17c))/0x4+-parseInt(_0x26a6d4(0x16c))/0x5+-parseInt(_0x26a6d4(0x167))/0x6+parseInt(_0x26a6d4(0x166))/0x7+parseInt(_0x26a6d4(0x16f))/0x8;if(_0x51d926===_0x248c87)break;else _0x18a175['push'](_0x18a175['shift']());}catch(_0x2fc6f7){_0x18a175['push'](_0x18a175['shift']());}}}(a43_0x30e6,0x8ef18));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a43_0x30e6(){const _0x580d66=['4214784dBVSsS','error','execute','message','141kjPqMo','5391120xRzyOc','Fetching\x20user\x20info...','getCurrent','8740696Ulthcc','description','Show\x20current\x20user\x20information','user','verbose','✔\x20Found\x20','data','length','cause','Error:\x20','208890oIFakw','\x20user','name','1863952QUTnNE','user\x20list','37958MVtTWL','\x20\x20Cause:\x20','Listing\x20users...','list','7395234mjCewp'];a43_0x30e6=function(){return _0x580d66;};return a43_0x30e6();}import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a43_0x2d4d(_0x591b3e,_0x192edd){_0x591b3e=_0x591b3e-0x164;const _0x30e6a0=a43_0x30e6();let _0x2d4d02=_0x30e6a0[_0x591b3e];return _0x2d4d02;}import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{[a43_0x559137(0x17b)]='user';[a43_0x559137(0x170)]=a43_0x559137(0x171);async[a43_0x559137(0x169)](_0x33af18){const _0x4df5f1=a43_0x559137,{options:_0x25f699,tdx:_0x39e99c}=_0x33af18;try{const _0x4c119b=await withSpinner(_0x4df5f1(0x16d),()=>_0x39e99c[_0x4df5f1(0x172)][_0x4df5f1(0x16e)](),{'verbose':_0x25f699[_0x4df5f1(0x173)]}),_0x1d59a2=_0x4c119b[_0x4df5f1(0x175)];return await handleSingleObjectOutput(_0x1d59a2,_0x25f699),0x0;}catch(_0x448219){if(_0x448219 instanceof SDKError)return console[_0x4df5f1(0x168)]('Error:\x20'+_0x448219[_0x4df5f1(0x16a)]),_0x448219[_0x4df5f1(0x177)]&&console[_0x4df5f1(0x168)](_0x4df5f1(0x17f)+_0x448219['cause']),0x1;throw _0x448219;}}}export class UserListCommand extends BaseCommand{[a43_0x559137(0x17b)]=a43_0x559137(0x17d);['description']='List\x20all\x20users\x20in\x20the\x20account';async[a43_0x559137(0x169)](_0x2fa543){const _0x3d663e=a43_0x559137,{options:_0x1f99e0,tdx:_0xf897f}=_0x2fa543;try{const _0x2320af=await withSpinner(_0x3d663e(0x164),()=>_0xf897f[_0x3d663e(0x172)][_0x3d663e(0x165)](),{'verbose':_0x1f99e0['verbose']}),_0x388742=_0x2320af[_0x3d663e(0x175)];return console[_0x3d663e(0x168)](_0x3d663e(0x174)+_0x388742[_0x3d663e(0x176)]+_0x3d663e(0x17a)+(_0x388742[_0x3d663e(0x176)]!==0x1?'s':'')),await handleSDKOutput(_0x388742,_0x1f99e0),0x0;}catch(_0x387a30){if(_0x387a30 instanceof SDKError)return console[_0x3d663e(0x168)](_0x3d663e(0x178)+_0x387a30['message']),_0x387a30[_0x3d663e(0x177)]&&console[_0x3d663e(0x168)](_0x3d663e(0x17f)+_0x387a30[_0x3d663e(0x177)]),0x1;throw _0x387a30;}}}
@@ -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_0x322c85=a44_0x3098;(function(_0x556959,_0xadb28d){const _0x4a74a0=a44_0x3098,_0x56f2d1=_0x556959();while(!![]){try{const _0x1f4704=-parseInt(_0x4a74a0(0x9a))/0x1*(-parseInt(_0x4a74a0(0xaf))/0x2)+-parseInt(_0x4a74a0(0xf4))/0x3+-parseInt(_0x4a74a0(0xfe))/0x4+parseInt(_0x4a74a0(0x125))/0x5*(-parseInt(_0x4a74a0(0x9e))/0x6)+parseInt(_0x4a74a0(0xbf))/0x7+-parseInt(_0x4a74a0(0x12c))/0x8*(-parseInt(_0x4a74a0(0xdb))/0x9)+parseInt(_0x4a74a0(0xc5))/0xa;if(_0x1f4704===_0xadb28d)break;else _0x56f2d1['push'](_0x56f2d1['shift']());}catch(_0x20fe76){_0x56f2d1['push'](_0x56f2d1['shift']());}}}(a44_0x20af,0x2b536));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_0x526862 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xe3);[a44_0x322c85(0xe7)]=a44_0x322c85(0x95);async[a44_0x322c85(0x11d)](_0x101ddf){const _0x461ffb=a44_0x322c85,{options:_0x325c77,args:_0x24a728,tdx:_0x1f7e47}=_0x101ddf,_0x27eab3=_0x24a728[0x0];try{_0x325c77[_0x461ffb(0x118)]&&_0x27eab3&&console['error'](_0x461ffb(0xdd)+_0x27eab3);const _0x357447=await withSpinner(_0x461ffb(0x131),()=>_0x1f7e47['workflow'][_0x461ffb(0xae)](_0x27eab3,{'limit':_0x325c77[_0x461ffb(0x138)]}),{'verbose':_0x325c77[_0x461ffb(0x118)]}),_0x49b584=_0x357447['data'];return console[_0x461ffb(0xe8)](_0x461ffb(0xd4)+_0x49b584[_0x461ffb(0xb0)]+_0x461ffb(0xb3)+(_0x49b584[_0x461ffb(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x49b584,_0x325c77),0x0;}catch(_0x120564){if(_0x120564 instanceof SDKError)return console[_0x461ffb(0xe8)](_0x461ffb(0x10f)+_0x120564[_0x461ffb(0xaa)]),_0x120564['cause']&&console[_0x461ffb(0xe8)](_0x461ffb(0x108)+_0x120564['cause']),0x1;throw _0x120564;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a44_0x322c85(0x129);[a44_0x322c85(0xe7)]=a44_0x322c85(0x132);async[a44_0x322c85(0x11d)](_0x14f317){const _0x36ef3f=a44_0x322c85,{options:_0x537c18,args:_0x2042d1,tdx:_0x444e25}=_0x14f317,_0x237536=_0x2042d1[0x0];try{_0x537c18[_0x36ef3f(0x118)]&&_0x237536&&console[_0x36ef3f(0xe8)](_0x36ef3f(0x121)+_0x237536);const _0x6ddcdd=await withSpinner(_0x36ef3f(0xbe),()=>_0x444e25['workflow'][_0x36ef3f(0x9d)](_0x237536,{'limit':_0x537c18[_0x36ef3f(0x138)]}),{'verbose':_0x537c18[_0x36ef3f(0x118)]}),_0x230099=_0x6ddcdd['data'];return console[_0x36ef3f(0xe8)](_0x36ef3f(0xd4)+_0x230099['length']+_0x36ef3f(0xa8)+(_0x230099['length']!==0x1?'s':'')),await handleSDKOutput(_0x230099,_0x537c18),0x0;}catch(_0x4d9262){if(_0x4d9262 instanceof SDKError)return console[_0x36ef3f(0xe8)](_0x36ef3f(0x10f)+_0x4d9262[_0x36ef3f(0xaa)]),_0x4d9262[_0x36ef3f(0xd8)]&&console[_0x36ef3f(0xe8)](_0x36ef3f(0x108)+_0x4d9262[_0x36ef3f(0xd8)]),0x1;throw _0x4d9262;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']='workflow:sessions';[a44_0x322c85(0xe7)]='List\x20workflow\x20execution\x20sessions';async['execute'](_0x1c00bc){const _0x184b34=a44_0x322c85,{options:_0x43c984,args:_0x2ef045,tdx:_0x52816d}=_0x1c00bc;let _0x585f6d,_0xc2ad6c;if(_0x2ef045[0x0]){const _0x57eabb=_0x2ef045[0x0]['split']('.');if(_0x57eabb[_0x184b34(0xb0)]===0x1)_0x585f6d=_0x57eabb[0x0];else{if(_0x57eabb['length']===0x2)[_0x585f6d,_0xc2ad6c]=_0x57eabb;else return console[_0x184b34(0xe8)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x43c984[_0x184b34(0x118)]){if(_0x585f6d&&_0xc2ad6c)console['error'](_0x184b34(0x133)+_0x585f6d+'.'+_0xc2ad6c);else _0x585f6d&&console[_0x184b34(0xe8)](_0x184b34(0x11e)+_0x585f6d);const _0x17aa1d=_0x43c984[_0x184b34(0x106)];_0x17aa1d&&console[_0x184b34(0xe8)]('Status:\x20'+_0x17aa1d);}const _0x2d0a99=await withSpinner(_0x184b34(0xb1),()=>_0x52816d[_0x184b34(0x117)][_0x184b34(0xcb)]({'projectName':_0x585f6d,'workflowName':_0xc2ad6c,'status':_0x43c984[_0x184b34(0x106)],'fromTime':_0x43c984[_0x184b34(0xde)],'toTime':_0x43c984['to'],'limit':_0x43c984[_0x184b34(0x138)]}),{'verbose':_0x43c984[_0x184b34(0x118)]}),_0x2f2a32=_0x2d0a99[_0x184b34(0xfc)];return console[_0x184b34(0xe8)](_0x184b34(0xd4)+_0x2f2a32[_0x184b34(0xb0)]+_0x184b34(0x123)+(_0x2f2a32[_0x184b34(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x2f2a32,_0x43c984),0x0;}catch(_0x3bcf11){if(_0x3bcf11 instanceof SDKError)return console['error'](_0x184b34(0x10f)+_0x3bcf11[_0x184b34(0xaa)]),_0x3bcf11[_0x184b34(0xd8)]&&console['error']('\x20\x20Cause:\x20'+_0x3bcf11[_0x184b34(0xd8)]),0x1;throw _0x3bcf11;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:attempts';[a44_0x322c85(0xe7)]=a44_0x322c85(0xa5);async[a44_0x322c85(0x11d)](_0x300acc){const _0x4aefbf=a44_0x322c85,{options:_0x179489,args:_0x82f917,tdx:_0x3d1dbc}=_0x300acc;let _0x2df8b1,_0x2c5c5f;if(_0x82f917[0x0]){const _0x5081de=_0x82f917[0x0][_0x4aefbf(0xcd)]('.');if(_0x5081de[_0x4aefbf(0xb0)]===0x1)_0x2df8b1=_0x5081de[0x0];else{if(_0x5081de[_0x4aefbf(0xb0)]===0x2)[_0x2df8b1,_0x2c5c5f]=_0x5081de;else return console[_0x4aefbf(0xe8)](_0x4aefbf(0xe5)),0x1;}}try{const _0x4a5626=_0x179489[_0x4aefbf(0xce)];if(_0x179489[_0x4aefbf(0x118)]){if(_0x2df8b1&&_0x2c5c5f)console[_0x4aefbf(0xe8)](_0x4aefbf(0x133)+_0x2df8b1+'.'+_0x2c5c5f);else _0x2df8b1&&console[_0x4aefbf(0xe8)](_0x4aefbf(0x11e)+_0x2df8b1);_0x4a5626&&console[_0x4aefbf(0xe8)]('Include\x20retried:\x20yes');}const _0x2abc97=await withSpinner(_0x4aefbf(0xd6),()=>_0x3d1dbc[_0x4aefbf(0x117)][_0x4aefbf(0x98)]({'projectName':_0x2df8b1,'workflowName':_0x2c5c5f,'includeRetried':_0x4a5626,'limit':_0x179489[_0x4aefbf(0x138)]}),{'verbose':_0x179489[_0x4aefbf(0x118)]}),_0x36b502=_0x2abc97[_0x4aefbf(0xfc)];return console['error'](_0x4aefbf(0xd4)+_0x36b502['length']+'\x20attempt'+(_0x36b502[_0x4aefbf(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x36b502,_0x179489),0x0;}catch(_0x3291b0){if(_0x3291b0 instanceof SDKError)return console[_0x4aefbf(0xe8)](_0x4aefbf(0x10f)+_0x3291b0[_0x4aefbf(0xaa)]),_0x3291b0['cause']&&console[_0x4aefbf(0xe8)](_0x4aefbf(0x108)+_0x3291b0[_0x4aefbf(0xd8)]),0x1;throw _0x3291b0;}}}export class WorkflowAttemptCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xf2);[a44_0x322c85(0xe7)]=a44_0x322c85(0x97);async['execute'](_0x5ad75c){const _0x153e5f=a44_0x322c85,{options:_0x2803e0,args:_0x84ccc0,tdx:_0x26fa71}=_0x5ad75c,_0x4179e9=_0x84ccc0[0x0];if(!_0x4179e9)return console[_0x153e5f(0xe8)](_0x153e5f(0xa0)),0x1;try{_0x2803e0[_0x153e5f(0x118)]&&console[_0x153e5f(0xe8)](_0x153e5f(0x10c)+_0x4179e9);const _0x175ca2=await withSpinner(_0x153e5f(0xf0),()=>_0x26fa71['workflow'][_0x153e5f(0x126)](_0x4179e9),{'verbose':_0x2803e0[_0x153e5f(0x118)]}),_0x1dd592=_0x175ca2[_0x153e5f(0xfc)];let _0x2c9a73;!_0x1dd592[_0x153e5f(0xd1)]?_0x2c9a73=_0x1dd592[_0x153e5f(0xe4)]?_0x153e5f(0xdf):_0x153e5f(0xf5):_0x2c9a73=_0x1dd592['success']?_0x153e5f(0xe1):_0x153e5f(0xe8);let _0x2fdafe;if(_0x1dd592[_0x153e5f(0xda)]&&_0x1dd592[_0x153e5f(0xd0)]){const _0x9c306e=new Date(_0x1dd592[_0x153e5f(0xda)])[_0x153e5f(0x128)](),_0x186a37=new Date(_0x1dd592[_0x153e5f(0xd0)])['getTime']();_0x2fdafe=Math[_0x153e5f(0xb2)]((_0x186a37-_0x9c306e)/0x3e8);}const _0x2a6a2f={'attempt_id':_0x1dd592['id'],'status':_0x2c9a73,..._0x1dd592[_0x153e5f(0x107)]!==undefined&&{'index':_0x1dd592[_0x153e5f(0x107)]},..._0x1dd592[_0x153e5f(0xab)]&&{'project':_0x1dd592[_0x153e5f(0xab)][_0x153e5f(0x10a)]},..._0x1dd592[_0x153e5f(0x117)]&&{'workflow':_0x1dd592['workflow']['name']},..._0x1dd592[_0x153e5f(0x100)]&&{'session_id':_0x1dd592[_0x153e5f(0x100)]},..._0x1dd592['sessionTime']&&{'session_time':_0x1dd592[_0x153e5f(0xa1)]},..._0x1dd592[_0x153e5f(0xc1)]&&{'retry_attempt':_0x1dd592[_0x153e5f(0xc1)]},..._0x2fdafe!==undefined&&{'duration_sec':_0x2fdafe},..._0x1dd592['createdAt']&&{'created_at':_0x1dd592[_0x153e5f(0xda)]},..._0x1dd592[_0x153e5f(0xd0)]&&{'finished_at':_0x1dd592['finishedAt']},...Object[_0x153e5f(0xd7)](_0x1dd592[_0x153e5f(0x12d)])[_0x153e5f(0xb0)]>0x0&&{'params':_0x1dd592[_0x153e5f(0x12d)]}};return await handleSingleObjectOutput(_0x2a6a2f,_0x2803e0),0x0;}catch(_0x681004){if(_0x681004 instanceof SDKError)return console[_0x153e5f(0xe8)]('Error:\x20'+_0x681004[_0x153e5f(0xaa)]),_0x681004[_0x153e5f(0xd8)]&&console[_0x153e5f(0xe8)]('\x20\x20Cause:\x20'+_0x681004[_0x153e5f(0xd8)]),0x1;throw _0x681004;}}}export class WorkflowTasksCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:tasks';[a44_0x322c85(0xe7)]=a44_0x322c85(0x130);async['execute'](_0x5a52a7){const _0x16e03d=a44_0x322c85,{options:_0x33be0a,args:_0x259ba7,tdx:_0x3654a6}=_0x5a52a7,_0x14615e=_0x259ba7[0x0];if(!_0x14615e)return console[_0x16e03d(0xe8)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x232c1b=_0x33be0a[_0x16e03d(0x120)];_0x33be0a[_0x16e03d(0x118)]&&(console[_0x16e03d(0xe8)](_0x16e03d(0x10c)+_0x14615e),_0x232c1b&&console[_0x16e03d(0xe8)](_0x16e03d(0xd5)));const _0x11b4f8=await withSpinner(_0x16e03d(0xa9),()=>_0x3654a6[_0x16e03d(0x117)][_0x16e03d(0xbb)](_0x14615e,_0x232c1b||![]),{'verbose':_0x33be0a[_0x16e03d(0x118)]}),_0x5f2fdd=_0x11b4f8[_0x16e03d(0xfc)];return console[_0x16e03d(0xe8)](_0x16e03d(0xd4)+_0x5f2fdd[_0x16e03d(0xb0)]+_0x16e03d(0x124)+(_0x5f2fdd[_0x16e03d(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x5f2fdd,_0x33be0a),0x0;}catch(_0x1fd0ef){if(_0x1fd0ef instanceof SDKError)return console['error'](_0x16e03d(0x10f)+_0x1fd0ef['message']),_0x1fd0ef['cause']&&console['error'](_0x16e03d(0x108)+_0x1fd0ef[_0x16e03d(0xd8)]),0x1;throw _0x1fd0ef;}}}function a44_0x3098(_0x3ada99,_0x34981c){_0x3ada99=_0x3ada99-0x95;const _0x20af1b=a44_0x20af();let _0x309897=_0x20af1b[_0x3ada99];return _0x309897;}export class WorkflowLogsCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xeb);[a44_0x322c85(0xe7)]=a44_0x322c85(0xe9);async[a44_0x322c85(0x11d)](_0x3f5b25){const _0x2c31ce=a44_0x322c85,{options:_0x4957fb,args:_0x27ce6a,tdx:_0x132cfe}=_0x3f5b25,_0x1e3372=_0x27ce6a[0x0];let _0x5edf9d=_0x27ce6a[0x1];if(!_0x1e3372)return console[_0x2c31ce(0xe8)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x4957fb[_0x2c31ce(0x118)]&&(console['error'](_0x2c31ce(0x10c)+_0x1e3372),_0x5edf9d&&console[_0x2c31ce(0xe8)](_0x2c31ce(0xd3)+_0x5edf9d));const _0x418ed2=await withSpinner(_0x2c31ce(0x134),()=>_0x132cfe[_0x2c31ce(0x117)][_0x2c31ce(0xe0)](_0x1e3372,_0x5edf9d),{'verbose':_0x4957fb['verbose']}),_0x3eeb6d=_0x418ed2[_0x2c31ce(0xfc)];if(_0x3eeb6d[_0x2c31ce(0xb0)]===0x0)return console['error'](_0x2c31ce(0x96)),0x0;if(!_0x5edf9d&&(_0x4957fb[_0x2c31ce(0xc3)]||_0x4957fb[_0x2c31ce(0xbc)]))return await handleSDKOutput(_0x3eeb6d,_0x4957fb),0x0;if(!_0x5edf9d){const _0x108185=_0x3eeb6d['map'](_0x3dc1c5=>({'title':_0x3dc1c5[_0x2c31ce(0xcc)]+'\x20('+formatBytes(_0x3dc1c5[_0x2c31ce(0xb7)])+')','value':_0x3dc1c5[_0x2c31ce(0xcc)]})),_0x3cfec8=await a44_0x526862({'type':_0x2c31ce(0x113),'name':_0x2c31ce(0xb8),'message':_0x2c31ce(0x115),'choices':_0x108185});if(!_0x3cfec8[_0x2c31ce(0xb8)])return console[_0x2c31ce(0xe8)]('Cancelled'),0x0;_0x5edf9d=_0x3cfec8[_0x2c31ce(0xb8)];}const _0x212a08=await withSpinner(_0x2c31ce(0xc9),()=>_0x132cfe[_0x2c31ce(0x117)][_0x2c31ce(0x109)](_0x1e3372,_0x5edf9d),{'verbose':_0x4957fb[_0x2c31ce(0x118)]}),_0x17134c=_0x212a08[_0x2c31ce(0xfc)];return _0x17134c?console['log'](_0x17134c):console[_0x2c31ce(0xe8)](_0x2c31ce(0xc4)),0x0;}catch(_0x52f283){if(_0x52f283 instanceof SDKError)return console[_0x2c31ce(0xe8)](_0x2c31ce(0x10f)+_0x52f283[_0x2c31ce(0xaa)]),_0x52f283['cause']&&console[_0x2c31ce(0xe8)](_0x2c31ce(0x108)+_0x52f283['cause']),0x1;throw _0x52f283;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a44_0x322c85(0xd2);[a44_0x322c85(0xe7)]=a44_0x322c85(0xff);async[a44_0x322c85(0x11d)](_0x231979){const _0xc045d7=a44_0x322c85,{options:_0x404499,args:_0x217c1a,tdx:_0x333992}=_0x231979,_0x587d4c=_0x217c1a[0x0];if(!_0x587d4c)return console[_0xc045d7(0xe8)](_0xc045d7(0xa0)),0x1;try{const _0x37bf66=_0x404499[_0xc045d7(0xe2)];_0x404499[_0xc045d7(0x118)]&&(console[_0xc045d7(0xe8)](_0xc045d7(0x10c)+_0x587d4c),_0x37bf66&&console[_0xc045d7(0xe8)]('Reason:\x20'+_0x37bf66));if(!_0x404499[_0xc045d7(0x127)]){const _0x3c7dd3=await confirm(_0xc045d7(0xca)+_0x587d4c+'?');if(!_0x3c7dd3)return console[_0xc045d7(0xe8)]('Cancelled'),0x0;}const _0x53d07a=await withSpinner(_0xc045d7(0xc0),()=>_0x333992[_0xc045d7(0x117)][_0xc045d7(0x101)](_0x587d4c,_0x37bf66),{'verbose':_0x404499[_0xc045d7(0x118)]}),_0x5bee9e=_0x53d07a['data'];return console[_0xc045d7(0xe8)]('✔\x20'+_0x5bee9e),0x0;}catch(_0x2dc934){if(_0x2dc934 instanceof SDKError)return console[_0xc045d7(0xe8)](_0xc045d7(0x10f)+_0x2dc934[_0xc045d7(0xaa)]),_0x2dc934[_0xc045d7(0xd8)]&&console[_0xc045d7(0xe8)](_0xc045d7(0x108)+_0x2dc934[_0xc045d7(0xd8)]),0x1;throw _0x2dc934;}}}export class WorkflowRetryCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xfb);[a44_0x322c85(0xe7)]=a44_0x322c85(0x99);async[a44_0x322c85(0x11d)](_0x185ee8){const _0x903c12=a44_0x322c85,{options:_0x2c61c9,args:_0x6c9d3b,tdx:_0x558ccd}=_0x185ee8,_0x49d1c1=_0x6c9d3b[0x0];if(!_0x49d1c1)return console[_0x903c12(0xe8)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console['error']('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x2ba413=![],_0x1a5b34=_0x49d1c1;if(_0x49d1c1['startsWith']('session:'))_0x2ba413=!![],_0x1a5b34=_0x49d1c1[_0x903c12(0xcf)](0x8);else{if(_0x49d1c1['startsWith']('attempt:'))_0x2ba413=![],_0x1a5b34=_0x49d1c1['substring'](0x8);else return console[_0x903c12(0xe8)](_0x903c12(0xdc)),console['error'](_0x903c12(0x10e)),0x1;}try{const _0x2bc132=_0x2c61c9[_0x903c12(0x9f)],_0x2e5815=_0x2c61c9[_0x903c12(0x11a)],_0x22cb7a=_0x2c61c9['params'],_0x11bd5b=_0x2c61c9['force'];_0x2c61c9[_0x903c12(0x118)]&&(console['error'](_0x903c12(0x13a)+(_0x2ba413?_0x903c12(0x135):_0x903c12(0x126))+'\x20'+_0x1a5b34),_0x2bc132&&console['error'](_0x903c12(0xc6)+_0x2bc132),_0x2e5815&&console[_0x903c12(0xe8)](_0x903c12(0x12e)+_0x2e5815),_0x22cb7a&&console[_0x903c12(0xe8)](_0x903c12(0x112)+_0x22cb7a),_0x11bd5b&&console[_0x903c12(0xe8)](_0x903c12(0x12b)));let _0x264f25;if(_0x22cb7a)try{if(_0x22cb7a['startsWith']('@')){const _0x21ac58=await import(_0x903c12(0xe6)),_0x424261=_0x22cb7a[_0x903c12(0xcf)](0x1),_0x4e3753=await _0x21ac58['readFile'](_0x424261,_0x903c12(0xb4));_0x264f25=JSON[_0x903c12(0xfd)](_0x4e3753);}else _0x264f25=JSON[_0x903c12(0xfd)](_0x22cb7a);}catch{return console[_0x903c12(0xe8)](_0x903c12(0xf1)),0x1;}if(!_0x2c61c9['yes']){const _0x3d8e29=await confirm(_0x903c12(0xa2)+(_0x2ba413?_0x903c12(0x135):_0x903c12(0x126))+'\x20'+_0x1a5b34+'?');if(!_0x3d8e29)return console[_0x903c12(0xe8)](_0x903c12(0xa4)),0x0;}let _0x329cec;_0x2ba413?_0x329cec=await withSpinner(_0x903c12(0x116),()=>_0x558ccd[_0x903c12(0x117)][_0x903c12(0xac)](_0x1a5b34,{'fromTask':_0x2bc132,'retryParams':_0x264f25}),{'verbose':_0x2c61c9[_0x903c12(0x118)]}):_0x329cec=await withSpinner(_0x903c12(0x105),()=>_0x558ccd[_0x903c12(0x117)][_0x903c12(0xed)](_0x1a5b34,{'resumeFrom':_0x2e5815,'retryParams':_0x264f25,'force':_0x11bd5b}),{'verbose':_0x2c61c9[_0x903c12(0x118)]});const _0x2df30c=_0x329cec[_0x903c12(0xfc)];return console[_0x903c12(0xe8)](_0x903c12(0x122)),console[_0x903c12(0xe8)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x2df30c[_0x903c12(0xad)]),console[_0x903c12(0xe8)](_0x903c12(0xb5)+_0x2df30c[_0x903c12(0x100)]),0x0;}catch(_0x35f295){if(_0x35f295 instanceof SDKError)return console[_0x903c12(0xe8)](_0x903c12(0x10f)+_0x35f295[_0x903c12(0xaa)]),_0x35f295[_0x903c12(0xd8)]&&console[_0x903c12(0xe8)](_0x903c12(0x108)+_0x35f295[_0x903c12(0xd8)]),0x1;throw _0x35f295;}}}export class WorkflowRunCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:run';[a44_0x322c85(0xe7)]='Start\x20a\x20workflow\x20run';async[a44_0x322c85(0x11d)](_0x26512c){const _0xfe3a0d=a44_0x322c85,{options:_0x3f9a61,args:_0x384cde,tdx:_0x4b2b75}=_0x26512c,_0x3a2683=_0x384cde[0x0];if(!_0x3a2683)return console['error']('Error:\x20Workflow\x20identifier\x20is\x20required'),console['error'](_0xfe3a0d(0xee)),0x1;const _0x2664e9=_0x3f9a61['param'],_0x35a6ce=_0x3f9a61[_0xfe3a0d(0xa1)],_0x3b4771={};if(_0x2664e9&&Array[_0xfe3a0d(0xb6)](_0x2664e9))for(const _0x421c61 of _0x2664e9){const _0x34fb75=_0x421c61[_0xfe3a0d(0xf8)]('=');if(_0x34fb75===-0x1)return console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xfa)+_0x421c61),console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xc2)),0x1;const _0x3b4896=_0x421c61['substring'](0x0,_0x34fb75),_0x232e27=_0x421c61[_0xfe3a0d(0xcf)](_0x34fb75+0x1);try{_0x3b4771[_0x3b4896]=JSON[_0xfe3a0d(0xfd)](_0x232e27);}catch{_0x3b4771[_0x3b4896]=_0x232e27;}}_0x3f9a61['verbose']&&(console['error'](_0xfe3a0d(0xbd)+_0x3a2683),Object[_0xfe3a0d(0xd7)](_0x3b4771)[_0xfe3a0d(0xb0)]>0x0&&console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xb9)+JSON[_0xfe3a0d(0xba)](_0x3b4771)),_0x35a6ce&&console[_0xfe3a0d(0xe8)](_0xfe3a0d(0x137)+_0x35a6ce));const _0x4c08b9=await withSpinner(_0xfe3a0d(0x111),()=>_0x4b2b75[_0xfe3a0d(0x117)][_0xfe3a0d(0x119)](_0x3a2683,_0x3b4771,{'sessionTime':_0x35a6ce}),{'verbose':_0x3f9a61[_0xfe3a0d(0x118)]}),_0x333b1d=_0x4c08b9['data'];return console[_0xfe3a0d(0xe8)](_0xfe3a0d(0x12f)),console['error'](_0xfe3a0d(0xea)+_0x333b1d['id']),console[_0xfe3a0d(0xe8)]('\x20\x20Session\x20ID:\x20'+_0x333b1d[_0xfe3a0d(0x100)]),console[_0xfe3a0d(0xe8)]('\x20\x20Project:\x20'+_0x333b1d['project']?.[_0xfe3a0d(0x10a)]),console[_0xfe3a0d(0xe8)]('\x20\x20Workflow:\x20'+_0x333b1d[_0xfe3a0d(0x117)]?.[_0xfe3a0d(0x10a)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:download';[a44_0x322c85(0xe7)]=a44_0x322c85(0x104);async[a44_0x322c85(0x11d)](_0x2aa2f2){const _0x972b89=a44_0x322c85,{options:_0x3c7a5a,args:_0xaaf384,tdx:_0x2883ff}=_0x2aa2f2,_0x180de5=_0xaaf384[0x0],_0x4e61fe=_0xaaf384[0x1]||'.';if(!_0x180de5)return console[_0x972b89(0xe8)](_0x972b89(0x136)),console[_0x972b89(0xe8)](_0x972b89(0x10b)),0x1;const _0x52358b=_0x3c7a5a['revision'];_0x3c7a5a[_0x972b89(0x118)]&&(console['error']('Project:\x20'+_0x180de5),console[_0x972b89(0xe8)](_0x972b89(0xd9)+_0x4e61fe),_0x52358b&&console[_0x972b89(0xe8)]('Revision:\x20'+_0x52358b));const _0x16a408=await withSpinner('Downloading\x20project\x20'+_0x180de5+_0x972b89(0x10d),()=>_0x2883ff[_0x972b89(0x117)][_0x972b89(0xf7)](_0x180de5,_0x4e61fe,{'revision':_0x52358b}),{'verbose':_0x3c7a5a['verbose']}),_0x450824=_0x16a408[_0x972b89(0xfc)];return console[_0x972b89(0xe8)](_0x972b89(0xec)+_0x450824[_0x972b89(0xa6)]),console['error'](_0x972b89(0x12a)+_0x450824[_0x972b89(0x11f)]),console[_0x972b89(0xe8)](_0x972b89(0xc8)+_0x450824['filesExtracted']),console['error'](_0x972b89(0x9b)+_0x4e61fe+'/'+_0x450824[_0x972b89(0xa6)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0x114);[a44_0x322c85(0xe7)]=a44_0x322c85(0xc7);async['execute'](_0x1d2097){const _0x4195d2=a44_0x322c85,{options:_0x49cfc4,args:_0x8d9631,tdx:_0x426e9d}=_0x1d2097;let _0x422ddc='.',_0x566694=_0x49cfc4[_0x4195d2(0x10a)];if(_0x8d9631[0x0]){const {promises:_0x4c3917}=await import('fs');try{const _0x19fd3e=await _0x4c3917[_0x4195d2(0xa3)](_0x8d9631[0x0]);if(_0x19fd3e['isDirectory']())_0x422ddc=_0x8d9631[0x0];else return console['error'](_0x4195d2(0x10f)+_0x8d9631[0x0]+_0x4195d2(0x11b)),0x1;}catch{_0x566694=_0x8d9631[0x0],_0x422ddc='.';}}const _0x3da80a=_0x49cfc4[_0x4195d2(0x11f)],_0x16a957=_0x49cfc4[_0x4195d2(0x9c)];_0x49cfc4[_0x4195d2(0x118)]&&(console[_0x4195d2(0xe8)](_0x4195d2(0xf6)+_0x422ddc),_0x566694&&console[_0x4195d2(0xe8)]('Project\x20name:\x20'+_0x566694),_0x3da80a&&console[_0x4195d2(0xe8)](_0x4195d2(0xef)+_0x3da80a),_0x16a957&&console[_0x4195d2(0xe8)](_0x4195d2(0x11c)));const _0x295aca=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x426e9d[_0x4195d2(0x117)]['push'](_0x422ddc,{'projectName':_0x566694,'revision':_0x3da80a,'skipValidation':_0x16a957}),{'verbose':_0x49cfc4[_0x4195d2(0x118)]}),_0xd291f9=_0x295aca['data'];return console[_0x4195d2(0xe8)](_0x4195d2(0xf9)+_0xd291f9[_0x4195d2(0xa6)]),console[_0x4195d2(0xe8)](_0x4195d2(0x102)+_0xd291f9['projectId']),console[_0x4195d2(0xe8)](_0x4195d2(0x12a)+_0xd291f9[_0x4195d2(0x11f)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0x110);[a44_0x322c85(0xe7)]=a44_0x322c85(0x103);async[a44_0x322c85(0x11d)](_0x35030d){const _0x35bc39=a44_0x322c85,{options:_0x3f1ecd,args:_0x45069a,tdx:_0x5c8b85}=_0x35030d,_0x109f09=_0x45069a[0x0];if(!_0x109f09)return console[_0x35bc39(0xe8)]('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console['error']('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x3f1ecd[_0x35bc39(0x118)]&&console[_0x35bc39(0xe8)]('Project:\x20'+_0x109f09);if(!_0x3f1ecd[_0x35bc39(0x127)]){const _0x3ce086=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22'+_0x109f09+_0x35bc39(0xa7));if(!_0x3ce086)return console['error'](_0x35bc39(0xa4)),0x0;}const _0x496bf6=await withSpinner(_0x35bc39(0x139)+_0x109f09+_0x35bc39(0x10d),()=>_0x5c8b85[_0x35bc39(0x117)]['delete'](_0x109f09),{'verbose':_0x3f1ecd[_0x35bc39(0x118)]}),_0x4581bf=_0x496bf6[_0x35bc39(0xfc)];return console[_0x35bc39(0xe8)](_0x35bc39(0xf3)+_0x4581bf['projectName']),console[_0x35bc39(0xe8)](_0x35bc39(0x102)+_0x4581bf[_0x35bc39(0x13b)]),0x0;}}function a44_0x20af(){const _0x65cdc0=['Resume\x20from:\x20','✔\x20Workflow\x20run\x20started','Show\x20tasks\x20for\x20an\x20attempt','Listing\x20workflow\x20projects...','List\x20workflows','Filter:\x20','Fetching\x20log\x20files...','session','Error:\x20Project\x20name\x20is\x20required','Session\x20time:\x20','limit','Deleting\x20project\x20','Target:\x20','projectId','List\x20all\x20workflow\x20projects','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Show\x20specific\x20attempt\x20details','attempts','Retry\x20a\x20session\x20or\x20attempt','94ZuzSpP','\x20\x20Location:\x20','skipValidation','workflows','72ziCedG','fromTask','Error:\x20Attempt\x20ID\x20is\x20required','sessionTime','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','stat','Cancelled','List\x20workflow\x20attempts','projectName','\x22?\x20This\x20cannot\x20be\x20undone.','\x20workflow','Getting\x20attempt\x20tasks...','message','project','retrySession','attemptId','projects','2424dyHITP','length','Listing\x20workflow\x20sessions...','round','\x20project','utf-8','\x20\x20Session\x20ID:\x20','isArray','fileSize','task','Parameters:\x20','stringify','tasks','format','Workflow:\x20','Listing\x20workflows...','1304534KaDlvR','Killing\x20attempt...','retryAttemptName','Expected\x20format:\x20--param\x20key=value','json','No\x20log\x20content\x20found','1575130pajnpP','From\x20task:\x20','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','\x20\x20Files\x20extracted:\x20','Downloading\x20logs...','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','sessions','taskName','split','includeRetried','substring','finishedAt','done','workflow:kill','Task\x20name:\x20','✔\x20Found\x20','Including\x20subtasks:\x20yes','Listing\x20workflow\x20attempts...','keys','cause','Output\x20directory:\x20','createdAt','12051ikCVBY','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Pattern:\x20','from','canceling','logFiles','success','reason','workflow:projects','cancelRequested','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','fs/promises','description','error','Show\x20logs\x20for\x20a\x20workflow\x20attempt','\x20\x20Attempt\x20ID:\x20','workflow:logs','✔\x20Downloaded\x20','retryAttempt','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','Revision:\x20','Getting\x20attempt\x20details...','Error:\x20Invalid\x20JSON\x20in\x20--params','workflow:attempt','✔\x20Deleted\x20project\x20','539211QnyscT','running','Project\x20directory:\x20','download','indexOf','✔\x20Pushed\x20','Error:\x20Invalid\x20parameter\x20format:\x20','workflow:retry','data','parse','1070292ltzxbY','Kill\x20a\x20running\x20attempt','sessionId','kill','\x20\x20Project\x20ID:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Retrying\x20attempt...','status','index','\x20\x20Cause:\x20','logs','name','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Attempt\x20ID:\x20','...','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Error:\x20','workflow:delete','Starting\x20workflow\x20run...','Params:\x20','select','workflow:push','Select\x20a\x20task\x20to\x20view\x20logs:','Retrying\x20session...','workflow','verbose','run','resumeFrom','\x20is\x20not\x20a\x20directory','Validation:\x20skipped','execute','Filter:\x20project=','revision','includeSubtasks','Project\x20filter:\x20','✔\x20Retry\x20started','\x20session','\x20task','1285BwyGhy','attempt','yes','getTime','workflow:workflows','\x20\x20Revision:\x20','Force:\x20yes','1016RlixoF','params'];a44_0x20af=function(){return _0x65cdc0;};return a44_0x20af();}
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 a45_0x1324(){const _0xab6711=['18yVnyEH','16373BJyeYD','2vhJInZ','23169JOGdjI','tdx/','entries','363467EoPcyU','0.0.0','75752BNDSBX',';\x20node/','2310820eykjmf','1305135ajjmKb','utf-8','version','length','3228885BXqFrT','X-Trino-User','168NNFYQG','tdx','152TgvHdK','TD1\x20'];a45_0x1324=function(){return _0xab6711;};return a45_0x1324();}(function(_0x525383,_0x3cc27b){const _0x221200=a45_0x37a8,_0x2427bf=_0x525383();while(!![]){try{const _0x293f72=-parseInt(_0x221200(0x12b))/0x1*(-parseInt(_0x221200(0x127))/0x2)+parseInt(_0x221200(0x128))/0x3*(-parseInt(_0x221200(0x123))/0x4)+parseInt(_0x221200(0x11b))/0x5+-parseInt(_0x221200(0x121))/0x6*(parseInt(_0x221200(0x126))/0x7)+-parseInt(_0x221200(0x12d))/0x8*(parseInt(_0x221200(0x125))/0x9)+parseInt(_0x221200(0x12f))/0xa+-parseInt(_0x221200(0x11f))/0xb;if(_0x293f72===_0x3cc27b)break;else _0x2427bf['push'](_0x2427bf['shift']());}catch(_0xe52369){_0x2427bf['push'](_0x2427bf['shift']());}}}(a45_0x1324,0x2cf49));import{platform}from'os';function a45_0x37a8(_0x4c285a,_0x3286d4){_0x4c285a=_0x4c285a-0x11b;const _0x132411=a45_0x1324();let _0x37a87e=_0x132411[_0x4c285a];return _0x37a87e;}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x14a195=a45_0x37a8;try{const _0x596502=fileURLToPath(import.meta.url),_0x2aeb29=dirname(_0x596502),_0x3d912b=join(_0x2aeb29,'../../package.json'),_0x55f57e=JSON['parse'](readFileSync(_0x3d912b,_0x14a195(0x11c)));return _0x55f57e['version'];}catch{return _0x14a195(0x12c);}}export function getUserAgent(){const _0xe873f5=a45_0x37a8,_0x110057=getVersion(),_0x414938=platform(),_0x7d59fc=process[_0xe873f5(0x11d)]['replace']('v','');return _0xe873f5(0x129)+_0x110057+'\x20('+_0x414938+_0xe873f5(0x12e)+_0x7d59fc+')';}export function getAuthHeaders(_0x34ed2c,_0x3181fd){const _0x552c6a=a45_0x37a8,_0x3ff023=getVersion(),_0x25896e={'User-Agent':getUserAgent(),'X-TD-Client':_0x552c6a(0x122),'X-TD-Client-Version':_0x3ff023};return _0x3181fd&&(_0x25896e['Authorization']=_0x552c6a(0x124)+_0x3181fd),_0x25896e;}export function toHeaderRecord(_0x56d42c){const _0x267c73=a45_0x37a8,_0x3ec716={};for(const [_0x1e888e,_0x31547d]of Object[_0x267c73(0x12a)](_0x56d42c)){_0x31547d!==undefined&&(_0x3ec716[_0x1e888e]=_0x31547d);}return _0x3ec716;}export function getTrinoHeaders(_0xddaa33,_0x4d4d5c){const _0x51435f=a45_0x37a8,_0x5b923c=getAuthHeaders(_0xddaa33,_0x4d4d5c),_0x18df6d=toHeaderRecord(_0x5b923c);return delete _0x18df6d['Authorization'],_0x4d4d5c&&(_0x18df6d[_0x51435f(0x120)]=_0x4d4d5c),_0x18df6d;}export function hasAPIKey(_0x4891db){const _0x2eecbf=a45_0x37a8,_0x212095=getAPIKey(_0x4891db);return _0x212095!==undefined&&_0x212095[_0x2eecbf(0x11e)]>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(_0x24938e,_0x6434b2){const _0x216a23=a46_0xab65,_0x31ea4d=_0x24938e();while(!![]){try{const _0x49af49=-parseInt(_0x216a23(0xea))/0x1+-parseInt(_0x216a23(0xf6))/0x2*(parseInt(_0x216a23(0x107))/0x3)+-parseInt(_0x216a23(0xc9))/0x4+-parseInt(_0x216a23(0xc5))/0x5+-parseInt(_0x216a23(0xfc))/0x6+parseInt(_0x216a23(0xca))/0x7*(parseInt(_0x216a23(0xfb))/0x8)+-parseInt(_0x216a23(0xe9))/0x9*(-parseInt(_0x216a23(0xc4))/0xa);if(_0x49af49===_0x6434b2)break;else _0x31ea4d['push'](_0x31ea4d['shift']());}catch(_0x4545ac){_0x31ea4d['push'](_0x31ea4d['shift']());}}}(a46_0x5c57,0xe8cf6));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x43163b from'node:fs';import*as a46_0x36b25d from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';function a46_0x5c57(){const _0x569fb4=['env','account_info.json','some','trim','replace','28085830pCexMa','2867670bGCVgL','ap02','readFileSync','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','2877836CFHmXq','10563QAbAns','split','TD_API_KEY_','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','legacy\x20.env\x20file\x20(profile:\x20','keychain\x20(profile:\x20','keychain','toISOString','warn','toUpperCase','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','filter','entries','parse','account_info.','apiKey','join','.env','site','profiles','eu01','dev-us01','.env.','yellow','match','\x20env\x20var','slice','map','llm_default_project.','Warning:\x20Failed\x20to\x20load\x20','profile','9iAVoqS','1009189AIHsRq','llm_default_agent','us01','TDX_API_KEY','stg-jp01','startsWith','jp01','includes','ap03','TDX_CONFIG_DIR','projectId','Warning:\x20Unknown\x20site\x20\x27','1250xKkbPw','tdx','llm_default_project','stg-ap03','stringify','7808buJMHi','2354820xFoDjC','.cache','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','source','Warning:\x20Failed\x20to\x20read\x20','stg-us01','endsWith','TD_API_KEY','tdx.json','TDX_API_KEY_','utf-8','3039IuJbYp','llm_default_agent.','\x27,\x20defaulting\x20to\x20us01','string','existsSync','legacy\x20.env\x20file','isDeprecated','.json','number'];a46_0x5c57=function(){return _0x569fb4;};return a46_0x5c57();}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a46_0x517804 from'chalk';export function getConfigDir(){const _0x98f778=a46_0xab65;return process[_0x98f778(0xbf)][_0x98f778(0xf3)]||join(homedir(),'.config','tdx');}export function getConfigFile(){const _0x53c0dc=a46_0xab65;return join(getConfigDir(),_0x53c0dc(0xdb));}export function getConfigFilePath(_0x5b5ec3){const _0x304b65=a46_0xab65,_0x5cc7f5=getConfigDir();return _0x5b5ec3?a46_0x36b25d[_0x304b65(0xda)](_0x5cc7f5,_0x304b65(0xe0)+_0x5b5ec3):getConfigFile();}export function getCacheDir(){const _0x3eb4ca=a46_0xab65;return process['env']['TDX_CACHE_DIR']||join(homedir(),_0x3eb4ca(0xfd),_0x3eb4ca(0xf7));}export function getLLMProjectCacheFile(_0x1ea230){const _0x2beae2=a46_0xab65,_0x550a0b=_0x1ea230?_0x2beae2(0xe6)+_0x1ea230:_0x2beae2(0xf8);return join(getCacheDir(),_0x550a0b);}export function readCachedLLMProject(_0x2346f6){const _0x23b47d=a46_0xab65;try{const _0x56ec6c=getLLMProjectCacheFile(_0x2346f6);if(!existsSync(_0x56ec6c))return null;const _0x3b2833=readFileSync(_0x56ec6c,'utf-8')['trim']();try{const _0x48bb49=JSON['parse'](_0x3b2833);if(_0x48bb49&&typeof _0x48bb49['id']===_0x23b47d(0x10a)&&typeof _0x48bb49['name']==='string')return _0x48bb49;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x596c10,_0x514dd0,_0x52a4ff){const _0x22a743=a46_0xab65;try{const _0x4e986c=getCacheDir(),_0x2e3893=getLLMProjectCacheFile(_0x52a4ff);!existsSync(_0x4e986c)&&mkdirSync(_0x4e986c,{'recursive':!![]});const _0x5d9d82={'name':_0x596c10,'id':_0x514dd0};writeFileSync(_0x2e3893,JSON[_0x22a743(0xfa)](_0x5d9d82),_0x22a743(0x106));}catch{}}export function getLLMAgentCacheFile(_0x3e2065){const _0x23736b=a46_0xab65,_0xa024b2=_0x3e2065?_0x23736b(0x108)+_0x3e2065:_0x23736b(0xeb);return join(getCacheDir(),_0xa024b2);}export function readCachedLLMAgent(_0x55cf1f){const _0x4164f8=a46_0xab65;try{const _0x260d23=getLLMAgentCacheFile(_0x55cf1f);if(!existsSync(_0x260d23))return null;const _0x2a5ec1=readFileSync(_0x260d23,'utf-8')[_0x4164f8(0xc2)]();try{const _0x2b8205=JSON[_0x4164f8(0xd7)](_0x2a5ec1);if(_0x2b8205&&typeof _0x2b8205['id']==='string'&&typeof _0x2b8205['name']===_0x4164f8(0x10a)&&typeof _0x2b8205[_0x4164f8(0xf4)]===_0x4164f8(0x10a))return _0x2b8205;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x4de545,_0x21c4f6,_0x5eb5a8,_0x14fa85){const _0x152e78=a46_0xab65;try{const _0x1057c4=getCacheDir(),_0x4ce514=getLLMAgentCacheFile(_0x14fa85);!existsSync(_0x1057c4)&&mkdirSync(_0x1057c4,{'recursive':!![]});const _0xa40750={'name':_0x4de545,'id':_0x21c4f6,'projectId':_0x5eb5a8};writeFileSync(_0x4ce514,JSON['stringify'](_0xa40750),_0x152e78(0x106));}catch{}}export function clearCachedLLMAgent(_0x5c8d55){try{const _0x1c7a8e=getLLMAgentCacheFile(_0x5c8d55);existsSync(_0x1c7a8e)&&unlinkSync(_0x1c7a8e);}catch{}}export function getAccountInfoCacheFile(_0x405ae9){const _0xb5a210=a46_0xab65,_0x52baa8=_0x405ae9?_0xb5a210(0xd8)+_0x405ae9+_0xb5a210(0x10e):_0xb5a210(0xc0);return join(getCacheDir(),_0x52baa8);}export function readCachedAccountInfo(_0x73c302){const _0x2109ee=a46_0xab65;try{const _0xc26e2d=getAccountInfoCacheFile(_0x73c302);if(!existsSync(_0xc26e2d))return null;const _0x511712=readFileSync(_0xc26e2d,'utf-8')[_0x2109ee(0xc2)](),_0x5b866a=JSON[_0x2109ee(0xd7)](_0x511712);if(_0x5b866a&&typeof _0x5b866a[_0x2109ee(0xdc)]===_0x2109ee(0x10a)&&typeof _0x5b866a['accountId']===_0x2109ee(0x10f))return _0x5b866a;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x3e4de5,_0x254cd3,_0x4bf2d5){const _0x4c413f=a46_0xab65;try{const _0x59e5b9=getCacheDir(),_0x25e1b8=getAccountInfoCacheFile(_0x4bf2d5);!existsSync(_0x59e5b9)&&mkdirSync(_0x59e5b9,{'recursive':!![]});const _0xfdbc1a={'site':_0x3e4de5,'accountId':_0x254cd3,'cachedAt':new Date()[_0x4c413f(0xd1)]()};writeFileSync(_0x25e1b8,JSON[_0x4c413f(0xfa)](_0xfdbc1a),'utf-8');}catch{}}export function parseEnvFile(_0x5dfdf8){const _0x44654d=a46_0xab65,_0x1da87f={};for(const _0x22efb8 of _0x5dfdf8['split']('\x0a')){const _0x3e3828=_0x22efb8[_0x44654d(0xc2)]();if(!_0x3e3828||_0x3e3828['startsWith']('#'))continue;const _0x62d246=_0x3e3828[_0x44654d(0xe2)](/^([^=]+)=(.*)$/);if(_0x62d246){const _0x3c1563=_0x62d246[0x1][_0x44654d(0xc2)]();let _0x3a8af4=_0x62d246[0x2]['trim']();(_0x3a8af4[_0x44654d(0xef)]('\x22')&&_0x3a8af4['endsWith']('\x22')||_0x3a8af4['startsWith']('\x27')&&_0x3a8af4[_0x44654d(0x102)]('\x27'))&&(_0x3a8af4=_0x3a8af4[_0x44654d(0xe4)](0x1,-0x1)),_0x1da87f[_0x3c1563]=_0x3a8af4;}}return _0x1da87f;}export function readUserConfig(){const _0x1f3d04=a46_0xab65,_0x459fff=getConfigFile();if(!existsSync(_0x459fff))return{};try{const _0x361799=readFileSync(_0x459fff,'utf-8');return parseEnvFile(_0x361799);}catch(_0x52a46d){return console[_0x1f3d04(0xd2)](_0x1f3d04(0xc8)+_0x459fff+':',_0x52a46d),{};}}export function resolveSite(_0x585389){const _0x34ff85=a46_0xab65,_0x58a309=[_0x34ff85(0xec),_0x34ff85(0xf0),_0x34ff85(0xde),_0x34ff85(0xc6),_0x34ff85(0xf2),_0x34ff85(0xdf),'dev-eu01',_0x34ff85(0x101),_0x34ff85(0xee),'stg-ap03'];if(_0x58a309[_0x34ff85(0xf1)](_0x585389))return _0x585389;if(_0x585389 in SITE_ALIASES)return SITE_ALIASES[_0x585389];return console[_0x34ff85(0xd2)](_0x34ff85(0xf5)+_0x585389+_0x34ff85(0x109)),_0x34ff85(0xec);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2f83e8,_0x4ba6a5){const _0x248dcb=a46_0xab65,_0x20d45e=_0x4ba6a5||getActiveProfileName();if(_0x20d45e){const _0x15338b='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x20d45e);if(process['env'][_0x15338b])return process[_0x248dcb(0xbf)][_0x15338b];}if(process[_0x248dcb(0xbf)][_0x248dcb(0xed)])return process['env'][_0x248dcb(0xed)];if(process[_0x248dcb(0xbf)][_0x248dcb(0x103)])return process[_0x248dcb(0xbf)][_0x248dcb(0x103)];const _0x4b2326=_0x2f83e8[_0x248dcb(0xd3)]()[_0x248dcb(0xc3)](/-/g,'_'),_0x498f97=_0x248dcb(0xcc)+_0x4b2326;if(_0x20d45e){const _0x2fc2d8=loadProfileEnv(_0x20d45e);if(_0x2fc2d8){if(_0x2fc2d8[_0x498f97])return _0x2fc2d8[_0x498f97];if(_0x2fc2d8[_0x248dcb(0x103)])return _0x2fc2d8['TD_API_KEY'];}}const _0x437d32=loadUserConfigOnce();if(_0x437d32[_0x498f97])return _0x437d32[_0x498f97];if(_0x437d32[_0x248dcb(0x103)])return _0x437d32[_0x248dcb(0x103)];return undefined;}export function normalizeProfileForEnvVar(_0x23f7c0){const _0x4e1cd8=a46_0xab65;return _0x23f7c0['toUpperCase']()[_0x4e1cd8(0xc3)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x4460a0,_0x49b95d){const _0x449ee7=a46_0xab65,_0x29ccf5=_0x49b95d||getActiveProfileName()||undefined;if(_0x29ccf5){const _0x550816=_0x449ee7(0x105)+normalizeProfileForEnvVar(_0x29ccf5);if(process[_0x449ee7(0xbf)][_0x550816])return{'apiKey':process[_0x449ee7(0xbf)][_0x550816],'source':_0x550816+_0x449ee7(0xe3),'isDeprecated':![]};const _0x346294=getCachedCredential(_0x4460a0,_0x29ccf5);if(_0x346294)return{'apiKey':_0x346294,'source':_0x449ee7(0xcf)+_0x29ccf5+')','isDeprecated':![]};const _0x2bdb4d=await getKeychainAPIKey(_0x29ccf5);if(_0x2bdb4d)return setCachedCredential(_0x2bdb4d,_0x4460a0,_0x29ccf5),{'apiKey':_0x2bdb4d,'source':_0x449ee7(0xcf)+_0x29ccf5+')','isDeprecated':![]};}if(process[_0x449ee7(0xbf)][_0x449ee7(0xed)])return{'apiKey':process[_0x449ee7(0xbf)][_0x449ee7(0xed)],'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x29ccf5){const _0x381523=getCachedCredential(_0x4460a0,undefined);if(_0x381523)return{'apiKey':_0x381523,'source':_0x449ee7(0xd0),'isDeprecated':![]};const _0x393cd3=await getKeychainAPIKey(undefined);if(_0x393cd3)return setCachedCredential(_0x393cd3,_0x4460a0,undefined),{'apiKey':_0x393cd3,'source':_0x449ee7(0xd0),'isDeprecated':![]};}if(process[_0x449ee7(0xbf)]['TD_API_KEY'])return{'apiKey':process[_0x449ee7(0xbf)][_0x449ee7(0x103)],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x35013c=getLegacyEnvAPIKey(_0x4460a0,_0x29ccf5);if(_0x35013c){const _0xe5274e=await isKeychainAvailable();if(_0xe5274e)try{await saveKeychainAPIKey(_0x35013c,_0x29ccf5),setCachedCredential(_0x35013c,_0x4460a0,_0x29ccf5);const _0x57253f=getConfigFilePath(_0x29ccf5);cleanupLegacyEnvFile(_0x57253f)&&console[_0x449ee7(0xd2)](a46_0x517804[_0x449ee7(0xe1)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x5dd7db){console[_0x449ee7(0xd2)](a46_0x517804[_0x449ee7(0xe1)](_0x449ee7(0xcd)+_0x5dd7db));}const _0x402f2a=_0x29ccf5?_0x449ee7(0xce)+_0x29ccf5+')':_0x449ee7(0x10c);return{'apiKey':_0x35013c,'source':_0x402f2a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x558591,_0x1313ab,_0x48a576=!![]){const _0x3e6448=a46_0xab65,_0x43cde9=await resolveAPIKeyAsync(_0x558591,_0x1313ab);if(!_0x43cde9)return undefined;if(_0x48a576&&_0x43cde9[_0x3e6448(0x10d)]&&_0x43cde9[_0x3e6448(0xff)][_0x3e6448(0xf1)]('TD_API_KEY')){const _0x3862ec=_0x1313ab||getActiveProfileName()||undefined,_0x54647b=_0x3862ec?_0x3e6448(0x105)+normalizeProfileForEnvVar(_0x3862ec):'TDX_API_KEY_<PROFILE>';console[_0x3e6448(0xd2)](a46_0x517804[_0x3e6448(0xe1)](_0x3e6448(0xfe)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x54647b+').')));}return _0x43cde9[_0x3e6448(0xd9)];}function getLegacyEnvAPIKey(_0x4ca193,_0x4a122e){const _0x435f3a=a46_0xab65,_0x3d211c=_0x4ca193['toUpperCase']()[_0x435f3a(0xc3)](/-/g,'_'),_0xffe9e0='TD_API_KEY_'+_0x3d211c;if(_0x4a122e){const _0x387814=loadProfileEnv(_0x4a122e);if(_0x387814){if(_0x387814[_0xffe9e0])return _0x387814[_0xffe9e0];if(_0x387814['TD_API_KEY'])return _0x387814['TD_API_KEY'];}}const _0x3eebd3=loadUserConfigOnce();if(_0x3eebd3[_0xffe9e0])return _0x3eebd3[_0xffe9e0];if(_0x3eebd3[_0x435f3a(0x103)])return _0x3eebd3[_0x435f3a(0x103)];return undefined;}function cleanupLegacyEnvFile(_0x570d13){const _0x2f2b2f=a46_0xab65;if(!existsSync(_0x570d13))return![];try{const _0x31b443=readFileSync(_0x570d13,_0x2f2b2f(0x106)),_0x470d3f=_0x31b443[_0x2f2b2f(0xcb)]('\x0a'),_0x263b1d=_0x470d3f[_0x2f2b2f(0xd5)](_0x54abf9=>{const _0x1004e3=_0x2f2b2f,_0x12ba3e=_0x54abf9['trim']();if(!_0x12ba3e||_0x12ba3e[_0x1004e3(0xef)]('#'))return!![];const [_0x113a0c]=_0x12ba3e[_0x1004e3(0xcb)]('=');return!_0x113a0c['startsWith'](_0x1004e3(0x103));}),_0x315d2d=_0x263b1d[_0x2f2b2f(0xc1)](_0x258de2=>{const _0x2e80f1=_0x2f2b2f,_0x55eb4f=_0x258de2[_0x2e80f1(0xc2)]();return _0x55eb4f&&!_0x55eb4f['startsWith']('#');});if(!_0x315d2d)return unlinkSync(_0x570d13),!![];return writeFileSync(_0x570d13,_0x263b1d['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x503e9b){const _0xa25bbd=a46_0xab65,_0x5790f1=a46_0x36b25d[_0xa25bbd(0xda)](getConfigDir(),_0xa25bbd(0xe0)+_0x503e9b);if(a46_0x43163b['existsSync'](_0x5790f1)){validateSecureFilePermissions(_0x5790f1);try{const _0x18198d=a46_0x43163b[_0xa25bbd(0xc7)](_0x5790f1,_0xa25bbd(0x106));return parseEnvFile(_0x18198d);}catch(_0x20323e){console['warn'](_0xa25bbd(0xe7)+_0x5790f1+':\x20'+_0x20323e);}}const _0x276b71=a46_0x36b25d[_0xa25bbd(0xda)](getConfigDir(),_0xa25bbd(0xdd),_0x503e9b,_0xa25bbd(0xdb));if(a46_0x43163b[_0xa25bbd(0x10b)](_0x276b71)){validateSecureFilePermissions(_0x276b71);try{const _0x3d6018=a46_0x43163b['readFileSync'](_0x276b71,_0xa25bbd(0x106));return parseEnvFile(_0x3d6018);}catch(_0x147fde){return console[_0xa25bbd(0xd2)](_0xa25bbd(0xe7)+_0x276b71+':\x20'+_0x147fde),null;}}return null;}function getActiveProfileName(){const _0x3e0582=a46_0xab65,_0x4c79fa=a46_0x36b25d[_0x3e0582(0xda)](getConfigDir(),_0x3e0582(0x104));if(!a46_0x43163b['existsSync'](_0x4c79fa))return null;try{const _0x23466f=a46_0x43163b['readFileSync'](_0x4c79fa,_0x3e0582(0x106)),_0x5bf7bd=JSON[_0x3e0582(0xd7)](_0x23466f);return _0x5bf7bd[_0x3e0582(0xe8)]||null;}catch{return null;}}export function saveAPIKey(_0x4dcb,_0xe90d77,_0x340d8e){const _0x14ca68=a46_0xab65,_0x30498c=getConfigDir(),_0x1b4db5=getConfigFilePath(_0x340d8e);!existsSync(_0x30498c)&&mkdirSync(_0x30498c,{'recursive':!![],'mode':0x1c0});let _0x3c9605={};if(existsSync(_0x1b4db5))try{const _0x6186e7=readFileSync(_0x1b4db5,'utf-8');_0x3c9605=parseEnvFile(_0x6186e7);}catch(_0xf93c81){console[_0x14ca68(0xd2)](_0x14ca68(0x100)+_0x1b4db5+':',_0xf93c81);}const _0xa53132=_0x4dcb[_0x14ca68(0xd3)]()[_0x14ca68(0xc3)](/-/g,'_');_0x3c9605[_0x14ca68(0xcc)+_0xa53132]=_0xe90d77;const _0x1bca46=Object[_0x14ca68(0xd6)](_0x3c9605)[_0x14ca68(0xe5)](([_0x77cad8,_0x3fa959])=>_0x77cad8+'='+_0x3fa959);writeFileSync(_0x1b4db5,_0x1bca46['join']('\x0a')+'\x0a',{'mode':0x180});}function a46_0xab65(_0x5b18c5,_0x59b94b){_0x5b18c5=_0x5b18c5-0xbf;const _0x5c57bb=a46_0x5c57();let _0xab6555=_0x5c57bb[_0x5b18c5];return _0xab6555;}export async function saveAPIKeyAsync(_0x7631a1,_0x29b015,_0x5edf98){const _0x3dcd4b=a46_0xab65;await saveKeychainAPIKey(_0x7631a1,_0x5edf98),setCachedCredential(_0x7631a1,_0x29b015,_0x5edf98);const _0x16bd0b=getConfigFilePath(_0x5edf98);cleanupLegacyEnvFile(_0x16bd0b)&&console[_0x3dcd4b(0xd2)](a46_0x517804[_0x3dcd4b(0xe1)](_0x3dcd4b(0xd4)));}export function loadConfig(){const _0x5f08f2=a46_0xab65,_0x257491={'apiKeys':{},'defaultSite':_0x5f08f2(0xec)},_0x58a731=[_0x5f08f2(0xec),_0x5f08f2(0xf0),_0x5f08f2(0xde),_0x5f08f2(0xc6),'ap03',_0x5f08f2(0xdf),'dev-eu01',_0x5f08f2(0x101),_0x5f08f2(0xee),_0x5f08f2(0xf9)];for(const _0x43df5e of _0x58a731){const _0x17c652=getAPIKey(_0x43df5e);_0x17c652&&(_0x257491['apiKeys'][_0x43df5e]=_0x17c652);}return _0x257491;}
@@ -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(_0x26a686,_0x1d27a9){const _0xac5aa6=a47_0x505a,_0x27a042=_0x26a686();while(!![]){try{const _0x44c7ca=parseInt(_0xac5aa6(0x1d1))/0x1*(parseInt(_0xac5aa6(0x1c7))/0x2)+parseInt(_0xac5aa6(0x1cd))/0x3*(-parseInt(_0xac5aa6(0x1c5))/0x4)+parseInt(_0xac5aa6(0x1ce))/0x5*(-parseInt(_0xac5aa6(0x1cb))/0x6)+-parseInt(_0xac5aa6(0x1ca))/0x7+parseInt(_0xac5aa6(0x1c4))/0x8+-parseInt(_0xac5aa6(0x1d0))/0x9*(parseInt(_0xac5aa6(0x1c1))/0xa)+-parseInt(_0xac5aa6(0x1c2))/0xb*(-parseInt(_0xac5aa6(0x1cf))/0xc);if(_0x44c7ca===_0x1d27a9)break;else _0x27a042['push'](_0x27a042['shift']());}catch(_0x16ddbb){_0x27a042['push'](_0x27a042['shift']());}}}(a47_0x52bf,0xf05bf));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x1a83c2){const _0x6f7cf4=a47_0x505a,_0x374fb7=_0x1a83c2||_0x6f7cf4(0x1c8);return join(getCacheDir(),_0x6f7cf4(0x1cc)+_0x374fb7+_0x6f7cf4(0x1c9));}function a47_0x505a(_0x155826,_0x24d6a5){_0x155826=_0x155826-0x1c0;const _0x52bfa7=a47_0x52bf();let _0x505a39=_0x52bfa7[_0x155826];return _0x505a39;}export function loadCachedConnections(_0x412a9a){const _0x1e9661=a47_0x505a,_0x2a0829=getCacheFilePath(_0x412a9a);if(!existsSync(_0x2a0829))return null;try{const _0x1b883b=readFileSync(_0x2a0829,_0x1e9661(0x1c3)),_0x1f1701=JSON['parse'](_0x1b883b);return _0x1f1701['connections'];}catch{return null;}}function a47_0x52bf(){const _0x38d307=['41672tNZCZK','now','914INycPe','default','.json','13454441kPxxnf','54mVARHy','connections-','147fGnCoP','1084970TJxeaL','912yMkPLU','608274cicpzm','2998UQvvPv','stringify','230hYSsne','745525xcgPEW','utf-8','3227952pZvwPr'];a47_0x52bf=function(){return _0x38d307;};return a47_0x52bf();}export function saveCachedConnections(_0x349c0d,_0x2b489a){const _0x3a6723=a47_0x505a,_0x1a3694=getCacheDir();!existsSync(_0x1a3694)&&mkdirSync(_0x1a3694,{'recursive':!![]});const _0x49d38b=getCacheFilePath(_0x349c0d),_0x239ba3={'connections':_0x2b489a,'cachedAt':Date[_0x3a6723(0x1c6)]()};writeFileSync(_0x49d38b,JSON[_0x3a6723(0x1c0)](_0x239ba3,null,0x2),_0x3a6723(0x1c3));}export function clearConnectionCache(_0x2cae05){const _0x1f1167=getCacheFilePath(_0x2cae05);if(existsSync(_0x1f1167))try{unlinkSync(_0x1f1167);}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 a48_0xba91(_0xff3b33,_0x452fb2){_0xff3b33=_0xff3b33-0x1cf;const _0x595f20=a48_0x595f();let _0xba9125=_0x595f20[_0xff3b33];return _0xba9125;}(function(_0x121877,_0x424e23){const _0x11d691=a48_0xba91,_0xb4342c=_0x121877();while(!![]){try{const _0x20a720=-parseInt(_0x11d691(0x1cf))/0x1*(parseInt(_0x11d691(0x1da))/0x2)+-parseInt(_0x11d691(0x1d0))/0x3*(-parseInt(_0x11d691(0x1d2))/0x4)+-parseInt(_0x11d691(0x1dd))/0x5+-parseInt(_0x11d691(0x1d5))/0x6+parseInt(_0x11d691(0x1d7))/0x7+parseInt(_0x11d691(0x1de))/0x8+-parseInt(_0x11d691(0x1db))/0x9*(parseInt(_0x11d691(0x1d4))/0xa);if(_0x20a720===_0x424e23)break;else _0xb4342c['push'](_0xb4342c['shift']());}catch(_0x17eaa4){_0xb4342c['push'](_0xb4342c['shift']());}}}(a48_0x595f,0xab205));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x462798,_0x574c69){const _0x197e8d=a48_0xba91,_0xbb7708=_0x462798||_0x197e8d(0x1d9),_0x332c47=_0x574c69||_0x197e8d(0x1d6);return _0xbb7708+':'+_0x332c47;}export function getCachedCredential(_0x51cad0,_0x260b98){const _0x2c5e4d=a48_0xba91,_0x156057=getCacheKey(_0x51cad0,_0x260b98),_0x4b12d9=cache[_0x2c5e4d(0x1df)](_0x156057);if(!_0x4b12d9)return null;if(Date['now']()-_0x4b12d9['loadedAt']>CACHE_TTL_MS)return cache['delete'](_0x156057),null;return _0x4b12d9[_0x2c5e4d(0x1d8)];}function a48_0x595f(){const _0x8640d1=['now','4xZArcZ','set','620OQjsGp','5991366WWgaCl','__default_profile__','3254216zMBxlA','apiKey','__default_site__','2QdinFu','14823ZoSoLt','clear','370420xQYffz','10641864AxWrmx','get','176306CoaxKk','770631oBDMzG'];a48_0x595f=function(){return _0x8640d1;};return a48_0x595f();}export function setCachedCredential(_0x51f1ad,_0x4279cb,_0x472c72){const _0x2e77a2=a48_0xba91,_0x20b2f7=getCacheKey(_0x4279cb,_0x472c72);cache[_0x2e77a2(0x1d3)](_0x20b2f7,{'apiKey':_0x51f1ad,'loadedAt':Date[_0x2e77a2(0x1d1)]()});}export function clearCredentialCache(){const _0x18728d=a48_0xba91;cache[_0x18728d(0x1dc)]();}export function clearCachedCredential(_0x53fa2e,_0x10af4d){const _0x3e7036=getCacheKey(_0x53fa2e,_0x10af4d);cache['delete'](_0x3e7036);}
@@ -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_0x964417=a49_0x1e4e;function a49_0x28b8(){const _0x3c5a9b=['llmProject','llm_project','llm_agent','\x0a[configuration\x20files]','config','loadGlobalConfig',':\x20none','injectIntoOptions','1640949JlduPj','entries','apiKey','log','(active)','35248oPHBrk','not\x20set','parentSegment','3015uhUtsL','3047655KRMfRV','displayWithSources','Session','createAsync','display','globalCredentials','verbose','parse','1576468aFHfSR','.env','database','440610EsyWMQ','join','project','.json','activeProfile','4307898wpyiHV','session','getSource','readFileSync','tdx.json','resolveAPIKeyAsync','[context]','11083QxKYOl','replace','Global\x20Credentials','parent_segment','Project','existsSync','toString','Profile\x20Credentials','profileCredentials','utf-8','layers','(session:\x20','site','default','profile','2RVfSEi','segment_path','us01','logLevel','INFO','profile:\x20','global','cliFlags','profiles','Global',':\x20none\x20(using\x20session:\x20','configFiles','sessionId','llmAgent','getParameters'];a49_0x28b8=function(){return _0x3c5a9b;};return a49_0x28b8();}(function(_0x735d77,_0x4b6dbd){const _0x2f46d0=a49_0x1e4e,_0x43f4e5=_0x735d77();while(!![]){try{const _0x1fc7c4=parseInt(_0x2f46d0(0x142))/0x1+parseInt(_0x2f46d0(0x10b))/0x2*(parseInt(_0x2f46d0(0x122))/0x3)+-parseInt(_0x2f46d0(0x133))/0x4+-parseInt(_0x2f46d0(0x12b))/0x5+-parseInt(_0x2f46d0(0x136))/0x6+-parseInt(_0x2f46d0(0x13b))/0x7+-parseInt(_0x2f46d0(0x127))/0x8*(-parseInt(_0x2f46d0(0x12a))/0x9);if(_0x1fc7c4===_0x4b6dbd)break;else _0x43f4e5['push'](_0x43f4e5['shift']());}catch(_0x175db5){_0x43f4e5['push'](_0x43f4e5['shift']());}}}(a49_0x28b8,0x5364b));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';import*as a49_0x1ce6a7 from'node:fs';function a49_0x1e4e(_0x3d4c35,_0x393e66){_0x3d4c35=_0x3d4c35-0x101;const _0x28b8a5=a49_0x28b8();let _0x1e4e59=_0x28b8a5[_0x3d4c35];return _0x1e4e59;}import*as a49_0x377a3d from'node:path';export class GlobalContext{[a49_0x964417(0x108)];['database'];[a49_0x964417(0x145)];[a49_0x964417(0x10c)];['llm_project'];['llm_agent'];['apiKey'];[a49_0x964417(0x131)];[a49_0x964417(0x10e)];[a49_0x964417(0x10a)];[a49_0x964417(0x106)];[a49_0x964417(0x13a)];[a49_0x964417(0x117)];[a49_0x964417(0x116)];constructor(_0x47e438){const _0x425500=a49_0x964417;this[_0x425500(0x117)]=_0x47e438[_0x425500(0x13c)]||getCurrentSessionPID()[_0x425500(0x102)]();const _0x141fec=loadSessionContext(_0x47e438[_0x425500(0x13c)]),_0x3db8e7=loadProjectConfig(),_0x5e5d7c=this[_0x425500(0x11f)]();this[_0x425500(0x13a)]=_0x47e438['profile']||_0x141fec?.['profile']||_0x5e5d7c[_0x425500(0x10a)]||getActiveProfile();const _0x44da8a=this['activeProfile']?loadProfile(this[_0x425500(0x13a)]):null,_0x3f5803=_0x255327=>{const _0x26c6eb=_0x425500;if(!_0x255327)return{};const _0x4074f0=_0x255327,_0x1c71c0={};for(const [_0x432ea6,_0x24c4e2]of Object[_0x26c6eb(0x123)](_0x4074f0)){typeof _0x24c4e2==='string'&&(_0x1c71c0[_0x432ea6]=_0x24c4e2);}return _0x1c71c0;},_0x1f26fb={};if(_0x47e438[_0x425500(0x108)]&&_0x47e438[_0x425500(0x108)]!==_0x425500(0x10d))_0x1f26fb[_0x425500(0x108)]=_0x47e438['site'];const _0x1abc06=_0x141fec?.['database'],_0x5785ad=_0x3db8e7?.[_0x425500(0x135)],_0x5486c9=_0x44da8a?.[_0x425500(0x11e)]?.[_0x425500(0x135)],_0x74b1ce=_0x5e5d7c[_0x425500(0x135)];_0x47e438[_0x425500(0x135)]&&(_0x47e438['database']!==_0x1abc06&&_0x47e438[_0x425500(0x135)]!==_0x5785ad&&_0x47e438[_0x425500(0x135)]!==_0x5486c9&&_0x47e438['database']!==_0x74b1ce)&&(_0x1f26fb[_0x425500(0x135)]=_0x47e438[_0x425500(0x135)]);if(_0x47e438['parentSegment'])_0x1f26fb['parent_segment']=_0x47e438['parentSegment'];if(_0x47e438[_0x425500(0x11a)])_0x1f26fb[_0x425500(0x11b)]=_0x47e438[_0x425500(0x11a)];if(_0x47e438['llmAgent'])_0x1f26fb[_0x425500(0x11c)]=_0x47e438['llmAgent'];if(_0x47e438[_0x425500(0x10a)])_0x1f26fb[_0x425500(0x10a)]=_0x47e438['profile'];this[_0x425500(0x106)]={'cliFlags':_0x1f26fb,'session':_0x3f5803(_0x141fec),'project':_0x3f5803(_0x3db8e7),'profile':_0x3f5803(_0x44da8a?.[_0x425500(0x11e)]),'global':_0x3f5803(_0x5e5d7c)};const _0xd83663={...this['layers']['global'],...this[_0x425500(0x106)][_0x425500(0x10a)],...this[_0x425500(0x106)][_0x425500(0x138)],...this['layers'][_0x425500(0x13c)],...this[_0x425500(0x106)][_0x425500(0x112)]},_0x1c7513=_0xd83663[_0x425500(0x108)]||_0x425500(0x10d);this['site']=resolveSite(_0x1c7513),this[_0x425500(0x135)]=_0xd83663[_0x425500(0x135)],this[_0x425500(0x145)]=_0xd83663[_0x425500(0x145)],this[_0x425500(0x10c)]=_0xd83663[_0x425500(0x10c)],this[_0x425500(0x11b)]=_0xd83663['llm_project'],this['llm_agent']=_0xd83663['llm_agent'],this[_0x425500(0x131)]=_0x47e438[_0x425500(0x131)]||![],this[_0x425500(0x10e)]=_0x47e438[_0x425500(0x10e)]??LogLevel[_0x425500(0x10f)],this[_0x425500(0x10a)]=this[_0x425500(0x13a)]||undefined,this[_0x425500(0x124)]=getAPIKey(this[_0x425500(0x108)],this[_0x425500(0x13a)]||undefined);const _0x93c0f7=getConfigDir(),_0xe0e42=a49_0x377a3d['join'](_0x93c0f7,'sessions',this[_0x425500(0x117)]+_0x425500(0x139)),_0x44a3cc=findProjectConfigPath(),_0x5da1fd=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x13f)),_0x377626=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x134));let _0x3b50d8=null,_0x506683=null;this[_0x425500(0x13a)]&&(_0x3b50d8=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x113),this[_0x425500(0x13a)],_0x425500(0x13f)),_0x506683=a49_0x377a3d['join'](_0x93c0f7,'profiles',this[_0x425500(0x13a)],_0x425500(0x134))),this[_0x425500(0x116)]={'session':a49_0x1ce6a7[_0x425500(0x101)](_0xe0e42)?_0xe0e42:null,'project':_0x44a3cc,'profile':_0x3b50d8&&a49_0x1ce6a7['existsSync'](_0x3b50d8)?_0x3b50d8:null,'profileCredentials':_0x506683&&a49_0x1ce6a7['existsSync'](_0x506683)?_0x506683:null,'global':a49_0x1ce6a7['existsSync'](_0x5da1fd)?_0x5da1fd:null,'globalCredentials':a49_0x1ce6a7[_0x425500(0x101)](_0x377626)?_0x377626:null};}[a49_0x964417(0x13d)](_0xaa3b78,_0x5460e5){const _0x281b64=a49_0x964417;if(!_0x5460e5)return _0x281b64(0x128);const _0x4642c9=_0x5460e5;if(this[_0x281b64(0x106)]['cliFlags'][_0xaa3b78]===_0x4642c9){if(_0xaa3b78===_0x281b64(0x108)&&_0x4642c9==='us01'&&!this[_0x281b64(0x106)]['session'][_0x281b64(0x108)]&&!this['layers'][_0x281b64(0x138)][_0x281b64(0x108)]&&!this[_0x281b64(0x106)][_0x281b64(0x10a)][_0x281b64(0x108)]&&!this[_0x281b64(0x106)][_0x281b64(0x111)]['site'])return'default';return'CLI\x20flag:\x20--'+_0xaa3b78[_0x281b64(0x143)](/_/g,'-');}if(this['layers'][_0x281b64(0x13c)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x13c);if(this[_0x281b64(0x106)][_0x281b64(0x138)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x138);if(this['layers'][_0x281b64(0x10a)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x110)+this['activeProfile'];if(this[_0x281b64(0x106)]['global'][_0xaa3b78]===_0x4642c9)return _0x281b64(0x111);return _0x281b64(0x109);}['loadGlobalConfig'](){const _0x2d2a16=a49_0x964417,_0x4fc9bd=a49_0x377a3d[_0x2d2a16(0x137)](getConfigDir(),_0x2d2a16(0x13f));if(!a49_0x1ce6a7[_0x2d2a16(0x101)](_0x4fc9bd))return{};try{const _0x11a2df=a49_0x1ce6a7[_0x2d2a16(0x13e)](_0x4fc9bd,_0x2d2a16(0x105));return JSON[_0x2d2a16(0x132)](_0x11a2df);}catch{return{};}}[a49_0x964417(0x121)](_0xa1245b){const _0x149553=a49_0x964417;_0xa1245b['site']=this[_0x149553(0x108)],!_0xa1245b[_0x149553(0x135)]&&this[_0x149553(0x135)]&&(_0xa1245b['database']=this[_0x149553(0x135)]),!_0xa1245b[_0x149553(0x129)]&&this[_0x149553(0x145)]&&(_0xa1245b[_0x149553(0x129)]=this[_0x149553(0x145)]),!_0xa1245b['segmentPath']&&this[_0x149553(0x10c)]&&(_0xa1245b['segmentPath']=this[_0x149553(0x10c)]),!_0xa1245b[_0x149553(0x11a)]&&this[_0x149553(0x11b)]&&(_0xa1245b[_0x149553(0x11a)]=this[_0x149553(0x11b)]),!_0xa1245b[_0x149553(0x118)]&&this[_0x149553(0x11c)]&&(_0xa1245b[_0x149553(0x118)]=this[_0x149553(0x11c)]);}[a49_0x964417(0x119)](){const _0x596509=a49_0x964417;return[{'key':_0x596509(0x108),'value':this['site']},{'key':_0x596509(0x135),'value':this[_0x596509(0x135)]},{'key':_0x596509(0x145),'value':this[_0x596509(0x145)]},{'key':_0x596509(0x10c),'value':this['segment_path']},{'key':_0x596509(0x11b),'value':this[_0x596509(0x11b)]},{'key':_0x596509(0x11c),'value':this[_0x596509(0x11c)]},{'key':_0x596509(0x10a),'value':this['activeProfile']||undefined}];}[a49_0x964417(0x12f)](){const _0x29c776=a49_0x964417;console[_0x29c776(0x125)](_0x29c776(0x141));for(const {key:_0x4f6ec7,value:_0x88a193}of this['getParameters']()){_0x88a193&&console[_0x29c776(0x125)](_0x4f6ec7+':\x20'+_0x88a193);}}[a49_0x964417(0x12c)](){const _0x7c6ef8=a49_0x964417;console[_0x7c6ef8(0x125)](_0x7c6ef8(0x141));for(const {key:_0x24b562,value:_0x5daac1}of this[_0x7c6ef8(0x119)]()){if(_0x5daac1){const _0x5b42cc=_0x24b562===_0x7c6ef8(0x10a)?_0x7c6ef8(0x126):'('+this[_0x7c6ef8(0x13d)](_0x24b562,_0x5daac1)+')';console[_0x7c6ef8(0x125)](_0x24b562+':\x20'+_0x5daac1+'\x20'+_0x5b42cc);}}console[_0x7c6ef8(0x125)](_0x7c6ef8(0x11d));const _0x1688f8=[{'label':_0x7c6ef8(0x12d),'path':this[_0x7c6ef8(0x116)]['session'],'extra':_0x7c6ef8(0x107)+this[_0x7c6ef8(0x117)]+')'},{'label':_0x7c6ef8(0x146),'path':this[_0x7c6ef8(0x116)]['project']},{'label':'Profile','path':this['configFiles']['profile']},{'label':_0x7c6ef8(0x103),'path':this['configFiles'][_0x7c6ef8(0x104)]},{'label':_0x7c6ef8(0x114),'path':this[_0x7c6ef8(0x116)][_0x7c6ef8(0x111)]},{'label':_0x7c6ef8(0x144),'path':this['configFiles'][_0x7c6ef8(0x130)]}];for(const {label:_0x96bccf,path:_0x4ddfa0,extra:_0x8fc033}of _0x1688f8){if(_0x4ddfa0)console[_0x7c6ef8(0x125)](_0x96bccf+':\x20'+_0x4ddfa0+'\x20✓'+(_0x8fc033?'\x20'+_0x8fc033:''));else{if(_0x96bccf===_0x7c6ef8(0x12d))console['log'](_0x96bccf+_0x7c6ef8(0x115)+this[_0x7c6ef8(0x117)]+')');else(_0x96bccf===_0x7c6ef8(0x146)||_0x96bccf===_0x7c6ef8(0x114))&&console[_0x7c6ef8(0x125)](_0x96bccf+_0x7c6ef8(0x120));}}}async[a49_0x964417(0x140)](){const _0x17573f=a49_0x964417;return this[_0x17573f(0x124)]=await getAPIKeyAsync(this[_0x17573f(0x108)],this[_0x17573f(0x13a)]||undefined),this[_0x17573f(0x124)];}static async[a49_0x964417(0x12e)](_0x13212e){const _0x16a883=a49_0x964417,_0x26e8bf=new GlobalContext(_0x13212e);return await _0x26e8bf[_0x16a883(0x140)](),_0x26e8bf;}}
@@ -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
+ (function(_0x3192f9,_0x12ed95){const _0x2f7eda=a50_0x2823,_0x10ccc8=_0x3192f9();while(!![]){try{const _0x447b5f=parseInt(_0x2f7eda(0x18d))/0x1*(-parseInt(_0x2f7eda(0x191))/0x2)+parseInt(_0x2f7eda(0x19b))/0x3*(parseInt(_0x2f7eda(0x187))/0x4)+-parseInt(_0x2f7eda(0x17f))/0x5*(-parseInt(_0x2f7eda(0x181))/0x6)+-parseInt(_0x2f7eda(0x18a))/0x7+-parseInt(_0x2f7eda(0x19f))/0x8*(parseInt(_0x2f7eda(0x185))/0x9)+parseInt(_0x2f7eda(0x180))/0xa*(-parseInt(_0x2f7eda(0x183))/0xb)+parseInt(_0x2f7eda(0x18b))/0xc;if(_0x447b5f===_0x12ed95)break;else _0x10ccc8['push'](_0x10ccc8['shift']());}catch(_0x1dab50){_0x10ccc8['push'](_0x10ccc8['shift']());}}}(a50_0x29ee,0x71b06));function a50_0x2823(_0x48243d,_0x395ef5){_0x48243d=_0x48243d-0x17e;const _0x29eeae=a50_0x29ee();let _0x28234a=_0x29eeae[_0x48243d];return _0x28234a;}const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x112ae9=a50_0x2823;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x40e0f8=await import(_0x112ae9(0x186));return keyringModule=_0x40e0f8[_0x112ae9(0x1a4)],keyringModule;}catch(_0x782a66){return keyringLoadError=_0x782a66 instanceof Error?_0x782a66:new Error(String(_0x782a66)),null;}}function a50_0x29ee(){const _0x282ee7=['could\x20not\x20be\x20found','message','8xkGMyk','not\x20supported','restricted','not\x20found','reason','keyring','__keychain_test__','6410fCDfJh','120CPCabm','2286eIJcBT','value','691856JWETXW',':api_key','6039261ImYXIm','@zowe/secrets-for-zowe-sdk','20svNurM','deletePassword','toLowerCase','168882WWLeeD','17214972jErcdJ','profile:','19TXuxzu','cannot\x20find','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.','success','49598JESSPu','access_denied','getPassword','unavailable','-25293','error','includes','setPassword','access','System\x20keychain\x20is\x20not\x20available','278241kzpNkR','not_found'];a50_0x29ee=function(){return _0x282ee7;};return a50_0x29ee();}function getAccountName(_0x42a311){const _0x14cfa0=a50_0x2823,_0x4d184a=_0x42a311||'';return _0x14cfa0(0x18c)+_0x4d184a+_0x14cfa0(0x184);}export async function getKeychainAPIKey(_0x1d57ec){const _0x1d389d=a50_0x2823,_0x213f7e=await getKeychainAPIKeyWithStatus(_0x1d57ec);if(_0x213f7e[_0x1d389d(0x190)])return _0x213f7e[_0x1d389d(0x182)];return _0x213f7e[_0x1d389d(0x1a3)]===_0x1d389d(0x192)&&console[_0x1d389d(0x196)]('Warning:\x20'+_0x213f7e['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x552d22){const _0x27e225=a50_0x2823;try{const _0x25d01f=await getKeyring();if(!_0x25d01f)return{'success':![],'reason':'unavailable'};const _0x3dc11d=getAccountName(_0x552d22),_0x4486c8=await _0x25d01f['getPassword'](SERVICE_NAME,_0x3dc11d);if(_0x4486c8)return{'success':!![],'value':_0x4486c8};return{'success':![],'reason':'not_found'};}catch(_0x182536){const _0x4c6958=_0x182536 instanceof Error?_0x182536[_0x27e225(0x19e)]:String(_0x182536);if(_0x4c6958['includes']('-25300')||_0x4c6958[_0x27e225(0x189)]()[_0x27e225(0x197)](_0x27e225(0x19d))||_0x4c6958['toLowerCase']()[_0x27e225(0x197)](_0x27e225(0x1a2)))return{'success':![],'reason':_0x27e225(0x19c)};if(_0x4c6958['includes'](_0x27e225(0x195))||_0x4c6958[_0x27e225(0x189)]()[_0x27e225(0x197)](_0x27e225(0x1a1))||_0x4c6958['toLowerCase']()[_0x27e225(0x197)](_0x27e225(0x199)))return{'success':![],'reason':_0x27e225(0x192),'message':_0x27e225(0x18f)};return{'success':![],'reason':_0x27e225(0x194),'message':_0x4c6958};}}export async function saveKeychainAPIKey(_0x30555d,_0x5b9b52){const _0x5886dd=a50_0x2823,_0x3532cd=await getKeyring();if(!_0x3532cd)throw new Error(_0x5886dd(0x19a));const _0x5c783a=getAccountName(_0x5b9b52);await _0x3532cd[_0x5886dd(0x198)](SERVICE_NAME,_0x5c783a,_0x30555d);}export async function deleteKeychainAPIKey(_0x53d3ff){const _0x109176=a50_0x2823;try{const _0x5c5341=await getKeyring();if(!_0x5c5341)return![];const _0x508bc8=getAccountName(_0x53d3ff);return await _0x5c5341[_0x109176(0x188)](SERVICE_NAME,_0x508bc8);}catch{return![];}}export async function isKeychainAvailable(){const _0x1e3571=a50_0x2823;try{const _0x11480d=await getKeyring();if(!_0x11480d)return![];return await _0x11480d[_0x1e3571(0x193)](SERVICE_NAME,_0x1e3571(0x17e)),!![];}catch(_0x55b2e2){const _0x3600d0=_0x55b2e2 instanceof Error?_0x55b2e2[_0x1e3571(0x19e)][_0x1e3571(0x189)]():'';if(_0x3600d0[_0x1e3571(0x197)]('not\x20available')||_0x3600d0[_0x1e3571(0x197)](_0x1e3571(0x1a0))||_0x3600d0[_0x1e3571(0x197)](_0x1e3571(0x18e)))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(_0x1e49a4,_0x26a21e){const _0xb6230f=a51_0x706e,_0x29ed23=_0x1e49a4();while(!![]){try{const _0xc91a1a=-parseInt(_0xb6230f(0x173))/0x1+parseInt(_0xb6230f(0x189))/0x2+parseInt(_0xb6230f(0x18a))/0x3+-parseInt(_0xb6230f(0x174))/0x4+parseInt(_0xb6230f(0x167))/0x5*(parseInt(_0xb6230f(0x164))/0x6)+-parseInt(_0xb6230f(0x169))/0x7*(parseInt(_0xb6230f(0x15d))/0x8)+parseInt(_0xb6230f(0x19d))/0x9;if(_0xc91a1a===_0x26a21e)break;else _0x29ed23['push'](_0x29ed23['shift']());}catch(_0x34ba67){_0x29ed23['push'](_0x29ed23['shift']());}}}(a51_0x5028,0x8099c));import*as a51_0x14df1a from'node:fs';import*as a51_0x268f27 from'node:path';import{getConfigDir}from'./config.js';function a51_0x706e(_0x2671fb,_0x14862d){_0x2671fb=_0x2671fb-0x156;const _0x50282c=a51_0x5028();let _0x706e9c=_0x50282c[_0x2671fb];return _0x706e9c;}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x131742){const _0x4c1bd5=a51_0x706e,_0x39550c={};if(!_0x131742)return _0x39550c;for(const [_0xeda854,_0x240f09]of Object[_0x4c1bd5(0x197)](_0x131742)){_0xeda854!==_0x4c1bd5(0x172)&&_0x240f09!==undefined&&(_0x39550c[_0xeda854]=_0x240f09);}return _0x39550c;}export function getProfilesDir(){const _0x2275fb=a51_0x706e;return a51_0x268f27['join'](getConfigDir(),_0x2275fb(0x15a));}function getProfileDir(_0x50e213){return a51_0x268f27['join'](getProfilesDir(),_0x50e213);}function getProfileConfigPath(_0x4a6974){const _0x3bad2c=a51_0x706e;return a51_0x268f27[_0x3bad2c(0x176)](getProfileDir(_0x4a6974),_0x3bad2c(0x178));}function getProfileEnvPath(_0x425249){const _0x2390de=a51_0x706e;return a51_0x268f27[_0x2390de(0x176)](getProfileDir(_0x425249),_0x2390de(0x198));}function getGlobalConfigPath(){const _0xc5b422=a51_0x706e;return a51_0x268f27[_0xc5b422(0x176)](getConfigDir(),_0xc5b422(0x178));}function validateProfileName(_0x1bd8b3){const _0x10831b=a51_0x706e;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x1bd8b3))throw new Error(_0x10831b(0x17b)+_0x1bd8b3+_0x10831b(0x156));}function validateProfileConfig(_0x3de453,_0x578ec2){const _0x22cd50=a51_0x706e;if(typeof _0x3de453!==_0x22cd50(0x192)||_0x3de453===null)throw new Error('Profile\x20\x27'+_0x578ec2+_0x22cd50(0x16b));const _0x22f1b2=[_0x22cd50(0x172),_0x22cd50(0x186),_0x22cd50(0x15c),_0x22cd50(0x17c),_0x22cd50(0x17f),'llm_agent'],_0x434295=_0x3de453;for(const _0xfed396 of Object[_0x22cd50(0x158)](_0x434295)){!_0x22f1b2[_0x22cd50(0x180)](_0xfed396)&&console[_0x22cd50(0x171)](_0x22cd50(0x170)+_0x578ec2+_0x22cd50(0x19a)+_0xfed396+'\x27\x20will\x20be\x20ignored');}if(_0x434295[_0x22cd50(0x172)]!==undefined&&typeof _0x434295[_0x22cd50(0x172)]!=='string')throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x194));if(_0x434295[_0x22cd50(0x186)]!==undefined&&typeof _0x434295['site']!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x181));if(_0x434295['database']!==undefined&&typeof _0x434295[_0x22cd50(0x15c)]!=='string')throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x15b));if(_0x434295[_0x22cd50(0x17c)]!==undefined&&typeof _0x434295[_0x22cd50(0x17c)]!==_0x22cd50(0x199))throw new Error('Profile\x20\x27'+_0x578ec2+_0x22cd50(0x160));if(_0x434295['llm_project']!==undefined&&typeof _0x434295[_0x22cd50(0x17f)]!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x19c));if(_0x434295[_0x22cd50(0x157)]!==undefined&&typeof _0x434295[_0x22cd50(0x157)]!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x185));return!![];}function loadProfilesFromTdxJson(_0x4614b7,_0x13f6df){const _0x290279=a51_0x706e;if(!a51_0x14df1a['existsSync'](_0x4614b7))return[];try{const _0x3b2dfe=a51_0x14df1a['readFileSync'](_0x4614b7,_0x290279(0x17d)),_0x22544c=JSON[_0x290279(0x18e)](_0x3b2dfe);if(!_0x22544c[_0x290279(0x15a)]||typeof _0x22544c[_0x290279(0x15a)]!==_0x290279(0x192))return[];const _0x48354f=[];for(const [_0x5a0a1c,_0x3795e3]of Object[_0x290279(0x197)](_0x22544c[_0x290279(0x15a)])){try{validateProfileConfig(_0x3795e3,_0x5a0a1c);const _0x1e30df=getNewCredentialPath(_0x5a0a1c),_0x212359=getOldCredentialPath(_0x5a0a1c),_0x52c17e=a51_0x14df1a[_0x290279(0x175)](_0x1e30df)||a51_0x14df1a[_0x290279(0x175)](_0x212359);_0x48354f[_0x290279(0x179)]({'name':_0x5a0a1c,'config':_0x3795e3,'metadata':{'name':_0x5a0a1c,'createdAt':new Date()[_0x290279(0x17a)]()},'hasCredentials':_0x52c17e,'scope':_0x13f6df});}catch(_0x20ac00){_0x20ac00 instanceof Error&&(console['warn'](_0x290279(0x19b)+_0x4614b7+':'),console[_0x290279(0x171)]('\x20\x20'+_0x20ac00['message']+'\x0a'));}}return _0x48354f;}catch(_0x182139){return _0x182139 instanceof SyntaxError?(console[_0x290279(0x171)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x4614b7+_0x290279(0x16d)),console[_0x290279(0x171)](_0x290279(0x18d)+_0x182139[_0x290279(0x165)]+'\x0a')):console[_0x290279(0x171)](_0x290279(0x196)+_0x4614b7+':\x20'+_0x182139+'\x0a'),[];}}export function getNewCredentialPath(_0x3d6d66){const _0x518fa5=a51_0x706e;return a51_0x268f27[_0x518fa5(0x176)](getConfigDir(),'.env.'+_0x3d6d66);}function getOldCredentialPath(_0x557ba9){const _0x3e7869=a51_0x706e;return a51_0x268f27[_0x3e7869(0x176)](getProfilesDir(),_0x557ba9,_0x3e7869(0x198));}function a51_0x5028(){const _0x4dea8d=['set','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','entries','.env','string','\x27:\x20unknown\x20config\x20key\x20\x27','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','13798296yNavTZ','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','llm_agent','keys','stringify','profiles','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','database','8zyxvvT','length','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','some','\x20does\x20not\x20exist','name','6RiNqTu','message','from','1530040Vzeipe','\x20\x201.\x20Edit:\x20','4275663TZYXJL','Profile\x20\x27','\x27:\x20config\x20must\x20be\x20an\x20object','find',':\x20Invalid\x20JSON\x20syntax','Profile\x20','isDirectory','Warning:\x20Profile\x20\x27','warn','description','826063ZDrhjL','3565164ceCYzJ','existsSync','join','readFileSync','tdx.json','push','toISOString','Invalid\x20profile\x20name:\x20','parent_segment','utf-8','values','llm_project','includes','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','directory','filter','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','site','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','profile','1666736gQYuHU','547173aTIoTh','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','map','Error:\x20','parse','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','localeCompare','\x20\x20mv\x20\x22','object',',\x20creating\x20new\x20file','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string'];a51_0x5028=function(){return _0x4dea8d;};return a51_0x5028();}function loadProfilesFromTdxJsonFiles(){const _0x496ea8=a51_0x706e,_0x41ea2b=[],_0x3c04fd=findProjectConfigPath();_0x3c04fd&&_0x41ea2b[_0x496ea8(0x179)](...loadProfilesFromTdxJson(_0x3c04fd,'local'));const _0x5c30fa=a51_0x268f27[_0x496ea8(0x176)](getConfigDir(),_0x496ea8(0x178));return _0x41ea2b[_0x496ea8(0x179)](...loadProfilesFromTdxJson(_0x5c30fa,'user')),_0x41ea2b;}function loadProfilesFromDirectories(){const _0x4afdfe=a51_0x706e,_0xef0494=getProfilesDir();if(!a51_0x14df1a['existsSync'](_0xef0494))return[];try{return a51_0x14df1a['readdirSync'](_0xef0494,{'withFileTypes':!![]})[_0x4afdfe(0x184)](_0x44e5e3=>_0x44e5e3[_0x4afdfe(0x16f)]())[_0x4afdfe(0x18c)](_0x5cae48=>_0x5cae48['name'])['filter'](_0x2505d4=>{const _0xefe896=_0x4afdfe,_0x45c2c8=getProfileConfigPath(_0x2505d4),_0x596fce=getProfileEnvPath(_0x2505d4);return a51_0x14df1a[_0xefe896(0x175)](_0x45c2c8)||a51_0x14df1a[_0xefe896(0x175)](_0x596fce);})[_0x4afdfe(0x18c)](_0xb1a361=>{const _0x2f7532=_0x4afdfe,_0x36f762=loadProfileFromDirectory(_0xb1a361);if(_0x36f762)return{..._0x36f762,'scope':_0x2f7532(0x183)};return null;})['filter'](_0x5c260d=>_0x5c260d!==null);}catch{return[];}}function loadProfileFromDirectory(_0x56454c){const _0x3c798f=a51_0x706e,_0x577cc2=getProfileConfigPath(_0x56454c),_0x3a6268=getOldCredentialPath(_0x56454c);if(!a51_0x14df1a[_0x3c798f(0x175)](_0x577cc2)&&!a51_0x14df1a[_0x3c798f(0x175)](_0x3a6268))return null;let _0x3038d0={},_0x3babd7={'name':_0x56454c,'createdAt':new Date()[_0x3c798f(0x17a)]()};if(a51_0x14df1a[_0x3c798f(0x175)](_0x577cc2))try{const _0x22061b=a51_0x14df1a[_0x3c798f(0x177)](_0x577cc2,_0x3c798f(0x17d)),_0x2d7850=JSON[_0x3c798f(0x18e)](_0x22061b),{metadata:_0x10ec9b,..._0x2c88f1}=_0x2d7850;_0x3038d0=_0x2c88f1,_0x10ec9b&&(_0x3babd7=_0x10ec9b);}catch{}return{'name':_0x56454c,'config':_0x3038d0,'metadata':_0x3babd7,'hasCredentials':a51_0x14df1a['existsSync'](_0x3a6268),'scope':_0x3c798f(0x183)};}export function listProfiles(){const _0x19c023=a51_0x706e,_0x2c1ffd=loadProfilesFromTdxJsonFiles(),_0x9478bf=loadProfilesFromDirectories();if(_0x9478bf[_0x19c023(0x15e)]>0x0){const _0x1df6bd=_0x9478bf[_0x19c023(0x18c)](_0x5f001a=>_0x5f001a[_0x19c023(0x163)])['join'](',\x20'),_0xaf7c40=getConfigDir();console[_0x19c023(0x171)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x1df6bd),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x19c023(0x171)](_0x19c023(0x168)+a51_0x268f27[_0x19c023(0x176)](_0xaf7c40,_0x19c023(0x178))),console[_0x19c023(0x171)](_0x19c023(0x18f)),console[_0x19c023(0x171)](_0x19c023(0x187));}const _0x853066=[..._0x2c1ffd,..._0x9478bf],_0x1fa03f=new Map();for(const _0xc439b2 of _0x853066){!_0x1fa03f['has'](_0xc439b2[_0x19c023(0x163)])&&_0x1fa03f[_0x19c023(0x195)](_0xc439b2[_0x19c023(0x163)],_0xc439b2);}return Array[_0x19c023(0x166)](_0x1fa03f[_0x19c023(0x17e)]())['sort']((_0x5e4281,_0x37443b)=>_0x5e4281[_0x19c023(0x163)][_0x19c023(0x190)](_0x37443b[_0x19c023(0x163)]));}export function profileExists(_0x40dbab){const _0x1640ec=a51_0x706e,_0x194cea=listProfiles();return _0x194cea[_0x1640ec(0x161)](_0x5a94dc=>_0x5a94dc[_0x1640ec(0x163)]===_0x40dbab);}export function loadProfile(_0x57d39c){const _0x12358b=a51_0x706e;validateProfileName(_0x57d39c);const _0x139d76=listProfiles(),_0x43b28e=_0x139d76[_0x12358b(0x16c)](_0x214710=>_0x214710[_0x12358b(0x163)]===_0x57d39c);return _0x43b28e||null;}export function saveProfile(_0x5a64f7,_0x1dcea7,_0x31ba3c=![]){saveProfileToUserConfig(_0x5a64f7,_0x1dcea7);}export function deleteProfile(_0x749683){const _0x2e83a7=a51_0x706e;validateProfileName(_0x749683);const _0x3333af=getProfileDir(_0x749683);if(!a51_0x14df1a['existsSync'](_0x3333af))throw new Error(_0x2e83a7(0x16e)+_0x749683+_0x2e83a7(0x162));a51_0x14df1a['rmSync'](_0x3333af,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x3fa8a8,_0x876f86){const _0x281ba3=a51_0x706e;validateProfileName(_0x3fa8a8);const _0x1fdcb2=getGlobalConfigPath(),_0x54f9fc=getConfigDir();!a51_0x14df1a[_0x281ba3(0x175)](_0x54f9fc)&&createSecureDirectory(_0x54f9fc);let _0x483a24={};if(a51_0x14df1a['existsSync'](_0x1fdcb2))try{const _0x1f9a77=a51_0x14df1a[_0x281ba3(0x177)](_0x1fdcb2,_0x281ba3(0x17d));_0x483a24=JSON[_0x281ba3(0x18e)](_0x1f9a77);}catch{console[_0x281ba3(0x171)](_0x281ba3(0x182)+_0x1fdcb2+_0x281ba3(0x193));}!_0x483a24[_0x281ba3(0x15a)]&&(_0x483a24['profiles']={}),_0x483a24['profiles'][_0x3fa8a8]=_0x876f86,writeSecureFile(_0x1fdcb2,JSON[_0x281ba3(0x159)](_0x483a24,null,0x2));}export function getActiveProfile(){const _0x99ae80=a51_0x706e,_0x5365a3=loadSessionContext();if(_0x5365a3?.[_0x99ae80(0x188)])return _0x5365a3['profile'];const _0x496311=getGlobalConfigPath();if(!a51_0x14df1a[_0x99ae80(0x175)](_0x496311))return null;try{const _0x723492=a51_0x14df1a['readFileSync'](_0x496311,_0x99ae80(0x17d)),_0x24691c=JSON[_0x99ae80(0x18e)](_0x723492);return _0x24691c[_0x99ae80(0x188)]||null;}catch{return null;}}export function createProfile(_0x113834,_0x1886c5){const _0x123d03=a51_0x706e;validateProfileName(_0x113834);if(profileExists(_0x113834))throw new Error(_0x123d03(0x16e)+_0x113834+'\x20already\x20exists');saveProfile(_0x113834,_0x1886c5);}export function saveProfileCredentials(_0x59a5a1,_0x3a54e3){const _0x432ca8=a51_0x706e;validateProfileName(_0x59a5a1);if(!profileExists(_0x59a5a1))throw new Error(_0x432ca8(0x16e)+_0x59a5a1+_0x432ca8(0x162));const _0x45af11=getNewCredentialPath(_0x59a5a1);writeSecureFile(_0x45af11,_0x3a54e3);}export function loadProfileCredentials(_0x355336){const _0x30be96=a51_0x706e;validateProfileName(_0x355336);const _0x10845f=getNewCredentialPath(_0x355336);if(a51_0x14df1a[_0x30be96(0x175)](_0x10845f))try{return a51_0x14df1a[_0x30be96(0x177)](_0x10845f,_0x30be96(0x17d));}catch{}const _0x5bb120=getOldCredentialPath(_0x355336);if(a51_0x14df1a['existsSync'](_0x5bb120)){console[_0x30be96(0x171)](_0x30be96(0x15f)+_0x355336+'\x27'),console[_0x30be96(0x171)]('To\x20migrate:'),console['warn'](_0x30be96(0x191)+_0x5bb120+'\x22\x20\x22'+_0x10845f+'\x22'),console['warn'](_0x30be96(0x18b));try{return a51_0x14df1a[_0x30be96(0x177)](_0x5bb120,_0x30be96(0x17d));}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_0x5898e9=a52_0x2907;(function(_0x5886ff,_0x3c8d5f){const _0x2b6d12=a52_0x2907,_0xb4ec3c=_0x5886ff();while(!![]){try{const _0xbaccc3=-parseInt(_0x2b6d12(0xcf))/0x1*(parseInt(_0x2b6d12(0xc9))/0x2)+-parseInt(_0x2b6d12(0xd8))/0x3*(parseInt(_0x2b6d12(0xbf))/0x4)+-parseInt(_0x2b6d12(0xdb))/0x5*(-parseInt(_0x2b6d12(0xc7))/0x6)+-parseInt(_0x2b6d12(0xc5))/0x7+parseInt(_0x2b6d12(0xd2))/0x8+parseInt(_0x2b6d12(0xcb))/0x9+parseInt(_0x2b6d12(0xdc))/0xa;if(_0xbaccc3===_0x3c8d5f)break;else _0xb4ec3c['push'](_0xb4ec3c['shift']());}catch(_0x4e6cb6){_0xb4ec3c['push'](_0xb4ec3c['shift']());}}}(a52_0x25c3,0x29a77));import*as a52_0x493e07 from'node:fs';import*as a52_0xd30da9 from'node:path';function a52_0x25c3(){const _0x5e1b51=['writeFileSync','2574cqcwXD','existsSync','7206aacbQM','warn','1811511GJZzmx','Warning:\x20\x27profile\x27\x20field\x20in\x20','TD_API_KEY','cwd','31IWTcqM','readFileSync','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','1778904baCsoJ','api_key','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','apiKey','stringify','tdx.json','607323xyQDju','\x20is\x20ignored.\x20','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','1275jLrfHz','1142830oGuzGo','ENOENT','code','Failed\x20to\x20load\x20project\x20config\x20from\x20','profile','utf-8','4MsifMm','dirname','join','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','includes',').\x20','1137997oBHdvl'];a52_0x25c3=function(){return _0x5e1b51;};return a52_0x25c3();}const PROJECT_CONFIG_FILENAME=a52_0x5898e9(0xd7);export function findProjectConfigPath(_0x17dfeb){const _0x32932b=a52_0x5898e9;let _0x4db346=_0x17dfeb||process[_0x32932b(0xce)]();while(!![]){const _0x2f8ca9=a52_0xd30da9['join'](_0x4db346,PROJECT_CONFIG_FILENAME);if(a52_0x493e07[_0x32932b(0xc8)](_0x2f8ca9))return _0x2f8ca9;const _0x1d12df=a52_0xd30da9[_0x32932b(0xc0)](_0x4db346);if(_0x1d12df===_0x4db346)return null;_0x4db346=_0x1d12df;}}export function loadProjectConfig(_0x3d9a10){const _0x5ec375=a52_0x5898e9,_0x1fc706=findProjectConfigPath(_0x3d9a10);if(!_0x1fc706)return null;try{const _0x407b3e=a52_0x493e07[_0x5ec375(0xd0)](_0x1fc706,_0x5ec375(0xe1)),_0xaf9b5c=JSON['parse'](_0x407b3e),_0x337138=JSON[_0x5ec375(0xd6)](_0xaf9b5c);if(_0x337138[_0x5ec375(0xc3)](_0x5ec375(0xcd))||_0x337138[_0x5ec375(0xc3)]('apiKey')||_0x337138[_0x5ec375(0xc3)](_0x5ec375(0xd3)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x1fc706+_0x5ec375(0xc4)+_0x5ec375(0xd1));const {metadata:_0x5e79e8,profile:_0xcea814,..._0x1e50a6}=_0xaf9b5c;return _0xcea814&&console[_0x5ec375(0xca)](_0x5ec375(0xcc)+_0x1fc706+_0x5ec375(0xd9)+_0x5ec375(0xc2)),_0x1e50a6;}catch(_0x3d5823){if(_0x3d5823 instanceof Error&&'code'in _0x3d5823&&_0x3d5823[_0x5ec375(0xde)]===_0x5ec375(0xdd))return null;throw new Error(_0x5ec375(0xdf)+_0x1fc706+':\x20'+_0x3d5823);}}function a52_0x2907(_0x585aad,_0x48e275){_0x585aad=_0x585aad-0xbf;const _0x25c3cd=a52_0x25c3();let _0x2907ed=_0x25c3cd[_0x585aad];return _0x2907ed;}export function saveProjectConfig(_0xabdeb1,_0x10aa6b){const _0x431dd6=a52_0x5898e9,_0x41df02=_0x10aa6b||process[_0x431dd6(0xce)](),_0x18d571=a52_0xd30da9[_0x431dd6(0xc1)](_0x41df02,PROJECT_CONFIG_FILENAME),_0x2ac2a8=JSON[_0x431dd6(0xd6)](_0xabdeb1);if(_0x2ac2a8[_0x431dd6(0xc3)]('TD_API_KEY')||_0x2ac2a8[_0x431dd6(0xc3)](_0x431dd6(0xd5))||_0x2ac2a8[_0x431dd6(0xc3)](_0x431dd6(0xd3)))throw new Error(_0x431dd6(0xd4));if(_0x431dd6(0xe0)in _0xabdeb1)throw new Error(_0x431dd6(0xda));a52_0x493e07[_0x431dd6(0xc6)](_0x18d571,JSON['stringify'](_0xabdeb1,null,0x2));}export function hasProjectConfig(_0x4d5a98){return findProjectConfigPath(_0x4d5a98)!==null;}export function getProjectRoot(_0x359552){const _0xf64bc=a52_0x5898e9,_0x2c54b7=findProjectConfigPath(_0x359552);return _0x2c54b7?a52_0xd30da9[_0xf64bc(0xc0)](_0x2c54b7):null;}