@treasuredata/tdx 0.10.0 → 0.10.1

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 (135) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/api-command.js +1 -1
  8. package/dist/commands/auth-command.js +1 -1
  9. package/dist/commands/chat-command.js +1 -1
  10. package/dist/commands/claude-command.js +1 -1
  11. package/dist/commands/claude-statusline-command.js +1 -1
  12. package/dist/commands/claude-usage-command.js +1 -1
  13. package/dist/commands/command.js +1 -1
  14. package/dist/commands/connection-command.js +1 -1
  15. package/dist/commands/context-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/parent-segment-command.js +1 -1
  25. package/dist/commands/profiles-command.js +1 -1
  26. package/dist/commands/query-command.js +1 -1
  27. package/dist/commands/segment-command.js +1 -1
  28. package/dist/commands/segment-create-command.js +1 -1
  29. package/dist/commands/segment-fields-command.js +1 -1
  30. package/dist/commands/segment-pull-command.js +1 -1
  31. package/dist/commands/segment-push-command.js +1 -1
  32. package/dist/commands/segment-update-command.js +1 -1
  33. package/dist/commands/segment-use-command.js +1 -1
  34. package/dist/commands/segment-validate-command.js +1 -1
  35. package/dist/commands/segments.js +1 -1
  36. package/dist/commands/show.js +1 -1
  37. package/dist/commands/tables.js +1 -1
  38. package/dist/commands/use-command.js +1 -1
  39. package/dist/commands/user-command.js +1 -1
  40. package/dist/commands/workflow-command.js +1 -1
  41. package/dist/core/auth.js +1 -1
  42. package/dist/core/command-output.js +1 -1
  43. package/dist/core/config.js +1 -1
  44. package/dist/core/connection-cache.js +1 -1
  45. package/dist/core/constants.js +1 -1
  46. package/dist/core/credential-cache.js +1 -1
  47. package/dist/core/global-context.js +1 -1
  48. package/dist/core/keychain.js +1 -1
  49. package/dist/core/profile.js +1 -1
  50. package/dist/core/project-config.js +1 -1
  51. package/dist/core/session.js +1 -1
  52. package/dist/core/user-cache.js +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/proxy/anthropic-adapter.js +1 -1
  55. package/dist/proxy/claude-usage-tracker.js +1 -1
  56. package/dist/proxy/context-signature.js +1 -1
  57. package/dist/proxy/conversation-utils.js +1 -1
  58. package/dist/proxy/server.js +1 -1
  59. package/dist/proxy/session-cache.js +1 -1
  60. package/dist/sdk/agent/agent-config.js +1 -1
  61. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  62. package/dist/sdk/agent/agent-yaml.js +1 -1
  63. package/dist/sdk/api.js +1 -1
  64. package/dist/sdk/client/cdp-api-client.js +1 -1
  65. package/dist/sdk/client/endpoints.js +1 -1
  66. package/dist/sdk/client/engage-api-client.js +1 -1
  67. package/dist/sdk/client/http-client.js +1 -1
  68. package/dist/sdk/client/llm-api-client.js +1 -1
  69. package/dist/sdk/client/rate-limiter.js +1 -1
  70. package/dist/sdk/client/td-api-client.js +1 -1
  71. package/dist/sdk/client/trino-api-client.js +1 -1
  72. package/dist/sdk/client/workflow-client.js +1 -1
  73. package/dist/sdk/connection-validator.js +1 -1
  74. package/dist/sdk/connection.js +1 -1
  75. package/dist/sdk/engage.js +1 -1
  76. package/dist/sdk/errors.js +1 -1
  77. package/dist/sdk/index.js +1 -1
  78. package/dist/sdk/io/index.js +1 -1
  79. package/dist/sdk/io/node-filesystem.js +1 -1
  80. package/dist/sdk/job.js +1 -1
  81. package/dist/sdk/journey.js +1 -1
  82. package/dist/sdk/llm/chat-cache.js +1 -1
  83. package/dist/sdk/llm/index.js +1 -1
  84. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  85. package/dist/sdk/llm/model-aliases.js +1 -1
  86. package/dist/sdk/llm/model-factors.js +1 -1
  87. package/dist/sdk/query/index.js +1 -1
  88. package/dist/sdk/query/sql-parser.js +1 -1
  89. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  90. package/dist/sdk/segment/fields-display.js +1 -1
  91. package/dist/sdk/segment/file-discovery.js +1 -1
  92. package/dist/sdk/segment/journey-utils.js +1 -1
  93. package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
  94. package/dist/sdk/segment/journey-yaml.js +1 -1
  95. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  96. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  97. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  98. package/dist/sdk/segment/pull-workflow.js +1 -1
  99. package/dist/sdk/segment/push-workflow.js +1 -1
  100. package/dist/sdk/segment/push-workflow.js.map +1 -1
  101. package/dist/sdk/segment/resolution-context.js +1 -1
  102. package/dist/sdk/segment/segment-path-parser.js +1 -1
  103. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  104. package/dist/sdk/segment/target-resolution.js +1 -1
  105. package/dist/sdk/segment/tdx-config.js +1 -1
  106. package/dist/sdk/segment/validate-files.js +1 -1
  107. package/dist/sdk/segment/yaml-validator.js +1 -1
  108. package/dist/sdk/segment.js +1 -1
  109. package/dist/sdk/types/cdp.d.ts +5 -2
  110. package/dist/sdk/types/cdp.d.ts.map +1 -1
  111. package/dist/sdk/types/index.js +1 -1
  112. package/dist/sdk/types/progress.js +1 -1
  113. package/dist/sdk/user.js +1 -1
  114. package/dist/sdk/util/format-detector.js +1 -1
  115. package/dist/sdk/util/formatters.js +1 -1
  116. package/dist/sdk/util/index.js +1 -1
  117. package/dist/sdk/util/tree-formatter.js +1 -1
  118. package/dist/sdk/workflow/index.js +1 -1
  119. package/dist/sdk/workflow/workflow-utils.js +1 -1
  120. package/dist/utils/async.js +1 -1
  121. package/dist/utils/colors.js +1 -1
  122. package/dist/utils/diff.js +1 -1
  123. package/dist/utils/file-permissions.js +1 -1
  124. package/dist/utils/json-loader.js +1 -1
  125. package/dist/utils/option-validation.js +1 -1
  126. package/dist/utils/port.js +1 -1
  127. package/dist/utils/process.js +1 -1
  128. package/dist/utils/prompt.js +1 -1
  129. package/dist/utils/spinner.js +1 -1
  130. package/dist/utils/sse-parser.js +1 -1
  131. package/dist/utils/string-utils.js +1 -1
  132. package/dist/utils/table-ref-parser.js +1 -1
  133. package/dist/utils/tdx-logger.js +1 -1
  134. package/dist/utils/version-check.js +1 -1
  135. package/package.json +1 -1
