@treasuredata/tdx 0.14.1 → 0.14.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 (143) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/api-command.js +1 -1
  8. package/dist/commands/auth-command.js +1 -1
  9. package/dist/commands/chat-command.js +1 -1
  10. package/dist/commands/claude-command.js +1 -1
  11. package/dist/commands/claude-statusline-command.js +1 -1
  12. package/dist/commands/claude-usage-command.js +1 -1
  13. package/dist/commands/command.js +1 -1
  14. package/dist/commands/connection-command.js +1 -1
  15. package/dist/commands/databases.js +1 -1
  16. package/dist/commands/describe.js +1 -1
  17. package/dist/commands/engage-command.js +1 -1
  18. package/dist/commands/job-command.js +1 -1
  19. package/dist/commands/journey-command.js +1 -1
  20. package/dist/commands/journey-validate-command.js +1 -1
  21. package/dist/commands/llm-command.js +1 -1
  22. package/dist/commands/llm-proxy.js +1 -1
  23. package/dist/commands/parent-segment-command.js +1 -1
  24. package/dist/commands/profile-command.js +1 -1
  25. package/dist/commands/profiles-command.js +1 -1
  26. package/dist/commands/query-command.js +1 -1
  27. package/dist/commands/segment-command.js +1 -1
  28. package/dist/commands/segment-create-command.js +1 -1
  29. package/dist/commands/segment-fields-command.js +1 -1
  30. package/dist/commands/segment-pull-command.js +1 -1
  31. package/dist/commands/segment-push-command.js +1 -1
  32. package/dist/commands/segment-update-command.js +1 -1
  33. package/dist/commands/segment-use-command.js +1 -1
  34. package/dist/commands/segment-validate-command.js +1 -1
  35. package/dist/commands/segments.js +1 -1
  36. package/dist/commands/show.js +1 -1
  37. package/dist/commands/tables.js +1 -1
  38. package/dist/commands/use-command.js +1 -1
  39. package/dist/commands/user-command.js +1 -1
  40. package/dist/commands/workflow-command.js +1 -1
  41. package/dist/core/auth.js +1 -1
  42. package/dist/core/command-output.js +1 -1
  43. package/dist/core/config.js +1 -1
  44. package/dist/core/connection-cache.js +1 -1
  45. package/dist/core/constants.js +1 -1
  46. package/dist/core/credential-cache.js +1 -1
  47. package/dist/core/global-context.js +1 -1
  48. package/dist/core/keychain.js +1 -1
  49. package/dist/core/profile.js +1 -1
  50. package/dist/core/project-config.js +1 -1
  51. package/dist/core/session.js +1 -1
  52. package/dist/core/user-cache.js +1 -1
  53. package/dist/core/version.js +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/proxy/anthropic-adapter.js +1 -1
  56. package/dist/proxy/claude-usage-tracker.js +1 -1
  57. package/dist/proxy/context-signature.js +1 -1
  58. package/dist/proxy/conversation-utils.js +1 -1
  59. package/dist/proxy/passthrough-server.js +1 -1
  60. package/dist/proxy/server.js +1 -1
  61. package/dist/proxy/session-cache.js +1 -1
  62. package/dist/proxy/sse-usage-parser.js +1 -1
  63. package/dist/sdk/agent/agent-config.js +1 -1
  64. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  65. package/dist/sdk/agent/agent-yaml.js +1 -1
  66. package/dist/sdk/api.js +1 -1
  67. package/dist/sdk/client/cdp-api-client.js +1 -1
  68. package/dist/sdk/client/endpoints.js +1 -1
  69. package/dist/sdk/client/endpoints.js.map +1 -1
  70. package/dist/sdk/client/engage-api-client.js +1 -1
  71. package/dist/sdk/client/http-client.js +1 -1
  72. package/dist/sdk/client/llm-api-client.js +1 -1
  73. package/dist/sdk/client/rate-limiter.js +1 -1
  74. package/dist/sdk/client/td-api-client.js +1 -1
  75. package/dist/sdk/client/trino-api-client.js +1 -1
  76. package/dist/sdk/client/workflow-client.js +1 -1
  77. package/dist/sdk/connection-validator.js +1 -1
  78. package/dist/sdk/connection.js +1 -1
  79. package/dist/sdk/engage.js +1 -1
  80. package/dist/sdk/errors.js +1 -1
  81. package/dist/sdk/index.js +1 -1
  82. package/dist/sdk/io/index.js +1 -1
  83. package/dist/sdk/io/node-filesystem.js +1 -1
  84. package/dist/sdk/job.js +1 -1
  85. package/dist/sdk/journey.js +1 -1
  86. package/dist/sdk/llm/chat-cache.js +1 -1
  87. package/dist/sdk/llm/index.js +1 -1
  88. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  89. package/dist/sdk/llm/model-aliases.js +1 -1
  90. package/dist/sdk/llm/model-factors.js +1 -1
  91. package/dist/sdk/query/index.js +1 -1
  92. package/dist/sdk/query/sql-parser.js +1 -1
  93. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  94. package/dist/sdk/segment/fields-display.js +1 -1
  95. package/dist/sdk/segment/file-discovery.js +1 -1
  96. package/dist/sdk/segment/journey-utils.js +1 -1
  97. package/dist/sdk/segment/journey-yaml.js +1 -1
  98. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  99. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  100. package/dist/sdk/segment/pull-workflow.js +1 -1
  101. package/dist/sdk/segment/push-workflow.js +1 -1
  102. package/dist/sdk/segment/resolution-context.js +1 -1
  103. package/dist/sdk/segment/segment-path-parser.js +1 -1
  104. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  105. package/dist/sdk/segment/target-resolution.js +1 -1
  106. package/dist/sdk/segment/tdx-config.js +1 -1
  107. package/dist/sdk/segment/validate-files.js +1 -1
  108. package/dist/sdk/segment/yaml-validator.js +1 -1
  109. package/dist/sdk/segment.js +1 -1
  110. package/dist/sdk/types/index.js +1 -1
  111. package/dist/sdk/types/progress.js +1 -1
  112. package/dist/sdk/user.js +1 -1
  113. package/dist/sdk/util/format-detector.js +1 -1
  114. package/dist/sdk/util/formatters.js +1 -1
  115. package/dist/sdk/util/index.js +1 -1
  116. package/dist/sdk/util/tree-formatter.js +1 -1
  117. package/dist/sdk/workflow/clone-workflow.js +1 -1
  118. package/dist/sdk/workflow/index.js +1 -1
  119. package/dist/sdk/workflow/pull-workflow.js +1 -1
  120. package/dist/sdk/workflow/push-workflow.d.ts.map +1 -1
  121. package/dist/sdk/workflow/push-workflow.js +1 -1
  122. package/dist/sdk/workflow/push-workflow.js.map +1 -1
  123. package/dist/sdk/workflow/tdx-config.js +1 -1
  124. package/dist/sdk/workflow/workflow-utils.d.ts +60 -0
  125. package/dist/sdk/workflow/workflow-utils.d.ts.map +1 -1
  126. package/dist/sdk/workflow/workflow-utils.js +1 -1
  127. package/dist/sdk/workflow/workflow-utils.js.map +1 -1
  128. package/dist/utils/async.js +1 -1
  129. package/dist/utils/colors.js +1 -1
  130. package/dist/utils/diff.js +1 -1
  131. package/dist/utils/file-permissions.js +1 -1
  132. package/dist/utils/json-loader.js +1 -1
  133. package/dist/utils/option-validation.js +1 -1
  134. package/dist/utils/port.js +1 -1
  135. package/dist/utils/process.js +1 -1
  136. package/dist/utils/prompt.js +1 -1
  137. package/dist/utils/spinner.js +1 -1
  138. package/dist/utils/sse-parser.js +1 -1
  139. package/dist/utils/string-utils.js +1 -1
  140. package/dist/utils/table-ref-parser.js +1 -1
  141. package/dist/utils/tdx-logger.js +1 -1
  142. package/dist/utils/version-check.js +1 -1
  143. package/package.json +2 -1
