@treasuredata/tdx 0.9.0 → 0.9.2

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 (122) 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/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/agent-command.js +1 -1
  15. package/dist/commands/api-command.js +1 -1
  16. package/dist/commands/auth-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-statusline-command.js +1 -1
  20. package/dist/commands/claude-usage-command.js +1 -1
  21. package/dist/commands/command.js +1 -1
  22. package/dist/commands/connection-command.js +1 -1
  23. package/dist/commands/context-command.js +1 -1
  24. package/dist/commands/databases.js +1 -1
  25. package/dist/commands/describe.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/llm-proxy.js +1 -1
  31. package/dist/commands/parent-segment-command.js +1 -1
  32. package/dist/commands/profiles-command.js +1 -1
  33. package/dist/commands/query-command.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pull-command.js +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/tables.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/config.js +1 -1
  49. package/dist/core/connection-cache.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/proxy/anthropic-adapter.js +1 -1
  59. package/dist/proxy/claude-usage-tracker.js +1 -1
  60. package/dist/proxy/context-signature.js +1 -1
  61. package/dist/proxy/conversation-utils.js +1 -1
  62. package/dist/proxy/server.js +1 -1
  63. package/dist/proxy/session-cache.js +1 -1
  64. package/dist/sdk/agent/agent-yaml.d.ts +1 -1
  65. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  66. package/dist/sdk/agent/agent-yaml.js +1 -1
  67. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  68. package/dist/sdk/api.js +1 -1
  69. package/dist/sdk/connection.js +1 -1
  70. package/dist/sdk/engage.js +1 -1
  71. package/dist/sdk/errors.js +1 -1
  72. package/dist/sdk/index.js +1 -1
  73. package/dist/sdk/job.js +1 -1
  74. package/dist/sdk/journey.js +1 -1
  75. package/dist/sdk/llm.d.ts +27 -20
  76. package/dist/sdk/llm.d.ts.map +1 -1
  77. package/dist/sdk/llm.js +1 -1
  78. package/dist/sdk/llm.js.map +1 -1
  79. package/dist/sdk/query.js +1 -1
  80. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  81. package/dist/sdk/segment/journey-yaml.js +1 -1
  82. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  83. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  84. package/dist/sdk/segment.js +1 -1
  85. package/dist/sdk/user.js +1 -1
  86. package/dist/sdk/workflow.js +1 -1
  87. package/dist/types/endpoints.js +1 -1
  88. package/dist/types/index.js +1 -1
  89. package/dist/utils/agent-config.js +1 -1
  90. package/dist/utils/agent-ref-parser.js +1 -1
  91. package/dist/utils/async.js +1 -1
  92. package/dist/utils/chat-cache.js +1 -1
  93. package/dist/utils/colors.js +1 -1
  94. package/dist/utils/command-output.js +1 -1
  95. package/dist/utils/constants.js +1 -1
  96. package/dist/utils/diff.js +1 -1
  97. package/dist/utils/fields-display.js +1 -1
  98. package/dist/utils/file-permissions.js +1 -1
  99. package/dist/utils/format-detector.js +1 -1
  100. package/dist/utils/formatters.js +1 -1
  101. package/dist/utils/journey-utils.js +1 -1
  102. package/dist/utils/json-loader.js +1 -1
  103. package/dist/utils/llm-backup-utils.js +1 -1
  104. package/dist/utils/model-aliases.js +1 -1
  105. package/dist/utils/model-factors.js +1 -1
  106. package/dist/utils/option-validation.js +1 -1
  107. package/dist/utils/port.js +1 -1
  108. package/dist/utils/process.js +1 -1
  109. package/dist/utils/prompt.js +1 -1
  110. package/dist/utils/segment-path-parser.js +1 -1
  111. package/dist/utils/segment-ref-parser.js +1 -1
  112. package/dist/utils/spinner.js +1 -1
  113. package/dist/utils/sql-parser.js +1 -1
  114. package/dist/utils/sse-parser.js +1 -1
  115. package/dist/utils/string-utils.js +1 -1
  116. package/dist/utils/table-ref-parser.js +1 -1
  117. package/dist/utils/tdx-config.js +1 -1
  118. package/dist/utils/tdx-logger.js +1 -1
  119. package/dist/utils/tree-formatter.js +1 -1
  120. package/dist/utils/version-check.js +1 -1
  121. package/dist/utils/workflow-utils.js +1 -1
  122. package/package.json +1 -1
