@treasuredata/tdx 2026.3.54 → 2026.3.55

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 (254) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.d.ts.map +1 -1
  9. package/dist/commands/agent-command.js +1 -1
  10. package/dist/commands/agent-command.js.map +1 -1
  11. package/dist/commands/agent-test-command.js +1 -1
  12. package/dist/commands/api-command.js +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/cas-command.js +1 -1
  15. package/dist/commands/cas-segment-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.js +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/connection-command.js +1 -1
  22. package/dist/commands/databases.js +1 -1
  23. package/dist/commands/delivery-command.js +1 -1
  24. package/dist/commands/describe.js +1 -1
  25. package/dist/commands/engage-campaign-pull-command.js +1 -1
  26. package/dist/commands/engage-campaign-push-command.js +1 -1
  27. package/dist/commands/engage-campaign-validate-command.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/engage-template-pull-command.js +1 -1
  30. package/dist/commands/engage-template-push-command.js +1 -1
  31. package/dist/commands/engage-template-validate-command.js +1 -1
  32. package/dist/commands/job-command.js +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/journey-validate-command.js +1 -1
  35. package/dist/commands/llm-command.js +1 -1
  36. package/dist/commands/mcp-command.js +1 -1
  37. package/dist/commands/parent-segment-command.js +1 -1
  38. package/dist/commands/policy-command.js +1 -1
  39. package/dist/commands/profile-command.js +1 -1
  40. package/dist/commands/profiles-command.js +1 -1
  41. package/dist/commands/query-command.js +1 -1
  42. package/dist/commands/schedule-command.js +1 -1
  43. package/dist/commands/segment-command.js +1 -1
  44. package/dist/commands/segment-create-command.js +1 -1
  45. package/dist/commands/segment-fields-command.js +1 -1
  46. package/dist/commands/segment-pull-command.js +1 -1
  47. package/dist/commands/segment-push-command.js +1 -1
  48. package/dist/commands/segment-update-command.js +1 -1
  49. package/dist/commands/segment-use-command.js +1 -1
  50. package/dist/commands/segment-validate-command.js +1 -1
  51. package/dist/commands/segments.js +1 -1
  52. package/dist/commands/show.js +1 -1
  53. package/dist/commands/status-command.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/unset-command.js +1 -1
  56. package/dist/commands/upgrade-command.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/work-command.js +1 -1
  60. package/dist/commands/workflow-command.d.ts +27 -0
  61. package/dist/commands/workflow-command.d.ts.map +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/commands/workflow-command.js.map +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.js +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/tools/work-create-item.js +1 -1
  85. package/dist/mcp/utils.js +1 -1
  86. package/dist/proxy/claude-usage-tracker.js +1 -1
  87. package/dist/proxy/passthrough-server.js +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.d.ts +10 -0
  90. package/dist/sdk/agent/agent-config.d.ts.map +1 -1
  91. package/dist/sdk/agent/agent-config.js +1 -1
  92. package/dist/sdk/agent/agent-config.js.map +1 -1
  93. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  94. package/dist/sdk/agent/agent-yaml.d.ts +61 -3
  95. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  96. package/dist/sdk/agent/agent-yaml.js +1 -1
  97. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  98. package/dist/sdk/agent/test/evaluator.js +1 -1
  99. package/dist/sdk/agent/test/executor.js +1 -1
  100. package/dist/sdk/agent/test/index.js +1 -1
  101. package/dist/sdk/agent/test/output.js +1 -1
  102. package/dist/sdk/agent/test/parser.js +1 -1
  103. package/dist/sdk/agent/tool-target-registry.js +1 -1
  104. package/dist/sdk/agent/types/agent-def.d.ts +43 -0
  105. package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
  106. package/dist/sdk/api.js +1 -1
  107. package/dist/sdk/cas/cas-api-client.js +1 -1
  108. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  109. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  110. package/dist/sdk/cas/index.js +1 -1
  111. package/dist/sdk/cas/pull-workflow.js +1 -1
  112. package/dist/sdk/cas/push-workflow.js +1 -1
  113. package/dist/sdk/client/cdp-api-client.js +1 -1
  114. package/dist/sdk/client/delivery-api-client.js +1 -1
  115. package/dist/sdk/client/endpoints.js +1 -1
  116. package/dist/sdk/client/engage-api-client.js +1 -1
  117. package/dist/sdk/client/http-client.js +1 -1
  118. package/dist/sdk/client/llm-api-client.d.ts +73 -1
  119. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  120. package/dist/sdk/client/llm-api-client.js +1 -1
  121. package/dist/sdk/client/llm-api-client.js.map +1 -1
  122. package/dist/sdk/client/oauth-refresh.js +1 -1
  123. package/dist/sdk/client/rate-limiter.js +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/trino-api-client.js +1 -1
  126. package/dist/sdk/client/workflow-client.d.ts +28 -1
  127. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  128. package/dist/sdk/client/workflow-client.js +1 -1
  129. package/dist/sdk/client/workflow-client.js.map +1 -1
  130. package/dist/sdk/connection-validator.js +1 -1
  131. package/dist/sdk/connection.js +1 -1
  132. package/dist/sdk/delivery.js +1 -1
  133. package/dist/sdk/engage/campaign-pull.js +1 -1
  134. package/dist/sdk/engage/campaign-push.js +1 -1
  135. package/dist/sdk/engage/campaign-validator.js +1 -1
  136. package/dist/sdk/engage/campaign-yaml.js +1 -1
  137. package/dist/sdk/engage/template-pull.js +1 -1
  138. package/dist/sdk/engage/template-push.js +1 -1
  139. package/dist/sdk/engage/template-validator.js +1 -1
  140. package/dist/sdk/engage/template-yaml.js +1 -1
  141. package/dist/sdk/engage/types/campaign-def.js +1 -1
  142. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  143. package/dist/sdk/engage/types/template-schema.js +1 -1
  144. package/dist/sdk/engage.js +1 -1
  145. package/dist/sdk/errors.js +1 -1
  146. package/dist/sdk/index.js +1 -1
  147. package/dist/sdk/io/index.js +1 -1
  148. package/dist/sdk/io/node-filesystem.js +1 -1
  149. package/dist/sdk/job.js +1 -1
  150. package/dist/sdk/journey.js +1 -1
  151. package/dist/sdk/llm/chat-cache.js +1 -1
  152. package/dist/sdk/llm/index.d.ts.map +1 -1
  153. package/dist/sdk/llm/index.js +1 -1
  154. package/dist/sdk/llm/index.js.map +1 -1
  155. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  156. package/dist/sdk/llm/model-factors.js +1 -1
  157. package/dist/sdk/personalization.js +1 -1
  158. package/dist/sdk/policy.js +1 -1
  159. package/dist/sdk/query/index.js +1 -1
  160. package/dist/sdk/query/sql-parser.js +1 -1
  161. package/dist/sdk/realtime.js +1 -1
  162. package/dist/sdk/schedule.js +1 -1
  163. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  164. package/dist/sdk/segment/fields-display.js +1 -1
  165. package/dist/sdk/segment/file-discovery.js +1 -1
  166. package/dist/sdk/segment/journey-utils.js +1 -1
  167. package/dist/sdk/segment/journey-validator.js +1 -1
  168. package/dist/sdk/segment/journey-yaml.js +1 -1
  169. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  170. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  171. package/dist/sdk/segment/pull-workflow.js +1 -1
  172. package/dist/sdk/segment/push-recovery.js +1 -1
  173. package/dist/sdk/segment/push-workflow.js +1 -1
  174. package/dist/sdk/segment/resolution-context.js +1 -1
  175. package/dist/sdk/segment/segment-path-parser.js +1 -1
  176. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  177. package/dist/sdk/segment/segment-validator.js +1 -1
  178. package/dist/sdk/segment/target-resolution.js +1 -1
  179. package/dist/sdk/segment/tdx-config.js +1 -1
  180. package/dist/sdk/segment/types/activation-schema.js +1 -1
  181. package/dist/sdk/segment/types/journey-def.js +1 -1
  182. package/dist/sdk/segment/types/journey-schema.js +1 -1
  183. package/dist/sdk/segment/types/segment-def.js +1 -1
  184. package/dist/sdk/segment/types/segment-schema.js +1 -1
  185. package/dist/sdk/segment/validate-files.js +1 -1
  186. package/dist/sdk/segment/yaml-validator.js +1 -1
  187. package/dist/sdk/segment.js +1 -1
  188. package/dist/sdk/types/index.d.ts +2 -2
  189. package/dist/sdk/types/index.d.ts.map +1 -1
  190. package/dist/sdk/types/index.js +1 -1
  191. package/dist/sdk/types/index.js.map +1 -1
  192. package/dist/sdk/types/llm.d.ts +158 -0
  193. package/dist/sdk/types/llm.d.ts.map +1 -1
  194. package/dist/sdk/types/progress.js +1 -1
  195. package/dist/sdk/types/workflow.d.ts +26 -0
  196. package/dist/sdk/types/workflow.d.ts.map +1 -1
  197. package/dist/sdk/types/workspace.js +1 -1
  198. package/dist/sdk/user.js +1 -1
  199. package/dist/sdk/util/format-detector.js +1 -1
  200. package/dist/sdk/util/formatters.js +1 -1
  201. package/dist/sdk/util/index.js +1 -1
  202. package/dist/sdk/util/paginate.js +1 -1
  203. package/dist/sdk/util/tree-formatter.js +1 -1
  204. package/dist/sdk/workflow/archive-validation.js +1 -1
  205. package/dist/sdk/workflow/clone-workflow.js +1 -1
  206. package/dist/sdk/workflow/index.d.ts +22 -0
  207. package/dist/sdk/workflow/index.d.ts.map +1 -1
  208. package/dist/sdk/workflow/index.js +1 -1
  209. package/dist/sdk/workflow/index.js.map +1 -1
  210. package/dist/sdk/workflow/pull-workflow.js +1 -1
  211. package/dist/sdk/workflow/push-workflow.js +1 -1
  212. package/dist/sdk/workflow/tdx-config.js +1 -1
  213. package/dist/sdk/workflow/workflow-utils.js +1 -1
  214. package/dist/sdk/workspace/frontmatter.js +1 -1
  215. package/dist/sdk/workspace/git.js +1 -1
  216. package/dist/sdk/workspace/index.js +1 -1
  217. package/dist/sdk/workspace/templates.js +1 -1
  218. package/dist/sdk/workspace/weekly.js +1 -1
  219. package/dist/sdk/workspace/wikilinks.js +1 -1
  220. package/dist/test-utils/command-runner.js +1 -1
  221. package/dist/test-utils/factories.js +1 -1
  222. package/dist/test-utils/fixtures.js +1 -1
  223. package/dist/test-utils/http-mock.js +1 -1
  224. package/dist/test-utils/index.js +1 -1
  225. package/dist/utils/async.js +1 -1
  226. package/dist/utils/colors.js +1 -1
  227. package/dist/utils/diff.js +1 -1
  228. package/dist/utils/file-permissions.js +1 -1
  229. package/dist/utils/file-reader.js +1 -1
  230. package/dist/utils/github-releases.js +1 -1
  231. package/dist/utils/global-cache.js +1 -1
  232. package/dist/utils/json-loader.js +1 -1
  233. package/dist/utils/local-cache.js +1 -1
  234. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  235. package/dist/utils/logger/formatters/index.js +1 -1
  236. package/dist/utils/logger/handlers/console-handler.js +1 -1
  237. package/dist/utils/logger/handlers/file-handler.js +1 -1
  238. package/dist/utils/logger/handlers/index.js +1 -1
  239. package/dist/utils/logger/handlers/null-handler.js +1 -1
  240. package/dist/utils/logger/index.js +1 -1
  241. package/dist/utils/logger/logger.js +1 -1
  242. package/dist/utils/logger/types.js +1 -1
  243. package/dist/utils/option-validation.js +1 -1
  244. package/dist/utils/process.d.ts.map +1 -1
  245. package/dist/utils/process.js +1 -1
  246. package/dist/utils/process.js.map +1 -1
  247. package/dist/utils/prompt.js +1 -1
  248. package/dist/utils/spinner.js +1 -1
  249. package/dist/utils/sse-parser.js +1 -1
  250. package/dist/utils/string-utils.js +1 -1
  251. package/dist/utils/table-ref-parser.js +1 -1
  252. package/dist/utils/tdx-logger.js +1 -1
  253. package/dist/utils/version-check.js +1 -1
  254. package/package.json +2 -2
