@treasuredata/tdx 2026.8.3 → 2026.8.4

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 (285) 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.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-campaign-pull-command.js +1 -1
  27. package/dist/commands/engage-campaign-push-command.js +1 -1
  28. package/dist/commands/engage-campaign-validate-command.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/engage-template-pull-command.js +1 -1
  31. package/dist/commands/engage-template-push-command.js +1 -1
  32. package/dist/commands/engage-template-validate-command.js +1 -1
  33. package/dist/commands/job-command.js +1 -1
  34. package/dist/commands/journey-command.js +1 -1
  35. package/dist/commands/journey-validate-command.js +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/mcp-command.js +1 -1
  38. package/dist/commands/p13n-command.d.ts +11 -0
  39. package/dist/commands/p13n-command.d.ts.map +1 -0
  40. package/dist/commands/p13n-command.js +1 -0
  41. package/dist/commands/p13n-command.js.map +1 -0
  42. package/dist/commands/parent-segment-command.js +1 -1
  43. package/dist/commands/policy-command.js +1 -1
  44. package/dist/commands/profile-command.js +1 -1
  45. package/dist/commands/profiles-command.js +1 -1
  46. package/dist/commands/query-command.js +1 -1
  47. package/dist/commands/schedule-command.js +1 -1
  48. package/dist/commands/segment-command.js +1 -1
  49. package/dist/commands/segment-create-command.js +1 -1
  50. package/dist/commands/segment-fields-command.js +1 -1
  51. package/dist/commands/segment-move-command.js +1 -1
  52. package/dist/commands/segment-pull-command.js +1 -1
  53. package/dist/commands/segment-push-command.js +1 -1
  54. package/dist/commands/segment-update-command.js +1 -1
  55. package/dist/commands/segment-use-command.js +1 -1
  56. package/dist/commands/segment-validate-command.js +1 -1
  57. package/dist/commands/segments.js +1 -1
  58. package/dist/commands/show.js +1 -1
  59. package/dist/commands/status-command.js +1 -1
  60. package/dist/commands/table-deleted.js +1 -1
  61. package/dist/commands/tables.js +1 -1
  62. package/dist/commands/unset-command.js +1 -1
  63. package/dist/commands/upgrade-command.js +1 -1
  64. package/dist/commands/use-command.js +1 -1
  65. package/dist/commands/user-command.js +1 -1
  66. package/dist/commands/work-command.js +1 -1
  67. package/dist/commands/workflow-command.js +1 -1
  68. package/dist/core/auth.js +1 -1
  69. package/dist/core/command-output.js +1 -1
  70. package/dist/core/config.js +1 -1
  71. package/dist/core/connection-cache.js +1 -1
  72. package/dist/core/constants.js +1 -1
  73. package/dist/core/credential-cache.js +1 -1
  74. package/dist/core/global-context.d.ts.map +1 -1
  75. package/dist/core/global-context.js +1 -1
  76. package/dist/core/global-context.js.map +1 -1
  77. package/dist/core/keychain.js +1 -1
  78. package/dist/core/oauth-keychain.js +1 -1
  79. package/dist/core/oauth.d.ts +9 -1
  80. package/dist/core/oauth.d.ts.map +1 -1
  81. package/dist/core/oauth.js +1 -1
  82. package/dist/core/oauth.js.map +1 -1
  83. package/dist/core/profile.js +1 -1
  84. package/dist/core/project-config.js +1 -1
  85. package/dist/core/session.js +1 -1
  86. package/dist/core/site-mismatch.js +1 -1
  87. package/dist/core/user-cache.js +1 -1
  88. package/dist/core/version.js +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/mcp/server.js +1 -1
  91. package/dist/mcp/tools/index.js +1 -1
  92. package/dist/mcp/tools/tdx-run.js +1 -1
  93. package/dist/mcp/tools/tdx-search.js +1 -1
  94. package/dist/mcp/tools/work-create-item.js +1 -1
  95. package/dist/mcp/utils.js +1 -1
  96. package/dist/proxy/claude-usage-tracker.js +1 -1
  97. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  98. package/dist/proxy/passthrough-server.js +1 -1
  99. package/dist/proxy/passthrough-server.js.map +1 -1
  100. package/dist/proxy/sse-usage-parser.js +1 -1
  101. package/dist/sdk/agent/agent-config.js +1 -1
  102. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  103. package/dist/sdk/agent/agent-yaml.js +1 -1
  104. package/dist/sdk/agent/test/evaluator.js +1 -1
  105. package/dist/sdk/agent/test/executor.js +1 -1
  106. package/dist/sdk/agent/test/index.js +1 -1
  107. package/dist/sdk/agent/test/output.js +1 -1
  108. package/dist/sdk/agent/test/parser.js +1 -1
  109. package/dist/sdk/agent/tool-target-registry.js +1 -1
  110. package/dist/sdk/api.js +1 -1
  111. package/dist/sdk/auth-token.d.ts +42 -6
  112. package/dist/sdk/auth-token.d.ts.map +1 -1
  113. package/dist/sdk/auth-token.js +1 -1
  114. package/dist/sdk/auth-token.js.map +1 -1
  115. package/dist/sdk/cas/cas-api-client.js +1 -1
  116. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  117. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  118. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  119. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  120. package/dist/sdk/cas/index.js +1 -1
  121. package/dist/sdk/cas/pull-workflow.js +1 -1
  122. package/dist/sdk/cas/push-workflow.js +1 -1
  123. package/dist/sdk/cas/validate-files.js +1 -1
  124. package/dist/sdk/client/cdp-api-client.js +1 -1
  125. package/dist/sdk/client/delivery-api-client.js +1 -1
  126. package/dist/sdk/client/endpoints.d.ts +6 -0
  127. package/dist/sdk/client/endpoints.d.ts.map +1 -1
  128. package/dist/sdk/client/endpoints.js +1 -1
  129. package/dist/sdk/client/endpoints.js.map +1 -1
  130. package/dist/sdk/client/engage-api-client.js +1 -1
  131. package/dist/sdk/client/http-client.js +1 -1
  132. package/dist/sdk/client/llm-api-client.js +1 -1
  133. package/dist/sdk/client/oauth-refresh.d.ts +11 -2
  134. package/dist/sdk/client/oauth-refresh.d.ts.map +1 -1
  135. package/dist/sdk/client/oauth-refresh.js +1 -1
  136. package/dist/sdk/client/oauth-refresh.js.map +1 -1
  137. package/dist/sdk/client/p13n-studio-api-client.d.ts +19 -0
  138. package/dist/sdk/client/p13n-studio-api-client.d.ts.map +1 -0
  139. package/dist/sdk/client/p13n-studio-api-client.js +1 -0
  140. package/dist/sdk/client/p13n-studio-api-client.js.map +1 -0
  141. package/dist/sdk/client/rate-limiter.js +1 -1
  142. package/dist/sdk/client/td-api-client.js +1 -1
  143. package/dist/sdk/client/trino-api-client.js +1 -1
  144. package/dist/sdk/client/workflow-client.js +1 -1
  145. package/dist/sdk/connection-validator.js +1 -1
  146. package/dist/sdk/connection.js +1 -1
  147. package/dist/sdk/delivery.js +1 -1
  148. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  149. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  150. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  151. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  152. package/dist/sdk/engage/campaign-pull.js +1 -1
  153. package/dist/sdk/engage/campaign-push.js +1 -1
  154. package/dist/sdk/engage/campaign-validator.js +1 -1
  155. package/dist/sdk/engage/campaign-yaml.js +1 -1
  156. package/dist/sdk/engage/template-pull.js +1 -1
  157. package/dist/sdk/engage/template-push.js +1 -1
  158. package/dist/sdk/engage/template-validator.js +1 -1
  159. package/dist/sdk/engage/template-yaml.js +1 -1
  160. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  161. package/dist/sdk/engage/types/campaign-def.js +1 -1
  162. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  163. package/dist/sdk/engage/types/template-schema.js +1 -1
  164. package/dist/sdk/engage.js +1 -1
  165. package/dist/sdk/errors.js +1 -1
  166. package/dist/sdk/index.d.ts +6 -0
  167. package/dist/sdk/index.d.ts.map +1 -1
  168. package/dist/sdk/index.js +1 -1
  169. package/dist/sdk/index.js.map +1 -1
  170. package/dist/sdk/io/index.js +1 -1
  171. package/dist/sdk/io/node-filesystem.js +1 -1
  172. package/dist/sdk/job.js +1 -1
  173. package/dist/sdk/journey.js +1 -1
  174. package/dist/sdk/llm/chat-cache.js +1 -1
  175. package/dist/sdk/llm/index.js +1 -1
  176. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  177. package/dist/sdk/llm/model-factors.js +1 -1
  178. package/dist/sdk/llm/user-settings.js +1 -1
  179. package/dist/sdk/p13n-studio.d.ts +13 -0
  180. package/dist/sdk/p13n-studio.d.ts.map +1 -0
  181. package/dist/sdk/p13n-studio.js +1 -0
  182. package/dist/sdk/p13n-studio.js.map +1 -0
  183. package/dist/sdk/personalization.js +1 -1
  184. package/dist/sdk/policy.js +1 -1
  185. package/dist/sdk/query/deleted-table-validation.js +1 -1
  186. package/dist/sdk/query/index.js +1 -1
  187. package/dist/sdk/query/sql-parser.js +1 -1
  188. package/dist/sdk/realtime.js +1 -1
  189. package/dist/sdk/schedule.js +1 -1
  190. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  191. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  192. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  193. package/dist/sdk/segment/fields-display.js +1 -1
  194. package/dist/sdk/segment/file-discovery.js +1 -1
  195. package/dist/sdk/segment/journey-utils.js +1 -1
  196. package/dist/sdk/segment/journey-validator.js +1 -1
  197. package/dist/sdk/segment/journey-yaml.js +1 -1
  198. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  199. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  200. package/dist/sdk/segment/pull-workflow.js +1 -1
  201. package/dist/sdk/segment/push-recovery.js +1 -1
  202. package/dist/sdk/segment/push-workflow.js +1 -1
  203. package/dist/sdk/segment/resolution-context.js +1 -1
  204. package/dist/sdk/segment/segment-path-parser.js +1 -1
  205. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  206. package/dist/sdk/segment/segment-validator.js +1 -1
  207. package/dist/sdk/segment/target-resolution.js +1 -1
  208. package/dist/sdk/segment/tdx-config.js +1 -1
  209. package/dist/sdk/segment/types/activation-schema.js +1 -1
  210. package/dist/sdk/segment/types/journey-def.js +1 -1
  211. package/dist/sdk/segment/types/journey-schema.js +1 -1
  212. package/dist/sdk/segment/types/segment-def.js +1 -1
  213. package/dist/sdk/segment/types/segment-schema.d.ts.map +1 -1
  214. package/dist/sdk/segment/types/segment-schema.js +1 -1
  215. package/dist/sdk/segment/types/segment-schema.js.map +1 -1
  216. package/dist/sdk/segment/validate-files.js +1 -1
  217. package/dist/sdk/segment/yaml-validator.js +1 -1
  218. package/dist/sdk/segment.js +1 -1
  219. package/dist/sdk/types/index.d.ts +2 -1
  220. package/dist/sdk/types/index.d.ts.map +1 -1
  221. package/dist/sdk/types/index.js +1 -1
  222. package/dist/sdk/types/index.js.map +1 -1
  223. package/dist/sdk/types/p13n-studio.d.ts +18 -0
  224. package/dist/sdk/types/p13n-studio.d.ts.map +1 -0
  225. package/dist/sdk/types/p13n-studio.js +1 -0
  226. package/dist/sdk/types/p13n-studio.js.map +1 -0
  227. package/dist/sdk/types/progress.js +1 -1
  228. package/dist/sdk/types/workspace.js +1 -1
  229. package/dist/sdk/user.js +1 -1
  230. package/dist/sdk/util/format-detector.js +1 -1
  231. package/dist/sdk/util/formatters.js +1 -1
  232. package/dist/sdk/util/index.js +1 -1
  233. package/dist/sdk/util/paginate.js +1 -1
  234. package/dist/sdk/util/tree-formatter.js +1 -1
  235. package/dist/sdk/util/tree-search.js +1 -1
  236. package/dist/sdk/workflow/archive-validation.js +1 -1
  237. package/dist/sdk/workflow/clone-workflow.js +1 -1
  238. package/dist/sdk/workflow/index.js +1 -1
  239. package/dist/sdk/workflow/pull-workflow.js +1 -1
  240. package/dist/sdk/workflow/push-workflow.js +1 -1
  241. package/dist/sdk/workflow/task-graph.js +1 -1
  242. package/dist/sdk/workflow/tdx-config.js +1 -1
  243. package/dist/sdk/workflow/workflow-utils.js +1 -1
  244. package/dist/sdk/workspace/access-tracker.js +1 -1
  245. package/dist/sdk/workspace/frontmatter.js +1 -1
  246. package/dist/sdk/workspace/git.js +1 -1
  247. package/dist/sdk/workspace/index.js +1 -1
  248. package/dist/sdk/workspace/templates.js +1 -1
  249. package/dist/sdk/workspace/weekly.js +1 -1
  250. package/dist/sdk/workspace/wikilinks.js +1 -1
  251. package/dist/test-utils/command-runner.js +1 -1
  252. package/dist/test-utils/factories.js +1 -1
  253. package/dist/test-utils/fixtures.js +1 -1
  254. package/dist/test-utils/http-mock.js +1 -1
  255. package/dist/test-utils/index.js +1 -1
  256. package/dist/utils/async.js +1 -1
  257. package/dist/utils/claude-code-state.js +1 -1
  258. package/dist/utils/colors.js +1 -1
  259. package/dist/utils/diff.js +1 -1
  260. package/dist/utils/file-permissions.js +1 -1
  261. package/dist/utils/file-reader.js +1 -1
  262. package/dist/utils/github-releases.js +1 -1
  263. package/dist/utils/global-cache.js +1 -1
  264. package/dist/utils/json-loader.js +1 -1
  265. package/dist/utils/local-cache.js +1 -1
  266. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  267. package/dist/utils/logger/formatters/index.js +1 -1
  268. package/dist/utils/logger/handlers/console-handler.js +1 -1
  269. package/dist/utils/logger/handlers/file-handler.js +1 -1
  270. package/dist/utils/logger/handlers/index.js +1 -1
  271. package/dist/utils/logger/handlers/null-handler.js +1 -1
  272. package/dist/utils/logger/index.js +1 -1
  273. package/dist/utils/logger/logger.js +1 -1
  274. package/dist/utils/logger/types.js +1 -1
  275. package/dist/utils/option-validation.js +1 -1
  276. package/dist/utils/process.js +1 -1
  277. package/dist/utils/prompt.js +1 -1
  278. package/dist/utils/proxy-fetch.js +1 -1
  279. package/dist/utils/spinner.js +1 -1
  280. package/dist/utils/sse-parser.js +1 -1
  281. package/dist/utils/string-utils.js +1 -1
  282. package/dist/utils/table-ref-parser.js +1 -1
  283. package/dist/utils/tdx-logger.js +1 -1
  284. package/dist/utils/version-check.js +1 -1
  285. package/package.json +1 -1