@@ -1 +1 @@
1
- const a11_0xfba14c=a11_0x2852;(function(_0x5a697a,_0x128b97){const _0x5b0453=a11_0x2852,_0x4e9e9e=_0x5a697a();while(!![]){try{const _0x229c72=-parseInt(_0x5b0453(0x191))/0x1+-parseInt(_0x5b0453(0x19c))/0x2*(parseInt(_0x5b0453(0x18d))/0x3)+-parseInt(_0x5b0453(0x192))/0x4*(parseInt(_0x5b0453(0x19a))/0x5)+parseInt(_0x5b0453(0x196))/0x6+parseInt(_0x5b0453(0x1a3))/0x7*(-parseInt(_0x5b0453(0x19f))/0x8)+parseInt(_0x5b0453(0x18f))/0x9*(-parseInt(_0x5b0453(0x194))/0xa)+parseInt(_0x5b0453(0x1a0))/0xb*(parseInt(_0x5b0453(0x18b))/0xc);if(_0x229c72===_0x128b97)break;else _0x4e9e9e['push'](_0x4e9e9e['shift']());}catch(_0x34a704){_0x4e9e9e['push'](_0x4e9e9e['shift']());}}}(a11_0x1cb6,0x70ed6));import{BaseCommand}from'./command.js';function a11_0x2852(_0x360f9c,_0x2de1a9){_0x360f9c=_0x360f9c-0x186;const _0x1cb625=a11_0x1cb6();let _0x28520a=_0x1cb625[_0x360f9c];return _0x28520a;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{['name']=a11_0xfba14c(0x1a4);[a11_0xfba14c(0x188)]='List\x20activations\x20for\x20a\x20segment';async[a11_0xfba14c(0x190)](_0x3e8dec){const _0x301b49=a11_0xfba14c,{options:_0x2ec694,args:_0x57a844,tdx:_0x1c3a66}=_0x3e8dec;if(_0x57a844[_0x301b49(0x19e)]===0x0)return console[_0x301b49(0x189)](_0x301b49(0x198)),console[_0x301b49(0x189)]('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x410bfd,childId:_0x453097}=parseSegmentRef(_0x57a844[0x0]);if(!_0x453097)return console['error'](_0x301b49(0x199)),console[_0x301b49(0x189)](_0x301b49(0x193)),0x1;_0x2ec694[_0x301b49(0x195)]&&(console[_0x301b49(0x189)](_0x301b49(0x18c)+_0x2ec694['site']),console[_0x301b49(0x189)](_0x301b49(0x1a7)+_0x410bfd),console[_0x301b49(0x189)]('Child\x20name:\x20'+_0x453097));const _0x2fee14=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x410bfd+_0x301b49(0x18a),()=>_0x1c3a66[_0x301b49(0x186)]['resolveParentId'](_0x410bfd),{'verbose':_0x2ec694[_0x301b49(0x195)]}),_0x123879=_0x2fee14[_0x301b49(0x1a1)];_0x2ec694[_0x301b49(0x195)]&&console[_0x301b49(0x189)]('Resolved\x20parent\x20ID:\x20'+_0x123879);const _0x429397=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x453097+'\x27...',()=>_0x1c3a66[_0x301b49(0x186)][_0x301b49(0x187)](_0x123879,_0x453097),{'verbose':_0x2ec694[_0x301b49(0x195)]}),_0x4d23bb=_0x429397[_0x301b49(0x1a1)];_0x2ec694[_0x301b49(0x195)]&&console[_0x301b49(0x189)](_0x301b49(0x1a6)+_0x4d23bb);const _0x2b3515=await withSpinner(_0x301b49(0x1a5)+_0x453097+'\x27...',()=>_0x1c3a66[_0x301b49(0x186)][_0x301b49(0x19d)](_0x123879,_0x4d23bb),{'verbose':_0x2ec694[_0x301b49(0x195)]}),_0x558bc0=_0x2b3515[_0x301b49(0x1a1)];return console['error']('✔\x20Found\x20'+_0x558bc0['length']+'\x20activation'+(_0x558bc0[_0x301b49(0x19e)]!==0x1?'s':'')),await handleSDKOutput(_0x558bc0,_0x2ec694),0x0;}catch(_0x5899b7){if(_0x5899b7 instanceof SDKError)return console[_0x301b49(0x189)](_0x301b49(0x1a2)+_0x5899b7[_0x301b49(0x197)]),_0x5899b7[_0x301b49(0x19b)]&&console[_0x301b49(0x189)](_0x301b49(0x18e)+_0x5899b7['cause']),0x1;throw _0x5899b7;}}}function a11_0x1cb6(){const _0x4e7b46=['4578580XbXZTr','verbose','5154438XONhwW','message','Error:\x20Segment\x20name\x20is\x20required','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','7985KAJQsi','cause','214ilzLgQ','listActivations','length','8itncfX','15826173fENKTG','data','Error:\x20','66542YHcHKO','activations','Listing\x20activations\x20for\x20segment\x20\x27','Resolved\x20child\x20ID:\x20','Parent\x20name:\x20','segment','resolveSegmentId','description','error','\x27...','12mYQWlh','Site:\x20','12360GgiVLK','\x20\x20Cause:\x20','9DhQpJN','execute','598080wHeaIs','824emOHBc','Usage:\x20tdx\x20activations\x20<parent_name/child_name>'];a11_0x1cb6=function(){return _0x4e7b46;};return a11_0x1cb6();}
1
+ const a11_0x2d1636=a11_0x33d8;(function(_0x221060,_0x47ca36){const _0x332f8f=a11_0x33d8,_0x1ee243=_0x221060();while(!![]){try{const _0xa1ae80=-parseInt(_0x332f8f(0x11f))/0x1*(parseInt(_0x332f8f(0x11d))/0x2)+parseInt(_0x332f8f(0x119))/0x3*(-parseInt(_0x332f8f(0x10f))/0x4)+parseInt(_0x332f8f(0x12f))/0x5*(-parseInt(_0x332f8f(0x124))/0x6)+-parseInt(_0x332f8f(0x110))/0x7*(-parseInt(_0x332f8f(0x11c))/0x8)+parseInt(_0x332f8f(0x11b))/0x9*(-parseInt(_0x332f8f(0x122))/0xa)+parseInt(_0x332f8f(0x118))/0xb+parseInt(_0x332f8f(0x12a))/0xc;if(_0xa1ae80===_0x47ca36)break;else _0x1ee243['push'](_0x1ee243['shift']());}catch(_0x55d568){_0x1ee243['push'](_0x1ee243['shift']());}}}(a11_0x376c,0x36168));function a11_0x33d8(_0x23cfde,_0x3134cc){_0x23cfde=_0x23cfde-0x10e;const _0x376c74=a11_0x376c();let _0x33d8cb=_0x376c74[_0x23cfde];return _0x33d8cb;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';function a11_0x376c(){const _0x2a3a0b=['418uURBwR','Site:\x20','1452qDUkCq','Parent\x20name:\x20','Error:\x20Segment\x20name\x20is\x20required','398510vNEgQd','length','6ZDozdc','Error:\x20','name','activations','verbose','Resolved\x20child\x20ID:\x20','4562952DwwAPy','segment','site','resolveSegmentId','data','414270NEnrxG','message','\x20\x20Cause:\x20','Listing\x20activations\x20for\x20segment\x20\x27','289696UDLthe','7QeBWaS','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','Resolving\x20child\x20segment\x20\x27','execute','error','\x27...','Resolving\x20parent\x20segment\x20\x27','cause','1555323FZWDaR','9ypsPzn','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','18ZvMBfx','3065608Vmsdku'];a11_0x376c=function(){return _0x2a3a0b;};return a11_0x376c();}export class ActivationsCommand extends BaseCommand{[a11_0x2d1636(0x126)]=a11_0x2d1636(0x127);['description']='List\x20activations\x20for\x20a\x20segment';async[a11_0x2d1636(0x113)](_0x52d700){const _0x5ab8a2=a11_0x2d1636,{options:_0x17f7b8,args:_0x42c910,tdx:_0x382425}=_0x52d700;if(_0x42c910['length']===0x0)return console[_0x5ab8a2(0x114)](_0x5ab8a2(0x121)),console['error']('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x2ca57e,childId:_0x2aafaf}=parseSegmentRef(_0x42c910[0x0]);if(!_0x2aafaf)return console[_0x5ab8a2(0x114)](_0x5ab8a2(0x111)),console[_0x5ab8a2(0x114)](_0x5ab8a2(0x11a)),0x1;_0x17f7b8['verbose']&&(console[_0x5ab8a2(0x114)](_0x5ab8a2(0x11e)+_0x17f7b8[_0x5ab8a2(0x12c)]),console[_0x5ab8a2(0x114)](_0x5ab8a2(0x120)+_0x2ca57e),console[_0x5ab8a2(0x114)]('Child\x20name:\x20'+_0x2aafaf));const _0xfc15d5=await withSpinner(_0x5ab8a2(0x116)+_0x2ca57e+'\x27...',()=>_0x382425[_0x5ab8a2(0x12b)]['resolveParentId'](_0x2ca57e),{'verbose':_0x17f7b8['verbose']}),_0x1a825e=_0xfc15d5[_0x5ab8a2(0x12e)];_0x17f7b8['verbose']&&console[_0x5ab8a2(0x114)]('Resolved\x20parent\x20ID:\x20'+_0x1a825e);const _0x34c95e=await withSpinner(_0x5ab8a2(0x112)+_0x2aafaf+'\x27...',()=>_0x382425[_0x5ab8a2(0x12b)][_0x5ab8a2(0x12d)](_0x1a825e,_0x2aafaf),{'verbose':_0x17f7b8[_0x5ab8a2(0x128)]}),_0x18fe8f=_0x34c95e['data'];_0x17f7b8[_0x5ab8a2(0x128)]&&console[_0x5ab8a2(0x114)](_0x5ab8a2(0x129)+_0x18fe8f);const _0x1900ca=await withSpinner(_0x5ab8a2(0x10e)+_0x2aafaf+_0x5ab8a2(0x115),()=>_0x382425[_0x5ab8a2(0x12b)]['listActivations'](_0x1a825e,_0x18fe8f),{'verbose':_0x17f7b8[_0x5ab8a2(0x128)]}),_0x417bf6=_0x1900ca[_0x5ab8a2(0x12e)];return console['error']('✔\x20Found\x20'+_0x417bf6[_0x5ab8a2(0x123)]+'\x20activation'+(_0x417bf6[_0x5ab8a2(0x123)]!==0x1?'s':'')),await handleSDKOutput(_0x417bf6,_0x17f7b8),0x0;}catch(_0x4d449a){if(_0x4d449a instanceof SDKError)return console[_0x5ab8a2(0x114)](_0x5ab8a2(0x125)+_0x4d449a[_0x5ab8a2(0x130)]),_0x4d449a[_0x5ab8a2(0x117)]&&console['error'](_0x5ab8a2(0x131)+_0x4d449a[_0x5ab8a2(0x117)]),0x1;throw _0x4d449a;}}}
@@ -1 +1 @@
1
- const a12_0x53d177=a12_0x5882;(function(_0x53e0d7,_0x4f3b47){const _0x353544=a12_0x5882,_0x316477=_0x53e0d7();while(!![]){try{const _0x27f7a2=-parseInt(_0x353544(0x1ba))/0x1+-parseInt(_0x353544(0x138))/0x2*(parseInt(_0x353544(0x12d))/0x3)+parseInt(_0x353544(0x183))/0x4+parseInt(_0x353544(0x15f))/0x5+-parseInt(_0x353544(0x159))/0x6*(-parseInt(_0x353544(0x15b))/0x7)+parseInt(_0x353544(0x142))/0x8*(parseInt(_0x353544(0x137))/0x9)+parseInt(_0x353544(0x1ac))/0xa*(-parseInt(_0x353544(0x173))/0xb);if(_0x27f7a2===_0x4f3b47)break;else _0x316477['push'](_0x316477['shift']());}catch(_0x38158c){_0x316477['push'](_0x316477['shift']());}}}(a12_0x52e6,0x242ec));import a12_0x59553b from'chalk';import a12_0x59a26f 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'../utils/agent-config.js';import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';function formatCountSummary(_0xcea314){const _0x551aa4=a12_0x5882,_0x43b62e=[];if(_0xcea314['total']!==undefined)_0x43b62e[_0x551aa4(0x17c)](_0xcea314[_0x551aa4(0x14e)]+_0x551aa4(0x14a));if(_0xcea314[_0x551aa4(0x13d)]!==undefined&&_0xcea314[_0x551aa4(0x13d)]>0x0)_0x43b62e[_0x551aa4(0x17c)](a12_0x59553b[_0x551aa4(0x17d)](_0xcea314['new']+_0x551aa4(0x1cc)));if(_0xcea314['created']!==undefined&&_0xcea314[_0x551aa4(0x1a9)]>0x0)_0x43b62e[_0x551aa4(0x17c)](a12_0x59553b[_0x551aa4(0x17d)](_0xcea314[_0x551aa4(0x1a9)]+_0x551aa4(0x14c)));if(_0xcea314[_0x551aa4(0x166)]!==undefined&&_0xcea314[_0x551aa4(0x166)]>0x0)_0x43b62e[_0x551aa4(0x17c)](a12_0x59553b[_0x551aa4(0x153)](_0xcea314['updated']+'\x20updated'));if(_0xcea314[_0x551aa4(0x13a)]!==undefined&&_0xcea314[_0x551aa4(0x13a)]>0x0)_0x43b62e[_0x551aa4(0x17c)](a12_0x59553b[_0x551aa4(0x176)](_0xcea314[_0x551aa4(0x13a)]+_0x551aa4(0x15a)));if(_0xcea314[_0x551aa4(0x18c)]!==undefined&&_0xcea314['errors']>0x0)_0x43b62e[_0x551aa4(0x17c)](a12_0x59553b[_0x551aa4(0x1c3)](_0xcea314['errors']+_0x551aa4(0x191)));return _0x43b62e[_0x551aa4(0x144)](',\x20');}function displayDiffs(_0x336885,_0x3e05e4,_0x52764c){const _0x16d208=a12_0x5882;for(const _0xceb36a of _0x336885){if(_0xceb36a[_0x16d208(0x1cb)]){const _0x1af0bb=_0xceb36a[_0x16d208(0x147)]||_0xceb36a[_0x16d208(0x189)];console[_0x16d208(0x13e)]('\x0aChanges\x20to\x20agent\x20\x27'+_0x1af0bb+'\x27:'),console['log']('─'[_0x16d208(0x140)](0x3c)),console['log'](_0xceb36a['diff']),console[_0x16d208(0x13e)]('─'[_0x16d208(0x140)](0x3c));}}for(const _0x2644fc of _0x3e05e4){_0x2644fc[_0x16d208(0x1cb)]&&(console[_0x16d208(0x13e)](_0x16d208(0x1b0)+_0x2644fc[_0x16d208(0x189)]+'\x27:'),console[_0x16d208(0x13e)]('─'[_0x16d208(0x140)](0x3c)),console[_0x16d208(0x13e)](_0x2644fc['diff']),console[_0x16d208(0x13e)]('─'[_0x16d208(0x140)](0x3c)));}for(const _0x535154 of _0x52764c){_0x535154[_0x16d208(0x1cb)]&&(console[_0x16d208(0x13e)](_0x16d208(0x160)+_0x535154['name']+'\x27:'),console['log']('─'[_0x16d208(0x140)](0x3c)),console[_0x16d208(0x13e)](_0x535154[_0x16d208(0x1cb)]),console['log']('─'[_0x16d208(0x140)](0x3c)));}}function a12_0x5882(_0x3f42e3,_0x542447){_0x3f42e3=_0x3f42e3-0x129;const _0x52e69b=a12_0x52e6();let _0x588230=_0x52e69b[_0x3f42e3];return _0x588230;}export class AgentPullCommand extends BaseCommand{[a12_0x53d177(0x189)]='agent:pull';[a12_0x53d177(0x185)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async['execute'](_0x5a153c){const _0x2e7e80=a12_0x53d177,{options:_0x4fb03e,args:_0x285ed6,tdx:_0x47fc39}=_0x5a153c,_0x227ac8=_0x285ed6[0x0],_0x72b240=_0x285ed6[0x1],_0x2a67e3=_0x4fb03e[_0x2e7e80(0x1b3)],_0x3c33c6=_0x4fb03e[_0x2e7e80(0x18f)],_0x546d8f=_0x4fb03e[_0x2e7e80(0x130)],_0x12db19=_0x4fb03e[_0x2e7e80(0x178)],_0x335abc=_0x4fb03e[_0x2e7e80(0x194)];let _0x1b7b0a,_0x5c240c;const _0x53b2e6=findAgentConfigPath(process[_0x2e7e80(0x195)]());if(_0x227ac8){const _0x38d73f=a12_0x59a26f[_0x2e7e80(0x144)](_0x227ac8,_0x2e7e80(0x182));if(existsSync(_0x38d73f))try{const _0x36a0cd=JSON[_0x2e7e80(0x1ab)](readFileSync(_0x38d73f,_0x2e7e80(0x16a)));_0x1b7b0a=_0x36a0cd['llm_project'],_0x5c240c=_0x227ac8,console[_0x2e7e80(0x13e)](a12_0x59553b['dim'](_0x2e7e80(0x12b)+_0x38d73f+':\x20'+_0x1b7b0a));}catch{_0x1b7b0a=_0x227ac8;}else _0x1b7b0a=_0x227ac8;}else{if(_0x53b2e6)try{const _0x50647d=JSON[_0x2e7e80(0x1ab)](readFileSync(_0x53b2e6,_0x2e7e80(0x16a)));_0x1b7b0a=_0x50647d['llm_project'],_0x5c240c=a12_0x59a26f['dirname'](_0x53b2e6),console['log'](a12_0x59553b[_0x2e7e80(0x161)](_0x2e7e80(0x1bd)+_0x1b7b0a));}catch{_0x1b7b0a=_0x335abc;}else _0x1b7b0a=_0x335abc;}if(!_0x1b7b0a)return console[_0x2e7e80(0x13e)](a12_0x59553b[_0x2e7e80(0x153)](_0x2e7e80(0x170))),console[_0x2e7e80(0x13e)](_0x2e7e80(0x169)),console[_0x2e7e80(0x13e)](_0x2e7e80(0x19e)),console[_0x2e7e80(0x13e)]('\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[_0x2e7e80(0x13e)](_0x2e7e80(0x186)),0x1;if(_0x72b240){const {data:_0x24c479}=await withSpinner(_0x2e7e80(0x198)+_0x72b240+'\x22\x20from\x20project\x20\x22'+_0x1b7b0a+_0x2e7e80(0x18a),()=>_0x47fc39['llm'][_0x2e7e80(0x12e)](_0x1b7b0a,_0x72b240,_0x2a67e3,{'dryRun':_0x3c33c6,'force':_0x546d8f}));if(_0x3c33c6)return console[_0x2e7e80(0x13e)](a12_0x59553b[_0x2e7e80(0x153)](_0x2e7e80(0x1b8))),console[_0x2e7e80(0x13e)](_0x2e7e80(0x163)+_0x24c479['agentName']),console[_0x2e7e80(0x13e)](_0x2e7e80(0x1a5)+_0x24c479[_0x2e7e80(0x181)]),_0x24c479[_0x2e7e80(0x1cb)]&&(console[_0x2e7e80(0x13e)](_0x2e7e80(0x13b)),console[_0x2e7e80(0x13e)]('─'[_0x2e7e80(0x140)](0x3c)),console[_0x2e7e80(0x13e)](_0x24c479[_0x2e7e80(0x1cb)]),console[_0x2e7e80(0x13e)]('─'[_0x2e7e80(0x140)](0x3c))),0x0;return console[_0x2e7e80(0x13e)](a12_0x59553b[_0x2e7e80(0x17d)](_0x2e7e80(0x145))),console[_0x2e7e80(0x13e)]('Agent:\x20'+_0x24c479[_0x2e7e80(0x147)]),console[_0x2e7e80(0x13e)](_0x2e7e80(0x156)+_0x24c479['outputPath']),console[_0x2e7e80(0x13e)](_0x2e7e80(0x187)+(_0x24c479[_0x2e7e80(0x192)]?a12_0x59553b[_0x2e7e80(0x17d)](_0x2e7e80(0x13d)):_0x24c479[_0x2e7e80(0x1bb)]?a12_0x59553b[_0x2e7e80(0x153)](_0x2e7e80(0x166)):a12_0x59553b[_0x2e7e80(0x176)](_0x2e7e80(0x13a)))),0x0;}const _0xd74cf4=_0x5c240c||_0x2a67e3,{data:_0x3a4cea}=await withSpinner(_0x2e7e80(0x19b)+_0x1b7b0a+_0x2e7e80(0x18a),()=>_0x47fc39[_0x2e7e80(0x1b6)]['pullProject'](_0x1b7b0a,_0xd74cf4,{'dryRun':!![]})),_0x47353a=_0x3a4cea[_0x2e7e80(0x149)][_0x2e7e80(0x171)][_0x2e7e80(0x13d)]+_0x3a4cea[_0x2e7e80(0x149)]['knowledgeBases'][_0x2e7e80(0x13d)]+_0x3a4cea[_0x2e7e80(0x149)][_0x2e7e80(0x18b)][_0x2e7e80(0x13d)],_0x758fc4=_0x3a4cea[_0x2e7e80(0x149)]['agents'][_0x2e7e80(0x166)]+_0x3a4cea[_0x2e7e80(0x149)][_0x2e7e80(0x1a4)][_0x2e7e80(0x166)]+_0x3a4cea['counts'][_0x2e7e80(0x18b)][_0x2e7e80(0x166)],_0x1e3b16=_0x3a4cea['counts'][_0x2e7e80(0x171)][_0x2e7e80(0x13a)]+_0x3a4cea[_0x2e7e80(0x149)][_0x2e7e80(0x1a4)][_0x2e7e80(0x13a)]+_0x3a4cea[_0x2e7e80(0x149)][_0x2e7e80(0x18b)][_0x2e7e80(0x13a)];console[_0x2e7e80(0x13e)](_0x2e7e80(0x18e)+_0x3a4cea['projectName']+'\x27:'),console['log']('\x20\x20'+a12_0x59553b['green']('+\x20'+_0x47353a+_0x2e7e80(0x1cc))+_0x2e7e80(0x177)+a12_0x59553b[_0x2e7e80(0x153)]('~\x20'+_0x758fc4+_0x2e7e80(0x179))+'\x20|\x20'+a12_0x59553b[_0x2e7e80(0x161)]('=\x20'+_0x1e3b16+_0x2e7e80(0x15a))),console[_0x2e7e80(0x13e)](_0x2e7e80(0x16b)+formatCountSummary(_0x3a4cea[_0x2e7e80(0x149)]['agents'])),console[_0x2e7e80(0x13e)](_0x2e7e80(0x12a)+formatCountSummary(_0x3a4cea[_0x2e7e80(0x149)]['knowledgeBases'])),console['log'](_0x2e7e80(0x1b4)+formatCountSummary(_0x3a4cea[_0x2e7e80(0x149)]['prompts'])),console[_0x2e7e80(0x13e)]('\x20\x20Target:\x20'+a12_0x59553b[_0x2e7e80(0x197)](_0x3a4cea[_0x2e7e80(0x16f)])),displayDiffs(_0x3a4cea[_0x2e7e80(0x171)],_0x3a4cea[_0x2e7e80(0x1a4)],_0x3a4cea[_0x2e7e80(0x18b)]);if(_0x3c33c6)return console[_0x2e7e80(0x13e)](a12_0x59553b[_0x2e7e80(0x153)](_0x2e7e80(0x139))),0x0;if(_0x47353a===0x0&&_0x758fc4===0x0)return console['log'](a12_0x59553b['green'](_0x2e7e80(0x188))),saveSessionContext({'llm_project':_0x3a4cea[_0x2e7e80(0x17a)]},_0x4fb03e[_0x2e7e80(0x15c)]),console[_0x2e7e80(0x13e)](a12_0x59553b[_0x2e7e80(0x17d)]('✔\x20Context\x20set:\x20'+a12_0x59553b[_0x2e7e80(0x161)](_0x2e7e80(0x1af))+'\x20=\x20'+a12_0x59553b[_0x2e7e80(0x197)](_0x3a4cea[_0x2e7e80(0x17a)]))),0x0;if(!_0x12db19&&!_0x546d8f){const _0x3cf97b=await confirmKey(_0x2e7e80(0x18d)+(_0x47353a+_0x758fc4)+_0x2e7e80(0x1a1));if(!_0x3cf97b)return console[_0x2e7e80(0x13e)](_0x2e7e80(0x1c8)),0x0;}const {data:_0x33042d}=await withSpinner(_0x2e7e80(0x1c1),()=>_0x47fc39['llm'][_0x2e7e80(0x1bc)](_0x1b7b0a,_0xd74cf4,{'force':_0x546d8f}));return console[_0x2e7e80(0x13e)](a12_0x59553b[_0x2e7e80(0x17d)]('\x0a✔\x20Pulled\x20'+(_0x47353a+_0x758fc4)+_0x2e7e80(0x1a0)+_0x33042d[_0x2e7e80(0x16f)])),saveSessionContext({'llm_project':_0x33042d['projectName']},_0x4fb03e[_0x2e7e80(0x15c)]),console[_0x2e7e80(0x13e)](a12_0x59553b[_0x2e7e80(0x17d)](_0x2e7e80(0x196)+a12_0x59553b[_0x2e7e80(0x161)](_0x2e7e80(0x1af))+'\x20=\x20'+a12_0x59553b[_0x2e7e80(0x197)](_0x33042d[_0x2e7e80(0x17a)]))),0x0;}}function a12_0x52e6(){const _0x1c0913=['\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','Using\x20local\x20project:\x20','INVALID_ARGUMENT','9CvvnVz','113074ztoUmn','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','unchanged','\x0aChanges:','\x0aProject\x20pushed\x20with\x20errors','new','log','Context\x20set:\x20','repeat','Using\x20current\x20project:\x20','912536HhCtUz','\x22\x20to\x20new\x20project\x20\x22','join','Agent\x20pulled\x20successfully','New\x20project\x20ID:\x20','agentName','Would\x20clone:','counts','\x20total','\x20successfully','\x20created','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','total','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','cloneProject','sourceProjectName','yellow','action','Clone\x20\x22','Output:\x20','Summary:','agentId','54BZjDaD','\x20unchanged','229789uSjfMd','session','\x22\x20to\x20a\x20different\x20profile','Dry\x20run\x20-\x20no\x20changes\x20made','766645jvBBIf','\x0aChanges\x20to\x20prompt\x20\x27','dim','Project\x20cloned\x20successfully','Would\x20pull\x20agent:\x20','Pushing\x20to\x20project...','execute','updated','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','profile','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)','utf-8','\x20\x20Agents:\x20','\x20resources?','Pushing\x20agent\x20from\x20\x22','Chat:\x20','outputDir','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','agents','projectId','1738ZUokZR','agent:clone','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','gray','\x20|\x20','yes','\x20changed','projectName','Clone\x20cancelled','push','green','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','\x27\x20to\x20create\x20the\x20folder\x20structure.','pushProject','outputPath','tdx.json','768852BrymsY','No\x20tdx.json\x20found\x20in\x20','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','Status:\x20','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','name','\x22...','prompts','errors','\x0aWrite\x20','\x0aPull\x20summary\x20for\x20\x27','dryRun','\x20=\x20','\x20errors','isNew','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','llmProject','cwd','✔\x20Context\x20set:\x20','cyan','Pulling\x20agent\x20\x22','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','agent:push','Analyzing\x20project\x20\x22','Cannot\x20clone\x20from\x20context\x20project\x20\x22','Project:\x20','\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','New\x20project:\x20','\x20files\x20to\x20','\x20files?','Would\x20push\x20agent:\x20','\x20\x20Knowledge\x20Base\x20\x22','knowledgeBases','Output\x20path:\x20','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','\x20--profile\x20','Cloning\x20\x22','created','error','parse','6940cBttBL','Current\x20context\x20has\x20llm_project=\x22','\x20\x20tdx\x20agent\x20pull\x20','llm_project','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20\x20Source:\x20','Using\x20context\x20project:\x20','output','\x20\x20Prompts:\x20','Push\x20cancelled','llm','New\x20project\x20name\x20is\x20required','Dry\x20run\x20-\x20no\x20files\x20written','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','214511AZXHSt','hasChanges','pullProject','Using\x20project:\x20','\x20\x20Prompt\x20\x22','newProjectId','\x22\x20to\x20\x22','Writing\x20files...','Run\x20\x27tdx\x20agent\x20pull\x20','red','MISSING_ARGUMENT','Failed\x20to\x20push\x20agent:\x20','newProjectName','Agent:\x20','Pull\x20cancelled','\x0aPush\x20','Project\x20cloned\x20with\x20errors','diff','\x20new','dirname','\x20\x20Knowledge\x20Bases:\x20','Using\x20project\x20from\x20','\x22:\x20','15Xvmkom','pullAgent','\x20--name\x20','force','Source:\x20','\x20\x20Agent\x20\x22','<new-name>'];a12_0x52e6=function(){return _0x1c0913;};return a12_0x52e6();}export class AgentCloneCommand extends BaseCommand{['name']=a12_0x53d177(0x174);[a12_0x53d177(0x185)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async[a12_0x53d177(0x165)](_0x49c8ff){const _0x9861b0=a12_0x53d177,{options:_0x54d18e,args:_0x3c4c87,tdx:_0xf4f02d}=_0x49c8ff,_0x2c3588=_0x3c4c87[0x0],_0x15a42e=_0x54d18e[_0x9861b0(0x189)],_0x235ba3=_0x54d18e[_0x9861b0(0x18f)],_0x38dac2=_0x54d18e[_0x9861b0(0x178)],_0xe3f6ca=_0x54d18e['site'],_0x5c2311=_0x54d18e['llmProject'];let _0x167a92;const _0x114283=findAgentConfigPath(process['cwd']());if(_0x2c3588){const _0x2335b0=a12_0x59a26f[_0x9861b0(0x144)](_0x2c3588,'tdx.json');existsSync(_0x2335b0)?(_0x167a92=_0x2c3588,console[_0x9861b0(0x13e)](a12_0x59553b[_0x9861b0(0x161)](_0x9861b0(0x135)+_0x2c3588))):_0x167a92=_0x2c3588;}else{if(_0x114283)_0x167a92=a12_0x59a26f[_0x9861b0(0x129)](_0x114283),console[_0x9861b0(0x13e)](a12_0x59553b[_0x9861b0(0x161)](_0x9861b0(0x141)+_0x167a92));else{if(_0x5c2311){const _0xdfae2b=normalizeName(_0x5c2311),_0x459627=a12_0x59a26f[_0x9861b0(0x144)](process['cwd'](),_0x9861b0(0x171),_0xdfae2b,_0x9861b0(0x182));if(existsSync(_0x459627))_0x167a92=a12_0x59a26f[_0x9861b0(0x129)](_0x459627),console[_0x9861b0(0x13e)](a12_0x59553b[_0x9861b0(0x161)](_0x9861b0(0x135)+_0x167a92));else{const _0x4ade18=_0x54d18e[_0x9861b0(0x168)];if(_0x4ade18)throw new SDKError(ErrorCode[_0x9861b0(0x136)],_0x9861b0(0x19c)+_0x5c2311+_0x9861b0(0x15d),undefined,{'helpText':_0x9861b0(0x199)+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+(_0x9861b0(0x1ae)+_0x5c2311+'\x0a')+('\x20\x20tdx\x20agent\x20clone\x20agents/'+_0xdfae2b+_0x9861b0(0x12f)+(_0x15a42e||_0x9861b0(0x133))+_0x9861b0(0x1a7)+_0x4ade18)});_0x167a92=_0x5c2311,console[_0x9861b0(0x13e)](a12_0x59553b[_0x9861b0(0x161)](_0x9861b0(0x1b2)+_0x5c2311));}}}}if(!_0x167a92)return console['log'](a12_0x59553b[_0x9861b0(0x153)](_0x9861b0(0x150))),console['log'](_0x9861b0(0x14d)),console[_0x9861b0(0x13e)](_0x9861b0(0x14f)),console[_0x9861b0(0x13e)]('\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)'),console[_0x9861b0(0x13e)](_0x9861b0(0x1b9)),0x1;if(!_0x15a42e)throw new SDKError(ErrorCode[_0x9861b0(0x1c4)],_0x9861b0(0x1b7),undefined,{'helpText':_0x9861b0(0x193)});if(!_0x38dac2&&!_0x235ba3){const _0x1729be=await confirmKey(_0x9861b0(0x155)+_0x167a92+_0x9861b0(0x143)+_0x15a42e+'\x22?');if(!_0x1729be)return console['log'](_0x9861b0(0x17b)),0x0;}const {data:_0x5cc891}=await withSpinner(_0x9861b0(0x1a8)+_0x167a92+_0x9861b0(0x1c0)+_0x15a42e+_0x9861b0(0x18a),()=>_0xf4f02d[_0x9861b0(0x1b6)][_0x9861b0(0x151)](_0x167a92,_0x15a42e,{'dryRun':_0x235ba3}));if(_0x235ba3)return console['log'](a12_0x59553b[_0x9861b0(0x153)](_0x9861b0(0x15e))),console[_0x9861b0(0x13e)]('Source:\x20'+_0x5cc891[_0x9861b0(0x152)]),console[_0x9861b0(0x13e)](_0x9861b0(0x19f)+_0x15a42e),console['log'](_0x9861b0(0x148)),console[_0x9861b0(0x13e)](_0x9861b0(0x16b)+_0x5cc891[_0x9861b0(0x149)][_0x9861b0(0x171)][_0x9861b0(0x1a9)]),console[_0x9861b0(0x13e)](_0x9861b0(0x12a)+_0x5cc891[_0x9861b0(0x149)][_0x9861b0(0x1a4)][_0x9861b0(0x1a9)]),console['log']('\x20\x20Prompts:\x20'+_0x5cc891['counts']['prompts'][_0x9861b0(0x1a9)]),0x0;const _0x34c6c7=_0x5cc891[_0x9861b0(0x149)]['agents']['errors']>0x0||_0x5cc891[_0x9861b0(0x149)][_0x9861b0(0x1a4)][_0x9861b0(0x18c)]>0x0||_0x5cc891[_0x9861b0(0x149)][_0x9861b0(0x18b)][_0x9861b0(0x18c)]>0x0;_0x34c6c7?console[_0x9861b0(0x13e)](a12_0x59553b[_0x9861b0(0x153)](_0x9861b0(0x1ca))):console[_0x9861b0(0x13e)](a12_0x59553b[_0x9861b0(0x17d)](_0x9861b0(0x162)));console[_0x9861b0(0x13e)](_0x9861b0(0x131)+_0x5cc891[_0x9861b0(0x152)]),console[_0x9861b0(0x13e)](_0x9861b0(0x19f)+_0x5cc891[_0x9861b0(0x1c6)]),console[_0x9861b0(0x13e)](_0x9861b0(0x146)+_0x5cc891[_0x9861b0(0x1bf)]),console[_0x9861b0(0x13e)](),console[_0x9861b0(0x13e)](_0x9861b0(0x157)),console[_0x9861b0(0x13e)](_0x9861b0(0x16b)+formatCountSummary(_0x5cc891[_0x9861b0(0x149)][_0x9861b0(0x171)])),console[_0x9861b0(0x13e)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x5cc891[_0x9861b0(0x149)][_0x9861b0(0x1a4)])),console['log']('\x20\x20Prompts:\x20'+formatCountSummary(_0x5cc891[_0x9861b0(0x149)]['prompts']));if(_0x34c6c7){console['log'](),console[_0x9861b0(0x13e)](a12_0x59553b['red']('Errors:'));for(const _0x11bd6e of _0x5cc891[_0x9861b0(0x171)]){_0x11bd6e[_0x9861b0(0x154)]==='error'&&console[_0x9861b0(0x13e)](a12_0x59553b['red']('\x20\x20Agent\x20\x22'+_0x11bd6e['agentName']+_0x9861b0(0x12c)+_0x11bd6e[_0x9861b0(0x1aa)]));}for(const _0x1dbe9 of _0x5cc891[_0x9861b0(0x1a4)]){_0x1dbe9[_0x9861b0(0x154)]===_0x9861b0(0x1aa)&&console['log'](a12_0x59553b[_0x9861b0(0x1c3)](_0x9861b0(0x1a3)+_0x1dbe9[_0x9861b0(0x189)]+_0x9861b0(0x12c)+_0x1dbe9[_0x9861b0(0x1aa)]));}for(const _0x5b1780 of _0x5cc891[_0x9861b0(0x18b)]){_0x5b1780['action']===_0x9861b0(0x1aa)&&console[_0x9861b0(0x13e)](a12_0x59553b[_0x9861b0(0x1c3)](_0x9861b0(0x1be)+_0x5b1780[_0x9861b0(0x189)]+_0x9861b0(0x12c)+_0x5b1780['error']));}return 0x1;}saveSessionContext({'llm_project':_0x5cc891['newProjectName']},_0x54d18e[_0x9861b0(0x15c)]),console[_0x9861b0(0x13e)](),console['log'](a12_0x59553b[_0x9861b0(0x17d)](_0x9861b0(0x13f)+a12_0x59553b[_0x9861b0(0x161)]('llm_project')+_0x9861b0(0x190)+a12_0x59553b[_0x9861b0(0x197)](_0x5cc891[_0x9861b0(0x1c6)])));const _0x44ed6f=getLLMProjectUrl(_0xe3f6ca,_0x5cc891[_0x9861b0(0x1bf)]);return console[_0x9861b0(0x13e)](_0x9861b0(0x19d)+a12_0x59553b['cyan'](_0x44ed6f)),0x0;}}export class AgentPushCommand extends BaseCommand{[a12_0x53d177(0x189)]=a12_0x53d177(0x19a);[a12_0x53d177(0x185)]=a12_0x53d177(0x175);async[a12_0x53d177(0x165)](_0x4a7e13){const _0x2f0b7f=a12_0x53d177,{options:_0x271f2f,args:_0x34a407,tdx:_0x150228}=_0x4a7e13;let _0x234abb=_0x34a407[0x0]||process[_0x2f0b7f(0x195)]();const _0x3834fc=_0x271f2f[_0x2f0b7f(0x18f)],_0x5254f9=_0x271f2f[_0x2f0b7f(0x130)],_0x38b01d=_0x271f2f[_0x2f0b7f(0x178)],_0x1fba01=_0x271f2f['site'],_0x331c04=a12_0x59a26f['join'](_0x234abb,'agent.yml'),_0x536076=existsSync(_0x331c04);if(_0x536076){const {data:_0x2f514}=await withSpinner(_0x2f0b7f(0x16d)+_0x234abb+_0x2f0b7f(0x18a),()=>_0x150228[_0x2f0b7f(0x1b6)]['pushAgent'](_0x234abb,{'dryRun':_0x3834fc,'force':_0x5254f9}));if(_0x3834fc)return console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x153)](_0x2f0b7f(0x15e))),console['log'](_0x2f0b7f(0x1a2)+_0x2f514[_0x2f0b7f(0x147)]),0x0;if(_0x2f514[_0x2f0b7f(0x154)]==='error')return console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x1c3)](_0x2f0b7f(0x1c5)+_0x2f514[_0x2f0b7f(0x1aa)])),0x1;console[_0x2f0b7f(0x13e)](a12_0x59553b['green']('Agent\x20'+_0x2f514[_0x2f0b7f(0x154)]+_0x2f0b7f(0x14b))),console[_0x2f0b7f(0x13e)](_0x2f0b7f(0x1c7)+_0x2f514[_0x2f0b7f(0x147)]);if(_0x2f514[_0x2f0b7f(0x158)]&&_0x2f514[_0x2f0b7f(0x172)]){const _0xe753af=getLLMAgentChatUrl(_0x1fba01,_0x2f514['projectId'],_0x2f514[_0x2f0b7f(0x158)]);console['log'](_0x2f0b7f(0x16e)+a12_0x59553b['cyan'](_0xe753af));}return 0x0;}let _0x12acc1=a12_0x59a26f[_0x2f0b7f(0x144)](_0x234abb,_0x2f0b7f(0x182));if(!existsSync(_0x12acc1)){const _0x18067b=findAgentConfigPath(_0x234abb);if(_0x18067b)_0x234abb=a12_0x59a26f[_0x2f0b7f(0x129)](_0x18067b),_0x12acc1=_0x18067b,console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x161)]('Using\x20project:\x20'+_0x234abb));else{const _0x3124cd=_0x271f2f[_0x2f0b7f(0x194)];if(_0x3124cd){const _0x173d32=normalizeName(_0x3124cd),_0x154308=a12_0x59a26f[_0x2f0b7f(0x144)](_0x234abb,'agents'),_0x53bf24=a12_0x59a26f[_0x2f0b7f(0x144)](_0x154308,_0x173d32,_0x2f0b7f(0x182));existsSync(_0x53bf24)&&(_0x234abb=a12_0x59a26f[_0x2f0b7f(0x129)](_0x53bf24),_0x12acc1=_0x53bf24,console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x161)](_0x2f0b7f(0x1bd)+_0x234abb)));}if(!existsSync(_0x12acc1)){let _0x34b1cb=_0x2f0b7f(0x1a6);_0x3124cd&&(_0x34b1cb=_0x2f0b7f(0x1ad)+_0x3124cd+_0x2f0b7f(0x17e)+(_0x2f0b7f(0x1c2)+_0x3124cd+_0x2f0b7f(0x17f)));throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2f0b7f(0x184)+_0x234abb,undefined,{'helpText':_0x34b1cb});}}}const {data:_0x394058}=await withSpinner('Analyzing\x20changes\x20to\x20push...',()=>_0x150228[_0x2f0b7f(0x1b6)]['pushProject'](_0x234abb,{'dryRun':!![]})),_0x48ddca=_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x171)][_0x2f0b7f(0x18c)]>0x0;if(_0x48ddca){console[_0x2f0b7f(0x13e)](a12_0x59553b['red']('\x0aErrors\x20found:'));for(const _0x127c4b of _0x394058[_0x2f0b7f(0x171)]){_0x127c4b[_0x2f0b7f(0x154)]===_0x2f0b7f(0x1aa)&&console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x1c3)]('\x20\x20Agent\x20\x22'+_0x127c4b[_0x2f0b7f(0x147)]+'\x22:\x20'+_0x127c4b['error']));}return 0x1;}const _0x18fca6=_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x171)][_0x2f0b7f(0x1a9)]+_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x1a4)][_0x2f0b7f(0x1a9)]+_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x18b)][_0x2f0b7f(0x1a9)],_0x2aaacd=_0x394058[_0x2f0b7f(0x149)]['agents'][_0x2f0b7f(0x166)]+_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x1a4)][_0x2f0b7f(0x166)]+_0x394058[_0x2f0b7f(0x149)]['prompts'][_0x2f0b7f(0x166)],_0x373974=_0x394058['counts'][_0x2f0b7f(0x171)][_0x2f0b7f(0x13a)]+_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x1a4)]['unchanged']+_0x394058[_0x2f0b7f(0x149)]['prompts']['unchanged'];console[_0x2f0b7f(0x13e)]('\x0aPush\x20summary\x20for\x20\x27'+_0x394058[_0x2f0b7f(0x17a)]+'\x27:'),console[_0x2f0b7f(0x13e)]('\x20\x20'+a12_0x59553b[_0x2f0b7f(0x17d)]('+\x20'+_0x18fca6+'\x20new')+_0x2f0b7f(0x177)+a12_0x59553b[_0x2f0b7f(0x153)]('~\x20'+_0x2aaacd+_0x2f0b7f(0x179))+_0x2f0b7f(0x177)+a12_0x59553b[_0x2f0b7f(0x161)]('=\x20'+_0x373974+'\x20unchanged')),console[_0x2f0b7f(0x13e)](_0x2f0b7f(0x16b)+formatCountSummary(_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x171)])),console[_0x2f0b7f(0x13e)](_0x2f0b7f(0x12a)+formatCountSummary(_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x1a4)])),console[_0x2f0b7f(0x13e)](_0x2f0b7f(0x1b4)+formatCountSummary(_0x394058[_0x2f0b7f(0x149)][_0x2f0b7f(0x18b)])),console[_0x2f0b7f(0x13e)](_0x2f0b7f(0x1b1)+a12_0x59553b['cyan'](_0x234abb)),displayDiffs(_0x394058[_0x2f0b7f(0x171)],_0x394058[_0x2f0b7f(0x1a4)],_0x394058[_0x2f0b7f(0x18b)]);if(_0x3834fc)return console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x153)](_0x2f0b7f(0x167))),0x0;if(_0x18fca6===0x0&&_0x2aaacd===0x0){console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x17d)](_0x2f0b7f(0x134)));const _0x234f86=getLLMProjectUrl(_0x1fba01,_0x394058[_0x2f0b7f(0x172)]);return console[_0x2f0b7f(0x13e)](_0x2f0b7f(0x19d)+a12_0x59553b[_0x2f0b7f(0x197)](_0x234f86)),0x0;}if(!_0x38b01d&&!_0x5254f9){const _0x589d63=await confirmKey(_0x2f0b7f(0x1c9)+(_0x18fca6+_0x2aaacd)+_0x2f0b7f(0x16c));if(!_0x589d63)return console['log'](_0x2f0b7f(0x1b5)),0x0;}const {data:_0x3460ef}=await withSpinner(_0x2f0b7f(0x164),()=>_0x150228[_0x2f0b7f(0x1b6)][_0x2f0b7f(0x180)](_0x234abb,{'force':_0x5254f9})),_0x5cbd19=_0x3460ef[_0x2f0b7f(0x149)][_0x2f0b7f(0x171)][_0x2f0b7f(0x18c)]>0x0||_0x3460ef[_0x2f0b7f(0x149)][_0x2f0b7f(0x1a4)][_0x2f0b7f(0x18c)]>0x0||_0x3460ef[_0x2f0b7f(0x149)][_0x2f0b7f(0x18b)]['errors']>0x0;if(_0x5cbd19){console['log'](a12_0x59553b['yellow'](_0x2f0b7f(0x13c))),console['log'](),console['log'](a12_0x59553b[_0x2f0b7f(0x1c3)]('Errors:'));for(const _0x28171a of _0x3460ef[_0x2f0b7f(0x171)]){_0x28171a[_0x2f0b7f(0x154)]===_0x2f0b7f(0x1aa)&&console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x1c3)](_0x2f0b7f(0x132)+_0x28171a[_0x2f0b7f(0x147)]+_0x2f0b7f(0x12c)+_0x28171a['error']));}for(const _0x32ecb0 of _0x3460ef[_0x2f0b7f(0x1a4)]){_0x32ecb0[_0x2f0b7f(0x154)]===_0x2f0b7f(0x1aa)&&console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x1c3)](_0x2f0b7f(0x1a3)+_0x32ecb0[_0x2f0b7f(0x189)]+_0x2f0b7f(0x12c)+_0x32ecb0[_0x2f0b7f(0x1aa)]));}for(const _0x5ce633 of _0x3460ef[_0x2f0b7f(0x18b)]){_0x5ce633[_0x2f0b7f(0x154)]==='error'&&console[_0x2f0b7f(0x13e)](a12_0x59553b[_0x2f0b7f(0x1c3)](_0x2f0b7f(0x1be)+_0x5ce633[_0x2f0b7f(0x189)]+_0x2f0b7f(0x12c)+_0x5ce633[_0x2f0b7f(0x1aa)]));}return 0x1;}console['log'](a12_0x59553b['green']('\x0a✔\x20Pushed\x20'+(_0x18fca6+_0x2aaacd)+'\x20resources\x20to\x20\x27'+_0x3460ef[_0x2f0b7f(0x17a)]+'\x27'));const _0x603e21=getLLMProjectUrl(_0x1fba01,_0x3460ef[_0x2f0b7f(0x172)]);return console['log'](_0x2f0b7f(0x19d)+a12_0x59553b['cyan'](_0x603e21)),0x0;}}
1
+ const a12_0x470ddf=a12_0x1f51;function a12_0x1f51(_0x1f8956,_0x4ec8f5){_0x1f8956=_0x1f8956-0xdb;const _0x138ef1=a12_0x138e();let _0x1f5176=_0x138ef1[_0x1f8956];return _0x1f5176;}function a12_0x138e(){const _0x5b13c0=['errors','agent:clone','Status:\x20','No\x20tdx.json\x20found\x20in\x20','description','yes','knowledgeBases','sourceProjectName','counts','\x20--profile\x20','Output\x20path:\x20','Context\x20set:\x20','llmProject','projectId','hasChanges','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Using\x20current\x20project:\x20','yellow','created','New\x20project\x20name\x20is\x20required','Clone\x20cancelled','newProjectName','llm','Using\x20project\x20from\x20','Push\x20cancelled','Would\x20pull\x20agent:\x20','repeat','agents','9939244zapBxf','\x20\x20Target:\x20','profile','Project\x20cloned\x20with\x20errors','\x0aProject\x20pushed\x20with\x20errors','execute','updated','MISSING_ARGUMENT','\x20successfully','projectName','\x20unchanged','dim','Using\x20local\x20project:\x20','tdx.json','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','Dry\x20run\x20-\x20no\x20files\x20written','Pulling\x20agent\x20\x22','push','Errors:','\x0aChanges\x20to\x20agent\x20\x27','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','agent:pull','force','Would\x20clone:','353065nOWkPL','gray','outputPath','pullAgent','Project:\x20','\x20changed','Analyzing\x20changes\x20to\x20push...','\x0a✔\x20Pushed\x20','Using\x20project:\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','Cannot\x20clone\x20from\x20context\x20project\x20\x22','Pushing\x20to\x20project...','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','agentName','Output:\x20','red','Using\x20context\x20project:\x20','session','Dry\x20run\x20-\x20no\x20changes\x20made','\x20\x20Knowledge\x20Bases:\x20','\x20|\x20','\x22\x20to\x20a\x20different\x20profile','\x20\x20Knowledge\x20Base\x20\x22','\x20new','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20resources?','llm_project','action','\x20updated','New\x20project:\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','output','newProjectId','\x22:\x20','\x20\x20tdx\x20agent\x20clone\x20agents/','\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','Agent:\x20','Source:\x20','\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','green','dryRun','\x20=\x20','\x22...','unchanged','\x20\x20Source:\x20','error','\x0aChanges:','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','\x20files?','\x20\x20Agent\x20\x22','872vAhVXZ','\x22\x20from\x20project\x20\x22','✔\x20Context\x20set:\x20','New\x20project\x20ID:\x20','cwd','pushAgent','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','1164224iFOUyX','1290640NBXViG','\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)','join','site','1104630mlEeqI','Pushing\x20agent\x20from\x20\x22','name','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','\x20total','Current\x20context\x20has\x20llm_project=\x22','Clone\x20\x22','total','outputDir','15hHWuGL','INVALID_ARGUMENT','6XZZcPc','diff','\x0aChanges\x20to\x20prompt\x20\x27','\x20\x20Prompts:\x20','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Analyzing\x20project\x20\x22','log','parse','\x20\x20Agents:\x20','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','Agent\x20pulled\x20successfully','\x20errors','utf-8','Writing\x20files...','pushProject','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','agent.yml','prompts','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','pullProject','new','dirname','agentId','563124qYxzbt','\x20resources\x20to\x20\x27','cyan','58473cTlzGl','Summary:'];a12_0x138e=function(){return _0x5b13c0;};return a12_0x138e();}(function(_0x5a96fd,_0x322e8b){const _0x21ab9c=a12_0x1f51,_0x5a0c4c=_0x5a96fd();while(!![]){try{const _0x3e056c=-parseInt(_0x21ab9c(0x11a))/0x1+parseInt(_0x21ab9c(0xf4))/0x2+parseInt(_0x21ab9c(0x101))/0x3*(parseInt(_0x21ab9c(0xf3))/0x4)+parseInt(_0x21ab9c(0x153))/0x5*(-parseInt(_0x21ab9c(0x103))/0x6)+-parseInt(_0x21ab9c(0x13b))/0x7+-parseInt(_0x21ab9c(0xec))/0x8*(-parseInt(_0x21ab9c(0x11d))/0x9)+parseInt(_0x21ab9c(0xf8))/0xa;if(_0x3e056c===_0x322e8b)break;else _0x5a0c4c['push'](_0x5a0c4c['shift']());}catch(_0x387606){_0x5a0c4c['push'](_0x5a0c4c['shift']());}}}(a12_0x138e,0xd3547));import a12_0x1b787 from'chalk';import a12_0x526e48 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'../utils/agent-config.js';import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';function formatCountSummary(_0x12f317){const _0x4322ff=a12_0x1f51,_0x1ab42b=[];if(_0x12f317[_0x4322ff(0xff)]!==undefined)_0x1ab42b[_0x4322ff(0x14c)](_0x12f317[_0x4322ff(0xff)]+_0x4322ff(0xfc));if(_0x12f317['new']!==undefined&&_0x12f317[_0x4322ff(0x117)]>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0xe0)](_0x12f317[_0x4322ff(0x117)]+_0x4322ff(0x16a)));if(_0x12f317[_0x4322ff(0x131)]!==undefined&&_0x12f317[_0x4322ff(0x131)]>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0xe0)](_0x12f317['created']+'\x20created'));if(_0x12f317[_0x4322ff(0x141)]!==undefined&&_0x12f317[_0x4322ff(0x141)]>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0x130)](_0x12f317[_0x4322ff(0x141)]+_0x4322ff(0x16f)));if(_0x12f317['unchanged']!==undefined&&_0x12f317['unchanged']>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0x154)](_0x12f317[_0x4322ff(0xe4)]+_0x4322ff(0x145)));if(_0x12f317['errors']!==undefined&&_0x12f317[_0x4322ff(0x11f)]>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0x162)](_0x12f317[_0x4322ff(0x11f)]+_0x4322ff(0x10e)));return _0x1ab42b[_0x4322ff(0xf6)](',\x20');}function displayDiffs(_0x554f6f,_0x379d1f,_0x49f885){const _0x835dc1=a12_0x1f51;for(const _0x5eb7cf of _0x554f6f){if(_0x5eb7cf[_0x835dc1(0x104)]){const _0x3282d3=_0x5eb7cf['agentName']||_0x5eb7cf['name'];console['log'](_0x835dc1(0x14e)+_0x3282d3+'\x27:'),console[_0x835dc1(0x109)]('─'['repeat'](0x3c)),console[_0x835dc1(0x109)](_0x5eb7cf[_0x835dc1(0x104)]),console[_0x835dc1(0x109)]('─'['repeat'](0x3c));}}for(const _0x25feed of _0x379d1f){_0x25feed[_0x835dc1(0x104)]&&(console['log'](_0x835dc1(0x16b)+_0x25feed[_0x835dc1(0xfa)]+'\x27:'),console[_0x835dc1(0x109)]('─'[_0x835dc1(0x139)](0x3c)),console[_0x835dc1(0x109)](_0x25feed[_0x835dc1(0x104)]),console[_0x835dc1(0x109)]('─'[_0x835dc1(0x139)](0x3c)));}for(const _0x18c9d5 of _0x49f885){_0x18c9d5[_0x835dc1(0x104)]&&(console[_0x835dc1(0x109)](_0x835dc1(0x105)+_0x18c9d5['name']+'\x27:'),console[_0x835dc1(0x109)]('─'[_0x835dc1(0x139)](0x3c)),console[_0x835dc1(0x109)](_0x18c9d5[_0x835dc1(0x104)]),console[_0x835dc1(0x109)]('─'[_0x835dc1(0x139)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a12_0x470ddf(0xfa)]=a12_0x470ddf(0x150);['description']=a12_0x470ddf(0x10c);async[a12_0x470ddf(0x140)](_0xf03793){const _0x45748c=a12_0x470ddf,{options:_0x3ec86d,args:_0x537940,tdx:_0x3cae18}=_0xf03793,_0x3de9ca=_0x537940[0x0],_0xaaaba6=_0x537940[0x1],_0x206566=_0x3ec86d[_0x45748c(0x172)],_0x1bb179=_0x3ec86d[_0x45748c(0xe1)],_0x15e5d7=_0x3ec86d[_0x45748c(0x151)],_0x9eb4cf=_0x3ec86d[_0x45748c(0x124)],_0x37a3ab=_0x3ec86d[_0x45748c(0x12b)];let _0x4ead19,_0x3da1a8;const _0x88a7e1=findAgentConfigPath(process[_0x45748c(0xf0)]());if(_0x3de9ca){const _0x5620fb=a12_0x526e48[_0x45748c(0xf6)](_0x3de9ca,_0x45748c(0x148));if(existsSync(_0x5620fb))try{const _0x119440=JSON['parse'](readFileSync(_0x5620fb,_0x45748c(0x10f)));_0x4ead19=_0x119440[_0x45748c(0x16d)],_0x3da1a8=_0x3de9ca,console['log'](a12_0x1b787['dim'](_0x45748c(0x136)+_0x5620fb+':\x20'+_0x4ead19));}catch{_0x4ead19=_0x3de9ca;}else _0x4ead19=_0x3de9ca;}else{if(_0x88a7e1)try{const _0x53ff59=JSON[_0x45748c(0x10a)](readFileSync(_0x88a7e1,_0x45748c(0x10f)));_0x4ead19=_0x53ff59[_0x45748c(0x16d)],_0x3da1a8=a12_0x526e48[_0x45748c(0x118)](_0x88a7e1),console['log'](a12_0x1b787[_0x45748c(0x146)](_0x45748c(0x15b)+_0x4ead19));}catch{_0x4ead19=_0x37a3ab;}else _0x4ead19=_0x37a3ab;}if(!_0x4ead19)return console[_0x45748c(0x109)](a12_0x1b787['yellow'](_0x45748c(0xfb))),console[_0x45748c(0x109)]('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)'),console[_0x45748c(0x109)](_0x45748c(0xdc)),console[_0x45748c(0x109)](_0x45748c(0xdf)),console['log'](_0x45748c(0xe9)),0x1;if(_0xaaaba6){const {data:_0x5b7ded}=await withSpinner(_0x45748c(0x14b)+_0xaaaba6+_0x45748c(0xed)+_0x4ead19+'\x22...',()=>_0x3cae18[_0x45748c(0x135)][_0x45748c(0x156)](_0x4ead19,_0xaaaba6,_0x206566,{'dryRun':_0x1bb179,'force':_0x15e5d7}));if(_0x1bb179)return console[_0x45748c(0x109)](a12_0x1b787[_0x45748c(0x130)](_0x45748c(0x14a))),console[_0x45748c(0x109)](_0x45748c(0x138)+_0x5b7ded[_0x45748c(0x160)]),console['log'](_0x45748c(0x129)+_0x5b7ded[_0x45748c(0x155)]),_0x5b7ded[_0x45748c(0x104)]&&(console[_0x45748c(0x109)](_0x45748c(0xe7)),console[_0x45748c(0x109)]('─'[_0x45748c(0x139)](0x3c)),console[_0x45748c(0x109)](_0x5b7ded[_0x45748c(0x104)]),console[_0x45748c(0x109)]('─'[_0x45748c(0x139)](0x3c))),0x0;return console[_0x45748c(0x109)](a12_0x1b787['green'](_0x45748c(0x10d))),console[_0x45748c(0x109)](_0x45748c(0xdd)+_0x5b7ded[_0x45748c(0x160)]),console[_0x45748c(0x109)](_0x45748c(0x161)+_0x5b7ded[_0x45748c(0x155)]),console[_0x45748c(0x109)](_0x45748c(0x121)+(_0x5b7ded['isNew']?a12_0x1b787['green']('new'):_0x5b7ded[_0x45748c(0x12d)]?a12_0x1b787[_0x45748c(0x130)]('updated'):a12_0x1b787[_0x45748c(0x154)](_0x45748c(0xe4)))),0x0;}const _0x11582f=_0x3da1a8||_0x206566,{data:_0x576f8e}=await withSpinner(_0x45748c(0x108)+_0x4ead19+_0x45748c(0xe3),()=>_0x3cae18[_0x45748c(0x135)][_0x45748c(0x116)](_0x4ead19,_0x11582f,{'dryRun':!![]})),_0x2832b9=_0x576f8e[_0x45748c(0x127)][_0x45748c(0x13a)][_0x45748c(0x117)]+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x125)]['new']+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x114)][_0x45748c(0x117)],_0x4fd44a=_0x576f8e[_0x45748c(0x127)][_0x45748c(0x13a)][_0x45748c(0x141)]+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x125)][_0x45748c(0x141)]+_0x576f8e[_0x45748c(0x127)]['prompts']['updated'],_0x916789=_0x576f8e[_0x45748c(0x127)][_0x45748c(0x13a)][_0x45748c(0xe4)]+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x125)][_0x45748c(0xe4)]+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x114)]['unchanged'];console['log']('\x0aPull\x20summary\x20for\x20\x27'+_0x576f8e[_0x45748c(0x144)]+'\x27:'),console[_0x45748c(0x109)]('\x20\x20'+a12_0x1b787[_0x45748c(0xe0)]('+\x20'+_0x2832b9+_0x45748c(0x16a))+_0x45748c(0x167)+a12_0x1b787[_0x45748c(0x130)]('~\x20'+_0x4fd44a+_0x45748c(0x158))+_0x45748c(0x167)+a12_0x1b787[_0x45748c(0x146)]('=\x20'+_0x916789+_0x45748c(0x145))),console['log'](_0x45748c(0x10b)+formatCountSummary(_0x576f8e[_0x45748c(0x127)][_0x45748c(0x13a)])),console['log'](_0x45748c(0x166)+formatCountSummary(_0x576f8e[_0x45748c(0x127)]['knowledgeBases'])),console[_0x45748c(0x109)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x576f8e[_0x45748c(0x127)]['prompts'])),console['log'](_0x45748c(0x13c)+a12_0x1b787[_0x45748c(0x11c)](_0x576f8e['outputDir'])),displayDiffs(_0x576f8e['agents'],_0x576f8e[_0x45748c(0x125)],_0x576f8e['prompts']);if(_0x1bb179)return console[_0x45748c(0x109)](a12_0x1b787['yellow'](_0x45748c(0x115))),0x0;if(_0x2832b9===0x0&&_0x4fd44a===0x0)return console[_0x45748c(0x109)](a12_0x1b787['green']('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x576f8e[_0x45748c(0x144)]},_0x3ec86d[_0x45748c(0x164)]),console[_0x45748c(0x109)](a12_0x1b787[_0x45748c(0xe0)](_0x45748c(0xee)+a12_0x1b787['dim'](_0x45748c(0x16d))+_0x45748c(0xe2)+a12_0x1b787[_0x45748c(0x11c)](_0x576f8e[_0x45748c(0x144)]))),0x0;if(!_0x9eb4cf&&!_0x15e5d7){const _0x10d062=await confirmKey('\x0aWrite\x20'+(_0x2832b9+_0x4fd44a)+_0x45748c(0xea));if(!_0x10d062)return console[_0x45748c(0x109)]('Pull\x20cancelled'),0x0;}const {data:_0x192ba6}=await withSpinner(_0x45748c(0x110),()=>_0x3cae18['llm'][_0x45748c(0x116)](_0x4ead19,_0x11582f,{'force':_0x15e5d7}));return console['log'](a12_0x1b787['green']('\x0a✔\x20Pulled\x20'+(_0x2832b9+_0x4fd44a)+'\x20files\x20to\x20'+_0x192ba6[_0x45748c(0x100)])),saveSessionContext({'llm_project':_0x192ba6[_0x45748c(0x144)]},_0x3ec86d[_0x45748c(0x164)]),console[_0x45748c(0x109)](a12_0x1b787['green'](_0x45748c(0xee)+a12_0x1b787[_0x45748c(0x146)](_0x45748c(0x16d))+_0x45748c(0xe2)+a12_0x1b787[_0x45748c(0x11c)](_0x192ba6[_0x45748c(0x144)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a12_0x470ddf(0xfa)]=a12_0x470ddf(0x120);[a12_0x470ddf(0x123)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async['execute'](_0x246f05){const _0xcc5d83=a12_0x470ddf,{options:_0x4522dc,args:_0x1e4bcf,tdx:_0x1cc9aa}=_0x246f05,_0x1bca6a=_0x1e4bcf[0x0],_0x4c7398=_0x4522dc[_0xcc5d83(0xfa)],_0x5981a8=_0x4522dc[_0xcc5d83(0xe1)],_0x5de5ac=_0x4522dc[_0xcc5d83(0x124)],_0x28e5ca=_0x4522dc[_0xcc5d83(0xf7)],_0x230e5a=_0x4522dc[_0xcc5d83(0x12b)];let _0x3e6128;const _0x18f689=findAgentConfigPath(process[_0xcc5d83(0xf0)]());if(_0x1bca6a){const _0x4240d4=a12_0x526e48['join'](_0x1bca6a,_0xcc5d83(0x148));existsSync(_0x4240d4)?(_0x3e6128=_0x1bca6a,console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x146)](_0xcc5d83(0x147)+_0x1bca6a))):_0x3e6128=_0x1bca6a;}else{if(_0x18f689)_0x3e6128=a12_0x526e48[_0xcc5d83(0x118)](_0x18f689),console['log'](a12_0x1b787['dim'](_0xcc5d83(0x12f)+_0x3e6128));else{if(_0x230e5a){const _0x2eb9ed=normalizeName(_0x230e5a),_0x31c1fe=a12_0x526e48[_0xcc5d83(0xf6)](process[_0xcc5d83(0xf0)](),'agents',_0x2eb9ed,_0xcc5d83(0x148));if(existsSync(_0x31c1fe))_0x3e6128=a12_0x526e48[_0xcc5d83(0x118)](_0x31c1fe),console['log'](a12_0x1b787[_0xcc5d83(0x146)](_0xcc5d83(0x147)+_0x3e6128));else{const _0x252507=_0x4522dc[_0xcc5d83(0x13d)];if(_0x252507)throw new SDKError(ErrorCode[_0xcc5d83(0x102)],_0xcc5d83(0x15d)+_0x230e5a+_0xcc5d83(0x168),undefined,{'helpText':_0xcc5d83(0x14f)+_0xcc5d83(0x112)+('\x20\x20tdx\x20agent\x20pull\x20'+_0x230e5a+'\x0a')+(_0xcc5d83(0xdb)+_0x2eb9ed+'\x20--name\x20'+(_0x4c7398||'<new-name>')+_0xcc5d83(0x128)+_0x252507)});_0x3e6128=_0x230e5a,console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x146)](_0xcc5d83(0x163)+_0x230e5a));}}}}if(!_0x3e6128)return console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x130)](_0xcc5d83(0x15c))),console[_0xcc5d83(0x109)](_0xcc5d83(0xf2)),console[_0xcc5d83(0x109)](_0xcc5d83(0x12e)),console[_0xcc5d83(0x109)](_0xcc5d83(0xf5)),console[_0xcc5d83(0x109)]('\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'),0x1;if(!_0x4c7398)throw new SDKError(ErrorCode[_0xcc5d83(0x142)],_0xcc5d83(0x132),undefined,{'helpText':_0xcc5d83(0xe8)});if(!_0x5de5ac&&!_0x5981a8){const _0x5b444d=await confirmKey(_0xcc5d83(0xfe)+_0x3e6128+'\x22\x20to\x20new\x20project\x20\x22'+_0x4c7398+'\x22?');if(!_0x5b444d)return console[_0xcc5d83(0x109)](_0xcc5d83(0x133)),0x0;}const {data:_0x53f1a7}=await withSpinner('Cloning\x20\x22'+_0x3e6128+'\x22\x20to\x20\x22'+_0x4c7398+_0xcc5d83(0xe3),()=>_0x1cc9aa[_0xcc5d83(0x135)]['cloneProject'](_0x3e6128,_0x4c7398,{'dryRun':_0x5981a8}));if(_0x5981a8)return console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x130)](_0xcc5d83(0x165))),console['log']('Source:\x20'+_0x53f1a7[_0xcc5d83(0x126)]),console[_0xcc5d83(0x109)](_0xcc5d83(0x170)+_0x4c7398),console[_0xcc5d83(0x109)](_0xcc5d83(0x152)),console[_0xcc5d83(0x109)]('\x20\x20Agents:\x20'+_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x13a)][_0xcc5d83(0x131)]),console['log'](_0xcc5d83(0x166)+_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x125)][_0xcc5d83(0x131)]),console['log'](_0xcc5d83(0x106)+_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x114)]['created']),0x0;const _0x3e0162=_0x53f1a7['counts'][_0xcc5d83(0x13a)]['errors']>0x0||_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x125)]['errors']>0x0||_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x114)][_0xcc5d83(0x11f)]>0x0;_0x3e0162?console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x130)](_0xcc5d83(0x13e))):console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0xe0)]('Project\x20cloned\x20successfully'));console[_0xcc5d83(0x109)](_0xcc5d83(0xde)+_0x53f1a7[_0xcc5d83(0x126)]),console[_0xcc5d83(0x109)](_0xcc5d83(0x170)+_0x53f1a7[_0xcc5d83(0x134)]),console['log'](_0xcc5d83(0xef)+_0x53f1a7[_0xcc5d83(0x173)]),console[_0xcc5d83(0x109)](),console[_0xcc5d83(0x109)](_0xcc5d83(0x11e)),console['log'](_0xcc5d83(0x10b)+formatCountSummary(_0x53f1a7[_0xcc5d83(0x127)]['agents'])),console[_0xcc5d83(0x109)](_0xcc5d83(0x166)+formatCountSummary(_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x125)])),console[_0xcc5d83(0x109)](_0xcc5d83(0x106)+formatCountSummary(_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x114)]));if(_0x3e0162){console[_0xcc5d83(0x109)](),console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x162)](_0xcc5d83(0x14d)));for(const _0x11e682 of _0x53f1a7[_0xcc5d83(0x13a)]){_0x11e682[_0xcc5d83(0x16e)]==='error'&&console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x162)]('\x20\x20Agent\x20\x22'+_0x11e682[_0xcc5d83(0x160)]+'\x22:\x20'+_0x11e682[_0xcc5d83(0xe6)]));}for(const _0x2cb8d0 of _0x53f1a7[_0xcc5d83(0x125)]){_0x2cb8d0[_0xcc5d83(0x16e)]===_0xcc5d83(0xe6)&&console[_0xcc5d83(0x109)](a12_0x1b787['red'](_0xcc5d83(0x169)+_0x2cb8d0[_0xcc5d83(0xfa)]+'\x22:\x20'+_0x2cb8d0[_0xcc5d83(0xe6)]));}for(const _0x3fe384 of _0x53f1a7[_0xcc5d83(0x114)]){_0x3fe384['action']===_0xcc5d83(0xe6)&&console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x162)]('\x20\x20Prompt\x20\x22'+_0x3fe384['name']+_0xcc5d83(0x174)+_0x3fe384[_0xcc5d83(0xe6)]));}return 0x1;}saveSessionContext({'llm_project':_0x53f1a7[_0xcc5d83(0x134)]},_0x4522dc[_0xcc5d83(0x164)]),console[_0xcc5d83(0x109)](),console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0xe0)](_0xcc5d83(0x12a)+a12_0x1b787[_0xcc5d83(0x146)](_0xcc5d83(0x16d))+'\x20=\x20'+a12_0x1b787[_0xcc5d83(0x11c)](_0x53f1a7[_0xcc5d83(0x134)])));const _0x66bbcd=getLLMProjectUrl(_0x28e5ca,_0x53f1a7[_0xcc5d83(0x173)]);return console[_0xcc5d83(0x109)]('Project:\x20'+a12_0x1b787['cyan'](_0x66bbcd)),0x0;}}export class AgentPushCommand extends BaseCommand{[a12_0x470ddf(0xfa)]='agent:push';[a12_0x470ddf(0x123)]=a12_0x470ddf(0x107);async[a12_0x470ddf(0x140)](_0x40741f){const _0x48a2d0=a12_0x470ddf,{options:_0x4c9f2b,args:_0x437289,tdx:_0x260bf2}=_0x40741f;let _0x4aaeab=_0x437289[0x0]||process['cwd']();const _0x3e5c20=_0x4c9f2b['dryRun'],_0x4519e1=_0x4c9f2b['force'],_0xeaa618=_0x4c9f2b[_0x48a2d0(0x124)],_0x17db8b=_0x4c9f2b['site'],_0x5f193=a12_0x526e48[_0x48a2d0(0xf6)](_0x4aaeab,_0x48a2d0(0x113)),_0x4ce4d9=existsSync(_0x5f193);if(_0x4ce4d9){const {data:_0x369b89}=await withSpinner(_0x48a2d0(0xf9)+_0x4aaeab+'\x22...',()=>_0x260bf2[_0x48a2d0(0x135)][_0x48a2d0(0xf1)](_0x4aaeab,{'dryRun':_0x3e5c20,'force':_0x4519e1}));if(_0x3e5c20)return console[_0x48a2d0(0x109)](a12_0x1b787['yellow'](_0x48a2d0(0x165))),console[_0x48a2d0(0x109)]('Would\x20push\x20agent:\x20'+_0x369b89[_0x48a2d0(0x160)]),0x0;if(_0x369b89['action']===_0x48a2d0(0xe6))return console[_0x48a2d0(0x109)](a12_0x1b787['red']('Failed\x20to\x20push\x20agent:\x20'+_0x369b89[_0x48a2d0(0xe6)])),0x1;console[_0x48a2d0(0x109)](a12_0x1b787['green']('Agent\x20'+_0x369b89['action']+_0x48a2d0(0x143))),console['log'](_0x48a2d0(0xdd)+_0x369b89[_0x48a2d0(0x160)]);if(_0x369b89[_0x48a2d0(0x119)]&&_0x369b89[_0x48a2d0(0x12c)]){const _0x299c15=getLLMAgentChatUrl(_0x17db8b,_0x369b89['projectId'],_0x369b89[_0x48a2d0(0x119)]);console['log']('Chat:\x20'+a12_0x1b787[_0x48a2d0(0x11c)](_0x299c15));}return 0x0;}let _0x127bb8=a12_0x526e48[_0x48a2d0(0xf6)](_0x4aaeab,'tdx.json');if(!existsSync(_0x127bb8)){const _0x2c2937=findAgentConfigPath(_0x4aaeab);if(_0x2c2937)_0x4aaeab=a12_0x526e48[_0x48a2d0(0x118)](_0x2c2937),_0x127bb8=_0x2c2937,console[_0x48a2d0(0x109)](a12_0x1b787['dim'](_0x48a2d0(0x15b)+_0x4aaeab));else{const _0x1a8d17=_0x4c9f2b[_0x48a2d0(0x12b)];if(_0x1a8d17){const _0x19dd60=normalizeName(_0x1a8d17),_0x31639=a12_0x526e48[_0x48a2d0(0xf6)](_0x4aaeab,_0x48a2d0(0x13a)),_0xa7bb5c=a12_0x526e48[_0x48a2d0(0xf6)](_0x31639,_0x19dd60,_0x48a2d0(0x148));existsSync(_0xa7bb5c)&&(_0x4aaeab=a12_0x526e48['dirname'](_0xa7bb5c),_0x127bb8=_0xa7bb5c,console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x146)](_0x48a2d0(0x15b)+_0x4aaeab)));}if(!existsSync(_0x127bb8)){let _0x238fa8='Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.';_0x1a8d17&&(_0x238fa8=_0x48a2d0(0xfd)+_0x1a8d17+'\x22\x20but\x20no\x20local\x20folder\x20found.\x0a'+('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x1a8d17+_0x48a2d0(0x171)));throw new SDKError(ErrorCode[_0x48a2d0(0x102)],_0x48a2d0(0x122)+_0x4aaeab,undefined,{'helpText':_0x238fa8});}}}const {data:_0x10d8c3}=await withSpinner(_0x48a2d0(0x159),()=>_0x260bf2[_0x48a2d0(0x135)]['pushProject'](_0x4aaeab,{'dryRun':!![]})),_0x2cc373=_0x10d8c3['counts'][_0x48a2d0(0x13a)][_0x48a2d0(0x11f)]>0x0;if(_0x2cc373){console[_0x48a2d0(0x109)](a12_0x1b787['red']('\x0aErrors\x20found:'));for(const _0x4e72d2 of _0x10d8c3[_0x48a2d0(0x13a)]){_0x4e72d2[_0x48a2d0(0x16e)]===_0x48a2d0(0xe6)&&console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x162)](_0x48a2d0(0xeb)+_0x4e72d2['agentName']+_0x48a2d0(0x174)+_0x4e72d2['error']));}return 0x1;}const _0xcc9d45=_0x10d8c3[_0x48a2d0(0x127)]['agents'][_0x48a2d0(0x131)]+_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x125)][_0x48a2d0(0x131)]+_0x10d8c3['counts'][_0x48a2d0(0x114)][_0x48a2d0(0x131)],_0x47551b=_0x10d8c3['counts'][_0x48a2d0(0x13a)]['updated']+_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x125)][_0x48a2d0(0x141)]+_0x10d8c3['counts'][_0x48a2d0(0x114)]['updated'],_0x4fd72a=_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x13a)][_0x48a2d0(0xe4)]+_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x125)][_0x48a2d0(0xe4)]+_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x114)][_0x48a2d0(0xe4)];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0x10d8c3[_0x48a2d0(0x144)]+'\x27:'),console[_0x48a2d0(0x109)]('\x20\x20'+a12_0x1b787['green']('+\x20'+_0xcc9d45+'\x20new')+_0x48a2d0(0x167)+a12_0x1b787[_0x48a2d0(0x130)]('~\x20'+_0x47551b+_0x48a2d0(0x158))+_0x48a2d0(0x167)+a12_0x1b787[_0x48a2d0(0x146)]('=\x20'+_0x4fd72a+_0x48a2d0(0x145))),console[_0x48a2d0(0x109)](_0x48a2d0(0x10b)+formatCountSummary(_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x13a)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x10d8c3['counts']['knowledgeBases'])),console[_0x48a2d0(0x109)](_0x48a2d0(0x106)+formatCountSummary(_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x114)])),console[_0x48a2d0(0x109)](_0x48a2d0(0xe5)+a12_0x1b787['cyan'](_0x4aaeab)),displayDiffs(_0x10d8c3[_0x48a2d0(0x13a)],_0x10d8c3[_0x48a2d0(0x125)],_0x10d8c3[_0x48a2d0(0x114)]);if(_0x3e5c20)return console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x130)](_0x48a2d0(0x15f))),0x0;if(_0xcc9d45===0x0&&_0x47551b===0x0){console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0xe0)](_0x48a2d0(0x149)));const _0x148c01=getLLMProjectUrl(_0x17db8b,_0x10d8c3['projectId']);return console['log'](_0x48a2d0(0x157)+a12_0x1b787[_0x48a2d0(0x11c)](_0x148c01)),0x0;}if(!_0xeaa618&&!_0x4519e1){const _0x1cdd21=await confirmKey('\x0aPush\x20'+(_0xcc9d45+_0x47551b)+_0x48a2d0(0x16c));if(!_0x1cdd21)return console[_0x48a2d0(0x109)](_0x48a2d0(0x137)),0x0;}const {data:_0x3d4d9f}=await withSpinner(_0x48a2d0(0x15e),()=>_0x260bf2[_0x48a2d0(0x135)][_0x48a2d0(0x111)](_0x4aaeab,{'force':_0x4519e1})),_0xd4affc=_0x3d4d9f[_0x48a2d0(0x127)][_0x48a2d0(0x13a)][_0x48a2d0(0x11f)]>0x0||_0x3d4d9f[_0x48a2d0(0x127)][_0x48a2d0(0x125)][_0x48a2d0(0x11f)]>0x0||_0x3d4d9f['counts'][_0x48a2d0(0x114)][_0x48a2d0(0x11f)]>0x0;if(_0xd4affc){console['log'](a12_0x1b787[_0x48a2d0(0x130)](_0x48a2d0(0x13f))),console[_0x48a2d0(0x109)](),console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x162)](_0x48a2d0(0x14d)));for(const _0x1f168b of _0x3d4d9f[_0x48a2d0(0x13a)]){_0x1f168b[_0x48a2d0(0x16e)]===_0x48a2d0(0xe6)&&console['log'](a12_0x1b787['red'](_0x48a2d0(0xeb)+_0x1f168b['agentName']+'\x22:\x20'+_0x1f168b[_0x48a2d0(0xe6)]));}for(const _0x1f339b of _0x3d4d9f[_0x48a2d0(0x125)]){_0x1f339b[_0x48a2d0(0x16e)]===_0x48a2d0(0xe6)&&console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x162)](_0x48a2d0(0x169)+_0x1f339b[_0x48a2d0(0xfa)]+_0x48a2d0(0x174)+_0x1f339b[_0x48a2d0(0xe6)]));}for(const _0x2ca812 of _0x3d4d9f[_0x48a2d0(0x114)]){_0x2ca812['action']===_0x48a2d0(0xe6)&&console[_0x48a2d0(0x109)](a12_0x1b787['red']('\x20\x20Prompt\x20\x22'+_0x2ca812[_0x48a2d0(0xfa)]+'\x22:\x20'+_0x2ca812['error']));}return 0x1;}console['log'](a12_0x1b787['green'](_0x48a2d0(0x15a)+(_0xcc9d45+_0x47551b)+_0x48a2d0(0x11b)+_0x3d4d9f[_0x48a2d0(0x144)]+'\x27'));const _0x20a9eb=getLLMProjectUrl(_0x17db8b,_0x3d4d9f[_0x48a2d0(0x12c)]);return console['log'](_0x48a2d0(0x157)+a12_0x1b787[_0x48a2d0(0x11c)](_0x20a9eb)),0x0;}}
@@ -1 +1 @@
1
- function a13_0x52e2(_0x1dd224,_0x308dab){_0x1dd224=_0x1dd224-0x145;const _0x3427bd=a13_0x3427();let _0x52e2b6=_0x3427bd[_0x1dd224];return _0x52e2b6;}const a13_0x64409f=a13_0x52e2;(function(_0x18ce35,_0x4c6bb0){const _0x101a56=a13_0x52e2,_0x28cfb1=_0x18ce35();while(!![]){try{const _0xc24b93=parseInt(_0x101a56(0x14d))/0x1*(-parseInt(_0x101a56(0x14b))/0x2)+parseInt(_0x101a56(0x16f))/0x3*(-parseInt(_0x101a56(0x176))/0x4)+parseInt(_0x101a56(0x184))/0x5+-parseInt(_0x101a56(0x161))/0x6+-parseInt(_0x101a56(0x154))/0x7*(-parseInt(_0x101a56(0x16d))/0x8)+parseInt(_0x101a56(0x152))/0x9*(-parseInt(_0x101a56(0x174))/0xa)+parseInt(_0x101a56(0x14c))/0xb;if(_0xc24b93===_0x4c6bb0)break;else _0x28cfb1['push'](_0x28cfb1['shift']());}catch(_0x31fa20){_0x28cfb1['push'](_0x28cfb1['shift']());}}}(a13_0x3427,0xccaf6));function a13_0x3427(){const _0x524f2b=['DELETE','isArray','set-cookie2','type','.\x20Valid\x20methods:\x20','7807422WpbiUH','method','substring','Invalid\x20HTTP\x20method:\x20','x-xsrf-token','trim','<\x20HTTP/1.1\x20','message','keys','description','output','indexOf','1024oaeQmG','join','276EWDzOQ','authorization','error','x-trino-user','stack','10sfxhkT','Error:\x20','34808hrXXAN','GET','data','site','\x0aStack\x20trace:\x0a','llm','headers','toUpperCase','file','length','status','Invalid\x20API\x20type:\x20','verbose','entries','2271065HmTlgM','log','Invalid\x20header\x20format:\x20\x22','has','trino','color','readBodyFromFile','workflow','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','\x22.\x20','noColor','278aQLSBG','50233403PJvDZo','8983QqLCVo','startsWith','cookie','api','.\x20Valid\x20types:\x20','9617238XHoCYt','PATCH','12936vsHPva','toLowerCase','Endpoint\x20must\x20start\x20with\x20/:\x20','request','set-cookie','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','cdp','PUT'];a13_0x3427=function(){return _0x524f2b;};return a13_0x3427();}import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a13_0x64409f(0x170),'proxy-authorization',a13_0x64409f(0x14f),a13_0x64409f(0x158),a13_0x64409f(0x15e),a13_0x64409f(0x165),'x-auth-token',a13_0x64409f(0x172)]);function isSensitiveHeader(_0x5570f5){const _0x5f2b4a=a13_0x64409f;return SENSITIVE_HEADERS[_0x5f2b4a(0x187)](_0x5570f5[_0x5f2b4a(0x155)]());}function parseHeader(_0x2d209e){const _0x3de5fc=a13_0x64409f,_0x2d9b40=_0x2d209e[_0x3de5fc(0x16c)](':');if(_0x2d9b40===-0x1)throw new Error(_0x3de5fc(0x186)+_0x2d209e+_0x3de5fc(0x149)+_0x3de5fc(0x147));const _0x554c0a=_0x2d209e['substring'](0x0,_0x2d9b40)['trim'](),_0x4cd3c0=_0x2d209e[_0x3de5fc(0x163)](_0x2d9b40+0x1)[_0x3de5fc(0x166)]();if(!_0x554c0a)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x2d209e+'\x22');return[_0x554c0a,_0x4cd3c0];}export class ApiCommand extends BaseCommand{['name']='api';[a13_0x64409f(0x16a)]=a13_0x64409f(0x159);['validate'](_0x42d7a3){const _0x4a219f=a13_0x64409f,{args:_0x409f5f,options:_0x194834}=_0x42d7a3,_0x571530=_0x194834;if(_0x409f5f[_0x4a219f(0x17f)]===0x0)return _0x4a219f(0x148);const _0x5158e9=_0x409f5f[0x0];if(!_0x5158e9[_0x4a219f(0x14e)]('/'))return _0x4a219f(0x156)+_0x5158e9;const _0x201ed8=_0x571530[_0x4a219f(0x178)],_0x25275d=_0x571530[_0x4a219f(0x17e)];if(_0x201ed8&&_0x25275d)return'Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.';const _0x430958=_0x571530[_0x4a219f(0x162)]||_0x4a219f(0x177),_0x32553a=['GET','POST',_0x4a219f(0x15b),_0x4a219f(0x15c),_0x4a219f(0x153)];if(!_0x32553a['includes'](_0x430958[_0x4a219f(0x17d)]()))return _0x4a219f(0x164)+_0x430958+_0x4a219f(0x160)+_0x32553a[_0x4a219f(0x16e)](',\x20');const _0x18f2f0=_0x571530[_0x4a219f(0x15f)]||'td',_0x2ba0b6=['td',_0x4a219f(0x15a),_0x4a219f(0x146),_0x4a219f(0x188),_0x4a219f(0x17b)];if(!_0x2ba0b6['includes'](_0x18f2f0))return _0x4a219f(0x181)+_0x18f2f0+_0x4a219f(0x151)+_0x2ba0b6[_0x4a219f(0x16e)](',\x20');return undefined;}async['execute'](_0x434ee4){const _0x3652c0=a13_0x64409f,{options:_0x3b46fb,args:_0x463d62,tdx:_0x1afcd8}=_0x434ee4,_0x467ee1=_0x3b46fb,_0x3b02b0=_0x463d62[0x0],_0x38ae17=(_0x467ee1['method']||_0x3652c0(0x177))['toUpperCase'](),_0x2d9cc6=_0x467ee1[_0x3652c0(0x178)],_0x4ab792=_0x467ee1['file'],_0x5be672=_0x467ee1['header'],_0x39e2a2=_0x467ee1['type']||'td';try{const _0x57bb78={};if(_0x5be672){const _0x4c22ea=Array[_0x3652c0(0x15d)](_0x5be672)?_0x5be672:[_0x5be672];for(const _0x54664e of _0x4c22ea){const [_0x2ad6f9,_0x5889d5]=parseHeader(_0x54664e);_0x57bb78[_0x2ad6f9]=_0x5889d5;}}let _0x1083db;if(_0x2d9cc6)_0x1083db=_0x2d9cc6;else{if(_0x4ab792)try{_0x1083db=RawAPI[_0x3652c0(0x145)](_0x4ab792);}catch(_0xfcfce4){return console[_0x3652c0(0x171)](_0x3652c0(0x175)+(_0xfcfce4 instanceof Error?_0xfcfce4[_0x3652c0(0x168)]:String(_0xfcfce4))),0x1;}}const _0x401c5c={'method':_0x38ae17,'apiType':_0x39e2a2,'includeHeaders':_0x3b46fb[_0x3652c0(0x182)]};_0x1083db&&(_0x401c5c['body']=_0x1083db);Object[_0x3652c0(0x169)](_0x57bb78)[_0x3652c0(0x17f)]>0x0&&(_0x401c5c[_0x3652c0(0x17c)]=_0x57bb78);if(_0x3b46fb[_0x3652c0(0x182)]){const _0x3ac597=resolveSite(_0x3b46fb[_0x3652c0(0x179)]),_0x1ca3cc=getEndpoint(_0x3ac597,_0x39e2a2),_0x10e7a0=''+_0x1ca3cc+_0x3b02b0;console[_0x3652c0(0x171)]('>\x20'+_0x38ae17+'\x20'+_0x10e7a0);const _0x1f7b26=getAuthHeaders(_0x3ac597),_0x1e32be={..._0x1f7b26,..._0x57bb78};for(const [_0xea514f,_0x2618c6]of Object[_0x3652c0(0x183)](_0x1e32be)){!isSensitiveHeader(_0xea514f)&&console['error']('>\x20'+_0xea514f+':\x20'+_0x2618c6);}_0x1083db&&console['error']('>'),console[_0x3652c0(0x171)]('');}const _0x2a769c=await _0x1afcd8[_0x3652c0(0x150)][_0x3652c0(0x157)](_0x3b02b0,_0x401c5c);if(_0x3b46fb[_0x3652c0(0x182)]&&_0x2a769c[_0x3652c0(0x17c)]){console[_0x3652c0(0x171)](_0x3652c0(0x167)+_0x2a769c[_0x3652c0(0x180)]);for(const [_0x5e9fb5,_0x3c41f3]of Object[_0x3652c0(0x183)](_0x2a769c[_0x3652c0(0x17c)])){!isSensitiveHeader(_0x5e9fb5)&&console['error']('<\x20'+_0x5e9fb5+':\x20'+_0x3c41f3);}console[_0x3652c0(0x171)]('');}const _0x3855a6=Boolean(_0x3b46fb[_0x3652c0(0x16b)]),_0x3bfc9a={'color':_0x3b46fb[_0x3652c0(0x189)],'noColor':_0x3b46fb[_0x3652c0(0x14a)]||_0x3855a6&&!_0x3b46fb[_0x3652c0(0x189)]},_0x30b12a=colorizeJSON(_0x2a769c['data'],_0x3bfc9a);return _0x3b46fb[_0x3652c0(0x16b)]?(writeFileSync(_0x3b46fb[_0x3652c0(0x16b)],_0x30b12a),console['error']('Results\x20saved\x20to\x20'+_0x3b46fb[_0x3652c0(0x16b)])):console[_0x3652c0(0x185)](_0x30b12a),0x0;}catch(_0x467467){return _0x467467 instanceof Error?(console[_0x3652c0(0x171)]('Error:\x20'+_0x467467['message']),_0x3b46fb['verbose']&&_0x467467[_0x3652c0(0x173)]&&console['error'](_0x3652c0(0x17a)+_0x467467[_0x3652c0(0x173)])):console[_0x3652c0(0x171)](_0x3652c0(0x175)+String(_0x467467)),0x1;}}}
1
+ const a13_0x2fb127=a13_0x5984;(function(_0x264b77,_0x1f2e1d){const _0x194c80=a13_0x5984,_0x4aca0d=_0x264b77();while(!![]){try{const _0x242326=-parseInt(_0x194c80(0x1a4))/0x1+parseInt(_0x194c80(0x1bf))/0x2*(parseInt(_0x194c80(0x1c2))/0x3)+parseInt(_0x194c80(0x1b0))/0x4+-parseInt(_0x194c80(0x18b))/0x5*(parseInt(_0x194c80(0x1a1))/0x6)+-parseInt(_0x194c80(0x1a3))/0x7*(parseInt(_0x194c80(0x1b6))/0x8)+parseInt(_0x194c80(0x195))/0x9+-parseInt(_0x194c80(0x188))/0xa*(-parseInt(_0x194c80(0x1bb))/0xb);if(_0x242326===_0x1f2e1d)break;else _0x4aca0d['push'](_0x4aca0d['shift']());}catch(_0x3ef5fd){_0x4aca0d['push'](_0x4aca0d['shift']());}}}(a13_0x3b84,0x895d2));import{BaseCommand}from'./command.js';function a13_0x5984(_0x59d39e,_0x3ff5c0){_0x59d39e=_0x59d39e-0x186;const _0x3b84ac=a13_0x3b84();let _0x59845d=_0x3b84ac[_0x59d39e];return _0x59845d;}import{RawAPI}from'../sdk/api.js';function a13_0x3b84(){const _0x478c83=['2IWtZUz','Error:\x20','body','1512597jnoEGl','api','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','error','workflow','data','name','3558580RGSlGz','x-xsrf-token','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','5fqSyXW','PUT','toUpperCase','validate','PATCH','\x0aStack\x20trace:\x0a','includes','has','verbose','proxy-authorization','3749319vFchku','.\x20Valid\x20methods:\x20','output','x-auth-token','startsWith','indexOf','execute','cdp','join','trino','Invalid\x20header\x20format:\x20\x22','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','2597712uhPAzV','length','6853FmVwlD','216086EePexq','message','Invalid\x20API\x20type:\x20','color','set-cookie2','log','site','toLowerCase','Endpoint\x20must\x20start\x20with\x20/:\x20','<\x20HTTP/1.1\x20','method','entries','4000736lzPOWw','Invalid\x20HTTP\x20method:\x20','GET','type','keys','noColor','8704wURTFd','isArray','file','set-cookie','llm','11mjEPEA','headers','trim','\x22.\x20'];a13_0x3b84=function(){return _0x478c83;};return a13_0x3b84();}import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set(['authorization',a13_0x2fb127(0x194),'cookie',a13_0x2fb127(0x1b9),a13_0x2fb127(0x1a8),a13_0x2fb127(0x189),a13_0x2fb127(0x198),'x-trino-user']);function isSensitiveHeader(_0x16704a){const _0x48a615=a13_0x2fb127;return SENSITIVE_HEADERS[_0x48a615(0x192)](_0x16704a[_0x48a615(0x1ab)]());}function parseHeader(_0x22b26f){const _0x554d0a=a13_0x2fb127,_0x3ddb6b=_0x22b26f[_0x554d0a(0x19a)](':');if(_0x3ddb6b===-0x1)throw new Error(_0x554d0a(0x19f)+_0x22b26f+_0x554d0a(0x1be)+_0x554d0a(0x18a));const _0xf0b52c=_0x22b26f['substring'](0x0,_0x3ddb6b)[_0x554d0a(0x1bd)](),_0x7c3920=_0x22b26f['substring'](_0x3ddb6b+0x1)[_0x554d0a(0x1bd)]();if(!_0xf0b52c)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x22b26f+'\x22');return[_0xf0b52c,_0x7c3920];}export class ApiCommand extends BaseCommand{[a13_0x2fb127(0x187)]=a13_0x2fb127(0x1c3);['description']=a13_0x2fb127(0x1c4);[a13_0x2fb127(0x18e)](_0x5e23ac){const _0x4c9c1c=a13_0x2fb127,{args:_0x1db55b,options:_0x2643a0}=_0x5e23ac,_0x2f49b9=_0x2643a0;if(_0x1db55b[_0x4c9c1c(0x1a2)]===0x0)return _0x4c9c1c(0x1a0);const _0x1d667a=_0x1db55b[0x0];if(!_0x1d667a[_0x4c9c1c(0x199)]('/'))return _0x4c9c1c(0x1ac)+_0x1d667a;const _0x3ca716=_0x2f49b9[_0x4c9c1c(0x186)],_0x5885ff=_0x2f49b9[_0x4c9c1c(0x1b8)];if(_0x3ca716&&_0x5885ff)return'Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.';const _0x1645cb=_0x2f49b9[_0x4c9c1c(0x1ae)]||_0x4c9c1c(0x1b2),_0x2a1b53=[_0x4c9c1c(0x1b2),'POST',_0x4c9c1c(0x18c),'DELETE',_0x4c9c1c(0x18f)];if(!_0x2a1b53['includes'](_0x1645cb[_0x4c9c1c(0x18d)]()))return _0x4c9c1c(0x1b1)+_0x1645cb+_0x4c9c1c(0x196)+_0x2a1b53[_0x4c9c1c(0x19d)](',\x20');const _0x312290=_0x2f49b9[_0x4c9c1c(0x1b3)]||'td',_0x5b29d9=['td',_0x4c9c1c(0x19c),_0x4c9c1c(0x1c6),_0x4c9c1c(0x19e),_0x4c9c1c(0x1ba)];if(!_0x5b29d9[_0x4c9c1c(0x191)](_0x312290))return _0x4c9c1c(0x1a6)+_0x312290+'.\x20Valid\x20types:\x20'+_0x5b29d9['join'](',\x20');return undefined;}async[a13_0x2fb127(0x19b)](_0x2580ab){const _0x507335=a13_0x2fb127,{options:_0x21323d,args:_0x5b7b4b,tdx:_0x3454d2}=_0x2580ab,_0x5b9c2a=_0x21323d,_0xcc6c12=_0x5b7b4b[0x0],_0x2c16d3=(_0x5b9c2a['method']||'GET')[_0x507335(0x18d)](),_0x152c7a=_0x5b9c2a[_0x507335(0x186)],_0x4f0b88=_0x5b9c2a[_0x507335(0x1b8)],_0x206bd1=_0x5b9c2a['header'],_0x474b63=_0x5b9c2a[_0x507335(0x1b3)]||'td';try{const _0x20286b={};if(_0x206bd1){const _0x1f6f6f=Array[_0x507335(0x1b7)](_0x206bd1)?_0x206bd1:[_0x206bd1];for(const _0x1068cc of _0x1f6f6f){const [_0x525a25,_0x3308c8]=parseHeader(_0x1068cc);_0x20286b[_0x525a25]=_0x3308c8;}}let _0x900aa9;if(_0x152c7a)_0x900aa9=_0x152c7a;else{if(_0x4f0b88)try{_0x900aa9=RawAPI['readBodyFromFile'](_0x4f0b88);}catch(_0x41545f){return console['error'](_0x507335(0x1c0)+(_0x41545f instanceof Error?_0x41545f[_0x507335(0x1a5)]:String(_0x41545f))),0x1;}}const _0xfa4173={'method':_0x2c16d3,'apiType':_0x474b63,'includeHeaders':_0x21323d[_0x507335(0x193)]};_0x900aa9&&(_0xfa4173[_0x507335(0x1c1)]=_0x900aa9);Object[_0x507335(0x1b4)](_0x20286b)[_0x507335(0x1a2)]>0x0&&(_0xfa4173[_0x507335(0x1bc)]=_0x20286b);if(_0x21323d['verbose']){const _0x473341=resolveSite(_0x21323d[_0x507335(0x1aa)]),_0x36606d=getEndpoint(_0x473341,_0x474b63),_0x57334c=''+_0x36606d+_0xcc6c12;console[_0x507335(0x1c5)]('>\x20'+_0x2c16d3+'\x20'+_0x57334c);const _0x24c45c=getAuthHeaders(_0x473341),_0x3a7f99={..._0x24c45c,..._0x20286b};for(const [_0x57266d,_0x5d62c4]of Object[_0x507335(0x1af)](_0x3a7f99)){!isSensitiveHeader(_0x57266d)&&console[_0x507335(0x1c5)]('>\x20'+_0x57266d+':\x20'+_0x5d62c4);}_0x900aa9&&console['error']('>'),console[_0x507335(0x1c5)]('');}const _0x162183=await _0x3454d2[_0x507335(0x1c3)]['request'](_0xcc6c12,_0xfa4173);if(_0x21323d['verbose']&&_0x162183['headers']){console[_0x507335(0x1c5)](_0x507335(0x1ad)+_0x162183['status']);for(const [_0x36d180,_0x523a33]of Object[_0x507335(0x1af)](_0x162183[_0x507335(0x1bc)])){!isSensitiveHeader(_0x36d180)&&console[_0x507335(0x1c5)]('<\x20'+_0x36d180+':\x20'+_0x523a33);}console[_0x507335(0x1c5)]('');}const _0x23c84c=Boolean(_0x21323d['output']),_0x119eb3={'color':_0x21323d[_0x507335(0x1a7)],'noColor':_0x21323d[_0x507335(0x1b5)]||_0x23c84c&&!_0x21323d[_0x507335(0x1a7)]},_0x5d6ff3=colorizeJSON(_0x162183[_0x507335(0x186)],_0x119eb3);return _0x21323d[_0x507335(0x197)]?(writeFileSync(_0x21323d['output'],_0x5d6ff3),console['error']('Results\x20saved\x20to\x20'+_0x21323d[_0x507335(0x197)])):console[_0x507335(0x1a9)](_0x5d6ff3),0x0;}catch(_0x5244c8){return _0x5244c8 instanceof Error?(console[_0x507335(0x1c5)]('Error:\x20'+_0x5244c8[_0x507335(0x1a5)]),_0x21323d[_0x507335(0x193)]&&_0x5244c8['stack']&&console['error'](_0x507335(0x190)+_0x5244c8['stack'])):console[_0x507335(0x1c5)]('Error:\x20'+String(_0x5244c8)),0x1;}}}
@@ -1 +1 @@
1
- const a14_0x4ea1b7=a14_0x16b9;(function(_0x1b6a69,_0x36e5b8){const _0x860243=a14_0x16b9,_0x57bb8b=_0x1b6a69();while(!![]){try{const _0x10bf5b=-parseInt(_0x860243(0xbe))/0x1+-parseInt(_0x860243(0x97))/0x2*(-parseInt(_0x860243(0xbd))/0x3)+-parseInt(_0x860243(0xc2))/0x4+parseInt(_0x860243(0x93))/0x5+parseInt(_0x860243(0x78))/0x6+parseInt(_0x860243(0xad))/0x7+-parseInt(_0x860243(0x9d))/0x8;if(_0x10bf5b===_0x36e5b8)break;else _0x57bb8b['push'](_0x57bb8b['shift']());}catch(_0x5a3e17){_0x57bb8b['push'](_0x57bb8b['shift']());}}}(a14_0x4e77,0xc7699));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';function a14_0x16b9(_0x2116c8,_0x29401c){_0x2116c8=_0x2116c8-0x73;const _0x4e7714=a14_0x4e77();let _0x16b9f2=_0x4e7714[_0x2116c8];return _0x16b9f2;}import{getConsoleUrl}from'../types/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a14_0x104991 from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a14_0x4e77(){const _0x3e9de6=['us01','3412716SgbExR','auth:setup','Validating\x20API\x20key...','bold','filter','\x20for\x20profile:\x20','N/A','green','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','error','✓\x20API\x20key\x20removed\x20from\x20keychain','profile','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','message','Setting\x20up\x20authentication\x20for\x20site:\x20','jobs','System\x20keychain\x20is\x20not\x20available','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','No\x20API\x20key\x20found\x20in\x20keychain','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','\x20\x20tdx','email','✗\x20Validation\x20failed:\x20','password','jp\x20\x20\x20-\x20Japan','name','value','7584220tlaErJ','\x20(site:\x20','description','ERROR','1112yhSlqg','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','apiKey','create','select','yellow','7045480stklMu','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','trim','API\x20key\x20cannot\x20be\x20empty','User:\x20','tdx:\x20auth\x20setup','jp01','warn','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Enter\x20custom\x20site','customSite','eu\x20\x20\x20-\x20Europe','last_name','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','Setup\x20API\x20key\x20authentication\x20interactively','Enter\x20site\x20name:','10536932XgtQSL','/app/mp/ak','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','getUserInfo','length','other','Enter\x20your\x20TD\x20API\x20key:','tdx\x20profile:\x20','\x20(profile:\x20','site','auth','red','log','✓\x20Profile\x20\x27','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','2628FFCjoQ','764890CunlTL','findIndex','Name:\x20','first_name','6462376zQryaC','\x0aSetup\x20cancelled','Remove\x20API\x20key\x20from\x20system\x20keychain','tdx:\x20auth\x20clear','status','execute','text','push','test','\x27\x20registered','✓\x20Authentication\x20successful\x0a'];a14_0x4e77=function(){return _0x3e9de6;};return a14_0x4e77();}import a14_0x410ffb from'chalk';export class AuthSetupCommand extends BaseCommand{[a14_0x4ea1b7(0x91)]=a14_0x4ea1b7(0x79);['description']=a14_0x4ea1b7(0xab);async[a14_0x4ea1b7(0xc7)](_0x325bd4){const _0x5288f0=a14_0x4ea1b7,{options:_0x4ebac9}=_0x325bd4,_0x4ff12e=_0x4ebac9['profile'];console[_0x5288f0(0xba)](a14_0x410ffb[_0x5288f0(0x7b)](_0x5288f0(0xa2)));const _0x30bbfe=_0x4ebac9[_0x5288f0(0xb7)]||_0x5288f0(0x77),_0x1c4291=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x5288f0(0x77)},{'title':_0x5288f0(0x90),'value':_0x5288f0(0xa3)},{'title':_0x5288f0(0xa8),'value':'eu01'},{'title':'ap02\x20-\x20Korea','value':'ap02'}];let _0x2ffca4=_0x1c4291[_0x5288f0(0xbf)](_0x11da45=>_0x11da45[_0x5288f0(0x92)]===_0x30bbfe);_0x2ffca4===-0x1&&_0x30bbfe!==_0x5288f0(0x77)&&(_0x1c4291[_0x5288f0(0x73)]({'title':_0x30bbfe,'value':_0x30bbfe}),_0x2ffca4=_0x1c4291[_0x5288f0(0xb2)]-0x1);_0x1c4291[_0x5288f0(0x73)]({'title':_0x5288f0(0xa6),'value':_0x5288f0(0xb3)});const _0x2af461=_0x4ff12e?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x4ff12e+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x4eeda3=await a14_0x104991({'type':_0x5288f0(0x9b),'name':_0x5288f0(0xb7),'message':_0x2af461,'choices':_0x1c4291,'initial':_0x2ffca4>=0x0?_0x2ffca4:0x0});if(!_0x4eeda3[_0x5288f0(0xb7)])return console[_0x5288f0(0xba)](_0x5288f0(0xc3)),0x1;let _0x5b2c14;if(_0x4eeda3[_0x5288f0(0xb7)]==='other'){const _0x11cad5=await a14_0x104991({'type':_0x5288f0(0xc8),'name':_0x5288f0(0xa7),'message':_0x5288f0(0xac),'initial':_0x5288f0(0x77),'validate':_0x1553b9=>{const _0x713c73=_0x5288f0;if(!_0x1553b9||!_0x1553b9[_0x713c73(0x9f)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x713c73(0x74)](_0x1553b9[_0x713c73(0x9f)]()))return _0x713c73(0x80);return!![];}});if(!_0x11cad5[_0x5288f0(0xa7)])return console['log'](_0x5288f0(0xc3)),0x1;_0x5b2c14=_0x11cad5[_0x5288f0(0xa7)];}else _0x5b2c14=_0x4eeda3[_0x5288f0(0xb7)];const _0x426c79=resolveSite(_0x5b2c14);console[_0x5288f0(0xba)](_0x5288f0(0x86)+_0x426c79),console['log'](_0x5288f0(0xaf)),console[_0x5288f0(0xba)]('\x20\x20'+getConsoleUrl(_0x426c79,_0x5288f0(0xae)));const _0x4d90a9=await a14_0x104991({'type':_0x5288f0(0x8f),'name':'apiKey','message':_0x5288f0(0xb4),'validate':_0x3aa5ac=>{const _0x3116cb=_0x5288f0;if(!_0x3aa5ac||!_0x3aa5ac[_0x3116cb(0x9f)]())return _0x3116cb(0xa0);return!![];}});if(!_0x4d90a9[_0x5288f0(0x99)])return console[_0x5288f0(0xba)](_0x5288f0(0xc3)),0x1;const _0x1038ad=_0x4d90a9['apiKey'];console[_0x5288f0(0xba)](_0x5288f0(0x7a));try{const _0x26264a=TDX[_0x5288f0(0x9a)]({'site':_0x426c79,'apiKey':_0x1038ad[_0x5288f0(0x9f)](),'logLevel':_0x4ebac9['logLevel']??LogLevel[_0x5288f0(0x96)]}),_0x45e68b=await _0x26264a[_0x5288f0(0x87)][_0x5288f0(0xb1)]();console[_0x5288f0(0xba)](_0x5288f0(0xaa)+_0x45e68b[_0x5288f0(0x8d)]+')');const _0x1cf1e4=await isKeychainAvailable();_0x1cf1e4?(await saveAPIKeyAsync(_0x1038ad[_0x5288f0(0x9f)](),_0x426c79,_0x4ff12e),console[_0x5288f0(0xba)](_0x5288f0(0x84)+(_0x4ff12e?_0x5288f0(0xb6)+_0x4ff12e+')':''))):(console[_0x5288f0(0xa4)](a14_0x410ffb['yellow'](_0x5288f0(0x89))),console[_0x5288f0(0xa4)](a14_0x410ffb[_0x5288f0(0x9c)](_0x5288f0(0xb0))));if(_0x4ff12e){const _0x2d1db1={'site':_0x426c79};saveProfileToUserConfig(_0x4ff12e,_0x2d1db1),console['log'](_0x5288f0(0xbb)+_0x4ff12e+_0x5288f0(0x75));}const _0x4a3974=_0x4ff12e?'\x20--profile\x20'+_0x4ff12e:'';return console['log'](),console[_0x5288f0(0xba)](_0x5288f0(0x8b)),console[_0x5288f0(0xba)](_0x5288f0(0x8c)+_0x4a3974+_0x5288f0(0x98)),console[_0x5288f0(0xba)](_0x5288f0(0x8c)+_0x4a3974+_0x5288f0(0xa5)),0x0;}catch(_0x107e31){if(_0x107e31 instanceof HTTPClientError&&_0x107e31[_0x5288f0(0xc6)]===0x191)return printAuthError(_0x107e31),0x1;return console[_0x5288f0(0x81)](a14_0x410ffb['red'](_0x5288f0(0x8e)+(_0x107e31 instanceof Error?_0x107e31[_0x5288f0(0x85)]:String(_0x107e31)))),console[_0x5288f0(0x81)](_0x5288f0(0xbc)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a14_0x4ea1b7(0x91)]=a14_0x4ea1b7(0xb8);[a14_0x4ea1b7(0x95)]=a14_0x4ea1b7(0x9e);async[a14_0x4ea1b7(0xc7)](_0x2bf849){const _0x52ea71=a14_0x4ea1b7,{options:_0x13c5b2,tdx:_0x7d4da4}=_0x2bf849,_0x1c1031=_0x13c5b2[_0x52ea71(0xb7)],_0x10ac85=_0x13c5b2[_0x52ea71(0x83)],_0x2eee99=_0x10ac85?_0x10ac85:_0x52ea71(0x7e);console['log'](_0x52ea71(0xb5)+_0x2eee99+_0x52ea71(0x94)+_0x1c1031+')');const _0x374253=await resolveAPIKeyAsync(_0x1c1031,_0x10ac85);if(_0x374253){const {source:_0x149bce,isDeprecated:_0x287cc5}=_0x374253,_0x2655e4='Read\x20credential\x20from\x20'+_0x149bce;console[_0x52ea71(0xba)](_0x287cc5?a14_0x410ffb['yellow'](_0x2655e4):_0x2655e4);}else console[_0x52ea71(0xba)](a14_0x410ffb['yellow']('No\x20credential\x20found'));try{const _0x4dda59=await _0x7d4da4[_0x52ea71(0x87)]['getUserInfo']();return console[_0x52ea71(0xba)](a14_0x410ffb[_0x52ea71(0x7f)](_0x52ea71(0x76))),console['log'](_0x52ea71(0xa1)+_0x4dda59['email']),(_0x4dda59[_0x52ea71(0xc1)]||_0x4dda59[_0x52ea71(0xa9)])&&console['log'](_0x52ea71(0xc0)+[_0x4dda59[_0x52ea71(0xc1)],_0x4dda59[_0x52ea71(0xa9)]][_0x52ea71(0x7c)](Boolean)['join']('\x20')),0x0;}catch(_0x238c6d){return _0x238c6d instanceof HTTPClientError&&_0x238c6d[_0x52ea71(0xc6)]===0x191?printAuthError(_0x238c6d,!![],_0x10ac85):console[_0x52ea71(0x81)](a14_0x410ffb[_0x52ea71(0xb9)](_0x52ea71(0x8e)+(_0x238c6d instanceof Error?_0x238c6d[_0x52ea71(0x85)]:String(_0x238c6d)))),0x1;}}}export class AuthClearCommand extends BaseCommand{['name']='auth:clear';['description']=a14_0x4ea1b7(0xc4);async[a14_0x4ea1b7(0xc7)](_0x27e3cc){const _0x571990=a14_0x4ea1b7,{options:_0x5eb7ab}=_0x27e3cc,_0x3d9cac=_0x5eb7ab[_0x571990(0x83)];console[_0x571990(0xba)](a14_0x410ffb['bold'](_0x571990(0xc5)));const _0x586349=await isKeychainAvailable();if(!_0x586349)return console['error'](a14_0x410ffb[_0x571990(0xb9)](_0x571990(0x88))),0x1;const _0x494c47=await deleteKeychainAPIKey(_0x3d9cac);return _0x494c47?(clearCredentialCache(),console[_0x571990(0xba)](_0x571990(0x82)+(_0x3d9cac?_0x571990(0xb6)+_0x3d9cac+')':'')),0x0):(console[_0x571990(0xba)](_0x571990(0x8a)+(_0x3d9cac?_0x571990(0x7d)+_0x3d9cac:'')),0x1);}}
1
+ const a14_0x1ff32b=a14_0x3215;function a14_0x241f(){const _0x1f77f7=['4152ooVRVt','tdx\x20profile:\x20','warn','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','✓\x20Authentication\x20successful\x0a','\x20\x20tdx','status','auth:setup','Remove\x20API\x20key\x20from\x20system\x20keychain','execute','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','select','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','push','\x20(profile:\x20','create','last_name','profile','logLevel','text','You\x20can\x20find\x20your\x20API\x20key\x20at:','System\x20keychain\x20is\x20not\x20available','tdx:\x20auth\x20setup','50cQTrvE','red','Validating\x20API\x20key...','API\x20key\x20cannot\x20be\x20empty','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','No\x20API\x20key\x20found\x20in\x20keychain','ERROR','log','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Enter\x20your\x20TD\x20API\x20key:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','error','apiKey','16GdFRlG','other','\x20(site:\x20','ap02','Setup\x20API\x20key\x20authentication\x20interactively','yellow','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','1869gowTln','us01','message','bold','Read\x20credential\x20from\x20','eu01','No\x20credential\x20found','trim','jp01','ap02\x20-\x20Korea','219654bhKwtv','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','auth','site','167910kzvhZV','1216737vKbbUY','customSite','value','143196gfgNPw','getUserInfo','N/A','filter','\x27\x20registered','email','join','✓\x20API\x20key\x20removed\x20from\x20keychain','findIndex','\x0aSetup\x20cancelled','length','name','tdx:\x20auth\x20clear','jobs','\x20--profile\x20','description','green','439855XaaUwz','✗\x20Validation\x20failed:\x20','first_name','jp\x20\x20\x20-\x20Japan','/app/mp/ak','us\x20\x20\x20-\x20United\x20States','5LQgtrO','5907121GfGhmq'];a14_0x241f=function(){return _0x1f77f7;};return a14_0x241f();}(function(_0x3e9850,_0x523481){const _0x3d3880=a14_0x3215,_0x2e9053=_0x3e9850();while(!![]){try{const _0x5b6a8a=parseInt(_0x3d3880(0x18a))/0x1*(parseInt(_0x3d3880(0x16f))/0x2)+parseInt(_0x3d3880(0x173))/0x3*(-parseInt(_0x3d3880(0x15a))/0x4)+parseInt(_0x3d3880(0x184))/0x5+parseInt(_0x3d3880(0x16b))/0x6+parseInt(_0x3d3880(0x161))/0x7*(parseInt(_0x3d3880(0x18c))/0x8)+parseInt(_0x3d3880(0x170))/0x9*(-parseInt(_0x3d3880(0x14d))/0xa)+parseInt(_0x3d3880(0x18b))/0xb;if(_0x5b6a8a===_0x523481)break;else _0x2e9053['push'](_0x2e9053['shift']());}catch(_0xf8cbb8){_0x2e9053['push'](_0x2e9053['shift']());}}}(a14_0x241f,0x56316));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';function a14_0x3215(_0x1216ea,_0x2828e0){_0x1216ea=_0x1216ea-0x143;const _0x241fe0=a14_0x241f();let _0x32154c=_0x241fe0[_0x1216ea];return _0x32154c;}import{getConsoleUrl}from'../types/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a14_0x36fda8 from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a14_0x58d6b7 from'chalk';export class AuthSetupCommand extends BaseCommand{['name']=a14_0x1ff32b(0x193);[a14_0x1ff32b(0x182)]=a14_0x1ff32b(0x15e);async[a14_0x1ff32b(0x195)](_0x2e8293){const _0x1c1324=a14_0x1ff32b,{options:_0x2a2a01}=_0x2e8293,_0x298c3d=_0x2a2a01[_0x1c1324(0x147)];console[_0x1c1324(0x154)](a14_0x58d6b7[_0x1c1324(0x164)](_0x1c1324(0x14c)));const _0x4aa5b5=_0x2a2a01[_0x1c1324(0x16e)]||_0x1c1324(0x162),_0x4d60e9=[{'title':_0x1c1324(0x189),'value':_0x1c1324(0x162)},{'title':_0x1c1324(0x187),'value':_0x1c1324(0x169)},{'title':'eu\x20\x20\x20-\x20Europe','value':_0x1c1324(0x166)},{'title':_0x1c1324(0x16a),'value':_0x1c1324(0x15d)}];let _0x7045d5=_0x4d60e9[_0x1c1324(0x17b)](_0x414a5=>_0x414a5[_0x1c1324(0x172)]===_0x4aa5b5);_0x7045d5===-0x1&&_0x4aa5b5!=='us01'&&(_0x4d60e9[_0x1c1324(0x143)]({'title':_0x4aa5b5,'value':_0x4aa5b5}),_0x7045d5=_0x4d60e9[_0x1c1324(0x17d)]-0x1);_0x4d60e9[_0x1c1324(0x143)]({'title':'Enter\x20custom\x20site','value':_0x1c1324(0x15b)});const _0x2993e7=_0x298c3d?_0x1c1324(0x198)+_0x298c3d+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x114e38=await a14_0x36fda8({'type':_0x1c1324(0x197),'name':_0x1c1324(0x16e),'message':_0x2993e7,'choices':_0x4d60e9,'initial':_0x7045d5>=0x0?_0x7045d5:0x0});if(!_0x114e38[_0x1c1324(0x16e)])return console[_0x1c1324(0x154)](_0x1c1324(0x17c)),0x1;let _0x840e6;if(_0x114e38[_0x1c1324(0x16e)]===_0x1c1324(0x15b)){const _0x509219=await a14_0x36fda8({'type':_0x1c1324(0x149),'name':_0x1c1324(0x171),'message':'Enter\x20site\x20name:','initial':_0x1c1324(0x162),'validate':_0x3fff37=>{const _0x29a378=_0x1c1324;if(!_0x3fff37||!_0x3fff37[_0x29a378(0x168)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x3fff37[_0x29a378(0x168)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x509219[_0x1c1324(0x171)])return console['log'](_0x1c1324(0x17c)),0x1;_0x840e6=_0x509219[_0x1c1324(0x171)];}else _0x840e6=_0x114e38['site'];const _0x145ca8=resolveSite(_0x840e6);console[_0x1c1324(0x154)]('Setting\x20up\x20authentication\x20for\x20site:\x20'+_0x145ca8),console[_0x1c1324(0x154)](_0x1c1324(0x14a)),console[_0x1c1324(0x154)]('\x20\x20'+getConsoleUrl(_0x145ca8,_0x1c1324(0x188)));const _0x1d3388=await a14_0x36fda8({'type':'password','name':_0x1c1324(0x159),'message':_0x1c1324(0x156),'validate':_0x5401b0=>{const _0x263e86=_0x1c1324;if(!_0x5401b0||!_0x5401b0[_0x263e86(0x168)]())return _0x263e86(0x150);return!![];}});if(!_0x1d3388['apiKey'])return console[_0x1c1324(0x154)](_0x1c1324(0x17c)),0x1;const _0x366ead=_0x1d3388['apiKey'];console[_0x1c1324(0x154)](_0x1c1324(0x14f));try{const _0x4ba81e=TDX[_0x1c1324(0x145)]({'site':_0x145ca8,'apiKey':_0x366ead[_0x1c1324(0x168)](),'logLevel':_0x2a2a01[_0x1c1324(0x148)]??LogLevel[_0x1c1324(0x153)]}),_0x5ae667=await _0x4ba81e[_0x1c1324(0x180)][_0x1c1324(0x174)]();console['log'](_0x1c1324(0x196)+_0x5ae667[_0x1c1324(0x178)]+')');const _0x416a5f=await isKeychainAvailable();_0x416a5f?(await saveAPIKeyAsync(_0x366ead[_0x1c1324(0x168)](),_0x145ca8,_0x298c3d),console[_0x1c1324(0x154)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x298c3d?_0x1c1324(0x144)+_0x298c3d+')':''))):(console[_0x1c1324(0x18e)](a14_0x58d6b7[_0x1c1324(0x15f)](_0x1c1324(0x151))),console['warn'](a14_0x58d6b7[_0x1c1324(0x15f)](_0x1c1324(0x16c))));if(_0x298c3d){const _0x22c018={'site':_0x145ca8};saveProfileToUserConfig(_0x298c3d,_0x22c018),console[_0x1c1324(0x154)]('✓\x20Profile\x20\x27'+_0x298c3d+_0x1c1324(0x177));}const _0x1d2800=_0x298c3d?_0x1c1324(0x181)+_0x298c3d:'';return console[_0x1c1324(0x154)](),console[_0x1c1324(0x154)](_0x1c1324(0x160)),console['log'](_0x1c1324(0x191)+_0x1d2800+_0x1c1324(0x155)),console['log']('\x20\x20tdx'+_0x1d2800+_0x1c1324(0x157)),0x0;}catch(_0x20f130){if(_0x20f130 instanceof HTTPClientError&&_0x20f130[_0x1c1324(0x192)]===0x191)return printAuthError(_0x20f130),0x1;return console[_0x1c1324(0x158)](a14_0x58d6b7[_0x1c1324(0x14e)](_0x1c1324(0x185)+(_0x20f130 instanceof Error?_0x20f130[_0x1c1324(0x163)]:String(_0x20f130)))),console[_0x1c1324(0x158)](_0x1c1324(0x18f)),0x1;}}}export class AuthStatusCommand extends BaseCommand{['name']=a14_0x1ff32b(0x16d);[a14_0x1ff32b(0x182)]='Show\x20authentication\x20status\x20and\x20validate\x20API\x20key';async['execute'](_0x135e83){const _0x2235d5=a14_0x1ff32b,{options:_0x27ad9d,tdx:_0x26e0ed}=_0x135e83,_0x472046=_0x27ad9d[_0x2235d5(0x16e)],_0x3780dd=_0x27ad9d[_0x2235d5(0x147)],_0x3dac1c=_0x3780dd?_0x3780dd:_0x2235d5(0x175);console[_0x2235d5(0x154)](_0x2235d5(0x18d)+_0x3dac1c+_0x2235d5(0x15c)+_0x472046+')');const _0x1d7fa5=await resolveAPIKeyAsync(_0x472046,_0x3780dd);if(_0x1d7fa5){const {source:_0x50ef48,isDeprecated:_0x213668}=_0x1d7fa5,_0x20c978=_0x2235d5(0x165)+_0x50ef48;console['log'](_0x213668?a14_0x58d6b7[_0x2235d5(0x15f)](_0x20c978):_0x20c978);}else console['log'](a14_0x58d6b7[_0x2235d5(0x15f)](_0x2235d5(0x167)));try{const _0x17dae5=await _0x26e0ed['jobs'][_0x2235d5(0x174)]();return console['log'](a14_0x58d6b7[_0x2235d5(0x183)](_0x2235d5(0x190))),console[_0x2235d5(0x154)]('User:\x20'+_0x17dae5[_0x2235d5(0x178)]),(_0x17dae5['first_name']||_0x17dae5[_0x2235d5(0x146)])&&console[_0x2235d5(0x154)]('Name:\x20'+[_0x17dae5[_0x2235d5(0x186)],_0x17dae5['last_name']][_0x2235d5(0x176)](Boolean)[_0x2235d5(0x179)]('\x20')),0x0;}catch(_0x387ab4){return _0x387ab4 instanceof HTTPClientError&&_0x387ab4[_0x2235d5(0x192)]===0x191?printAuthError(_0x387ab4,!![],_0x3780dd):console[_0x2235d5(0x158)](a14_0x58d6b7['red'](_0x2235d5(0x185)+(_0x387ab4 instanceof Error?_0x387ab4[_0x2235d5(0x163)]:String(_0x387ab4)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a14_0x1ff32b(0x17e)]='auth:clear';[a14_0x1ff32b(0x182)]=a14_0x1ff32b(0x194);async[a14_0x1ff32b(0x195)](_0x2476bb){const _0x1fc916=a14_0x1ff32b,{options:_0x356d8f}=_0x2476bb,_0x28ea15=_0x356d8f[_0x1fc916(0x147)];console[_0x1fc916(0x154)](a14_0x58d6b7[_0x1fc916(0x164)](_0x1fc916(0x17f)));const _0x41befe=await isKeychainAvailable();if(!_0x41befe)return console[_0x1fc916(0x158)](a14_0x58d6b7[_0x1fc916(0x14e)](_0x1fc916(0x14b))),0x1;const _0x426c69=await deleteKeychainAPIKey(_0x28ea15);return _0x426c69?(clearCredentialCache(),console[_0x1fc916(0x154)](_0x1fc916(0x17a)+(_0x28ea15?_0x1fc916(0x144)+_0x28ea15+')':'')),0x0):(console[_0x1fc916(0x154)](_0x1fc916(0x152)+(_0x28ea15?'\x20for\x20profile:\x20'+_0x28ea15:'')),0x1);}}
@@ -1 +1 @@
1
- const a15_0x2d4bff=a15_0x504c;(function(_0x1e1483,_0x2738c3){const _0x589f61=a15_0x504c,_0x2b8a4e=_0x1e1483();while(!![]){try{const _0x4192ec=parseInt(_0x589f61(0x1f2))/0x1+parseInt(_0x589f61(0x1eb))/0x2+-parseInt(_0x589f61(0x20a))/0x3+-parseInt(_0x589f61(0x1fc))/0x4+parseInt(_0x589f61(0x1ea))/0x5*(-parseInt(_0x589f61(0x206))/0x6)+parseInt(_0x589f61(0x1dd))/0x7*(-parseInt(_0x589f61(0x20f))/0x8)+parseInt(_0x589f61(0x1f5))/0x9;if(_0x4192ec===_0x2738c3)break;else _0x2b8a4e['push'](_0x2b8a4e['shift']());}catch(_0x5ce041){_0x2b8a4e['push'](_0x2b8a4e['shift']());}}}(a15_0x4bd5,0x5cc9a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../utils/chat-cache.js';function a15_0x4bd5(){const _0x34d9ac=['chat','handleChatEvent','5AMoSlZ','538378JIZxQG','message','Getting\x20default\x20agent...','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','validate','description','includes','524662xIyYsy','stdout','streamChat','4968711ohGGNL','Resolving\x20project\x20\x27','resolveAgentId','write','event','stack','\x20\x20Cause:\x20','506900HVKmSa','name','session\x20context','\x27...','verbose','\x0aError:\x20','args','error','getAgentId','new','1238064SkAsjY','\x0aStack\x20trace:','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','agent','870546qjcVrr','CHAT_NOT_FOUND','Resolving\x20agent\x20\x27','data','getOrCreateDefaultAgent','72BtuWbM','resolveProjectId','metadata','llm','cause','Using\x20cached\x20default\x20agent:\x20','llmProject','266483eyBugy','execute','type','--agent\x20flag','404','getDefaultAgent','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','claude-4.5-haiku','join','Chat\x20session:\x20','Continuing\x20chat:\x20'];a15_0x4bd5=function(){return _0x34d9ac;};return a15_0x4bd5();}function a15_0x504c(_0x5c1477,_0x2e789c){_0x5c1477=_0x5c1477-0x1dd;const _0x4bd5ed=a15_0x4bd5();let _0x504c1d=_0x4bd5ed[_0x5c1477];return _0x504c1d;}function handleSDKError(_0x119c51,_0x4c8243){const _0x548ee5=a15_0x504c;if(_0x119c51 instanceof SDKError)console[_0x548ee5(0x203)]('Error:\x20'+_0x119c51[_0x548ee5(0x1ec)]),_0x4c8243[_0x548ee5(0x200)]&&(_0x119c51[_0x548ee5(0x213)]&&console[_0x548ee5(0x203)](_0x548ee5(0x1fb)+_0x119c51['cause']),_0x119c51[_0x548ee5(0x1fa)]&&(console[_0x548ee5(0x203)](_0x548ee5(0x207)),console[_0x548ee5(0x203)](_0x119c51[_0x548ee5(0x1fa)])));else throw _0x119c51;}export class ChatCommand extends BaseCommand{[a15_0x2d4bff(0x1fd)]=a15_0x2d4bff(0x1e8);[a15_0x2d4bff(0x1f0)]=a15_0x2d4bff(0x1ee);[a15_0x2d4bff(0x1ef)](_0x22aa55){const _0x1bcf58=a15_0x2d4bff,_0x4f9e2d=_0x22aa55[_0x1bcf58(0x202)][_0x1bcf58(0x1e5)]('\x20');if(!_0x4f9e2d)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async[a15_0x2d4bff(0x1f4)](_0x416530,_0x298ce4,_0x548787,_0x17629f,_0x4732a4){const _0xc2ce7a=a15_0x2d4bff;for await(const _0x360def of _0x416530['llm']['chat'](_0x298ce4,{'agentId':_0x548787,'chatId':_0x17629f})){if(_0x360def[_0xc2ce7a(0x1df)]===_0xc2ce7a(0x211)){const _0x54f844=_0x360def[_0xc2ce7a(0x20d)]['chatId'];saveLastChatId(_0x54f844),_0x4732a4&&console[_0xc2ce7a(0x203)](_0xc2ce7a(0x1e6)+_0x54f844);}else _0x360def['type']===_0xc2ce7a(0x1f9)&&this[_0xc2ce7a(0x1e9)](_0x360def['data']);}}async[a15_0x2d4bff(0x204)](_0xb6afed,_0x2ee05a,_0x32b5da,_0x1efae5,_0x3180bf){const _0x4efada=a15_0x2d4bff,_0x1888e3=_0x2ee05a||_0x32b5da;if(_0x1888e3){const {projectName:_0x55aaf4,agentName:_0x1c5fe9}=parseAgentRef(_0x1888e3),_0x155ab8=_0x1c5fe9||_0x1888e3,_0x4859d8=_0x1c5fe9?_0x55aaf4:_0x1efae5;if(!_0x4859d8)throw new Error(_0x4efada(0x208));if(_0x3180bf){const _0x2f7bab=_0x2ee05a?_0x4efada(0x1e0):_0x4efada(0x1fe);console[_0x4efada(0x203)]('Using\x20agent\x20from\x20'+_0x2f7bab+':\x20'+_0x4859d8+'/'+_0x155ab8);}const _0x2c26a9=await withSpinner(_0x4efada(0x1f6)+_0x4859d8+_0x4efada(0x1ff),()=>_0xb6afed[_0x4efada(0x212)][_0x4efada(0x210)](_0x4859d8),{'verbose':_0x3180bf}),_0x385dcd=await withSpinner(_0x4efada(0x20c)+_0x155ab8+'\x27...',()=>_0xb6afed['llm'][_0x4efada(0x1f7)](_0x155ab8,_0x2c26a9[_0x4efada(0x20d)]),{'verbose':_0x3180bf});return _0x385dcd[_0x4efada(0x20d)];}else{const _0xcec12d=_0xb6afed[_0x4efada(0x212)][_0x4efada(0x1e2)]();if(_0xcec12d)return _0x3180bf&&console[_0x4efada(0x203)](_0x4efada(0x214)+_0xcec12d['name']),_0xcec12d['id'];const _0x53622f=await withSpinner(_0x4efada(0x1ed),()=>_0xb6afed[_0x4efada(0x212)][_0x4efada(0x20e)](_0x4efada(0x1e4),0x0),{'verbose':_0x3180bf});return _0x53622f[_0x4efada(0x20d)]['id'];}}async[a15_0x2d4bff(0x1de)](_0x974b3d){const _0x3e24a1=a15_0x2d4bff,{options:_0x4b7de3,args:_0x3a511b,tdx:_0x40bf63}=_0x974b3d,_0x5aeceb=_0x3a511b['join']('\x20'),_0x2492b7=_0x4b7de3,_0x2fefac=_0x2492b7[_0x3e24a1(0x209)],_0xd99759=_0x2492b7['llmAgent'],_0x4caf0a=_0x2492b7[_0x3e24a1(0x215)],_0x543e00=_0x2492b7[_0x3e24a1(0x205)];try{let _0x26ba22,_0x508fdc;!_0x543e00&&(_0x508fdc=loadLastChatId(),_0x508fdc&&_0x4b7de3[_0x3e24a1(0x200)]&&console[_0x3e24a1(0x203)](_0x3e24a1(0x1e7)+_0x508fdc));(_0x543e00||!_0x508fdc)&&(_0x26ba22=await this[_0x3e24a1(0x204)](_0x40bf63,_0x2fefac,_0xd99759,_0x4caf0a,_0x4b7de3[_0x3e24a1(0x200)]));try{await this[_0x3e24a1(0x1f4)](_0x40bf63,_0x5aeceb,_0x26ba22,_0x508fdc,_0x4b7de3['verbose']);}catch(_0x22ae39){const _0x4ed1fa=_0x22ae39 instanceof SDKError&&_0x22ae39['code']===ErrorCode[_0x3e24a1(0x20b)]||_0x22ae39 instanceof Error&&_0x22ae39['message'][_0x3e24a1(0x1f1)](_0x3e24a1(0x1e1));if(_0x4ed1fa)_0x4b7de3[_0x3e24a1(0x200)]&&console[_0x3e24a1(0x203)](_0x3e24a1(0x1e3)),!_0x26ba22&&(_0x26ba22=await this[_0x3e24a1(0x204)](_0x40bf63,_0x2fefac,_0xd99759,_0x4caf0a,_0x4b7de3[_0x3e24a1(0x200)])),await this[_0x3e24a1(0x1f4)](_0x40bf63,_0x5aeceb,_0x26ba22,undefined,_0x4b7de3[_0x3e24a1(0x200)]);else throw _0x22ae39;}return console['log'](),0x0;}catch(_0x1a86a7){return console['error'](),handleSDKError(_0x1a86a7,_0x4b7de3),0x1;}}[a15_0x2d4bff(0x1e9)](_0x276ee4){const _0x2ec3d4=a15_0x2d4bff;if('content'in _0x276ee4)process[_0x2ec3d4(0x1f3)][_0x2ec3d4(0x1f8)](_0x276ee4['content']);else'error'in _0x276ee4&&console[_0x2ec3d4(0x203)](_0x2ec3d4(0x201)+_0x276ee4['error']);}}
1
+ const a15_0x433439=a15_0x598d;(function(_0x406a8a,_0x2ad0c3){const _0x65d3ce=a15_0x598d,_0xbeb6cc=_0x406a8a();while(!![]){try{const _0x1f1176=-parseInt(_0x65d3ce(0x10f))/0x1*(-parseInt(_0x65d3ce(0x111))/0x2)+-parseInt(_0x65d3ce(0xe8))/0x3*(parseInt(_0x65d3ce(0xf3))/0x4)+parseInt(_0x65d3ce(0xfe))/0x5*(-parseInt(_0x65d3ce(0xe2))/0x6)+parseInt(_0x65d3ce(0x10e))/0x7+-parseInt(_0x65d3ce(0x108))/0x8+parseInt(_0x65d3ce(0xe1))/0x9*(-parseInt(_0x65d3ce(0xe0))/0xa)+-parseInt(_0x65d3ce(0xef))/0xb*(-parseInt(_0x65d3ce(0xee))/0xc);if(_0x1f1176===_0x2ad0c3)break;else _0xbeb6cc['push'](_0xbeb6cc['shift']());}catch(_0x47bc04){_0xbeb6cc['push'](_0xbeb6cc['shift']());}}}(a15_0x1a69,0x8270a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a15_0x598d(_0x29c594,_0x1b89c4){_0x29c594=_0x29c594-0xd9;const _0x1a6937=a15_0x1a69();let _0x598d93=_0x1a6937[_0x29c594];return _0x598d93;}import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../utils/chat-cache.js';function a15_0x1a69(){const _0x5de1e5=['Using\x20agent\x20from\x20','chat','CHAT_NOT_FOUND','4976740DWhcoA','9PzjKIy','174IcqpJK','metadata','getAgentId','execute','code','verbose','3ZzYATh','Error:\x20','error','type','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','name','240dgCgav','552442ZBhmXx','streamChat','Resolving\x20agent\x20\x27','args','712AKaJiY','Using\x20cached\x20default\x20agent:\x20','resolveAgentId','\x27...','stack','claude-4.5-haiku','log','join','write','getOrCreateDefaultAgent','llmAgent','44945rWdcIp','includes','Getting\x20default\x20agent...','resolveProjectId','llm','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','message','content','agent','Chat\x20session:\x20','7100192ggllZG','chatId','404','data','llmProject','session\x20context','4572344khHqBU','522707briTaB','\x0aStack\x20trace:','2HEkLXU','event','--agent\x20flag','getDefaultAgent','cause','Resolving\x20project\x20\x27','\x20\x20Cause:\x20'];a15_0x1a69=function(){return _0x5de1e5;};return a15_0x1a69();}function handleSDKError(_0x5571af,_0x477c4c){const _0x102337=a15_0x598d;if(_0x5571af instanceof SDKError)console['error'](_0x102337(0xe9)+_0x5571af[_0x102337(0x104)]),_0x477c4c[_0x102337(0xe7)]&&(_0x5571af[_0x102337(0xda)]&&console['error'](_0x102337(0xdc)+_0x5571af['cause']),_0x5571af[_0x102337(0xf7)]&&(console[_0x102337(0xea)](_0x102337(0x110)),console[_0x102337(0xea)](_0x5571af[_0x102337(0xf7)])));else throw _0x5571af;}export class ChatCommand extends BaseCommand{[a15_0x433439(0xed)]=a15_0x433439(0xde);['description']=a15_0x433439(0x103);['validate'](_0x117d12){const _0xb441e2=a15_0x433439,_0x460b09=_0x117d12[_0xb441e2(0xf2)][_0xb441e2(0xfa)]('\x20');if(!_0x460b09)return _0xb441e2(0xec);return undefined;}async[a15_0x433439(0xf0)](_0x23a318,_0x74c5a5,_0xa1262b,_0x4e8f30,_0x29094b){const _0x3d6493=a15_0x433439;for await(const _0x20e4e8 of _0x23a318[_0x3d6493(0x102)][_0x3d6493(0xde)](_0x74c5a5,{'agentId':_0xa1262b,'chatId':_0x4e8f30})){if(_0x20e4e8[_0x3d6493(0xeb)]===_0x3d6493(0xe3)){const _0x1b28d2=_0x20e4e8['data'][_0x3d6493(0x109)];saveLastChatId(_0x1b28d2),_0x29094b&&console['error'](_0x3d6493(0x107)+_0x1b28d2);}else _0x20e4e8['type']===_0x3d6493(0x112)&&this['handleChatEvent'](_0x20e4e8[_0x3d6493(0x10b)]);}}async[a15_0x433439(0xe4)](_0x193c61,_0x4237bf,_0x4cecfa,_0x17cafb,_0x36649a){const _0x308138=a15_0x433439,_0x10cdda=_0x4237bf||_0x4cecfa;if(_0x10cdda){const {projectName:_0x48fc4c,agentName:_0x17b9e1}=parseAgentRef(_0x10cdda),_0x40f441=_0x17b9e1||_0x10cdda,_0x16c48a=_0x17b9e1?_0x48fc4c:_0x17cafb;if(!_0x16c48a)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x36649a){const _0x4326eb=_0x4237bf?_0x308138(0x113):_0x308138(0x10d);console[_0x308138(0xea)](_0x308138(0xdd)+_0x4326eb+':\x20'+_0x16c48a+'/'+_0x40f441);}const _0x58e1e9=await withSpinner(_0x308138(0xdb)+_0x16c48a+'\x27...',()=>_0x193c61[_0x308138(0x102)][_0x308138(0x101)](_0x16c48a),{'verbose':_0x36649a}),_0x430c69=await withSpinner(_0x308138(0xf1)+_0x40f441+_0x308138(0xf6),()=>_0x193c61[_0x308138(0x102)][_0x308138(0xf5)](_0x40f441,_0x58e1e9[_0x308138(0x10b)]),{'verbose':_0x36649a});return _0x430c69[_0x308138(0x10b)];}else{const _0x292cd6=_0x193c61[_0x308138(0x102)][_0x308138(0xd9)]();if(_0x292cd6)return _0x36649a&&console[_0x308138(0xea)](_0x308138(0xf4)+_0x292cd6[_0x308138(0xed)]),_0x292cd6['id'];const _0x253568=await withSpinner(_0x308138(0x100),()=>_0x193c61['llm'][_0x308138(0xfc)](_0x308138(0xf8),0x0),{'verbose':_0x36649a});return _0x253568['data']['id'];}}async[a15_0x433439(0xe5)](_0x57f3bb){const _0x1bd664=a15_0x433439,{options:_0x27614a,args:_0x11dca5,tdx:_0x1d69df}=_0x57f3bb,_0x42ce65=_0x11dca5[_0x1bd664(0xfa)]('\x20'),_0x274d0e=_0x27614a,_0x432238=_0x274d0e[_0x1bd664(0x106)],_0x46de05=_0x274d0e[_0x1bd664(0xfd)],_0x268d48=_0x274d0e[_0x1bd664(0x10c)],_0x44b61f=_0x274d0e['new'];try{let _0x4422b7,_0x18f411;!_0x44b61f&&(_0x18f411=loadLastChatId(),_0x18f411&&_0x27614a[_0x1bd664(0xe7)]&&console[_0x1bd664(0xea)]('Continuing\x20chat:\x20'+_0x18f411));(_0x44b61f||!_0x18f411)&&(_0x4422b7=await this[_0x1bd664(0xe4)](_0x1d69df,_0x432238,_0x46de05,_0x268d48,_0x27614a[_0x1bd664(0xe7)]));try{await this[_0x1bd664(0xf0)](_0x1d69df,_0x42ce65,_0x4422b7,_0x18f411,_0x27614a[_0x1bd664(0xe7)]);}catch(_0x2914b1){const _0x48b135=_0x2914b1 instanceof SDKError&&_0x2914b1[_0x1bd664(0xe6)]===ErrorCode[_0x1bd664(0xdf)]||_0x2914b1 instanceof Error&&_0x2914b1[_0x1bd664(0x104)][_0x1bd664(0xff)](_0x1bd664(0x10a));if(_0x48b135)_0x27614a[_0x1bd664(0xe7)]&&console['error']('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x4422b7&&(_0x4422b7=await this['getAgentId'](_0x1d69df,_0x432238,_0x46de05,_0x268d48,_0x27614a['verbose'])),await this[_0x1bd664(0xf0)](_0x1d69df,_0x42ce65,_0x4422b7,undefined,_0x27614a[_0x1bd664(0xe7)]);else throw _0x2914b1;}return console[_0x1bd664(0xf9)](),0x0;}catch(_0x29a1e7){return console['error'](),handleSDKError(_0x29a1e7,_0x27614a),0x1;}}['handleChatEvent'](_0x1831a4){const _0x55915e=a15_0x433439;if(_0x55915e(0x105)in _0x1831a4)process['stdout'][_0x55915e(0xfb)](_0x1831a4[_0x55915e(0x105)]);else'error'in _0x1831a4&&console['error']('\x0aError:\x20'+_0x1831a4[_0x55915e(0xea)]);}}
@@ -1 +1 @@
1
- const a16_0x53c67e=a16_0x2532;(function(_0x212274,_0x59fb8c){const _0x3ac8a5=a16_0x2532,_0x5b51a5=_0x212274();while(!![]){try{const _0x5ed15d=-parseInt(_0x3ac8a5(0x1c0))/0x1*(parseInt(_0x3ac8a5(0x217))/0x2)+parseInt(_0x3ac8a5(0x1f0))/0x3*(-parseInt(_0x3ac8a5(0x1d6))/0x4)+parseInt(_0x3ac8a5(0x201))/0x5*(parseInt(_0x3ac8a5(0x23d))/0x6)+parseInt(_0x3ac8a5(0x1cf))/0x7+parseInt(_0x3ac8a5(0x1e8))/0x8+-parseInt(_0x3ac8a5(0x1e9))/0x9*(-parseInt(_0x3ac8a5(0x1cd))/0xa)+-parseInt(_0x3ac8a5(0x23b))/0xb;if(_0x5ed15d===_0x59fb8c)break;else _0x5b51a5['push'](_0x5b51a5['shift']());}catch(_0x522518){_0x5b51a5['push'](_0x5b51a5['shift']());}}}(a16_0x3096,0xaf417));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 a16_0xf3168b 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=a16_0x53c67e(0x1c3);function handleInstallationError(_0x5f1a2c,_0x427eee,_0x41395a,_0x13c24c){const _0xab4c80=a16_0x53c67e;errorContains(_0x5f1a2c,_0xab4c80(0x220),_0xab4c80(0x22c),'already\x20configured')?(_0x41395a[_0xab4c80(0x1f2)]='✓\x20'+_0x427eee+_0xab4c80(0x1e4),_0x13c24c?.['info'](_0x427eee+_0xab4c80(0x1e4)),_0x5f1a2c instanceof SDKError&&_0x5f1a2c[_0xab4c80(0x23e)]&&_0x13c24c?.['debug'](_0xab4c80(0x1ca)+_0x5f1a2c['cause'][_0xab4c80(0x1f3)])):(_0x41395a[_0xab4c80(0x21a)](_0xab4c80(0x21f)+_0x427eee),_0x13c24c?.[_0xab4c80(0x1ce)](_0x427eee+'\x20configuration\x20failed',_0x5f1a2c));}export function parseVersion(_0x1b7ae3){const _0x11f33f=a16_0x53c67e,_0x338f68=_0x1b7ae3['trim']()[_0x11f33f(0x222)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x338f68)return null;return{'major':parseInt(_0x338f68[0x1],0xa),'minor':parseInt(_0x338f68[0x2],0xa),'patch':parseInt(_0x338f68[0x3],0xa)};}export function compareVersions(_0x586c4c,_0x24d708){const _0x179532=a16_0x53c67e;if(_0x586c4c['major']!==_0x24d708['major'])return _0x586c4c[_0x179532(0x243)]-_0x24d708[_0x179532(0x243)];if(_0x586c4c[_0x179532(0x1c4)]!==_0x24d708[_0x179532(0x1c4)])return _0x586c4c[_0x179532(0x1c4)]-_0x24d708[_0x179532(0x1c4)];return _0x586c4c[_0x179532(0x1c2)]-_0x24d708[_0x179532(0x1c2)];}async function checkClaudeVersion(_0x54a98b,_0x160fa5){const _0x163216=a16_0x53c67e;_0x160fa5?.['debug'](_0x163216(0x1bc)+_0x54a98b+')');const _0x2d82be=await executeClaudeCommand([_0x163216(0x1b7)],undefined,_0x160fa5),_0x2f8d59=parseVersion(_0x2d82be);if(!_0x2f8d59){_0x160fa5?.[_0x163216(0x21a)](_0x163216(0x1f1)+_0x2d82be);return;}const _0xacb5c8=_0x2f8d59['major']+'.'+_0x2f8d59[_0x163216(0x1c4)]+'.'+_0x2f8d59[_0x163216(0x1c2)],_0xc9b5f1=parseVersion(_0x54a98b);if(!_0xc9b5f1){_0x160fa5?.['warn'](_0x163216(0x1e3)+_0x54a98b);return;}if(compareVersions(_0x2f8d59,_0xc9b5f1)<0x0){_0x160fa5?.[_0x163216(0x1ce)](_0x163216(0x238)+_0xacb5c8+_0x163216(0x1c8)+_0x54a98b+')');throw new SDKError(ErrorCode[_0x163216(0x239)],_0x163216(0x238)+_0xacb5c8+_0x163216(0x1ee)+_0x54a98b+'\x20or\x20later.',undefined,{'helpText':_0x163216(0x1b2)});}_0x160fa5?.[_0x163216(0x1b6)](_0x163216(0x238)+_0xacb5c8+_0x163216(0x1b5));}async function executeClaudeCommand(_0x302f28,_0x3b9457,_0x19fd8b){const _0x87167f=a16_0x53c67e;return _0x19fd8b?.[_0x87167f(0x224)]('Executing:\x20claude\x20'+_0x302f28[_0x87167f(0x1bb)]('\x20')),new Promise((_0x47ad75,_0x452ae4)=>{const _0x3d9b0a=_0x87167f,_0x2ea95e=spawn('claude',_0x302f28,{'stdio':_0x3d9b0a(0x20f)});let _0x4fc958='',_0x5c4343='';_0x2ea95e['stdout']['on'](_0x3d9b0a(0x218),_0x5ceea9=>{_0x4fc958+=_0x5ceea9['toString']();}),_0x2ea95e[_0x3d9b0a(0x213)]['on'](_0x3d9b0a(0x218),_0x2d04e3=>{const _0x5b65af=_0x3d9b0a;_0x5c4343+=_0x2d04e3[_0x5b65af(0x204)]();}),_0x2ea95e['on'](_0x3d9b0a(0x1ce),_0x2a2acd=>{const _0x9b9b87=_0x3d9b0a;_0x2a2acd[_0x9b9b87(0x1f5)]===_0x9b9b87(0x200)?(_0x19fd8b?.[_0x9b9b87(0x1ce)](_0x9b9b87(0x1da)),_0x452ae4(new SDKError(ErrorCode[_0x9b9b87(0x1e7)],_0x9b9b87(0x1da),_0x2a2acd,{'helpText':_0x9b9b87(0x212)}))):(_0x19fd8b?.['error'](_0x9b9b87(0x1c7)+_0x2a2acd[_0x9b9b87(0x1f3)]),_0x452ae4(new SDKError(ErrorCode[_0x9b9b87(0x1dd)],_0x9b9b87(0x1d2)+_0x2a2acd['message'],_0x2a2acd)));}),_0x2ea95e['on'](_0x3d9b0a(0x22a),_0x3a38a6=>{const _0x175830=_0x3d9b0a;if(_0x3a38a6===0x0)_0x47ad75(_0x4fc958);else _0x3b9457?(_0x19fd8b?.[_0x175830(0x1ce)]('Command\x20failed\x20(exit\x20'+_0x3a38a6+_0x175830(0x232)+_0x302f28[_0x175830(0x1bb)]('\x20')),_0x452ae4(new SDKError(ErrorCode[_0x175830(0x1fe)],_0x3b9457,new Error(_0x5c4343)))):_0x47ad75('');});});}async function ensureMcpServer(_0x8598b1,_0xe1392b,_0x4f4708,_0x443cc7,_0x183714){const _0x37ce9c=a16_0x53c67e;_0x443cc7[_0x37ce9c(0x1f2)]=_0x37ce9c(0x23c)+_0x8598b1+_0x37ce9c(0x1df),await executeClaudeCommand(['mcp',_0x37ce9c(0x1f8),_0x8598b1,_0xe1392b,'--transport',_0x4f4708],_0x37ce9c(0x1b3)+_0x8598b1+'\x27',_0x183714),_0x443cc7[_0x37ce9c(0x1f2)]=_0x37ce9c(0x1db)+_0x8598b1+_0x37ce9c(0x1d1);}function a16_0x2532(_0x244142,_0x41edad){_0x244142=_0x244142-0x1b1;const _0x30963a=a16_0x3096();let _0x2532cf=_0x30963a[_0x244142];return _0x2532cf;}async function ensureMarketplace(_0x5dfded,_0x28bbcb,_0x2fe545,_0x3d6779){const _0x49b257=a16_0x53c67e;_0x2fe545[_0x49b257(0x1f2)]=_0x49b257(0x1ea)+_0x5dfded+_0x49b257(0x1df),await executeClaudeCommand([_0x49b257(0x211),_0x49b257(0x1d4),'add',_0x28bbcb],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x5dfded+'\x27',_0x3d6779),_0x2fe545[_0x49b257(0x1f2)]='✓\x20Marketplace\x20\x27'+_0x5dfded+'\x27\x20configured';}async function updateMarketplace(_0x405d89,_0x5ad06a,_0x255368){const _0x187232=a16_0x53c67e;_0x5ad06a[_0x187232(0x1f2)]=_0x187232(0x1e2)+_0x405d89+_0x187232(0x1df),await executeClaudeCommand(['plugin',_0x187232(0x1d4),_0x187232(0x229)],_0x187232(0x236)+_0x405d89+'\x27',_0x255368),_0x5ad06a[_0x187232(0x1f2)]=_0x187232(0x1f6)+_0x405d89+_0x187232(0x1c1);}async function ensurePlugin(_0x2adebf,_0x35cd82,_0x1f8b5c,_0x1d095c){const _0x3710a5=a16_0x53c67e;_0x1f8b5c[_0x3710a5(0x1f2)]=_0x3710a5(0x1c6)+_0x2adebf+_0x3710a5(0x1df),await executeClaudeCommand([_0x3710a5(0x211),_0x3710a5(0x1e1),_0x2adebf+'@'+_0x35cd82],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x2adebf+'\x27',_0x1d095c),_0x1f8b5c[_0x3710a5(0x1f2)]=_0x3710a5(0x206)+_0x2adebf+'\x27\x20installed';}async function createClaudeSettings(_0x4709d0,_0x24cab5=a16_0x53c67e(0x22f),_0x1d04af){const _0x5cc3c6=a16_0x53c67e,_0x27bc51=join(process[_0x5cc3c6(0x1b9)](),_0x5cc3c6(0x21b)),_0x21f22e=join(_0x27bc51,_0x5cc3c6(0x20c));await mkdir(_0x27bc51,{'recursive':!![]});let _0x2c466e={};if(existsSync(_0x21f22e))try{const _0x2a149c=await readFile(_0x21f22e,_0x5cc3c6(0x244));_0x2c466e=JSON[_0x5cc3c6(0x1e6)](_0x2a149c);}catch{_0x2c466e={};}const _0x3c45f1=_0x2c466e[_0x5cc3c6(0x1cc)]||{},_0x42d0a8={'ANTHROPIC_BASE_URL':_0x3c45f1[_0x5cc3c6(0x216)],'ANTHROPIC_MODEL':_0x3c45f1['ANTHROPIC_MODEL'],'ANTHROPIC_AUTH_TOKEN':_0x3c45f1[_0x5cc3c6(0x240)],'statusLine':_0x2c466e[_0x5cc3c6(0x207)]},_0x4f9bb4={..._0x2c466e,'env':{..._0x3c45f1,'ANTHROPIC_BASE_URL':_0x5cc3c6(0x20d)+_0x4709d0,'ANTHROPIC_MODEL':_0x24cab5,'ANTHROPIC_AUTH_TOKEN':_0x5cc3c6(0x221)},'statusLine':{'type':_0x5cc3c6(0x1bd),'command':_0x1d04af?_0x5cc3c6(0x235)+_0x1d04af+_0x5cc3c6(0x1d9):_0x5cc3c6(0x1f9)}};return await writeFile(_0x21f22e,JSON['stringify'](_0x4f9bb4,null,0x2)+'\x0a'),_0x42d0a8;}async function restoreClaudeSettings(_0x3905bb){const _0x4d9045=a16_0x53c67e,_0x1aaecb=join(process[_0x4d9045(0x1b9)](),'.claude'),_0x4fbd0f=join(_0x1aaecb,_0x4d9045(0x20c));if(!existsSync(_0x4fbd0f))return;try{const _0x50f6d0=await readFile(_0x4fbd0f,_0x4d9045(0x244)),_0x2a0109=JSON[_0x4d9045(0x1e6)](_0x50f6d0),_0x529785=_0x2a0109[_0x4d9045(0x1cc)]||{},_0x9af4dd=_0x529785['ANTHROPIC_BASE_URL'],_0x42bc9b=((()=>{const _0x2cefbb=_0x4d9045;if(typeof _0x9af4dd!==_0x2cefbb(0x228))return![];try{const _0x2b2d0e=new URL(_0x9af4dd);return _0x2b2d0e['hostname']===_0x2cefbb(0x227)||_0x2b2d0e[_0x2cefbb(0x23a)]===_0x2cefbb(0x20a);}catch{return![];}})());_0x42bc9b?(delete _0x529785['ANTHROPIC_BASE_URL'],delete _0x529785['ANTHROPIC_MODEL'],delete _0x529785['ANTHROPIC_AUTH_TOKEN']):(_0x3905bb['ANTHROPIC_BASE_URL']!==undefined?_0x529785[_0x4d9045(0x216)]=_0x3905bb[_0x4d9045(0x216)]:delete _0x529785[_0x4d9045(0x216)],_0x3905bb[_0x4d9045(0x1ec)]!==undefined?_0x529785[_0x4d9045(0x1ec)]=_0x3905bb[_0x4d9045(0x1ec)]:delete _0x529785[_0x4d9045(0x1ec)],_0x3905bb[_0x4d9045(0x240)]!==undefined?_0x529785[_0x4d9045(0x240)]=_0x3905bb[_0x4d9045(0x240)]:delete _0x529785[_0x4d9045(0x240)]);const _0x5a8bd6=_0x2a0109[_0x4d9045(0x207)],_0x451c81=((()=>{const _0x590c3b=_0x4d9045;if(!_0x5a8bd6||typeof _0x5a8bd6!=='object')return![];if(_0x5a8bd6[_0x590c3b(0x1d0)]!==_0x590c3b(0x1bd))return![];if(typeof _0x5a8bd6[_0x590c3b(0x1bd)]!==_0x590c3b(0x228))return![];return _0x5a8bd6[_0x590c3b(0x1bd)][_0x590c3b(0x1eb)](_0x590c3b(0x1fa))&&_0x5a8bd6['command']['includes'](_0x590c3b(0x230));})());if(_0x451c81)delete _0x2a0109[_0x4d9045(0x207)];else _0x3905bb[_0x4d9045(0x207)]!==undefined?_0x2a0109[_0x4d9045(0x207)]=_0x3905bb[_0x4d9045(0x207)]:delete _0x2a0109[_0x4d9045(0x207)];_0x2a0109['env']=_0x529785,await writeFile(_0x4fbd0f,JSON[_0x4d9045(0x21e)](_0x2a0109,null,0x2)+'\x0a');}catch{}}function a16_0x3096(){const _0x57a34e=['INTERNAL','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','\x27...','proxy','install','Updating\x20marketplace\x20\x27','Invalid\x20minimum\x20version\x20format:\x20','\x20already\x20configured','init','parse','CLAUDE_CODE_NOT_FOUND','2568832nTYXCR','3113577wWWCce','Configuring\x20marketplace\x20\x27','includes','ANTHROPIC_MODEL','red','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','port','184851wFHksK','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','text','message','✓\x20Settings\x20restored:\x20.claude/settings.local.json','code','✓\x20Marketplace\x20\x27','inherit','add','tdx\x20claude\x20statusline','tdx','getLogPath','attributes','logger','INSTALLATION_FAILED','account_id','ENOENT','10rNBxSE','getOrCreateDefaultProject','close','toString','findClaudePath','✓\x20Plugin\x20\x27','statusLine','name','✓\x20Logs\x20saved\x20to\x20','127.0.0.1','td-skills\x20Plugins','settings.local.json','http://127.0.0.1:','Initializing\x20proxy\x20logger...','pipe','✓\x20Using\x20project:\x20','plugin','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','stderr','td-skills','Setup\x20failed','ANTHROPIC_BASE_URL','392096mBfqor','data','unshift','warn','.claude','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','user','stringify','Warning:\x20Failed\x20to\x20configure\x20','already\x20exists','tdx-managed-proxy','match','tdx-skills','info','Setting\x20up\x20project...','originalSettings','localhost','string','update','exit','workflow-skills','already\x20installed','model','getCurrent','sonnet','statusline','green','):\x20claude\x20','Finding\x20available\x20port...','td-docs','tdx\x20--profile\x20','Failed\x20to\x20update\x20marketplace\x20\x27','Starting\x20TD\x20LLM\x20proxy\x20server...','Claude\x20Code\x20version\x20','CLAUDE_CODE_UNSUPPORTED_VERSION','hostname','6731637AjeYYo','Configuring\x20MCP\x20server\x20\x27','3895752yyJSBK','cause','server','ANTHROPIC_AUTH_TOKEN','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','Initializing...','major','utf-8','✓\x20Claude\x20Code\x20version\x20OK','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','execute','\x20meets\x20minimum\x20requirement','debug','--version','trim','cwd','Claude\x20Code\x20version\x20check\x20failed','join','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','command','continue','site','3NjKYEM','\x27\x20updated','patch','2.0.20','minor','start','Installing\x20plugin\x20\x27','Command\x20spawn\x20error:\x20','\x20is\x20too\x20old\x20(minimum:\x20','stdout','Command\x20output:\x20','https://github.com/treasure-data/td-skills','env','30rxTfTi','error','3880576xbyNZm','type','\x27\x20configured','Failed\x20to\x20spawn\x20claude\x20command:\x20','✓\x20Port\x20','marketplace','stop','84nfWPkW','fail','log','\x20claude\x20statusline','Claude\x20Code\x20CLI\x20not\x20found','✓\x20MCP\x20server\x20\x27','claude'];a16_0x3096=function(){return _0x57a34e;};return a16_0x3096();}export class ClaudeCommand extends BaseCommand{[a16_0x53c67e(0x208)]=a16_0x53c67e(0x1dc);['description']=a16_0x53c67e(0x1de);[a16_0x53c67e(0x23f)];['originalSettings'];['logger'];[a16_0x53c67e(0x1ef)];async[a16_0x53c67e(0x1b4)](_0x5874c0){const _0x4b456b=a16_0x53c67e,{tdx:_0x25c634,options:_0x534235,args:_0x1d59f3}=_0x5874c0;try{const _0xf2cc82=_0x534235,_0x79c39c=_0xf2cc82[_0x4b456b(0x22d)]||_0x4b456b(0x22f),_0x5df975=_0xf2cc82[_0x4b456b(0x1e0)]===![],_0x1ae942=_0xf2cc82[_0x4b456b(0x1be)]===!![],_0x53785b=_0xf2cc82['resume']===!![],_0x5ec14d=[..._0x1d59f3];if(_0x1ae942)_0x5ec14d[_0x4b456b(0x219)]('-c');else _0x53785b&&_0x5ec14d[_0x4b456b(0x219)]('-r');const _0x54cc0a=createCommandSpinner(_0x4b456b(0x242),{'verbose':_0x534235['verbose']});_0x54cc0a[_0x4b456b(0x1c5)]();try{if(!_0x5df975){_0x54cc0a[_0x4b456b(0x1f2)]=_0x4b456b(0x233),this['port']=await findAvailablePort(0xfa0),_0x54cc0a[_0x4b456b(0x1f2)]=_0x4b456b(0x1d3)+this[_0x4b456b(0x1ef)],_0x54cc0a[_0x4b456b(0x1f2)]=_0x4b456b(0x225);const _0x3be7af=await _0x25c634['llm'][_0x4b456b(0x202)](),_0xb46403=_0x3be7af['id'];_0x54cc0a[_0x4b456b(0x1f2)]=_0x4b456b(0x210)+_0x3be7af[_0x4b456b(0x1fc)]['name'];const _0x25c610=_0x534235['profile'];try{const _0x2dcae9=await _0x25c634[_0x4b456b(0x21d)][_0x4b456b(0x22e)]();_0x2dcae9['account_id']&&writeCachedAccountInfo(_0x534235[_0x4b456b(0x1bf)],_0x2dcae9[_0x4b456b(0x1ff)],_0x25c610);}catch{}_0x54cc0a[_0x4b456b(0x1f2)]=_0x4b456b(0x20e),this[_0x4b456b(0x1fd)]=new TDXLogger(_0x534235['logLevel'],!![]),await this[_0x4b456b(0x1fd)][_0x4b456b(0x1e5)]();const _0x3e43ce=this[_0x4b456b(0x1fd)]['getLogPath']();_0x54cc0a[_0x4b456b(0x1f2)]='✓\x20Logging\x20to\x20'+_0x3e43ce,_0x54cc0a[_0x4b456b(0x1f2)]=_0x4b456b(0x237),this['server']=new ProxyServer({'port':this[_0x4b456b(0x1ef)],'projectId':_0xb46403,'tdx':_0x25c634,'logger':this[_0x4b456b(0x1fd)],'site':_0x534235[_0x4b456b(0x1bf)]}),await this[_0x4b456b(0x23f)][_0x4b456b(0x1c5)](),_0x54cc0a[_0x4b456b(0x1f2)]='✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20'+this[_0x4b456b(0x1ef)],_0x54cc0a[_0x4b456b(0x1f2)]='Creating\x20.claude/settings.local.json...',this[_0x4b456b(0x226)]=await createClaudeSettings(this[_0x4b456b(0x1ef)],_0x79c39c,_0x25c610),_0x54cc0a[_0x4b456b(0x1f2)]='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x54cc0a[_0x4b456b(0x1f2)]=_0x4b456b(0x21c);try{_0x54cc0a[_0x4b456b(0x1f2)]='Checking\x20Claude\x20Code\x20version...',await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x4b456b(0x1fd)]),_0x54cc0a[_0x4b456b(0x1f2)]=_0x4b456b(0x1b1);}catch(_0x61f4c4){_0x54cc0a[_0x4b456b(0x1d7)](_0x4b456b(0x1ba));throw _0x61f4c4;}try{await ensureMcpServer(_0x4b456b(0x234),'https://docs.treasuredata.com/mcp','http',_0x54cc0a,this[_0x4b456b(0x1fd)]);}catch(_0x7c37e){handleInstallationError(_0x7c37e,'TD\x20Docs\x20MCP\x20Server',_0x54cc0a,this[_0x4b456b(0x1fd)]);}try{await ensureMarketplace(_0x4b456b(0x214),_0x4b456b(0x1cb),_0x54cc0a,this[_0x4b456b(0x1fd)]),await updateMarketplace(_0x4b456b(0x214),_0x54cc0a,this[_0x4b456b(0x1fd)]),await ensurePlugin('sql-skills',_0x4b456b(0x214),_0x54cc0a,this['logger']),await ensurePlugin(_0x4b456b(0x22b),'td-skills',_0x54cc0a,this[_0x4b456b(0x1fd)]),await ensurePlugin(_0x4b456b(0x223),_0x4b456b(0x214),_0x54cc0a,this[_0x4b456b(0x1fd)]);}catch(_0x550e2e){handleInstallationError(_0x550e2e,_0x4b456b(0x20b),_0x54cc0a,this[_0x4b456b(0x1fd)]);}_0x54cc0a[_0x4b456b(0x1d5)]();}catch(_0x3adbd0){_0x54cc0a['fail'](_0x4b456b(0x215));throw _0x3adbd0;}const _0x1f376f=await this[_0x4b456b(0x205)]();if(!_0x1f376f)throw new SDKError(ErrorCode[_0x4b456b(0x1e7)],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':_0x4b456b(0x212)});const _0x2791d3={...process['env']};!_0x5df975&&(_0x2791d3[_0x4b456b(0x216)]=_0x4b456b(0x20d)+this[_0x4b456b(0x1ef)],_0x2791d3['ANTHROPIC_MODEL']=_0x79c39c,_0x2791d3[_0x4b456b(0x240)]='tdx-managed-proxy');const _0x18e623=spawn(_0x1f376f,_0x5ec14d,{'stdio':_0x4b456b(0x1f7),'env':_0x2791d3}),_0x1c5c77=await new Promise(_0xf7b73f=>{const _0x4d89d2=_0x4b456b;_0x18e623['on'](_0x4d89d2(0x22a),_0x5ab621=>{_0xf7b73f(_0x5ab621||0x0);}),_0x18e623['on']('error',_0xa723f8=>{const _0x5abd80=_0x4d89d2;console[_0x5abd80(0x1ce)](a16_0xf3168b[_0x5abd80(0x1ed)]('Failed\x20to\x20launch\x20Claude\x20Code:\x20'+_0xa723f8[_0x5abd80(0x1f3)])),_0xf7b73f(0x1);});});this[_0x4b456b(0x23f)]&&(await this[_0x4b456b(0x23f)]['stop'](),console[_0x4b456b(0x1d8)](a16_0xf3168b[_0x4b456b(0x231)](_0x4b456b(0x241))));if(this['logger']){await this[_0x4b456b(0x1fd)][_0x4b456b(0x203)]();const _0x45b9a3=this[_0x4b456b(0x1fd)][_0x4b456b(0x1fb)]();console[_0x4b456b(0x1d8)](a16_0xf3168b[_0x4b456b(0x231)](_0x4b456b(0x209)+_0x45b9a3));}return this[_0x4b456b(0x226)]&&(await restoreClaudeSettings(this[_0x4b456b(0x226)]),console[_0x4b456b(0x1d8)](a16_0xf3168b['green'](_0x4b456b(0x1f4)))),_0x1c5c77;}catch(_0x1e0ba1){this[_0x4b456b(0x23f)]&&await this[_0x4b456b(0x23f)][_0x4b456b(0x1d5)]();this['logger']&&await this[_0x4b456b(0x1fd)][_0x4b456b(0x203)]();this['originalSettings']&&await restoreClaudeSettings(this['originalSettings']);throw _0x1e0ba1;}}async['findClaudePath'](){return new Promise(_0x3497df=>{const _0x463944=a16_0x2532,_0x672371=spawn('which',[_0x463944(0x1dc)]);let _0x149ecf='';_0x672371[_0x463944(0x1c9)]['on'](_0x463944(0x218),_0x337787=>{_0x149ecf+=_0x337787['toString']();}),_0x672371['on'](_0x463944(0x22a),_0xe738fe=>{const _0x9f7fd1=_0x463944;_0xe738fe===0x0&&_0x149ecf[_0x9f7fd1(0x1b8)]()?_0x3497df(_0x149ecf[_0x9f7fd1(0x1b8)]()):_0x3497df(null);});});}}
1
+ const a16_0x2e390a=a16_0x4f10;(function(_0xf34d0e,_0x38a9e1){const _0x322b47=a16_0x4f10,_0x3082b4=_0xf34d0e();while(!![]){try{const _0x213668=parseInt(_0x322b47(0x16b))/0x1+-parseInt(_0x322b47(0x115))/0x2+parseInt(_0x322b47(0x16d))/0x3+parseInt(_0x322b47(0x163))/0x4+parseInt(_0x322b47(0x11e))/0x5+-parseInt(_0x322b47(0x128))/0x6+parseInt(_0x322b47(0x13d))/0x7;if(_0x213668===_0x38a9e1)break;else _0x3082b4['push'](_0x3082b4['shift']());}catch(_0x4c0ea5){_0x3082b4['push'](_0x3082b4['shift']());}}}(a16_0x21f9,0xb0c80));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 a16_0x11f35b from'chalk';function a16_0x21f9(){const _0x29a2e7=['green','error','tdx','✓\x20Logs\x20saved\x20to\x20','Command\x20output:\x20','profile','933089PzYlzk','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','2241897ZNLFqp','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','\x27\x20installed','ANTHROPIC_BASE_URL','CLAUDE_CODE_NOT_FOUND','https://docs.treasuredata.com/mcp','\x27...','install','add','127.0.0.1','✓\x20Settings\x20configured:\x20.claude/settings.local.json','✓\x20Using\x20project:\x20','join','Failed\x20to\x20configure\x20marketplace\x20\x27','INSTALLATION_FAILED','tdx\x20claude\x20statusline','warn','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','description','close','already\x20installed','✓\x20MCP\x20server\x20\x27','tdx-managed-proxy','\x20meets\x20minimum\x20requirement','--transport','✓\x20Port\x20','which','model','tdx\x20--profile\x20','\x27\x20configured','text','already\x20exists','Finding\x20available\x20port...','user','inherit','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','https://github.com/treasure-data/td-skills','\x20or\x20later.','start','stdout','):\x20claude\x20','data','account_id','patch','Claude\x20Code\x20CLI\x20not\x20found','site','stringify','logger','localhost','port','cwd','.claude','originalSettings','settings.local.json','major','sql-skills','marketplace','update','2866210OythrE','already\x20configured','ANTHROPIC_AUTH_TOKEN','CLAUDE_CODE_UNSUPPORTED_VERSION','env','✓\x20Marketplace\x20\x27','match','toString','Invalid\x20minimum\x20version\x20format:\x20','1273945kRZZVP','Setting\x20up\x20project...','unshift','stop','http://127.0.0.1:','2.0.20','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','logLevel','Setup\x20failed','continue','8413056mQyylp','findClaudePath','Checking\x20Claude\x20Code\x20version...','tdx-skills','Claude\x20Code\x20version\x20','plugin','server','Executing:\x20claude\x20','Warning:\x20Failed\x20to\x20configure\x20','Installing\x20plugin\x20\x27','resume','exit','debug','\x20configuration\x20failed','--version','INTERNAL','http','mcp','name','td-skills\x20Plugins','attributes','8422974xUXTJK','llm','Failed\x20to\x20install\x20plugin\x20\x27','init','workflow-skills','parse','utf-8','fail','log','getLogPath','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','ANTHROPIC_MODEL','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','Initializing...','Initializing\x20proxy\x20logger...','ENOENT','object','trim','minor','Claude\x20Code\x20version\x20check\x20failed','proxy','Failed\x20to\x20spawn\x20claude\x20command:\x20','command','Configuring\x20MCP\x20server\x20\x27','claude','statusLine','td-skills','Failed\x20to\x20launch\x20Claude\x20Code:\x20','message','info','code','hostname','sonnet','string','✓\x20Logging\x20to\x20','\x27\x20updated','cause','1683672LvfrHQ','includes'];a16_0x21f9=function(){return _0x29a2e7;};return a16_0x21f9();}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=a16_0x2e390a(0x123);function handleInstallationError(_0x2b2bd5,_0x58c854,_0x1e94ab,_0x56e121){const _0x5cb7c2=a16_0x2e390a;errorContains(_0x2b2bd5,_0x5cb7c2(0xfa),_0x5cb7c2(0x181),_0x5cb7c2(0x116))?(_0x1e94ab[_0x5cb7c2(0xf9)]='✓\x20'+_0x58c854+'\x20already\x20configured',_0x56e121?.['info'](_0x58c854+'\x20already\x20configured'),_0x2b2bd5 instanceof SDKError&&_0x2b2bd5[_0x5cb7c2(0x162)]&&_0x56e121?.[_0x5cb7c2(0x134)](_0x5cb7c2(0x169)+_0x2b2bd5[_0x5cb7c2(0x162)][_0x5cb7c2(0x15a)])):(_0x1e94ab[_0x5cb7c2(0x17d)](_0x5cb7c2(0x130)+_0x58c854),_0x56e121?.[_0x5cb7c2(0x166)](_0x58c854+_0x5cb7c2(0x135),_0x2b2bd5));}export function parseVersion(_0x427a75){const _0x7ffb80=a16_0x2e390a,_0x1ea7da=_0x427a75[_0x7ffb80(0x14f)]()[_0x7ffb80(0x11b)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x1ea7da)return null;return{'major':parseInt(_0x1ea7da[0x1],0xa),'minor':parseInt(_0x1ea7da[0x2],0xa),'patch':parseInt(_0x1ea7da[0x3],0xa)};}export function compareVersions(_0x596b48,_0x49e1da){const _0xcc12a5=a16_0x2e390a;if(_0x596b48[_0xcc12a5(0x111)]!==_0x49e1da[_0xcc12a5(0x111)])return _0x596b48[_0xcc12a5(0x111)]-_0x49e1da[_0xcc12a5(0x111)];if(_0x596b48[_0xcc12a5(0x150)]!==_0x49e1da[_0xcc12a5(0x150)])return _0x596b48[_0xcc12a5(0x150)]-_0x49e1da[_0xcc12a5(0x150)];return _0x596b48[_0xcc12a5(0x106)]-_0x49e1da['patch'];}async function checkClaudeVersion(_0x26d10b,_0x28ae2e){const _0x2c0e97=a16_0x2e390a;_0x28ae2e?.[_0x2c0e97(0x134)](_0x2c0e97(0x16c)+_0x26d10b+')');const _0x577144=await executeClaudeCommand([_0x2c0e97(0x136)],undefined,_0x28ae2e),_0x451cda=parseVersion(_0x577144);if(!_0x451cda){_0x28ae2e?.[_0x2c0e97(0x17d)](_0x2c0e97(0x147)+_0x577144);return;}const _0x1598c2=_0x451cda[_0x2c0e97(0x111)]+'.'+_0x451cda[_0x2c0e97(0x150)]+'.'+_0x451cda[_0x2c0e97(0x106)],_0x1d400f=parseVersion(_0x26d10b);if(!_0x1d400f){_0x28ae2e?.[_0x2c0e97(0x17d)](_0x2c0e97(0x11d)+_0x26d10b);return;}if(compareVersions(_0x451cda,_0x1d400f)<0x0){_0x28ae2e?.[_0x2c0e97(0x166)](_0x2c0e97(0x12c)+_0x1598c2+'\x20is\x20too\x20old\x20(minimum:\x20'+_0x26d10b+')');throw new SDKError(ErrorCode[_0x2c0e97(0x118)],_0x2c0e97(0x12c)+_0x1598c2+_0x2c0e97(0x16e)+_0x26d10b+_0x2c0e97(0x100),undefined,{'helpText':_0x2c0e97(0x17e)});}_0x28ae2e?.['debug'](_0x2c0e97(0x12c)+_0x1598c2+_0x2c0e97(0xf2));}async function executeClaudeCommand(_0x3d28ea,_0xbb8f1,_0x5964be){const _0x75bde8=a16_0x2e390a;return _0x5964be?.[_0x75bde8(0x15b)](_0x75bde8(0x12f)+_0x3d28ea[_0x75bde8(0x179)]('\x20')),new Promise((_0x10147d,_0x1b03be)=>{const _0x145820=_0x75bde8,_0x5b5560=spawn(_0x145820(0x156),_0x3d28ea,{'stdio':'pipe'});let _0x1cbacf='',_0x22e97f='';_0x5b5560[_0x145820(0x102)]['on']('data',_0x1170d9=>{const _0x2d3f89=_0x145820;_0x1cbacf+=_0x1170d9[_0x2d3f89(0x11c)]();}),_0x5b5560['stderr']['on'](_0x145820(0x104),_0x1d8624=>{_0x22e97f+=_0x1d8624['toString']();}),_0x5b5560['on']('error',_0x15b974=>{const _0x38010c=_0x145820;_0x15b974[_0x38010c(0x15c)]===_0x38010c(0x14d)?(_0x5964be?.[_0x38010c(0x166)]('Claude\x20Code\x20CLI\x20not\x20found'),_0x1b03be(new SDKError(ErrorCode[_0x38010c(0x171)],'Claude\x20Code\x20CLI\x20not\x20found',_0x15b974,{'helpText':_0x38010c(0xfe)}))):(_0x5964be?.[_0x38010c(0x166)]('Command\x20spawn\x20error:\x20'+_0x15b974['message']),_0x1b03be(new SDKError(ErrorCode[_0x38010c(0x137)],_0x38010c(0x153)+_0x15b974[_0x38010c(0x15a)],_0x15b974)));}),_0x5b5560['on']('exit',_0x3a97be=>{const _0x3205d8=_0x145820;if(_0x3a97be===0x0)_0x10147d(_0x1cbacf);else _0xbb8f1?(_0x5964be?.[_0x3205d8(0x166)]('Command\x20failed\x20(exit\x20'+_0x3a97be+_0x3205d8(0x103)+_0x3d28ea[_0x3205d8(0x179)]('\x20')),_0x1b03be(new SDKError(ErrorCode[_0x3205d8(0x17b)],_0xbb8f1,new Error(_0x22e97f)))):_0x10147d('');});});}async function ensureMcpServer(_0x293eb7,_0x4a7e46,_0x51e6ef,_0x12bd42,_0x591147){const _0x5beb8a=a16_0x2e390a;_0x12bd42[_0x5beb8a(0xf9)]=_0x5beb8a(0x155)+_0x293eb7+_0x5beb8a(0x173),await executeClaudeCommand([_0x5beb8a(0x139),_0x5beb8a(0x175),_0x293eb7,_0x4a7e46,_0x5beb8a(0xf3),_0x51e6ef],_0x5beb8a(0x124)+_0x293eb7+'\x27',_0x591147),_0x12bd42[_0x5beb8a(0xf9)]=_0x5beb8a(0x182)+_0x293eb7+_0x5beb8a(0xf8);}async function ensureMarketplace(_0x7369f2,_0x11d47a,_0x481e6e,_0x4549b1){const _0x1d15b6=a16_0x2e390a;_0x481e6e[_0x1d15b6(0xf9)]='Configuring\x20marketplace\x20\x27'+_0x7369f2+'\x27...',await executeClaudeCommand(['plugin',_0x1d15b6(0x113),_0x1d15b6(0x175),_0x11d47a],_0x1d15b6(0x17a)+_0x7369f2+'\x27',_0x4549b1),_0x481e6e['text']=_0x1d15b6(0x11a)+_0x7369f2+_0x1d15b6(0xf8);}function a16_0x4f10(_0x27818a,_0x1295bb){_0x27818a=_0x27818a-0xf1;const _0x21f9ba=a16_0x21f9();let _0x4f10bf=_0x21f9ba[_0x27818a];return _0x4f10bf;}async function updateMarketplace(_0x44a248,_0x294b02,_0x309b85){const _0xa19ee=a16_0x2e390a;_0x294b02[_0xa19ee(0xf9)]='Updating\x20marketplace\x20\x27'+_0x44a248+'\x27...',await executeClaudeCommand([_0xa19ee(0x12d),_0xa19ee(0x113),_0xa19ee(0x114)],'Failed\x20to\x20update\x20marketplace\x20\x27'+_0x44a248+'\x27',_0x309b85),_0x294b02[_0xa19ee(0xf9)]=_0xa19ee(0x11a)+_0x44a248+_0xa19ee(0x161);}async function ensurePlugin(_0x5b3037,_0x1a930f,_0x20752e,_0x48c2e8){const _0x2259ce=a16_0x2e390a;_0x20752e['text']=_0x2259ce(0x131)+_0x5b3037+_0x2259ce(0x173),await executeClaudeCommand([_0x2259ce(0x12d),_0x2259ce(0x174),_0x5b3037+'@'+_0x1a930f],_0x2259ce(0x13f)+_0x5b3037+'\x27',_0x48c2e8),_0x20752e[_0x2259ce(0xf9)]='✓\x20Plugin\x20\x27'+_0x5b3037+_0x2259ce(0x16f);}async function createClaudeSettings(_0x1dc48c,_0x511161=a16_0x2e390a(0x15e),_0x478c14){const _0x362989=a16_0x2e390a,_0x1d2c31=join(process[_0x362989(0x10d)](),_0x362989(0x10e)),_0x894e3=join(_0x1d2c31,_0x362989(0x110));await mkdir(_0x1d2c31,{'recursive':!![]});let _0x59313c={};if(existsSync(_0x894e3))try{const _0x4edc9d=await readFile(_0x894e3,_0x362989(0x143));_0x59313c=JSON[_0x362989(0x142)](_0x4edc9d);}catch{_0x59313c={};}const _0x2d0f64=_0x59313c[_0x362989(0x119)]||{},_0x1970c0={'ANTHROPIC_BASE_URL':_0x2d0f64['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0x2d0f64[_0x362989(0x149)],'ANTHROPIC_AUTH_TOKEN':_0x2d0f64[_0x362989(0x117)],'statusLine':_0x59313c[_0x362989(0x157)]},_0x262e87={..._0x59313c,'env':{..._0x2d0f64,'ANTHROPIC_BASE_URL':_0x362989(0x122)+_0x1dc48c,'ANTHROPIC_MODEL':_0x511161,'ANTHROPIC_AUTH_TOKEN':_0x362989(0xf1)},'statusLine':{'type':_0x362989(0x154),'command':_0x478c14?_0x362989(0xf7)+_0x478c14+'\x20claude\x20statusline':_0x362989(0x17c)}};return await writeFile(_0x894e3,JSON['stringify'](_0x262e87,null,0x2)+'\x0a'),_0x1970c0;}async function restoreClaudeSettings(_0x446a0e){const _0x5837fd=a16_0x2e390a,_0x424f37=join(process[_0x5837fd(0x10d)](),_0x5837fd(0x10e)),_0x5564b5=join(_0x424f37,'settings.local.json');if(!existsSync(_0x5564b5))return;try{const _0x1aed00=await readFile(_0x5564b5,_0x5837fd(0x143)),_0x4b4bc6=JSON[_0x5837fd(0x142)](_0x1aed00),_0x384eff=_0x4b4bc6[_0x5837fd(0x119)]||{},_0x5047f3=_0x384eff['ANTHROPIC_BASE_URL'],_0x79e027=((()=>{const _0xce7dfb=_0x5837fd;if(typeof _0x5047f3!==_0xce7dfb(0x15f))return![];try{const _0xa4374=new URL(_0x5047f3);return _0xa4374[_0xce7dfb(0x15d)]===_0xce7dfb(0x10b)||_0xa4374[_0xce7dfb(0x15d)]===_0xce7dfb(0x176);}catch{return![];}})());_0x79e027?(delete _0x384eff[_0x5837fd(0x170)],delete _0x384eff['ANTHROPIC_MODEL'],delete _0x384eff[_0x5837fd(0x117)]):(_0x446a0e['ANTHROPIC_BASE_URL']!==undefined?_0x384eff[_0x5837fd(0x170)]=_0x446a0e[_0x5837fd(0x170)]:delete _0x384eff[_0x5837fd(0x170)],_0x446a0e[_0x5837fd(0x149)]!==undefined?_0x384eff['ANTHROPIC_MODEL']=_0x446a0e[_0x5837fd(0x149)]:delete _0x384eff[_0x5837fd(0x149)],_0x446a0e['ANTHROPIC_AUTH_TOKEN']!==undefined?_0x384eff[_0x5837fd(0x117)]=_0x446a0e['ANTHROPIC_AUTH_TOKEN']:delete _0x384eff['ANTHROPIC_AUTH_TOKEN']);const _0xda1620=_0x4b4bc6[_0x5837fd(0x157)],_0x33c424=((()=>{const _0x238953=_0x5837fd;if(!_0xda1620||typeof _0xda1620!==_0x238953(0x14e))return![];if(_0xda1620['type']!==_0x238953(0x154))return![];if(typeof _0xda1620['command']!==_0x238953(0x15f))return![];return _0xda1620[_0x238953(0x154)]['includes'](_0x238953(0x167))&&_0xda1620[_0x238953(0x154)][_0x238953(0x164)]('statusline');})());if(_0x33c424)delete _0x4b4bc6['statusLine'];else _0x446a0e['statusLine']!==undefined?_0x4b4bc6['statusLine']=_0x446a0e[_0x5837fd(0x157)]:delete _0x4b4bc6[_0x5837fd(0x157)];_0x4b4bc6[_0x5837fd(0x119)]=_0x384eff,await writeFile(_0x5564b5,JSON[_0x5837fd(0x109)](_0x4b4bc6,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a16_0x2e390a(0x13a)]=a16_0x2e390a(0x156);[a16_0x2e390a(0x17f)]='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';[a16_0x2e390a(0x12e)];[a16_0x2e390a(0x10f)];['logger'];[a16_0x2e390a(0x10c)];async['execute'](_0x47330c){const _0x2cc30f=a16_0x2e390a,{tdx:_0x51f355,options:_0x2728b4,args:_0x19f96d}=_0x47330c;try{const _0x5c1173=_0x2728b4,_0x592d41=_0x5c1173[_0x2cc30f(0xf6)]||_0x2cc30f(0x15e),_0x563769=_0x5c1173[_0x2cc30f(0x152)]===![],_0x19d76c=_0x5c1173[_0x2cc30f(0x127)]===!![],_0x40391a=_0x5c1173[_0x2cc30f(0x132)]===!![],_0x53bd64=[..._0x19f96d];if(_0x19d76c)_0x53bd64[_0x2cc30f(0x120)]('-c');else _0x40391a&&_0x53bd64[_0x2cc30f(0x120)]('-r');const _0x453b50=createCommandSpinner(_0x2cc30f(0x14b),{'verbose':_0x2728b4['verbose']});_0x453b50['start']();try{if(!_0x563769){_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0xfb),this['port']=await findAvailablePort(0xfa0),_0x453b50['text']=_0x2cc30f(0xf4)+this[_0x2cc30f(0x10c)],_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x11f);const _0x46d651=await _0x51f355[_0x2cc30f(0x13e)]['getOrCreateDefaultProject'](),_0x5e5277=_0x46d651['id'];_0x453b50['text']=_0x2cc30f(0x178)+_0x46d651[_0x2cc30f(0x13c)][_0x2cc30f(0x13a)];const _0xb64fa2=_0x2728b4[_0x2cc30f(0x16a)];try{const _0x5e6a81=await _0x51f355[_0x2cc30f(0xfc)]['getCurrent']();_0x5e6a81[_0x2cc30f(0x105)]&&writeCachedAccountInfo(_0x2728b4[_0x2cc30f(0x108)],_0x5e6a81[_0x2cc30f(0x105)],_0xb64fa2);}catch{}_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x14c),this[_0x2cc30f(0x10a)]=new TDXLogger(_0x2728b4[_0x2cc30f(0x125)],!![]),await this[_0x2cc30f(0x10a)][_0x2cc30f(0x140)]();const _0x180dcc=this[_0x2cc30f(0x10a)][_0x2cc30f(0x146)]();_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x160)+_0x180dcc,_0x453b50[_0x2cc30f(0xf9)]='Starting\x20TD\x20LLM\x20proxy\x20server...',this['server']=new ProxyServer({'port':this[_0x2cc30f(0x10c)],'projectId':_0x5e5277,'tdx':_0x51f355,'logger':this[_0x2cc30f(0x10a)],'site':_0x2728b4[_0x2cc30f(0x108)]}),await this['server'][_0x2cc30f(0x101)](),_0x453b50[_0x2cc30f(0xf9)]='✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20'+this[_0x2cc30f(0x10c)],_0x453b50[_0x2cc30f(0xf9)]='Creating\x20.claude/settings.local.json...',this['originalSettings']=await createClaudeSettings(this['port'],_0x592d41,_0xb64fa2),_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x177);}else _0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x14a);try{_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x12a),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x2cc30f(0x10a)]),_0x453b50['text']='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x1ef51c){_0x453b50[_0x2cc30f(0x144)](_0x2cc30f(0x151));throw _0x1ef51c;}try{await ensureMcpServer('td-docs',_0x2cc30f(0x172),_0x2cc30f(0x138),_0x453b50,this[_0x2cc30f(0x10a)]);}catch(_0x356b77){handleInstallationError(_0x356b77,'TD\x20Docs\x20MCP\x20Server',_0x453b50,this['logger']);}try{await ensureMarketplace('td-skills',_0x2cc30f(0xff),_0x453b50,this[_0x2cc30f(0x10a)]),await updateMarketplace(_0x2cc30f(0x158),_0x453b50,this['logger']),await ensurePlugin(_0x2cc30f(0x112),_0x2cc30f(0x158),_0x453b50,this[_0x2cc30f(0x10a)]),await ensurePlugin(_0x2cc30f(0x141),_0x2cc30f(0x158),_0x453b50,this[_0x2cc30f(0x10a)]),await ensurePlugin(_0x2cc30f(0x12b),_0x2cc30f(0x158),_0x453b50,this[_0x2cc30f(0x10a)]);}catch(_0x155d1c){handleInstallationError(_0x155d1c,_0x2cc30f(0x13b),_0x453b50,this[_0x2cc30f(0x10a)]);}_0x453b50[_0x2cc30f(0x121)]();}catch(_0x4989e){_0x453b50['fail'](_0x2cc30f(0x126));throw _0x4989e;}const _0x232d29=await this[_0x2cc30f(0x129)]();if(!_0x232d29)throw new SDKError(ErrorCode[_0x2cc30f(0x171)],_0x2cc30f(0x107),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x3be0ca={...process['env']};!_0x563769&&(_0x3be0ca[_0x2cc30f(0x170)]='http://127.0.0.1:'+this[_0x2cc30f(0x10c)],_0x3be0ca['ANTHROPIC_MODEL']=_0x592d41,_0x3be0ca[_0x2cc30f(0x117)]=_0x2cc30f(0xf1));const _0x3c3494=spawn(_0x232d29,_0x53bd64,{'stdio':_0x2cc30f(0xfd),'env':_0x3be0ca}),_0x4c7df6=await new Promise(_0x36e0b9=>{const _0x4aa130=_0x2cc30f;_0x3c3494['on'](_0x4aa130(0x133),_0x2148b5=>{_0x36e0b9(_0x2148b5||0x0);}),_0x3c3494['on']('error',_0x2dfd65=>{const _0x4e26e3=_0x4aa130;console[_0x4e26e3(0x166)](a16_0x11f35b['red'](_0x4e26e3(0x159)+_0x2dfd65['message'])),_0x36e0b9(0x1);});});this[_0x2cc30f(0x12e)]&&(await this[_0x2cc30f(0x12e)][_0x2cc30f(0x121)](),console[_0x2cc30f(0x145)](a16_0x11f35b[_0x2cc30f(0x165)](_0x2cc30f(0x148))));if(this[_0x2cc30f(0x10a)]){await this[_0x2cc30f(0x10a)][_0x2cc30f(0x180)]();const _0x58d073=this['logger'][_0x2cc30f(0x146)]();console[_0x2cc30f(0x145)](a16_0x11f35b[_0x2cc30f(0x165)](_0x2cc30f(0x168)+_0x58d073));}return this[_0x2cc30f(0x10f)]&&(await restoreClaudeSettings(this[_0x2cc30f(0x10f)]),console['log'](a16_0x11f35b[_0x2cc30f(0x165)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x4c7df6;}catch(_0xf90095){this['server']&&await this[_0x2cc30f(0x12e)][_0x2cc30f(0x121)]();this[_0x2cc30f(0x10a)]&&await this[_0x2cc30f(0x10a)][_0x2cc30f(0x180)]();this[_0x2cc30f(0x10f)]&&await restoreClaudeSettings(this[_0x2cc30f(0x10f)]);throw _0xf90095;}}async[a16_0x2e390a(0x129)](){return new Promise(_0x382e27=>{const _0x261314=a16_0x4f10,_0x59738f=spawn(_0x261314(0xf5),[_0x261314(0x156)]);let _0x45de36='';_0x59738f[_0x261314(0x102)]['on'](_0x261314(0x104),_0x24e912=>{const _0x162ece=_0x261314;_0x45de36+=_0x24e912[_0x162ece(0x11c)]();}),_0x59738f['on'](_0x261314(0x133),_0x257a72=>{const _0x1e63d4=_0x261314;_0x257a72===0x0&&_0x45de36[_0x1e63d4(0x14f)]()?_0x382e27(_0x45de36[_0x1e63d4(0x14f)]()):_0x382e27(null);});});}}
@@ -1 +1 @@
1
- const a17_0x4a8077=a17_0x350e;(function(_0x4fdde9,_0x5e967c){const _0x5e6441=a17_0x350e,_0x4d5394=_0x4fdde9();while(!![]){try{const _0x5d9dd9=parseInt(_0x5e6441(0x185))/0x1*(parseInt(_0x5e6441(0x184))/0x2)+parseInt(_0x5e6441(0x179))/0x3*(parseInt(_0x5e6441(0x182))/0x4)+-parseInt(_0x5e6441(0x198))/0x5+-parseInt(_0x5e6441(0x199))/0x6*(parseInt(_0x5e6441(0x194))/0x7)+-parseInt(_0x5e6441(0x17c))/0x8+-parseInt(_0x5e6441(0x18c))/0x9+parseInt(_0x5e6441(0x18b))/0xa;if(_0x5d9dd9===_0x5e967c)break;else _0x4d5394['push'](_0x4d5394['shift']());}catch(_0x3a34a6){_0x4d5394['push'](_0x4d5394['shift']());}}}(a17_0x1680,0x9df96));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'../utils/model-factors.js';function a17_0x350e(_0x28f4bf,_0x388759){_0x28f4bf=_0x28f4bf-0x172;const _0x16803e=a17_0x1680();let _0x350e3d=_0x16803e[_0x28f4bf];return _0x350e3d;}async function readStdinJson(_0x5dcfc3=0x64){return new Promise(_0x1430fb=>{const _0x5159ab=a17_0x350e;let _0x10459d='',_0xafdf2=![];const _0x3c6864=createInterface({'input':process[_0x5159ab(0x174)],'terminal':![]}),_0x3353ab=_0x2c5219=>{if(_0xafdf2)return;_0xafdf2=!![],clearTimeout(_0x504166),_0x3c6864['close'](),_0x1430fb(_0x2c5219);},_0x504166=setTimeout(()=>{_0x3353ab(null);},_0x5dcfc3);_0x3c6864['on'](_0x5159ab(0x17e),_0x50f1ae=>{_0x10459d+=_0x50f1ae;}),_0x3c6864['on']('close',()=>{const _0x47c286=_0x5159ab;if(_0xafdf2)return;try{const _0x5bf035=JSON[_0x47c286(0x180)](_0x10459d);_0x3353ab(_0x5bf035);}catch{_0x3353ab(null);}});});}function formatCredits(_0x2b2834){const _0x22c260=a17_0x350e;return _0x2b2834[_0x22c260(0x186)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a17_0x4a8077(0x193)]=a17_0x4a8077(0x175);[a17_0x4a8077(0x172)]=a17_0x4a8077(0x183);async[a17_0x4a8077(0x188)](_0x1d4d82){const _0x8d2297=a17_0x4a8077;try{const _0x54669f=await readStdinJson();if(!_0x54669f?.[_0x8d2297(0x189)])return console['log']('💎\x20tdx\x20-\x20Claude'),0x0;const _0xda8c18=_0x54669f[_0x8d2297(0x189)],_0x2ab9e1=_0x54669f[_0x8d2297(0x190)]?.['id']||'',_0x2c1083=_0x54669f[_0x8d2297(0x176)]||_0x1d4d82[_0x8d2297(0x173)][_0x8d2297(0x176)],_0x5a5fb7=await getUsageStats(_0xda8c18,_0x2c1083),_0x25ce84=[],_0x2a5504=readCachedAccountInfo(_0x2c1083),_0x4effe2=_0x2a5504?_0x8d2297(0x187)+_0x2a5504['site']+':'+_0x2a5504[_0x8d2297(0x192)]:_0x8d2297(0x17f),_0x1de800=_0x2ab9e1?getModelDisplayName(_0x2ab9e1):'Claude';_0x25ce84[_0x8d2297(0x18e)](_0x8d2297(0x18a)+_0x4effe2+_0x8d2297(0x181)+_0x1de800);const _0x2c6d00=formatCredits(_0x5a5fb7[_0x8d2297(0x17b)]),_0x5b7cfa=formatCredits(_0x5a5fb7['todayCredits']),_0x3fcc45=formatCredits(_0x5a5fb7[_0x8d2297(0x191)]);_0x25ce84[_0x8d2297(0x18e)](_0x8d2297(0x197)+_0x2c6d00+_0x8d2297(0x17d)+_0x5b7cfa+_0x8d2297(0x196)+_0x3fcc45+_0x8d2297(0x17a));if(_0x5a5fb7[_0x8d2297(0x195)]>0x0&&_0x2ab9e1){const _0x4e058e=formatTokenCount(_0x5a5fb7[_0x8d2297(0x195)]),_0x43f97b=calculateContextPercentage(_0x5a5fb7[_0x8d2297(0x195)],_0x2ab9e1);_0x25ce84[_0x8d2297(0x18e)]('🧠\x20'+_0x4e058e+'\x20('+_0x43f97b+'%)');}return console[_0x8d2297(0x18d)](_0x25ce84[_0x8d2297(0x177)](_0x8d2297(0x178))),0x0;}catch{return console[_0x8d2297(0x18d)](_0x8d2297(0x18f)),0x0;}}}function a17_0x1680(){const _0x55b70d=['\x20today\x20/\x20','🪙\x20credit:\x20','963515ymQRKx','6oiBydx','description','options','stdin','statusline','profile','join','\x20|\x20','69846RpoMsp','\x20month','sessionCredits','7479272qThbTq','\x20session\x20/\x20','line','tdx','parse','\x20-\x20','188QjInhn','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','346dawIgU','2617Zjjscd','toFixed','tdx\x20','execute','session_id','💎\x20','8025280YruGuR','2785041nFfong','log','push','💎\x20tdx\x20-\x20Claude','model','monthCredits','accountId','name','1857800RPmQgY','latestInputTokens'];a17_0x1680=function(){return _0x55b70d;};return a17_0x1680();}
1
+ const a17_0x448700=a17_0x19bd;(function(_0x3574c6,_0x53c426){const _0x2ff917=a17_0x19bd,_0x3296b5=_0x3574c6();while(!![]){try{const _0x1e1054=-parseInt(_0x2ff917(0xa4))/0x1*(-parseInt(_0x2ff917(0x86))/0x2)+-parseInt(_0x2ff917(0x8e))/0x3*(parseInt(_0x2ff917(0xa7))/0x4)+parseInt(_0x2ff917(0x98))/0x5+-parseInt(_0x2ff917(0x9f))/0x6*(-parseInt(_0x2ff917(0x9b))/0x7)+-parseInt(_0x2ff917(0xa8))/0x8+-parseInt(_0x2ff917(0x94))/0x9*(parseInt(_0x2ff917(0x87))/0xa)+parseInt(_0x2ff917(0x90))/0xb*(parseInt(_0x2ff917(0x93))/0xc);if(_0x1e1054===_0x53c426)break;else _0x3296b5['push'](_0x3296b5['shift']());}catch(_0x44e653){_0x3296b5['push'](_0x3296b5['shift']());}}}(a17_0x4403,0xa3219));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'../utils/model-factors.js';function a17_0x4403(){const _0x318067=['Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','statusline','session_id','1fkjjDV','\x20session\x20/\x20','stdin','4IWCLYe','9279792UUmyaX','toFixed','line','options','💎\x20','log','accountId','1613574EgguME','4050DPsWCo','latestInputTokens','\x20month','todayCredits','join','sessionCredits','\x20-\x20','1886865PbTeFC','profile','22jgAxCR','tdx','execute','3291540wUpvWJ','3096maIZZQ','site','🪙\x20credit:\x20','parse','3602130XnHjUu','description','push','7FvJILp','💎\x20tdx\x20-\x20Claude','model','close','3123786SoyemB','\x20|\x20'];a17_0x4403=function(){return _0x318067;};return a17_0x4403();}async function readStdinJson(_0x10f3c8=0x64){return new Promise(_0x311431=>{const _0x28a95e=a17_0x19bd;let _0x29e5ed='',_0x2c8f8b=![];const _0x164a46=createInterface({'input':process[_0x28a95e(0xa6)],'terminal':![]}),_0x1498aa=_0x560c50=>{const _0x528955=_0x28a95e;if(_0x2c8f8b)return;_0x2c8f8b=!![],clearTimeout(_0x345275),_0x164a46[_0x528955(0x9e)](),_0x311431(_0x560c50);},_0x345275=setTimeout(()=>{_0x1498aa(null);},_0x10f3c8);_0x164a46['on'](_0x28a95e(0xaa),_0x2b6805=>{_0x29e5ed+=_0x2b6805;}),_0x164a46['on'](_0x28a95e(0x9e),()=>{const _0x3e098f=_0x28a95e;if(_0x2c8f8b)return;try{const _0x6d0bd6=JSON[_0x3e098f(0x97)](_0x29e5ed);_0x1498aa(_0x6d0bd6);}catch{_0x1498aa(null);}});});}function a17_0x19bd(_0x3ff240,_0x3844b7){_0x3ff240=_0x3ff240-0x86;const _0x4403e0=a17_0x4403();let _0x19bdae=_0x4403e0[_0x3ff240];return _0x19bdae;}function formatCredits(_0xf35d69){const _0x503e16=a17_0x19bd;return _0xf35d69[_0x503e16(0xa9)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{['name']=a17_0x448700(0xa2);[a17_0x448700(0x99)]=a17_0x448700(0xa1);async[a17_0x448700(0x92)](_0x31cf49){const _0x226edc=a17_0x448700;try{const _0xf93b79=await readStdinJson();if(!_0xf93b79?.[_0x226edc(0xa3)])return console[_0x226edc(0xad)](_0x226edc(0x9c)),0x0;const _0x59b599=_0xf93b79[_0x226edc(0xa3)],_0x488641=_0xf93b79[_0x226edc(0x9d)]?.['id']||'',_0x5a9b27=_0xf93b79[_0x226edc(0x8f)]||_0x31cf49[_0x226edc(0xab)][_0x226edc(0x8f)],_0x5d2862=await getUsageStats(_0x59b599,_0x5a9b27),_0x4fd99c=[],_0x149fe1=readCachedAccountInfo(_0x5a9b27),_0x5b0305=_0x149fe1?'tdx\x20'+_0x149fe1[_0x226edc(0x95)]+':'+_0x149fe1[_0x226edc(0xae)]:_0x226edc(0x91),_0x426d4f=_0x488641?getModelDisplayName(_0x488641):'Claude';_0x4fd99c[_0x226edc(0x9a)](_0x226edc(0xac)+_0x5b0305+_0x226edc(0x8d)+_0x426d4f);const _0x42612d=formatCredits(_0x5d2862[_0x226edc(0x8c)]),_0x3a5768=formatCredits(_0x5d2862[_0x226edc(0x8a)]),_0x3b44c6=formatCredits(_0x5d2862['monthCredits']);_0x4fd99c[_0x226edc(0x9a)](_0x226edc(0x96)+_0x42612d+_0x226edc(0xa5)+_0x3a5768+'\x20today\x20/\x20'+_0x3b44c6+_0x226edc(0x89));if(_0x5d2862['latestInputTokens']>0x0&&_0x488641){const _0xc1de74=formatTokenCount(_0x5d2862[_0x226edc(0x88)]),_0x43f642=calculateContextPercentage(_0x5d2862[_0x226edc(0x88)],_0x488641);_0x4fd99c[_0x226edc(0x9a)]('🧠\x20'+_0xc1de74+'\x20('+_0x43f642+'%)');}return console['log'](_0x4fd99c[_0x226edc(0x8b)](_0x226edc(0xa0))),0x0;}catch{return console[_0x226edc(0xad)]('💎\x20tdx\x20-\x20Claude'),0x0;}}}
@@ -1 +1 @@
1
- const a18_0x28aa77=a18_0x3df0;(function(_0x25bc7c,_0xaddfba){const _0x351510=a18_0x3df0,_0x1a7d21=_0x25bc7c();while(!![]){try{const _0x5e77e8=-parseInt(_0x351510(0x1a5))/0x1+-parseInt(_0x351510(0x188))/0x2*(-parseInt(_0x351510(0x197))/0x3)+-parseInt(_0x351510(0x18e))/0x4*(parseInt(_0x351510(0x1ae))/0x5)+-parseInt(_0x351510(0x199))/0x6+-parseInt(_0x351510(0x1af))/0x7+-parseInt(_0x351510(0x194))/0x8*(-parseInt(_0x351510(0x19f))/0x9)+parseInt(_0x351510(0x195))/0xa;if(_0x5e77e8===_0xaddfba)break;else _0x1a7d21['push'](_0x1a7d21['shift']());}catch(_0x37eee8){_0x1a7d21['push'](_0x1a7d21['shift']());}}}(a18_0x5614,0xef9d8));import a18_0x38457e from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function a18_0x5614(){const _0x5908cd=['en-CA','padEnd','(default)','outputTable','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','11138TfrhRg','red','jsonl','never','toLocaleDateString','bold','1065932qmsVmg','today\x20','\x20\x20Total:\x20\x20\x20','execute','map','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','43184ucAOLm','9267780KLiavp','\x20days\x20ago','849MgmdwI','totalCredits','800922gyBvzV','Unknown\x20error','credits','cyan','en-US','log','2961thkKgt','name','dim','json','toLocaleTimeString','usage','1257355QgFazI','default','padStart','lastUsedAt','Credits','round','length','profile','all','30yryACC','2152801HLIfRz','getTime','\x20\x20Today:\x20\x20\x20','short','message','2-digit','Last\x20Used','max','todayCredits','outputStructured','\x20credits','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','error','Usage\x20by\x20Profile','format','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','repeat','entryCount','monthCredits','profileCount'];a18_0x5614=function(){return _0x5908cd;};return a18_0x5614();}function formatCredits(_0x107c4e){return _0x107c4e['toFixed'](0x2);}function formatLastUsed(_0x576c81){const _0x31092e=a18_0x3df0;if(!_0x576c81)return _0x31092e(0x18b);const _0x1a0247=new Date(_0x576c81),_0x35113b=new Date(),_0x22627f=_0x1a0247[_0x31092e(0x18c)]('en-CA'),_0x35af44=_0x35113b['toLocaleDateString'](_0x31092e(0x183));if(_0x22627f===_0x35af44)return _0x31092e(0x18f)+_0x1a0247[_0x31092e(0x1a3)](_0x31092e(0x19d),{'hour':_0x31092e(0x1b4),'minute':'2-digit'});const _0x1b880a=new Date(_0x22627f),_0x2ad32f=new Date(_0x35af44),_0xd6c6ee=Math[_0x31092e(0x1aa)]((_0x2ad32f[_0x31092e(0x1b0)]()-_0x1b880a[_0x31092e(0x1b0)]())/(0x18*0x3c*0x3c*0x3e8));if(_0xd6c6ee===0x1)return'yesterday';else return _0xd6c6ee>0x1&&_0xd6c6ee<0x7?_0xd6c6ee+_0x31092e(0x196):_0x1a0247['toLocaleDateString'](_0x31092e(0x19d),{'month':_0x31092e(0x1b2),'day':'numeric'});}function a18_0x3df0(_0x422267,_0x41cdd2){_0x422267=_0x422267-0x177;const _0x5614d1=a18_0x5614();let _0x3df08e=_0x5614d1[_0x422267];return _0x3df08e;}export class ClaudeUsageCommand extends BaseCommand{[a18_0x28aa77(0x1a0)]=a18_0x28aa77(0x1a4);['description']='Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile';async[a18_0x28aa77(0x191)](_0x2935f7){const _0x390276=a18_0x28aa77,{options:_0x32a5d8}=_0x2935f7,_0x5e456b=_0x32a5d8[_0x390276(0x17d)]===_0x390276(0x1a2)||_0x32a5d8[_0x390276(0x17d)]===_0x390276(0x18a)||_0x32a5d8[_0x390276(0x1a2)];try{const [_0x25bc36,_0x22c11f]=await Promise[_0x390276(0x1ad)]([getAllProfileStats(),getUsageSummary()]);return _0x5e456b?await this['outputStructured'](_0x25bc36,_0x22c11f,_0x32a5d8):this[_0x390276(0x186)](_0x25bc36,_0x22c11f),0x0;}catch(_0x3d38fc){const _0x476a9e=_0x3d38fc instanceof Error?_0x3d38fc[_0x390276(0x1b3)]:_0x390276(0x19a);return console[_0x390276(0x17b)](a18_0x38457e[_0x390276(0x189)]('Error:\x20'+_0x476a9e)),0x1;}}async[a18_0x28aa77(0x178)](_0x503b78,_0x367f56,_0x1fa131){const _0x17cc44=a18_0x28aa77,_0x1b704d={'summary':{'todayCredits':_0x367f56[_0x17cc44(0x177)],'monthCredits':_0x367f56[_0x17cc44(0x181)],'totalCredits':_0x367f56['totalCredits'],'profileCount':_0x367f56[_0x17cc44(0x182)]},'profiles':_0x503b78[_0x17cc44(0x192)](_0x36fc84=>({'profile':_0x36fc84[_0x17cc44(0x1ac)],'credits':_0x36fc84['credits'],'requests':_0x36fc84[_0x17cc44(0x180)],'lastUsedAt':_0x36fc84[_0x17cc44(0x1a8)]}))};await handleSDKOutput([_0x1b704d],_0x1fa131);}[a18_0x28aa77(0x186)](_0x3f4909,_0x24f524){const _0x276e13=a18_0x28aa77;console[_0x276e13(0x19e)](a18_0x38457e[_0x276e13(0x18d)](_0x276e13(0x187))),console[_0x276e13(0x19e)](a18_0x38457e[_0x276e13(0x1a1)]('─'[_0x276e13(0x17f)](0x32))),console[_0x276e13(0x19e)](_0x276e13(0x1b1)+a18_0x38457e['cyan'](formatCredits(_0x24f524[_0x276e13(0x177)]))+_0x276e13(0x179)),console[_0x276e13(0x19e)]('\x20\x20Month:\x20\x20\x20'+a18_0x38457e[_0x276e13(0x19c)](formatCredits(_0x24f524[_0x276e13(0x181)]))+'\x20credits'),console[_0x276e13(0x19e)](_0x276e13(0x190)+a18_0x38457e[_0x276e13(0x19c)](formatCredits(_0x24f524[_0x276e13(0x198)]))+_0x276e13(0x179)),console[_0x276e13(0x19e)]();if(_0x3f4909[_0x276e13(0x1ab)]===0x0){console[_0x276e13(0x19e)](a18_0x38457e[_0x276e13(0x1a1)](_0x276e13(0x17e))),console[_0x276e13(0x19e)](a18_0x38457e[_0x276e13(0x1a1)](_0x276e13(0x17a)));return;}console[_0x276e13(0x19e)](a18_0x38457e[_0x276e13(0x18d)](_0x276e13(0x17c))),console['log'](a18_0x38457e['dim']('─'[_0x276e13(0x17f)](0x3c)));const _0x225f77=Math[_0x276e13(0x1b6)](0xc,..._0x3f4909['map'](_0x89efdc=>_0x89efdc[_0x276e13(0x1ac)]==='default'?_0x276e13(0x185)[_0x276e13(0x1ab)]:_0x89efdc[_0x276e13(0x1ac)][_0x276e13(0x1ab)])),_0x103396=0xa,_0x4db185=0xa;console['log']('\x20\x20'+'Profile'[_0x276e13(0x184)](_0x225f77)+'\x20\x20'+_0x276e13(0x1a9)['padStart'](_0x103396)+'\x20\x20'+'Requests'[_0x276e13(0x1a7)](_0x4db185)+'\x20\x20'+_0x276e13(0x1b5));for(const _0x359b2d of _0x3f4909){const _0x432e54=_0x359b2d[_0x276e13(0x1ac)]===_0x276e13(0x1a6)?_0x276e13(0x185):_0x359b2d['profile'],_0x481187=_0x432e54[_0x276e13(0x184)](_0x225f77),_0x5f1bf4=_0x359b2d[_0x276e13(0x1ac)]===_0x276e13(0x1a6)?a18_0x38457e[_0x276e13(0x1a1)](_0x481187):_0x481187;console['log']('\x20\x20'+_0x5f1bf4+'\x20\x20'+a18_0x38457e[_0x276e13(0x19c)](formatCredits(_0x359b2d[_0x276e13(0x19b)])[_0x276e13(0x1a7)](_0x103396))+'\x20\x20'+String(_0x359b2d['entryCount'])[_0x276e13(0x1a7)](_0x4db185)+'\x20\x20'+a18_0x38457e[_0x276e13(0x1a1)](formatLastUsed(_0x359b2d['lastUsedAt'])));}console['log'](),console[_0x276e13(0x19e)](a18_0x38457e['dim'](_0x276e13(0x193))),console['log']();}}
1
+ function a18_0x12ef(){const _0x5b4c5d=['toLocaleTimeString','Last\x20Used','yesterday','error','round','format','190306uIZSmJ','toLocaleDateString','1682472plncAa','outputStructured','2ICLJxg','en-US','today\x20','Usage\x20by\x20Profile','execute','profile','lastUsedAt','bold','Credits','padStart','totalCredits','outputTable','short','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','89564KHRIzz','88ifqqMG','getTime','numeric','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','red','2-digit','10087965gUcbhW','repeat','5736BItafZ','Requests','69736APdqZo','dim','Error:\x20','profileCount','(default)','log','default','Unknown\x20error','description','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','message','cyan','\x20\x20Month:\x20\x20\x20','map','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','3222060WjnYoh','monthCredits','Profile','credits','padEnd','length','5185DMQDDF','never','all','toFixed','\x20credits','en-CA','161dpgdJN','name','141SkDDpe','\x20\x20Total:\x20\x20\x20','todayCredits'];a18_0x12ef=function(){return _0x5b4c5d;};return a18_0x12ef();}const a18_0x2c7ca5=a18_0x3b12;(function(_0x190e5a,_0x72dc5f){const _0x18baf7=a18_0x3b12,_0x156a1c=_0x190e5a();while(!![]){try{const _0x2f527a=-parseInt(_0x18baf7(0x1d4))/0x1*(-parseInt(_0x18baf7(0x1d0))/0x2)+-parseInt(_0x18baf7(0x1c7))/0x3*(parseInt(_0x18baf7(0x1e2))/0x4)+parseInt(_0x18baf7(0x1bf))/0x5*(parseInt(_0x18baf7(0x1eb))/0x6)+parseInt(_0x18baf7(0x1c5))/0x7*(parseInt(_0x18baf7(0x1ed))/0x8)+-parseInt(_0x18baf7(0x1e9))/0x9+parseInt(_0x18baf7(0x1b9))/0xa+parseInt(_0x18baf7(0x1e3))/0xb*(parseInt(_0x18baf7(0x1d2))/0xc);if(_0x2f527a===_0x72dc5f)break;else _0x156a1c['push'](_0x156a1c['shift']());}catch(_0x5e0025){_0x156a1c['push'](_0x156a1c['shift']());}}}(a18_0x12ef,0x9f5d9));import a18_0xf7275e from'chalk';function a18_0x3b12(_0x5dda9d,_0x2560d5){_0x5dda9d=_0x5dda9d-0x1ac;const _0x12ef41=a18_0x12ef();let _0x3b127e=_0x12ef41[_0x5dda9d];return _0x3b127e;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x1be720){const _0x133a4d=a18_0x3b12;return _0x1be720[_0x133a4d(0x1c2)](0x2);}function formatLastUsed(_0x2fc356){const _0x3daaff=a18_0x3b12;if(!_0x2fc356)return _0x3daaff(0x1c0);const _0x346905=new Date(_0x2fc356),_0x53668f=new Date(),_0x5b06cd=_0x346905[_0x3daaff(0x1d1)]('en-CA'),_0x3580bb=_0x53668f['toLocaleDateString'](_0x3daaff(0x1c4));if(_0x5b06cd===_0x3580bb)return _0x3daaff(0x1d6)+_0x346905[_0x3daaff(0x1ca)](_0x3daaff(0x1d5),{'hour':_0x3daaff(0x1e8),'minute':_0x3daaff(0x1e8)});const _0x3ef9df=new Date(_0x5b06cd),_0x1db51d=new Date(_0x3580bb),_0x12dc56=Math[_0x3daaff(0x1ce)]((_0x1db51d['getTime']()-_0x3ef9df[_0x3daaff(0x1e4)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x12dc56===0x1)return _0x3daaff(0x1cc);else return _0x12dc56>0x1&&_0x12dc56<0x7?_0x12dc56+'\x20days\x20ago':_0x346905[_0x3daaff(0x1d1)](_0x3daaff(0x1d5),{'month':_0x3daaff(0x1e0),'day':_0x3daaff(0x1e5)});}export class ClaudeUsageCommand extends BaseCommand{[a18_0x2c7ca5(0x1c6)]='usage';[a18_0x2c7ca5(0x1b2)]=a18_0x2c7ca5(0x1b3);async[a18_0x2c7ca5(0x1d8)](_0x33a438){const _0x4515b0=a18_0x2c7ca5,{options:_0x289cf4}=_0x33a438,_0x32e63d=_0x289cf4[_0x4515b0(0x1cf)]==='json'||_0x289cf4[_0x4515b0(0x1cf)]==='jsonl'||_0x289cf4['json'];try{const [_0x499a78,_0x359bb2]=await Promise[_0x4515b0(0x1c1)]([getAllProfileStats(),getUsageSummary()]);return _0x32e63d?await this[_0x4515b0(0x1d3)](_0x499a78,_0x359bb2,_0x289cf4):this[_0x4515b0(0x1df)](_0x499a78,_0x359bb2),0x0;}catch(_0x1beaa9){const _0x2bc81b=_0x1beaa9 instanceof Error?_0x1beaa9[_0x4515b0(0x1b4)]:_0x4515b0(0x1b1);return console[_0x4515b0(0x1cd)](a18_0xf7275e[_0x4515b0(0x1e7)](_0x4515b0(0x1ac)+_0x2bc81b)),0x1;}}async['outputStructured'](_0x5d5430,_0x1675e6,_0x38e6fc){const _0x132919=a18_0x2c7ca5,_0x52d994={'summary':{'todayCredits':_0x1675e6[_0x132919(0x1c9)],'monthCredits':_0x1675e6[_0x132919(0x1ba)],'totalCredits':_0x1675e6[_0x132919(0x1de)],'profileCount':_0x1675e6[_0x132919(0x1ad)]},'profiles':_0x5d5430[_0x132919(0x1b7)](_0x3e8352=>({'profile':_0x3e8352[_0x132919(0x1d9)],'credits':_0x3e8352['credits'],'requests':_0x3e8352['entryCount'],'lastUsedAt':_0x3e8352[_0x132919(0x1da)]}))};await handleSDKOutput([_0x52d994],_0x38e6fc);}[a18_0x2c7ca5(0x1df)](_0x4ff55f,_0x3e6880){const _0x10c67c=a18_0x2c7ca5;console[_0x10c67c(0x1af)](a18_0xf7275e[_0x10c67c(0x1db)](_0x10c67c(0x1e1))),console[_0x10c67c(0x1af)](a18_0xf7275e[_0x10c67c(0x1ee)]('─'['repeat'](0x32))),console[_0x10c67c(0x1af)]('\x20\x20Today:\x20\x20\x20'+a18_0xf7275e[_0x10c67c(0x1b5)](formatCredits(_0x3e6880['todayCredits']))+_0x10c67c(0x1c3)),console[_0x10c67c(0x1af)](_0x10c67c(0x1b6)+a18_0xf7275e['cyan'](formatCredits(_0x3e6880[_0x10c67c(0x1ba)]))+_0x10c67c(0x1c3)),console['log'](_0x10c67c(0x1c8)+a18_0xf7275e[_0x10c67c(0x1b5)](formatCredits(_0x3e6880[_0x10c67c(0x1de)]))+'\x20credits'),console[_0x10c67c(0x1af)]();if(_0x4ff55f[_0x10c67c(0x1be)]===0x0){console[_0x10c67c(0x1af)](a18_0xf7275e[_0x10c67c(0x1ee)](_0x10c67c(0x1e6))),console[_0x10c67c(0x1af)](a18_0xf7275e['dim']('\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a'));return;}console['log'](a18_0xf7275e['bold'](_0x10c67c(0x1d7))),console[_0x10c67c(0x1af)](a18_0xf7275e['dim']('─'[_0x10c67c(0x1ea)](0x3c)));const _0x524127=Math['max'](0xc,..._0x4ff55f[_0x10c67c(0x1b7)](_0x20b87b=>_0x20b87b[_0x10c67c(0x1d9)]===_0x10c67c(0x1b0)?_0x10c67c(0x1ae)[_0x10c67c(0x1be)]:_0x20b87b[_0x10c67c(0x1d9)]['length'])),_0x109dcf=0xa,_0x338c13=0xa;console['log']('\x20\x20'+_0x10c67c(0x1bb)[_0x10c67c(0x1bd)](_0x524127)+'\x20\x20'+_0x10c67c(0x1dc)[_0x10c67c(0x1dd)](_0x109dcf)+'\x20\x20'+_0x10c67c(0x1ec)[_0x10c67c(0x1dd)](_0x338c13)+'\x20\x20'+_0x10c67c(0x1cb));for(const _0x1f8000 of _0x4ff55f){const _0x266334=_0x1f8000[_0x10c67c(0x1d9)]===_0x10c67c(0x1b0)?_0x10c67c(0x1ae):_0x1f8000[_0x10c67c(0x1d9)],_0x4b8194=_0x266334[_0x10c67c(0x1bd)](_0x524127),_0x4d26d3=_0x1f8000[_0x10c67c(0x1d9)]===_0x10c67c(0x1b0)?a18_0xf7275e[_0x10c67c(0x1ee)](_0x4b8194):_0x4b8194;console[_0x10c67c(0x1af)]('\x20\x20'+_0x4d26d3+'\x20\x20'+a18_0xf7275e['cyan'](formatCredits(_0x1f8000[_0x10c67c(0x1bc)])[_0x10c67c(0x1dd)](_0x109dcf))+'\x20\x20'+String(_0x1f8000['entryCount'])['padStart'](_0x338c13)+'\x20\x20'+a18_0xf7275e[_0x10c67c(0x1ee)](formatLastUsed(_0x1f8000['lastUsedAt'])));}console[_0x10c67c(0x1af)](),console['log'](a18_0xf7275e[_0x10c67c(0x1ee)](_0x10c67c(0x1b8))),console['log']();}}