@@ -1 +1 @@
1
- const a3_0x10e171=a3_0x2569;(function(_0x1a536d,_0x4ec321){const _0x7721fb=a3_0x2569,_0x5893e1=_0x1a536d();while(!![]){try{const _0x1ebaf8=parseInt(_0x7721fb(0x18a))/0x1*(parseInt(_0x7721fb(0x1a0))/0x2)+parseInt(_0x7721fb(0x186))/0x3*(-parseInt(_0x7721fb(0x194))/0x4)+parseInt(_0x7721fb(0x19d))/0x5+parseInt(_0x7721fb(0x19b))/0x6*(parseInt(_0x7721fb(0x190))/0x7)+parseInt(_0x7721fb(0x1a2))/0x8+parseInt(_0x7721fb(0x193))/0x9*(parseInt(_0x7721fb(0x196))/0xa)+-parseInt(_0x7721fb(0x188))/0xb;if(_0x1ebaf8===_0x4ec321)break;else _0x5893e1['push'](_0x5893e1['shift']());}catch(_0x66e793){_0x5893e1['push'](_0x5893e1['shift']());}}}(a3_0x5602,0x4632e));function a3_0x5602(){const _0x560682=['6jxEkBX','\x27...','1367960QPLmuK','✔\x20Found\x20','site','2kpAAhq','\x20\x20Cause:\x20','900536wuagcU','description','execute','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','Resolved\x20child\x20ID:\x20','Parent\x20name:\x20','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','Error:\x20','length','activations','3uqdVhi','resolveParentId','7634759ZUtjYb','Resolved\x20parent\x20ID:\x20','432611AtXdnH','message','Child\x20name:\x20','verbose','listActivations','name','2106223VXtgSb','cause','segment','22437ayWqkN','1180460bNsVMd','error','630AkGlXq','Listing\x20activations\x20for\x20segment\x20\x27','Error:\x20Segment\x20name\x20is\x20required','List\x20activations\x20for\x20a\x20segment','data'];a3_0x5602=function(){return _0x560682;};return a3_0x5602();}import{BaseCommand}from'./command.js';function a3_0x2569(_0x259f6,_0xea2014){_0x259f6=_0x259f6-0x17f;const _0x56020c=a3_0x5602();let _0x2569aa=_0x56020c[_0x259f6];return _0x2569aa;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a3_0x10e171(0x18f)]=a3_0x10e171(0x185);[a3_0x10e171(0x1a3)]=a3_0x10e171(0x199);async[a3_0x10e171(0x1a4)](_0x1fa39a){const _0x301d57=a3_0x10e171,{options:_0x1ca0a7,args:_0x3bf5ff,tdx:_0x3c8817}=_0x1fa39a;if(_0x3bf5ff[_0x301d57(0x184)]===0x0)return console[_0x301d57(0x195)](_0x301d57(0x198)),console[_0x301d57(0x195)](_0x301d57(0x182)),0x1;try{const {parentId:_0x339725,childId:_0x25155e}=parseSegmentRef(_0x3bf5ff[0x0]);if(!_0x25155e)return console[_0x301d57(0x195)](_0x301d57(0x17f)),console['error'](_0x301d57(0x182)),0x1;_0x1ca0a7[_0x301d57(0x18d)]&&(console[_0x301d57(0x195)]('Site:\x20'+_0x1ca0a7[_0x301d57(0x19f)]),console[_0x301d57(0x195)](_0x301d57(0x181)+_0x339725),console[_0x301d57(0x195)](_0x301d57(0x18c)+_0x25155e));const _0x15678d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x339725+_0x301d57(0x19c),()=>_0x3c8817[_0x301d57(0x192)][_0x301d57(0x187)](_0x339725),{'verbose':_0x1ca0a7[_0x301d57(0x18d)]}),_0x371d6a=_0x15678d[_0x301d57(0x19a)];_0x1ca0a7[_0x301d57(0x18d)]&&console[_0x301d57(0x195)](_0x301d57(0x189)+_0x371d6a);const _0x234ded=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x25155e+_0x301d57(0x19c),()=>_0x3c8817[_0x301d57(0x192)]['resolveSegmentId'](_0x371d6a,_0x25155e),{'verbose':_0x1ca0a7[_0x301d57(0x18d)]}),_0x59ad76=_0x234ded['data'];_0x1ca0a7['verbose']&&console[_0x301d57(0x195)](_0x301d57(0x180)+_0x59ad76);const _0x8d8eb4=await withSpinner(_0x301d57(0x197)+_0x25155e+'\x27...',()=>_0x3c8817[_0x301d57(0x192)][_0x301d57(0x18e)](_0x371d6a,_0x59ad76),{'verbose':_0x1ca0a7[_0x301d57(0x18d)]}),_0x37e8ab=_0x8d8eb4[_0x301d57(0x19a)];return console[_0x301d57(0x195)](_0x301d57(0x19e)+_0x37e8ab['length']+'\x20activation'+(_0x37e8ab[_0x301d57(0x184)]!==0x1?'s':'')),await handleSDKOutput(_0x37e8ab,_0x1ca0a7),0x0;}catch(_0x326748){if(_0x326748 instanceof SDKError)return console[_0x301d57(0x195)](_0x301d57(0x183)+_0x326748[_0x301d57(0x18b)]),_0x326748[_0x301d57(0x191)]&&console[_0x301d57(0x195)](_0x301d57(0x1a1)+_0x326748['cause']),0x1;throw _0x326748;}}}
1
+ const a3_0x1ebeaf=a3_0xe43c;(function(_0x1b52d9,_0x4f47f5){const _0x5315ce=a3_0xe43c,_0x5dec3f=_0x1b52d9();while(!![]){try{const _0x2efb9a=parseInt(_0x5315ce(0x6f))/0x1+parseInt(_0x5315ce(0x78))/0x2+parseInt(_0x5315ce(0x87))/0x3+-parseInt(_0x5315ce(0x73))/0x4*(parseInt(_0x5315ce(0x7c))/0x5)+parseInt(_0x5315ce(0x6d))/0x6+-parseInt(_0x5315ce(0x86))/0x7+parseInt(_0x5315ce(0x77))/0x8*(-parseInt(_0x5315ce(0x6c))/0x9);if(_0x2efb9a===_0x4f47f5)break;else _0x5dec3f['push'](_0x5dec3f['shift']());}catch(_0x120b96){_0x5dec3f['push'](_0x5dec3f['shift']());}}}(a3_0x169e,0xacf38));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';function a3_0x169e(){const _0x5b2dd6=['4551342PgojRg','cause','944125XhRPRs','site','Resolved\x20child\x20ID:\x20','\x27...','595844WgRMka','data','resolveParentId','description','736EhDXAZ','1566072bElpLz','error','Parent\x20name:\x20','length','35jOYICG','segment','Listing\x20activations\x20for\x20segment\x20\x27','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','name','listActivations','✔\x20Found\x20','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','Site:\x20','Error:\x20','7213549AVEgNf','1287696BMSlFO','verbose','\x20\x20Cause:\x20','resolveSegmentId','message','List\x20activations\x20for\x20a\x20segment','13041VrmrNO'];a3_0x169e=function(){return _0x5b2dd6;};return a3_0x169e();}import{withSpinner}from'../utils/spinner.js';function a3_0xe43c(_0x9197b0,_0x546113){_0x9197b0=_0x9197b0-0x6a;const _0x169e71=a3_0x169e();let _0xe43ceb=_0x169e71[_0x9197b0];return _0xe43ceb;}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a3_0x1ebeaf(0x80)]='activations';[a3_0x1ebeaf(0x76)]=a3_0x1ebeaf(0x6b);async['execute'](_0x3d6382){const _0xad905d=a3_0x1ebeaf,{options:_0x5c40b5,args:_0x22015b,tdx:_0x5e90a7}=_0x3d6382;if(_0x22015b[_0xad905d(0x7b)]===0x0)return console['error']('Error:\x20Segment\x20name\x20is\x20required'),console[_0xad905d(0x79)](_0xad905d(0x7f)),0x1;try{const {parentId:_0x33b72e,childId:_0x238385}=parseSegmentRef(_0x22015b[0x0]);if(!_0x238385)return console[_0xad905d(0x79)](_0xad905d(0x83)),console['error'](_0xad905d(0x7f)),0x1;_0x5c40b5[_0xad905d(0x88)]&&(console[_0xad905d(0x79)](_0xad905d(0x84)+_0x5c40b5[_0xad905d(0x70)]),console[_0xad905d(0x79)](_0xad905d(0x7a)+_0x33b72e),console[_0xad905d(0x79)]('Child\x20name:\x20'+_0x238385));const _0x300d69=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x33b72e+_0xad905d(0x72),()=>_0x5e90a7['segment'][_0xad905d(0x75)](_0x33b72e),{'verbose':_0x5c40b5[_0xad905d(0x88)]}),_0x4794a0=_0x300d69[_0xad905d(0x74)];_0x5c40b5[_0xad905d(0x88)]&&console[_0xad905d(0x79)]('Resolved\x20parent\x20ID:\x20'+_0x4794a0);const _0x1a28d0=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x238385+_0xad905d(0x72),()=>_0x5e90a7[_0xad905d(0x7d)][_0xad905d(0x8a)](_0x4794a0,_0x238385),{'verbose':_0x5c40b5[_0xad905d(0x88)]}),_0x28b979=_0x1a28d0[_0xad905d(0x74)];_0x5c40b5[_0xad905d(0x88)]&&console['error'](_0xad905d(0x71)+_0x28b979);const _0x5b0bc0=await withSpinner(_0xad905d(0x7e)+_0x238385+_0xad905d(0x72),()=>_0x5e90a7[_0xad905d(0x7d)][_0xad905d(0x81)](_0x4794a0,_0x28b979),{'verbose':_0x5c40b5[_0xad905d(0x88)]}),_0x1c16cf=_0x5b0bc0[_0xad905d(0x74)];return console[_0xad905d(0x79)](_0xad905d(0x82)+_0x1c16cf[_0xad905d(0x7b)]+'\x20activation'+(_0x1c16cf[_0xad905d(0x7b)]!==0x1?'s':'')),await handleSDKOutput(_0x1c16cf,_0x5c40b5),0x0;}catch(_0x1dae66){if(_0x1dae66 instanceof SDKError)return console['error'](_0xad905d(0x85)+_0x1dae66[_0xad905d(0x6a)]),_0x1dae66[_0xad905d(0x6e)]&&console[_0xad905d(0x79)](_0xad905d(0x89)+_0x1dae66[_0xad905d(0x6e)]),0x1;throw _0x1dae66;}}}
@@ -1 +1 @@
1
- const a4_0xc83520=a4_0x5639;function a4_0x5639(_0x3ec83a,_0x553743){_0x3ec83a=_0x3ec83a-0x97;const _0x36e42a=a4_0x36e4();let _0x5639bb=_0x36e42a[_0x3ec83a];return _0x5639bb;}(function(_0x6e09b1,_0x46dccc){const _0x321888=a4_0x5639,_0x3fdfa2=_0x6e09b1();while(!![]){try{const _0x1358ae=parseInt(_0x321888(0xb5))/0x1*(parseInt(_0x321888(0x11c))/0x2)+parseInt(_0x321888(0x128))/0x3*(parseInt(_0x321888(0xb1))/0x4)+parseInt(_0x321888(0x131))/0x5+parseInt(_0x321888(0xd0))/0x6+parseInt(_0x321888(0x114))/0x7+parseInt(_0x321888(0xf2))/0x8*(parseInt(_0x321888(0x123))/0x9)+-parseInt(_0x321888(0xbc))/0xa;if(_0x1358ae===_0x46dccc)break;else _0x3fdfa2['push'](_0x3fdfa2['shift']());}catch(_0x5a7ebe){_0x3fdfa2['push'](_0x3fdfa2['shift']());}}}(a4_0x36e4,0xccd00));import a4_0x43622b from'chalk';import a4_0x380073 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x144e15){const _0x371eb7=a4_0x5639,_0x39b722=[];if(_0x144e15[_0x371eb7(0xa8)]!==undefined)_0x39b722[_0x371eb7(0x11f)](_0x144e15[_0x371eb7(0xa8)]+_0x371eb7(0x9c));if(_0x144e15[_0x371eb7(0xaf)]!==undefined&&_0x144e15['new']>0x0)_0x39b722[_0x371eb7(0x11f)](a4_0x43622b[_0x371eb7(0xba)](_0x144e15[_0x371eb7(0xaf)]+_0x371eb7(0x117)));if(_0x144e15[_0x371eb7(0x11e)]!==undefined&&_0x144e15['created']>0x0)_0x39b722[_0x371eb7(0x11f)](a4_0x43622b['green'](_0x144e15[_0x371eb7(0x11e)]+_0x371eb7(0xc4)));if(_0x144e15['updated']!==undefined&&_0x144e15['updated']>0x0)_0x39b722['push'](a4_0x43622b['yellow'](_0x144e15[_0x371eb7(0x103)]+_0x371eb7(0xa7)));if(_0x144e15[_0x371eb7(0xf6)]!==undefined&&_0x144e15['unchanged']>0x0)_0x39b722['push'](a4_0x43622b['gray'](_0x144e15[_0x371eb7(0xf6)]+_0x371eb7(0xc0)));if(_0x144e15[_0x371eb7(0xdf)]!==undefined&&_0x144e15[_0x371eb7(0xdf)]>0x0)_0x39b722['push'](a4_0x43622b[_0x371eb7(0x101)](_0x144e15[_0x371eb7(0xdf)]+_0x371eb7(0xb2)));return _0x39b722[_0x371eb7(0x9b)](',\x20');}function displayDiffs(_0x4ddc80,_0x62a90d,_0x5c7554,_0x35b8ce){const _0x3665af=a4_0x5639;for(const _0x2ac28d of _0x4ddc80){if(_0x2ac28d[_0x3665af(0xca)]){const _0xe51871=_0x2ac28d[_0x3665af(0x102)]||_0x2ac28d[_0x3665af(0xb7)];console[_0x3665af(0xde)](_0x3665af(0xc8)+_0xe51871+'\x27:'),console[_0x3665af(0xde)]('─'['repeat'](0x3c)),console[_0x3665af(0xde)](_0x2ac28d[_0x3665af(0xca)]),console['log']('─'[_0x3665af(0x125)](0x3c));}}for(const _0x37b3c2 of _0x62a90d){_0x37b3c2[_0x3665af(0xca)]&&(console['log'](_0x3665af(0x100)+_0x37b3c2[_0x3665af(0xb7)]+'\x27:'),console[_0x3665af(0xde)]('─'[_0x3665af(0x125)](0x3c)),console[_0x3665af(0xde)](_0x37b3c2[_0x3665af(0xca)]),console[_0x3665af(0xde)]('─'[_0x3665af(0x125)](0x3c)));}for(const _0x33fe3d of _0x5c7554){_0x33fe3d['diff']&&(console['log'](_0x3665af(0xa2)+_0x33fe3d[_0x3665af(0xb7)]+'\x27:'),console[_0x3665af(0xde)]('─'['repeat'](0x3c)),console[_0x3665af(0xde)](_0x33fe3d[_0x3665af(0xca)]),console[_0x3665af(0xde)]('─'[_0x3665af(0x125)](0x3c)));}for(const _0x3f1a78 of _0x35b8ce){_0x3f1a78['diff']&&(console[_0x3665af(0xde)](_0x3665af(0x122)+_0x3f1a78[_0x3665af(0xb7)]+'\x27:'),console[_0x3665af(0xde)]('─'[_0x3665af(0x125)](0x3c)),console['log'](_0x3f1a78[_0x3665af(0xca)]),console[_0x3665af(0xde)]('─'['repeat'](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0xc83520(0xb7)]='agent:pull';[a4_0xc83520(0xc3)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async[a4_0xc83520(0xf7)](_0x2dc873){const _0x2567b0=a4_0xc83520,{options:_0x3ea681,args:_0x257471,tdx:_0x13c21b}=_0x2dc873,_0x5594f4=_0x257471[0x0],_0x274cb1=_0x257471[0x1],_0x2adb39=_0x3ea681[_0x2567b0(0xbb)],_0xe90a63=_0x3ea681[_0x2567b0(0xa3)],_0x1fea98=_0x3ea681[_0x2567b0(0x106)],_0x48b267=_0x3ea681[_0x2567b0(0xe4)],_0x23a501=_0x3ea681['llmProject'];let _0x518ebd,_0x37cffa;const _0x27c656=findAgentConfigPath(process['cwd']());if(_0x5594f4){const _0x4b3991=a4_0x380073[_0x2567b0(0x9b)](_0x5594f4,_0x2567b0(0xf8));if(existsSync(_0x4b3991))try{const _0x276858=JSON[_0x2567b0(0x9d)](readFileSync(_0x4b3991,_0x2567b0(0x9e)));_0x518ebd=_0x276858[_0x2567b0(0xa5)],_0x37cffa=_0x5594f4,console[_0x2567b0(0xde)](a4_0x43622b['dim'](_0x2567b0(0xef)+_0x4b3991+':\x20'+_0x518ebd));}catch{_0x518ebd=_0x5594f4;}else _0x518ebd=_0x5594f4;}else{if(_0x27c656)try{const _0x174009=JSON[_0x2567b0(0x9d)](readFileSync(_0x27c656,'utf-8'));_0x518ebd=_0x174009['llm_project'],_0x37cffa=a4_0x380073['dirname'](_0x27c656),console['log'](a4_0x43622b[_0x2567b0(0xf4)](_0x2567b0(0x10b)+_0x518ebd));}catch{_0x518ebd=_0x23a501;}else _0x518ebd=_0x23a501;}if(!_0x518ebd)return console[_0x2567b0(0xde)](a4_0x43622b[_0x2567b0(0x127)](_0x2567b0(0xce))),console[_0x2567b0(0xde)](_0x2567b0(0xe5)),console[_0x2567b0(0xde)](_0x2567b0(0xa1)),console[_0x2567b0(0xde)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory'),console[_0x2567b0(0xde)](_0x2567b0(0xb8)),0x1;if(_0x274cb1){const {data:_0x121bc7}=await withSpinner(_0x2567b0(0xe1)+_0x274cb1+'\x22\x20from\x20project\x20\x22'+_0x518ebd+_0x2567b0(0xe7),()=>_0x13c21b[_0x2567b0(0x124)][_0x2567b0(0x105)](_0x518ebd,_0x274cb1,_0x2adb39,{'dryRun':_0xe90a63,'force':_0x1fea98}));if(_0xe90a63)return console[_0x2567b0(0xde)](a4_0x43622b[_0x2567b0(0x127)](_0x2567b0(0xd6))),console[_0x2567b0(0xde)](_0x2567b0(0xd5)+_0x121bc7['agentName']),console[_0x2567b0(0xde)]('Output\x20path:\x20'+_0x121bc7['outputPath']),_0x121bc7['diff']&&(console['log']('\x0aChanges:'),console[_0x2567b0(0xde)]('─'[_0x2567b0(0x125)](0x3c)),console[_0x2567b0(0xde)](_0x121bc7['diff']),console[_0x2567b0(0xde)]('─'['repeat'](0x3c))),0x0;return console[_0x2567b0(0xde)](a4_0x43622b[_0x2567b0(0xba)](_0x2567b0(0x135))),console[_0x2567b0(0xde)]('Agent:\x20'+_0x121bc7['agentName']),console[_0x2567b0(0xde)](_0x2567b0(0xad)+_0x121bc7[_0x2567b0(0xdc)]),console[_0x2567b0(0xde)]('Status:\x20'+(_0x121bc7['isNew']?a4_0x43622b[_0x2567b0(0xba)](_0x2567b0(0xaf)):_0x121bc7[_0x2567b0(0xd8)]?a4_0x43622b['yellow']('updated'):a4_0x43622b[_0x2567b0(0x130)](_0x2567b0(0xf6)))),0x0;}const _0x36e24d=_0x37cffa||_0x2adb39,{data:_0x2f51bd}=await withSpinner(_0x2567b0(0xf0)+_0x518ebd+_0x2567b0(0xe7),()=>_0x13c21b[_0x2567b0(0x124)]['pullProject'](_0x518ebd,_0x36e24d,{'dryRun':!![]})),_0x4fc176=_0x2f51bd[_0x2567b0(0x9a)][_0x2567b0(0xd3)][_0x2567b0(0xaf)]+_0x2f51bd['counts'][_0x2567b0(0xfb)]['new']+_0x2f51bd[_0x2567b0(0x9a)]['textKnowledgeBases'][_0x2567b0(0xaf)]+_0x2f51bd[_0x2567b0(0x9a)][_0x2567b0(0xb3)]['new'],_0x21a905=_0x2f51bd['counts'][_0x2567b0(0xd3)][_0x2567b0(0x103)]+_0x2f51bd['counts']['knowledgeBases'][_0x2567b0(0x103)]+_0x2f51bd[_0x2567b0(0x9a)][_0x2567b0(0xa0)][_0x2567b0(0x103)]+_0x2f51bd['counts'][_0x2567b0(0xb3)][_0x2567b0(0x103)],_0x406a52=_0x2f51bd['counts'][_0x2567b0(0xd3)][_0x2567b0(0xf6)]+_0x2f51bd[_0x2567b0(0x9a)][_0x2567b0(0xfb)]['unchanged']+_0x2f51bd[_0x2567b0(0x9a)][_0x2567b0(0xa0)]['unchanged']+_0x2f51bd[_0x2567b0(0x9a)][_0x2567b0(0xb3)][_0x2567b0(0xf6)];console[_0x2567b0(0xde)](_0x2567b0(0x10d)+_0x2f51bd['projectName']+'\x27:'),console[_0x2567b0(0xde)]('\x20\x20'+a4_0x43622b[_0x2567b0(0xba)]('+\x20'+_0x4fc176+'\x20new')+_0x2567b0(0xbe)+a4_0x43622b[_0x2567b0(0x127)]('~\x20'+_0x21a905+_0x2567b0(0xfa))+_0x2567b0(0xbe)+a4_0x43622b[_0x2567b0(0xf4)]('=\x20'+_0x406a52+_0x2567b0(0xc0))),console['log'](_0x2567b0(0xd2)+formatCountSummary(_0x2f51bd[_0x2567b0(0x9a)]['agents'])),console[_0x2567b0(0xde)](_0x2567b0(0x12d)+formatCountSummary(_0x2f51bd[_0x2567b0(0x9a)][_0x2567b0(0xfb)])),console[_0x2567b0(0xde)](_0x2567b0(0x11d)+formatCountSummary(_0x2f51bd['counts'][_0x2567b0(0xa0)])),console[_0x2567b0(0xde)](_0x2567b0(0xd9)+formatCountSummary(_0x2f51bd['counts'][_0x2567b0(0xb3)])),console['log']('\x20\x20Target:\x20'+a4_0x43622b[_0x2567b0(0x118)](_0x2f51bd[_0x2567b0(0xda)])),displayDiffs(_0x2f51bd[_0x2567b0(0xd3)],_0x2f51bd[_0x2567b0(0xfb)],_0x2f51bd[_0x2567b0(0xa0)],_0x2f51bd[_0x2567b0(0xb3)]);if(_0xe90a63)return console[_0x2567b0(0xde)](a4_0x43622b['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x4fc176===0x0&&_0x21a905===0x0)return console[_0x2567b0(0xde)](a4_0x43622b['green']('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x2f51bd[_0x2567b0(0xee)]},_0x3ea681[_0x2567b0(0xff)]),console['log'](a4_0x43622b['green']('✔\x20Context\x20set:\x20'+a4_0x43622b[_0x2567b0(0xf4)]('llm_project')+_0x2567b0(0x12e)+a4_0x43622b[_0x2567b0(0x118)](_0x2f51bd[_0x2567b0(0xee)]))),0x0;if(!_0x48b267&&!_0x1fea98){const _0x1df121=await confirmKey(_0x2567b0(0xe0)+(_0x4fc176+_0x21a905)+_0x2567b0(0xf9));if(!_0x1df121)return console['log']('Pull\x20cancelled'),0x0;}const {data:_0x40dd9c}=await withSpinner(_0x2567b0(0xfd),()=>_0x13c21b[_0x2567b0(0x124)][_0x2567b0(0x113)](_0x518ebd,_0x36e24d,{'force':_0x1fea98}));return console[_0x2567b0(0xde)](a4_0x43622b[_0x2567b0(0xba)](_0x2567b0(0xcc)+(_0x4fc176+_0x21a905)+_0x2567b0(0x109)+_0x40dd9c[_0x2567b0(0xda)])),saveSessionContext({'llm_project':_0x40dd9c[_0x2567b0(0xee)]},_0x3ea681[_0x2567b0(0xff)]),console[_0x2567b0(0xde)](a4_0x43622b['green'](_0x2567b0(0x9f)+a4_0x43622b[_0x2567b0(0xf4)](_0x2567b0(0xa5))+_0x2567b0(0x12e)+a4_0x43622b[_0x2567b0(0x118)](_0x40dd9c['projectName']))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0xc83520(0x136);[a4_0xc83520(0xc3)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async[a4_0xc83520(0xf7)](_0x34237d){const _0x35d100=a4_0xc83520,{options:_0x2a4148,args:_0x2f691d,tdx:_0x54c4fa}=_0x34237d,_0x5321b9=_0x2f691d[0x0],_0x3e153e=_0x2a4148['name'],_0xd652bf=_0x2a4148[_0x35d100(0xa3)],_0x45aacd=_0x2a4148[_0x35d100(0xe4)],_0x5becb8=_0x2a4148['site'],_0x2fbfe1=_0x2a4148['llmProject'];let _0x2d2635;const _0x2cac5a=findAgentConfigPath(process[_0x35d100(0x104)]());if(_0x5321b9){const _0x169a1a=a4_0x380073[_0x35d100(0x9b)](_0x5321b9,'tdx.json');existsSync(_0x169a1a)?(_0x2d2635=_0x5321b9,console[_0x35d100(0xde)](a4_0x43622b['dim']('Using\x20local\x20project:\x20'+_0x5321b9))):_0x2d2635=_0x5321b9;}else{if(_0x2cac5a)_0x2d2635=a4_0x380073[_0x35d100(0x10a)](_0x2cac5a),console['log'](a4_0x43622b[_0x35d100(0xf4)](_0x35d100(0x132)+_0x2d2635));else{if(_0x2fbfe1){const _0x25b60e=normalizeName(_0x2fbfe1),_0x4e1268=a4_0x380073[_0x35d100(0x9b)](process['cwd'](),'agents',_0x25b60e,_0x35d100(0xf8));if(existsSync(_0x4e1268))_0x2d2635=a4_0x380073[_0x35d100(0x10a)](_0x4e1268),console[_0x35d100(0xde)](a4_0x43622b[_0x35d100(0xf4)](_0x35d100(0xbf)+_0x2d2635));else{const _0x1df0d3=_0x2a4148[_0x35d100(0x115)];if(_0x1df0d3)throw new SDKError(ErrorCode[_0x35d100(0x12b)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x2fbfe1+_0x35d100(0xe6),undefined,{'helpText':_0x35d100(0x97)+_0x35d100(0x10c)+(_0x35d100(0xeb)+_0x2fbfe1+'\x0a')+(_0x35d100(0xe8)+_0x25b60e+'\x20--name\x20'+(_0x3e153e||_0x35d100(0xe9))+_0x35d100(0x110)+_0x1df0d3)});_0x2d2635=_0x2fbfe1,console['log'](a4_0x43622b[_0x35d100(0xf4)](_0x35d100(0xa9)+_0x2fbfe1));}}}}if(!_0x2d2635)return console[_0x35d100(0xde)](a4_0x43622b['yellow']('No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a')),console['log'](_0x35d100(0xc5)),console['log'](_0x35d100(0xf1)),console[_0x35d100(0xde)](_0x35d100(0xac)),console[_0x35d100(0xde)](_0x35d100(0xb4)),0x1;if(!_0x3e153e)throw new SDKError(ErrorCode[_0x35d100(0x129)],_0x35d100(0x108),undefined,{'helpText':_0x35d100(0x126)});if(!_0x45aacd&&!_0xd652bf){const _0x3dd5f7=await confirmKey('Clone\x20\x22'+_0x2d2635+_0x35d100(0x12f)+_0x3e153e+'\x22?');if(!_0x3dd5f7)return console[_0x35d100(0xde)](_0x35d100(0x10e)),0x0;}const {data:_0x56bfc6}=await withSpinner(_0x35d100(0x133)+_0x2d2635+_0x35d100(0x12c)+_0x3e153e+_0x35d100(0xe7),()=>_0x54c4fa[_0x35d100(0x124)][_0x35d100(0xc6)](_0x2d2635,_0x3e153e,{'dryRun':_0xd652bf}));if(_0xd652bf)return console[_0x35d100(0xde)](a4_0x43622b[_0x35d100(0x127)](_0x35d100(0x119))),console[_0x35d100(0xde)](_0x35d100(0xae)+_0x56bfc6['sourceProjectName']),console['log'](_0x35d100(0x10f)+_0x3e153e),console[_0x35d100(0xde)]('Would\x20clone:'),console[_0x35d100(0xde)](_0x35d100(0xd2)+_0x56bfc6[_0x35d100(0x9a)][_0x35d100(0xd3)][_0x35d100(0x11e)]),console['log'](_0x35d100(0x12d)+_0x56bfc6[_0x35d100(0x9a)]['knowledgeBases'][_0x35d100(0x11e)]),console[_0x35d100(0xde)]('\x20\x20Prompts:\x20'+_0x56bfc6['counts'][_0x35d100(0xb3)][_0x35d100(0x11e)]),0x0;const _0x4f8eb5=_0x56bfc6[_0x35d100(0x9a)][_0x35d100(0xd3)][_0x35d100(0xdf)]>0x0||_0x56bfc6[_0x35d100(0x9a)][_0x35d100(0xfb)][_0x35d100(0xdf)]>0x0||_0x56bfc6[_0x35d100(0x9a)][_0x35d100(0xb3)]['errors']>0x0;_0x4f8eb5?console['log'](a4_0x43622b['yellow'](_0x35d100(0x116))):console[_0x35d100(0xde)](a4_0x43622b[_0x35d100(0xba)]('Project\x20cloned\x20successfully'));console[_0x35d100(0xde)](_0x35d100(0xae)+_0x56bfc6[_0x35d100(0x121)]),console[_0x35d100(0xde)](_0x35d100(0x10f)+_0x56bfc6[_0x35d100(0x137)]),console[_0x35d100(0xde)](_0x35d100(0xd1)+_0x56bfc6[_0x35d100(0xbd)]),console[_0x35d100(0xde)](),console[_0x35d100(0xde)](_0x35d100(0xf3)),console[_0x35d100(0xde)]('\x20\x20Agents:\x20'+formatCountSummary(_0x56bfc6[_0x35d100(0x9a)]['agents'])),console[_0x35d100(0xde)](_0x35d100(0x12d)+formatCountSummary(_0x56bfc6[_0x35d100(0x9a)][_0x35d100(0xfb)])),console['log']('\x20\x20Prompts:\x20'+formatCountSummary(_0x56bfc6[_0x35d100(0x9a)][_0x35d100(0xb3)]));if(_0x4f8eb5){console['log'](),console[_0x35d100(0xde)](a4_0x43622b[_0x35d100(0x101)](_0x35d100(0xc2)));for(const _0x40728f of _0x56bfc6[_0x35d100(0xd3)]){_0x40728f[_0x35d100(0xd7)]===_0x35d100(0xc7)&&console['log'](a4_0x43622b[_0x35d100(0x101)](_0x35d100(0xcb)+_0x40728f['agentName']+_0x35d100(0xaa)+_0x40728f['error']));}for(const _0x4257ae of _0x56bfc6[_0x35d100(0xfb)]){_0x4257ae[_0x35d100(0xd7)]===_0x35d100(0xc7)&&console[_0x35d100(0xde)](a4_0x43622b[_0x35d100(0x101)](_0x35d100(0xc9)+_0x4257ae[_0x35d100(0xb7)]+_0x35d100(0xaa)+_0x4257ae[_0x35d100(0xc7)]));}for(const _0x569f8b of _0x56bfc6['prompts']){_0x569f8b[_0x35d100(0xd7)]==='error'&&console[_0x35d100(0xde)](a4_0x43622b['red'](_0x35d100(0xb9)+_0x569f8b[_0x35d100(0xb7)]+'\x22:\x20'+_0x569f8b[_0x35d100(0xc7)]));}return 0x1;}saveSessionContext({'llm_project':_0x56bfc6[_0x35d100(0x137)]},_0x2a4148[_0x35d100(0xff)]),console[_0x35d100(0xde)](),console[_0x35d100(0xde)](a4_0x43622b['green'](_0x35d100(0xcd)+a4_0x43622b[_0x35d100(0xf4)](_0x35d100(0xa5))+_0x35d100(0x12e)+a4_0x43622b[_0x35d100(0x118)](_0x56bfc6['newProjectName'])));const _0x2106df=getLLMProjectUrl(_0x5becb8,_0x56bfc6['newProjectId']);return console[_0x35d100(0xde)]('Project:\x20'+a4_0x43622b[_0x35d100(0x118)](_0x2106df)),0x0;}}function a4_0x36e4(){const _0x38b25c=['248yEtonS','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','\x20\x20Prompt\x20\x22','green','output','40338340CFhSHN','newProjectId','\x20|\x20','Using\x20local\x20project:\x20','\x20unchanged','\x27\x20to\x20create\x20the\x20folder\x20structure.','Errors:','description','\x20created','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','cloneProject','error','\x0aChanges\x20to\x20agent\x20\x27','\x20\x20Knowledge\x20Base\x20\x22','diff','\x20\x20Agent\x20\x22','\x0a✔\x20Pulled\x20','Context\x20set:\x20','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','llmProject','7232952kcmhiU','New\x20project\x20ID:\x20','\x20\x20Agents:\x20','agents','\x0a✔\x20Pushed\x20','Would\x20pull\x20agent:\x20','Dry\x20run\x20-\x20no\x20files\x20written','action','hasChanges','\x20\x20Prompts:\x20','outputDir','agentId','outputPath','Current\x20context\x20has\x20llm_project=\x22','log','errors','\x0aWrite\x20','Pulling\x20agent\x20\x22','\x0aPush\x20summary\x20for\x20\x27','agent:push','yes','Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)','\x22\x20to\x20a\x20different\x20profile','\x22...','\x20\x20tdx\x20agent\x20clone\x20agents/','<new-name>','Chat:\x20','\x20\x20tdx\x20agent\x20pull\x20','agent.yml','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','projectName','Using\x20project\x20from\x20','Analyzing\x20project\x20\x22','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','1794904fdPCRu','Summary:','dim','Analyzing\x20changes\x20to\x20push...','unchanged','execute','tdx.json','\x20files?','\x20changed','knowledgeBases','Run\x20\x27tdx\x20agent\x20pull\x20','Writing\x20files...','Agent\x20','session','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','red','agentName','updated','cwd','pullAgent','force','No\x20tdx.json\x20found\x20in\x20','New\x20project\x20name\x20is\x20required','\x20files\x20to\x20','dirname','Using\x20project:\x20','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','\x0aPull\x20summary\x20for\x20\x27','Clone\x20cancelled','New\x20project:\x20','\x20--profile\x20','pushProject','\x20\x20Source:\x20','pullProject','6789167GaoeMF','profile','Project\x20cloned\x20with\x20errors','\x20new','cyan','Dry\x20run\x20-\x20no\x20changes\x20made','projectId','\x0aProject\x20pushed\x20with\x20errors','7876oKOBit','\x20\x20Text\x20Knowledge\x20Bases:\x20','created','push','Would\x20push\x20agent:\x20','sourceProjectName','\x0aChanges\x20to\x20prompt\x20\x27','27nmAWZn','llm','repeat','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','yellow','9RCrfbj','MISSING_ARGUMENT','Project:\x20','INVALID_ARGUMENT','\x22\x20to\x20\x22','\x20\x20Knowledge\x20Bases:\x20','\x20=\x20','\x22\x20to\x20new\x20project\x20\x22','gray','965865LbJRTz','Using\x20current\x20project:\x20','Cloning\x20\x22','site','Agent\x20pulled\x20successfully','agent:clone','newProjectName','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','Agent:\x20','Failed\x20to\x20push\x20agent:\x20','counts','join','\x20total','parse','utf-8','✔\x20Context\x20set:\x20','textKnowledgeBases','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','dryRun','\x0aErrors\x20found:','llm_project','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','\x20updated','total','Using\x20context\x20project:\x20','\x22:\x20','Push\x20cancelled','\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)','Output:\x20','Source:\x20','new','pushAgent','1139316UZASob','\x20errors','prompts','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'];a4_0x36e4=function(){return _0x38b25c;};return a4_0x36e4();}export class AgentPushCommand extends BaseCommand{[a4_0xc83520(0xb7)]=a4_0xc83520(0xe3);[a4_0xc83520(0xc3)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a4_0xc83520(0xf7)](_0x287900){const _0x4a1cb5=a4_0xc83520,{options:_0x54e949,args:_0x597c2b,tdx:_0x4f7754}=_0x287900;let _0x1756f3=_0x597c2b[0x0]||process['cwd']();const _0x234b98=_0x54e949['dryRun'],_0x3b7409=_0x54e949[_0x4a1cb5(0x106)],_0x225000=_0x54e949['yes'],_0x54cc22=_0x54e949[_0x4a1cb5(0x134)],_0x2e464c=a4_0x380073['join'](_0x1756f3,_0x4a1cb5(0xec)),_0x189a27=existsSync(_0x2e464c);if(_0x189a27){const {data:_0xded38e}=await withSpinner('Pushing\x20agent\x20from\x20\x22'+_0x1756f3+_0x4a1cb5(0xe7),()=>_0x4f7754[_0x4a1cb5(0x124)][_0x4a1cb5(0xb0)](_0x1756f3,{'dryRun':_0x234b98,'force':_0x3b7409}));if(_0x234b98)return console[_0x4a1cb5(0xde)](a4_0x43622b['yellow'](_0x4a1cb5(0x119))),console[_0x4a1cb5(0xde)](_0x4a1cb5(0x120)+_0xded38e['agentName']),0x0;if(_0xded38e[_0x4a1cb5(0xd7)]===_0x4a1cb5(0xc7))return console['log'](a4_0x43622b[_0x4a1cb5(0x101)](_0x4a1cb5(0x99)+_0xded38e[_0x4a1cb5(0xc7)])),0x1;console['log'](a4_0x43622b['green'](_0x4a1cb5(0xfe)+_0xded38e[_0x4a1cb5(0xd7)]+'\x20successfully')),console[_0x4a1cb5(0xde)](_0x4a1cb5(0x98)+_0xded38e[_0x4a1cb5(0x102)]);if(_0xded38e[_0x4a1cb5(0xdb)]&&_0xded38e[_0x4a1cb5(0x11a)]){const _0x2fcf96=getLLMAgentChatUrl(_0x54cc22,_0xded38e[_0x4a1cb5(0x11a)],_0xded38e[_0x4a1cb5(0xdb)]);console[_0x4a1cb5(0xde)](_0x4a1cb5(0xea)+a4_0x43622b[_0x4a1cb5(0x118)](_0x2fcf96));}return 0x0;}let _0x14dca8=a4_0x380073['join'](_0x1756f3,'tdx.json');if(!existsSync(_0x14dca8)){const _0x468b2c=findAgentConfigPath(_0x1756f3);if(_0x468b2c)_0x1756f3=a4_0x380073[_0x4a1cb5(0x10a)](_0x468b2c),_0x14dca8=_0x468b2c,console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0xf4)](_0x4a1cb5(0x10b)+_0x1756f3));else{const _0x35fd38=_0x54e949[_0x4a1cb5(0xcf)];if(_0x35fd38){const _0x4c3ccc=normalizeName(_0x35fd38),_0x167e24=a4_0x380073[_0x4a1cb5(0x9b)](_0x1756f3,_0x4a1cb5(0xd3)),_0x352952=a4_0x380073[_0x4a1cb5(0x9b)](_0x167e24,_0x4c3ccc,_0x4a1cb5(0xf8));existsSync(_0x352952)&&(_0x1756f3=a4_0x380073[_0x4a1cb5(0x10a)](_0x352952),_0x14dca8=_0x352952,console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0xf4)](_0x4a1cb5(0x10b)+_0x1756f3)));}if(!existsSync(_0x14dca8)){let _0x37c6e5='Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.';_0x35fd38&&(_0x37c6e5=_0x4a1cb5(0xdd)+_0x35fd38+_0x4a1cb5(0xb6)+(_0x4a1cb5(0xfc)+_0x35fd38+_0x4a1cb5(0xc1)));throw new SDKError(ErrorCode[_0x4a1cb5(0x12b)],_0x4a1cb5(0x107)+_0x1756f3,undefined,{'helpText':_0x37c6e5});}}}const {data:_0x4a50fd}=await withSpinner(_0x4a1cb5(0xf5),()=>_0x4f7754['llm'][_0x4a1cb5(0x111)](_0x1756f3,{'dryRun':!![]})),_0x34fc47=_0x4a50fd[_0x4a1cb5(0x9a)][_0x4a1cb5(0xd3)][_0x4a1cb5(0xdf)]>0x0;if(_0x34fc47){console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0x101)](_0x4a1cb5(0xa4)));for(const _0x155b8a of _0x4a50fd[_0x4a1cb5(0xd3)]){_0x155b8a[_0x4a1cb5(0xd7)]===_0x4a1cb5(0xc7)&&console[_0x4a1cb5(0xde)](a4_0x43622b['red']('\x20\x20Agent\x20\x22'+_0x155b8a[_0x4a1cb5(0x102)]+_0x4a1cb5(0xaa)+_0x155b8a[_0x4a1cb5(0xc7)]));}return 0x1;}const _0x32df2c=_0x4a50fd[_0x4a1cb5(0x9a)]['agents']['created']+_0x4a50fd['counts'][_0x4a1cb5(0xfb)][_0x4a1cb5(0x11e)]+_0x4a50fd[_0x4a1cb5(0x9a)]['textKnowledgeBases'][_0x4a1cb5(0x11e)]+_0x4a50fd[_0x4a1cb5(0x9a)][_0x4a1cb5(0xb3)]['created'],_0x324d13=_0x4a50fd[_0x4a1cb5(0x9a)][_0x4a1cb5(0xd3)]['updated']+_0x4a50fd['counts']['knowledgeBases']['updated']+_0x4a50fd[_0x4a1cb5(0x9a)]['textKnowledgeBases']['updated']+_0x4a50fd[_0x4a1cb5(0x9a)][_0x4a1cb5(0xb3)][_0x4a1cb5(0x103)],_0x18696e=_0x4a50fd[_0x4a1cb5(0x9a)]['agents'][_0x4a1cb5(0xf6)]+_0x4a50fd['counts'][_0x4a1cb5(0xfb)]['unchanged']+_0x4a50fd[_0x4a1cb5(0x9a)]['textKnowledgeBases'][_0x4a1cb5(0xf6)]+_0x4a50fd['counts']['prompts'][_0x4a1cb5(0xf6)];console[_0x4a1cb5(0xde)](_0x4a1cb5(0xe2)+_0x4a50fd[_0x4a1cb5(0xee)]+'\x27:'),console[_0x4a1cb5(0xde)]('\x20\x20'+a4_0x43622b[_0x4a1cb5(0xba)]('+\x20'+_0x32df2c+_0x4a1cb5(0x117))+_0x4a1cb5(0xbe)+a4_0x43622b['yellow']('~\x20'+_0x324d13+_0x4a1cb5(0xfa))+'\x20|\x20'+a4_0x43622b['dim']('=\x20'+_0x18696e+'\x20unchanged')),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x4a50fd[_0x4a1cb5(0x9a)][_0x4a1cb5(0xd3)])),console['log'](_0x4a1cb5(0x12d)+formatCountSummary(_0x4a50fd['counts'][_0x4a1cb5(0xfb)])),console[_0x4a1cb5(0xde)](_0x4a1cb5(0x11d)+formatCountSummary(_0x4a50fd[_0x4a1cb5(0x9a)][_0x4a1cb5(0xa0)])),console['log'](_0x4a1cb5(0xd9)+formatCountSummary(_0x4a50fd[_0x4a1cb5(0x9a)][_0x4a1cb5(0xb3)])),console['log'](_0x4a1cb5(0x112)+a4_0x43622b['cyan'](_0x1756f3)),displayDiffs(_0x4a50fd[_0x4a1cb5(0xd3)],_0x4a50fd[_0x4a1cb5(0xfb)],_0x4a50fd[_0x4a1cb5(0xa0)],_0x4a50fd[_0x4a1cb5(0xb3)]);if(_0x234b98)return console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0x127)](_0x4a1cb5(0xa6))),0x0;if(_0x32df2c===0x0&&_0x324d13===0x0){console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0xba)](_0x4a1cb5(0xed)));const _0x2723ae=getLLMProjectUrl(_0x54cc22,_0x4a50fd[_0x4a1cb5(0x11a)]);return console[_0x4a1cb5(0xde)](_0x4a1cb5(0x12a)+a4_0x43622b[_0x4a1cb5(0x118)](_0x2723ae)),0x0;}if(!_0x225000&&!_0x3b7409){const _0x2e263c=await confirmKey('\x0aPush\x20'+(_0x32df2c+_0x324d13)+'\x20resources?');if(!_0x2e263c)return console[_0x4a1cb5(0xde)](_0x4a1cb5(0xab)),0x0;}const {data:_0x425bd5}=await withSpinner('Pushing\x20to\x20project...',()=>_0x4f7754[_0x4a1cb5(0x124)][_0x4a1cb5(0x111)](_0x1756f3,{'force':_0x3b7409})),_0x2fc29f=_0x425bd5[_0x4a1cb5(0x9a)][_0x4a1cb5(0xd3)][_0x4a1cb5(0xdf)]>0x0||_0x425bd5[_0x4a1cb5(0x9a)][_0x4a1cb5(0xfb)][_0x4a1cb5(0xdf)]>0x0||_0x425bd5[_0x4a1cb5(0x9a)]['textKnowledgeBases'][_0x4a1cb5(0xdf)]>0x0||_0x425bd5['counts'][_0x4a1cb5(0xb3)][_0x4a1cb5(0xdf)]>0x0;if(_0x2fc29f){console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0x127)](_0x4a1cb5(0x11b))),console[_0x4a1cb5(0xde)](),console['log'](a4_0x43622b['red']('Errors:'));for(const _0x557890 of _0x425bd5[_0x4a1cb5(0xd3)]){_0x557890['action']==='error'&&console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0x101)](_0x4a1cb5(0xcb)+_0x557890[_0x4a1cb5(0x102)]+_0x4a1cb5(0xaa)+_0x557890[_0x4a1cb5(0xc7)]));}for(const _0x3a61bf of _0x425bd5[_0x4a1cb5(0xfb)]){_0x3a61bf[_0x4a1cb5(0xd7)]===_0x4a1cb5(0xc7)&&console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0x101)](_0x4a1cb5(0xc9)+_0x3a61bf[_0x4a1cb5(0xb7)]+_0x4a1cb5(0xaa)+_0x3a61bf[_0x4a1cb5(0xc7)]));}for(const _0x40173e of _0x425bd5['textKnowledgeBases']){_0x40173e[_0x4a1cb5(0xd7)]==='error'&&console[_0x4a1cb5(0xde)](a4_0x43622b[_0x4a1cb5(0x101)]('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0x40173e[_0x4a1cb5(0xb7)]+'\x22:\x20'+_0x40173e[_0x4a1cb5(0xc7)]));}for(const _0x28979e of _0x425bd5[_0x4a1cb5(0xb3)]){_0x28979e[_0x4a1cb5(0xd7)]==='error'&&console[_0x4a1cb5(0xde)](a4_0x43622b['red']('\x20\x20Prompt\x20\x22'+_0x28979e[_0x4a1cb5(0xb7)]+_0x4a1cb5(0xaa)+_0x28979e['error']));}return 0x1;}console[_0x4a1cb5(0xde)](a4_0x43622b['green'](_0x4a1cb5(0xd4)+(_0x32df2c+_0x324d13)+'\x20resources\x20to\x20\x27'+_0x425bd5[_0x4a1cb5(0xee)]+'\x27'));const _0x98c6a8=getLLMProjectUrl(_0x54cc22,_0x425bd5[_0x4a1cb5(0x11a)]);return console[_0x4a1cb5(0xde)](_0x4a1cb5(0x12a)+a4_0x43622b[_0x4a1cb5(0x118)](_0x98c6a8)),0x0;}}
1
+ const a4_0x57260c=a4_0x4c2a;(function(_0x2b2083,_0x2ced7b){const _0x456aa9=a4_0x4c2a,_0x310a71=_0x2b2083();while(!![]){try{const _0x5e8350=-parseInt(_0x456aa9(0x10a))/0x1+-parseInt(_0x456aa9(0xbd))/0x2+-parseInt(_0x456aa9(0xa5))/0x3+-parseInt(_0x456aa9(0xf0))/0x4*(parseInt(_0x456aa9(0xe6))/0x5)+parseInt(_0x456aa9(0xa4))/0x6*(parseInt(_0x456aa9(0xd9))/0x7)+-parseInt(_0x456aa9(0x123))/0x8+parseInt(_0x456aa9(0xb4))/0x9*(parseInt(_0x456aa9(0x91))/0xa);if(_0x5e8350===_0x2ced7b)break;else _0x310a71['push'](_0x310a71['shift']());}catch(_0x5555d9){_0x310a71['push'](_0x310a71['shift']());}}}(a4_0x408f,0x3e909));import a4_0x149e72 from'chalk';import a4_0x3555b2 from'path';function a4_0x4c2a(_0x5d58de,_0xdb7d17){_0x5d58de=_0x5d58de-0x89;const _0x408f48=a4_0x408f();let _0x4c2aa3=_0x408f48[_0x5d58de];return _0x4c2aa3;}import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';function a4_0x408f(){const _0xc03945=['Agent\x20','new','Pushing\x20agent\x20from\x20\x22','diff','repeat','agent:push','536215fcYcix','force','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','INVALID_ARGUMENT','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','red','unchanged','newProjectId','outputDir','sourceProjectName','16KtZRoG','\x20errors','green','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','Analyzing\x20project\x20\x22','Project\x20cloned\x20successfully','\x20updated','output','\x20new','\x20\x20Agent\x20\x22','yellow','Would\x20push\x20agent:\x20','Output:\x20','textKnowledgeBases','\x20--profile\x20','log','Using\x20project:\x20','Using\x20local\x20project:\x20','gray','agent.yml','projectId','\x20unchanged','Using\x20context\x20project:\x20','projectName','Pull\x20cancelled','246048FbsZzv','Clone\x20cancelled','Analyzing\x20changes\x20to\x20push...','total','agents','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x20resources\x20to\x20\x27','session','Cannot\x20clone\x20from\x20context\x20project\x20\x22','\x20\x20Text\x20Knowledge\x20Bases:\x20','tdx.json','Dry\x20run\x20-\x20no\x20changes\x20made','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory','llm_project','\x22:\x20','Clone\x20\x22','join','Agent\x20pulled\x20successfully','\x0aPull\x20summary\x20for\x20\x27','Would\x20pull\x20agent:\x20','\x20=\x20','No\x20tdx.json\x20found\x20in\x20','Source:\x20','\x0aWrite\x20','Failed\x20to\x20push\x20agent:\x20','3780432XWZNnA','Chat:\x20','outputPath','\x22...','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','agentName','\x20\x20Prompts:\x20','push','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','183220yeCmaU','\x0aProject\x20pushed\x20with\x20errors','Summary:','\x0a✔\x20Pushed\x20','hasChanges','\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)','\x20files\x20to\x20','cwd','dim','name','llmProject','\x20\x20Prompt\x20\x22','errors','newProjectName','\x0aPush\x20summary\x20for\x20\x27','description','\x0aPush\x20','\x20\x20Knowledge\x20Bases:\x20','yes','42clecGf','743823oZAbwD','Push\x20cancelled','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\x20\x20tdx\x20agent\x20clone\x20agents/','✔\x20Context\x20set:\x20','New\x20project:\x20','dirname','error','Agent:\x20','prompts','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','created','counts','Current\x20context\x20has\x20llm_project=\x22','action','810nIjcEc','\x20\x20Source:\x20','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','MISSING_ARGUMENT','\x0aChanges\x20to\x20prompt\x20\x27','site','\x20successfully','\x20resources?','profile','1001266BaBnZa','\x22\x20to\x20\x22','knowledgeBases','agentId','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','New\x20project\x20ID:\x20','updated','\x20changed','Using\x20current\x20project:\x20','cyan','parse','\x0a✔\x20Pulled\x20','\x20|\x20','execute','Cloning\x20\x22','\x20\x20Knowledge\x20Base\x20\x22','llm','\x22\x20to\x20a\x20different\x20profile','\x20--name\x20','Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)','\x22\x20from\x20project\x20\x22','dryRun','pullAgent','pushProject','New\x20project\x20name\x20is\x20required','agent:clone','utf-8','Errors:','503433kGzxhU','\x20\x20Agents:\x20','Project:\x20','agent:pull','\x20\x20tdx\x20agent\x20pull\x20','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'];a4_0x408f=function(){return _0xc03945;};return a4_0x408f();}import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x62a419){const _0x358f43=a4_0x4c2a,_0x2a9bb1=[];if(_0x62a419[_0x358f43(0x10d)]!==undefined)_0x2a9bb1['push'](_0x62a419['total']+'\x20total');if(_0x62a419[_0x358f43(0xe1)]!==undefined&&_0x62a419[_0x358f43(0xe1)]>0x0)_0x2a9bb1[_0x358f43(0x8f)](a4_0x149e72[_0x358f43(0xf2)](_0x62a419['new']+_0x358f43(0xf9)));if(_0x62a419[_0x358f43(0xb0)]!==undefined&&_0x62a419['created']>0x0)_0x2a9bb1[_0x358f43(0x8f)](a4_0x149e72[_0x358f43(0xf2)](_0x62a419[_0x358f43(0xb0)]+'\x20created'));if(_0x62a419[_0x358f43(0xc3)]!==undefined&&_0x62a419[_0x358f43(0xc3)]>0x0)_0x2a9bb1['push'](a4_0x149e72['yellow'](_0x62a419[_0x358f43(0xc3)]+_0x358f43(0xf7)));if(_0x62a419[_0x358f43(0xec)]!==undefined&&_0x62a419[_0x358f43(0xec)]>0x0)_0x2a9bb1[_0x358f43(0x8f)](a4_0x149e72[_0x358f43(0x103)](_0x62a419[_0x358f43(0xec)]+_0x358f43(0x106)));if(_0x62a419[_0x358f43(0x9d)]!==undefined&&_0x62a419[_0x358f43(0x9d)]>0x0)_0x2a9bb1[_0x358f43(0x8f)](a4_0x149e72[_0x358f43(0xeb)](_0x62a419[_0x358f43(0x9d)]+_0x358f43(0xf1)));return _0x2a9bb1[_0x358f43(0x11a)](',\x20');}function displayDiffs(_0x5d588f,_0x423183,_0x17895b,_0x42da49){const _0x5fd785=a4_0x4c2a;for(const _0x2d6118 of _0x5d588f){if(_0x2d6118[_0x5fd785(0xe3)]){const _0x4f0c8d=_0x2d6118[_0x5fd785(0x8d)]||_0x2d6118['name'];console[_0x5fd785(0x100)]('\x0aChanges\x20to\x20agent\x20\x27'+_0x4f0c8d+'\x27:'),console[_0x5fd785(0x100)]('─'[_0x5fd785(0xe4)](0x3c)),console[_0x5fd785(0x100)](_0x2d6118[_0x5fd785(0xe3)]),console['log']('─'[_0x5fd785(0xe4)](0x3c));}}for(const _0xf5f2ec of _0x423183){_0xf5f2ec[_0x5fd785(0xe3)]&&(console['log'](_0x5fd785(0xde)+_0xf5f2ec[_0x5fd785(0x9a)]+'\x27:'),console['log']('─'[_0x5fd785(0xe4)](0x3c)),console[_0x5fd785(0x100)](_0xf5f2ec[_0x5fd785(0xe3)]),console[_0x5fd785(0x100)]('─'['repeat'](0x3c)));}for(const _0x25e04c of _0x17895b){_0x25e04c[_0x5fd785(0xe3)]&&(console[_0x5fd785(0x100)]('\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27'+_0x25e04c[_0x5fd785(0x9a)]+'\x27:'),console[_0x5fd785(0x100)]('─'[_0x5fd785(0xe4)](0x3c)),console[_0x5fd785(0x100)](_0x25e04c[_0x5fd785(0xe3)]),console[_0x5fd785(0x100)]('─'[_0x5fd785(0xe4)](0x3c)));}for(const _0x5b36a0 of _0x42da49){_0x5b36a0['diff']&&(console['log'](_0x5fd785(0xb8)+_0x5b36a0['name']+'\x27:'),console[_0x5fd785(0x100)]('─'[_0x5fd785(0xe4)](0x3c)),console[_0x5fd785(0x100)](_0x5b36a0[_0x5fd785(0xe3)]),console[_0x5fd785(0x100)]('─'[_0x5fd785(0xe4)](0x3c)));}}export class AgentPullCommand extends BaseCommand{['name']=a4_0x57260c(0xdc);[a4_0x57260c(0xa0)]=a4_0x57260c(0xe8);async[a4_0x57260c(0xca)](_0x45dca2){const _0xbeb21e=a4_0x57260c,{options:_0x5ea4cd,args:_0x50ad25,tdx:_0x3a94b2}=_0x45dca2,_0x5cdf15=_0x50ad25[0x0],_0x3ae56c=_0x50ad25[0x1],_0x6c92fc=_0x5ea4cd[_0xbeb21e(0xf8)],_0x2f4fc7=_0x5ea4cd['dryRun'],_0x54d614=_0x5ea4cd[_0xbeb21e(0xe7)],_0x1bb876=_0x5ea4cd['yes'],_0x18bab8=_0x5ea4cd[_0xbeb21e(0x9b)];let _0x4e756d,_0x27d2b0;const _0x63a8d4=findAgentConfigPath(process[_0xbeb21e(0x98)]());if(_0x5cdf15){const _0x2275fa=a4_0x3555b2['join'](_0x5cdf15,_0xbeb21e(0x114));if(existsSync(_0x2275fa))try{const _0x79d9df=JSON[_0xbeb21e(0xc7)](readFileSync(_0x2275fa,_0xbeb21e(0xd7)));_0x4e756d=_0x79d9df[_0xbeb21e(0x117)],_0x27d2b0=_0x5cdf15,console[_0xbeb21e(0x100)](a4_0x149e72[_0xbeb21e(0x99)]('Using\x20project\x20from\x20'+_0x2275fa+':\x20'+_0x4e756d));}catch{_0x4e756d=_0x5cdf15;}else _0x4e756d=_0x5cdf15;}else{if(_0x63a8d4)try{const _0x361c76=JSON['parse'](readFileSync(_0x63a8d4,_0xbeb21e(0xd7)));_0x4e756d=_0x361c76[_0xbeb21e(0x117)],_0x27d2b0=a4_0x3555b2[_0xbeb21e(0xab)](_0x63a8d4),console[_0xbeb21e(0x100)](a4_0x149e72[_0xbeb21e(0x99)]('Using\x20project:\x20'+_0x4e756d));}catch{_0x4e756d=_0x18bab8;}else _0x4e756d=_0x18bab8;}if(!_0x4e756d)return console[_0xbeb21e(0x100)](a4_0x149e72[_0xbeb21e(0xfb)](_0xbeb21e(0xaf))),console[_0xbeb21e(0x100)](_0xbeb21e(0xd0)),console[_0xbeb21e(0x100)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project'),console['log'](_0xbeb21e(0x116)),console[_0xbeb21e(0x100)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent'),0x1;if(_0x3ae56c){const {data:_0x5ee342}=await withSpinner('Pulling\x20agent\x20\x22'+_0x3ae56c+_0xbeb21e(0xd1)+_0x4e756d+_0xbeb21e(0x8b),()=>_0x3a94b2[_0xbeb21e(0xcd)][_0xbeb21e(0xd3)](_0x4e756d,_0x3ae56c,_0x6c92fc,{'dryRun':_0x2f4fc7,'force':_0x54d614}));if(_0x2f4fc7)return console[_0xbeb21e(0x100)](a4_0x149e72['yellow']('Dry\x20run\x20-\x20no\x20files\x20written')),console[_0xbeb21e(0x100)](_0xbeb21e(0x11d)+_0x5ee342[_0xbeb21e(0x8d)]),console['log']('Output\x20path:\x20'+_0x5ee342['outputPath']),_0x5ee342[_0xbeb21e(0xe3)]&&(console[_0xbeb21e(0x100)]('\x0aChanges:'),console['log']('─'[_0xbeb21e(0xe4)](0x3c)),console[_0xbeb21e(0x100)](_0x5ee342[_0xbeb21e(0xe3)]),console['log']('─'[_0xbeb21e(0xe4)](0x3c))),0x0;return console[_0xbeb21e(0x100)](a4_0x149e72[_0xbeb21e(0xf2)](_0xbeb21e(0x11b))),console[_0xbeb21e(0x100)](_0xbeb21e(0xad)+_0x5ee342[_0xbeb21e(0x8d)]),console[_0xbeb21e(0x100)](_0xbeb21e(0xfd)+_0x5ee342[_0xbeb21e(0x8a)]),console['log']('Status:\x20'+(_0x5ee342['isNew']?a4_0x149e72['green'](_0xbeb21e(0xe1)):_0x5ee342[_0xbeb21e(0x95)]?a4_0x149e72[_0xbeb21e(0xfb)]('updated'):a4_0x149e72['gray'](_0xbeb21e(0xec)))),0x0;}const _0x14f173=_0x27d2b0||_0x6c92fc,{data:_0x24e0da}=await withSpinner(_0xbeb21e(0xf5)+_0x4e756d+'\x22...',()=>_0x3a94b2['llm']['pullProject'](_0x4e756d,_0x14f173,{'dryRun':!![]})),_0xde7826=_0x24e0da[_0xbeb21e(0xb1)]['agents'][_0xbeb21e(0xe1)]+_0x24e0da[_0xbeb21e(0xb1)][_0xbeb21e(0xbf)][_0xbeb21e(0xe1)]+_0x24e0da[_0xbeb21e(0xb1)]['textKnowledgeBases'][_0xbeb21e(0xe1)]+_0x24e0da[_0xbeb21e(0xb1)]['prompts'][_0xbeb21e(0xe1)],_0x4abf=_0x24e0da[_0xbeb21e(0xb1)]['agents'][_0xbeb21e(0xc3)]+_0x24e0da['counts'][_0xbeb21e(0xbf)][_0xbeb21e(0xc3)]+_0x24e0da['counts'][_0xbeb21e(0xfe)][_0xbeb21e(0xc3)]+_0x24e0da[_0xbeb21e(0xb1)][_0xbeb21e(0xae)]['updated'],_0x42a54b=_0x24e0da[_0xbeb21e(0xb1)][_0xbeb21e(0x10e)][_0xbeb21e(0xec)]+_0x24e0da[_0xbeb21e(0xb1)]['knowledgeBases'][_0xbeb21e(0xec)]+_0x24e0da['counts'][_0xbeb21e(0xfe)][_0xbeb21e(0xec)]+_0x24e0da[_0xbeb21e(0xb1)][_0xbeb21e(0xae)][_0xbeb21e(0xec)];console[_0xbeb21e(0x100)](_0xbeb21e(0x11c)+_0x24e0da[_0xbeb21e(0x108)]+'\x27:'),console[_0xbeb21e(0x100)]('\x20\x20'+a4_0x149e72[_0xbeb21e(0xf2)]('+\x20'+_0xde7826+_0xbeb21e(0xf9))+_0xbeb21e(0xc9)+a4_0x149e72['yellow']('~\x20'+_0x4abf+_0xbeb21e(0xc4))+'\x20|\x20'+a4_0x149e72[_0xbeb21e(0x99)]('=\x20'+_0x42a54b+_0xbeb21e(0x106))),console[_0xbeb21e(0x100)](_0xbeb21e(0xda)+formatCountSummary(_0x24e0da[_0xbeb21e(0xb1)][_0xbeb21e(0x10e)])),console[_0xbeb21e(0x100)](_0xbeb21e(0xa2)+formatCountSummary(_0x24e0da[_0xbeb21e(0xb1)][_0xbeb21e(0xbf)])),console[_0xbeb21e(0x100)](_0xbeb21e(0x113)+formatCountSummary(_0x24e0da['counts'][_0xbeb21e(0xfe)])),console['log']('\x20\x20Prompts:\x20'+formatCountSummary(_0x24e0da[_0xbeb21e(0xb1)][_0xbeb21e(0xae)])),console[_0xbeb21e(0x100)]('\x20\x20Target:\x20'+a4_0x149e72[_0xbeb21e(0xc6)](_0x24e0da[_0xbeb21e(0xee)])),displayDiffs(_0x24e0da['agents'],_0x24e0da[_0xbeb21e(0xbf)],_0x24e0da[_0xbeb21e(0xfe)],_0x24e0da[_0xbeb21e(0xae)]);if(_0x2f4fc7)return console[_0xbeb21e(0x100)](a4_0x149e72['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0xde7826===0x0&&_0x4abf===0x0)return console['log'](a4_0x149e72[_0xbeb21e(0xf2)](_0xbeb21e(0xf4))),saveSessionContext({'llm_project':_0x24e0da[_0xbeb21e(0x108)]},_0x5ea4cd[_0xbeb21e(0x111)]),console['log'](a4_0x149e72[_0xbeb21e(0xf2)]('✔\x20Context\x20set:\x20'+a4_0x149e72[_0xbeb21e(0x99)](_0xbeb21e(0x117))+_0xbeb21e(0x11e)+a4_0x149e72[_0xbeb21e(0xc6)](_0x24e0da['projectName']))),0x0;if(!_0x1bb876&&!_0x54d614){const _0x3b411d=await confirmKey(_0xbeb21e(0x121)+(_0xde7826+_0x4abf)+'\x20files?');if(!_0x3b411d)return console['log'](_0xbeb21e(0x109)),0x0;}const {data:_0xb3bb8e}=await withSpinner('Writing\x20files...',()=>_0x3a94b2[_0xbeb21e(0xcd)]['pullProject'](_0x4e756d,_0x14f173,{'force':_0x54d614}));return console[_0xbeb21e(0x100)](a4_0x149e72[_0xbeb21e(0xf2)](_0xbeb21e(0xc8)+(_0xde7826+_0x4abf)+_0xbeb21e(0x97)+_0xb3bb8e[_0xbeb21e(0xee)])),saveSessionContext({'llm_project':_0xb3bb8e[_0xbeb21e(0x108)]},_0x5ea4cd[_0xbeb21e(0x111)]),console[_0xbeb21e(0x100)](a4_0x149e72['green'](_0xbeb21e(0xa9)+a4_0x149e72[_0xbeb21e(0x99)]('llm_project')+_0xbeb21e(0x11e)+a4_0x149e72[_0xbeb21e(0xc6)](_0xb3bb8e[_0xbeb21e(0x108)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0x57260c(0xd6);['description']=a4_0x57260c(0x90);async[a4_0x57260c(0xca)](_0x595bb7){const _0x625b35=a4_0x57260c,{options:_0x1d01a6,args:_0x4aa33b,tdx:_0x29c7b6}=_0x595bb7,_0x4c99fd=_0x4aa33b[0x0],_0x464044=_0x1d01a6[_0x625b35(0x9a)],_0x5f2d6b=_0x1d01a6[_0x625b35(0xd2)],_0x39c394=_0x1d01a6[_0x625b35(0xa3)],_0xdfc212=_0x1d01a6[_0x625b35(0xb9)],_0x6088ed=_0x1d01a6[_0x625b35(0x9b)];let _0x234845;const _0x15471f=findAgentConfigPath(process[_0x625b35(0x98)]());if(_0x4c99fd){const _0x1bc54f=a4_0x3555b2[_0x625b35(0x11a)](_0x4c99fd,_0x625b35(0x114));existsSync(_0x1bc54f)?(_0x234845=_0x4c99fd,console['log'](a4_0x149e72[_0x625b35(0x99)](_0x625b35(0x102)+_0x4c99fd))):_0x234845=_0x4c99fd;}else{if(_0x15471f)_0x234845=a4_0x3555b2[_0x625b35(0xab)](_0x15471f),console[_0x625b35(0x100)](a4_0x149e72['dim'](_0x625b35(0xc5)+_0x234845));else{if(_0x6088ed){const _0x584049=normalizeName(_0x6088ed),_0x2221ff=a4_0x3555b2[_0x625b35(0x11a)](process[_0x625b35(0x98)](),_0x625b35(0x10e),_0x584049,'tdx.json');if(existsSync(_0x2221ff))_0x234845=a4_0x3555b2['dirname'](_0x2221ff),console[_0x625b35(0x100)](a4_0x149e72[_0x625b35(0x99)](_0x625b35(0x102)+_0x234845));else{const _0x568035=_0x1d01a6[_0x625b35(0xbc)];if(_0x568035)throw new SDKError(ErrorCode[_0x625b35(0xe9)],_0x625b35(0x112)+_0x6088ed+_0x625b35(0xce),undefined,{'helpText':_0x625b35(0xf3)+_0x625b35(0xb6)+(_0x625b35(0xdd)+_0x6088ed+'\x0a')+(_0x625b35(0xa8)+_0x584049+_0x625b35(0xcf)+(_0x464044||'<new-name>')+_0x625b35(0xff)+_0x568035)});_0x234845=_0x6088ed,console[_0x625b35(0x100)](a4_0x149e72[_0x625b35(0x99)](_0x625b35(0x107)+_0x6088ed));}}}}if(!_0x234845)return console[_0x625b35(0x100)](a4_0x149e72[_0x625b35(0xfb)]('No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a')),console[_0x625b35(0x100)](_0x625b35(0xc1)),console['log'](_0x625b35(0x10f)),console[_0x625b35(0x100)](_0x625b35(0x96)),console[_0x625b35(0x100)]('\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'),0x1;if(!_0x464044)throw new SDKError(ErrorCode[_0x625b35(0xb7)],_0x625b35(0xd5),undefined,{'helpText':_0x625b35(0xa7)});if(!_0x39c394&&!_0x5f2d6b){const _0x1afdae=await confirmKey(_0x625b35(0x119)+_0x234845+'\x22\x20to\x20new\x20project\x20\x22'+_0x464044+'\x22?');if(!_0x1afdae)return console[_0x625b35(0x100)](_0x625b35(0x10b)),0x0;}const {data:_0x130027}=await withSpinner(_0x625b35(0xcb)+_0x234845+_0x625b35(0xbe)+_0x464044+'\x22...',()=>_0x29c7b6[_0x625b35(0xcd)]['cloneProject'](_0x234845,_0x464044,{'dryRun':_0x5f2d6b}));if(_0x5f2d6b)return console[_0x625b35(0x100)](a4_0x149e72[_0x625b35(0xfb)](_0x625b35(0x115))),console[_0x625b35(0x100)]('Source:\x20'+_0x130027['sourceProjectName']),console['log'](_0x625b35(0xaa)+_0x464044),console[_0x625b35(0x100)]('Would\x20clone:'),console[_0x625b35(0x100)](_0x625b35(0xda)+_0x130027[_0x625b35(0xb1)][_0x625b35(0x10e)][_0x625b35(0xb0)]),console[_0x625b35(0x100)](_0x625b35(0xa2)+_0x130027[_0x625b35(0xb1)][_0x625b35(0xbf)]['created']),console['log'](_0x625b35(0x8e)+_0x130027[_0x625b35(0xb1)][_0x625b35(0xae)][_0x625b35(0xb0)]),0x0;const _0x11e8ac=_0x130027[_0x625b35(0xb1)]['agents'][_0x625b35(0x9d)]>0x0||_0x130027[_0x625b35(0xb1)][_0x625b35(0xbf)][_0x625b35(0x9d)]>0x0||_0x130027[_0x625b35(0xb1)]['prompts'][_0x625b35(0x9d)]>0x0;_0x11e8ac?console['log'](a4_0x149e72[_0x625b35(0xfb)]('Project\x20cloned\x20with\x20errors')):console[_0x625b35(0x100)](a4_0x149e72['green'](_0x625b35(0xf6)));console[_0x625b35(0x100)](_0x625b35(0x120)+_0x130027[_0x625b35(0xef)]),console[_0x625b35(0x100)]('New\x20project:\x20'+_0x130027[_0x625b35(0x9e)]),console[_0x625b35(0x100)](_0x625b35(0xc2)+_0x130027[_0x625b35(0xed)]),console['log'](),console[_0x625b35(0x100)](_0x625b35(0x93)),console[_0x625b35(0x100)](_0x625b35(0xda)+formatCountSummary(_0x130027[_0x625b35(0xb1)][_0x625b35(0x10e)])),console[_0x625b35(0x100)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x130027['counts']['knowledgeBases'])),console[_0x625b35(0x100)](_0x625b35(0x8e)+formatCountSummary(_0x130027['counts'][_0x625b35(0xae)]));if(_0x11e8ac){console['log'](),console[_0x625b35(0x100)](a4_0x149e72[_0x625b35(0xeb)]('Errors:'));for(const _0x58dfbf of _0x130027[_0x625b35(0x10e)]){_0x58dfbf[_0x625b35(0xb3)]==='error'&&console[_0x625b35(0x100)](a4_0x149e72[_0x625b35(0xeb)]('\x20\x20Agent\x20\x22'+_0x58dfbf[_0x625b35(0x8d)]+_0x625b35(0x118)+_0x58dfbf['error']));}for(const _0x127175 of _0x130027['knowledgeBases']){_0x127175[_0x625b35(0xb3)]===_0x625b35(0xac)&&console[_0x625b35(0x100)](a4_0x149e72[_0x625b35(0xeb)](_0x625b35(0xcc)+_0x127175[_0x625b35(0x9a)]+_0x625b35(0x118)+_0x127175[_0x625b35(0xac)]));}for(const _0x488fbf of _0x130027[_0x625b35(0xae)]){_0x488fbf[_0x625b35(0xb3)]===_0x625b35(0xac)&&console[_0x625b35(0x100)](a4_0x149e72['red'](_0x625b35(0x9c)+_0x488fbf['name']+_0x625b35(0x118)+_0x488fbf[_0x625b35(0xac)]));}return 0x1;}saveSessionContext({'llm_project':_0x130027[_0x625b35(0x9e)]},_0x1d01a6['session']),console[_0x625b35(0x100)](),console[_0x625b35(0x100)](a4_0x149e72[_0x625b35(0xf2)]('Context\x20set:\x20'+a4_0x149e72[_0x625b35(0x99)]('llm_project')+_0x625b35(0x11e)+a4_0x149e72[_0x625b35(0xc6)](_0x130027[_0x625b35(0x9e)])));const _0x37595e=getLLMProjectUrl(_0xdfc212,_0x130027['newProjectId']);return console['log']('Project:\x20'+a4_0x149e72['cyan'](_0x37595e)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x57260c(0x9a)]=a4_0x57260c(0xe5);['description']='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a4_0x57260c(0xca)](_0x5f5372){const _0x5ce04d=a4_0x57260c,{options:_0x4a7877,args:_0x3b5998,tdx:_0x3ae354}=_0x5f5372;let _0x2b4be2=_0x3b5998[0x0]||process[_0x5ce04d(0x98)]();const _0x3f1e3d=_0x4a7877[_0x5ce04d(0xd2)],_0x582238=_0x4a7877[_0x5ce04d(0xe7)],_0x5d2af7=_0x4a7877[_0x5ce04d(0xa3)],_0x1c8484=_0x4a7877[_0x5ce04d(0xb9)],_0x5dfc9a=a4_0x3555b2[_0x5ce04d(0x11a)](_0x2b4be2,_0x5ce04d(0x104)),_0x197652=existsSync(_0x5dfc9a);if(_0x197652){const {data:_0x2d25a0}=await withSpinner(_0x5ce04d(0xe2)+_0x2b4be2+_0x5ce04d(0x8b),()=>_0x3ae354[_0x5ce04d(0xcd)]['pushAgent'](_0x2b4be2,{'dryRun':_0x3f1e3d,'force':_0x582238}));if(_0x3f1e3d)return console[_0x5ce04d(0x100)](a4_0x149e72[_0x5ce04d(0xfb)](_0x5ce04d(0x115))),console['log'](_0x5ce04d(0xfc)+_0x2d25a0[_0x5ce04d(0x8d)]),0x0;if(_0x2d25a0[_0x5ce04d(0xb3)]===_0x5ce04d(0xac))return console['log'](a4_0x149e72['red'](_0x5ce04d(0x122)+_0x2d25a0[_0x5ce04d(0xac)])),0x1;console[_0x5ce04d(0x100)](a4_0x149e72[_0x5ce04d(0xf2)](_0x5ce04d(0xe0)+_0x2d25a0[_0x5ce04d(0xb3)]+_0x5ce04d(0xba))),console[_0x5ce04d(0x100)](_0x5ce04d(0xad)+_0x2d25a0[_0x5ce04d(0x8d)]);if(_0x2d25a0['agentId']&&_0x2d25a0[_0x5ce04d(0x105)]){const _0x234b12=getLLMAgentChatUrl(_0x1c8484,_0x2d25a0[_0x5ce04d(0x105)],_0x2d25a0[_0x5ce04d(0xc0)]);console['log'](_0x5ce04d(0x89)+a4_0x149e72[_0x5ce04d(0xc6)](_0x234b12));}return 0x0;}let _0x4f9142=a4_0x3555b2[_0x5ce04d(0x11a)](_0x2b4be2,_0x5ce04d(0x114));if(!existsSync(_0x4f9142)){const _0x1ab17d=findAgentConfigPath(_0x2b4be2);if(_0x1ab17d)_0x2b4be2=a4_0x3555b2[_0x5ce04d(0xab)](_0x1ab17d),_0x4f9142=_0x1ab17d,console['log'](a4_0x149e72[_0x5ce04d(0x99)](_0x5ce04d(0x101)+_0x2b4be2));else{const _0x3c42c0=_0x4a7877[_0x5ce04d(0x9b)];if(_0x3c42c0){const _0x3eb388=normalizeName(_0x3c42c0),_0x2a3c88=a4_0x3555b2['join'](_0x2b4be2,_0x5ce04d(0x10e)),_0x621f28=a4_0x3555b2[_0x5ce04d(0x11a)](_0x2a3c88,_0x3eb388,_0x5ce04d(0x114));existsSync(_0x621f28)&&(_0x2b4be2=a4_0x3555b2[_0x5ce04d(0xab)](_0x621f28),_0x4f9142=_0x621f28,console['log'](a4_0x149e72[_0x5ce04d(0x99)](_0x5ce04d(0x101)+_0x2b4be2)));}if(!existsSync(_0x4f9142)){let _0x3e1284=_0x5ce04d(0x8c);_0x3c42c0&&(_0x3e1284=_0x5ce04d(0xb2)+_0x3c42c0+'\x22\x20but\x20no\x20local\x20folder\x20found.\x0a'+('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x3c42c0+'\x27\x20to\x20create\x20the\x20folder\x20structure.'));throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5ce04d(0x11f)+_0x2b4be2,undefined,{'helpText':_0x3e1284});}}}const {data:_0x2cec8e}=await withSpinner(_0x5ce04d(0x10c),()=>_0x3ae354[_0x5ce04d(0xcd)][_0x5ce04d(0xd4)](_0x2b4be2,{'dryRun':!![]})),_0x2b6c59=_0x2cec8e['counts'][_0x5ce04d(0x10e)][_0x5ce04d(0x9d)]>0x0;if(_0x2b6c59){console['log'](a4_0x149e72[_0x5ce04d(0xeb)]('\x0aErrors\x20found:'));for(const _0x27dfe7 of _0x2cec8e[_0x5ce04d(0x10e)]){_0x27dfe7[_0x5ce04d(0xb3)]==='error'&&console[_0x5ce04d(0x100)](a4_0x149e72['red'](_0x5ce04d(0xfa)+_0x27dfe7['agentName']+'\x22:\x20'+_0x27dfe7[_0x5ce04d(0xac)]));}return 0x1;}const _0x5dd1d5=_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0x10e)][_0x5ce04d(0xb0)]+_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0xbf)][_0x5ce04d(0xb0)]+_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0xfe)][_0x5ce04d(0xb0)]+_0x2cec8e[_0x5ce04d(0xb1)]['prompts'][_0x5ce04d(0xb0)],_0x5ec6a6=_0x2cec8e['counts'][_0x5ce04d(0x10e)]['updated']+_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0xbf)]['updated']+_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0xfe)]['updated']+_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0xae)][_0x5ce04d(0xc3)],_0x4d8a10=_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0x10e)][_0x5ce04d(0xec)]+_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0xbf)][_0x5ce04d(0xec)]+_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0xfe)][_0x5ce04d(0xec)]+_0x2cec8e['counts'][_0x5ce04d(0xae)][_0x5ce04d(0xec)];console[_0x5ce04d(0x100)](_0x5ce04d(0x9f)+_0x2cec8e[_0x5ce04d(0x108)]+'\x27:'),console['log']('\x20\x20'+a4_0x149e72[_0x5ce04d(0xf2)]('+\x20'+_0x5dd1d5+_0x5ce04d(0xf9))+_0x5ce04d(0xc9)+a4_0x149e72[_0x5ce04d(0xfb)]('~\x20'+_0x5ec6a6+_0x5ce04d(0xc4))+_0x5ce04d(0xc9)+a4_0x149e72['dim']('=\x20'+_0x4d8a10+_0x5ce04d(0x106))),console[_0x5ce04d(0x100)](_0x5ce04d(0xda)+formatCountSummary(_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0x10e)])),console[_0x5ce04d(0x100)](_0x5ce04d(0xa2)+formatCountSummary(_0x2cec8e['counts'][_0x5ce04d(0xbf)])),console['log']('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x2cec8e[_0x5ce04d(0xb1)][_0x5ce04d(0xfe)])),console['log'](_0x5ce04d(0x8e)+formatCountSummary(_0x2cec8e[_0x5ce04d(0xb1)]['prompts'])),console[_0x5ce04d(0x100)](_0x5ce04d(0xb5)+a4_0x149e72['cyan'](_0x2b4be2)),displayDiffs(_0x2cec8e['agents'],_0x2cec8e[_0x5ce04d(0xbf)],_0x2cec8e[_0x5ce04d(0xfe)],_0x2cec8e[_0x5ce04d(0xae)]);if(_0x3f1e3d)return console['log'](a4_0x149e72['yellow'](_0x5ce04d(0xea))),0x0;if(_0x5dd1d5===0x0&&_0x5ec6a6===0x0){console['log'](a4_0x149e72[_0x5ce04d(0xf2)](_0x5ce04d(0xdf)));const _0xa5de05=getLLMProjectUrl(_0x1c8484,_0x2cec8e[_0x5ce04d(0x105)]);return console[_0x5ce04d(0x100)](_0x5ce04d(0xdb)+a4_0x149e72[_0x5ce04d(0xc6)](_0xa5de05)),0x0;}if(!_0x5d2af7&&!_0x582238){const _0x217790=await confirmKey(_0x5ce04d(0xa1)+(_0x5dd1d5+_0x5ec6a6)+_0x5ce04d(0xbb));if(!_0x217790)return console[_0x5ce04d(0x100)](_0x5ce04d(0xa6)),0x0;}const {data:_0x145378}=await withSpinner('Pushing\x20to\x20project...',()=>_0x3ae354[_0x5ce04d(0xcd)][_0x5ce04d(0xd4)](_0x2b4be2,{'force':_0x582238})),_0x4e05b1=_0x145378[_0x5ce04d(0xb1)][_0x5ce04d(0x10e)]['errors']>0x0||_0x145378[_0x5ce04d(0xb1)]['knowledgeBases']['errors']>0x0||_0x145378[_0x5ce04d(0xb1)][_0x5ce04d(0xfe)][_0x5ce04d(0x9d)]>0x0||_0x145378['counts']['prompts'][_0x5ce04d(0x9d)]>0x0;if(_0x4e05b1){console['log'](a4_0x149e72[_0x5ce04d(0xfb)](_0x5ce04d(0x92))),console[_0x5ce04d(0x100)](),console[_0x5ce04d(0x100)](a4_0x149e72[_0x5ce04d(0xeb)](_0x5ce04d(0xd8)));for(const _0x50940f of _0x145378[_0x5ce04d(0x10e)]){_0x50940f[_0x5ce04d(0xb3)]===_0x5ce04d(0xac)&&console[_0x5ce04d(0x100)](a4_0x149e72['red'](_0x5ce04d(0xfa)+_0x50940f['agentName']+_0x5ce04d(0x118)+_0x50940f[_0x5ce04d(0xac)]));}for(const _0x3f3826 of _0x145378[_0x5ce04d(0xbf)]){_0x3f3826[_0x5ce04d(0xb3)]===_0x5ce04d(0xac)&&console['log'](a4_0x149e72[_0x5ce04d(0xeb)](_0x5ce04d(0xcc)+_0x3f3826[_0x5ce04d(0x9a)]+_0x5ce04d(0x118)+_0x3f3826['error']));}for(const _0xbff7f9 of _0x145378[_0x5ce04d(0xfe)]){_0xbff7f9[_0x5ce04d(0xb3)]===_0x5ce04d(0xac)&&console[_0x5ce04d(0x100)](a4_0x149e72[_0x5ce04d(0xeb)]('\x20\x20Text\x20Knowledge\x20Base\x20\x22'+_0xbff7f9['name']+_0x5ce04d(0x118)+_0xbff7f9[_0x5ce04d(0xac)]));}for(const _0x10c0a9 of _0x145378[_0x5ce04d(0xae)]){_0x10c0a9['action']==='error'&&console[_0x5ce04d(0x100)](a4_0x149e72[_0x5ce04d(0xeb)](_0x5ce04d(0x9c)+_0x10c0a9[_0x5ce04d(0x9a)]+_0x5ce04d(0x118)+_0x10c0a9[_0x5ce04d(0xac)]));}return 0x1;}console[_0x5ce04d(0x100)](a4_0x149e72[_0x5ce04d(0xf2)](_0x5ce04d(0x94)+(_0x5dd1d5+_0x5ec6a6)+_0x5ce04d(0x110)+_0x145378[_0x5ce04d(0x108)]+'\x27'));const _0x2b92c9=getLLMProjectUrl(_0x1c8484,_0x145378['projectId']);return console[_0x5ce04d(0x100)](_0x5ce04d(0xdb)+a4_0x149e72['cyan'](_0x2b92c9)),0x0;}}
@@ -1 +1 @@
1
- const a5_0x4e462f=a5_0x2f07;function a5_0xb323(){const _0x1e38b5=['\x0aStack\x20trace:\x0a','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','cdp','description','header','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','86495CfvlwW','2032434GhSKRX','message','proxy-authorization','x-trino-user','verbose','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','validate','output','type','stack','.\x20Valid\x20types:\x20','POST','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','length','api','232TQpREO','\x22.\x20','1alTHrG','Endpoint\x20must\x20start\x20with\x20/:\x20','readBodyFromFile','.\x20Valid\x20methods:\x20','6781616GXYzwe','indexOf','log','<\x20HTTP/1.1\x20','toLowerCase','1695414CBYtdS','5052322vpxqwm','GET','x-xsrf-token','PATCH','file','color','body','workflow','entries','set-cookie','trim','error','Invalid\x20API\x20type:\x20','name','7XbUxZh','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','30ONjwKG','includes','site','join','method','status','DELETE','12bXWtiK','Error:\x20','PUT','toUpperCase','headers','cookie','488782GSAQHS','data','298017jnXgNC'];a5_0xb323=function(){return _0x1e38b5;};return a5_0xb323();}(function(_0x17eeb0,_0x1b03c0){const _0x4c06e2=a5_0x2f07,_0x4ed63c=_0x17eeb0();while(!![]){try{const _0x172282=-parseInt(_0x4c06e2(0x192))/0x1*(-parseInt(_0x4c06e2(0x177))/0x2)+-parseInt(_0x4c06e2(0x181))/0x3+-parseInt(_0x4c06e2(0x190))/0x4*(-parseInt(_0x4c06e2(0x180))/0x5)+parseInt(_0x4c06e2(0x19b))/0x6+parseInt(_0x4c06e2(0x168))/0x7*(-parseInt(_0x4c06e2(0x196))/0x8)+parseInt(_0x4c06e2(0x179))/0x9*(parseInt(_0x4c06e2(0x16a))/0xa)+-parseInt(_0x4c06e2(0x19c))/0xb*(-parseInt(_0x4c06e2(0x171))/0xc);if(_0x172282===_0x1b03c0)break;else _0x4ed63c['push'](_0x4ed63c['shift']());}catch(_0x4d36a3){_0x4ed63c['push'](_0x4ed63c['shift']());}}}(a5_0xb323,0x89a33));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set(['authorization',a5_0x4e462f(0x183),a5_0x4e462f(0x176),a5_0x4e462f(0x1a5),'set-cookie2',a5_0x4e462f(0x19e),'x-auth-token',a5_0x4e462f(0x184)]);function isSensitiveHeader(_0x387b06){const _0x34f8aa=a5_0x4e462f;return SENSITIVE_HEADERS['has'](_0x387b06[_0x34f8aa(0x19a)]());}function parseHeader(_0x5905e6){const _0x90ba37=a5_0x4e462f,_0x30c33d=_0x5905e6[_0x90ba37(0x197)](':');if(_0x30c33d===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0x5905e6+_0x90ba37(0x191)+_0x90ba37(0x186));const _0x205cdb=_0x5905e6['substring'](0x0,_0x30c33d)[_0x90ba37(0x1a6)](),_0x1558aa=_0x5905e6['substring'](_0x30c33d+0x1)['trim']();if(!_0x205cdb)throw new Error(_0x90ba37(0x18d)+_0x5905e6+'\x22');return[_0x205cdb,_0x1558aa];}function a5_0x2f07(_0x33a381,_0x118be1){_0x33a381=_0x33a381-0x168;const _0xb32338=a5_0xb323();let _0x2f0756=_0xb32338[_0x33a381];return _0x2f0756;}export class ApiCommand extends BaseCommand{[a5_0x4e462f(0x1a9)]=a5_0x4e462f(0x18f);[a5_0x4e462f(0x17d)]=a5_0x4e462f(0x17b);[a5_0x4e462f(0x187)](_0x14d4a8){const _0x2bfd54=a5_0x4e462f,{args:_0x2a056d,options:_0x3c2182}=_0x14d4a8,_0x2accec=_0x3c2182;if(_0x2a056d[_0x2bfd54(0x18e)]===0x0)return _0x2bfd54(0x17f);const _0x1ffa81=_0x2a056d[0x0];if(!_0x1ffa81['startsWith']('/'))return _0x2bfd54(0x193)+_0x1ffa81;const _0x10ad74=_0x2accec[_0x2bfd54(0x178)],_0xa1c9ba=_0x2accec[_0x2bfd54(0x1a0)];if(_0x10ad74&&_0xa1c9ba)return _0x2bfd54(0x169);const _0x2dd04c=_0x2accec[_0x2bfd54(0x16e)]||_0x2bfd54(0x19d),_0x53653f=[_0x2bfd54(0x19d),_0x2bfd54(0x18c),_0x2bfd54(0x173),_0x2bfd54(0x170),_0x2bfd54(0x19f)];if(!_0x53653f[_0x2bfd54(0x16b)](_0x2dd04c[_0x2bfd54(0x174)]()))return'Invalid\x20HTTP\x20method:\x20'+_0x2dd04c+_0x2bfd54(0x195)+_0x53653f[_0x2bfd54(0x16d)](',\x20');const _0x7e9413=_0x2accec['type']||'td',_0x5def93=['td',_0x2bfd54(0x17c),_0x2bfd54(0x1a3),'trino','llm'];if(!_0x5def93[_0x2bfd54(0x16b)](_0x7e9413))return _0x2bfd54(0x1a8)+_0x7e9413+_0x2bfd54(0x18b)+_0x5def93[_0x2bfd54(0x16d)](',\x20');return undefined;}async['execute'](_0x4d78f7){const _0x21ec27=a5_0x4e462f,{options:_0x131ac5,args:_0x2afa6c,tdx:_0x5071e8}=_0x4d78f7,_0x4ca898=_0x131ac5,_0x394cad=_0x2afa6c[0x0],_0x164e4e=(_0x4ca898[_0x21ec27(0x16e)]||_0x21ec27(0x19d))[_0x21ec27(0x174)](),_0x4eee67=_0x4ca898[_0x21ec27(0x178)],_0x5b18fd=_0x4ca898[_0x21ec27(0x1a0)],_0x10a431=_0x4ca898[_0x21ec27(0x17e)],_0x5aaa4b=_0x4ca898[_0x21ec27(0x189)]||'td';try{const _0x40672c={};if(_0x10a431){const _0x416e2a=Array['isArray'](_0x10a431)?_0x10a431:[_0x10a431];for(const _0x3605a9 of _0x416e2a){const [_0x3855bf,_0x8222d9]=parseHeader(_0x3605a9);_0x40672c[_0x3855bf]=_0x8222d9;}}let _0x2bee32;if(_0x4eee67)_0x2bee32=_0x4eee67;else{if(_0x5b18fd)try{_0x2bee32=RawAPI[_0x21ec27(0x194)](_0x5b18fd);}catch(_0x45afb7){return console[_0x21ec27(0x1a7)](_0x21ec27(0x172)+(_0x45afb7 instanceof Error?_0x45afb7[_0x21ec27(0x182)]:String(_0x45afb7))),0x1;}}const _0x553540={'method':_0x164e4e,'apiType':_0x5aaa4b,'includeHeaders':_0x131ac5[_0x21ec27(0x185)]};_0x2bee32&&(_0x553540[_0x21ec27(0x1a2)]=_0x2bee32);Object['keys'](_0x40672c)[_0x21ec27(0x18e)]>0x0&&(_0x553540['headers']=_0x40672c);if(_0x131ac5[_0x21ec27(0x185)]){const _0x5ca7c5=resolveSite(_0x131ac5[_0x21ec27(0x16c)]),_0x1f86c9=getEndpoint(_0x5ca7c5,_0x5aaa4b),_0x3e8474=''+_0x1f86c9+_0x394cad;console[_0x21ec27(0x1a7)]('>\x20'+_0x164e4e+'\x20'+_0x3e8474);const _0x5428ac=getAuthHeaders(_0x5ca7c5),_0x5eae70={..._0x5428ac,..._0x40672c};for(const [_0x2ee818,_0x20b492]of Object['entries'](_0x5eae70)){!isSensitiveHeader(_0x2ee818)&&console['error']('>\x20'+_0x2ee818+':\x20'+_0x20b492);}_0x2bee32&&console[_0x21ec27(0x1a7)]('>'),console[_0x21ec27(0x1a7)]('');}const _0x38011f=await _0x5071e8[_0x21ec27(0x18f)]['request'](_0x394cad,_0x553540);if(_0x131ac5[_0x21ec27(0x185)]&&_0x38011f[_0x21ec27(0x175)]){console['error'](_0x21ec27(0x199)+_0x38011f[_0x21ec27(0x16f)]);for(const [_0x138c28,_0x561ec1]of Object[_0x21ec27(0x1a4)](_0x38011f[_0x21ec27(0x175)])){!isSensitiveHeader(_0x138c28)&&console[_0x21ec27(0x1a7)]('<\x20'+_0x138c28+':\x20'+_0x561ec1);}console[_0x21ec27(0x1a7)]('');}const _0x4f93d6=Boolean(_0x131ac5[_0x21ec27(0x188)]),_0x3e3e68={'color':_0x131ac5[_0x21ec27(0x1a1)],'noColor':_0x131ac5['noColor']||_0x4f93d6&&!_0x131ac5[_0x21ec27(0x1a1)]},_0x4bfeda=colorizeJSON(_0x38011f[_0x21ec27(0x178)],_0x3e3e68);return _0x131ac5['output']?(writeFileSync(_0x131ac5['output'],_0x4bfeda),console[_0x21ec27(0x1a7)]('Results\x20saved\x20to\x20'+_0x131ac5[_0x21ec27(0x188)])):console[_0x21ec27(0x198)](_0x4bfeda),0x0;}catch(_0x2575dc){return _0x2575dc instanceof Error?(console['error']('Error:\x20'+_0x2575dc['message']),_0x131ac5[_0x21ec27(0x185)]&&_0x2575dc[_0x21ec27(0x18a)]&&console[_0x21ec27(0x1a7)](_0x21ec27(0x17a)+_0x2575dc[_0x21ec27(0x18a)])):console[_0x21ec27(0x1a7)](_0x21ec27(0x172)+String(_0x2575dc)),0x1;}}}
1
+ const a5_0x49c83c=a5_0x2338;(function(_0x934fd4,_0x14847e){const _0x63e13e=a5_0x2338,_0x26272d=_0x934fd4();while(!![]){try{const _0x3f0875=-parseInt(_0x63e13e(0x156))/0x1+-parseInt(_0x63e13e(0x191))/0x2+parseInt(_0x63e13e(0x155))/0x3+-parseInt(_0x63e13e(0x17d))/0x4*(-parseInt(_0x63e13e(0x18d))/0x5)+parseInt(_0x63e13e(0x172))/0x6*(parseInt(_0x63e13e(0x16e))/0x7)+parseInt(_0x63e13e(0x16a))/0x8+-parseInt(_0x63e13e(0x192))/0x9;if(_0x3f0875===_0x14847e)break;else _0x26272d['push'](_0x26272d['shift']());}catch(_0x445046){_0x26272d['push'](_0x26272d['shift']());}}}(a5_0x32ad,0x9c2b9));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';function a5_0x32ad(){const _0x12b5bd=['3428QJrInR','isArray','cdp','substring','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','\x0aStack\x20trace:\x0a','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','message','verbose','Error:\x20','stack','request','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','output','.\x20Valid\x20types:\x20','header','3795ITygsd','startsWith','keys','trim','927554ITyKak','119169VHmiIs','has','name','log','cookie','type','set-cookie','site','api','2000136ZjfyKQ','866121hYvJjs','authorization','toUpperCase','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','Invalid\x20HTTP\x20method:\x20','indexOf','error','includes','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','POST','entries','x-auth-token','execute','file','toLowerCase','method','\x22.\x20','Invalid\x20API\x20type:\x20','data','color','343792KalaIh','noColor','x-trino-user','workflow','7PbATIZ','trino','length','PATCH','3735978PLxCgQ','.\x20Valid\x20methods:\x20','Results\x20saved\x20to\x20','GET','description','llm','Endpoint\x20must\x20start\x20with\x20/:\x20','headers','<\x20HTTP/1.1\x20','readBodyFromFile','status'];a5_0x32ad=function(){return _0x12b5bd;};return a5_0x32ad();}import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';function a5_0x2338(_0x329483,_0x4aeeac){_0x329483=_0x329483-0x14d;const _0x32ad83=a5_0x32ad();let _0x233856=_0x32ad83[_0x329483];return _0x233856;}const SENSITIVE_HEADERS=new Set([a5_0x49c83c(0x157),'proxy-authorization',a5_0x49c83c(0x150),a5_0x49c83c(0x152),'set-cookie2','x-xsrf-token',a5_0x49c83c(0x161),a5_0x49c83c(0x16c)]);function isSensitiveHeader(_0x449e8f){const _0x9c60fb=a5_0x49c83c;return SENSITIVE_HEADERS[_0x9c60fb(0x14d)](_0x449e8f[_0x9c60fb(0x164)]());}function parseHeader(_0x24e5c1){const _0x38015e=a5_0x49c83c,_0x566c5f=_0x24e5c1[_0x38015e(0x15b)](':');if(_0x566c5f===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0x24e5c1+_0x38015e(0x166)+_0x38015e(0x15e));const _0x20fba0=_0x24e5c1[_0x38015e(0x180)](0x0,_0x566c5f)['trim'](),_0xbab337=_0x24e5c1[_0x38015e(0x180)](_0x566c5f+0x1)[_0x38015e(0x190)]();if(!_0x20fba0)throw new Error(_0x38015e(0x181)+_0x24e5c1+'\x22');return[_0x20fba0,_0xbab337];}export class ApiCommand extends BaseCommand{[a5_0x49c83c(0x14e)]=a5_0x49c83c(0x154);[a5_0x49c83c(0x176)]=a5_0x49c83c(0x189);['validate'](_0x18fd5a){const _0x5c258d=a5_0x49c83c,{args:_0x4b9369,options:_0x50c9b2}=_0x18fd5a,_0x5a16c2=_0x50c9b2;if(_0x4b9369[_0x5c258d(0x170)]===0x0)return _0x5c258d(0x183);const _0x25e85b=_0x4b9369[0x0];if(!_0x25e85b[_0x5c258d(0x18e)]('/'))return _0x5c258d(0x178)+_0x25e85b;const _0x3da465=_0x5a16c2[_0x5c258d(0x168)],_0x53f910=_0x5a16c2[_0x5c258d(0x163)];if(_0x3da465&&_0x53f910)return _0x5c258d(0x159);const _0x5ab31b=_0x5a16c2[_0x5c258d(0x165)]||_0x5c258d(0x175),_0x23d7c0=['GET',_0x5c258d(0x15f),'PUT','DELETE',_0x5c258d(0x171)];if(!_0x23d7c0[_0x5c258d(0x15d)](_0x5ab31b[_0x5c258d(0x158)]()))return _0x5c258d(0x15a)+_0x5ab31b+_0x5c258d(0x173)+_0x23d7c0['join'](',\x20');const _0x8d5732=_0x5a16c2['type']||'td',_0x22582c=['td',_0x5c258d(0x17f),_0x5c258d(0x16d),_0x5c258d(0x16f),_0x5c258d(0x177)];if(!_0x22582c[_0x5c258d(0x15d)](_0x8d5732))return _0x5c258d(0x167)+_0x8d5732+_0x5c258d(0x18b)+_0x22582c['join'](',\x20');return undefined;}async[a5_0x49c83c(0x162)](_0x5b6eca){const _0x4b73c0=a5_0x49c83c,{options:_0x2f3d83,args:_0x13de10,tdx:_0x33808f}=_0x5b6eca,_0x35c4be=_0x2f3d83,_0x68c3d6=_0x13de10[0x0],_0x22e6f4=(_0x35c4be[_0x4b73c0(0x165)]||_0x4b73c0(0x175))['toUpperCase'](),_0x50d02e=_0x35c4be[_0x4b73c0(0x168)],_0x47edbf=_0x35c4be[_0x4b73c0(0x163)],_0x331409=_0x35c4be[_0x4b73c0(0x18c)],_0x1d0886=_0x35c4be[_0x4b73c0(0x151)]||'td';try{const _0x8ad21={};if(_0x331409){const _0x461b3d=Array[_0x4b73c0(0x17e)](_0x331409)?_0x331409:[_0x331409];for(const _0xc26c11 of _0x461b3d){const [_0x26bf2d,_0x23ebd4]=parseHeader(_0xc26c11);_0x8ad21[_0x26bf2d]=_0x23ebd4;}}let _0x21f0b7;if(_0x50d02e)_0x21f0b7=_0x50d02e;else{if(_0x47edbf)try{_0x21f0b7=RawAPI[_0x4b73c0(0x17b)](_0x47edbf);}catch(_0x5e307f){return console[_0x4b73c0(0x15c)](_0x4b73c0(0x186)+(_0x5e307f instanceof Error?_0x5e307f[_0x4b73c0(0x184)]:String(_0x5e307f))),0x1;}}const _0x52b4f2={'method':_0x22e6f4,'apiType':_0x1d0886,'includeHeaders':_0x2f3d83[_0x4b73c0(0x185)]};_0x21f0b7&&(_0x52b4f2['body']=_0x21f0b7);Object[_0x4b73c0(0x18f)](_0x8ad21)[_0x4b73c0(0x170)]>0x0&&(_0x52b4f2[_0x4b73c0(0x179)]=_0x8ad21);if(_0x2f3d83[_0x4b73c0(0x185)]){const _0x564620=resolveSite(_0x2f3d83[_0x4b73c0(0x153)]),_0x505636=getEndpoint(_0x564620,_0x1d0886),_0x1c8867=''+_0x505636+_0x68c3d6;console[_0x4b73c0(0x15c)]('>\x20'+_0x22e6f4+'\x20'+_0x1c8867);const _0x3cdc03=getAuthHeaders(_0x564620),_0x1cb632={..._0x3cdc03,..._0x8ad21};for(const [_0x2c9095,_0x4f3ac3]of Object['entries'](_0x1cb632)){!isSensitiveHeader(_0x2c9095)&&console[_0x4b73c0(0x15c)]('>\x20'+_0x2c9095+':\x20'+_0x4f3ac3);}_0x21f0b7&&console['error']('>'),console['error']('');}const _0x475002=await _0x33808f[_0x4b73c0(0x154)][_0x4b73c0(0x188)](_0x68c3d6,_0x52b4f2);if(_0x2f3d83[_0x4b73c0(0x185)]&&_0x475002[_0x4b73c0(0x179)]){console['error'](_0x4b73c0(0x17a)+_0x475002[_0x4b73c0(0x17c)]);for(const [_0x2ff509,_0xa6563a]of Object[_0x4b73c0(0x160)](_0x475002['headers'])){!isSensitiveHeader(_0x2ff509)&&console[_0x4b73c0(0x15c)]('<\x20'+_0x2ff509+':\x20'+_0xa6563a);}console[_0x4b73c0(0x15c)]('');}const _0x1ff846=Boolean(_0x2f3d83[_0x4b73c0(0x18a)]),_0x39810e={'color':_0x2f3d83[_0x4b73c0(0x169)],'noColor':_0x2f3d83[_0x4b73c0(0x16b)]||_0x1ff846&&!_0x2f3d83[_0x4b73c0(0x169)]},_0x249f71=colorizeJSON(_0x475002[_0x4b73c0(0x168)],_0x39810e);return _0x2f3d83[_0x4b73c0(0x18a)]?(writeFileSync(_0x2f3d83[_0x4b73c0(0x18a)],_0x249f71),console['error'](_0x4b73c0(0x174)+_0x2f3d83['output'])):console[_0x4b73c0(0x14f)](_0x249f71),0x0;}catch(_0x5cc7b2){return _0x5cc7b2 instanceof Error?(console[_0x4b73c0(0x15c)](_0x4b73c0(0x186)+_0x5cc7b2[_0x4b73c0(0x184)]),_0x2f3d83['verbose']&&_0x5cc7b2[_0x4b73c0(0x187)]&&console['error'](_0x4b73c0(0x182)+_0x5cc7b2[_0x4b73c0(0x187)])):console[_0x4b73c0(0x15c)](_0x4b73c0(0x186)+String(_0x5cc7b2)),0x1;}}}
@@ -1 +1 @@
1
- const a6_0xdf6262=a6_0x5607;(function(_0x441a97,_0x35787e){const _0x335af6=a6_0x5607,_0x569a8e=_0x441a97();while(!![]){try{const _0x3c742b=parseInt(_0x335af6(0x1b6))/0x1*(-parseInt(_0x335af6(0x1c8))/0x2)+parseInt(_0x335af6(0x203))/0x3*(-parseInt(_0x335af6(0x1fa))/0x4)+parseInt(_0x335af6(0x1f7))/0x5*(parseInt(_0x335af6(0x204))/0x6)+parseInt(_0x335af6(0x200))/0x7+parseInt(_0x335af6(0x1ec))/0x8*(parseInt(_0x335af6(0x1db))/0x9)+parseInt(_0x335af6(0x1ef))/0xa*(-parseInt(_0x335af6(0x1f9))/0xb)+parseInt(_0x335af6(0x1c5))/0xc*(-parseInt(_0x335af6(0x1b7))/0xd);if(_0x3c742b===_0x35787e)break;else _0x569a8e['push'](_0x569a8e['shift']());}catch(_0x24edaf){_0x569a8e['push'](_0x569a8e['shift']());}}}(a6_0xc6da,0xb3c85));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a6_0xc6da(){const _0x35f512=['green','profile','other','first_name','3070yUCpAg','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','517ErPqFH','222868CaBAum','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','logLevel','tdx:\x20auth\x20clear','\x20for\x20profile:\x20','\x27\x20registered','9832480rsKifv','\x20\x20tdx','System\x20keychain\x20is\x20not\x20available','3ibgMNm','10986xMYqgx','\x20(profile:\x20','execute','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','✓\x20API\x20key\x20removed\x20from\x20keychain','us01','error','Enter\x20your\x20TD\x20API\x20key:','bold','text','133PFINIH','3189225BjyIWC','message','last_name','eu01','value','status','jp01','trim','auth','tdx:\x20auth\x20setup','join','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','filter','User:\x20','12QhLhYU','warn','push','4666IrTJFb','name','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x20(site:\x20','Name:\x20','site','Validating\x20API\x20key...','log','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','Setup\x20API\x20key\x20authentication\x20interactively','select','apiKey','Enter\x20site\x20name:','password','ap02','eu\x20\x20\x20-\x20Europe','auth:setup','\x20--profile\x20','1286793yGWHMI','auth:clear','\x0aSetup\x20cancelled','findIndex','length','ap02\x20-\x20Korea','email','API\x20key\x20cannot\x20be\x20empty','customSite','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','jp\x20\x20\x20-\x20Japan','yellow','jobs','No\x20API\x20key\x20found\x20in\x20keychain','No\x20credential\x20found','description','✓\x20Profile\x20\x27','8NkwZzS','red','✗\x20Validation\x20failed:\x20','281730iMFqvG','getUserInfo','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','N/A'];a6_0xc6da=function(){return _0x35f512;};return a6_0xc6da();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a6_0x556806 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a6_0x7c2eff from'chalk';export class AuthSetupCommand extends BaseCommand{[a6_0xdf6262(0x1c9)]=a6_0xdf6262(0x1d9);['description']=a6_0xdf6262(0x1d2);async['execute'](_0x440354){const _0x55e813=a6_0xdf6262,{options:_0x4b66bf}=_0x440354,_0x43b770=_0x4b66bf[_0x55e813(0x1f4)];console[_0x55e813(0x1d0)](a6_0x7c2eff[_0x55e813(0x1b4)](_0x55e813(0x1c0)));const _0x38447f=_0x4b66bf['site']||_0x55e813(0x209),_0x5e4909=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x55e813(0x209)},{'title':_0x55e813(0x1e5),'value':_0x55e813(0x1bd)},{'title':_0x55e813(0x1d8),'value':_0x55e813(0x1ba)},{'title':_0x55e813(0x1e0),'value':_0x55e813(0x1d7)}];let _0x3e9db5=_0x5e4909[_0x55e813(0x1de)](_0x551a3b=>_0x551a3b[_0x55e813(0x1bb)]===_0x38447f);_0x3e9db5===-0x1&&_0x38447f!==_0x55e813(0x209)&&(_0x5e4909[_0x55e813(0x1c7)]({'title':_0x38447f,'value':_0x38447f}),_0x3e9db5=_0x5e4909[_0x55e813(0x1df)]-0x1);_0x5e4909[_0x55e813(0x1c7)]({'title':'Enter\x20custom\x20site','value':'other'});const _0x4b2ed4=_0x43b770?_0x55e813(0x1fb)+_0x43b770+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x545541=await a6_0x556806({'type':_0x55e813(0x1d3),'name':_0x55e813(0x1ce),'message':_0x4b2ed4,'choices':_0x5e4909,'initial':_0x3e9db5>=0x0?_0x3e9db5:0x0});if(!_0x545541['site'])return console[_0x55e813(0x1d0)]('\x0aSetup\x20cancelled'),0x1;let _0x2a3b5e;if(_0x545541['site']===_0x55e813(0x1f5)){const _0x2843dc=await a6_0x556806({'type':_0x55e813(0x1b5),'name':'customSite','message':_0x55e813(0x1d5),'initial':'us01','validate':_0x56ac55=>{const _0x301bf1=_0x55e813;if(!_0x56ac55||!_0x56ac55[_0x301bf1(0x1be)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x56ac55[_0x301bf1(0x1be)]()))return _0x301bf1(0x1cb);return!![];}});if(!_0x2843dc[_0x55e813(0x1e3)])return console[_0x55e813(0x1d0)](_0x55e813(0x1dd)),0x1;_0x2a3b5e=_0x2843dc['customSite'];}else _0x2a3b5e=_0x545541[_0x55e813(0x1ce)];const _0x37f51d=resolveSite(_0x2a3b5e);console[_0x55e813(0x1d0)]('Setting\x20up\x20authentication\x20for\x20site:\x20'+_0x37f51d),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x37f51d,'/app/mp/ak'));const _0x278dfc=await a6_0x556806({'type':_0x55e813(0x1d6),'name':_0x55e813(0x1d4),'message':_0x55e813(0x1b3),'validate':_0x244870=>{const _0x298064=_0x55e813;if(!_0x244870||!_0x244870[_0x298064(0x1be)]())return _0x298064(0x1e2);return!![];}});if(!_0x278dfc[_0x55e813(0x1d4)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x31aacb=_0x278dfc[_0x55e813(0x1d4)];console[_0x55e813(0x1d0)](_0x55e813(0x1cf));try{const _0x516d6a=TDX['create']({'site':_0x37f51d,'apiKey':_0x31aacb['trim'](),'logLevel':_0x4b66bf[_0x55e813(0x1fc)]??LogLevel['ERROR']}),_0x30e4ec=await _0x516d6a[_0x55e813(0x1e7)][_0x55e813(0x1f0)]();console[_0x55e813(0x1d0)](_0x55e813(0x1c2)+_0x30e4ec[_0x55e813(0x1e1)]+')');const _0x439d4e=await isKeychainAvailable();_0x439d4e?(await saveAPIKeyAsync(_0x31aacb[_0x55e813(0x1be)](),_0x37f51d,_0x43b770),console[_0x55e813(0x1d0)](_0x55e813(0x207)+(_0x43b770?_0x55e813(0x205)+_0x43b770+')':''))):(console['warn'](a6_0x7c2eff[_0x55e813(0x1e6)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x55e813(0x1c6)](a6_0x7c2eff[_0x55e813(0x1e6)](_0x55e813(0x1ca))));if(_0x43b770){const _0xe96475={'site':_0x37f51d};saveProfileToUserConfig(_0x43b770,_0xe96475),console[_0x55e813(0x1d0)](_0x55e813(0x1eb)+_0x43b770+_0x55e813(0x1ff));}const _0x500447=_0x43b770?_0x55e813(0x1da)+_0x43b770:'';return console[_0x55e813(0x1d0)](),console[_0x55e813(0x1d0)](_0x55e813(0x1f1)),console['log']('\x20\x20tdx'+_0x500447+_0x55e813(0x1f8)),console[_0x55e813(0x1d0)](_0x55e813(0x201)+_0x500447+_0x55e813(0x1e4)),0x0;}catch(_0x368375){if(_0x368375 instanceof HTTPClientError&&_0x368375[_0x55e813(0x1bc)]===0x191)return printAuthError(_0x368375),0x1;return console[_0x55e813(0x1b2)](a6_0x7c2eff['red']('✗\x20Validation\x20failed:\x20'+(_0x368375 instanceof Error?_0x368375['message']:String(_0x368375)))),console[_0x55e813(0x1b2)](_0x55e813(0x1d1)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a6_0xdf6262(0x1c9)]=a6_0xdf6262(0x1bf);[a6_0xdf6262(0x1ea)]='Show\x20authentication\x20status\x20and\x20validate\x20API\x20key';async['execute'](_0x3dc048){const _0x2d6bb3=a6_0xdf6262,{options:_0x2d822c,tdx:_0x2413e3}=_0x3dc048,_0x24fb90=_0x2d822c['site'],_0x276ad8=_0x2d822c['profile'],_0x50dec5=_0x276ad8?_0x276ad8:_0x2d6bb3(0x1f2);console[_0x2d6bb3(0x1d0)]('tdx\x20profile:\x20'+_0x50dec5+_0x2d6bb3(0x1cc)+_0x24fb90+')');const _0x123d12=await resolveAPIKeyAsync(_0x24fb90,_0x276ad8);if(_0x123d12){const {source:_0x3ab7a4,isDeprecated:_0x256aca}=_0x123d12,_0x180fd7='Read\x20credential\x20from\x20'+_0x3ab7a4;console[_0x2d6bb3(0x1d0)](_0x256aca?a6_0x7c2eff[_0x2d6bb3(0x1e6)](_0x180fd7):_0x180fd7);}else console[_0x2d6bb3(0x1d0)](a6_0x7c2eff[_0x2d6bb3(0x1e6)](_0x2d6bb3(0x1e9)));try{const _0x3e293f=await _0x2413e3['jobs']['getUserInfo']();return console['log'](a6_0x7c2eff[_0x2d6bb3(0x1f3)]('✓\x20Authentication\x20successful\x0a')),console['log'](_0x2d6bb3(0x1c4)+_0x3e293f[_0x2d6bb3(0x1e1)]),(_0x3e293f[_0x2d6bb3(0x1f6)]||_0x3e293f[_0x2d6bb3(0x1b9)])&&console[_0x2d6bb3(0x1d0)](_0x2d6bb3(0x1cd)+[_0x3e293f[_0x2d6bb3(0x1f6)],_0x3e293f[_0x2d6bb3(0x1b9)]][_0x2d6bb3(0x1c3)](Boolean)[_0x2d6bb3(0x1c1)]('\x20')),0x0;}catch(_0x32cd1a){return _0x32cd1a instanceof HTTPClientError&&_0x32cd1a[_0x2d6bb3(0x1bc)]===0x191?printAuthError(_0x32cd1a,!![],_0x276ad8):console['error'](a6_0x7c2eff[_0x2d6bb3(0x1ed)](_0x2d6bb3(0x1ee)+(_0x32cd1a instanceof Error?_0x32cd1a[_0x2d6bb3(0x1b8)]:String(_0x32cd1a)))),0x1;}}}function a6_0x5607(_0xd2d621,_0x4792c7){_0xd2d621=_0xd2d621-0x1b2;const _0xc6da72=a6_0xc6da();let _0x560719=_0xc6da72[_0xd2d621];return _0x560719;}export class AuthClearCommand extends BaseCommand{[a6_0xdf6262(0x1c9)]=a6_0xdf6262(0x1dc);['description']='Remove\x20API\x20key\x20from\x20system\x20keychain';async[a6_0xdf6262(0x206)](_0x16e683){const _0x2e2870=a6_0xdf6262,{options:_0x1c4a60}=_0x16e683,_0x2aae0a=_0x1c4a60[_0x2e2870(0x1f4)];console[_0x2e2870(0x1d0)](a6_0x7c2eff[_0x2e2870(0x1b4)](_0x2e2870(0x1fd)));const _0xbdf4cd=await isKeychainAvailable();if(!_0xbdf4cd)return console['error'](a6_0x7c2eff[_0x2e2870(0x1ed)](_0x2e2870(0x202))),0x1;const _0xa049ce=await deleteKeychainAPIKey(_0x2aae0a);return _0xa049ce?(clearCredentialCache(),console[_0x2e2870(0x1d0)](_0x2e2870(0x208)+(_0x2aae0a?_0x2e2870(0x205)+_0x2aae0a+')':'')),0x0):(console['log'](_0x2e2870(0x1e8)+(_0x2aae0a?_0x2e2870(0x1fe)+_0x2aae0a:'')),0x1);}}
1
+ const a6_0x269098=a6_0x36d5;function a6_0xa6a6(){const _0x535692=['first_name','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','✓\x20Profile\x20\x27','ap02','profile','yellow','8qSffyy','/app/mp/ak','warn','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','message','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','✓\x20API\x20key\x20removed\x20from\x20keychain','eu01','auth:setup','13012767PkBOXR','site','text','jobs','1553796ehlvyw','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','email','✗\x20Validation\x20failed:\x20','Name:\x20','1715tHzdKU','Select\x20your\x20Treasure\x20Data\x20site:','us\x20\x20\x20-\x20United\x20States','\x20\x20tdx','Setting\x20up\x20authentication\x20for\x20site:\x20','description','push','red','jp\x20\x20\x20-\x20Japan','green','Enter\x20custom\x20site','88UYlJgc','Read\x20credential\x20from\x20','API\x20key\x20cannot\x20be\x20empty','\x20(profile:\x20','bold','418vJhnXB','getUserInfo','execute','tdx:\x20auth\x20setup','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','\x20for\x20profile:\x20','findIndex','value','\x20(site:\x20','apiKey','Validating\x20API\x20key...','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','customSite','Site\x20name\x20cannot\x20be\x20empty','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','tdx:\x20auth\x20clear','4448381JYySSg','N/A','2148LoTlvD','920650qkHmyu','error','No\x20credential\x20found','status','password','log','ap02\x20-\x20Korea','us01','209628uzCkng','\x0aSetup\x20cancelled','logLevel','11340VyArax','name','trim'];a6_0xa6a6=function(){return _0x535692;};return a6_0xa6a6();}(function(_0x3f9e23,_0x3a88b4){const _0x56bdca=a6_0x36d5,_0x49b53f=_0x3f9e23();while(!![]){try{const _0x5012dc=parseInt(_0x56bdca(0x8e))/0x1*(parseInt(_0x56bdca(0x99))/0x2)+parseInt(_0x56bdca(0x89))/0x3+parseInt(_0x56bdca(0x67))/0x4*(-parseInt(_0x56bdca(0x73))/0x5)+-parseInt(_0x56bdca(0x70))/0x6+parseInt(_0x56bdca(0xaf))/0x7*(-parseInt(_0x56bdca(0x7c))/0x8)+-parseInt(_0x56bdca(0x85))/0x9+-parseInt(_0x56bdca(0x68))/0xa*(-parseInt(_0x56bdca(0x9e))/0xb);if(_0x5012dc===_0x3a88b4)break;else _0x49b53f['push'](_0x49b53f['shift']());}catch(_0x4ea200){_0x49b53f['push'](_0x49b53f['shift']());}}}(a6_0xa6a6,0xb8f9e));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a6_0x2ec350 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a6_0xdda0ef from'chalk';export class AuthSetupCommand extends BaseCommand{[a6_0x269098(0x74)]=a6_0x269098(0x84);[a6_0x269098(0x93)]='Setup\x20API\x20key\x20authentication\x20interactively';async[a6_0x269098(0xa0)](_0x469e46){const _0x1fd2f2=a6_0x269098,{options:_0x1af850}=_0x469e46,_0x186341=_0x1af850['profile'];console[_0x1fd2f2(0x6d)](a6_0xdda0ef[_0x1fd2f2(0x9d)](_0x1fd2f2(0xa1)));const _0x202f47=_0x1af850[_0x1fd2f2(0x86)]||_0x1fd2f2(0x6f),_0xcf0028=[{'title':_0x1fd2f2(0x90),'value':_0x1fd2f2(0x6f)},{'title':_0x1fd2f2(0x96),'value':'jp01'},{'title':'eu\x20\x20\x20-\x20Europe','value':_0x1fd2f2(0x83)},{'title':_0x1fd2f2(0x6e),'value':_0x1fd2f2(0x79)}];let _0x54000b=_0xcf0028[_0x1fd2f2(0xa4)](_0x1b731a=>_0x1b731a[_0x1fd2f2(0xa5)]===_0x202f47);_0x54000b===-0x1&&_0x202f47!==_0x1fd2f2(0x6f)&&(_0xcf0028[_0x1fd2f2(0x94)]({'title':_0x202f47,'value':_0x202f47}),_0x54000b=_0xcf0028['length']-0x1);_0xcf0028['push']({'title':_0x1fd2f2(0x98),'value':'other'});const _0x259a21=_0x186341?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x186341+'):':_0x1fd2f2(0x8f),_0x49c0ac=await a6_0x2ec350({'type':'select','name':'site','message':_0x259a21,'choices':_0xcf0028,'initial':_0x54000b>=0x0?_0x54000b:0x0});if(!_0x49c0ac[_0x1fd2f2(0x86)])return console[_0x1fd2f2(0x6d)]('\x0aSetup\x20cancelled'),0x1;let _0x5a907d;if(_0x49c0ac[_0x1fd2f2(0x86)]==='other'){const _0x39050d=await a6_0x2ec350({'type':_0x1fd2f2(0x87),'name':_0x1fd2f2(0xab),'message':'Enter\x20site\x20name:','initial':_0x1fd2f2(0x6f),'validate':_0x5ea06f=>{const _0x2f6918=_0x1fd2f2;if(!_0x5ea06f||!_0x5ea06f['trim']())return _0x2f6918(0xac);if(!/^[a-z0-9-]+$/['test'](_0x5ea06f[_0x2f6918(0x75)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x39050d['customSite'])return console[_0x1fd2f2(0x6d)](_0x1fd2f2(0x71)),0x1;_0x5a907d=_0x39050d[_0x1fd2f2(0xab)];}else _0x5a907d=_0x49c0ac['site'];const _0x3f44ab=resolveSite(_0x5a907d);console['log'](_0x1fd2f2(0x92)+_0x3f44ab),console[_0x1fd2f2(0x6d)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x3f44ab,_0x1fd2f2(0x7d)));const _0x172764=await a6_0x2ec350({'type':_0x1fd2f2(0x6c),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x29b0c5=>{const _0x3c9f27=_0x1fd2f2;if(!_0x29b0c5||!_0x29b0c5[_0x3c9f27(0x75)]())return _0x3c9f27(0x9b);return!![];}});if(!_0x172764['apiKey'])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x4cb44e=_0x172764[_0x1fd2f2(0xa7)];console[_0x1fd2f2(0x6d)](_0x1fd2f2(0xa8));try{const _0x2a8b42=TDX['create']({'site':_0x3f44ab,'apiKey':_0x4cb44e[_0x1fd2f2(0x75)](),'logLevel':_0x1af850[_0x1fd2f2(0x72)]??LogLevel['ERROR']}),_0x2db63f=await _0x2a8b42[_0x1fd2f2(0x88)][_0x1fd2f2(0x9f)]();console[_0x1fd2f2(0x6d)](_0x1fd2f2(0xa9)+_0x2db63f[_0x1fd2f2(0x8b)]+')');const _0x5a48cb=await isKeychainAvailable();_0x5a48cb?(await saveAPIKeyAsync(_0x4cb44e[_0x1fd2f2(0x75)](),_0x3f44ab,_0x186341),console['log'](_0x1fd2f2(0x81)+(_0x186341?_0x1fd2f2(0x9c)+_0x186341+')':''))):(console[_0x1fd2f2(0x7e)](a6_0xdda0ef[_0x1fd2f2(0x7b)](_0x1fd2f2(0xad))),console[_0x1fd2f2(0x7e)](a6_0xdda0ef[_0x1fd2f2(0x7b)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x186341){const _0x18bf31={'site':_0x3f44ab};saveProfileToUserConfig(_0x186341,_0x18bf31),console[_0x1fd2f2(0x6d)](_0x1fd2f2(0x78)+_0x186341+'\x27\x20registered');}const _0x3ece30=_0x186341?'\x20--profile\x20'+_0x186341:'';return console[_0x1fd2f2(0x6d)](),console[_0x1fd2f2(0x6d)](_0x1fd2f2(0x8a)),console['log'](_0x1fd2f2(0x91)+_0x3ece30+_0x1fd2f2(0x7f)),console[_0x1fd2f2(0x6d)]('\x20\x20tdx'+_0x3ece30+_0x1fd2f2(0x77)),0x0;}catch(_0xbd3672){if(_0xbd3672 instanceof HTTPClientError&&_0xbd3672['status']===0x191)return printAuthError(_0xbd3672),0x1;return console[_0x1fd2f2(0x69)](a6_0xdda0ef[_0x1fd2f2(0x95)](_0x1fd2f2(0x8c)+(_0xbd3672 instanceof Error?_0xbd3672[_0x1fd2f2(0x80)]:String(_0xbd3672)))),console[_0x1fd2f2(0x69)](_0x1fd2f2(0xaa)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a6_0x269098(0x74)]='auth';[a6_0x269098(0x93)]=a6_0x269098(0xa2);async[a6_0x269098(0xa0)](_0x4c0c33){const _0x3cf26e=a6_0x269098,{options:_0x1862df,tdx:_0x2887e9}=_0x4c0c33,_0x3106ac=_0x1862df['site'],_0x14936d=_0x1862df[_0x3cf26e(0x7a)],_0x470b50=_0x14936d?_0x14936d:_0x3cf26e(0x66);console[_0x3cf26e(0x6d)]('tdx\x20profile:\x20'+_0x470b50+_0x3cf26e(0xa6)+_0x3106ac+')');const _0x3b9ceb=await resolveAPIKeyAsync(_0x3106ac,_0x14936d);if(_0x3b9ceb){const {source:_0x41c7f2,isDeprecated:_0x4d77e0}=_0x3b9ceb,_0xab4fa7=_0x3cf26e(0x9a)+_0x41c7f2;console[_0x3cf26e(0x6d)](_0x4d77e0?a6_0xdda0ef[_0x3cf26e(0x7b)](_0xab4fa7):_0xab4fa7);}else console[_0x3cf26e(0x6d)](a6_0xdda0ef[_0x3cf26e(0x7b)](_0x3cf26e(0x6a)));try{const _0x12581f=await _0x2887e9['jobs'][_0x3cf26e(0x9f)]();return console[_0x3cf26e(0x6d)](a6_0xdda0ef[_0x3cf26e(0x97)]('✓\x20Authentication\x20successful\x0a')),console[_0x3cf26e(0x6d)]('User:\x20'+_0x12581f[_0x3cf26e(0x8b)]),(_0x12581f[_0x3cf26e(0x76)]||_0x12581f['last_name'])&&console[_0x3cf26e(0x6d)](_0x3cf26e(0x8d)+[_0x12581f['first_name'],_0x12581f['last_name']]['filter'](Boolean)['join']('\x20')),0x0;}catch(_0xe648f5){return _0xe648f5 instanceof HTTPClientError&&_0xe648f5[_0x3cf26e(0x6b)]===0x191?printAuthError(_0xe648f5,!![],_0x14936d):console[_0x3cf26e(0x69)](a6_0xdda0ef[_0x3cf26e(0x95)](_0x3cf26e(0x8c)+(_0xe648f5 instanceof Error?_0xe648f5[_0x3cf26e(0x80)]:String(_0xe648f5)))),0x1;}}}function a6_0x36d5(_0x446552,_0x536424){_0x446552=_0x446552-0x66;const _0xa6a6d7=a6_0xa6a6();let _0x36d5e1=_0xa6a6d7[_0x446552];return _0x36d5e1;}export class AuthClearCommand extends BaseCommand{['name']='auth:clear';[a6_0x269098(0x93)]='Remove\x20API\x20key\x20from\x20system\x20keychain';async[a6_0x269098(0xa0)](_0x13145b){const _0x593dfd=a6_0x269098,{options:_0x39a627}=_0x13145b,_0x351172=_0x39a627[_0x593dfd(0x7a)];console[_0x593dfd(0x6d)](a6_0xdda0ef[_0x593dfd(0x9d)](_0x593dfd(0xae)));const _0x537684=await isKeychainAvailable();if(!_0x537684)return console[_0x593dfd(0x69)](a6_0xdda0ef[_0x593dfd(0x95)]('System\x20keychain\x20is\x20not\x20available')),0x1;const _0x21f683=await deleteKeychainAPIKey(_0x351172);return _0x21f683?(clearCredentialCache(),console[_0x593dfd(0x6d)](_0x593dfd(0x82)+(_0x351172?_0x593dfd(0x9c)+_0x351172+')':'')),0x0):(console[_0x593dfd(0x6d)]('No\x20API\x20key\x20found\x20in\x20keychain'+(_0x351172?_0x593dfd(0xa3)+_0x351172:'')),0x1);}}
@@ -1 +1 @@
1
- const a7_0x4396dc=a7_0x53be;(function(_0x461604,_0x586c05){const _0x5860d5=a7_0x53be,_0x225329=_0x461604();while(!![]){try{const _0x301306=parseInt(_0x5860d5(0xa4))/0x1*(parseInt(_0x5860d5(0x8a))/0x2)+-parseInt(_0x5860d5(0xa0))/0x3+parseInt(_0x5860d5(0xa6))/0x4*(parseInt(_0x5860d5(0xae))/0x5)+parseInt(_0x5860d5(0x90))/0x6*(-parseInt(_0x5860d5(0xa3))/0x7)+-parseInt(_0x5860d5(0x93))/0x8*(-parseInt(_0x5860d5(0xac))/0x9)+-parseInt(_0x5860d5(0xab))/0xa+parseInt(_0x5860d5(0xb9))/0xb*(-parseInt(_0x5860d5(0x99))/0xc);if(_0x301306===_0x586c05)break;else _0x225329['push'](_0x225329['shift']());}catch(_0x29331e){_0x225329['push'](_0x225329['shift']());}}}(a7_0x6973,0x71b09));function a7_0x53be(_0x513f4c,_0x54eea4){_0x513f4c=_0x513f4c-0x8a;const _0x6973b6=a7_0x6973();let _0x53bec8=_0x6973b6[_0x513f4c];return _0x53bec8;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a7_0x6973(){const _0xcc5f1a=['event','2260788LQgnUw','\x20\x20Cause:\x20','name','llmProject','Getting\x20default\x20agent...','stdout','verbose','1946484cIoWMb','Error:\x20','getDefaultAgent','2760863jYyOpK','236879ODbqXl','handleChatEvent','44wcxZAS','Resolving\x20agent\x20\x27','getOrCreateDefaultAgent','execute','session\x20context','1282900vIYHvH','450RhgWTi','--agent\x20flag','293305DPjrqO','includes','\x0aError:\x20','llmAgent','type','llm','Continuing\x20chat:\x20','new','Using\x20cached\x20default\x20agent:\x20','chatId','content','11DBqhEf','args','getAgentId','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','description','validate','stack','chat','error','message','Resolving\x20project\x20\x27','6JvToHC','agent','404','Using\x20agent\x20from\x20','cause','Chat\x20session:\x20','12nEdWMJ','join','claude-4.5-haiku','138256JQKGRD','data','streamChat','\x27...','CHAT_NOT_FOUND'];a7_0x6973=function(){return _0xcc5f1a;};return a7_0x6973();}import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function handleSDKError(_0x580588,_0x41e5b3){const _0x3603d8=a7_0x53be;if(_0x580588 instanceof SDKError)console[_0x3603d8(0xc1)](_0x3603d8(0xa1)+_0x580588[_0x3603d8(0xc2)]),_0x41e5b3['verbose']&&(_0x580588[_0x3603d8(0x8e)]&&console[_0x3603d8(0xc1)](_0x3603d8(0x9a)+_0x580588[_0x3603d8(0x8e)]),_0x580588[_0x3603d8(0xbf)]&&(console['error']('\x0aStack\x20trace:'),console[_0x3603d8(0xc1)](_0x580588[_0x3603d8(0xbf)])));else throw _0x580588;}export class ChatCommand extends BaseCommand{[a7_0x4396dc(0x9b)]=a7_0x4396dc(0xc0);[a7_0x4396dc(0xbd)]='Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)';[a7_0x4396dc(0xbe)](_0x5a07dd){const _0x5bda38=a7_0x4396dc,_0x205591=_0x5a07dd[_0x5bda38(0xba)][_0x5bda38(0x91)]('\x20');if(!_0x205591)return _0x5bda38(0xbc);return undefined;}async[a7_0x4396dc(0x95)](_0xb7f4b,_0x5e2ba5,_0x111826,_0x1bcb83,_0x1a1c98){const _0x46b82b=a7_0x4396dc;for await(const _0x4e1e07 of _0xb7f4b['llm']['chat'](_0x5e2ba5,{'agentId':_0x111826,'chatId':_0x1bcb83})){if(_0x4e1e07[_0x46b82b(0xb2)]==='metadata'){const _0x21ab4e=_0x4e1e07[_0x46b82b(0x94)][_0x46b82b(0xb7)];saveLastChatId(_0x21ab4e),_0x1a1c98&&console[_0x46b82b(0xc1)](_0x46b82b(0x8f)+_0x21ab4e);}else _0x4e1e07[_0x46b82b(0xb2)]===_0x46b82b(0x98)&&this[_0x46b82b(0xa5)](_0x4e1e07['data']);}}async['getAgentId'](_0x31109e,_0x4008ad,_0x3a965c,_0x245923,_0x2f3fa2){const _0x9a859c=a7_0x4396dc,_0x571e6b=_0x4008ad||_0x3a965c;if(_0x571e6b){const {projectName:_0x46c189,agentName:_0x43196b}=parseAgentRef(_0x571e6b),_0x5c53de=_0x43196b||_0x571e6b,_0x4c11d2=_0x43196b?_0x46c189:_0x245923;if(!_0x4c11d2)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x2f3fa2){const _0x11d499=_0x4008ad?_0x9a859c(0xad):_0x9a859c(0xaa);console['error'](_0x9a859c(0x8d)+_0x11d499+':\x20'+_0x4c11d2+'/'+_0x5c53de);}const _0x3a40e1=await withSpinner(_0x9a859c(0xc3)+_0x4c11d2+_0x9a859c(0x96),()=>_0x31109e[_0x9a859c(0xb3)]['resolveProjectId'](_0x4c11d2),{'verbose':_0x2f3fa2}),_0x5458f4=await withSpinner(_0x9a859c(0xa7)+_0x5c53de+'\x27...',()=>_0x31109e[_0x9a859c(0xb3)]['resolveAgentId'](_0x5c53de,_0x3a40e1[_0x9a859c(0x94)]),{'verbose':_0x2f3fa2});return _0x5458f4[_0x9a859c(0x94)];}else{const _0x1a8ea6=_0x31109e[_0x9a859c(0xb3)][_0x9a859c(0xa2)]();if(_0x1a8ea6)return _0x2f3fa2&&console[_0x9a859c(0xc1)](_0x9a859c(0xb6)+_0x1a8ea6[_0x9a859c(0x9b)]),_0x1a8ea6['id'];const _0x2689e7=await withSpinner(_0x9a859c(0x9d),()=>_0x31109e[_0x9a859c(0xb3)][_0x9a859c(0xa8)](_0x9a859c(0x92),0x0),{'verbose':_0x2f3fa2});return _0x2689e7[_0x9a859c(0x94)]['id'];}}async[a7_0x4396dc(0xa9)](_0x26e79d){const _0x2eb28c=a7_0x4396dc,{options:_0x55a9cd,args:_0x3dcf5c,tdx:_0x374211}=_0x26e79d,_0x7007b0=_0x3dcf5c[_0x2eb28c(0x91)]('\x20'),_0x1d1a5e=_0x55a9cd,_0x1250b3=_0x1d1a5e[_0x2eb28c(0x8b)],_0x2459f8=_0x1d1a5e[_0x2eb28c(0xb1)],_0x234db2=_0x1d1a5e[_0x2eb28c(0x9c)],_0x4c63b3=_0x1d1a5e[_0x2eb28c(0xb5)];try{let _0x4b3031,_0x58f68f;!_0x4c63b3&&(_0x58f68f=loadLastChatId(),_0x58f68f&&_0x55a9cd[_0x2eb28c(0x9f)]&&console[_0x2eb28c(0xc1)](_0x2eb28c(0xb4)+_0x58f68f));(_0x4c63b3||!_0x58f68f)&&(_0x4b3031=await this[_0x2eb28c(0xbb)](_0x374211,_0x1250b3,_0x2459f8,_0x234db2,_0x55a9cd[_0x2eb28c(0x9f)]));try{await this['streamChat'](_0x374211,_0x7007b0,_0x4b3031,_0x58f68f,_0x55a9cd[_0x2eb28c(0x9f)]);}catch(_0x447fe4){const _0x5beda0=_0x447fe4 instanceof SDKError&&_0x447fe4['code']===ErrorCode[_0x2eb28c(0x97)]||_0x447fe4 instanceof Error&&_0x447fe4[_0x2eb28c(0xc2)][_0x2eb28c(0xaf)](_0x2eb28c(0x8c));if(_0x5beda0)_0x55a9cd['verbose']&&console[_0x2eb28c(0xc1)]('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x4b3031&&(_0x4b3031=await this[_0x2eb28c(0xbb)](_0x374211,_0x1250b3,_0x2459f8,_0x234db2,_0x55a9cd[_0x2eb28c(0x9f)])),await this[_0x2eb28c(0x95)](_0x374211,_0x7007b0,_0x4b3031,undefined,_0x55a9cd[_0x2eb28c(0x9f)]);else throw _0x447fe4;}return console['log'](),0x0;}catch(_0x4b5e09){return console['error'](),handleSDKError(_0x4b5e09,_0x55a9cd),0x1;}}[a7_0x4396dc(0xa5)](_0x5ca994){const _0x531cfd=a7_0x4396dc;if(_0x531cfd(0xb8)in _0x5ca994)process[_0x531cfd(0x9e)]['write'](_0x5ca994['content']);else _0x531cfd(0xc1)in _0x5ca994&&console[_0x531cfd(0xc1)](_0x531cfd(0xb0)+_0x5ca994[_0x531cfd(0xc1)]);}}
1
+ const a7_0x281949=a7_0x5e23;(function(_0x428252,_0x418be1){const _0x1104eb=a7_0x5e23,_0x48bfa6=_0x428252();while(!![]){try{const _0x3a28a9=parseInt(_0x1104eb(0xcf))/0x1+-parseInt(_0x1104eb(0xd9))/0x2*(-parseInt(_0x1104eb(0xc8))/0x3)+-parseInt(_0x1104eb(0xcd))/0x4*(parseInt(_0x1104eb(0xc6))/0x5)+-parseInt(_0x1104eb(0xc7))/0x6*(parseInt(_0x1104eb(0xee))/0x7)+-parseInt(_0x1104eb(0xe5))/0x8+parseInt(_0x1104eb(0xf9))/0x9*(-parseInt(_0x1104eb(0xd2))/0xa)+parseInt(_0x1104eb(0xe7))/0xb*(parseInt(_0x1104eb(0xe8))/0xc);if(_0x3a28a9===_0x418be1)break;else _0x48bfa6['push'](_0x48bfa6['shift']());}catch(_0x583682){_0x48bfa6['push'](_0x48bfa6['shift']());}}}(a7_0x14e9,0x926d1));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';function a7_0x14e9(){const _0x5cb2b3=['getAgentId','llm','handleChatEvent','7718944eaBRov','Chat\x20session:\x20','3707vJVbgL','105852TXRRNJ','chat','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','metadata','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','Using\x20agent\x20from\x20','7yIfPXV','getOrCreateDefaultAgent','claude-4.5-haiku','error','code','data','log','resolveAgentId','streamChat','Continuing\x20chat:\x20','description','8793GKxJzJ','content','write','1305485bEnzYs','7025070ZEQdYA','290913rQGiRw','--agent\x20flag','agent','verbose','\x0aError:\x20','12pRaRhu','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','441782bfqLbv','type','Using\x20cached\x20default\x20agent:\x20','1910Bbnoub','stdout','stack','session\x20context','name','\x20\x20Cause:\x20','\x27...','6WmCsbX','llmAgent','validate','message','args','cause','chatId','resolveProjectId','join'];a7_0x14e9=function(){return _0x5cb2b3;};return a7_0x14e9();}function a7_0x5e23(_0x24ce96,_0x267229){_0x24ce96=_0x24ce96-0xc6;const _0x14e925=a7_0x14e9();let _0x5e2313=_0x14e925[_0x24ce96];return _0x5e2313;}import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function handleSDKError(_0x575a94,_0x41482e){const _0x4a223e=a7_0x5e23;if(_0x575a94 instanceof SDKError)console['error']('Error:\x20'+_0x575a94[_0x4a223e(0xdc)]),_0x41482e[_0x4a223e(0xcb)]&&(_0x575a94[_0x4a223e(0xde)]&&console[_0x4a223e(0xf1)](_0x4a223e(0xd7)+_0x575a94[_0x4a223e(0xde)]),_0x575a94['stack']&&(console[_0x4a223e(0xf1)]('\x0aStack\x20trace:'),console['error'](_0x575a94[_0x4a223e(0xd4)])));else throw _0x575a94;}export class ChatCommand extends BaseCommand{[a7_0x281949(0xd6)]=a7_0x281949(0xe9);[a7_0x281949(0xf8)]=a7_0x281949(0xce);[a7_0x281949(0xdb)](_0x293b50){const _0x9dccd4=a7_0x281949,_0x2a9608=_0x293b50[_0x9dccd4(0xdd)][_0x9dccd4(0xe1)]('\x20');if(!_0x2a9608)return _0x9dccd4(0xec);return undefined;}async[a7_0x281949(0xf6)](_0x46b2d8,_0x58a8b8,_0x2377a4,_0x563dad,_0x12e8e4){const _0x2c8ea4=a7_0x281949;for await(const _0x54676b of _0x46b2d8[_0x2c8ea4(0xe3)][_0x2c8ea4(0xe9)](_0x58a8b8,{'agentId':_0x2377a4,'chatId':_0x563dad})){if(_0x54676b[_0x2c8ea4(0xd0)]===_0x2c8ea4(0xeb)){const _0xb47dba=_0x54676b[_0x2c8ea4(0xf3)][_0x2c8ea4(0xdf)];saveLastChatId(_0xb47dba),_0x12e8e4&&console[_0x2c8ea4(0xf1)](_0x2c8ea4(0xe6)+_0xb47dba);}else _0x54676b[_0x2c8ea4(0xd0)]==='event'&&this[_0x2c8ea4(0xe4)](_0x54676b[_0x2c8ea4(0xf3)]);}}async[a7_0x281949(0xe2)](_0x5be5a1,_0x2c0d9a,_0x4df4d8,_0x46d1c4,_0x56ab78){const _0x14365=a7_0x281949,_0x209361=_0x2c0d9a||_0x4df4d8;if(_0x209361){const {projectName:_0x4e3fba,agentName:_0x355ae8}=parseAgentRef(_0x209361),_0x2dcba1=_0x355ae8||_0x209361,_0x1921b9=_0x355ae8?_0x4e3fba:_0x46d1c4;if(!_0x1921b9)throw new Error(_0x14365(0xea));if(_0x56ab78){const _0x41bbb1=_0x2c0d9a?_0x14365(0xc9):_0x14365(0xd5);console['error'](_0x14365(0xed)+_0x41bbb1+':\x20'+_0x1921b9+'/'+_0x2dcba1);}const _0x54458d=await withSpinner('Resolving\x20project\x20\x27'+_0x1921b9+_0x14365(0xd8),()=>_0x5be5a1['llm'][_0x14365(0xe0)](_0x1921b9),{'verbose':_0x56ab78}),_0x404ab1=await withSpinner('Resolving\x20agent\x20\x27'+_0x2dcba1+'\x27...',()=>_0x5be5a1[_0x14365(0xe3)][_0x14365(0xf5)](_0x2dcba1,_0x54458d[_0x14365(0xf3)]),{'verbose':_0x56ab78});return _0x404ab1[_0x14365(0xf3)];}else{const _0xbdf95d=_0x5be5a1['llm']['getDefaultAgent']();if(_0xbdf95d)return _0x56ab78&&console[_0x14365(0xf1)](_0x14365(0xd1)+_0xbdf95d[_0x14365(0xd6)]),_0xbdf95d['id'];const _0x3dacb7=await withSpinner('Getting\x20default\x20agent...',()=>_0x5be5a1[_0x14365(0xe3)][_0x14365(0xef)](_0x14365(0xf0),0x0),{'verbose':_0x56ab78});return _0x3dacb7[_0x14365(0xf3)]['id'];}}async['execute'](_0x8ad96){const _0x1432ed=a7_0x281949,{options:_0x4e874e,args:_0x25fd0a,tdx:_0xc550e6}=_0x8ad96,_0xcea8c4=_0x25fd0a[_0x1432ed(0xe1)]('\x20'),_0x55f1e7=_0x4e874e,_0x485de1=_0x55f1e7[_0x1432ed(0xca)],_0xbc009a=_0x55f1e7[_0x1432ed(0xda)],_0x435f9b=_0x55f1e7['llmProject'],_0x124987=_0x55f1e7['new'];try{let _0x1e1187,_0x3c9ce8;!_0x124987&&(_0x3c9ce8=loadLastChatId(),_0x3c9ce8&&_0x4e874e[_0x1432ed(0xcb)]&&console[_0x1432ed(0xf1)](_0x1432ed(0xf7)+_0x3c9ce8));(_0x124987||!_0x3c9ce8)&&(_0x1e1187=await this[_0x1432ed(0xe2)](_0xc550e6,_0x485de1,_0xbc009a,_0x435f9b,_0x4e874e[_0x1432ed(0xcb)]));try{await this[_0x1432ed(0xf6)](_0xc550e6,_0xcea8c4,_0x1e1187,_0x3c9ce8,_0x4e874e[_0x1432ed(0xcb)]);}catch(_0x554aaf){const _0x3b7ec1=_0x554aaf instanceof SDKError&&_0x554aaf[_0x1432ed(0xf2)]===ErrorCode['CHAT_NOT_FOUND']||_0x554aaf instanceof Error&&_0x554aaf[_0x1432ed(0xdc)]['includes']('404');if(_0x3b7ec1)_0x4e874e[_0x1432ed(0xcb)]&&console[_0x1432ed(0xf1)]('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x1e1187&&(_0x1e1187=await this[_0x1432ed(0xe2)](_0xc550e6,_0x485de1,_0xbc009a,_0x435f9b,_0x4e874e[_0x1432ed(0xcb)])),await this[_0x1432ed(0xf6)](_0xc550e6,_0xcea8c4,_0x1e1187,undefined,_0x4e874e[_0x1432ed(0xcb)]);else throw _0x554aaf;}return console[_0x1432ed(0xf4)](),0x0;}catch(_0x27993c){return console[_0x1432ed(0xf1)](),handleSDKError(_0x27993c,_0x4e874e),0x1;}}[a7_0x281949(0xe4)](_0x538015){const _0x21f458=a7_0x281949;if(_0x21f458(0xfa)in _0x538015)process[_0x21f458(0xd3)][_0x21f458(0xfb)](_0x538015[_0x21f458(0xfa)]);else _0x21f458(0xf1)in _0x538015&&console[_0x21f458(0xf1)](_0x21f458(0xcc)+_0x538015['error']);}}
@@ -1 +1 @@
1
- function a8_0x1de8(_0x17cabf,_0x31899e){_0x17cabf=_0x17cabf-0x125;const _0x2d955e=a8_0x2d95();let _0x1de86a=_0x2d955e[_0x17cabf];return _0x1de86a;}const a8_0x3878fc=a8_0x1de8;(function(_0x2216f1,_0x12d4bd){const _0x5c2ce5=a8_0x1de8,_0x48a1c4=_0x2216f1();while(!![]){try{const _0x47a03a=-parseInt(_0x5c2ce5(0x1b3))/0x1*(-parseInt(_0x5c2ce5(0x142))/0x2)+parseInt(_0x5c2ce5(0x148))/0x3+parseInt(_0x5c2ce5(0x197))/0x4+parseInt(_0x5c2ce5(0x18a))/0x5+-parseInt(_0x5c2ce5(0x168))/0x6*(parseInt(_0x5c2ce5(0x135))/0x7)+parseInt(_0x5c2ce5(0x167))/0x8+-parseInt(_0x5c2ce5(0x18d))/0x9*(parseInt(_0x5c2ce5(0x183))/0xa);if(_0x47a03a===_0x12d4bd)break;else _0x48a1c4['push'](_0x48a1c4['shift']());}catch(_0x1560fe){_0x48a1c4['push'](_0x48a1c4['shift']());}}}(a8_0x2d95,0x2228e));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a8_0x3a1a29 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';function a8_0x2d95(){const _0x4c24ae=['\x20already\x20configured','369180adLeyd','trim','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','9POCnHj','toString','sql-skills','tdx\x20--profile\x20','Failed\x20to\x20install\x20plugin\x20\x27','stdout','minor','originalSettings','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','1002988xTOyny','stringify','getLogPath','verbose','td-skills\x20Plugins','✓\x20Logs\x20saved\x20to\x20','add','pipe','error','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','log','tdx\x20claude\x20statusline','cwd','Claude\x20Code\x20version\x20','td-skills','message','llm','unshift','sonnet','name','✓\x20MCP\x20server\x20\x27','\x27\x20installed','\x27\x20updated','\x20is\x20too\x20old\x20(minimum:\x20','hostname','CLAUDE_CODE_NOT_FOUND','info','already\x20configured','11QrrBVi','Claude\x20Code\x20CLI\x20not\x20found','CLAUDE_CODE_UNSUPPORTED_VERSION','warn','statusline','td-docs','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','plugin','Starting\x20TD\x20LLM\x20proxy\x20server...','port','command','--transport','\x27...','Configuring\x20MCP\x20server\x20\x27','Failed\x20to\x20configure\x20marketplace\x20\x27','debug','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','13517RKfWly','mcp','getCurrent','✓\x20Logging\x20to\x20','ANTHROPIC_MODEL','data','major','Command\x20spawn\x20error:\x20','tdx-skills','site','Warning:\x20Failed\x20to\x20configure\x20','type','https://docs.treasuredata.com/mcp','49018GxUEVp','logger','\x20claude\x20statusline','ENOENT','.claude','patch','486375jcIhyv','includes','string','execute','cause','green','server','start','attributes','model','already\x20exists','fail','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','claude','Failed\x20to\x20update\x20marketplace\x20\x27','install','marketplace','✓\x20Using\x20project:\x20','ANTHROPIC_BASE_URL','ANTHROPIC_AUTH_TOKEN','Initializing...','continue','✓\x20Marketplace\x20\x27','tdx','\x20or\x20later.','\x27\x20configured','Failed\x20to\x20launch\x20Claude\x20Code:\x20','Claude\x20Code\x20version\x20check\x20failed','http://127.0.0.1:','✓\x20Settings\x20restored:\x20.claude/settings.local.json','settings.local.json','1916096wxbATo','492XOjFPq','\x20configuration\x20failed','red','stderr','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','findClaudePath','text','workflow-skills','Setup\x20failed','Command\x20failed\x20(exit\x20','statusLine','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','code','Creating\x20.claude/settings.local.json...','utf-8','Initializing\x20proxy\x20logger...','exit','logLevel','INTERNAL','INSTALLATION_FAILED','update','close','tdx-managed-proxy','127.0.0.1','stop','env','Command\x20output:\x20','6975590xWRnPQ','getOrCreateDefaultProject','Updating\x20marketplace\x20\x27','\x20meets\x20minimum\x20requirement','description','http'];a8_0x2d95=function(){return _0x4c24ae;};return a8_0x2d95();}import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION='2.0.20';function handleInstallationError(_0x50b5d7,_0x5a4588,_0x46854b,_0x366563){const _0x84fb12=a8_0x1de8;errorContains(_0x50b5d7,_0x84fb12(0x152),'already\x20installed',_0x84fb12(0x1b2))?(_0x46854b[_0x84fb12(0x16e)]='✓\x20'+_0x5a4588+_0x84fb12(0x189),_0x366563?.[_0x84fb12(0x1b1)](_0x5a4588+_0x84fb12(0x189)),_0x50b5d7 instanceof SDKError&&_0x50b5d7[_0x84fb12(0x14c)]&&_0x366563?.['debug'](_0x84fb12(0x182)+_0x50b5d7[_0x84fb12(0x14c)]['message'])):(_0x46854b[_0x84fb12(0x127)](_0x84fb12(0x13f)+_0x5a4588),_0x366563?.[_0x84fb12(0x19f)](_0x5a4588+_0x84fb12(0x169),_0x50b5d7));}export function parseVersion(_0x50759d){const _0x5192d3=a8_0x1de8,_0x48505e=_0x50759d[_0x5192d3(0x18b)]()['match'](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x48505e)return null;return{'major':parseInt(_0x48505e[0x1],0xa),'minor':parseInt(_0x48505e[0x2],0xa),'patch':parseInt(_0x48505e[0x3],0xa)};}export function compareVersions(_0x1c54ce,_0x12edac){const _0x435b96=a8_0x1de8;if(_0x1c54ce['major']!==_0x12edac[_0x435b96(0x13b)])return _0x1c54ce['major']-_0x12edac['major'];if(_0x1c54ce[_0x435b96(0x193)]!==_0x12edac['minor'])return _0x1c54ce['minor']-_0x12edac[_0x435b96(0x193)];return _0x1c54ce[_0x435b96(0x147)]-_0x12edac[_0x435b96(0x147)];}async function checkClaudeVersion(_0x394c2a,_0x2b610a){const _0x56c6be=a8_0x1de8;_0x2b610a?.[_0x56c6be(0x133)](_0x56c6be(0x173)+_0x394c2a+')');const _0x547799=await executeClaudeCommand(['--version'],undefined,_0x2b610a),_0x418a05=parseVersion(_0x547799);if(!_0x418a05){_0x2b610a?.[_0x56c6be(0x127)](_0x56c6be(0x134)+_0x547799);return;}const _0x417d07=_0x418a05[_0x56c6be(0x13b)]+'.'+_0x418a05[_0x56c6be(0x193)]+'.'+_0x418a05[_0x56c6be(0x147)],_0x5a9236=parseVersion(_0x394c2a);if(!_0x5a9236){_0x2b610a?.[_0x56c6be(0x127)]('Invalid\x20minimum\x20version\x20format:\x20'+_0x394c2a);return;}if(compareVersions(_0x418a05,_0x5a9236)<0x0){_0x2b610a?.[_0x56c6be(0x19f)](_0x56c6be(0x1a4)+_0x417d07+_0x56c6be(0x1ae)+_0x394c2a+')');throw new SDKError(ErrorCode[_0x56c6be(0x126)],_0x56c6be(0x1a4)+_0x417d07+_0x56c6be(0x16c)+_0x394c2a+_0x56c6be(0x160),undefined,{'helpText':_0x56c6be(0x18c)});}_0x2b610a?.['debug'](_0x56c6be(0x1a4)+_0x417d07+_0x56c6be(0x186));}async function executeClaudeCommand(_0x14d836,_0x500daf,_0x417d4f){const _0x39b419=a8_0x1de8;return _0x417d4f?.[_0x39b419(0x1b1)]('Executing:\x20claude\x20'+_0x14d836['join']('\x20')),new Promise((_0x3c2b65,_0x548cbf)=>{const _0x57f53f=_0x39b419,_0x2c9b15=spawn(_0x57f53f(0x155),_0x14d836,{'stdio':_0x57f53f(0x19e)});let _0x3f926f='',_0x2d9c10='';_0x2c9b15[_0x57f53f(0x192)]['on'](_0x57f53f(0x13a),_0xf98175=>{const _0xe7d2e9=_0x57f53f;_0x3f926f+=_0xf98175[_0xe7d2e9(0x18e)]();}),_0x2c9b15[_0x57f53f(0x16b)]['on'](_0x57f53f(0x13a),_0x2cc0df=>{const _0x332e1a=_0x57f53f;_0x2d9c10+=_0x2cc0df[_0x332e1a(0x18e)]();}),_0x2c9b15['on'](_0x57f53f(0x19f),_0x18648a=>{const _0x399bf0=_0x57f53f;_0x18648a[_0x399bf0(0x174)]===_0x399bf0(0x145)?(_0x417d4f?.[_0x399bf0(0x19f)](_0x399bf0(0x125)),_0x548cbf(new SDKError(ErrorCode[_0x399bf0(0x1b0)],_0x399bf0(0x125),_0x18648a,{'helpText':_0x399bf0(0x196)}))):(_0x417d4f?.[_0x399bf0(0x19f)](_0x399bf0(0x13c)+_0x18648a[_0x399bf0(0x1a6)]),_0x548cbf(new SDKError(ErrorCode[_0x399bf0(0x17a)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x18648a[_0x399bf0(0x1a6)],_0x18648a)));}),_0x2c9b15['on'](_0x57f53f(0x178),_0x33c8eb=>{const _0x45e9df=_0x57f53f;if(_0x33c8eb===0x0)_0x3c2b65(_0x3f926f);else _0x500daf?(_0x417d4f?.[_0x45e9df(0x19f)](_0x45e9df(0x171)+_0x33c8eb+'):\x20claude\x20'+_0x14d836['join']('\x20')),_0x548cbf(new SDKError(ErrorCode[_0x45e9df(0x17b)],_0x500daf,new Error(_0x2d9c10)))):_0x3c2b65('');});});}async function ensureMcpServer(_0x212e54,_0x20d4a0,_0x4bf01f,_0xadf037,_0xa78f93){const _0x3c6f3e=a8_0x1de8;_0xadf037['text']=_0x3c6f3e(0x131)+_0x212e54+_0x3c6f3e(0x130),await executeClaudeCommand([_0x3c6f3e(0x136),_0x3c6f3e(0x19d),_0x212e54,_0x20d4a0,_0x3c6f3e(0x12f),_0x4bf01f],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0x212e54+'\x27',_0xa78f93),_0xadf037[_0x3c6f3e(0x16e)]=_0x3c6f3e(0x1ab)+_0x212e54+_0x3c6f3e(0x161);}async function ensureMarketplace(_0x278144,_0x87b938,_0x28e99c,_0x48cf1e){const _0x355f21=a8_0x1de8;_0x28e99c['text']='Configuring\x20marketplace\x20\x27'+_0x278144+'\x27...',await executeClaudeCommand([_0x355f21(0x12b),_0x355f21(0x158),_0x355f21(0x19d),_0x87b938],_0x355f21(0x132)+_0x278144+'\x27',_0x48cf1e),_0x28e99c[_0x355f21(0x16e)]=_0x355f21(0x15e)+_0x278144+_0x355f21(0x161);}async function updateMarketplace(_0x24e2c8,_0x2cf1a6,_0x3300bc){const _0x356d20=a8_0x1de8;_0x2cf1a6[_0x356d20(0x16e)]=_0x356d20(0x185)+_0x24e2c8+'\x27...',await executeClaudeCommand([_0x356d20(0x12b),_0x356d20(0x158),_0x356d20(0x17c)],_0x356d20(0x156)+_0x24e2c8+'\x27',_0x3300bc),_0x2cf1a6['text']='✓\x20Marketplace\x20\x27'+_0x24e2c8+_0x356d20(0x1ad);}async function ensurePlugin(_0x5ed016,_0x1195ec,_0x252396,_0x1c6211){const _0x585c98=a8_0x1de8;_0x252396['text']='Installing\x20plugin\x20\x27'+_0x5ed016+_0x585c98(0x130),await executeClaudeCommand([_0x585c98(0x12b),_0x585c98(0x157),_0x5ed016+'@'+_0x1195ec],_0x585c98(0x191)+_0x5ed016+'\x27',_0x1c6211),_0x252396[_0x585c98(0x16e)]='✓\x20Plugin\x20\x27'+_0x5ed016+_0x585c98(0x1ac);}async function createClaudeSettings(_0x1e7698,_0x29ed6a=a8_0x3878fc(0x1a9),_0x401571){const _0x5a6c15=a8_0x3878fc,_0x140e24=join(process['cwd'](),_0x5a6c15(0x146)),_0x49695c=join(_0x140e24,_0x5a6c15(0x166));await mkdir(_0x140e24,{'recursive':!![]});let _0x4f1fdb={};if(existsSync(_0x49695c))try{const _0x5562e9=await readFile(_0x49695c,_0x5a6c15(0x176));_0x4f1fdb=JSON['parse'](_0x5562e9);}catch{_0x4f1fdb={};}const _0x2d7118=_0x4f1fdb[_0x5a6c15(0x181)]||{},_0x44964a={'ANTHROPIC_BASE_URL':_0x2d7118[_0x5a6c15(0x15a)],'ANTHROPIC_MODEL':_0x2d7118[_0x5a6c15(0x139)],'ANTHROPIC_AUTH_TOKEN':_0x2d7118[_0x5a6c15(0x15b)],'statusLine':_0x4f1fdb[_0x5a6c15(0x172)]},_0x3270a1={..._0x4f1fdb,'env':{..._0x2d7118,'ANTHROPIC_BASE_URL':_0x5a6c15(0x164)+_0x1e7698,'ANTHROPIC_MODEL':_0x29ed6a,'ANTHROPIC_AUTH_TOKEN':'tdx-managed-proxy'},'statusLine':{'type':_0x5a6c15(0x12e),'command':_0x401571?_0x5a6c15(0x190)+_0x401571+_0x5a6c15(0x144):_0x5a6c15(0x1a2)}};return await writeFile(_0x49695c,JSON[_0x5a6c15(0x198)](_0x3270a1,null,0x2)+'\x0a'),_0x44964a;}async function restoreClaudeSettings(_0x3622d5){const _0x3171aa=a8_0x3878fc,_0x301b9b=join(process[_0x3171aa(0x1a3)](),_0x3171aa(0x146)),_0x26ca44=join(_0x301b9b,'settings.local.json');if(!existsSync(_0x26ca44))return;try{const _0x580763=await readFile(_0x26ca44,_0x3171aa(0x176)),_0x5046fb=JSON['parse'](_0x580763),_0x202d21=_0x5046fb[_0x3171aa(0x181)]||{},_0xfb46f2=_0x202d21[_0x3171aa(0x15a)],_0x3b77f1=((()=>{const _0x321a4a=_0x3171aa;if(typeof _0xfb46f2!=='string')return![];try{const _0x2bbfe2=new URL(_0xfb46f2);return _0x2bbfe2['hostname']==='localhost'||_0x2bbfe2[_0x321a4a(0x1af)]===_0x321a4a(0x17f);}catch{return![];}})());_0x3b77f1?(delete _0x202d21[_0x3171aa(0x15a)],delete _0x202d21['ANTHROPIC_MODEL'],delete _0x202d21['ANTHROPIC_AUTH_TOKEN']):(_0x3622d5['ANTHROPIC_BASE_URL']!==undefined?_0x202d21[_0x3171aa(0x15a)]=_0x3622d5[_0x3171aa(0x15a)]:delete _0x202d21[_0x3171aa(0x15a)],_0x3622d5[_0x3171aa(0x139)]!==undefined?_0x202d21[_0x3171aa(0x139)]=_0x3622d5['ANTHROPIC_MODEL']:delete _0x202d21[_0x3171aa(0x139)],_0x3622d5[_0x3171aa(0x15b)]!==undefined?_0x202d21['ANTHROPIC_AUTH_TOKEN']=_0x3622d5[_0x3171aa(0x15b)]:delete _0x202d21['ANTHROPIC_AUTH_TOKEN']);const _0x1d83c7=_0x5046fb[_0x3171aa(0x172)],_0x392bd8=((()=>{const _0x3c676b=_0x3171aa;if(!_0x1d83c7||typeof _0x1d83c7!=='object')return![];if(_0x1d83c7[_0x3c676b(0x140)]!==_0x3c676b(0x12e))return![];if(typeof _0x1d83c7[_0x3c676b(0x12e)]!==_0x3c676b(0x14a))return![];return _0x1d83c7[_0x3c676b(0x12e)][_0x3c676b(0x149)](_0x3c676b(0x15f))&&_0x1d83c7[_0x3c676b(0x12e)][_0x3c676b(0x149)](_0x3c676b(0x128));})());if(_0x392bd8)delete _0x5046fb[_0x3171aa(0x172)];else _0x3622d5[_0x3171aa(0x172)]!==undefined?_0x5046fb[_0x3171aa(0x172)]=_0x3622d5[_0x3171aa(0x172)]:delete _0x5046fb[_0x3171aa(0x172)];_0x5046fb[_0x3171aa(0x181)]=_0x202d21,await writeFile(_0x26ca44,JSON[_0x3171aa(0x198)](_0x5046fb,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a8_0x3878fc(0x1aa)]='claude';[a8_0x3878fc(0x187)]=a8_0x3878fc(0x154);['server'];[a8_0x3878fc(0x194)];[a8_0x3878fc(0x143)];[a8_0x3878fc(0x12d)];async[a8_0x3878fc(0x14b)](_0x208612){const _0x36e5a1=a8_0x3878fc,{tdx:_0x4a5270,options:_0x35be54,args:_0x224c2a}=_0x208612;try{const _0x26871e=_0x35be54,_0x3b9394=_0x26871e[_0x36e5a1(0x151)]||_0x36e5a1(0x1a9),_0x2c3826=_0x26871e['proxy']===![],_0x5da9a0=_0x26871e[_0x36e5a1(0x15d)]===!![],_0x77a0d8=_0x26871e['resume']===!![],_0x1f1357=[..._0x224c2a];if(_0x5da9a0)_0x1f1357[_0x36e5a1(0x1a8)]('-c');else _0x77a0d8&&_0x1f1357['unshift']('-r');const _0x4b5946=createCommandSpinner(_0x36e5a1(0x15c),{'verbose':_0x35be54[_0x36e5a1(0x19a)]});_0x4b5946[_0x36e5a1(0x14f)]();try{if(!_0x2c3826){_0x4b5946[_0x36e5a1(0x16e)]='Finding\x20available\x20port...',this[_0x36e5a1(0x12d)]=await findAvailablePort(0xfa0),_0x4b5946[_0x36e5a1(0x16e)]='✓\x20Port\x20'+this[_0x36e5a1(0x12d)],_0x4b5946[_0x36e5a1(0x16e)]='Setting\x20up\x20project...';const _0x12295d=await _0x4a5270[_0x36e5a1(0x1a7)][_0x36e5a1(0x184)](),_0x373be1=_0x12295d['id'];_0x4b5946[_0x36e5a1(0x16e)]=_0x36e5a1(0x159)+_0x12295d[_0x36e5a1(0x150)][_0x36e5a1(0x1aa)];const _0xbc8ff2=_0x35be54['profile'];try{const _0x1daad8=await _0x4a5270['user'][_0x36e5a1(0x137)]();_0x1daad8['account_id']&&writeCachedAccountInfo(_0x35be54[_0x36e5a1(0x13e)],_0x1daad8['account_id'],_0xbc8ff2);}catch{}_0x4b5946['text']=_0x36e5a1(0x177),this[_0x36e5a1(0x143)]=new TDXLogger(_0x35be54[_0x36e5a1(0x179)],!![]),await this['logger']['init']();const _0x3924e3=this['logger'][_0x36e5a1(0x199)]();_0x4b5946[_0x36e5a1(0x16e)]=_0x36e5a1(0x138)+_0x3924e3,_0x4b5946[_0x36e5a1(0x16e)]=_0x36e5a1(0x12c),this[_0x36e5a1(0x14e)]=new ProxyServer({'port':this[_0x36e5a1(0x12d)],'projectId':_0x373be1,'tdx':_0x4a5270,'logger':this[_0x36e5a1(0x143)],'site':_0x35be54[_0x36e5a1(0x13e)]}),await this[_0x36e5a1(0x14e)][_0x36e5a1(0x14f)](),_0x4b5946[_0x36e5a1(0x16e)]=_0x36e5a1(0x195)+this[_0x36e5a1(0x12d)],_0x4b5946[_0x36e5a1(0x16e)]=_0x36e5a1(0x175),this[_0x36e5a1(0x194)]=await createClaudeSettings(this[_0x36e5a1(0x12d)],_0x3b9394,_0xbc8ff2),_0x4b5946[_0x36e5a1(0x16e)]='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x4b5946[_0x36e5a1(0x16e)]=_0x36e5a1(0x12a);try{_0x4b5946[_0x36e5a1(0x16e)]='Checking\x20Claude\x20Code\x20version...',await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x36e5a1(0x143)]),_0x4b5946[_0x36e5a1(0x16e)]='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x26b3be){_0x4b5946['fail'](_0x36e5a1(0x163));throw _0x26b3be;}try{await ensureMcpServer(_0x36e5a1(0x129),_0x36e5a1(0x141),_0x36e5a1(0x188),_0x4b5946,this[_0x36e5a1(0x143)]);}catch(_0x3805ed){handleInstallationError(_0x3805ed,'TD\x20Docs\x20MCP\x20Server',_0x4b5946,this[_0x36e5a1(0x143)]);}try{await ensureMarketplace(_0x36e5a1(0x1a5),'https://github.com/treasure-data/td-skills',_0x4b5946,this[_0x36e5a1(0x143)]),await updateMarketplace(_0x36e5a1(0x1a5),_0x4b5946,this[_0x36e5a1(0x143)]),await ensurePlugin(_0x36e5a1(0x18f),_0x36e5a1(0x1a5),_0x4b5946,this[_0x36e5a1(0x143)]),await ensurePlugin(_0x36e5a1(0x16f),_0x36e5a1(0x1a5),_0x4b5946,this[_0x36e5a1(0x143)]),await ensurePlugin(_0x36e5a1(0x13d),_0x36e5a1(0x1a5),_0x4b5946,this[_0x36e5a1(0x143)]);}catch(_0x3f3d29){handleInstallationError(_0x3f3d29,_0x36e5a1(0x19b),_0x4b5946,this['logger']);}_0x4b5946['stop']();}catch(_0x17007e){_0x4b5946[_0x36e5a1(0x153)](_0x36e5a1(0x170));throw _0x17007e;}const _0x2696ee=await this[_0x36e5a1(0x16d)]();if(!_0x2696ee)throw new SDKError(ErrorCode[_0x36e5a1(0x1b0)],_0x36e5a1(0x125),undefined,{'helpText':_0x36e5a1(0x196)});const _0x2db084={...process[_0x36e5a1(0x181)]};!_0x2c3826&&(_0x2db084[_0x36e5a1(0x15a)]=_0x36e5a1(0x164)+this['port'],_0x2db084['ANTHROPIC_MODEL']=_0x3b9394,_0x2db084[_0x36e5a1(0x15b)]=_0x36e5a1(0x17e));const _0x197084=spawn(_0x2696ee,_0x1f1357,{'stdio':'inherit','env':_0x2db084}),_0x17eb6e=await new Promise(_0x5b1c08=>{const _0x2ef9f5=_0x36e5a1;_0x197084['on'](_0x2ef9f5(0x178),_0x3b328c=>{_0x5b1c08(_0x3b328c||0x0);}),_0x197084['on'](_0x2ef9f5(0x19f),_0x3ad684=>{const _0x46467c=_0x2ef9f5;console[_0x46467c(0x19f)](a8_0x3a1a29[_0x46467c(0x16a)](_0x46467c(0x162)+_0x3ad684['message'])),_0x5b1c08(0x1);});});this['server']&&(await this['server'][_0x36e5a1(0x180)](),console['log'](a8_0x3a1a29[_0x36e5a1(0x14d)](_0x36e5a1(0x1a0))));if(this[_0x36e5a1(0x143)]){await this[_0x36e5a1(0x143)]['close']();const _0x2ab28d=this['logger'][_0x36e5a1(0x199)]();console[_0x36e5a1(0x1a1)](a8_0x3a1a29['green'](_0x36e5a1(0x19c)+_0x2ab28d));}return this[_0x36e5a1(0x194)]&&(await restoreClaudeSettings(this['originalSettings']),console['log'](a8_0x3a1a29[_0x36e5a1(0x14d)](_0x36e5a1(0x165)))),_0x17eb6e;}catch(_0x47d68f){this[_0x36e5a1(0x14e)]&&await this['server']['stop']();this[_0x36e5a1(0x143)]&&await this[_0x36e5a1(0x143)][_0x36e5a1(0x17d)]();this['originalSettings']&&await restoreClaudeSettings(this[_0x36e5a1(0x194)]);throw _0x47d68f;}}async[a8_0x3878fc(0x16d)](){return new Promise(_0x2d97a7=>{const _0x361789=a8_0x1de8,_0x4e90de=spawn('which',[_0x361789(0x155)]);let _0x4911d9='';_0x4e90de[_0x361789(0x192)]['on']('data',_0x439f88=>{const _0x13dbf0=_0x361789;_0x4911d9+=_0x439f88[_0x13dbf0(0x18e)]();}),_0x4e90de['on']('exit',_0x44bbc8=>{const _0x3a8087=_0x361789;_0x44bbc8===0x0&&_0x4911d9[_0x3a8087(0x18b)]()?_0x2d97a7(_0x4911d9[_0x3a8087(0x18b)]()):_0x2d97a7(null);});});}}
1
+ const a8_0x36da8b=a8_0x2075;(function(_0x23792f,_0x22b668){const _0x4a6ce1=a8_0x2075,_0x12dda1=_0x23792f();while(!![]){try{const _0x15694f=-parseInt(_0x4a6ce1(0xb2))/0x1+-parseInt(_0x4a6ce1(0xfe))/0x2*(parseInt(_0x4a6ce1(0xe9))/0x3)+parseInt(_0x4a6ce1(0xbc))/0x4+parseInt(_0x4a6ce1(0x135))/0x5+parseInt(_0x4a6ce1(0xd5))/0x6*(parseInt(_0x4a6ce1(0xe4))/0x7)+parseInt(_0x4a6ce1(0x127))/0x8+-parseInt(_0x4a6ce1(0x12d))/0x9;if(_0x15694f===_0x22b668)break;else _0x12dda1['push'](_0x12dda1['shift']());}catch(_0x12fbfd){_0x12dda1['push'](_0x12dda1['shift']());}}}(a8_0x583d,0xa44a0));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a8_0x4afd42 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION='2.0.20';function handleInstallationError(_0x2aa088,_0x11c8c1,_0x3a9af1,_0x549cbd){const _0x239012=a8_0x2075;errorContains(_0x2aa088,_0x239012(0x10d),_0x239012(0xc1),_0x239012(0xd0))?(_0x3a9af1[_0x239012(0x133)]='✓\x20'+_0x11c8c1+_0x239012(0xb8),_0x549cbd?.[_0x239012(0xb6)](_0x11c8c1+'\x20already\x20configured'),_0x2aa088 instanceof SDKError&&_0x2aa088['cause']&&_0x549cbd?.[_0x239012(0x120)](_0x239012(0xf0)+_0x2aa088[_0x239012(0xf5)][_0x239012(0x11e)])):(_0x3a9af1['warn'](_0x239012(0x106)+_0x11c8c1),_0x549cbd?.[_0x239012(0x103)](_0x11c8c1+_0x239012(0x136),_0x2aa088));}function a8_0x2075(_0x349132,_0x401f07){_0x349132=_0x349132-0xab;const _0x583d74=a8_0x583d();let _0x207571=_0x583d74[_0x349132];return _0x207571;}export function parseVersion(_0x403fa4){const _0x41ab90=a8_0x2075,_0x4e30a8=_0x403fa4[_0x41ab90(0x114)]()['match'](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x4e30a8)return null;return{'major':parseInt(_0x4e30a8[0x1],0xa),'minor':parseInt(_0x4e30a8[0x2],0xa),'patch':parseInt(_0x4e30a8[0x3],0xa)};}export function compareVersions(_0x2cab50,_0x23c727){const _0x201464=a8_0x2075;if(_0x2cab50[_0x201464(0xaf)]!==_0x23c727['major'])return _0x2cab50[_0x201464(0xaf)]-_0x23c727['major'];if(_0x2cab50[_0x201464(0x123)]!==_0x23c727['minor'])return _0x2cab50['minor']-_0x23c727[_0x201464(0x123)];return _0x2cab50[_0x201464(0xd6)]-_0x23c727[_0x201464(0xd6)];}async function checkClaudeVersion(_0x3f4085,_0x5519cd){const _0x3e2853=a8_0x2075;_0x5519cd?.['debug'](_0x3e2853(0xcc)+_0x3f4085+')');const _0x509fcd=await executeClaudeCommand([_0x3e2853(0xe0)],undefined,_0x5519cd),_0x2c4f7c=parseVersion(_0x509fcd);if(!_0x2c4f7c){_0x5519cd?.[_0x3e2853(0xe3)](_0x3e2853(0x124)+_0x509fcd);return;}const _0x408d2f=_0x2c4f7c[_0x3e2853(0xaf)]+'.'+_0x2c4f7c['minor']+'.'+_0x2c4f7c[_0x3e2853(0xd6)],_0x46d96f=parseVersion(_0x3f4085);if(!_0x46d96f){_0x5519cd?.[_0x3e2853(0xe3)](_0x3e2853(0x109)+_0x3f4085);return;}if(compareVersions(_0x2c4f7c,_0x46d96f)<0x0){_0x5519cd?.[_0x3e2853(0x103)]('Claude\x20Code\x20version\x20'+_0x408d2f+_0x3e2853(0xde)+_0x3f4085+')');throw new SDKError(ErrorCode['CLAUDE_CODE_UNSUPPORTED_VERSION'],_0x3e2853(0x12a)+_0x408d2f+_0x3e2853(0x11a)+_0x3f4085+_0x3e2853(0x10f),undefined,{'helpText':_0x3e2853(0xbe)});}_0x5519cd?.[_0x3e2853(0x120)](_0x3e2853(0x12a)+_0x408d2f+'\x20meets\x20minimum\x20requirement');}async function executeClaudeCommand(_0x4115b9,_0x2a73e0,_0x5e5009){const _0x37a434=a8_0x2075;return _0x5e5009?.[_0x37a434(0xb6)](_0x37a434(0xe6)+_0x4115b9['join']('\x20')),new Promise((_0x208377,_0xbad151)=>{const _0x437b13=_0x37a434,_0x195343=spawn(_0x437b13(0x116),_0x4115b9,{'stdio':_0x437b13(0x105)});let _0x1f585a='',_0xda1c48='';_0x195343['stdout']['on'](_0x437b13(0xad),_0x2d633d=>{const _0xbf76d2=_0x437b13;_0x1f585a+=_0x2d633d[_0xbf76d2(0x12c)]();}),_0x195343['stderr']['on'](_0x437b13(0xad),_0x5e2a3c=>{const _0x4779f6=_0x437b13;_0xda1c48+=_0x5e2a3c[_0x4779f6(0x12c)]();}),_0x195343['on'](_0x437b13(0x103),_0x5de48c=>{const _0x514c4e=_0x437b13;_0x5de48c[_0x514c4e(0x12e)]===_0x514c4e(0xc6)?(_0x5e5009?.[_0x514c4e(0x103)]('Claude\x20Code\x20CLI\x20not\x20found'),_0xbad151(new SDKError(ErrorCode[_0x514c4e(0xe2)],_0x514c4e(0xf9),_0x5de48c,{'helpText':_0x514c4e(0xeb)}))):(_0x5e5009?.[_0x514c4e(0x103)](_0x514c4e(0xb0)+_0x5de48c[_0x514c4e(0x11e)]),_0xbad151(new SDKError(ErrorCode[_0x514c4e(0xda)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x5de48c['message'],_0x5de48c)));}),_0x195343['on']('exit',_0x4e76f3=>{const _0x4085c4=_0x437b13;if(_0x4e76f3===0x0)_0x208377(_0x1f585a);else _0x2a73e0?(_0x5e5009?.[_0x4085c4(0x103)](_0x4085c4(0x11d)+_0x4e76f3+_0x4085c4(0xe5)+_0x4115b9['join']('\x20')),_0xbad151(new SDKError(ErrorCode[_0x4085c4(0xc5)],_0x2a73e0,new Error(_0xda1c48)))):_0x208377('');});});}async function ensureMcpServer(_0x11b848,_0x1bf8d6,_0x4eb3f2,_0x41c7ac,_0x4fcec9){const _0x29cb35=a8_0x2075;_0x41c7ac[_0x29cb35(0x133)]=_0x29cb35(0xb7)+_0x11b848+_0x29cb35(0xf2),await executeClaudeCommand([_0x29cb35(0x10b),_0x29cb35(0xd7),_0x11b848,_0x1bf8d6,_0x29cb35(0xbf),_0x4eb3f2],_0x29cb35(0xba)+_0x11b848+'\x27',_0x4fcec9),_0x41c7ac[_0x29cb35(0x133)]='✓\x20MCP\x20server\x20\x27'+_0x11b848+'\x27\x20configured';}async function ensureMarketplace(_0x492018,_0x32add5,_0x3daf74,_0x2b47b3){const _0x5f6078=a8_0x2075;_0x3daf74['text']=_0x5f6078(0xd9)+_0x492018+'\x27...',await executeClaudeCommand([_0x5f6078(0xfa),_0x5f6078(0xce),_0x5f6078(0xd7),_0x32add5],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x492018+'\x27',_0x2b47b3),_0x3daf74[_0x5f6078(0x133)]=_0x5f6078(0xfc)+_0x492018+'\x27\x20configured';}async function updateMarketplace(_0x147d2b,_0x4f1474,_0x2af7c0){const _0x162bc3=a8_0x2075;_0x4f1474[_0x162bc3(0x133)]='Updating\x20marketplace\x20\x27'+_0x147d2b+_0x162bc3(0xf2),await executeClaudeCommand([_0x162bc3(0xfa),'marketplace',_0x162bc3(0x11b)],_0x162bc3(0xb4)+_0x147d2b+'\x27',_0x2af7c0),_0x4f1474[_0x162bc3(0x133)]=_0x162bc3(0xfc)+_0x147d2b+_0x162bc3(0x130);}async function ensurePlugin(_0x3e06ef,_0x3fc010,_0x28ac4a,_0x4d8453){const _0x412895=a8_0x2075;_0x28ac4a[_0x412895(0x133)]='Installing\x20plugin\x20\x27'+_0x3e06ef+_0x412895(0xf2),await executeClaudeCommand([_0x412895(0xfa),'install',_0x3e06ef+'@'+_0x3fc010],_0x412895(0xe8)+_0x3e06ef+'\x27',_0x4d8453),_0x28ac4a[_0x412895(0x133)]=_0x412895(0xc0)+_0x3e06ef+_0x412895(0x10a);}function a8_0x583d(){const _0x3f90d0=['red','data','stdout','major','Command\x20spawn\x20error:\x20','td-docs','333191cHwKAk','tdx\x20--profile\x20','Failed\x20to\x20update\x20marketplace\x20\x27','getLogPath','info','Configuring\x20MCP\x20server\x20\x27','\x20already\x20configured','llm','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','which','4502760TVvDRF','tdx','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','--transport','✓\x20Plugin\x20\x27','already\x20installed','tdx\x20claude\x20statusline','site','✓\x20Using\x20project:\x20','INSTALLATION_FAILED','ENOENT','profile','stringify','sql-skills','tdx-managed-proxy','env','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','log','marketplace','fail','already\x20configured','originalSettings','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','settings.local.json','type','323496ODeaqr','patch','add','ANTHROPIC_AUTH_TOKEN','Configuring\x20marketplace\x20\x27','INTERNAL','getOrCreateDefaultProject','Failed\x20to\x20launch\x20Claude\x20Code:\x20','tdx-skills','\x20is\x20too\x20old\x20(minimum:\x20','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','--version','exit','CLAUDE_CODE_NOT_FOUND','warn','154uyELSz','):\x20claude\x20','Executing:\x20claude\x20','statusLine','Failed\x20to\x20install\x20plugin\x20\x27','831297aXPiEW','server','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','http://127.0.0.1:','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','parse','execute','Command\x20output:\x20','✓\x20Logs\x20saved\x20to\x20','\x27...','Finding\x20available\x20port...','workflow-skills','cause','Claude\x20Code\x20version\x20check\x20failed','object','name','Claude\x20Code\x20CLI\x20not\x20found','plugin','green','✓\x20Marketplace\x20\x27','start','2RGXazT','td-skills','ANTHROPIC_BASE_URL','https://docs.treasuredata.com/mcp','logLevel','error','Creating\x20.claude/settings.local.json...','pipe','Warning:\x20Failed\x20to\x20configure\x20','127.0.0.1','http','Invalid\x20minimum\x20version\x20format:\x20','\x27\x20installed','mcp','user','already\x20exists','close','\x20or\x20later.','ANTHROPIC_MODEL','statusline','unshift','hostname','trim','account_id','claude','Checking\x20Claude\x20Code\x20version...','logger','attributes','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','update','.claude','Command\x20failed\x20(exit\x20','message','stop','debug','continue','✓\x20Logging\x20to\x20','minor','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','description','cwd','7817832WyQONc','model','port','Claude\x20Code\x20version\x20','\x20claude\x20statusline','toString','23824179GWMbJL','code','string','\x27\x20updated','command','includes','text','Starting\x20TD\x20LLM\x20proxy\x20server...','3206390grymJn','\x20configuration\x20failed','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','Initializing...'];a8_0x583d=function(){return _0x3f90d0;};return a8_0x583d();}async function createClaudeSettings(_0x1bd636,_0x46c70c='sonnet',_0x4bff41){const _0x2b8009=a8_0x2075,_0x1617f0=join(process[_0x2b8009(0x126)](),'.claude'),_0x4028b1=join(_0x1617f0,_0x2b8009(0xd3));await mkdir(_0x1617f0,{'recursive':!![]});let _0x4789a1={};if(existsSync(_0x4028b1))try{const _0x1a5ed7=await readFile(_0x4028b1,'utf-8');_0x4789a1=JSON[_0x2b8009(0xee)](_0x1a5ed7);}catch{_0x4789a1={};}const _0x1b4e8a=_0x4789a1[_0x2b8009(0xcb)]||{},_0x56df38={'ANTHROPIC_BASE_URL':_0x1b4e8a['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0x1b4e8a[_0x2b8009(0x110)],'ANTHROPIC_AUTH_TOKEN':_0x1b4e8a[_0x2b8009(0xd8)],'statusLine':_0x4789a1['statusLine']},_0x2864d9={..._0x4789a1,'env':{..._0x1b4e8a,'ANTHROPIC_BASE_URL':_0x2b8009(0xec)+_0x1bd636,'ANTHROPIC_MODEL':_0x46c70c,'ANTHROPIC_AUTH_TOKEN':_0x2b8009(0xca)},'statusLine':{'type':_0x2b8009(0x131),'command':_0x4bff41?_0x2b8009(0xb3)+_0x4bff41+_0x2b8009(0x12b):_0x2b8009(0xc2)}};return await writeFile(_0x4028b1,JSON[_0x2b8009(0xc8)](_0x2864d9,null,0x2)+'\x0a'),_0x56df38;}async function restoreClaudeSettings(_0x44091f){const _0x21e4db=a8_0x2075,_0x2df92c=join(process[_0x21e4db(0x126)](),_0x21e4db(0x11c)),_0x2fcdcc=join(_0x2df92c,_0x21e4db(0xd3));if(!existsSync(_0x2fcdcc))return;try{const _0x510b06=await readFile(_0x2fcdcc,'utf-8'),_0x3e1f4c=JSON[_0x21e4db(0xee)](_0x510b06),_0x622451=_0x3e1f4c['env']||{},_0xc430b4=_0x622451[_0x21e4db(0x100)],_0x3d62d9=((()=>{const _0x4782c7=_0x21e4db;if(typeof _0xc430b4!==_0x4782c7(0x12f))return![];try{const _0x3be002=new URL(_0xc430b4);return _0x3be002[_0x4782c7(0x113)]==='localhost'||_0x3be002[_0x4782c7(0x113)]===_0x4782c7(0x107);}catch{return![];}})());_0x3d62d9?(delete _0x622451[_0x21e4db(0x100)],delete _0x622451['ANTHROPIC_MODEL'],delete _0x622451['ANTHROPIC_AUTH_TOKEN']):(_0x44091f['ANTHROPIC_BASE_URL']!==undefined?_0x622451['ANTHROPIC_BASE_URL']=_0x44091f[_0x21e4db(0x100)]:delete _0x622451[_0x21e4db(0x100)],_0x44091f[_0x21e4db(0x110)]!==undefined?_0x622451['ANTHROPIC_MODEL']=_0x44091f[_0x21e4db(0x110)]:delete _0x622451[_0x21e4db(0x110)],_0x44091f[_0x21e4db(0xd8)]!==undefined?_0x622451[_0x21e4db(0xd8)]=_0x44091f['ANTHROPIC_AUTH_TOKEN']:delete _0x622451[_0x21e4db(0xd8)]);const _0x505417=_0x3e1f4c[_0x21e4db(0xe7)],_0x5bc6a1=((()=>{const _0x5a9fd9=_0x21e4db;if(!_0x505417||typeof _0x505417!==_0x5a9fd9(0xf7))return![];if(_0x505417[_0x5a9fd9(0xd4)]!==_0x5a9fd9(0x131))return![];if(typeof _0x505417['command']!==_0x5a9fd9(0x12f))return![];return _0x505417['command'][_0x5a9fd9(0x132)](_0x5a9fd9(0xbd))&&_0x505417[_0x5a9fd9(0x131)][_0x5a9fd9(0x132)](_0x5a9fd9(0x111));})());if(_0x5bc6a1)delete _0x3e1f4c[_0x21e4db(0xe7)];else _0x44091f['statusLine']!==undefined?_0x3e1f4c['statusLine']=_0x44091f['statusLine']:delete _0x3e1f4c[_0x21e4db(0xe7)];_0x3e1f4c['env']=_0x622451,await writeFile(_0x2fcdcc,JSON[_0x21e4db(0xc8)](_0x3e1f4c,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{['name']=a8_0x36da8b(0x116);[a8_0x36da8b(0x125)]=a8_0x36da8b(0xed);['server'];['originalSettings'];[a8_0x36da8b(0x118)];[a8_0x36da8b(0x129)];async[a8_0x36da8b(0xef)](_0x5dcdcd){const _0x40258b=a8_0x36da8b,{tdx:_0xf48e9d,options:_0x166727,args:_0x423655}=_0x5dcdcd;try{const _0x4ab802=_0x166727,_0x2b2448=_0x4ab802[_0x40258b(0x128)]||'sonnet',_0xdeb1f2=_0x4ab802['proxy']===![],_0x23f20f=_0x4ab802[_0x40258b(0x121)]===!![],_0x49a591=_0x4ab802['resume']===!![],_0x32c8ae=[..._0x423655];if(_0x23f20f)_0x32c8ae[_0x40258b(0x112)]('-c');else _0x49a591&&_0x32c8ae[_0x40258b(0x112)]('-r');const _0x2687c5=createCommandSpinner(_0x40258b(0xab),{'verbose':_0x166727['verbose']});_0x2687c5[_0x40258b(0xfd)]();try{if(!_0xdeb1f2){_0x2687c5[_0x40258b(0x133)]=_0x40258b(0xf3),this[_0x40258b(0x129)]=await findAvailablePort(0xfa0),_0x2687c5[_0x40258b(0x133)]='✓\x20Port\x20'+this[_0x40258b(0x129)],_0x2687c5[_0x40258b(0x133)]='Setting\x20up\x20project...';const _0xeecf32=await _0xf48e9d[_0x40258b(0xb9)][_0x40258b(0xdb)](),_0x457641=_0xeecf32['id'];_0x2687c5[_0x40258b(0x133)]=_0x40258b(0xc4)+_0xeecf32[_0x40258b(0x119)][_0x40258b(0xf8)];const _0x4de737=_0x166727[_0x40258b(0xc7)];try{const _0x497992=await _0xf48e9d[_0x40258b(0x10c)]['getCurrent']();_0x497992[_0x40258b(0x115)]&&writeCachedAccountInfo(_0x166727[_0x40258b(0xc3)],_0x497992[_0x40258b(0x115)],_0x4de737);}catch{}_0x2687c5[_0x40258b(0x133)]='Initializing\x20proxy\x20logger...',this['logger']=new TDXLogger(_0x166727[_0x40258b(0x102)],!![]),await this[_0x40258b(0x118)]['init']();const _0x460d89=this['logger'][_0x40258b(0xb5)]();_0x2687c5[_0x40258b(0x133)]=_0x40258b(0x122)+_0x460d89,_0x2687c5[_0x40258b(0x133)]=_0x40258b(0x134),this['server']=new ProxyServer({'port':this[_0x40258b(0x129)],'projectId':_0x457641,'tdx':_0xf48e9d,'logger':this[_0x40258b(0x118)],'site':_0x166727[_0x40258b(0xc3)]}),await this[_0x40258b(0xea)][_0x40258b(0xfd)](),_0x2687c5[_0x40258b(0x133)]=_0x40258b(0x137)+this[_0x40258b(0x129)],_0x2687c5[_0x40258b(0x133)]=_0x40258b(0x104),this['originalSettings']=await createClaudeSettings(this[_0x40258b(0x129)],_0x2b2448,_0x4de737),_0x2687c5['text']='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x2687c5[_0x40258b(0x133)]=_0x40258b(0xd2);try{_0x2687c5[_0x40258b(0x133)]=_0x40258b(0x117),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x40258b(0x118)]),_0x2687c5[_0x40258b(0x133)]='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x234455){_0x2687c5[_0x40258b(0xcf)](_0x40258b(0xf6));throw _0x234455;}try{await ensureMcpServer(_0x40258b(0xb1),_0x40258b(0x101),_0x40258b(0x108),_0x2687c5,this[_0x40258b(0x118)]);}catch(_0x479a08){handleInstallationError(_0x479a08,'TD\x20Docs\x20MCP\x20Server',_0x2687c5,this['logger']);}try{await ensureMarketplace('td-skills','https://github.com/treasure-data/td-skills',_0x2687c5,this[_0x40258b(0x118)]),await updateMarketplace(_0x40258b(0xff),_0x2687c5,this[_0x40258b(0x118)]),await ensurePlugin(_0x40258b(0xc9),_0x40258b(0xff),_0x2687c5,this[_0x40258b(0x118)]),await ensurePlugin(_0x40258b(0xf4),_0x40258b(0xff),_0x2687c5,this[_0x40258b(0x118)]),await ensurePlugin(_0x40258b(0xdd),_0x40258b(0xff),_0x2687c5,this['logger']);}catch(_0x536ee9){handleInstallationError(_0x536ee9,'td-skills\x20Plugins',_0x2687c5,this[_0x40258b(0x118)]);}_0x2687c5[_0x40258b(0x11f)]();}catch(_0x2676e3){_0x2687c5[_0x40258b(0xcf)]('Setup\x20failed');throw _0x2676e3;}const _0x1c49d9=await this['findClaudePath']();if(!_0x1c49d9)throw new SDKError(ErrorCode[_0x40258b(0xe2)],_0x40258b(0xf9),undefined,{'helpText':_0x40258b(0xeb)});const _0x1346da={...process['env']};!_0xdeb1f2&&(_0x1346da[_0x40258b(0x100)]=_0x40258b(0xec)+this[_0x40258b(0x129)],_0x1346da[_0x40258b(0x110)]=_0x2b2448,_0x1346da['ANTHROPIC_AUTH_TOKEN']=_0x40258b(0xca));const _0x22dac3=spawn(_0x1c49d9,_0x32c8ae,{'stdio':'inherit','env':_0x1346da}),_0x16f8af=await new Promise(_0x59b8a1=>{const _0x36578e=_0x40258b;_0x22dac3['on']('exit',_0x5d2df4=>{_0x59b8a1(_0x5d2df4||0x0);}),_0x22dac3['on'](_0x36578e(0x103),_0x5184e3=>{const _0x531e40=_0x36578e;console[_0x531e40(0x103)](a8_0x4afd42[_0x531e40(0xac)](_0x531e40(0xdc)+_0x5184e3[_0x531e40(0x11e)])),_0x59b8a1(0x1);});});this[_0x40258b(0xea)]&&(await this['server']['stop'](),console[_0x40258b(0xcd)](a8_0x4afd42[_0x40258b(0xfb)](_0x40258b(0xdf))));if(this[_0x40258b(0x118)]){await this['logger'][_0x40258b(0x10e)]();const _0xbab141=this[_0x40258b(0x118)]['getLogPath']();console[_0x40258b(0xcd)](a8_0x4afd42[_0x40258b(0xfb)](_0x40258b(0xf1)+_0xbab141));}return this[_0x40258b(0xd1)]&&(await restoreClaudeSettings(this[_0x40258b(0xd1)]),console['log'](a8_0x4afd42[_0x40258b(0xfb)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x16f8af;}catch(_0x4439c8){this[_0x40258b(0xea)]&&await this[_0x40258b(0xea)][_0x40258b(0x11f)]();this[_0x40258b(0x118)]&&await this[_0x40258b(0x118)][_0x40258b(0x10e)]();this['originalSettings']&&await restoreClaudeSettings(this[_0x40258b(0xd1)]);throw _0x4439c8;}}async['findClaudePath'](){return new Promise(_0x10a56f=>{const _0x5660da=a8_0x2075,_0x32d4b7=spawn(_0x5660da(0xbb),[_0x5660da(0x116)]);let _0x3fd490='';_0x32d4b7[_0x5660da(0xae)]['on'](_0x5660da(0xad),_0x5a5546=>{_0x3fd490+=_0x5a5546['toString']();}),_0x32d4b7['on'](_0x5660da(0xe1),_0x151765=>{const _0x1b6270=_0x5660da;_0x151765===0x0&&_0x3fd490[_0x1b6270(0x114)]()?_0x10a56f(_0x3fd490['trim']()):_0x10a56f(null);});});}}
@@ -1 +1 @@
1
- const a9_0x5df031=a9_0x15af;(function(_0x468391,_0x310028){const _0xee686c=a9_0x15af,_0x32f406=_0x468391();while(!![]){try{const _0x2c8110=parseInt(_0xee686c(0xcf))/0x1+-parseInt(_0xee686c(0xe9))/0x2+parseInt(_0xee686c(0xdc))/0x3*(parseInt(_0xee686c(0xe8))/0x4)+parseInt(_0xee686c(0xd1))/0x5*(parseInt(_0xee686c(0xc7))/0x6)+parseInt(_0xee686c(0xdd))/0x7+-parseInt(_0xee686c(0xd5))/0x8+parseInt(_0xee686c(0xd6))/0x9;if(_0x2c8110===_0x310028)break;else _0x32f406['push'](_0x32f406['shift']());}catch(_0x198cb7){_0x32f406['push'](_0x32f406['shift']());}}}(a9_0x4580,0x6b718));function a9_0x4580(){const _0x44bd6d=['session_id','todayCredits','💎\x20','line','🧠\x20','Claude','toFixed','parse','34628peQgHa','1514694hqWAkB','model','push','log','6ebLvXW','🪙\x20credit:\x20','name','site','latestInputTokens','close','join','stdin','296418FwmYWO','\x20today\x20/\x20','1195985agMXfL','tdx\x20','accountId','monthCredits','1353856rUDQMV','13446tEIKEc','statusline','tdx','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','profile','execute','240JNjrXW','958986QgSVvJ','\x20month','sessionCredits'];a9_0x4580=function(){return _0x44bd6d;};return a9_0x4580();}import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x1a3876=0x64){return new Promise(_0x2b3d5f=>{const _0x113465=a9_0x15af;let _0x1d417a='',_0x34e9f4=![];const _0x4da447=createInterface({'input':process[_0x113465(0xce)],'terminal':![]}),_0x46745e=_0x283fcc=>{const _0x4ae6da=_0x113465;if(_0x34e9f4)return;_0x34e9f4=!![],clearTimeout(_0x289411),_0x4da447[_0x4ae6da(0xcc)](),_0x2b3d5f(_0x283fcc);},_0x289411=setTimeout(()=>{_0x46745e(null);},_0x1a3876);_0x4da447['on'](_0x113465(0xe3),_0x31e1ba=>{_0x1d417a+=_0x31e1ba;}),_0x4da447['on'](_0x113465(0xcc),()=>{const _0x16643e=_0x113465;if(_0x34e9f4)return;try{const _0x96db81=JSON[_0x16643e(0xe7)](_0x1d417a);_0x46745e(_0x96db81);}catch{_0x46745e(null);}});});}function formatCredits(_0x558d3d){const _0x29d8a6=a9_0x15af;return _0x558d3d[_0x29d8a6(0xe6)](0x2);}function a9_0x15af(_0x5b2e25,_0x513902){_0x5b2e25=_0x5b2e25-0xc7;const _0x458014=a9_0x4580();let _0x15afdf=_0x458014[_0x5b2e25];return _0x15afdf;}export class ClaudeStatuslineCommand extends BaseCommand{[a9_0x5df031(0xc9)]=a9_0x5df031(0xd7);['description']=a9_0x5df031(0xd9);async[a9_0x5df031(0xdb)](_0x3b6843){const _0x1d90c3=a9_0x5df031;try{const _0x5cc2c7=await readStdinJson();if(!_0x5cc2c7?.['session_id'])return console['log']('💎\x20tdx\x20-\x20Claude'),0x0;const _0x49b7bd=_0x5cc2c7[_0x1d90c3(0xe0)],_0x3a458d=_0x5cc2c7[_0x1d90c3(0xea)]?.['id']||'',_0x120dc1=_0x5cc2c7[_0x1d90c3(0xda)]||_0x3b6843['options'][_0x1d90c3(0xda)],_0x363c0e=await getUsageStats(_0x49b7bd,_0x120dc1),_0x162bce=[],_0x362cfb=readCachedAccountInfo(_0x120dc1),_0x21a764=_0x362cfb?_0x1d90c3(0xd2)+_0x362cfb[_0x1d90c3(0xca)]+':'+_0x362cfb[_0x1d90c3(0xd3)]:_0x1d90c3(0xd8),_0x312029=_0x3a458d?getModelDisplayName(_0x3a458d):_0x1d90c3(0xe5);_0x162bce['push'](_0x1d90c3(0xe2)+_0x21a764+'\x20-\x20'+_0x312029);const _0x3aab68=formatCredits(_0x363c0e[_0x1d90c3(0xdf)]),_0x454d92=formatCredits(_0x363c0e[_0x1d90c3(0xe1)]),_0x446a2d=formatCredits(_0x363c0e[_0x1d90c3(0xd4)]);_0x162bce[_0x1d90c3(0xeb)](_0x1d90c3(0xc8)+_0x3aab68+'\x20session\x20/\x20'+_0x454d92+_0x1d90c3(0xd0)+_0x446a2d+_0x1d90c3(0xde));if(_0x363c0e[_0x1d90c3(0xcb)]>0x0&&_0x3a458d){const _0x7c89c9=formatTokenCount(_0x363c0e[_0x1d90c3(0xcb)]),_0x4549e2=calculateContextPercentage(_0x363c0e['latestInputTokens'],_0x3a458d);_0x162bce[_0x1d90c3(0xeb)](_0x1d90c3(0xe4)+_0x7c89c9+'\x20('+_0x4549e2+'%)');}return console[_0x1d90c3(0xec)](_0x162bce[_0x1d90c3(0xcd)]('\x20|\x20')),0x0;}catch{return console[_0x1d90c3(0xec)]('💎\x20tdx\x20-\x20Claude'),0x0;}}}
1
+ const a9_0x18db6d=a9_0x59f2;(function(_0x55ac9c,_0x317b64){const _0x560709=a9_0x59f2,_0x1e1112=_0x55ac9c();while(!![]){try{const _0x29a746=parseInt(_0x560709(0x163))/0x1*(parseInt(_0x560709(0x16a))/0x2)+-parseInt(_0x560709(0x177))/0x3*(-parseInt(_0x560709(0x17b))/0x4)+parseInt(_0x560709(0x173))/0x5*(parseInt(_0x560709(0x179))/0x6)+parseInt(_0x560709(0x155))/0x7*(-parseInt(_0x560709(0x159))/0x8)+-parseInt(_0x560709(0x15b))/0x9*(-parseInt(_0x560709(0x15c))/0xa)+parseInt(_0x560709(0x170))/0xb*(parseInt(_0x560709(0x157))/0xc)+-parseInt(_0x560709(0x175))/0xd*(parseInt(_0x560709(0x16f))/0xe);if(_0x29a746===_0x317b64)break;else _0x1e1112['push'](_0x1e1112['shift']());}catch(_0x205713){_0x1e1112['push'](_0x1e1112['shift']());}}}(a9_0x19dc,0xc3bfe));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';function a9_0x19dc(){const _0xbab972=['\x20-\x20','8Xbdwci','tdx','1593171FEgmWB','40BEmltQ','session_id','profile','🪙\x20credit:\x20','log','sessionCredits','join','303473KOQsss','execute','latestInputTokens','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','options','todayCredits','Claude','2MqMKtK','\x20session\x20/\x20','\x20today\x20/\x20','🧠\x20','parse','18718070yuRGzt','19822LBqrlQ','model','💎\x20tdx\x20-\x20Claude','139685pAzmqW','push','26AjIhlt','💎\x20','3hrPntn','stdin','294CvuPDy','name','5341048VmnXij','7116102iqRYbn','tdx\x20','5172XDFtnn'];a9_0x19dc=function(){return _0xbab972;};return a9_0x19dc();}import{getUsageStats}from'../proxy/claude-usage-tracker.js';function a9_0x59f2(_0x4f1394,_0x4c07b0){_0x4f1394=_0x4f1394-0x155;const _0x19dcff=a9_0x19dc();let _0x59f29e=_0x19dcff[_0x4f1394];return _0x59f29e;}import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x482433=0x64){return new Promise(_0x5cd22c=>{const _0xa1a79c=a9_0x59f2;let _0x570264='',_0x5b9b78=![];const _0xeff72=createInterface({'input':process[_0xa1a79c(0x178)],'terminal':![]}),_0x483aa5=_0x3a5efc=>{if(_0x5b9b78)return;_0x5b9b78=!![],clearTimeout(_0x55ad60),_0xeff72['close'](),_0x5cd22c(_0x3a5efc);},_0x55ad60=setTimeout(()=>{_0x483aa5(null);},_0x482433);_0xeff72['on']('line',_0x1f3e96=>{_0x570264+=_0x1f3e96;}),_0xeff72['on']('close',()=>{const _0x12020a=_0xa1a79c;if(_0x5b9b78)return;try{const _0x408dd1=JSON[_0x12020a(0x16e)](_0x570264);_0x483aa5(_0x408dd1);}catch{_0x483aa5(null);}});});}function formatCredits(_0x189bbb){return _0x189bbb['toFixed'](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a9_0x18db6d(0x17a)]='statusline';['description']=a9_0x18db6d(0x166);async[a9_0x18db6d(0x164)](_0x5c4b43){const _0x27bf42=a9_0x18db6d;try{const _0x3acc3a=await readStdinJson();if(!_0x3acc3a?.[_0x27bf42(0x15d)])return console[_0x27bf42(0x160)](_0x27bf42(0x172)),0x0;const _0x3727dd=_0x3acc3a['session_id'],_0x1e3597=_0x3acc3a[_0x27bf42(0x171)]?.['id']||'',_0x2a7eca=_0x3acc3a[_0x27bf42(0x15e)]||_0x5c4b43[_0x27bf42(0x167)][_0x27bf42(0x15e)],_0x42276d=await getUsageStats(_0x3727dd,_0x2a7eca),_0x298a14=[],_0x5beca5=readCachedAccountInfo(_0x2a7eca),_0x7c454f=_0x5beca5?_0x27bf42(0x156)+_0x5beca5['site']+':'+_0x5beca5['accountId']:_0x27bf42(0x15a),_0x479968=_0x1e3597?getModelDisplayName(_0x1e3597):_0x27bf42(0x169);_0x298a14[_0x27bf42(0x174)](_0x27bf42(0x176)+_0x7c454f+_0x27bf42(0x158)+_0x479968);const _0x3d3afe=formatCredits(_0x42276d[_0x27bf42(0x161)]),_0x354b3e=formatCredits(_0x42276d[_0x27bf42(0x168)]),_0x571354=formatCredits(_0x42276d['monthCredits']);_0x298a14['push'](_0x27bf42(0x15f)+_0x3d3afe+_0x27bf42(0x16b)+_0x354b3e+_0x27bf42(0x16c)+_0x571354+'\x20month');if(_0x42276d[_0x27bf42(0x165)]>0x0&&_0x1e3597){const _0x69c1d4=formatTokenCount(_0x42276d[_0x27bf42(0x165)]),_0x3add64=calculateContextPercentage(_0x42276d[_0x27bf42(0x165)],_0x1e3597);_0x298a14[_0x27bf42(0x174)](_0x27bf42(0x16d)+_0x69c1d4+'\x20('+_0x3add64+'%)');}return console['log'](_0x298a14[_0x27bf42(0x162)]('\x20|\x20')),0x0;}catch{return console['log'](_0x27bf42(0x172)),0x0;}}}
@@ -1 +1 @@
1
- function a10_0x327e(_0x2312bc,_0x6cdce0){_0x2312bc=_0x2312bc-0x175;const _0x532dae=a10_0x532d();let _0x327e6f=_0x532dae[_0x2312bc];return _0x327e6f;}const a10_0x229f4c=a10_0x327e;(function(_0x4ed6a0,_0x11b6dd){const _0x4aec7f=a10_0x327e,_0x206968=_0x4ed6a0();while(!![]){try{const _0x24fc5a=parseInt(_0x4aec7f(0x19a))/0x1+parseInt(_0x4aec7f(0x18a))/0x2*(parseInt(_0x4aec7f(0x18e))/0x3)+-parseInt(_0x4aec7f(0x183))/0x4+parseInt(_0x4aec7f(0x18c))/0x5+parseInt(_0x4aec7f(0x1ae))/0x6*(parseInt(_0x4aec7f(0x176))/0x7)+-parseInt(_0x4aec7f(0x1a4))/0x8*(-parseInt(_0x4aec7f(0x1a1))/0x9)+-parseInt(_0x4aec7f(0x185))/0xa*(parseInt(_0x4aec7f(0x1b1))/0xb);if(_0x24fc5a===_0x11b6dd)break;else _0x206968['push'](_0x206968['shift']());}catch(_0x5f44b8){_0x206968['push'](_0x206968['shift']());}}}(a10_0x532d,0xc65b2));import a10_0x409f8e from'chalk';import{BaseCommand}from'./command.js';function a10_0x532d(){const _0xa380bb=['never','numeric','en-US','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','bold','usage','length','lastUsedAt','175537sywhEs','json','outputStructured','short','max','description','format','963OTCLwY','2-digit','credits','103832iFqVsg','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','all','padStart','jsonl','dim','Profile','(default)','red','\x20days\x20ago','564xeJKXC','getTime','\x20credits','34507WyOfNd','outputTable','toLocaleDateString','log','37275ZASKJs','toFixed','todayCredits','yesterday','Credits','Unknown\x20error','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','monthCredits','error','execute','en-CA','padEnd','profileCount','5971180tmnZMu','default','6010qfHsII','\x20\x20Total:\x20\x20\x20','entryCount','cyan','map','2SwHrzr','profile','5534495OzLlnf','Error:\x20','3056577Waudpk','round','today\x20','totalCredits'];a10_0x532d=function(){return _0xa380bb;};return a10_0x532d();}import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x419672){const _0x2478e8=a10_0x327e;return _0x419672[_0x2478e8(0x177)](0x2);}function formatLastUsed(_0x4eb30e){const _0x2cad66=a10_0x327e;if(!_0x4eb30e)return _0x2cad66(0x192);const _0x4f3d85=new Date(_0x4eb30e),_0x59bb88=new Date(),_0x3b6ae4=_0x4f3d85[_0x2cad66(0x1b3)](_0x2cad66(0x180)),_0x45f15e=_0x59bb88[_0x2cad66(0x1b3)](_0x2cad66(0x180));if(_0x3b6ae4===_0x45f15e)return _0x2cad66(0x190)+_0x4f3d85['toLocaleTimeString'](_0x2cad66(0x194),{'hour':_0x2cad66(0x1a2),'minute':_0x2cad66(0x1a2)});const _0x1687c6=new Date(_0x3b6ae4),_0x55ea30=new Date(_0x45f15e),_0x4a7aa5=Math[_0x2cad66(0x18f)]((_0x55ea30[_0x2cad66(0x1af)]()-_0x1687c6[_0x2cad66(0x1af)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x4a7aa5===0x1)return _0x2cad66(0x179);else return _0x4a7aa5>0x1&&_0x4a7aa5<0x7?_0x4a7aa5+_0x2cad66(0x1ad):_0x4f3d85[_0x2cad66(0x1b3)](_0x2cad66(0x194),{'month':_0x2cad66(0x19d),'day':_0x2cad66(0x193)});}export class ClaudeUsageCommand extends BaseCommand{['name']=a10_0x229f4c(0x197);[a10_0x229f4c(0x19f)]='Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile';async[a10_0x229f4c(0x17f)](_0x28f60f){const _0x2a50e6=a10_0x229f4c,{options:_0x3bd9c5}=_0x28f60f,_0x55424e=_0x3bd9c5[_0x2a50e6(0x1a0)]==='json'||_0x3bd9c5[_0x2a50e6(0x1a0)]===_0x2a50e6(0x1a8)||_0x3bd9c5[_0x2a50e6(0x19b)];try{const [_0x3f9983,_0xd5f7a8]=await Promise[_0x2a50e6(0x1a6)]([getAllProfileStats(),getUsageSummary()]);return _0x55424e?await this[_0x2a50e6(0x19c)](_0x3f9983,_0xd5f7a8,_0x3bd9c5):this[_0x2a50e6(0x1b2)](_0x3f9983,_0xd5f7a8),0x0;}catch(_0x1d9369){const _0x58efaf=_0x1d9369 instanceof Error?_0x1d9369['message']:_0x2a50e6(0x17b);return console[_0x2a50e6(0x17e)](a10_0x409f8e[_0x2a50e6(0x1ac)](_0x2a50e6(0x18d)+_0x58efaf)),0x1;}}async['outputStructured'](_0x2568fc,_0x3ef9b7,_0x38446b){const _0x4f5651=a10_0x229f4c,_0x5cb39e={'summary':{'todayCredits':_0x3ef9b7[_0x4f5651(0x178)],'monthCredits':_0x3ef9b7['monthCredits'],'totalCredits':_0x3ef9b7[_0x4f5651(0x191)],'profileCount':_0x3ef9b7[_0x4f5651(0x182)]},'profiles':_0x2568fc[_0x4f5651(0x189)](_0x3b7cc5=>({'profile':_0x3b7cc5[_0x4f5651(0x18b)],'credits':_0x3b7cc5[_0x4f5651(0x1a3)],'requests':_0x3b7cc5[_0x4f5651(0x187)],'lastUsedAt':_0x3b7cc5['lastUsedAt']}))};await handleSDKOutput([_0x5cb39e],_0x38446b);}[a10_0x229f4c(0x1b2)](_0xcf5fbd,_0x7eb25c){const _0x12f533=a10_0x229f4c;console[_0x12f533(0x175)](a10_0x409f8e['bold'](_0x12f533(0x195))),console[_0x12f533(0x175)](a10_0x409f8e[_0x12f533(0x1a9)]('─'['repeat'](0x32))),console['log']('\x20\x20Today:\x20\x20\x20'+a10_0x409f8e[_0x12f533(0x188)](formatCredits(_0x7eb25c['todayCredits']))+_0x12f533(0x1b0)),console[_0x12f533(0x175)]('\x20\x20Month:\x20\x20\x20'+a10_0x409f8e[_0x12f533(0x188)](formatCredits(_0x7eb25c[_0x12f533(0x17d)]))+_0x12f533(0x1b0)),console[_0x12f533(0x175)](_0x12f533(0x186)+a10_0x409f8e['cyan'](formatCredits(_0x7eb25c['totalCredits']))+_0x12f533(0x1b0)),console['log']();if(_0xcf5fbd[_0x12f533(0x198)]===0x0){console[_0x12f533(0x175)](a10_0x409f8e['dim'](_0x12f533(0x1a5))),console[_0x12f533(0x175)](a10_0x409f8e[_0x12f533(0x1a9)](_0x12f533(0x17c)));return;}console[_0x12f533(0x175)](a10_0x409f8e[_0x12f533(0x196)]('Usage\x20by\x20Profile')),console[_0x12f533(0x175)](a10_0x409f8e[_0x12f533(0x1a9)]('─'['repeat'](0x3c)));const _0x120dbe=Math[_0x12f533(0x19e)](0xc,..._0xcf5fbd['map'](_0x4e0431=>_0x4e0431[_0x12f533(0x18b)]===_0x12f533(0x184)?_0x12f533(0x1ab)['length']:_0x4e0431['profile'][_0x12f533(0x198)])),_0x52f321=0xa,_0x2ebe10=0xa;console[_0x12f533(0x175)]('\x20\x20'+_0x12f533(0x1aa)[_0x12f533(0x181)](_0x120dbe)+'\x20\x20'+_0x12f533(0x17a)[_0x12f533(0x1a7)](_0x52f321)+'\x20\x20'+'Requests'[_0x12f533(0x1a7)](_0x2ebe10)+'\x20\x20'+'Last\x20Used');for(const _0x479527 of _0xcf5fbd){const _0x3c4e2f=_0x479527['profile']===_0x12f533(0x184)?_0x12f533(0x1ab):_0x479527[_0x12f533(0x18b)],_0x22e38a=_0x3c4e2f[_0x12f533(0x181)](_0x120dbe),_0x335f5c=_0x479527[_0x12f533(0x18b)]===_0x12f533(0x184)?a10_0x409f8e[_0x12f533(0x1a9)](_0x22e38a):_0x22e38a;console[_0x12f533(0x175)]('\x20\x20'+_0x335f5c+'\x20\x20'+a10_0x409f8e[_0x12f533(0x188)](formatCredits(_0x479527[_0x12f533(0x1a3)])[_0x12f533(0x1a7)](_0x52f321))+'\x20\x20'+String(_0x479527[_0x12f533(0x187)])[_0x12f533(0x1a7)](_0x2ebe10)+'\x20\x20'+a10_0x409f8e['dim'](formatLastUsed(_0x479527[_0x12f533(0x199)])));}console[_0x12f533(0x175)](),console[_0x12f533(0x175)](a10_0x409f8e[_0x12f533(0x1a9)]('Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.')),console[_0x12f533(0x175)]();}}
1
+ const a10_0x516c36=a10_0x4207;(function(_0xd85b49,_0x86b730){const _0x3ed6fa=a10_0x4207,_0x4813de=_0xd85b49();while(!![]){try{const _0x1914d3=-parseInt(_0x3ed6fa(0x1ac))/0x1*(parseInt(_0x3ed6fa(0x19c))/0x2)+parseInt(_0x3ed6fa(0x1d0))/0x3*(-parseInt(_0x3ed6fa(0x1b7))/0x4)+parseInt(_0x3ed6fa(0x1a9))/0x5+parseInt(_0x3ed6fa(0x196))/0x6*(parseInt(_0x3ed6fa(0x1b9))/0x7)+-parseInt(_0x3ed6fa(0x1bb))/0x8+-parseInt(_0x3ed6fa(0x1b8))/0x9+parseInt(_0x3ed6fa(0x1be))/0xa*(parseInt(_0x3ed6fa(0x1cd))/0xb);if(_0x1914d3===_0x86b730)break;else _0x4813de['push'](_0x4813de['shift']());}catch(_0xd6dcc2){_0x4813de['push'](_0x4813de['shift']());}}}(a10_0x2b98,0xb386f));function a10_0x4207(_0x37d349,_0x49a806){_0x37d349=_0x37d349-0x193;const _0x2b98b9=a10_0x2b98();let _0x42074f=_0x2b98b9[_0x37d349];return _0x42074f;}import a10_0x3ed6a2 from'chalk';function a10_0x2b98(){const _0x4e913f=['padStart','802252vyiunG','6976116scmMQb','14TxnvDW','\x20\x20Month:\x20\x20\x20','7421408thFlwb','bold','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','2180RKQZUJ','yesterday','error','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','dim','default','2-digit','Usage\x20by\x20Profile','name','log','todayCredits','en-CA','credits','getTime','lastUsedAt','145244HGCBLJ','Last\x20Used','execute','15PjXaPF','length','description','never','toFixed','entryCount','max','1239072mLqerS','Credits','totalCredits','profileCount','outputTable','map','8PaDJAY','json','all','padEnd','outputStructured','cyan','profile','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','round','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','\x20\x20Total:\x20\x20\x20','Profile','Error:\x20','781430NhTJFI','toLocaleDateString','repeat','1706fDuDox','Requests','usage','monthCredits','(default)','numeric','\x20credits','jsonl','format','en-US'];a10_0x2b98=function(){return _0x4e913f;};return a10_0x2b98();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x314c6b){const _0x30610d=a10_0x4207;return _0x314c6b[_0x30610d(0x193)](0x2);}function formatLastUsed(_0x462365){const _0x5c1dd0=a10_0x4207;if(!_0x462365)return _0x5c1dd0(0x1d3);const _0x3db3b1=new Date(_0x462365),_0xd5d466=new Date(),_0x2dd20a=_0x3db3b1[_0x5c1dd0(0x1aa)](_0x5c1dd0(0x1c9)),_0x48d2db=_0xd5d466[_0x5c1dd0(0x1aa)](_0x5c1dd0(0x1c9));if(_0x2dd20a===_0x48d2db)return'today\x20'+_0x3db3b1['toLocaleTimeString'](_0x5c1dd0(0x1b5),{'hour':'2-digit','minute':_0x5c1dd0(0x1c4)});const _0x205da0=new Date(_0x2dd20a),_0x54e9f4=new Date(_0x48d2db),_0x5c22fc=Math[_0x5c1dd0(0x1a4)]((_0x54e9f4['getTime']()-_0x205da0[_0x5c1dd0(0x1cb)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x5c22fc===0x1)return _0x5c1dd0(0x1bf);else return _0x5c22fc>0x1&&_0x5c22fc<0x7?_0x5c22fc+'\x20days\x20ago':_0x3db3b1[_0x5c1dd0(0x1aa)](_0x5c1dd0(0x1b5),{'month':'short','day':_0x5c1dd0(0x1b1)});}export class ClaudeUsageCommand extends BaseCommand{[a10_0x516c36(0x1c6)]=a10_0x516c36(0x1ae);[a10_0x516c36(0x1d2)]=a10_0x516c36(0x1a5);async[a10_0x516c36(0x1cf)](_0x41ea75){const _0x19833d=a10_0x516c36,{options:_0x5c9943}=_0x41ea75,_0x5e8c40=_0x5c9943[_0x19833d(0x1b4)]===_0x19833d(0x19d)||_0x5c9943[_0x19833d(0x1b4)]===_0x19833d(0x1b3)||_0x5c9943[_0x19833d(0x19d)];try{const [_0x53d8fd,_0x4ce4b8]=await Promise[_0x19833d(0x19e)]([getAllProfileStats(),getUsageSummary()]);return _0x5e8c40?await this[_0x19833d(0x1a0)](_0x53d8fd,_0x4ce4b8,_0x5c9943):this[_0x19833d(0x19a)](_0x53d8fd,_0x4ce4b8),0x0;}catch(_0x466643){const _0x453f35=_0x466643 instanceof Error?_0x466643['message']:'Unknown\x20error';return console[_0x19833d(0x1c0)](a10_0x3ed6a2['red'](_0x19833d(0x1a8)+_0x453f35)),0x1;}}async[a10_0x516c36(0x1a0)](_0x2d05ae,_0x221997,_0x5bd078){const _0x6c153f=a10_0x516c36,_0x5b67df={'summary':{'todayCredits':_0x221997[_0x6c153f(0x1c8)],'monthCredits':_0x221997[_0x6c153f(0x1af)],'totalCredits':_0x221997[_0x6c153f(0x198)],'profileCount':_0x221997[_0x6c153f(0x199)]},'profiles':_0x2d05ae[_0x6c153f(0x19b)](_0x93c1e1=>({'profile':_0x93c1e1['profile'],'credits':_0x93c1e1[_0x6c153f(0x1ca)],'requests':_0x93c1e1[_0x6c153f(0x194)],'lastUsedAt':_0x93c1e1[_0x6c153f(0x1cc)]}))};await handleSDKOutput([_0x5b67df],_0x5bd078);}['outputTable'](_0x141658,_0x4b2e55){const _0x40056c=a10_0x516c36;console[_0x40056c(0x1c7)](a10_0x3ed6a2[_0x40056c(0x1bc)](_0x40056c(0x1a3))),console[_0x40056c(0x1c7)](a10_0x3ed6a2['dim']('─'[_0x40056c(0x1ab)](0x32))),console['log']('\x20\x20Today:\x20\x20\x20'+a10_0x3ed6a2[_0x40056c(0x1a1)](formatCredits(_0x4b2e55[_0x40056c(0x1c8)]))+_0x40056c(0x1b2)),console['log'](_0x40056c(0x1ba)+a10_0x3ed6a2[_0x40056c(0x1a1)](formatCredits(_0x4b2e55[_0x40056c(0x1af)]))+_0x40056c(0x1b2)),console['log'](_0x40056c(0x1a6)+a10_0x3ed6a2[_0x40056c(0x1a1)](formatCredits(_0x4b2e55[_0x40056c(0x198)]))+_0x40056c(0x1b2)),console[_0x40056c(0x1c7)]();if(_0x141658[_0x40056c(0x1d1)]===0x0){console[_0x40056c(0x1c7)](a10_0x3ed6a2[_0x40056c(0x1c2)](_0x40056c(0x1c1))),console[_0x40056c(0x1c7)](a10_0x3ed6a2['dim'](_0x40056c(0x1bd)));return;}console[_0x40056c(0x1c7)](a10_0x3ed6a2[_0x40056c(0x1bc)](_0x40056c(0x1c5))),console['log'](a10_0x3ed6a2[_0x40056c(0x1c2)]('─'[_0x40056c(0x1ab)](0x3c)));const _0x7733fd=Math[_0x40056c(0x195)](0xc,..._0x141658[_0x40056c(0x19b)](_0x2f316d=>_0x2f316d['profile']===_0x40056c(0x1c3)?_0x40056c(0x1b0)[_0x40056c(0x1d1)]:_0x2f316d['profile'][_0x40056c(0x1d1)])),_0x8a06e7=0xa,_0xdaf415=0xa;console[_0x40056c(0x1c7)]('\x20\x20'+_0x40056c(0x1a7)[_0x40056c(0x19f)](_0x7733fd)+'\x20\x20'+_0x40056c(0x197)[_0x40056c(0x1b6)](_0x8a06e7)+'\x20\x20'+_0x40056c(0x1ad)['padStart'](_0xdaf415)+'\x20\x20'+_0x40056c(0x1ce));for(const _0x12b49e of _0x141658){const _0x1643e5=_0x12b49e[_0x40056c(0x1a2)]==='default'?_0x40056c(0x1b0):_0x12b49e[_0x40056c(0x1a2)],_0x27b708=_0x1643e5[_0x40056c(0x19f)](_0x7733fd),_0x4e19d2=_0x12b49e[_0x40056c(0x1a2)]==='default'?a10_0x3ed6a2[_0x40056c(0x1c2)](_0x27b708):_0x27b708;console[_0x40056c(0x1c7)]('\x20\x20'+_0x4e19d2+'\x20\x20'+a10_0x3ed6a2['cyan'](formatCredits(_0x12b49e['credits'])['padStart'](_0x8a06e7))+'\x20\x20'+String(_0x12b49e['entryCount'])[_0x40056c(0x1b6)](_0xdaf415)+'\x20\x20'+a10_0x3ed6a2[_0x40056c(0x1c2)](formatLastUsed(_0x12b49e['lastUsedAt'])));}console[_0x40056c(0x1c7)](),console[_0x40056c(0x1c7)](a10_0x3ed6a2[_0x40056c(0x1c2)]('Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.')),console[_0x40056c(0x1c7)]();}}