@@ -1 +1 @@
1
- const a8_0x3ce05c=a8_0x8419;(function(_0x48b8dd,_0x35c503){const _0x24a07c=a8_0x8419,_0x2d3780=_0x48b8dd();while(!![]){try{const _0x5d9999=-parseInt(_0x24a07c(0x1d3))/0x1*(parseInt(_0x24a07c(0x1e2))/0x2)+-parseInt(_0x24a07c(0x1ce))/0x3*(-parseInt(_0x24a07c(0x175))/0x4)+parseInt(_0x24a07c(0x160))/0x5+-parseInt(_0x24a07c(0x18c))/0x6*(parseInt(_0x24a07c(0x140))/0x7)+parseInt(_0x24a07c(0x154))/0x8*(parseInt(_0x24a07c(0x191))/0x9)+parseInt(_0x24a07c(0x13c))/0xa*(-parseInt(_0x24a07c(0x15e))/0xb)+parseInt(_0x24a07c(0x1bb))/0xc;if(_0x5d9999===_0x35c503)break;else _0x2d3780['push'](_0x2d3780['shift']());}catch(_0x9b51ab){_0x2d3780['push'](_0x2d3780['shift']());}}}(a8_0x1c23,0xe63ef));function a8_0x1c23(){const _0x56584e=['Analyzing\x20CAS\x20YAML\x20files...','column','\x20\x20Audience:\x20','\x20—\x20a\x20real\x20push\x20will\x20refuse\x20unless\x20run\x20with\x20--delete.','updated','list','audiences','Preview\x20composable\x20segment\x20query\x20on\x20CDW','\x0a↻\x20Would\x20rename\x20attribute\x20\x22','names','Push\x20YAML\x20files\x20to\x20CAS\x20API','error','\x20YAML\x20file(s)','192gksDXv','\x20warning(s)\x20found','Behaviors\x20(','Master\x20Table','composableAudience','1206ldcjEp','invalidCount','Status:\x20','\x20segments,\x20','data','\x0aError:','\x20composable\x20audiences','Not\x20found:\x20','\x20\x20Renames\x20are\x20applied\x20by\x20recreating\x20the\x20attribute/behavior\x20server-side\x20—\x20its\x20id\x20will\x20change.','\x20\x20Renamed\x20attribute:\x20\x22','basename','cas:desc','\x20\x20Removed\x20(--delete):\x20','\x20(server\x20id\x20changed\x20','\x0aValidation\x20failed:','Attributes\x20(','No\x20composable\x20audiences\x20found.','timeColumn','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','cas:preview','\x20activations)','cwd','errors','execute','masterSchema','\x20\x20Created:\x20','hasErrors','description','files','\x20file(s)\x20with\x20errors,\x20','attribute(s)\x20','renamedAttributes','Validate\x20composable\x20audience\x20YAML\x20files\x20locally','Tip:\x20Run\x20`tdx\x20cas\x20pull\x20<name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Error:\x20\x20','Pushing\x20to\x20CAS\x20API...','table','cyan','from','log','utf-8','fromId','3991272vhWdNf','segments','Would\x20create:\x20','\x20warning(s)','attributes','count','\x27...','join','schema','\x22\x20→\x20\x22','delete','\x20or\x20set\x20context\x20with\x20','dirname','folders','name','Describe\x20a\x20composable\x20audience','length','🧊\x20','green','2787FCYuHG','renamedBehaviors','dir','\x20\x20Key:\x20\x20\x20\x20','absolutePath','736BhehJn','diff','yellow','audienceDrift','source','\x0a⚠\x20On\x20server\x20but\x20not\x20in\x20this\x20YAML:\x20','\x20—\x20','tdx\x20use\x20cas\x20<name>','\x0a↻\x20Would\x20rename\x20behavior\x20\x22','dryRun','\x0a✔\x20Push\x20complete','\x20→\x20','created','push','Found\x20','3952QkHOIz','underline','red','\x20error(s)','content','Usage:\x20tdx\x20cas\x20preview\x20<segment_name>\x20[--audience\x20<name>]','(dry\x20run\x20—\x20no\x20files\x20written)','Wrote\x20','rows','behaviors','--audience\x20<name>','tdx\x20cas\x20validate\x20<path>','\x20change(s)?','Fetching\x20audience\x20\x27','Directory\x20not\x20found:\x20','\x20\x20Schema:\x20','hasChanges','valid','bold','344030jbFeaR','skippedCount','cas:push','verbose','13160LMjKTQ','Aborted.','map','population','Write\x20files?','\x20file(s)\x20to\x20write\x20','\x20composable\x20segment\x20file(s)\x20not\x20validated','activations','counts','status','\x20file(s)\x20valid','audienceName','\x20file(s)\x20to\x20','get','\x20activation(s)','Context\x20set:\x20','pull','\x20(time:\x20','toId','result','83688gobtcX','setPhase','removedAttributes','masterTable','warnings','✔\x20All\x20','Validation\x20failed:\x20','\x20\x20Updated:\x20','\x20audience(s)','Would\x20update:\x20','451kXbJAt','Fetching\x20composable\x20audiences...','4486135NKYwgT','\x20(new)','reason','isNew','Use\x20','Resolving\x20connections...','connection','No\x20composable\x20audience\x20specified.','\x0aPush\x20','yes','cas:list','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','removedBehaviors','behavior(s)\x20','type','preview','warningCount','\x20\x20Renamed\x20behavior:\x20\x22','relativePath','\x20and\x20','dim','5324GlTEbY','Pulling\x20composable\x20audience\x20\x27','tdx\x20cas\x20desc\x20<name>','\x20valid','cas','validCount','Audience:\x20','renamedAttributeIds','renamedBehaviorIds','Source:\x20\x20\x20'];a8_0x1c23=function(){return _0x56584e;};return a8_0x1c23();}import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import a8_0x49b07e from'chalk';function a8_0x8419(_0xf23dfb,_0xb7d07d){_0xf23dfb=_0xf23dfb-0x12d;const _0x1c23b9=a8_0x1c23();let _0x8419b3=_0x1c23b9[_0xf23dfb];return _0x8419b3;}import{existsSync,mkdirSync,writeFileSync}from'fs';import a8_0x2345f2 from'path';import{confirmKey,isInteractive}from'../utils/prompt.js';import{collectYamlFiles,buildConnectionMaps}from'../sdk/cas/push-workflow.js';import{validateCasYamlFiles,isCasValidationResult,calculateCasValidationSummary}from'../sdk/cas/validate-files.js';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';export class CASListCommand extends BaseCommand{[a8_0x3ce05c(0x1c9)]=a8_0x3ce05c(0x16a);['description']='List\x20composable\x20audiences';async[a8_0x3ce05c(0x1a8)](_0x3aeb9b){const _0x3489f9=a8_0x3ce05c,{options:_0x58ad3b,tdx:_0x525d41}=_0x3aeb9b,_0x54a74b=await withProgressSpinner(_0x3489f9(0x15f),()=>_0x525d41[_0x3489f9(0x179)][_0x3489f9(0x184)](),{'verbose':_0x58ad3b[_0x3489f9(0x13f)]}),_0x5b1271=_0x54a74b[_0x3489f9(0x195)];if(isStructuredFormat(_0x58ad3b))return await handleSDKOutput(_0x5b1271,_0x58ad3b),0x0;if(_0x5b1271[_0x3489f9(0x1cb)]===0x0)return console[_0x3489f9(0x1b8)](a8_0x49b07e[_0x3489f9(0x174)](_0x3489f9(0x1a1))),0x0;console[_0x3489f9(0x1b8)](a8_0x49b07e[_0x3489f9(0x1cd)](_0x3489f9(0x1e1)+_0x5b1271[_0x3489f9(0x1cb)]+_0x3489f9(0x197)));for(const _0x49f56a of _0x5b1271){const _0x18c3b2=_0x49f56a[_0x3489f9(0x143)]?a8_0x49b07e[_0x3489f9(0x174)]('\x20('+Number(_0x49f56a['population'])['toLocaleString']()+')'):'',_0x1a1e83=a8_0x49b07e[_0x3489f9(0x174)]('\x20'+_0x49f56a[_0x3489f9(0x1a9)]+'.'+_0x49f56a[_0x3489f9(0x157)]);console[_0x3489f9(0x1b8)](_0x3489f9(0x1cc)+_0x49f56a['name']+_0x18c3b2+_0x1a1e83),_0x49f56a['description']&&console['log']('\x20\x20'+a8_0x49b07e[_0x3489f9(0x174)](_0x49f56a[_0x3489f9(0x1ac)]));}return 0x0;}}export class CASDescCommand extends BaseCommand{[a8_0x3ce05c(0x1c9)]=a8_0x3ce05c(0x19c);[a8_0x3ce05c(0x1ac)]=a8_0x3ce05c(0x1ca);async['execute'](_0xe835ba){const _0x314a83=a8_0x3ce05c,{options:_0x570857,args:_0x534f2b,tdx:_0x24eab4}=_0xe835ba,_0x27d261=_0x534f2b[0x0]||_0x570857[_0x314a83(0x190)];if(!_0x27d261)return console['error'](a8_0x49b07e[_0x314a83(0x1d5)]('No\x20composable\x20audience\x20specified.')),console[_0x314a83(0x18a)]('Use\x20'+a8_0x49b07e[_0x314a83(0x1b6)](_0x314a83(0x177))+'\x20or\x20set\x20context\x20with\x20'+a8_0x49b07e['cyan']('tdx\x20use\x20cas\x20<name>')),0x1;const _0x16540d=await withProgressSpinner(_0x314a83(0x136)+_0x27d261+_0x314a83(0x1c1),()=>_0x24eab4['cas'][_0x314a83(0x14d)](_0x27d261),{'verbose':_0x570857[_0x314a83(0x13f)]}),_0x664c79=_0x16540d[_0x314a83(0x195)];if(isStructuredFormat(_0x570857))return await handleSingleObjectOutput(_0x664c79,_0x570857),0x0;console[_0x314a83(0x1b8)](a8_0x49b07e[_0x314a83(0x13b)](_0x664c79[_0x314a83(0x1c9)]));if(_0x664c79[_0x314a83(0x1ac)])console[_0x314a83(0x1b8)](a8_0x49b07e[_0x314a83(0x174)](_0x664c79['description']));console[_0x314a83(0x1b8)](),console[_0x314a83(0x1b8)](a8_0x49b07e['underline'](_0x314a83(0x18f))),console[_0x314a83(0x1b8)](_0x314a83(0x138)+_0x664c79[_0x314a83(0x1a9)]),console[_0x314a83(0x1b8)]('\x20\x20Table:\x20\x20'+_0x664c79[_0x314a83(0x157)]),console['log'](_0x314a83(0x1d1)+_0x664c79['masterKeyColumn']),console[_0x314a83(0x1b8)]();if(_0x664c79[_0x314a83(0x1bf)]?.[_0x314a83(0x1cb)]){console[_0x314a83(0x1b8)](a8_0x49b07e[_0x314a83(0x1e3)](_0x314a83(0x1a0)+_0x664c79['attributes']['length']+')'));for(const _0x1e5201 of _0x664c79[_0x314a83(0x1bf)]){console[_0x314a83(0x1b8)]('\x20\x20'+a8_0x49b07e[_0x314a83(0x13b)](_0x1e5201[_0x314a83(0x1c9)])+_0x314a83(0x1d9)+_0x1e5201[_0x314a83(0x1c3)]+'.'+_0x1e5201['table']+'.'+_0x1e5201[_0x314a83(0x180)]+'\x20('+a8_0x49b07e['dim'](_0x1e5201[_0x314a83(0x16e)])+')');}console['log']();}if(_0x664c79[_0x314a83(0x132)]?.['length']){console['log'](a8_0x49b07e[_0x314a83(0x1e3)](_0x314a83(0x18e)+_0x664c79[_0x314a83(0x132)]['length']+')'));for(const _0x3d6c1a of _0x664c79[_0x314a83(0x132)]){const _0x5659d7=_0x3d6c1a[_0x314a83(0x1a2)]?_0x314a83(0x151)+_0x3d6c1a['timeColumn']+')':'';console[_0x314a83(0x1b8)]('\x20\x20'+a8_0x49b07e['bold'](_0x3d6c1a[_0x314a83(0x1c9)])+_0x314a83(0x1d9)+_0x3d6c1a[_0x314a83(0x1c3)]+'.'+_0x3d6c1a[_0x314a83(0x1b5)]+_0x5659d7);}}return 0x0;}}export class CASPullCommand extends BaseCommand{[a8_0x3ce05c(0x1c9)]='cas:pull';[a8_0x3ce05c(0x1ac)]='Pull\x20composable\x20audience\x20to\x20YAML\x20files';async[a8_0x3ce05c(0x1a8)](_0x2b0a8f){const _0x24a6d6=a8_0x3ce05c,{options:_0x4ba8d1,args:_0x4b1677,tdx:_0x2180d3}=_0x2b0a8f,_0x1cfca5=_0x4ba8d1,_0x15f7d7=_0x4b1677[0x0]||_0x4ba8d1['composableAudience'];if(!_0x15f7d7)return console[_0x24a6d6(0x18a)](a8_0x49b07e[_0x24a6d6(0x1d5)]('No\x20composable\x20audience\x20specified.')),console['error']('Use\x20'+a8_0x49b07e[_0x24a6d6(0x1b6)]('tdx\x20cas\x20pull\x20<name>')+_0x24a6d6(0x1c6)+a8_0x49b07e[_0x24a6d6(0x1b6)](_0x24a6d6(0x1da))),0x1;const _0x555e21=_0x1cfca5[_0x24a6d6(0x1d0)]||a8_0x2345f2[_0x24a6d6(0x1c2)](process[_0x24a6d6(0x1a6)](),_0x24a6d6(0x179),sanitizeFileName(_0x15f7d7)),_0x369757=await withProgressSpinner(_0x24a6d6(0x176)+_0x15f7d7+_0x24a6d6(0x1c1),_0x493e86=>_0x2180d3[_0x24a6d6(0x179)][_0x24a6d6(0x150)](_0x15f7d7,{'targetDir':_0x555e21,'verbose':_0x1cfca5['verbose'],'progress':{'update':_0x5a4bbe=>_0x493e86['setPhase'](_0x5a4bbe)}}),{'verbose':_0x1cfca5['verbose']}),_0x1ef021=_0x369757[_0x24a6d6(0x195)],_0x272398=_0x1ef021[_0x24a6d6(0x1ad)]['filter'](_0x5a924a=>_0x5a924a[_0x24a6d6(0x163)]||_0x5a924a[_0x24a6d6(0x139)]);saveSessionContext({'composable_audience':_0x1ef021['audienceName']},_0x1cfca5['session']),console[_0x24a6d6(0x1b8)](a8_0x49b07e[_0x24a6d6(0x1cd)](_0x24a6d6(0x14f)+a8_0x49b07e[_0x24a6d6(0x174)]('composable_audience')+'\x20=\x20'+a8_0x49b07e[_0x24a6d6(0x1b6)](_0x1ef021[_0x24a6d6(0x14b)])));if(_0x272398[_0x24a6d6(0x1cb)]===0x0)return console[_0x24a6d6(0x1b8)](a8_0x49b07e[_0x24a6d6(0x1cd)]('All\x20files\x20are\x20up\x20to\x20date.')),0x0;for(const _0x45c854 of _0x272398){if(_0x45c854[_0x24a6d6(0x163)])console[_0x24a6d6(0x1b8)](a8_0x49b07e['green']('+\x20'+_0x45c854[_0x24a6d6(0x172)]+_0x24a6d6(0x161)));else _0x45c854['diff']&&(console['log'](a8_0x49b07e[_0x24a6d6(0x1d5)]('~\x20'+_0x45c854[_0x24a6d6(0x172)])),console[_0x24a6d6(0x1b8)](_0x45c854[_0x24a6d6(0x1d4)]));}console[_0x24a6d6(0x1b8)]('\x0a'+_0x272398[_0x24a6d6(0x1cb)]+_0x24a6d6(0x145)+('('+_0x1ef021['counts'][_0x24a6d6(0x1bc)]+_0x24a6d6(0x194)+_0x1ef021[_0x24a6d6(0x148)][_0x24a6d6(0x147)]+_0x24a6d6(0x1a5)));if(_0x1cfca5[_0x24a6d6(0x1dc)])return console[_0x24a6d6(0x1b8)](a8_0x49b07e[_0x24a6d6(0x174)](_0x24a6d6(0x12f))),0x0;if(!_0x1cfca5[_0x24a6d6(0x169)]&&isInteractive()){const _0x15c0ca=await confirmKey(_0x24a6d6(0x144));if(!_0x15c0ca)return console[_0x24a6d6(0x1b8)](a8_0x49b07e[_0x24a6d6(0x174)]('Cancelled.')),0x0;}for(const _0x148fb0 of _0x272398){const _0x4b5bfa=a8_0x2345f2[_0x24a6d6(0x1c7)](_0x148fb0[_0x24a6d6(0x1d2)]);if(!existsSync(_0x4b5bfa))mkdirSync(_0x4b5bfa,{'recursive':!![]});writeFileSync(_0x148fb0[_0x24a6d6(0x1d2)],_0x148fb0[_0x24a6d6(0x12d)],_0x24a6d6(0x1b9));}return console['log'](a8_0x49b07e[_0x24a6d6(0x1cd)](_0x24a6d6(0x130)+_0x272398[_0x24a6d6(0x1cb)]+_0x24a6d6(0x14c)+_0x555e21)),0x0;}}export class CASPushCommand extends BaseCommand{['name']=a8_0x3ce05c(0x13e);[a8_0x3ce05c(0x1ac)]=a8_0x3ce05c(0x189);async['execute'](_0x4d6b9b){const _0x90fae6=a8_0x3ce05c,{options:_0x2790ec,args:_0x83133c,tdx:_0x6da4d}=_0x4d6b9b,_0x146609=_0x2790ec;let _0x59fe8d=_0x83133c[0x0];!_0x59fe8d&&_0x2790ec[_0x90fae6(0x190)]&&(_0x59fe8d=a8_0x2345f2[_0x90fae6(0x1c2)](process[_0x90fae6(0x1a6)](),_0x90fae6(0x179),sanitizeFileName(_0x2790ec[_0x90fae6(0x190)])));if(!_0x59fe8d)return console[_0x90fae6(0x18a)](a8_0x49b07e[_0x90fae6(0x1d5)]('No\x20composable\x20audience\x20specified.')),console[_0x90fae6(0x18a)](_0x90fae6(0x164)+a8_0x49b07e[_0x90fae6(0x1b6)]('tdx\x20cas\x20push\x20<path>')+_0x90fae6(0x1c6)+a8_0x49b07e[_0x90fae6(0x1b6)]('tdx\x20use\x20cas\x20<name>')),0x1;if(!existsSync(_0x59fe8d))return console[_0x90fae6(0x18a)](a8_0x49b07e[_0x90fae6(0x1e4)](_0x90fae6(0x137)+_0x59fe8d)),console[_0x90fae6(0x18a)](a8_0x49b07e['dim'](_0x90fae6(0x1b2))),0x1;const _0x232717=_0x2790ec[_0x90fae6(0x190)]||a8_0x2345f2[_0x90fae6(0x19b)](_0x59fe8d),_0x2f47d7=a8_0x2345f2['relative'](process[_0x90fae6(0x1a6)](),_0x59fe8d)||'.';console[_0x90fae6(0x1b8)](_0x90fae6(0x17b)+a8_0x49b07e['cyan'](_0x232717)),console[_0x90fae6(0x1b8)](_0x90fae6(0x17e)+a8_0x49b07e['dim'](_0x2f47d7)),console[_0x90fae6(0x1b8)]();const _0x27ab10=collectYamlFiles(_0x59fe8d);if(_0x27ab10['length']===0x0)return console[_0x90fae6(0x18a)](a8_0x49b07e['red']('No\x20YAML\x20files\x20found\x20in:\x20'+_0x59fe8d)),0x1;console[_0x90fae6(0x1b8)](_0x90fae6(0x1e1)+_0x27ab10[_0x90fae6(0x1cb)]+_0x90fae6(0x18b));const _0x26f1ac=await withProgressSpinner(_0x90fae6(0x165),()=>buildConnectionMaps(_0x6da4d['connection']),{'verbose':_0x146609[_0x90fae6(0x13f)]}),_0x42bba4=_0x26f1ac[_0x90fae6(0x195)],{nameToId:_0x5e6197,nameToType:_0x28fb8e,idToType:_0xc1dc1}=_0x42bba4,_0x143a88=validateCasYamlFiles(_0x27ab10,_0x59fe8d,{'connectionNameToType':_0x28fb8e,'connectionIdToType':_0xc1dc1,'connectionNameToId':_0x5e6197}),_0x489cf7=calculateCasValidationSummary(_0x143a88);if(_0x489cf7[_0x90fae6(0x1ab)]){console[_0x90fae6(0x18a)](a8_0x49b07e['red'](_0x90fae6(0x19f)));for(const _0x5cd81a of _0x143a88){isCasValidationResult(_0x5cd81a)&&!_0x5cd81a['result'][_0x90fae6(0x13a)]&&(console['error']('\x0a'+_0x5cd81a['relativePath']+':\x20'+_0x5cd81a['result'][_0x90fae6(0x1a7)][_0x90fae6(0x1cb)]+_0x90fae6(0x1e5)),console[_0x90fae6(0x18a)](formatValidationResult(_0x5cd81a['result'],_0x5cd81a[_0x90fae6(0x1d7)],_0x5cd81a['relativePath'])));}return console[_0x90fae6(0x18a)](a8_0x49b07e[_0x90fae6(0x1d5)]('\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20cas\x20validate`\x20to\x20check\x20files\x20locally.')),0x1;}const _0x31f62d=await withProgressSpinner(_0x90fae6(0x17f),_0x2fa867=>_0x6da4d[_0x90fae6(0x179)]['push'](_0x27ab10,{'dryRun':!![],'verbose':_0x146609[_0x90fae6(0x13f)],'deleteDrift':_0x146609[_0x90fae6(0x1c5)],'connectionMaps':_0x42bba4,'progress':{'update':_0x67602f=>_0x2fa867[_0x90fae6(0x155)](_0x67602f)}}),{'verbose':_0x146609['verbose']}),_0x3aa633=_0x31f62d[_0x90fae6(0x195)],_0x3d6ec7=(_0x2a98b1,_0x339fc9)=>{const _0x36689c=_0x90fae6,_0x6b1de2=_0x2a98b1[_0x339fc9],_0x5f280b=[];if(_0x6b1de2[_0x36689c(0x185)])_0x5f280b['push'](_0x6b1de2['audiences']+_0x36689c(0x15c));if(_0x6b1de2['folders'])_0x5f280b['push'](_0x6b1de2[_0x36689c(0x1c8)]+'\x20folder(s)');if(_0x6b1de2[_0x36689c(0x1bc)])_0x5f280b[_0x36689c(0x1e0)](_0x6b1de2[_0x36689c(0x1bc)]+'\x20segment(s)');if(_0x6b1de2[_0x36689c(0x147)])_0x5f280b[_0x36689c(0x1e0)](_0x6b1de2[_0x36689c(0x147)]+_0x36689c(0x14e));return _0x5f280b;},_0x5b2eae=_0x3d6ec7(_0x3aa633,'created'),_0x24f718=_0x3d6ec7(_0x3aa633,_0x90fae6(0x183)),_0x180033=_0x3aa633[_0x90fae6(0x1df)][_0x90fae6(0x185)]+_0x3aa633[_0x90fae6(0x1df)][_0x90fae6(0x1c8)]+_0x3aa633[_0x90fae6(0x1df)][_0x90fae6(0x1bc)]+_0x3aa633[_0x90fae6(0x1df)]['activations']+_0x3aa633[_0x90fae6(0x183)][_0x90fae6(0x185)]+_0x3aa633['updated'][_0x90fae6(0x1c8)]+_0x3aa633[_0x90fae6(0x183)]['segments']+_0x3aa633[_0x90fae6(0x183)][_0x90fae6(0x147)];if(_0x180033===0x0)return console[_0x90fae6(0x1b8)](a8_0x49b07e[_0x90fae6(0x174)]('No\x20CAS\x20resources\x20found\x20in\x20YAML\x20files.')),0x0;if(_0x5b2eae['length']>0x0)console['log'](_0x90fae6(0x1bd)+_0x5b2eae['join'](',\x20'));if(_0x24f718[_0x90fae6(0x1cb)]>0x0)console[_0x90fae6(0x1b8)](_0x90fae6(0x15d)+_0x24f718[_0x90fae6(0x1c2)](',\x20'));const _0x2737fd=_0x3aa633[_0x90fae6(0x1d6)];if(_0x2737fd&&(_0x2737fd[_0x90fae6(0x156)][_0x90fae6(0x1cb)]||_0x2737fd[_0x90fae6(0x16c)][_0x90fae6(0x1cb)])){const _0x2fe518=[];_0x2737fd[_0x90fae6(0x156)][_0x90fae6(0x1cb)]&&_0x2fe518['push'](_0x90fae6(0x1af)+_0x2737fd[_0x90fae6(0x156)][_0x90fae6(0x1c2)](',\x20')),_0x2737fd[_0x90fae6(0x16c)][_0x90fae6(0x1cb)]&&_0x2fe518['push'](_0x90fae6(0x16d)+_0x2737fd['removedBehaviors'][_0x90fae6(0x1c2)](',\x20')),console['log'](a8_0x49b07e[_0x90fae6(0x1e4)](_0x90fae6(0x1d8)+_0x2fe518['join'](_0x90fae6(0x173))+_0x90fae6(0x182)));}if(_0x2737fd&&(_0x2737fd[_0x90fae6(0x1b0)]['length']||_0x2737fd[_0x90fae6(0x1cf)]['length'])){for(const _0x1dfcad of _0x2737fd[_0x90fae6(0x1b0)]){console['log'](a8_0x49b07e['yellow'](_0x90fae6(0x187)+_0x1dfcad[_0x90fae6(0x1b7)]+_0x90fae6(0x1c4)+_0x1dfcad['to']+'\x22'));}for(const _0x2e0cca of _0x2737fd[_0x90fae6(0x1cf)]){console[_0x90fae6(0x1b8)](a8_0x49b07e[_0x90fae6(0x1d5)](_0x90fae6(0x1db)+_0x2e0cca[_0x90fae6(0x1b7)]+'\x22\x20→\x20\x22'+_0x2e0cca['to']+'\x22'));}console[_0x90fae6(0x1b8)](a8_0x49b07e[_0x90fae6(0x174)](_0x90fae6(0x199)));}if(_0x146609[_0x90fae6(0x1dc)])return console[_0x90fae6(0x1b8)](a8_0x49b07e['yellow'](_0x90fae6(0x1a3))),0x0;if(!_0x146609['yes']){if(!isInteractive())return console[_0x90fae6(0x18a)](a8_0x49b07e[_0x90fae6(0x1e4)](_0x90fae6(0x196)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x90fae6(0x18a)](a8_0x49b07e[_0x90fae6(0x174)](_0x90fae6(0x16b))),0x1;const _0x281b03=await confirmKey(_0x90fae6(0x168)+_0x180033+_0x90fae6(0x135));if(!_0x281b03)return console[_0x90fae6(0x1b8)](a8_0x49b07e['yellow'](_0x90fae6(0x141))),0x1;}const _0x2354b3=await withProgressSpinner(_0x90fae6(0x1b4),_0x89c4cd=>_0x6da4d[_0x90fae6(0x179)]['push'](_0x27ab10,{'dryRun':![],'verbose':_0x146609[_0x90fae6(0x13f)],'deleteDrift':_0x146609[_0x90fae6(0x1c5)],'progress':{'update':_0x1384d5=>_0x89c4cd[_0x90fae6(0x155)](_0x1384d5)}}),{'verbose':_0x146609[_0x90fae6(0x13f)]}),_0x2f6c07=_0x2354b3[_0x90fae6(0x195)];console[_0x90fae6(0x1b8)](a8_0x49b07e[_0x90fae6(0x1cd)](_0x90fae6(0x1dd)));_0x2f6c07[_0x90fae6(0x14b)]&&console[_0x90fae6(0x1b8)](_0x90fae6(0x181)+a8_0x49b07e['cyan'](_0x2f6c07[_0x90fae6(0x14b)]));const _0x731735=_0x3d6ec7(_0x2f6c07,_0x90fae6(0x1df)),_0x9a4f4e=_0x3d6ec7(_0x2f6c07,_0x90fae6(0x183));if(_0x731735[_0x90fae6(0x1cb)]>0x0)console[_0x90fae6(0x1b8)](_0x90fae6(0x1aa)+_0x731735[_0x90fae6(0x1c2)](',\x20'));if(_0x9a4f4e['length']>0x0)console[_0x90fae6(0x1b8)](_0x90fae6(0x15b)+_0x9a4f4e['join'](',\x20'));const _0x1cb312=_0x2f6c07[_0x90fae6(0x1d6)];if(_0x1cb312&&(_0x1cb312['removedAttributes'][_0x90fae6(0x1cb)]||_0x1cb312[_0x90fae6(0x16c)][_0x90fae6(0x1cb)])){const _0x831865=[];_0x1cb312[_0x90fae6(0x156)][_0x90fae6(0x1cb)]&&_0x831865[_0x90fae6(0x1e0)](_0x90fae6(0x1af)+_0x1cb312['removedAttributes'][_0x90fae6(0x1c2)](',\x20')),_0x1cb312['removedBehaviors'][_0x90fae6(0x1cb)]&&_0x831865[_0x90fae6(0x1e0)]('behavior(s)\x20'+_0x1cb312[_0x90fae6(0x16c)][_0x90fae6(0x1c2)](',\x20')),console[_0x90fae6(0x1b8)](a8_0x49b07e['red'](_0x90fae6(0x19d)+_0x831865['join'](_0x90fae6(0x173))));}for(const _0x3c09dc of _0x2f6c07[_0x90fae6(0x17c)]??[]){console[_0x90fae6(0x1b8)](a8_0x49b07e[_0x90fae6(0x1d5)](_0x90fae6(0x19a)+_0x3c09dc['from']+'\x22\x20→\x20\x22'+_0x3c09dc['to']+'\x22'+(_0x3c09dc[_0x90fae6(0x1ba)]&&_0x3c09dc['toId']?_0x90fae6(0x19e)+_0x3c09dc[_0x90fae6(0x1ba)]+_0x90fae6(0x1de)+_0x3c09dc[_0x90fae6(0x152)]+')':'')));}for(const _0x1eff74 of _0x2f6c07[_0x90fae6(0x17d)]??[]){console['log'](a8_0x49b07e[_0x90fae6(0x1d5)](_0x90fae6(0x171)+_0x1eff74[_0x90fae6(0x1b7)]+_0x90fae6(0x1c4)+_0x1eff74['to']+'\x22'+(_0x1eff74[_0x90fae6(0x1ba)]&&_0x1eff74['toId']?_0x90fae6(0x19e)+_0x1eff74[_0x90fae6(0x1ba)]+_0x90fae6(0x1de)+_0x1eff74[_0x90fae6(0x152)]+')':'')));}return 0x0;}}export class CASValidateCommand extends BaseCommand{[a8_0x3ce05c(0x1c9)]='cas:validate';[a8_0x3ce05c(0x1ac)]=a8_0x3ce05c(0x1b1);async['execute'](_0x278e69){const _0xc376e9=a8_0x3ce05c,{options:_0x30f206,args:_0x5abf47,tdx:_0x596b90}=_0x278e69,_0x4b1a32=_0x30f206;let _0x33c8f1=_0x5abf47[0x0];!_0x33c8f1&&_0x30f206[_0xc376e9(0x190)]&&(_0x33c8f1=a8_0x2345f2[_0xc376e9(0x1c2)](process[_0xc376e9(0x1a6)](),_0xc376e9(0x179),sanitizeFileName(_0x30f206[_0xc376e9(0x190)])));if(!_0x33c8f1)return console[_0xc376e9(0x18a)](a8_0x49b07e[_0xc376e9(0x1d5)](_0xc376e9(0x167))),console[_0xc376e9(0x18a)](_0xc376e9(0x164)+a8_0x49b07e[_0xc376e9(0x1b6)](_0xc376e9(0x134))+_0xc376e9(0x1c6)+a8_0x49b07e['cyan'](_0xc376e9(0x1da))),0x1;if(!existsSync(_0x33c8f1))return console[_0xc376e9(0x18a)](a8_0x49b07e[_0xc376e9(0x1e4)](_0xc376e9(0x198)+_0x33c8f1)),0x1;const _0x168f3b=collectYamlFiles(_0x33c8f1);if(_0x168f3b[_0xc376e9(0x1cb)]===0x0)return console[_0xc376e9(0x18a)](a8_0x49b07e[_0xc376e9(0x1e4)]('No\x20YAML\x20files\x20found\x20in:\x20'+_0x33c8f1)),0x1;const _0x3492e8=await withProgressSpinner(_0xc376e9(0x165),()=>buildConnectionMaps(_0x596b90[_0xc376e9(0x166)]),{'verbose':_0x4b1a32['verbose']}),{nameToId:_0x431569,nameToType:_0x5c6739,idToType:_0x53ff3f}=_0x3492e8[_0xc376e9(0x195)],_0x4f90b0=validateCasYamlFiles(_0x168f3b,_0x33c8f1,{'connectionNameToType':_0x5c6739,'connectionIdToType':_0x53ff3f,'connectionNameToId':_0x431569}),_0x459619=calculateCasValidationSummary(_0x4f90b0);for(const _0x4a1c55 of _0x4f90b0){if(!isCasValidationResult(_0x4a1c55)){_0x4b1a32[_0xc376e9(0x13f)]&&console['log'](a8_0x49b07e[_0xc376e9(0x174)]('⊘\x20'+_0x4a1c55[_0xc376e9(0x172)]+':\x20skipped\x20('+_0x4a1c55[_0xc376e9(0x162)]+')'));continue;}if(_0x4a1c55[_0xc376e9(0x153)][_0xc376e9(0x13a)]&&_0x4a1c55[_0xc376e9(0x153)][_0xc376e9(0x158)][_0xc376e9(0x1cb)]===0x0)_0x4b1a32[_0xc376e9(0x13f)]&&console[_0xc376e9(0x1b8)](a8_0x49b07e['green']('✔\x20'+_0x4a1c55[_0xc376e9(0x172)]));else _0x4a1c55[_0xc376e9(0x153)][_0xc376e9(0x13a)]?(console[_0xc376e9(0x1b8)](a8_0x49b07e['yellow']('⚠\x20'+_0x4a1c55[_0xc376e9(0x172)])+a8_0x49b07e[_0xc376e9(0x174)](':\x20'+_0x4a1c55[_0xc376e9(0x153)][_0xc376e9(0x158)][_0xc376e9(0x1cb)]+_0xc376e9(0x1be))),console[_0xc376e9(0x1b8)](formatValidationResult(_0x4a1c55['result'],_0x4a1c55[_0xc376e9(0x1d7)],_0x4a1c55[_0xc376e9(0x172)]))):(console[_0xc376e9(0x1b8)](a8_0x49b07e[_0xc376e9(0x1e4)]('✖\x20'+_0x4a1c55[_0xc376e9(0x172)])+a8_0x49b07e[_0xc376e9(0x174)](':\x20'+_0x4a1c55['result']['errors'][_0xc376e9(0x1cb)]+'\x20error(s)')),console[_0xc376e9(0x1b8)](formatValidationResult(_0x4a1c55[_0xc376e9(0x153)],_0x4a1c55['source'],_0x4a1c55['relativePath'])));}console[_0xc376e9(0x1b8)]('');if(_0x459619['hasErrors'])return console['log'](a8_0x49b07e[_0xc376e9(0x1e4)](_0xc376e9(0x15a)+_0x459619[_0xc376e9(0x192)]+_0xc376e9(0x1ae)+_0x459619[_0xc376e9(0x17a)]+_0xc376e9(0x178))),_0x459619[_0xc376e9(0x170)]>0x0&&console[_0xc376e9(0x1b8)](a8_0x49b07e['yellow'](_0x459619[_0xc376e9(0x170)]+_0xc376e9(0x18d))),0x1;return console[_0xc376e9(0x1b8)](a8_0x49b07e[_0xc376e9(0x1cd)](_0xc376e9(0x159)+_0x459619[_0xc376e9(0x17a)]+_0xc376e9(0x14a))),_0x459619['warningCount']>0x0&&console['log'](a8_0x49b07e[_0xc376e9(0x1d5)](_0x459619[_0xc376e9(0x170)]+'\x20warning(s)\x20found')),_0x459619[_0xc376e9(0x13d)]>0x0&&console[_0xc376e9(0x1b8)](a8_0x49b07e[_0xc376e9(0x174)](_0x459619[_0xc376e9(0x13d)]+_0xc376e9(0x146))),0x0;}}export class CASPreviewCommand extends BaseCommand{[a8_0x3ce05c(0x1c9)]=a8_0x3ce05c(0x1a4);[a8_0x3ce05c(0x1ac)]=a8_0x3ce05c(0x186);async['execute'](_0x12b3da){const _0x3ebf40=a8_0x3ce05c,{options:_0x5c9258,args:_0x2a0564,tdx:_0x17f6b2}=_0x12b3da,_0x467418=_0x2a0564[0x0],_0x5480a9=_0x2a0564[0x1]||_0x5c9258[_0x3ebf40(0x190)];if(!_0x467418)return console[_0x3ebf40(0x18a)](a8_0x49b07e['red'](_0x3ebf40(0x12e))),0x1;if(!_0x5480a9)return console[_0x3ebf40(0x18a)](a8_0x49b07e[_0x3ebf40(0x1d5)]('Audience\x20name\x20required.')),console['error']('Use\x20'+a8_0x49b07e[_0x3ebf40(0x1b6)](_0x3ebf40(0x133))+_0x3ebf40(0x1c6)+a8_0x49b07e[_0x3ebf40(0x1b6)](_0x3ebf40(0x1da))),0x1;const _0x54955c=await withProgressSpinner('Running\x20preview\x20for\x20\x27'+_0x467418+_0x3ebf40(0x1c1),()=>_0x17f6b2[_0x3ebf40(0x179)][_0x3ebf40(0x16f)](_0x5480a9,_0x467418),{'verbose':_0x5c9258[_0x3ebf40(0x13f)]}),{query:_0x36e5d,customers:_0x4bdecb}=_0x54955c[_0x3ebf40(0x195)];if(isStructuredFormat(_0x5c9258))return await handleSingleObjectOutput({'query':_0x36e5d,'customers':_0x4bdecb},_0x5c9258),0x0;const _0x2466c3=_0x36e5d[_0x3ebf40(0x149)]==='success'?a8_0x49b07e[_0x3ebf40(0x1cd)]:a8_0x49b07e[_0x3ebf40(0x1d5)];console[_0x3ebf40(0x1b8)](_0x3ebf40(0x193)+_0x2466c3(_0x36e5d[_0x3ebf40(0x149)])),console['log']('Count:\x20\x20'+a8_0x49b07e[_0x3ebf40(0x13b)](String(_0x36e5d[_0x3ebf40(0x1c0)])));_0x36e5d['error']&&console[_0x3ebf40(0x1b8)](_0x3ebf40(0x1b3)+a8_0x49b07e[_0x3ebf40(0x1e4)](_0x36e5d['error']));if(_0x4bdecb?.['names']&&_0x4bdecb?.[_0x3ebf40(0x131)]){console['log'](a8_0x49b07e['underline']('\x0aSample\x20Rows\x20('+_0x4bdecb[_0x3ebf40(0x131)][_0x3ebf40(0x1cb)]+')'));const _0x60a98b=_0x4bdecb[_0x3ebf40(0x131)][_0x3ebf40(0x142)](_0x51de04=>{const _0x4be542=_0x3ebf40,_0x121f24={};for(let _0x1a96ce=0x0;_0x1a96ce<_0x4bdecb[_0x4be542(0x188)][_0x4be542(0x1cb)];_0x1a96ce++){_0x121f24[_0x4bdecb['names'][_0x1a96ce]]=_0x51de04[_0x1a96ce];}return _0x121f24;});await handleSDKOutput(_0x60a98b,_0x5c9258);}return 0x0;}}
1
+ const a8_0x30c9d4=a8_0x21a4;(function(_0x38e811,_0x3fdd33){const _0x584888=a8_0x21a4,_0x5781e5=_0x38e811();while(!![]){try{const _0x176a89=-parseInt(_0x584888(0x174))/0x1+parseInt(_0x584888(0x10c))/0x2+-parseInt(_0x584888(0x16a))/0x3*(-parseInt(_0x584888(0x132))/0x4)+-parseInt(_0x584888(0x149))/0x5+parseInt(_0x584888(0x121))/0x6*(-parseInt(_0x584888(0x16d))/0x7)+parseInt(_0x584888(0xe1))/0x8*(-parseInt(_0x584888(0x173))/0x9)+parseInt(_0x584888(0x168))/0xa;if(_0x176a89===_0x3fdd33)break;else _0x5781e5['push'](_0x5781e5['shift']());}catch(_0x1fd7d8){_0x5781e5['push'](_0x5781e5['shift']());}}}(a8_0xff90,0xa8a96));import{BaseCommand}from'./command.js';function a8_0x21a4(_0x1061e0,_0x4c622d){_0x1061e0=_0x1061e0-0xc2;const _0xff9053=a8_0xff90();let _0x21a469=_0xff9053[_0x1061e0];return _0x21a469;}import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import a8_0x48e2e8 from'chalk';function a8_0xff90(){const _0xa5e858=['name','\x20activations)','errors','Describe\x20a\x20composable\x20audience','masterTable','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','preview','\x20file(s)\x20with\x20errors,\x20','renamedAttributeIds','Push\x20YAML\x20files\x20to\x20CAS\x20API','Master\x20Table','\x27...','timeColumn','\x20\x20Schema:\x20','attribute(s)\x20','List\x20composable\x20audiences','\x0aValidation\x20failed:','dim','195805EuuRDE','\x0a✔\x20Push\x20complete','\x20\x20Renames\x20are\x20applied\x20by\x20recreating\x20the\x20attribute/behavior\x20server-side\x20—\x20its\x20id\x20will\x20change.','list','from','cyan','isNew','cas:validate','\x20\x20Updated:\x20','log','\x20file(s)\x20valid','absolutePath','\x20\x20Created:\x20','valid','Context\x20set:\x20','\x0a↻\x20Would\x20rename\x20behavior\x20\x22','\x20warning(s)\x20found','warningCount','push','dir','\x20→\x20','\x20composable\x20segment\x20file(s)\x20not\x20validated','removedAttributes','bold','red','green','tdx\x20cas\x20validate\x20<path>','\x20\x20Table:\x20\x20','behaviors','\x0a↻\x20Would\x20rename\x20attribute\x20\x22','composable_audience','16776150tYUfhq','Pushing\x20to\x20CAS\x20API...','15dQlNTE','relativePath','\x20error(s)','63OnrPAE','Status:\x20','population','utf-8','description','Pull\x20composable\x20audience\x20to\x20YAML\x20files','4054221dOZkjc','993562ULoaUX','audienceDrift','column','hasErrors','count','No\x20composable\x20audience\x20specified.','folders','No\x20composable\x20audiences\x20found.','Write\x20files?','Aborted.','created','\x22\x20→\x20\x22','diff','schema','segments','toId','composableAudience','rows','audienceName','cas:pull','counts','Resolving\x20connections...','\x20—\x20','Use\x20','data','warnings','Would\x20update:\x20','Found\x20','Directory\x20not\x20found:\x20','Not\x20found:\x20','error','\x0aSample\x20Rows\x20(','fromId','\x0aError:','8rYBQNp','audiences','\x20audience(s)','type','yes','cwd','Validate\x20composable\x20audience\x20YAML\x20files\x20locally','Audience:\x20','yellow','status','attributes','cas:push','length','All\x20files\x20are\x20up\x20to\x20date.','tdx\x20cas\x20desc\x20<name>','connection','tdx\x20cas\x20pull\x20<name>','\x20segment(s)','Fetching\x20composable\x20audiences...','tdx\x20use\x20cas\x20<name>','\x20(server\x20id\x20changed\x20','activations','Source:\x20\x20\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20—\x20a\x20real\x20push\x20will\x20refuse\x20unless\x20run\x20with\x20--delete.','delete','Fetching\x20audience\x20\x27','session','setPhase','cas:preview','\x20change(s)?','relative','\x20\x20Renamed\x20attribute:\x20\x22','underline','renamedAttributes','\x20activation(s)','\x0a⚠\x20On\x20server\x20but\x20not\x20in\x20this\x20YAML:\x20','\x20\x20Renamed\x20behavior:\x20\x22','dirname','result','\x20file(s)\x20to\x20','masterKeyColumn','get','495622zzZCgB','skippedCount','No\x20YAML\x20files\x20found\x20in:\x20','hasChanges','🧊\x20','\x20warning(s)','cas:desc','map','Count:\x20\x20','Preview\x20composable\x20segment\x20query\x20on\x20CDW','\x20(time:\x20','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20cas\x20validate`\x20to\x20check\x20files\x20locally.','invalidCount','\x20composable\x20audiences','Validation\x20failed:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','behavior(s)\x20','--audience\x20<name>','updated','\x20and\x20','cas','235194nEFucl','toLocaleString','source','names','removedBehaviors','verbose','\x20valid','cas:list','\x20or\x20set\x20context\x20with\x20','join','success','\x20(new)','\x20YAML\x20file(s)','execute','\x20folder(s)','dryRun','renamedBehaviorIds','481116KkEqqW','basename','\x20=\x20','table','tdx\x20cas\x20push\x20<path>'];a8_0xff90=function(){return _0xa5e858;};return a8_0xff90();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a8_0x489306 from'path';import{confirmKey,isInteractive}from'../utils/prompt.js';import{collectYamlFiles,buildConnectionMaps}from'../sdk/cas/push-workflow.js';import{validateCasYamlFiles,isCasValidationResult,calculateCasValidationSummary}from'../sdk/cas/validate-files.js';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';export class CASListCommand extends BaseCommand{[a8_0x30c9d4(0x137)]=a8_0x30c9d4(0x128);[a8_0x30c9d4(0x171)]=a8_0x30c9d4(0x146);async[a8_0x30c9d4(0x12e)](_0x41fcc6){const _0x42bacf=a8_0x30c9d4,{options:_0x1dc81e,tdx:_0x307709}=_0x41fcc6,_0x137c19=await withProgressSpinner(_0x42bacf(0xf3),()=>_0x307709[_0x42bacf(0x120)][_0x42bacf(0x14c)](),{'verbose':_0x1dc81e[_0x42bacf(0x126)]}),_0x1e20ef=_0x137c19[_0x42bacf(0xd7)];if(isStructuredFormat(_0x1dc81e))return await handleSDKOutput(_0x1e20ef,_0x1dc81e),0x0;if(_0x1e20ef[_0x42bacf(0xed)]===0x0)return console[_0x42bacf(0x152)](a8_0x48e2e8[_0x42bacf(0x148)](_0x42bacf(0xc6))),0x0;console[_0x42bacf(0x152)](a8_0x48e2e8[_0x42bacf(0x162)](_0x42bacf(0xda)+_0x1e20ef[_0x42bacf(0xed)]+_0x42bacf(0x119)));for(const _0x29ccfa of _0x1e20ef){const _0x22327d=_0x29ccfa['population']?a8_0x48e2e8[_0x42bacf(0x148)]('\x20('+Number(_0x29ccfa[_0x42bacf(0x16f)])[_0x42bacf(0x122)]()+')'):'',_0x50bc56=a8_0x48e2e8['dim']('\x20'+_0x29ccfa['masterSchema']+'.'+_0x29ccfa['masterTable']);console[_0x42bacf(0x152)](_0x42bacf(0x110)+_0x29ccfa[_0x42bacf(0x137)]+_0x22327d+_0x50bc56),_0x29ccfa[_0x42bacf(0x171)]&&console['log']('\x20\x20'+a8_0x48e2e8[_0x42bacf(0x148)](_0x29ccfa[_0x42bacf(0x171)]));}return 0x0;}}export class CASDescCommand extends BaseCommand{[a8_0x30c9d4(0x137)]=a8_0x30c9d4(0x112);[a8_0x30c9d4(0x171)]=a8_0x30c9d4(0x13a);async[a8_0x30c9d4(0x12e)](_0x187e39){const _0x5e68c4=a8_0x30c9d4,{options:_0x5ba006,args:_0x37ae97,tdx:_0x3d026e}=_0x187e39,_0x457a85=_0x37ae97[0x0]||_0x5ba006[_0x5e68c4(0xcf)];if(!_0x457a85)return console[_0x5e68c4(0xdd)](a8_0x48e2e8[_0x5e68c4(0xe9)](_0x5e68c4(0xc4))),console[_0x5e68c4(0xdd)](_0x5e68c4(0xd6)+a8_0x48e2e8[_0x5e68c4(0x14e)](_0x5e68c4(0xef))+_0x5e68c4(0x129)+a8_0x48e2e8[_0x5e68c4(0x14e)](_0x5e68c4(0xf4))),0x1;const _0x8f6e37=await withProgressSpinner(_0x5e68c4(0xfb)+_0x457a85+_0x5e68c4(0x142),()=>_0x3d026e[_0x5e68c4(0x120)][_0x5e68c4(0x10b)](_0x457a85),{'verbose':_0x5ba006[_0x5e68c4(0x126)]}),_0x2a2413=_0x8f6e37[_0x5e68c4(0xd7)];if(isStructuredFormat(_0x5ba006))return await handleSingleObjectOutput(_0x2a2413,_0x5ba006),0x0;console[_0x5e68c4(0x152)](a8_0x48e2e8['bold'](_0x2a2413[_0x5e68c4(0x137)]));if(_0x2a2413[_0x5e68c4(0x171)])console[_0x5e68c4(0x152)](a8_0x48e2e8['dim'](_0x2a2413['description']));console[_0x5e68c4(0x152)](),console['log'](a8_0x48e2e8['underline'](_0x5e68c4(0x141))),console['log'](_0x5e68c4(0x144)+_0x2a2413['masterSchema']),console[_0x5e68c4(0x152)](_0x5e68c4(0x164)+_0x2a2413[_0x5e68c4(0x13b)]),console[_0x5e68c4(0x152)]('\x20\x20Key:\x20\x20\x20\x20'+_0x2a2413[_0x5e68c4(0x10a)]),console['log']();if(_0x2a2413[_0x5e68c4(0xeb)]?.[_0x5e68c4(0xed)]){console[_0x5e68c4(0x152)](a8_0x48e2e8[_0x5e68c4(0x102)]('Attributes\x20('+_0x2a2413[_0x5e68c4(0xeb)]['length']+')'));for(const _0x4a77ed of _0x2a2413[_0x5e68c4(0xeb)]){console[_0x5e68c4(0x152)]('\x20\x20'+a8_0x48e2e8[_0x5e68c4(0x160)](_0x4a77ed[_0x5e68c4(0x137)])+_0x5e68c4(0xd5)+_0x4a77ed[_0x5e68c4(0xcc)]+'.'+_0x4a77ed[_0x5e68c4(0x135)]+'.'+_0x4a77ed[_0x5e68c4(0x176)]+'\x20('+a8_0x48e2e8[_0x5e68c4(0x148)](_0x4a77ed[_0x5e68c4(0xe4)])+')');}console[_0x5e68c4(0x152)]();}if(_0x2a2413[_0x5e68c4(0x165)]?.[_0x5e68c4(0xed)]){console['log'](a8_0x48e2e8[_0x5e68c4(0x102)]('Behaviors\x20('+_0x2a2413['behaviors'][_0x5e68c4(0xed)]+')'));for(const _0x5a8dd9 of _0x2a2413[_0x5e68c4(0x165)]){const _0x538e26=_0x5a8dd9[_0x5e68c4(0x143)]?_0x5e68c4(0x116)+_0x5a8dd9[_0x5e68c4(0x143)]+')':'';console[_0x5e68c4(0x152)]('\x20\x20'+a8_0x48e2e8[_0x5e68c4(0x160)](_0x5a8dd9[_0x5e68c4(0x137)])+_0x5e68c4(0xd5)+_0x5a8dd9['schema']+'.'+_0x5a8dd9[_0x5e68c4(0x135)]+_0x538e26);}}return 0x0;}}export class CASPullCommand extends BaseCommand{[a8_0x30c9d4(0x137)]=a8_0x30c9d4(0xd2);['description']=a8_0x30c9d4(0x172);async['execute'](_0x1011f2){const _0x31991f=a8_0x30c9d4,{options:_0x2541fe,args:_0x1e9317,tdx:_0x2988a2}=_0x1011f2,_0x167880=_0x2541fe,_0x31bbb3=_0x1e9317[0x0]||_0x2541fe[_0x31991f(0xcf)];if(!_0x31bbb3)return console['error'](a8_0x48e2e8[_0x31991f(0xe9)](_0x31991f(0xc4))),console['error'](_0x31991f(0xd6)+a8_0x48e2e8[_0x31991f(0x14e)](_0x31991f(0xf1))+_0x31991f(0x129)+a8_0x48e2e8[_0x31991f(0x14e)](_0x31991f(0xf4))),0x1;const _0x167115=_0x167880[_0x31991f(0x15c)]||a8_0x489306['join'](process[_0x31991f(0xe6)](),_0x31991f(0x120),sanitizeFileName(_0x31bbb3)),_0x2f293e=await withProgressSpinner('Pulling\x20composable\x20audience\x20\x27'+_0x31bbb3+_0x31991f(0x142),_0x59c502=>_0x2988a2['cas']['pull'](_0x31bbb3,{'targetDir':_0x167115,'verbose':_0x167880[_0x31991f(0x126)],'progress':{'update':_0x450d7a=>_0x59c502[_0x31991f(0xfd)](_0x450d7a)}}),{'verbose':_0x167880['verbose']}),_0x59f104=_0x2f293e[_0x31991f(0xd7)],_0x5b7d00=_0x59f104['files']['filter'](_0x44a27b=>_0x44a27b[_0x31991f(0x14f)]||_0x44a27b[_0x31991f(0x10f)]);saveSessionContext({'composable_audience':_0x59f104[_0x31991f(0xd1)]},_0x167880[_0x31991f(0xfc)]),console['log'](a8_0x48e2e8[_0x31991f(0x162)](_0x31991f(0x157)+a8_0x48e2e8[_0x31991f(0x148)](_0x31991f(0x167))+_0x31991f(0x134)+a8_0x48e2e8[_0x31991f(0x14e)](_0x59f104['audienceName'])));if(_0x5b7d00[_0x31991f(0xed)]===0x0)return console[_0x31991f(0x152)](a8_0x48e2e8['green'](_0x31991f(0xee))),0x0;for(const _0x1cb526 of _0x5b7d00){if(_0x1cb526[_0x31991f(0x14f)])console['log'](a8_0x48e2e8[_0x31991f(0x162)]('+\x20'+_0x1cb526['relativePath']+_0x31991f(0x12c)));else _0x1cb526[_0x31991f(0xcb)]&&(console['log'](a8_0x48e2e8['yellow']('~\x20'+_0x1cb526['relativePath'])),console[_0x31991f(0x152)](_0x1cb526[_0x31991f(0xcb)]));}console[_0x31991f(0x152)]('\x0a'+_0x5b7d00[_0x31991f(0xed)]+'\x20file(s)\x20to\x20write\x20'+('('+_0x59f104[_0x31991f(0xd3)][_0x31991f(0xcd)]+'\x20segments,\x20'+_0x59f104[_0x31991f(0xd3)][_0x31991f(0xf6)]+_0x31991f(0x138)));if(_0x167880[_0x31991f(0x130)])return console[_0x31991f(0x152)](a8_0x48e2e8[_0x31991f(0x148)]('(dry\x20run\x20—\x20no\x20files\x20written)')),0x0;if(!_0x167880[_0x31991f(0xe5)]&&isInteractive()){const _0x2f6736=await confirmKey(_0x31991f(0xc7));if(!_0x2f6736)return console['log'](a8_0x48e2e8[_0x31991f(0x148)]('Cancelled.')),0x0;}for(const _0xfe354c of _0x5b7d00){const _0x2057d0=a8_0x489306[_0x31991f(0x107)](_0xfe354c[_0x31991f(0x154)]);if(!existsSync(_0x2057d0))mkdirSync(_0x2057d0,{'recursive':!![]});writeFileSync(_0xfe354c[_0x31991f(0x154)],_0xfe354c['content'],_0x31991f(0x170));}return console[_0x31991f(0x152)](a8_0x48e2e8[_0x31991f(0x162)]('Wrote\x20'+_0x5b7d00[_0x31991f(0xed)]+_0x31991f(0x109)+_0x167115)),0x0;}}export class CASPushCommand extends BaseCommand{['name']=a8_0x30c9d4(0xec);[a8_0x30c9d4(0x171)]=a8_0x30c9d4(0x140);async[a8_0x30c9d4(0x12e)](_0x415645){const _0x4c43c0=a8_0x30c9d4,{options:_0x1da627,args:_0x2f1c59,tdx:_0x49a74d}=_0x415645,_0x5d587b=_0x1da627;let _0x3d1ea1=_0x2f1c59[0x0];!_0x3d1ea1&&_0x1da627[_0x4c43c0(0xcf)]&&(_0x3d1ea1=a8_0x489306[_0x4c43c0(0x12a)](process['cwd'](),_0x4c43c0(0x120),sanitizeFileName(_0x1da627[_0x4c43c0(0xcf)])));if(!_0x3d1ea1)return console[_0x4c43c0(0xdd)](a8_0x48e2e8[_0x4c43c0(0xe9)](_0x4c43c0(0xc4))),console[_0x4c43c0(0xdd)](_0x4c43c0(0xd6)+a8_0x48e2e8[_0x4c43c0(0x14e)](_0x4c43c0(0x136))+_0x4c43c0(0x129)+a8_0x48e2e8[_0x4c43c0(0x14e)](_0x4c43c0(0xf4))),0x1;if(!existsSync(_0x3d1ea1))return console[_0x4c43c0(0xdd)](a8_0x48e2e8[_0x4c43c0(0x161)](_0x4c43c0(0xdb)+_0x3d1ea1)),console[_0x4c43c0(0xdd)](a8_0x48e2e8[_0x4c43c0(0x148)]('Tip:\x20Run\x20`tdx\x20cas\x20pull\x20<name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;const _0x42e8a0=_0x1da627[_0x4c43c0(0xcf)]||a8_0x489306[_0x4c43c0(0x133)](_0x3d1ea1),_0x3cb3e0=a8_0x489306[_0x4c43c0(0x100)](process[_0x4c43c0(0xe6)](),_0x3d1ea1)||'.';console[_0x4c43c0(0x152)](_0x4c43c0(0xe8)+a8_0x48e2e8['cyan'](_0x42e8a0)),console[_0x4c43c0(0x152)](_0x4c43c0(0xf7)+a8_0x48e2e8[_0x4c43c0(0x148)](_0x3cb3e0)),console[_0x4c43c0(0x152)]();const _0x3cf111=collectYamlFiles(_0x3d1ea1);if(_0x3cf111['length']===0x0)return console[_0x4c43c0(0xdd)](a8_0x48e2e8[_0x4c43c0(0x161)](_0x4c43c0(0x10e)+_0x3d1ea1)),0x1;console[_0x4c43c0(0x152)](_0x4c43c0(0xda)+_0x3cf111[_0x4c43c0(0xed)]+_0x4c43c0(0x12d));const _0x336e74=await withProgressSpinner(_0x4c43c0(0xd4),()=>buildConnectionMaps(_0x49a74d[_0x4c43c0(0xf0)]),{'verbose':_0x5d587b[_0x4c43c0(0x126)]}),_0x214001=_0x336e74[_0x4c43c0(0xd7)],{nameToId:_0x4f1e58,nameToType:_0x44908d,idToType:_0x15f751}=_0x214001,_0x47e84c=validateCasYamlFiles(_0x3cf111,_0x3d1ea1,{'connectionNameToType':_0x44908d,'connectionIdToType':_0x15f751,'connectionNameToId':_0x4f1e58}),_0x7d3497=calculateCasValidationSummary(_0x47e84c);if(_0x7d3497[_0x4c43c0(0xc2)]){console[_0x4c43c0(0xdd)](a8_0x48e2e8[_0x4c43c0(0x161)](_0x4c43c0(0x147)));for(const _0x534497 of _0x47e84c){isCasValidationResult(_0x534497)&&!_0x534497['result'][_0x4c43c0(0x156)]&&(console['error']('\x0a'+_0x534497[_0x4c43c0(0x16b)]+':\x20'+_0x534497[_0x4c43c0(0x108)][_0x4c43c0(0x139)][_0x4c43c0(0xed)]+'\x20error(s)'),console[_0x4c43c0(0xdd)](formatValidationResult(_0x534497['result'],_0x534497[_0x4c43c0(0x123)],_0x534497[_0x4c43c0(0x16b)])));}return console['error'](a8_0x48e2e8[_0x4c43c0(0xe9)](_0x4c43c0(0x117))),0x1;}const _0xefd075=await withProgressSpinner('Analyzing\x20CAS\x20YAML\x20files...',_0x469333=>_0x49a74d[_0x4c43c0(0x120)][_0x4c43c0(0x15b)](_0x3cf111,{'dryRun':!![],'verbose':_0x5d587b[_0x4c43c0(0x126)],'deleteDrift':_0x5d587b[_0x4c43c0(0xfa)],'connectionMaps':_0x214001,'progress':{'update':_0x1780a3=>_0x469333[_0x4c43c0(0xfd)](_0x1780a3)}}),{'verbose':_0x5d587b[_0x4c43c0(0x126)]}),_0x4eaa2b=_0xefd075[_0x4c43c0(0xd7)],_0x3ccf3c=(_0x5a9f09,_0x1c47fa)=>{const _0x125ebc=_0x4c43c0,_0x2a1193=_0x5a9f09[_0x1c47fa],_0x307c0e=[];if(_0x2a1193['audiences'])_0x307c0e['push'](_0x2a1193[_0x125ebc(0xe2)]+_0x125ebc(0xe3));if(_0x2a1193['folders'])_0x307c0e[_0x125ebc(0x15b)](_0x2a1193[_0x125ebc(0xc5)]+_0x125ebc(0x12f));if(_0x2a1193[_0x125ebc(0xcd)])_0x307c0e[_0x125ebc(0x15b)](_0x2a1193['segments']+_0x125ebc(0xf2));if(_0x2a1193[_0x125ebc(0xf6)])_0x307c0e['push'](_0x2a1193['activations']+_0x125ebc(0x104));return _0x307c0e;},_0x4a9820=_0x3ccf3c(_0x4eaa2b,_0x4c43c0(0xc9)),_0x1f6a58=_0x3ccf3c(_0x4eaa2b,_0x4c43c0(0x11e)),_0x5832ff=_0x4eaa2b['created'][_0x4c43c0(0xe2)]+_0x4eaa2b[_0x4c43c0(0xc9)][_0x4c43c0(0xc5)]+_0x4eaa2b[_0x4c43c0(0xc9)][_0x4c43c0(0xcd)]+_0x4eaa2b['created'][_0x4c43c0(0xf6)]+_0x4eaa2b[_0x4c43c0(0x11e)][_0x4c43c0(0xe2)]+_0x4eaa2b[_0x4c43c0(0x11e)]['folders']+_0x4eaa2b[_0x4c43c0(0x11e)][_0x4c43c0(0xcd)]+_0x4eaa2b['updated'][_0x4c43c0(0xf6)];if(_0x5832ff===0x0)return console[_0x4c43c0(0x152)](a8_0x48e2e8[_0x4c43c0(0x148)]('No\x20CAS\x20resources\x20found\x20in\x20YAML\x20files.')),0x0;if(_0x4a9820[_0x4c43c0(0xed)]>0x0)console[_0x4c43c0(0x152)]('Would\x20create:\x20'+_0x4a9820['join'](',\x20'));if(_0x1f6a58['length']>0x0)console[_0x4c43c0(0x152)](_0x4c43c0(0xd9)+_0x1f6a58[_0x4c43c0(0x12a)](',\x20'));const _0x28e9f4=_0x4eaa2b[_0x4c43c0(0x175)];if(_0x28e9f4&&(_0x28e9f4[_0x4c43c0(0x15f)][_0x4c43c0(0xed)]||_0x28e9f4[_0x4c43c0(0x125)]['length'])){const _0x1d789f=[];_0x28e9f4[_0x4c43c0(0x15f)][_0x4c43c0(0xed)]&&_0x1d789f[_0x4c43c0(0x15b)](_0x4c43c0(0x145)+_0x28e9f4[_0x4c43c0(0x15f)]['join'](',\x20')),_0x28e9f4[_0x4c43c0(0x125)][_0x4c43c0(0xed)]&&_0x1d789f[_0x4c43c0(0x15b)]('behavior(s)\x20'+_0x28e9f4[_0x4c43c0(0x125)][_0x4c43c0(0x12a)](',\x20')),console[_0x4c43c0(0x152)](a8_0x48e2e8[_0x4c43c0(0x161)](_0x4c43c0(0x105)+_0x1d789f[_0x4c43c0(0x12a)](_0x4c43c0(0x11f))+_0x4c43c0(0xf9)));}if(_0x28e9f4&&(_0x28e9f4['renamedAttributes'][_0x4c43c0(0xed)]||_0x28e9f4['renamedBehaviors']['length'])){for(const _0xc87258 of _0x28e9f4[_0x4c43c0(0x103)]){console[_0x4c43c0(0x152)](a8_0x48e2e8['yellow'](_0x4c43c0(0x166)+_0xc87258[_0x4c43c0(0x14d)]+_0x4c43c0(0xca)+_0xc87258['to']+'\x22'));}for(const _0x11848a of _0x28e9f4['renamedBehaviors']){console[_0x4c43c0(0x152)](a8_0x48e2e8[_0x4c43c0(0xe9)](_0x4c43c0(0x158)+_0x11848a[_0x4c43c0(0x14d)]+_0x4c43c0(0xca)+_0x11848a['to']+'\x22'));}console[_0x4c43c0(0x152)](a8_0x48e2e8[_0x4c43c0(0x148)](_0x4c43c0(0x14b)));}if(_0x5d587b[_0x4c43c0(0x130)])return console[_0x4c43c0(0x152)](a8_0x48e2e8[_0x4c43c0(0xe9)](_0x4c43c0(0xf8))),0x0;if(!_0x5d587b[_0x4c43c0(0xe5)]){if(!isInteractive())return console['error'](a8_0x48e2e8['red'](_0x4c43c0(0xe0)),_0x4c43c0(0x13c)),console['error'](a8_0x48e2e8[_0x4c43c0(0x148)](_0x4c43c0(0x11b))),0x1;const _0xc0b8dc=await confirmKey('\x0aPush\x20'+_0x5832ff+_0x4c43c0(0xff));if(!_0xc0b8dc)return console['log'](a8_0x48e2e8[_0x4c43c0(0xe9)](_0x4c43c0(0xc8))),0x1;}const _0x17144e=await withProgressSpinner(_0x4c43c0(0x169),_0x4f54f6=>_0x49a74d['cas'][_0x4c43c0(0x15b)](_0x3cf111,{'dryRun':![],'verbose':_0x5d587b[_0x4c43c0(0x126)],'deleteDrift':_0x5d587b[_0x4c43c0(0xfa)],'progress':{'update':_0x5b3fbb=>_0x4f54f6[_0x4c43c0(0xfd)](_0x5b3fbb)}}),{'verbose':_0x5d587b['verbose']}),_0x2315ab=_0x17144e[_0x4c43c0(0xd7)];console[_0x4c43c0(0x152)](a8_0x48e2e8[_0x4c43c0(0x162)](_0x4c43c0(0x14a)));_0x2315ab['audienceName']&&console[_0x4c43c0(0x152)]('\x20\x20Audience:\x20'+a8_0x48e2e8[_0x4c43c0(0x14e)](_0x2315ab[_0x4c43c0(0xd1)]));const _0x1695dc=_0x3ccf3c(_0x2315ab,_0x4c43c0(0xc9)),_0x513657=_0x3ccf3c(_0x2315ab,_0x4c43c0(0x11e));if(_0x1695dc['length']>0x0)console['log'](_0x4c43c0(0x155)+_0x1695dc[_0x4c43c0(0x12a)](',\x20'));if(_0x513657['length']>0x0)console[_0x4c43c0(0x152)](_0x4c43c0(0x151)+_0x513657[_0x4c43c0(0x12a)](',\x20'));const _0x402739=_0x2315ab[_0x4c43c0(0x175)];if(_0x402739&&(_0x402739['removedAttributes'][_0x4c43c0(0xed)]||_0x402739[_0x4c43c0(0x125)]['length'])){const _0x4ef2db=[];_0x402739['removedAttributes'][_0x4c43c0(0xed)]&&_0x4ef2db[_0x4c43c0(0x15b)](_0x4c43c0(0x145)+_0x402739[_0x4c43c0(0x15f)]['join'](',\x20')),_0x402739[_0x4c43c0(0x125)][_0x4c43c0(0xed)]&&_0x4ef2db[_0x4c43c0(0x15b)](_0x4c43c0(0x11c)+_0x402739[_0x4c43c0(0x125)][_0x4c43c0(0x12a)](',\x20')),console['log'](a8_0x48e2e8[_0x4c43c0(0x161)]('\x20\x20Removed\x20(--delete):\x20'+_0x4ef2db[_0x4c43c0(0x12a)](_0x4c43c0(0x11f))));}for(const _0x48d517 of _0x2315ab[_0x4c43c0(0x13f)]??[]){console['log'](a8_0x48e2e8[_0x4c43c0(0xe9)](_0x4c43c0(0x101)+_0x48d517[_0x4c43c0(0x14d)]+'\x22\x20→\x20\x22'+_0x48d517['to']+'\x22'+(_0x48d517[_0x4c43c0(0xdf)]&&_0x48d517[_0x4c43c0(0xce)]?_0x4c43c0(0xf5)+_0x48d517[_0x4c43c0(0xdf)]+_0x4c43c0(0x15d)+_0x48d517['toId']+')':'')));}for(const _0x4193d2 of _0x2315ab[_0x4c43c0(0x131)]??[]){console['log'](a8_0x48e2e8['yellow'](_0x4c43c0(0x106)+_0x4193d2[_0x4c43c0(0x14d)]+_0x4c43c0(0xca)+_0x4193d2['to']+'\x22'+(_0x4193d2[_0x4c43c0(0xdf)]&&_0x4193d2[_0x4c43c0(0xce)]?_0x4c43c0(0xf5)+_0x4193d2[_0x4c43c0(0xdf)]+_0x4c43c0(0x15d)+_0x4193d2[_0x4c43c0(0xce)]+')':'')));}return 0x0;}}export class CASValidateCommand extends BaseCommand{[a8_0x30c9d4(0x137)]=a8_0x30c9d4(0x150);[a8_0x30c9d4(0x171)]=a8_0x30c9d4(0xe7);async[a8_0x30c9d4(0x12e)](_0x3e3c24){const _0x3846cf=a8_0x30c9d4,{options:_0x4d75ed,args:_0x8480bd,tdx:_0x2b25ea}=_0x3e3c24,_0xe61188=_0x4d75ed;let _0x22e4c7=_0x8480bd[0x0];!_0x22e4c7&&_0x4d75ed[_0x3846cf(0xcf)]&&(_0x22e4c7=a8_0x489306[_0x3846cf(0x12a)](process[_0x3846cf(0xe6)](),'cas',sanitizeFileName(_0x4d75ed[_0x3846cf(0xcf)])));if(!_0x22e4c7)return console[_0x3846cf(0xdd)](a8_0x48e2e8[_0x3846cf(0xe9)](_0x3846cf(0xc4))),console['error'](_0x3846cf(0xd6)+a8_0x48e2e8[_0x3846cf(0x14e)](_0x3846cf(0x163))+_0x3846cf(0x129)+a8_0x48e2e8['cyan'](_0x3846cf(0xf4))),0x1;if(!existsSync(_0x22e4c7))return console[_0x3846cf(0xdd)](a8_0x48e2e8[_0x3846cf(0x161)](_0x3846cf(0xdc)+_0x22e4c7)),0x1;const _0x326747=collectYamlFiles(_0x22e4c7);if(_0x326747[_0x3846cf(0xed)]===0x0)return console[_0x3846cf(0xdd)](a8_0x48e2e8['red'](_0x3846cf(0x10e)+_0x22e4c7)),0x1;const _0x104d9c=await withProgressSpinner(_0x3846cf(0xd4),()=>buildConnectionMaps(_0x2b25ea['connection']),{'verbose':_0xe61188[_0x3846cf(0x126)]}),{nameToId:_0x29d7f7,nameToType:_0xd9cb27,idToType:_0x425c00}=_0x104d9c[_0x3846cf(0xd7)],_0x50124a=validateCasYamlFiles(_0x326747,_0x22e4c7,{'connectionNameToType':_0xd9cb27,'connectionIdToType':_0x425c00,'connectionNameToId':_0x29d7f7}),_0x50f84c=calculateCasValidationSummary(_0x50124a);for(const _0x5e1055 of _0x50124a){if(!isCasValidationResult(_0x5e1055)){_0xe61188[_0x3846cf(0x126)]&&console['log'](a8_0x48e2e8['dim']('⊘\x20'+_0x5e1055[_0x3846cf(0x16b)]+':\x20skipped\x20('+_0x5e1055['reason']+')'));continue;}if(_0x5e1055[_0x3846cf(0x108)][_0x3846cf(0x156)]&&_0x5e1055['result'][_0x3846cf(0xd8)][_0x3846cf(0xed)]===0x0)_0xe61188['verbose']&&console[_0x3846cf(0x152)](a8_0x48e2e8[_0x3846cf(0x162)]('✔\x20'+_0x5e1055[_0x3846cf(0x16b)]));else _0x5e1055[_0x3846cf(0x108)][_0x3846cf(0x156)]?(console[_0x3846cf(0x152)](a8_0x48e2e8[_0x3846cf(0xe9)]('⚠\x20'+_0x5e1055['relativePath'])+a8_0x48e2e8[_0x3846cf(0x148)](':\x20'+_0x5e1055[_0x3846cf(0x108)][_0x3846cf(0xd8)][_0x3846cf(0xed)]+_0x3846cf(0x111))),console[_0x3846cf(0x152)](formatValidationResult(_0x5e1055['result'],_0x5e1055[_0x3846cf(0x123)],_0x5e1055[_0x3846cf(0x16b)]))):(console[_0x3846cf(0x152)](a8_0x48e2e8[_0x3846cf(0x161)]('✖\x20'+_0x5e1055[_0x3846cf(0x16b)])+a8_0x48e2e8['dim'](':\x20'+_0x5e1055[_0x3846cf(0x108)][_0x3846cf(0x139)][_0x3846cf(0xed)]+_0x3846cf(0x16c))),console[_0x3846cf(0x152)](formatValidationResult(_0x5e1055[_0x3846cf(0x108)],_0x5e1055[_0x3846cf(0x123)],_0x5e1055[_0x3846cf(0x16b)])));}console[_0x3846cf(0x152)]('');if(_0x50f84c[_0x3846cf(0xc2)])return console[_0x3846cf(0x152)](a8_0x48e2e8['red'](_0x3846cf(0x11a)+_0x50f84c[_0x3846cf(0x118)]+_0x3846cf(0x13e)+_0x50f84c['validCount']+_0x3846cf(0x127))),_0x50f84c['warningCount']>0x0&&console[_0x3846cf(0x152)](a8_0x48e2e8[_0x3846cf(0xe9)](_0x50f84c[_0x3846cf(0x15a)]+_0x3846cf(0x159))),0x1;return console[_0x3846cf(0x152)](a8_0x48e2e8[_0x3846cf(0x162)]('✔\x20All\x20'+_0x50f84c['validCount']+_0x3846cf(0x153))),_0x50f84c['warningCount']>0x0&&console[_0x3846cf(0x152)](a8_0x48e2e8['yellow'](_0x50f84c['warningCount']+_0x3846cf(0x159))),_0x50f84c['skippedCount']>0x0&&console['log'](a8_0x48e2e8[_0x3846cf(0x148)](_0x50f84c[_0x3846cf(0x10d)]+_0x3846cf(0x15e))),0x0;}}export class CASPreviewCommand extends BaseCommand{[a8_0x30c9d4(0x137)]=a8_0x30c9d4(0xfe);[a8_0x30c9d4(0x171)]=a8_0x30c9d4(0x115);async[a8_0x30c9d4(0x12e)](_0x44c8f9){const _0x2103e6=a8_0x30c9d4,{options:_0x167ac5,args:_0x463236,tdx:_0x5d652c}=_0x44c8f9,_0x520a3c=_0x463236[0x0],_0x2dda61=_0x463236[0x1]||_0x167ac5[_0x2103e6(0xcf)];if(!_0x520a3c)return console['error'](a8_0x48e2e8['red']('Usage:\x20tdx\x20cas\x20preview\x20<segment_name>\x20[--audience\x20<name>]')),0x1;if(!_0x2dda61)return console[_0x2103e6(0xdd)](a8_0x48e2e8[_0x2103e6(0xe9)]('Audience\x20name\x20required.')),console['error'](_0x2103e6(0xd6)+a8_0x48e2e8['cyan'](_0x2103e6(0x11d))+_0x2103e6(0x129)+a8_0x48e2e8[_0x2103e6(0x14e)](_0x2103e6(0xf4))),0x1;const _0x427842=await withProgressSpinner('Running\x20preview\x20for\x20\x27'+_0x520a3c+_0x2103e6(0x142),()=>_0x5d652c['cas'][_0x2103e6(0x13d)](_0x2dda61,_0x520a3c),{'verbose':_0x167ac5[_0x2103e6(0x126)]}),{query:_0x505a1c,customers:_0x289466}=_0x427842[_0x2103e6(0xd7)];if(isStructuredFormat(_0x167ac5))return await handleSingleObjectOutput({'query':_0x505a1c,'customers':_0x289466},_0x167ac5),0x0;const _0x3b608b=_0x505a1c[_0x2103e6(0xea)]===_0x2103e6(0x12b)?a8_0x48e2e8['green']:a8_0x48e2e8[_0x2103e6(0xe9)];console[_0x2103e6(0x152)](_0x2103e6(0x16e)+_0x3b608b(_0x505a1c[_0x2103e6(0xea)])),console[_0x2103e6(0x152)](_0x2103e6(0x114)+a8_0x48e2e8[_0x2103e6(0x160)](String(_0x505a1c[_0x2103e6(0xc3)])));_0x505a1c[_0x2103e6(0xdd)]&&console[_0x2103e6(0x152)]('Error:\x20\x20'+a8_0x48e2e8[_0x2103e6(0x161)](_0x505a1c[_0x2103e6(0xdd)]));if(_0x289466?.[_0x2103e6(0x124)]&&_0x289466?.[_0x2103e6(0xd0)]){console[_0x2103e6(0x152)](a8_0x48e2e8[_0x2103e6(0x102)](_0x2103e6(0xde)+_0x289466[_0x2103e6(0xd0)][_0x2103e6(0xed)]+')'));const _0x110c0a=_0x289466[_0x2103e6(0xd0)][_0x2103e6(0x113)](_0x52000f=>{const _0x5e7305=_0x2103e6,_0x5269a8={};for(let _0x29c195=0x0;_0x29c195<_0x289466[_0x5e7305(0x124)][_0x5e7305(0xed)];_0x29c195++){_0x5269a8[_0x289466[_0x5e7305(0x124)][_0x29c195]]=_0x52000f[_0x29c195];}return _0x5269a8;});await handleSDKOutput(_0x110c0a,_0x167ac5);}return 0x0;}}
@@ -1 +1 @@
1
- const a9_0x5eb52b=a9_0xb683;(function(_0x491c27,_0x4915ab){const _0x48f77f=a9_0xb683,_0x1f6ea1=_0x491c27();while(!![]){try{const _0x57e9d0=parseInt(_0x48f77f(0x153))/0x1*(-parseInt(_0x48f77f(0x18c))/0x2)+-parseInt(_0x48f77f(0x142))/0x3*(-parseInt(_0x48f77f(0x181))/0x4)+parseInt(_0x48f77f(0x145))/0x5*(-parseInt(_0x48f77f(0x169))/0x6)+parseInt(_0x48f77f(0x180))/0x7*(-parseInt(_0x48f77f(0x162))/0x8)+parseInt(_0x48f77f(0x186))/0x9+parseInt(_0x48f77f(0x14e))/0xa+parseInt(_0x48f77f(0x16a))/0xb;if(_0x57e9d0===_0x4915ab)break;else _0x1f6ea1['push'](_0x1f6ea1['shift']());}catch(_0x426c10){_0x1f6ea1['push'](_0x1f6ea1['shift']());}}}(a9_0x118f,0xe1727));function a9_0x118f(){const _0x35e3dd=['name','Fetching\x20segments\x20for\x20\x27','length','resolveAudienceId','description','cwd','population','parse','Deleting\x20segment\x20\x27','File\x20not\x20found:\x20','verbose','\x20segment','388234eKkzPT','4nKjQkE','Create','\x0aDelete\x20segment\x20\x22','setPhase','\x20from\x20audience\x20','5262093EaVGwK','cyan','log','connection','Bulk/directory\x20delete\x20is\x20not\x20supported\x20yet.','\x20is\x20a\x20directory\x20—\x20tdx\x20cas\x20sg\x20push\x20takes\x20a\x20single\x20file.','1506112UrOOzM','Create\x20or\x20update\x20a\x20single\x20composable\x20child\x20segment','basename','relative','push','\x20\x20Audience:\x20','delete','data','Resolving\x20connections...','Would\x20','Usage:\x20tdx\x20cas\x20sg\x20list\x20<audience_name>','cas','\x20as\x20YAML:\x20','Use\x20`tdx\x20cas\x20push\x20<dir>`\x20to\x20push\x20multiple\x20files\x20at\x20once.','red','2499909KkpyPX','Usage:\x20tdx\x20cas\x20sg\x20push\x20<segment.yml>\x20[--audience\x20<name>]','yes','6245oLSBcn','yellow','updated','dim','Audience\x20name\x20required.','Nothing\x20to\x20delete.','\x0a✔\x20Segment\x20deleted','green','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','15448750wuDwHY','dryRun','\x20this\x20segment?','Aborted.','error','1FOKpTY','Use\x20','cas:sg:push','\x27...','find','isDirectory','created','Audience:\x20','Source:\x20\x20\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20doesn\x27t\x20look\x20like\x20a\x20composable\x20segment.','segments','\x22\x20from\x20audience\x20\x22','audience','\x20or\x20set\x20context\x20with\x20','168XMfnly','composableAudience','execute','Composable\x20segment\x20YAML\x20requires\x20`type:\x20composable_segment`\x20at\x20the\x20top\x20level.','Or\x20set\x20context:\x20tdx\x20use\x20cas\x20<audience_name>','\x22\x20not\x20found\x20under\x20audience\x20\x22','\x0aError:','3564jWtTvO','6822640JwViAb','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Pushing\x20segment\x20to\x20\x27','Composable\x20segment\x20\x22','listSegments','\x20segment\x20in\x20audience\x20','List\x20composable\x20segments\x20for\x20an\x20audience','executeDelete','\x20\x20Segment:\x20\x20','Would\x20delete\x20segment\x20'];a9_0x118f=function(){return _0x35e3dd;};return a9_0x118f();}import a9_0x296ec0 from'path';import{existsSync,readFileSync,statSync}from'fs';import*as a9_0x266a82 from'yaml';import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import{formatRows}from'../sdk/util/formatters.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a9_0xb683(_0xdae64e,_0x2f1743){_0xdae64e=_0xdae64e-0x136;const _0x118f09=a9_0x118f();let _0xb68332=_0x118f09[_0xdae64e];return _0xb68332;}import{buildConnectionMaps}from'../sdk/cas/push-workflow.js';import{isComposableSegmentDef}from'../sdk/cas/cas-segment-yaml.js';import a9_0x148b41 from'chalk';export class CASSegmentListCommand extends BaseCommand{[a9_0x5eb52b(0x174)]='cas:sg:list';[a9_0x5eb52b(0x178)]=a9_0x5eb52b(0x170);async[a9_0x5eb52b(0x164)](_0x5d439b){const _0x244a0a=a9_0x5eb52b,{options:_0x47a5b9,args:_0x28500e,tdx:_0xfaecb8}=_0x5d439b,_0x12f0df=_0x28500e[0x0]||_0x47a5b9[_0x244a0a(0x163)];if(!_0x12f0df)return console[_0x244a0a(0x152)](a9_0x148b41[_0x244a0a(0x141)](_0x244a0a(0x13d))),console[_0x244a0a(0x152)](a9_0x148b41[_0x244a0a(0x148)](_0x244a0a(0x166))),0x1;const _0x4a7e85=await withProgressSpinner('Fetching\x20segments\x20for\x20\x27'+_0x12f0df+_0x244a0a(0x156),()=>_0xfaecb8[_0x244a0a(0x13e)][_0x244a0a(0x16e)](_0x12f0df),{'verbose':_0x47a5b9[_0x244a0a(0x17e)]}),_0x7de3f4=_0x4a7e85[_0x244a0a(0x13a)];if(isStructuredFormat(_0x47a5b9))return await handleSDKOutput(_0x7de3f4,_0x47a5b9),0x0;console[_0x244a0a(0x188)](a9_0x148b41[_0x244a0a(0x14c)]('Found\x20'+_0x7de3f4[_0x244a0a(0x176)]+_0x244a0a(0x17f)+(_0x7de3f4[_0x244a0a(0x176)]!==0x1?'s':'')));if(_0x7de3f4[_0x244a0a(0x176)]===0x0)return 0x0;for(const _0x38d8e1 of _0x7de3f4){const _0x32c95e=_0x38d8e1[_0x244a0a(0x17a)]!=null?a9_0x148b41[_0x244a0a(0x148)]('\x20('+formatRows(_0x38d8e1[_0x244a0a(0x17a)])+')'):'';console[_0x244a0a(0x188)]('🎯\x20'+_0x38d8e1['name']+_0x32c95e),_0x38d8e1[_0x244a0a(0x178)]&&console['log']('\x20\x20'+a9_0x148b41[_0x244a0a(0x148)](_0x38d8e1[_0x244a0a(0x178)]));}return 0x0;}}export class CASSegmentPushCommand extends BaseCommand{[a9_0x5eb52b(0x174)]=a9_0x5eb52b(0x155);[a9_0x5eb52b(0x178)]=a9_0x5eb52b(0x18d);async['execute'](_0x4a9a05){const _0x4e9fff=a9_0x5eb52b,{options:_0x558bee,args:_0x5b8903,tdx:_0x313541}=_0x4a9a05,_0x1ae695=_0x558bee,_0x54d952=_0x5b8903[0x0];if(!_0x54d952)return console[_0x4e9fff(0x152)](a9_0x148b41['red'](_0x4e9fff(0x143))),0x1;if(!existsSync(_0x54d952))return console[_0x4e9fff(0x152)](a9_0x148b41[_0x4e9fff(0x141)](_0x4e9fff(0x17d)+_0x54d952)),0x1;if(statSync(_0x54d952)[_0x4e9fff(0x158)]())return console['error'](a9_0x148b41[_0x4e9fff(0x141)](_0x54d952+_0x4e9fff(0x18b))),_0x1ae695[_0x4e9fff(0x139)]?console['error'](a9_0x148b41['dim'](_0x4e9fff(0x18a))):console[_0x4e9fff(0x152)](a9_0x148b41['dim'](_0x4e9fff(0x140))),0x1;const _0x5eb9f7=_0x1ae695[_0x4e9fff(0x160)]||_0x558bee[_0x4e9fff(0x163)];if(!_0x5eb9f7)return console[_0x4e9fff(0x152)](a9_0x148b41[_0x4e9fff(0x146)](_0x4e9fff(0x149))),console[_0x4e9fff(0x152)](_0x4e9fff(0x154)+a9_0x148b41[_0x4e9fff(0x187)]('--audience\x20<name>')+_0x4e9fff(0x161)+a9_0x148b41[_0x4e9fff(0x187)]('tdx\x20use\x20cas\x20<name>')),0x1;console['log'](_0x4e9fff(0x15a)+a9_0x148b41[_0x4e9fff(0x187)](_0x5eb9f7)),console[_0x4e9fff(0x188)](_0x4e9fff(0x15b)+a9_0x148b41[_0x4e9fff(0x148)](a9_0x296ec0[_0x4e9fff(0x136)](process[_0x4e9fff(0x179)](),_0x54d952)||'.')),console['log']();let _0x352913;try{_0x352913=a9_0x266a82[_0x4e9fff(0x17b)](readFileSync(_0x54d952,'utf-8'));}catch(_0x71deb9){return console['error'](a9_0x148b41['red']('Failed\x20to\x20parse\x20'+a9_0x296ec0[_0x4e9fff(0x18e)](_0x54d952)+_0x4e9fff(0x13f)),_0x71deb9 instanceof Error?_0x71deb9['message']:String(_0x71deb9)),0x1;}if(!isComposableSegmentDef(_0x352913))return console[_0x4e9fff(0x152)](a9_0x148b41[_0x4e9fff(0x141)](a9_0x296ec0[_0x4e9fff(0x18e)](_0x54d952)+_0x4e9fff(0x15d))),console['error'](a9_0x148b41[_0x4e9fff(0x146)](_0x4e9fff(0x165))),0x1;if(_0x1ae695[_0x4e9fff(0x139)])return this[_0x4e9fff(0x171)](_0x4a9a05,_0x5eb9f7,_0x352913[_0x4e9fff(0x174)],_0x1ae695);const _0x15f664=await withProgressSpinner(_0x4e9fff(0x13b),()=>buildConnectionMaps(_0x313541[_0x4e9fff(0x189)]),{'verbose':_0x1ae695[_0x4e9fff(0x17e)]}),_0x78dc8d=_0x15f664['data'],_0xc84f51=await withProgressSpinner('Resolving\x20audience\x20\x27'+_0x5eb9f7+_0x4e9fff(0x156),()=>_0x313541[_0x4e9fff(0x13e)][_0x4e9fff(0x177)](_0x5eb9f7),{'verbose':_0x1ae695[_0x4e9fff(0x17e)]}),_0x4568cc=_0xc84f51[_0x4e9fff(0x13a)],_0x456bd2=await withProgressSpinner('Analyzing\x20segment\x20YAML...',_0x10631e=>_0x313541[_0x4e9fff(0x13e)][_0x4e9fff(0x137)]([_0x54d952],{'dryRun':!![],'verbose':_0x1ae695['verbose'],'resolvedAudienceId':_0x4568cc,'connectionMaps':_0x78dc8d,'progress':{'update':_0x45abb2=>_0x10631e[_0x4e9fff(0x184)](_0x45abb2)}}),{'verbose':_0x1ae695[_0x4e9fff(0x17e)]}),_0x49cc35=_0x456bd2[_0x4e9fff(0x13a)],_0x2ae546=_0x49cc35[_0x4e9fff(0x147)][_0x4e9fff(0x15e)]>0x0,_0x5e2269=_0x2ae546?'update':'create';console[_0x4e9fff(0x188)](_0x4e9fff(0x13c)+_0x5e2269+_0x4e9fff(0x16f)+a9_0x148b41['cyan'](_0x5eb9f7));if(_0x1ae695[_0x4e9fff(0x14f)])return console[_0x4e9fff(0x188)](a9_0x148b41[_0x4e9fff(0x146)](_0x4e9fff(0x15c))),0x0;if(!_0x1ae695[_0x4e9fff(0x144)]){if(!isInteractive())return console[_0x4e9fff(0x152)](a9_0x148b41[_0x4e9fff(0x141)](_0x4e9fff(0x168)),_0x4e9fff(0x14d)),console[_0x4e9fff(0x152)](a9_0x148b41[_0x4e9fff(0x148)](_0x4e9fff(0x16b))),0x1;const _0x3f02a5=await confirmKey('\x0a'+(_0x2ae546?'Update':_0x4e9fff(0x182))+_0x4e9fff(0x150));if(!_0x3f02a5)return console[_0x4e9fff(0x188)](a9_0x148b41[_0x4e9fff(0x146)](_0x4e9fff(0x151))),0x1;}const _0x5cd706=await withProgressSpinner(_0x4e9fff(0x16c)+_0x5eb9f7+_0x4e9fff(0x156),_0x4e5df0=>_0x313541[_0x4e9fff(0x13e)][_0x4e9fff(0x137)]([_0x54d952],{'dryRun':![],'verbose':_0x1ae695[_0x4e9fff(0x17e)],'resolvedAudienceId':_0x4568cc,'progress':{'update':_0x1d5818=>_0x4e5df0[_0x4e9fff(0x184)](_0x1d5818)}}),{'verbose':_0x1ae695[_0x4e9fff(0x17e)]}),_0xa01fec=_0x5cd706[_0x4e9fff(0x13a)],_0x2acb15=_0xa01fec[_0x4e9fff(0x159)][_0x4e9fff(0x15e)]>0x0;return console['log'](a9_0x148b41[_0x4e9fff(0x14c)]('\x0a✔\x20Segment\x20'+(_0x2acb15?'created':_0x4e9fff(0x147)))),console['log']('\x20\x20Audience:\x20'+a9_0x148b41[_0x4e9fff(0x187)](_0x5eb9f7)),0x0;}async['executeDelete'](_0x3d3d4b,_0x15b911,_0x1ae067,_0x17a1d6){const _0x24c0fa=a9_0x5eb52b,{tdx:_0x490968}=_0x3d3d4b,_0x2b95fc=await withProgressSpinner(_0x24c0fa(0x175)+_0x15b911+_0x24c0fa(0x156),()=>_0x490968['cas'][_0x24c0fa(0x16e)](_0x15b911),{'verbose':_0x17a1d6[_0x24c0fa(0x17e)]}),_0x516d8b=_0x2b95fc[_0x24c0fa(0x13a)][_0x24c0fa(0x157)](_0x2751d2=>_0x2751d2[_0x24c0fa(0x174)]===_0x1ae067);if(!_0x516d8b)return console[_0x24c0fa(0x152)](a9_0x148b41[_0x24c0fa(0x141)](_0x24c0fa(0x16d)+_0x1ae067+_0x24c0fa(0x167)+_0x15b911+'\x22.')),console[_0x24c0fa(0x152)](a9_0x148b41[_0x24c0fa(0x148)](_0x24c0fa(0x14a))),0x1;console[_0x24c0fa(0x188)](_0x24c0fa(0x173)+a9_0x148b41['red'](_0x1ae067)+_0x24c0fa(0x185)+a9_0x148b41[_0x24c0fa(0x187)](_0x15b911));if(_0x17a1d6['dryRun'])return console[_0x24c0fa(0x188)](a9_0x148b41[_0x24c0fa(0x146)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;if(!_0x17a1d6['yes']){if(!isInteractive())return console[_0x24c0fa(0x152)](a9_0x148b41[_0x24c0fa(0x141)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x24c0fa(0x152)](a9_0x148b41[_0x24c0fa(0x148)](_0x24c0fa(0x16b))),0x1;const _0x20e727=await confirmKey(_0x24c0fa(0x183)+_0x1ae067+_0x24c0fa(0x15f)+_0x15b911+'\x22?\x20This\x20cannot\x20be\x20undone.');if(!_0x20e727)return console[_0x24c0fa(0x188)](a9_0x148b41[_0x24c0fa(0x146)](_0x24c0fa(0x151))),0x1;}return await withProgressSpinner(_0x24c0fa(0x17c)+_0x1ae067+_0x24c0fa(0x156),()=>_0x490968[_0x24c0fa(0x13e)]['deleteSegmentById'](_0x516d8b['id']),{'verbose':_0x17a1d6[_0x24c0fa(0x17e)]}),console[_0x24c0fa(0x188)](a9_0x148b41['green'](_0x24c0fa(0x14b))),console[_0x24c0fa(0x188)](_0x24c0fa(0x172)+a9_0x148b41[_0x24c0fa(0x187)](_0x1ae067)),console[_0x24c0fa(0x188)](_0x24c0fa(0x138)+a9_0x148b41[_0x24c0fa(0x187)](_0x15b911)),0x0;}}
1
+ const a9_0x5714d1=a9_0x1a80;(function(_0x3e569e,_0x324dc9){const _0xf90565=a9_0x1a80,_0x1232d9=_0x3e569e();while(!![]){try{const _0x128d5=-parseInt(_0xf90565(0x1ba))/0x1*(parseInt(_0xf90565(0x1cb))/0x2)+-parseInt(_0xf90565(0x1d1))/0x3*(parseInt(_0xf90565(0x1cd))/0x4)+parseInt(_0xf90565(0x1a1))/0x5+parseInt(_0xf90565(0x1cc))/0x6+parseInt(_0xf90565(0x1c8))/0x7*(parseInt(_0xf90565(0x1bd))/0x8)+parseInt(_0xf90565(0x180))/0x9*(-parseInt(_0xf90565(0x19e))/0xa)+-parseInt(_0xf90565(0x1c2))/0xb*(-parseInt(_0xf90565(0x1b9))/0xc);if(_0x128d5===_0x324dc9)break;else _0x1232d9['push'](_0x1232d9['shift']());}catch(_0x3647cc){_0x1232d9['push'](_0x1232d9['shift']());}}}(a9_0x552d,0x1c2b8));import a9_0x265c27 from'path';import{existsSync,readFileSync,statSync}from'fs';import*as a9_0x346a0f from'yaml';import{BaseCommand}from'./command.js';function a9_0x552d(){const _0x18016f=['Found\x20','\x22?\x20This\x20cannot\x20be\x20undone.','Deleting\x20segment\x20\x27','\x20from\x20audience\x20','Usage:\x20tdx\x20cas\x20sg\x20push\x20<segment.yml>\x20[--audience\x20<name>]','tdx\x20use\x20cas\x20<name>','verbose','data','Would\x20delete\x20segment\x20','length','yellow','162NzVAkF','executeDelete','isDirectory','Use\x20','\x20segment','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','resolveAudienceId','Bulk/directory\x20delete\x20is\x20not\x20supported\x20yet.','dim','error','Usage:\x20tdx\x20cas\x20sg\x20list\x20<audience_name>','description','Fetching\x20segments\x20for\x20\x27','Composable\x20segment\x20YAML\x20requires\x20`type:\x20composable_segment`\x20at\x20the\x20top\x20level.','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Create\x20or\x20update\x20a\x20single\x20composable\x20child\x20segment','execute','log','Analyzing\x20segment\x20YAML...','Use\x20`tdx\x20cas\x20push\x20<dir>`\x20to\x20push\x20multiple\x20files\x20at\x20once.','cyan','updated','segments','Create','setPhase','\x20\x20Audience:\x20','\x22\x20from\x20audience\x20\x22','\x20is\x20a\x20directory\x20—\x20tdx\x20cas\x20sg\x20push\x20takes\x20a\x20single\x20file.','find','audience','13320AEPYVG','\x20\x20Segment:\x20\x20','\x20or\x20set\x20context\x20with\x20','800070bjDOGF','Would\x20','basename','List\x20composable\x20segments\x20for\x20an\x20audience','message','deleteSegmentById','connection','create','🎯\x20','\x0aError:','\x20segment\x20in\x20audience\x20','cas:sg:list','listSegments','Failed\x20to\x20parse\x20','green','\x20doesn\x27t\x20look\x20like\x20a\x20composable\x20segment.','delete','name','composableAudience','Source:\x20\x20\x20','Resolving\x20connections...','red','dryRun','Aborted.','4872PzoXsL','11437obzPQQ','cwd','cas','4208fGnKZq','population','File\x20not\x20found:\x20','Or\x20set\x20context:\x20tdx\x20use\x20cas\x20<audience_name>','push','4279FkwIJs','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Audience\x20name\x20required.','created','\x20as\x20YAML:\x20','--audience\x20<name>','308yVNoVf','cas:sg:push','\x22\x20not\x20found\x20under\x20audience\x20\x22','22FTnNlA','582576RbjMzw','692084KzBNuA','yes','\x0a✔\x20Segment\x20deleted','\x27...','3AfKPbh','relative','Composable\x20segment\x20\x22'];a9_0x552d=function(){return _0x18016f;};return a9_0x552d();}import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a9_0x1a80(_0xc4f2bd,_0x284c77){_0xc4f2bd=_0xc4f2bd-0x17a;const _0x552d17=a9_0x552d();let _0x1a8001=_0x552d17[_0xc4f2bd];return _0x1a8001;}import{formatRows}from'../sdk/util/formatters.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{buildConnectionMaps}from'../sdk/cas/push-workflow.js';import{isComposableSegmentDef}from'../sdk/cas/cas-segment-yaml.js';import a9_0x278818 from'chalk';export class CASSegmentListCommand extends BaseCommand{['name']=a9_0x5714d1(0x1ac);['description']=a9_0x5714d1(0x1a4);async[a9_0x5714d1(0x190)](_0x46c664){const _0x2584e8=a9_0x5714d1,{options:_0x7f82df,args:_0xf73535,tdx:_0x136f90}=_0x46c664,_0x49a096=_0xf73535[0x0]||_0x7f82df['composableAudience'];if(!_0x49a096)return console[_0x2584e8(0x189)](a9_0x278818[_0x2584e8(0x1b6)](_0x2584e8(0x18a))),console[_0x2584e8(0x189)](a9_0x278818[_0x2584e8(0x188)](_0x2584e8(0x1c0))),0x1;const _0x44abb0=await withProgressSpinner(_0x2584e8(0x18c)+_0x49a096+_0x2584e8(0x1d0),()=>_0x136f90['cas'][_0x2584e8(0x1ad)](_0x49a096),{'verbose':_0x7f82df['verbose']}),_0x8c53b4=_0x44abb0[_0x2584e8(0x17c)];if(isStructuredFormat(_0x7f82df))return await handleSDKOutput(_0x8c53b4,_0x7f82df),0x0;console[_0x2584e8(0x191)](a9_0x278818['green'](_0x2584e8(0x1d4)+_0x8c53b4[_0x2584e8(0x17e)]+_0x2584e8(0x184)+(_0x8c53b4[_0x2584e8(0x17e)]!==0x1?'s':'')));if(_0x8c53b4['length']===0x0)return 0x0;for(const _0x1595cf of _0x8c53b4){const _0x5f0dee=_0x1595cf[_0x2584e8(0x1be)]!=null?a9_0x278818[_0x2584e8(0x188)]('\x20('+formatRows(_0x1595cf['population'])+')'):'';console['log'](_0x2584e8(0x1a9)+_0x1595cf['name']+_0x5f0dee),_0x1595cf[_0x2584e8(0x18b)]&&console[_0x2584e8(0x191)]('\x20\x20'+a9_0x278818[_0x2584e8(0x188)](_0x1595cf[_0x2584e8(0x18b)]));}return 0x0;}}export class CASSegmentPushCommand extends BaseCommand{[a9_0x5714d1(0x1b2)]=a9_0x5714d1(0x1c9);[a9_0x5714d1(0x18b)]=a9_0x5714d1(0x18f);async[a9_0x5714d1(0x190)](_0x340f84){const _0x200394=a9_0x5714d1,{options:_0x1bc774,args:_0x146243,tdx:_0x545087}=_0x340f84,_0x284010=_0x1bc774,_0x4adee6=_0x146243[0x0];if(!_0x4adee6)return console[_0x200394(0x189)](a9_0x278818[_0x200394(0x1b6)](_0x200394(0x1d8))),0x1;if(!existsSync(_0x4adee6))return console[_0x200394(0x189)](a9_0x278818['red'](_0x200394(0x1bf)+_0x4adee6)),0x1;if(statSync(_0x4adee6)[_0x200394(0x182)]())return console[_0x200394(0x189)](a9_0x278818[_0x200394(0x1b6)](_0x4adee6+_0x200394(0x19b))),_0x284010['delete']?console[_0x200394(0x189)](a9_0x278818['dim'](_0x200394(0x187))):console['error'](a9_0x278818['dim'](_0x200394(0x193))),0x1;const _0x459c60=_0x284010[_0x200394(0x19d)]||_0x1bc774[_0x200394(0x1b3)];if(!_0x459c60)return console[_0x200394(0x189)](a9_0x278818['yellow'](_0x200394(0x1c4))),console[_0x200394(0x189)](_0x200394(0x183)+a9_0x278818[_0x200394(0x194)](_0x200394(0x1c7))+_0x200394(0x1a0)+a9_0x278818[_0x200394(0x194)](_0x200394(0x17a))),0x1;console['log']('Audience:\x20'+a9_0x278818[_0x200394(0x194)](_0x459c60)),console[_0x200394(0x191)](_0x200394(0x1b4)+a9_0x278818[_0x200394(0x188)](a9_0x265c27[_0x200394(0x1d2)](process[_0x200394(0x1bb)](),_0x4adee6)||'.')),console['log']();let _0x57a185;try{_0x57a185=a9_0x346a0f['parse'](readFileSync(_0x4adee6,'utf-8'));}catch(_0x1d9493){return console[_0x200394(0x189)](a9_0x278818[_0x200394(0x1b6)](_0x200394(0x1ae)+a9_0x265c27[_0x200394(0x1a3)](_0x4adee6)+_0x200394(0x1c6)),_0x1d9493 instanceof Error?_0x1d9493[_0x200394(0x1a5)]:String(_0x1d9493)),0x1;}if(!isComposableSegmentDef(_0x57a185))return console[_0x200394(0x189)](a9_0x278818[_0x200394(0x1b6)](a9_0x265c27[_0x200394(0x1a3)](_0x4adee6)+_0x200394(0x1b0))),console['error'](a9_0x278818[_0x200394(0x17f)](_0x200394(0x18d))),0x1;if(_0x284010[_0x200394(0x1b1)])return this[_0x200394(0x181)](_0x340f84,_0x459c60,_0x57a185['name'],_0x284010);const _0x144a2f=await withProgressSpinner(_0x200394(0x1b5),()=>buildConnectionMaps(_0x545087[_0x200394(0x1a7)]),{'verbose':_0x284010['verbose']}),_0xc63d40=_0x144a2f[_0x200394(0x17c)],_0x1c5d86=await withProgressSpinner('Resolving\x20audience\x20\x27'+_0x459c60+_0x200394(0x1d0),()=>_0x545087[_0x200394(0x1bc)][_0x200394(0x186)](_0x459c60),{'verbose':_0x284010[_0x200394(0x17b)]}),_0x237346=_0x1c5d86[_0x200394(0x17c)],_0x40262b=await withProgressSpinner(_0x200394(0x192),_0x40852d=>_0x545087[_0x200394(0x1bc)][_0x200394(0x1c1)]([_0x4adee6],{'dryRun':!![],'verbose':_0x284010[_0x200394(0x17b)],'resolvedAudienceId':_0x237346,'connectionMaps':_0xc63d40,'progress':{'update':_0x125813=>_0x40852d[_0x200394(0x198)](_0x125813)}}),{'verbose':_0x284010['verbose']}),_0x4268e1=_0x40262b['data'],_0x41d642=_0x4268e1[_0x200394(0x195)][_0x200394(0x196)]>0x0,_0x3c0a96=_0x41d642?'update':_0x200394(0x1a8);console[_0x200394(0x191)](_0x200394(0x1a2)+_0x3c0a96+_0x200394(0x1ab)+a9_0x278818[_0x200394(0x194)](_0x459c60));if(_0x284010[_0x200394(0x1b7)])return console[_0x200394(0x191)](a9_0x278818[_0x200394(0x17f)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;if(!_0x284010[_0x200394(0x1ce)]){if(!isInteractive())return console['error'](a9_0x278818[_0x200394(0x1b6)](_0x200394(0x1aa)),_0x200394(0x18e)),console[_0x200394(0x189)](a9_0x278818[_0x200394(0x188)](_0x200394(0x185))),0x1;const _0x315ab0=await confirmKey('\x0a'+(_0x41d642?'Update':_0x200394(0x197))+'\x20this\x20segment?');if(!_0x315ab0)return console[_0x200394(0x191)](a9_0x278818['yellow'](_0x200394(0x1b8))),0x1;}const _0x3c8c71=await withProgressSpinner('Pushing\x20segment\x20to\x20\x27'+_0x459c60+'\x27...',_0x5870c0=>_0x545087['cas'][_0x200394(0x1c1)]([_0x4adee6],{'dryRun':![],'verbose':_0x284010[_0x200394(0x17b)],'resolvedAudienceId':_0x237346,'progress':{'update':_0x206d82=>_0x5870c0['setPhase'](_0x206d82)}}),{'verbose':_0x284010['verbose']}),_0x56ff17=_0x3c8c71[_0x200394(0x17c)],_0x1f1b1a=_0x56ff17[_0x200394(0x1c5)][_0x200394(0x196)]>0x0;return console[_0x200394(0x191)](a9_0x278818[_0x200394(0x1af)]('\x0a✔\x20Segment\x20'+(_0x1f1b1a?_0x200394(0x1c5):'updated'))),console['log'](_0x200394(0x199)+a9_0x278818[_0x200394(0x194)](_0x459c60)),0x0;}async[a9_0x5714d1(0x181)](_0x22f10b,_0xc22686,_0x40b6ec,_0xd7bb8e){const _0x3616cf=a9_0x5714d1,{tdx:_0x3a247a}=_0x22f10b,_0x693791=await withProgressSpinner('Fetching\x20segments\x20for\x20\x27'+_0xc22686+_0x3616cf(0x1d0),()=>_0x3a247a[_0x3616cf(0x1bc)][_0x3616cf(0x1ad)](_0xc22686),{'verbose':_0xd7bb8e['verbose']}),_0x39c6ca=_0x693791[_0x3616cf(0x17c)][_0x3616cf(0x19c)](_0x5750a3=>_0x5750a3[_0x3616cf(0x1b2)]===_0x40b6ec);if(!_0x39c6ca)return console['error'](a9_0x278818[_0x3616cf(0x1b6)](_0x3616cf(0x1d3)+_0x40b6ec+_0x3616cf(0x1ca)+_0xc22686+'\x22.')),console[_0x3616cf(0x189)](a9_0x278818['dim']('Nothing\x20to\x20delete.')),0x1;console[_0x3616cf(0x191)](_0x3616cf(0x17d)+a9_0x278818['red'](_0x40b6ec)+_0x3616cf(0x1d7)+a9_0x278818[_0x3616cf(0x194)](_0xc22686));if(_0xd7bb8e[_0x3616cf(0x1b7)])return console[_0x3616cf(0x191)](a9_0x278818['yellow'](_0x3616cf(0x1c3))),0x0;if(!_0xd7bb8e[_0x3616cf(0x1ce)]){if(!isInteractive())return console[_0x3616cf(0x189)](a9_0x278818[_0x3616cf(0x1b6)](_0x3616cf(0x1aa)),_0x3616cf(0x18e)),console[_0x3616cf(0x189)](a9_0x278818[_0x3616cf(0x188)](_0x3616cf(0x185))),0x1;const _0x4de702=await confirmKey('\x0aDelete\x20segment\x20\x22'+_0x40b6ec+_0x3616cf(0x19a)+_0xc22686+_0x3616cf(0x1d5));if(!_0x4de702)return console[_0x3616cf(0x191)](a9_0x278818[_0x3616cf(0x17f)](_0x3616cf(0x1b8))),0x1;}return await withProgressSpinner(_0x3616cf(0x1d6)+_0x40b6ec+'\x27...',()=>_0x3a247a['cas'][_0x3616cf(0x1a6)](_0x39c6ca['id']),{'verbose':_0xd7bb8e[_0x3616cf(0x17b)]}),console[_0x3616cf(0x191)](a9_0x278818['green'](_0x3616cf(0x1cf))),console[_0x3616cf(0x191)](_0x3616cf(0x19f)+a9_0x278818[_0x3616cf(0x194)](_0x40b6ec)),console['log'](_0x3616cf(0x199)+a9_0x278818[_0x3616cf(0x194)](_0xc22686)),0x0;}}
@@ -1 +1 @@
1
- const a10_0x58d780=a10_0x42b8;function a10_0x5c40(){const _0x50dfa5=['includes','streamChat','targetKnowledgeBase','targetFunction','2332IHSROp','data','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','Resolving\x20agent\x20\x27','chatId','functionName','7xxLYAA','--agent\x20flag','221166aNakbd','handleChatEvent','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','agent','agentId','chat-create','CHAT_NOT_FOUND','done','verbose','llmProject','streamChatJsonl','join','Using\x20agent\x20from\x20','code','getOrCreateDefaultAgent','\x27...','121972yXjyPb','projectId','Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together','context','\x27\x20not\x20found','\x0aStack\x20trace:','tool_call','startChat','site','execute','chat','Chat\x20session:\x20','1246100etgeta','228664DIuCHO','cause','tool','validate','type','stream','args','name','Error:\x20Chat\x20session\x20\x27','event','content','6PtrvvL','\x20\x20Cause:\x20','targetAgent','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','slice','stringify','795765dhlknx','message','resolveProjectId','targetWebSearchTool','tool_result','1164Enksew','llmAgent','options','getDefaultAgent','claude-4.5-haiku','llm','stack','resolveAgentId','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','new','log','Using\x20cached\x20default\x20agent:\x20','stdout','error','metadata','string','1895913KHofrd'];a10_0x5c40=function(){return _0x50dfa5;};return a10_0x5c40();}(function(_0x53ed16,_0x3cfc03){const _0x3cc1c8=a10_0x42b8,_0x874e48=_0x53ed16();while(!![]){try{const _0x5e7404=-parseInt(_0x3cc1c8(0xc2))/0x1+parseInt(_0x3cc1c8(0xd2))/0x2+-parseInt(_0x3cc1c8(0xa4))/0x3*(parseInt(_0x3cc1c8(0xb9))/0x4)+parseInt(_0x3cc1c8(0x9f))/0x5*(parseInt(_0x3cc1c8(0xea))/0x6)+parseInt(_0x3cc1c8(0xc0))/0x7*(parseInt(_0x3cc1c8(0xdf))/0x8)+parseInt(_0x3cc1c8(0xb4))/0x9+parseInt(_0x3cc1c8(0xde))/0xa;if(_0x5e7404===_0x3cfc03)break;else _0x874e48['push'](_0x874e48['shift']());}catch(_0x272f0b){_0x874e48['push'](_0x874e48['shift']());}}}(a10_0x5c40,0x215ab));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 a10_0x42b8(_0x32b7f3,_0x180c1c){_0x32b7f3=_0x32b7f3-0x9f;const _0x5c40ca=a10_0x5c40();let _0x42b8d2=_0x5c40ca[_0x32b7f3];return _0x42b8d2;}function handleSDKError(_0x34dfe6,_0x5bb3ff){const _0xc45914=a10_0x42b8;if(_0x34dfe6 instanceof SDKError)console[_0xc45914(0xb1)]('Error:\x20'+_0x34dfe6[_0xc45914(0xa0)]),_0x5bb3ff[_0xc45914(0xca)]&&(_0x34dfe6[_0xc45914(0xe0)]&&console[_0xc45914(0xb1)](_0xc45914(0xeb)+_0x34dfe6[_0xc45914(0xe0)]),_0x34dfe6[_0xc45914(0xaa)]&&(console[_0xc45914(0xb1)](_0xc45914(0xd7)),console[_0xc45914(0xb1)](_0x34dfe6['stack'])));else throw _0x34dfe6;}async function resolveAgentId(_0x50ab21,_0x2d6f0f,_0x2473cb,_0x105327,_0x5aff10){const _0x265734=a10_0x42b8,_0x293d12=_0x2d6f0f||_0x2473cb;if(_0x293d12){const {projectName:_0x3c84c6,agentName:_0x4ad95c}=parseAgentRef(_0x293d12),_0xbcb9e9=_0x4ad95c||_0x293d12,_0x47e0f5=_0x4ad95c?_0x3c84c6:_0x105327;if(!_0x47e0f5)throw new Error(_0x265734(0xac));if(_0x5aff10){const _0x3b2172=_0x2d6f0f?_0x265734(0xc1):'session\x20context';console[_0x265734(0xb1)](_0x265734(0xce)+_0x3b2172+':\x20'+_0x47e0f5+'/'+_0xbcb9e9);}const _0xeb0cd7=await withSpinner('Resolving\x20project\x20\x27'+_0x47e0f5+_0x265734(0xd1),()=>_0x50ab21[_0x265734(0xa9)][_0x265734(0xa1)](_0x47e0f5),{'verbose':_0x5aff10}),_0x13b762=await withSpinner(_0x265734(0xbd)+_0xbcb9e9+_0x265734(0xd1),()=>_0x50ab21[_0x265734(0xa9)][_0x265734(0xab)](_0xbcb9e9,_0xeb0cd7[_0x265734(0xba)]),{'verbose':_0x5aff10});return _0x13b762['data'];}else{const _0x5dcaf5=_0x50ab21['llm'][_0x265734(0xa7)]();if(_0x5dcaf5)return _0x5aff10&&console[_0x265734(0xb1)](_0x265734(0xaf)+_0x5dcaf5[_0x265734(0xe6)]),_0x5dcaf5['id'];const _0x6f4a12=await withSpinner('Getting\x20default\x20agent...',()=>_0x50ab21[_0x265734(0xa9)][_0x265734(0xd0)](_0x265734(0xa8),0x0),{'verbose':_0x5aff10});return _0x6f4a12['data']['id'];}}export class ChatCommand extends BaseCommand{[a10_0x58d780(0xe6)]=a10_0x58d780(0xdc);['description']=a10_0x58d780(0xbc);[a10_0x58d780(0xe2)](_0x2b31d5){const _0x5e161c=a10_0x58d780,_0x363308=_0x2b31d5[_0x5e161c(0xe5)][_0x5e161c(0xcd)]('\x20');if(!_0x363308)return _0x5e161c(0xbb);return undefined;}async[a10_0x58d780(0xb6)](_0x5a1cde,_0x37cbdf,_0x1e4bb2,_0x787afa,_0x2841fd){const _0x1069f8=a10_0x58d780;for await(const _0x48e664 of _0x5a1cde[_0x1069f8(0xa9)][_0x1069f8(0xdc)](_0x37cbdf,{'agentId':_0x1e4bb2,'chatId':_0x787afa})){if(_0x48e664[_0x1069f8(0xe3)]===_0x1069f8(0xb2)){const _0x40ff30=_0x48e664['data'][_0x1069f8(0xbe)];saveLastChatId(_0x40ff30),_0x2841fd&&console[_0x1069f8(0xb1)](_0x1069f8(0xdd)+_0x40ff30);}else _0x48e664[_0x1069f8(0xe3)]===_0x1069f8(0xe8)&&this[_0x1069f8(0xc3)](_0x48e664[_0x1069f8(0xba)]);}}async['streamChatJsonl'](_0x50554c,_0x27d4f4,_0x5ad808,_0xe3f0a9){const _0x3e5771=a10_0x58d780,_0x12a887=_0x50554c[_0x3e5771(0xd5)][_0x3e5771(0xda)];let _0x4880e3=![];for await(const _0xbed70c of _0x50554c[_0x3e5771(0xa9)][_0x3e5771(0xdc)](_0x27d4f4,{'agentId':_0x5ad808,'chatId':_0xe3f0a9})){if(_0xbed70c[_0x3e5771(0xe3)]==='metadata'){const _0x355cea=_0xbed70c['data'];saveLastChatId(_0x355cea[_0x3e5771(0xbe)]);const _0x29e94c=_0x355cea[_0x3e5771(0xd3)]&&_0x355cea[_0x3e5771(0xc6)]?getLLMConversationUrl(_0x12a887,_0x355cea[_0x3e5771(0xd3)],_0x355cea[_0x3e5771(0xc6)],_0x355cea[_0x3e5771(0xbe)]):undefined;console['log'](JSON[_0x3e5771(0xef)]({'type':_0x3e5771(0xb2),'data':{'chatId':_0x355cea['chatId'],'agentId':_0x355cea[_0x3e5771(0xc6)],'consoleUrl':_0x29e94c}})),_0x4880e3=!![];}else{if(_0xbed70c[_0x3e5771(0xe3)]===_0x3e5771(0xe8)){!_0x4880e3&&_0xe3f0a9&&(console[_0x3e5771(0xae)](JSON[_0x3e5771(0xef)]({'type':_0x3e5771(0xb2),'data':{'chatId':_0xe3f0a9}})),_0x4880e3=!![]);const _0x3934be=_0xbed70c[_0x3e5771(0xba)];if(_0x3e5771(0xe9)in _0x3934be)console[_0x3e5771(0xae)](JSON[_0x3e5771(0xef)]({'type':_0x3e5771(0xe9),'data':{'content':_0x3934be[_0x3e5771(0xe9)]}}));else{if(_0x3e5771(0xd8)in _0x3934be){const _0x59fb42=_0x3934be['tool_call'];console[_0x3e5771(0xae)](JSON[_0x3e5771(0xef)]({'type':_0x3e5771(0xd8),'data':{'id':_0x59fb42['id'],'name':_0x59fb42['functionName'],'target':_0x59fb42[_0x3e5771(0xb7)]?.['name']||_0x59fb42[_0x3e5771(0xec)]?.['name']||_0x59fb42[_0x3e5771(0xa2)]?.[_0x3e5771(0xe6)]||_0x59fb42[_0x3e5771(0xb8)]}}));}else{if(_0x3e5771(0xe1)in _0x3934be)console['log'](JSON['stringify']({'type':_0x3e5771(0xa3),'data':{'id':_0x3934be[_0x3e5771(0xe1)]['id'],'name':_0x3934be[_0x3e5771(0xe1)][_0x3e5771(0xbf)],'result':typeof _0x3934be[_0x3e5771(0xe1)][_0x3e5771(0xe9)]===_0x3e5771(0xb3)?_0x3934be[_0x3e5771(0xe1)][_0x3e5771(0xe9)][_0x3e5771(0xee)](0x0,0x1f4):''}}));else _0x3e5771(0xb1)in _0x3934be&&console[_0x3e5771(0xae)](JSON[_0x3e5771(0xef)]({'type':_0x3e5771(0xb1),'data':{'error':_0x3934be[_0x3e5771(0xb1)]}}));}}}}}console[_0x3e5771(0xae)](JSON[_0x3e5771(0xef)]({'type':_0x3e5771(0xc9)}));}async['execute'](_0xcf184e){const _0x368a75=a10_0x58d780,{options:_0x22527f,args:_0x24a148,tdx:_0x36b6a1}=_0xcf184e,_0x55cb13=_0x24a148[_0x368a75(0xcd)]('\x20'),_0x16e0db=_0x22527f,_0x3185ca=_0x16e0db[_0x368a75(0xc5)],_0x4ea35a=_0x16e0db[_0x368a75(0xa5)],_0x5b6506=_0x16e0db['llmProject'],_0x198787=_0x16e0db[_0x368a75(0xad)],_0x5670fd=_0x16e0db['chatId'],_0x43e197=_0x16e0db[_0x368a75(0xe4)];if(_0x198787&&_0x5670fd)return console['error'](_0x368a75(0xd4)),0x1;try{let _0x186a0a,_0x445bd3;if(_0x5670fd)_0x445bd3=_0x5670fd;else!_0x198787&&(_0x445bd3=loadLastChatId(),_0x445bd3&&_0x22527f[_0x368a75(0xca)]&&console[_0x368a75(0xb1)]('Continuing\x20chat:\x20'+_0x445bd3));!_0x5670fd&&(_0x198787||!_0x445bd3)&&(_0x186a0a=await resolveAgentId(_0x36b6a1,_0x3185ca,_0x4ea35a,_0x5b6506,_0x22527f[_0x368a75(0xca)]));const _0xaacc66=_0x43e197?(_0x810b89,_0xfe778b,_0x205798)=>this[_0x368a75(0xcc)](_0x36b6a1,_0x810b89,_0xfe778b,_0x205798):(_0x1b368c,_0x38e1f0,_0x189706)=>this[_0x368a75(0xb6)](_0x36b6a1,_0x1b368c,_0x38e1f0,_0x189706,_0x22527f[_0x368a75(0xca)]);try{await _0xaacc66(_0x55cb13,_0x186a0a,_0x445bd3);}catch(_0x24e594){const _0x2376c4=_0x24e594 instanceof SDKError&&_0x24e594[_0x368a75(0xcf)]===ErrorCode[_0x368a75(0xc8)]||_0x24e594 instanceof Error&&_0x24e594[_0x368a75(0xa0)][_0x368a75(0xb5)]('404');if(_0x2376c4&&_0x5670fd)return console['error'](_0x368a75(0xe7)+_0x5670fd+_0x368a75(0xd6)),0x1;if(_0x2376c4)_0x22527f[_0x368a75(0xca)]&&console['error'](_0x368a75(0xc4)),!_0x186a0a&&(_0x186a0a=await resolveAgentId(_0x36b6a1,_0x3185ca,_0x4ea35a,_0x5b6506,_0x22527f[_0x368a75(0xca)])),await _0xaacc66(_0x55cb13,_0x186a0a,undefined);else throw _0x24e594;}return!_0x43e197&&console['log'](),0x0;}catch(_0x23eca8){return console['error'](),handleSDKError(_0x23eca8,_0x22527f),0x1;}}[a10_0x58d780(0xc3)](_0x36f2a9){const _0x4bb042=a10_0x58d780;if(_0x4bb042(0xe9)in _0x36f2a9)process[_0x4bb042(0xb0)]['write'](_0x36f2a9['content']);else'error'in _0x36f2a9&&console[_0x4bb042(0xb1)]('\x0aError:\x20'+_0x36f2a9[_0x4bb042(0xb1)]);}}export class ChatCreateCommand extends BaseCommand{['name']=a10_0x58d780(0xc7);['description']='Create\x20a\x20new\x20chat\x20session';['validate'](_0x4f4efc){const _0x1e4405=a10_0x58d780,_0x215615=_0x4f4efc[_0x1e4405(0xa6)],_0x262813=_0x215615[_0x1e4405(0xc5)],_0x7d0f4=_0x215615['llmAgent'];if(!_0x262813&&!_0x7d0f4)return _0x1e4405(0xed);return undefined;}async[a10_0x58d780(0xdb)](_0x1dba58){const _0x3ba923=a10_0x58d780,{options:_0x263872,tdx:_0x5ec811}=_0x1dba58,_0x4266bd=_0x263872,_0x4553a3=_0x4266bd[_0x3ba923(0xc5)],_0x2da2f3=_0x4266bd['llmAgent'],_0x1d39db=_0x4266bd[_0x3ba923(0xcb)];try{const _0x1d5493=await resolveAgentId(_0x5ec811,_0x4553a3,_0x2da2f3,_0x1d39db,_0x263872[_0x3ba923(0xca)]),_0x463be7=await _0x5ec811[_0x3ba923(0xa9)][_0x3ba923(0xd9)](_0x1d5493);return saveLastChatId(_0x463be7['id']),console[_0x3ba923(0xae)](JSON[_0x3ba923(0xef)]({'chatId':_0x463be7['id'],'agentId':_0x1d5493})),0x0;}catch(_0x1fb245){return handleSDKError(_0x1fb245,_0x263872),0x1;}}}
1
+ function a10_0x463e(_0x38a9ec,_0x103899){_0x38a9ec=_0x38a9ec-0x1e0;const _0x44e930=a10_0x44e9();let _0x463e1a=_0x44e930[_0x38a9ec];return _0x463e1a;}const a10_0x5dddc7=a10_0x463e;(function(_0x2e7a76,_0x9281ef){const _0x224584=a10_0x463e,_0x5d1837=_0x2e7a76();while(!![]){try{const _0x4f1b20=-parseInt(_0x224584(0x1ea))/0x1*(parseInt(_0x224584(0x1e9))/0x2)+-parseInt(_0x224584(0x210))/0x3+-parseInt(_0x224584(0x1f3))/0x4+parseInt(_0x224584(0x22a))/0x5+parseInt(_0x224584(0x208))/0x6+parseInt(_0x224584(0x1f4))/0x7*(parseInt(_0x224584(0x1ef))/0x8)+-parseInt(_0x224584(0x1ed))/0x9;if(_0x4f1b20===_0x9281ef)break;else _0x5d1837['push'](_0x5d1837['shift']());}catch(_0x22ea25){_0x5d1837['push'](_0x5d1837['shift']());}}}(a10_0x44e9,0x2d645));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';function a10_0x44e9(){const _0x187caa=['tool','metadata','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','404','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','\x20\x20Cause:\x20','getOrCreateDefaultAgent','description','error','write','execute','agent','validate','handleChatEvent','llmProject','tool_result','message','1265400Ehihpr','streamChatJsonl','streamChat','Using\x20agent\x20from\x20','name','verbose','join','code','521424KhcQGb','targetKnowledgeBase','site','targetAgent','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','\x27...','Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together','llmAgent','functionName','--agent\x20flag','projectId','resolveProjectId','targetWebSearchTool','data','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','startChat','\x0aStack\x20trace:','resolveAgentId','options','Getting\x20default\x20agent...','Continuing\x20chat:\x20','args','agentId','\x0aError:\x20','Resolving\x20project\x20\x27','llm','773620FktTvI','Chat\x20session:\x20','tool_call','chat-create','slice','Resolving\x20agent\x20\x27','content','type','targetFunction','chatId','string','log','6qBcKhS','19185lmBMms','stdout','new','190854GmygSc','Error:\x20','198536HEfjwk','Using\x20cached\x20default\x20agent:\x20','event','claude-4.5-haiku','800468SKINKz','77vpAIMh','chat','stringify'];a10_0x44e9=function(){return _0x187caa;};return a10_0x44e9();}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(_0x1c8ba1,_0x4ac35d){const _0x21678e=a10_0x463e;if(_0x1c8ba1 instanceof SDKError)console[_0x21678e(0x1ff)](_0x21678e(0x1ee)+_0x1c8ba1[_0x21678e(0x207)]),_0x4ac35d[_0x21678e(0x20d)]&&(_0x1c8ba1['cause']&&console[_0x21678e(0x1ff)](_0x21678e(0x1fc)+_0x1c8ba1['cause']),_0x1c8ba1['stack']&&(console[_0x21678e(0x1ff)](_0x21678e(0x220)),console[_0x21678e(0x1ff)](_0x1c8ba1['stack'])));else throw _0x1c8ba1;}async function resolveAgentId(_0x47cd03,_0x61fefe,_0xf35514,_0x1f1778,_0x59579d){const _0x288073=a10_0x463e,_0xe1991d=_0x61fefe||_0xf35514;if(_0xe1991d){const {projectName:_0x2777f6,agentName:_0x42e4f1}=parseAgentRef(_0xe1991d),_0x52b3b4=_0x42e4f1||_0xe1991d,_0x6291be=_0x42e4f1?_0x2777f6:_0x1f1778;if(!_0x6291be)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x59579d){const _0x3adf97=_0x61fefe?_0x288073(0x219):'session\x20context';console[_0x288073(0x1ff)](_0x288073(0x20b)+_0x3adf97+':\x20'+_0x6291be+'/'+_0x52b3b4);}const _0xce2833=await withSpinner(_0x288073(0x228)+_0x6291be+'\x27...',()=>_0x47cd03['llm'][_0x288073(0x21b)](_0x6291be),{'verbose':_0x59579d}),_0x540517=await withSpinner(_0x288073(0x1e2)+_0x52b3b4+_0x288073(0x215),()=>_0x47cd03[_0x288073(0x229)][_0x288073(0x221)](_0x52b3b4,_0xce2833[_0x288073(0x21d)]),{'verbose':_0x59579d});return _0x540517[_0x288073(0x21d)];}else{const _0x4cab31=_0x47cd03['llm']['getDefaultAgent']();if(_0x4cab31)return _0x59579d&&console['error'](_0x288073(0x1f0)+_0x4cab31[_0x288073(0x20c)]),_0x4cab31['id'];const _0x1d7f2e=await withSpinner(_0x288073(0x223),()=>_0x47cd03[_0x288073(0x229)][_0x288073(0x1fd)](_0x288073(0x1f2),0x0),{'verbose':_0x59579d});return _0x1d7f2e[_0x288073(0x21d)]['id'];}}export class ChatCommand extends BaseCommand{['name']=a10_0x5dddc7(0x1f5);[a10_0x5dddc7(0x1fe)]=a10_0x5dddc7(0x21e);[a10_0x5dddc7(0x203)](_0x52f565){const _0x197cd4=a10_0x5dddc7,_0x40f115=_0x52f565[_0x197cd4(0x225)][_0x197cd4(0x20e)]('\x20');if(!_0x40f115)return _0x197cd4(0x1f9);return undefined;}async[a10_0x5dddc7(0x20a)](_0x530aa5,_0x450487,_0x4c6089,_0x418dc2,_0x210da9){const _0x31667e=a10_0x5dddc7;for await(const _0x57f8ad of _0x530aa5[_0x31667e(0x229)]['chat'](_0x450487,{'agentId':_0x4c6089,'chatId':_0x418dc2})){if(_0x57f8ad[_0x31667e(0x1e4)]==='metadata'){const _0xa618a0=_0x57f8ad[_0x31667e(0x21d)][_0x31667e(0x1e6)];saveLastChatId(_0xa618a0),_0x210da9&&console['error'](_0x31667e(0x22b)+_0xa618a0);}else _0x57f8ad[_0x31667e(0x1e4)]===_0x31667e(0x1f1)&&this[_0x31667e(0x204)](_0x57f8ad[_0x31667e(0x21d)]);}}async[a10_0x5dddc7(0x209)](_0xd17d46,_0x410946,_0x57bd23,_0x3a8659){const _0x41cfe0=a10_0x5dddc7,_0x496f8b=_0xd17d46['context'][_0x41cfe0(0x212)];let _0x1c7c4d=![];for await(const _0x37c8c6 of _0xd17d46[_0x41cfe0(0x229)][_0x41cfe0(0x1f5)](_0x410946,{'agentId':_0x57bd23,'chatId':_0x3a8659})){if(_0x37c8c6[_0x41cfe0(0x1e4)]===_0x41cfe0(0x1f8)){const _0x3e22fa=_0x37c8c6[_0x41cfe0(0x21d)];saveLastChatId(_0x3e22fa[_0x41cfe0(0x1e6)]);const _0x50b942=_0x3e22fa[_0x41cfe0(0x21a)]&&_0x3e22fa[_0x41cfe0(0x226)]?getLLMConversationUrl(_0x496f8b,_0x3e22fa[_0x41cfe0(0x21a)],_0x3e22fa['agentId'],_0x3e22fa['chatId']):undefined;console['log'](JSON['stringify']({'type':'metadata','data':{'chatId':_0x3e22fa[_0x41cfe0(0x1e6)],'agentId':_0x3e22fa[_0x41cfe0(0x226)],'consoleUrl':_0x50b942}})),_0x1c7c4d=!![];}else{if(_0x37c8c6[_0x41cfe0(0x1e4)]===_0x41cfe0(0x1f1)){!_0x1c7c4d&&_0x3a8659&&(console[_0x41cfe0(0x1e8)](JSON[_0x41cfe0(0x1f6)]({'type':_0x41cfe0(0x1f8),'data':{'chatId':_0x3a8659}})),_0x1c7c4d=!![]);const _0x7099f2=_0x37c8c6[_0x41cfe0(0x21d)];if('content'in _0x7099f2)console['log'](JSON[_0x41cfe0(0x1f6)]({'type':_0x41cfe0(0x1e3),'data':{'content':_0x7099f2[_0x41cfe0(0x1e3)]}}));else{if('tool_call'in _0x7099f2){const _0x5dd869=_0x7099f2[_0x41cfe0(0x22c)];console[_0x41cfe0(0x1e8)](JSON['stringify']({'type':_0x41cfe0(0x22c),'data':{'id':_0x5dd869['id'],'name':_0x5dd869[_0x41cfe0(0x218)],'target':_0x5dd869[_0x41cfe0(0x211)]?.['name']||_0x5dd869[_0x41cfe0(0x213)]?.[_0x41cfe0(0x20c)]||_0x5dd869[_0x41cfe0(0x21c)]?.[_0x41cfe0(0x20c)]||_0x5dd869[_0x41cfe0(0x1e5)]}}));}else{if('tool'in _0x7099f2)console[_0x41cfe0(0x1e8)](JSON[_0x41cfe0(0x1f6)]({'type':_0x41cfe0(0x206),'data':{'id':_0x7099f2[_0x41cfe0(0x1f7)]['id'],'name':_0x7099f2['tool'][_0x41cfe0(0x218)],'result':typeof _0x7099f2[_0x41cfe0(0x1f7)]['content']===_0x41cfe0(0x1e7)?_0x7099f2[_0x41cfe0(0x1f7)][_0x41cfe0(0x1e3)][_0x41cfe0(0x1e1)](0x0,0x1f4):''}}));else _0x41cfe0(0x1ff)in _0x7099f2&&console[_0x41cfe0(0x1e8)](JSON['stringify']({'type':_0x41cfe0(0x1ff),'data':{'error':_0x7099f2[_0x41cfe0(0x1ff)]}}));}}}}}console['log'](JSON[_0x41cfe0(0x1f6)]({'type':'done'}));}async[a10_0x5dddc7(0x201)](_0x5c88af){const _0x285d3a=a10_0x5dddc7,{options:_0x1167a8,args:_0x393d09,tdx:_0x2f2245}=_0x5c88af,_0x53be86=_0x393d09[_0x285d3a(0x20e)]('\x20'),_0xfaafeb=_0x1167a8,_0x153b63=_0xfaafeb[_0x285d3a(0x202)],_0x185d92=_0xfaafeb['llmAgent'],_0x3b0127=_0xfaafeb['llmProject'],_0x2de05a=_0xfaafeb[_0x285d3a(0x1ec)],_0x311e8c=_0xfaafeb[_0x285d3a(0x1e6)],_0x41ad3a=_0xfaafeb['stream'];if(_0x2de05a&&_0x311e8c)return console['error'](_0x285d3a(0x216)),0x1;try{let _0xb6a3ab,_0x3ff698;if(_0x311e8c)_0x3ff698=_0x311e8c;else!_0x2de05a&&(_0x3ff698=loadLastChatId(),_0x3ff698&&_0x1167a8[_0x285d3a(0x20d)]&&console[_0x285d3a(0x1ff)](_0x285d3a(0x224)+_0x3ff698));!_0x311e8c&&(_0x2de05a||!_0x3ff698)&&(_0xb6a3ab=await resolveAgentId(_0x2f2245,_0x153b63,_0x185d92,_0x3b0127,_0x1167a8[_0x285d3a(0x20d)]));const _0xf5c6ac=_0x41ad3a?(_0x26943b,_0x292a23,_0x1ebe4)=>this['streamChatJsonl'](_0x2f2245,_0x26943b,_0x292a23,_0x1ebe4):(_0x4acea5,_0x13abe1,_0x3a4266)=>this[_0x285d3a(0x20a)](_0x2f2245,_0x4acea5,_0x13abe1,_0x3a4266,_0x1167a8[_0x285d3a(0x20d)]);try{await _0xf5c6ac(_0x53be86,_0xb6a3ab,_0x3ff698);}catch(_0xee61d9){const _0x4fc947=_0xee61d9 instanceof SDKError&&_0xee61d9[_0x285d3a(0x20f)]===ErrorCode['CHAT_NOT_FOUND']||_0xee61d9 instanceof Error&&_0xee61d9['message']['includes'](_0x285d3a(0x1fa));if(_0x4fc947&&_0x311e8c)return console[_0x285d3a(0x1ff)]('Error:\x20Chat\x20session\x20\x27'+_0x311e8c+'\x27\x20not\x20found'),0x1;if(_0x4fc947)_0x1167a8[_0x285d3a(0x20d)]&&console[_0x285d3a(0x1ff)](_0x285d3a(0x214)),!_0xb6a3ab&&(_0xb6a3ab=await resolveAgentId(_0x2f2245,_0x153b63,_0x185d92,_0x3b0127,_0x1167a8['verbose'])),await _0xf5c6ac(_0x53be86,_0xb6a3ab,undefined);else throw _0xee61d9;}return!_0x41ad3a&&console[_0x285d3a(0x1e8)](),0x0;}catch(_0x5cb19b){return console[_0x285d3a(0x1ff)](),handleSDKError(_0x5cb19b,_0x1167a8),0x1;}}[a10_0x5dddc7(0x204)](_0x2fbbab){const _0x947841=a10_0x5dddc7;if(_0x947841(0x1e3)in _0x2fbbab)process[_0x947841(0x1eb)][_0x947841(0x200)](_0x2fbbab[_0x947841(0x1e3)]);else _0x947841(0x1ff)in _0x2fbbab&&console[_0x947841(0x1ff)](_0x947841(0x227)+_0x2fbbab['error']);}}export class ChatCreateCommand extends BaseCommand{[a10_0x5dddc7(0x20c)]=a10_0x5dddc7(0x1e0);[a10_0x5dddc7(0x1fe)]='Create\x20a\x20new\x20chat\x20session';[a10_0x5dddc7(0x203)](_0x4398f4){const _0x4125f7=a10_0x5dddc7,_0xfb6daa=_0x4398f4[_0x4125f7(0x222)],_0x57a1ba=_0xfb6daa[_0x4125f7(0x202)],_0x1fe3a1=_0xfb6daa[_0x4125f7(0x217)];if(!_0x57a1ba&&!_0x1fe3a1)return _0x4125f7(0x1fb);return undefined;}async[a10_0x5dddc7(0x201)](_0xae10d5){const _0x217093=a10_0x5dddc7,{options:_0x2f920a,tdx:_0x4ade93}=_0xae10d5,_0x321333=_0x2f920a,_0x46ce70=_0x321333[_0x217093(0x202)],_0x3903be=_0x321333['llmAgent'],_0x50b4c1=_0x321333[_0x217093(0x205)];try{const _0x18098b=await resolveAgentId(_0x4ade93,_0x46ce70,_0x3903be,_0x50b4c1,_0x2f920a[_0x217093(0x20d)]),_0x49ffaa=await _0x4ade93['llm'][_0x217093(0x21f)](_0x18098b);return saveLastChatId(_0x49ffaa['id']),console[_0x217093(0x1e8)](JSON[_0x217093(0x1f6)]({'chatId':_0x49ffaa['id'],'agentId':_0x18098b})),0x0;}catch(_0x879d8a){return handleSDKError(_0x879d8a,_0x2f920a),0x1;}}}
@@ -1 +1 @@
1
- const a11_0x515cfc=a11_0x32b6;(function(_0x5d5284,_0x3f6567){const _0x3e3acb=a11_0x32b6,_0x44e1ce=_0x5d5284();while(!![]){try{const _0x626de8=-parseInt(_0x3e3acb(0x1c7))/0x1*(parseInt(_0x3e3acb(0x26e))/0x2)+parseInt(_0x3e3acb(0x1c3))/0x3*(parseInt(_0x3e3acb(0x227))/0x4)+parseInt(_0x3e3acb(0x210))/0x5+-parseInt(_0x3e3acb(0x1cc))/0x6+parseInt(_0x3e3acb(0x1db))/0x7+parseInt(_0x3e3acb(0x264))/0x8+-parseInt(_0x3e3acb(0x26f))/0x9;if(_0x626de8===_0x3f6567)break;else _0x44e1ce['push'](_0x44e1ce['shift']());}catch(_0x287497){_0x44e1ce['push'](_0x44e1ce['shift']());}}}(a11_0x313a,0xe0264));import{execFile}from'node:child_process';function a11_0x32b6(_0x3c9cb0,_0x1fa1f3){_0x3c9cb0=_0x3c9cb0-0x1bf;const _0x313af9=a11_0x313a();let _0x32b633=_0x313af9[_0x3c9cb0];return _0x32b633;}import{existsSync}from'node:fs';import{join}from'node:path';import{promisify}from'node:util';import a11_0xea792e 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{getVersion}from'../core/version.js';import{resolveReleaseTag}from'../utils/github-releases.js';import{createGlobalCache}from'../utils/global-cache.js';import{findMcpServerUrl,getClaudeConfigDir,isPluginInstalled,normalizeRepoUrl,readMarketplaceSourceUrl}from'../utils/claude-code-state.js';const execFileAsync=promisify(execFile),MIN_CLAUDE_VERSION=a11_0x515cfc(0x27c);export function buildClaudeSettingsArgs(_0x3cbdaa){const _0x2b1ed0=a11_0x515cfc;return['--settings',JSON[_0x2b1ed0(0x1f2)]({'statusLine':{'type':_0x2b1ed0(0x1dd),'command':_0x3cbdaa?_0x2b1ed0(0x205)+_0x3cbdaa+_0x2b1ed0(0x208):_0x2b1ed0(0x212)}})];}export function buildClaudeLaunchArgs(_0x542949,_0x5950e8){const _0xa716d3=a11_0x515cfc;if(_0x542949['includes'](_0xa716d3(0x281))||_0x542949[_0xa716d3(0x1c8)](_0x895664=>_0x895664['startsWith'](_0xa716d3(0x1d8))))return[..._0x542949];return[..._0x542949,...buildClaudeSettingsArgs(_0x5950e8)];}function handleInstallationError(_0x3c7cc2,_0x418906,_0x5e67cd,_0x59e413){const _0x20f309=a11_0x515cfc;errorContains(_0x3c7cc2,'already\x20exists',_0x20f309(0x1d6),'already\x20configured')?(_0x5e67cd[_0x20f309(0x22e)]='✓\x20'+_0x418906+_0x20f309(0x263),_0x59e413?.[_0x20f309(0x261)](_0x418906+'\x20already\x20configured'),_0x3c7cc2 instanceof SDKError&&_0x3c7cc2[_0x20f309(0x20c)]&&_0x59e413?.[_0x20f309(0x22f)](_0x20f309(0x278)+_0x3c7cc2[_0x20f309(0x20c)][_0x20f309(0x1fb)])):(_0x5e67cd[_0x20f309(0x1d2)](_0x20f309(0x1cf)+_0x418906),_0x59e413?.[_0x20f309(0x224)](_0x418906+_0x20f309(0x222),_0x3c7cc2));}export function parseVersion(_0x34ad39){const _0x4b2e23=a11_0x515cfc,_0x8432ef=_0x34ad39[_0x4b2e23(0x217)]()[_0x4b2e23(0x270)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x8432ef)return null;return{'major':parseInt(_0x8432ef[0x1],0xa),'minor':parseInt(_0x8432ef[0x2],0xa),'patch':parseInt(_0x8432ef[0x3],0xa)};}export function compareVersions(_0x53f0a9,_0x59acf3){const _0x4ac42a=a11_0x515cfc;if(_0x53f0a9[_0x4ac42a(0x218)]!==_0x59acf3[_0x4ac42a(0x218)])return _0x53f0a9['major']-_0x59acf3[_0x4ac42a(0x218)];if(_0x53f0a9[_0x4ac42a(0x204)]!==_0x59acf3['minor'])return _0x53f0a9[_0x4ac42a(0x204)]-_0x59acf3['minor'];return _0x53f0a9[_0x4ac42a(0x1d5)]-_0x59acf3[_0x4ac42a(0x1d5)];}async function checkClaudeVersion(_0x2a1078,_0x538dde){const _0x1f1f68=a11_0x515cfc;_0x538dde?.[_0x1f1f68(0x22f)](_0x1f1f68(0x23c)+_0x2a1078+')');const _0x223f99=await executeClaudeCommand([_0x1f1f68(0x271)],undefined,_0x538dde),_0x55a1f6=parseVersion(_0x223f99);if(!_0x55a1f6){_0x538dde?.['warn'](_0x1f1f68(0x282)+_0x223f99);return;}const _0x2da4ab=_0x55a1f6[_0x1f1f68(0x218)]+'.'+_0x55a1f6[_0x1f1f68(0x204)]+'.'+_0x55a1f6[_0x1f1f68(0x1d5)],_0x44e776=parseVersion(_0x2a1078);if(!_0x44e776){_0x538dde?.['warn']('Invalid\x20minimum\x20version\x20format:\x20'+_0x2a1078);return;}if(compareVersions(_0x55a1f6,_0x44e776)<0x0){_0x538dde?.[_0x1f1f68(0x224)](_0x1f1f68(0x1df)+_0x2da4ab+_0x1f1f68(0x228)+_0x2a1078+')');throw new SDKError(ErrorCode[_0x1f1f68(0x249)],_0x1f1f68(0x1df)+_0x2da4ab+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x2a1078+_0x1f1f68(0x25e),undefined,{'helpText':_0x1f1f68(0x24d)});}_0x538dde?.['debug']('Claude\x20Code\x20version\x20'+_0x2da4ab+_0x1f1f68(0x1e3));}async function executeClaudeCommand(_0x117600,_0x4e83c3,_0x5ad8ac){const _0x503a60=a11_0x515cfc;return _0x5ad8ac?.['info'](_0x503a60(0x1d4)+_0x117600[_0x503a60(0x21e)]('\x20')),new Promise((_0x2a3789,_0x4f2289)=>{const _0x5e0765=_0x503a60,_0x5d126a=crossSpawn(_0x5e0765(0x1eb),_0x117600,{'stdio':_0x5e0765(0x216)});let _0x18e41e='',_0x224104='';_0x5d126a[_0x5e0765(0x1de)]?.['on'](_0x5e0765(0x248),_0x464a11=>{_0x18e41e+=_0x464a11['toString']();}),_0x5d126a['stderr']?.['on'](_0x5e0765(0x248),_0x2ff764=>{const _0xa9126a=_0x5e0765;_0x224104+=_0x2ff764[_0xa9126a(0x1e6)]();}),_0x5d126a['on']('error',_0x78d858=>{const _0xeca55e=_0x5e0765;_0x78d858['code']===_0xeca55e(0x1f8)?(_0x5ad8ac?.[_0xeca55e(0x224)](_0xeca55e(0x1c5)),_0x4f2289(new SDKError(ErrorCode[_0xeca55e(0x201)],_0xeca55e(0x1c5),_0x78d858,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'}))):(_0x5ad8ac?.[_0xeca55e(0x224)](_0xeca55e(0x1fd)+_0x78d858['message']),_0x4f2289(new SDKError(ErrorCode[_0xeca55e(0x1e2)],_0xeca55e(0x257)+_0x78d858[_0xeca55e(0x1fb)],_0x78d858)));}),_0x5d126a['on'](_0x5e0765(0x280),_0x360230=>{const _0x5265e9=_0x5e0765;if(_0x360230===0x0)_0x2a3789(_0x18e41e);else _0x4e83c3?(_0x5ad8ac?.[_0x5265e9(0x224)](_0x5265e9(0x200)+_0x360230+_0x5265e9(0x268)+_0x117600[_0x5265e9(0x21e)]('\x20')),_0x4f2289(new SDKError(ErrorCode['INSTALLATION_FAILED'],_0x4e83c3,new Error(_0x224104)))):_0x2a3789('');});});}async function ensureMcpServer(_0x3dafa7,_0xdf7e0c,_0x1db2c4,_0x2c4d09,_0x226ee4){const _0x2e50eb=a11_0x515cfc;_0x2c4d09[_0x2e50eb(0x22e)]=_0x2e50eb(0x1f5)+_0x3dafa7+'\x27...';const _0x4e1c47=await executeClaudeCommand(['mcp','get',_0x3dafa7],undefined,_0x226ee4);if(_0x4e1c47){const _0x1c61cc=_0x4e1c47[_0x2e50eb(0x270)](/URL:\s*(\S+)/);if(_0x1c61cc&&_0x1c61cc[0x1]===_0xdf7e0c){_0x2c4d09[_0x2e50eb(0x22e)]='✓\x20MCP\x20server\x20\x27'+_0x3dafa7+_0x2e50eb(0x253);return;}else{if(_0x1c61cc){const _0x1fe90e=_0x1c61cc[0x1];_0x226ee4?.[_0x2e50eb(0x261)](_0x2e50eb(0x246)+_0x3dafa7+_0x2e50eb(0x24b)+_0x1fe90e+'\x20→\x20'+_0xdf7e0c),_0x2c4d09[_0x2e50eb(0x22e)]=_0x2e50eb(0x20b)+_0x3dafa7+_0x2e50eb(0x1f9),await executeClaudeCommand([_0x2e50eb(0x1f3),_0x2e50eb(0x247),_0x3dafa7],_0x2e50eb(0x1c1)+_0x3dafa7+'\x27',_0x226ee4);try{await executeClaudeCommand([_0x2e50eb(0x1f3),_0x2e50eb(0x275),_0x3dafa7,_0xdf7e0c,_0x2e50eb(0x1ea),_0x1db2c4],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0x3dafa7+'\x27',_0x226ee4),_0x2c4d09[_0x2e50eb(0x22e)]=_0x2e50eb(0x21d)+_0x3dafa7+_0x2e50eb(0x215);return;}catch(_0x464c37){_0x226ee4?.['error'](_0x2e50eb(0x267)+_0x1fe90e),await executeClaudeCommand([_0x2e50eb(0x1f3),'add',_0x3dafa7,_0x1fe90e,_0x2e50eb(0x1ea),_0x1db2c4],'Failed\x20to\x20restore\x20MCP\x20server\x20\x27'+_0x3dafa7+_0x2e50eb(0x25d)+_0x1fe90e,_0x226ee4)[_0x2e50eb(0x1e8)](_0x31c950=>_0x226ee4?.[_0x2e50eb(0x224)](_0x2e50eb(0x232)+_0x31c950));throw _0x464c37;}}}}await executeClaudeCommand([_0x2e50eb(0x1f3),_0x2e50eb(0x275),_0x3dafa7,_0xdf7e0c,_0x2e50eb(0x1ea),_0x1db2c4],_0x2e50eb(0x1c0)+_0x3dafa7+'\x27',_0x226ee4),_0x2c4d09['text']=_0x2e50eb(0x21d)+_0x3dafa7+_0x2e50eb(0x253);}const TD_DOCS_MCP_URL=a11_0x515cfc(0x213);export const TD_MCP_SERVERS=[{'name':a11_0x515cfc(0x256),'url':TD_DOCS_MCP_URL,'transport':a11_0x515cfc(0x1d0)}];export const DEFAULT_TD_SKILLS_URL=a11_0x515cfc(0x206);export function getTdSkillsRepoUrl(){const _0x301a55=process.env.TDX_TD_SKILLS_REPO;if(_0x301a55)return _0x301a55;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x44bd01,_0x5d70e5){const _0x194784=a11_0x515cfc;try{const _0x1206f9=await executeClaudeCommand([_0x194784(0x237),_0x194784(0x1f6),_0x194784(0x1d7)],'Failed\x20to\x20list\x20marketplaces',_0x5d70e5);if(!_0x1206f9['includes'](_0x44bd01)){_0x5d70e5?.[_0x194784(0x22f)](_0x194784(0x24e)+_0x44bd01+_0x194784(0x1e7));return;}await executeClaudeCommand([_0x194784(0x237),_0x194784(0x1f6),'remove',_0x44bd01],_0x194784(0x26c)+_0x44bd01+'\x27',_0x5d70e5),_0x5d70e5?.[_0x194784(0x261)](_0x194784(0x24e)+_0x44bd01+_0x194784(0x22c));}catch(_0x5c3d67){_0x5d70e5?.[_0x194784(0x1d2)](_0x194784(0x26c)+_0x44bd01+_0x194784(0x269)+_0x5c3d67);}}async function restoreDefaultTdSkillsMarketplace(_0x5d29af){const _0x4a39bd=a11_0x515cfc;try{await removeMarketplace('td-skills',_0x5d29af),await executeClaudeCommand([_0x4a39bd(0x237),'marketplace','add',DEFAULT_TD_SKILLS_URL],undefined,_0x5d29af),_0x5d29af?.[_0x4a39bd(0x261)]('Restored\x20default\x20td-skills\x20marketplace');}catch{}}async function ensureMarketplace(_0x403f5e,_0x265649,_0x30c1d8,_0x202aea){const _0x6bcf61=a11_0x515cfc;_0x30c1d8[_0x6bcf61(0x22e)]=_0x6bcf61(0x274)+_0x403f5e+_0x6bcf61(0x1c6),await executeClaudeCommand([_0x6bcf61(0x237),'marketplace','add',_0x265649],_0x6bcf61(0x231)+_0x403f5e+'\x27',_0x202aea),_0x30c1d8[_0x6bcf61(0x22e)]='✓\x20Marketplace\x20\x27'+_0x403f5e+_0x6bcf61(0x253);}async function updateMarketplace(_0x2d1dff,_0xa885f5,_0x168f6b){const _0x2e7014=a11_0x515cfc;_0xa885f5[_0x2e7014(0x22e)]='Updating\x20marketplace\x20\x27'+_0x2d1dff+_0x2e7014(0x1c6),await executeClaudeCommand(['plugin',_0x2e7014(0x1f6),_0x2e7014(0x279),_0x2d1dff],_0x2e7014(0x233)+_0x2d1dff+'\x27',_0x168f6b),_0xa885f5[_0x2e7014(0x22e)]=_0x2e7014(0x27b)+_0x2d1dff+_0x2e7014(0x215);}async function ensurePlugin(_0x10a220,_0x5c52c6,_0x5a4cf0,_0x365390){const _0x54106e=a11_0x515cfc;_0x5a4cf0[_0x54106e(0x22e)]=_0x54106e(0x209)+_0x10a220+_0x54106e(0x1c6),await executeClaudeCommand([_0x54106e(0x237),_0x54106e(0x1d1),_0x10a220+'@'+_0x5c52c6],_0x54106e(0x235)+_0x10a220+'\x27',_0x365390),_0x5a4cf0[_0x54106e(0x22e)]=_0x54106e(0x24f)+_0x10a220+_0x54106e(0x265);}export const TD_SKILLS_PLUGINS=['sql-skills',a11_0x515cfc(0x1ef),a11_0x515cfc(0x236)];export const SETUP_TTL_MS=0xe*0x18*0x3c*0x3c*0x3e8;function isWithinTtl(_0x37446b){const _0x3faeec=a11_0x515cfc;if(!_0x37446b)return![];const _0x5ca867=Date[_0x3faeec(0x20f)]()-new Date(_0x37446b)[_0x3faeec(0x1fc)]();return Number[_0x3faeec(0x23b)](_0x5ca867)&&_0x5ca867>=0x0&&_0x5ca867<=SETUP_TTL_MS;}const setupCache=createGlobalCache(a11_0x515cfc(0x1c9),a11_0x515cfc(0x255));function updateSetupCache(_0x4e1ee2){const _0x59c1c1=a11_0x515cfc;try{setupCache['write']({...setupCache[_0x59c1c1(0x24c)](),..._0x4e1ee2});}catch{}}function isTdxUpgradeSinceSetup(){const _0x3d3050=a11_0x515cfc;return setupCache[_0x3d3050(0x24c)]()?.[_0x3d3050(0x1dc)]!==getVersion();}export function recordSetupVersion(){updateSetupCache({'tdxVersion':getVersion()});}function isSkillsRefreshDue(_0x1bac20,_0x5e22af){const _0x10e594=a11_0x515cfc,_0x123121=setupCache[_0x10e594(0x24c)]()?.['skills'];if(!_0x123121)return!![];if(_0x123121[_0x10e594(0x23a)]!==_0x1bac20||_0x123121[_0x10e594(0x22a)]!==_0x5e22af||_0x123121[_0x10e594(0x1e0)]?.[_0x10e594(0x21e)](',')!==TD_SKILLS_PLUGINS[_0x10e594(0x21e)](','))return!![];return!isWithinTtl(_0x123121['refreshedAt']);}export function recordSkillsRefresh(_0xaea6,_0x191d50){const _0x298f4f=a11_0x515cfc;updateSetupCache({'skills':{'refreshedAt':new Date()[_0x298f4f(0x1fa)](),'repoUrl':_0xaea6,'releaseChannel':_0x191d50,'pluginIds':TD_SKILLS_PLUGINS}});}const MCP_SETUP_MAX_CWDS=0x64;function wasMcpConfiguredRecently(_0x3039e7,_0x1b4fa1){const _0x4206b0=a11_0x515cfc,_0x4ee03b=setupCache[_0x4206b0(0x24c)]()?.[_0x4206b0(0x1f3)]?.[_0x3039e7[_0x4206b0(0x23d)]];if(_0x4ee03b?.[_0x4206b0(0x1e4)]!==_0x3039e7[_0x4206b0(0x1e4)])return![];return isWithinTtl(_0x4ee03b[_0x4206b0(0x25a)]?.[_0x1b4fa1]);}function a11_0x313a(){const _0x34042d=['text','debug','description','Failed\x20to\x20configure\x20marketplace\x20\x27','Restore\x20also\x20failed:\x20','Failed\x20to\x20update\x20marketplace\x20\x27','...','Failed\x20to\x20install\x20plugin\x20\x27','tdx-skills','plugin','stop','http://127.0.0.1:','repoUrl','isFinite','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','name','getCurrent','filter','cwd','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','git','inherit','logger','INVALID_ARGUMENT','MCP\x20server\x20\x27','remove','data','CLAUDE_CODE_UNSUPPORTED_VERSION','✓\x20td-skills\x20checked\x20out\x20at\x20','\x27\x20URL\x20changed:\x20','read','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','Marketplace\x20\x27','✓\x20Plugin\x20\x27','td-skills','continue','--tags','\x27\x20configured','sort','claude-command','td-docs','Failed\x20to\x20spawn\x20claude\x20command:\x20','setUpClaudeIntegration','close','cwds','fromEntries','origin','\x27\x20to\x20','\x20or\x20later.','tdx-managed-proxy','td-skills\x20checked\x20out\x20at\x20tag\x20','info','TDX_PROFILE','\x20already\x20configured','7907232cwTxHy','\x27\x20installed','localeCompare','Failed\x20to\x20add\x20new\x20URL,\x20restoring\x20previous\x20URL:\x20','):\x20claude\x20','\x27:\x20','\x20→\x20','Authentication\x20required\x20for\x20TD\x20LLM\x20Proxy.\x20Run:\x20tdx\x20auth\x20setup','Failed\x20to\x20remove\x20marketplace\x20\x27','logLevel','694YuiaxW','11696526EySIXs','match','--version','Failed\x20to\x20launch\x20Claude\x20Code:\x20','td-skills\x20marketplace\x20dir\x20not\x20found,\x20skipping\x20release\x20tag\x20checkout','Configuring\x20marketplace\x20\x27','add','us01','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','Command\x20output:\x20','update','getLogPath','✓\x20Marketplace\x20\x27','2.0.20','oauth','port','plugins','exit','--settings','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','unshift','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Failed\x20to\x20remove\x20outdated\x20MCP\x20server\x20\x27','access_token','5003337BBVNfB','entries','Claude\x20Code\x20CLI\x20not\x20found','\x27...','656wGvqix','some','claude_setup.json','init','false','10192632NSUsLB','map','missingPlugins','Warning:\x20Failed\x20to\x20configure\x20','http','install','warn','CLAUDE_CODE_USE_BEDROCK','Executing:\x20claude\x20','patch','already\x20installed','list','--settings=','main','transport','2582167PkrPng','tdxVersion','command','stdout','Claude\x20Code\x20version\x20','pluginIds','Claude\x20Code\x20version\x20check\x20failed','INTERNAL','\x20meets\x20minimum\x20requirement','url','includes','toString','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','catch','resume','--transport','claude','verbose','context','missingMcpServers','workflow-skills','log','✓\x20Logs\x20saved\x20to\x20','stringify','mcp','account_id','Configuring\x20MCP\x20server\x20\x27','marketplace','site','ENOENT','\x27\x20URL...','toISOString','message','getTime','Command\x20spawn\x20error:\x20','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','proxy','Command\x20failed\x20(exit\x20','CLAUDE_CODE_NOT_FOUND','fetch','passThroughServer','minor','tdx\x20--profile\x20','https://github.com/treasure-data/td-skills','length','\x20claude\x20statusline','Installing\x20plugin\x20\x27','refresh_token','Updating\x20MCP\x20server\x20\x27','cause','refresh','marketplaces','now','5595350BuJCCd','--hard','tdx\x20claude\x20statusline','https://docs.treasure.ai/mcp','checkout','\x27\x20updated','pipe','trim','major','start','td-skills\x20Plugins','user','Setup\x20failed','✓\x20MCP\x20server\x20\x27','join','✓\x20Claude\x20Code\x20version\x20OK','Initializing...','--force','\x20configuration\x20failed','profile','error','fail','Initializing\x20proxy\x20logger...','4lSIqaP','\x20is\x20too\x20old\x20(minimum:\x20','✓\x20Logging\x20to\x20','releaseChannel','llm-proxy','\x27\x20removed','Failed\x20to\x20apply\x20td-skills\x20release\x20channel:\x20'];a11_0x313a=function(){return _0x34042d;};return a11_0x313a();}export function recordMcpSetup(_0x36f474,_0x2a0b48){const _0x35b701=a11_0x515cfc,_0x52b36d=setupCache[_0x35b701(0x24c)]()?.[_0x35b701(0x1f3)]??{},_0x4b222f=_0x52b36d[_0x36f474[_0x35b701(0x23d)]],_0xbcbc2=_0x4b222f?.[_0x35b701(0x1e4)]===_0x36f474[_0x35b701(0x1e4)]?_0x4b222f['cwds']:{},_0x431d95=Object[_0x35b701(0x1c4)]({..._0xbcbc2,[_0x2a0b48]:new Date()['toISOString']()})['filter'](([,_0x4b43d4])=>isWithinTtl(_0x4b43d4))[_0x35b701(0x254)](([,_0xc59c28],[,_0x1e24ab])=>_0x1e24ab[_0x35b701(0x266)](_0xc59c28))['slice'](0x0,MCP_SETUP_MAX_CWDS);updateSetupCache({'mcp':{..._0x52b36d,[_0x36f474[_0x35b701(0x23d)]]:{'url':_0x36f474[_0x35b701(0x1e4)],'cwds':Object[_0x35b701(0x25b)](_0x431d95)}}});}export function hasSetupWork(_0x4ef320){const _0x5d79f9=a11_0x515cfc;return _0x4ef320[_0x5d79f9(0x1ee)][_0x5d79f9(0x207)]>0x0||_0x4ef320[_0x5d79f9(0x1f6)]||_0x4ef320['missingPlugins'][_0x5d79f9(0x207)]>0x0||_0x4ef320[_0x5d79f9(0x20d)];}export function planClaudeSetup(_0x26f65b,_0x1141b1,_0x3d6110){const _0x4a64bb=a11_0x515cfc;if(_0x3d6110||isTdxUpgradeSinceSetup())return{'missingMcpServers':TD_MCP_SERVERS[_0x4a64bb(0x1cd)](_0x240e1c=>_0x240e1c[_0x4a64bb(0x23d)]),'marketplace':!![],'missingPlugins':[...TD_SKILLS_PLUGINS],'refresh':!![]};const _0x379d1b=readMarketplaceSourceUrl(_0x4a64bb(0x250))!==normalizeRepoUrl(_0x26f65b),_0x567e0a=_0x379d1b?[...TD_SKILLS_PLUGINS]:TD_SKILLS_PLUGINS[_0x4a64bb(0x23f)](_0x7f2ee5=>!isPluginInstalled(_0x7f2ee5,_0x4a64bb(0x250))),_0x49e413=_0x26f65b!==DEFAULT_TD_SKILLS_URL,_0x53829d=process['cwd'](),_0xcc8894=TD_MCP_SERVERS['filter'](_0x1e90ad=>findMcpServerUrl(_0x1e90ad[_0x4a64bb(0x23d)],_0x53829d)!==_0x1e90ad[_0x4a64bb(0x1e4)]&&!wasMcpConfiguredRecently(_0x1e90ad,_0x53829d))[_0x4a64bb(0x1cd)](_0x4b6d83=>_0x4b6d83[_0x4a64bb(0x23d)]);return{'missingMcpServers':_0xcc8894,'marketplace':_0x379d1b,'missingPlugins':_0x567e0a,'refresh':_0x379d1b||_0x567e0a[_0x4a64bb(0x207)]>0x0||_0x49e413||isSkillsRefreshDue(_0x26f65b,_0x1141b1)};}async function checkoutReleaseTag(_0x30ef2d,_0x2b4323,_0x3d2a19){const _0xaa214a=a11_0x515cfc,_0x1d87fe=join(getClaudeConfigDir(),_0xaa214a(0x27f),_0xaa214a(0x20e),_0xaa214a(0x250));if(!existsSync(_0x1d87fe)){_0x3d2a19?.[_0xaa214a(0x22f)](_0xaa214a(0x273));return;}_0x2b4323[_0xaa214a(0x22e)]='Checking\x20out\x20td-skills\x20'+_0x30ef2d+_0xaa214a(0x234),await execFileAsync(_0xaa214a(0x242),[_0xaa214a(0x202),_0xaa214a(0x25c),_0xaa214a(0x252),_0xaa214a(0x221)],{'cwd':_0x1d87fe});try{await execFileAsync(_0xaa214a(0x242),[_0xaa214a(0x214),_0xaa214a(0x1d9)],{'cwd':_0x1d87fe});}catch{await execFileAsync(_0xaa214a(0x242),['checkout','-b','main','origin/main'],{'cwd':_0x1d87fe});}await execFileAsync(_0xaa214a(0x242),['reset',_0xaa214a(0x211),_0x30ef2d],{'cwd':_0x1d87fe}),_0x2b4323[_0xaa214a(0x22e)]=_0xaa214a(0x24a)+_0x30ef2d,_0x3d2a19?.[_0xaa214a(0x261)](_0xaa214a(0x260)+_0x30ef2d);}export class ClaudeCommand extends BaseCommand{[a11_0x515cfc(0x23d)]=a11_0x515cfc(0x1eb);[a11_0x515cfc(0x230)]=a11_0x515cfc(0x1fe);[a11_0x515cfc(0x203)];[a11_0x515cfc(0x244)];['port'];async['setUpClaudeIntegration'](_0x2ae0d3,_0x1fc4bc,_0xf9a510){const _0xead80d=a11_0x515cfc,_0x48e741=loadReleaseChannel(),_0x596f02=planClaudeSetup(_0x2ae0d3,_0x48e741,_0x1fc4bc);this[_0xead80d(0x244)]?.[_0xead80d(0x22f)]('Claude\x20setup\x20plan:\x20'+JSON[_0xead80d(0x1f2)](_0x596f02));if(!hasSetupWork(_0x596f02))return;try{_0xf9a510[_0xead80d(0x22e)]='Checking\x20Claude\x20Code\x20version...',await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0xead80d(0x244)]),_0xf9a510[_0xead80d(0x22e)]=_0xead80d(0x21f);}catch(_0x463589){_0xf9a510['fail'](_0xead80d(0x1e1));throw _0x463589;}let _0x144c9f=!![];for(const _0x40edca of TD_MCP_SERVERS['filter'](_0x9e2bf2=>_0x596f02[_0xead80d(0x1ee)][_0xead80d(0x1e5)](_0x9e2bf2[_0xead80d(0x23d)]))){try{await ensureMcpServer(_0x40edca['name'],_0x40edca[_0xead80d(0x1e4)],_0x40edca[_0xead80d(0x1da)],_0xf9a510,this[_0xead80d(0x244)]),recordMcpSetup(_0x40edca,process[_0xead80d(0x240)]());}catch(_0x40cb6e){_0x144c9f=![],handleInstallationError(_0x40cb6e,_0xead80d(0x246)+_0x40edca[_0xead80d(0x23d)]+'\x27',_0xf9a510,this[_0xead80d(0x244)]);}}try{_0x596f02[_0xead80d(0x1f6)]&&(await removeMarketplace(_0xead80d(0x250),this[_0xead80d(0x244)]),await ensureMarketplace('td-skills',_0x2ae0d3,_0xf9a510,this[_0xead80d(0x244)]));_0x596f02[_0xead80d(0x20d)]&&await updateMarketplace(_0xead80d(0x250),_0xf9a510,this[_0xead80d(0x244)]);for(const _0x5a9357 of _0x596f02[_0xead80d(0x1ce)]){await ensurePlugin(_0x5a9357,_0xead80d(0x250),_0xf9a510,this[_0xead80d(0x244)]);}if(_0x596f02['refresh'])try{const _0x25b092=await resolveReleaseTag(_0x48e741,'treasure-data','td-skills','tdx-cli');_0x25b092&&await checkoutReleaseTag(_0x25b092,_0xf9a510,this[_0xead80d(0x244)]),recordSkillsRefresh(_0x2ae0d3,_0x48e741);}catch(_0x4e2978){_0x144c9f=![],this[_0xead80d(0x244)]?.['warn'](_0xead80d(0x22d)+_0x4e2978);}}catch(_0x477520){_0x144c9f=![],handleInstallationError(_0x477520,_0xead80d(0x21a),_0xf9a510,this['logger']);}_0x144c9f&&recordSetupVersion();}async['execute'](_0x552442){const _0xa6bf02=a11_0x515cfc,{tdx:_0x330cfb,options:_0xdf0692,args:_0x3230a8}=_0x552442;let _0x38edd2=![];try{const _0x164d76=_0xdf0692,_0x4f59b6=_0x164d76[_0xa6bf02(0x1ff)]===![],_0x27e1b7=_0x164d76[_0xa6bf02(0x251)]===!![],_0x4262ab=_0x164d76[_0xa6bf02(0x1e9)]===!![],_0x258b5a=[..._0x3230a8];if(_0x27e1b7)_0x258b5a[_0xa6bf02(0x1bf)]('-c');else _0x4262ab&&_0x258b5a[_0xa6bf02(0x1bf)]('-r');const _0x4be8e8=createCommandSpinner(_0xa6bf02(0x220),{'verbose':_0xdf0692[_0xa6bf02(0x1ec)]});_0x4be8e8[_0xa6bf02(0x219)]();try{if(!_0x4f59b6){const _0x17eafd=_0xdf0692[_0xa6bf02(0x223)];try{const _0x534232=await _0x330cfb[_0xa6bf02(0x21b)][_0xa6bf02(0x23e)]();_0x534232['account_id']&&writeCachedAccountInfo(_0xdf0692['site']??_0xa6bf02(0x276),_0x534232[_0xa6bf02(0x1f4)],_0x17eafd);}catch{}_0x4be8e8[_0xa6bf02(0x22e)]=_0xa6bf02(0x226),this[_0xa6bf02(0x244)]=new TDXLogger(_0xdf0692[_0xa6bf02(0x26d)],!![]),await this[_0xa6bf02(0x244)][_0xa6bf02(0x1ca)]();const _0x2d972c=this[_0xa6bf02(0x244)][_0xa6bf02(0x27a)]();_0x4be8e8[_0xa6bf02(0x22e)]=_0xa6bf02(0x229)+_0x2d972c;const _0x2446f5=getEndpoint(_0xdf0692[_0xa6bf02(0x1f7)],_0xa6bf02(0x22b));_0x4be8e8['text']=_0xa6bf02(0x283);let _0x4b727b;const _0x59245a=await getOAuthTokens(_0x17eafd);if(_0x59245a)_0x4b727b={'type':_0xa6bf02(0x27d),'accessToken':_0x59245a[_0xa6bf02(0x1c2)],'refreshToken':_0x59245a[_0xa6bf02(0x20a)],'expiresAt':_0x59245a['expires_at'],'consoleUrl':getConsoleUrl(_0xdf0692[_0xa6bf02(0x1f7)])};else{if(_0x330cfb[_0xa6bf02(0x1ed)]['apiKey'])_0x4b727b={'type':'apikey','apiKey':_0x330cfb[_0xa6bf02(0x1ed)]['apiKey']};else throw new SDKError(ErrorCode[_0xa6bf02(0x245)],_0xa6bf02(0x26b));}this[_0xa6bf02(0x203)]=new PassThroughProxyServer({'startPort':0xfa0,'llmProxyUrl':_0x2446f5,'auth':_0x4b727b,'logger':this['logger'],'site':_0xdf0692[_0xa6bf02(0x1f7)]??_0xa6bf02(0x276),'profile':_0x17eafd,'proxy':_0x330cfb['context'][_0xa6bf02(0x1ff)]}),await this[_0xa6bf02(0x203)][_0xa6bf02(0x219)](),this[_0xa6bf02(0x27e)]=this[_0xa6bf02(0x203)][_0xa6bf02(0x27e)],_0x4be8e8['text']='✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20'+this['port']+_0xa6bf02(0x26a)+_0x2446f5,_0x4be8e8[_0xa6bf02(0x22e)]='✓\x20TD\x20LLM\x20proxy\x20settings\x20prepared\x20for\x20this\x20session';}else _0x4be8e8[_0xa6bf02(0x22e)]='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';const _0x4d6582=getTdSkillsRepoUrl();_0x38edd2=_0x4d6582!==DEFAULT_TD_SKILLS_URL,await this[_0xa6bf02(0x258)](_0x4d6582,_0x164d76[_0xa6bf02(0x20d)]===!![],_0x4be8e8),_0x4be8e8[_0xa6bf02(0x238)]();}catch(_0x44a116){_0x4be8e8[_0xa6bf02(0x225)](_0xa6bf02(0x21c));throw _0x44a116;}const _0x362940=await findExecutable('claude');if(!_0x362940)throw new SDKError(ErrorCode[_0xa6bf02(0x201)],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':_0xa6bf02(0x241)});const _0x2fb816=_0x4f59b6?_0x258b5a:buildClaudeLaunchArgs(_0x258b5a,_0x330cfb[_0xa6bf02(0x1ed)][_0xa6bf02(0x223)]),_0x3fb41a={...process.env};!_0x4f59b6&&(_0x3fb41a['ANTHROPIC_BASE_URL']=_0xa6bf02(0x239)+this[_0xa6bf02(0x27e)],_0x3fb41a['ANTHROPIC_AUTH_TOKEN']=_0xa6bf02(0x25f),_0x3fb41a[_0xa6bf02(0x1d3)]=_0xa6bf02(0x1cb),_0x3fb41a['CLAUDE_CODE_USE_VERTEX']=_0xa6bf02(0x1cb));_0x330cfb[_0xa6bf02(0x1ed)][_0xa6bf02(0x223)]&&(_0x3fb41a[_0xa6bf02(0x262)]=_0x330cfb[_0xa6bf02(0x1ed)][_0xa6bf02(0x223)]);const _0xebd3de=crossSpawn(_0x362940,_0x2fb816,{'stdio':_0xa6bf02(0x243),'env':_0x3fb41a}),_0x3c4b17=await new Promise(_0x1b5ef6=>{const _0x1160b3=_0xa6bf02;_0xebd3de['on'](_0x1160b3(0x280),_0x531090=>{_0x1b5ef6(_0x531090||0x0);}),_0xebd3de['on']('error',_0x3eb976=>{const _0xd8e9ca=_0x1160b3;console['error'](a11_0xea792e['red'](_0xd8e9ca(0x272)+_0x3eb976['message'])),_0x1b5ef6(0x1);});});_0x38edd2&&await restoreDefaultTdSkillsMarketplace(this['logger']);this[_0xa6bf02(0x203)]&&(await this[_0xa6bf02(0x203)][_0xa6bf02(0x238)](),console[_0xa6bf02(0x1f0)](a11_0xea792e['green'](_0xa6bf02(0x277))));if(this[_0xa6bf02(0x244)]){await this[_0xa6bf02(0x244)]['close']();const _0xcdcd75=this[_0xa6bf02(0x244)]['getLogPath']();console[_0xa6bf02(0x1f0)](a11_0xea792e['green'](_0xa6bf02(0x1f1)+_0xcdcd75));}return _0x3c4b17;}catch(_0x558a6e){_0x38edd2&&await restoreDefaultTdSkillsMarketplace(this[_0xa6bf02(0x244)]);this['passThroughServer']&&await this[_0xa6bf02(0x203)][_0xa6bf02(0x238)]();this[_0xa6bf02(0x244)]&&await this[_0xa6bf02(0x244)][_0xa6bf02(0x259)]();throw _0x558a6e;}}}
1
+ const a11_0x3bbffe=a11_0x32a8;(function(_0x437d8b,_0x55705e){const _0x2b747a=a11_0x32a8,_0x11cd18=_0x437d8b();while(!![]){try{const _0x2ef63f=-parseInt(_0x2b747a(0x226))/0x1+parseInt(_0x2b747a(0x1c2))/0x2*(-parseInt(_0x2b747a(0x1c9))/0x3)+parseInt(_0x2b747a(0x277))/0x4*(-parseInt(_0x2b747a(0x1d6))/0x5)+-parseInt(_0x2b747a(0x221))/0x6*(-parseInt(_0x2b747a(0x230))/0x7)+-parseInt(_0x2b747a(0x26a))/0x8*(-parseInt(_0x2b747a(0x261))/0x9)+-parseInt(_0x2b747a(0x258))/0xa*(-parseInt(_0x2b747a(0x1cf))/0xb)+parseInt(_0x2b747a(0x1f7))/0xc*(parseInt(_0x2b747a(0x232))/0xd);if(_0x2ef63f===_0x55705e)break;else _0x11cd18['push'](_0x11cd18['shift']());}catch(_0x2e2a0e){_0x11cd18['push'](_0x11cd18['shift']());}}}(a11_0x3762,0x42f78));import{execFile}from'node:child_process';import{existsSync}from'node:fs';import{join}from'node:path';import{promisify}from'node:util';import a11_0x369d28 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{getVersion}from'../core/version.js';function a11_0x32a8(_0x4a0a56,_0x30f35d){_0x4a0a56=_0x4a0a56-0x1c1;const _0x37622c=a11_0x3762();let _0x32a894=_0x37622c[_0x4a0a56];return _0x32a894;}import{resolveReleaseTag}from'../utils/github-releases.js';import{createGlobalCache}from'../utils/global-cache.js';import{findMcpServerUrl,getClaudeConfigDir,isPluginInstalled,normalizeRepoUrl,readMarketplaceSourceUrl}from'../utils/claude-code-state.js';const execFileAsync=promisify(execFile),MIN_CLAUDE_VERSION=a11_0x3bbffe(0x1e2);export function buildClaudeSettingsArgs(_0x4711fe){const _0x525f47=a11_0x3bbffe;return['--settings',JSON[_0x525f47(0x219)]({'statusLine':{'type':_0x525f47(0x271),'command':_0x4711fe?'tdx\x20--profile\x20'+_0x4711fe+'\x20claude\x20statusline':_0x525f47(0x1fc)}})];}export function buildClaudeLaunchArgs(_0x4ad023,_0x2efbc6){const _0x3aae6b=a11_0x3bbffe;if(_0x4ad023[_0x3aae6b(0x1df)](_0x3aae6b(0x273))||_0x4ad023['some'](_0x3e60a8=>_0x3e60a8[_0x3aae6b(0x1f1)](_0x3aae6b(0x23e))))return[..._0x4ad023];return[..._0x4ad023,...buildClaudeSettingsArgs(_0x2efbc6)];}function handleInstallationError(_0x2e007d,_0xfafe4b,_0x57940b,_0x5d9d8){const _0xa5271f=a11_0x3bbffe;errorContains(_0x2e007d,'already\x20exists','already\x20installed',_0xa5271f(0x204))?(_0x57940b[_0xa5271f(0x21b)]='✓\x20'+_0xfafe4b+_0xa5271f(0x1de),_0x5d9d8?.[_0xa5271f(0x265)](_0xfafe4b+_0xa5271f(0x1de)),_0x2e007d instanceof SDKError&&_0x2e007d['cause']&&_0x5d9d8?.[_0xa5271f(0x1f3)](_0xa5271f(0x20e)+_0x2e007d[_0xa5271f(0x213)][_0xa5271f(0x23b)])):(_0x57940b[_0xa5271f(0x208)](_0xa5271f(0x212)+_0xfafe4b),_0x5d9d8?.['error'](_0xfafe4b+'\x20configuration\x20failed',_0x2e007d));}export function parseVersion(_0x200e08){const _0x251cca=a11_0x3bbffe,_0x49d44e=_0x200e08[_0x251cca(0x27e)]()[_0x251cca(0x21d)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x49d44e)return null;return{'major':parseInt(_0x49d44e[0x1],0xa),'minor':parseInt(_0x49d44e[0x2],0xa),'patch':parseInt(_0x49d44e[0x3],0xa)};}export function compareVersions(_0x14dd44,_0x3ab401){const _0x1f53d3=a11_0x3bbffe;if(_0x14dd44[_0x1f53d3(0x225)]!==_0x3ab401[_0x1f53d3(0x225)])return _0x14dd44[_0x1f53d3(0x225)]-_0x3ab401[_0x1f53d3(0x225)];if(_0x14dd44[_0x1f53d3(0x235)]!==_0x3ab401[_0x1f53d3(0x235)])return _0x14dd44[_0x1f53d3(0x235)]-_0x3ab401['minor'];return _0x14dd44[_0x1f53d3(0x259)]-_0x3ab401[_0x1f53d3(0x259)];}async function checkClaudeVersion(_0x4d29f4,_0x28ed3a){const _0x370e31=a11_0x3bbffe;_0x28ed3a?.[_0x370e31(0x1f3)]('Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20'+_0x4d29f4+')');const _0x34da0d=await executeClaudeCommand([_0x370e31(0x1da)],undefined,_0x28ed3a),_0x107fd5=parseVersion(_0x34da0d);if(!_0x107fd5){_0x28ed3a?.[_0x370e31(0x208)](_0x370e31(0x248)+_0x34da0d);return;}const _0x41f617=_0x107fd5[_0x370e31(0x225)]+'.'+_0x107fd5[_0x370e31(0x235)]+'.'+_0x107fd5[_0x370e31(0x259)],_0x73058a=parseVersion(_0x4d29f4);if(!_0x73058a){_0x28ed3a?.[_0x370e31(0x208)](_0x370e31(0x1e9)+_0x4d29f4);return;}if(compareVersions(_0x107fd5,_0x73058a)<0x0){_0x28ed3a?.['error'](_0x370e31(0x1d2)+_0x41f617+_0x370e31(0x1e1)+_0x4d29f4+')');throw new SDKError(ErrorCode[_0x370e31(0x27d)],'Claude\x20Code\x20version\x20'+_0x41f617+_0x370e31(0x249)+_0x4d29f4+'\x20or\x20later.',undefined,{'helpText':_0x370e31(0x1fb)});}_0x28ed3a?.[_0x370e31(0x1f3)](_0x370e31(0x1d2)+_0x41f617+_0x370e31(0x207));}async function executeClaudeCommand(_0x52cbb0,_0x3816d9,_0x4abda6){const _0x21f2f4=a11_0x3bbffe;return _0x4abda6?.['info'](_0x21f2f4(0x1d5)+_0x52cbb0[_0x21f2f4(0x1f2)]('\x20')),new Promise((_0x501136,_0x551964)=>{const _0x3ab408=_0x21f2f4,_0xbef3ba=crossSpawn(_0x3ab408(0x251),_0x52cbb0,{'stdio':'pipe'});let _0x32e5bb='',_0x1ce8e5='';_0xbef3ba['stdout']?.['on'](_0x3ab408(0x237),_0x563548=>{const _0x3ff7c1=_0x3ab408;_0x32e5bb+=_0x563548[_0x3ff7c1(0x25d)]();}),_0xbef3ba[_0x3ab408(0x21f)]?.['on'](_0x3ab408(0x237),_0x3532f9=>{const _0xb40260=_0x3ab408;_0x1ce8e5+=_0x3532f9[_0xb40260(0x25d)]();}),_0xbef3ba['on'](_0x3ab408(0x1cc),_0x4966a4=>{const _0xe6f52e=_0x3ab408;_0x4966a4['code']===_0xe6f52e(0x267)?(_0x4abda6?.[_0xe6f52e(0x1cc)](_0xe6f52e(0x24d)),_0x551964(new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],'Claude\x20Code\x20CLI\x20not\x20found',_0x4966a4,{'helpText':_0xe6f52e(0x26d)}))):(_0x4abda6?.[_0xe6f52e(0x1cc)](_0xe6f52e(0x22c)+_0x4966a4[_0xe6f52e(0x23b)]),_0x551964(new SDKError(ErrorCode['INTERNAL'],_0xe6f52e(0x202)+_0x4966a4[_0xe6f52e(0x23b)],_0x4966a4)));}),_0xbef3ba['on']('exit',_0x846d97=>{const _0x3b1a7f=_0x3ab408;if(_0x846d97===0x0)_0x501136(_0x32e5bb);else _0x3816d9?(_0x4abda6?.['error']('Command\x20failed\x20(exit\x20'+_0x846d97+_0x3b1a7f(0x1ed)+_0x52cbb0[_0x3b1a7f(0x1f2)]('\x20')),_0x551964(new SDKError(ErrorCode[_0x3b1a7f(0x1ee)],_0x3816d9,new Error(_0x1ce8e5)))):_0x501136('');});});}async function ensureMcpServer(_0x22603b,_0x20ca46,_0x4c0db6,_0x3d021e,_0x364398){const _0x534061=a11_0x3bbffe;_0x3d021e[_0x534061(0x21b)]=_0x534061(0x229)+_0x22603b+_0x534061(0x200);const _0x5033d4=await executeClaudeCommand([_0x534061(0x1e6),_0x534061(0x1f9),_0x22603b],undefined,_0x364398);if(_0x5033d4){const _0x2e68b3=_0x5033d4[_0x534061(0x21d)](/URL:\s*(\S+)/);if(_0x2e68b3&&_0x2e68b3[0x1]===_0x20ca46){_0x3d021e['text']=_0x534061(0x1ec)+_0x22603b+_0x534061(0x1c3);return;}else{if(_0x2e68b3){const _0x399758=_0x2e68b3[0x1];_0x364398?.['info'](_0x534061(0x27a)+_0x22603b+'\x27\x20URL\x20changed:\x20'+_0x399758+_0x534061(0x276)+_0x20ca46),_0x3d021e[_0x534061(0x21b)]=_0x534061(0x223)+_0x22603b+'\x27\x20URL...',await executeClaudeCommand([_0x534061(0x1e6),_0x534061(0x238),_0x22603b],'Failed\x20to\x20remove\x20outdated\x20MCP\x20server\x20\x27'+_0x22603b+'\x27',_0x364398);try{await executeClaudeCommand([_0x534061(0x1e6),'add',_0x22603b,_0x20ca46,_0x534061(0x1e8),_0x4c0db6],_0x534061(0x224)+_0x22603b+'\x27',_0x364398),_0x3d021e[_0x534061(0x21b)]='✓\x20MCP\x20server\x20\x27'+_0x22603b+_0x534061(0x214);return;}catch(_0x19c0f0){_0x364398?.[_0x534061(0x1cc)]('Failed\x20to\x20add\x20new\x20URL,\x20restoring\x20previous\x20URL:\x20'+_0x399758),await executeClaudeCommand([_0x534061(0x1e6),_0x534061(0x1f8),_0x22603b,_0x399758,_0x534061(0x1e8),_0x4c0db6],_0x534061(0x254)+_0x22603b+_0x534061(0x1eb)+_0x399758,_0x364398)[_0x534061(0x222)](_0x43ecd7=>_0x364398?.[_0x534061(0x1cc)](_0x534061(0x24e)+_0x43ecd7));throw _0x19c0f0;}}}}await executeClaudeCommand([_0x534061(0x1e6),'add',_0x22603b,_0x20ca46,_0x534061(0x1e8),_0x4c0db6],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0x22603b+'\x27',_0x364398),_0x3d021e['text']=_0x534061(0x1ec)+_0x22603b+'\x27\x20configured';}const TD_DOCS_MCP_URL='https://docs.treasure.ai/mcp';export const TD_MCP_SERVERS=[{'name':'td-docs','url':TD_DOCS_MCP_URL,'transport':a11_0x3bbffe(0x1e5)}];export const DEFAULT_TD_SKILLS_URL='https://github.com/treasure-data/td-skills';export function getTdSkillsRepoUrl(){const _0x110bb8=process.env.TDX_TD_SKILLS_REPO;if(_0x110bb8)return _0x110bb8;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0xa3c9b1,_0xf02353){const _0x54ab92=a11_0x3bbffe;try{const _0x5a0e35=await executeClaudeCommand([_0x54ab92(0x266),_0x54ab92(0x1ea),_0x54ab92(0x1d7)],_0x54ab92(0x247),_0xf02353);if(!_0x5a0e35['includes'](_0xa3c9b1)){_0xf02353?.[_0x54ab92(0x1f3)](_0x54ab92(0x1dc)+_0xa3c9b1+_0x54ab92(0x23a));return;}await executeClaudeCommand([_0x54ab92(0x266),_0x54ab92(0x1ea),_0x54ab92(0x238),_0xa3c9b1],_0x54ab92(0x241)+_0xa3c9b1+'\x27',_0xf02353),_0xf02353?.['info']('Marketplace\x20\x27'+_0xa3c9b1+'\x27\x20removed');}catch(_0x95c2e6){_0xf02353?.[_0x54ab92(0x208)](_0x54ab92(0x241)+_0xa3c9b1+'\x27:\x20'+_0x95c2e6);}}async function restoreDefaultTdSkillsMarketplace(_0x337b4d){const _0x7c1689=a11_0x3bbffe;try{await removeMarketplace('td-skills',_0x337b4d),await executeClaudeCommand([_0x7c1689(0x266),_0x7c1689(0x1ea),'add',DEFAULT_TD_SKILLS_URL],undefined,_0x337b4d),_0x337b4d?.[_0x7c1689(0x265)](_0x7c1689(0x205));}catch{}}async function ensureMarketplace(_0x298b57,_0x3e6afe,_0x221828,_0x282c70){const _0x5c6475=a11_0x3bbffe;_0x221828[_0x5c6475(0x21b)]=_0x5c6475(0x233)+_0x298b57+'\x27...',await executeClaudeCommand(['plugin','marketplace',_0x5c6475(0x1f8),_0x3e6afe],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x298b57+'\x27',_0x282c70),_0x221828[_0x5c6475(0x21b)]=_0x5c6475(0x220)+_0x298b57+'\x27\x20configured';}async function updateMarketplace(_0x33cc5b,_0x207e16,_0x5d5245){const _0x475d6c=a11_0x3bbffe;_0x207e16['text']=_0x475d6c(0x23f)+_0x33cc5b+_0x475d6c(0x200),await executeClaudeCommand(['plugin','marketplace',_0x475d6c(0x1db),_0x33cc5b],_0x475d6c(0x1e7)+_0x33cc5b+'\x27',_0x5d5245),_0x207e16[_0x475d6c(0x21b)]=_0x475d6c(0x220)+_0x33cc5b+_0x475d6c(0x214);}async function ensurePlugin(_0x237e57,_0x13d536,_0x3fde9f,_0x40d712){const _0x1f7ead=a11_0x3bbffe;_0x3fde9f[_0x1f7ead(0x21b)]=_0x1f7ead(0x1f4)+_0x237e57+_0x1f7ead(0x200),await executeClaudeCommand([_0x1f7ead(0x266),_0x1f7ead(0x262),_0x237e57+'@'+_0x13d536],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x237e57+'\x27',_0x40d712),_0x3fde9f[_0x1f7ead(0x21b)]=_0x1f7ead(0x216)+_0x237e57+_0x1f7ead(0x260);}export const TD_SKILLS_PLUGINS=['sql-skills',a11_0x3bbffe(0x279),a11_0x3bbffe(0x26f)];export const SETUP_TTL_MS=0xe*0x18*0x3c*0x3c*0x3e8;function isWithinTtl(_0x4a30d6){const _0x18534c=a11_0x3bbffe;if(!_0x4a30d6)return![];const _0x2b8b72=Date['now']()-new Date(_0x4a30d6)[_0x18534c(0x20b)]();return Number[_0x18534c(0x1ca)](_0x2b8b72)&&_0x2b8b72>=0x0&&_0x2b8b72<=SETUP_TTL_MS;}const setupCache=createGlobalCache(a11_0x3bbffe(0x256),a11_0x3bbffe(0x227));function updateSetupCache(_0x1957fb){const _0xdb0dd0=a11_0x3bbffe;try{setupCache[_0xdb0dd0(0x209)]({...setupCache['read'](),..._0x1957fb});}catch{}}function isTdxUpgradeSinceSetup(){const _0x56f8e8=a11_0x3bbffe;return setupCache['read']()?.[_0x56f8e8(0x20a)]!==getVersion();}export function recordSetupVersion(){updateSetupCache({'tdxVersion':getVersion()});}function isSkillsRefreshDue(_0x2fa1d7,_0x14c1dc){const _0x306520=a11_0x3bbffe,_0x32494b=setupCache['read']()?.['skills'];if(!_0x32494b)return!![];if(_0x32494b[_0x306520(0x244)]!==_0x2fa1d7||_0x32494b['releaseChannel']!==_0x14c1dc||_0x32494b['pluginIds']?.[_0x306520(0x1f2)](',')!==TD_SKILLS_PLUGINS[_0x306520(0x1f2)](','))return!![];return!isWithinTtl(_0x32494b[_0x306520(0x22d)]);}export function recordSkillsRefresh(_0x41bc0c,_0x86a34f){updateSetupCache({'skills':{'refreshedAt':new Date()['toISOString'](),'repoUrl':_0x41bc0c,'releaseChannel':_0x86a34f,'pluginIds':TD_SKILLS_PLUGINS}});}const MCP_SETUP_MAX_CWDS=0x64;function wasMcpConfiguredRecently(_0x472cf0,_0x547a79){const _0x22bee7=a11_0x3bbffe,_0x171f33=setupCache[_0x22bee7(0x1f5)]()?.[_0x22bee7(0x1e6)]?.[_0x472cf0[_0x22bee7(0x1d4)]];if(_0x171f33?.[_0x22bee7(0x1d1)]!==_0x472cf0[_0x22bee7(0x1d1)])return![];return isWithinTtl(_0x171f33[_0x22bee7(0x1ce)]?.[_0x547a79]);}function a11_0x3762(){const _0xc6c7f5=['Checking\x20Claude\x20Code\x20version...','logLevel','repoUrl','td-skills','ANTHROPIC_BASE_URL','Failed\x20to\x20list\x20marketplaces','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','refresh_token','TDX_PROFILE','close','Claude\x20Code\x20CLI\x20not\x20found','Restore\x20also\x20failed:\x20','Setup\x20failed','checkout','claude','tdx-cli','port','Failed\x20to\x20restore\x20MCP\x20server\x20\x27','fromEntries','claude_setup.json','Authentication\x20required\x20for\x20TD\x20LLM\x20Proxy.\x20Run:\x20tdx\x20auth\x20setup','124900eKqEJr','patch','Failed\x20to\x20apply\x20td-skills\x20release\x20channel:\x20','Initializing\x20proxy\x20logger...','start','toString','git','execute','\x27\x20installed','9CGcUts','install','CLAUDE_CODE_NOT_FOUND','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','info','plugin','ENOENT','us01','td-skills\x20marketplace\x20dir\x20not\x20found,\x20skipping\x20release\x20tag\x20checkout','563896AScaVR','Claude\x20setup\x20plan:\x20','stop','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','fail','tdx-skills','missingPlugins','command','origin','--settings','inherit','✓\x20td-skills\x20checked\x20out\x20at\x20','\x20→\x20','649948jJagVd','getLogPath','workflow-skills','MCP\x20server\x20\x27','INVALID_ARGUMENT','length','CLAUDE_CODE_UNSUPPORTED_VERSION','trim','unshift','resume','178KhqIQy','\x27\x20configured','Initializing...','td-skills\x20checked\x20out\x20at\x20tag\x20','init','ANTHROPIC_AUTH_TOKEN','CLAUDE_CODE_USE_BEDROCK','10320jUpaCz','isFinite','log','error','missingMcpServers','cwds','407KClJfp','logger','url','Claude\x20Code\x20version\x20','filter','name','Executing:\x20claude\x20','15wvhguR','list','map','✓\x20TD\x20LLM\x20proxy\x20settings\x20prepared\x20for\x20this\x20session','--version','update','Marketplace\x20\x27','refresh','\x20already\x20configured','includes','plugins','\x20is\x20too\x20old\x20(minimum:\x20','2.0.20','--force','✓\x20Logs\x20saved\x20to\x20','http','mcp','Failed\x20to\x20update\x20marketplace\x20\x27','--transport','Invalid\x20minimum\x20version\x20format:\x20','marketplace','\x27\x20to\x20','✓\x20MCP\x20server\x20\x27','):\x20claude\x20','INSTALLATION_FAILED','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','CLAUDE_CODE_USE_VERTEX','startsWith','join','debug','Installing\x20plugin\x20\x27','read','context','108qeVodi','add','get','...','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','tdx\x20claude\x20statusline','Failed\x20to\x20launch\x20Claude\x20Code:\x20','cwd','fetch','\x27...','slice','Failed\x20to\x20spawn\x20claude\x20command:\x20','apiKey','already\x20configured','Restored\x20default\x20td-skills\x20marketplace','toISOString','\x20meets\x20minimum\x20requirement','warn','write','tdxVersion','getTime','setUpClaudeIntegration','verbose','Command\x20output:\x20','site','green','td-skills\x20Plugins','Warning:\x20Failed\x20to\x20configure\x20','cause','\x27\x20updated','profile','✓\x20Plugin\x20\x27','Checking\x20out\x20td-skills\x20','tdx-managed-proxy','stringify','account_id','text','false','match','treasure-data','stderr','✓\x20Marketplace\x20\x27','108534WaZmME','catch','Updating\x20MCP\x20server\x20\x27','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','major','119154oesGVI','claude-command','--tags','Configuring\x20MCP\x20server\x20\x27','passThroughServer','oauth','Command\x20spawn\x20error:\x20','refreshedAt','Claude\x20Code\x20version\x20check\x20failed','expires_at','56hocAzB','localeCompare','736294ehgEvl','Configuring\x20marketplace\x20\x27','user','minor','proxy','data','remove','getCurrent','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','message','transport','✓\x20Claude\x20Code\x20version\x20OK','--settings=','Updating\x20marketplace\x20\x27','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','Failed\x20to\x20remove\x20marketplace\x20\x27'];a11_0x3762=function(){return _0xc6c7f5;};return a11_0x3762();}export function recordMcpSetup(_0x21df04,_0x14eb15){const _0x46999e=a11_0x3bbffe,_0x223b68=setupCache[_0x46999e(0x1f5)]()?.[_0x46999e(0x1e6)]??{},_0x88221c=_0x223b68[_0x21df04[_0x46999e(0x1d4)]],_0x391c7a=_0x88221c?.[_0x46999e(0x1d1)]===_0x21df04[_0x46999e(0x1d1)]?_0x88221c[_0x46999e(0x1ce)]:{},_0x3e35c5=Object['entries']({..._0x391c7a,[_0x14eb15]:new Date()[_0x46999e(0x206)]()})['filter'](([,_0x920eef])=>isWithinTtl(_0x920eef))['sort'](([,_0x2cd7dd],[,_0x53565e])=>_0x53565e[_0x46999e(0x231)](_0x2cd7dd))[_0x46999e(0x201)](0x0,MCP_SETUP_MAX_CWDS);updateSetupCache({'mcp':{..._0x223b68,[_0x21df04[_0x46999e(0x1d4)]]:{'url':_0x21df04[_0x46999e(0x1d1)],'cwds':Object[_0x46999e(0x255)](_0x3e35c5)}}});}export function hasSetupWork(_0x3d3c43){const _0x5f1099=a11_0x3bbffe;return _0x3d3c43[_0x5f1099(0x1cd)]['length']>0x0||_0x3d3c43[_0x5f1099(0x1ea)]||_0x3d3c43[_0x5f1099(0x270)][_0x5f1099(0x27c)]>0x0||_0x3d3c43['refresh'];}export function planClaudeSetup(_0x5aa6c3,_0x595825,_0x4f0bb5){const _0xfa30c6=a11_0x3bbffe;if(_0x4f0bb5||isTdxUpgradeSinceSetup())return{'missingMcpServers':TD_MCP_SERVERS[_0xfa30c6(0x1d8)](_0x5e3869=>_0x5e3869['name']),'marketplace':!![],'missingPlugins':[...TD_SKILLS_PLUGINS],'refresh':!![]};const _0x462aae=readMarketplaceSourceUrl(_0xfa30c6(0x245))!==normalizeRepoUrl(_0x5aa6c3),_0x4e797f=_0x462aae?[...TD_SKILLS_PLUGINS]:TD_SKILLS_PLUGINS[_0xfa30c6(0x1d3)](_0x18c194=>!isPluginInstalled(_0x18c194,_0xfa30c6(0x245))),_0x292e58=_0x5aa6c3!==DEFAULT_TD_SKILLS_URL,_0x3cf5a5=process[_0xfa30c6(0x1fe)](),_0x36c31d=TD_MCP_SERVERS['filter'](_0x24824a=>findMcpServerUrl(_0x24824a['name'],_0x3cf5a5)!==_0x24824a[_0xfa30c6(0x1d1)]&&!wasMcpConfiguredRecently(_0x24824a,_0x3cf5a5))[_0xfa30c6(0x1d8)](_0x255947=>_0x255947[_0xfa30c6(0x1d4)]);return{'missingMcpServers':_0x36c31d,'marketplace':_0x462aae,'missingPlugins':_0x4e797f,'refresh':_0x462aae||_0x4e797f['length']>0x0||_0x292e58||isSkillsRefreshDue(_0x5aa6c3,_0x595825)};}async function checkoutReleaseTag(_0x20eb47,_0x9f7362,_0x3ebba0){const _0xa78a10=a11_0x3bbffe,_0x5b990b=join(getClaudeConfigDir(),_0xa78a10(0x1e0),'marketplaces',_0xa78a10(0x245));if(!existsSync(_0x5b990b)){_0x3ebba0?.[_0xa78a10(0x1f3)](_0xa78a10(0x269));return;}_0x9f7362[_0xa78a10(0x21b)]=_0xa78a10(0x217)+_0x20eb47+_0xa78a10(0x1fa),await execFileAsync(_0xa78a10(0x25e),[_0xa78a10(0x1ff),_0xa78a10(0x272),_0xa78a10(0x228),_0xa78a10(0x1e3)],{'cwd':_0x5b990b});try{await execFileAsync(_0xa78a10(0x25e),[_0xa78a10(0x250),'main'],{'cwd':_0x5b990b});}catch{await execFileAsync(_0xa78a10(0x25e),[_0xa78a10(0x250),'-b','main','origin/main'],{'cwd':_0x5b990b});}await execFileAsync(_0xa78a10(0x25e),['reset','--hard',_0x20eb47],{'cwd':_0x5b990b}),_0x9f7362['text']=_0xa78a10(0x275)+_0x20eb47,_0x3ebba0?.['info'](_0xa78a10(0x1c5)+_0x20eb47);}export class ClaudeCommand extends BaseCommand{[a11_0x3bbffe(0x1d4)]=a11_0x3bbffe(0x251);['description']='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';['passThroughServer'];[a11_0x3bbffe(0x1d0)];[a11_0x3bbffe(0x253)];async[a11_0x3bbffe(0x20c)](_0x3d4ef7,_0x1a5c4e,_0x4157b4){const _0x5459be=a11_0x3bbffe,_0x8f3841=loadReleaseChannel(),_0x18b96c=planClaudeSetup(_0x3d4ef7,_0x8f3841,_0x1a5c4e);this['logger']?.[_0x5459be(0x1f3)](_0x5459be(0x26b)+JSON[_0x5459be(0x219)](_0x18b96c));if(!hasSetupWork(_0x18b96c))return;try{_0x4157b4['text']=_0x5459be(0x242),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x5459be(0x1d0)]),_0x4157b4['text']=_0x5459be(0x23d);}catch(_0x154787){_0x4157b4[_0x5459be(0x26e)](_0x5459be(0x22e));throw _0x154787;}let _0xedd421=!![];for(const _0x7b9a33 of TD_MCP_SERVERS[_0x5459be(0x1d3)](_0x205980=>_0x18b96c[_0x5459be(0x1cd)][_0x5459be(0x1df)](_0x205980[_0x5459be(0x1d4)]))){try{await ensureMcpServer(_0x7b9a33[_0x5459be(0x1d4)],_0x7b9a33[_0x5459be(0x1d1)],_0x7b9a33[_0x5459be(0x23c)],_0x4157b4,this[_0x5459be(0x1d0)]),recordMcpSetup(_0x7b9a33,process['cwd']());}catch(_0x20e828){_0xedd421=![],handleInstallationError(_0x20e828,_0x5459be(0x27a)+_0x7b9a33[_0x5459be(0x1d4)]+'\x27',_0x4157b4,this[_0x5459be(0x1d0)]);}}try{_0x18b96c[_0x5459be(0x1ea)]&&(await removeMarketplace(_0x5459be(0x245),this[_0x5459be(0x1d0)]),await ensureMarketplace(_0x5459be(0x245),_0x3d4ef7,_0x4157b4,this[_0x5459be(0x1d0)]));_0x18b96c[_0x5459be(0x1dd)]&&await updateMarketplace(_0x5459be(0x245),_0x4157b4,this[_0x5459be(0x1d0)]);for(const _0x5edadc of _0x18b96c['missingPlugins']){await ensurePlugin(_0x5edadc,'td-skills',_0x4157b4,this[_0x5459be(0x1d0)]);}if(_0x18b96c['refresh'])try{const _0x1198f1=await resolveReleaseTag(_0x8f3841,_0x5459be(0x21e),_0x5459be(0x245),_0x5459be(0x252));_0x1198f1&&await checkoutReleaseTag(_0x1198f1,_0x4157b4,this[_0x5459be(0x1d0)]),recordSkillsRefresh(_0x3d4ef7,_0x8f3841);}catch(_0x1cc44c){_0xedd421=![],this[_0x5459be(0x1d0)]?.[_0x5459be(0x208)](_0x5459be(0x25a)+_0x1cc44c);}}catch(_0x2cd529){_0xedd421=![],handleInstallationError(_0x2cd529,_0x5459be(0x211),_0x4157b4,this[_0x5459be(0x1d0)]);}_0xedd421&&recordSetupVersion();}async[a11_0x3bbffe(0x25f)](_0x472c68){const _0x3726a8=a11_0x3bbffe,{tdx:_0x167c88,options:_0x2c04f4,args:_0x3d232b}=_0x472c68;let _0x27e75d=![];try{const _0x21b032=_0x2c04f4,_0x568e79=_0x21b032[_0x3726a8(0x236)]===![],_0x4c8018=_0x21b032['continue']===!![],_0x15a2ab=_0x21b032[_0x3726a8(0x1c1)]===!![],_0x5011d2=[..._0x3d232b];if(_0x4c8018)_0x5011d2['unshift']('-c');else _0x15a2ab&&_0x5011d2[_0x3726a8(0x27f)]('-r');const _0x402d58=createCommandSpinner(_0x3726a8(0x1c4),{'verbose':_0x2c04f4[_0x3726a8(0x20d)]});_0x402d58[_0x3726a8(0x25c)]();try{if(!_0x568e79){const _0x514450=_0x2c04f4[_0x3726a8(0x215)];try{const _0x26d2fe=await _0x167c88[_0x3726a8(0x234)][_0x3726a8(0x239)]();_0x26d2fe[_0x3726a8(0x21a)]&&writeCachedAccountInfo(_0x2c04f4[_0x3726a8(0x20f)]??_0x3726a8(0x268),_0x26d2fe['account_id'],_0x514450);}catch{}_0x402d58[_0x3726a8(0x21b)]=_0x3726a8(0x25b),this[_0x3726a8(0x1d0)]=new TDXLogger(_0x2c04f4[_0x3726a8(0x243)],!![]),await this[_0x3726a8(0x1d0)][_0x3726a8(0x1c6)]();const _0xa99964=this[_0x3726a8(0x1d0)][_0x3726a8(0x278)]();_0x402d58[_0x3726a8(0x21b)]='✓\x20Logging\x20to\x20'+_0xa99964;const _0x2afbf0=getEndpoint(_0x2c04f4['site'],'llm-proxy');_0x402d58['text']='Starting\x20TD\x20LLM\x20pass-through\x20proxy...';let _0x52a08b;const _0x507edd=await getOAuthTokens(_0x514450);if(_0x507edd)_0x52a08b={'type':_0x3726a8(0x22b),'accessToken':_0x507edd['access_token'],'refreshToken':_0x507edd[_0x3726a8(0x24a)],'expiresAt':_0x507edd[_0x3726a8(0x22f)],'consoleUrl':getConsoleUrl(_0x2c04f4[_0x3726a8(0x20f)])};else{if(_0x167c88['context'][_0x3726a8(0x203)])_0x52a08b={'type':'apikey','apiKey':_0x167c88['context']['apiKey']};else throw new SDKError(ErrorCode[_0x3726a8(0x27b)],_0x3726a8(0x257));}this['passThroughServer']=new PassThroughProxyServer({'startPort':0xfa0,'llmProxyUrl':_0x2afbf0,'auth':_0x52a08b,'logger':this[_0x3726a8(0x1d0)],'site':_0x2c04f4[_0x3726a8(0x20f)]??'us01','profile':_0x514450,'proxy':_0x167c88[_0x3726a8(0x1f6)][_0x3726a8(0x236)]}),await this['passThroughServer']['start'](),this[_0x3726a8(0x253)]=this[_0x3726a8(0x22a)]['port'],_0x402d58[_0x3726a8(0x21b)]=_0x3726a8(0x240)+this['port']+'\x20→\x20'+_0x2afbf0,_0x402d58[_0x3726a8(0x21b)]=_0x3726a8(0x1d9);}else _0x402d58['text']=_0x3726a8(0x1ef);const _0x4ac8ec=getTdSkillsRepoUrl();_0x27e75d=_0x4ac8ec!==DEFAULT_TD_SKILLS_URL,await this[_0x3726a8(0x20c)](_0x4ac8ec,_0x21b032[_0x3726a8(0x1dd)]===!![],_0x402d58),_0x402d58[_0x3726a8(0x26c)]();}catch(_0x3020e4){_0x402d58['fail'](_0x3726a8(0x24f));throw _0x3020e4;}const _0xb34883=await findExecutable(_0x3726a8(0x251));if(!_0xb34883)throw new SDKError(ErrorCode[_0x3726a8(0x263)],_0x3726a8(0x24d),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x40377b=_0x568e79?_0x5011d2:buildClaudeLaunchArgs(_0x5011d2,_0x167c88[_0x3726a8(0x1f6)][_0x3726a8(0x215)]),_0x140f62={...process.env};!_0x568e79&&(_0x140f62[_0x3726a8(0x246)]='http://127.0.0.1:'+this[_0x3726a8(0x253)],_0x140f62[_0x3726a8(0x1c7)]=_0x3726a8(0x218),_0x140f62[_0x3726a8(0x1c8)]='false',_0x140f62[_0x3726a8(0x1f0)]=_0x3726a8(0x21c));_0x167c88[_0x3726a8(0x1f6)][_0x3726a8(0x215)]&&(_0x140f62[_0x3726a8(0x24b)]=_0x167c88['context'][_0x3726a8(0x215)]);const _0x59dca7=crossSpawn(_0xb34883,_0x40377b,{'stdio':_0x3726a8(0x274),'env':_0x140f62}),_0x1fc398=await new Promise(_0xc46cd5=>{const _0x3920bf=_0x3726a8;_0x59dca7['on']('exit',_0x2b577b=>{_0xc46cd5(_0x2b577b||0x0);}),_0x59dca7['on'](_0x3920bf(0x1cc),_0x5dac25=>{const _0x40af41=_0x3920bf;console['error'](a11_0x369d28['red'](_0x40af41(0x1fd)+_0x5dac25[_0x40af41(0x23b)])),_0xc46cd5(0x1);});});_0x27e75d&&await restoreDefaultTdSkillsMarketplace(this['logger']);this[_0x3726a8(0x22a)]&&(await this[_0x3726a8(0x22a)][_0x3726a8(0x26c)](),console[_0x3726a8(0x1cb)](a11_0x369d28[_0x3726a8(0x210)](_0x3726a8(0x264))));if(this[_0x3726a8(0x1d0)]){await this['logger'][_0x3726a8(0x24c)]();const _0x8de7c9=this[_0x3726a8(0x1d0)]['getLogPath']();console['log'](a11_0x369d28['green'](_0x3726a8(0x1e4)+_0x8de7c9));}return _0x1fc398;}catch(_0x4225b9){_0x27e75d&&await restoreDefaultTdSkillsMarketplace(this['logger']);this[_0x3726a8(0x22a)]&&await this[_0x3726a8(0x22a)]['stop']();this['logger']&&await this[_0x3726a8(0x1d0)][_0x3726a8(0x24c)]();throw _0x4225b9;}}}
@@ -1 +1 @@
1
- const a12_0x295b63=a12_0x5ab6;(function(_0xbc708d,_0x35c45d){const _0x458782=a12_0x5ab6,_0x9ca975=_0xbc708d();while(!![]){try{const _0x306b66=-parseInt(_0x458782(0x1b6))/0x1*(-parseInt(_0x458782(0x1b8))/0x2)+-parseInt(_0x458782(0x1c6))/0x3+-parseInt(_0x458782(0x1c3))/0x4+-parseInt(_0x458782(0x1b7))/0x5*(-parseInt(_0x458782(0x1d4))/0x6)+-parseInt(_0x458782(0x1c7))/0x7+parseInt(_0x458782(0x1ca))/0x8*(-parseInt(_0x458782(0x1c1))/0x9)+parseInt(_0x458782(0x1c4))/0xa*(parseInt(_0x458782(0x1ac))/0xb);if(_0x306b66===_0x35c45d)break;else _0x9ca975['push'](_0x9ca975['shift']());}catch(_0x4e7df2){_0x9ca975['push'](_0x9ca975['shift']());}}}(a12_0x3c93,0xd7156));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';function a12_0x3c93(){const _0x5b3fcf=['\x20session\x20/\x20','🧠\x20','todayCredits','cache_creation_input_tokens','name','used_percentage','3035244wFCSkl','\x20|\x20','💎\x20','601546zVxtee','parse','profile','close','session_id','execute','round','accountId','monthCredits','\x20month','1350255DHjbro','5PPIFpc','2zlbykV','log','line','statusline','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','context_window','tdx\x20','model','join','9sOuWEF','Claude','4822412wAMnWR','550ihAXBM','push','3865797FQcAkb','9852017UUvJXV','💎\x20tdx\x20-\x20Claude','toFixed','649952yyDXjX','input_tokens','options','tdx'];a12_0x3c93=function(){return _0x5b3fcf;};return a12_0x3c93();}function a12_0x5ab6(_0xad8c64,_0x41eb7e){_0xad8c64=_0xad8c64-0x1ab;const _0x3c9301=a12_0x3c93();let _0x5ab6ff=_0x3c9301[_0xad8c64];return _0x5ab6ff;}import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x490b02=0x64){return new Promise(_0x250ee9=>{const _0x2eb1ea=a12_0x5ab6;let _0x3ecdac='',_0x1b9dca=![];const _0x4c3554=createInterface({'input':process['stdin'],'terminal':![]}),_0xa3ba09=_0x51419f=>{if(_0x1b9dca)return;_0x1b9dca=!![],clearTimeout(_0xd3fa4f),_0x4c3554['close'](),_0x250ee9(_0x51419f);},_0xd3fa4f=setTimeout(()=>{_0xa3ba09(null);},_0x490b02);_0x4c3554['on'](_0x2eb1ea(0x1ba),_0x56b084=>{_0x3ecdac+=_0x56b084;}),_0x4c3554['on'](_0x2eb1ea(0x1af),()=>{const _0x2e1e70=_0x2eb1ea;if(_0x1b9dca)return;try{const _0x2cc2fe=JSON[_0x2e1e70(0x1ad)](_0x3ecdac);_0xa3ba09(_0x2cc2fe);}catch{_0xa3ba09(null);}});});}function formatCredits(_0x107e41){const _0x24879e=a12_0x5ab6;return _0x107e41[_0x24879e(0x1c9)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a12_0x295b63(0x1d2)]=a12_0x295b63(0x1bb);['description']=a12_0x295b63(0x1bc);async[a12_0x295b63(0x1b1)](_0x11c4c5){const _0x2e526f=a12_0x295b63;try{const _0x2d8dfe=await readStdinJson();if(!_0x2d8dfe?.[_0x2e526f(0x1b0)])return console[_0x2e526f(0x1b9)](_0x2e526f(0x1c8)),0x0;const _0x3b1964=_0x2d8dfe[_0x2e526f(0x1b0)],_0x40b15e=_0x2d8dfe[_0x2e526f(0x1bf)]?.['id']||'',_0x6b1f8f=_0x2d8dfe[_0x2e526f(0x1ae)]||_0x11c4c5[_0x2e526f(0x1cc)][_0x2e526f(0x1ae)],_0x421b52=await getUsageStats(_0x3b1964,_0x6b1f8f),_0x44397d=[],_0x4ba889=readCachedAccountInfo(_0x6b1f8f),_0x46723=_0x4ba889?_0x2e526f(0x1be)+_0x4ba889['site']+':'+_0x4ba889[_0x2e526f(0x1b3)]:_0x2e526f(0x1cd),_0x3b3a97=_0x40b15e?getModelDisplayName(_0x40b15e):_0x2e526f(0x1c2);_0x44397d[_0x2e526f(0x1c5)](_0x2e526f(0x1ab)+_0x46723+'\x20-\x20'+_0x3b3a97);const _0xd432d8=formatCredits(_0x421b52['sessionCredits']),_0x42bc55=formatCredits(_0x421b52[_0x2e526f(0x1d0)]),_0x50ad57=formatCredits(_0x421b52[_0x2e526f(0x1b4)]);_0x44397d[_0x2e526f(0x1c5)]('🪙\x20credit:\x20'+_0xd432d8+_0x2e526f(0x1ce)+_0x42bc55+'\x20today\x20/\x20'+_0x50ad57+_0x2e526f(0x1b5));const _0x39a827=_0x2d8dfe[_0x2e526f(0x1bd)],_0x18e145=_0x39a827?.['current_usage'];if(_0x18e145&&_0x39a827?.[_0x2e526f(0x1d3)]!=null){const _0x26085c=_0x18e145[_0x2e526f(0x1cb)]+_0x18e145[_0x2e526f(0x1d1)]+_0x18e145['cache_read_input_tokens'],_0x92a406=formatTokenCount(_0x26085c),_0x3004ae=Math[_0x2e526f(0x1b2)](_0x39a827[_0x2e526f(0x1d3)]);_0x44397d['push'](_0x2e526f(0x1cf)+_0x92a406+'\x20('+_0x3004ae+'%)');}return console['log'](_0x44397d[_0x2e526f(0x1c0)](_0x2e526f(0x1d5))),0x0;}catch{return console[_0x2e526f(0x1b9)]('💎\x20tdx\x20-\x20Claude'),0x0;}}}
1
+ const a12_0x3eacc6=a12_0xeff7;(function(_0x17e6c1,_0x3288d0){const _0x521e08=a12_0xeff7,_0x56597f=_0x17e6c1();while(!![]){try{const _0x55ec39=-parseInt(_0x521e08(0xe5))/0x1+parseInt(_0x521e08(0xd6))/0x2*(parseInt(_0x521e08(0xcf))/0x3)+parseInt(_0x521e08(0xe0))/0x4*(parseInt(_0x521e08(0xdd))/0x5)+-parseInt(_0x521e08(0xbf))/0x6+-parseInt(_0x521e08(0xca))/0x7+parseInt(_0x521e08(0xdc))/0x8*(-parseInt(_0x521e08(0xe4))/0x9)+parseInt(_0x521e08(0xe8))/0xa*(parseInt(_0x521e08(0xe7))/0xb);if(_0x55ec39===_0x3288d0)break;else _0x56597f['push'](_0x56597f['shift']());}catch(_0x342bcd){_0x56597f['push'](_0x56597f['shift']());}}}(a12_0x4237,0xa72e0));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';function a12_0x4237(){const _0x55d9f2=['close','6899340Lderps','statusline','options','log','profile','join','\x20session\x20/\x20','💎\x20tdx\x20-\x20Claude','tdx','\x20month','parse','3323040eJleYh','\x20today\x20/\x20','cache_creation_input_tokens','name','monthCredits','3nOsYbl','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','input_tokens','sessionCredits','session_id','push','\x20-\x20','282202zCoAum','execute','💎\x20','description','🧠\x20','model','2752936DsFJpN','3253825pcfFJp','\x20|\x20','🪙\x20credit:\x20','8AGMpAA','tdx\x20','line','context_window','18Lphkdp','641936KRtcAA','accountId','11VgMeNf','21969170XrKwTk','site','used_percentage'];a12_0x4237=function(){return _0x55d9f2;};return a12_0x4237();}import{getModelDisplayName,formatTokenCount}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x864b01=0x64){return new Promise(_0x1df8a9=>{const _0x4b762b=a12_0xeff7;let _0x58d09c='',_0x4f2cb1=![];const _0x3c3549=createInterface({'input':process['stdin'],'terminal':![]}),_0x302567=_0x3a7454=>{const _0x2ff037=a12_0xeff7;if(_0x4f2cb1)return;_0x4f2cb1=!![],clearTimeout(_0x762f8f),_0x3c3549[_0x2ff037(0xbe)](),_0x1df8a9(_0x3a7454);},_0x762f8f=setTimeout(()=>{_0x302567(null);},_0x864b01);_0x3c3549['on'](_0x4b762b(0xe2),_0x1e36a0=>{_0x58d09c+=_0x1e36a0;}),_0x3c3549['on'](_0x4b762b(0xbe),()=>{const _0x252b12=_0x4b762b;if(_0x4f2cb1)return;try{const _0x249612=JSON[_0x252b12(0xc9)](_0x58d09c);_0x302567(_0x249612);}catch{_0x302567(null);}});});}function a12_0xeff7(_0x2768d6,_0x360115){_0x2768d6=_0x2768d6-0xbc;const _0x42374e=a12_0x4237();let _0xeff7cc=_0x42374e[_0x2768d6];return _0xeff7cc;}function formatCredits(_0x39500f){return _0x39500f['toFixed'](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a12_0x3eacc6(0xcd)]=a12_0x3eacc6(0xc0);[a12_0x3eacc6(0xd9)]=a12_0x3eacc6(0xd0);async[a12_0x3eacc6(0xd7)](_0x5302e9){const _0x34876c=a12_0x3eacc6;try{const _0x3ae09d=await readStdinJson();if(!_0x3ae09d?.[_0x34876c(0xd3)])return console['log'](_0x34876c(0xc6)),0x0;const _0x1d66b0=_0x3ae09d[_0x34876c(0xd3)],_0x2d7c0c=_0x3ae09d[_0x34876c(0xdb)]?.['id']||'',_0x443af6=_0x3ae09d['profile']||_0x5302e9[_0x34876c(0xc1)][_0x34876c(0xc3)],_0x27c40f=await getUsageStats(_0x1d66b0,_0x443af6),_0x118687=[],_0x4bb76f=readCachedAccountInfo(_0x443af6),_0x41cfc6=_0x4bb76f?_0x34876c(0xe1)+_0x4bb76f[_0x34876c(0xbc)]+':'+_0x4bb76f[_0x34876c(0xe6)]:_0x34876c(0xc7),_0x458f78=_0x2d7c0c?getModelDisplayName(_0x2d7c0c):'Claude';_0x118687['push'](_0x34876c(0xd8)+_0x41cfc6+_0x34876c(0xd5)+_0x458f78);const _0x2f8c13=formatCredits(_0x27c40f[_0x34876c(0xd2)]),_0x5df3ff=formatCredits(_0x27c40f['todayCredits']),_0x56f055=formatCredits(_0x27c40f[_0x34876c(0xce)]);_0x118687['push'](_0x34876c(0xdf)+_0x2f8c13+_0x34876c(0xc5)+_0x5df3ff+_0x34876c(0xcb)+_0x56f055+_0x34876c(0xc8));const _0x32fa38=_0x3ae09d[_0x34876c(0xe3)],_0xb28b46=_0x32fa38?.['current_usage'];if(_0xb28b46&&_0x32fa38?.[_0x34876c(0xbd)]!=null){const _0x123489=_0xb28b46[_0x34876c(0xd1)]+_0xb28b46[_0x34876c(0xcc)]+_0xb28b46['cache_read_input_tokens'],_0x5cb3a4=formatTokenCount(_0x123489),_0x2a9010=Math['round'](_0x32fa38[_0x34876c(0xbd)]);_0x118687[_0x34876c(0xd4)](_0x34876c(0xda)+_0x5cb3a4+'\x20('+_0x2a9010+'%)');}return console[_0x34876c(0xc2)](_0x118687[_0x34876c(0xc4)](_0x34876c(0xde))),0x0;}catch{return console[_0x34876c(0xc2)](_0x34876c(0xc6)),0x0;}}}
@@ -1 +1 @@
1
- const a13_0x503f3b=a13_0x116e;(function(_0x28a04c,_0x53d497){const _0x38fbe9=a13_0x116e,_0x446ce6=_0x28a04c();while(!![]){try{const _0x1beb43=parseInt(_0x38fbe9(0xaa))/0x1+-parseInt(_0x38fbe9(0xab))/0x2*(parseInt(_0x38fbe9(0xbf))/0x3)+-parseInt(_0x38fbe9(0x8b))/0x4*(-parseInt(_0x38fbe9(0xb6))/0x5)+parseInt(_0x38fbe9(0xa7))/0x6*(-parseInt(_0x38fbe9(0xc7))/0x7)+-parseInt(_0x38fbe9(0xcd))/0x8+-parseInt(_0x38fbe9(0xad))/0x9+-parseInt(_0x38fbe9(0x95))/0xa*(-parseInt(_0x38fbe9(0xb4))/0xb);if(_0x1beb43===_0x53d497)break;else _0x446ce6['push'](_0x446ce6['shift']());}catch(_0x20d964){_0x446ce6['push'](_0x446ce6['shift']());}}}(a13_0x2c68,0x96564));import a13_0x48b99a 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 a13_0x116e(_0x3588ce,_0x550682){_0x3588ce=_0x3588ce-0x8b;const _0x2c6837=a13_0x2c68();let _0x116e43=_0x2c6837[_0x3588ce];return _0x116e43;}function formatCredits(_0x504e5f){const _0x29389e=a13_0x116e;return _0x504e5f[_0x29389e(0xa6)](0x2);}function formatLastUsed(_0x3116c7){const _0x5f49d6=a13_0x116e;if(!_0x3116c7)return _0x5f49d6(0xc8);const _0x5eb987=new Date(_0x3116c7),_0x34f16c=new Date(),_0x31c1fb=_0x5eb987[_0x5f49d6(0xb9)]('en-CA'),_0x2fb398=_0x34f16c[_0x5f49d6(0xb9)]('en-CA');if(_0x31c1fb===_0x2fb398)return'today\x20'+_0x5eb987[_0x5f49d6(0x94)](_0x5f49d6(0xac),{'hour':_0x5f49d6(0x9d),'minute':_0x5f49d6(0x9d)});const _0x35a35c=new Date(_0x31c1fb),_0x1665c7=new Date(_0x2fb398),_0x7d26f8=Math[_0x5f49d6(0xa8)]((_0x1665c7['getTime']()-_0x35a35c[_0x5f49d6(0xc3)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x7d26f8===0x1)return _0x5f49d6(0xa9);else return _0x7d26f8>0x1&&_0x7d26f8<0x7?_0x7d26f8+_0x5f49d6(0x93):_0x5eb987[_0x5f49d6(0xb9)]('en-US',{'month':'short','day':_0x5f49d6(0x92)});}function a13_0x2c68(){const _0x31fa60=['toFixed','458298eCYdUG','round','yesterday','502750dqXHWm','62278lEokyl','en-US','248643KZCeQM','cyan','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','red','dim','source','default','11FLBboC','entryCount','555yiOBiU','Month','lastUsedAt','toLocaleDateString','Usage\x20by\x20Source','bold','log','profile','Unknown\x20error','33hfruCv','\x20credits','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','credits','getTime','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','Error:\x20','length','56SPcysZ','never','todayCredits','(default)','monthCredits','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','504128imgctG','padEnd','outputStructured','\x20\x20Today:\x20\x20\x20','32108VfXcXG','outputTable','Profile','message','Source','jsonl','Today','numeric','\x20days\x20ago','toLocaleTimeString','2662690oyuFae','\x20\x20Month:\x20\x20\x20','\x20\x20Total:\x20\x20\x20','padStart','error','Total','totalCredits','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','2-digit','repeat','usage','name','format','max','json','map','Credits'];a13_0x2c68=function(){return _0x31fa60;};return a13_0x2c68();}export class ClaudeUsageCommand extends BaseCommand{[a13_0x503f3b(0xa0)]=a13_0x503f3b(0x9f);['description']=a13_0x503f3b(0xcc);async['execute'](_0x1bb94e){const _0x3fbc04=a13_0x503f3b,{options:_0x2f0eff}=_0x1bb94e,_0x554e01=_0x2f0eff[_0x3fbc04(0xa1)]===_0x3fbc04(0xa3)||_0x2f0eff['format']===_0x3fbc04(0x90)||_0x2f0eff[_0x3fbc04(0xa3)];try{const [_0x13aaf8,_0x5510b5,_0x58d0da]=await Promise['all']([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0x554e01?await this[_0x3fbc04(0xcf)](_0x13aaf8,_0x5510b5,_0x58d0da,_0x2f0eff):this['outputTable'](_0x13aaf8,_0x5510b5,_0x58d0da),0x0;}catch(_0x32d4a7){const _0x3a4a06=_0x32d4a7 instanceof Error?_0x32d4a7[_0x3fbc04(0x8e)]:_0x3fbc04(0xbe);return console[_0x3fbc04(0x99)](a13_0x48b99a[_0x3fbc04(0xb0)](_0x3fbc04(0xc5)+_0x3a4a06)),0x1;}}async['outputStructured'](_0xbc5508,_0x11f886,_0x5d850e,_0x197922){const _0x5c1af2=a13_0x503f3b,_0x442356={'summary':{'todayCredits':_0x5d850e[_0x5c1af2(0xc9)],'monthCredits':_0x5d850e['monthCredits'],'totalCredits':_0x5d850e[_0x5c1af2(0x9b)],'profileCount':_0x5d850e['profileCount']},'profiles':_0xbc5508[_0x5c1af2(0xa4)](_0x871373=>({'profile':_0x871373[_0x5c1af2(0xbd)],'credits':_0x871373['credits'],'requests':_0x871373[_0x5c1af2(0xb5)],'lastUsedAt':_0x871373[_0x5c1af2(0xb8)]})),'sources':_0x11f886[_0x5c1af2(0xa4)](_0x45f619=>({'source':_0x45f619[_0x5c1af2(0xb2)],'credits':_0x45f619[_0x5c1af2(0xc2)],'todayCredits':_0x45f619['todayCredits'],'monthCredits':_0x45f619[_0x5c1af2(0xcb)],'requests':_0x45f619[_0x5c1af2(0xb5)]}))};await handleSDKOutput([_0x442356],_0x197922);}[a13_0x503f3b(0x8c)](_0x438869,_0x30ecaa,_0x2cf74c){const _0x1de8ed=a13_0x503f3b;console['log'](a13_0x48b99a[_0x1de8ed(0xbb)](_0x1de8ed(0xaf))),console[_0x1de8ed(0xbc)](a13_0x48b99a[_0x1de8ed(0xb1)]('─'[_0x1de8ed(0x9e)](0x32))),console[_0x1de8ed(0xbc)](_0x1de8ed(0xd0)+a13_0x48b99a['cyan'](formatCredits(_0x2cf74c[_0x1de8ed(0xc9)]))+_0x1de8ed(0xc0)),console['log'](_0x1de8ed(0x96)+a13_0x48b99a[_0x1de8ed(0xae)](formatCredits(_0x2cf74c[_0x1de8ed(0xcb)]))+_0x1de8ed(0xc0)),console[_0x1de8ed(0xbc)](_0x1de8ed(0x97)+a13_0x48b99a[_0x1de8ed(0xae)](formatCredits(_0x2cf74c[_0x1de8ed(0x9b)]))+_0x1de8ed(0xc0)),console[_0x1de8ed(0xbc)]();if(_0x30ecaa[_0x1de8ed(0xc6)]>0x0){console[_0x1de8ed(0xbc)](a13_0x48b99a['bold'](_0x1de8ed(0xba))),console[_0x1de8ed(0xbc)](a13_0x48b99a[_0x1de8ed(0xb1)]('─'[_0x1de8ed(0x9e)](0x3c)));const _0x5de4f7=0xc,_0x205e76=0xa,_0x4a148e=0xa,_0x2da1e6=0xa;console['log']('\x20\x20'+_0x1de8ed(0x8f)[_0x1de8ed(0xce)](_0x5de4f7)+'\x20\x20'+_0x1de8ed(0x9a)[_0x1de8ed(0x98)](_0x205e76)+'\x20\x20'+_0x1de8ed(0x91)[_0x1de8ed(0x98)](_0x4a148e)+'\x20\x20'+_0x1de8ed(0xb7)[_0x1de8ed(0x98)](_0x2da1e6));for(const _0x2e48ba of _0x30ecaa){console[_0x1de8ed(0xbc)]('\x20\x20'+_0x2e48ba['source']['padEnd'](_0x5de4f7)+'\x20\x20'+a13_0x48b99a[_0x1de8ed(0xae)](formatCredits(_0x2e48ba[_0x1de8ed(0xc2)])[_0x1de8ed(0x98)](_0x205e76))+'\x20\x20'+formatCredits(_0x2e48ba[_0x1de8ed(0xc9)])['padStart'](_0x4a148e)+'\x20\x20'+formatCredits(_0x2e48ba[_0x1de8ed(0xcb)])[_0x1de8ed(0x98)](_0x2da1e6));}console[_0x1de8ed(0xbc)]();}if(_0x438869[_0x1de8ed(0xc6)]===0x0){console[_0x1de8ed(0xbc)](a13_0x48b99a[_0x1de8ed(0xb1)](_0x1de8ed(0xc4))),console['log'](a13_0x48b99a[_0x1de8ed(0xb1)](_0x1de8ed(0xc1)));return;}console[_0x1de8ed(0xbc)](a13_0x48b99a[_0x1de8ed(0xbb)]('Usage\x20by\x20Profile')),console[_0x1de8ed(0xbc)](a13_0x48b99a['dim']('─'['repeat'](0x3c)));const _0xb0ff94=Math[_0x1de8ed(0xa2)](0xc,..._0x438869['map'](_0x1856ef=>_0x1856ef[_0x1de8ed(0xbd)]===_0x1de8ed(0xb3)?_0x1de8ed(0xca)[_0x1de8ed(0xc6)]:_0x1856ef[_0x1de8ed(0xbd)][_0x1de8ed(0xc6)])),_0x3aad2d=0xa,_0x3df1f3=0xa;console[_0x1de8ed(0xbc)]('\x20\x20'+_0x1de8ed(0x8d)[_0x1de8ed(0xce)](_0xb0ff94)+'\x20\x20'+_0x1de8ed(0xa5)[_0x1de8ed(0x98)](_0x3aad2d)+'\x20\x20'+'Requests'[_0x1de8ed(0x98)](_0x3df1f3)+'\x20\x20'+'Last\x20Used');for(const _0x33185f of _0x438869){const _0xa8b926=_0x33185f[_0x1de8ed(0xbd)]===_0x1de8ed(0xb3)?_0x1de8ed(0xca):_0x33185f['profile'],_0x8bf13b=_0xa8b926[_0x1de8ed(0xce)](_0xb0ff94),_0x4a582b=_0x33185f[_0x1de8ed(0xbd)]===_0x1de8ed(0xb3)?a13_0x48b99a[_0x1de8ed(0xb1)](_0x8bf13b):_0x8bf13b;console[_0x1de8ed(0xbc)]('\x20\x20'+_0x4a582b+'\x20\x20'+a13_0x48b99a['cyan'](formatCredits(_0x33185f['credits'])['padStart'](_0x3aad2d))+'\x20\x20'+String(_0x33185f['entryCount'])[_0x1de8ed(0x98)](_0x3df1f3)+'\x20\x20'+a13_0x48b99a[_0x1de8ed(0xb1)](formatLastUsed(_0x33185f['lastUsedAt'])));}console['log'](),console[_0x1de8ed(0xbc)](a13_0x48b99a[_0x1de8ed(0xb1)](_0x1de8ed(0x9c))),console[_0x1de8ed(0xbc)]();}}
1
+ const a13_0x34b374=a13_0x2090;(function(_0x2c811a,_0x33c0a1){const _0x1ad4c1=a13_0x2090,_0x4865d3=_0x2c811a();while(!![]){try{const _0x269c7f=parseInt(_0x1ad4c1(0x1f1))/0x1*(parseInt(_0x1ad4c1(0x1e6))/0x2)+parseInt(_0x1ad4c1(0x1e9))/0x3*(parseInt(_0x1ad4c1(0x1b8))/0x4)+-parseInt(_0x1ad4c1(0x1c6))/0x5+parseInt(_0x1ad4c1(0x1c1))/0x6*(-parseInt(_0x1ad4c1(0x1b9))/0x7)+-parseInt(_0x1ad4c1(0x1e2))/0x8+parseInt(_0x1ad4c1(0x1b7))/0x9*(-parseInt(_0x1ad4c1(0x1df))/0xa)+parseInt(_0x1ad4c1(0x1cb))/0xb*(parseInt(_0x1ad4c1(0x1e8))/0xc);if(_0x269c7f===_0x33c0a1)break;else _0x4865d3['push'](_0x4865d3['shift']());}catch(_0x448e87){_0x4865d3['push'](_0x4865d3['shift']());}}}(a13_0x23ec,0xa3a2d));import a13_0x2a2b9d from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a13_0x2090(_0x1ac154,_0x1ea026){_0x1ac154=_0x1ac154-0x1b2;const _0x23ecb1=a13_0x23ec();let _0x20909f=_0x23ecb1[_0x1ac154];return _0x20909f;}import{getAllProfileStats,getAllSourceStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function a13_0x23ec(){const _0x4a0729=['\x20\x20Month:\x20\x20\x20','source','map','cyan','padStart','262693taALMp','profile','error','todayCredits','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','Source','outputStructured','monthCredits','toLocaleTimeString','54cCliIp','224RMylcF','74389HkQnLL','usage','Last\x20Used','repeat','yesterday','execute','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','credits','174CnGFKl','totalCredits','red','padEnd','\x20credits','6126235ZqeeUl','never','getTime','lastUsedAt','\x20\x20Total:\x20\x20\x20','13662afReVI','outputTable','dim','Today','toLocaleDateString','bold','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','message','numeric','Usage\x20by\x20Profile','short','format','name','\x20\x20Today:\x20\x20\x20','Credits','toFixed','2-digit','Total','(default)','entryCount','408590rhZIVm','log','length','788304eVYIRN','\x20days\x20ago','json','en-CA','10wRYvCx','Month','276jRQDBV','64572tXMBYJ','en-US','default'];a13_0x23ec=function(){return _0x4a0729;};return a13_0x23ec();}function formatCredits(_0x57b6ef){const _0x25a217=a13_0x2090;return _0x57b6ef[_0x25a217(0x1da)](0x2);}function formatLastUsed(_0x3f053f){const _0x1ea46c=a13_0x2090;if(!_0x3f053f)return _0x1ea46c(0x1c7);const _0x574212=new Date(_0x3f053f),_0x283e7f=new Date(),_0x241480=_0x574212[_0x1ea46c(0x1cf)](_0x1ea46c(0x1e5)),_0x20922b=_0x283e7f['toLocaleDateString'](_0x1ea46c(0x1e5));if(_0x241480===_0x20922b)return'today\x20'+_0x574212[_0x1ea46c(0x1b6)](_0x1ea46c(0x1ea),{'hour':_0x1ea46c(0x1db),'minute':_0x1ea46c(0x1db)});const _0x28d605=new Date(_0x241480),_0x1e2aee=new Date(_0x20922b),_0x58b5c8=Math['round']((_0x1e2aee[_0x1ea46c(0x1c8)]()-_0x28d605['getTime']())/(0x18*0x3c*0x3c*0x3e8));if(_0x58b5c8===0x1)return _0x1ea46c(0x1bd);else return _0x58b5c8>0x1&&_0x58b5c8<0x7?_0x58b5c8+_0x1ea46c(0x1e3):_0x574212[_0x1ea46c(0x1cf)](_0x1ea46c(0x1ea),{'month':_0x1ea46c(0x1d5),'day':_0x1ea46c(0x1d3)});}export class ClaudeUsageCommand extends BaseCommand{[a13_0x34b374(0x1d7)]=a13_0x34b374(0x1ba);['description']=a13_0x34b374(0x1d1);async[a13_0x34b374(0x1be)](_0x2c48b6){const _0x206d48=a13_0x34b374,{options:_0x381b4c}=_0x2c48b6,_0x2620fc=_0x381b4c[_0x206d48(0x1d6)]===_0x206d48(0x1e4)||_0x381b4c['format']==='jsonl'||_0x381b4c['json'];try{const [_0x4bb2d2,_0x2468c2,_0x417e2a]=await Promise['all']([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0x2620fc?await this['outputStructured'](_0x4bb2d2,_0x2468c2,_0x417e2a,_0x381b4c):this[_0x206d48(0x1cc)](_0x4bb2d2,_0x2468c2,_0x417e2a),0x0;}catch(_0x3b11c4){const _0x68d1c6=_0x3b11c4 instanceof Error?_0x3b11c4[_0x206d48(0x1d2)]:'Unknown\x20error';return console[_0x206d48(0x1f3)](a13_0x2a2b9d[_0x206d48(0x1c3)]('Error:\x20'+_0x68d1c6)),0x1;}}async[a13_0x34b374(0x1b4)](_0x4129b8,_0x502383,_0x25384c,_0x6aceb){const _0x41f8e7=a13_0x34b374,_0x22ae93={'summary':{'todayCredits':_0x25384c[_0x41f8e7(0x1f4)],'monthCredits':_0x25384c[_0x41f8e7(0x1b5)],'totalCredits':_0x25384c[_0x41f8e7(0x1c2)],'profileCount':_0x25384c['profileCount']},'profiles':_0x4129b8[_0x41f8e7(0x1ee)](_0x4ea171=>({'profile':_0x4ea171['profile'],'credits':_0x4ea171[_0x41f8e7(0x1c0)],'requests':_0x4ea171[_0x41f8e7(0x1de)],'lastUsedAt':_0x4ea171[_0x41f8e7(0x1c9)]})),'sources':_0x502383[_0x41f8e7(0x1ee)](_0x4c1839=>({'source':_0x4c1839['source'],'credits':_0x4c1839[_0x41f8e7(0x1c0)],'todayCredits':_0x4c1839[_0x41f8e7(0x1f4)],'monthCredits':_0x4c1839[_0x41f8e7(0x1b5)],'requests':_0x4c1839[_0x41f8e7(0x1de)]}))};await handleSDKOutput([_0x22ae93],_0x6aceb);}[a13_0x34b374(0x1cc)](_0x460981,_0x35ba58,_0x345353){const _0xf7f08=a13_0x34b374;console[_0xf7f08(0x1e0)](a13_0x2a2b9d[_0xf7f08(0x1d0)]('\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary')),console[_0xf7f08(0x1e0)](a13_0x2a2b9d['dim']('─'['repeat'](0x32))),console['log'](_0xf7f08(0x1d8)+a13_0x2a2b9d[_0xf7f08(0x1ef)](formatCredits(_0x345353[_0xf7f08(0x1f4)]))+_0xf7f08(0x1c5)),console[_0xf7f08(0x1e0)](_0xf7f08(0x1ec)+a13_0x2a2b9d[_0xf7f08(0x1ef)](formatCredits(_0x345353[_0xf7f08(0x1b5)]))+_0xf7f08(0x1c5)),console['log'](_0xf7f08(0x1ca)+a13_0x2a2b9d[_0xf7f08(0x1ef)](formatCredits(_0x345353[_0xf7f08(0x1c2)]))+_0xf7f08(0x1c5)),console[_0xf7f08(0x1e0)]();if(_0x35ba58[_0xf7f08(0x1e1)]>0x0){console[_0xf7f08(0x1e0)](a13_0x2a2b9d[_0xf7f08(0x1d0)]('Usage\x20by\x20Source')),console[_0xf7f08(0x1e0)](a13_0x2a2b9d['dim']('─'[_0xf7f08(0x1bc)](0x3c)));const _0xfb8e43=0xc,_0x22cbda=0xa,_0x55683f=0xa,_0xc1ab32=0xa;console['log']('\x20\x20'+_0xf7f08(0x1b3)[_0xf7f08(0x1c4)](_0xfb8e43)+'\x20\x20'+_0xf7f08(0x1dc)[_0xf7f08(0x1f0)](_0x22cbda)+'\x20\x20'+_0xf7f08(0x1ce)[_0xf7f08(0x1f0)](_0x55683f)+'\x20\x20'+_0xf7f08(0x1e7)[_0xf7f08(0x1f0)](_0xc1ab32));for(const _0x2bf50e of _0x35ba58){console[_0xf7f08(0x1e0)]('\x20\x20'+_0x2bf50e[_0xf7f08(0x1ed)][_0xf7f08(0x1c4)](_0xfb8e43)+'\x20\x20'+a13_0x2a2b9d[_0xf7f08(0x1ef)](formatCredits(_0x2bf50e[_0xf7f08(0x1c0)])[_0xf7f08(0x1f0)](_0x22cbda))+'\x20\x20'+formatCredits(_0x2bf50e[_0xf7f08(0x1f4)])[_0xf7f08(0x1f0)](_0x55683f)+'\x20\x20'+formatCredits(_0x2bf50e[_0xf7f08(0x1b5)])[_0xf7f08(0x1f0)](_0xc1ab32));}console[_0xf7f08(0x1e0)]();}if(_0x460981[_0xf7f08(0x1e1)]===0x0){console[_0xf7f08(0x1e0)](a13_0x2a2b9d['dim']('\x20\x20No\x20usage\x20data\x20recorded\x20yet.')),console['log'](a13_0x2a2b9d[_0xf7f08(0x1cd)](_0xf7f08(0x1b2)));return;}console['log'](a13_0x2a2b9d[_0xf7f08(0x1d0)](_0xf7f08(0x1d4))),console[_0xf7f08(0x1e0)](a13_0x2a2b9d[_0xf7f08(0x1cd)]('─'[_0xf7f08(0x1bc)](0x3c)));const _0x3f4d72=Math['max'](0xc,..._0x460981[_0xf7f08(0x1ee)](_0x54b79b=>_0x54b79b['profile']===_0xf7f08(0x1eb)?_0xf7f08(0x1dd)['length']:_0x54b79b[_0xf7f08(0x1f2)][_0xf7f08(0x1e1)])),_0x3666ac=0xa,_0x463008=0xa;console[_0xf7f08(0x1e0)]('\x20\x20'+'Profile'[_0xf7f08(0x1c4)](_0x3f4d72)+'\x20\x20'+_0xf7f08(0x1d9)[_0xf7f08(0x1f0)](_0x3666ac)+'\x20\x20'+'Requests'[_0xf7f08(0x1f0)](_0x463008)+'\x20\x20'+_0xf7f08(0x1bb));for(const _0x1453bd of _0x460981){const _0xc090d0=_0x1453bd['profile']===_0xf7f08(0x1eb)?_0xf7f08(0x1dd):_0x1453bd['profile'],_0x33458c=_0xc090d0[_0xf7f08(0x1c4)](_0x3f4d72),_0x1603bd=_0x1453bd[_0xf7f08(0x1f2)]===_0xf7f08(0x1eb)?a13_0x2a2b9d[_0xf7f08(0x1cd)](_0x33458c):_0x33458c;console[_0xf7f08(0x1e0)]('\x20\x20'+_0x1603bd+'\x20\x20'+a13_0x2a2b9d[_0xf7f08(0x1ef)](formatCredits(_0x1453bd[_0xf7f08(0x1c0)])[_0xf7f08(0x1f0)](_0x3666ac))+'\x20\x20'+String(_0x1453bd['entryCount'])[_0xf7f08(0x1f0)](_0x463008)+'\x20\x20'+a13_0x2a2b9d[_0xf7f08(0x1cd)](formatLastUsed(_0x1453bd[_0xf7f08(0x1c9)])));}console[_0xf7f08(0x1e0)](),console[_0xf7f08(0x1e0)](a13_0x2a2b9d['dim'](_0xf7f08(0x1bf))),console[_0xf7f08(0x1e0)]();}}
@@ -1 +1 @@
1
- const a14_0x45e0d5=a14_0x45d1;(function(_0x3268f1,_0x4fafb4){const _0x1f0c5c=a14_0x45d1,_0x5a3e0e=_0x3268f1();while(!![]){try{const _0x8434f9=-parseInt(_0x1f0c5c(0xed))/0x1+-parseInt(_0x1f0c5c(0xf6))/0x2*(parseInt(_0x1f0c5c(0xf5))/0x3)+parseInt(_0x1f0c5c(0xd9))/0x4+-parseInt(_0x1f0c5c(0xea))/0x5+-parseInt(_0x1f0c5c(0xdd))/0x6*(-parseInt(_0x1f0c5c(0xe7))/0x7)+parseInt(_0x1f0c5c(0xf0))/0x8+parseInt(_0x1f0c5c(0xde))/0x9*(parseInt(_0x1f0c5c(0xd6))/0xa);if(_0x8434f9===_0x4fafb4)break;else _0x5a3e0e['push'](_0x5a3e0e['shift']());}catch(_0x5d9735){_0x5a3e0e['push'](_0x5a3e0e['shift']());}}}(a14_0x1f3c,0x8bfb2));import{validateLimitOption}from'../utils/option-validation.js';function a14_0x1f3c(){const _0x190a70=['Authentication\x20error\x20stack\x20trace:','number','isValid','values','error','options','Authentication\x20failed','250OIaxGQ','message','category','829160YRTViN','status','code','validateGlobalOptions','186jZZKBJ','92403fIvafK','debug','\x20\x20→\x20Please\x20contact\x20your\x20admin\x20to\x20request\x20the\x20required\x20permission.','helpText','commands','problemDetails','stack','\x27\x20is\x20already\x20registered','Error:\x20','202461ZEYSHz','cyan','\x0aStack\x20trace:\x0a','1371715JQTrnF','get','red','512650JLkxiM','Reason:\x20','execute','3418232MxDoUO','Invalid\x20limit\x20value:\x20','limit','yellow','tdx\x20auth\x20setup','641253wvfPgi','4wgYPNU','\x20--profile\x20','value','dim','name','Command\x20\x27','detail','run','register','from','.\x20Must\x20be\x20a\x20number.','has','command'];a14_0x1f3c=function(){return _0x190a70;};return a14_0x1f3c();}import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory,ErrorCode}from'../sdk/errors.js';import{Logger}from'../utils/logger/index.js';import a14_0x1ad512 from'chalk';export function printSDKError(_0x39734a){const _0x49917b=a14_0x45d1;_0x39734a[_0x49917b(0xdb)]===ErrorCode['PERMISSION_DENIED']?(console['error'](a14_0x1ad512[_0x49917b(0xec)](_0x49917b(0xe6)+_0x39734a['message'])),console[_0x49917b(0xd3)](a14_0x1ad512[_0x49917b(0xf9)](_0x49917b(0xe0)))):console['error'](a14_0x1ad512[_0x49917b(0xec)](_0x49917b(0xe6)+_0x39734a[_0x49917b(0xd7)])),_0x39734a[_0x49917b(0xe1)]&&console[_0x49917b(0xd3)](a14_0x1ad512[_0x49917b(0xf3)](_0x39734a['helpText']));}function a14_0x45d1(_0x4d9584,_0x3e97f6){_0x4d9584=_0x4d9584-0xd2;const _0x1f3c08=a14_0x1f3c();let _0x45d193=_0x1f3c08[_0x4d9584];return _0x45d193;}export function printAuthError(_0x31c0bd,_0x372fd7=![],_0x4c697a){const _0x263942=a14_0x45d1,_0x10d9fc=_0x31c0bd[_0x263942(0xe3)]?.[_0x263942(0xfc)]||_0x31c0bd[_0x263942(0xd7)];console[_0x263942(0xd3)](a14_0x1ad512['red'](_0x263942(0xd5))),console[_0x263942(0xd3)](a14_0x1ad512['red'](_0x263942(0xee)+_0x10d9fc));if(_0x372fd7){const _0x40632f=_0x4c697a?_0x263942(0xf7)+_0x4c697a:'';console[_0x263942(0xd3)]('\x0a'+a14_0x1ad512[_0x263942(0xf9)]('To\x20set\x20up\x20authentication:')),console['error']('\x20\x20'+a14_0x1ad512['cyan'](_0x263942(0xf4)+_0x40632f)+'\x0a'),console['error'](''+a14_0x1ad512['dim']('To\x20check\x20your\x20current\x20auth\x20status:')),console[_0x263942(0xd3)]('\x20\x20'+a14_0x1ad512[_0x263942(0xe8)]('tdx\x20auth'+_0x40632f));}}export class BaseCommand{[a14_0x45e0d5(0xdc)](_0x5e96c5){const _0x51f7dd=a14_0x45e0d5,{options:_0x52179f}=_0x5e96c5,_0x362c1d=_0x52179f[_0x51f7dd(0xf2)];if(_0x362c1d!==undefined){const _0x4efc24=typeof _0x362c1d===_0x51f7dd(0x104)?_0x362c1d:parseInt(_0x362c1d,0xa);if(isNaN(_0x4efc24))return _0x51f7dd(0xf1)+_0x362c1d+_0x51f7dd(0x100);const _0x18ac62=validateLimitOption(_0x4efc24);if(!_0x18ac62[_0x51f7dd(0x105)])return _0x18ac62[_0x51f7dd(0xd3)];_0x5e96c5[_0x51f7dd(0xd4)]['limit']=_0x18ac62[_0x51f7dd(0xf8)];}return undefined;}['validate'](_0x57e401){return undefined;}async[a14_0x45e0d5(0xfd)](_0x5227a4){const _0x133aec=a14_0x45e0d5;try{const _0x1d2a74=this[_0x133aec(0xdc)](_0x5227a4);if(_0x1d2a74)return console[_0x133aec(0xd3)](_0x133aec(0xe6)+_0x1d2a74),0x1;const _0x3c513d=this['validate'](_0x5227a4);if(_0x3c513d){const _0x2f9c09=/^\s*(Usage|Note|Warning|Error):/i['test'](_0x3c513d);return _0x2f9c09?console[_0x133aec(0xd3)](_0x3c513d):console[_0x133aec(0xd3)](_0x133aec(0xe6)+_0x3c513d),0x1;}const _0x8e87b7=await this[_0x133aec(0xef)](_0x5227a4);return _0x8e87b7??0x0;}catch(_0x3a5da6){if(_0x3a5da6 instanceof Error){if(_0x3a5da6 instanceof HTTPClientError&&_0x3a5da6[_0x133aec(0xda)]===0x191){const _0x2ce85a=_0x5227a4[_0x133aec(0xd4)]['profile'];printAuthError(_0x3a5da6,!![],_0x2ce85a);if(_0x3a5da6[_0x133aec(0xe4)]){const _0x304741=Logger['of'](_0x133aec(0x102));_0x304741[_0x133aec(0xdf)](_0x133aec(0x103)),_0x304741[_0x133aec(0xdf)](_0x3a5da6['stack']);}return 0x1;}_0x3a5da6 instanceof SDKError?printSDKError(_0x3a5da6):console[_0x133aec(0xd3)](a14_0x1ad512['red'](_0x133aec(0xe6)+_0x3a5da6[_0x133aec(0xd7)]));const _0x4bd058=_0x3a5da6 instanceof SDKError&&_0x3a5da6[_0x133aec(0xd8)]===ErrorCategory['USER_ERROR'];_0x3a5da6[_0x133aec(0xe4)]&&!_0x4bd058&&console[_0x133aec(0xd3)](_0x133aec(0xe9)+_0x3a5da6['stack']);}else console[_0x133aec(0xd3)](_0x133aec(0xe6)+String(_0x3a5da6));return 0x1;}}}export class CommandRegistry{['commands']=new Map();[a14_0x45e0d5(0xfe)](_0x52fb1d){const _0x1fb908=a14_0x45e0d5;if(this[_0x1fb908(0xe2)][_0x1fb908(0x101)](_0x52fb1d['name']))throw new Error(_0x1fb908(0xfb)+_0x52fb1d['name']+_0x1fb908(0xe5));this['commands']['set'](_0x52fb1d[_0x1fb908(0xfa)],_0x52fb1d);}[a14_0x45e0d5(0xeb)](_0x2635f3){const _0x1207f2=a14_0x45e0d5;return this[_0x1207f2(0xe2)][_0x1207f2(0xeb)](_0x2635f3);}['getAll'](){const _0xc3208a=a14_0x45e0d5;return Array[_0xc3208a(0xff)](this['commands'][_0xc3208a(0xd2)]());}['has'](_0x50a4cc){const _0x3f8cff=a14_0x45e0d5;return this[_0x3f8cff(0xe2)][_0x3f8cff(0x101)](_0x50a4cc);}}export const registry=new CommandRegistry();
1
+ const a14_0x274dfe=a14_0xd16a;(function(_0x33f107,_0x795e9){const _0x2ee5bc=a14_0xd16a,_0x2aba83=_0x33f107();while(!![]){try{const _0x377ba7=parseInt(_0x2ee5bc(0x19a))/0x1*(parseInt(_0x2ee5bc(0x191))/0x2)+parseInt(_0x2ee5bc(0x1a2))/0x3+parseInt(_0x2ee5bc(0x178))/0x4*(parseInt(_0x2ee5bc(0x186))/0x5)+-parseInt(_0x2ee5bc(0x19f))/0x6*(-parseInt(_0x2ee5bc(0x1ae))/0x7)+parseInt(_0x2ee5bc(0x1a4))/0x8*(-parseInt(_0x2ee5bc(0x18d))/0x9)+-parseInt(_0x2ee5bc(0x1aa))/0xa*(-parseInt(_0x2ee5bc(0x17c))/0xb)+-parseInt(_0x2ee5bc(0x1ab))/0xc;if(_0x377ba7===_0x795e9)break;else _0x2aba83['push'](_0x2aba83['shift']());}catch(_0x53b0d5){_0x2aba83['push'](_0x2aba83['shift']());}}}(a14_0x415e,0xa933b));function a14_0xd16a(_0x2fe4e5,_0x20e8a4){_0x2fe4e5=_0x2fe4e5-0x178;const _0x415e8b=a14_0x415e();let _0xd16abb=_0x415e8b[_0x2fe4e5];return _0xd16abb;}import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory,ErrorCode}from'../sdk/errors.js';import{Logger}from'../utils/logger/index.js';import a14_0x2bf7f9 from'chalk';export function printSDKError(_0x263f35){const _0x58e41d=a14_0xd16a;_0x263f35[_0x58e41d(0x18a)]===ErrorCode[_0x58e41d(0x199)]?(console['error'](a14_0x2bf7f9[_0x58e41d(0x18b)]('Error:\x20'+_0x263f35[_0x58e41d(0x17d)])),console['error'](a14_0x2bf7f9[_0x58e41d(0x1ac)](_0x58e41d(0x19b)))):console[_0x58e41d(0x193)](a14_0x2bf7f9[_0x58e41d(0x18b)](_0x58e41d(0x1af)+_0x263f35[_0x58e41d(0x17d)])),_0x263f35[_0x58e41d(0x1b1)]&&console[_0x58e41d(0x193)](a14_0x2bf7f9[_0x58e41d(0x1a9)](_0x263f35[_0x58e41d(0x1b1)]));}export function printAuthError(_0xefa469,_0x445f7a=![],_0x31f813){const _0x25bf1b=a14_0xd16a,_0x86f8dc=_0xefa469[_0x25bf1b(0x190)]?.[_0x25bf1b(0x1ad)]||_0xefa469[_0x25bf1b(0x17d)];console[_0x25bf1b(0x193)](a14_0x2bf7f9['red'](_0x25bf1b(0x19d))),console['error'](a14_0x2bf7f9[_0x25bf1b(0x18b)](_0x25bf1b(0x1b0)+_0x86f8dc));if(_0x445f7a){const _0x47a212=_0x31f813?'\x20--profile\x20'+_0x31f813:'';console[_0x25bf1b(0x193)]('\x0a'+a14_0x2bf7f9['dim']('To\x20set\x20up\x20authentication:')),console['error']('\x20\x20'+a14_0x2bf7f9[_0x25bf1b(0x17a)](_0x25bf1b(0x180)+_0x47a212)+'\x0a'),console['error'](''+a14_0x2bf7f9[_0x25bf1b(0x1ac)]('To\x20check\x20your\x20current\x20auth\x20status:')),console['error']('\x20\x20'+a14_0x2bf7f9[_0x25bf1b(0x17a)](_0x25bf1b(0x179)+_0x47a212));}}function a14_0x415e(){const _0x4ef7d2=['command','debug','tdx\x20auth\x20setup','from','name','USER_ERROR','stack','value','2605eZIkiF','set','.\x20Must\x20be\x20a\x20number.','isValid','code','red','status','2742723BggQqE','execute','Authentication\x20error\x20stack\x20trace:','problemDetails','2kSzCQG','profile','error','\x27\x20is\x20already\x20registered','options','Invalid\x20limit\x20value:\x20','validateGlobalOptions','values','PERMISSION_DENIED','761347uPXjxk','\x20\x20→\x20Please\x20contact\x20your\x20admin\x20to\x20request\x20the\x20required\x20permission.','get','Authentication\x20failed','\x0aStack\x20trace:\x0a','14502NnDmhe','number','commands','1253667tNdRgr','run','8cEjILu','validate','limit','test','Command\x20\x27','yellow','4910990LjglIt','29722056ILiiVV','dim','detail','1743fYXGmV','Error:\x20','Reason:\x20','helpText','9232VdJqde','tdx\x20auth','cyan','getAll','11TdNliP','message'];a14_0x415e=function(){return _0x4ef7d2;};return a14_0x415e();}export class BaseCommand{[a14_0x274dfe(0x197)](_0x28f689){const _0x48d9c6=a14_0x274dfe,{options:_0x173b9d}=_0x28f689,_0x2a3361=_0x173b9d[_0x48d9c6(0x1a6)];if(_0x2a3361!==undefined){const _0x10ba07=typeof _0x2a3361===_0x48d9c6(0x1a0)?_0x2a3361:parseInt(_0x2a3361,0xa);if(isNaN(_0x10ba07))return _0x48d9c6(0x196)+_0x2a3361+_0x48d9c6(0x188);const _0x23981e=validateLimitOption(_0x10ba07);if(!_0x23981e[_0x48d9c6(0x189)])return _0x23981e[_0x48d9c6(0x193)];_0x28f689[_0x48d9c6(0x195)][_0x48d9c6(0x1a6)]=_0x23981e[_0x48d9c6(0x185)];}return undefined;}['validate'](_0x11bf52){return undefined;}async[a14_0x274dfe(0x1a3)](_0x3dd6b4){const _0x1825c7=a14_0x274dfe;try{const _0x4a5656=this['validateGlobalOptions'](_0x3dd6b4);if(_0x4a5656)return console['error'](_0x1825c7(0x1af)+_0x4a5656),0x1;const _0x1d98ea=this[_0x1825c7(0x1a5)](_0x3dd6b4);if(_0x1d98ea){const _0x3aac8d=/^\s*(Usage|Note|Warning|Error):/i[_0x1825c7(0x1a7)](_0x1d98ea);return _0x3aac8d?console[_0x1825c7(0x193)](_0x1d98ea):console['error'](_0x1825c7(0x1af)+_0x1d98ea),0x1;}const _0x2e286e=await this[_0x1825c7(0x18e)](_0x3dd6b4);return _0x2e286e??0x0;}catch(_0x4926f9){if(_0x4926f9 instanceof Error){if(_0x4926f9 instanceof HTTPClientError&&_0x4926f9[_0x1825c7(0x18c)]===0x191){const _0x3ef0fa=_0x3dd6b4['options'][_0x1825c7(0x192)];printAuthError(_0x4926f9,!![],_0x3ef0fa);if(_0x4926f9[_0x1825c7(0x184)]){const _0x35434d=Logger['of'](_0x1825c7(0x17e));_0x35434d[_0x1825c7(0x17f)](_0x1825c7(0x18f)),_0x35434d[_0x1825c7(0x17f)](_0x4926f9[_0x1825c7(0x184)]);}return 0x1;}_0x4926f9 instanceof SDKError?printSDKError(_0x4926f9):console[_0x1825c7(0x193)](a14_0x2bf7f9[_0x1825c7(0x18b)](_0x1825c7(0x1af)+_0x4926f9[_0x1825c7(0x17d)]));const _0x41a9e3=_0x4926f9 instanceof SDKError&&_0x4926f9['category']===ErrorCategory[_0x1825c7(0x183)];_0x4926f9[_0x1825c7(0x184)]&&!_0x41a9e3&&console[_0x1825c7(0x193)](_0x1825c7(0x19e)+_0x4926f9['stack']);}else console[_0x1825c7(0x193)](_0x1825c7(0x1af)+String(_0x4926f9));return 0x1;}}}export class CommandRegistry{[a14_0x274dfe(0x1a1)]=new Map();['register'](_0x211e8c){const _0x5b768d=a14_0x274dfe;if(this[_0x5b768d(0x1a1)]['has'](_0x211e8c[_0x5b768d(0x182)]))throw new Error(_0x5b768d(0x1a8)+_0x211e8c[_0x5b768d(0x182)]+_0x5b768d(0x194));this['commands'][_0x5b768d(0x187)](_0x211e8c[_0x5b768d(0x182)],_0x211e8c);}[a14_0x274dfe(0x19c)](_0x5686a2){const _0x50e742=a14_0x274dfe;return this[_0x50e742(0x1a1)]['get'](_0x5686a2);}[a14_0x274dfe(0x17b)](){const _0x3e27c2=a14_0x274dfe;return Array[_0x3e27c2(0x181)](this['commands'][_0x3e27c2(0x198)]());}['has'](_0x1028c8){return this['commands']['has'](_0x1028c8);}}export const registry=new CommandRegistry();