@@ -1 +1 @@
1
- const a6_0x3ea4e6=a6_0x365b;(function(_0x5101d3,_0x10303c){const _0x363535=a6_0x365b,_0x5801f3=_0x5101d3();while(!![]){try{const _0x3c1b1a=parseInt(_0x363535(0x1d0))/0x1*(-parseInt(_0x363535(0x1b0))/0x2)+parseInt(_0x363535(0x1d1))/0x3+-parseInt(_0x363535(0x1ae))/0x4*(parseInt(_0x363535(0x1e9))/0x5)+-parseInt(_0x363535(0x1e4))/0x6+parseInt(_0x363535(0x1be))/0x7*(-parseInt(_0x363535(0x1cb))/0x8)+-parseInt(_0x363535(0x1ee))/0x9*(parseInt(_0x363535(0x1cf))/0xa)+parseInt(_0x363535(0x1b2))/0xb;if(_0x3c1b1a===_0x10303c)break;else _0x5801f3['push'](_0x5801f3['shift']());}catch(_0x2cd4c9){_0x5801f3['push'](_0x5801f3['shift']());}}}(a6_0x3bb9,0xd4691));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';function a6_0x3bb9(){const _0x2573dc=['PATCH','data','cdp','Results\x20saved\x20to\x20','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','Error:\x20','760bJfjbT','api','\x0aStack\x20trace:\x0a','entries','460Qyphhg','1465949gaeDby','370719EXhwWJ','request','file','error','join','stack','body','message','x-xsrf-token','trino','description','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','output','x-auth-token','toUpperCase','color','status','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','.\x20Valid\x20methods:\x20','9534636ZUmZFy','validate','authorization','has','\x22.\x20','1633585DBmdnM','site','length','cas','includes','150678yolCuV','indexOf','Invalid\x20HTTP\x20method:\x20','name','headers','8rYEuoT','header','2uECDqW','verbose','75158336nswjFl','substring','PUT','proxy-authorization','set-cookie2','<\x20HTTP/1.1\x20','noColor','GET','POST','llm','cookie','method','118447DlTluY','keys','.\x20Valid\x20types:\x20','execute','readBodyFromFile','llm-proxy','trim'];a6_0x3bb9=function(){return _0x2573dc;};return a6_0x3bb9();}const SENSITIVE_HEADERS=new Set([a6_0x3ea4e6(0x1e6),a6_0x3ea4e6(0x1b5),a6_0x3ea4e6(0x1bc),'set-cookie',a6_0x3ea4e6(0x1b6),a6_0x3ea4e6(0x1d9),a6_0x3ea4e6(0x1de),'x-trino-user']);function a6_0x365b(_0xe34c88,_0xee9239){_0xe34c88=_0xe34c88-0x1ac;const _0x3bb9d2=a6_0x3bb9();let _0x365bf1=_0x3bb9d2[_0xe34c88];return _0x365bf1;}function isSensitiveHeader(_0x2b9d8a){const _0x15a709=a6_0x3ea4e6;return SENSITIVE_HEADERS[_0x15a709(0x1e7)](_0x2b9d8a['toLowerCase']());}function parseHeader(_0x5b1196){const _0x331962=a6_0x3ea4e6,_0x548410=_0x5b1196[_0x331962(0x1ef)](':');if(_0x548410===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0x5b1196+_0x331962(0x1e8)+_0x331962(0x1c9));const _0x1dec5c=_0x5b1196[_0x331962(0x1b3)](0x0,_0x548410)[_0x331962(0x1c4)](),_0x55463b=_0x5b1196['substring'](_0x548410+0x1)[_0x331962(0x1c4)]();if(!_0x1dec5c)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x5b1196+'\x22');return[_0x1dec5c,_0x55463b];}export class ApiCommand extends BaseCommand{[a6_0x3ea4e6(0x1ac)]='api';[a6_0x3ea4e6(0x1db)]='Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs';[a6_0x3ea4e6(0x1e5)](_0x12e0fd){const _0x1247af=a6_0x3ea4e6,{args:_0x3c7604,options:_0x2bea16}=_0x12e0fd,_0x1cfdce=_0x2bea16;if(_0x3c7604['length']===0x0)return _0x1247af(0x1e2);const _0x2e0423=_0x3c7604[0x0];if(!_0x2e0423['startsWith']('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x2e0423;const _0x50172f=_0x1cfdce[_0x1247af(0x1c6)],_0x491052=_0x1cfdce['file'];if(_0x50172f&&_0x491052)return _0x1247af(0x1dc);const _0x545c46=_0x1cfdce[_0x1247af(0x1bd)]||_0x1247af(0x1b9),_0x3b3556=[_0x1247af(0x1b9),_0x1247af(0x1ba),_0x1247af(0x1b4),'DELETE',_0x1247af(0x1c5)];if(!_0x3b3556['includes'](_0x545c46[_0x1247af(0x1df)]()))return _0x1247af(0x1f0)+_0x545c46+_0x1247af(0x1e3)+_0x3b3556[_0x1247af(0x1d5)](',\x20');const _0x1bb969=_0x1cfdce['type']||'td',_0x22925a=['td',_0x1247af(0x1c7),'workflow',_0x1247af(0x1da),_0x1247af(0x1bb),_0x1247af(0x1c3),_0x1247af(0x1ec)];if(!_0x22925a[_0x1247af(0x1ed)](_0x1bb969))return'Invalid\x20API\x20type:\x20'+_0x1bb969+_0x1247af(0x1c0)+_0x22925a[_0x1247af(0x1d5)](',\x20');return undefined;}async[a6_0x3ea4e6(0x1c1)](_0x3c07d5){const _0xd02cef=a6_0x3ea4e6,{options:_0x27e70a,args:_0x4c8d0f,tdx:_0x54bb7c}=_0x3c07d5,_0x5de39b=_0x27e70a,_0x229f2e=_0x4c8d0f[0x0],_0x2e6952=(_0x5de39b[_0xd02cef(0x1bd)]||_0xd02cef(0x1b9))[_0xd02cef(0x1df)](),_0x49f2d9=_0x5de39b[_0xd02cef(0x1c6)],_0x53bd68=_0x5de39b[_0xd02cef(0x1d3)],_0x2c1a85=_0x5de39b[_0xd02cef(0x1af)],_0x4678cd=_0x5de39b['type']||'td';try{const _0x4aa2db={};if(_0x2c1a85){const _0x585c0d=Array['isArray'](_0x2c1a85)?_0x2c1a85:[_0x2c1a85];for(const _0x234a53 of _0x585c0d){const [_0x7231c3,_0x271157]=parseHeader(_0x234a53);_0x4aa2db[_0x7231c3]=_0x271157;}}let _0x247a72;if(_0x49f2d9)_0x247a72=_0x49f2d9;else{if(_0x53bd68)try{_0x247a72=RawAPI[_0xd02cef(0x1c2)](_0x53bd68);}catch(_0x28388b){return console[_0xd02cef(0x1d4)](_0xd02cef(0x1ca)+(_0x28388b instanceof Error?_0x28388b['message']:String(_0x28388b))),0x1;}}const _0x4a3f36={'method':_0x2e6952,'apiType':_0x4678cd,'includeHeaders':_0x27e70a[_0xd02cef(0x1b1)]};_0x247a72&&(_0x4a3f36[_0xd02cef(0x1d7)]=_0x247a72);Object[_0xd02cef(0x1bf)](_0x4aa2db)[_0xd02cef(0x1eb)]>0x0&&(_0x4a3f36[_0xd02cef(0x1ad)]=_0x4aa2db);if(_0x27e70a[_0xd02cef(0x1b1)]){const _0x4e7a23=resolveSite(_0x27e70a[_0xd02cef(0x1ea)]),_0x44b646=getEndpoint(_0x4e7a23,_0x4678cd),_0x5c5ae5=''+_0x44b646+_0x229f2e;console[_0xd02cef(0x1d4)]('>\x20'+_0x2e6952+'\x20'+_0x5c5ae5);const _0x13e207=getAuthHeaders(_0x4e7a23),_0x5ebb5a={..._0x13e207,..._0x4aa2db};for(const [_0xd678d4,_0x333d81]of Object[_0xd02cef(0x1ce)](_0x5ebb5a)){!isSensitiveHeader(_0xd678d4)&&console[_0xd02cef(0x1d4)]('>\x20'+_0xd678d4+':\x20'+_0x333d81);}_0x247a72&&console[_0xd02cef(0x1d4)]('>'),console['error']('');}const _0x20ff64=await _0x54bb7c[_0xd02cef(0x1cc)][_0xd02cef(0x1d2)](_0x229f2e,_0x4a3f36);if(_0x27e70a[_0xd02cef(0x1b1)]&&_0x20ff64[_0xd02cef(0x1ad)]){console['error'](_0xd02cef(0x1b7)+_0x20ff64[_0xd02cef(0x1e1)]);for(const [_0x52e906,_0x5732e3]of Object[_0xd02cef(0x1ce)](_0x20ff64['headers'])){!isSensitiveHeader(_0x52e906)&&console['error']('<\x20'+_0x52e906+':\x20'+_0x5732e3);}console[_0xd02cef(0x1d4)]('');}const _0x17cd87=Boolean(_0x27e70a[_0xd02cef(0x1dd)]),_0x2a2c9f={'color':_0x27e70a[_0xd02cef(0x1e0)],'noColor':_0x27e70a[_0xd02cef(0x1b8)]||_0x17cd87&&!_0x27e70a[_0xd02cef(0x1e0)]},_0xaac0e3=colorizeJSON(_0x20ff64[_0xd02cef(0x1c6)],_0x2a2c9f);return _0x27e70a[_0xd02cef(0x1dd)]?(writeFileSync(_0x27e70a[_0xd02cef(0x1dd)],_0xaac0e3),console['error'](_0xd02cef(0x1c8)+_0x27e70a[_0xd02cef(0x1dd)])):console['log'](_0xaac0e3),0x0;}catch(_0x171b2e){return _0x171b2e instanceof Error?(console[_0xd02cef(0x1d4)]('Error:\x20'+_0x171b2e[_0xd02cef(0x1d8)]),_0x27e70a[_0xd02cef(0x1b1)]&&_0x171b2e[_0xd02cef(0x1d6)]&&console[_0xd02cef(0x1d4)](_0xd02cef(0x1cd)+_0x171b2e[_0xd02cef(0x1d6)])):console[_0xd02cef(0x1d4)](_0xd02cef(0x1ca)+String(_0x171b2e)),0x1;}}}
1
+ function a6_0x1b59(_0x363270,_0x5d948b){_0x363270=_0x363270-0x125;const _0x18baeb=a6_0x18ba();let _0x1b5973=_0x18baeb[_0x363270];return _0x1b5973;}const a6_0x5ae64f=a6_0x1b59;(function(_0x501012,_0x490923){const _0xf0971c=a6_0x1b59,_0x28e153=_0x501012();while(!![]){try{const _0x4f3e32=parseInt(_0xf0971c(0x12c))/0x1*(parseInt(_0xf0971c(0x13a))/0x2)+parseInt(_0xf0971c(0x146))/0x3+parseInt(_0xf0971c(0x152))/0x4+-parseInt(_0xf0971c(0x13e))/0x5*(parseInt(_0xf0971c(0x127))/0x6)+-parseInt(_0xf0971c(0x13c))/0x7+parseInt(_0xf0971c(0x133))/0x8*(parseInt(_0xf0971c(0x142))/0x9)+-parseInt(_0xf0971c(0x161))/0xa;if(_0x4f3e32===_0x490923)break;else _0x28e153['push'](_0x28e153['shift']());}catch(_0x407061){_0x28e153['push'](_0x28e153['shift']());}}}(a6_0x18ba,0x6a964));import{BaseCommand}from'./command.js';function a6_0x18ba(){const _0xe68cb=['header','27782RcXUGc','PATCH','549584NiDNRt','api','6770uMKiML','includes','proxy-authorization','toLowerCase','1206xPzRFG','method','.\x20Valid\x20types:\x20','substring','1476417nlIVAI','headers','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','data','authorization','llm-proxy','join','Invalid\x20HTTP\x20method:\x20','POST','indexOf','color','\x22.\x20','1016296QXSSKh','type','Invalid\x20header\x20format:\x20\x22','GET','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','Error:\x20','log','isArray','set-cookie2','keys','request','workflow','readBodyFromFile','x-auth-token','site','7318880BUOhvO','toUpperCase','status','message','output','file','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','noColor','description','\x0aStack\x20trace:\x0a','1506dfMtzG','Endpoint\x20must\x20start\x20with\x20/:\x20','<\x20HTTP/1.1\x20','entries','validate','17IsIXdX','execute','length','has','Results\x20saved\x20to\x20','cas','verbose','36088raVvws','error','stack','x-xsrf-token','name','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.'];a6_0x18ba=function(){return _0xe68cb;};return a6_0x18ba();}import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a6_0x5ae64f(0x14a),a6_0x5ae64f(0x140),'cookie','set-cookie',a6_0x5ae64f(0x15a),a6_0x5ae64f(0x136),a6_0x5ae64f(0x15f),'x-trino-user']);function isSensitiveHeader(_0x14a3d8){const _0x3bc5e3=a6_0x5ae64f;return SENSITIVE_HEADERS[_0x3bc5e3(0x12f)](_0x14a3d8[_0x3bc5e3(0x141)]());}function parseHeader(_0x57d3fa){const _0x5265cf=a6_0x5ae64f,_0x465570=_0x57d3fa[_0x5265cf(0x14f)](':');if(_0x465570===-0x1)throw new Error(_0x5265cf(0x154)+_0x57d3fa+_0x5265cf(0x151)+_0x5265cf(0x167));const _0x25e9a9=_0x57d3fa[_0x5265cf(0x145)](0x0,_0x465570)['trim'](),_0x3ef2c0=_0x57d3fa['substring'](_0x465570+0x1)['trim']();if(!_0x25e9a9)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x57d3fa+'\x22');return[_0x25e9a9,_0x3ef2c0];}export class ApiCommand extends BaseCommand{[a6_0x5ae64f(0x137)]=a6_0x5ae64f(0x13d);[a6_0x5ae64f(0x125)]=a6_0x5ae64f(0x148);[a6_0x5ae64f(0x12b)](_0x45de6e){const _0x19672a=a6_0x5ae64f,{args:_0x6d0680,options:_0x9f7b0d}=_0x45de6e,_0x12dee0=_0x9f7b0d;if(_0x6d0680['length']===0x0)return _0x19672a(0x156);const _0x2b50f5=_0x6d0680[0x0];if(!_0x2b50f5['startsWith']('/'))return _0x19672a(0x128)+_0x2b50f5;const _0x49a534=_0x12dee0[_0x19672a(0x149)],_0x432773=_0x12dee0['file'];if(_0x49a534&&_0x432773)return _0x19672a(0x138);const _0x526c18=_0x12dee0[_0x19672a(0x143)]||_0x19672a(0x155),_0xe013df=['GET',_0x19672a(0x14e),'PUT','DELETE',_0x19672a(0x13b)];if(!_0xe013df[_0x19672a(0x13f)](_0x526c18[_0x19672a(0x162)]()))return _0x19672a(0x14d)+_0x526c18+'.\x20Valid\x20methods:\x20'+_0xe013df['join'](',\x20');const _0x21a26a=_0x12dee0[_0x19672a(0x153)]||'td',_0x15d765=['td','cdp',_0x19672a(0x15d),'trino','llm',_0x19672a(0x14b),_0x19672a(0x131)];if(!_0x15d765[_0x19672a(0x13f)](_0x21a26a))return'Invalid\x20API\x20type:\x20'+_0x21a26a+_0x19672a(0x144)+_0x15d765[_0x19672a(0x14c)](',\x20');return undefined;}async[a6_0x5ae64f(0x12d)](_0x246088){const _0x17e1cd=a6_0x5ae64f,{options:_0x2b7aa3,args:_0x318d96,tdx:_0x3ad3ca}=_0x246088,_0x430ba9=_0x2b7aa3,_0x313b7a=_0x318d96[0x0],_0x513d1a=(_0x430ba9[_0x17e1cd(0x143)]||_0x17e1cd(0x155))[_0x17e1cd(0x162)](),_0x49bb72=_0x430ba9['data'],_0xa1bbfd=_0x430ba9[_0x17e1cd(0x166)],_0x276ec1=_0x430ba9[_0x17e1cd(0x139)],_0x33e471=_0x430ba9[_0x17e1cd(0x153)]||'td';try{const _0x4c88df={};if(_0x276ec1){const _0x5ece66=Array[_0x17e1cd(0x159)](_0x276ec1)?_0x276ec1:[_0x276ec1];for(const _0x5383c1 of _0x5ece66){const [_0x58817b,_0x1c1b53]=parseHeader(_0x5383c1);_0x4c88df[_0x58817b]=_0x1c1b53;}}let _0x3bad4f;if(_0x49bb72)_0x3bad4f=_0x49bb72;else{if(_0xa1bbfd)try{_0x3bad4f=RawAPI[_0x17e1cd(0x15e)](_0xa1bbfd);}catch(_0x12e3d0){return console[_0x17e1cd(0x134)]('Error:\x20'+(_0x12e3d0 instanceof Error?_0x12e3d0[_0x17e1cd(0x164)]:String(_0x12e3d0))),0x1;}}const _0xc0b5c={'method':_0x513d1a,'apiType':_0x33e471,'includeHeaders':_0x2b7aa3[_0x17e1cd(0x132)]};_0x3bad4f&&(_0xc0b5c['body']=_0x3bad4f);Object[_0x17e1cd(0x15b)](_0x4c88df)[_0x17e1cd(0x12e)]>0x0&&(_0xc0b5c[_0x17e1cd(0x147)]=_0x4c88df);if(_0x2b7aa3[_0x17e1cd(0x132)]){const _0x149b0d=resolveSite(_0x2b7aa3[_0x17e1cd(0x160)]),_0x4d8bbe=getEndpoint(_0x149b0d,_0x33e471),_0x4a9fd2=''+_0x4d8bbe+_0x313b7a;console[_0x17e1cd(0x134)]('>\x20'+_0x513d1a+'\x20'+_0x4a9fd2);const _0x26358d=getAuthHeaders(_0x149b0d),_0x297a6e={..._0x26358d,..._0x4c88df};for(const [_0x2f2a08,_0x33693e]of Object['entries'](_0x297a6e)){!isSensitiveHeader(_0x2f2a08)&&console[_0x17e1cd(0x134)]('>\x20'+_0x2f2a08+':\x20'+_0x33693e);}_0x3bad4f&&console[_0x17e1cd(0x134)]('>'),console[_0x17e1cd(0x134)]('');}const _0x482a4a=await _0x3ad3ca[_0x17e1cd(0x13d)][_0x17e1cd(0x15c)](_0x313b7a,_0xc0b5c);if(_0x2b7aa3[_0x17e1cd(0x132)]&&_0x482a4a[_0x17e1cd(0x147)]){console[_0x17e1cd(0x134)](_0x17e1cd(0x129)+_0x482a4a[_0x17e1cd(0x163)]);for(const [_0x551f78,_0x119378]of Object[_0x17e1cd(0x12a)](_0x482a4a[_0x17e1cd(0x147)])){!isSensitiveHeader(_0x551f78)&&console[_0x17e1cd(0x134)]('<\x20'+_0x551f78+':\x20'+_0x119378);}console['error']('');}const _0x45ff66=Boolean(_0x2b7aa3[_0x17e1cd(0x165)]),_0x30546e={'color':_0x2b7aa3[_0x17e1cd(0x150)],'noColor':_0x2b7aa3[_0x17e1cd(0x168)]||_0x45ff66&&!_0x2b7aa3['color']},_0x4bf504=colorizeJSON(_0x482a4a[_0x17e1cd(0x149)],_0x30546e);return _0x2b7aa3[_0x17e1cd(0x165)]?(writeFileSync(_0x2b7aa3[_0x17e1cd(0x165)],_0x4bf504),console['error'](_0x17e1cd(0x130)+_0x2b7aa3[_0x17e1cd(0x165)])):console[_0x17e1cd(0x158)](_0x4bf504),0x0;}catch(_0x3228b1){return _0x3228b1 instanceof Error?(console['error']('Error:\x20'+_0x3228b1[_0x17e1cd(0x164)]),_0x2b7aa3[_0x17e1cd(0x132)]&&_0x3228b1['stack']&&console[_0x17e1cd(0x134)](_0x17e1cd(0x126)+_0x3228b1[_0x17e1cd(0x135)])):console[_0x17e1cd(0x134)](_0x17e1cd(0x157)+String(_0x3228b1)),0x1;}}}
@@ -1 +1 @@
1
- const a7_0xfee33d=a7_0x5980;function a7_0x5980(_0x194303,_0x3f772c){_0x194303=_0x194303-0x91;const _0x4de82c=a7_0x4de8();let _0x5980fb=_0x4de82c[_0x194303];return _0x5980fb;}(function(_0x808c6a,_0x455db4){const _0x2441c0=a7_0x5980,_0x2fde90=_0x808c6a();while(!![]){try{const _0x513e16=parseInt(_0x2441c0(0xa8))/0x1+parseInt(_0x2441c0(0xe1))/0x2+parseInt(_0x2441c0(0xaf))/0x3+-parseInt(_0x2441c0(0xcd))/0x4+parseInt(_0x2441c0(0xed))/0x5+parseInt(_0x2441c0(0xad))/0x6*(parseInt(_0x2441c0(0xc8))/0x7)+-parseInt(_0x2441c0(0xc1))/0x8;if(_0x513e16===_0x455db4)break;else _0x2fde90['push'](_0x2fde90['shift']());}catch(_0x5f5954){_0x2fde90['push'](_0x2fde90['shift']());}}}(a7_0x4de8,0xa215b));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens,saveOAuthTokens}from'../core/oauth-keychain.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';function a7_0x4de8(){const _0x1a2718=['No\x20credential\x20found','oauth','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','OAuth\x20tokens','logLevel','931766ukCthU','password','Opens\x20your\x20browser\x20to\x20sign\x20in\x20with\x20SSO','create','✓\x20Default\x20site\x20set\x20to\x20','\x20(profile:\x20','warn','Opening\x20browser\x20for\x20authentication...','message','N/A','execute','status','1676070oNEGHZ','Read\x20credential\x20from\x20','last_name','\x20\x20\x20\x201.\x20Run:\x20tdx\x20auth\x20setup\x20--account-name\x20<name>','Setting\x20up\x20authentication\x20for\x20site:\x20','trim','accountName','join','site','User:\x20','method','description','System\x20keychain\x20is\x20not\x20available','✗\x20Validation\x20failed:\x20','getUserInfo','tdx\x20profile:\x20','auth','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','Validating\x20OAuth\x20tokens...','yellow','\x0aSetup\x20cancelled','For\x20scripts\x20or\x20headless\x20servers','\x20\x20tdx','select','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','205885UNjCTw','\x20(site:\x20','green','\x20\x20(','ERROR','883650qsmtsm','bold','1499580iFWghe','filter','Setup\x20cancelled','\x20for\x20profile:\x20','jobs','Waiting\x20for\x20authorization\x20(timeout:\x202\x20minutes)...','\x20and\x20','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','apiKey','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','error','access_token','Name:\x20','\x20\x20user_id:','\x27\x20registered','Remove\x20API\x20key\x20from\x20system\x20keychain','account_id','8186128iuuyVa','\x20removed\x20from\x20keychain','auth:setup','log','all','✓\x20Signed\x20in\x20successfully','red','14lWesRQ','/oauth/authorize','auth:clear','tdx:\x20auth\x20setup','name','456908yynmqX','profile','Enter\x20your\x20TD\x20API\x20key:','email','Credential\x20type:\x20OAuth','API\x20key','first_name','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','API\x20key\x20cannot\x20be\x20empty','Setup\x20API\x20key\x20authentication\x20interactively','dim','text','cyan','Sign\x20in\x20with\x20browser\x20(recommended)','Validating\x20API\x20key...'];a7_0x4de8=function(){return _0x1a2718;};return a7_0x4de8();}import{clearCredentialCache}from'../core/credential-cache.js';import{startOAuthFlow}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import a7_0x368150 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x346675 from'chalk';export async function runOAuthLoginFlow(_0x2e4a96,_0x47f4ae,_0x1d3a1a,_0xb73d51){const _0x16f540=a7_0x5980,_0x4e30a3=await isKeychainAvailable();if(!_0x4e30a3)throw new Error('System\x20keychain\x20is\x20not\x20available.\x20OAuth\x20tokens\x20cannot\x20be\x20saved.\x20'+'Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.');let _0x5849da=_0xb73d51?.[_0x16f540(0x95)];if(!_0x5849da){const _0x57e7ee=await a7_0x368150({'type':_0x16f540(0xd8),'name':_0x16f540(0x95),'message':'Account\x20name\x20for\x20SSO\x20(press\x20Enter\x20to\x20skip):'});if(_0x57e7ee['accountName']===undefined)throw new Error(_0x16f540(0xb1));_0x5849da=_0x57e7ee['accountName'][_0x16f540(0x94)]()||undefined;}const _0x46e971=getConsoleUrl(_0x2e4a96);console[_0x16f540(0xc4)](_0x16f540(0xe8));_0x5849da?console[_0x16f540(0xc4)]('\x20\x20'+_0x46e971+'/users/initiate_sso\x20(account:\x20'+_0x5849da+')'):console[_0x16f540(0xc4)]('\x20\x20'+_0x46e971+_0x16f540(0xc9));console[_0x16f540(0xc4)](_0x16f540(0xb4));const _0x43e167=await startOAuthFlow(_0x2e4a96,{'accountName':_0x5849da});console['log'](_0x16f540(0xa1));const _0x37fc04=TDX[_0x16f540(0xe4)]({'site':_0x2e4a96,'accessToken':_0x43e167[_0x16f540(0xbb)],'logLevel':_0x1d3a1a??LogLevel[_0x16f540(0xac)]}),_0x5b7f72=await _0x37fc04[_0x16f540(0xb3)]['getUserInfo']();console['log'](a7_0x346675['green'](_0x16f540(0xc6))),console[_0x16f540(0xc4)]('\x20\x20'+a7_0x346675[_0x16f540(0xd9)](_0x2e4a96+':'+_0x5b7f72[_0x16f540(0xc0)])+_0x16f540(0xbd)+_0x5b7f72['id']+_0x16f540(0xab)+_0x5b7f72[_0x16f540(0xd0)]+')');!_0x5849da&&(console[_0x16f540(0xc4)](a7_0x346675['dim']('\x20\x20If\x20this\x20is\x20not\x20the\x20expected\x20account:')),console[_0x16f540(0xc4)](a7_0x346675[_0x16f540(0xd7)](_0x16f540(0x92))),console[_0x16f540(0xc4)](a7_0x346675['dim']('\x20\x20\x20\x202.\x20Or\x20use\x20a\x20different\x20browser\x20profile\x20to\x20avoid\x20cached\x20sessions')));await saveOAuthTokens(_0x43e167,_0x47f4ae),console[_0x16f540(0xc4)]('✓\x20OAuth\x20tokens\x20saved\x20to\x20system\x20keychain'+(_0x47f4ae?_0x16f540(0xe6)+_0x47f4ae+')':''));if(_0x47f4ae){const _0x273d5a={'site':_0x2e4a96};saveProfileToUserConfig(_0x47f4ae,_0x273d5a),console[_0x16f540(0xc4)]('✓\x20Profile\x20\x27'+_0x47f4ae+_0x16f540(0xbe));}else saveDefaultSiteToUserConfig(_0x2e4a96),console[_0x16f540(0xc4)](_0x16f540(0xe5)+_0x2e4a96);const _0x5c4715=_0x47f4ae?'\x20--profile\x20'+_0x47f4ae:'';console[_0x16f540(0xc4)](),console['log'](_0x16f540(0xb9)),console[_0x16f540(0xc4)]('\x20\x20tdx'+_0x5c4715+_0x16f540(0xb7)),console[_0x16f540(0xc4)](_0x16f540(0xa5)+_0x5c4715+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases');}export async function promptAuthMethod(){const _0x5b26b3=a7_0x5980,_0x3ab62a=await a7_0x368150({'type':_0x5b26b3(0xa6),'name':'method','message':'Choose\x20how\x20to\x20sign\x20in:','choices':[{'title':_0x5b26b3(0xda),'description':_0x5b26b3(0xe3),'value':'oauth'},{'title':'Use\x20an\x20API\x20key','description':_0x5b26b3(0xa4),'value':'apikey'}]});return _0x3ab62a[_0x5b26b3(0x99)]||null;}export class AuthSetupCommand extends BaseCommand{[a7_0xfee33d(0xcc)]=a7_0xfee33d(0xc3);[a7_0xfee33d(0x9a)]=a7_0xfee33d(0xd6);async[a7_0xfee33d(0xeb)](_0xaa44e){const _0x671c79=a7_0xfee33d,{options:_0x531db0}=_0xaa44e,_0x32f67d=_0x531db0[_0x671c79(0xce)];console[_0x671c79(0xc4)](a7_0x346675[_0x671c79(0xae)](_0x671c79(0xcb)));const _0x4bc9a9=_0x531db0[_0x671c79(0x97)]||'us01',_0x4cfe63=await promptSiteSelection(_0x4bc9a9,_0x32f67d,_0x671c79(0xb1));if(!_0x4cfe63)return 0x1;const _0x4c38ea=resolveSite(_0x4cfe63),_0x340636=await promptAuthMethod();if(!_0x340636)return console[_0x671c79(0xc4)](_0x671c79(0xa3)),0x1;if(_0x340636===_0x671c79(0xdd)){const {accountName:_0x8df70f}=_0x531db0;return await runOAuthLoginFlow(_0x4c38ea,_0x32f67d,_0x531db0[_0x671c79(0xe0)]??LogLevel[_0x671c79(0xac)],{'accountName':_0x8df70f}),0x0;}console[_0x671c79(0xc4)](_0x671c79(0x93)+_0x4c38ea),console[_0x671c79(0xc4)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x671c79(0xc4)]('\x20\x20'+getConsoleUrl(_0x4c38ea,'/app/mp/ak'));const _0x15778a=await a7_0x368150({'type':_0x671c79(0xe2),'name':_0x671c79(0xb8),'message':_0x671c79(0xcf),'validate':_0x14303e=>{const _0xe92da6=_0x671c79;if(!_0x14303e||!_0x14303e[_0xe92da6(0x94)]())return _0xe92da6(0xd5);return!![];}});if(!_0x15778a[_0x671c79(0xb8)])return console[_0x671c79(0xc4)](_0x671c79(0xa3)),0x1;const _0x1bddb0=_0x15778a[_0x671c79(0xb8)];console[_0x671c79(0xc4)](_0x671c79(0xdb));try{const _0x3ac940=TDX['create']({'site':_0x4c38ea,'apiKey':_0x1bddb0[_0x671c79(0x94)](),'logLevel':_0x531db0[_0x671c79(0xe0)]??LogLevel['ERROR']}),_0x108c0d=await _0x3ac940['jobs'][_0x671c79(0x9d)]();console[_0x671c79(0xc4)]('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x108c0d[_0x671c79(0xd0)]+')');const _0x3739c9=await isKeychainAvailable();_0x3739c9?(await saveAPIKeyAsync(_0x1bddb0[_0x671c79(0x94)](),_0x4c38ea,_0x32f67d),console[_0x671c79(0xc4)](_0x671c79(0xa0)+(_0x32f67d?_0x671c79(0xe6)+_0x32f67d+')':''))):(console['warn'](a7_0x346675[_0x671c79(0xa2)](_0x671c79(0xd4))),console[_0x671c79(0xe7)](a7_0x346675[_0x671c79(0xa2)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x32f67d){const _0x2eeace={'site':_0x4c38ea};saveProfileToUserConfig(_0x32f67d,_0x2eeace),console[_0x671c79(0xc4)]('✓\x20Profile\x20\x27'+_0x32f67d+_0x671c79(0xbe));}else saveDefaultSiteToUserConfig(_0x4c38ea),console['log'](_0x671c79(0xe5)+_0x4c38ea);const _0x23b948=_0x32f67d?'\x20--profile\x20'+_0x32f67d:'';return console[_0x671c79(0xc4)](),console['log'](_0x671c79(0xb9)),console[_0x671c79(0xc4)](_0x671c79(0xa5)+_0x23b948+_0x671c79(0xb7)),console[_0x671c79(0xc4)](_0x671c79(0xa5)+_0x23b948+_0x671c79(0xde)),0x0;}catch(_0x39ebc4){if(_0x39ebc4 instanceof HTTPClientError&&_0x39ebc4[_0x671c79(0xec)]===0x191)return printAuthError(_0x39ebc4),0x1;return console[_0x671c79(0xba)](a7_0x346675[_0x671c79(0xc7)]('✗\x20Validation\x20failed:\x20'+(_0x39ebc4 instanceof Error?_0x39ebc4[_0x671c79(0xe9)]:String(_0x39ebc4)))),console[_0x671c79(0xba)](_0x671c79(0xb6)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0xfee33d(0xcc)]=a7_0xfee33d(0x9f);[a7_0xfee33d(0x9a)]=a7_0xfee33d(0xa7);async[a7_0xfee33d(0xeb)](_0x3d34c2){const _0x385aff=a7_0xfee33d,{options:_0x42179d,tdx:_0x683be9}=_0x3d34c2,_0x3fa974=_0x42179d['site'],_0x4e0894=_0x42179d[_0x385aff(0xce)],_0x11517d=_0x4e0894?_0x4e0894:_0x385aff(0xea);console[_0x385aff(0xc4)](_0x385aff(0x9e)+_0x11517d+_0x385aff(0xa9)+_0x3fa974+')');const _0x5cfe93=await getOAuthTokens(_0x4e0894);if(_0x5cfe93)console['log'](_0x385aff(0xd1)),console['log']('Read\x20credential\x20from\x20keychain'+(_0x4e0894?_0x385aff(0xe6)+_0x4e0894+')':''));else{const _0x14ec3e=await resolveAPIKeyAsync(_0x3fa974,_0x4e0894);if(_0x14ec3e){const {source:_0x10bcb2,isDeprecated:_0x4142e5}=_0x14ec3e,_0x329d27=_0x385aff(0xee)+_0x10bcb2;console[_0x385aff(0xc4)](_0x4142e5?a7_0x346675[_0x385aff(0xa2)](_0x329d27):_0x329d27);}else console['log'](a7_0x346675[_0x385aff(0xa2)](_0x385aff(0xdc)));}try{const _0x32846f=await _0x683be9[_0x385aff(0xb3)][_0x385aff(0x9d)]();return console[_0x385aff(0xc4)](a7_0x346675[_0x385aff(0xaa)]('✓\x20Authentication\x20successful\x0a')),console[_0x385aff(0xc4)](_0x385aff(0x98)+_0x32846f[_0x385aff(0xd0)]),(_0x32846f[_0x385aff(0xd3)]||_0x32846f[_0x385aff(0x91)])&&console[_0x385aff(0xc4)](_0x385aff(0xbc)+[_0x32846f[_0x385aff(0xd3)],_0x32846f[_0x385aff(0x91)]][_0x385aff(0xb0)](Boolean)[_0x385aff(0x96)]('\x20')),0x0;}catch(_0xcd79b9){return _0xcd79b9 instanceof HTTPClientError&&_0xcd79b9[_0x385aff(0xec)]===0x191?printAuthError(_0xcd79b9,!![],_0x4e0894):console['error'](a7_0x346675['red'](_0x385aff(0x9c)+(_0xcd79b9 instanceof Error?_0xcd79b9[_0x385aff(0xe9)]:String(_0xcd79b9)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0xfee33d(0xcc)]=a7_0xfee33d(0xca);['description']=a7_0xfee33d(0xbf);async['execute'](_0x210c4d){const _0x524990=a7_0xfee33d,{options:_0x223a5b}=_0x210c4d,_0x2d8ffe=_0x223a5b['profile'];console[_0x524990(0xc4)](a7_0x346675[_0x524990(0xae)]('tdx:\x20auth\x20clear'));const _0x103aac=await isKeychainAvailable();if(!_0x103aac)return console[_0x524990(0xba)](a7_0x346675['red'](_0x524990(0x9b))),0x1;const [_0x11733f,_0x19d300]=await Promise[_0x524990(0xc5)]([deleteKeychainAPIKey(_0x2d8ffe),deleteOAuthTokens(_0x2d8ffe)]);if(_0x11733f||_0x19d300){clearCredentialCache();const _0x248878=[_0x11733f&&_0x524990(0xd2),_0x19d300&&_0x524990(0xdf)][_0x524990(0xb0)](Boolean)[_0x524990(0x96)](_0x524990(0xb5));return console['log']('✓\x20'+_0x248878+_0x524990(0xc2)+(_0x2d8ffe?_0x524990(0xe6)+_0x2d8ffe+')':'')),0x0;}else return console['log']('No\x20credentials\x20found\x20in\x20keychain'+(_0x2d8ffe?_0x524990(0xb2)+_0x2d8ffe:'')),0x1;}}
1
+ const a7_0x120e5b=a7_0x1235;(function(_0x20c69d,_0x52b27e){const _0x579a56=a7_0x1235,_0x222167=_0x20c69d();while(!![]){try{const _0x1567a6=parseInt(_0x579a56(0x141))/0x1*(-parseInt(_0x579a56(0x147))/0x2)+-parseInt(_0x579a56(0x148))/0x3*(-parseInt(_0x579a56(0x18b))/0x4)+-parseInt(_0x579a56(0x171))/0x5+parseInt(_0x579a56(0x138))/0x6*(-parseInt(_0x579a56(0x170))/0x7)+-parseInt(_0x579a56(0x16e))/0x8+-parseInt(_0x579a56(0x172))/0x9*(parseInt(_0x579a56(0x15c))/0xa)+parseInt(_0x579a56(0x14b))/0xb;if(_0x1567a6===_0x52b27e)break;else _0x222167['push'](_0x222167['shift']());}catch(_0x5e8765){_0x222167['push'](_0x222167['shift']());}}}(a7_0x5abc,0x7efd4));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens,saveOAuthTokens}from'../core/oauth-keychain.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import{startOAuthFlow}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import a7_0x283251 from'prompts';function a7_0x5abc(){const _0x2cb7c6=['password','\x20(site:\x20','1003xUACVI','API\x20key\x20cannot\x20be\x20empty','\x20\x20\x20\x202.\x20Or\x20use\x20a\x20different\x20browser\x20profile\x20to\x20avoid\x20cached\x20sessions','✓\x20Profile\x20\x27','email','apikey','34qFnOJB','3zKkZJn','tdx\x20profile:\x20','dim','28577142DomsBw','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','\x20and\x20','\x27\x20registered','Validating\x20API\x20key...','Sign\x20in\x20with\x20browser\x20(recommended)','\x20\x20\x20\x201.\x20Run:\x20tdx\x20auth\x20setup\x20--account-name\x20<name>','execute','message','us01','red','profile','/app/mp/ak','\x20\x20user_id:','✓\x20Default\x20site\x20set\x20to\x20','Setup\x20cancelled','accountName','495410qkeZQe','trim','error','No\x20credential\x20found','description','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','oauth','Enter\x20your\x20TD\x20API\x20key:','Opening\x20browser\x20for\x20authentication...','getUserInfo','System\x20keychain\x20is\x20not\x20available','site','yellow','N/A','create','warn','Setting\x20up\x20authentication\x20for\x20site:\x20','name','1288256FJdVeQ','auth','3416PKJorl','4166765EpQQsh','171YORMlm','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20\x20(','OAuth\x20tokens','text','No\x20credentials\x20found\x20in\x20keychain','✓\x20Signed\x20in\x20successfully','logLevel','filter','last_name','first_name','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','/oauth/authorize','auth:clear','✓\x20Authentication\x20successful\x0a','Opens\x20your\x20browser\x20to\x20sign\x20in\x20with\x20SSO','cyan','\x20removed\x20from\x20keychain','Account\x20name\x20for\x20SSO\x20(press\x20Enter\x20to\x20skip):','Use\x20an\x20API\x20key','bold','Remove\x20API\x20key\x20from\x20system\x20keychain','ERROR','Name:\x20','2751796PtopSj','✓\x20OAuth\x20tokens\x20saved\x20to\x20system\x20keychain','jobs','✗\x20Validation\x20failed:\x20','apiKey','access_token','Credential\x20type:\x20OAuth','\x20\x20If\x20this\x20is\x20not\x20the\x20expected\x20account:','Use\x20\x22tdx\x20auth\x20setup\x22\x20with\x20an\x20API\x20key\x20instead.','For\x20scripts\x20or\x20headless\x20servers','You\x20can\x20find\x20your\x20API\x20key\x20at:','account_id','tdx:\x20auth\x20setup','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x0aSetup\x20cancelled','User:\x20','Choose\x20how\x20to\x20sign\x20in:','\x20\x20tdx','9996lILFTn','method','Waiting\x20for\x20authorization\x20(timeout:\x202\x20minutes)...','\x20(profile:\x20','status','join','log'];a7_0x5abc=function(){return _0x2cb7c6;};return a7_0x5abc();}function a7_0x1235(_0x15ebcc,_0xadbe4c){_0x15ebcc=_0x15ebcc-0x130;const _0x5abc3d=a7_0x5abc();let _0x1235fa=_0x5abc3d[_0x15ebcc];return _0x1235fa;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a7_0x59d1f5 from'chalk';export async function runOAuthLoginFlow(_0x1ba44e,_0x3c0b3f,_0x23ba31,_0xb9ffc6){const _0x7485f5=a7_0x1235,_0x8c8b00=await isKeychainAvailable();if(!_0x8c8b00)throw new Error('System\x20keychain\x20is\x20not\x20available.\x20OAuth\x20tokens\x20cannot\x20be\x20saved.\x20'+_0x7485f5(0x193));let _0x961bc5=_0xb9ffc6?.['accountName'];if(!_0x961bc5){const _0x540fe4=await a7_0x283251({'type':_0x7485f5(0x177),'name':'accountName','message':_0x7485f5(0x185)});if(_0x540fe4[_0x7485f5(0x15b)]===undefined)throw new Error(_0x7485f5(0x15a));_0x961bc5=_0x540fe4[_0x7485f5(0x15b)][_0x7485f5(0x15d)]()||undefined;}const _0x1d54c2=getConsoleUrl(_0x1ba44e);console['log'](_0x7485f5(0x164));_0x961bc5?console['log']('\x20\x20'+_0x1d54c2+'/users/initiate_sso\x20(account:\x20'+_0x961bc5+')'):console[_0x7485f5(0x13e)]('\x20\x20'+_0x1d54c2+_0x7485f5(0x17f));console['log'](_0x7485f5(0x13a));const _0x3105f3=await startOAuthFlow(_0x1ba44e,{'accountName':_0x961bc5});console[_0x7485f5(0x13e)]('Validating\x20OAuth\x20tokens...');const _0x523b42=TDX['create']({'site':_0x1ba44e,'accessToken':_0x3105f3[_0x7485f5(0x190)],'logLevel':_0x23ba31??LogLevel[_0x7485f5(0x189)]}),_0x5ad5eb=await _0x523b42[_0x7485f5(0x18d)][_0x7485f5(0x165)]();console[_0x7485f5(0x13e)](a7_0x59d1f5['green'](_0x7485f5(0x179))),console['log']('\x20\x20'+a7_0x59d1f5[_0x7485f5(0x183)](_0x1ba44e+':'+_0x5ad5eb[_0x7485f5(0x130)])+_0x7485f5(0x158)+_0x5ad5eb['id']+_0x7485f5(0x175)+_0x5ad5eb[_0x7485f5(0x145)]+')');!_0x961bc5&&(console['log'](a7_0x59d1f5['dim'](_0x7485f5(0x192))),console[_0x7485f5(0x13e)](a7_0x59d1f5[_0x7485f5(0x14a)](_0x7485f5(0x151))),console['log'](a7_0x59d1f5['dim'](_0x7485f5(0x143))));await saveOAuthTokens(_0x3105f3,_0x3c0b3f),console['log'](_0x7485f5(0x18c)+(_0x3c0b3f?_0x7485f5(0x13b)+_0x3c0b3f+')':''));if(_0x3c0b3f){const _0x502a41={'site':_0x1ba44e};saveProfileToUserConfig(_0x3c0b3f,_0x502a41),console[_0x7485f5(0x13e)](_0x7485f5(0x144)+_0x3c0b3f+_0x7485f5(0x14e));}else saveDefaultSiteToUserConfig(_0x1ba44e),console[_0x7485f5(0x13e)]('✓\x20Default\x20site\x20set\x20to\x20'+_0x1ba44e);const _0x570d84=_0x3c0b3f?'\x20--profile\x20'+_0x3c0b3f:'';console[_0x7485f5(0x13e)](),console[_0x7485f5(0x13e)]('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console[_0x7485f5(0x13e)]('\x20\x20tdx'+_0x570d84+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x7485f5(0x13e)](_0x7485f5(0x137)+_0x570d84+_0x7485f5(0x173));}export async function promptAuthMethod(){const _0x2bb5f8=a7_0x1235,_0x1c59c9=await a7_0x283251({'type':'select','name':_0x2bb5f8(0x139),'message':_0x2bb5f8(0x136),'choices':[{'title':_0x2bb5f8(0x150),'description':_0x2bb5f8(0x182),'value':_0x2bb5f8(0x162)},{'title':_0x2bb5f8(0x186),'description':_0x2bb5f8(0x194),'value':_0x2bb5f8(0x146)}]});return _0x1c59c9['method']||null;}export class AuthSetupCommand extends BaseCommand{[a7_0x120e5b(0x16d)]='auth:setup';['description']='Setup\x20API\x20key\x20authentication\x20interactively';async[a7_0x120e5b(0x152)](_0x20f5ed){const _0x6aa22=a7_0x120e5b,{options:_0x31c4fd}=_0x20f5ed,_0x38ecd2=_0x31c4fd['profile'];console[_0x6aa22(0x13e)](a7_0x59d1f5[_0x6aa22(0x187)](_0x6aa22(0x131)));const _0x3b2743=_0x31c4fd[_0x6aa22(0x167)]||_0x6aa22(0x154),_0xfc0dd9=await promptSiteSelection(_0x3b2743,_0x38ecd2,_0x6aa22(0x15a));if(!_0xfc0dd9)return 0x1;const _0x320620=resolveSite(_0xfc0dd9),_0xda8830=await promptAuthMethod();if(!_0xda8830)return console[_0x6aa22(0x13e)](_0x6aa22(0x134)),0x1;if(_0xda8830===_0x6aa22(0x162)){const {accountName:_0x35c2b1}=_0x31c4fd;return await runOAuthLoginFlow(_0x320620,_0x38ecd2,_0x31c4fd['logLevel']??LogLevel[_0x6aa22(0x189)],{'accountName':_0x35c2b1}),0x0;}console[_0x6aa22(0x13e)](_0x6aa22(0x16c)+_0x320620),console[_0x6aa22(0x13e)](_0x6aa22(0x195)),console['log']('\x20\x20'+getConsoleUrl(_0x320620,_0x6aa22(0x157)));const _0xfbdec8=await a7_0x283251({'type':_0x6aa22(0x13f),'name':_0x6aa22(0x18f),'message':_0x6aa22(0x163),'validate':_0x1992d6=>{const _0x19ef4d=_0x6aa22;if(!_0x1992d6||!_0x1992d6['trim']())return _0x19ef4d(0x142);return!![];}});if(!_0xfbdec8[_0x6aa22(0x18f)])return console[_0x6aa22(0x13e)](_0x6aa22(0x134)),0x1;const _0x20b491=_0xfbdec8[_0x6aa22(0x18f)];console[_0x6aa22(0x13e)](_0x6aa22(0x14f));try{const _0x415fb4=TDX[_0x6aa22(0x16a)]({'site':_0x320620,'apiKey':_0x20b491[_0x6aa22(0x15d)](),'logLevel':_0x31c4fd[_0x6aa22(0x17a)]??LogLevel[_0x6aa22(0x189)]}),_0x477531=await _0x415fb4['jobs'][_0x6aa22(0x165)]();console[_0x6aa22(0x13e)]('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x477531['email']+')');const _0x5ccebc=await isKeychainAvailable();_0x5ccebc?(await saveAPIKeyAsync(_0x20b491[_0x6aa22(0x15d)](),_0x320620,_0x38ecd2),console[_0x6aa22(0x13e)](_0x6aa22(0x133)+(_0x38ecd2?'\x20(profile:\x20'+_0x38ecd2+')':''))):(console[_0x6aa22(0x16b)](a7_0x59d1f5[_0x6aa22(0x168)](_0x6aa22(0x174))),console[_0x6aa22(0x16b)](a7_0x59d1f5[_0x6aa22(0x168)](_0x6aa22(0x17e))));if(_0x38ecd2){const _0x29fcba={'site':_0x320620};saveProfileToUserConfig(_0x38ecd2,_0x29fcba),console[_0x6aa22(0x13e)]('✓\x20Profile\x20\x27'+_0x38ecd2+_0x6aa22(0x14e));}else saveDefaultSiteToUserConfig(_0x320620),console[_0x6aa22(0x13e)](_0x6aa22(0x159)+_0x320620);const _0x33e0e5=_0x38ecd2?'\x20--profile\x20'+_0x38ecd2:'';return console[_0x6aa22(0x13e)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console[_0x6aa22(0x13e)](_0x6aa22(0x137)+_0x33e0e5+_0x6aa22(0x161)),console['log'](_0x6aa22(0x137)+_0x33e0e5+_0x6aa22(0x173)),0x0;}catch(_0x249869){if(_0x249869 instanceof HTTPClientError&&_0x249869[_0x6aa22(0x13c)]===0x191)return printAuthError(_0x249869),0x1;return console[_0x6aa22(0x15e)](a7_0x59d1f5[_0x6aa22(0x155)](_0x6aa22(0x18e)+(_0x249869 instanceof Error?_0x249869[_0x6aa22(0x153)]:String(_0x249869)))),console[_0x6aa22(0x15e)](_0x6aa22(0x14c)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a7_0x120e5b(0x16d)]=a7_0x120e5b(0x16f);[a7_0x120e5b(0x160)]=a7_0x120e5b(0x132);async['execute'](_0x2b2d86){const _0x18a9d5=a7_0x120e5b,{options:_0x3a189a,tdx:_0x3ba6c1}=_0x2b2d86,_0x16551c=_0x3a189a[_0x18a9d5(0x167)],_0x19529c=_0x3a189a[_0x18a9d5(0x156)],_0x3ccee8=_0x19529c?_0x19529c:_0x18a9d5(0x169);console[_0x18a9d5(0x13e)](_0x18a9d5(0x149)+_0x3ccee8+_0x18a9d5(0x140)+_0x16551c+')');const _0x138d4d=await getOAuthTokens(_0x19529c);if(_0x138d4d)console[_0x18a9d5(0x13e)](_0x18a9d5(0x191)),console[_0x18a9d5(0x13e)]('Read\x20credential\x20from\x20keychain'+(_0x19529c?_0x18a9d5(0x13b)+_0x19529c+')':''));else{const _0x4c5851=await resolveAPIKeyAsync(_0x16551c,_0x19529c);if(_0x4c5851){const {source:_0x35139b,isDeprecated:_0x292ed9}=_0x4c5851,_0x46d064='Read\x20credential\x20from\x20'+_0x35139b;console[_0x18a9d5(0x13e)](_0x292ed9?a7_0x59d1f5[_0x18a9d5(0x168)](_0x46d064):_0x46d064);}else console['log'](a7_0x59d1f5[_0x18a9d5(0x168)](_0x18a9d5(0x15f)));}try{const _0x363107=await _0x3ba6c1[_0x18a9d5(0x18d)][_0x18a9d5(0x165)]();return console[_0x18a9d5(0x13e)](a7_0x59d1f5['green'](_0x18a9d5(0x181))),console[_0x18a9d5(0x13e)](_0x18a9d5(0x135)+_0x363107[_0x18a9d5(0x145)]),(_0x363107[_0x18a9d5(0x17d)]||_0x363107['last_name'])&&console[_0x18a9d5(0x13e)](_0x18a9d5(0x18a)+[_0x363107[_0x18a9d5(0x17d)],_0x363107[_0x18a9d5(0x17c)]][_0x18a9d5(0x17b)](Boolean)['join']('\x20')),0x0;}catch(_0x375477){return _0x375477 instanceof HTTPClientError&&_0x375477[_0x18a9d5(0x13c)]===0x191?printAuthError(_0x375477,!![],_0x19529c):console['error'](a7_0x59d1f5['red'](_0x18a9d5(0x18e)+(_0x375477 instanceof Error?_0x375477['message']:String(_0x375477)))),0x1;}}}export class AuthClearCommand extends BaseCommand{['name']=a7_0x120e5b(0x180);[a7_0x120e5b(0x160)]=a7_0x120e5b(0x188);async['execute'](_0x2affd0){const _0x4b0071=a7_0x120e5b,{options:_0x15048c}=_0x2affd0,_0x1c7d24=_0x15048c[_0x4b0071(0x156)];console['log'](a7_0x59d1f5[_0x4b0071(0x187)]('tdx:\x20auth\x20clear'));const _0x5d1326=await isKeychainAvailable();if(!_0x5d1326)return console[_0x4b0071(0x15e)](a7_0x59d1f5[_0x4b0071(0x155)](_0x4b0071(0x166))),0x1;const [_0xdb7d09,_0xa74b2d]=await Promise['all']([deleteKeychainAPIKey(_0x1c7d24),deleteOAuthTokens(_0x1c7d24)]);if(_0xdb7d09||_0xa74b2d){clearCredentialCache();const _0x10c334=[_0xdb7d09&&'API\x20key',_0xa74b2d&&_0x4b0071(0x176)][_0x4b0071(0x17b)](Boolean)[_0x4b0071(0x13d)](_0x4b0071(0x14d));return console['log']('✓\x20'+_0x10c334+_0x4b0071(0x184)+(_0x1c7d24?_0x4b0071(0x13b)+_0x1c7d24+')':'')),0x0;}else return console[_0x4b0071(0x13e)](_0x4b0071(0x178)+(_0x1c7d24?'\x20for\x20profile:\x20'+_0x1c7d24:'')),0x1;}}
@@ -1 +1 @@
1
- const a8_0xdabb1c=a8_0x56da;(function(_0x3e0e5b,_0x50dc62){const _0x175b7e=a8_0x56da,_0xf3a87a=_0x3e0e5b();while(!![]){try{const _0x111168=-parseInt(_0x175b7e(0x107))/0x1+-parseInt(_0x175b7e(0xbe))/0x2*(parseInt(_0x175b7e(0x9a))/0x3)+-parseInt(_0x175b7e(0x96))/0x4+-parseInt(_0x175b7e(0xf4))/0x5+-parseInt(_0x175b7e(0xc4))/0x6+-parseInt(_0x175b7e(0xd8))/0x7+parseInt(_0x175b7e(0xc0))/0x8*(parseInt(_0x175b7e(0xe1))/0x9);if(_0x111168===_0x50dc62)break;else _0xf3a87a['push'](_0xf3a87a['shift']());}catch(_0xdb37f1){_0xf3a87a['push'](_0xf3a87a['shift']());}}}(a8_0x1977,0x50266));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import a8_0x29e169 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a8_0x31c79f from'path';import{confirmKey,isInteractive}from'../utils/prompt.js';function a8_0x1977(){const _0x33ae1a=['join','Pull\x20composable\x20audience\x20to\x20YAML\x20files','isNew','\x20YAML\x20file(s)','description','636850UsgWCj','\x20audience(s)','cwd','error','\x20\x20Table:\x20\x20','log','659628mToQQd','Error:\x20\x20','Audience\x20name\x20required.','behaviors','843SNqbME','relativePath','Would\x20push:\x20','setPhase','\x20(time:\x20','preview','\x20file(s)\x20to\x20','green','Preview\x20composable\x20segment\x20query\x20on\x20CDW','(dry\x20run\x20—\x20no\x20files\x20written)','No\x20CAS\x20resources\x20found\x20in\x20YAML\x20files.','timeColumn','length','dir','list','\x20activation(s)','\x20or\x20set\x20context\x20with\x20','Describe\x20a\x20composable\x20audience','masterSchema','table','Running\x20preview\x20for\x20\x27','Cancelled.','\x27...','cas:preview','No\x20composable\x20audience\x20specified.','\x20\x20Schema:\x20','Use\x20','basename','underline','diff','red','cas:desc','files','Tip:\x20Run\x20`tdx\x20cas\x20pull\x20<name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20=\x20','\x20segment(s)','4478CnZkPS','Wrote\x20','22139704ukUWnD','name','\x20file(s)\x20to\x20write\x20','schema','1836756cKLoBR','audienceName','attributes','column','🧊\x20','All\x20files\x20are\x20up\x20to\x20date.','push','population','\x20segments,\x20','List\x20composable\x20audiences','Write\x20files?','dim','absolutePath','composable_audience','status','audiences','Fetching\x20audience\x20\x27','counts','\x0aSample\x20Rows\x20(','cas:push','2329957aDXSmo','Audience:\x20','type','names','Analyzing\x20CAS\x20YAML\x20files...','success','hasChanges','cyan','bold','9gbbcZm','\x20—\x20','composableAudience','cas','Master\x20Table','dryRun','Context\x20set:\x20','rows','activations','utf-8','segments','masterKeyColumn','\x20composable\x20audiences','yes','tdx\x20cas\x20desc\x20<name>','session','masterTable','Directory\x20not\x20found:\x20','Pulling\x20composable\x20audience\x20\x27','1846380CyfSNC','content','tdx\x20cas\x20pull\x20<name>','map','get','Found\x20','yellow','Push\x20YAML\x20files\x20to\x20CAS\x20API','\x20\x20Key:\x20\x20\x20\x20','data','No\x20composable\x20audiences\x20found.','tdx\x20use\x20cas\x20<name>','verbose','execute'];a8_0x1977=function(){return _0x33ae1a;};return a8_0x1977();}import{collectYamlFiles}from'../sdk/cas/push-workflow.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';export class CASListCommand extends BaseCommand{[a8_0xdabb1c(0xc1)]='cas:list';['description']=a8_0xdabb1c(0xcd);async[a8_0xdabb1c(0x101)](_0x4b9eb2){const _0x522b32=a8_0xdabb1c,{options:_0x157dd8,tdx:_0xe00b1d}=_0x4b9eb2,_0x11edf5=await withProgressSpinner('Fetching\x20composable\x20audiences...',()=>_0xe00b1d[_0x522b32(0xe4)][_0x522b32(0xa8)](),{'verbose':_0x157dd8[_0x522b32(0x100)]}),_0x44a3b4=_0x11edf5[_0x522b32(0xfd)];if(isStructuredFormat(_0x157dd8))return await handleSDKOutput(_0x44a3b4,_0x157dd8),0x0;if(_0x44a3b4[_0x522b32(0xa6)]===0x0)return console[_0x522b32(0x95)](a8_0x29e169[_0x522b32(0xcf)](_0x522b32(0xfe))),0x0;console[_0x522b32(0x95)](a8_0x29e169[_0x522b32(0xa1)](_0x522b32(0xf9)+_0x44a3b4['length']+_0x522b32(0xed)));for(const _0x11951a of _0x44a3b4){const _0x350352=_0x11951a[_0x522b32(0xcb)]?a8_0x29e169['dim']('\x20('+Number(_0x11951a[_0x522b32(0xcb)])['toLocaleString']()+')'):'',_0x10039e=a8_0x29e169[_0x522b32(0xcf)]('\x20'+_0x11951a[_0x522b32(0xac)]+'.'+_0x11951a[_0x522b32(0xf1)]);console['log'](_0x522b32(0xc8)+_0x11951a[_0x522b32(0xc1)]+_0x350352+_0x10039e),_0x11951a['description']&&console['log']('\x20\x20'+a8_0x29e169[_0x522b32(0xcf)](_0x11951a[_0x522b32(0x106)]));}return 0x0;}}function a8_0x56da(_0x3b7b9d,_0x2b0f2c){_0x3b7b9d=_0x3b7b9d-0x92;const _0x19778a=a8_0x1977();let _0x56da23=_0x19778a[_0x3b7b9d];return _0x56da23;}export class CASDescCommand extends BaseCommand{['name']=a8_0xdabb1c(0xb9);[a8_0xdabb1c(0x106)]=a8_0xdabb1c(0xab);async[a8_0xdabb1c(0x101)](_0x7f7136){const _0x1764b6=a8_0xdabb1c,{options:_0x18daa8,args:_0x2e22b4,tdx:_0x1f5ace}=_0x7f7136,_0x840899=_0x2e22b4[0x0]||_0x18daa8[_0x1764b6(0xe3)];if(!_0x840899)return console['error'](a8_0x29e169[_0x1764b6(0xfa)](_0x1764b6(0xb2))),console[_0x1764b6(0x93)](_0x1764b6(0xb4)+a8_0x29e169[_0x1764b6(0xdf)](_0x1764b6(0xef))+_0x1764b6(0xaa)+a8_0x29e169[_0x1764b6(0xdf)]('tdx\x20use\x20cas\x20<name>')),0x1;const _0x30905e=await withProgressSpinner(_0x1764b6(0xd4)+_0x840899+_0x1764b6(0xb0),()=>_0x1f5ace[_0x1764b6(0xe4)][_0x1764b6(0xf8)](_0x840899),{'verbose':_0x18daa8[_0x1764b6(0x100)]}),_0x446c70=_0x30905e[_0x1764b6(0xfd)];if(isStructuredFormat(_0x18daa8))return await handleSingleObjectOutput(_0x446c70,_0x18daa8),0x0;console['log'](a8_0x29e169[_0x1764b6(0xe0)](_0x446c70[_0x1764b6(0xc1)]));if(_0x446c70[_0x1764b6(0x106)])console[_0x1764b6(0x95)](a8_0x29e169[_0x1764b6(0xcf)](_0x446c70[_0x1764b6(0x106)]));console[_0x1764b6(0x95)](),console['log'](a8_0x29e169[_0x1764b6(0xb6)](_0x1764b6(0xe5))),console[_0x1764b6(0x95)](_0x1764b6(0xb3)+_0x446c70[_0x1764b6(0xac)]),console[_0x1764b6(0x95)](_0x1764b6(0x94)+_0x446c70[_0x1764b6(0xf1)]),console['log'](_0x1764b6(0xfc)+_0x446c70[_0x1764b6(0xec)]),console[_0x1764b6(0x95)]();if(_0x446c70[_0x1764b6(0xc6)]?.[_0x1764b6(0xa6)]){console[_0x1764b6(0x95)](a8_0x29e169[_0x1764b6(0xb6)]('Attributes\x20('+_0x446c70['attributes'][_0x1764b6(0xa6)]+')'));for(const _0x1022ce of _0x446c70['attributes']){console[_0x1764b6(0x95)]('\x20\x20'+a8_0x29e169['bold'](_0x1022ce['name'])+_0x1764b6(0xe2)+_0x1022ce[_0x1764b6(0xc3)]+'.'+_0x1022ce[_0x1764b6(0xad)]+'.'+_0x1022ce[_0x1764b6(0xc7)]+'\x20('+a8_0x29e169[_0x1764b6(0xcf)](_0x1022ce[_0x1764b6(0xda)])+')');}console[_0x1764b6(0x95)]();}if(_0x446c70[_0x1764b6(0x99)]?.['length']){console['log'](a8_0x29e169[_0x1764b6(0xb6)]('Behaviors\x20('+_0x446c70[_0x1764b6(0x99)][_0x1764b6(0xa6)]+')'));for(const _0x236da9 of _0x446c70[_0x1764b6(0x99)]){const _0xee710f=_0x236da9['timeColumn']?_0x1764b6(0x9e)+_0x236da9[_0x1764b6(0xa5)]+')':'';console['log']('\x20\x20'+a8_0x29e169['bold'](_0x236da9[_0x1764b6(0xc1)])+_0x1764b6(0xe2)+_0x236da9['schema']+'.'+_0x236da9[_0x1764b6(0xad)]+_0xee710f);}}return 0x0;}}export class CASPullCommand extends BaseCommand{[a8_0xdabb1c(0xc1)]='cas:pull';['description']=a8_0xdabb1c(0x103);async[a8_0xdabb1c(0x101)](_0x57ff31){const _0x1d6eea=a8_0xdabb1c,{options:_0x1e0466,args:_0x3bab17,tdx:_0x28ffcd}=_0x57ff31,_0x141cfd=_0x1e0466,_0x4515ad=_0x3bab17[0x0]||_0x1e0466[_0x1d6eea(0xe3)];if(!_0x4515ad)return console[_0x1d6eea(0x93)](a8_0x29e169['yellow'](_0x1d6eea(0xb2))),console['error'](_0x1d6eea(0xb4)+a8_0x29e169[_0x1d6eea(0xdf)](_0x1d6eea(0xf6))+'\x20or\x20set\x20context\x20with\x20'+a8_0x29e169[_0x1d6eea(0xdf)](_0x1d6eea(0xff))),0x1;const _0xea4377=_0x141cfd[_0x1d6eea(0xa7)]||a8_0x31c79f['join'](process[_0x1d6eea(0x92)](),_0x1d6eea(0xe4),sanitizeFileName(_0x4515ad)),_0x281b07=await withProgressSpinner(_0x1d6eea(0xf3)+_0x4515ad+_0x1d6eea(0xb0),_0x3f34cb=>_0x28ffcd['cas']['pull'](_0x4515ad,{'targetDir':_0xea4377,'verbose':_0x141cfd[_0x1d6eea(0x100)],'progress':{'update':_0x1d2e21=>_0x3f34cb[_0x1d6eea(0x9d)](_0x1d2e21)}}),{'verbose':_0x141cfd['verbose']}),_0x2bda43=_0x281b07[_0x1d6eea(0xfd)],_0x4ff290=_0x2bda43[_0x1d6eea(0xba)]['filter'](_0x52fa7e=>_0x52fa7e['isNew']||_0x52fa7e[_0x1d6eea(0xde)]);saveSessionContext({'composable_audience':_0x2bda43[_0x1d6eea(0xc5)]},_0x141cfd[_0x1d6eea(0xf0)]),console[_0x1d6eea(0x95)](a8_0x29e169[_0x1d6eea(0xa1)](_0x1d6eea(0xe7)+a8_0x29e169['dim'](_0x1d6eea(0xd1))+_0x1d6eea(0xbc)+a8_0x29e169['cyan'](_0x2bda43[_0x1d6eea(0xc5)])));if(_0x4ff290[_0x1d6eea(0xa6)]===0x0)return console[_0x1d6eea(0x95)](a8_0x29e169[_0x1d6eea(0xa1)](_0x1d6eea(0xc9))),0x0;for(const _0x4ed5b1 of _0x4ff290){if(_0x4ed5b1[_0x1d6eea(0x104)])console['log'](a8_0x29e169[_0x1d6eea(0xa1)]('+\x20'+_0x4ed5b1[_0x1d6eea(0x9b)]+'\x20(new)'));else _0x4ed5b1[_0x1d6eea(0xb7)]&&(console[_0x1d6eea(0x95)](a8_0x29e169[_0x1d6eea(0xfa)]('~\x20'+_0x4ed5b1[_0x1d6eea(0x9b)])),console['log'](_0x4ed5b1[_0x1d6eea(0xb7)]));}console[_0x1d6eea(0x95)]('\x0a'+_0x4ff290[_0x1d6eea(0xa6)]+_0x1d6eea(0xc2)+('('+_0x2bda43[_0x1d6eea(0xd5)][_0x1d6eea(0xeb)]+_0x1d6eea(0xcc)+_0x2bda43['counts'][_0x1d6eea(0xe9)]+'\x20activations)'));if(_0x141cfd[_0x1d6eea(0xe6)])return console[_0x1d6eea(0x95)](a8_0x29e169['dim'](_0x1d6eea(0xa3))),0x0;if(!_0x141cfd[_0x1d6eea(0xee)]&&isInteractive()){const _0x52aee4=await confirmKey(_0x1d6eea(0xce));if(!_0x52aee4)return console[_0x1d6eea(0x95)](a8_0x29e169[_0x1d6eea(0xcf)](_0x1d6eea(0xaf))),0x0;}for(const _0x1152ef of _0x4ff290){const _0x4e5d7c=a8_0x31c79f['dirname'](_0x1152ef[_0x1d6eea(0xd0)]);if(!existsSync(_0x4e5d7c))mkdirSync(_0x4e5d7c,{'recursive':!![]});writeFileSync(_0x1152ef['absolutePath'],_0x1152ef[_0x1d6eea(0xf5)],_0x1d6eea(0xea));}return console[_0x1d6eea(0x95)](a8_0x29e169[_0x1d6eea(0xa1)](_0x1d6eea(0xbf)+_0x4ff290[_0x1d6eea(0xa6)]+_0x1d6eea(0xa0)+_0xea4377)),0x0;}}export class CASPushCommand extends BaseCommand{[a8_0xdabb1c(0xc1)]=a8_0xdabb1c(0xd7);[a8_0xdabb1c(0x106)]=a8_0xdabb1c(0xfb);async[a8_0xdabb1c(0x101)](_0x39047c){const _0x40febb=a8_0xdabb1c,{options:_0x119943,args:_0x104fa3,tdx:_0x32f280}=_0x39047c,_0x23fc8c=_0x119943;let _0x3af37e=_0x104fa3[0x0];!_0x3af37e&&_0x119943['composableAudience']&&(_0x3af37e=a8_0x31c79f['join'](process[_0x40febb(0x92)](),'cas',sanitizeFileName(_0x119943['composableAudience'])));if(!_0x3af37e)return console['error'](a8_0x29e169[_0x40febb(0xfa)](_0x40febb(0xb2))),console[_0x40febb(0x93)](_0x40febb(0xb4)+a8_0x29e169[_0x40febb(0xdf)]('tdx\x20cas\x20push\x20<path>')+'\x20or\x20set\x20context\x20with\x20'+a8_0x29e169[_0x40febb(0xdf)](_0x40febb(0xff))),0x1;if(!existsSync(_0x3af37e))return console['error'](a8_0x29e169[_0x40febb(0xb8)](_0x40febb(0xf2)+_0x3af37e)),console[_0x40febb(0x93)](a8_0x29e169['dim'](_0x40febb(0xbb))),0x1;const _0x1788af=_0x119943['composableAudience']||a8_0x31c79f[_0x40febb(0xb5)](_0x3af37e),_0x5c7ed7=a8_0x31c79f['relative'](process[_0x40febb(0x92)](),_0x3af37e)||'.';console['log'](_0x40febb(0xd9)+a8_0x29e169[_0x40febb(0xdf)](_0x1788af)),console[_0x40febb(0x95)]('Source:\x20\x20\x20'+a8_0x29e169[_0x40febb(0xcf)](_0x5c7ed7)),console[_0x40febb(0x95)](a8_0x29e169[_0x40febb(0xfa)]('\x0a⚠\x20Experimental:\x20CAS\x20push\x20runs\x20in\x20dry-run\x20mode\x20only.\x20Push\x20support\x20is\x20not\x20yet\x20complete.')),console['log']();const _0x208218=collectYamlFiles(_0x3af37e);if(_0x208218['length']===0x0)return console[_0x40febb(0x93)](a8_0x29e169[_0x40febb(0xb8)]('No\x20YAML\x20files\x20found\x20in:\x20'+_0x3af37e)),0x1;console[_0x40febb(0x95)](_0x40febb(0xf9)+_0x208218[_0x40febb(0xa6)]+_0x40febb(0x105));const _0x29e322=await withProgressSpinner(_0x40febb(0xdc),_0x563328=>_0x32f280['cas'][_0x40febb(0xca)](_0x208218,{'dryRun':!![],'verbose':_0x23fc8c[_0x40febb(0x100)],'progress':{'update':_0x290aed=>_0x563328[_0x40febb(0x9d)](_0x290aed)}}),{'verbose':_0x23fc8c[_0x40febb(0x100)]}),_0x3acb0d=_0x29e322[_0x40febb(0xfd)],{created:_0x488328}=_0x3acb0d,_0x29c841=[];if(_0x488328['audiences'])_0x29c841['push'](_0x488328[_0x40febb(0xd3)]+_0x40febb(0x108));if(_0x488328[_0x40febb(0xeb)])_0x29c841[_0x40febb(0xca)](_0x488328[_0x40febb(0xeb)]+_0x40febb(0xbd));if(_0x488328['activations'])_0x29c841[_0x40febb(0xca)](_0x488328['activations']+_0x40febb(0xa9));return _0x29c841[_0x40febb(0xa6)]===0x0?console[_0x40febb(0x95)](a8_0x29e169[_0x40febb(0xcf)](_0x40febb(0xa4))):console['log'](_0x40febb(0x9c)+_0x29c841[_0x40febb(0x102)](',\x20')),console['log'](a8_0x29e169[_0x40febb(0xcf)]('(dry\x20run\x20—\x20push\x20is\x20not\x20yet\x20implemented)')),0x0;}}export class CASPreviewCommand extends BaseCommand{[a8_0xdabb1c(0xc1)]=a8_0xdabb1c(0xb1);['description']=a8_0xdabb1c(0xa2);async[a8_0xdabb1c(0x101)](_0x111158){const _0xf7aa06=a8_0xdabb1c,{options:_0x563e8d,args:_0x3ac5eb,tdx:_0x255a07}=_0x111158,_0x43b27c=_0x3ac5eb[0x0],_0x574db6=_0x3ac5eb[0x1]||_0x563e8d[_0xf7aa06(0xe3)];if(!_0x43b27c)return console['error'](a8_0x29e169[_0xf7aa06(0xb8)]('Usage:\x20tdx\x20cas\x20preview\x20<segment_name>\x20[--audience\x20<name>]')),0x1;if(!_0x574db6)return console[_0xf7aa06(0x93)](a8_0x29e169[_0xf7aa06(0xfa)](_0xf7aa06(0x98))),console['error']('Use\x20'+a8_0x29e169[_0xf7aa06(0xdf)]('--audience\x20<name>')+'\x20or\x20set\x20context\x20with\x20'+a8_0x29e169[_0xf7aa06(0xdf)]('tdx\x20use\x20cas\x20<name>')),0x1;const _0x313052=await withProgressSpinner(_0xf7aa06(0xae)+_0x43b27c+_0xf7aa06(0xb0),()=>_0x255a07[_0xf7aa06(0xe4)][_0xf7aa06(0x9f)](_0x574db6,_0x43b27c),{'verbose':_0x563e8d[_0xf7aa06(0x100)]}),{query:_0x1057c1,customers:_0x35d56d}=_0x313052[_0xf7aa06(0xfd)];if(isStructuredFormat(_0x563e8d))return await handleSingleObjectOutput({'query':_0x1057c1,'customers':_0x35d56d},_0x563e8d),0x0;const _0x40456d=_0x1057c1[_0xf7aa06(0xd2)]===_0xf7aa06(0xdd)?a8_0x29e169[_0xf7aa06(0xa1)]:a8_0x29e169['yellow'];console[_0xf7aa06(0x95)]('Status:\x20'+_0x40456d(_0x1057c1[_0xf7aa06(0xd2)])),console[_0xf7aa06(0x95)]('Count:\x20\x20'+a8_0x29e169[_0xf7aa06(0xe0)](String(_0x1057c1['count'])));_0x1057c1['error']&&console['log'](_0xf7aa06(0x97)+a8_0x29e169[_0xf7aa06(0xb8)](_0x1057c1[_0xf7aa06(0x93)]));if(_0x35d56d?.[_0xf7aa06(0xdb)]&&_0x35d56d?.[_0xf7aa06(0xe8)]){console[_0xf7aa06(0x95)](a8_0x29e169[_0xf7aa06(0xb6)](_0xf7aa06(0xd6)+_0x35d56d[_0xf7aa06(0xe8)][_0xf7aa06(0xa6)]+')'));const _0x36b7be=_0x35d56d[_0xf7aa06(0xe8)][_0xf7aa06(0xf7)](_0x5a0e58=>{const _0x3066bc=_0xf7aa06,_0x358389={};for(let _0x54f6a6=0x0;_0x54f6a6<_0x35d56d[_0x3066bc(0xdb)][_0x3066bc(0xa6)];_0x54f6a6++){_0x358389[_0x35d56d[_0x3066bc(0xdb)][_0x54f6a6]]=_0x5a0e58[_0x54f6a6];}return _0x358389;});await handleSDKOutput(_0x36b7be,_0x563e8d);}return 0x0;}}
1
+ const a8_0x515b60=a8_0x33fa;(function(_0x514d0c,_0x52cbc0){const _0x1f64cc=a8_0x33fa,_0x1b213c=_0x514d0c();while(!![]){try{const _0x2801f9=-parseInt(_0x1f64cc(0x152))/0x1*(-parseInt(_0x1f64cc(0x100))/0x2)+parseInt(_0x1f64cc(0x14c))/0x3*(-parseInt(_0x1f64cc(0x12e))/0x4)+-parseInt(_0x1f64cc(0x139))/0x5*(-parseInt(_0x1f64cc(0x155))/0x6)+-parseInt(_0x1f64cc(0x179))/0x7*(parseInt(_0x1f64cc(0x165))/0x8)+parseInt(_0x1f64cc(0x126))/0x9+-parseInt(_0x1f64cc(0x113))/0xa+parseInt(_0x1f64cc(0x163))/0xb*(parseInt(_0x1f64cc(0x160))/0xc);if(_0x2801f9===_0x52cbc0)break;else _0x1b213c['push'](_0x1b213c['shift']());}catch(_0x4c365b){_0x1b213c['push'](_0x1b213c['shift']());}}}(a8_0x1531,0x26db3));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import a8_0xb443bc from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a8_0x34f308 from'path';import{confirmKey,isInteractive}from'../utils/prompt.js';import{collectYamlFiles}from'../sdk/cas/push-workflow.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';export class CASListCommand extends BaseCommand{['name']='cas:list';[a8_0x515b60(0x125)]=a8_0x515b60(0x12a);async[a8_0x515b60(0x158)](_0x417dd8){const _0x52cb68=a8_0x515b60,{options:_0x58a320,tdx:_0x23dca9}=_0x417dd8,_0x18686f=await withProgressSpinner(_0x52cb68(0x17b),()=>_0x23dca9['cas'][_0x52cb68(0x166)](),{'verbose':_0x58a320[_0x52cb68(0x13c)]}),_0x42854b=_0x18686f[_0x52cb68(0x138)];if(isStructuredFormat(_0x58a320))return await handleSDKOutput(_0x42854b,_0x58a320),0x0;if(_0x42854b['length']===0x0)return console[_0x52cb68(0x17c)](a8_0xb443bc[_0x52cb68(0x12d)](_0x52cb68(0x106))),0x0;console[_0x52cb68(0x17c)](a8_0xb443bc[_0x52cb68(0x109)]('Found\x20'+_0x42854b[_0x52cb68(0x10c)]+_0x52cb68(0x115)));for(const _0x56ede8 of _0x42854b){const _0x78a620=_0x56ede8['population']?a8_0xb443bc[_0x52cb68(0x12d)]('\x20('+Number(_0x56ede8[_0x52cb68(0x114)])[_0x52cb68(0x16f)]()+')'):'',_0x525131=a8_0xb443bc['dim']('\x20'+_0x56ede8[_0x52cb68(0x15b)]+'.'+_0x56ede8[_0x52cb68(0x15e)]);console[_0x52cb68(0x17c)](_0x52cb68(0x135)+_0x56ede8[_0x52cb68(0x16c)]+_0x78a620+_0x525131),_0x56ede8[_0x52cb68(0x125)]&&console[_0x52cb68(0x17c)]('\x20\x20'+a8_0xb443bc[_0x52cb68(0x12d)](_0x56ede8[_0x52cb68(0x125)]));}return 0x0;}}export class CASDescCommand extends BaseCommand{['name']='cas:desc';[a8_0x515b60(0x125)]=a8_0x515b60(0x131);async[a8_0x515b60(0x158)](_0x59f208){const _0x5a6c3d=a8_0x515b60,{options:_0x1af848,args:_0x3cd4be,tdx:_0x5c0229}=_0x59f208,_0x597c63=_0x3cd4be[0x0]||_0x1af848['composableAudience'];if(!_0x597c63)return console[_0x5a6c3d(0x156)](a8_0xb443bc[_0x5a6c3d(0x103)](_0x5a6c3d(0x169))),console[_0x5a6c3d(0x156)]('Use\x20'+a8_0xb443bc[_0x5a6c3d(0x157)](_0x5a6c3d(0x116))+_0x5a6c3d(0x107)+a8_0xb443bc[_0x5a6c3d(0x157)](_0x5a6c3d(0x148))),0x1;const _0x24a85e=await withProgressSpinner(_0x5a6c3d(0x104)+_0x597c63+_0x5a6c3d(0x11b),()=>_0x5c0229[_0x5a6c3d(0x11d)][_0x5a6c3d(0x141)](_0x597c63),{'verbose':_0x1af848[_0x5a6c3d(0x13c)]}),_0x4d80ef=_0x24a85e[_0x5a6c3d(0x138)];if(isStructuredFormat(_0x1af848))return await handleSingleObjectOutput(_0x4d80ef,_0x1af848),0x0;console[_0x5a6c3d(0x17c)](a8_0xb443bc['bold'](_0x4d80ef['name']));if(_0x4d80ef[_0x5a6c3d(0x125)])console['log'](a8_0xb443bc[_0x5a6c3d(0x12d)](_0x4d80ef[_0x5a6c3d(0x125)]));console[_0x5a6c3d(0x17c)](),console[_0x5a6c3d(0x17c)](a8_0xb443bc[_0x5a6c3d(0x122)](_0x5a6c3d(0x172))),console[_0x5a6c3d(0x17c)](_0x5a6c3d(0x164)+_0x4d80ef[_0x5a6c3d(0x15b)]),console['log'](_0x5a6c3d(0x147)+_0x4d80ef[_0x5a6c3d(0x15e)]),console[_0x5a6c3d(0x17c)](_0x5a6c3d(0x136)+_0x4d80ef[_0x5a6c3d(0x10e)]),console[_0x5a6c3d(0x17c)]();if(_0x4d80ef[_0x5a6c3d(0x13e)]?.[_0x5a6c3d(0x10c)]){console['log'](a8_0xb443bc[_0x5a6c3d(0x122)](_0x5a6c3d(0x13d)+_0x4d80ef[_0x5a6c3d(0x13e)][_0x5a6c3d(0x10c)]+')'));for(const _0x3bb5e5 of _0x4d80ef['attributes']){console[_0x5a6c3d(0x17c)]('\x20\x20'+a8_0xb443bc[_0x5a6c3d(0x129)](_0x3bb5e5[_0x5a6c3d(0x16c)])+_0x5a6c3d(0xff)+_0x3bb5e5[_0x5a6c3d(0x14e)]+'.'+_0x3bb5e5['table']+'.'+_0x3bb5e5[_0x5a6c3d(0x16a)]+'\x20('+a8_0xb443bc[_0x5a6c3d(0x12d)](_0x3bb5e5[_0x5a6c3d(0x137)])+')');}console[_0x5a6c3d(0x17c)]();}if(_0x4d80ef['behaviors']?.[_0x5a6c3d(0x10c)]){console[_0x5a6c3d(0x17c)](a8_0xb443bc[_0x5a6c3d(0x122)]('Behaviors\x20('+_0x4d80ef['behaviors'][_0x5a6c3d(0x10c)]+')'));for(const _0x309685 of _0x4d80ef[_0x5a6c3d(0x108)]){const _0x26fca7=_0x309685[_0x5a6c3d(0x143)]?_0x5a6c3d(0x121)+_0x309685[_0x5a6c3d(0x143)]+')':'';console['log']('\x20\x20'+a8_0xb443bc['bold'](_0x309685[_0x5a6c3d(0x16c)])+_0x5a6c3d(0xff)+_0x309685[_0x5a6c3d(0x14e)]+'.'+_0x309685['table']+_0x26fca7);}}return 0x0;}}export class CASPullCommand extends BaseCommand{[a8_0x515b60(0x16c)]=a8_0x515b60(0x14b);['description']=a8_0x515b60(0x151);async[a8_0x515b60(0x158)](_0x263582){const _0x15dc28=a8_0x515b60,{options:_0x131f82,args:_0x5188d4,tdx:_0xa1b8b9}=_0x263582,_0x25512a=_0x131f82,_0x12a516=_0x5188d4[0x0]||_0x131f82[_0x15dc28(0x170)];if(!_0x12a516)return console[_0x15dc28(0x156)](a8_0xb443bc[_0x15dc28(0x103)]('No\x20composable\x20audience\x20specified.')),console[_0x15dc28(0x156)]('Use\x20'+a8_0xb443bc[_0x15dc28(0x157)](_0x15dc28(0x173))+_0x15dc28(0x107)+a8_0xb443bc['cyan']('tdx\x20use\x20cas\x20<name>')),0x1;const _0x67f60=_0x25512a[_0x15dc28(0x14f)]||a8_0x34f308['join'](process[_0x15dc28(0x17a)](),_0x15dc28(0x11d),sanitizeFileName(_0x12a516)),_0x3164a9=await withProgressSpinner(_0x15dc28(0x13f)+_0x12a516+_0x15dc28(0x11b),_0x3af836=>_0xa1b8b9[_0x15dc28(0x11d)]['pull'](_0x12a516,{'targetDir':_0x67f60,'verbose':_0x25512a[_0x15dc28(0x13c)],'progress':{'update':_0x7ac984=>_0x3af836[_0x15dc28(0x118)](_0x7ac984)}}),{'verbose':_0x25512a[_0x15dc28(0x13c)]}),_0x33c44d=_0x3164a9[_0x15dc28(0x138)],_0x5ac865=_0x33c44d[_0x15dc28(0x153)][_0x15dc28(0x167)](_0x1f2680=>_0x1f2680['isNew']||_0x1f2680['hasChanges']);saveSessionContext({'composable_audience':_0x33c44d[_0x15dc28(0x15c)]},_0x25512a[_0x15dc28(0x119)]),console['log'](a8_0xb443bc[_0x15dc28(0x109)](_0x15dc28(0x112)+a8_0xb443bc[_0x15dc28(0x12d)]('composable_audience')+_0x15dc28(0x11a)+a8_0xb443bc[_0x15dc28(0x157)](_0x33c44d[_0x15dc28(0x15c)])));if(_0x5ac865[_0x15dc28(0x10c)]===0x0)return console[_0x15dc28(0x17c)](a8_0xb443bc['green'](_0x15dc28(0x154))),0x0;for(const _0x41a24a of _0x5ac865){if(_0x41a24a['isNew'])console[_0x15dc28(0x17c)](a8_0xb443bc[_0x15dc28(0x109)]('+\x20'+_0x41a24a[_0x15dc28(0x176)]+_0x15dc28(0x10b)));else _0x41a24a[_0x15dc28(0x134)]&&(console[_0x15dc28(0x17c)](a8_0xb443bc[_0x15dc28(0x103)]('~\x20'+_0x41a24a[_0x15dc28(0x176)])),console[_0x15dc28(0x17c)](_0x41a24a[_0x15dc28(0x134)]));}console[_0x15dc28(0x17c)]('\x0a'+_0x5ac865['length']+_0x15dc28(0x145)+('('+_0x33c44d[_0x15dc28(0x174)][_0x15dc28(0x12c)]+_0x15dc28(0x130)+_0x33c44d[_0x15dc28(0x174)][_0x15dc28(0x120)]+_0x15dc28(0x132)));if(_0x25512a[_0x15dc28(0x128)])return console[_0x15dc28(0x17c)](a8_0xb443bc['dim'](_0x15dc28(0x15f))),0x0;if(!_0x25512a[_0x15dc28(0x127)]&&isInteractive()){const _0x708ef7=await confirmKey(_0x15dc28(0x149));if(!_0x708ef7)return console[_0x15dc28(0x17c)](a8_0xb443bc[_0x15dc28(0x12d)](_0x15dc28(0x13b))),0x0;}for(const _0x335b96 of _0x5ac865){const _0xf5a3c9=a8_0x34f308[_0x15dc28(0x14a)](_0x335b96[_0x15dc28(0x16b)]);if(!existsSync(_0xf5a3c9))mkdirSync(_0xf5a3c9,{'recursive':!![]});writeFileSync(_0x335b96['absolutePath'],_0x335b96['content'],_0x15dc28(0x10a));}return console[_0x15dc28(0x17c)](a8_0xb443bc[_0x15dc28(0x109)]('Wrote\x20'+_0x5ac865[_0x15dc28(0x10c)]+_0x15dc28(0x10d)+_0x67f60)),0x0;}}function a8_0x33fa(_0x4c7bc2,_0x5b9b0f){_0x4c7bc2=_0x4c7bc2-0xff;const _0x153176=a8_0x1531();let _0x33faa0=_0x153176[_0x4c7bc2];return _0x33faa0;}export class CASPushCommand extends BaseCommand{[a8_0x515b60(0x16c)]=a8_0x515b60(0x133);['description']=a8_0x515b60(0x13a);async[a8_0x515b60(0x158)](_0x5a0964){const _0x37f0cf=a8_0x515b60,{options:_0x491c1d,args:_0x5ab4ef,tdx:_0x1bcd27}=_0x5a0964,_0x288b29=_0x491c1d;let _0xcafce6=_0x5ab4ef[0x0];!_0xcafce6&&_0x491c1d[_0x37f0cf(0x170)]&&(_0xcafce6=a8_0x34f308[_0x37f0cf(0x11e)](process[_0x37f0cf(0x17a)](),_0x37f0cf(0x11d),sanitizeFileName(_0x491c1d[_0x37f0cf(0x170)])));if(!_0xcafce6)return console[_0x37f0cf(0x156)](a8_0xb443bc[_0x37f0cf(0x103)](_0x37f0cf(0x169))),console['error']('Use\x20'+a8_0xb443bc[_0x37f0cf(0x157)](_0x37f0cf(0x10f))+_0x37f0cf(0x107)+a8_0xb443bc[_0x37f0cf(0x157)](_0x37f0cf(0x148))),0x1;if(!existsSync(_0xcafce6))return console[_0x37f0cf(0x156)](a8_0xb443bc[_0x37f0cf(0x178)](_0x37f0cf(0x150)+_0xcafce6)),console[_0x37f0cf(0x156)](a8_0xb443bc[_0x37f0cf(0x12d)](_0x37f0cf(0x142))),0x1;const _0x25dab2=_0x491c1d['composableAudience']||a8_0x34f308[_0x37f0cf(0x11f)](_0xcafce6),_0x4f6c21=a8_0x34f308[_0x37f0cf(0x171)](process[_0x37f0cf(0x17a)](),_0xcafce6)||'.';console[_0x37f0cf(0x17c)](_0x37f0cf(0x105)+a8_0xb443bc[_0x37f0cf(0x157)](_0x25dab2)),console['log'](_0x37f0cf(0x12b)+a8_0xb443bc[_0x37f0cf(0x12d)](_0x4f6c21)),console[_0x37f0cf(0x17c)](a8_0xb443bc['yellow'](_0x37f0cf(0x124))),console[_0x37f0cf(0x17c)]();const _0x238857=collectYamlFiles(_0xcafce6);if(_0x238857['length']===0x0)return console[_0x37f0cf(0x156)](a8_0xb443bc[_0x37f0cf(0x178)](_0x37f0cf(0x123)+_0xcafce6)),0x1;console[_0x37f0cf(0x17c)]('Found\x20'+_0x238857[_0x37f0cf(0x10c)]+_0x37f0cf(0x175));const _0xec4204=await withProgressSpinner(_0x37f0cf(0x102),_0x32caf7=>_0x1bcd27[_0x37f0cf(0x11d)][_0x37f0cf(0x111)](_0x238857,{'dryRun':!![],'verbose':_0x288b29[_0x37f0cf(0x13c)],'progress':{'update':_0x406b77=>_0x32caf7[_0x37f0cf(0x118)](_0x406b77)}}),{'verbose':_0x288b29[_0x37f0cf(0x13c)]}),_0x2b1a13=_0xec4204[_0x37f0cf(0x138)],{created:_0x164730}=_0x2b1a13,_0x315723=[];if(_0x164730[_0x37f0cf(0x117)])_0x315723[_0x37f0cf(0x111)](_0x164730['audiences']+_0x37f0cf(0x161));if(_0x164730[_0x37f0cf(0x12c)])_0x315723[_0x37f0cf(0x111)](_0x164730[_0x37f0cf(0x12c)]+_0x37f0cf(0x101));if(_0x164730[_0x37f0cf(0x120)])_0x315723[_0x37f0cf(0x111)](_0x164730[_0x37f0cf(0x120)]+_0x37f0cf(0x140));return _0x315723['length']===0x0?console['log'](a8_0xb443bc[_0x37f0cf(0x12d)](_0x37f0cf(0x15a))):console[_0x37f0cf(0x17c)](_0x37f0cf(0x16d)+_0x315723['join'](',\x20')),console[_0x37f0cf(0x17c)](a8_0xb443bc['dim']('(dry\x20run\x20—\x20push\x20is\x20not\x20yet\x20implemented)')),0x0;}}export class CASPreviewCommand extends BaseCommand{['name']=a8_0x515b60(0x146);[a8_0x515b60(0x125)]=a8_0x515b60(0x15d);async[a8_0x515b60(0x158)](_0x1fa677){const _0x1421de=a8_0x515b60,{options:_0x48ab22,args:_0x3c70a7,tdx:_0x7ba81f}=_0x1fa677,_0x2bb3a1=_0x3c70a7[0x0],_0x59b099=_0x3c70a7[0x1]||_0x48ab22[_0x1421de(0x170)];if(!_0x2bb3a1)return console[_0x1421de(0x156)](a8_0xb443bc['red'](_0x1421de(0x17d))),0x1;if(!_0x59b099)return console['error'](a8_0xb443bc[_0x1421de(0x103)](_0x1421de(0x144))),console[_0x1421de(0x156)](_0x1421de(0x159)+a8_0xb443bc[_0x1421de(0x157)](_0x1421de(0x16e))+'\x20or\x20set\x20context\x20with\x20'+a8_0xb443bc[_0x1421de(0x157)](_0x1421de(0x148))),0x1;const _0x2d7584=await withProgressSpinner(_0x1421de(0x11c)+_0x2bb3a1+_0x1421de(0x11b),()=>_0x7ba81f[_0x1421de(0x11d)][_0x1421de(0x162)](_0x59b099,_0x2bb3a1),{'verbose':_0x48ab22[_0x1421de(0x13c)]}),{query:_0x5695d4,customers:_0x130cb1}=_0x2d7584[_0x1421de(0x138)];if(isStructuredFormat(_0x48ab22))return await handleSingleObjectOutput({'query':_0x5695d4,'customers':_0x130cb1},_0x48ab22),0x0;const _0x264a1a=_0x5695d4[_0x1421de(0x110)]===_0x1421de(0x177)?a8_0xb443bc['green']:a8_0xb443bc[_0x1421de(0x103)];console['log']('Status:\x20'+_0x264a1a(_0x5695d4[_0x1421de(0x110)])),console[_0x1421de(0x17c)]('Count:\x20\x20'+a8_0xb443bc['bold'](String(_0x5695d4[_0x1421de(0x168)])));_0x5695d4['error']&&console[_0x1421de(0x17c)]('Error:\x20\x20'+a8_0xb443bc['red'](_0x5695d4['error']));if(_0x130cb1?.[_0x1421de(0x14d)]&&_0x130cb1?.[_0x1421de(0x12f)]){console[_0x1421de(0x17c)](a8_0xb443bc['underline']('\x0aSample\x20Rows\x20('+_0x130cb1['rows']['length']+')'));const _0x5c717f=_0x130cb1[_0x1421de(0x12f)]['map'](_0x45f367=>{const _0x271fcb=_0x1421de,_0x5c34e8={};for(let _0xc4dfa7=0x0;_0xc4dfa7<_0x130cb1[_0x271fcb(0x14d)][_0x271fcb(0x10c)];_0xc4dfa7++){_0x5c34e8[_0x130cb1[_0x271fcb(0x14d)][_0xc4dfa7]]=_0x45f367[_0xc4dfa7];}return _0x5c34e8;});await handleSDKOutput(_0x5c717f,_0x48ab22);}return 0x0;}}function a8_0x1531(){const _0xf29bc8=['basename','activations','\x20(time:\x20','underline','No\x20YAML\x20files\x20found\x20in:\x20','\x0a⚠\x20Experimental:\x20CAS\x20push\x20runs\x20in\x20dry-run\x20mode\x20only.\x20Push\x20support\x20is\x20not\x20yet\x20complete.','description','823068MDXpww','yes','dryRun','bold','List\x20composable\x20audiences','Source:\x20\x20\x20','segments','dim','460348qQPjyt','rows','\x20segments,\x20','Describe\x20a\x20composable\x20audience','\x20activations)','cas:push','diff','🧊\x20','\x20\x20Key:\x20\x20\x20\x20','type','data','681985oUdBMw','Push\x20YAML\x20files\x20to\x20CAS\x20API','Cancelled.','verbose','Attributes\x20(','attributes','Pulling\x20composable\x20audience\x20\x27','\x20activation(s)','get','Tip:\x20Run\x20`tdx\x20cas\x20pull\x20<name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','timeColumn','Audience\x20name\x20required.','\x20file(s)\x20to\x20write\x20','cas:preview','\x20\x20Table:\x20\x20','tdx\x20use\x20cas\x20<name>','Write\x20files?','dirname','cas:pull','3baCdxc','names','schema','dir','Directory\x20not\x20found:\x20','Pull\x20composable\x20audience\x20to\x20YAML\x20files','1432LmcuBv','files','All\x20files\x20are\x20up\x20to\x20date.','6vJlMht','error','cyan','execute','Use\x20','No\x20CAS\x20resources\x20found\x20in\x20YAML\x20files.','masterSchema','audienceName','Preview\x20composable\x20segment\x20query\x20on\x20CDW','masterTable','(dry\x20run\x20—\x20no\x20files\x20written)','262392jestkR','\x20audience(s)','preview','66tcigwV','\x20\x20Schema:\x20','1576xpeZhQ','list','filter','count','No\x20composable\x20audience\x20specified.','column','absolutePath','name','Would\x20push:\x20','--audience\x20<name>','toLocaleString','composableAudience','relative','Master\x20Table','tdx\x20cas\x20pull\x20<name>','counts','\x20YAML\x20file(s)','relativePath','success','red','3990Wvoapq','cwd','Fetching\x20composable\x20audiences...','log','Usage:\x20tdx\x20cas\x20preview\x20<segment_name>\x20[--audience\x20<name>]','\x20—\x20','76StQjGQ','\x20segment(s)','Analyzing\x20CAS\x20YAML\x20files...','yellow','Fetching\x20audience\x20\x27','Audience:\x20','No\x20composable\x20audiences\x20found.','\x20or\x20set\x20context\x20with\x20','behaviors','green','utf-8','\x20(new)','length','\x20file(s)\x20to\x20','masterKeyColumn','tdx\x20cas\x20push\x20<path>','status','push','Context\x20set:\x20','269290BiqsEs','population','\x20composable\x20audiences','tdx\x20cas\x20desc\x20<name>','audiences','setPhase','session','\x20=\x20','\x27...','Running\x20preview\x20for\x20\x27','cas','join'];a8_0x1531=function(){return _0xf29bc8;};return a8_0x1531();}
@@ -1 +1 @@
1
- const a9_0x11511c=a9_0x18b6;(function(_0x4129a0,_0x162050){const _0x183455=a9_0x18b6,_0x1bafce=_0x4129a0();while(!![]){try{const _0x5678c5=parseInt(_0x183455(0xa8))/0x1+-parseInt(_0x183455(0xa3))/0x2+parseInt(_0x183455(0xa7))/0x3*(parseInt(_0x183455(0xa6))/0x4)+-parseInt(_0x183455(0xa2))/0x5*(-parseInt(_0x183455(0x99))/0x6)+parseInt(_0x183455(0x92))/0x7*(-parseInt(_0x183455(0x98))/0x8)+parseInt(_0x183455(0x96))/0x9+parseInt(_0x183455(0x90))/0xa;if(_0x5678c5===_0x162050)break;else _0x1bafce['push'](_0x1bafce['shift']());}catch(_0x54a7a3){_0x1bafce['push'](_0x1bafce['shift']());}}}(a9_0x124c,0x1d988));import{BaseCommand}from'./command.js';function a9_0x124c(){const _0x142535=['9155REOluG','364924iXzTXB','List\x20composable\x20segments\x20for\x20an\x20audience','Found\x20','20rDurwf','41769CbrgJu','145303ETsJzP','description','log','length','107040pbGgcK','error','203AJJmgs','dim','name','red','1694016waWMbf','Or\x20set\x20context:\x20tdx\x20use\x20cas\x20<audience_name>','50088PkyiLS','234FdYFjN','cas:sg:list','execute','\x27...','🎯\x20','cas','composableAudience','data','green'];a9_0x124c=function(){return _0x142535;};return a9_0x124c();}import{withProgressSpinner}from'../utils/spinner.js';function a9_0x18b6(_0x552136,_0x9d145f){_0x552136=_0x552136-0x8f;const _0x124cb7=a9_0x124c();let _0x18b67f=_0x124cb7[_0x552136];return _0x18b67f;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import{formatRows}from'../sdk/util/formatters.js';import a9_0x5503f2 from'chalk';export class CASSegmentListCommand extends BaseCommand{[a9_0x11511c(0x94)]=a9_0x11511c(0x9a);[a9_0x11511c(0xa9)]=a9_0x11511c(0xa4);async[a9_0x11511c(0x9b)](_0x136906){const _0x2f2f24=a9_0x11511c,{options:_0x36cd75,args:_0x5c50a3,tdx:_0xd6bc69}=_0x136906,_0x3d288b=_0x5c50a3[0x0]||_0x36cd75[_0x2f2f24(0x9f)];if(!_0x3d288b)return console['error'](a9_0x5503f2[_0x2f2f24(0x95)]('Usage:\x20tdx\x20cas\x20sg\x20list\x20<audience_name>')),console[_0x2f2f24(0x91)](a9_0x5503f2['dim'](_0x2f2f24(0x97))),0x1;const _0x3a732c=await withProgressSpinner('Fetching\x20segments\x20for\x20\x27'+_0x3d288b+_0x2f2f24(0x9c),()=>_0xd6bc69[_0x2f2f24(0x9e)]['listSegments'](_0x3d288b),{'verbose':_0x36cd75['verbose']}),_0xfa68b2=_0x3a732c[_0x2f2f24(0xa0)];if(isStructuredFormat(_0x36cd75))return await handleSDKOutput(_0xfa68b2,_0x36cd75),0x0;console[_0x2f2f24(0xaa)](a9_0x5503f2[_0x2f2f24(0xa1)](_0x2f2f24(0xa5)+_0xfa68b2['length']+'\x20segment'+(_0xfa68b2['length']!==0x1?'s':'')));if(_0xfa68b2[_0x2f2f24(0x8f)]===0x0)return 0x0;for(const _0x4fe3ea of _0xfa68b2){const _0xa776f8=_0x4fe3ea['population']!=null?a9_0x5503f2[_0x2f2f24(0x93)]('\x20('+formatRows(_0x4fe3ea['population'])+')'):'';console[_0x2f2f24(0xaa)](_0x2f2f24(0x9d)+_0x4fe3ea[_0x2f2f24(0x94)]+_0xa776f8),_0x4fe3ea[_0x2f2f24(0xa9)]&&console[_0x2f2f24(0xaa)]('\x20\x20'+a9_0x5503f2['dim'](_0x4fe3ea[_0x2f2f24(0xa9)]));}return 0x0;}}
1
+ const a9_0x181dbb=a9_0x1a86;(function(_0x1b8693,_0x5d64d5){const _0x221388=a9_0x1a86,_0x4a1664=_0x1b8693();while(!![]){try{const _0x435b62=parseInt(_0x221388(0x118))/0x1+parseInt(_0x221388(0x116))/0x2*(-parseInt(_0x221388(0x127))/0x3)+parseInt(_0x221388(0x12c))/0x4+-parseInt(_0x221388(0x11e))/0x5+-parseInt(_0x221388(0x12d))/0x6+parseInt(_0x221388(0x122))/0x7*(-parseInt(_0x221388(0x124))/0x8)+parseInt(_0x221388(0x125))/0x9*(parseInt(_0x221388(0x12b))/0xa);if(_0x435b62===_0x5d64d5)break;else _0x4a1664['push'](_0x4a1664['shift']());}catch(_0x52abb8){_0x4a1664['push'](_0x4a1664['shift']());}}}(a9_0x55b9,0xc2139));import{BaseCommand}from'./command.js';function a9_0x1a86(_0x186b53,_0xa963d8){_0x186b53=_0x186b53-0x113;const _0x55b9e6=a9_0x55b9();let _0x1a8607=_0x55b9e6[_0x186b53];return _0x1a8607;}import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a9_0x55b9(){const _0x29bd37=['Found\x20','15ZVxuzm','description','cas:sg:list','red','289690kVKwSh','6087384AjpTzu','8302602vVngXu','cas','Fetching\x20segments\x20for\x20\x27','List\x20composable\x20segments\x20for\x20an\x20audience','composableAudience','Usage:\x20tdx\x20cas\x20sg\x20list\x20<audience_name>','388630OrlxUw','log','960433NyfGwk','🎯\x20','length','dim','population','green','7456640OiJGLS','verbose','\x20segment','execute','35DnkASr','Or\x20set\x20context:\x20tdx\x20use\x20cas\x20<audience_name>','1041064djUhhh','873fsECqL'];a9_0x55b9=function(){return _0x29bd37;};return a9_0x55b9();}import{formatRows}from'../sdk/util/formatters.js';import a9_0x42db7b from'chalk';export class CASSegmentListCommand extends BaseCommand{['name']=a9_0x181dbb(0x129);['description']=a9_0x181dbb(0x113);async[a9_0x181dbb(0x121)](_0x4a82d4){const _0x5adfed=a9_0x181dbb,{options:_0x51ada8,args:_0x36d692,tdx:_0x51d799}=_0x4a82d4,_0x42a577=_0x36d692[0x0]||_0x51ada8[_0x5adfed(0x114)];if(!_0x42a577)return console['error'](a9_0x42db7b[_0x5adfed(0x12a)](_0x5adfed(0x115))),console['error'](a9_0x42db7b[_0x5adfed(0x11b)](_0x5adfed(0x123))),0x1;const _0x3336ac=await withProgressSpinner(_0x5adfed(0x12f)+_0x42a577+'\x27...',()=>_0x51d799[_0x5adfed(0x12e)]['listSegments'](_0x42a577),{'verbose':_0x51ada8[_0x5adfed(0x11f)]}),_0x292199=_0x3336ac['data'];if(isStructuredFormat(_0x51ada8))return await handleSDKOutput(_0x292199,_0x51ada8),0x0;console[_0x5adfed(0x117)](a9_0x42db7b[_0x5adfed(0x11d)](_0x5adfed(0x126)+_0x292199[_0x5adfed(0x11a)]+_0x5adfed(0x120)+(_0x292199[_0x5adfed(0x11a)]!==0x1?'s':'')));if(_0x292199[_0x5adfed(0x11a)]===0x0)return 0x0;for(const _0x8acdc4 of _0x292199){const _0x17424d=_0x8acdc4[_0x5adfed(0x11c)]!=null?a9_0x42db7b[_0x5adfed(0x11b)]('\x20('+formatRows(_0x8acdc4['population'])+')'):'';console[_0x5adfed(0x117)](_0x5adfed(0x119)+_0x8acdc4['name']+_0x17424d),_0x8acdc4[_0x5adfed(0x128)]&&console['log']('\x20\x20'+a9_0x42db7b['dim'](_0x8acdc4[_0x5adfed(0x128)]));}return 0x0;}}
@@ -1 +1 @@
1
- function a10_0x56a4(_0x2d3f58,_0x4707cc){_0x2d3f58=_0x2d3f58-0xa6;const _0x4fc021=a10_0x4fc0();let _0x56a477=_0x4fc021[_0x2d3f58];return _0x56a477;}const a10_0x4a2d15=a10_0x56a4;(function(_0x302525,_0x954c54){const _0x9e87f8=a10_0x56a4,_0x5b28a1=_0x302525();while(!![]){try{const _0x44c4a9=parseInt(_0x9e87f8(0xad))/0x1+-parseInt(_0x9e87f8(0xdd))/0x2*(parseInt(_0x9e87f8(0xd9))/0x3)+parseInt(_0x9e87f8(0xee))/0x4*(parseInt(_0x9e87f8(0xbe))/0x5)+-parseInt(_0x9e87f8(0xd0))/0x6+parseInt(_0x9e87f8(0xd1))/0x7*(-parseInt(_0x9e87f8(0xc7))/0x8)+-parseInt(_0x9e87f8(0xd6))/0x9*(-parseInt(_0x9e87f8(0xc5))/0xa)+parseInt(_0x9e87f8(0xaa))/0xb;if(_0x44c4a9===_0x954c54)break;else _0x5b28a1['push'](_0x5b28a1['shift']());}catch(_0x25065e){_0x5b28a1['push'](_0x5b28a1['shift']());}}}(a10_0x4fc0,0x604eb));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0x171ade,_0x392478){const _0x26ef74=a10_0x56a4;if(_0x171ade instanceof SDKError)console['error'](_0x26ef74(0xcb)+_0x171ade[_0x26ef74(0xc2)]),_0x392478['verbose']&&(_0x171ade[_0x26ef74(0xe1)]&&console[_0x26ef74(0xa8)](_0x26ef74(0xc3)+_0x171ade[_0x26ef74(0xe1)]),_0x171ade[_0x26ef74(0xc4)]&&(console['error']('\x0aStack\x20trace:'),console['error'](_0x171ade[_0x26ef74(0xc4)])));else throw _0x171ade;}function a10_0x4fc0(){const _0x5e0915=['4396000JbHUIK','startChat','site','Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together','Error:\x20','done','llmProject','streamChatJsonl','log','2743572eWwENu','7GNewJP','Resolving\x20agent\x20\x27','args','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','name','214623kqndPK','agent','includes','1302CJHBZU','string','Chat\x20session:\x20','chat','1202YnploA','claude-4.5-haiku','Using\x20agent\x20from\x20','chatId','cause','handleChatEvent','targetKnowledgeBase','functionName','context','tool','--agent\x20flag','execute','validate','tool_result','targetFunction','description','content','20632axnigY','write','streamChat','Resolving\x20project\x20\x27','Error:\x20Chat\x20session\x20\x27','event','error','llmAgent','6008695eWigYB','join','stringify','741906WWHGhr','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','llm','projectId','metadata','tool_call','slice','\x27...','stream','agentId','session\x20context','verbose','new','chat-create','stdout','270Iqnuzq','data','type','options','message','\x20\x20Cause:\x20','stack','40xggMha','CHAT_NOT_FOUND'];a10_0x4fc0=function(){return _0x5e0915;};return a10_0x4fc0();}async function resolveAgentId(_0x40109b,_0x171535,_0xc4aa05,_0x3a3440,_0x12b135){const _0x4bdd5b=a10_0x56a4,_0x565800=_0x171535||_0xc4aa05;if(_0x565800){const {projectName:_0x2563a6,agentName:_0x23ed4f}=parseAgentRef(_0x565800),_0x5e3fb9=_0x23ed4f||_0x565800,_0x5ab319=_0x23ed4f?_0x2563a6:_0x3a3440;if(!_0x5ab319)throw new Error(_0x4bdd5b(0xd4));if(_0x12b135){const _0x4e036b=_0x171535?_0x4bdd5b(0xe7):_0x4bdd5b(0xb9);console[_0x4bdd5b(0xa8)](_0x4bdd5b(0xdf)+_0x4e036b+':\x20'+_0x5ab319+'/'+_0x5e3fb9);}const _0xb677df=await withSpinner(_0x4bdd5b(0xf1)+_0x5ab319+_0x4bdd5b(0xb6),()=>_0x40109b['llm']['resolveProjectId'](_0x5ab319),{'verbose':_0x12b135}),_0x475cbc=await withSpinner(_0x4bdd5b(0xd2)+_0x5e3fb9+_0x4bdd5b(0xb6),()=>_0x40109b[_0x4bdd5b(0xb1)]['resolveAgentId'](_0x5e3fb9,_0xb677df['data']),{'verbose':_0x12b135});return _0x475cbc[_0x4bdd5b(0xbf)];}else{const _0x41a421=_0x40109b['llm']['getDefaultAgent']();if(_0x41a421)return _0x12b135&&console[_0x4bdd5b(0xa8)]('Using\x20cached\x20default\x20agent:\x20'+_0x41a421[_0x4bdd5b(0xd5)]),_0x41a421['id'];const _0x1e992d=await withSpinner('Getting\x20default\x20agent...',()=>_0x40109b[_0x4bdd5b(0xb1)]['getOrCreateDefaultAgent'](_0x4bdd5b(0xde),0x0),{'verbose':_0x12b135});return _0x1e992d['data']['id'];}}export class ChatCommand extends BaseCommand{['name']=a10_0x4a2d15(0xdc);[a10_0x4a2d15(0xec)]='Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)';[a10_0x4a2d15(0xe9)](_0x13908b){const _0x427d7f=a10_0x4a2d15,_0x3da9e0=_0x13908b[_0x427d7f(0xd3)][_0x427d7f(0xab)]('\x20');if(!_0x3da9e0)return _0x427d7f(0xaf);return undefined;}async[a10_0x4a2d15(0xf0)](_0x5450e9,_0x11bc2f,_0x6d259d,_0x45e780,_0x509d2d){const _0x57cfca=a10_0x4a2d15;for await(const _0xb40e61 of _0x5450e9[_0x57cfca(0xb1)][_0x57cfca(0xdc)](_0x11bc2f,{'agentId':_0x6d259d,'chatId':_0x45e780})){if(_0xb40e61['type']==='metadata'){const _0x57725f=_0xb40e61[_0x57cfca(0xbf)][_0x57cfca(0xe0)];saveLastChatId(_0x57725f),_0x509d2d&&console['error'](_0x57cfca(0xdb)+_0x57725f);}else _0xb40e61[_0x57cfca(0xc0)]===_0x57cfca(0xa7)&&this[_0x57cfca(0xe2)](_0xb40e61[_0x57cfca(0xbf)]);}}async[a10_0x4a2d15(0xce)](_0x1722a4,_0x3dacb8,_0x5d671e,_0x469293){const _0x1ec300=a10_0x4a2d15,_0x305914=_0x1722a4[_0x1ec300(0xe5)][_0x1ec300(0xc9)];let _0x22ea80=![];for await(const _0x27495f of _0x1722a4[_0x1ec300(0xb1)][_0x1ec300(0xdc)](_0x3dacb8,{'agentId':_0x5d671e,'chatId':_0x469293})){if(_0x27495f[_0x1ec300(0xc0)]===_0x1ec300(0xb3)){const _0x2cdfa0=_0x27495f['data'];saveLastChatId(_0x2cdfa0[_0x1ec300(0xe0)]);const _0x933436=_0x2cdfa0[_0x1ec300(0xb2)]&&_0x2cdfa0[_0x1ec300(0xb8)]?getLLMConversationUrl(_0x305914,_0x2cdfa0[_0x1ec300(0xb2)],_0x2cdfa0['agentId'],_0x2cdfa0[_0x1ec300(0xe0)]):undefined;console['log'](JSON['stringify']({'type':'metadata','data':{'chatId':_0x2cdfa0[_0x1ec300(0xe0)],'agentId':_0x2cdfa0[_0x1ec300(0xb8)],'consoleUrl':_0x933436}})),_0x22ea80=!![];}else{if(_0x27495f[_0x1ec300(0xc0)]===_0x1ec300(0xa7)){!_0x22ea80&&_0x469293&&(console[_0x1ec300(0xcf)](JSON[_0x1ec300(0xac)]({'type':'metadata','data':{'chatId':_0x469293}})),_0x22ea80=!![]);const _0x28f9e6=_0x27495f[_0x1ec300(0xbf)];if(_0x1ec300(0xed)in _0x28f9e6)console[_0x1ec300(0xcf)](JSON[_0x1ec300(0xac)]({'type':_0x1ec300(0xed),'data':{'content':_0x28f9e6[_0x1ec300(0xed)]}}));else{if(_0x1ec300(0xb4)in _0x28f9e6){const _0x1f169b=_0x28f9e6[_0x1ec300(0xb4)];console['log'](JSON['stringify']({'type':_0x1ec300(0xb4),'data':{'id':_0x1f169b['id'],'name':_0x1f169b[_0x1ec300(0xe4)],'target':_0x1f169b[_0x1ec300(0xe3)]?.[_0x1ec300(0xd5)]||_0x1f169b['targetAgent']?.[_0x1ec300(0xd5)]||_0x1f169b['targetWebSearchTool']?.[_0x1ec300(0xd5)]||_0x1f169b[_0x1ec300(0xeb)]}}));}else{if(_0x1ec300(0xe6)in _0x28f9e6)console[_0x1ec300(0xcf)](JSON['stringify']({'type':_0x1ec300(0xea),'data':{'id':_0x28f9e6['tool']['id'],'name':_0x28f9e6[_0x1ec300(0xe6)][_0x1ec300(0xe4)],'result':typeof _0x28f9e6[_0x1ec300(0xe6)]['content']===_0x1ec300(0xda)?_0x28f9e6[_0x1ec300(0xe6)][_0x1ec300(0xed)][_0x1ec300(0xb5)](0x0,0x1f4):''}}));else _0x1ec300(0xa8)in _0x28f9e6&&console['log'](JSON['stringify']({'type':_0x1ec300(0xa8),'data':{'error':_0x28f9e6[_0x1ec300(0xa8)]}}));}}}}}console[_0x1ec300(0xcf)](JSON[_0x1ec300(0xac)]({'type':_0x1ec300(0xcc)}));}async['execute'](_0x1b98a6){const _0x7a2f50=a10_0x4a2d15,{options:_0x496fd3,args:_0xcbbc41,tdx:_0x4223b9}=_0x1b98a6,_0x30153b=_0xcbbc41['join']('\x20'),_0x1d4aec=_0x496fd3,_0xb563f0=_0x1d4aec[_0x7a2f50(0xd7)],_0x44dc4e=_0x1d4aec[_0x7a2f50(0xa9)],_0xb453da=_0x1d4aec[_0x7a2f50(0xcd)],_0xe48d93=_0x1d4aec[_0x7a2f50(0xbb)],_0x8be9bc=_0x1d4aec['chatId'],_0x475e5f=_0x1d4aec[_0x7a2f50(0xb7)];if(_0xe48d93&&_0x8be9bc)return console[_0x7a2f50(0xa8)](_0x7a2f50(0xca)),0x1;try{let _0x416870,_0x45afed;if(_0x8be9bc)_0x45afed=_0x8be9bc;else!_0xe48d93&&(_0x45afed=loadLastChatId(),_0x45afed&&_0x496fd3['verbose']&&console[_0x7a2f50(0xa8)]('Continuing\x20chat:\x20'+_0x45afed));!_0x8be9bc&&(_0xe48d93||!_0x45afed)&&(_0x416870=await resolveAgentId(_0x4223b9,_0xb563f0,_0x44dc4e,_0xb453da,_0x496fd3[_0x7a2f50(0xba)]));const _0xe7dcba=_0x475e5f?(_0x57cd65,_0x4e40b1,_0x3b2cb0)=>this[_0x7a2f50(0xce)](_0x4223b9,_0x57cd65,_0x4e40b1,_0x3b2cb0):(_0x1e9e48,_0x32cc25,_0x6ff014)=>this[_0x7a2f50(0xf0)](_0x4223b9,_0x1e9e48,_0x32cc25,_0x6ff014,_0x496fd3[_0x7a2f50(0xba)]);try{await _0xe7dcba(_0x30153b,_0x416870,_0x45afed);}catch(_0x3dfbd0){const _0x47c50c=_0x3dfbd0 instanceof SDKError&&_0x3dfbd0['code']===ErrorCode[_0x7a2f50(0xc6)]||_0x3dfbd0 instanceof Error&&_0x3dfbd0[_0x7a2f50(0xc2)][_0x7a2f50(0xd8)]('404');if(_0x47c50c&&_0x8be9bc)return console['error'](_0x7a2f50(0xa6)+_0x8be9bc+'\x27\x20not\x20found'),0x1;if(_0x47c50c)_0x496fd3[_0x7a2f50(0xba)]&&console[_0x7a2f50(0xa8)](_0x7a2f50(0xae)),!_0x416870&&(_0x416870=await resolveAgentId(_0x4223b9,_0xb563f0,_0x44dc4e,_0xb453da,_0x496fd3[_0x7a2f50(0xba)])),await _0xe7dcba(_0x30153b,_0x416870,undefined);else throw _0x3dfbd0;}return!_0x475e5f&&console['log'](),0x0;}catch(_0x221d6a){return console[_0x7a2f50(0xa8)](),handleSDKError(_0x221d6a,_0x496fd3),0x1;}}['handleChatEvent'](_0x383378){const _0x168c34=a10_0x4a2d15;if(_0x168c34(0xed)in _0x383378)process[_0x168c34(0xbd)][_0x168c34(0xef)](_0x383378[_0x168c34(0xed)]);else'error'in _0x383378&&console[_0x168c34(0xa8)]('\x0aError:\x20'+_0x383378[_0x168c34(0xa8)]);}}export class ChatCreateCommand extends BaseCommand{[a10_0x4a2d15(0xd5)]=a10_0x4a2d15(0xbc);[a10_0x4a2d15(0xec)]='Create\x20a\x20new\x20chat\x20session';[a10_0x4a2d15(0xe9)](_0x1f26ba){const _0x10171e=a10_0x4a2d15,_0x35aff0=_0x1f26ba[_0x10171e(0xc1)],_0x5d80e9=_0x35aff0[_0x10171e(0xd7)],_0x3e1b35=_0x35aff0['llmAgent'];if(!_0x5d80e9&&!_0x3e1b35)return _0x10171e(0xb0);return undefined;}async[a10_0x4a2d15(0xe8)](_0x26353c){const _0x6b913d=a10_0x4a2d15,{options:_0x3f378e,tdx:_0xe64ba3}=_0x26353c,_0x747b5b=_0x3f378e,_0x192e6d=_0x747b5b[_0x6b913d(0xd7)],_0x1e804e=_0x747b5b[_0x6b913d(0xa9)],_0x2c9d4f=_0x747b5b[_0x6b913d(0xcd)];try{const _0x337630=await resolveAgentId(_0xe64ba3,_0x192e6d,_0x1e804e,_0x2c9d4f,_0x3f378e['verbose']),_0x241734=await _0xe64ba3[_0x6b913d(0xb1)][_0x6b913d(0xc8)](_0x337630);return saveLastChatId(_0x241734['id']),console['log'](JSON[_0x6b913d(0xac)]({'chatId':_0x241734['id'],'agentId':_0x337630})),0x0;}catch(_0xb1c920){return handleSDKError(_0xb1c920,_0x3f378e),0x1;}}}
1
+ const a10_0xc3133d=a10_0x2afb;(function(_0x5b231d,_0x5317e5){const _0x2aaca1=a10_0x2afb,_0x507c92=_0x5b231d();while(!![]){try{const _0x3c918d=-parseInt(_0x2aaca1(0x1f4))/0x1+parseInt(_0x2aaca1(0x207))/0x2*(-parseInt(_0x2aaca1(0x1f9))/0x3)+-parseInt(_0x2aaca1(0x1d5))/0x4+-parseInt(_0x2aaca1(0x1ca))/0x5*(parseInt(_0x2aaca1(0x1de))/0x6)+parseInt(_0x2aaca1(0x1f7))/0x7*(-parseInt(_0x2aaca1(0x1da))/0x8)+parseInt(_0x2aaca1(0x20e))/0x9*(-parseInt(_0x2aaca1(0x1fa))/0xa)+-parseInt(_0x2aaca1(0x1d3))/0xb*(-parseInt(_0x2aaca1(0x20a))/0xc);if(_0x3c918d===_0x5317e5)break;else _0x507c92['push'](_0x507c92['shift']());}catch(_0x1626fd){_0x507c92['push'](_0x507c92['shift']());}}}(a10_0x3a1e,0x8addd));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0x557b4c,_0x40b63b){const _0x56f797=a10_0x2afb;if(_0x557b4c instanceof SDKError)console['error']('Error:\x20'+_0x557b4c[_0x56f797(0x1f2)]),_0x40b63b['verbose']&&(_0x557b4c[_0x56f797(0x1ea)]&&console[_0x56f797(0x1e0)]('\x20\x20Cause:\x20'+_0x557b4c['cause']),_0x557b4c[_0x56f797(0x1e6)]&&(console[_0x56f797(0x1e0)](_0x56f797(0x1f8)),console[_0x56f797(0x1e0)](_0x557b4c[_0x56f797(0x1e6)])));else throw _0x557b4c;}function a10_0x3a1e(){const _0x5ce73c=['llmProject','12ywGzcK','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','Create\x20a\x20new\x20chat\x20session','resolveAgentId','23805WQfwYR','claude-4.5-haiku','new','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','write','verbose','streamChatJsonl','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','chat-create','60ORJQYt','stdout','site','join','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','projectId','validate','stream','tool_result','51659663paAXNN','content','4482928ilJlEB','type','Chat\x20session:\x20','event','getDefaultAgent','8pHiXGF','args','Error:\x20Chat\x20session\x20\x27','llm','388998MNqxhZ','CHAT_NOT_FOUND','error','\x0aError:\x20','Using\x20agent\x20from\x20','code','\x27...','agentId','stack','string','execute','tool','cause','functionName','stringify','data','handleChatEvent','--agent\x20flag','chat','done','message','getOrCreateDefaultAgent','596085kgSwYP','tool_call','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','6358023RMErlA','\x0aStack\x20trace:','6BuhJVe','1780bIZfwo','name','targetFunction','session\x20context','metadata','targetWebSearchTool','\x27\x20not\x20found','log','agent','llmAgent','description','streamChat','chatId','253624HgDQlz','context'];a10_0x3a1e=function(){return _0x5ce73c;};return a10_0x3a1e();}function a10_0x2afb(_0x18073d,_0x1e4483){_0x18073d=_0x18073d-0x1c7;const _0x3a1eed=a10_0x3a1e();let _0x2afb17=_0x3a1eed[_0x18073d];return _0x2afb17;}async function resolveAgentId(_0x5ccf7f,_0x5a292b,_0x2381ad,_0x246a41,_0x390a44){const _0x51bd0d=a10_0x2afb,_0x39582a=_0x5a292b||_0x2381ad;if(_0x39582a){const {projectName:_0x332f12,agentName:_0xf1f162}=parseAgentRef(_0x39582a),_0x584ade=_0xf1f162||_0x39582a,_0x3b1baf=_0xf1f162?_0x332f12:_0x246a41;if(!_0x3b1baf)throw new Error(_0x51bd0d(0x1f6));if(_0x390a44){const _0x2466ec=_0x5a292b?_0x51bd0d(0x1ef):_0x51bd0d(0x1fd);console[_0x51bd0d(0x1e0)](_0x51bd0d(0x1e2)+_0x2466ec+':\x20'+_0x3b1baf+'/'+_0x584ade);}const _0x13a586=await withSpinner('Resolving\x20project\x20\x27'+_0x3b1baf+_0x51bd0d(0x1e4),()=>_0x5ccf7f[_0x51bd0d(0x1dd)]['resolveProjectId'](_0x3b1baf),{'verbose':_0x390a44}),_0x1db184=await withSpinner('Resolving\x20agent\x20\x27'+_0x584ade+_0x51bd0d(0x1e4),()=>_0x5ccf7f[_0x51bd0d(0x1dd)][_0x51bd0d(0x20d)](_0x584ade,_0x13a586[_0x51bd0d(0x1ed)]),{'verbose':_0x390a44});return _0x1db184[_0x51bd0d(0x1ed)];}else{const _0x252771=_0x5ccf7f[_0x51bd0d(0x1dd)][_0x51bd0d(0x1d9)]();if(_0x252771)return _0x390a44&&console['error']('Using\x20cached\x20default\x20agent:\x20'+_0x252771['name']),_0x252771['id'];const _0x99cc45=await withSpinner('Getting\x20default\x20agent...',()=>_0x5ccf7f[_0x51bd0d(0x1dd)][_0x51bd0d(0x1f3)](_0x51bd0d(0x20f),0x0),{'verbose':_0x390a44});return _0x99cc45[_0x51bd0d(0x1ed)]['id'];}}export class ChatCommand extends BaseCommand{[a10_0xc3133d(0x1fb)]='chat';['description']=a10_0xc3133d(0x1c8);[a10_0xc3133d(0x1d0)](_0x130502){const _0x26515c=a10_0xc3133d,_0x20efa7=_0x130502[_0x26515c(0x1db)][_0x26515c(0x1cd)]('\x20');if(!_0x20efa7)return _0x26515c(0x20b);return undefined;}async[a10_0xc3133d(0x205)](_0x5c08c5,_0xba7cd6,_0x30a598,_0x313a8c,_0xad6f5c){const _0x39402d=a10_0xc3133d;for await(const _0x10b4e5 of _0x5c08c5[_0x39402d(0x1dd)][_0x39402d(0x1f0)](_0xba7cd6,{'agentId':_0x30a598,'chatId':_0x313a8c})){if(_0x10b4e5[_0x39402d(0x1d6)]==='metadata'){const _0x37e931=_0x10b4e5['data'][_0x39402d(0x206)];saveLastChatId(_0x37e931),_0xad6f5c&&console[_0x39402d(0x1e0)](_0x39402d(0x1d7)+_0x37e931);}else _0x10b4e5[_0x39402d(0x1d6)]===_0x39402d(0x1d8)&&this['handleChatEvent'](_0x10b4e5[_0x39402d(0x1ed)]);}}async[a10_0xc3133d(0x1c7)](_0x57a3e2,_0x5be743,_0x5f31c3,_0xdb8407){const _0x469ec4=a10_0xc3133d,_0x145e43=_0x57a3e2[_0x469ec4(0x208)][_0x469ec4(0x1cc)];let _0x1ccf3c=![];for await(const _0x1d7d11 of _0x57a3e2[_0x469ec4(0x1dd)]['chat'](_0x5be743,{'agentId':_0x5f31c3,'chatId':_0xdb8407})){if(_0x1d7d11[_0x469ec4(0x1d6)]===_0x469ec4(0x1fe)){const _0x2e90ec=_0x1d7d11['data'];saveLastChatId(_0x2e90ec[_0x469ec4(0x206)]);const _0x4d2214=_0x2e90ec[_0x469ec4(0x1cf)]&&_0x2e90ec['agentId']?getLLMConversationUrl(_0x145e43,_0x2e90ec['projectId'],_0x2e90ec[_0x469ec4(0x1e5)],_0x2e90ec[_0x469ec4(0x206)]):undefined;console[_0x469ec4(0x201)](JSON[_0x469ec4(0x1ec)]({'type':_0x469ec4(0x1fe),'data':{'chatId':_0x2e90ec[_0x469ec4(0x206)],'agentId':_0x2e90ec[_0x469ec4(0x1e5)],'consoleUrl':_0x4d2214}})),_0x1ccf3c=!![];}else{if(_0x1d7d11[_0x469ec4(0x1d6)]==='event'){!_0x1ccf3c&&_0xdb8407&&(console[_0x469ec4(0x201)](JSON[_0x469ec4(0x1ec)]({'type':'metadata','data':{'chatId':_0xdb8407}})),_0x1ccf3c=!![]);const _0x4a6a6e=_0x1d7d11[_0x469ec4(0x1ed)];if(_0x469ec4(0x1d4)in _0x4a6a6e)console[_0x469ec4(0x201)](JSON[_0x469ec4(0x1ec)]({'type':_0x469ec4(0x1d4),'data':{'content':_0x4a6a6e['content']}}));else{if(_0x469ec4(0x1f5)in _0x4a6a6e){const _0x9cb229=_0x4a6a6e[_0x469ec4(0x1f5)];console['log'](JSON['stringify']({'type':_0x469ec4(0x1f5),'data':{'id':_0x9cb229['id'],'name':_0x9cb229[_0x469ec4(0x1eb)],'target':_0x9cb229['targetKnowledgeBase']?.['name']||_0x9cb229['targetAgent']?.['name']||_0x9cb229[_0x469ec4(0x1ff)]?.['name']||_0x9cb229[_0x469ec4(0x1fc)]}}));}else{if(_0x469ec4(0x1e9)in _0x4a6a6e)console[_0x469ec4(0x201)](JSON[_0x469ec4(0x1ec)]({'type':_0x469ec4(0x1d2),'data':{'id':_0x4a6a6e[_0x469ec4(0x1e9)]['id'],'name':_0x4a6a6e[_0x469ec4(0x1e9)][_0x469ec4(0x1eb)],'result':typeof _0x4a6a6e[_0x469ec4(0x1e9)][_0x469ec4(0x1d4)]===_0x469ec4(0x1e7)?_0x4a6a6e['tool'][_0x469ec4(0x1d4)]['slice'](0x0,0x1f4):''}}));else'error'in _0x4a6a6e&&console[_0x469ec4(0x201)](JSON['stringify']({'type':_0x469ec4(0x1e0),'data':{'error':_0x4a6a6e[_0x469ec4(0x1e0)]}}));}}}}}console[_0x469ec4(0x201)](JSON[_0x469ec4(0x1ec)]({'type':_0x469ec4(0x1f1)}));}async['execute'](_0x1484a2){const _0x2c3ea1=a10_0xc3133d,{options:_0x497c7e,args:_0x4cdce5,tdx:_0x5d28c9}=_0x1484a2,_0x5334c9=_0x4cdce5[_0x2c3ea1(0x1cd)]('\x20'),_0x588ef8=_0x497c7e,_0x14b24d=_0x588ef8[_0x2c3ea1(0x202)],_0x321b77=_0x588ef8['llmAgent'],_0x1af8c6=_0x588ef8['llmProject'],_0x5ce495=_0x588ef8[_0x2c3ea1(0x210)],_0x1df0f2=_0x588ef8[_0x2c3ea1(0x206)],_0x19f05d=_0x588ef8[_0x2c3ea1(0x1d1)];if(_0x5ce495&&_0x1df0f2)return console[_0x2c3ea1(0x1e0)]('Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together'),0x1;try{let _0x5e991d,_0x2f4350;if(_0x1df0f2)_0x2f4350=_0x1df0f2;else!_0x5ce495&&(_0x2f4350=loadLastChatId(),_0x2f4350&&_0x497c7e[_0x2c3ea1(0x213)]&&console[_0x2c3ea1(0x1e0)]('Continuing\x20chat:\x20'+_0x2f4350));!_0x1df0f2&&(_0x5ce495||!_0x2f4350)&&(_0x5e991d=await resolveAgentId(_0x5d28c9,_0x14b24d,_0x321b77,_0x1af8c6,_0x497c7e['verbose']));const _0x46cdb5=_0x19f05d?(_0x272990,_0x1ce58a,_0x2267e1)=>this[_0x2c3ea1(0x1c7)](_0x5d28c9,_0x272990,_0x1ce58a,_0x2267e1):(_0x4dff38,_0x55af48,_0x54eee8)=>this[_0x2c3ea1(0x205)](_0x5d28c9,_0x4dff38,_0x55af48,_0x54eee8,_0x497c7e[_0x2c3ea1(0x213)]);try{await _0x46cdb5(_0x5334c9,_0x5e991d,_0x2f4350);}catch(_0x2264e9){const _0x428140=_0x2264e9 instanceof SDKError&&_0x2264e9[_0x2c3ea1(0x1e3)]===ErrorCode[_0x2c3ea1(0x1df)]||_0x2264e9 instanceof Error&&_0x2264e9[_0x2c3ea1(0x1f2)]['includes']('404');if(_0x428140&&_0x1df0f2)return console[_0x2c3ea1(0x1e0)](_0x2c3ea1(0x1dc)+_0x1df0f2+_0x2c3ea1(0x200)),0x1;if(_0x428140)_0x497c7e[_0x2c3ea1(0x213)]&&console[_0x2c3ea1(0x1e0)](_0x2c3ea1(0x1ce)),!_0x5e991d&&(_0x5e991d=await resolveAgentId(_0x5d28c9,_0x14b24d,_0x321b77,_0x1af8c6,_0x497c7e[_0x2c3ea1(0x213)])),await _0x46cdb5(_0x5334c9,_0x5e991d,undefined);else throw _0x2264e9;}return!_0x19f05d&&console['log'](),0x0;}catch(_0xc3e877){return console[_0x2c3ea1(0x1e0)](),handleSDKError(_0xc3e877,_0x497c7e),0x1;}}[a10_0xc3133d(0x1ee)](_0x14caa4){const _0x6b50a1=a10_0xc3133d;if('content'in _0x14caa4)process[_0x6b50a1(0x1cb)][_0x6b50a1(0x212)](_0x14caa4[_0x6b50a1(0x1d4)]);else _0x6b50a1(0x1e0)in _0x14caa4&&console['error'](_0x6b50a1(0x1e1)+_0x14caa4[_0x6b50a1(0x1e0)]);}}export class ChatCreateCommand extends BaseCommand{[a10_0xc3133d(0x1fb)]=a10_0xc3133d(0x1c9);[a10_0xc3133d(0x204)]=a10_0xc3133d(0x20c);[a10_0xc3133d(0x1d0)](_0xf4b1ec){const _0x5a01a0=a10_0xc3133d,_0x45b67f=_0xf4b1ec['options'],_0x56c395=_0x45b67f[_0x5a01a0(0x202)],_0x1ad8e1=_0x45b67f[_0x5a01a0(0x203)];if(!_0x56c395&&!_0x1ad8e1)return _0x5a01a0(0x211);return undefined;}async[a10_0xc3133d(0x1e8)](_0x4aaab6){const _0x2b3619=a10_0xc3133d,{options:_0x17fba7,tdx:_0x4d4d7e}=_0x4aaab6,_0xfd6c12=_0x17fba7,_0x5b1319=_0xfd6c12[_0x2b3619(0x202)],_0x1ecfd7=_0xfd6c12[_0x2b3619(0x203)],_0x4778e5=_0xfd6c12[_0x2b3619(0x209)];try{const _0x14613f=await resolveAgentId(_0x4d4d7e,_0x5b1319,_0x1ecfd7,_0x4778e5,_0x17fba7['verbose']),_0x20a494=await _0x4d4d7e[_0x2b3619(0x1dd)]['startChat'](_0x14613f);return saveLastChatId(_0x20a494['id']),console['log'](JSON[_0x2b3619(0x1ec)]({'chatId':_0x20a494['id'],'agentId':_0x14613f})),0x0;}catch(_0x4b9f68){return handleSDKError(_0x4b9f68,_0x17fba7),0x1;}}}
@@ -1 +1 @@
1
- function a11_0x34e0(_0x3fd191,_0x572c58){_0x3fd191=_0x3fd191-0xcf;const _0x4c7de7=a11_0x4c7d();let _0x34e0f=_0x4c7de7[_0x3fd191];return _0x34e0f;}const a11_0x55d351=a11_0x34e0;(function(_0x5bddc2,_0x5ed72b){const _0x14dcf3=a11_0x34e0,_0x4a187e=_0x5bddc2();while(!![]){try{const _0x2941a2=parseInt(_0x14dcf3(0x12d))/0x1+parseInt(_0x14dcf3(0x162))/0x2+parseInt(_0x14dcf3(0x16d))/0x3+parseInt(_0x14dcf3(0x104))/0x4+parseInt(_0x14dcf3(0x114))/0x5+-parseInt(_0x14dcf3(0x102))/0x6*(parseInt(_0x14dcf3(0x136))/0x7)+-parseInt(_0x14dcf3(0x158))/0x8*(parseInt(_0x14dcf3(0x12e))/0x9);if(_0x2941a2===_0x5ed72b)break;else _0x4a187e['push'](_0x4a187e['shift']());}catch(_0xbe34cb){_0x4a187e['push'](_0x4a187e['shift']());}}}(a11_0x4c7d,0xa6631));import{readFile,writeFile,mkdir,unlink}from'node:fs/promises';import{execFile}from'node:child_process';import{existsSync}from'node:fs';import{homedir}from'node:os';function a11_0x4c7d(){const _0x33c49b=['Command\x20output:\x20','plugins','✓\x20Logs\x20saved\x20to\x20','account_id','message','expires_at','stringify','statusLine','parse','5297050kCbghP','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','apikey','Failed\x20to\x20launch\x20Claude\x20Code:\x20','env','reset','Setup\x20failed','\x20→\x20','false','treasure-data','TD\x20Docs\x20MCP\x20Server','marketplaces','Claude\x20Code\x20version\x20','data','Command\x20spawn\x20error:\x20','\x27\x20updated','Initializing\x20proxy\x20logger...','Failed\x20to\x20list\x20marketplaces','oauth','stop','inherit','profile','.claude','):\x20claude\x20','verbose','362989WHwUSZ','747etucZG','refresh_token','green','logLevel','getCurrent','https://docs.treasuredata.com/mcp','Initializing...','\x20is\x20too\x20old\x20(minimum:\x20','3284519ielTph','CLAUDE_CODE_USE_VERTEX','origin','mcp','execute','already\x20exists','major','Failed\x20to\x20apply\x20td-skills\x20release\x20channel:\x20','checkout','description','add','command','fetch','getLogPath','Configuring\x20MCP\x20server\x20\x27','Marketplace\x20\x27','install','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','Authentication\x20required\x20for\x20TD\x20LLM\x20Proxy.\x20Run:\x20tdx\x20auth\x20setup','ANTHROPIC_MODEL','2.0.20','resume','\x27...','plugin','tdx\x20--profile\x20','Failed\x20to\x20install\x20plugin\x20\x27','.tdx-settings-backup.json','passThroughServer','✓\x20Settings\x20configured:\x20.claude/settings.local.json','CLAUDE_CODE_USE_BEDROCK','match','tdx\x20claude\x20statusline','claude','debug','216464EeKNtN','cwd','access_token','ANTHROPIC_AUTH_TOKEN','context','remove','Checking\x20Claude\x20Code\x20version...','start','tdx-skills','unshift','476266qADhZS','git','INSTALLATION_FAILED','--version','continue','update','INTERNAL','✓\x20Plugin\x20\x27','error','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','Failed\x20to\x20remove\x20marketplace\x20\x27','2532477YLqace','originalSettings','sql-skills','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','CLAUDE_CODE_UNSUPPORTED_VERSION','llm-proxy','red','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','settings.local.json','cause','init','Claude\x20Code\x20version\x20check\x20failed','includes','port','Checking\x20out\x20td-skills\x20','td-skills','utf-8','already\x20configured','logger','\x20meets\x20minimum\x20requirement','✓\x20Marketplace\x20\x27','\x27\x20configured','Invalid\x20minimum\x20version\x20format:\x20','CLAUDE_CODE_NOT_FOUND','Command\x20failed\x20(exit\x20','td-docs','\x20already\x20configured','marketplace','https://github.com/treasure-data/td-skills','td-skills\x20Plugins','log','td-skills\x20marketplace\x20dir\x20not\x20found,\x20skipping\x20release\x20tag\x20checkout','ENOENT','Configuring\x20marketplace\x20\x27','INVALID_ARGUMENT','join','http://127.0.0.1:','main','tdx-managed-proxy','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','\x27\x20removed','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','\x20configuration\x20failed','close','info','proxy','Claude\x20Code\x20CLI\x20not\x20found','exit','✓\x20Settings\x20restored:\x20.claude/settings.local.json','ANTHROPIC_BASE_URL','minor','warn','Failed\x20to\x20update\x20marketplace\x20\x27','toISOString','toString','Warning:\x20Failed\x20to\x20configure\x20','Failed\x20to\x20configure\x20marketplace\x20\x27','stdout','pid','td-skills\x20checked\x20out\x20at\x20tag\x20','text','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','fail','site','patch','--force','12yCHhgm','user','5444312XMPIWe','✓\x20Logging\x20to\x20','\x20or\x20later.','http','--tags','Installing\x20plugin\x20\x27','workflow-skills'];a11_0x4c7d=function(){return _0x33c49b;};return a11_0x4c7d();}import{join}from'node:path';import{promisify}from'node:util';import a11_0x2bfe3a from'chalk';import{BaseCommand}from'./command.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint,getConsoleUrl}from'../sdk/client/endpoints.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{findExecutable,crossSpawn}from'../utils/process.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo,loadReleaseChannel}from'../core/config.js';import{resolveReleaseTag}from'../utils/github-releases.js';const execFileAsync=promisify(execFile),MIN_CLAUDE_VERSION=a11_0x55d351(0x14a),SETTINGS_BACKUP_FILENAME=a11_0x55d351(0x150);function isProcessRunning(_0x457c1e){try{return process['kill'](_0x457c1e,0x0),!![];}catch{return![];}}async function applyOriginalSettings(_0x50ffde,_0x566ca7){const _0x36979d=a11_0x55d351;if(!existsSync(_0x50ffde))return;try{const _0x45b1ac=await readFile(_0x50ffde,_0x36979d(0xd0)),_0x1de48f=JSON[_0x36979d(0x113)](_0x45b1ac),_0x89ae8=_0x1de48f[_0x36979d(0x118)]||{};for(const _0xc8ef18 of[_0x36979d(0xf1),_0x36979d(0x149),_0x36979d(0x15b),'CLAUDE_CODE_USE_BEDROCK',_0x36979d(0x137)]){_0x566ca7[_0xc8ef18]!==undefined?_0x89ae8[_0xc8ef18]=_0x566ca7[_0xc8ef18]:delete _0x89ae8[_0xc8ef18];}_0x566ca7[_0x36979d(0x112)]!==undefined?_0x1de48f[_0x36979d(0x112)]=_0x566ca7[_0x36979d(0x112)]:delete _0x1de48f[_0x36979d(0x112)],_0x1de48f['env']=_0x89ae8,await writeFile(_0x50ffde,JSON[_0x36979d(0x111)](_0x1de48f,null,0x2)+'\x0a');}catch{}}async function safeUnlink(_0x41d55a){try{await unlink(_0x41d55a);}catch{}}async function recoverFromStaleBackup(_0x18fe4d,_0x35e15c){const _0x49b998=a11_0x55d351;if(!existsSync(_0x35e15c))return undefined;try{const _0x43f721=await readFile(_0x35e15c,_0x49b998(0xd0)),_0x3cb1d4=JSON[_0x49b998(0x113)](_0x43f721);if(isProcessRunning(_0x3cb1d4[_0x49b998(0xfa)]))return{'liveSessionOriginals':_0x3cb1d4['originalSettings']};return await applyOriginalSettings(_0x18fe4d,_0x3cb1d4[_0x49b998(0x16e)]),await safeUnlink(_0x35e15c),undefined;}catch{return await safeUnlink(_0x35e15c),undefined;}}function handleInstallationError(_0x3fd52e,_0x367dc5,_0x3166f5,_0x5c908e){const _0xe78431=a11_0x55d351;errorContains(_0x3fd52e,_0xe78431(0x13b),'already\x20installed',_0xe78431(0xd1))?(_0x3166f5[_0xe78431(0xfc)]='✓\x20'+_0x367dc5+_0xe78431(0xda),_0x5c908e?.[_0xe78431(0xec)](_0x367dc5+_0xe78431(0xda)),_0x3fd52e instanceof SDKError&&_0x3fd52e[_0xe78431(0x177)]&&_0x5c908e?.[_0xe78431(0x157)](_0xe78431(0x10b)+_0x3fd52e['cause'][_0xe78431(0x10f)])):(_0x3166f5[_0xe78431(0xf3)](_0xe78431(0xf7)+_0x367dc5),_0x5c908e?.[_0xe78431(0x16a)](_0x367dc5+_0xe78431(0xea),_0x3fd52e));}export function parseVersion(_0x4824ac){const _0x429e38=a11_0x55d351,_0x11a740=_0x4824ac['trim']()[_0x429e38(0x154)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x11a740)return null;return{'major':parseInt(_0x11a740[0x1],0xa),'minor':parseInt(_0x11a740[0x2],0xa),'patch':parseInt(_0x11a740[0x3],0xa)};}export function compareVersions(_0x337ef4,_0x155f26){const _0x5860ab=a11_0x55d351;if(_0x337ef4[_0x5860ab(0x13c)]!==_0x155f26[_0x5860ab(0x13c)])return _0x337ef4['major']-_0x155f26[_0x5860ab(0x13c)];if(_0x337ef4[_0x5860ab(0xf2)]!==_0x155f26[_0x5860ab(0xf2)])return _0x337ef4[_0x5860ab(0xf2)]-_0x155f26[_0x5860ab(0xf2)];return _0x337ef4[_0x5860ab(0x100)]-_0x155f26['patch'];}async function checkClaudeVersion(_0x530cd5,_0xa01c67){const _0x373f07=a11_0x55d351;_0xa01c67?.[_0x373f07(0x157)]('Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20'+_0x530cd5+')');const _0x4e3007=await executeClaudeCommand([_0x373f07(0x165)],undefined,_0xa01c67),_0x1a98bb=parseVersion(_0x4e3007);if(!_0x1a98bb){_0xa01c67?.[_0x373f07(0xf3)]('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x4e3007);return;}const _0x55e610=_0x1a98bb['major']+'.'+_0x1a98bb[_0x373f07(0xf2)]+'.'+_0x1a98bb[_0x373f07(0x100)],_0x58aa28=parseVersion(_0x530cd5);if(!_0x58aa28){_0xa01c67?.[_0x373f07(0xf3)](_0x373f07(0xd6)+_0x530cd5);return;}if(compareVersions(_0x1a98bb,_0x58aa28)<0x0){_0xa01c67?.[_0x373f07(0x16a)](_0x373f07(0x120)+_0x55e610+_0x373f07(0x135)+_0x530cd5+')');throw new SDKError(ErrorCode[_0x373f07(0x171)],_0x373f07(0x120)+_0x55e610+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x530cd5+_0x373f07(0x106),undefined,{'helpText':_0x373f07(0x147)});}_0xa01c67?.[_0x373f07(0x157)](_0x373f07(0x120)+_0x55e610+_0x373f07(0xd3));}async function executeClaudeCommand(_0x323666,_0x534dca,_0x4724dc){const _0x31a2b4=a11_0x55d351;return _0x4724dc?.[_0x31a2b4(0xec)]('Executing:\x20claude\x20'+_0x323666[_0x31a2b4(0xe3)]('\x20')),new Promise((_0x3a6550,_0x3636b1)=>{const _0x10c181=_0x31a2b4,_0x3998c8=crossSpawn('claude',_0x323666,{'stdio':'pipe'});let _0x36618b='',_0x5af36d='';_0x3998c8[_0x10c181(0xf9)]?.['on'](_0x10c181(0x121),_0x28cbdc=>{const _0x4db09b=_0x10c181;_0x36618b+=_0x28cbdc[_0x4db09b(0xf6)]();}),_0x3998c8['stderr']?.['on'](_0x10c181(0x121),_0x345b40=>{_0x5af36d+=_0x345b40['toString']();}),_0x3998c8['on'](_0x10c181(0x16a),_0x4240b8=>{const _0x457d56=_0x10c181;_0x4240b8['code']===_0x457d56(0xe0)?(_0x4724dc?.[_0x457d56(0x16a)]('Claude\x20Code\x20CLI\x20not\x20found'),_0x3636b1(new SDKError(ErrorCode[_0x457d56(0xd7)],_0x457d56(0xee),_0x4240b8,{'helpText':_0x457d56(0xfd)}))):(_0x4724dc?.['error'](_0x457d56(0x122)+_0x4240b8[_0x457d56(0x10f)]),_0x3636b1(new SDKError(ErrorCode[_0x457d56(0x168)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x4240b8[_0x457d56(0x10f)],_0x4240b8)));}),_0x3998c8['on'](_0x10c181(0xef),_0x46e961=>{const _0x2510bf=_0x10c181;if(_0x46e961===0x0)_0x3a6550(_0x36618b);else _0x534dca?(_0x4724dc?.[_0x2510bf(0x16a)](_0x2510bf(0xd8)+_0x46e961+_0x2510bf(0x12b)+_0x323666[_0x2510bf(0xe3)]('\x20')),_0x3636b1(new SDKError(ErrorCode[_0x2510bf(0x164)],_0x534dca,new Error(_0x5af36d)))):_0x3a6550('');});});}async function ensureMcpServer(_0x183932,_0xe6f85a,_0x5ea1a2,_0x19f238,_0x93b0d1){const _0x4dd407=a11_0x55d351;_0x19f238[_0x4dd407(0xfc)]=_0x4dd407(0x144)+_0x183932+_0x4dd407(0x14c),await executeClaudeCommand([_0x4dd407(0x139),_0x4dd407(0x140),_0x183932,_0xe6f85a,'--transport',_0x5ea1a2],_0x4dd407(0x170)+_0x183932+'\x27',_0x93b0d1),_0x19f238[_0x4dd407(0xfc)]='✓\x20MCP\x20server\x20\x27'+_0x183932+_0x4dd407(0xd5);}export const DEFAULT_TD_SKILLS_URL=a11_0x55d351(0xdc);export function getTdSkillsRepoUrl(){const _0x460e16=process.env.TDX_TD_SKILLS_REPO;if(_0x460e16)return _0x460e16;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x5d4658,_0x1b1f5e){const _0x7c4027=a11_0x55d351;try{const _0x36bfd0=await executeClaudeCommand([_0x7c4027(0x14d),_0x7c4027(0xdb),'list'],_0x7c4027(0x125),_0x1b1f5e);if(!_0x36bfd0[_0x7c4027(0x17a)](_0x5d4658)){_0x1b1f5e?.[_0x7c4027(0x157)](_0x7c4027(0x145)+_0x5d4658+_0x7c4027(0xe7));return;}await executeClaudeCommand([_0x7c4027(0x14d),'marketplace',_0x7c4027(0x15d),_0x5d4658],_0x7c4027(0x16c)+_0x5d4658+'\x27',_0x1b1f5e),_0x1b1f5e?.[_0x7c4027(0xec)](_0x7c4027(0x145)+_0x5d4658+_0x7c4027(0xe8));}catch(_0xa73fbb){_0x1b1f5e?.[_0x7c4027(0xf3)](_0x7c4027(0x16c)+_0x5d4658+'\x27:\x20'+_0xa73fbb);}}async function restoreDefaultTdSkillsMarketplace(_0x50f8ce){const _0x105fa2=a11_0x55d351;try{await removeMarketplace(_0x105fa2(0xcf),_0x50f8ce),await executeClaudeCommand(['plugin','marketplace','add',DEFAULT_TD_SKILLS_URL],undefined,_0x50f8ce),_0x50f8ce?.[_0x105fa2(0xec)]('Restored\x20default\x20td-skills\x20marketplace');}catch{}}async function ensureMarketplace(_0x39423b,_0x39420e,_0x42f775,_0x50520b){const _0x4e84c5=a11_0x55d351;_0x42f775[_0x4e84c5(0xfc)]=_0x4e84c5(0xe1)+_0x39423b+_0x4e84c5(0x14c),await executeClaudeCommand([_0x4e84c5(0x14d),_0x4e84c5(0xdb),_0x4e84c5(0x140),_0x39420e],_0x4e84c5(0xf8)+_0x39423b+'\x27',_0x50520b),_0x42f775['text']=_0x4e84c5(0xd4)+_0x39423b+_0x4e84c5(0xd5);}async function updateMarketplace(_0x430232,_0x1c3d09,_0x34768b){const _0x270282=a11_0x55d351;_0x1c3d09[_0x270282(0xfc)]='Updating\x20marketplace\x20\x27'+_0x430232+_0x270282(0x14c),await executeClaudeCommand([_0x270282(0x14d),_0x270282(0xdb),_0x270282(0x167)],_0x270282(0xf4)+_0x430232+'\x27',_0x34768b),_0x1c3d09[_0x270282(0xfc)]=_0x270282(0xd4)+_0x430232+_0x270282(0x123);}async function ensurePlugin(_0x4a69c8,_0x267b31,_0xa858a9,_0x3c9936){const _0x57a58c=a11_0x55d351;_0xa858a9[_0x57a58c(0xfc)]=_0x57a58c(0x109)+_0x4a69c8+_0x57a58c(0x14c),await executeClaudeCommand([_0x57a58c(0x14d),_0x57a58c(0x146),_0x4a69c8+'@'+_0x267b31],_0x57a58c(0x14f)+_0x4a69c8+'\x27',_0x3c9936),_0xa858a9[_0x57a58c(0xfc)]=_0x57a58c(0x169)+_0x4a69c8+'\x27\x20installed';}function getClaudeConfigDir(){const _0x3a9af1=a11_0x55d351;return process.env.CLAUDE_CONFIG_DIR||join(homedir(),_0x3a9af1(0x12a));}async function checkoutReleaseTag(_0x3eec6f,_0x43b182,_0x44e663){const _0x24bc36=a11_0x55d351,_0x200369=join(getClaudeConfigDir(),_0x24bc36(0x10c),_0x24bc36(0x11f),_0x24bc36(0xcf));if(!existsSync(_0x200369)){_0x44e663?.[_0x24bc36(0x157)](_0x24bc36(0xdf));return;}_0x43b182['text']=_0x24bc36(0x17c)+_0x3eec6f+'...',await execFileAsync(_0x24bc36(0x163),[_0x24bc36(0x142),_0x24bc36(0x138),_0x24bc36(0x108),_0x24bc36(0x101)],{'cwd':_0x200369});try{await execFileAsync(_0x24bc36(0x163),[_0x24bc36(0x13e),_0x24bc36(0xe5)],{'cwd':_0x200369});}catch{await execFileAsync(_0x24bc36(0x163),[_0x24bc36(0x13e),'-b',_0x24bc36(0xe5),'origin/main'],{'cwd':_0x200369});}await execFileAsync(_0x24bc36(0x163),[_0x24bc36(0x119),'--hard',_0x3eec6f],{'cwd':_0x200369}),_0x43b182[_0x24bc36(0xfc)]='✓\x20td-skills\x20checked\x20out\x20at\x20'+_0x3eec6f,_0x44e663?.[_0x24bc36(0xec)](_0x24bc36(0xfb)+_0x3eec6f);}async function createClaudeSettings(_0x311c45,_0x18a8e1,_0x28f502){const _0x1975ba=a11_0x55d351,_0x1e10fc=join(process[_0x1975ba(0x159)](),_0x1975ba(0x12a)),_0x4b8c90=join(_0x1e10fc,_0x1975ba(0x176)),_0x26db6c=join(_0x1e10fc,SETTINGS_BACKUP_FILENAME);await mkdir(_0x1e10fc,{'recursive':!![]});const _0xcb7945=await recoverFromStaleBackup(_0x4b8c90,_0x26db6c);let _0xac5e74;if(_0xcb7945)_0xac5e74=_0xcb7945['liveSessionOriginals'];else{let _0x2d0029={};if(existsSync(_0x4b8c90))try{const _0x101b07=await readFile(_0x4b8c90,_0x1975ba(0xd0));_0x2d0029=JSON[_0x1975ba(0x113)](_0x101b07);}catch{_0x2d0029={};}const _0x5922fd=_0x2d0029['env']||{};_0xac5e74={'ANTHROPIC_BASE_URL':_0x5922fd[_0x1975ba(0xf1)],'ANTHROPIC_MODEL':_0x5922fd[_0x1975ba(0x149)],'ANTHROPIC_AUTH_TOKEN':_0x5922fd['ANTHROPIC_AUTH_TOKEN'],'CLAUDE_CODE_USE_BEDROCK':_0x5922fd[_0x1975ba(0x153)],'CLAUDE_CODE_USE_VERTEX':_0x5922fd[_0x1975ba(0x137)],'statusLine':_0x2d0029['statusLine']};const _0x4303d4={'createdAt':new Date()[_0x1975ba(0xf5)](),'pid':process['pid'],'originalSettings':_0xac5e74};await writeFile(_0x26db6c,JSON[_0x1975ba(0x111)](_0x4303d4,null,0x2)+'\x0a');}let _0x127648={};if(existsSync(_0x4b8c90))try{const _0x18069d=await readFile(_0x4b8c90,_0x1975ba(0xd0));_0x127648=JSON[_0x1975ba(0x113)](_0x18069d);}catch{_0x127648={};}const _0x3c3869=_0x127648[_0x1975ba(0x118)]||{},_0xb0724d={..._0x127648,'env':{..._0x3c3869,'ANTHROPIC_BASE_URL':'http://127.0.0.1:'+_0x311c45,..._0x18a8e1&&{'ANTHROPIC_MODEL':_0x18a8e1},'ANTHROPIC_AUTH_TOKEN':_0x1975ba(0xe6),'CLAUDE_CODE_USE_BEDROCK':'false','CLAUDE_CODE_USE_VERTEX':_0x1975ba(0x11c)},'statusLine':{'type':_0x1975ba(0x141),'command':_0x28f502?_0x1975ba(0x14e)+_0x28f502+'\x20claude\x20statusline':_0x1975ba(0x155)}};return await writeFile(_0x4b8c90,JSON[_0x1975ba(0x111)](_0xb0724d,null,0x2)+'\x0a'),_0xac5e74;}async function restoreClaudeSettings(_0xe06582){const _0x510ac8=a11_0x55d351,_0x2e4f16=join(process[_0x510ac8(0x159)](),'.claude'),_0x393385=join(_0x2e4f16,_0x510ac8(0x176)),_0x32016d=join(_0x2e4f16,SETTINGS_BACKUP_FILENAME);await applyOriginalSettings(_0x393385,_0xe06582);try{if(existsSync(_0x32016d)){const _0x29e1a8=await readFile(_0x32016d,'utf-8'),_0x36f621=JSON[_0x510ac8(0x113)](_0x29e1a8);_0x36f621[_0x510ac8(0xfa)]===process[_0x510ac8(0xfa)]&&await safeUnlink(_0x32016d);}}catch{}}export class ClaudeCommand extends BaseCommand{['name']='claude';[a11_0x55d351(0x13f)]=a11_0x55d351(0x115);['passThroughServer'];[a11_0x55d351(0x16e)];[a11_0x55d351(0xd2)];['port'];async[a11_0x55d351(0x13a)](_0x126898){const _0x170658=a11_0x55d351,{tdx:_0x492a60,options:_0xdc78ad,args:_0x5460de}=_0x126898;let _0x1dc707=![];try{const _0x519fb9=_0xdc78ad,_0x387afa=_0x519fb9[_0x170658(0xed)]===![],_0x1d7f58=_0x519fb9[_0x170658(0x166)]===!![],_0x3babb8=_0x519fb9[_0x170658(0x14b)]===!![],_0x132430=[..._0x5460de];if(_0x1d7f58)_0x132430[_0x170658(0x161)]('-c');else _0x3babb8&&_0x132430['unshift']('-r');const _0x5d0b52=createCommandSpinner(_0x170658(0x134),{'verbose':_0xdc78ad[_0x170658(0x12c)]});_0x5d0b52[_0x170658(0x15f)]();try{if(!_0x387afa){const _0x40b63c=_0xdc78ad[_0x170658(0x129)];try{const _0x11909e=await _0x492a60[_0x170658(0x103)][_0x170658(0x132)]();_0x11909e[_0x170658(0x10e)]&&writeCachedAccountInfo(_0xdc78ad[_0x170658(0xff)],_0x11909e[_0x170658(0x10e)],_0x40b63c);}catch{}_0x5d0b52['text']=_0x170658(0x124),this[_0x170658(0xd2)]=new TDXLogger(_0xdc78ad[_0x170658(0x131)],!![]),await this[_0x170658(0xd2)][_0x170658(0x178)]();const _0x4c2401=this['logger']['getLogPath']();_0x5d0b52[_0x170658(0xfc)]=_0x170658(0x105)+_0x4c2401;const _0x5468bd=getEndpoint(_0xdc78ad[_0x170658(0xff)],_0x170658(0x172));_0x5d0b52[_0x170658(0xfc)]=_0x170658(0xe9);let _0x47d345;const _0x4a0e78=await getOAuthTokens(_0x40b63c);if(_0x4a0e78)_0x47d345={'type':_0x170658(0x126),'accessToken':_0x4a0e78[_0x170658(0x15a)],'refreshToken':_0x4a0e78[_0x170658(0x12f)],'expiresAt':_0x4a0e78[_0x170658(0x110)],'consoleUrl':getConsoleUrl(_0xdc78ad[_0x170658(0xff)])};else{if(_0x492a60[_0x170658(0x15c)]['apiKey'])_0x47d345={'type':_0x170658(0x116),'apiKey':_0x492a60[_0x170658(0x15c)]['apiKey']};else throw new SDKError(ErrorCode[_0x170658(0xe2)],_0x170658(0x148));}this['passThroughServer']=new PassThroughProxyServer({'startPort':0xfa0,'llmProxyUrl':_0x5468bd,'auth':_0x47d345,'logger':this[_0x170658(0xd2)],'site':_0xdc78ad[_0x170658(0xff)],'profile':_0x40b63c}),await this[_0x170658(0x151)][_0x170658(0x15f)](),this[_0x170658(0x17b)]=this[_0x170658(0x151)][_0x170658(0x17b)],_0x5d0b52['text']=_0x170658(0x175)+this[_0x170658(0x17b)]+_0x170658(0x11b)+_0x5468bd,_0x5d0b52[_0x170658(0xfc)]='Creating\x20.claude/settings.local.json...',this[_0x170658(0x16e)]=await createClaudeSettings(this[_0x170658(0x17b)],undefined,_0x40b63c),_0x5d0b52[_0x170658(0xfc)]=_0x170658(0x152);}else _0x5d0b52[_0x170658(0xfc)]=_0x170658(0x16b);try{_0x5d0b52[_0x170658(0xfc)]=_0x170658(0x15e),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x170658(0xd2)]),_0x5d0b52[_0x170658(0xfc)]='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x23b2a2){_0x5d0b52['fail'](_0x170658(0x179));throw _0x23b2a2;}try{await ensureMcpServer(_0x170658(0xd9),_0x170658(0x133),_0x170658(0x107),_0x5d0b52,this[_0x170658(0xd2)]);}catch(_0x1fb5a5){handleInstallationError(_0x1fb5a5,_0x170658(0x11e),_0x5d0b52,this['logger']);}try{const _0x547c83=getTdSkillsRepoUrl();_0x1dc707=_0x547c83!==DEFAULT_TD_SKILLS_URL;_0x1dc707&&await removeMarketplace('td-skills',this[_0x170658(0xd2)]);await ensureMarketplace(_0x170658(0xcf),_0x547c83,_0x5d0b52,this[_0x170658(0xd2)]),await updateMarketplace(_0x170658(0xcf),_0x5d0b52,this[_0x170658(0xd2)]),await ensurePlugin(_0x170658(0x16f),'td-skills',_0x5d0b52,this['logger']),await ensurePlugin(_0x170658(0x10a),_0x170658(0xcf),_0x5d0b52,this[_0x170658(0xd2)]),await ensurePlugin(_0x170658(0x160),_0x170658(0xcf),_0x5d0b52,this['logger']);try{const _0x40d7a8=loadReleaseChannel(),_0x5a4deb=await resolveReleaseTag(_0x40d7a8,_0x170658(0x11d),_0x170658(0xcf),'tdx-cli');_0x5a4deb&&await checkoutReleaseTag(_0x5a4deb,_0x5d0b52,this[_0x170658(0xd2)]);}catch(_0x5833a6){this[_0x170658(0xd2)]?.[_0x170658(0xf3)](_0x170658(0x13d)+_0x5833a6);}}catch(_0x397984){handleInstallationError(_0x397984,_0x170658(0xdd),_0x5d0b52,this[_0x170658(0xd2)]);}_0x5d0b52[_0x170658(0x127)]();}catch(_0x41c46d){_0x5d0b52[_0x170658(0xfe)](_0x170658(0x11a));throw _0x41c46d;}const _0x4706ac=await findExecutable(_0x170658(0x156));if(!_0x4706ac)throw new SDKError(ErrorCode[_0x170658(0xd7)],_0x170658(0xee),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x190f93={...process.env};!_0x387afa&&(_0x190f93['ANTHROPIC_BASE_URL']=_0x170658(0xe4)+this[_0x170658(0x17b)],_0x190f93[_0x170658(0x15b)]=_0x170658(0xe6),_0x190f93[_0x170658(0x153)]=_0x170658(0x11c),_0x190f93['CLAUDE_CODE_USE_VERTEX']=_0x170658(0x11c));const _0x53bb39=crossSpawn(_0x4706ac,_0x132430,{'stdio':_0x170658(0x128),'env':_0x190f93}),_0x55a9e8=await new Promise(_0x143556=>{const _0x2a6c3f=_0x170658;_0x53bb39['on'](_0x2a6c3f(0xef),_0x308973=>{_0x143556(_0x308973||0x0);}),_0x53bb39['on'](_0x2a6c3f(0x16a),_0x21a451=>{const _0x3ceb30=_0x2a6c3f;console[_0x3ceb30(0x16a)](a11_0x2bfe3a[_0x3ceb30(0x173)](_0x3ceb30(0x117)+_0x21a451['message'])),_0x143556(0x1);});});_0x1dc707&&await restoreDefaultTdSkillsMarketplace(this[_0x170658(0xd2)]);this['passThroughServer']&&(await this[_0x170658(0x151)][_0x170658(0x127)](),console[_0x170658(0xde)](a11_0x2bfe3a[_0x170658(0x130)](_0x170658(0x174))));if(this[_0x170658(0xd2)]){await this[_0x170658(0xd2)][_0x170658(0xeb)]();const _0xf1a038=this[_0x170658(0xd2)][_0x170658(0x143)]();console[_0x170658(0xde)](a11_0x2bfe3a[_0x170658(0x130)](_0x170658(0x10d)+_0xf1a038));}return this['originalSettings']&&(await restoreClaudeSettings(this['originalSettings']),console['log'](a11_0x2bfe3a['green'](_0x170658(0xf0)))),_0x55a9e8;}catch(_0x21bc6f){_0x1dc707&&await restoreDefaultTdSkillsMarketplace(this['logger']);this[_0x170658(0x151)]&&await this[_0x170658(0x151)][_0x170658(0x127)]();this[_0x170658(0xd2)]&&await this[_0x170658(0xd2)][_0x170658(0xeb)]();this['originalSettings']&&await restoreClaudeSettings(this[_0x170658(0x16e)]);throw _0x21bc6f;}}}
1
+ const a11_0x33970b=a11_0x1b77;(function(_0x429fe7,_0x220098){const _0x35cc28=a11_0x1b77,_0x577e4e=_0x429fe7();while(!![]){try{const _0x53a996=-parseInt(_0x35cc28(0xc1))/0x1+-parseInt(_0x35cc28(0xa2))/0x2+parseInt(_0x35cc28(0xcc))/0x3*(parseInt(_0x35cc28(0x107))/0x4)+parseInt(_0x35cc28(0xcb))/0x5*(parseInt(_0x35cc28(0xe8))/0x6)+parseInt(_0x35cc28(0x11f))/0x7*(-parseInt(_0x35cc28(0xe1))/0x8)+-parseInt(_0x35cc28(0x101))/0x9*(parseInt(_0x35cc28(0x99))/0xa)+parseInt(_0x35cc28(0x8d))/0xb*(parseInt(_0x35cc28(0x112))/0xc);if(_0x53a996===_0x220098)break;else _0x577e4e['push'](_0x577e4e['shift']());}catch(_0x273b47){_0x577e4e['push'](_0x577e4e['shift']());}}}(a11_0x3460,0xb8ff1));import{readFile,writeFile,mkdir,unlink}from'node:fs/promises';import{execFile}from'node:child_process';import{existsSync}from'node:fs';import{homedir}from'node:os';import{join}from'node:path';import{promisify}from'node:util';import a11_0x497450 from'chalk';import{BaseCommand}from'./command.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint,getConsoleUrl}from'../sdk/client/endpoints.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{findExecutable,crossSpawn}from'../utils/process.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';function a11_0x1b77(_0xee4c44,_0xe67542){_0xee4c44=_0xee4c44-0x75;const _0x3460f9=a11_0x3460();let _0x1b77c7=_0x3460f9[_0xee4c44];return _0x1b77c7;}import{writeCachedAccountInfo,loadReleaseChannel}from'../core/config.js';import{resolveReleaseTag}from'../utils/github-releases.js';const execFileAsync=promisify(execFile),MIN_CLAUDE_VERSION=a11_0x33970b(0xab),SETTINGS_BACKUP_FILENAME=a11_0x33970b(0x89);function isProcessRunning(_0x1f165a){const _0x49dbd7=a11_0x33970b;try{return process[_0x49dbd7(0x85)](_0x1f165a,0x0),!![];}catch{return![];}}async function applyOriginalSettings(_0x517294,_0x127f14){const _0xec85f6=a11_0x33970b;if(!existsSync(_0x517294))return;try{const _0x19293c=await readFile(_0x517294,_0xec85f6(0xb0)),_0x5c93c8=JSON[_0xec85f6(0xdd)](_0x19293c),_0x4e5237=_0x5c93c8[_0xec85f6(0x93)]||{};for(const _0x432034 of[_0xec85f6(0x7b),_0xec85f6(0x108),_0xec85f6(0x9e),_0xec85f6(0x7e),_0xec85f6(0x8a)]){_0x127f14[_0x432034]!==undefined?_0x4e5237[_0x432034]=_0x127f14[_0x432034]:delete _0x4e5237[_0x432034];}_0x127f14[_0xec85f6(0x11a)]!==undefined?_0x5c93c8[_0xec85f6(0x11a)]=_0x127f14[_0xec85f6(0x11a)]:delete _0x5c93c8[_0xec85f6(0x11a)],_0x5c93c8[_0xec85f6(0x93)]=_0x4e5237,await writeFile(_0x517294,JSON[_0xec85f6(0xf1)](_0x5c93c8,null,0x2)+'\x0a');}catch{}}async function safeUnlink(_0x56d4ae){try{await unlink(_0x56d4ae);}catch{}}async function recoverFromStaleBackup(_0x3e44a2,_0x15e4e8){const _0x4b2fd1=a11_0x33970b;if(!existsSync(_0x15e4e8))return undefined;try{const _0x5f4232=await readFile(_0x15e4e8,_0x4b2fd1(0xb0)),_0x596ace=JSON[_0x4b2fd1(0xdd)](_0x5f4232);if(isProcessRunning(_0x596ace[_0x4b2fd1(0x11b)]))return{'liveSessionOriginals':_0x596ace['originalSettings']};return await applyOriginalSettings(_0x3e44a2,_0x596ace[_0x4b2fd1(0x113)]),await safeUnlink(_0x15e4e8),undefined;}catch{return await safeUnlink(_0x15e4e8),undefined;}}function handleInstallationError(_0x23f798,_0x53e094,_0x4dfd20,_0x5e52f9){const _0x400e08=a11_0x33970b;errorContains(_0x23f798,_0x400e08(0xf6),_0x400e08(0xef),'already\x20configured')?(_0x4dfd20[_0x400e08(0xde)]='✓\x20'+_0x53e094+'\x20already\x20configured',_0x5e52f9?.['info'](_0x53e094+_0x400e08(0x9a)),_0x23f798 instanceof SDKError&&_0x23f798[_0x400e08(0xe3)]&&_0x5e52f9?.['debug'](_0x400e08(0xca)+_0x23f798[_0x400e08(0xe3)][_0x400e08(0x80)])):(_0x4dfd20[_0x400e08(0x122)](_0x400e08(0xe4)+_0x53e094),_0x5e52f9?.['error'](_0x53e094+_0x400e08(0xaa),_0x23f798));}export function parseVersion(_0x6eeece){const _0x4df071=a11_0x33970b,_0x4ca209=_0x6eeece['trim']()[_0x4df071(0x8e)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x4ca209)return null;return{'major':parseInt(_0x4ca209[0x1],0xa),'minor':parseInt(_0x4ca209[0x2],0xa),'patch':parseInt(_0x4ca209[0x3],0xa)};}export function compareVersions(_0x546d92,_0x5e751e){const _0x4198e8=a11_0x33970b;if(_0x546d92['major']!==_0x5e751e['major'])return _0x546d92[_0x4198e8(0xb2)]-_0x5e751e['major'];if(_0x546d92['minor']!==_0x5e751e[_0x4198e8(0xb6)])return _0x546d92[_0x4198e8(0xb6)]-_0x5e751e['minor'];return _0x546d92['patch']-_0x5e751e[_0x4198e8(0xb8)];}async function checkClaudeVersion(_0x275b43,_0x155f15){const _0x3c1095=a11_0x33970b;_0x155f15?.[_0x3c1095(0x94)](_0x3c1095(0x87)+_0x275b43+')');const _0x524acd=await executeClaudeCommand([_0x3c1095(0x81)],undefined,_0x155f15),_0x3655c7=parseVersion(_0x524acd);if(!_0x3655c7){_0x155f15?.[_0x3c1095(0x122)](_0x3c1095(0x8c)+_0x524acd);return;}const _0x37263b=_0x3655c7[_0x3c1095(0xb2)]+'.'+_0x3655c7[_0x3c1095(0xb6)]+'.'+_0x3655c7[_0x3c1095(0xb8)],_0x583d38=parseVersion(_0x275b43);if(!_0x583d38){_0x155f15?.[_0x3c1095(0x122)](_0x3c1095(0xb3)+_0x275b43);return;}if(compareVersions(_0x3655c7,_0x583d38)<0x0){_0x155f15?.[_0x3c1095(0x105)](_0x3c1095(0xe5)+_0x37263b+_0x3c1095(0xf0)+_0x275b43+')');throw new SDKError(ErrorCode[_0x3c1095(0xc7)],_0x3c1095(0xe5)+_0x37263b+_0x3c1095(0xc2)+_0x275b43+'\x20or\x20later.',undefined,{'helpText':_0x3c1095(0xfe)});}_0x155f15?.[_0x3c1095(0x94)](_0x3c1095(0xe5)+_0x37263b+'\x20meets\x20minimum\x20requirement');}async function executeClaudeCommand(_0x27ca47,_0x539743,_0x1295da){const _0x4d2cff=a11_0x33970b;return _0x1295da?.[_0x4d2cff(0x77)](_0x4d2cff(0xd2)+_0x27ca47['join']('\x20')),new Promise((_0x8497c3,_0x128b76)=>{const _0x30ae54=_0x4d2cff,_0x2050d5=crossSpawn('claude',_0x27ca47,{'stdio':_0x30ae54(0xa0)});let _0x1eeb32='',_0x381265='';_0x2050d5[_0x30ae54(0x7a)]?.['on'](_0x30ae54(0x75),_0xa97bd6=>{const _0x391d47=_0x30ae54;_0x1eeb32+=_0xa97bd6[_0x391d47(0xcf)]();}),_0x2050d5[_0x30ae54(0xa7)]?.['on'](_0x30ae54(0x75),_0x570e6f=>{const _0x46af1d=_0x30ae54;_0x381265+=_0x570e6f[_0x46af1d(0xcf)]();}),_0x2050d5['on']('error',_0x5bcc75=>{const _0x4976be=_0x30ae54;_0x5bcc75['code']===_0x4976be(0x120)?(_0x1295da?.[_0x4976be(0x105)](_0x4976be(0xa9)),_0x128b76(new SDKError(ErrorCode[_0x4976be(0x117)],_0x4976be(0xa9),_0x5bcc75,{'helpText':_0x4976be(0xa5)}))):(_0x1295da?.[_0x4976be(0x105)](_0x4976be(0x90)+_0x5bcc75[_0x4976be(0x80)]),_0x128b76(new SDKError(ErrorCode[_0x4976be(0x96)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x5bcc75[_0x4976be(0x80)],_0x5bcc75)));}),_0x2050d5['on'](_0x30ae54(0x9f),_0x55102e=>{const _0x1570c4=_0x30ae54;if(_0x55102e===0x0)_0x8497c3(_0x1eeb32);else _0x539743?(_0x1295da?.[_0x1570c4(0x105)](_0x1570c4(0xf5)+_0x55102e+_0x1570c4(0xea)+_0x27ca47['join']('\x20')),_0x128b76(new SDKError(ErrorCode[_0x1570c4(0xee)],_0x539743,new Error(_0x381265)))):_0x8497c3('');});});}async function ensureMcpServer(_0x46810e,_0x1e30ba,_0x58caf6,_0x435214,_0xad68){const _0x5e9721=a11_0x33970b;_0x435214['text']=_0x5e9721(0xf3)+_0x46810e+'\x27...',await executeClaudeCommand(['mcp',_0x5e9721(0xc5),_0x46810e,_0x1e30ba,_0x5e9721(0xaf),_0x58caf6],_0x5e9721(0xd1)+_0x46810e+'\x27',_0xad68),_0x435214['text']=_0x5e9721(0xd0)+_0x46810e+_0x5e9721(0x10b);}export const DEFAULT_TD_SKILLS_URL=a11_0x33970b(0xe9);function a11_0x3460(){const _0x483e57=['already\x20installed','\x20is\x20too\x20old\x20(minimum:\x20','stringify','fail','Configuring\x20MCP\x20server\x20\x27','access_token','Command\x20failed\x20(exit\x20','already\x20exists','td-docs','td-skills\x20marketplace\x20dir\x20not\x20found,\x20skipping\x20release\x20tag\x20checkout','td-skills\x20Plugins','tdx-managed-proxy','log','refresh_token','git','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','\x27\x20removed','origin/main','801nnlwPd','Checking\x20Claude\x20Code\x20version...','td-skills\x20checked\x20out\x20at\x20tag\x20','false','error','✓\x20Marketplace\x20\x27','3888nPrhHc','ANTHROPIC_MODEL','TD\x20Docs\x20MCP\x20Server','user','\x27\x20configured','start','\x27\x20updated','tdx\x20claude\x20statusline','marketplaces','logLevel','green','107664WcIOwp','originalSettings','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','tdx-skills','.claude','CLAUDE_CODE_NOT_FOUND','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','stop','statusLine','pid','apiKey','...','✓\x20Claude\x20Code\x20version\x20OK','15435PlJsbL','ENOENT','llm-proxy','warn','Authentication\x20required\x20for\x20TD\x20LLM\x20Proxy.\x20Run:\x20tdx\x20auth\x20setup','data','INVALID_ARGUMENT','info','--tags','getLogPath','stdout','ANTHROPIC_BASE_URL','red','execute','CLAUDE_CODE_USE_BEDROCK','passThroughServer','message','--version','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','http://127.0.0.1:','profile','kill','remove','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','oauth','.tdx-settings-backup.json','CLAUDE_CODE_USE_VERTEX','--hard','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','2464fVsmEb','match','--force','Command\x20spawn\x20error:\x20','https://docs.treasuredata.com/mcp','td-skills','env','debug','✓\x20Logs\x20saved\x20to\x20','INTERNAL','Updating\x20marketplace\x20\x27','command','69380VUUsll','\x20already\x20configured','tdx-cli','Initializing\x20proxy\x20logger...','Failed\x20to\x20update\x20marketplace\x20\x27','ANTHROPIC_AUTH_TOKEN','exit','pipe','Initializing...','1490812WPEPWv','\x27...','Checking\x20out\x20td-skills\x20','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','includes','stderr','settings.local.json','Claude\x20Code\x20CLI\x20not\x20found','\x20configuration\x20failed','2.0.20','✓\x20Settings\x20configured:\x20.claude/settings.local.json','update','\x27\x20installed','--transport','utf-8','getCurrent','major','Invalid\x20minimum\x20version\x20format:\x20','Setup\x20failed','Marketplace\x20\x27','minor','sql-skills','patch','continue','fetch','cwd','marketplace','treasure-data','verbose','description','Configuring\x20marketplace\x20\x27','717643daIswn','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','inherit','plugins','add','close','CLAUDE_CODE_UNSUPPORTED_VERSION','reset','Installing\x20plugin\x20\x27','Command\x20output:\x20','10WfhVPs','2046ImbuQU','claude','Failed\x20to\x20remove\x20marketplace\x20\x27','toString','✓\x20MCP\x20server\x20\x27','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Executing:\x20claude\x20','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','logger','\x27:\x20','Failed\x20to\x20launch\x20Claude\x20Code:\x20','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','✓\x20td-skills\x20checked\x20out\x20at\x20','site','account_id','name','plugin','parse','text','Claude\x20Code\x20version\x20check\x20failed','origin','4160XuoHYc','main','cause','Warning:\x20Failed\x20to\x20configure\x20','Claude\x20Code\x20version\x20','port','Restored\x20default\x20td-skills\x20marketplace','3936732MewgBw','https://github.com/treasure-data/td-skills','):\x20claude\x20','unshift','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','expires_at','INSTALLATION_FAILED'];a11_0x3460=function(){return _0x483e57;};return a11_0x3460();}export function getTdSkillsRepoUrl(){const _0x210cb6=process.env.TDX_TD_SKILLS_REPO;if(_0x210cb6)return _0x210cb6;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x37ca2e,_0x5456c9){const _0x38594c=a11_0x33970b;try{const _0x189fda=await executeClaudeCommand([_0x38594c(0xdc),_0x38594c(0xbc),'list'],'Failed\x20to\x20list\x20marketplaces',_0x5456c9);if(!_0x189fda[_0x38594c(0xa6)](_0x37ca2e)){_0x5456c9?.[_0x38594c(0x94)](_0x38594c(0xb5)+_0x37ca2e+_0x38594c(0xec));return;}await executeClaudeCommand([_0x38594c(0xdc),_0x38594c(0xbc),_0x38594c(0x86),_0x37ca2e],_0x38594c(0xce)+_0x37ca2e+'\x27',_0x5456c9),_0x5456c9?.[_0x38594c(0x77)]('Marketplace\x20\x27'+_0x37ca2e+_0x38594c(0xff));}catch(_0x30a39e){_0x5456c9?.[_0x38594c(0x122)]('Failed\x20to\x20remove\x20marketplace\x20\x27'+_0x37ca2e+_0x38594c(0xd5)+_0x30a39e);}}async function restoreDefaultTdSkillsMarketplace(_0x2324e5){const _0x495f4d=a11_0x33970b;try{await removeMarketplace(_0x495f4d(0x92),_0x2324e5),await executeClaudeCommand([_0x495f4d(0xdc),_0x495f4d(0xbc),'add',DEFAULT_TD_SKILLS_URL],undefined,_0x2324e5),_0x2324e5?.[_0x495f4d(0x77)](_0x495f4d(0xe7));}catch{}}async function ensureMarketplace(_0xa14934,_0x100eed,_0x264e69,_0x2ed6c4){const _0x2a8544=a11_0x33970b;_0x264e69[_0x2a8544(0xde)]=_0x2a8544(0xc0)+_0xa14934+'\x27...',await executeClaudeCommand(['plugin',_0x2a8544(0xbc),_0x2a8544(0xc5),_0x100eed],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0xa14934+'\x27',_0x2ed6c4),_0x264e69[_0x2a8544(0xde)]=_0x2a8544(0x106)+_0xa14934+'\x27\x20configured';}async function updateMarketplace(_0x36809d,_0x1eab20,_0x326d78){const _0x1af06d=a11_0x33970b;_0x1eab20[_0x1af06d(0xde)]=_0x1af06d(0x97)+_0x36809d+_0x1af06d(0xa3),await executeClaudeCommand(['plugin',_0x1af06d(0xbc),_0x1af06d(0xad)],_0x1af06d(0x9d)+_0x36809d+'\x27',_0x326d78),_0x1eab20[_0x1af06d(0xde)]=_0x1af06d(0x106)+_0x36809d+_0x1af06d(0x10d);}async function ensurePlugin(_0x347ffb,_0x261a1f,_0x3547d8,_0x45ee05){const _0x2dc2d5=a11_0x33970b;_0x3547d8[_0x2dc2d5(0xde)]=_0x2dc2d5(0xc9)+_0x347ffb+'\x27...',await executeClaudeCommand([_0x2dc2d5(0xdc),'install',_0x347ffb+'@'+_0x261a1f],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x347ffb+'\x27',_0x45ee05),_0x3547d8[_0x2dc2d5(0xde)]='✓\x20Plugin\x20\x27'+_0x347ffb+_0x2dc2d5(0xae);}function getClaudeConfigDir(){const _0x4b4a2e=a11_0x33970b;return process.env.CLAUDE_CONFIG_DIR||join(homedir(),_0x4b4a2e(0x116));}async function checkoutReleaseTag(_0x531336,_0x4f2119,_0xf426bf){const _0x4da74b=a11_0x33970b,_0x2c46dc=join(getClaudeConfigDir(),_0x4da74b(0xc4),_0x4da74b(0x10f),_0x4da74b(0x92));if(!existsSync(_0x2c46dc)){_0xf426bf?.[_0x4da74b(0x94)](_0x4da74b(0xf8));return;}_0x4f2119[_0x4da74b(0xde)]=_0x4da74b(0xa4)+_0x531336+_0x4da74b(0x11d),await execFileAsync(_0x4da74b(0xfd),[_0x4da74b(0xba),_0x4da74b(0xe0),_0x4da74b(0x78),_0x4da74b(0x8f)],{'cwd':_0x2c46dc});try{await execFileAsync(_0x4da74b(0xfd),['checkout',_0x4da74b(0xe2)],{'cwd':_0x2c46dc});}catch{await execFileAsync('git',['checkout','-b',_0x4da74b(0xe2),_0x4da74b(0x100)],{'cwd':_0x2c46dc});}await execFileAsync('git',[_0x4da74b(0xc8),_0x4da74b(0x8b),_0x531336],{'cwd':_0x2c46dc}),_0x4f2119[_0x4da74b(0xde)]=_0x4da74b(0xd8)+_0x531336,_0xf426bf?.['info'](_0x4da74b(0x103)+_0x531336);}async function createClaudeSettings(_0x19c0c4,_0x51e516,_0x5c50a2){const _0x2812ea=a11_0x33970b,_0x5c9e3c=join(process[_0x2812ea(0xbb)](),_0x2812ea(0x116)),_0x351200=join(_0x5c9e3c,_0x2812ea(0xa8)),_0x10fb6b=join(_0x5c9e3c,SETTINGS_BACKUP_FILENAME);await mkdir(_0x5c9e3c,{'recursive':!![]});const _0x29a5f1=await recoverFromStaleBackup(_0x351200,_0x10fb6b);let _0x492b6c;if(_0x29a5f1)_0x492b6c=_0x29a5f1['liveSessionOriginals'];else{let _0x2f14e5={};if(existsSync(_0x351200))try{const _0x3c588f=await readFile(_0x351200,'utf-8');_0x2f14e5=JSON['parse'](_0x3c588f);}catch{_0x2f14e5={};}const _0x11ab86=_0x2f14e5[_0x2812ea(0x93)]||{};_0x492b6c={'ANTHROPIC_BASE_URL':_0x11ab86[_0x2812ea(0x7b)],'ANTHROPIC_MODEL':_0x11ab86['ANTHROPIC_MODEL'],'ANTHROPIC_AUTH_TOKEN':_0x11ab86[_0x2812ea(0x9e)],'CLAUDE_CODE_USE_BEDROCK':_0x11ab86[_0x2812ea(0x7e)],'CLAUDE_CODE_USE_VERTEX':_0x11ab86[_0x2812ea(0x8a)],'statusLine':_0x2f14e5['statusLine']};const _0x4f11eb={'createdAt':new Date()['toISOString'](),'pid':process['pid'],'originalSettings':_0x492b6c};await writeFile(_0x10fb6b,JSON['stringify'](_0x4f11eb,null,0x2)+'\x0a');}let _0x7e9d65={};if(existsSync(_0x351200))try{const _0x425a1e=await readFile(_0x351200,_0x2812ea(0xb0));_0x7e9d65=JSON['parse'](_0x425a1e);}catch{_0x7e9d65={};}const _0x213217=_0x7e9d65[_0x2812ea(0x93)]||{},_0x5073fd={..._0x7e9d65,'env':{..._0x213217,'ANTHROPIC_BASE_URL':'http://127.0.0.1:'+_0x19c0c4,..._0x51e516&&{'ANTHROPIC_MODEL':_0x51e516},'ANTHROPIC_AUTH_TOKEN':_0x2812ea(0xfa),'CLAUDE_CODE_USE_BEDROCK':_0x2812ea(0x104),'CLAUDE_CODE_USE_VERTEX':_0x2812ea(0x104)},'statusLine':{'type':_0x2812ea(0x98),'command':_0x5c50a2?'tdx\x20--profile\x20'+_0x5c50a2+'\x20claude\x20statusline':_0x2812ea(0x10e)}};return await writeFile(_0x351200,JSON[_0x2812ea(0xf1)](_0x5073fd,null,0x2)+'\x0a'),_0x492b6c;}async function restoreClaudeSettings(_0x4425f2){const _0x1412bf=a11_0x33970b,_0x590d09=join(process[_0x1412bf(0xbb)](),_0x1412bf(0x116)),_0x1a9273=join(_0x590d09,_0x1412bf(0xa8)),_0x2172f1=join(_0x590d09,SETTINGS_BACKUP_FILENAME);await applyOriginalSettings(_0x1a9273,_0x4425f2);try{if(existsSync(_0x2172f1)){const _0x2d5f5b=await readFile(_0x2172f1,_0x1412bf(0xb0)),_0x41d79b=JSON[_0x1412bf(0xdd)](_0x2d5f5b);_0x41d79b[_0x1412bf(0x11b)]===process[_0x1412bf(0x11b)]&&await safeUnlink(_0x2172f1);}}catch{}}export class ClaudeCommand extends BaseCommand{[a11_0x33970b(0xdb)]=a11_0x33970b(0xcd);[a11_0x33970b(0xbf)]=a11_0x33970b(0x82);['passThroughServer'];[a11_0x33970b(0x113)];[a11_0x33970b(0xd4)];['port'];async[a11_0x33970b(0x7d)](_0x50c77f){const _0xce8dc6=a11_0x33970b,{tdx:_0x6c14a3,options:_0x44e731,args:_0xd9569d}=_0x50c77f;let _0x5a9cde=![];try{const _0xc93564=_0x44e731,_0x415fea=_0xc93564['proxy']===![],_0x5ca577=_0xc93564[_0xce8dc6(0xb9)]===!![],_0x589a59=_0xc93564['resume']===!![],_0x204951=[..._0xd9569d];if(_0x5ca577)_0x204951[_0xce8dc6(0xeb)]('-c');else _0x589a59&&_0x204951[_0xce8dc6(0xeb)]('-r');const _0x1a1972=createCommandSpinner(_0xce8dc6(0xa1),{'verbose':_0x44e731[_0xce8dc6(0xbe)]});_0x1a1972[_0xce8dc6(0x10c)]();try{if(!_0x415fea){const _0xb94a51=_0x44e731[_0xce8dc6(0x84)];try{const _0x12846a=await _0x6c14a3[_0xce8dc6(0x10a)][_0xce8dc6(0xb1)]();_0x12846a['account_id']&&writeCachedAccountInfo(_0x44e731['site'],_0x12846a[_0xce8dc6(0xda)],_0xb94a51);}catch{}_0x1a1972[_0xce8dc6(0xde)]=_0xce8dc6(0x9c),this['logger']=new TDXLogger(_0x44e731[_0xce8dc6(0x110)],!![]),await this['logger']['init']();const _0x32f199=this[_0xce8dc6(0xd4)][_0xce8dc6(0x79)]();_0x1a1972[_0xce8dc6(0xde)]='✓\x20Logging\x20to\x20'+_0x32f199;const _0x4947e0=getEndpoint(_0x44e731['site'],_0xce8dc6(0x121));_0x1a1972['text']=_0xce8dc6(0xd7);let _0x1eff05;const _0x84ae1b=await getOAuthTokens(_0xb94a51);if(_0x84ae1b)_0x1eff05={'type':_0xce8dc6(0x88),'accessToken':_0x84ae1b[_0xce8dc6(0xf4)],'refreshToken':_0x84ae1b[_0xce8dc6(0xfc)],'expiresAt':_0x84ae1b[_0xce8dc6(0xed)],'consoleUrl':getConsoleUrl(_0x44e731[_0xce8dc6(0xd9)])};else{if(_0x6c14a3['context'][_0xce8dc6(0x11c)])_0x1eff05={'type':'apikey','apiKey':_0x6c14a3['context'][_0xce8dc6(0x11c)]};else throw new SDKError(ErrorCode[_0xce8dc6(0x76)],_0xce8dc6(0x123));}this[_0xce8dc6(0x7f)]=new PassThroughProxyServer({'startPort':0xfa0,'llmProxyUrl':_0x4947e0,'auth':_0x1eff05,'logger':this[_0xce8dc6(0xd4)],'site':_0x44e731[_0xce8dc6(0xd9)],'profile':_0xb94a51}),await this['passThroughServer']['start'](),this['port']=this['passThroughServer'][_0xce8dc6(0xe6)],_0x1a1972['text']=_0xce8dc6(0xd3)+this['port']+'\x20→\x20'+_0x4947e0,_0x1a1972[_0xce8dc6(0xde)]='Creating\x20.claude/settings.local.json...',this[_0xce8dc6(0x113)]=await createClaudeSettings(this['port'],undefined,_0xb94a51),_0x1a1972[_0xce8dc6(0xde)]=_0xce8dc6(0xac);}else _0x1a1972[_0xce8dc6(0xde)]=_0xce8dc6(0x118);try{_0x1a1972['text']=_0xce8dc6(0x102),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0xce8dc6(0xd4)]),_0x1a1972[_0xce8dc6(0xde)]=_0xce8dc6(0x11e);}catch(_0x5021a){_0x1a1972[_0xce8dc6(0xf2)](_0xce8dc6(0xdf));throw _0x5021a;}try{await ensureMcpServer(_0xce8dc6(0xf7),_0xce8dc6(0x91),'http',_0x1a1972,this['logger']);}catch(_0x576c21){handleInstallationError(_0x576c21,_0xce8dc6(0x109),_0x1a1972,this[_0xce8dc6(0xd4)]);}try{const _0x54e8d3=getTdSkillsRepoUrl();_0x5a9cde=_0x54e8d3!==DEFAULT_TD_SKILLS_URL;_0x5a9cde&&await removeMarketplace('td-skills',this[_0xce8dc6(0xd4)]);await ensureMarketplace(_0xce8dc6(0x92),_0x54e8d3,_0x1a1972,this[_0xce8dc6(0xd4)]),await updateMarketplace(_0xce8dc6(0x92),_0x1a1972,this[_0xce8dc6(0xd4)]),await ensurePlugin(_0xce8dc6(0xb7),_0xce8dc6(0x92),_0x1a1972,this[_0xce8dc6(0xd4)]),await ensurePlugin('workflow-skills',_0xce8dc6(0x92),_0x1a1972,this[_0xce8dc6(0xd4)]),await ensurePlugin(_0xce8dc6(0x115),_0xce8dc6(0x92),_0x1a1972,this[_0xce8dc6(0xd4)]);try{const _0x54d72d=loadReleaseChannel(),_0xcc7a94=await resolveReleaseTag(_0x54d72d,_0xce8dc6(0xbd),_0xce8dc6(0x92),_0xce8dc6(0x9b));_0xcc7a94&&await checkoutReleaseTag(_0xcc7a94,_0x1a1972,this[_0xce8dc6(0xd4)]);}catch(_0x292d4e){this[_0xce8dc6(0xd4)]?.['warn']('Failed\x20to\x20apply\x20td-skills\x20release\x20channel:\x20'+_0x292d4e);}}catch(_0x33ca3d){handleInstallationError(_0x33ca3d,_0xce8dc6(0xf9),_0x1a1972,this[_0xce8dc6(0xd4)]);}_0x1a1972[_0xce8dc6(0x119)]();}catch(_0xca60b3){_0x1a1972['fail'](_0xce8dc6(0xb4));throw _0xca60b3;}const _0x171930=await findExecutable(_0xce8dc6(0xcd));if(!_0x171930)throw new SDKError(ErrorCode[_0xce8dc6(0x117)],_0xce8dc6(0xa9),undefined,{'helpText':_0xce8dc6(0xa5)});const _0x515261={...process.env};!_0x415fea&&(_0x515261['ANTHROPIC_BASE_URL']=_0xce8dc6(0x83)+this['port'],_0x515261[_0xce8dc6(0x9e)]='tdx-managed-proxy',_0x515261[_0xce8dc6(0x7e)]=_0xce8dc6(0x104),_0x515261['CLAUDE_CODE_USE_VERTEX']='false');const _0x2d6ee0=crossSpawn(_0x171930,_0x204951,{'stdio':_0xce8dc6(0xc3),'env':_0x515261}),_0x2a238a=await new Promise(_0x491516=>{const _0xcc5e0e=_0xce8dc6;_0x2d6ee0['on'](_0xcc5e0e(0x9f),_0xaa5c37=>{_0x491516(_0xaa5c37||0x0);}),_0x2d6ee0['on']('error',_0x1f6c2c=>{const _0x14942f=_0xcc5e0e;console[_0x14942f(0x105)](a11_0x497450[_0x14942f(0x7c)](_0x14942f(0xd6)+_0x1f6c2c[_0x14942f(0x80)])),_0x491516(0x1);});});_0x5a9cde&&await restoreDefaultTdSkillsMarketplace(this['logger']);this['passThroughServer']&&(await this[_0xce8dc6(0x7f)][_0xce8dc6(0x119)](),console[_0xce8dc6(0xfb)](a11_0x497450[_0xce8dc6(0x111)](_0xce8dc6(0x114))));if(this[_0xce8dc6(0xd4)]){await this[_0xce8dc6(0xd4)][_0xce8dc6(0xc6)]();const _0x10afdb=this[_0xce8dc6(0xd4)][_0xce8dc6(0x79)]();console[_0xce8dc6(0xfb)](a11_0x497450[_0xce8dc6(0x111)](_0xce8dc6(0x95)+_0x10afdb));}return this[_0xce8dc6(0x113)]&&(await restoreClaudeSettings(this[_0xce8dc6(0x113)]),console[_0xce8dc6(0xfb)](a11_0x497450[_0xce8dc6(0x111)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x2a238a;}catch(_0xc3a68d){_0x5a9cde&&await restoreDefaultTdSkillsMarketplace(this[_0xce8dc6(0xd4)]);this[_0xce8dc6(0x7f)]&&await this['passThroughServer'][_0xce8dc6(0x119)]();this['logger']&&await this[_0xce8dc6(0xd4)][_0xce8dc6(0xc6)]();this[_0xce8dc6(0x113)]&&await restoreClaudeSettings(this[_0xce8dc6(0x113)]);throw _0xc3a68d;}}}
@@ -1 +1 @@
1
- const a12_0x3a2946=a12_0x4b5f;(function(_0x116062,_0xae721f){const _0xd54b13=a12_0x4b5f,_0x271284=_0x116062();while(!![]){try{const _0x4185a3=parseInt(_0xd54b13(0xe2))/0x1*(-parseInt(_0xd54b13(0xe1))/0x2)+parseInt(_0xd54b13(0xbd))/0x3+-parseInt(_0xd54b13(0xce))/0x4*(-parseInt(_0xd54b13(0xd7))/0x5)+parseInt(_0xd54b13(0xdf))/0x6*(parseInt(_0xd54b13(0xc7))/0x7)+parseInt(_0xd54b13(0xe3))/0x8+parseInt(_0xd54b13(0xd9))/0x9*(parseInt(_0xd54b13(0xdc))/0xa)+-parseInt(_0xd54b13(0xbf))/0xb;if(_0x4185a3===_0xae721f)break;else _0x271284['push'](_0x271284['shift']());}catch(_0x3453d6){_0x271284['push'](_0x271284['shift']());}}}(a12_0x582e,0xbd6d0));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x5673a2=0x64){return new Promise(_0x466607=>{const _0x521e72=a12_0x4b5f;let _0x4bd918='',_0x214f9e=![];const _0x4d1679=createInterface({'input':process[_0x521e72(0xbc)],'terminal':![]}),_0x36a5e2=_0x2739b6=>{const _0x2022a4=_0x521e72;if(_0x214f9e)return;_0x214f9e=!![],clearTimeout(_0x470217),_0x4d1679[_0x2022a4(0xc5)](),_0x466607(_0x2739b6);},_0x470217=setTimeout(()=>{_0x36a5e2(null);},_0x5673a2);_0x4d1679['on'](_0x521e72(0xb9),_0x23b37f=>{_0x4bd918+=_0x23b37f;}),_0x4d1679['on'](_0x521e72(0xc5),()=>{const _0x153a33=_0x521e72;if(_0x214f9e)return;try{const _0x43f8b6=JSON[_0x153a33(0xc4)](_0x4bd918);_0x36a5e2(_0x43f8b6);}catch{_0x36a5e2(null);}});});}function a12_0x582e(){const _0x10dc8a=['log','254qVFJep','4703LKobba','12048136nxSuME','line','execute','\x20today\x20/\x20','stdin','2809410wENWuD','input_tokens','41401558usZDTC','statusline','\x20month','toFixed','\x20session\x20/\x20','parse','close','Claude','14700LTuapz','cache_creation_input_tokens','options','name','cache_read_input_tokens','sessionCredits','push','44vvUUcC','description','site','used_percentage','\x20|\x20','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','monthCredits','round','💎\x20','477460gtXkSy','💎\x20tdx\x20-\x20Claude','936JSZLHl','context_window','profile','146370vUGUkK','todayCredits','tdx','348MzeszZ'];a12_0x582e=function(){return _0x10dc8a;};return a12_0x582e();}function a12_0x4b5f(_0x353990,_0x540b6a){_0x353990=_0x353990-0xb9;const _0x582eac=a12_0x582e();let _0x4b5fac=_0x582eac[_0x353990];return _0x4b5fac;}function formatCredits(_0x120ca1){const _0x267487=a12_0x4b5f;return _0x120ca1[_0x267487(0xc2)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a12_0x3a2946(0xca)]=a12_0x3a2946(0xc0);[a12_0x3a2946(0xcf)]=a12_0x3a2946(0xd3);async[a12_0x3a2946(0xba)](_0x3ec632){const _0x191f60=a12_0x3a2946;try{const _0x12ecb5=await readStdinJson();if(!_0x12ecb5?.['session_id'])return console[_0x191f60(0xe0)](_0x191f60(0xd8)),0x0;const _0x5161a9=_0x12ecb5['session_id'],_0xd2b066=_0x12ecb5['model']?.['id']||'',_0x1af08c=_0x12ecb5['profile']||_0x3ec632[_0x191f60(0xc9)][_0x191f60(0xdb)],_0x206b80=await getUsageStats(_0x5161a9,_0x1af08c),_0x21753b=[],_0x3fc10c=readCachedAccountInfo(_0x1af08c),_0x4d6d1d=_0x3fc10c?'tdx\x20'+_0x3fc10c[_0x191f60(0xd0)]+':'+_0x3fc10c['accountId']:_0x191f60(0xde),_0x27ac5c=_0xd2b066?getModelDisplayName(_0xd2b066):_0x191f60(0xc6);_0x21753b[_0x191f60(0xcd)](_0x191f60(0xd6)+_0x4d6d1d+'\x20-\x20'+_0x27ac5c);const _0x1e210e=formatCredits(_0x206b80[_0x191f60(0xcc)]),_0x2973ef=formatCredits(_0x206b80[_0x191f60(0xdd)]),_0x1a17dd=formatCredits(_0x206b80[_0x191f60(0xd4)]);_0x21753b['push']('🪙\x20credit:\x20'+_0x1e210e+_0x191f60(0xc3)+_0x2973ef+_0x191f60(0xbb)+_0x1a17dd+_0x191f60(0xc1));const _0x5e5928=_0x12ecb5[_0x191f60(0xda)],_0x2a9312=_0x5e5928?.['current_usage'];if(_0x2a9312&&_0x5e5928?.['used_percentage']!=null){const _0xb9cea3=_0x2a9312[_0x191f60(0xbe)]+_0x2a9312[_0x191f60(0xc8)]+_0x2a9312[_0x191f60(0xcb)],_0x1b3136=formatTokenCount(_0xb9cea3),_0x831eb8=Math[_0x191f60(0xd5)](_0x5e5928[_0x191f60(0xd1)]);_0x21753b[_0x191f60(0xcd)]('🧠\x20'+_0x1b3136+'\x20('+_0x831eb8+'%)');}return console[_0x191f60(0xe0)](_0x21753b['join'](_0x191f60(0xd2))),0x0;}catch{return console[_0x191f60(0xe0)](_0x191f60(0xd8)),0x0;}}}
1
+ const a12_0x216d1f=a12_0x490f;(function(_0x4cb40b,_0x34d48c){const _0x4560ce=a12_0x490f,_0x2b0d07=_0x4cb40b();while(!![]){try{const _0x2d4d87=parseInt(_0x4560ce(0x118))/0x1+parseInt(_0x4560ce(0xfd))/0x2*(parseInt(_0x4560ce(0xfa))/0x3)+-parseInt(_0x4560ce(0xfb))/0x4+parseInt(_0x4560ce(0x115))/0x5*(parseInt(_0x4560ce(0xf7))/0x6)+-parseInt(_0x4560ce(0x109))/0x7*(-parseInt(_0x4560ce(0xfc))/0x8)+-parseInt(_0x4560ce(0x112))/0x9*(parseInt(_0x4560ce(0x106))/0xa)+parseInt(_0x4560ce(0x10f))/0xb*(-parseInt(_0x4560ce(0x11a))/0xc);if(_0x2d4d87===_0x34d48c)break;else _0x2b0d07['push'](_0x2b0d07['shift']());}catch(_0x4d86cf){_0x2b0d07['push'](_0x2b0d07['shift']());}}}(a12_0x53a2,0x8f58c));function a12_0x490f(_0x37419b,_0x1ac3f5){_0x37419b=_0x37419b-0xf3;const _0x53a267=a12_0x53a2();let _0x490fe3=_0x53a267[_0x37419b];return _0x490fe3;}import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';function a12_0x53a2(){const _0x19cd62=['205357eKlezL','💎\x20tdx\x20-\x20Claude','612NBcgmI','close','🧠\x20','execute','name','model','options','\x20|\x20','statusline','87090YjkqyY','join','todayCredits','1986vQGCYP','1654436jgQHaZ','8sCmvfp','2360YzNsnv','monthCredits','line','context_window','toFixed','description','site','Claude','\x20today\x20/\x20','191020RaITBp','cache_read_input_tokens','sessionCredits','2412193irYdHz','accountId','round','tdx','tdx\x20','push','100067Jegihz','current_usage','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','279CVwroB','session_id','\x20-\x20','250flKFil','log','💎\x20'];a12_0x53a2=function(){return _0x19cd62;};return a12_0x53a2();}import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x39a32e=0x64){return new Promise(_0x10d39e=>{const _0x8eea3=a12_0x490f;let _0x5b6dae='',_0x39afcd=![];const _0x4eec73=createInterface({'input':process['stdin'],'terminal':![]}),_0x4dce81=_0x44eef8=>{const _0x51590e=a12_0x490f;if(_0x39afcd)return;_0x39afcd=!![],clearTimeout(_0x18ac20),_0x4eec73[_0x51590e(0x11b)](),_0x10d39e(_0x44eef8);},_0x18ac20=setTimeout(()=>{_0x4dce81(null);},_0x39a32e);_0x4eec73['on'](_0x8eea3(0xff),_0x1c53f8=>{_0x5b6dae+=_0x1c53f8;}),_0x4eec73['on']('close',()=>{if(_0x39afcd)return;try{const _0x112671=JSON['parse'](_0x5b6dae);_0x4dce81(_0x112671);}catch{_0x4dce81(null);}});});}function formatCredits(_0x2025ee){const _0x5bb230=a12_0x490f;return _0x2025ee[_0x5bb230(0x101)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a12_0x216d1f(0x11e)]=a12_0x216d1f(0xf6);[a12_0x216d1f(0x102)]=a12_0x216d1f(0x111);async[a12_0x216d1f(0x11d)](_0x3a565a){const _0x2093eb=a12_0x216d1f;try{const _0x3a4738=await readStdinJson();if(!_0x3a4738?.[_0x2093eb(0x113)])return console[_0x2093eb(0x116)](_0x2093eb(0x119)),0x0;const _0x1c2482=_0x3a4738[_0x2093eb(0x113)],_0x5eea59=_0x3a4738[_0x2093eb(0xf3)]?.['id']||'',_0x5b16c2=_0x3a4738['profile']||_0x3a565a[_0x2093eb(0xf4)]['profile'],_0x40b957=await getUsageStats(_0x1c2482,_0x5b16c2),_0x48d8c7=[],_0x13eac1=readCachedAccountInfo(_0x5b16c2),_0x5add0b=_0x13eac1?_0x2093eb(0x10d)+_0x13eac1[_0x2093eb(0x103)]+':'+_0x13eac1[_0x2093eb(0x10a)]:_0x2093eb(0x10c),_0x1daae3=_0x5eea59?getModelDisplayName(_0x5eea59):_0x2093eb(0x104);_0x48d8c7[_0x2093eb(0x10e)](_0x2093eb(0x117)+_0x5add0b+_0x2093eb(0x114)+_0x1daae3);const _0x4eab13=formatCredits(_0x40b957[_0x2093eb(0x108)]),_0x2c6f25=formatCredits(_0x40b957[_0x2093eb(0xf9)]),_0x88b911=formatCredits(_0x40b957[_0x2093eb(0xfe)]);_0x48d8c7[_0x2093eb(0x10e)]('🪙\x20credit:\x20'+_0x4eab13+'\x20session\x20/\x20'+_0x2c6f25+_0x2093eb(0x105)+_0x88b911+'\x20month');const _0xfcfc4a=_0x3a4738[_0x2093eb(0x100)],_0x42ec8f=_0xfcfc4a?.[_0x2093eb(0x110)];if(_0x42ec8f&&_0xfcfc4a?.['used_percentage']!=null){const _0x3532e8=_0x42ec8f['input_tokens']+_0x42ec8f['cache_creation_input_tokens']+_0x42ec8f[_0x2093eb(0x107)],_0x35ce30=formatTokenCount(_0x3532e8),_0x399d6c=Math[_0x2093eb(0x10b)](_0xfcfc4a['used_percentage']);_0x48d8c7['push'](_0x2093eb(0x11c)+_0x35ce30+'\x20('+_0x399d6c+'%)');}return console[_0x2093eb(0x116)](_0x48d8c7[_0x2093eb(0xf8)](_0x2093eb(0xf5))),0x0;}catch{return console['log'](_0x2093eb(0x119)),0x0;}}}
@@ -1 +1 @@
1
- const a13_0xf863de=a13_0x4316;(function(_0x43f465,_0x3a8736){const _0x42bd70=a13_0x4316,_0x3201e7=_0x43f465();while(!![]){try{const _0x1f2c9a=parseInt(_0x42bd70(0x1df))/0x1+parseInt(_0x42bd70(0x1cb))/0x2*(parseInt(_0x42bd70(0x1d9))/0x3)+parseInt(_0x42bd70(0x1d0))/0x4+parseInt(_0x42bd70(0x1be))/0x5*(-parseInt(_0x42bd70(0x1cd))/0x6)+-parseInt(_0x42bd70(0x1ef))/0x7*(parseInt(_0x42bd70(0x1f3))/0x8)+parseInt(_0x42bd70(0x1ce))/0x9*(parseInt(_0x42bd70(0x1fa))/0xa)+-parseInt(_0x42bd70(0x1bb))/0xb*(parseInt(_0x42bd70(0x1c9))/0xc);if(_0x1f2c9a===_0x3a8736)break;else _0x3201e7['push'](_0x3201e7['shift']());}catch(_0x4de572){_0x3201e7['push'](_0x3201e7['shift']());}}}(a13_0x4d01,0xe6ab4));import a13_0x59c352 from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getAllSourceStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x3a6637){const _0x3a626d=a13_0x4316;return _0x3a6637[_0x3a626d(0x1f0)](0x2);}function formatLastUsed(_0x3c1699){const _0x1447d5=a13_0x4316;if(!_0x3c1699)return _0x1447d5(0x1ec);const _0x4371d6=new Date(_0x3c1699),_0x348ac9=new Date(),_0x4ce669=_0x4371d6[_0x1447d5(0x1bf)](_0x1447d5(0x1d1)),_0x430ee8=_0x348ac9[_0x1447d5(0x1bf)](_0x1447d5(0x1d1));if(_0x4ce669===_0x430ee8)return _0x1447d5(0x1e9)+_0x4371d6[_0x1447d5(0x1ca)]('en-US',{'hour':_0x1447d5(0x1bd),'minute':'2-digit'});const _0xd6dda9=new Date(_0x4ce669),_0x323190=new Date(_0x430ee8),_0x5122b4=Math['round']((_0x323190['getTime']()-_0xd6dda9[_0x1447d5(0x1ff)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x5122b4===0x1)return _0x1447d5(0x1c8);else return _0x5122b4>0x1&&_0x5122b4<0x7?_0x5122b4+_0x1447d5(0x1e4):_0x4371d6[_0x1447d5(0x1bf)](_0x1447d5(0x1e6),{'month':'short','day':_0x1447d5(0x1da)});}function a13_0x4316(_0x2775c1,_0x4a4ad3){_0x2775c1=_0x2775c1-0x1b8;const _0x4d0126=a13_0x4d01();let _0x4316eb=_0x4d0126[_0x2775c1];return _0x4316eb;}export class ClaudeUsageCommand extends BaseCommand{[a13_0xf863de(0x1d6)]=a13_0xf863de(0x1bc);['description']=a13_0xf863de(0x1fc);async[a13_0xf863de(0x1b9)](_0x189ed7){const _0x237a93=a13_0xf863de,{options:_0x596b5e}=_0x189ed7,_0x45d995=_0x596b5e[_0x237a93(0x1f1)]===_0x237a93(0x1cc)||_0x596b5e[_0x237a93(0x1f1)]===_0x237a93(0x1d2)||_0x596b5e[_0x237a93(0x1cc)];try{const [_0x4b89d8,_0x50fb04,_0x4bdc43]=await Promise['all']([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0x45d995?await this[_0x237a93(0x1e8)](_0x4b89d8,_0x50fb04,_0x4bdc43,_0x596b5e):this['outputTable'](_0x4b89d8,_0x50fb04,_0x4bdc43),0x0;}catch(_0x330b74){const _0x40e3c2=_0x330b74 instanceof Error?_0x330b74[_0x237a93(0x1d8)]:_0x237a93(0x1e0);return console[_0x237a93(0x1f2)](a13_0x59c352[_0x237a93(0x1c6)]('Error:\x20'+_0x40e3c2)),0x1;}}async[a13_0xf863de(0x1e8)](_0x1b0871,_0x2e0d44,_0x4a30cd,_0x4b1cf6){const _0x1881aa=a13_0xf863de,_0x319c22={'summary':{'todayCredits':_0x4a30cd['todayCredits'],'monthCredits':_0x4a30cd[_0x1881aa(0x1c0)],'totalCredits':_0x4a30cd[_0x1881aa(0x1f4)],'profileCount':_0x4a30cd[_0x1881aa(0x1e1)]},'profiles':_0x1b0871[_0x1881aa(0x1db)](_0x120410=>({'profile':_0x120410[_0x1881aa(0x1c3)],'credits':_0x120410[_0x1881aa(0x1d4)],'requests':_0x120410[_0x1881aa(0x1d5)],'lastUsedAt':_0x120410[_0x1881aa(0x1dd)]})),'sources':_0x2e0d44[_0x1881aa(0x1db)](_0x8138c6=>({'source':_0x8138c6[_0x1881aa(0x1c7)],'credits':_0x8138c6[_0x1881aa(0x1d4)],'todayCredits':_0x8138c6[_0x1881aa(0x1e5)],'monthCredits':_0x8138c6[_0x1881aa(0x1c0)],'requests':_0x8138c6['entryCount']}))};await handleSDKOutput([_0x319c22],_0x4b1cf6);}['outputTable'](_0x85072d,_0x59757e,_0x1e8b97){const _0x21f659=a13_0xf863de;console[_0x21f659(0x1cf)](a13_0x59c352[_0x21f659(0x1f5)]('\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary')),console[_0x21f659(0x1cf)](a13_0x59c352[_0x21f659(0x1f6)]('─'[_0x21f659(0x1fd)](0x32))),console['log'](_0x21f659(0x1d7)+a13_0x59c352[_0x21f659(0x1b8)](formatCredits(_0x1e8b97[_0x21f659(0x1e5)]))+_0x21f659(0x1f9)),console[_0x21f659(0x1cf)]('\x20\x20Month:\x20\x20\x20'+a13_0x59c352['cyan'](formatCredits(_0x1e8b97['monthCredits']))+'\x20credits'),console[_0x21f659(0x1cf)](_0x21f659(0x1ed)+a13_0x59c352[_0x21f659(0x1b8)](formatCredits(_0x1e8b97[_0x21f659(0x1f4)]))+_0x21f659(0x1f9)),console[_0x21f659(0x1cf)]();if(_0x59757e[_0x21f659(0x1e2)]>0x0){console[_0x21f659(0x1cf)](a13_0x59c352[_0x21f659(0x1f5)](_0x21f659(0x1de))),console['log'](a13_0x59c352[_0x21f659(0x1f6)]('─'[_0x21f659(0x1fd)](0x3c)));const _0x1087c5=0xc,_0x210533=0xa,_0x501833=0xa,_0xeb1254=0xa;console[_0x21f659(0x1cf)]('\x20\x20'+_0x21f659(0x1ea)[_0x21f659(0x1ee)](_0x1087c5)+'\x20\x20'+_0x21f659(0x1f7)[_0x21f659(0x1c4)](_0x210533)+'\x20\x20'+_0x21f659(0x1c1)[_0x21f659(0x1c4)](_0x501833)+'\x20\x20'+_0x21f659(0x1c2)[_0x21f659(0x1c4)](_0xeb1254));for(const _0x5a215f of _0x59757e){console[_0x21f659(0x1cf)]('\x20\x20'+_0x5a215f[_0x21f659(0x1c7)][_0x21f659(0x1ee)](_0x1087c5)+'\x20\x20'+a13_0x59c352[_0x21f659(0x1b8)](formatCredits(_0x5a215f[_0x21f659(0x1d4)])[_0x21f659(0x1c4)](_0x210533))+'\x20\x20'+formatCredits(_0x5a215f[_0x21f659(0x1e5)])['padStart'](_0x501833)+'\x20\x20'+formatCredits(_0x5a215f[_0x21f659(0x1c0)])[_0x21f659(0x1c4)](_0xeb1254));}console[_0x21f659(0x1cf)]();}if(_0x85072d[_0x21f659(0x1e2)]===0x0){console[_0x21f659(0x1cf)](a13_0x59c352['dim'](_0x21f659(0x1e3))),console[_0x21f659(0x1cf)](a13_0x59c352['dim']('\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a'));return;}console[_0x21f659(0x1cf)](a13_0x59c352['bold'](_0x21f659(0x1c5))),console[_0x21f659(0x1cf)](a13_0x59c352[_0x21f659(0x1f6)]('─'[_0x21f659(0x1fd)](0x3c)));const _0x1c90f6=Math[_0x21f659(0x1eb)](0xc,..._0x85072d[_0x21f659(0x1db)](_0x556a54=>_0x556a54[_0x21f659(0x1c3)]==='default'?_0x21f659(0x1fe)['length']:_0x556a54[_0x21f659(0x1c3)][_0x21f659(0x1e2)])),_0x210e51=0xa,_0x5b35bb=0xa;console['log']('\x20\x20'+_0x21f659(0x1fb)[_0x21f659(0x1ee)](_0x1c90f6)+'\x20\x20'+_0x21f659(0x1dc)[_0x21f659(0x1c4)](_0x210e51)+'\x20\x20'+_0x21f659(0x1d3)[_0x21f659(0x1c4)](_0x5b35bb)+'\x20\x20'+_0x21f659(0x1e7));for(const _0x20a367 of _0x85072d){const _0x498ef7=_0x20a367[_0x21f659(0x1c3)]===_0x21f659(0x1f8)?_0x21f659(0x1fe):_0x20a367[_0x21f659(0x1c3)],_0x2c4e4e=_0x498ef7['padEnd'](_0x1c90f6),_0x112a82=_0x20a367[_0x21f659(0x1c3)]===_0x21f659(0x1f8)?a13_0x59c352[_0x21f659(0x1f6)](_0x2c4e4e):_0x2c4e4e;console[_0x21f659(0x1cf)]('\x20\x20'+_0x112a82+'\x20\x20'+a13_0x59c352[_0x21f659(0x1b8)](formatCredits(_0x20a367['credits'])[_0x21f659(0x1c4)](_0x210e51))+'\x20\x20'+String(_0x20a367[_0x21f659(0x1d5)])['padStart'](_0x5b35bb)+'\x20\x20'+a13_0x59c352[_0x21f659(0x1f6)](formatLastUsed(_0x20a367[_0x21f659(0x1dd)])));}console[_0x21f659(0x1cf)](),console[_0x21f659(0x1cf)](a13_0x59c352[_0x21f659(0x1f6)](_0x21f659(0x1ba))),console[_0x21f659(0x1cf)]();}}function a13_0x4d01(){const _0xc9366d=['Usage\x20by\x20Profile','red','source','yesterday','18221484euOpmu','toLocaleTimeString','46IXVPzw','json','64578XzzpqP','3003498ZEexaQ','log','1730660iuDYQw','en-CA','jsonl','Requests','credits','entryCount','name','\x20\x20Today:\x20\x20\x20','message','115908mPeMmp','numeric','map','Credits','lastUsedAt','Usage\x20by\x20Source','1019467drvHbb','Unknown\x20error','profileCount','length','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','\x20days\x20ago','todayCredits','en-US','Last\x20Used','outputStructured','today\x20','Source','max','never','\x20\x20Total:\x20\x20\x20','padEnd','14NiQaUM','toFixed','format','error','3471544NJmuHy','totalCredits','bold','dim','Total','default','\x20credits','30JTAvgj','Profile','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','repeat','(default)','getTime','cyan','execute','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','11NNXOan','usage','2-digit','5AyuIEk','toLocaleDateString','monthCredits','Today','Month','profile','padStart'];a13_0x4d01=function(){return _0xc9366d;};return a13_0x4d01();}
1
+ function a13_0xd14e(){const _0xdf5191=['Profile','default','7117160SAgXVl','outputStructured','Credits','cyan','2646777HvBELh','repeat','message','format','toLocaleTimeString','2-digit','\x20\x20Month:\x20\x20\x20','entryCount','description','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','9wuouls','Usage\x20by\x20Profile','profileCount','lastUsedAt','en-US','112ccDVkJ','round','Total','todayCredits','toLocaleDateString','Error:\x20','totalCredits','length','Month','json','map','\x20\x20Today:\x20\x20\x20','(default)','Last\x20Used','short','918zsCTQW','3435544rIOpLm','en-CA','getTime','monthCredits','padEnd','toFixed','numeric','17201510lSfbPo','dim','credits','Usage\x20by\x20Source','source','6LbwQFS','Today','\x20credits','error','red','13479944YQCszF','max','bold','823347wzIQks','profile','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','padStart','log','execute','outputTable','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','Source','name','all'];a13_0xd14e=function(){return _0xdf5191;};return a13_0xd14e();}const a13_0x51c183=a13_0x5252;(function(_0x2c291b,_0x5b7a5a){const _0x179744=a13_0x5252,_0x34b554=_0x2c291b();while(!![]){try{const _0x3357de=parseInt(_0x179744(0x16b))/0x1+-parseInt(_0x179744(0x19b))/0x2+parseInt(_0x179744(0x19a))/0x3*(-parseInt(_0x179744(0x18b))/0x4)+parseInt(_0x179744(0x178))/0x5*(parseInt(_0x179744(0x163))/0x6)+parseInt(_0x179744(0x17c))/0x7+parseInt(_0x179744(0x168))/0x8*(parseInt(_0x179744(0x186))/0x9)+-parseInt(_0x179744(0x1a2))/0xa;if(_0x3357de===_0x5b7a5a)break;else _0x34b554['push'](_0x34b554['shift']());}catch(_0x2f6dc0){_0x34b554['push'](_0x34b554['shift']());}}}(a13_0xd14e,0xd2ca0));import a13_0x5f3ffc from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getAllSourceStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0xc6dff2){const _0x2cb2b3=a13_0x5252;return _0xc6dff2[_0x2cb2b3(0x1a0)](0x2);}function formatLastUsed(_0x5d9c61){const _0x54aa4c=a13_0x5252;if(!_0x5d9c61)return'never';const _0x3a913c=new Date(_0x5d9c61),_0x34435a=new Date(),_0x3b9318=_0x3a913c['toLocaleDateString'](_0x54aa4c(0x19c)),_0x3c198c=_0x34435a[_0x54aa4c(0x18f)]('en-CA');if(_0x3b9318===_0x3c198c)return'today\x20'+_0x3a913c[_0x54aa4c(0x180)](_0x54aa4c(0x18a),{'hour':_0x54aa4c(0x181),'minute':_0x54aa4c(0x181)});const _0x1e16c5=new Date(_0x3b9318),_0x4be040=new Date(_0x3c198c),_0x330b61=Math[_0x54aa4c(0x18c)]((_0x4be040[_0x54aa4c(0x19d)]()-_0x1e16c5['getTime']())/(0x18*0x3c*0x3c*0x3e8));if(_0x330b61===0x1)return'yesterday';else return _0x330b61>0x1&&_0x330b61<0x7?_0x330b61+'\x20days\x20ago':_0x3a913c[_0x54aa4c(0x18f)](_0x54aa4c(0x18a),{'month':_0x54aa4c(0x199),'day':_0x54aa4c(0x1a1)});}function a13_0x5252(_0x33ec16,_0x42ee41){_0x33ec16=_0x33ec16-0x163;const _0xd14e7e=a13_0xd14e();let _0x5252eb=_0xd14e7e[_0x33ec16];return _0x5252eb;}export class ClaudeUsageCommand extends BaseCommand{[a13_0x51c183(0x174)]='usage';[a13_0x51c183(0x184)]=a13_0x51c183(0x16d);async[a13_0x51c183(0x170)](_0x35bce0){const _0x5a09a7=a13_0x51c183,{options:_0x1acea6}=_0x35bce0,_0xe0074a=_0x1acea6[_0x5a09a7(0x17f)]==='json'||_0x1acea6[_0x5a09a7(0x17f)]==='jsonl'||_0x1acea6[_0x5a09a7(0x194)];try{const [_0x2ea623,_0x567c55,_0x419d6c]=await Promise[_0x5a09a7(0x175)]([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0xe0074a?await this[_0x5a09a7(0x179)](_0x2ea623,_0x567c55,_0x419d6c,_0x1acea6):this[_0x5a09a7(0x171)](_0x2ea623,_0x567c55,_0x419d6c),0x0;}catch(_0x4214e3){const _0x14e51a=_0x4214e3 instanceof Error?_0x4214e3[_0x5a09a7(0x17e)]:'Unknown\x20error';return console[_0x5a09a7(0x166)](a13_0x5f3ffc[_0x5a09a7(0x167)](_0x5a09a7(0x190)+_0x14e51a)),0x1;}}async[a13_0x51c183(0x179)](_0x1a1c99,_0x493b99,_0x1ba6de,_0x4615b5){const _0x291fdf=a13_0x51c183,_0x3fbb0d={'summary':{'todayCredits':_0x1ba6de[_0x291fdf(0x18e)],'monthCredits':_0x1ba6de[_0x291fdf(0x19e)],'totalCredits':_0x1ba6de[_0x291fdf(0x191)],'profileCount':_0x1ba6de[_0x291fdf(0x188)]},'profiles':_0x1a1c99[_0x291fdf(0x195)](_0xacbea4=>({'profile':_0xacbea4['profile'],'credits':_0xacbea4[_0x291fdf(0x1a4)],'requests':_0xacbea4[_0x291fdf(0x183)],'lastUsedAt':_0xacbea4[_0x291fdf(0x189)]})),'sources':_0x493b99[_0x291fdf(0x195)](_0x285178=>({'source':_0x285178[_0x291fdf(0x1a6)],'credits':_0x285178['credits'],'todayCredits':_0x285178[_0x291fdf(0x18e)],'monthCredits':_0x285178['monthCredits'],'requests':_0x285178['entryCount']}))};await handleSDKOutput([_0x3fbb0d],_0x4615b5);}[a13_0x51c183(0x171)](_0x1657c7,_0xa5e7e4,_0x2406ee){const _0xf92f79=a13_0x51c183;console['log'](a13_0x5f3ffc[_0xf92f79(0x16a)](_0xf92f79(0x185))),console[_0xf92f79(0x16f)](a13_0x5f3ffc[_0xf92f79(0x1a3)]('─'[_0xf92f79(0x17d)](0x32))),console[_0xf92f79(0x16f)](_0xf92f79(0x196)+a13_0x5f3ffc[_0xf92f79(0x17b)](formatCredits(_0x2406ee['todayCredits']))+'\x20credits'),console[_0xf92f79(0x16f)](_0xf92f79(0x182)+a13_0x5f3ffc[_0xf92f79(0x17b)](formatCredits(_0x2406ee[_0xf92f79(0x19e)]))+'\x20credits'),console['log']('\x20\x20Total:\x20\x20\x20'+a13_0x5f3ffc[_0xf92f79(0x17b)](formatCredits(_0x2406ee[_0xf92f79(0x191)]))+_0xf92f79(0x165)),console[_0xf92f79(0x16f)]();if(_0xa5e7e4[_0xf92f79(0x192)]>0x0){console[_0xf92f79(0x16f)](a13_0x5f3ffc[_0xf92f79(0x16a)](_0xf92f79(0x1a5))),console[_0xf92f79(0x16f)](a13_0x5f3ffc['dim']('─'[_0xf92f79(0x17d)](0x3c)));const _0x34271e=0xc,_0x5757a9=0xa,_0x5d4d25=0xa,_0x5cf1da=0xa;console[_0xf92f79(0x16f)]('\x20\x20'+_0xf92f79(0x173)[_0xf92f79(0x19f)](_0x34271e)+'\x20\x20'+_0xf92f79(0x18d)[_0xf92f79(0x16e)](_0x5757a9)+'\x20\x20'+_0xf92f79(0x164)[_0xf92f79(0x16e)](_0x5d4d25)+'\x20\x20'+_0xf92f79(0x193)[_0xf92f79(0x16e)](_0x5cf1da));for(const _0x5e5854 of _0xa5e7e4){console['log']('\x20\x20'+_0x5e5854['source'][_0xf92f79(0x19f)](_0x34271e)+'\x20\x20'+a13_0x5f3ffc[_0xf92f79(0x17b)](formatCredits(_0x5e5854[_0xf92f79(0x1a4)])[_0xf92f79(0x16e)](_0x5757a9))+'\x20\x20'+formatCredits(_0x5e5854['todayCredits'])[_0xf92f79(0x16e)](_0x5d4d25)+'\x20\x20'+formatCredits(_0x5e5854[_0xf92f79(0x19e)])[_0xf92f79(0x16e)](_0x5cf1da));}console[_0xf92f79(0x16f)]();}if(_0x1657c7['length']===0x0){console[_0xf92f79(0x16f)](a13_0x5f3ffc[_0xf92f79(0x1a3)]('\x20\x20No\x20usage\x20data\x20recorded\x20yet.')),console['log'](a13_0x5f3ffc[_0xf92f79(0x1a3)](_0xf92f79(0x172)));return;}console[_0xf92f79(0x16f)](a13_0x5f3ffc[_0xf92f79(0x16a)](_0xf92f79(0x187))),console['log'](a13_0x5f3ffc[_0xf92f79(0x1a3)]('─'['repeat'](0x3c)));const _0x441da6=Math[_0xf92f79(0x169)](0xc,..._0x1657c7[_0xf92f79(0x195)](_0x3080f4=>_0x3080f4['profile']===_0xf92f79(0x177)?'(default)'[_0xf92f79(0x192)]:_0x3080f4['profile'][_0xf92f79(0x192)])),_0x3df8a2=0xa,_0xe3805b=0xa;console[_0xf92f79(0x16f)]('\x20\x20'+_0xf92f79(0x176)['padEnd'](_0x441da6)+'\x20\x20'+_0xf92f79(0x17a)[_0xf92f79(0x16e)](_0x3df8a2)+'\x20\x20'+'Requests'[_0xf92f79(0x16e)](_0xe3805b)+'\x20\x20'+_0xf92f79(0x198));for(const _0x55fa24 of _0x1657c7){const _0x3859da=_0x55fa24[_0xf92f79(0x16c)]===_0xf92f79(0x177)?_0xf92f79(0x197):_0x55fa24[_0xf92f79(0x16c)],_0x16b4dd=_0x3859da[_0xf92f79(0x19f)](_0x441da6),_0x46f719=_0x55fa24[_0xf92f79(0x16c)]===_0xf92f79(0x177)?a13_0x5f3ffc[_0xf92f79(0x1a3)](_0x16b4dd):_0x16b4dd;console['log']('\x20\x20'+_0x46f719+'\x20\x20'+a13_0x5f3ffc[_0xf92f79(0x17b)](formatCredits(_0x55fa24[_0xf92f79(0x1a4)])[_0xf92f79(0x16e)](_0x3df8a2))+'\x20\x20'+String(_0x55fa24['entryCount'])[_0xf92f79(0x16e)](_0xe3805b)+'\x20\x20'+a13_0x5f3ffc[_0xf92f79(0x1a3)](formatLastUsed(_0x55fa24['lastUsedAt'])));}console[_0xf92f79(0x16f)](),console[_0xf92f79(0x16f)](a13_0x5f3ffc[_0xf92f79(0x1a3)]('Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.')),console['log']();}}
@@ -1 +1 @@
1
- const a14_0x2b3c9d=a14_0xdbf5;function a14_0x2c3c(){const _0x311661=['106561VxPjpk','limit','execute','helpText','run','stack','63KDnEaq','6dcbCga','set','from','options','.\x20Must\x20be\x20a\x20number.','3MXpviy','has','dim','Error:\x20','isValid','error','Reason:\x20','USER_ERROR','To\x20set\x20up\x20authentication:','debug','red','values','get','validateGlobalOptions','970690ZeEmZD','\x27\x20is\x20already\x20registered','12001726nZjFhx','35264uzyECi','command','To\x20check\x20your\x20current\x20auth\x20status:','message','value','\x20--profile\x20','1062988tClUHm','Authentication\x20error\x20stack\x20trace:','problemDetails','register','commands','test','detail','tdx\x20auth\x20setup','cyan','247662CobeNn','name','60itpwRL','Command\x20\x27','validate','702046cjZjqJ'];a14_0x2c3c=function(){return _0x311661;};return a14_0x2c3c();}(function(_0x4b4839,_0x57cf0c){const _0x597405=a14_0xdbf5,_0x37769c=_0x4b4839();while(!![]){try{const _0x21e195=parseInt(_0x597405(0x19a))/0x1+-parseInt(_0x597405(0x199))/0x2*(parseInt(_0x597405(0x1a6))/0x3)+-parseInt(_0x597405(0x1bd))/0x4+parseInt(_0x597405(0x1b4))/0x5*(-parseInt(_0x597405(0x1a1))/0x6)+parseInt(_0x597405(0x1a0))/0x7*(-parseInt(_0x597405(0x1b7))/0x8)+parseInt(_0x597405(0x194))/0x9*(-parseInt(_0x597405(0x196))/0xa)+parseInt(_0x597405(0x1b6))/0xb;if(_0x21e195===_0x57cf0c)break;else _0x37769c['push'](_0x37769c['shift']());}catch(_0x56507d){_0x37769c['push'](_0x37769c['shift']());}}}(a14_0x2c3c,0x2c6b3));import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory}from'../sdk/errors.js';import{Logger}from'../utils/logger/index.js';import a14_0x4a5ed9 from'chalk';export function printAuthError(_0x23f7aa,_0x329f18=![],_0x50f503){const _0x29f346=a14_0xdbf5,_0x240697=_0x23f7aa[_0x29f346(0x1bf)]?.[_0x29f346(0x191)]||_0x23f7aa[_0x29f346(0x1ba)];console['error'](a14_0x4a5ed9[_0x29f346(0x1b0)]('Authentication\x20failed')),console['error'](a14_0x4a5ed9['red'](_0x29f346(0x1ac)+_0x240697));if(_0x329f18){const _0x3f2f93=_0x50f503?_0x29f346(0x1bc)+_0x50f503:'';console['error']('\x0a'+a14_0x4a5ed9['dim'](_0x29f346(0x1ae))),console[_0x29f346(0x1ab)]('\x20\x20'+a14_0x4a5ed9[_0x29f346(0x193)](_0x29f346(0x192)+_0x3f2f93)+'\x0a'),console[_0x29f346(0x1ab)](''+a14_0x4a5ed9[_0x29f346(0x1a8)](_0x29f346(0x1b9))),console[_0x29f346(0x1ab)]('\x20\x20'+a14_0x4a5ed9[_0x29f346(0x193)]('tdx\x20auth'+_0x3f2f93));}}function a14_0xdbf5(_0x3772ab,_0x323c0c){_0x3772ab=_0x3772ab-0x190;const _0x2c3cf8=a14_0x2c3c();let _0xdbf51b=_0x2c3cf8[_0x3772ab];return _0xdbf51b;}export class BaseCommand{[a14_0x2b3c9d(0x1b3)](_0xad10a9){const _0x55425d=a14_0x2b3c9d,{options:_0x106aa9}=_0xad10a9,_0x5476b3=_0x106aa9[_0x55425d(0x19b)];if(_0x5476b3!==undefined){const _0x935ee3=typeof _0x5476b3==='number'?_0x5476b3:parseInt(_0x5476b3,0xa);if(isNaN(_0x935ee3))return'Invalid\x20limit\x20value:\x20'+_0x5476b3+_0x55425d(0x1a5);const _0x13db8c=validateLimitOption(_0x935ee3);if(!_0x13db8c[_0x55425d(0x1aa)])return _0x13db8c['error'];_0xad10a9[_0x55425d(0x1a4)]['limit']=_0x13db8c[_0x55425d(0x1bb)];}return undefined;}['validate'](_0x397efd){return undefined;}async[a14_0x2b3c9d(0x19e)](_0x36f8e5){const _0xf6a779=a14_0x2b3c9d;try{const _0x92942a=this[_0xf6a779(0x1b3)](_0x36f8e5);if(_0x92942a)return console[_0xf6a779(0x1ab)](_0xf6a779(0x1a9)+_0x92942a),0x1;const _0x3e6fa5=this[_0xf6a779(0x198)](_0x36f8e5);if(_0x3e6fa5){const _0x383802=/^\s*(Usage|Note|Warning|Error):/i[_0xf6a779(0x190)](_0x3e6fa5);return _0x383802?console[_0xf6a779(0x1ab)](_0x3e6fa5):console[_0xf6a779(0x1ab)](_0xf6a779(0x1a9)+_0x3e6fa5),0x1;}const _0x1c3ff0=await this[_0xf6a779(0x19c)](_0x36f8e5);return _0x1c3ff0??0x0;}catch(_0x166561){if(_0x166561 instanceof Error){if(_0x166561 instanceof HTTPClientError&&_0x166561['status']===0x191){const _0x3b33e6=_0x36f8e5[_0xf6a779(0x1a4)]['profile'];printAuthError(_0x166561,!![],_0x3b33e6);if(_0x166561[_0xf6a779(0x19f)]){const _0x579870=Logger['of'](_0xf6a779(0x1b8));_0x579870['debug'](_0xf6a779(0x1be)),_0x579870[_0xf6a779(0x1af)](_0x166561[_0xf6a779(0x19f)]);}return 0x1;}console[_0xf6a779(0x1ab)](a14_0x4a5ed9['red'](_0xf6a779(0x1a9)+_0x166561[_0xf6a779(0x1ba)]));_0x166561 instanceof SDKError&&_0x166561[_0xf6a779(0x19d)]&&console[_0xf6a779(0x1ab)](a14_0x4a5ed9['yellow'](_0x166561[_0xf6a779(0x19d)]));const _0x2207cb=_0x166561 instanceof SDKError&&_0x166561['category']===ErrorCategory[_0xf6a779(0x1ad)];_0x166561[_0xf6a779(0x19f)]&&!_0x2207cb&&console['error']('\x0aStack\x20trace:\x0a'+_0x166561[_0xf6a779(0x19f)]);}else console[_0xf6a779(0x1ab)](_0xf6a779(0x1a9)+String(_0x166561));return 0x1;}}}export class CommandRegistry{[a14_0x2b3c9d(0x1c1)]=new Map();[a14_0x2b3c9d(0x1c0)](_0x2e42dd){const _0x4e2692=a14_0x2b3c9d;if(this[_0x4e2692(0x1c1)][_0x4e2692(0x1a7)](_0x2e42dd[_0x4e2692(0x195)]))throw new Error(_0x4e2692(0x197)+_0x2e42dd[_0x4e2692(0x195)]+_0x4e2692(0x1b5));this[_0x4e2692(0x1c1)][_0x4e2692(0x1a2)](_0x2e42dd[_0x4e2692(0x195)],_0x2e42dd);}[a14_0x2b3c9d(0x1b2)](_0x4aaaac){const _0x196250=a14_0x2b3c9d;return this[_0x196250(0x1c1)][_0x196250(0x1b2)](_0x4aaaac);}['getAll'](){const _0x200ea7=a14_0x2b3c9d;return Array[_0x200ea7(0x1a3)](this['commands'][_0x200ea7(0x1b1)]());}['has'](_0xe3b09d){const _0x4addf5=a14_0x2b3c9d;return this[_0x4addf5(0x1c1)][_0x4addf5(0x1a7)](_0xe3b09d);}}export const registry=new CommandRegistry();
1
+ const a14_0x1c3f82=a14_0x151b;(function(_0x4ff9c6,_0x58724a){const _0x471f8d=a14_0x151b,_0x765518=_0x4ff9c6();while(!![]){try{const _0x3aba27=-parseInt(_0x471f8d(0x1fb))/0x1+-parseInt(_0x471f8d(0x205))/0x2*(-parseInt(_0x471f8d(0x1db))/0x3)+parseInt(_0x471f8d(0x208))/0x4*(-parseInt(_0x471f8d(0x206))/0x5)+-parseInt(_0x471f8d(0x1e3))/0x6+parseInt(_0x471f8d(0x1fd))/0x7+-parseInt(_0x471f8d(0x1d8))/0x8*(-parseInt(_0x471f8d(0x1f4))/0x9)+parseInt(_0x471f8d(0x1f3))/0xa;if(_0x3aba27===_0x58724a)break;else _0x765518['push'](_0x765518['shift']());}catch(_0x3601d8){_0x765518['push'](_0x765518['shift']());}}}(a14_0x4596,0xe44e4));import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory}from'../sdk/errors.js';import{Logger}from'../utils/logger/index.js';function a14_0x151b(_0x375595,_0x520214){_0x375595=_0x375595-0x1d6;const _0x4596f2=a14_0x4596();let _0x151b8c=_0x4596f2[_0x375595];return _0x151b8c;}function a14_0x4596(){const _0x58a34b=['has','tdx\x20auth','value','dim','cyan','USER_ERROR','profile','message','red','name','yellow','Reason:\x20','1709000qAIRGm','18iqwVbD','options','validate','command','status','Authentication\x20failed','execute','499085xfyFwy','stack','6067621sVySXw','isValid','helpText','number','error','To\x20check\x20your\x20current\x20auth\x20status:','problemDetails','commands','2wPOIJx','5025535PclWIl','from','4zHzoho','\x0aStack\x20trace:\x0a','category','6863664zZjady','tdx\x20auth\x20setup','validateGlobalOptions','3587289jEqEKm','set','values','\x20--profile\x20','Authentication\x20error\x20stack\x20trace:','Invalid\x20limit\x20value:\x20','debug','get','9060300ikYnVh','test','Error:\x20','getAll'];a14_0x4596=function(){return _0x58a34b;};return a14_0x4596();}import a14_0x2d3231 from'chalk';export function printAuthError(_0x29476b,_0x2d6207=![],_0x26b539){const _0x3f1d93=a14_0x151b,_0x1c9d07=_0x29476b[_0x3f1d93(0x203)]?.['detail']||_0x29476b[_0x3f1d93(0x1ee)];console[_0x3f1d93(0x201)](a14_0x2d3231[_0x3f1d93(0x1ef)](_0x3f1d93(0x1f9))),console[_0x3f1d93(0x201)](a14_0x2d3231[_0x3f1d93(0x1ef)](_0x3f1d93(0x1f2)+_0x1c9d07));if(_0x2d6207){const _0x34dc3f=_0x26b539?_0x3f1d93(0x1de)+_0x26b539:'';console[_0x3f1d93(0x201)]('\x0a'+a14_0x2d3231[_0x3f1d93(0x1ea)]('To\x20set\x20up\x20authentication:')),console['error']('\x20\x20'+a14_0x2d3231['cyan'](_0x3f1d93(0x1d9)+_0x34dc3f)+'\x0a'),console['error'](''+a14_0x2d3231[_0x3f1d93(0x1ea)](_0x3f1d93(0x202))),console['error']('\x20\x20'+a14_0x2d3231[_0x3f1d93(0x1eb)](_0x3f1d93(0x1e8)+_0x34dc3f));}}export class BaseCommand{['validateGlobalOptions'](_0x286dc5){const _0x51e016=a14_0x151b,{options:_0x51c199}=_0x286dc5,_0x15effb=_0x51c199['limit'];if(_0x15effb!==undefined){const _0xa0d1f2=typeof _0x15effb===_0x51e016(0x200)?_0x15effb:parseInt(_0x15effb,0xa);if(isNaN(_0xa0d1f2))return _0x51e016(0x1e0)+_0x15effb+'.\x20Must\x20be\x20a\x20number.';const _0x414aff=validateLimitOption(_0xa0d1f2);if(!_0x414aff[_0x51e016(0x1fe)])return _0x414aff[_0x51e016(0x201)];_0x286dc5[_0x51e016(0x1f5)]['limit']=_0x414aff[_0x51e016(0x1e9)];}return undefined;}[a14_0x1c3f82(0x1f6)](_0x53ceb2){return undefined;}async['run'](_0x272460){const _0x21a598=a14_0x1c3f82;try{const _0xdbb94f=this[_0x21a598(0x1da)](_0x272460);if(_0xdbb94f)return console[_0x21a598(0x201)](_0x21a598(0x1e5)+_0xdbb94f),0x1;const _0x3478c9=this[_0x21a598(0x1f6)](_0x272460);if(_0x3478c9){const _0x512b12=/^\s*(Usage|Note|Warning|Error):/i[_0x21a598(0x1e4)](_0x3478c9);return _0x512b12?console['error'](_0x3478c9):console[_0x21a598(0x201)](_0x21a598(0x1e5)+_0x3478c9),0x1;}const _0x540cd6=await this[_0x21a598(0x1fa)](_0x272460);return _0x540cd6??0x0;}catch(_0x2ee4dc){if(_0x2ee4dc instanceof Error){if(_0x2ee4dc instanceof HTTPClientError&&_0x2ee4dc[_0x21a598(0x1f8)]===0x191){const _0x38eaaf=_0x272460[_0x21a598(0x1f5)][_0x21a598(0x1ed)];printAuthError(_0x2ee4dc,!![],_0x38eaaf);if(_0x2ee4dc[_0x21a598(0x1fc)]){const _0x46d724=Logger['of'](_0x21a598(0x1f7));_0x46d724[_0x21a598(0x1e1)](_0x21a598(0x1df)),_0x46d724[_0x21a598(0x1e1)](_0x2ee4dc[_0x21a598(0x1fc)]);}return 0x1;}console[_0x21a598(0x201)](a14_0x2d3231[_0x21a598(0x1ef)](_0x21a598(0x1e5)+_0x2ee4dc[_0x21a598(0x1ee)]));_0x2ee4dc instanceof SDKError&&_0x2ee4dc[_0x21a598(0x1ff)]&&console[_0x21a598(0x201)](a14_0x2d3231[_0x21a598(0x1f1)](_0x2ee4dc['helpText']));const _0x411649=_0x2ee4dc instanceof SDKError&&_0x2ee4dc[_0x21a598(0x1d7)]===ErrorCategory[_0x21a598(0x1ec)];_0x2ee4dc[_0x21a598(0x1fc)]&&!_0x411649&&console['error'](_0x21a598(0x1d6)+_0x2ee4dc[_0x21a598(0x1fc)]);}else console[_0x21a598(0x201)](_0x21a598(0x1e5)+String(_0x2ee4dc));return 0x1;}}}export class CommandRegistry{['commands']=new Map();['register'](_0xb2374a){const _0x2777fe=a14_0x1c3f82;if(this[_0x2777fe(0x204)]['has'](_0xb2374a[_0x2777fe(0x1f0)]))throw new Error('Command\x20\x27'+_0xb2374a[_0x2777fe(0x1f0)]+'\x27\x20is\x20already\x20registered');this[_0x2777fe(0x204)][_0x2777fe(0x1dc)](_0xb2374a['name'],_0xb2374a);}[a14_0x1c3f82(0x1e2)](_0xbcfeec){const _0x316d9c=a14_0x1c3f82;return this['commands'][_0x316d9c(0x1e2)](_0xbcfeec);}[a14_0x1c3f82(0x1e6)](){const _0x4db15a=a14_0x1c3f82;return Array[_0x4db15a(0x207)](this[_0x4db15a(0x204)][_0x4db15a(0x1dd)]());}[a14_0x1c3f82(0x1e7)](_0x5923db){const _0x363c24=a14_0x1c3f82;return this['commands'][_0x363c24(0x1e7)](_0x5923db);}}export const registry=new CommandRegistry();