@@ -1 +1 @@
1
- const a3_0x2644d9=a3_0x269c;(function(_0x3e1ecd,_0x592956){const _0x39fa2c=a3_0x269c,_0x5d57e1=_0x3e1ecd();while(!![]){try{const _0x324faa=-parseInt(_0x39fa2c(0x151))/0x1*(parseInt(_0x39fa2c(0x16d))/0x2)+-parseInt(_0x39fa2c(0x15d))/0x3*(-parseInt(_0x39fa2c(0x15c))/0x4)+-parseInt(_0x39fa2c(0x159))/0x5*(-parseInt(_0x39fa2c(0x15a))/0x6)+parseInt(_0x39fa2c(0x170))/0x7*(parseInt(_0x39fa2c(0x157))/0x8)+parseInt(_0x39fa2c(0x161))/0x9+parseInt(_0x39fa2c(0x155))/0xa*(parseInt(_0x39fa2c(0x16a))/0xb)+-parseInt(_0x39fa2c(0x168))/0xc*(parseInt(_0x39fa2c(0x15f))/0xd);if(_0x324faa===_0x592956)break;else _0x5d57e1['push'](_0x5d57e1['shift']());}catch(_0x419191){_0x5d57e1['push'](_0x5d57e1['shift']());}}}(a3_0x1e39,0x4c4bb));function a3_0x269c(_0x3b3d58,_0x561d44){_0x3b3d58=_0x3b3d58-0x14c;const _0x1e39f9=a3_0x1e39();let _0x269cb2=_0x1e39f9[_0x3b3d58];return _0x269cb2;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a3_0x1e39(){const _0x2f9b8e=['Listing\x20activations\x20for\x20segment\x20\x27','97420oQNhBP','30vVRcJi','site','13vghpfT','execute','3312297CsiGsz','Parent\x20name:\x20','name','Site:\x20','Error:\x20Segment\x20name\x20is\x20required','\x20activation','\x20\x20Cause:\x20','9006468HXLhbj','resolveSegmentId','33WpsgMW','\x27...','segment','8OJCGkq','Resolving\x20parent\x20segment\x20\x27','data','39081lLAUOV','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','✔\x20Found\x20','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','listActivations','verbose','47248TrSZlT','Child\x20name:\x20','error','Resolved\x20parent\x20ID:\x20','788950lznsBx','length','568pOrDuV','cause','15IUxwcV','14754dFHIJy'];a3_0x1e39=function(){return _0x2f9b8e;};return a3_0x1e39();}export class ActivationsCommand extends BaseCommand{[a3_0x2644d9(0x163)]='activations';['description']='List\x20activations\x20for\x20a\x20segment';async[a3_0x2644d9(0x160)](_0x5bcb8a){const _0x32764d=a3_0x2644d9,{options:_0x5d8c4d,args:_0x16c95f,tdx:_0x6bfb99}=_0x5bcb8a;if(_0x16c95f[_0x32764d(0x156)]===0x0)return console[_0x32764d(0x153)](_0x32764d(0x165)),console[_0x32764d(0x153)](_0x32764d(0x14c)),0x1;try{const {parentId:_0x182d89,childId:_0x427a90}=parseSegmentRef(_0x16c95f[0x0]);if(!_0x427a90)return console[_0x32764d(0x153)](_0x32764d(0x14e)),console['error'](_0x32764d(0x14c)),0x1;_0x5d8c4d[_0x32764d(0x150)]&&(console[_0x32764d(0x153)](_0x32764d(0x164)+_0x5d8c4d[_0x32764d(0x15e)]),console[_0x32764d(0x153)](_0x32764d(0x162)+_0x182d89),console[_0x32764d(0x153)](_0x32764d(0x152)+_0x427a90));const _0x382317=await withSpinner(_0x32764d(0x16e)+_0x182d89+'\x27...',()=>_0x6bfb99['segment']['resolveParentId'](_0x182d89),{'verbose':_0x5d8c4d[_0x32764d(0x150)]}),_0xff3cde=_0x382317[_0x32764d(0x16f)];_0x5d8c4d[_0x32764d(0x150)]&&console[_0x32764d(0x153)](_0x32764d(0x154)+_0xff3cde);const _0x362ba9=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x427a90+_0x32764d(0x16b),()=>_0x6bfb99[_0x32764d(0x16c)][_0x32764d(0x169)](_0xff3cde,_0x427a90),{'verbose':_0x5d8c4d[_0x32764d(0x150)]}),_0x10ad60=_0x362ba9[_0x32764d(0x16f)];_0x5d8c4d['verbose']&&console[_0x32764d(0x153)]('Resolved\x20child\x20ID:\x20'+_0x10ad60);const _0x2f7c16=await withSpinner(_0x32764d(0x15b)+_0x427a90+_0x32764d(0x16b),()=>_0x6bfb99[_0x32764d(0x16c)][_0x32764d(0x14f)](_0xff3cde,_0x10ad60),{'verbose':_0x5d8c4d[_0x32764d(0x150)]}),_0x531ce9=_0x2f7c16[_0x32764d(0x16f)];return console[_0x32764d(0x153)](_0x32764d(0x14d)+_0x531ce9[_0x32764d(0x156)]+_0x32764d(0x166)+(_0x531ce9[_0x32764d(0x156)]!==0x1?'s':'')),await handleSDKOutput(_0x531ce9,_0x5d8c4d),0x0;}catch(_0x2c1bb5){if(_0x2c1bb5 instanceof SDKError)return console[_0x32764d(0x153)]('Error:\x20'+_0x2c1bb5['message']),_0x2c1bb5[_0x32764d(0x158)]&&console['error'](_0x32764d(0x167)+_0x2c1bb5[_0x32764d(0x158)]),0x1;throw _0x2c1bb5;}}}
1
+ const a3_0x353e7c=a3_0x2e50;(function(_0xea2044,_0x5f6bcf){const _0x214d41=a3_0x2e50,_0x2e9112=_0xea2044();while(!![]){try{const _0x2e01fd=parseInt(_0x214d41(0x1c4))/0x1+parseInt(_0x214d41(0x1c2))/0x2*(-parseInt(_0x214d41(0x1b0))/0x3)+parseInt(_0x214d41(0x1af))/0x4+-parseInt(_0x214d41(0x1bd))/0x5+-parseInt(_0x214d41(0x1c9))/0x6*(-parseInt(_0x214d41(0x1cd))/0x7)+-parseInt(_0x214d41(0x1cc))/0x8*(-parseInt(_0x214d41(0x1ac))/0x9)+parseInt(_0x214d41(0x1be))/0xa*(-parseInt(_0x214d41(0x1b8))/0xb);if(_0x2e01fd===_0x5f6bcf)break;else _0x2e9112['push'](_0x2e9112['shift']());}catch(_0x3f4a48){_0x2e9112['push'](_0x2e9112['shift']());}}}(a3_0x184b,0x672a7));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a3_0x2e50(_0x19c70d,_0x1b68f6){_0x19c70d=_0x19c70d-0x1ab;const _0x184b78=a3_0x184b();let _0x2e5011=_0x184b78[_0x19c70d];return _0x2e5011;}function a3_0x184b(){const _0xb09e27=['cause','Parent\x20name:\x20','Resolved\x20parent\x20ID:\x20','Listing\x20activations\x20for\x20segment\x20\x27','name','Resolving\x20parent\x20segment\x20\x27','\x27...','209XPDjiV','resolveSegmentId','Site:\x20','message','Error:\x20Segment\x20name\x20is\x20required','600815htVaNQ','352520eixNHU','description','Resolved\x20child\x20ID:\x20','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','2GQDWOY','error','390319hrSHlU','activations','Child\x20name:\x20','\x20\x20Cause:\x20','execute','330LxdGmF','site','Resolving\x20child\x20segment\x20\x27','5815688YnbpTg','30065bhZHzw','segment','9IWASuT','data','verbose','386960zGGjyP','713181LjgqwW'];a3_0x184b=function(){return _0xb09e27;};return a3_0x184b();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a3_0x353e7c(0x1b5)]=a3_0x353e7c(0x1c5);[a3_0x353e7c(0x1bf)]='List\x20activations\x20for\x20a\x20segment';async[a3_0x353e7c(0x1c8)](_0x47822b){const _0x217a9f=a3_0x353e7c,{options:_0xd76229,args:_0x359b04,tdx:_0x5ebbe1}=_0x47822b;if(_0x359b04['length']===0x0)return console['error'](_0x217a9f(0x1bc)),console[_0x217a9f(0x1c3)](_0x217a9f(0x1c1)),0x1;try{const {parentId:_0x30d793,childId:_0x5a68ed}=parseSegmentRef(_0x359b04[0x0]);if(!_0x5a68ed)return console[_0x217a9f(0x1c3)]('Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations'),console[_0x217a9f(0x1c3)](_0x217a9f(0x1c1)),0x1;_0xd76229[_0x217a9f(0x1ae)]&&(console['error'](_0x217a9f(0x1ba)+_0xd76229[_0x217a9f(0x1ca)]),console[_0x217a9f(0x1c3)](_0x217a9f(0x1b2)+_0x30d793),console[_0x217a9f(0x1c3)](_0x217a9f(0x1c6)+_0x5a68ed));const _0x191c4b=await withSpinner(_0x217a9f(0x1b6)+_0x30d793+'\x27...',()=>_0x5ebbe1[_0x217a9f(0x1ab)]['resolveParentId'](_0x30d793),{'verbose':_0xd76229[_0x217a9f(0x1ae)]}),_0xcb3673=_0x191c4b[_0x217a9f(0x1ad)];_0xd76229[_0x217a9f(0x1ae)]&&console[_0x217a9f(0x1c3)](_0x217a9f(0x1b3)+_0xcb3673);const _0x25ffb9=await withSpinner(_0x217a9f(0x1cb)+_0x5a68ed+_0x217a9f(0x1b7),()=>_0x5ebbe1['segment'][_0x217a9f(0x1b9)](_0xcb3673,_0x5a68ed),{'verbose':_0xd76229['verbose']}),_0x4ea076=_0x25ffb9[_0x217a9f(0x1ad)];_0xd76229[_0x217a9f(0x1ae)]&&console[_0x217a9f(0x1c3)](_0x217a9f(0x1c0)+_0x4ea076);const _0x37d32d=await withSpinner(_0x217a9f(0x1b4)+_0x5a68ed+'\x27...',()=>_0x5ebbe1[_0x217a9f(0x1ab)]['listActivations'](_0xcb3673,_0x4ea076),{'verbose':_0xd76229[_0x217a9f(0x1ae)]}),_0x333549=_0x37d32d[_0x217a9f(0x1ad)];return console[_0x217a9f(0x1c3)]('✔\x20Found\x20'+_0x333549['length']+'\x20activation'+(_0x333549['length']!==0x1?'s':'')),await handleSDKOutput(_0x333549,_0xd76229),0x0;}catch(_0x167d4d){if(_0x167d4d instanceof SDKError)return console[_0x217a9f(0x1c3)]('Error:\x20'+_0x167d4d[_0x217a9f(0x1bb)]),_0x167d4d[_0x217a9f(0x1b1)]&&console[_0x217a9f(0x1c3)](_0x217a9f(0x1c7)+_0x167d4d[_0x217a9f(0x1b1)]),0x1;throw _0x167d4d;}}}
@@ -1 +1 @@
1
- const a4_0xf23dba=a4_0x48e7;function a4_0x5f44(){const _0x5ac4bc=['1571580sYhduJ','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','\x0aChanges\x20to\x20agent\x20\x27','580794eZZwSV','INVALID_ARGUMENT','Using\x20project:\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','641392bjIKCB','cyan','isNew','Agent:\x20','pushProject','New\x20project:\x20','agent:clone','\x20files?','\x20changed','\x0aPull\x20summary\x20for\x20\x27','\x20\x20Agents:\x20','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','projectId','MISSING_ARGUMENT','Source:\x20','Analyzing\x20project\x20\x22','dim','created','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\x20errors','Clone\x20cancelled','outputPath','\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','\x20files\x20to\x20','\x20\x20Prompts:\x20','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','\x22\x20from\x20project\x20\x22','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','Dry\x20run\x20-\x20no\x20files\x20written','\x20new','\x20\x20Target:\x20','\x20\x20Text\x20Knowledge\x20Base\x20\x22','No\x20tdx.json\x20found\x20in\x20','\x0aPush\x20summary\x20for\x20\x27','output','utf-8','8674oxHnEI','Using\x20current\x20project:\x20','new','llm','\x0aChanges\x20to\x20prompt\x20\x27','projectName','execute','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Pushing\x20to\x20project...','updated','cwd','43pqKuCU','agent:push','Errors:','Would\x20push\x20agent:\x20','agentId','gray','\x20unchanged','\x20resources?','Pull\x20cancelled','\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)','56kbAHGk','\x0aPush\x20','sourceProjectName','error','log','green','pullProject','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','\x20\x20tdx\x20agent\x20clone\x20agents/','action','counts','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Pushing\x20agent\x20from\x20\x22','push','30RLDNgw','Status:\x20','Writing\x20files...','\x22\x20to\x20a\x20different\x20profile','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x20=\x20','Agent\x20pulled\x20successfully','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','10aQqXwY','dirname','hasChanges','prompts','\x22:\x20','yes','\x20--profile\x20','\x20\x20Prompt\x20\x22','New\x20project\x20ID:\x20','session','7365600Ftlplg','join','Output\x20path:\x20','llm_project','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','\x0aChanges:','\x0aWrite\x20','textKnowledgeBases','\x20|\x20','14252117DlxyWU','Would\x20clone:','Push\x20cancelled','Summary:','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','newProjectId','\x20--name\x20','llmProject','outputDir','site','dryRun','force','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20\x20Knowledge\x20Base\x20\x22','Using\x20context\x20project:\x20','diff','\x27\x20to\x20create\x20the\x20folder\x20structure.','Failed\x20to\x20push\x20agent:\x20','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','cloneProject','\x0a✔\x20Pushed\x20','\x20\x20Knowledge\x20Bases:\x20','\x20created','\x22...','Would\x20pull\x20agent:\x20','errors','Using\x20project\x20from\x20','Dry\x20run\x20-\x20no\x20changes\x20made','Output:\x20','Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)','\x20\x20Text\x20Knowledge\x20Bases:\x20','<new-name>','Using\x20local\x20project:\x20','Agent\x20','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','knowledgeBases','\x20successfully','Pulling\x20agent\x20\x22','Current\x20context\x20has\x20llm_project=\x22','name','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','\x0aErrors\x20found:','repeat','total','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','\x0a✔\x20Pulled\x20','\x20resources\x20to\x20\x27','red','86915xWXFaT','yellow','Analyzing\x20changes\x20to\x20push...','Project:\x20','unchanged','tdx.json','agents','\x20\x20Agent\x20\x22','agentName','description'];a4_0x5f44=function(){return _0x5ac4bc;};return a4_0x5f44();}(function(_0x448f47,_0x1e50af){const _0x4ba2fa=a4_0x48e7,_0x293399=_0x448f47();while(!![]){try{const _0x3e4ea7=-parseInt(_0x4ba2fa(0x113))/0x1*(parseInt(_0x4ba2fa(0x108))/0x2)+-parseInt(_0x4ba2fa(0x183))/0x3+-parseInt(_0x4ba2fa(0x180))/0x4+parseInt(_0x4ba2fa(0x176))/0x5*(parseInt(_0x4ba2fa(0x12b))/0x6)+-parseInt(_0x4ba2fa(0x11d))/0x7*(-parseInt(_0x4ba2fa(0x187))/0x8)+-parseInt(_0x4ba2fa(0x13d))/0x9+-parseInt(_0x4ba2fa(0x133))/0xa*(-parseInt(_0x4ba2fa(0x146))/0xb);if(_0x3e4ea7===_0x1e50af)break;else _0x293399['push'](_0x293399['shift']());}catch(_0x4c54b2){_0x293399['push'](_0x293399['shift']());}}}(a4_0x5f44,0x699ba));import a4_0xd61c5d from'chalk';import a4_0x2acfc5 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x3b446d){const _0x318039=a4_0x48e7,_0x399ed9=[];if(_0x3b446d[_0x318039(0x171)]!==undefined)_0x399ed9[_0x318039(0x12a)](_0x3b446d[_0x318039(0x171)]+'\x20total');if(_0x3b446d['new']!==undefined&&_0x3b446d[_0x318039(0x10a)]>0x0)_0x399ed9['push'](a4_0xd61c5d[_0x318039(0x122)](_0x3b446d[_0x318039(0x10a)]+_0x318039(0x101)));if(_0x3b446d[_0x318039(0xf4)]!==undefined&&_0x3b446d['created']>0x0)_0x399ed9[_0x318039(0x12a)](a4_0xd61c5d[_0x318039(0x122)](_0x3b446d[_0x318039(0xf4)]+_0x318039(0x15c)));if(_0x3b446d[_0x318039(0x111)]!==undefined&&_0x3b446d['updated']>0x0)_0x399ed9['push'](a4_0xd61c5d[_0x318039(0x177)](_0x3b446d['updated']+'\x20updated'));if(_0x3b446d[_0x318039(0x17a)]!==undefined&&_0x3b446d[_0x318039(0x17a)]>0x0)_0x399ed9[_0x318039(0x12a)](a4_0xd61c5d[_0x318039(0x118)](_0x3b446d['unchanged']+'\x20unchanged'));if(_0x3b446d[_0x318039(0x15f)]!==undefined&&_0x3b446d[_0x318039(0x15f)]>0x0)_0x399ed9['push'](a4_0xd61c5d[_0x318039(0x175)](_0x3b446d[_0x318039(0x15f)]+_0x318039(0xf7)));return _0x399ed9[_0x318039(0x13e)](',\x20');}function displayDiffs(_0x426f39,_0x44ce28,_0x13cf90,_0x415b8e){const _0x4e28de=a4_0x48e7;for(const _0x3b1098 of _0x426f39){if(_0x3b1098[_0x4e28de(0x155)]){const _0x33c7b8=_0x3b1098[_0x4e28de(0x17e)]||_0x3b1098[_0x4e28de(0x16d)];console[_0x4e28de(0x121)](_0x4e28de(0x182)+_0x33c7b8+'\x27:'),console[_0x4e28de(0x121)]('─'[_0x4e28de(0x170)](0x3c)),console[_0x4e28de(0x121)](_0x3b1098['diff']),console['log']('─'['repeat'](0x3c));}}for(const _0x2f0aa0 of _0x44ce28){_0x2f0aa0[_0x4e28de(0x155)]&&(console['log'](_0x4e28de(0x152)+_0x2f0aa0[_0x4e28de(0x16d)]+'\x27:'),console[_0x4e28de(0x121)]('─'[_0x4e28de(0x170)](0x3c)),console['log'](_0x2f0aa0[_0x4e28de(0x155)]),console[_0x4e28de(0x121)]('─'[_0x4e28de(0x170)](0x3c)));}for(const _0x24cc5f of _0x13cf90){_0x24cc5f[_0x4e28de(0x155)]&&(console['log'](_0x4e28de(0x16e)+_0x24cc5f['name']+'\x27:'),console[_0x4e28de(0x121)]('─'[_0x4e28de(0x170)](0x3c)),console['log'](_0x24cc5f[_0x4e28de(0x155)]),console[_0x4e28de(0x121)]('─'[_0x4e28de(0x170)](0x3c)));}for(const _0x3b0d70 of _0x415b8e){_0x3b0d70['diff']&&(console[_0x4e28de(0x121)](_0x4e28de(0x10c)+_0x3b0d70[_0x4e28de(0x16d)]+'\x27:'),console[_0x4e28de(0x121)]('─'[_0x4e28de(0x170)](0x3c)),console[_0x4e28de(0x121)](_0x3b0d70[_0x4e28de(0x155)]),console[_0x4e28de(0x121)]('─'[_0x4e28de(0x170)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0xf23dba(0x16d)]='agent:pull';['description']=a4_0xf23dba(0x172);async[a4_0xf23dba(0x10e)](_0x38502b){const _0x2cecc3=a4_0xf23dba,{options:_0x58c371,args:_0x195387,tdx:_0x537754}=_0x38502b,_0x5bd98b=_0x195387[0x0],_0x432167=_0x195387[0x1],_0x3ff3b1=_0x58c371[_0x2cecc3(0x106)],_0x37ce4a=_0x58c371[_0x2cecc3(0x150)],_0x1ec1d8=_0x58c371[_0x2cecc3(0x151)],_0x283185=_0x58c371[_0x2cecc3(0x138)],_0x52157d=_0x58c371[_0x2cecc3(0x14d)];let _0x3d1c5c,_0x1cfb57;const _0x1000f7=findAgentConfigPath(process['cwd']());if(_0x5bd98b){const _0x1dca0c=a4_0x2acfc5['join'](_0x5bd98b,_0x2cecc3(0x17b));if(existsSync(_0x1dca0c))try{const _0x48c9f3=JSON['parse'](readFileSync(_0x1dca0c,'utf-8'));_0x3d1c5c=_0x48c9f3[_0x2cecc3(0x140)],_0x1cfb57=_0x5bd98b,console[_0x2cecc3(0x121)](a4_0xd61c5d[_0x2cecc3(0x197)](_0x2cecc3(0x160)+_0x1dca0c+':\x20'+_0x3d1c5c));}catch{_0x3d1c5c=_0x5bd98b;}else _0x3d1c5c=_0x5bd98b;}else{if(_0x1000f7)try{const _0x392ac5=JSON['parse'](readFileSync(_0x1000f7,_0x2cecc3(0x107)));_0x3d1c5c=_0x392ac5[_0x2cecc3(0x140)],_0x1cfb57=a4_0x2acfc5[_0x2cecc3(0x134)](_0x1000f7),console['log'](a4_0xd61c5d[_0x2cecc3(0x197)](_0x2cecc3(0x185)+_0x3d1c5c));}catch{_0x3d1c5c=_0x52157d;}else _0x3d1c5c=_0x52157d;}if(!_0x3d1c5c)return console[_0x2cecc3(0x121)](a4_0xd61c5d[_0x2cecc3(0x177)](_0x2cecc3(0x14a))),console['log'](_0x2cecc3(0x163)),console[_0x2cecc3(0x121)](_0x2cecc3(0xfa)),console[_0x2cecc3(0x121)]('\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[_0x2cecc3(0x121)](_0x2cecc3(0x132)),0x1;if(_0x432167){const {data:_0x1b55b5}=await withSpinner(_0x2cecc3(0x16b)+_0x432167+_0x2cecc3(0xfe)+_0x3d1c5c+_0x2cecc3(0x15d),()=>_0x537754[_0x2cecc3(0x10b)]['pullAgent'](_0x3d1c5c,_0x432167,_0x3ff3b1,{'dryRun':_0x37ce4a,'force':_0x1ec1d8}));if(_0x37ce4a)return console[_0x2cecc3(0x121)](a4_0xd61c5d[_0x2cecc3(0x177)](_0x2cecc3(0x100))),console[_0x2cecc3(0x121)](_0x2cecc3(0x15e)+_0x1b55b5['agentName']),console['log'](_0x2cecc3(0x13f)+_0x1b55b5[_0x2cecc3(0xf9)]),_0x1b55b5[_0x2cecc3(0x155)]&&(console['log'](_0x2cecc3(0x142)),console[_0x2cecc3(0x121)]('─'[_0x2cecc3(0x170)](0x3c)),console[_0x2cecc3(0x121)](_0x1b55b5[_0x2cecc3(0x155)]),console[_0x2cecc3(0x121)]('─'[_0x2cecc3(0x170)](0x3c))),0x0;return console[_0x2cecc3(0x121)](a4_0xd61c5d[_0x2cecc3(0x122)](_0x2cecc3(0x131))),console[_0x2cecc3(0x121)](_0x2cecc3(0x18a)+_0x1b55b5[_0x2cecc3(0x17e)]),console['log'](_0x2cecc3(0x162)+_0x1b55b5['outputPath']),console[_0x2cecc3(0x121)](_0x2cecc3(0x12c)+(_0x1b55b5[_0x2cecc3(0x189)]?a4_0xd61c5d[_0x2cecc3(0x122)](_0x2cecc3(0x10a)):_0x1b55b5[_0x2cecc3(0x135)]?a4_0xd61c5d['yellow'](_0x2cecc3(0x111)):a4_0xd61c5d['gray'](_0x2cecc3(0x17a)))),0x0;}const _0x1269fd=_0x1cfb57||_0x3ff3b1,{data:_0x38c20}=await withSpinner(_0x2cecc3(0x196)+_0x3d1c5c+_0x2cecc3(0x15d),()=>_0x537754[_0x2cecc3(0x10b)][_0x2cecc3(0x123)](_0x3d1c5c,_0x1269fd,{'dryRun':!![]})),_0x5061c1=_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x17c)][_0x2cecc3(0x10a)]+_0x38c20['counts'][_0x2cecc3(0x169)][_0x2cecc3(0x10a)]+_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x144)][_0x2cecc3(0x10a)]+_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x136)][_0x2cecc3(0x10a)],_0x338139=_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x17c)][_0x2cecc3(0x111)]+_0x38c20['counts']['knowledgeBases'][_0x2cecc3(0x111)]+_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x144)][_0x2cecc3(0x111)]+_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x136)][_0x2cecc3(0x111)],_0xb3ffea=_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x17c)]['unchanged']+_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x169)][_0x2cecc3(0x17a)]+_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x144)]['unchanged']+_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x136)][_0x2cecc3(0x17a)];console[_0x2cecc3(0x121)](_0x2cecc3(0x190)+_0x38c20[_0x2cecc3(0x10d)]+'\x27:'),console[_0x2cecc3(0x121)]('\x20\x20'+a4_0xd61c5d['green']('+\x20'+_0x5061c1+_0x2cecc3(0x101))+_0x2cecc3(0x145)+a4_0xd61c5d[_0x2cecc3(0x177)]('~\x20'+_0x338139+_0x2cecc3(0x18f))+'\x20|\x20'+a4_0xd61c5d[_0x2cecc3(0x197)]('=\x20'+_0xb3ffea+_0x2cecc3(0x119))),console[_0x2cecc3(0x121)](_0x2cecc3(0x191)+formatCountSummary(_0x38c20['counts'][_0x2cecc3(0x17c)])),console[_0x2cecc3(0x121)](_0x2cecc3(0x15b)+formatCountSummary(_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x169)])),console[_0x2cecc3(0x121)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x38c20[_0x2cecc3(0x127)][_0x2cecc3(0x144)])),console[_0x2cecc3(0x121)](_0x2cecc3(0xfc)+formatCountSummary(_0x38c20['counts'][_0x2cecc3(0x136)])),console[_0x2cecc3(0x121)](_0x2cecc3(0x102)+a4_0xd61c5d[_0x2cecc3(0x188)](_0x38c20[_0x2cecc3(0x14e)])),displayDiffs(_0x38c20[_0x2cecc3(0x17c)],_0x38c20['knowledgeBases'],_0x38c20[_0x2cecc3(0x144)],_0x38c20[_0x2cecc3(0x136)]);if(_0x37ce4a)return console[_0x2cecc3(0x121)](a4_0xd61c5d[_0x2cecc3(0x177)](_0x2cecc3(0x10f))),0x0;if(_0x5061c1===0x0&&_0x338139===0x0)return console[_0x2cecc3(0x121)](a4_0xd61c5d['green'](_0x2cecc3(0x141))),saveSessionContext({'llm_project':_0x38c20['projectName']},_0x58c371[_0x2cecc3(0x13c)]),console['log'](a4_0xd61c5d['green']('✔\x20Context\x20set:\x20'+a4_0xd61c5d['dim']('llm_project')+_0x2cecc3(0x130)+a4_0xd61c5d[_0x2cecc3(0x188)](_0x38c20[_0x2cecc3(0x10d)]))),0x0;if(!_0x283185&&!_0x1ec1d8){const _0x2de1d3=await confirmKey(_0x2cecc3(0x143)+(_0x5061c1+_0x338139)+_0x2cecc3(0x18e));if(!_0x2de1d3)return console[_0x2cecc3(0x121)](_0x2cecc3(0x11b)),0x0;}const {data:_0x5e0c02}=await withSpinner(_0x2cecc3(0x12d),()=>_0x537754[_0x2cecc3(0x10b)][_0x2cecc3(0x123)](_0x3d1c5c,_0x1269fd,{'force':_0x1ec1d8}));return console[_0x2cecc3(0x121)](a4_0xd61c5d[_0x2cecc3(0x122)](_0x2cecc3(0x173)+(_0x5061c1+_0x338139)+_0x2cecc3(0xfb)+_0x5e0c02[_0x2cecc3(0x14e)])),saveSessionContext({'llm_project':_0x5e0c02[_0x2cecc3(0x10d)]},_0x58c371[_0x2cecc3(0x13c)]),console[_0x2cecc3(0x121)](a4_0xd61c5d[_0x2cecc3(0x122)]('✔\x20Context\x20set:\x20'+a4_0xd61c5d[_0x2cecc3(0x197)](_0x2cecc3(0x140))+'\x20=\x20'+a4_0xd61c5d[_0x2cecc3(0x188)](_0x5e0c02[_0x2cecc3(0x10d)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0xf23dba(0x18d);[a4_0xf23dba(0x17f)]=a4_0xf23dba(0xfd);async[a4_0xf23dba(0x10e)](_0x46a28a){const _0x3fbefb=a4_0xf23dba,{options:_0xa5da59,args:_0x343627,tdx:_0x2de21d}=_0x46a28a,_0x4f84b6=_0x343627[0x0],_0x293757=_0xa5da59[_0x3fbefb(0x16d)],_0x434523=_0xa5da59[_0x3fbefb(0x150)],_0x56b409=_0xa5da59[_0x3fbefb(0x138)],_0x4184dd=_0xa5da59[_0x3fbefb(0x14f)],_0x256fd3=_0xa5da59['llmProject'];let _0x5b6bdc;const _0x56b277=findAgentConfigPath(process['cwd']());if(_0x4f84b6){const _0x1884e7=a4_0x2acfc5['join'](_0x4f84b6,'tdx.json');existsSync(_0x1884e7)?(_0x5b6bdc=_0x4f84b6,console[_0x3fbefb(0x121)](a4_0xd61c5d[_0x3fbefb(0x197)](_0x3fbefb(0x166)+_0x4f84b6))):_0x5b6bdc=_0x4f84b6;}else{if(_0x56b277)_0x5b6bdc=a4_0x2acfc5[_0x3fbefb(0x134)](_0x56b277),console[_0x3fbefb(0x121)](a4_0xd61c5d[_0x3fbefb(0x197)](_0x3fbefb(0x109)+_0x5b6bdc));else{if(_0x256fd3){const _0x2c2f1d=normalizeName(_0x256fd3),_0x399350=a4_0x2acfc5[_0x3fbefb(0x13e)](process[_0x3fbefb(0x112)](),_0x3fbefb(0x17c),_0x2c2f1d,_0x3fbefb(0x17b));if(existsSync(_0x399350))_0x5b6bdc=a4_0x2acfc5[_0x3fbefb(0x134)](_0x399350),console['log'](a4_0xd61c5d[_0x3fbefb(0x197)](_0x3fbefb(0x166)+_0x5b6bdc));else{const _0x5aff18=_0xa5da59['profile'];if(_0x5aff18)throw new SDKError(ErrorCode[_0x3fbefb(0x184)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x256fd3+_0x3fbefb(0x12e),undefined,{'helpText':_0x3fbefb(0x158)+_0x3fbefb(0xf5)+('\x20\x20tdx\x20agent\x20pull\x20'+_0x256fd3+'\x0a')+(_0x3fbefb(0x125)+_0x2c2f1d+_0x3fbefb(0x14c)+(_0x293757||_0x3fbefb(0x165))+_0x3fbefb(0x139)+_0x5aff18)});_0x5b6bdc=_0x256fd3,console[_0x3fbefb(0x121)](a4_0xd61c5d[_0x3fbefb(0x197)](_0x3fbefb(0x154)+_0x256fd3));}}}}if(!_0x5b6bdc)return console[_0x3fbefb(0x121)](a4_0xd61c5d[_0x3fbefb(0x177)](_0x3fbefb(0x12f))),console[_0x3fbefb(0x121)](_0x3fbefb(0x124)),console['log'](_0x3fbefb(0x192)),console[_0x3fbefb(0x121)](_0x3fbefb(0x11c)),console['log'](_0x3fbefb(0x128)),0x1;if(!_0x293757)throw new SDKError(ErrorCode[_0x3fbefb(0x194)],'New\x20project\x20name\x20is\x20required',undefined,{'helpText':_0x3fbefb(0xf6)});if(!_0x56b409&&!_0x434523){const _0x13d4ae=await confirmKey('Clone\x20\x22'+_0x5b6bdc+'\x22\x20to\x20new\x20project\x20\x22'+_0x293757+'\x22?');if(!_0x13d4ae)return console['log'](_0x3fbefb(0xf8)),0x0;}const {data:_0x2b2a08}=await withSpinner('Cloning\x20\x22'+_0x5b6bdc+'\x22\x20to\x20\x22'+_0x293757+_0x3fbefb(0x15d),()=>_0x2de21d['llm'][_0x3fbefb(0x159)](_0x5b6bdc,_0x293757,{'dryRun':_0x434523}));if(_0x434523)return console['log'](a4_0xd61c5d[_0x3fbefb(0x177)](_0x3fbefb(0x161))),console[_0x3fbefb(0x121)](_0x3fbefb(0x195)+_0x2b2a08['sourceProjectName']),console[_0x3fbefb(0x121)](_0x3fbefb(0x18c)+_0x293757),console[_0x3fbefb(0x121)](_0x3fbefb(0x147)),console[_0x3fbefb(0x121)]('\x20\x20Agents:\x20'+_0x2b2a08[_0x3fbefb(0x127)][_0x3fbefb(0x17c)][_0x3fbefb(0xf4)]),console['log'](_0x3fbefb(0x15b)+_0x2b2a08[_0x3fbefb(0x127)][_0x3fbefb(0x169)][_0x3fbefb(0xf4)]),console['log'](_0x3fbefb(0xfc)+_0x2b2a08[_0x3fbefb(0x127)][_0x3fbefb(0x136)]['created']),0x0;const _0x1ccd2a=_0x2b2a08[_0x3fbefb(0x127)][_0x3fbefb(0x17c)][_0x3fbefb(0x15f)]>0x0||_0x2b2a08[_0x3fbefb(0x127)][_0x3fbefb(0x169)][_0x3fbefb(0x15f)]>0x0||_0x2b2a08[_0x3fbefb(0x127)][_0x3fbefb(0x136)][_0x3fbefb(0x15f)]>0x0;_0x1ccd2a?console['log'](a4_0xd61c5d[_0x3fbefb(0x177)]('Project\x20cloned\x20with\x20errors')):console[_0x3fbefb(0x121)](a4_0xd61c5d[_0x3fbefb(0x122)]('Project\x20cloned\x20successfully'));console[_0x3fbefb(0x121)]('Source:\x20'+_0x2b2a08[_0x3fbefb(0x11f)]),console[_0x3fbefb(0x121)](_0x3fbefb(0x18c)+_0x2b2a08['newProjectName']),console[_0x3fbefb(0x121)](_0x3fbefb(0x13b)+_0x2b2a08[_0x3fbefb(0x14b)]),console[_0x3fbefb(0x121)](),console[_0x3fbefb(0x121)](_0x3fbefb(0x149)),console['log'](_0x3fbefb(0x191)+formatCountSummary(_0x2b2a08['counts']['agents'])),console[_0x3fbefb(0x121)](_0x3fbefb(0x15b)+formatCountSummary(_0x2b2a08[_0x3fbefb(0x127)][_0x3fbefb(0x169)])),console[_0x3fbefb(0x121)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x2b2a08[_0x3fbefb(0x127)]['prompts']));if(_0x1ccd2a){console['log'](),console['log'](a4_0xd61c5d[_0x3fbefb(0x175)](_0x3fbefb(0x115)));for(const _0x576450 of _0x2b2a08[_0x3fbefb(0x17c)]){_0x576450[_0x3fbefb(0x126)]==='error'&&console['log'](a4_0xd61c5d[_0x3fbefb(0x175)]('\x20\x20Agent\x20\x22'+_0x576450['agentName']+_0x3fbefb(0x137)+_0x576450[_0x3fbefb(0x120)]));}for(const _0x3b975e of _0x2b2a08['knowledgeBases']){_0x3b975e['action']==='error'&&console[_0x3fbefb(0x121)](a4_0xd61c5d[_0x3fbefb(0x175)](_0x3fbefb(0x153)+_0x3b975e[_0x3fbefb(0x16d)]+_0x3fbefb(0x137)+_0x3b975e[_0x3fbefb(0x120)]));}for(const _0x1b0cf5 of _0x2b2a08[_0x3fbefb(0x136)]){_0x1b0cf5[_0x3fbefb(0x126)]===_0x3fbefb(0x120)&&console[_0x3fbefb(0x121)](a4_0xd61c5d[_0x3fbefb(0x175)](_0x3fbefb(0x13a)+_0x1b0cf5[_0x3fbefb(0x16d)]+_0x3fbefb(0x137)+_0x1b0cf5[_0x3fbefb(0x120)]));}return 0x1;}console[_0x3fbefb(0x121)]();const _0x48cfbf=getLLMProjectUrl(_0x4184dd,_0x2b2a08[_0x3fbefb(0x14b)]);return console[_0x3fbefb(0x121)](_0x3fbefb(0x179)+a4_0xd61c5d[_0x3fbefb(0x188)](_0x48cfbf)),0x0;}}function a4_0x48e7(_0xf1786c,_0x4c4dc5){_0xf1786c=_0xf1786c-0xf4;const _0x5f4413=a4_0x5f44();let _0x48e749=_0x5f4413[_0xf1786c];return _0x48e749;}export class AgentPushCommand extends BaseCommand{[a4_0xf23dba(0x16d)]=a4_0xf23dba(0x114);[a4_0xf23dba(0x17f)]=a4_0xf23dba(0x168);async[a4_0xf23dba(0x10e)](_0x44b900){const _0x3361dd=a4_0xf23dba,{options:_0x182ba0,args:_0x50a5da,tdx:_0x18735f}=_0x44b900;let _0x3b2f35=_0x50a5da[0x0]||process[_0x3361dd(0x112)]();const _0x4e2ce3=_0x182ba0[_0x3361dd(0x150)],_0x62d938=_0x182ba0[_0x3361dd(0x151)],_0x1a9a09=_0x182ba0['yes'],_0x499fce=_0x182ba0[_0x3361dd(0x14f)],_0x34dede=a4_0x2acfc5['join'](_0x3b2f35,'agent.yml'),_0x1b6e69=existsSync(_0x34dede);if(_0x1b6e69){const {data:_0x188d67}=await withSpinner(_0x3361dd(0x129)+_0x3b2f35+_0x3361dd(0x15d),()=>_0x18735f['llm']['pushAgent'](_0x3b2f35,{'dryRun':_0x4e2ce3,'force':_0x62d938}));if(_0x4e2ce3)return console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x177)](_0x3361dd(0x161))),console['log'](_0x3361dd(0x116)+_0x188d67[_0x3361dd(0x17e)]),0x0;if(_0x188d67['action']==='error')return console[_0x3361dd(0x121)](a4_0xd61c5d['red'](_0x3361dd(0x157)+_0x188d67[_0x3361dd(0x120)])),0x1;console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x122)](_0x3361dd(0x167)+_0x188d67['action']+_0x3361dd(0x16a))),console[_0x3361dd(0x121)]('Agent:\x20'+_0x188d67['agentName']);if(_0x188d67[_0x3361dd(0x117)]&&_0x188d67[_0x3361dd(0x193)]){const _0x28c41a=getLLMAgentChatUrl(_0x499fce,_0x188d67['projectId'],_0x188d67['agentId']);console['log']('Chat:\x20'+a4_0xd61c5d[_0x3361dd(0x188)](_0x28c41a));}return 0x0;}let _0x377807=a4_0x2acfc5[_0x3361dd(0x13e)](_0x3b2f35,_0x3361dd(0x17b));if(!existsSync(_0x377807)){const _0x21e5f9=findAgentConfigPath(_0x3b2f35);if(_0x21e5f9)_0x3b2f35=a4_0x2acfc5[_0x3361dd(0x134)](_0x21e5f9),_0x377807=_0x21e5f9,console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x197)]('Using\x20project:\x20'+_0x3b2f35));else{const _0x27c1c6=_0x182ba0[_0x3361dd(0x14d)];if(_0x27c1c6){const _0x1f0e89=normalizeName(_0x27c1c6),_0x26b199=a4_0x2acfc5['join'](_0x3b2f35,_0x3361dd(0x17c)),_0x105336=a4_0x2acfc5[_0x3361dd(0x13e)](_0x26b199,_0x1f0e89,_0x3361dd(0x17b));existsSync(_0x105336)&&(_0x3b2f35=a4_0x2acfc5[_0x3361dd(0x134)](_0x105336),_0x377807=_0x105336,console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x197)]('Using\x20project:\x20'+_0x3b2f35)));}if(!existsSync(_0x377807)){let _0x35770d=_0x3361dd(0xff);_0x27c1c6&&(_0x35770d=_0x3361dd(0x16c)+_0x27c1c6+_0x3361dd(0x181)+('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x27c1c6+_0x3361dd(0x156)));throw new SDKError(ErrorCode[_0x3361dd(0x184)],_0x3361dd(0x104)+_0x3b2f35,undefined,{'helpText':_0x35770d});}}}const {data:_0x4d9105}=await withSpinner(_0x3361dd(0x178),()=>_0x18735f[_0x3361dd(0x10b)][_0x3361dd(0x18b)](_0x3b2f35,{'dryRun':!![]})),_0x3d9fdf=_0x4d9105[_0x3361dd(0x127)][_0x3361dd(0x17c)]['errors']>0x0;if(_0x3d9fdf){console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x175)](_0x3361dd(0x16f)));for(const _0x2c3c18 of _0x4d9105[_0x3361dd(0x17c)]){_0x2c3c18[_0x3361dd(0x126)]===_0x3361dd(0x120)&&console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x175)](_0x3361dd(0x17d)+_0x2c3c18[_0x3361dd(0x17e)]+_0x3361dd(0x137)+_0x2c3c18[_0x3361dd(0x120)]));}return 0x1;}const _0x11bef1=_0x4d9105['counts'][_0x3361dd(0x17c)]['created']+_0x4d9105['counts']['knowledgeBases']['created']+_0x4d9105[_0x3361dd(0x127)][_0x3361dd(0x144)][_0x3361dd(0xf4)]+_0x4d9105['counts']['prompts'][_0x3361dd(0xf4)],_0x2b4ddf=_0x4d9105[_0x3361dd(0x127)]['agents'][_0x3361dd(0x111)]+_0x4d9105[_0x3361dd(0x127)][_0x3361dd(0x169)][_0x3361dd(0x111)]+_0x4d9105['counts'][_0x3361dd(0x144)][_0x3361dd(0x111)]+_0x4d9105['counts'][_0x3361dd(0x136)]['updated'],_0x4bfb62=_0x4d9105['counts'][_0x3361dd(0x17c)][_0x3361dd(0x17a)]+_0x4d9105[_0x3361dd(0x127)]['knowledgeBases'][_0x3361dd(0x17a)]+_0x4d9105[_0x3361dd(0x127)][_0x3361dd(0x144)][_0x3361dd(0x17a)]+_0x4d9105[_0x3361dd(0x127)][_0x3361dd(0x136)]['unchanged'];console[_0x3361dd(0x121)](_0x3361dd(0x105)+_0x4d9105[_0x3361dd(0x10d)]+'\x27:'),console[_0x3361dd(0x121)]('\x20\x20'+a4_0xd61c5d['green']('+\x20'+_0x11bef1+_0x3361dd(0x101))+_0x3361dd(0x145)+a4_0xd61c5d[_0x3361dd(0x177)]('~\x20'+_0x2b4ddf+_0x3361dd(0x18f))+_0x3361dd(0x145)+a4_0xd61c5d['dim']('=\x20'+_0x4bfb62+_0x3361dd(0x119))),console[_0x3361dd(0x121)]('\x20\x20Agents:\x20'+formatCountSummary(_0x4d9105[_0x3361dd(0x127)][_0x3361dd(0x17c)])),console[_0x3361dd(0x121)](_0x3361dd(0x15b)+formatCountSummary(_0x4d9105[_0x3361dd(0x127)][_0x3361dd(0x169)])),console[_0x3361dd(0x121)](_0x3361dd(0x164)+formatCountSummary(_0x4d9105[_0x3361dd(0x127)][_0x3361dd(0x144)])),console[_0x3361dd(0x121)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x4d9105['counts']['prompts'])),console[_0x3361dd(0x121)]('\x20\x20Source:\x20'+a4_0xd61c5d['cyan'](_0x3b2f35)),displayDiffs(_0x4d9105[_0x3361dd(0x17c)],_0x4d9105[_0x3361dd(0x169)],_0x4d9105[_0x3361dd(0x144)],_0x4d9105[_0x3361dd(0x136)]);if(_0x4e2ce3)return console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x177)](_0x3361dd(0x186))),0x0;if(_0x11bef1===0x0&&_0x2b4ddf===0x0){console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x122)]('\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date'));const _0x10048d=getLLMProjectUrl(_0x499fce,_0x4d9105[_0x3361dd(0x193)]);return console[_0x3361dd(0x121)](_0x3361dd(0x179)+a4_0xd61c5d[_0x3361dd(0x188)](_0x10048d)),0x0;}if(!_0x1a9a09&&!_0x62d938){const _0x3f1bbe=await confirmKey(_0x3361dd(0x11e)+(_0x11bef1+_0x2b4ddf)+_0x3361dd(0x11a));if(!_0x3f1bbe)return console[_0x3361dd(0x121)](_0x3361dd(0x148)),0x0;}const {data:_0x1d6389}=await withSpinner(_0x3361dd(0x110),()=>_0x18735f[_0x3361dd(0x10b)]['pushProject'](_0x3b2f35,{'force':_0x62d938})),_0x31b556=_0x1d6389['counts'][_0x3361dd(0x17c)][_0x3361dd(0x15f)]>0x0||_0x1d6389[_0x3361dd(0x127)][_0x3361dd(0x169)][_0x3361dd(0x15f)]>0x0||_0x1d6389[_0x3361dd(0x127)]['textKnowledgeBases'][_0x3361dd(0x15f)]>0x0||_0x1d6389[_0x3361dd(0x127)]['prompts'][_0x3361dd(0x15f)]>0x0;if(_0x31b556){console['log'](a4_0xd61c5d[_0x3361dd(0x177)]('\x0aProject\x20pushed\x20with\x20errors')),console[_0x3361dd(0x121)](),console[_0x3361dd(0x121)](a4_0xd61c5d['red'](_0x3361dd(0x115)));for(const _0xa13d2a of _0x1d6389['agents']){_0xa13d2a[_0x3361dd(0x126)]===_0x3361dd(0x120)&&console['log'](a4_0xd61c5d['red']('\x20\x20Agent\x20\x22'+_0xa13d2a[_0x3361dd(0x17e)]+_0x3361dd(0x137)+_0xa13d2a[_0x3361dd(0x120)]));}for(const _0x325da0 of _0x1d6389[_0x3361dd(0x169)]){_0x325da0['action']==='error'&&console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x175)](_0x3361dd(0x153)+_0x325da0[_0x3361dd(0x16d)]+_0x3361dd(0x137)+_0x325da0['error']));}for(const _0xee3f3 of _0x1d6389[_0x3361dd(0x144)]){_0xee3f3[_0x3361dd(0x126)]===_0x3361dd(0x120)&&console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x175)](_0x3361dd(0x103)+_0xee3f3[_0x3361dd(0x16d)]+'\x22:\x20'+_0xee3f3[_0x3361dd(0x120)]));}for(const _0x469212 of _0x1d6389[_0x3361dd(0x136)]){_0x469212[_0x3361dd(0x126)]==='error'&&console['log'](a4_0xd61c5d[_0x3361dd(0x175)](_0x3361dd(0x13a)+_0x469212[_0x3361dd(0x16d)]+_0x3361dd(0x137)+_0x469212[_0x3361dd(0x120)]));}return 0x1;}console[_0x3361dd(0x121)](a4_0xd61c5d[_0x3361dd(0x122)](_0x3361dd(0x15a)+(_0x11bef1+_0x2b4ddf)+_0x3361dd(0x174)+_0x1d6389[_0x3361dd(0x10d)]+'\x27'));const _0x9f71c5=getLLMProjectUrl(_0x499fce,_0x1d6389[_0x3361dd(0x193)]);return console[_0x3361dd(0x121)](_0x3361dd(0x179)+a4_0xd61c5d[_0x3361dd(0x188)](_0x9f71c5)),0x0;}}
1
+ const a4_0x30dd8c=a4_0x3a88;(function(_0x167a03,_0x5ed050){const _0x10e673=a4_0x3a88,_0x883fb9=_0x167a03();while(!![]){try{const _0xa4475b=-parseInt(_0x10e673(0xf4))/0x1+-parseInt(_0x10e673(0xb0))/0x2*(-parseInt(_0x10e673(0xea))/0x3)+-parseInt(_0x10e673(0x12b))/0x4*(-parseInt(_0x10e673(0xca))/0x5)+parseInt(_0x10e673(0xa3))/0x6+-parseInt(_0x10e673(0x11d))/0x7*(-parseInt(_0x10e673(0xc8))/0x8)+parseInt(_0x10e673(0xbf))/0x9*(parseInt(_0x10e673(0xde))/0xa)+-parseInt(_0x10e673(0xf8))/0xb;if(_0xa4475b===_0x5ed050)break;else _0x883fb9['push'](_0x883fb9['shift']());}catch(_0x143880){_0x883fb9['push'](_0x883fb9['shift']());}}}(a4_0x2075,0xe998e));import a4_0x5c6107 from'chalk';import a4_0x28c9fb from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../sdk/agent/agent-config.js';function a4_0x3a88(_0x46292f,_0x67bdf2){_0x46292f=_0x46292f-0x90;const _0x2075b9=a4_0x2075();let _0x3a8887=_0x2075b9[_0x46292f];return _0x3a8887;}import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';function a4_0x2075(){const _0x5e4762=['\x20\x20Agents:\x20','llm_project','\x20unchanged','agent:push','\x20total','Using\x20local\x20project:\x20','Failed\x20to\x20push\x20agent:\x20','Cloning\x20\x22','Pushing\x20to\x20project...','prompts','agent:clone','errors','Clone\x20\x22','\x20new','Agent\x20pulled\x20successfully','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','\x20|\x20','\x20--profile\x20','Pull\x20cancelled','4969002YnFOZY','site','diff','yes','\x20updated','created','Agent:\x20','updated','\x20\x20Knowledge\x20Base\x20\x22','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','Pushing\x20agent\x20from\x20\x22','\x20\x20Prompt\x20\x22','\x0aChanges:','42522iPmRYj','yellow','agentName','llmProject','\x20\x20Text\x20Knowledge\x20Bases:\x20','\x20\x20Agent\x20\x22','\x0aErrors\x20found:','\x0aChanges\x20to\x20prompt\x20\x27','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','Output:\x20','pushProject','description','\x22\x20to\x20new\x20project\x20\x22','pullProject','dirname','13645377BddGrp','\x20\x20tdx\x20agent\x20clone\x20agents/','\x20--name\x20','profile','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','\x0a✔\x20Pushed\x20','pullAgent','execute','\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','16IpbjLD','Would\x20clone:','10RaFyRX','red','join','dryRun','\x22\x20from\x20project\x20\x22','Project\x20cloned\x20with\x20errors','Would\x20push\x20agent:\x20','Cannot\x20clone\x20from\x20context\x20project\x20\x22','outputDir','newProjectId','Agent\x20','name','unchanged','projectName','\x22:\x20','action','Using\x20context\x20project:\x20','cwd','Summary:','\x0aWrite\x20','10mtpRBk','\x22\x20to\x20\x22','textKnowledgeBases','\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','output','Source:\x20','tdx.json','\x20\x20Knowledge\x20Bases:\x20','sourceProjectName','\x20\x20Source:\x20','\x20successfully','Push\x20cancelled','186pQzrNg','cyan','Clone\x20cancelled','dim','\x20=\x20','total','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','No\x20tdx.json\x20found\x20in\x20','push','Run\x20\x27tdx\x20agent\x20pull\x20','1569034uHtbJX','cloneProject','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20created','30937632rHPHjB','New\x20project\x20name\x20is\x20required','knowledgeBases','Analyzing\x20project\x20\x22','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','\x22\x20to\x20a\x20different\x20profile','agentId','\x22...','Chat:\x20','gray','\x20files\x20to\x20','\x20\x20tdx\x20agent\x20pull\x20','Analyzing\x20changes\x20to\x20push...','new','Dry\x20run\x20-\x20no\x20changes\x20made','Status:\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x20\x20Prompts:\x20','\x0aPush\x20','Project:\x20','Dry\x20run\x20-\x20no\x20files\x20written','counts','Errors:','\x20\x20Text\x20Knowledge\x20Base\x20\x22','outputPath','\x0aPull\x20summary\x20for\x20\x27','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)','agents','\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)','MISSING_ARGUMENT','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Would\x20pull\x20agent:\x20','\x0aPush\x20summary\x20for\x20\x27','Using\x20current\x20project:\x20','projectId','INVALID_ARGUMENT','\x0a✔\x20Pulled\x20','4941769MewSwf','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x20resources\x20to\x20\x27','session','green','\x20changed','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','error','force','Using\x20project\x20from\x20','agent:pull','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','✔\x20Context\x20set:\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','527848OnBMum','isNew','New\x20project\x20ID:\x20','log','llm','repeat','Writing\x20files...','Using\x20project:\x20','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'];a4_0x2075=function(){return _0x5e4762;};return a4_0x2075();}import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0xd73551){const _0x58d475=a4_0x3a88,_0x18d0e3=[];if(_0xd73551[_0x58d475(0xef)]!==undefined)_0x18d0e3['push'](_0xd73551[_0x58d475(0xef)]+_0x58d475(0x94));if(_0xd73551[_0x58d475(0x105)]!==undefined&&_0xd73551[_0x58d475(0x105)]>0x0)_0x18d0e3[_0x58d475(0xf2)](a4_0x5c6107[_0x58d475(0x121)](_0xd73551['new']+_0x58d475(0x9d)));if(_0xd73551[_0x58d475(0xa8)]!==undefined&&_0xd73551['created']>0x0)_0x18d0e3[_0x58d475(0xf2)](a4_0x5c6107[_0x58d475(0x121)](_0xd73551[_0x58d475(0xa8)]+_0x58d475(0xf7)));if(_0xd73551[_0x58d475(0xaa)]!==undefined&&_0xd73551[_0x58d475(0xaa)]>0x0)_0x18d0e3['push'](a4_0x5c6107[_0x58d475(0xb1)](_0xd73551['updated']+_0x58d475(0xa7)));if(_0xd73551[_0x58d475(0xd6)]!==undefined&&_0xd73551[_0x58d475(0xd6)]>0x0)_0x18d0e3[_0x58d475(0xf2)](a4_0x5c6107[_0x58d475(0x101)](_0xd73551[_0x58d475(0xd6)]+_0x58d475(0x92)));if(_0xd73551[_0x58d475(0x9b)]!==undefined&&_0xd73551[_0x58d475(0x9b)]>0x0)_0x18d0e3[_0x58d475(0xf2)](a4_0x5c6107['red'](_0xd73551[_0x58d475(0x9b)]+'\x20errors'));return _0x18d0e3['join'](',\x20');}function displayDiffs(_0x59b341,_0x13c986,_0x2869e4,_0x49abb9){const _0x5ed355=a4_0x3a88;for(const _0x5f0f95 of _0x59b341){if(_0x5f0f95['diff']){const _0x237f73=_0x5f0f95['agentName']||_0x5f0f95['name'];console[_0x5ed355(0x12e)]('\x0aChanges\x20to\x20agent\x20\x27'+_0x237f73+'\x27:'),console[_0x5ed355(0x12e)]('─'['repeat'](0x3c)),console[_0x5ed355(0x12e)](_0x5f0f95[_0x5ed355(0xa5)]),console[_0x5ed355(0x12e)]('─'[_0x5ed355(0x130)](0x3c));}}for(const _0x280261 of _0x13c986){_0x280261[_0x5ed355(0xa5)]&&(console[_0x5ed355(0x12e)](_0x5ed355(0xf6)+_0x280261[_0x5ed355(0xd5)]+'\x27:'),console[_0x5ed355(0x12e)]('─'['repeat'](0x3c)),console['log'](_0x280261[_0x5ed355(0xa5)]),console[_0x5ed355(0x12e)]('─'['repeat'](0x3c)));}for(const _0x3ee5a3 of _0x2869e4){_0x3ee5a3[_0x5ed355(0xa5)]&&(console['log']('\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27'+_0x3ee5a3[_0x5ed355(0xd5)]+'\x27:'),console[_0x5ed355(0x12e)]('─'[_0x5ed355(0x130)](0x3c)),console['log'](_0x3ee5a3[_0x5ed355(0xa5)]),console[_0x5ed355(0x12e)]('─'['repeat'](0x3c)));}for(const _0x2f6cac of _0x49abb9){_0x2f6cac['diff']&&(console['log'](_0x5ed355(0xb7)+_0x2f6cac[_0x5ed355(0xd5)]+'\x27:'),console[_0x5ed355(0x12e)]('─'[_0x5ed355(0x130)](0x3c)),console['log'](_0x2f6cac[_0x5ed355(0xa5)]),console[_0x5ed355(0x12e)]('─'['repeat'](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x30dd8c(0xd5)]=a4_0x30dd8c(0x127);['description']=a4_0x30dd8c(0xb8);async[a4_0x30dd8c(0xc6)](_0x2b30b1){const _0x53e2a7=a4_0x30dd8c,{options:_0x11d0ae,args:_0x301514,tdx:_0x3639e0}=_0x2b30b1,_0x4ec522=_0x301514[0x0],_0x10a636=_0x301514[0x1],_0x54d543=_0x11d0ae[_0x53e2a7(0xe2)],_0xe1f302=_0x11d0ae[_0x53e2a7(0xcd)],_0x3cf225=_0x11d0ae['force'],_0xc581cf=_0x11d0ae[_0x53e2a7(0xa6)],_0x3d1f63=_0x11d0ae[_0x53e2a7(0xb3)];let _0x3decd2,_0x14b836;const _0x46334a=findAgentConfigPath(process[_0x53e2a7(0xdb)]());if(_0x4ec522){const _0x12fd1d=a4_0x28c9fb[_0x53e2a7(0xcc)](_0x4ec522,_0x53e2a7(0xe4));if(existsSync(_0x12fd1d))try{const _0x88c3ee=JSON['parse'](readFileSync(_0x12fd1d,'utf-8'));_0x3decd2=_0x88c3ee['llm_project'],_0x14b836=_0x4ec522,console['log'](a4_0x5c6107['dim'](_0x53e2a7(0x126)+_0x12fd1d+':\x20'+_0x3decd2));}catch{_0x3decd2=_0x4ec522;}else _0x3decd2=_0x4ec522;}else{if(_0x46334a)try{const _0x2b9b7f=JSON['parse'](readFileSync(_0x46334a,'utf-8'));_0x3decd2=_0x2b9b7f[_0x53e2a7(0x91)],_0x14b836=a4_0x28c9fb[_0x53e2a7(0xbe)](_0x46334a),console[_0x53e2a7(0x12e)](a4_0x5c6107[_0x53e2a7(0xed)]('Using\x20project:\x20'+_0x3decd2));}catch{_0x3decd2=_0x3d1f63;}else _0x3decd2=_0x3d1f63;}if(!_0x3decd2)return console[_0x53e2a7(0x12e)](a4_0x5c6107[_0x53e2a7(0xb1)](_0x53e2a7(0x128))),console[_0x53e2a7(0x12e)](_0x53e2a7(0x112)),console[_0x53e2a7(0x12e)](_0x53e2a7(0xc7)),console[_0x53e2a7(0x12e)](_0x53e2a7(0xe1)),console['log'](_0x53e2a7(0xc3)),0x1;if(_0x10a636){const {data:_0x10d920}=await withSpinner('Pulling\x20agent\x20\x22'+_0x10a636+_0x53e2a7(0xce)+_0x3decd2+'\x22...',()=>_0x3639e0[_0x53e2a7(0x12f)][_0x53e2a7(0xc5)](_0x3decd2,_0x10a636,_0x54d543,{'dryRun':_0xe1f302,'force':_0x3cf225}));if(_0xe1f302)return console['log'](a4_0x5c6107[_0x53e2a7(0xb1)](_0x53e2a7(0x10c))),console[_0x53e2a7(0x12e)](_0x53e2a7(0x117)+_0x10d920['agentName']),console[_0x53e2a7(0x12e)]('Output\x20path:\x20'+_0x10d920[_0x53e2a7(0x110)]),_0x10d920[_0x53e2a7(0xa5)]&&(console['log'](_0x53e2a7(0xaf)),console[_0x53e2a7(0x12e)]('─'['repeat'](0x3c)),console['log'](_0x10d920['diff']),console[_0x53e2a7(0x12e)]('─'[_0x53e2a7(0x130)](0x3c))),0x0;return console['log'](a4_0x5c6107[_0x53e2a7(0x121)](_0x53e2a7(0x9e))),console[_0x53e2a7(0x12e)](_0x53e2a7(0xa9)+_0x10d920[_0x53e2a7(0xb2)]),console['log'](_0x53e2a7(0xb9)+_0x10d920[_0x53e2a7(0x110)]),console[_0x53e2a7(0x12e)](_0x53e2a7(0x107)+(_0x10d920[_0x53e2a7(0x12c)]?a4_0x5c6107['green']('new'):_0x10d920['hasChanges']?a4_0x5c6107[_0x53e2a7(0xb1)]('updated'):a4_0x5c6107[_0x53e2a7(0x101)](_0x53e2a7(0xd6)))),0x0;}const _0x1e8d5f=_0x14b836||_0x54d543,{data:_0x3b0f21}=await withSpinner(_0x53e2a7(0xfb)+_0x3decd2+'\x22...',()=>_0x3639e0[_0x53e2a7(0x12f)][_0x53e2a7(0xbd)](_0x3decd2,_0x1e8d5f,{'dryRun':!![]})),_0x2c4d82=_0x3b0f21['counts']['agents']['new']+_0x3b0f21[_0x53e2a7(0x10d)][_0x53e2a7(0xfa)]['new']+_0x3b0f21[_0x53e2a7(0x10d)]['textKnowledgeBases'][_0x53e2a7(0x105)]+_0x3b0f21[_0x53e2a7(0x10d)][_0x53e2a7(0x99)][_0x53e2a7(0x105)],_0x423add=_0x3b0f21[_0x53e2a7(0x10d)][_0x53e2a7(0x113)][_0x53e2a7(0xaa)]+_0x3b0f21[_0x53e2a7(0x10d)]['knowledgeBases']['updated']+_0x3b0f21[_0x53e2a7(0x10d)][_0x53e2a7(0xe0)]['updated']+_0x3b0f21[_0x53e2a7(0x10d)][_0x53e2a7(0x99)][_0x53e2a7(0xaa)],_0x4e819c=_0x3b0f21[_0x53e2a7(0x10d)][_0x53e2a7(0x113)][_0x53e2a7(0xd6)]+_0x3b0f21[_0x53e2a7(0x10d)][_0x53e2a7(0xfa)][_0x53e2a7(0xd6)]+_0x3b0f21['counts']['textKnowledgeBases'][_0x53e2a7(0xd6)]+_0x3b0f21['counts'][_0x53e2a7(0x99)][_0x53e2a7(0xd6)];console[_0x53e2a7(0x12e)](_0x53e2a7(0x111)+_0x3b0f21['projectName']+'\x27:'),console['log']('\x20\x20'+a4_0x5c6107[_0x53e2a7(0x121)]('+\x20'+_0x2c4d82+_0x53e2a7(0x9d))+_0x53e2a7(0xa0)+a4_0x5c6107[_0x53e2a7(0xb1)]('~\x20'+_0x423add+_0x53e2a7(0x122))+_0x53e2a7(0xa0)+a4_0x5c6107[_0x53e2a7(0xed)]('=\x20'+_0x4e819c+_0x53e2a7(0x92))),console[_0x53e2a7(0x12e)](_0x53e2a7(0x90)+formatCountSummary(_0x3b0f21['counts'][_0x53e2a7(0x113)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x3b0f21['counts'][_0x53e2a7(0xfa)])),console[_0x53e2a7(0x12e)](_0x53e2a7(0xb4)+formatCountSummary(_0x3b0f21[_0x53e2a7(0x10d)][_0x53e2a7(0xe0)])),console[_0x53e2a7(0x12e)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x3b0f21['counts']['prompts'])),console[_0x53e2a7(0x12e)]('\x20\x20Target:\x20'+a4_0x5c6107[_0x53e2a7(0xeb)](_0x3b0f21[_0x53e2a7(0xd2)])),displayDiffs(_0x3b0f21['agents'],_0x3b0f21[_0x53e2a7(0xfa)],_0x3b0f21[_0x53e2a7(0xe0)],_0x3b0f21['prompts']);if(_0xe1f302)return console[_0x53e2a7(0x12e)](a4_0x5c6107['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x2c4d82===0x0&&_0x423add===0x0)return console[_0x53e2a7(0x12e)](a4_0x5c6107['green'](_0x53e2a7(0x123))),saveSessionContext({'llm_project':_0x3b0f21[_0x53e2a7(0xd7)]},_0x11d0ae[_0x53e2a7(0x120)]),console[_0x53e2a7(0x12e)](a4_0x5c6107['green']('✔\x20Context\x20set:\x20'+a4_0x5c6107['dim'](_0x53e2a7(0x91))+_0x53e2a7(0xee)+a4_0x5c6107[_0x53e2a7(0xeb)](_0x3b0f21[_0x53e2a7(0xd7)]))),0x0;if(!_0xc581cf&&!_0x3cf225){const _0x1e6c22=await confirmKey(_0x53e2a7(0xdd)+(_0x2c4d82+_0x423add)+'\x20files?');if(!_0x1e6c22)return console[_0x53e2a7(0x12e)](_0x53e2a7(0xa2)),0x0;}const {data:_0x1a19be}=await withSpinner(_0x53e2a7(0x131),()=>_0x3639e0['llm'][_0x53e2a7(0xbd)](_0x3decd2,_0x1e8d5f,{'force':_0x3cf225}));return console[_0x53e2a7(0x12e)](a4_0x5c6107[_0x53e2a7(0x121)](_0x53e2a7(0x11c)+(_0x2c4d82+_0x423add)+_0x53e2a7(0x102)+_0x1a19be[_0x53e2a7(0xd2)])),saveSessionContext({'llm_project':_0x1a19be[_0x53e2a7(0xd7)]},_0x11d0ae[_0x53e2a7(0x120)]),console[_0x53e2a7(0x12e)](a4_0x5c6107[_0x53e2a7(0x121)](_0x53e2a7(0x129)+a4_0x5c6107[_0x53e2a7(0xed)](_0x53e2a7(0x91))+_0x53e2a7(0xee)+a4_0x5c6107[_0x53e2a7(0xeb)](_0x1a19be['projectName']))),0x0;}}export class AgentCloneCommand extends BaseCommand{['name']=a4_0x30dd8c(0x9a);[a4_0x30dd8c(0xbb)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async[a4_0x30dd8c(0xc6)](_0x20bb5b){const _0xf0e2ba=a4_0x30dd8c,{options:_0x5cf9a2,args:_0x899dd2,tdx:_0xb5adc7}=_0x20bb5b,_0x321a5b=_0x899dd2[0x0],_0x49493f=_0x5cf9a2[_0xf0e2ba(0xd5)],_0x4282b8=_0x5cf9a2['dryRun'],_0x5c107c=_0x5cf9a2['yes'],_0x5d064c=_0x5cf9a2['site'],_0x59960b=_0x5cf9a2[_0xf0e2ba(0xb3)];let _0x4967d2;const _0x4e0f33=findAgentConfigPath(process['cwd']());if(_0x321a5b){const _0x31bb89=a4_0x28c9fb['join'](_0x321a5b,'tdx.json');existsSync(_0x31bb89)?(_0x4967d2=_0x321a5b,console['log'](a4_0x5c6107[_0xf0e2ba(0xed)](_0xf0e2ba(0x95)+_0x321a5b))):_0x4967d2=_0x321a5b;}else{if(_0x4e0f33)_0x4967d2=a4_0x28c9fb['dirname'](_0x4e0f33),console[_0xf0e2ba(0x12e)](a4_0x5c6107[_0xf0e2ba(0xed)](_0xf0e2ba(0x119)+_0x4967d2));else{if(_0x59960b){const _0x4e48ab=normalizeName(_0x59960b),_0x1f0328=a4_0x28c9fb[_0xf0e2ba(0xcc)](process[_0xf0e2ba(0xdb)](),_0xf0e2ba(0x113),_0x4e48ab,_0xf0e2ba(0xe4));if(existsSync(_0x1f0328))_0x4967d2=a4_0x28c9fb['dirname'](_0x1f0328),console[_0xf0e2ba(0x12e)](a4_0x5c6107[_0xf0e2ba(0xed)](_0xf0e2ba(0x95)+_0x4967d2));else{const _0x16844c=_0x5cf9a2[_0xf0e2ba(0xc2)];if(_0x16844c)throw new SDKError(ErrorCode[_0xf0e2ba(0x11b)],_0xf0e2ba(0xd1)+_0x59960b+_0xf0e2ba(0xfd),undefined,{'helpText':'When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a'+'First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a'+(_0xf0e2ba(0x103)+_0x59960b+'\x0a')+(_0xf0e2ba(0xc0)+_0x4e48ab+_0xf0e2ba(0xc1)+(_0x49493f||'<new-name>')+_0xf0e2ba(0xa1)+_0x16844c)});_0x4967d2=_0x59960b,console[_0xf0e2ba(0x12e)](a4_0x5c6107['dim'](_0xf0e2ba(0xda)+_0x59960b));}}}}if(!_0x4967d2)return console['log'](a4_0x5c6107[_0xf0e2ba(0xb1)](_0xf0e2ba(0x108))),console[_0xf0e2ba(0x12e)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console['log'](_0xf0e2ba(0x11e)),console[_0xf0e2ba(0x12e)](_0xf0e2ba(0x114)),console[_0xf0e2ba(0x12e)](_0xf0e2ba(0x133)),0x1;if(!_0x49493f)throw new SDKError(ErrorCode[_0xf0e2ba(0x115)],_0xf0e2ba(0xf9),undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x5c107c&&!_0x4282b8){const _0x9b6c59=await confirmKey(_0xf0e2ba(0x9c)+_0x4967d2+_0xf0e2ba(0xbc)+_0x49493f+'\x22?');if(!_0x9b6c59)return console['log'](_0xf0e2ba(0xec)),0x0;}const {data:_0x47722f}=await withSpinner(_0xf0e2ba(0x97)+_0x4967d2+_0xf0e2ba(0xdf)+_0x49493f+_0xf0e2ba(0xff),()=>_0xb5adc7[_0xf0e2ba(0x12f)][_0xf0e2ba(0xf5)](_0x4967d2,_0x49493f,{'dryRun':_0x4282b8}));if(_0x4282b8)return console[_0xf0e2ba(0x12e)](a4_0x5c6107['yellow'](_0xf0e2ba(0x106))),console[_0xf0e2ba(0x12e)](_0xf0e2ba(0xe3)+_0x47722f[_0xf0e2ba(0xe6)]),console[_0xf0e2ba(0x12e)]('New\x20project:\x20'+_0x49493f),console[_0xf0e2ba(0x12e)](_0xf0e2ba(0xc9)),console['log']('\x20\x20Agents:\x20'+_0x47722f['counts'][_0xf0e2ba(0x113)]['created']),console['log'](_0xf0e2ba(0xe5)+_0x47722f['counts'][_0xf0e2ba(0xfa)][_0xf0e2ba(0xa8)]),console[_0xf0e2ba(0x12e)]('\x20\x20Prompts:\x20'+_0x47722f[_0xf0e2ba(0x10d)][_0xf0e2ba(0x99)][_0xf0e2ba(0xa8)]),0x0;const _0x437bc2=_0x47722f[_0xf0e2ba(0x10d)]['agents'][_0xf0e2ba(0x9b)]>0x0||_0x47722f['counts'][_0xf0e2ba(0xfa)][_0xf0e2ba(0x9b)]>0x0||_0x47722f[_0xf0e2ba(0x10d)]['prompts']['errors']>0x0;_0x437bc2?console[_0xf0e2ba(0x12e)](a4_0x5c6107[_0xf0e2ba(0xb1)](_0xf0e2ba(0xcf))):console[_0xf0e2ba(0x12e)](a4_0x5c6107[_0xf0e2ba(0x121)]('Project\x20cloned\x20successfully'));console[_0xf0e2ba(0x12e)](_0xf0e2ba(0xe3)+_0x47722f[_0xf0e2ba(0xe6)]),console[_0xf0e2ba(0x12e)]('New\x20project:\x20'+_0x47722f['newProjectName']),console[_0xf0e2ba(0x12e)](_0xf0e2ba(0x12d)+_0x47722f[_0xf0e2ba(0xd3)]),console[_0xf0e2ba(0x12e)](),console['log'](_0xf0e2ba(0xdc)),console['log'](_0xf0e2ba(0x90)+formatCountSummary(_0x47722f[_0xf0e2ba(0x10d)][_0xf0e2ba(0x113)])),console[_0xf0e2ba(0x12e)](_0xf0e2ba(0xe5)+formatCountSummary(_0x47722f[_0xf0e2ba(0x10d)][_0xf0e2ba(0xfa)])),console[_0xf0e2ba(0x12e)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x47722f[_0xf0e2ba(0x10d)][_0xf0e2ba(0x99)]));if(_0x437bc2){console[_0xf0e2ba(0x12e)](),console['log'](a4_0x5c6107['red']('Errors:'));for(const _0x4be43c of _0x47722f['agents']){_0x4be43c['action']===_0xf0e2ba(0x124)&&console[_0xf0e2ba(0x12e)](a4_0x5c6107['red']('\x20\x20Agent\x20\x22'+_0x4be43c[_0xf0e2ba(0xb2)]+_0xf0e2ba(0xd8)+_0x4be43c[_0xf0e2ba(0x124)]));}for(const _0x566a0b of _0x47722f['knowledgeBases']){_0x566a0b[_0xf0e2ba(0xd9)]===_0xf0e2ba(0x124)&&console[_0xf0e2ba(0x12e)](a4_0x5c6107[_0xf0e2ba(0xcb)](_0xf0e2ba(0xab)+_0x566a0b[_0xf0e2ba(0xd5)]+_0xf0e2ba(0xd8)+_0x566a0b['error']));}for(const _0x2651c5 of _0x47722f[_0xf0e2ba(0x99)]){_0x2651c5[_0xf0e2ba(0xd9)]==='error'&&console[_0xf0e2ba(0x12e)](a4_0x5c6107[_0xf0e2ba(0xcb)](_0xf0e2ba(0xae)+_0x2651c5[_0xf0e2ba(0xd5)]+_0xf0e2ba(0xd8)+_0x2651c5[_0xf0e2ba(0x124)]));}return 0x1;}console['log']();const _0x24cfe3=getLLMProjectUrl(_0x5d064c,_0x47722f[_0xf0e2ba(0xd3)]);return console[_0xf0e2ba(0x12e)](_0xf0e2ba(0x10b)+a4_0x5c6107[_0xf0e2ba(0xeb)](_0x24cfe3)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x30dd8c(0xd5)]=a4_0x30dd8c(0x93);[a4_0x30dd8c(0xbb)]=a4_0x30dd8c(0x116);async[a4_0x30dd8c(0xc6)](_0x82d052){const _0x1433df=a4_0x30dd8c,{options:_0x32df49,args:_0x739958,tdx:_0x34f5a6}=_0x82d052;let _0x1b2f71=_0x739958[0x0]||process['cwd']();const _0x45bea7=_0x32df49[_0x1433df(0xcd)],_0x35afeb=_0x32df49[_0x1433df(0x125)],_0x4a7c3f=_0x32df49['yes'],_0x2ee20c=_0x32df49[_0x1433df(0xa4)],_0x35a315=a4_0x28c9fb['join'](_0x1b2f71,'agent.yml'),_0x329d82=existsSync(_0x35a315);if(_0x329d82){const {data:_0x59da0e}=await withSpinner(_0x1433df(0xad)+_0x1b2f71+'\x22...',()=>_0x34f5a6[_0x1433df(0x12f)]['pushAgent'](_0x1b2f71,{'dryRun':_0x45bea7,'force':_0x35afeb}));if(_0x45bea7)return console[_0x1433df(0x12e)](a4_0x5c6107['yellow'](_0x1433df(0x106))),console[_0x1433df(0x12e)](_0x1433df(0xd0)+_0x59da0e['agentName']),0x0;if(_0x59da0e[_0x1433df(0xd9)]===_0x1433df(0x124))return console[_0x1433df(0x12e)](a4_0x5c6107[_0x1433df(0xcb)](_0x1433df(0x96)+_0x59da0e[_0x1433df(0x124)])),0x1;console[_0x1433df(0x12e)](a4_0x5c6107[_0x1433df(0x121)](_0x1433df(0xd4)+_0x59da0e[_0x1433df(0xd9)]+_0x1433df(0xe8))),console[_0x1433df(0x12e)](_0x1433df(0xa9)+_0x59da0e[_0x1433df(0xb2)]);if(_0x59da0e[_0x1433df(0xfe)]&&_0x59da0e[_0x1433df(0x11a)]){const _0x4abe7c=getLLMAgentChatUrl(_0x2ee20c,_0x59da0e[_0x1433df(0x11a)],_0x59da0e[_0x1433df(0xfe)]);console[_0x1433df(0x12e)](_0x1433df(0x100)+a4_0x5c6107[_0x1433df(0xeb)](_0x4abe7c));}return 0x0;}let _0x36a90d=a4_0x28c9fb['join'](_0x1b2f71,_0x1433df(0xe4));if(!existsSync(_0x36a90d)){const _0x2c3474=findAgentConfigPath(_0x1b2f71);if(_0x2c3474)_0x1b2f71=a4_0x28c9fb[_0x1433df(0xbe)](_0x2c3474),_0x36a90d=_0x2c3474,console[_0x1433df(0x12e)](a4_0x5c6107[_0x1433df(0xed)](_0x1433df(0x132)+_0x1b2f71));else{const _0x2f5774=_0x32df49[_0x1433df(0xb3)];if(_0x2f5774){const _0x440a5f=normalizeName(_0x2f5774),_0x251196=a4_0x28c9fb[_0x1433df(0xcc)](_0x1b2f71,_0x1433df(0x113)),_0x388077=a4_0x28c9fb[_0x1433df(0xcc)](_0x251196,_0x440a5f,_0x1433df(0xe4));existsSync(_0x388077)&&(_0x1b2f71=a4_0x28c9fb[_0x1433df(0xbe)](_0x388077),_0x36a90d=_0x388077,console[_0x1433df(0x12e)](a4_0x5c6107[_0x1433df(0xed)](_0x1433df(0x132)+_0x1b2f71)));}if(!existsSync(_0x36a90d)){let _0x6e0f68=_0x1433df(0xac);_0x2f5774&&(_0x6e0f68='Current\x20context\x20has\x20llm_project=\x22'+_0x2f5774+_0x1433df(0xfc)+(_0x1433df(0xf3)+_0x2f5774+_0x1433df(0x12a)));throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1433df(0xf1)+_0x1b2f71,undefined,{'helpText':_0x6e0f68});}}}const {data:_0x2d205f}=await withSpinner(_0x1433df(0x104),()=>_0x34f5a6[_0x1433df(0x12f)][_0x1433df(0xba)](_0x1b2f71,{'dryRun':!![]})),_0x5a0ad8=_0x2d205f[_0x1433df(0x10d)][_0x1433df(0x113)][_0x1433df(0x9b)]>0x0;if(_0x5a0ad8){console[_0x1433df(0x12e)](a4_0x5c6107['red'](_0x1433df(0xb6)));for(const _0x5dcead of _0x2d205f[_0x1433df(0x113)]){_0x5dcead[_0x1433df(0xd9)]===_0x1433df(0x124)&&console['log'](a4_0x5c6107['red'](_0x1433df(0xb5)+_0x5dcead['agentName']+_0x1433df(0xd8)+_0x5dcead[_0x1433df(0x124)]));}return 0x1;}const _0x40b232=_0x2d205f[_0x1433df(0x10d)]['agents'][_0x1433df(0xa8)]+_0x2d205f[_0x1433df(0x10d)][_0x1433df(0xfa)][_0x1433df(0xa8)]+_0x2d205f['counts'][_0x1433df(0xe0)][_0x1433df(0xa8)]+_0x2d205f[_0x1433df(0x10d)][_0x1433df(0x99)][_0x1433df(0xa8)],_0x3a81ae=_0x2d205f[_0x1433df(0x10d)][_0x1433df(0x113)][_0x1433df(0xaa)]+_0x2d205f[_0x1433df(0x10d)]['knowledgeBases']['updated']+_0x2d205f['counts'][_0x1433df(0xe0)]['updated']+_0x2d205f[_0x1433df(0x10d)][_0x1433df(0x99)][_0x1433df(0xaa)],_0x3a5fe1=_0x2d205f[_0x1433df(0x10d)][_0x1433df(0x113)][_0x1433df(0xd6)]+_0x2d205f[_0x1433df(0x10d)][_0x1433df(0xfa)][_0x1433df(0xd6)]+_0x2d205f[_0x1433df(0x10d)]['textKnowledgeBases'][_0x1433df(0xd6)]+_0x2d205f['counts'][_0x1433df(0x99)][_0x1433df(0xd6)];console[_0x1433df(0x12e)](_0x1433df(0x118)+_0x2d205f['projectName']+'\x27:'),console[_0x1433df(0x12e)]('\x20\x20'+a4_0x5c6107['green']('+\x20'+_0x40b232+_0x1433df(0x9d))+_0x1433df(0xa0)+a4_0x5c6107[_0x1433df(0xb1)]('~\x20'+_0x3a81ae+_0x1433df(0x122))+'\x20|\x20'+a4_0x5c6107[_0x1433df(0xed)]('=\x20'+_0x3a5fe1+_0x1433df(0x92))),console[_0x1433df(0x12e)](_0x1433df(0x90)+formatCountSummary(_0x2d205f[_0x1433df(0x10d)]['agents'])),console[_0x1433df(0x12e)](_0x1433df(0xe5)+formatCountSummary(_0x2d205f['counts'][_0x1433df(0xfa)])),console[_0x1433df(0x12e)](_0x1433df(0xb4)+formatCountSummary(_0x2d205f[_0x1433df(0x10d)][_0x1433df(0xe0)])),console[_0x1433df(0x12e)](_0x1433df(0x109)+formatCountSummary(_0x2d205f[_0x1433df(0x10d)][_0x1433df(0x99)])),console[_0x1433df(0x12e)](_0x1433df(0xe7)+a4_0x5c6107[_0x1433df(0xeb)](_0x1b2f71)),displayDiffs(_0x2d205f[_0x1433df(0x113)],_0x2d205f['knowledgeBases'],_0x2d205f[_0x1433df(0xe0)],_0x2d205f[_0x1433df(0x99)]);if(_0x45bea7)return console['log'](a4_0x5c6107['yellow'](_0x1433df(0x9f))),0x0;if(_0x40b232===0x0&&_0x3a81ae===0x0){console[_0x1433df(0x12e)](a4_0x5c6107['green'](_0x1433df(0xf0)));const _0x3b52fd=getLLMProjectUrl(_0x2ee20c,_0x2d205f[_0x1433df(0x11a)]);return console[_0x1433df(0x12e)](_0x1433df(0x10b)+a4_0x5c6107[_0x1433df(0xeb)](_0x3b52fd)),0x0;}if(!_0x4a7c3f&&!_0x35afeb){const _0x5bfd23=await confirmKey(_0x1433df(0x10a)+(_0x40b232+_0x3a81ae)+'\x20resources?');if(!_0x5bfd23)return console['log'](_0x1433df(0xe9)),0x0;}const {data:_0x24605e}=await withSpinner(_0x1433df(0x98),()=>_0x34f5a6['llm'][_0x1433df(0xba)](_0x1b2f71,{'force':_0x35afeb})),_0x493858=_0x24605e['counts']['agents']['errors']>0x0||_0x24605e['counts']['knowledgeBases'][_0x1433df(0x9b)]>0x0||_0x24605e[_0x1433df(0x10d)][_0x1433df(0xe0)][_0x1433df(0x9b)]>0x0||_0x24605e[_0x1433df(0x10d)][_0x1433df(0x99)][_0x1433df(0x9b)]>0x0;if(_0x493858){console['log'](a4_0x5c6107[_0x1433df(0xb1)]('\x0aProject\x20pushed\x20with\x20errors')),console[_0x1433df(0x12e)](),console[_0x1433df(0x12e)](a4_0x5c6107[_0x1433df(0xcb)](_0x1433df(0x10e)));for(const _0x17318e of _0x24605e[_0x1433df(0x113)]){_0x17318e['action']===_0x1433df(0x124)&&console[_0x1433df(0x12e)](a4_0x5c6107[_0x1433df(0xcb)]('\x20\x20Agent\x20\x22'+_0x17318e[_0x1433df(0xb2)]+_0x1433df(0xd8)+_0x17318e[_0x1433df(0x124)]));}for(const _0x4f1aa6 of _0x24605e[_0x1433df(0xfa)]){_0x4f1aa6[_0x1433df(0xd9)]===_0x1433df(0x124)&&console[_0x1433df(0x12e)](a4_0x5c6107[_0x1433df(0xcb)](_0x1433df(0xab)+_0x4f1aa6[_0x1433df(0xd5)]+_0x1433df(0xd8)+_0x4f1aa6[_0x1433df(0x124)]));}for(const _0x42f63b of _0x24605e[_0x1433df(0xe0)]){_0x42f63b[_0x1433df(0xd9)]==='error'&&console[_0x1433df(0x12e)](a4_0x5c6107['red'](_0x1433df(0x10f)+_0x42f63b[_0x1433df(0xd5)]+_0x1433df(0xd8)+_0x42f63b['error']));}for(const _0x5eb8d0 of _0x24605e[_0x1433df(0x99)]){_0x5eb8d0[_0x1433df(0xd9)]===_0x1433df(0x124)&&console[_0x1433df(0x12e)](a4_0x5c6107['red']('\x20\x20Prompt\x20\x22'+_0x5eb8d0['name']+'\x22:\x20'+_0x5eb8d0[_0x1433df(0x124)]));}return 0x1;}console[_0x1433df(0x12e)](a4_0x5c6107[_0x1433df(0x121)](_0x1433df(0xc4)+(_0x40b232+_0x3a81ae)+_0x1433df(0x11f)+_0x24605e[_0x1433df(0xd7)]+'\x27'));const _0x418a3c=getLLMProjectUrl(_0x2ee20c,_0x24605e[_0x1433df(0x11a)]);return console['log'](_0x1433df(0x10b)+a4_0x5c6107[_0x1433df(0xeb)](_0x418a3c)),0x0;}}
@@ -1 +1 @@
1
- const a5_0x25791d=a5_0x25cd;(function(_0x4a2110,_0x580c4f){const _0x525d82=a5_0x25cd,_0x2ca29b=_0x4a2110();while(!![]){try{const _0x283d18=parseInt(_0x525d82(0x133))/0x1*(parseInt(_0x525d82(0x118))/0x2)+parseInt(_0x525d82(0x145))/0x3+-parseInt(_0x525d82(0x126))/0x4+parseInt(_0x525d82(0x10f))/0x5+parseInt(_0x525d82(0x123))/0x6+-parseInt(_0x525d82(0x110))/0x7+-parseInt(_0x525d82(0x11d))/0x8;if(_0x283d18===_0x580c4f)break;else _0x2ca29b['push'](_0x2ca29b['shift']());}catch(_0x150951){_0x2ca29b['push'](_0x2ca29b['shift']());}}}(a5_0x6afd,0x21691));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';function a5_0x25cd(_0x38a4d7,_0x20c391){_0x38a4d7=_0x38a4d7-0x10e;const _0x6afd30=a5_0x6afd();let _0x25cd28=_0x6afd30[_0x38a4d7];return _0x25cd28;}import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a5_0x25791d(0x11c),'proxy-authorization',a5_0x25791d(0x12e),a5_0x25791d(0x12a),'set-cookie2','x-xsrf-token',a5_0x25791d(0x139),a5_0x25791d(0x134)]);function a5_0x6afd(){const _0x5da801=['5lDJLvQ','x-trino-user','site','GET','PATCH','trim','x-auth-token','PUT','Invalid\x20header\x20format:\x20\x22','output','keys','startsWith','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','error','length','execute','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','trino','341016ozxGwz','<\x20HTTP/1.1\x20','status','1122460RWYIbL','1011843aYForI','method','indexOf','stack','toUpperCase','header','\x0aStack\x20trace:\x0a','Error:\x20','105394MfIweZ','toLowerCase','join','type','authorization','4094624KgiGBB','color','entries','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','verbose','Invalid\x20HTTP\x20method:\x20','1292310ZmEhXv','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','api','95232YeQpdU','description','substring','has','set-cookie','cdp','log','data','cookie','file','message','headers','DELETE'];a5_0x6afd=function(){return _0x5da801;};return a5_0x6afd();}function isSensitiveHeader(_0x1dd445){const _0xc98760=a5_0x25791d;return SENSITIVE_HEADERS[_0xc98760(0x129)](_0x1dd445[_0xc98760(0x119)]());}function parseHeader(_0x376826){const _0x46fcba=a5_0x25791d,_0x2b0e22=_0x376826[_0x46fcba(0x112)](':');if(_0x2b0e22===-0x1)throw new Error(_0x46fcba(0x13b)+_0x376826+'\x22.\x20'+'Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22');const _0x5b185c=_0x376826[_0x46fcba(0x128)](0x0,_0x2b0e22)['trim'](),_0x3d5d4c=_0x376826['substring'](_0x2b0e22+0x1)[_0x46fcba(0x138)]();if(!_0x5b185c)throw new Error(_0x46fcba(0x124)+_0x376826+'\x22');return[_0x5b185c,_0x3d5d4c];}export class ApiCommand extends BaseCommand{['name']=a5_0x25791d(0x125);[a5_0x25791d(0x127)]=a5_0x25791d(0x120);['validate'](_0x31cba2){const _0x16c54c=a5_0x25791d,{args:_0x4b336b,options:_0xbd2b0c}=_0x31cba2,_0x46e81d=_0xbd2b0c;if(_0x4b336b[_0x16c54c(0x141)]===0x0)return _0x16c54c(0x13f);const _0x37ce98=_0x4b336b[0x0];if(!_0x37ce98[_0x16c54c(0x13e)]('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x37ce98;const _0x42a4a7=_0x46e81d['data'],_0x100050=_0x46e81d[_0x16c54c(0x12f)];if(_0x42a4a7&&_0x100050)return _0x16c54c(0x143);const _0x4829b3=_0x46e81d[_0x16c54c(0x111)]||_0x16c54c(0x136),_0x4d8b93=[_0x16c54c(0x136),'POST',_0x16c54c(0x13a),_0x16c54c(0x132),_0x16c54c(0x137)];if(!_0x4d8b93['includes'](_0x4829b3['toUpperCase']()))return _0x16c54c(0x122)+_0x4829b3+'.\x20Valid\x20methods:\x20'+_0x4d8b93[_0x16c54c(0x11a)](',\x20');const _0x5eb982=_0x46e81d[_0x16c54c(0x11b)]||'td',_0x14b1d1=['td',_0x16c54c(0x12b),'workflow',_0x16c54c(0x144),'llm','llm-proxy'];if(!_0x14b1d1['includes'](_0x5eb982))return'Invalid\x20API\x20type:\x20'+_0x5eb982+'.\x20Valid\x20types:\x20'+_0x14b1d1[_0x16c54c(0x11a)](',\x20');return undefined;}async[a5_0x25791d(0x142)](_0x4e79c4){const _0x1ca885=a5_0x25791d,{options:_0x525184,args:_0x3d60ae,tdx:_0x4d54c0}=_0x4e79c4,_0x3ccd01=_0x525184,_0x50e559=_0x3d60ae[0x0],_0x52f0c8=(_0x3ccd01['method']||_0x1ca885(0x136))[_0x1ca885(0x114)](),_0x365763=_0x3ccd01['data'],_0x59e15f=_0x3ccd01[_0x1ca885(0x12f)],_0x3f9b72=_0x3ccd01[_0x1ca885(0x115)],_0x50b689=_0x3ccd01[_0x1ca885(0x11b)]||'td';try{const _0x2d0caf={};if(_0x3f9b72){const _0x549ddc=Array['isArray'](_0x3f9b72)?_0x3f9b72:[_0x3f9b72];for(const _0x33688a of _0x549ddc){const [_0xa5be81,_0x5e82c0]=parseHeader(_0x33688a);_0x2d0caf[_0xa5be81]=_0x5e82c0;}}let _0x3cffdd;if(_0x365763)_0x3cffdd=_0x365763;else{if(_0x59e15f)try{_0x3cffdd=RawAPI['readBodyFromFile'](_0x59e15f);}catch(_0x590ea6){return console['error'](_0x1ca885(0x117)+(_0x590ea6 instanceof Error?_0x590ea6[_0x1ca885(0x130)]:String(_0x590ea6))),0x1;}}const _0x197f34={'method':_0x52f0c8,'apiType':_0x50b689,'includeHeaders':_0x525184[_0x1ca885(0x121)]};_0x3cffdd&&(_0x197f34['body']=_0x3cffdd);Object[_0x1ca885(0x13d)](_0x2d0caf)['length']>0x0&&(_0x197f34['headers']=_0x2d0caf);if(_0x525184['verbose']){const _0x1a3536=resolveSite(_0x525184[_0x1ca885(0x135)]),_0x57dfb1=getEndpoint(_0x1a3536,_0x50b689),_0x5089dc=''+_0x57dfb1+_0x50e559;console[_0x1ca885(0x140)]('>\x20'+_0x52f0c8+'\x20'+_0x5089dc);const _0x34541d=getAuthHeaders(_0x1a3536),_0x79f70={..._0x34541d,..._0x2d0caf};for(const [_0x48a3ac,_0x155361]of Object[_0x1ca885(0x11f)](_0x79f70)){!isSensitiveHeader(_0x48a3ac)&&console['error']('>\x20'+_0x48a3ac+':\x20'+_0x155361);}_0x3cffdd&&console[_0x1ca885(0x140)]('>'),console[_0x1ca885(0x140)]('');}const _0x486b45=await _0x4d54c0[_0x1ca885(0x125)]['request'](_0x50e559,_0x197f34);if(_0x525184[_0x1ca885(0x121)]&&_0x486b45['headers']){console[_0x1ca885(0x140)](_0x1ca885(0x146)+_0x486b45[_0x1ca885(0x10e)]);for(const [_0x1df116,_0x4d1d3b]of Object[_0x1ca885(0x11f)](_0x486b45[_0x1ca885(0x131)])){!isSensitiveHeader(_0x1df116)&&console[_0x1ca885(0x140)]('<\x20'+_0x1df116+':\x20'+_0x4d1d3b);}console[_0x1ca885(0x140)]('');}const _0x327c58=Boolean(_0x525184[_0x1ca885(0x13c)]),_0x494030={'color':_0x525184['color'],'noColor':_0x525184['noColor']||_0x327c58&&!_0x525184[_0x1ca885(0x11e)]},_0x2b42ac=colorizeJSON(_0x486b45[_0x1ca885(0x12d)],_0x494030);return _0x525184[_0x1ca885(0x13c)]?(writeFileSync(_0x525184['output'],_0x2b42ac),console['error']('Results\x20saved\x20to\x20'+_0x525184[_0x1ca885(0x13c)])):console[_0x1ca885(0x12c)](_0x2b42ac),0x0;}catch(_0x2fb638){return _0x2fb638 instanceof Error?(console[_0x1ca885(0x140)](_0x1ca885(0x117)+_0x2fb638['message']),_0x525184[_0x1ca885(0x121)]&&_0x2fb638[_0x1ca885(0x113)]&&console['error'](_0x1ca885(0x116)+_0x2fb638[_0x1ca885(0x113)])):console[_0x1ca885(0x140)](_0x1ca885(0x117)+String(_0x2fb638)),0x1;}}}
1
+ const a5_0x50a1ee=a5_0x27a8;(function(_0x4ed663,_0x587b39){const _0x167ac3=a5_0x27a8,_0x3ff507=_0x4ed663();while(!![]){try{const _0x45b28b=-parseInt(_0x167ac3(0x1fb))/0x1*(-parseInt(_0x167ac3(0x218))/0x2)+parseInt(_0x167ac3(0x22e))/0x3+parseInt(_0x167ac3(0x203))/0x4*(-parseInt(_0x167ac3(0x21f))/0x5)+parseInt(_0x167ac3(0x1ed))/0x6+parseInt(_0x167ac3(0x210))/0x7*(parseInt(_0x167ac3(0x20e))/0x8)+-parseInt(_0x167ac3(0x226))/0x9*(-parseInt(_0x167ac3(0x229))/0xa)+-parseInt(_0x167ac3(0x228))/0xb*(parseInt(_0x167ac3(0x1fc))/0xc);if(_0x45b28b===_0x587b39)break;else _0x3ff507['push'](_0x3ff507['shift']());}catch(_0x1d4670){_0x3ff507['push'](_0x3ff507['shift']());}}}(a5_0x3809,0x8967d));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';function a5_0x3809(){const _0x5cf6cc=['2785644MgZIMV','\x22.\x20','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','Endpoint\x20must\x20start\x20with\x20/:\x20','.\x20Valid\x20types:\x20','llm','substring','startsWith','3571590VJbChM','api','.\x20Valid\x20methods:\x20','verbose','Results\x20saved\x20to\x20','type','set-cookie2','workflow','toUpperCase','status','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','authorization','has','Invalid\x20HTTP\x20method:\x20','1083055HPZWQq','22368uspIjZ','trino','message','PUT','headers','request','log','3092BBZJpi','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','stack','file','x-trino-user','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','POST','name','PATCH','join','GET','136blJLHE','length','248213NUZTLy','body','readBodyFromFile','Invalid\x20header\x20format:\x20\x22','includes','proxy-authorization','set-cookie','Invalid\x20API\x20type:\x20','2fEZsHN','DELETE','data','execute','<\x20HTTP/1.1\x20','output','\x0aStack\x20trace:\x0a','6905KVqOzt','error','toLowerCase','description','color','llm-proxy','header','6235839sXOaxZ','cookie','13409XMAhkF','10ctJurz','Error:\x20','method','noColor','entries'];a5_0x3809=function(){return _0x5cf6cc;};return a5_0x3809();}import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a5_0x50a1ee(0x1f8),a5_0x50a1ee(0x215),a5_0x50a1ee(0x227),a5_0x50a1ee(0x216),a5_0x50a1ee(0x1f3),'x-xsrf-token','x-auth-token',a5_0x50a1ee(0x207)]);function a5_0x27a8(_0x4228e0,_0x23aabb){_0x4228e0=_0x4228e0-0x1e8;const _0x380966=a5_0x3809();let _0x27a80e=_0x380966[_0x4228e0];return _0x27a80e;}function isSensitiveHeader(_0x5621ad){const _0x2c1d02=a5_0x50a1ee;return SENSITIVE_HEADERS[_0x2c1d02(0x1f9)](_0x5621ad[_0x2c1d02(0x221)]());}function parseHeader(_0x3090ea){const _0xefa8cf=a5_0x50a1ee,_0x124a6f=_0x3090ea['indexOf'](':');if(_0x124a6f===-0x1)throw new Error(_0xefa8cf(0x213)+_0x3090ea+_0xefa8cf(0x22f)+'Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22');const _0x25d7e3=_0x3090ea[_0xefa8cf(0x1eb)](0x0,_0x124a6f)['trim'](),_0x43c225=_0x3090ea[_0xefa8cf(0x1eb)](_0x124a6f+0x1)['trim']();if(!_0x25d7e3)throw new Error(_0xefa8cf(0x208)+_0x3090ea+'\x22');return[_0x25d7e3,_0x43c225];}export class ApiCommand extends BaseCommand{[a5_0x50a1ee(0x20a)]=a5_0x50a1ee(0x1ee);[a5_0x50a1ee(0x222)]=a5_0x50a1ee(0x204);['validate'](_0xb68b51){const _0x5c8416=a5_0x50a1ee,{args:_0x4afdbf,options:_0x2f6bbb}=_0xb68b51,_0x1fc4f2=_0x2f6bbb;if(_0x4afdbf[_0x5c8416(0x20f)]===0x0)return _0x5c8416(0x230);const _0x4dbfcf=_0x4afdbf[0x0];if(!_0x4dbfcf[_0x5c8416(0x1ec)]('/'))return _0x5c8416(0x1e8)+_0x4dbfcf;const _0x396916=_0x1fc4f2[_0x5c8416(0x21a)],_0x3b0209=_0x1fc4f2[_0x5c8416(0x206)];if(_0x396916&&_0x3b0209)return _0x5c8416(0x1f7);const _0x1083d8=_0x1fc4f2[_0x5c8416(0x22b)]||_0x5c8416(0x20d),_0x433d98=['GET',_0x5c8416(0x209),_0x5c8416(0x1ff),_0x5c8416(0x219),_0x5c8416(0x20b)];if(!_0x433d98[_0x5c8416(0x214)](_0x1083d8[_0x5c8416(0x1f5)]()))return _0x5c8416(0x1fa)+_0x1083d8+_0x5c8416(0x1ef)+_0x433d98[_0x5c8416(0x20c)](',\x20');const _0x386b20=_0x1fc4f2['type']||'td',_0x331d95=['td','cdp',_0x5c8416(0x1f4),_0x5c8416(0x1fd),_0x5c8416(0x1ea),_0x5c8416(0x224)];if(!_0x331d95[_0x5c8416(0x214)](_0x386b20))return _0x5c8416(0x217)+_0x386b20+_0x5c8416(0x1e9)+_0x331d95[_0x5c8416(0x20c)](',\x20');return undefined;}async[a5_0x50a1ee(0x21b)](_0x5beed3){const _0x4f506b=a5_0x50a1ee,{options:_0x1db2d5,args:_0x782104,tdx:_0x1e0641}=_0x5beed3,_0xcebf96=_0x1db2d5,_0x4c8046=_0x782104[0x0],_0x4d732c=(_0xcebf96[_0x4f506b(0x22b)]||'GET')[_0x4f506b(0x1f5)](),_0x11f2db=_0xcebf96[_0x4f506b(0x21a)],_0x5c75b7=_0xcebf96[_0x4f506b(0x206)],_0x2c80cb=_0xcebf96[_0x4f506b(0x225)],_0x5d7f42=_0xcebf96[_0x4f506b(0x1f2)]||'td';try{const _0x42ad5f={};if(_0x2c80cb){const _0x3c6eff=Array['isArray'](_0x2c80cb)?_0x2c80cb:[_0x2c80cb];for(const _0x10e5f3 of _0x3c6eff){const [_0x1961bf,_0x19baa4]=parseHeader(_0x10e5f3);_0x42ad5f[_0x1961bf]=_0x19baa4;}}let _0x141b9c;if(_0x11f2db)_0x141b9c=_0x11f2db;else{if(_0x5c75b7)try{_0x141b9c=RawAPI[_0x4f506b(0x212)](_0x5c75b7);}catch(_0x535b54){return console[_0x4f506b(0x220)](_0x4f506b(0x22a)+(_0x535b54 instanceof Error?_0x535b54[_0x4f506b(0x1fe)]:String(_0x535b54))),0x1;}}const _0x5275e0={'method':_0x4d732c,'apiType':_0x5d7f42,'includeHeaders':_0x1db2d5[_0x4f506b(0x1f0)]};_0x141b9c&&(_0x5275e0[_0x4f506b(0x211)]=_0x141b9c);Object['keys'](_0x42ad5f)[_0x4f506b(0x20f)]>0x0&&(_0x5275e0['headers']=_0x42ad5f);if(_0x1db2d5[_0x4f506b(0x1f0)]){const _0x3d05ba=resolveSite(_0x1db2d5['site']),_0x4ed518=getEndpoint(_0x3d05ba,_0x5d7f42),_0x4ee679=''+_0x4ed518+_0x4c8046;console['error']('>\x20'+_0x4d732c+'\x20'+_0x4ee679);const _0x203a45=getAuthHeaders(_0x3d05ba),_0x573b9a={..._0x203a45,..._0x42ad5f};for(const [_0xba8fac,_0x599f38]of Object['entries'](_0x573b9a)){!isSensitiveHeader(_0xba8fac)&&console[_0x4f506b(0x220)]('>\x20'+_0xba8fac+':\x20'+_0x599f38);}_0x141b9c&&console[_0x4f506b(0x220)]('>'),console[_0x4f506b(0x220)]('');}const _0x303b98=await _0x1e0641[_0x4f506b(0x1ee)][_0x4f506b(0x201)](_0x4c8046,_0x5275e0);if(_0x1db2d5['verbose']&&_0x303b98['headers']){console[_0x4f506b(0x220)](_0x4f506b(0x21c)+_0x303b98[_0x4f506b(0x1f6)]);for(const [_0x341bce,_0x54816a]of Object[_0x4f506b(0x22d)](_0x303b98[_0x4f506b(0x200)])){!isSensitiveHeader(_0x341bce)&&console[_0x4f506b(0x220)]('<\x20'+_0x341bce+':\x20'+_0x54816a);}console[_0x4f506b(0x220)]('');}const _0x45efa5=Boolean(_0x1db2d5[_0x4f506b(0x21d)]),_0x161e1f={'color':_0x1db2d5[_0x4f506b(0x223)],'noColor':_0x1db2d5[_0x4f506b(0x22c)]||_0x45efa5&&!_0x1db2d5[_0x4f506b(0x223)]},_0x1e9cf1=colorizeJSON(_0x303b98[_0x4f506b(0x21a)],_0x161e1f);return _0x1db2d5['output']?(writeFileSync(_0x1db2d5[_0x4f506b(0x21d)],_0x1e9cf1),console[_0x4f506b(0x220)](_0x4f506b(0x1f1)+_0x1db2d5[_0x4f506b(0x21d)])):console[_0x4f506b(0x202)](_0x1e9cf1),0x0;}catch(_0x307f01){return _0x307f01 instanceof Error?(console['error'](_0x4f506b(0x22a)+_0x307f01['message']),_0x1db2d5[_0x4f506b(0x1f0)]&&_0x307f01[_0x4f506b(0x205)]&&console['error'](_0x4f506b(0x21e)+_0x307f01[_0x4f506b(0x205)])):console[_0x4f506b(0x220)](_0x4f506b(0x22a)+String(_0x307f01)),0x1;}}}
@@ -1 +1 @@
1
- const a6_0x32d9a7=a6_0x53dd;(function(_0x37154f,_0x10c490){const _0x56a1b7=a6_0x53dd,_0x394050=_0x37154f();while(!![]){try{const _0x2fb875=parseInt(_0x56a1b7(0xfd))/0x1*(-parseInt(_0x56a1b7(0x10a))/0x2)+-parseInt(_0x56a1b7(0x115))/0x3*(parseInt(_0x56a1b7(0xdd))/0x4)+-parseInt(_0x56a1b7(0xd5))/0x5+-parseInt(_0x56a1b7(0xd3))/0x6+-parseInt(_0x56a1b7(0x114))/0x7+parseInt(_0x56a1b7(0xf1))/0x8*(-parseInt(_0x56a1b7(0xf2))/0x9)+-parseInt(_0x56a1b7(0xda))/0xa*(-parseInt(_0x56a1b7(0xe8))/0xb);if(_0x2fb875===_0x10c490)break;else _0x394050['push'](_0x394050['shift']());}catch(_0x2cb09f){_0x394050['push'](_0x394050['shift']());}}}(a6_0x2a42,0x4d24a));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';function a6_0x53dd(_0x9ce885,_0x36edb3){_0x9ce885=_0x9ce885-0xc2;const _0x2a4269=a6_0x2a42();let _0x53dd5a=_0x2a4269[_0x9ce885];return _0x53dd5a;}import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a6_0x141ca8 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a6_0x2a42(){const _0x4c9e22=['tdx:\x20auth\x20clear','tdx:\x20auth\x20setup','ERROR','last_name','11176zyrAwH','3150sHUyAw','/app/mp/ak','Read\x20credential\x20from\x20','Enter\x20site\x20name:','Validating\x20API\x20key...','Enter\x20your\x20TD\x20API\x20key:','error','findIndex','ap02\x20-\x20Korea','tdx\x20profile:\x20','No\x20API\x20key\x20found\x20in\x20keychain','23393SySdwm','jobs','Select\x20your\x20Treasure\x20Data\x20site:','apiKey','Site\x20name\x20cannot\x20be\x20empty','name','User:\x20','filter','Setting\x20up\x20authentication\x20for\x20site:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','bold','No\x20credential\x20found','\x20\x20tdx','4ZFqdgL','\x0aSetup\x20cancelled','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','getUserInfo','us\x20\x20\x20-\x20United\x20States','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','value','ap02','eu01','3275202EGFMxD','430917YYvWcX','site','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','API\x20key\x20cannot\x20be\x20empty','yellow','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','status','message','red','warn','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','execute','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','✓\x20API\x20key\x20removed\x20from\x20keychain','customSite','length','\x20(site:\x20','3292038VovrUL','trim','3092385khHtAV','auth:setup','first_name','Remove\x20API\x20key\x20from\x20system\x20keychain','Name:\x20','10nzIiqA','email','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','12nWRaGl','join','select','text','log','create','password','eu\x20\x20\x20-\x20Europe','push','description','us01','32094337wDbNry','✗\x20Validation\x20failed:\x20','test','other','profile'];a6_0x2a42=function(){return _0x4c9e22;};return a6_0x2a42();}import a6_0x1cb478 from'chalk';export class AuthSetupCommand extends BaseCommand{['name']=a6_0x32d9a7(0xd6);[a6_0x32d9a7(0xe6)]='Setup\x20API\x20key\x20authentication\x20interactively';async[a6_0x32d9a7(0xcc)](_0x47089f){const _0x4ed969=a6_0x32d9a7,{options:_0x16005b}=_0x47089f,_0x54de21=_0x16005b[_0x4ed969(0xec)];console[_0x4ed969(0xe1)](a6_0x1cb478[_0x4ed969(0x107)](_0x4ed969(0xee)));const _0x12c723=_0x16005b[_0x4ed969(0xc2)]||_0x4ed969(0xe7),_0x3aad7b=[{'title':_0x4ed969(0x10e),'value':_0x4ed969(0xe7)},{'title':'jp\x20\x20\x20-\x20Japan','value':'jp01'},{'title':_0x4ed969(0xe4),'value':_0x4ed969(0x113)},{'title':_0x4ed969(0xfa),'value':_0x4ed969(0x112)}];let _0x16c6c7=_0x3aad7b[_0x4ed969(0xf9)](_0x462b60=>_0x462b60[_0x4ed969(0x111)]===_0x12c723);_0x16c6c7===-0x1&&_0x12c723!==_0x4ed969(0xe7)&&(_0x3aad7b[_0x4ed969(0xe5)]({'title':_0x12c723,'value':_0x12c723}),_0x16c6c7=_0x3aad7b[_0x4ed969(0xd1)]-0x1);_0x3aad7b[_0x4ed969(0xe5)]({'title':'Enter\x20custom\x20site','value':_0x4ed969(0xeb)});const _0x289e61=_0x54de21?_0x4ed969(0xc3)+_0x54de21+'):':_0x4ed969(0xff),_0x270f5b=await a6_0x141ca8({'type':_0x4ed969(0xdf),'name':_0x4ed969(0xc2),'message':_0x289e61,'choices':_0x3aad7b,'initial':_0x16c6c7>=0x0?_0x16c6c7:0x0});if(!_0x270f5b['site'])return console[_0x4ed969(0xe1)](_0x4ed969(0x10b)),0x1;let _0x184a10;if(_0x270f5b[_0x4ed969(0xc2)]==='other'){const _0x4481e1=await a6_0x141ca8({'type':_0x4ed969(0xe0),'name':'customSite','message':_0x4ed969(0xf5),'initial':_0x4ed969(0xe7),'validate':_0x1287a1=>{const _0x398e83=_0x4ed969;if(!_0x1287a1||!_0x1287a1[_0x398e83(0xd4)]())return _0x398e83(0x101);if(!/^[a-z0-9-]+$/[_0x398e83(0xea)](_0x1287a1[_0x398e83(0xd4)]()))return _0x398e83(0x10f);return!![];}});if(!_0x4481e1[_0x4ed969(0xd0)])return console['log'](_0x4ed969(0x10b)),0x1;_0x184a10=_0x4481e1[_0x4ed969(0xd0)];}else _0x184a10=_0x270f5b[_0x4ed969(0xc2)];const _0x5cb768=resolveSite(_0x184a10);console[_0x4ed969(0xe1)](_0x4ed969(0x105)+_0x5cb768),console[_0x4ed969(0xe1)](_0x4ed969(0x106)),console['log']('\x20\x20'+getConsoleUrl(_0x5cb768,_0x4ed969(0xf3)));const _0x1843db=await a6_0x141ca8({'type':_0x4ed969(0xe3),'name':_0x4ed969(0x100),'message':_0x4ed969(0xf7),'validate':_0x22b626=>{const _0x5149c2=_0x4ed969;if(!_0x22b626||!_0x22b626[_0x5149c2(0xd4)]())return _0x5149c2(0xc4);return!![];}});if(!_0x1843db['apiKey'])return console[_0x4ed969(0xe1)](_0x4ed969(0x10b)),0x1;const _0x3f1a1a=_0x1843db[_0x4ed969(0x100)];console[_0x4ed969(0xe1)](_0x4ed969(0xf6));try{const _0x439d42=TDX[_0x4ed969(0xe2)]({'site':_0x5cb768,'apiKey':_0x3f1a1a[_0x4ed969(0xd4)](),'logLevel':_0x16005b['logLevel']??LogLevel[_0x4ed969(0xef)]}),_0x48393a=await _0x439d42['jobs'][_0x4ed969(0x10d)]();console['log'](_0x4ed969(0xc6)+_0x48393a[_0x4ed969(0xdb)]+')');const _0x17c3d0=await isKeychainAvailable();_0x17c3d0?(await saveAPIKeyAsync(_0x3f1a1a[_0x4ed969(0xd4)](),_0x5cb768,_0x54de21),console[_0x4ed969(0xe1)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x54de21?'\x20(profile:\x20'+_0x54de21+')':''))):(console[_0x4ed969(0xca)](a6_0x1cb478[_0x4ed969(0xc5)](_0x4ed969(0xce))),console[_0x4ed969(0xca)](a6_0x1cb478[_0x4ed969(0xc5)](_0x4ed969(0xcd))));if(_0x54de21){const _0x521e37={'site':_0x5cb768};saveProfileToUserConfig(_0x54de21,_0x521e37),console[_0x4ed969(0xe1)]('✓\x20Profile\x20\x27'+_0x54de21+'\x27\x20registered');}const _0x48565c=_0x54de21?'\x20--profile\x20'+_0x54de21:'';return console[_0x4ed969(0xe1)](),console[_0x4ed969(0xe1)](_0x4ed969(0x110)),console[_0x4ed969(0xe1)](_0x4ed969(0x109)+_0x48565c+_0x4ed969(0x10c)),console[_0x4ed969(0xe1)](_0x4ed969(0x109)+_0x48565c+_0x4ed969(0xcb)),0x0;}catch(_0x211d75){if(_0x211d75 instanceof HTTPClientError&&_0x211d75[_0x4ed969(0xc7)]===0x191)return printAuthError(_0x211d75),0x1;return console[_0x4ed969(0xf8)](a6_0x1cb478['red'](_0x4ed969(0xe9)+(_0x211d75 instanceof Error?_0x211d75[_0x4ed969(0xc8)]:String(_0x211d75)))),console['error']('API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.'),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a6_0x32d9a7(0x102)]='auth';[a6_0x32d9a7(0xe6)]=a6_0x32d9a7(0xdc);async[a6_0x32d9a7(0xcc)](_0x290e50){const _0x2099cd=a6_0x32d9a7,{options:_0x1d5e61,tdx:_0x464ac4}=_0x290e50,_0x38fdfd=_0x1d5e61[_0x2099cd(0xc2)],_0x109947=_0x1d5e61[_0x2099cd(0xec)],_0x1a8fd8=_0x109947?_0x109947:'N/A';console[_0x2099cd(0xe1)](_0x2099cd(0xfb)+_0x1a8fd8+_0x2099cd(0xd2)+_0x38fdfd+')');const _0x37e2e0=await resolveAPIKeyAsync(_0x38fdfd,_0x109947);if(_0x37e2e0){const {source:_0x798f5c,isDeprecated:_0x248242}=_0x37e2e0,_0xbef806=_0x2099cd(0xf4)+_0x798f5c;console[_0x2099cd(0xe1)](_0x248242?a6_0x1cb478['yellow'](_0xbef806):_0xbef806);}else console['log'](a6_0x1cb478[_0x2099cd(0xc5)](_0x2099cd(0x108)));try{const _0x35e492=await _0x464ac4[_0x2099cd(0xfe)]['getUserInfo']();return console[_0x2099cd(0xe1)](a6_0x1cb478['green']('✓\x20Authentication\x20successful\x0a')),console[_0x2099cd(0xe1)](_0x2099cd(0x103)+_0x35e492['email']),(_0x35e492[_0x2099cd(0xd7)]||_0x35e492[_0x2099cd(0xf0)])&&console[_0x2099cd(0xe1)](_0x2099cd(0xd9)+[_0x35e492[_0x2099cd(0xd7)],_0x35e492[_0x2099cd(0xf0)]][_0x2099cd(0x104)](Boolean)[_0x2099cd(0xde)]('\x20')),0x0;}catch(_0x7a3f16){return _0x7a3f16 instanceof HTTPClientError&&_0x7a3f16[_0x2099cd(0xc7)]===0x191?printAuthError(_0x7a3f16,!![],_0x109947):console[_0x2099cd(0xf8)](a6_0x1cb478[_0x2099cd(0xc9)]('✗\x20Validation\x20failed:\x20'+(_0x7a3f16 instanceof Error?_0x7a3f16[_0x2099cd(0xc8)]:String(_0x7a3f16)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a6_0x32d9a7(0x102)]='auth:clear';[a6_0x32d9a7(0xe6)]=a6_0x32d9a7(0xd8);async['execute'](_0x1938f9){const _0x10f89a=a6_0x32d9a7,{options:_0x13e518}=_0x1938f9,_0x4ea095=_0x13e518[_0x10f89a(0xec)];console[_0x10f89a(0xe1)](a6_0x1cb478['bold'](_0x10f89a(0xed)));const _0x2ac6be=await isKeychainAvailable();if(!_0x2ac6be)return console[_0x10f89a(0xf8)](a6_0x1cb478[_0x10f89a(0xc9)]('System\x20keychain\x20is\x20not\x20available')),0x1;const _0x5dba70=await deleteKeychainAPIKey(_0x4ea095);return _0x5dba70?(clearCredentialCache(),console[_0x10f89a(0xe1)](_0x10f89a(0xcf)+(_0x4ea095?'\x20(profile:\x20'+_0x4ea095+')':'')),0x0):(console['log'](_0x10f89a(0xfc)+(_0x4ea095?'\x20for\x20profile:\x20'+_0x4ea095:'')),0x1);}}
1
+ const a6_0x72033c=a6_0xf00e;(function(_0x376593,_0x8fdf1c){const _0x2e7618=a6_0xf00e,_0x3f329a=_0x376593();while(!![]){try{const _0xb97c2d=parseInt(_0x2e7618(0x17c))/0x1+parseInt(_0x2e7618(0x175))/0x2*(parseInt(_0x2e7618(0x15c))/0x3)+-parseInt(_0x2e7618(0x155))/0x4*(parseInt(_0x2e7618(0x17e))/0x5)+-parseInt(_0x2e7618(0x153))/0x6+-parseInt(_0x2e7618(0x140))/0x7+parseInt(_0x2e7618(0x18d))/0x8*(-parseInt(_0x2e7618(0x16f))/0x9)+parseInt(_0x2e7618(0x186))/0xa;if(_0xb97c2d===_0x8fdf1c)break;else _0x3f329a['push'](_0x3f329a['shift']());}catch(_0x543a13){_0x3f329a['push'](_0x3f329a['shift']());}}}(a6_0x3312,0xb9a90));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';function a6_0x3312(){const _0x585c0e=['password','auth:clear','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','bold','19326fhRMtG','red','4fZxKvA','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','auth','Enter\x20site\x20name:','other','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','8079fPEuTP','last_name','name','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','push','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','API\x20key\x20cannot\x20be\x20empty','us\x20\x20\x20-\x20United\x20States','/app/mp/ak','eu01','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','✓\x20Authentication\x20successful\x0a','error','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','logLevel','execute','jobs','auth:setup','length','10717209ChypCq','join','warn','System\x20keychain\x20is\x20not\x20available','\x20(site:\x20','status','310HJUeEp','description','select','\x0aSetup\x20cancelled','email','apiKey','getUserInfo','549387MKFJKp','✓\x20Profile\x20\x27','5182160IxlTzm','jp01','filter','Remove\x20API\x20key\x20from\x20system\x20keychain','ERROR','ap02','yellow','value','30383660AdqaJP','Site\x20name\x20cannot\x20be\x20empty','findIndex','\x20(profile:\x20','us01','Name:\x20','Select\x20your\x20Treasure\x20Data\x20site:','8FCEGkT','tdx\x20profile:\x20','trim','customSite','Enter\x20your\x20TD\x20API\x20key:','tdx:\x20auth\x20clear','first_name','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','test','message','7099750STLhlR','No\x20API\x20key\x20found\x20in\x20keychain','\x20for\x20profile:\x20','site','\x20\x20tdx','log','Enter\x20custom\x20site','text','✗\x20Validation\x20failed:\x20','green','✓\x20API\x20key\x20removed\x20from\x20keychain','No\x20credential\x20found','tdx:\x20auth\x20setup','profile','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'];a6_0x3312=function(){return _0x585c0e;};return a6_0x3312();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a6_0x2acdb5 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a6_0xf00e(_0x2ca880,_0x697a06){_0x2ca880=_0x2ca880-0x13a;const _0x331254=a6_0x3312();let _0xf00eef=_0x331254[_0x2ca880];return _0xf00eef;}import a6_0x30d66c from'chalk';export class AuthSetupCommand extends BaseCommand{[a6_0x72033c(0x15e)]=a6_0x72033c(0x16d);['description']='Setup\x20API\x20key\x20authentication\x20interactively';async['execute'](_0x33bdd8){const _0x3b4838=a6_0x72033c,{options:_0x1e1a75}=_0x33bdd8,_0x16caa6=_0x1e1a75[_0x3b4838(0x14d)];console[_0x3b4838(0x145)](a6_0x30d66c[_0x3b4838(0x152)](_0x3b4838(0x14c)));const _0x580064=_0x1e1a75[_0x3b4838(0x143)]||'us01',_0x37cd1a=[{'title':_0x3b4838(0x163),'value':_0x3b4838(0x18a)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x3b4838(0x17f)},{'title':'eu\x20\x20\x20-\x20Europe','value':_0x3b4838(0x165)},{'title':'ap02\x20-\x20Korea','value':_0x3b4838(0x183)}];let _0x230080=_0x37cd1a[_0x3b4838(0x188)](_0x53c347=>_0x53c347[_0x3b4838(0x185)]===_0x580064);_0x230080===-0x1&&_0x580064!==_0x3b4838(0x18a)&&(_0x37cd1a[_0x3b4838(0x160)]({'title':_0x580064,'value':_0x580064}),_0x230080=_0x37cd1a[_0x3b4838(0x16e)]-0x1);_0x37cd1a[_0x3b4838(0x160)]({'title':_0x3b4838(0x146),'value':_0x3b4838(0x159)});const _0x483b19=_0x16caa6?_0x3b4838(0x15b)+_0x16caa6+'):':_0x3b4838(0x18c),_0x1d2ddc=await a6_0x2acdb5({'type':_0x3b4838(0x177),'name':_0x3b4838(0x143),'message':_0x483b19,'choices':_0x37cd1a,'initial':_0x230080>=0x0?_0x230080:0x0});if(!_0x1d2ddc['site'])return console[_0x3b4838(0x145)](_0x3b4838(0x178)),0x1;let _0x25c065;if(_0x1d2ddc['site']===_0x3b4838(0x159)){const _0xfb6712=await a6_0x2acdb5({'type':_0x3b4838(0x147),'name':_0x3b4838(0x190),'message':_0x3b4838(0x158),'initial':_0x3b4838(0x18a),'validate':_0x3abf6e=>{const _0x3e2325=_0x3b4838;if(!_0x3abf6e||!_0x3abf6e[_0x3e2325(0x18f)]())return _0x3e2325(0x187);if(!/^[a-z0-9-]+$/[_0x3e2325(0x13e)](_0x3abf6e['trim']()))return _0x3e2325(0x166);return!![];}});if(!_0xfb6712[_0x3b4838(0x190)])return console[_0x3b4838(0x145)](_0x3b4838(0x178)),0x1;_0x25c065=_0xfb6712['customSite'];}else _0x25c065=_0x1d2ddc['site'];const _0x17dae6=resolveSite(_0x25c065);console['log']('Setting\x20up\x20authentication\x20for\x20site:\x20'+_0x17dae6),console[_0x3b4838(0x145)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x3b4838(0x145)]('\x20\x20'+getConsoleUrl(_0x17dae6,_0x3b4838(0x164)));const _0x34463b=await a6_0x2acdb5({'type':_0x3b4838(0x14f),'name':_0x3b4838(0x17a),'message':_0x3b4838(0x13a),'validate':_0x230935=>{const _0x11aec2=_0x3b4838;if(!_0x230935||!_0x230935[_0x11aec2(0x18f)]())return _0x11aec2(0x162);return!![];}});if(!_0x34463b[_0x3b4838(0x17a)])return console[_0x3b4838(0x145)]('\x0aSetup\x20cancelled'),0x1;const _0x595b11=_0x34463b['apiKey'];console[_0x3b4838(0x145)]('Validating\x20API\x20key...');try{const _0x4d14d5=TDX['create']({'site':_0x17dae6,'apiKey':_0x595b11[_0x3b4838(0x18f)](),'logLevel':_0x1e1a75[_0x3b4838(0x16a)]??LogLevel[_0x3b4838(0x182)]}),_0x7b1e8a=await _0x4d14d5[_0x3b4838(0x16c)][_0x3b4838(0x17b)]();console[_0x3b4838(0x145)](_0x3b4838(0x15a)+_0x7b1e8a[_0x3b4838(0x179)]+')');const _0x212452=await isKeychainAvailable();_0x212452?(await saveAPIKeyAsync(_0x595b11[_0x3b4838(0x18f)](),_0x17dae6,_0x16caa6),console[_0x3b4838(0x145)](_0x3b4838(0x14e)+(_0x16caa6?_0x3b4838(0x189)+_0x16caa6+')':''))):(console[_0x3b4838(0x171)](a6_0x30d66c[_0x3b4838(0x184)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x3b4838(0x171)](a6_0x30d66c[_0x3b4838(0x184)](_0x3b4838(0x151))));if(_0x16caa6){const _0x4fff5b={'site':_0x17dae6};saveProfileToUserConfig(_0x16caa6,_0x4fff5b),console['log'](_0x3b4838(0x17d)+_0x16caa6+'\x27\x20registered');}const _0x2d7ff7=_0x16caa6?'\x20--profile\x20'+_0x16caa6:'';return console[_0x3b4838(0x145)](),console['log'](_0x3b4838(0x169)),console[_0x3b4838(0x145)](_0x3b4838(0x144)+_0x2d7ff7+_0x3b4838(0x156)),console[_0x3b4838(0x145)](_0x3b4838(0x144)+_0x2d7ff7+_0x3b4838(0x161)),0x0;}catch(_0x1c2d16){if(_0x1c2d16 instanceof HTTPClientError&&_0x1c2d16[_0x3b4838(0x174)]===0x191)return printAuthError(_0x1c2d16),0x1;return console[_0x3b4838(0x168)](a6_0x30d66c[_0x3b4838(0x154)](_0x3b4838(0x148)+(_0x1c2d16 instanceof Error?_0x1c2d16['message']:String(_0x1c2d16)))),console[_0x3b4838(0x168)](_0x3b4838(0x15f)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a6_0x72033c(0x15e)]=a6_0x72033c(0x157);[a6_0x72033c(0x176)]=a6_0x72033c(0x13d);async[a6_0x72033c(0x16b)](_0xc2dd34){const _0x371582=a6_0x72033c,{options:_0xdd2038,tdx:_0x11c5f0}=_0xc2dd34,_0x5eecb8=_0xdd2038[_0x371582(0x143)],_0x16bac0=_0xdd2038[_0x371582(0x14d)],_0x1247fe=_0x16bac0?_0x16bac0:'N/A';console['log'](_0x371582(0x18e)+_0x1247fe+_0x371582(0x173)+_0x5eecb8+')');const _0xa9f186=await resolveAPIKeyAsync(_0x5eecb8,_0x16bac0);if(_0xa9f186){const {source:_0x520031,isDeprecated:_0x2a35a5}=_0xa9f186,_0x4ab51c='Read\x20credential\x20from\x20'+_0x520031;console[_0x371582(0x145)](_0x2a35a5?a6_0x30d66c[_0x371582(0x184)](_0x4ab51c):_0x4ab51c);}else console[_0x371582(0x145)](a6_0x30d66c['yellow'](_0x371582(0x14b)));try{const _0x531289=await _0x11c5f0[_0x371582(0x16c)][_0x371582(0x17b)]();return console[_0x371582(0x145)](a6_0x30d66c[_0x371582(0x149)](_0x371582(0x167))),console[_0x371582(0x145)]('User:\x20'+_0x531289[_0x371582(0x179)]),(_0x531289[_0x371582(0x13c)]||_0x531289[_0x371582(0x15d)])&&console[_0x371582(0x145)](_0x371582(0x18b)+[_0x531289['first_name'],_0x531289['last_name']][_0x371582(0x180)](Boolean)[_0x371582(0x170)]('\x20')),0x0;}catch(_0x58de40){return _0x58de40 instanceof HTTPClientError&&_0x58de40[_0x371582(0x174)]===0x191?printAuthError(_0x58de40,!![],_0x16bac0):console[_0x371582(0x168)](a6_0x30d66c['red'](_0x371582(0x148)+(_0x58de40 instanceof Error?_0x58de40[_0x371582(0x13f)]:String(_0x58de40)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a6_0x72033c(0x15e)]=a6_0x72033c(0x150);[a6_0x72033c(0x176)]=a6_0x72033c(0x181);async[a6_0x72033c(0x16b)](_0x159f31){const _0x13252b=a6_0x72033c,{options:_0x986c5a}=_0x159f31,_0x27da87=_0x986c5a[_0x13252b(0x14d)];console['log'](a6_0x30d66c[_0x13252b(0x152)](_0x13252b(0x13b)));const _0xea498c=await isKeychainAvailable();if(!_0xea498c)return console[_0x13252b(0x168)](a6_0x30d66c[_0x13252b(0x154)](_0x13252b(0x172))),0x1;const _0x852145=await deleteKeychainAPIKey(_0x27da87);return _0x852145?(clearCredentialCache(),console[_0x13252b(0x145)](_0x13252b(0x14a)+(_0x27da87?_0x13252b(0x189)+_0x27da87+')':'')),0x0):(console['log'](_0x13252b(0x141)+(_0x27da87?_0x13252b(0x142)+_0x27da87:'')),0x1);}}
@@ -1 +1 @@
1
- const a7_0x3cabe8=a7_0x3685;function a7_0x3685(_0x21a20d,_0x3c58ce){_0x21a20d=_0x21a20d-0x65;const _0x559e62=a7_0x559e();let _0x368517=_0x559e62[_0x21a20d];return _0x368517;}(function(_0x417aeb,_0x4248b7){const _0x41c327=a7_0x3685,_0xdfc700=_0x417aeb();while(!![]){try{const _0x309a05=-parseInt(_0x41c327(0x72))/0x1+parseInt(_0x41c327(0x69))/0x2+parseInt(_0x41c327(0x67))/0x3+parseInt(_0x41c327(0x85))/0x4*(parseInt(_0x41c327(0x7b))/0x5)+-parseInt(_0x41c327(0x90))/0x6+parseInt(_0x41c327(0x92))/0x7+-parseInt(_0x41c327(0x88))/0x8*(parseInt(_0x41c327(0x65))/0x9);if(_0x309a05===_0x4248b7)break;else _0xdfc700['push'](_0xdfc700['shift']());}catch(_0x165267){_0xdfc700['push'](_0xdfc700['shift']());}}}(a7_0x559e,0x6a043));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function handleSDKError(_0x1c7427,_0x56267b){const _0x2efc1f=a7_0x3685;if(_0x1c7427 instanceof SDKError)console[_0x2efc1f(0x6f)](_0x2efc1f(0x66)+_0x1c7427['message']),_0x56267b[_0x2efc1f(0x7e)]&&(_0x1c7427['cause']&&console[_0x2efc1f(0x6f)](_0x2efc1f(0x84)+_0x1c7427['cause']),_0x1c7427[_0x2efc1f(0x7a)]&&(console[_0x2efc1f(0x6f)](_0x2efc1f(0x6c)),console['error'](_0x1c7427['stack'])));else throw _0x1c7427;}function a7_0x559e(){const _0x256b85=['\x0aStack\x20trace:','name','session\x20context','error','validate','log','613058wfAhiW','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','404','data','resolveAgentId','new','claude-4.5-haiku','Continuing\x20chat:\x20','stack','15pCPsEJ','Getting\x20default\x20agent...','getDefaultAgent','verbose','agent','streamChat','getAgentId','chat','chatId','\x20\x20Cause:\x20','903796gMOnIr','event','join','7408fjebIq','getOrCreateDefaultAgent','includes','\x27...','content','handleChatEvent','args','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','2545290eaVSbO','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','3960635SjPUKl','Resolving\x20project\x20\x27','metadata','message','execute','Chat\x20session:\x20','CHAT_NOT_FOUND','11268smUGKm','Error:\x20','2568519lgQnwf','llmAgent','1062086ignZZx','llm','type'];a7_0x559e=function(){return _0x256b85;};return a7_0x559e();}export class ChatCommand extends BaseCommand{[a7_0x3cabe8(0x6d)]=a7_0x3cabe8(0x82);['description']=a7_0x3cabe8(0x73);[a7_0x3cabe8(0x70)](_0x378612){const _0x1af8fe=a7_0x3cabe8,_0x369619=_0x378612[_0x1af8fe(0x8e)][_0x1af8fe(0x87)]('\x20');if(!_0x369619)return _0x1af8fe(0x91);return undefined;}async[a7_0x3cabe8(0x80)](_0x403fcd,_0x32718c,_0xa1848c,_0x1ea302,_0x17508f){const _0x4677f1=a7_0x3cabe8;for await(const _0x48dde9 of _0x403fcd[_0x4677f1(0x6a)][_0x4677f1(0x82)](_0x32718c,{'agentId':_0xa1848c,'chatId':_0x1ea302})){if(_0x48dde9['type']===_0x4677f1(0x94)){const _0x10e7ac=_0x48dde9[_0x4677f1(0x75)][_0x4677f1(0x83)];saveLastChatId(_0x10e7ac),_0x17508f&&console[_0x4677f1(0x6f)](_0x4677f1(0x97)+_0x10e7ac);}else _0x48dde9[_0x4677f1(0x6b)]===_0x4677f1(0x86)&&this['handleChatEvent'](_0x48dde9[_0x4677f1(0x75)]);}}async['getAgentId'](_0x37ce79,_0x480ed5,_0x24f630,_0x4986da,_0x146d2b){const _0x350762=a7_0x3cabe8,_0x2a72b2=_0x480ed5||_0x24f630;if(_0x2a72b2){const {projectName:_0x36f61e,agentName:_0x4c990f}=parseAgentRef(_0x2a72b2),_0x40be80=_0x4c990f||_0x2a72b2,_0x2d244a=_0x4c990f?_0x36f61e:_0x4986da;if(!_0x2d244a)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x146d2b){const _0x293d0f=_0x480ed5?'--agent\x20flag':_0x350762(0x6e);console[_0x350762(0x6f)]('Using\x20agent\x20from\x20'+_0x293d0f+':\x20'+_0x2d244a+'/'+_0x40be80);}const _0x246283=await withSpinner(_0x350762(0x93)+_0x2d244a+_0x350762(0x8b),()=>_0x37ce79['llm']['resolveProjectId'](_0x2d244a),{'verbose':_0x146d2b}),_0x2ccc97=await withSpinner('Resolving\x20agent\x20\x27'+_0x40be80+'\x27...',()=>_0x37ce79[_0x350762(0x6a)][_0x350762(0x76)](_0x40be80,_0x246283[_0x350762(0x75)]),{'verbose':_0x146d2b});return _0x2ccc97[_0x350762(0x75)];}else{const _0x4b4787=_0x37ce79['llm'][_0x350762(0x7d)]();if(_0x4b4787)return _0x146d2b&&console[_0x350762(0x6f)]('Using\x20cached\x20default\x20agent:\x20'+_0x4b4787[_0x350762(0x6d)]),_0x4b4787['id'];const _0x5cbd44=await withSpinner(_0x350762(0x7c),()=>_0x37ce79[_0x350762(0x6a)][_0x350762(0x89)](_0x350762(0x78),0x0),{'verbose':_0x146d2b});return _0x5cbd44[_0x350762(0x75)]['id'];}}async[a7_0x3cabe8(0x96)](_0x15aedb){const _0x176744=a7_0x3cabe8,{options:_0x44d9eb,args:_0x510302,tdx:_0x4fd6d6}=_0x15aedb,_0x124821=_0x510302['join']('\x20'),_0x52d100=_0x44d9eb,_0xd77c61=_0x52d100[_0x176744(0x7f)],_0x38b71e=_0x52d100[_0x176744(0x68)],_0x33cd3c=_0x52d100['llmProject'],_0x5b6944=_0x52d100[_0x176744(0x77)];try{let _0xa17e90,_0x3fdde9;!_0x5b6944&&(_0x3fdde9=loadLastChatId(),_0x3fdde9&&_0x44d9eb[_0x176744(0x7e)]&&console[_0x176744(0x6f)](_0x176744(0x79)+_0x3fdde9));(_0x5b6944||!_0x3fdde9)&&(_0xa17e90=await this[_0x176744(0x81)](_0x4fd6d6,_0xd77c61,_0x38b71e,_0x33cd3c,_0x44d9eb['verbose']));try{await this[_0x176744(0x80)](_0x4fd6d6,_0x124821,_0xa17e90,_0x3fdde9,_0x44d9eb['verbose']);}catch(_0x458414){const _0x301f2f=_0x458414 instanceof SDKError&&_0x458414['code']===ErrorCode[_0x176744(0x98)]||_0x458414 instanceof Error&&_0x458414[_0x176744(0x95)][_0x176744(0x8a)](_0x176744(0x74));if(_0x301f2f)_0x44d9eb[_0x176744(0x7e)]&&console['error'](_0x176744(0x8f)),!_0xa17e90&&(_0xa17e90=await this[_0x176744(0x81)](_0x4fd6d6,_0xd77c61,_0x38b71e,_0x33cd3c,_0x44d9eb[_0x176744(0x7e)])),await this[_0x176744(0x80)](_0x4fd6d6,_0x124821,_0xa17e90,undefined,_0x44d9eb[_0x176744(0x7e)]);else throw _0x458414;}return console[_0x176744(0x71)](),0x0;}catch(_0x453970){return console['error'](),handleSDKError(_0x453970,_0x44d9eb),0x1;}}[a7_0x3cabe8(0x8d)](_0x40036d){const _0x3cf3af=a7_0x3cabe8;if(_0x3cf3af(0x8c)in _0x40036d)process['stdout']['write'](_0x40036d[_0x3cf3af(0x8c)]);else'error'in _0x40036d&&console[_0x3cf3af(0x6f)]('\x0aError:\x20'+_0x40036d[_0x3cf3af(0x6f)]);}}
1
+ const a7_0x222587=a7_0x6511;(function(_0x5355ff,_0x36466c){const _0x28b15b=a7_0x6511,_0x31a70c=_0x5355ff();while(!![]){try{const _0x293641=-parseInt(_0x28b15b(0xc8))/0x1+-parseInt(_0x28b15b(0xcf))/0x2+-parseInt(_0x28b15b(0xc9))/0x3*(parseInt(_0x28b15b(0xcb))/0x4)+parseInt(_0x28b15b(0xd4))/0x5+-parseInt(_0x28b15b(0xce))/0x6+parseInt(_0x28b15b(0xdb))/0x7*(-parseInt(_0x28b15b(0xb5))/0x8)+parseInt(_0x28b15b(0xca))/0x9*(parseInt(_0x28b15b(0xe2))/0xa);if(_0x293641===_0x36466c)break;else _0x31a70c['push'](_0x31a70c['shift']());}catch(_0x29ad58){_0x31a70c['push'](_0x31a70c['shift']());}}}(a7_0x2792,0x4d4c9));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';function a7_0x6511(_0x207a93,_0x35956a){_0x207a93=_0x207a93-0xb3;const _0x27926f=a7_0x2792();let _0x651157=_0x27926f[_0x207a93];return _0x651157;}import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';function a7_0x2792(){const _0x52070c=['Error:\x20','--agent\x20flag','10GdssnQ','Resolving\x20project\x20\x27','resolveProjectId','getDefaultAgent','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','9248BVcDBm','execute','\x0aStack\x20trace:','Getting\x20default\x20agent...','content','new','type','llm','404','getAgentId','agent','session\x20context','name','stdout','streamChat','chat','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','validate','data','441269SAZPQD','12Pqtnge','10785618MpyAji','170840ZbTLHr','claude-4.5-haiku','message','412638ZwWNpZ','1201294TWQPcb','metadata','cause','verbose','code','2183680dpGait','llmProject','error','includes','stack','join','Resolving\x20agent\x20\x27','224auWzat','\x20\x20Cause:\x20','\x27...','Using\x20agent\x20from\x20','event'];a7_0x2792=function(){return _0x52070c;};return a7_0x2792();}function handleSDKError(_0x424962,_0x452c33){const _0x55e046=a7_0x6511;if(_0x424962 instanceof SDKError)console[_0x55e046(0xd6)](_0x55e046(0xe0)+_0x424962[_0x55e046(0xcd)]),_0x452c33[_0x55e046(0xd2)]&&(_0x424962[_0x55e046(0xd1)]&&console['error'](_0x55e046(0xdc)+_0x424962['cause']),_0x424962['stack']&&(console[_0x55e046(0xd6)](_0x55e046(0xb7)),console[_0x55e046(0xd6)](_0x424962[_0x55e046(0xd8)])));else throw _0x424962;}export class ChatCommand extends BaseCommand{[a7_0x222587(0xc1)]=a7_0x222587(0xc4);['description']=a7_0x222587(0xb4);[a7_0x222587(0xc6)](_0x45c62c){const _0x930b16=a7_0x222587,_0x5c2fbb=_0x45c62c['args'][_0x930b16(0xd9)]('\x20');if(!_0x5c2fbb)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async[a7_0x222587(0xc3)](_0x2b2309,_0x5c1b33,_0x2db362,_0x41a4de,_0x30797b){const _0x1e3564=a7_0x222587;for await(const _0x314385 of _0x2b2309[_0x1e3564(0xbc)][_0x1e3564(0xc4)](_0x5c1b33,{'agentId':_0x2db362,'chatId':_0x41a4de})){if(_0x314385[_0x1e3564(0xbb)]===_0x1e3564(0xd0)){const _0x9e3ca3=_0x314385[_0x1e3564(0xc7)]['chatId'];saveLastChatId(_0x9e3ca3),_0x30797b&&console[_0x1e3564(0xd6)]('Chat\x20session:\x20'+_0x9e3ca3);}else _0x314385[_0x1e3564(0xbb)]===_0x1e3564(0xdf)&&this['handleChatEvent'](_0x314385[_0x1e3564(0xc7)]);}}async[a7_0x222587(0xbe)](_0x1e6ce0,_0x2c1068,_0x376bc7,_0x4f6262,_0x5bd5f6){const _0x59bba6=a7_0x222587,_0x4d75d0=_0x2c1068||_0x376bc7;if(_0x4d75d0){const {projectName:_0x1e9acb,agentName:_0x5abbf4}=parseAgentRef(_0x4d75d0),_0x34433f=_0x5abbf4||_0x4d75d0,_0x97124d=_0x5abbf4?_0x1e9acb:_0x4f6262;if(!_0x97124d)throw new Error(_0x59bba6(0xc5));if(_0x5bd5f6){const _0x2c2b6d=_0x2c1068?_0x59bba6(0xe1):_0x59bba6(0xc0);console[_0x59bba6(0xd6)](_0x59bba6(0xde)+_0x2c2b6d+':\x20'+_0x97124d+'/'+_0x34433f);}const _0x1af534=await withSpinner(_0x59bba6(0xe3)+_0x97124d+_0x59bba6(0xdd),()=>_0x1e6ce0[_0x59bba6(0xbc)][_0x59bba6(0xe4)](_0x97124d),{'verbose':_0x5bd5f6}),_0x5d2cbf=await withSpinner(_0x59bba6(0xda)+_0x34433f+_0x59bba6(0xdd),()=>_0x1e6ce0[_0x59bba6(0xbc)]['resolveAgentId'](_0x34433f,_0x1af534[_0x59bba6(0xc7)]),{'verbose':_0x5bd5f6});return _0x5d2cbf[_0x59bba6(0xc7)];}else{const _0x47a6fb=_0x1e6ce0[_0x59bba6(0xbc)][_0x59bba6(0xb3)]();if(_0x47a6fb)return _0x5bd5f6&&console[_0x59bba6(0xd6)]('Using\x20cached\x20default\x20agent:\x20'+_0x47a6fb[_0x59bba6(0xc1)]),_0x47a6fb['id'];const _0x29432b=await withSpinner(_0x59bba6(0xb8),()=>_0x1e6ce0['llm']['getOrCreateDefaultAgent'](_0x59bba6(0xcc),0x0),{'verbose':_0x5bd5f6});return _0x29432b['data']['id'];}}async[a7_0x222587(0xb6)](_0x3cb2a6){const _0x1f2cce=a7_0x222587,{options:_0x40a496,args:_0x2600ab,tdx:_0xb739c8}=_0x3cb2a6,_0x3e3c2b=_0x2600ab[_0x1f2cce(0xd9)]('\x20'),_0x4ccde7=_0x40a496,_0x14e189=_0x4ccde7[_0x1f2cce(0xbf)],_0x1d9433=_0x4ccde7['llmAgent'],_0x22e594=_0x4ccde7[_0x1f2cce(0xd5)],_0x327a02=_0x4ccde7[_0x1f2cce(0xba)];try{let _0x3a817d,_0x34c929;!_0x327a02&&(_0x34c929=loadLastChatId(),_0x34c929&&_0x40a496[_0x1f2cce(0xd2)]&&console['error']('Continuing\x20chat:\x20'+_0x34c929));(_0x327a02||!_0x34c929)&&(_0x3a817d=await this[_0x1f2cce(0xbe)](_0xb739c8,_0x14e189,_0x1d9433,_0x22e594,_0x40a496[_0x1f2cce(0xd2)]));try{await this['streamChat'](_0xb739c8,_0x3e3c2b,_0x3a817d,_0x34c929,_0x40a496['verbose']);}catch(_0x2431c3){const _0x48088c=_0x2431c3 instanceof SDKError&&_0x2431c3[_0x1f2cce(0xd3)]===ErrorCode['CHAT_NOT_FOUND']||_0x2431c3 instanceof Error&&_0x2431c3[_0x1f2cce(0xcd)][_0x1f2cce(0xd7)](_0x1f2cce(0xbd));if(_0x48088c)_0x40a496['verbose']&&console[_0x1f2cce(0xd6)]('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x3a817d&&(_0x3a817d=await this['getAgentId'](_0xb739c8,_0x14e189,_0x1d9433,_0x22e594,_0x40a496[_0x1f2cce(0xd2)])),await this[_0x1f2cce(0xc3)](_0xb739c8,_0x3e3c2b,_0x3a817d,undefined,_0x40a496[_0x1f2cce(0xd2)]);else throw _0x2431c3;}return console['log'](),0x0;}catch(_0x51889c){return console[_0x1f2cce(0xd6)](),handleSDKError(_0x51889c,_0x40a496),0x1;}}['handleChatEvent'](_0x368d78){const _0x55c526=a7_0x222587;if('content'in _0x368d78)process[_0x55c526(0xc2)]['write'](_0x368d78[_0x55c526(0xb9)]);else _0x55c526(0xd6)in _0x368d78&&console[_0x55c526(0xd6)]('\x0aError:\x20'+_0x368d78['error']);}}
@@ -1 +1 @@
1
- const a8_0x3196c1=a8_0x2a89;(function(_0x51eb20,_0x4128ff){const _0xba072c=a8_0x2a89,_0x1fcfd0=_0x51eb20();while(!![]){try{const _0x116656=parseInt(_0xba072c(0x12c))/0x1*(-parseInt(_0xba072c(0x176))/0x2)+parseInt(_0xba072c(0x143))/0x3+-parseInt(_0xba072c(0x10a))/0x4*(-parseInt(_0xba072c(0xff))/0x5)+-parseInt(_0xba072c(0x141))/0x6+-parseInt(_0xba072c(0x160))/0x7*(-parseInt(_0xba072c(0x10b))/0x8)+parseInt(_0xba072c(0x110))/0x9*(-parseInt(_0xba072c(0x179))/0xa)+parseInt(_0xba072c(0x136))/0xb;if(_0x116656===_0x4128ff)break;else _0x1fcfd0['push'](_0x1fcfd0['shift']());}catch(_0x4b2c24){_0x1fcfd0['push'](_0x1fcfd0['shift']());}}}(a8_0x888e,0xbb207));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a8_0xc22838 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';function a8_0x888e(){const _0x2a09fb=['statusLine','command','✓\x20Logging\x20to\x20','close','utf-8','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','error','ANTHROPIC_MODEL','passThroughServer','which','td-skills','Checking\x20Claude\x20Code\x20version...','install','Failed\x20to\x20configure\x20marketplace\x20\x27','originalSettings','localhost','525500RxZuZI','warn','parse','.claude','green','start','):\x20claude\x20','Claude\x20Code\x20version\x20','attributes','\x20meets\x20minimum\x20requirement','debug','16GnLryc','1048Xhujzi','Configuring\x20marketplace\x20\x27','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','Executing:\x20claude\x20','log','6041133TGUFAC','tdx\x20claude\x20statusline','string','claude','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','name','http','INSTALLATION_FAILED','data','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','findClaudePath','Claude\x20Code\x20version\x20check\x20failed','https://docs.treasuredata.com/mcp','\x27...','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','add','✓\x20Marketplace\x20\x27','object','major','stringify','patch','\x20claude\x20statusline','cause','hostname','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','Finding\x20available\x20port...','tdx','logger','29vhitUY','https://github.com/treasure-data/td-skills','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','cwd','server','fail','Initializing\x20proxy\x20logger...','\x27\x20configured','env','match','17303341dGrXif','Setup\x20failed','\x20is\x20too\x20old\x20(minimum:\x20','\x20configuration\x20failed','stop','Claude\x20Code\x20CLI\x20not\x20found','tdx-managed-proxy','verbose','Creating\x20.claude/settings.local.json...','profile','code','7822128IhwLwa','exit','964449qnfVDV','toString','✓\x20Settings\x20restored:\x20.claude/settings.local.json','Warning:\x20Failed\x20to\x20configure\x20','proxy','✓\x20Claude\x20Code\x20version\x20OK','pipe','message','stdout','getOrCreateDefaultProject','init','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','settings.local.json','Failed\x20to\x20install\x20plugin\x20\x27','sonnet','marketplace','includes','logLevel','unshift','http://127.0.0.1:','already\x20exists','sql-skills','account_id','trim','td-skills\x20Plugins','Initializing...','tdx\x20--profile\x20','info','getCurrent','79079QlleTB','TD\x20Docs\x20MCP\x20Server','user','ANTHROPIC_AUTH_TOKEN','Invalid\x20minimum\x20version\x20format:\x20','\x27\x20updated','update','llm','model','mcp','ANTHROPIC_BASE_URL','text','execute','workflow-skills','--transport','site','Configuring\x20MCP\x20server\x20\x27','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','\x20already\x20configured','Invalid\x20LLM\x20proxy\x20URL:\x20','CLAUDE_CODE_UNSUPPORTED_VERSION','context','72650SJUQvc','\x20or\x20later.','INVALID_ARGUMENT','10TZnudx','plugin','llm-proxy','apiKey','continue','Command\x20output:\x20','127.0.0.1','getLogPath','minor','✓\x20Plugin\x20\x27','llmProxy','port','CLAUDE_CODE_NOT_FOUND','join','tdx-skills'];a8_0x888e=function(){return _0x2a09fb;};return a8_0x888e();}import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint}from'../sdk/client/endpoints.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION='2.0.20';function handleInstallationError(_0x5b7c0a,_0x3f8034,_0x3406b9,_0x3b2643){const _0x32210c=a8_0x2a89;errorContains(_0x5b7c0a,_0x32210c(0x157),'already\x20installed','already\x20configured')?(_0x3406b9[_0x32210c(0x16b)]='✓\x20'+_0x3f8034+_0x32210c(0x172),_0x3b2643?.[_0x32210c(0x15e)](_0x3f8034+_0x32210c(0x172)),_0x5b7c0a instanceof SDKError&&_0x5b7c0a['cause']&&_0x3b2643?.[_0x32210c(0x109)](_0x32210c(0x17e)+_0x5b7c0a[_0x32210c(0x126)][_0x32210c(0x14a)])):(_0x3406b9[_0x32210c(0x100)](_0x32210c(0x146)+_0x3f8034),_0x3b2643?.[_0x32210c(0x18e)](_0x3f8034+_0x32210c(0x139),_0x5b7c0a));}export function parseVersion(_0x41ad9b){const _0x2e7ce8=a8_0x2a89,_0x335077=_0x41ad9b['trim']()[_0x2e7ce8(0x135)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x335077)return null;return{'major':parseInt(_0x335077[0x1],0xa),'minor':parseInt(_0x335077[0x2],0xa),'patch':parseInt(_0x335077[0x3],0xa)};}export function compareVersions(_0x256936,_0x30065f){const _0xc48686=a8_0x2a89;if(_0x256936[_0xc48686(0x122)]!==_0x30065f[_0xc48686(0x122)])return _0x256936[_0xc48686(0x122)]-_0x30065f[_0xc48686(0x122)];if(_0x256936[_0xc48686(0x181)]!==_0x30065f[_0xc48686(0x181)])return _0x256936[_0xc48686(0x181)]-_0x30065f[_0xc48686(0x181)];return _0x256936[_0xc48686(0x124)]-_0x30065f[_0xc48686(0x124)];}async function checkClaudeVersion(_0x576eaa,_0x5a1301){const _0xa3ab89=a8_0x2a89;_0x5a1301?.[_0xa3ab89(0x109)](_0xa3ab89(0x14e)+_0x576eaa+')');const _0x4f328c=await executeClaudeCommand(['--version'],undefined,_0x5a1301),_0x40718e=parseVersion(_0x4f328c);if(!_0x40718e){_0x5a1301?.['warn'](_0xa3ab89(0x11e)+_0x4f328c);return;}const _0x3ff278=_0x40718e[_0xa3ab89(0x122)]+'.'+_0x40718e['minor']+'.'+_0x40718e[_0xa3ab89(0x124)],_0x33dc00=parseVersion(_0x576eaa);if(!_0x33dc00){_0x5a1301?.[_0xa3ab89(0x100)](_0xa3ab89(0x164)+_0x576eaa);return;}if(compareVersions(_0x40718e,_0x33dc00)<0x0){_0x5a1301?.[_0xa3ab89(0x18e)](_0xa3ab89(0x106)+_0x3ff278+_0xa3ab89(0x138)+_0x576eaa+')');throw new SDKError(ErrorCode[_0xa3ab89(0x174)],_0xa3ab89(0x106)+_0x3ff278+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x576eaa+_0xa3ab89(0x177),undefined,{'helpText':'Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code'});}_0x5a1301?.[_0xa3ab89(0x109)](_0xa3ab89(0x106)+_0x3ff278+_0xa3ab89(0x108));}async function executeClaudeCommand(_0x4b1e15,_0x5d5d89,_0x1d84bd){const _0x1fa759=a8_0x2a89;return _0x1d84bd?.[_0x1fa759(0x15e)](_0x1fa759(0x10e)+_0x4b1e15['join']('\x20')),new Promise((_0x7c4276,_0x1c5fe2)=>{const _0x42360a=_0x1fa759,_0x4dba5a=spawn('claude',_0x4b1e15,{'stdio':_0x42360a(0x149)});let _0x137457='',_0x750c44='';_0x4dba5a[_0x42360a(0x14b)]['on'](_0x42360a(0x118),_0x534dfd=>{_0x137457+=_0x534dfd['toString']();}),_0x4dba5a['stderr']['on'](_0x42360a(0x118),_0x269812=>{_0x750c44+=_0x269812['toString']();}),_0x4dba5a['on'](_0x42360a(0x18e),_0x347083=>{const _0x47fe8f=_0x42360a;_0x347083[_0x47fe8f(0x140)]==='ENOENT'?(_0x1d84bd?.[_0x47fe8f(0x18e)](_0x47fe8f(0x13b)),_0x1c5fe2(new SDKError(ErrorCode[_0x47fe8f(0x185)],'Claude\x20Code\x20CLI\x20not\x20found',_0x347083,{'helpText':_0x47fe8f(0x119)}))):(_0x1d84bd?.['error']('Command\x20spawn\x20error:\x20'+_0x347083['message']),_0x1c5fe2(new SDKError(ErrorCode['INTERNAL'],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x347083['message'],_0x347083)));}),_0x4dba5a['on']('exit',_0x46684e=>{const _0x50b098=_0x42360a;if(_0x46684e===0x0)_0x7c4276(_0x137457);else _0x5d5d89?(_0x1d84bd?.[_0x50b098(0x18e)]('Command\x20failed\x20(exit\x20'+_0x46684e+_0x50b098(0x105)+_0x4b1e15[_0x50b098(0x186)]('\x20')),_0x1c5fe2(new SDKError(ErrorCode[_0x50b098(0x117)],_0x5d5d89,new Error(_0x750c44)))):_0x7c4276('');});});}async function ensureMcpServer(_0x499326,_0x35084c,_0x1be3e6,_0x3bf502,_0x411a36){const _0x34e1af=a8_0x2a89;_0x3bf502[_0x34e1af(0x16b)]=_0x34e1af(0x170)+_0x499326+'\x27...',await executeClaudeCommand([_0x34e1af(0x169),'add',_0x499326,_0x35084c,_0x34e1af(0x16e),_0x1be3e6],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0x499326+'\x27',_0x411a36),_0x3bf502[_0x34e1af(0x16b)]='✓\x20MCP\x20server\x20\x27'+_0x499326+_0x34e1af(0x133);}async function ensureMarketplace(_0x4e1c44,_0x4eed00,_0x1a2d06,_0x14d523){const _0x51c6a0=a8_0x2a89;_0x1a2d06[_0x51c6a0(0x16b)]=_0x51c6a0(0x10c)+_0x4e1c44+_0x51c6a0(0x11d),await executeClaudeCommand(['plugin',_0x51c6a0(0x152),_0x51c6a0(0x11f),_0x4eed00],_0x51c6a0(0xfc)+_0x4e1c44+'\x27',_0x14d523),_0x1a2d06[_0x51c6a0(0x16b)]=_0x51c6a0(0x120)+_0x4e1c44+_0x51c6a0(0x133);}async function updateMarketplace(_0x973cb6,_0x57c043,_0x48c514){const _0x28b5e5=a8_0x2a89;_0x57c043['text']='Updating\x20marketplace\x20\x27'+_0x973cb6+_0x28b5e5(0x11d),await executeClaudeCommand(['plugin',_0x28b5e5(0x152),_0x28b5e5(0x166)],'Failed\x20to\x20update\x20marketplace\x20\x27'+_0x973cb6+'\x27',_0x48c514),_0x57c043[_0x28b5e5(0x16b)]=_0x28b5e5(0x120)+_0x973cb6+_0x28b5e5(0x165);}function a8_0x2a89(_0x436edb,_0x32cf7f){_0x436edb=_0x436edb-0xfc;const _0x888e8c=a8_0x888e();let _0x2a891b=_0x888e8c[_0x436edb];return _0x2a891b;}async function ensurePlugin(_0x9befb5,_0x34c41a,_0x12e81d,_0x276856){const _0x3def20=a8_0x2a89;_0x12e81d[_0x3def20(0x16b)]='Installing\x20plugin\x20\x27'+_0x9befb5+_0x3def20(0x11d),await executeClaudeCommand([_0x3def20(0x17a),_0x3def20(0x194),_0x9befb5+'@'+_0x34c41a],_0x3def20(0x150)+_0x9befb5+'\x27',_0x276856),_0x12e81d['text']=_0x3def20(0x182)+_0x9befb5+'\x27\x20installed';}async function createClaudeSettings(_0x3d0f52,_0x18d698=a8_0x3196c1(0x151),_0x307645){const _0xb1ab6e=a8_0x3196c1,_0x379edc=join(process[_0xb1ab6e(0x12f)](),_0xb1ab6e(0x102)),_0x5e23b7=join(_0x379edc,_0xb1ab6e(0x14f));await mkdir(_0x379edc,{'recursive':!![]});let _0x4bc7e5={};if(existsSync(_0x5e23b7))try{const _0xd73b7d=await readFile(_0x5e23b7,_0xb1ab6e(0x18c));_0x4bc7e5=JSON[_0xb1ab6e(0x101)](_0xd73b7d);}catch{_0x4bc7e5={};}const _0x3334b9=_0x4bc7e5[_0xb1ab6e(0x134)]||{},_0x10e404={'ANTHROPIC_BASE_URL':_0x3334b9[_0xb1ab6e(0x16a)],'ANTHROPIC_MODEL':_0x3334b9['ANTHROPIC_MODEL'],'ANTHROPIC_AUTH_TOKEN':_0x3334b9['ANTHROPIC_AUTH_TOKEN'],'statusLine':_0x4bc7e5[_0xb1ab6e(0x188)]},_0x52bd7b={..._0x4bc7e5,'env':{..._0x3334b9,'ANTHROPIC_BASE_URL':_0xb1ab6e(0x156)+_0x3d0f52,'ANTHROPIC_MODEL':_0x18d698,'ANTHROPIC_AUTH_TOKEN':_0xb1ab6e(0x13c)},'statusLine':{'type':_0xb1ab6e(0x189),'command':_0x307645?_0xb1ab6e(0x15d)+_0x307645+_0xb1ab6e(0x125):_0xb1ab6e(0x111)}};return await writeFile(_0x5e23b7,JSON['stringify'](_0x52bd7b,null,0x2)+'\x0a'),_0x10e404;}async function restoreClaudeSettings(_0x571a38){const _0x5d4c58=a8_0x3196c1,_0x23bed3=join(process['cwd'](),'.claude'),_0x325279=join(_0x23bed3,'settings.local.json');if(!existsSync(_0x325279))return;try{const _0x17a0a3=await readFile(_0x325279,_0x5d4c58(0x18c)),_0x37dbd1=JSON[_0x5d4c58(0x101)](_0x17a0a3),_0x1fcf7f=_0x37dbd1[_0x5d4c58(0x134)]||{},_0xdb7772=_0x1fcf7f[_0x5d4c58(0x16a)],_0x442ead=((()=>{const _0x2585c6=_0x5d4c58;if(typeof _0xdb7772!==_0x2585c6(0x112))return![];try{const _0x2e27d9=new URL(_0xdb7772);return _0x2e27d9[_0x2585c6(0x127)]===_0x2585c6(0xfe)||_0x2e27d9[_0x2585c6(0x127)]===_0x2585c6(0x17f);}catch{return![];}})());_0x442ead?(delete _0x1fcf7f['ANTHROPIC_BASE_URL'],delete _0x1fcf7f['ANTHROPIC_MODEL'],delete _0x1fcf7f['ANTHROPIC_AUTH_TOKEN']):(_0x571a38[_0x5d4c58(0x16a)]!==undefined?_0x1fcf7f[_0x5d4c58(0x16a)]=_0x571a38[_0x5d4c58(0x16a)]:delete _0x1fcf7f['ANTHROPIC_BASE_URL'],_0x571a38[_0x5d4c58(0x18f)]!==undefined?_0x1fcf7f[_0x5d4c58(0x18f)]=_0x571a38['ANTHROPIC_MODEL']:delete _0x1fcf7f['ANTHROPIC_MODEL'],_0x571a38[_0x5d4c58(0x163)]!==undefined?_0x1fcf7f[_0x5d4c58(0x163)]=_0x571a38[_0x5d4c58(0x163)]:delete _0x1fcf7f['ANTHROPIC_AUTH_TOKEN']);const _0xc6e65f=_0x37dbd1[_0x5d4c58(0x188)],_0x187031=((()=>{const _0x2a421e=_0x5d4c58;if(!_0xc6e65f||typeof _0xc6e65f!==_0x2a421e(0x121))return![];if(_0xc6e65f['type']!==_0x2a421e(0x189))return![];if(typeof _0xc6e65f[_0x2a421e(0x189)]!==_0x2a421e(0x112))return![];return _0xc6e65f['command'][_0x2a421e(0x153)](_0x2a421e(0x12a))&&_0xc6e65f['command'][_0x2a421e(0x153)]('statusline');})());if(_0x187031)delete _0x37dbd1[_0x5d4c58(0x188)];else _0x571a38[_0x5d4c58(0x188)]!==undefined?_0x37dbd1['statusLine']=_0x571a38[_0x5d4c58(0x188)]:delete _0x37dbd1[_0x5d4c58(0x188)];_0x37dbd1[_0x5d4c58(0x134)]=_0x1fcf7f,await writeFile(_0x325279,JSON[_0x5d4c58(0x123)](_0x37dbd1,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a8_0x3196c1(0x115)]='claude';['description']=a8_0x3196c1(0x128);[a8_0x3196c1(0x130)];[a8_0x3196c1(0x190)];['originalSettings'];[a8_0x3196c1(0x12b)];[a8_0x3196c1(0x184)];async[a8_0x3196c1(0x16c)](_0x55cac9){const _0x18811a=a8_0x3196c1,{tdx:_0x27c0de,options:_0x41c70d,args:_0x25fb0f}=_0x55cac9;try{const _0x2088ed=_0x41c70d,_0x444042=_0x2088ed[_0x18811a(0x168)]||_0x18811a(0x151),_0x5bc07c=_0x2088ed[_0x18811a(0x147)]===![],_0x4f632a=_0x2088ed[_0x18811a(0x17d)]===!![],_0x5ad0b3=_0x2088ed['resume']===!![],_0x478955=_0x2088ed[_0x18811a(0x183)],_0x4f1c95=_0x478955!==undefined&&_0x478955!==![],_0x3fa58b=typeof _0x478955==='string'?_0x478955:undefined,_0x230c7b=[..._0x25fb0f];if(_0x4f632a)_0x230c7b[_0x18811a(0x155)]('-c');else _0x5ad0b3&&_0x230c7b[_0x18811a(0x155)]('-r');const _0x3d42e0=createCommandSpinner(_0x18811a(0x15c),{'verbose':_0x41c70d[_0x18811a(0x13d)]});_0x3d42e0[_0x18811a(0x104)]();try{if(!_0x5bc07c){_0x3d42e0[_0x18811a(0x16b)]=_0x18811a(0x129),this[_0x18811a(0x184)]=await findAvailablePort(0xfa0),_0x3d42e0[_0x18811a(0x16b)]='✓\x20Port\x20'+this[_0x18811a(0x184)];const _0x39a14a=_0x41c70d[_0x18811a(0x13f)];try{const _0x344320=await _0x27c0de[_0x18811a(0x162)][_0x18811a(0x15f)]();_0x344320['account_id']&&writeCachedAccountInfo(_0x41c70d[_0x18811a(0x16f)],_0x344320[_0x18811a(0x159)],_0x39a14a);}catch{}_0x3d42e0[_0x18811a(0x16b)]=_0x18811a(0x132),this[_0x18811a(0x12b)]=new TDXLogger(_0x41c70d[_0x18811a(0x154)],!![]),await this['logger'][_0x18811a(0x14d)]();const _0x4a83d4=this['logger']['getLogPath']();_0x3d42e0[_0x18811a(0x16b)]=_0x18811a(0x18a)+_0x4a83d4;if(_0x4f1c95){if(_0x3fa58b&&!URL['canParse'](_0x3fa58b))throw new SDKError(ErrorCode[_0x18811a(0x178)],_0x18811a(0x173)+_0x3fa58b);const _0x4ddba4=_0x3fa58b||getEndpoint(_0x41c70d['site'],_0x18811a(0x17b));_0x3d42e0[_0x18811a(0x16b)]=_0x18811a(0x171);if(!_0x27c0de[_0x18811a(0x175)]['apiKey'])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x18811a(0x12e));this['passThroughServer']=new PassThroughProxyServer({'port':this[_0x18811a(0x184)],'llmProxyUrl':_0x4ddba4,'apiKey':_0x27c0de[_0x18811a(0x175)][_0x18811a(0x17c)],'logger':this[_0x18811a(0x12b)],'site':_0x41c70d['site'],'profile':_0x39a14a}),await this[_0x18811a(0x190)][_0x18811a(0x104)](),_0x3d42e0[_0x18811a(0x16b)]=_0x18811a(0x10d)+this['port']+'\x20→\x20'+_0x4ddba4;}else{_0x3d42e0[_0x18811a(0x16b)]='Setting\x20up\x20project...';const _0x59c0c1=await _0x27c0de[_0x18811a(0x167)][_0x18811a(0x14c)](),_0x46a6e5=_0x59c0c1['id'];_0x3d42e0[_0x18811a(0x16b)]='✓\x20Using\x20project:\x20'+_0x59c0c1[_0x18811a(0x107)][_0x18811a(0x115)],_0x3d42e0[_0x18811a(0x16b)]='Starting\x20TD\x20LLM\x20proxy\x20server...',this[_0x18811a(0x130)]=new ProxyServer({'port':this['port'],'projectId':_0x46a6e5,'tdx':_0x27c0de,'logger':this[_0x18811a(0x12b)],'site':_0x41c70d[_0x18811a(0x16f)]}),await this[_0x18811a(0x130)][_0x18811a(0x104)](),_0x3d42e0['text']=_0x18811a(0x18d)+this[_0x18811a(0x184)];}_0x3d42e0[_0x18811a(0x16b)]=_0x18811a(0x13e),this[_0x18811a(0xfd)]=await createClaudeSettings(this[_0x18811a(0x184)],_0x444042,_0x39a14a),_0x3d42e0[_0x18811a(0x16b)]='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x3d42e0[_0x18811a(0x16b)]='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{_0x3d42e0[_0x18811a(0x16b)]=_0x18811a(0x193),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x18811a(0x12b)]),_0x3d42e0['text']=_0x18811a(0x148);}catch(_0x3e8fca){_0x3d42e0['fail'](_0x18811a(0x11b));throw _0x3e8fca;}try{await ensureMcpServer('td-docs',_0x18811a(0x11c),_0x18811a(0x116),_0x3d42e0,this[_0x18811a(0x12b)]);}catch(_0x2cd37d){handleInstallationError(_0x2cd37d,_0x18811a(0x161),_0x3d42e0,this[_0x18811a(0x12b)]);}try{await ensureMarketplace(_0x18811a(0x192),_0x18811a(0x12d),_0x3d42e0,this[_0x18811a(0x12b)]),await updateMarketplace('td-skills',_0x3d42e0,this['logger']),await ensurePlugin(_0x18811a(0x158),_0x18811a(0x192),_0x3d42e0,this[_0x18811a(0x12b)]),await ensurePlugin(_0x18811a(0x16d),'td-skills',_0x3d42e0,this[_0x18811a(0x12b)]),await ensurePlugin(_0x18811a(0x187),_0x18811a(0x192),_0x3d42e0,this[_0x18811a(0x12b)]);}catch(_0x5db80a){handleInstallationError(_0x5db80a,_0x18811a(0x15b),_0x3d42e0,this[_0x18811a(0x12b)]);}_0x3d42e0[_0x18811a(0x13a)]();}catch(_0x2ec746){_0x3d42e0[_0x18811a(0x131)](_0x18811a(0x137));throw _0x2ec746;}const _0x514c41=await this[_0x18811a(0x11a)]();if(!_0x514c41)throw new SDKError(ErrorCode[_0x18811a(0x185)],_0x18811a(0x13b),undefined,{'helpText':_0x18811a(0x119)});const _0x3699b2={...process[_0x18811a(0x134)]};!_0x5bc07c&&(_0x3699b2[_0x18811a(0x16a)]=_0x18811a(0x156)+this[_0x18811a(0x184)],_0x3699b2[_0x18811a(0x18f)]=_0x444042,_0x3699b2['ANTHROPIC_AUTH_TOKEN']='tdx-managed-proxy');const _0x2b8d60=spawn(_0x514c41,_0x230c7b,{'stdio':'inherit','env':_0x3699b2}),_0x57efcf=await new Promise(_0x5b6e97=>{const _0x239e34=_0x18811a;_0x2b8d60['on'](_0x239e34(0x142),_0x3ab2a5=>{_0x5b6e97(_0x3ab2a5||0x0);}),_0x2b8d60['on'](_0x239e34(0x18e),_0x20280d=>{const _0x5c2070=_0x239e34;console[_0x5c2070(0x18e)](a8_0xc22838['red']('Failed\x20to\x20launch\x20Claude\x20Code:\x20'+_0x20280d[_0x5c2070(0x14a)])),_0x5b6e97(0x1);});});this[_0x18811a(0x130)]&&(await this[_0x18811a(0x130)][_0x18811a(0x13a)](),console[_0x18811a(0x10f)](a8_0xc22838[_0x18811a(0x103)](_0x18811a(0x114))));this[_0x18811a(0x190)]&&(await this[_0x18811a(0x190)]['stop'](),console[_0x18811a(0x10f)](a8_0xc22838[_0x18811a(0x103)]('✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped')));if(this['logger']){await this[_0x18811a(0x12b)]['close']();const _0x3c5303=this['logger'][_0x18811a(0x180)]();console['log'](a8_0xc22838[_0x18811a(0x103)]('✓\x20Logs\x20saved\x20to\x20'+_0x3c5303));}return this['originalSettings']&&(await restoreClaudeSettings(this[_0x18811a(0xfd)]),console[_0x18811a(0x10f)](a8_0xc22838['green'](_0x18811a(0x145)))),_0x57efcf;}catch(_0x5b16fb){this['server']&&await this[_0x18811a(0x130)][_0x18811a(0x13a)]();this[_0x18811a(0x190)]&&await this['passThroughServer'][_0x18811a(0x13a)]();this[_0x18811a(0x12b)]&&await this[_0x18811a(0x12b)][_0x18811a(0x18b)]();this[_0x18811a(0xfd)]&&await restoreClaudeSettings(this[_0x18811a(0xfd)]);throw _0x5b16fb;}}async['findClaudePath'](){return new Promise(_0x683e3f=>{const _0x5291db=a8_0x2a89,_0x31ff2e=spawn(_0x5291db(0x191),[_0x5291db(0x113)]);let _0x142099='';_0x31ff2e[_0x5291db(0x14b)]['on'](_0x5291db(0x118),_0x21a0c3=>{const _0x2dd488=_0x5291db;_0x142099+=_0x21a0c3[_0x2dd488(0x144)]();}),_0x31ff2e['on'](_0x5291db(0x142),_0x37ebff=>{const _0x320f14=_0x5291db;_0x37ebff===0x0&&_0x142099['trim']()?_0x683e3f(_0x142099[_0x320f14(0x15a)]()):_0x683e3f(null);});});}}
1
+ const a8_0x58bf3d=a8_0x7f2f;(function(_0x5728bc,_0x613b2){const _0x3a34b6=a8_0x7f2f,_0x49c87a=_0x5728bc();while(!![]){try{const _0x1335e6=-parseInt(_0x3a34b6(0x121))/0x1*(parseInt(_0x3a34b6(0x165))/0x2)+parseInt(_0x3a34b6(0x196))/0x3*(parseInt(_0x3a34b6(0x173))/0x4)+-parseInt(_0x3a34b6(0x1a9))/0x5*(-parseInt(_0x3a34b6(0x142))/0x6)+parseInt(_0x3a34b6(0x13e))/0x7+parseInt(_0x3a34b6(0x151))/0x8+parseInt(_0x3a34b6(0x146))/0x9*(-parseInt(_0x3a34b6(0x162))/0xa)+-parseInt(_0x3a34b6(0x19e))/0xb;if(_0x1335e6===_0x613b2)break;else _0x49c87a['push'](_0x49c87a['shift']());}catch(_0x8e01eb){_0x49c87a['push'](_0x49c87a['shift']());}}}(a8_0x571c,0xdbc1d));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a8_0x2e616b from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint}from'../sdk/client/endpoints.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=a8_0x58bf3d(0x19c);function handleInstallationError(_0x110987,_0x2fbc77,_0x21df3b,_0x450b77){const _0x4a936e=a8_0x58bf3d;errorContains(_0x110987,_0x4a936e(0x192),_0x4a936e(0x163),_0x4a936e(0x1a8))?(_0x21df3b[_0x4a936e(0x177)]='✓\x20'+_0x2fbc77+'\x20already\x20configured',_0x450b77?.['info'](_0x2fbc77+_0x4a936e(0x116)),_0x110987 instanceof SDKError&&_0x110987[_0x4a936e(0x17b)]&&_0x450b77?.[_0x4a936e(0x159)](_0x4a936e(0x18c)+_0x110987['cause'][_0x4a936e(0x197)])):(_0x21df3b[_0x4a936e(0x125)](_0x4a936e(0x17c)+_0x2fbc77),_0x450b77?.[_0x4a936e(0x179)](_0x2fbc77+_0x4a936e(0x17f),_0x110987));}export function parseVersion(_0x433be4){const _0x55b783=a8_0x58bf3d,_0x44c688=_0x433be4[_0x55b783(0x16b)]()[_0x55b783(0x175)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x44c688)return null;return{'major':parseInt(_0x44c688[0x1],0xa),'minor':parseInt(_0x44c688[0x2],0xa),'patch':parseInt(_0x44c688[0x3],0xa)};}export function compareVersions(_0x45510a,_0x5dfe57){const _0x27ccad=a8_0x58bf3d;if(_0x45510a['major']!==_0x5dfe57[_0x27ccad(0x13d)])return _0x45510a['major']-_0x5dfe57[_0x27ccad(0x13d)];if(_0x45510a[_0x27ccad(0x12d)]!==_0x5dfe57[_0x27ccad(0x12d)])return _0x45510a[_0x27ccad(0x12d)]-_0x5dfe57['minor'];return _0x45510a[_0x27ccad(0x11a)]-_0x5dfe57['patch'];}async function checkClaudeVersion(_0x576d28,_0x47faaf){const _0x2eb87a=a8_0x58bf3d;_0x47faaf?.[_0x2eb87a(0x159)](_0x2eb87a(0x13c)+_0x576d28+')');const _0x2aaf13=await executeClaudeCommand(['--version'],undefined,_0x47faaf),_0x3035b1=parseVersion(_0x2aaf13);if(!_0x3035b1){_0x47faaf?.[_0x2eb87a(0x125)](_0x2eb87a(0x17e)+_0x2aaf13);return;}const _0x40691c=_0x3035b1['major']+'.'+_0x3035b1[_0x2eb87a(0x12d)]+'.'+_0x3035b1[_0x2eb87a(0x11a)],_0x11a252=parseVersion(_0x576d28);if(!_0x11a252){_0x47faaf?.[_0x2eb87a(0x125)](_0x2eb87a(0x14f)+_0x576d28);return;}if(compareVersions(_0x3035b1,_0x11a252)<0x0){_0x47faaf?.[_0x2eb87a(0x179)](_0x2eb87a(0x181)+_0x40691c+_0x2eb87a(0x150)+_0x576d28+')');throw new SDKError(ErrorCode['CLAUDE_CODE_UNSUPPORTED_VERSION'],_0x2eb87a(0x181)+_0x40691c+_0x2eb87a(0x155)+_0x576d28+_0x2eb87a(0x12b),undefined,{'helpText':_0x2eb87a(0x123)});}_0x47faaf?.[_0x2eb87a(0x159)](_0x2eb87a(0x181)+_0x40691c+'\x20meets\x20minimum\x20requirement');}async function executeClaudeCommand(_0x50a2c4,_0x26d0e0,_0x4a06c3){const _0xdde5d7=a8_0x58bf3d;return _0x4a06c3?.['info'](_0xdde5d7(0x1a0)+_0x50a2c4[_0xdde5d7(0x18a)]('\x20')),new Promise((_0x5c3be4,_0x235f74)=>{const _0x3e00f9=_0xdde5d7,_0x2171f8=spawn(_0x3e00f9(0x183),_0x50a2c4,{'stdio':'pipe'});let _0x99a5b7='',_0x1f40db='';_0x2171f8[_0x3e00f9(0x144)]['on']('data',_0x53c1ab=>{_0x99a5b7+=_0x53c1ab['toString']();}),_0x2171f8[_0x3e00f9(0x12f)]['on'](_0x3e00f9(0x168),_0x3c14fc=>{const _0x1e6b2e=_0x3e00f9;_0x1f40db+=_0x3c14fc[_0x1e6b2e(0x1aa)]();}),_0x2171f8['on'](_0x3e00f9(0x179),_0x2b136d=>{const _0x29f1df=_0x3e00f9;_0x2b136d[_0x29f1df(0x15c)]===_0x29f1df(0x16c)?(_0x4a06c3?.[_0x29f1df(0x179)](_0x29f1df(0x154)),_0x235f74(new SDKError(ErrorCode[_0x29f1df(0x19b)],_0x29f1df(0x154),_0x2b136d,{'helpText':_0x29f1df(0x172)}))):(_0x4a06c3?.[_0x29f1df(0x179)](_0x29f1df(0x15b)+_0x2b136d[_0x29f1df(0x197)]),_0x235f74(new SDKError(ErrorCode[_0x29f1df(0x139)],_0x29f1df(0x124)+_0x2b136d[_0x29f1df(0x197)],_0x2b136d)));}),_0x2171f8['on']('exit',_0x310862=>{const _0x1746b8=_0x3e00f9;if(_0x310862===0x0)_0x5c3be4(_0x99a5b7);else _0x26d0e0?(_0x4a06c3?.[_0x1746b8(0x179)]('Command\x20failed\x20(exit\x20'+_0x310862+_0x1746b8(0x115)+_0x50a2c4[_0x1746b8(0x18a)]('\x20')),_0x235f74(new SDKError(ErrorCode[_0x1746b8(0x15f)],_0x26d0e0,new Error(_0x1f40db)))):_0x5c3be4('');});});}function a8_0x571c(){const _0x1f9712=['Claude\x20Code\x20version\x20','utf-8','claude','ANTHROPIC_BASE_URL','parse','start','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','ANTHROPIC_AUTH_TOKEN','✓\x20Settings\x20restored:\x20.claude/settings.local.json','join','\x27\x20updated','Command\x20output:\x20','https://docs.treasuredata.com/mcp','tdx-skills','object','llm','Setting\x20up\x20project...','already\x20exists','Configuring\x20MCP\x20server\x20\x27','description','Failed\x20to\x20launch\x20Claude\x20Code:\x20','3LkjyJD','message','getLogPath','string','\x20→\x20','CLAUDE_CODE_NOT_FOUND','2.0.20','inherit','8152078ucIJbo','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','Executing:\x20claude\x20','statusline','llm-proxy','http','server','model','tdx-managed-proxy','tdx\x20--profile\x20','already\x20configured','730dlCieC','toString','logger','settings.local.json','passThroughServer','account_id','.claude','sql-skills','type','):\x20claude\x20','\x20already\x20configured','port','Finding\x20available\x20port...','plugin','patch','fail','--transport','logLevel','\x27\x20installed','command','getOrCreateDefaultProject','5xWFRnc','cwd','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','Failed\x20to\x20spawn\x20claude\x20command:\x20','warn','http://127.0.0.1:','ANTHROPIC_MODEL','Creating\x20.claude/settings.local.json...','stop','✓\x20Settings\x20configured:\x20.claude/settings.local.json','\x20or\x20later.','llmProxy','minor','unshift','stderr','getCurrent','includes','profile','hostname','td-skills','Claude\x20Code\x20version\x20check\x20failed','INVALID_ARGUMENT','add','proxy','INTERNAL','user','\x27...','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','major','3476473CrHdQL','localhost','update','✓\x20Using\x20project:\x20','31722UplleR','execute','stdout','TD\x20Docs\x20MCP\x20Server','171QStEnh','td-skills\x20Plugins','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','log','tdx\x20claude\x20statusline','resume','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','green','attributes','Invalid\x20minimum\x20version\x20format:\x20','\x20is\x20too\x20old\x20(minimum:\x20','8549688qenWZY','context','✓\x20Logs\x20saved\x20to\x20','Claude\x20Code\x20CLI\x20not\x20found','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','Configuring\x20marketplace\x20\x27','✓\x20Claude\x20Code\x20version\x20OK','findClaudePath','debug','marketplace','Command\x20spawn\x20error:\x20','code','Setup\x20failed','https://github.com/treasure-data/td-skills','INSTALLATION_FAILED','Installing\x20plugin\x20\x27','\x20claude\x20statusline','16490xwFkPk','already\x20installed','exit','715534VxypYF','mcp','Failed\x20to\x20install\x20plugin\x20\x27','data','apiKey','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','trim','ENOENT','site','stringify','statusLine','\x27\x20configured','env','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','4496548vTroRS','sonnet','match','originalSettings','text','name','error','Updating\x20marketplace\x20\x27','cause','Warning:\x20Failed\x20to\x20configure\x20','tdx','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','\x20configuration\x20failed','Starting\x20TD\x20LLM\x20proxy\x20server...'];a8_0x571c=function(){return _0x1f9712;};return a8_0x571c();}async function ensureMcpServer(_0x5e0c9e,_0x5a40f0,_0x589d42,_0x2858cc,_0x3099df){const _0x4f5e80=a8_0x58bf3d;_0x2858cc['text']=_0x4f5e80(0x193)+_0x5e0c9e+'\x27...',await executeClaudeCommand([_0x4f5e80(0x166),_0x4f5e80(0x137),_0x5e0c9e,_0x5a40f0,_0x4f5e80(0x11c),_0x589d42],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0x5e0c9e+'\x27',_0x3099df),_0x2858cc[_0x4f5e80(0x177)]='✓\x20MCP\x20server\x20\x27'+_0x5e0c9e+_0x4f5e80(0x170);}async function ensureMarketplace(_0x52bbc5,_0x494d21,_0x30844d,_0x3f2efd){const _0x3257b6=a8_0x58bf3d;_0x30844d[_0x3257b6(0x177)]=_0x3257b6(0x156)+_0x52bbc5+_0x3257b6(0x13b),await executeClaudeCommand([_0x3257b6(0x119),_0x3257b6(0x15a),_0x3257b6(0x137),_0x494d21],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x52bbc5+'\x27',_0x3f2efd),_0x30844d[_0x3257b6(0x177)]='✓\x20Marketplace\x20\x27'+_0x52bbc5+_0x3257b6(0x170);}async function updateMarketplace(_0x1ad6ed,_0x55083,_0x15d09f){const _0x2860f1=a8_0x58bf3d;_0x55083[_0x2860f1(0x177)]=_0x2860f1(0x17a)+_0x1ad6ed+_0x2860f1(0x13b),await executeClaudeCommand([_0x2860f1(0x119),_0x2860f1(0x15a),_0x2860f1(0x140)],'Failed\x20to\x20update\x20marketplace\x20\x27'+_0x1ad6ed+'\x27',_0x15d09f),_0x55083[_0x2860f1(0x177)]='✓\x20Marketplace\x20\x27'+_0x1ad6ed+_0x2860f1(0x18b);}async function ensurePlugin(_0x247211,_0x400532,_0xe25733,_0x57e11d){const _0x3bdcd7=a8_0x58bf3d;_0xe25733[_0x3bdcd7(0x177)]=_0x3bdcd7(0x160)+_0x247211+_0x3bdcd7(0x13b),await executeClaudeCommand([_0x3bdcd7(0x119),'install',_0x247211+'@'+_0x400532],_0x3bdcd7(0x167)+_0x247211+'\x27',_0x57e11d),_0xe25733[_0x3bdcd7(0x177)]='✓\x20Plugin\x20\x27'+_0x247211+_0x3bdcd7(0x11e);}function a8_0x7f2f(_0x48b646,_0x3d784b){_0x48b646=_0x48b646-0x114;const _0x571c3d=a8_0x571c();let _0x7f2f09=_0x571c3d[_0x48b646];return _0x7f2f09;}async function createClaudeSettings(_0x5b7dfa,_0x29fcf0=a8_0x58bf3d(0x174),_0x417d67){const _0x5d7bd0=a8_0x58bf3d,_0x1e0571=join(process[_0x5d7bd0(0x122)](),_0x5d7bd0(0x1af)),_0x51377e=join(_0x1e0571,'settings.local.json');await mkdir(_0x1e0571,{'recursive':!![]});let _0x160da4={};if(existsSync(_0x51377e))try{const _0x468939=await readFile(_0x51377e,'utf-8');_0x160da4=JSON[_0x5d7bd0(0x185)](_0x468939);}catch{_0x160da4={};}const _0x335c72=_0x160da4[_0x5d7bd0(0x171)]||{},_0x2d2d99={'ANTHROPIC_BASE_URL':_0x335c72[_0x5d7bd0(0x184)],'ANTHROPIC_MODEL':_0x335c72[_0x5d7bd0(0x127)],'ANTHROPIC_AUTH_TOKEN':_0x335c72['ANTHROPIC_AUTH_TOKEN'],'statusLine':_0x160da4[_0x5d7bd0(0x16f)]},_0x1b5d34={..._0x160da4,'env':{..._0x335c72,'ANTHROPIC_BASE_URL':_0x5d7bd0(0x126)+_0x5b7dfa,'ANTHROPIC_MODEL':_0x29fcf0,'ANTHROPIC_AUTH_TOKEN':_0x5d7bd0(0x1a6)},'statusLine':{'type':_0x5d7bd0(0x11f),'command':_0x417d67?_0x5d7bd0(0x1a7)+_0x417d67+_0x5d7bd0(0x161):_0x5d7bd0(0x14a)}};return await writeFile(_0x51377e,JSON['stringify'](_0x1b5d34,null,0x2)+'\x0a'),_0x2d2d99;}async function restoreClaudeSettings(_0xdedc11){const _0x494612=a8_0x58bf3d,_0x108ff4=join(process[_0x494612(0x122)](),_0x494612(0x1af)),_0x16141d=join(_0x108ff4,_0x494612(0x1ac));if(!existsSync(_0x16141d))return;try{const _0x1b3c4b=await readFile(_0x16141d,_0x494612(0x182)),_0x25d6f6=JSON['parse'](_0x1b3c4b),_0x58501b=_0x25d6f6[_0x494612(0x171)]||{},_0x34dec1=_0x58501b['ANTHROPIC_BASE_URL'],_0x49ac59=((()=>{const _0x41020f=_0x494612;if(typeof _0x34dec1!==_0x41020f(0x199))return![];try{const _0x368d3b=new URL(_0x34dec1);return _0x368d3b[_0x41020f(0x133)]===_0x41020f(0x13f)||_0x368d3b[_0x41020f(0x133)]==='127.0.0.1';}catch{return![];}})());_0x49ac59?(delete _0x58501b[_0x494612(0x184)],delete _0x58501b[_0x494612(0x127)],delete _0x58501b[_0x494612(0x188)]):(_0xdedc11['ANTHROPIC_BASE_URL']!==undefined?_0x58501b[_0x494612(0x184)]=_0xdedc11['ANTHROPIC_BASE_URL']:delete _0x58501b[_0x494612(0x184)],_0xdedc11[_0x494612(0x127)]!==undefined?_0x58501b['ANTHROPIC_MODEL']=_0xdedc11[_0x494612(0x127)]:delete _0x58501b['ANTHROPIC_MODEL'],_0xdedc11[_0x494612(0x188)]!==undefined?_0x58501b['ANTHROPIC_AUTH_TOKEN']=_0xdedc11[_0x494612(0x188)]:delete _0x58501b['ANTHROPIC_AUTH_TOKEN']);const _0x5b067a=_0x25d6f6[_0x494612(0x16f)],_0x525b7e=((()=>{const _0x57af21=_0x494612;if(!_0x5b067a||typeof _0x5b067a!==_0x57af21(0x18f))return![];if(_0x5b067a[_0x57af21(0x114)]!==_0x57af21(0x11f))return![];if(typeof _0x5b067a[_0x57af21(0x11f)]!=='string')return![];return _0x5b067a[_0x57af21(0x11f)]['includes'](_0x57af21(0x17d))&&_0x5b067a['command'][_0x57af21(0x131)](_0x57af21(0x1a1));})());if(_0x525b7e)delete _0x25d6f6[_0x494612(0x16f)];else _0xdedc11[_0x494612(0x16f)]!==undefined?_0x25d6f6['statusLine']=_0xdedc11[_0x494612(0x16f)]:delete _0x25d6f6[_0x494612(0x16f)];_0x25d6f6['env']=_0x58501b,await writeFile(_0x16141d,JSON[_0x494612(0x16e)](_0x25d6f6,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a8_0x58bf3d(0x178)]=a8_0x58bf3d(0x183);[a8_0x58bf3d(0x194)]=a8_0x58bf3d(0x16a);[a8_0x58bf3d(0x1a4)];['passThroughServer'];[a8_0x58bf3d(0x176)];['logger'];['port'];async[a8_0x58bf3d(0x143)](_0x38ac88){const _0x545f76=a8_0x58bf3d,{tdx:_0x44c219,options:_0x17c82c,args:_0x3f4134}=_0x38ac88;try{const _0x280838=_0x17c82c,_0x9053b5=_0x280838[_0x545f76(0x1a5)]||_0x545f76(0x174),_0x239c21=_0x280838[_0x545f76(0x138)]===![],_0x300a6e=_0x280838['continue']===!![],_0x5804ef=_0x280838[_0x545f76(0x14b)]===!![],_0x54521e=_0x280838[_0x545f76(0x12c)],_0x2d1d85=_0x54521e!==undefined&&_0x54521e!==![],_0x45cb33=typeof _0x54521e==='string'?_0x54521e:undefined,_0x34127e=[..._0x3f4134];if(_0x300a6e)_0x34127e[_0x545f76(0x12e)]('-c');else _0x5804ef&&_0x34127e['unshift']('-r');const _0x3d1579=createCommandSpinner('Initializing...',{'verbose':_0x17c82c['verbose']});_0x3d1579['start']();try{if(!_0x239c21){_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x118),this[_0x545f76(0x117)]=await findAvailablePort(0xfa0),_0x3d1579[_0x545f76(0x177)]='✓\x20Port\x20'+this[_0x545f76(0x117)];const _0x598f2b=_0x17c82c[_0x545f76(0x132)];try{const _0x5c983b=await _0x44c219[_0x545f76(0x13a)][_0x545f76(0x130)]();_0x5c983b[_0x545f76(0x1ae)]&&writeCachedAccountInfo(_0x17c82c[_0x545f76(0x16d)],_0x5c983b['account_id'],_0x598f2b);}catch{}_0x3d1579[_0x545f76(0x177)]='Initializing\x20proxy\x20logger...',this[_0x545f76(0x1ab)]=new TDXLogger(_0x17c82c[_0x545f76(0x11d)],!![]),await this[_0x545f76(0x1ab)]['init']();const _0x38725d=this[_0x545f76(0x1ab)][_0x545f76(0x198)]();_0x3d1579[_0x545f76(0x177)]='✓\x20Logging\x20to\x20'+_0x38725d;if(_0x2d1d85){if(_0x45cb33&&!URL['canParse'](_0x45cb33))throw new SDKError(ErrorCode[_0x545f76(0x136)],'Invalid\x20LLM\x20proxy\x20URL:\x20'+_0x45cb33);const _0x338bd8=_0x45cb33||getEndpoint(_0x17c82c[_0x545f76(0x16d)],_0x545f76(0x1a2));_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x19f);if(!_0x44c219['context'][_0x545f76(0x169)])throw new SDKError(ErrorCode[_0x545f76(0x136)],_0x545f76(0x14c));this[_0x545f76(0x1ad)]=new PassThroughProxyServer({'port':this[_0x545f76(0x117)],'llmProxyUrl':_0x338bd8,'apiKey':_0x44c219[_0x545f76(0x152)][_0x545f76(0x169)],'logger':this[_0x545f76(0x1ab)],'site':_0x17c82c['site'],'profile':_0x598f2b}),await this[_0x545f76(0x1ad)][_0x545f76(0x186)](),_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x187)+this[_0x545f76(0x117)]+_0x545f76(0x19a)+_0x338bd8;}else{_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x191);const _0x20a65e=await _0x44c219[_0x545f76(0x190)][_0x545f76(0x120)](),_0x254f7a=_0x20a65e['id'];_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x141)+_0x20a65e[_0x545f76(0x14e)][_0x545f76(0x178)],_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x180),this[_0x545f76(0x1a4)]=new ProxyServer({'port':this[_0x545f76(0x117)],'projectId':_0x254f7a,'tdx':_0x44c219,'logger':this[_0x545f76(0x1ab)],'site':_0x17c82c[_0x545f76(0x16d)]}),await this[_0x545f76(0x1a4)][_0x545f76(0x186)](),_0x3d1579[_0x545f76(0x177)]='✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20'+this['port'];}_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x128),this[_0x545f76(0x176)]=await createClaudeSettings(this['port'],_0x9053b5,_0x598f2b),_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x12a);}else _0x3d1579[_0x545f76(0x177)]='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{_0x3d1579[_0x545f76(0x177)]='Checking\x20Claude\x20Code\x20version...',await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x545f76(0x1ab)]),_0x3d1579[_0x545f76(0x177)]=_0x545f76(0x157);}catch(_0x33b995){_0x3d1579[_0x545f76(0x11b)](_0x545f76(0x135));throw _0x33b995;}try{await ensureMcpServer('td-docs',_0x545f76(0x18d),_0x545f76(0x1a3),_0x3d1579,this[_0x545f76(0x1ab)]);}catch(_0x21cff7){handleInstallationError(_0x21cff7,_0x545f76(0x145),_0x3d1579,this[_0x545f76(0x1ab)]);}try{await ensureMarketplace(_0x545f76(0x134),_0x545f76(0x15e),_0x3d1579,this[_0x545f76(0x1ab)]),await updateMarketplace(_0x545f76(0x134),_0x3d1579,this['logger']),await ensurePlugin(_0x545f76(0x1b0),_0x545f76(0x134),_0x3d1579,this['logger']),await ensurePlugin('workflow-skills',_0x545f76(0x134),_0x3d1579,this[_0x545f76(0x1ab)]),await ensurePlugin(_0x545f76(0x18e),'td-skills',_0x3d1579,this[_0x545f76(0x1ab)]);}catch(_0x22697a){handleInstallationError(_0x22697a,_0x545f76(0x147),_0x3d1579,this['logger']);}_0x3d1579['stop']();}catch(_0x462c6f){_0x3d1579[_0x545f76(0x11b)](_0x545f76(0x15d));throw _0x462c6f;}const _0x4e3a54=await this[_0x545f76(0x158)]();if(!_0x4e3a54)throw new SDKError(ErrorCode[_0x545f76(0x19b)],_0x545f76(0x154),undefined,{'helpText':_0x545f76(0x172)});const _0xf504cb={...process[_0x545f76(0x171)]};!_0x239c21&&(_0xf504cb[_0x545f76(0x184)]=_0x545f76(0x126)+this[_0x545f76(0x117)],_0xf504cb[_0x545f76(0x127)]=_0x9053b5,_0xf504cb[_0x545f76(0x188)]=_0x545f76(0x1a6));const _0x425da1=spawn(_0x4e3a54,_0x34127e,{'stdio':_0x545f76(0x19d),'env':_0xf504cb}),_0x4180c7=await new Promise(_0x2ad8df=>{const _0x456961=_0x545f76;_0x425da1['on'](_0x456961(0x164),_0x2df2b0=>{_0x2ad8df(_0x2df2b0||0x0);}),_0x425da1['on'](_0x456961(0x179),_0x356ddd=>{const _0x37bc30=_0x456961;console[_0x37bc30(0x179)](a8_0x2e616b['red'](_0x37bc30(0x195)+_0x356ddd['message'])),_0x2ad8df(0x1);});});this[_0x545f76(0x1a4)]&&(await this[_0x545f76(0x1a4)][_0x545f76(0x129)](),console['log'](a8_0x2e616b[_0x545f76(0x14d)]('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));this[_0x545f76(0x1ad)]&&(await this[_0x545f76(0x1ad)][_0x545f76(0x129)](),console['log'](a8_0x2e616b[_0x545f76(0x14d)](_0x545f76(0x148))));if(this[_0x545f76(0x1ab)]){await this[_0x545f76(0x1ab)]['close']();const _0xb83a5f=this[_0x545f76(0x1ab)][_0x545f76(0x198)]();console['log'](a8_0x2e616b[_0x545f76(0x14d)](_0x545f76(0x153)+_0xb83a5f));}return this['originalSettings']&&(await restoreClaudeSettings(this[_0x545f76(0x176)]),console[_0x545f76(0x149)](a8_0x2e616b[_0x545f76(0x14d)](_0x545f76(0x189)))),_0x4180c7;}catch(_0x45cad9){this['server']&&await this[_0x545f76(0x1a4)]['stop']();this[_0x545f76(0x1ad)]&&await this[_0x545f76(0x1ad)]['stop']();this[_0x545f76(0x1ab)]&&await this[_0x545f76(0x1ab)]['close']();this['originalSettings']&&await restoreClaudeSettings(this['originalSettings']);throw _0x45cad9;}}async[a8_0x58bf3d(0x158)](){return new Promise(_0x63dd99=>{const _0x6fe3cd=a8_0x7f2f,_0x2a75fb=spawn('which',[_0x6fe3cd(0x183)]);let _0x4f8be3='';_0x2a75fb[_0x6fe3cd(0x144)]['on'](_0x6fe3cd(0x168),_0x1194fa=>{const _0x263b37=_0x6fe3cd;_0x4f8be3+=_0x1194fa[_0x263b37(0x1aa)]();}),_0x2a75fb['on']('exit',_0x3da3dd=>{const _0x379a3e=_0x6fe3cd;_0x3da3dd===0x0&&_0x4f8be3['trim']()?_0x63dd99(_0x4f8be3[_0x379a3e(0x16b)]()):_0x63dd99(null);});});}}
@@ -1 +1 @@
1
- const a9_0x41b8c3=a9_0x1283;function a9_0x1283(_0x212abd,_0x481dd0){_0x212abd=_0x212abd-0xea;const _0x3c3c53=a9_0x3c3c();let _0x12830b=_0x3c3c53[_0x212abd];return _0x12830b;}(function(_0x474501,_0x466c2f){const _0x5b452d=a9_0x1283,_0x4f72a6=_0x474501();while(!![]){try{const _0x1b962a=parseInt(_0x5b452d(0xea))/0x1+parseInt(_0x5b452d(0xfe))/0x2+parseInt(_0x5b452d(0x103))/0x3+-parseInt(_0x5b452d(0xeb))/0x4+parseInt(_0x5b452d(0x10d))/0x5*(-parseInt(_0x5b452d(0x102))/0x6)+-parseInt(_0x5b452d(0xfd))/0x7*(-parseInt(_0x5b452d(0xf8))/0x8)+parseInt(_0x5b452d(0xfc))/0x9*(parseInt(_0x5b452d(0x108))/0xa);if(_0x1b962a===_0x466c2f)break;else _0x4f72a6['push'](_0x4f72a6['shift']());}catch(_0x354e10){_0x4f72a6['push'](_0x4f72a6['shift']());}}}(a9_0x3c3c,0x79401));function a9_0x3c3c(){const _0x4b858e=['log','250EIFwiV','\x20today\x20/\x20','🧠\x20','toFixed','options','175xbGkkM','Claude','18543aJteeL','3143020ilLVny','💎\x20','\x20-\x20','description','session_id','🪙\x20credit:\x20','latestInputTokens','monthCredits','line','sessionCredits','\x20|\x20','todayCredits','model','573288mfEiMV','accountId','tdx','close','77697AbUdhl','70SZUewA','860010rEduNF','tdx\x20','push','statusline','128910qIccaB','1960164AMZDKV','profile','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','💎\x20tdx\x20-\x20Claude'];a9_0x3c3c=function(){return _0x4b858e;};return a9_0x3c3c();}import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x60caef=0x64){return new Promise(_0x373cd8=>{const _0x273c50=a9_0x1283;let _0x37d754='',_0x1c4cf7=![];const _0x23439e=createInterface({'input':process['stdin'],'terminal':![]}),_0x2ede32=_0xb6b9c7=>{const _0x335a03=a9_0x1283;if(_0x1c4cf7)return;_0x1c4cf7=!![],clearTimeout(_0x325194),_0x23439e[_0x335a03(0xfb)](),_0x373cd8(_0xb6b9c7);},_0x325194=setTimeout(()=>{_0x2ede32(null);},_0x60caef);_0x23439e['on'](_0x273c50(0xf3),_0x19c1ee=>{_0x37d754+=_0x19c1ee;}),_0x23439e['on'](_0x273c50(0xfb),()=>{if(_0x1c4cf7)return;try{const _0x2c9ca0=JSON['parse'](_0x37d754);_0x2ede32(_0x2c9ca0);}catch{_0x2ede32(null);}});});}function formatCredits(_0x594647){const _0x6bbd50=a9_0x1283;return _0x594647[_0x6bbd50(0x10b)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{['name']=a9_0x41b8c3(0x101);[a9_0x41b8c3(0xee)]=a9_0x41b8c3(0x105);async['execute'](_0x534bc1){const _0x1d71e9=a9_0x41b8c3;try{const _0x500b86=await readStdinJson();if(!_0x500b86?.[_0x1d71e9(0xef)])return console['log']('💎\x20tdx\x20-\x20Claude'),0x0;const _0x5138a9=_0x500b86[_0x1d71e9(0xef)],_0x541e9a=_0x500b86[_0x1d71e9(0xf7)]?.['id']||'',_0x5c10f4=_0x500b86[_0x1d71e9(0x104)]||_0x534bc1[_0x1d71e9(0x10c)][_0x1d71e9(0x104)],_0x3a038f=await getUsageStats(_0x5138a9,_0x5c10f4),_0x1e9ba1=[],_0x4674aa=readCachedAccountInfo(_0x5c10f4),_0x25808e=_0x4674aa?_0x1d71e9(0xff)+_0x4674aa['site']+':'+_0x4674aa[_0x1d71e9(0xf9)]:_0x1d71e9(0xfa),_0x1782aa=_0x541e9a?getModelDisplayName(_0x541e9a):_0x1d71e9(0x10e);_0x1e9ba1[_0x1d71e9(0x100)](_0x1d71e9(0xec)+_0x25808e+_0x1d71e9(0xed)+_0x1782aa);const _0x426a98=formatCredits(_0x3a038f[_0x1d71e9(0xf4)]),_0x511e2a=formatCredits(_0x3a038f[_0x1d71e9(0xf6)]),_0x4026c7=formatCredits(_0x3a038f[_0x1d71e9(0xf2)]);_0x1e9ba1['push'](_0x1d71e9(0xf0)+_0x426a98+'\x20session\x20/\x20'+_0x511e2a+_0x1d71e9(0x109)+_0x4026c7+'\x20month');if(_0x3a038f[_0x1d71e9(0xf1)]>0x0&&_0x541e9a){const _0x35a0ef=formatTokenCount(_0x3a038f['latestInputTokens']),_0x30a622=calculateContextPercentage(_0x3a038f[_0x1d71e9(0xf1)],_0x541e9a);_0x1e9ba1[_0x1d71e9(0x100)](_0x1d71e9(0x10a)+_0x35a0ef+'\x20('+_0x30a622+'%)');}return console[_0x1d71e9(0x107)](_0x1e9ba1['join'](_0x1d71e9(0xf5))),0x0;}catch{return console['log'](_0x1d71e9(0x106)),0x0;}}}
1
+ const a9_0x36db82=a9_0x363a;(function(_0xf64ef5,_0x3c94ee){const _0x15a2fb=a9_0x363a,_0x19edc8=_0xf64ef5();while(!![]){try{const _0x45076c=-parseInt(_0x15a2fb(0xa1))/0x1*(parseInt(_0x15a2fb(0xb8))/0x2)+-parseInt(_0x15a2fb(0x9f))/0x3+parseInt(_0x15a2fb(0xb6))/0x4+parseInt(_0x15a2fb(0xb7))/0x5*(parseInt(_0x15a2fb(0xb9))/0x6)+-parseInt(_0x15a2fb(0xa9))/0x7*(-parseInt(_0x15a2fb(0xa7))/0x8)+parseInt(_0x15a2fb(0xa3))/0x9*(-parseInt(_0x15a2fb(0x97))/0xa)+parseInt(_0x15a2fb(0xa2))/0xb;if(_0x45076c===_0x3c94ee)break;else _0x19edc8['push'](_0x19edc8['shift']());}catch(_0x22b037){_0x19edc8['push'](_0x19edc8['shift']());}}}(a9_0x25af,0x6fde4));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';function a9_0x25af(){const _0x2e49f0=['accountId','push','🪙\x20credit:\x20','469116nymRhz','352150EgkmpL','888SXimYY','6loUziX','\x20today\x20/\x20','log','profile','8550QrdwOe','latestInputTokens','sessionCredits','monthCredits','statusline','close','💎\x20tdx\x20-\x20Claude','name','1002372ZzRsfz','parse','914uFouJa','15752264jLKtnn','9297USfdbg','toFixed','session_id','model','26192GJjTQM','\x20|\x20','987qmHpXi','todayCredits','Claude','line','options','join','\x20month','\x20-\x20','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','tdx\x20'];a9_0x25af=function(){return _0x2e49f0;};return a9_0x25af();}function a9_0x363a(_0x11feb5,_0x3e13d7){_0x11feb5=_0x11feb5-0x97;const _0x25af50=a9_0x25af();let _0x363af6=_0x25af50[_0x11feb5];return _0x363af6;}import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x38a705=0x64){return new Promise(_0x64914e=>{const _0x40ac9a=a9_0x363a;let _0x27dbda='',_0x1b05e3=![];const _0x4b5703=createInterface({'input':process['stdin'],'terminal':![]}),_0x57ba14=_0x13774a=>{const _0x4bf3c4=a9_0x363a;if(_0x1b05e3)return;_0x1b05e3=!![],clearTimeout(_0x190ad0),_0x4b5703[_0x4bf3c4(0x9c)](),_0x64914e(_0x13774a);},_0x190ad0=setTimeout(()=>{_0x57ba14(null);},_0x38a705);_0x4b5703['on'](_0x40ac9a(0xac),_0x1d5e65=>{_0x27dbda+=_0x1d5e65;}),_0x4b5703['on'](_0x40ac9a(0x9c),()=>{const _0x2d63a1=_0x40ac9a;if(_0x1b05e3)return;try{const _0x1a529f=JSON[_0x2d63a1(0xa0)](_0x27dbda);_0x57ba14(_0x1a529f);}catch{_0x57ba14(null);}});});}function formatCredits(_0x30ad2b){const _0xcc6724=a9_0x363a;return _0x30ad2b[_0xcc6724(0xa4)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a9_0x36db82(0x9e)]=a9_0x36db82(0x9b);['description']=a9_0x36db82(0xb1);async['execute'](_0x5b371b){const _0x1986ed=a9_0x36db82;try{const _0x5383e3=await readStdinJson();if(!_0x5383e3?.[_0x1986ed(0xa5)])return console[_0x1986ed(0xbb)](_0x1986ed(0x9d)),0x0;const _0x5b564b=_0x5383e3[_0x1986ed(0xa5)],_0x3d38df=_0x5383e3[_0x1986ed(0xa6)]?.['id']||'',_0x31e51d=_0x5383e3[_0x1986ed(0xbc)]||_0x5b371b[_0x1986ed(0xad)][_0x1986ed(0xbc)],_0x488ce7=await getUsageStats(_0x5b564b,_0x31e51d),_0x4e26ca=[],_0x3e14fa=readCachedAccountInfo(_0x31e51d),_0x96430b=_0x3e14fa?_0x1986ed(0xb2)+_0x3e14fa['site']+':'+_0x3e14fa[_0x1986ed(0xb3)]:'tdx',_0x26e151=_0x3d38df?getModelDisplayName(_0x3d38df):_0x1986ed(0xab);_0x4e26ca[_0x1986ed(0xb4)]('💎\x20'+_0x96430b+_0x1986ed(0xb0)+_0x26e151);const _0x4b95d7=formatCredits(_0x488ce7[_0x1986ed(0x99)]),_0x2f08a4=formatCredits(_0x488ce7[_0x1986ed(0xaa)]),_0x21b7db=formatCredits(_0x488ce7[_0x1986ed(0x9a)]);_0x4e26ca[_0x1986ed(0xb4)](_0x1986ed(0xb5)+_0x4b95d7+'\x20session\x20/\x20'+_0x2f08a4+_0x1986ed(0xba)+_0x21b7db+_0x1986ed(0xaf));if(_0x488ce7[_0x1986ed(0x98)]>0x0&&_0x3d38df){const _0x3d4f6d=formatTokenCount(_0x488ce7[_0x1986ed(0x98)]),_0x578525=calculateContextPercentage(_0x488ce7[_0x1986ed(0x98)],_0x3d38df);_0x4e26ca[_0x1986ed(0xb4)]('🧠\x20'+_0x3d4f6d+'\x20('+_0x578525+'%)');}return console['log'](_0x4e26ca[_0x1986ed(0xae)](_0x1986ed(0xa8))),0x0;}catch{return console[_0x1986ed(0xbb)](_0x1986ed(0x9d)),0x0;}}}