@treasuredata/tdx 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/agent-command.js +1 -1
  15. package/dist/commands/api-command.js +1 -1
  16. package/dist/commands/auth-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-statusline-command.js +1 -1
  20. package/dist/commands/claude-usage-command.js +1 -1
  21. package/dist/commands/command.js +1 -1
  22. package/dist/commands/connection-command.js +1 -1
  23. package/dist/commands/context-command.js +1 -1
  24. package/dist/commands/databases.js +1 -1
  25. package/dist/commands/describe.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/llm-proxy.js +1 -1
  31. package/dist/commands/parent-segment-command.js +1 -1
  32. package/dist/commands/profiles-command.js +1 -1
  33. package/dist/commands/query-command.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pull-command.js +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/tables.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/config.js +1 -1
  49. package/dist/core/connection-cache.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/proxy/anthropic-adapter.js +1 -1
  59. package/dist/proxy/claude-usage-tracker.js +1 -1
  60. package/dist/proxy/context-signature.js +1 -1
  61. package/dist/proxy/conversation-utils.js +1 -1
  62. package/dist/proxy/server.js +1 -1
  63. package/dist/proxy/session-cache.js +1 -1
  64. package/dist/sdk/agent/agent-yaml.js +1 -1
  65. package/dist/sdk/api.js +1 -1
  66. package/dist/sdk/connection.js +1 -1
  67. package/dist/sdk/engage.js +1 -1
  68. package/dist/sdk/errors.js +1 -1
  69. package/dist/sdk/index.js +1 -1
  70. package/dist/sdk/job.js +1 -1
  71. package/dist/sdk/journey.js +1 -1
  72. package/dist/sdk/llm.d.ts +27 -20
  73. package/dist/sdk/llm.d.ts.map +1 -1
  74. package/dist/sdk/llm.js +1 -1
  75. package/dist/sdk/llm.js.map +1 -1
  76. package/dist/sdk/query.js +1 -1
  77. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  78. package/dist/sdk/segment/journey-yaml.js +1 -1
  79. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  80. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  81. package/dist/sdk/segment.js +1 -1
  82. package/dist/sdk/user.js +1 -1
  83. package/dist/sdk/workflow.js +1 -1
  84. package/dist/types/endpoints.js +1 -1
  85. package/dist/types/index.js +1 -1
  86. package/dist/utils/agent-config.js +1 -1
  87. package/dist/utils/agent-ref-parser.js +1 -1
  88. package/dist/utils/async.js +1 -1
  89. package/dist/utils/chat-cache.js +1 -1
  90. package/dist/utils/colors.js +1 -1
  91. package/dist/utils/command-output.js +1 -1
  92. package/dist/utils/constants.js +1 -1
  93. package/dist/utils/diff.js +1 -1
  94. package/dist/utils/fields-display.js +1 -1
  95. package/dist/utils/file-permissions.js +1 -1
  96. package/dist/utils/format-detector.js +1 -1
  97. package/dist/utils/formatters.js +1 -1
  98. package/dist/utils/journey-utils.js +1 -1
  99. package/dist/utils/json-loader.js +1 -1
  100. package/dist/utils/llm-backup-utils.js +1 -1
  101. package/dist/utils/model-aliases.js +1 -1
  102. package/dist/utils/model-factors.js +1 -1
  103. package/dist/utils/option-validation.js +1 -1
  104. package/dist/utils/port.js +1 -1
  105. package/dist/utils/process.js +1 -1
  106. package/dist/utils/prompt.js +1 -1
  107. package/dist/utils/segment-path-parser.js +1 -1
  108. package/dist/utils/segment-ref-parser.js +1 -1
  109. package/dist/utils/spinner.js +1 -1
  110. package/dist/utils/sql-parser.js +1 -1
  111. package/dist/utils/sse-parser.js +1 -1
  112. package/dist/utils/string-utils.js +1 -1
  113. package/dist/utils/table-ref-parser.js +1 -1
  114. package/dist/utils/tdx-config.js +1 -1
  115. package/dist/utils/tdx-logger.js +1 -1
  116. package/dist/utils/tree-formatter.js +1 -1
  117. package/dist/utils/version-check.js +1 -1
  118. package/dist/utils/workflow-utils.js +1 -1
  119. package/package.json +1 -1
@@ -1 +1 @@
1
- const a11_0x49fd27=a11_0x5992;(function(_0x39b2e9,_0x45039f){const _0x90d3fa=a11_0x5992,_0x43a075=_0x39b2e9();while(!![]){try{const _0x1e4f2b=-parseInt(_0x90d3fa(0xd5))/0x1*(-parseInt(_0x90d3fa(0xe1))/0x2)+parseInt(_0x90d3fa(0xd7))/0x3*(-parseInt(_0x90d3fa(0xdc))/0x4)+-parseInt(_0x90d3fa(0xef))/0x5+parseInt(_0x90d3fa(0xd4))/0x6+parseInt(_0x90d3fa(0xda))/0x7+parseInt(_0x90d3fa(0xd8))/0x8+parseInt(_0x90d3fa(0xd6))/0x9*(parseInt(_0x90d3fa(0xe2))/0xa);if(_0x1e4f2b===_0x45039f)break;else _0x43a075['push'](_0x43a075['shift']());}catch(_0x47c5b){_0x43a075['push'](_0x43a075['shift']());}}}(a11_0x12ee,0x1aa61));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a11_0x5992(_0x490e7a,_0x52ce5b){_0x490e7a=_0x490e7a-0xd4;const _0x12ee05=a11_0x12ee();let _0x599203=_0x12ee05[_0x490e7a];return _0x599203;}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';function a11_0x12ee(){const _0x5390bb=['List\x20activations\x20for\x20a\x20segment','\x27...','message','length','832020CYgSgM','Resolving\x20parent\x20segment\x20\x27','1020990CSpFoC','1AgWjMx','40077zThYCR','584874ayddwa','1348000JUpvuF','error','638778uYmVRR','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','4acmGUh','verbose','Parent\x20name:\x20','\x20activation','description','1038FSToSo','90AvWuZy','✔\x20Found\x20','resolveSegmentId','activations','site','Resolved\x20parent\x20ID:\x20','data','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','cause'];a11_0x12ee=function(){return _0x5390bb;};return a11_0x12ee();}export class ActivationsCommand extends BaseCommand{['name']=a11_0x49fd27(0xe5);[a11_0x49fd27(0xe0)]=a11_0x49fd27(0xeb);async['execute'](_0x5df552){const _0xf29a1c=a11_0x49fd27,{options:_0x30e9c6,args:_0x1497f1,tdx:_0x3ff7ae}=_0x5df552;if(_0x1497f1[_0xf29a1c(0xee)]===0x0)return console[_0xf29a1c(0xd9)]('Error:\x20Segment\x20name\x20is\x20required'),console[_0xf29a1c(0xd9)]('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x18a038,childId:_0x38a05d}=parseSegmentRef(_0x1497f1[0x0]);if(!_0x38a05d)return console[_0xf29a1c(0xd9)](_0xf29a1c(0xe9)),console['error'](_0xf29a1c(0xdb)),0x1;_0x30e9c6[_0xf29a1c(0xdd)]&&(console[_0xf29a1c(0xd9)]('Site:\x20'+_0x30e9c6[_0xf29a1c(0xe6)]),console[_0xf29a1c(0xd9)](_0xf29a1c(0xde)+_0x18a038),console[_0xf29a1c(0xd9)]('Child\x20name:\x20'+_0x38a05d));const _0x4d1b99=await withSpinner(_0xf29a1c(0xf0)+_0x18a038+_0xf29a1c(0xec),()=>_0x3ff7ae['segment']['resolveParentId'](_0x18a038),{'verbose':_0x30e9c6[_0xf29a1c(0xdd)]}),_0x22ba82=_0x4d1b99[_0xf29a1c(0xe8)];_0x30e9c6[_0xf29a1c(0xdd)]&&console['error'](_0xf29a1c(0xe7)+_0x22ba82);const _0x24fc40=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x38a05d+_0xf29a1c(0xec),()=>_0x3ff7ae['segment'][_0xf29a1c(0xe4)](_0x22ba82,_0x38a05d),{'verbose':_0x30e9c6[_0xf29a1c(0xdd)]}),_0x1cd796=_0x24fc40[_0xf29a1c(0xe8)];_0x30e9c6[_0xf29a1c(0xdd)]&&console[_0xf29a1c(0xd9)]('Resolved\x20child\x20ID:\x20'+_0x1cd796);const _0x12ad2b=await withSpinner('Listing\x20activations\x20for\x20segment\x20\x27'+_0x38a05d+'\x27...',()=>_0x3ff7ae['segment']['listActivations'](_0x22ba82,_0x1cd796),{'verbose':_0x30e9c6[_0xf29a1c(0xdd)]}),_0x1c0a9d=_0x12ad2b['data'];return console[_0xf29a1c(0xd9)](_0xf29a1c(0xe3)+_0x1c0a9d['length']+_0xf29a1c(0xdf)+(_0x1c0a9d[_0xf29a1c(0xee)]!==0x1?'s':'')),await handleSDKOutput(_0x1c0a9d,_0x30e9c6),0x0;}catch(_0x14beb6){if(_0x14beb6 instanceof SDKError)return console[_0xf29a1c(0xd9)]('Error:\x20'+_0x14beb6[_0xf29a1c(0xed)]),_0x14beb6[_0xf29a1c(0xea)]&&console[_0xf29a1c(0xd9)]('\x20\x20Cause:\x20'+_0x14beb6[_0xf29a1c(0xea)]),0x1;throw _0x14beb6;}}}
1
+ const a11_0x2d1636=a11_0x33d8;(function(_0x221060,_0x47ca36){const _0x332f8f=a11_0x33d8,_0x1ee243=_0x221060();while(!![]){try{const _0xa1ae80=-parseInt(_0x332f8f(0x11f))/0x1*(parseInt(_0x332f8f(0x11d))/0x2)+parseInt(_0x332f8f(0x119))/0x3*(-parseInt(_0x332f8f(0x10f))/0x4)+parseInt(_0x332f8f(0x12f))/0x5*(-parseInt(_0x332f8f(0x124))/0x6)+-parseInt(_0x332f8f(0x110))/0x7*(-parseInt(_0x332f8f(0x11c))/0x8)+parseInt(_0x332f8f(0x11b))/0x9*(-parseInt(_0x332f8f(0x122))/0xa)+parseInt(_0x332f8f(0x118))/0xb+parseInt(_0x332f8f(0x12a))/0xc;if(_0xa1ae80===_0x47ca36)break;else _0x1ee243['push'](_0x1ee243['shift']());}catch(_0x55d568){_0x1ee243['push'](_0x1ee243['shift']());}}}(a11_0x376c,0x36168));function a11_0x33d8(_0x23cfde,_0x3134cc){_0x23cfde=_0x23cfde-0x10e;const _0x376c74=a11_0x376c();let _0x33d8cb=_0x376c74[_0x23cfde];return _0x33d8cb;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';function a11_0x376c(){const _0x2a3a0b=['418uURBwR','Site:\x20','1452qDUkCq','Parent\x20name:\x20','Error:\x20Segment\x20name\x20is\x20required','398510vNEgQd','length','6ZDozdc','Error:\x20','name','activations','verbose','Resolved\x20child\x20ID:\x20','4562952DwwAPy','segment','site','resolveSegmentId','data','414270NEnrxG','message','\x20\x20Cause:\x20','Listing\x20activations\x20for\x20segment\x20\x27','289696UDLthe','7QeBWaS','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','Resolving\x20child\x20segment\x20\x27','execute','error','\x27...','Resolving\x20parent\x20segment\x20\x27','cause','1555323FZWDaR','9ypsPzn','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','18ZvMBfx','3065608Vmsdku'];a11_0x376c=function(){return _0x2a3a0b;};return a11_0x376c();}export class ActivationsCommand extends BaseCommand{[a11_0x2d1636(0x126)]=a11_0x2d1636(0x127);['description']='List\x20activations\x20for\x20a\x20segment';async[a11_0x2d1636(0x113)](_0x52d700){const _0x5ab8a2=a11_0x2d1636,{options:_0x17f7b8,args:_0x42c910,tdx:_0x382425}=_0x52d700;if(_0x42c910['length']===0x0)return console[_0x5ab8a2(0x114)](_0x5ab8a2(0x121)),console['error']('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x2ca57e,childId:_0x2aafaf}=parseSegmentRef(_0x42c910[0x0]);if(!_0x2aafaf)return console[_0x5ab8a2(0x114)](_0x5ab8a2(0x111)),console[_0x5ab8a2(0x114)](_0x5ab8a2(0x11a)),0x1;_0x17f7b8['verbose']&&(console[_0x5ab8a2(0x114)](_0x5ab8a2(0x11e)+_0x17f7b8[_0x5ab8a2(0x12c)]),console[_0x5ab8a2(0x114)](_0x5ab8a2(0x120)+_0x2ca57e),console[_0x5ab8a2(0x114)]('Child\x20name:\x20'+_0x2aafaf));const _0xfc15d5=await withSpinner(_0x5ab8a2(0x116)+_0x2ca57e+'\x27...',()=>_0x382425[_0x5ab8a2(0x12b)]['resolveParentId'](_0x2ca57e),{'verbose':_0x17f7b8['verbose']}),_0x1a825e=_0xfc15d5[_0x5ab8a2(0x12e)];_0x17f7b8['verbose']&&console[_0x5ab8a2(0x114)]('Resolved\x20parent\x20ID:\x20'+_0x1a825e);const _0x34c95e=await withSpinner(_0x5ab8a2(0x112)+_0x2aafaf+'\x27...',()=>_0x382425[_0x5ab8a2(0x12b)][_0x5ab8a2(0x12d)](_0x1a825e,_0x2aafaf),{'verbose':_0x17f7b8[_0x5ab8a2(0x128)]}),_0x18fe8f=_0x34c95e['data'];_0x17f7b8[_0x5ab8a2(0x128)]&&console[_0x5ab8a2(0x114)](_0x5ab8a2(0x129)+_0x18fe8f);const _0x1900ca=await withSpinner(_0x5ab8a2(0x10e)+_0x2aafaf+_0x5ab8a2(0x115),()=>_0x382425[_0x5ab8a2(0x12b)]['listActivations'](_0x1a825e,_0x18fe8f),{'verbose':_0x17f7b8[_0x5ab8a2(0x128)]}),_0x417bf6=_0x1900ca[_0x5ab8a2(0x12e)];return console['error']('✔\x20Found\x20'+_0x417bf6[_0x5ab8a2(0x123)]+'\x20activation'+(_0x417bf6[_0x5ab8a2(0x123)]!==0x1?'s':'')),await handleSDKOutput(_0x417bf6,_0x17f7b8),0x0;}catch(_0x4d449a){if(_0x4d449a instanceof SDKError)return console[_0x5ab8a2(0x114)](_0x5ab8a2(0x125)+_0x4d449a[_0x5ab8a2(0x130)]),_0x4d449a[_0x5ab8a2(0x117)]&&console['error'](_0x5ab8a2(0x131)+_0x4d449a[_0x5ab8a2(0x117)]),0x1;throw _0x4d449a;}}}
@@ -1 +1 @@
1
- function a12_0x236b(){const _0x49ee21=['hasChanges','\x22:\x20','new','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','dryRun','gray','Dry\x20run\x20-\x20no\x20changes\x20made','\x0aPush\x20summary\x20for\x20\x27','sourceProjectName','Using\x20local\x20project:\x20','\x20resources?','newProjectId','Pulling\x20agent\x20\x22','19133939WTffhv','Using\x20project\x20from\x20','Pull\x20cancelled','execute','<new-name>','\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','utf-8','session','2995626yxVvqF','Would\x20pull\x20agent:\x20','pullProject','\x20\x20Knowledge\x20Base\x20\x22','outputDir','agentName','Pushing\x20to\x20project...','\x22\x20but\x20no\x20local\x20folder\x20found.\x0a','\x20changed','New\x20project\x20ID:\x20','site','push','Chat:\x20','✔\x20Context\x20set:\x20','diff','10FaprRO','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','Output\x20path:\x20','projectName','\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','2951955AQOabx','\x20\x20Prompts:\x20','tdx.json','Cannot\x20clone\x20from\x20context\x20project\x20\x22','Pushing\x20agent\x20from\x20\x22','6178384PbirwD','5hdRbnQ','knowledgeBases','yes','cyan','\x20--name\x20','yellow','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','Agent:\x20','\x20|\x20','dirname','\x0aErrors\x20found:','No\x20tdx.json\x20found\x20in\x20','pushProject','\x20--profile\x20','\x22\x20to\x20\x22','join','1Llqrff','\x0aWrite\x20','agents','red','\x0aChanges:','\x20\x20Knowledge\x20Bases:\x20','\x20\x20Agent\x20\x22','\x20=\x20','Writing\x20files...','Summary:','New\x20project\x20name\x20is\x20required','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Source:\x20','errors','parse','Agent\x20pulled\x20successfully','dim','\x20resources\x20to\x20\x27','3230037yNMrNI','1637652fVGpqw','llmProject','7OogKZG','\x0a✔\x20Pushed\x20','\x20\x20Prompt\x20\x22','cloneProject','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20new','name','repeat','llm','agent:push','Context\x20set:\x20','output','counts','cwd','\x20files?','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)','log','profile','prompts','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','\x20unchanged','Clone\x20cancelled','Analyzing\x20changes\x20to\x20push...','llm_project','projectId','\x20errors','agent:pull','updated','Dry\x20run\x20-\x20no\x20files\x20written','MISSING_ARGUMENT','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Run\x20\x27tdx\x20agent\x20pull\x20','INVALID_ARGUMENT','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','action','Using\x20project:\x20','Using\x20current\x20project:\x20','\x20created','Errors:','description','\x20updated','Push\x20cancelled','agentId','New\x20project:\x20','\x22\x20to\x20a\x20different\x20profile','force','newProjectName','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','pullAgent','error','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','Cloning\x20\x22','\x0aProject\x20pushed\x20with\x20errors','total','agent.yml','\x22\x20from\x20project\x20\x22','Would\x20push\x20agent:\x20','outputPath','Output:\x20','Project:\x20','\x20\x20Agents:\x20','created','624718UfVvzg','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','green','unchanged'];a12_0x236b=function(){return _0x49ee21;};return a12_0x236b();}const a12_0x467cf5=a12_0x2e8d;(function(_0x28dd0c,_0x3d7091){const _0x469e40=a12_0x2e8d,_0x1874d4=_0x28dd0c();while(!![]){try{const _0x53678b=parseInt(_0x469e40(0x1de))/0x1*(-parseInt(_0x469e40(0x231))/0x2)+-parseInt(_0x469e40(0x1f0))/0x3+parseInt(_0x469e40(0x1f1))/0x4+-parseInt(_0x469e40(0x1ce))/0x5*(parseInt(_0x469e40(0x1b4))/0x6)+parseInt(_0x469e40(0x1f3))/0x7*(parseInt(_0x469e40(0x1cd))/0x8)+-parseInt(_0x469e40(0x1c8))/0x9+-parseInt(_0x469e40(0x1c3))/0xa*(-parseInt(_0x469e40(0x242))/0xb);if(_0x53678b===_0x3d7091)break;else _0x1874d4['push'](_0x1874d4['shift']());}catch(_0x5c7678){_0x1874d4['push'](_0x1874d4['shift']());}}}(a12_0x236b,0xac158));import a12_0x8504ff from'chalk';import a12_0x54a3b7 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../utils/agent-config.js';import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';function formatCountSummary(_0x6a41ad){const _0x2a2782=a12_0x2e8d,_0x53e3a6=[];if(_0x6a41ad[_0x2a2782(0x228)]!==undefined)_0x53e3a6['push'](_0x6a41ad[_0x2a2782(0x228)]+'\x20total');if(_0x6a41ad[_0x2a2782(0x237)]!==undefined&&_0x6a41ad[_0x2a2782(0x237)]>0x0)_0x53e3a6[_0x2a2782(0x1bf)](a12_0x8504ff[_0x2a2782(0x233)](_0x6a41ad['new']+_0x2a2782(0x1f8)));if(_0x6a41ad[_0x2a2782(0x230)]!==undefined&&_0x6a41ad[_0x2a2782(0x230)]>0x0)_0x53e3a6['push'](a12_0x8504ff['green'](_0x6a41ad['created']+_0x2a2782(0x218)));if(_0x6a41ad[_0x2a2782(0x20e)]!==undefined&&_0x6a41ad[_0x2a2782(0x20e)]>0x0)_0x53e3a6['push'](a12_0x8504ff[_0x2a2782(0x1d3)](_0x6a41ad[_0x2a2782(0x20e)]+_0x2a2782(0x21b)));if(_0x6a41ad['unchanged']!==undefined&&_0x6a41ad['unchanged']>0x0)_0x53e3a6[_0x2a2782(0x1bf)](a12_0x8504ff['gray'](_0x6a41ad[_0x2a2782(0x234)]+'\x20unchanged'));if(_0x6a41ad[_0x2a2782(0x1eb)]!==undefined&&_0x6a41ad['errors']>0x0)_0x53e3a6[_0x2a2782(0x1bf)](a12_0x8504ff[_0x2a2782(0x1e1)](_0x6a41ad[_0x2a2782(0x1eb)]+_0x2a2782(0x20c)));return _0x53e3a6[_0x2a2782(0x1dd)](',\x20');}function displayDiffs(_0x541dd2,_0x2b6a7e,_0x11261a){const _0x454c17=a12_0x2e8d;for(const _0x5677d4 of _0x541dd2){if(_0x5677d4[_0x454c17(0x1c2)]){const _0x506867=_0x5677d4[_0x454c17(0x1b9)]||_0x5677d4[_0x454c17(0x1f9)];console['log']('\x0aChanges\x20to\x20agent\x20\x27'+_0x506867+'\x27:'),console[_0x454c17(0x203)]('─'[_0x454c17(0x1fa)](0x3c)),console[_0x454c17(0x203)](_0x5677d4['diff']),console[_0x454c17(0x203)]('─'['repeat'](0x3c));}}for(const _0x360daa of _0x2b6a7e){_0x360daa[_0x454c17(0x1c2)]&&(console[_0x454c17(0x203)](_0x454c17(0x222)+_0x360daa[_0x454c17(0x1f9)]+'\x27:'),console[_0x454c17(0x203)]('─'['repeat'](0x3c)),console['log'](_0x360daa[_0x454c17(0x1c2)]),console['log']('─'[_0x454c17(0x1fa)](0x3c)));}for(const _0x568d66 of _0x11261a){_0x568d66[_0x454c17(0x1c2)]&&(console[_0x454c17(0x203)]('\x0aChanges\x20to\x20prompt\x20\x27'+_0x568d66[_0x454c17(0x1f9)]+'\x27:'),console[_0x454c17(0x203)]('─'['repeat'](0x3c)),console[_0x454c17(0x203)](_0x568d66[_0x454c17(0x1c2)]),console[_0x454c17(0x203)]('─'[_0x454c17(0x1fa)](0x3c)));}}function a12_0x2e8d(_0x109b54,_0x5bb546){_0x109b54=_0x109b54-0x1b0;const _0x236b58=a12_0x236b();let _0x2e8d4a=_0x236b58[_0x109b54];return _0x2e8d4a;}export class AgentPullCommand extends BaseCommand{[a12_0x467cf5(0x1f9)]=a12_0x467cf5(0x20d);[a12_0x467cf5(0x21a)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async[a12_0x467cf5(0x245)](_0x598e2d){const _0x4c36a3=a12_0x467cf5,{options:_0x2b11d5,args:_0x26c31b,tdx:_0x187a26}=_0x598e2d,_0x1f9cf8=_0x26c31b[0x0],_0x3cdbeb=_0x26c31b[0x1],_0x2087d5=_0x2b11d5[_0x4c36a3(0x1fe)],_0x213d2e=_0x2b11d5[_0x4c36a3(0x239)],_0x5e9bef=_0x2b11d5[_0x4c36a3(0x220)],_0x5ca73b=_0x2b11d5[_0x4c36a3(0x1d0)],_0x1d4976=_0x2b11d5[_0x4c36a3(0x1f2)];let _0x4dedb4,_0x213d58;const _0x3b739a=findAgentConfigPath(process[_0x4c36a3(0x200)]());if(_0x1f9cf8){const _0x1450be=a12_0x54a3b7[_0x4c36a3(0x1dd)](_0x1f9cf8,_0x4c36a3(0x1ca));if(existsSync(_0x1450be))try{const _0x4cb2=JSON[_0x4c36a3(0x1ec)](readFileSync(_0x1450be,_0x4c36a3(0x1b2)));_0x4dedb4=_0x4cb2[_0x4c36a3(0x20a)],_0x213d58=_0x1f9cf8,console[_0x4c36a3(0x203)](a12_0x8504ff[_0x4c36a3(0x1ee)](_0x4c36a3(0x243)+_0x1450be+':\x20'+_0x4dedb4));}catch{_0x4dedb4=_0x1f9cf8;}else _0x4dedb4=_0x1f9cf8;}else{if(_0x3b739a)try{const _0x40b05b=JSON[_0x4c36a3(0x1ec)](readFileSync(_0x3b739a,_0x4c36a3(0x1b2)));_0x4dedb4=_0x40b05b[_0x4c36a3(0x20a)],_0x213d58=a12_0x54a3b7[_0x4c36a3(0x1d7)](_0x3b739a),console['log'](a12_0x8504ff[_0x4c36a3(0x1ee)](_0x4c36a3(0x216)+_0x4dedb4));}catch{_0x4dedb4=_0x1d4976;}else _0x4dedb4=_0x1d4976;}if(!_0x4dedb4)return console[_0x4c36a3(0x203)](a12_0x8504ff[_0x4c36a3(0x1d3)](_0x4c36a3(0x1d4))),console[_0x4c36a3(0x203)](_0x4c36a3(0x202)),console[_0x4c36a3(0x203)](_0x4c36a3(0x1b1)),console['log'](_0x4c36a3(0x1c7)),console[_0x4c36a3(0x203)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent'),0x1;if(_0x3cdbeb){const {data:_0x4c9de7}=await withSpinner(_0x4c36a3(0x241)+_0x3cdbeb+_0x4c36a3(0x22a)+_0x4dedb4+'\x22...',()=>_0x187a26[_0x4c36a3(0x1fb)][_0x4c36a3(0x223)](_0x4dedb4,_0x3cdbeb,_0x2087d5,{'dryRun':_0x213d2e,'force':_0x5e9bef}));if(_0x213d2e)return console[_0x4c36a3(0x203)](a12_0x8504ff[_0x4c36a3(0x1d3)](_0x4c36a3(0x20f))),console[_0x4c36a3(0x203)](_0x4c36a3(0x1b5)+_0x4c9de7['agentName']),console[_0x4c36a3(0x203)](_0x4c36a3(0x1c5)+_0x4c9de7[_0x4c36a3(0x22c)]),_0x4c9de7[_0x4c36a3(0x1c2)]&&(console[_0x4c36a3(0x203)](_0x4c36a3(0x1e2)),console[_0x4c36a3(0x203)]('─'[_0x4c36a3(0x1fa)](0x3c)),console[_0x4c36a3(0x203)](_0x4c9de7['diff']),console[_0x4c36a3(0x203)]('─'[_0x4c36a3(0x1fa)](0x3c))),0x0;return console[_0x4c36a3(0x203)](a12_0x8504ff[_0x4c36a3(0x233)](_0x4c36a3(0x1ed))),console[_0x4c36a3(0x203)](_0x4c36a3(0x1d5)+_0x4c9de7[_0x4c36a3(0x1b9)]),console[_0x4c36a3(0x203)](_0x4c36a3(0x22d)+_0x4c9de7[_0x4c36a3(0x22c)]),console['log']('Status:\x20'+(_0x4c9de7['isNew']?a12_0x8504ff[_0x4c36a3(0x233)](_0x4c36a3(0x237)):_0x4c9de7[_0x4c36a3(0x235)]?a12_0x8504ff[_0x4c36a3(0x1d3)]('updated'):a12_0x8504ff[_0x4c36a3(0x23a)](_0x4c36a3(0x234)))),0x0;}const _0x1bcd86=_0x213d58||_0x2087d5,{data:_0x43de7d}=await withSpinner('Analyzing\x20project\x20\x22'+_0x4dedb4+'\x22...',()=>_0x187a26[_0x4c36a3(0x1fb)][_0x4c36a3(0x1b6)](_0x4dedb4,_0x1bcd86,{'dryRun':!![]})),_0x3b3086=_0x43de7d[_0x4c36a3(0x1ff)]['agents'][_0x4c36a3(0x237)]+_0x43de7d[_0x4c36a3(0x1ff)][_0x4c36a3(0x1cf)]['new']+_0x43de7d[_0x4c36a3(0x1ff)]['prompts'][_0x4c36a3(0x237)],_0x591ebc=_0x43de7d[_0x4c36a3(0x1ff)]['agents'][_0x4c36a3(0x20e)]+_0x43de7d[_0x4c36a3(0x1ff)][_0x4c36a3(0x1cf)]['updated']+_0x43de7d['counts']['prompts'][_0x4c36a3(0x20e)],_0x2b93c0=_0x43de7d['counts'][_0x4c36a3(0x1e0)]['unchanged']+_0x43de7d[_0x4c36a3(0x1ff)][_0x4c36a3(0x1cf)]['unchanged']+_0x43de7d['counts']['prompts'][_0x4c36a3(0x234)];console[_0x4c36a3(0x203)]('\x0aPull\x20summary\x20for\x20\x27'+_0x43de7d[_0x4c36a3(0x1c6)]+'\x27:'),console[_0x4c36a3(0x203)]('\x20\x20'+a12_0x8504ff[_0x4c36a3(0x233)]('+\x20'+_0x3b3086+'\x20new')+'\x20|\x20'+a12_0x8504ff[_0x4c36a3(0x1d3)]('~\x20'+_0x591ebc+_0x4c36a3(0x1bc))+_0x4c36a3(0x1d6)+a12_0x8504ff[_0x4c36a3(0x1ee)]('=\x20'+_0x2b93c0+_0x4c36a3(0x207))),console[_0x4c36a3(0x203)](_0x4c36a3(0x22f)+formatCountSummary(_0x43de7d[_0x4c36a3(0x1ff)][_0x4c36a3(0x1e0)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x43de7d['counts'][_0x4c36a3(0x1cf)])),console['log'](_0x4c36a3(0x1c9)+formatCountSummary(_0x43de7d[_0x4c36a3(0x1ff)]['prompts'])),console[_0x4c36a3(0x203)]('\x20\x20Target:\x20'+a12_0x8504ff[_0x4c36a3(0x1d1)](_0x43de7d[_0x4c36a3(0x1b8)])),displayDiffs(_0x43de7d[_0x4c36a3(0x1e0)],_0x43de7d[_0x4c36a3(0x1cf)],_0x43de7d['prompts']);if(_0x213d2e)return console[_0x4c36a3(0x203)](a12_0x8504ff[_0x4c36a3(0x1d3)](_0x4c36a3(0x238))),0x0;if(_0x3b3086===0x0&&_0x591ebc===0x0)return console[_0x4c36a3(0x203)](a12_0x8504ff['green'](_0x4c36a3(0x1f7))),saveSessionContext({'llm_project':_0x43de7d[_0x4c36a3(0x1c6)]},_0x2b11d5['session']),console[_0x4c36a3(0x203)](a12_0x8504ff[_0x4c36a3(0x233)](_0x4c36a3(0x1c1)+a12_0x8504ff['dim']('llm_project')+_0x4c36a3(0x1e5)+a12_0x8504ff[_0x4c36a3(0x1d1)](_0x43de7d[_0x4c36a3(0x1c6)]))),0x0;if(!_0x5ca73b&&!_0x5e9bef){const _0x416e72=await confirmKey(_0x4c36a3(0x1df)+(_0x3b3086+_0x591ebc)+_0x4c36a3(0x201));if(!_0x416e72)return console[_0x4c36a3(0x203)](_0x4c36a3(0x244)),0x0;}const {data:_0x5593a0}=await withSpinner(_0x4c36a3(0x1e6),()=>_0x187a26[_0x4c36a3(0x1fb)][_0x4c36a3(0x1b6)](_0x4dedb4,_0x1bcd86,{'force':_0x5e9bef}));return console[_0x4c36a3(0x203)](a12_0x8504ff[_0x4c36a3(0x233)]('\x0a✔\x20Pulled\x20'+(_0x3b3086+_0x591ebc)+'\x20files\x20to\x20'+_0x5593a0[_0x4c36a3(0x1b8)])),saveSessionContext({'llm_project':_0x5593a0['projectName']},_0x2b11d5['session']),console[_0x4c36a3(0x203)](a12_0x8504ff[_0x4c36a3(0x233)]('✔\x20Context\x20set:\x20'+a12_0x8504ff[_0x4c36a3(0x1ee)](_0x4c36a3(0x20a))+_0x4c36a3(0x1e5)+a12_0x8504ff['cyan'](_0x5593a0[_0x4c36a3(0x1c6)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a12_0x467cf5(0x1f9)]='agent:clone';[a12_0x467cf5(0x21a)]=a12_0x467cf5(0x225);async[a12_0x467cf5(0x245)](_0x56f77f){const _0x4514d0=a12_0x467cf5,{options:_0x455f45,args:_0x73e382,tdx:_0x5d7693}=_0x56f77f,_0x486bd5=_0x73e382[0x0],_0x2ffa40=_0x455f45['name'],_0x294aa5=_0x455f45[_0x4514d0(0x239)],_0x37d0dd=_0x455f45['yes'],_0x21c2bf=_0x455f45[_0x4514d0(0x1be)],_0x23088c=_0x455f45[_0x4514d0(0x1f2)];let _0x4672ea;const _0x27ec19=findAgentConfigPath(process[_0x4514d0(0x200)]());if(_0x486bd5){const _0x2c2154=a12_0x54a3b7['join'](_0x486bd5,_0x4514d0(0x1ca));existsSync(_0x2c2154)?(_0x4672ea=_0x486bd5,console['log'](a12_0x8504ff[_0x4514d0(0x1ee)](_0x4514d0(0x23e)+_0x486bd5))):_0x4672ea=_0x486bd5;}else{if(_0x27ec19)_0x4672ea=a12_0x54a3b7[_0x4514d0(0x1d7)](_0x27ec19),console[_0x4514d0(0x203)](a12_0x8504ff['dim'](_0x4514d0(0x217)+_0x4672ea));else{if(_0x23088c){const _0x5974d2=normalizeName(_0x23088c),_0x256a62=a12_0x54a3b7[_0x4514d0(0x1dd)](process[_0x4514d0(0x200)](),_0x4514d0(0x1e0),_0x5974d2,_0x4514d0(0x1ca));if(existsSync(_0x256a62))_0x4672ea=a12_0x54a3b7[_0x4514d0(0x1d7)](_0x256a62),console['log'](a12_0x8504ff[_0x4514d0(0x1ee)](_0x4514d0(0x23e)+_0x4672ea));else{const _0x4e68f5=_0x455f45[_0x4514d0(0x204)];if(_0x4e68f5)throw new SDKError(ErrorCode[_0x4514d0(0x213)],_0x4514d0(0x1cb)+_0x23088c+_0x4514d0(0x21f),undefined,{'helpText':'When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a'+_0x4514d0(0x214)+('\x20\x20tdx\x20agent\x20pull\x20'+_0x23088c+'\x0a')+('\x20\x20tdx\x20agent\x20clone\x20agents/'+_0x5974d2+_0x4514d0(0x1d2)+(_0x2ffa40||_0x4514d0(0x1b0))+_0x4514d0(0x1db)+_0x4e68f5)});_0x4672ea=_0x23088c,console[_0x4514d0(0x203)](a12_0x8504ff['dim']('Using\x20context\x20project:\x20'+_0x23088c));}}}}if(!_0x4672ea)return console[_0x4514d0(0x203)](a12_0x8504ff['yellow'](_0x4514d0(0x206))),console[_0x4514d0(0x203)](_0x4514d0(0x1c4)),console['log']('\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory'),console[_0x4514d0(0x203)]('\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)'),console[_0x4514d0(0x203)](_0x4514d0(0x1e9)),0x1;if(!_0x2ffa40)throw new SDKError(ErrorCode[_0x4514d0(0x210)],_0x4514d0(0x1e8),undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x37d0dd&&!_0x294aa5){const _0xe04605=await confirmKey('Clone\x20\x22'+_0x4672ea+'\x22\x20to\x20new\x20project\x20\x22'+_0x2ffa40+'\x22?');if(!_0xe04605)return console[_0x4514d0(0x203)](_0x4514d0(0x208)),0x0;}const {data:_0x30ad77}=await withSpinner(_0x4514d0(0x226)+_0x4672ea+_0x4514d0(0x1dc)+_0x2ffa40+'\x22...',()=>_0x5d7693[_0x4514d0(0x1fb)][_0x4514d0(0x1f6)](_0x4672ea,_0x2ffa40,{'dryRun':_0x294aa5}));if(_0x294aa5)return console[_0x4514d0(0x203)](a12_0x8504ff['yellow'](_0x4514d0(0x23b))),console[_0x4514d0(0x203)](_0x4514d0(0x1ea)+_0x30ad77[_0x4514d0(0x23d)]),console[_0x4514d0(0x203)]('New\x20project:\x20'+_0x2ffa40),console[_0x4514d0(0x203)]('Would\x20clone:'),console[_0x4514d0(0x203)](_0x4514d0(0x22f)+_0x30ad77['counts'][_0x4514d0(0x1e0)]['created']),console[_0x4514d0(0x203)](_0x4514d0(0x1e3)+_0x30ad77[_0x4514d0(0x1ff)][_0x4514d0(0x1cf)][_0x4514d0(0x230)]),console[_0x4514d0(0x203)](_0x4514d0(0x1c9)+_0x30ad77['counts'][_0x4514d0(0x205)]['created']),0x0;const _0x3e4e0c=_0x30ad77[_0x4514d0(0x1ff)][_0x4514d0(0x1e0)]['errors']>0x0||_0x30ad77['counts'][_0x4514d0(0x1cf)][_0x4514d0(0x1eb)]>0x0||_0x30ad77['counts'][_0x4514d0(0x205)][_0x4514d0(0x1eb)]>0x0;_0x3e4e0c?console[_0x4514d0(0x203)](a12_0x8504ff[_0x4514d0(0x1d3)]('Project\x20cloned\x20with\x20errors')):console['log'](a12_0x8504ff['green']('Project\x20cloned\x20successfully'));console[_0x4514d0(0x203)](_0x4514d0(0x1ea)+_0x30ad77[_0x4514d0(0x23d)]),console[_0x4514d0(0x203)](_0x4514d0(0x21e)+_0x30ad77[_0x4514d0(0x221)]),console['log'](_0x4514d0(0x1bd)+_0x30ad77[_0x4514d0(0x240)]),console[_0x4514d0(0x203)](),console[_0x4514d0(0x203)](_0x4514d0(0x1e7)),console[_0x4514d0(0x203)](_0x4514d0(0x22f)+formatCountSummary(_0x30ad77[_0x4514d0(0x1ff)][_0x4514d0(0x1e0)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x30ad77[_0x4514d0(0x1ff)][_0x4514d0(0x1cf)])),console['log'](_0x4514d0(0x1c9)+formatCountSummary(_0x30ad77[_0x4514d0(0x1ff)][_0x4514d0(0x205)]));if(_0x3e4e0c){console[_0x4514d0(0x203)](),console[_0x4514d0(0x203)](a12_0x8504ff['red'](_0x4514d0(0x219)));for(const _0x50451e of _0x30ad77[_0x4514d0(0x1e0)]){_0x50451e[_0x4514d0(0x215)]===_0x4514d0(0x224)&&console[_0x4514d0(0x203)](a12_0x8504ff[_0x4514d0(0x1e1)]('\x20\x20Agent\x20\x22'+_0x50451e[_0x4514d0(0x1b9)]+_0x4514d0(0x236)+_0x50451e['error']));}for(const _0x242e2a of _0x30ad77[_0x4514d0(0x1cf)]){_0x242e2a[_0x4514d0(0x215)]===_0x4514d0(0x224)&&console['log'](a12_0x8504ff['red'](_0x4514d0(0x1b7)+_0x242e2a[_0x4514d0(0x1f9)]+'\x22:\x20'+_0x242e2a[_0x4514d0(0x224)]));}for(const _0xbbe5e5 of _0x30ad77['prompts']){_0xbbe5e5['action']===_0x4514d0(0x224)&&console[_0x4514d0(0x203)](a12_0x8504ff[_0x4514d0(0x1e1)](_0x4514d0(0x1f5)+_0xbbe5e5[_0x4514d0(0x1f9)]+_0x4514d0(0x236)+_0xbbe5e5['error']));}return 0x1;}saveSessionContext({'llm_project':_0x30ad77[_0x4514d0(0x221)]},_0x455f45[_0x4514d0(0x1b3)]),console[_0x4514d0(0x203)](),console[_0x4514d0(0x203)](a12_0x8504ff[_0x4514d0(0x233)](_0x4514d0(0x1fd)+a12_0x8504ff[_0x4514d0(0x1ee)]('llm_project')+_0x4514d0(0x1e5)+a12_0x8504ff['cyan'](_0x30ad77[_0x4514d0(0x221)])));const _0x39b85b=getLLMProjectUrl(_0x21c2bf,_0x30ad77['newProjectId']);return console[_0x4514d0(0x203)](_0x4514d0(0x22e)+a12_0x8504ff[_0x4514d0(0x1d1)](_0x39b85b)),0x0;}}export class AgentPushCommand extends BaseCommand{[a12_0x467cf5(0x1f9)]=a12_0x467cf5(0x1fc);['description']=a12_0x467cf5(0x211);async[a12_0x467cf5(0x245)](_0x488958){const _0x16e698=a12_0x467cf5,{options:_0x547d43,args:_0x25aafb,tdx:_0x5816d9}=_0x488958;let _0x49e2d9=_0x25aafb[0x0]||process[_0x16e698(0x200)]();const _0x5bca8e=_0x547d43[_0x16e698(0x239)],_0x492de4=_0x547d43['force'],_0x382498=_0x547d43[_0x16e698(0x1d0)],_0x54ab1e=_0x547d43[_0x16e698(0x1be)],_0x53e901=a12_0x54a3b7[_0x16e698(0x1dd)](_0x49e2d9,_0x16e698(0x229)),_0x9d2a70=existsSync(_0x53e901);if(_0x9d2a70){const {data:_0x25909a}=await withSpinner(_0x16e698(0x1cc)+_0x49e2d9+'\x22...',()=>_0x5816d9['llm']['pushAgent'](_0x49e2d9,{'dryRun':_0x5bca8e,'force':_0x492de4}));if(_0x5bca8e)return console[_0x16e698(0x203)](a12_0x8504ff[_0x16e698(0x1d3)](_0x16e698(0x23b))),console['log'](_0x16e698(0x22b)+_0x25909a[_0x16e698(0x1b9)]),0x0;if(_0x25909a['action']===_0x16e698(0x224))return console[_0x16e698(0x203)](a12_0x8504ff[_0x16e698(0x1e1)]('Failed\x20to\x20push\x20agent:\x20'+_0x25909a[_0x16e698(0x224)])),0x1;console['log'](a12_0x8504ff[_0x16e698(0x233)]('Agent\x20'+_0x25909a[_0x16e698(0x215)]+'\x20successfully')),console[_0x16e698(0x203)](_0x16e698(0x1d5)+_0x25909a['agentName']);if(_0x25909a[_0x16e698(0x21d)]&&_0x25909a[_0x16e698(0x20b)]){const _0x22b9d7=getLLMAgentChatUrl(_0x54ab1e,_0x25909a['projectId'],_0x25909a[_0x16e698(0x21d)]);console[_0x16e698(0x203)](_0x16e698(0x1c0)+a12_0x8504ff['cyan'](_0x22b9d7));}return 0x0;}let _0x3c8c15=a12_0x54a3b7[_0x16e698(0x1dd)](_0x49e2d9,_0x16e698(0x1ca));if(!existsSync(_0x3c8c15)){const _0x3d9a45=findAgentConfigPath(_0x49e2d9);if(_0x3d9a45)_0x49e2d9=a12_0x54a3b7['dirname'](_0x3d9a45),_0x3c8c15=_0x3d9a45,console[_0x16e698(0x203)](a12_0x8504ff[_0x16e698(0x1ee)](_0x16e698(0x216)+_0x49e2d9));else{const _0xc1f3f5=_0x547d43[_0x16e698(0x1f2)];if(_0xc1f3f5){const _0x281e61=normalizeName(_0xc1f3f5),_0x196d43=a12_0x54a3b7[_0x16e698(0x1dd)](_0x49e2d9,'agents'),_0x12e1cb=a12_0x54a3b7[_0x16e698(0x1dd)](_0x196d43,_0x281e61,_0x16e698(0x1ca));existsSync(_0x12e1cb)&&(_0x49e2d9=a12_0x54a3b7[_0x16e698(0x1d7)](_0x12e1cb),_0x3c8c15=_0x12e1cb,console[_0x16e698(0x203)](a12_0x8504ff[_0x16e698(0x1ee)]('Using\x20project:\x20'+_0x49e2d9)));}if(!existsSync(_0x3c8c15)){let _0x154952='Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.';_0xc1f3f5&&(_0x154952='Current\x20context\x20has\x20llm_project=\x22'+_0xc1f3f5+_0x16e698(0x1bb)+(_0x16e698(0x212)+_0xc1f3f5+'\x27\x20to\x20create\x20the\x20folder\x20structure.'));throw new SDKError(ErrorCode[_0x16e698(0x213)],_0x16e698(0x1d9)+_0x49e2d9,undefined,{'helpText':_0x154952});}}}const {data:_0x4c0e01}=await withSpinner(_0x16e698(0x209),()=>_0x5816d9[_0x16e698(0x1fb)][_0x16e698(0x1da)](_0x49e2d9,{'dryRun':!![]})),_0x123150=_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x1e0)]['errors']>0x0;if(_0x123150){console[_0x16e698(0x203)](a12_0x8504ff[_0x16e698(0x1e1)](_0x16e698(0x1d8)));for(const _0xbaaadd of _0x4c0e01[_0x16e698(0x1e0)]){_0xbaaadd[_0x16e698(0x215)]===_0x16e698(0x224)&&console['log'](a12_0x8504ff[_0x16e698(0x1e1)](_0x16e698(0x1e4)+_0xbaaadd[_0x16e698(0x1b9)]+_0x16e698(0x236)+_0xbaaadd[_0x16e698(0x224)]));}return 0x1;}const _0x301dfe=_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x1e0)][_0x16e698(0x230)]+_0x4c0e01['counts'][_0x16e698(0x1cf)]['created']+_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x205)]['created'],_0x1c8b6c=_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x1e0)][_0x16e698(0x20e)]+_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x1cf)]['updated']+_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x205)][_0x16e698(0x20e)],_0x64f597=_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x1e0)][_0x16e698(0x234)]+_0x4c0e01['counts'][_0x16e698(0x1cf)][_0x16e698(0x234)]+_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x205)]['unchanged'];console['log'](_0x16e698(0x23c)+_0x4c0e01[_0x16e698(0x1c6)]+'\x27:'),console[_0x16e698(0x203)]('\x20\x20'+a12_0x8504ff[_0x16e698(0x233)]('+\x20'+_0x301dfe+_0x16e698(0x1f8))+_0x16e698(0x1d6)+a12_0x8504ff['yellow']('~\x20'+_0x1c8b6c+'\x20changed')+_0x16e698(0x1d6)+a12_0x8504ff[_0x16e698(0x1ee)]('=\x20'+_0x64f597+_0x16e698(0x207))),console[_0x16e698(0x203)](_0x16e698(0x22f)+formatCountSummary(_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x1e0)])),console[_0x16e698(0x203)](_0x16e698(0x1e3)+formatCountSummary(_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x1cf)])),console['log'](_0x16e698(0x1c9)+formatCountSummary(_0x4c0e01[_0x16e698(0x1ff)][_0x16e698(0x205)])),console[_0x16e698(0x203)]('\x20\x20Source:\x20'+a12_0x8504ff[_0x16e698(0x1d1)](_0x49e2d9)),displayDiffs(_0x4c0e01[_0x16e698(0x1e0)],_0x4c0e01['knowledgeBases'],_0x4c0e01[_0x16e698(0x205)]);if(_0x5bca8e)return console[_0x16e698(0x203)](a12_0x8504ff[_0x16e698(0x1d3)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed')),0x0;if(_0x301dfe===0x0&&_0x1c8b6c===0x0){console[_0x16e698(0x203)](a12_0x8504ff[_0x16e698(0x233)](_0x16e698(0x232)));const _0x5d02df=getLLMProjectUrl(_0x54ab1e,_0x4c0e01[_0x16e698(0x20b)]);return console['log']('Project:\x20'+a12_0x8504ff[_0x16e698(0x1d1)](_0x5d02df)),0x0;}if(!_0x382498&&!_0x492de4){const _0x1a84a7=await confirmKey('\x0aPush\x20'+(_0x301dfe+_0x1c8b6c)+_0x16e698(0x23f));if(!_0x1a84a7)return console['log'](_0x16e698(0x21c)),0x0;}const {data:_0x4e810b}=await withSpinner(_0x16e698(0x1ba),()=>_0x5816d9['llm']['pushProject'](_0x49e2d9,{'force':_0x492de4})),_0x56df9f=_0x4e810b[_0x16e698(0x1ff)][_0x16e698(0x1e0)]['errors']>0x0||_0x4e810b['counts'][_0x16e698(0x1cf)][_0x16e698(0x1eb)]>0x0||_0x4e810b[_0x16e698(0x1ff)][_0x16e698(0x205)]['errors']>0x0;if(_0x56df9f){console[_0x16e698(0x203)](a12_0x8504ff['yellow'](_0x16e698(0x227))),console[_0x16e698(0x203)](),console[_0x16e698(0x203)](a12_0x8504ff[_0x16e698(0x1e1)](_0x16e698(0x219)));for(const _0x5f0540 of _0x4e810b[_0x16e698(0x1e0)]){_0x5f0540[_0x16e698(0x215)]===_0x16e698(0x224)&&console[_0x16e698(0x203)](a12_0x8504ff['red']('\x20\x20Agent\x20\x22'+_0x5f0540[_0x16e698(0x1b9)]+_0x16e698(0x236)+_0x5f0540[_0x16e698(0x224)]));}for(const _0x5a70f2 of _0x4e810b[_0x16e698(0x1cf)]){_0x5a70f2[_0x16e698(0x215)]==='error'&&console[_0x16e698(0x203)](a12_0x8504ff['red'](_0x16e698(0x1b7)+_0x5a70f2[_0x16e698(0x1f9)]+_0x16e698(0x236)+_0x5a70f2[_0x16e698(0x224)]));}for(const _0x203517 of _0x4e810b[_0x16e698(0x205)]){_0x203517[_0x16e698(0x215)]===_0x16e698(0x224)&&console['log'](a12_0x8504ff[_0x16e698(0x1e1)](_0x16e698(0x1f5)+_0x203517[_0x16e698(0x1f9)]+_0x16e698(0x236)+_0x203517[_0x16e698(0x224)]));}return 0x1;}console[_0x16e698(0x203)](a12_0x8504ff['green'](_0x16e698(0x1f4)+(_0x301dfe+_0x1c8b6c)+_0x16e698(0x1ef)+_0x4e810b[_0x16e698(0x1c6)]+'\x27'));const _0x204f7b=getLLMProjectUrl(_0x54ab1e,_0x4e810b['projectId']);return console[_0x16e698(0x203)]('Project:\x20'+a12_0x8504ff[_0x16e698(0x1d1)](_0x204f7b)),0x0;}}
1
+ const a12_0x470ddf=a12_0x1f51;function a12_0x1f51(_0x1f8956,_0x4ec8f5){_0x1f8956=_0x1f8956-0xdb;const _0x138ef1=a12_0x138e();let _0x1f5176=_0x138ef1[_0x1f8956];return _0x1f5176;}function a12_0x138e(){const _0x5b13c0=['errors','agent:clone','Status:\x20','No\x20tdx.json\x20found\x20in\x20','description','yes','knowledgeBases','sourceProjectName','counts','\x20--profile\x20','Output\x20path:\x20','Context\x20set:\x20','llmProject','projectId','hasChanges','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','Using\x20current\x20project:\x20','yellow','created','New\x20project\x20name\x20is\x20required','Clone\x20cancelled','newProjectName','llm','Using\x20project\x20from\x20','Push\x20cancelled','Would\x20pull\x20agent:\x20','repeat','agents','9939244zapBxf','\x20\x20Target:\x20','profile','Project\x20cloned\x20with\x20errors','\x0aProject\x20pushed\x20with\x20errors','execute','updated','MISSING_ARGUMENT','\x20successfully','projectName','\x20unchanged','dim','Using\x20local\x20project:\x20','tdx.json','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','Dry\x20run\x20-\x20no\x20files\x20written','Pulling\x20agent\x20\x22','push','Errors:','\x0aChanges\x20to\x20agent\x20\x27','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','agent:pull','force','Would\x20clone:','353065nOWkPL','gray','outputPath','pullAgent','Project:\x20','\x20changed','Analyzing\x20changes\x20to\x20push...','\x0a✔\x20Pushed\x20','Using\x20project:\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','Cannot\x20clone\x20from\x20context\x20project\x20\x22','Pushing\x20to\x20project...','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','agentName','Output:\x20','red','Using\x20context\x20project:\x20','session','Dry\x20run\x20-\x20no\x20changes\x20made','\x20\x20Knowledge\x20Bases:\x20','\x20|\x20','\x22\x20to\x20a\x20different\x20profile','\x20\x20Knowledge\x20Base\x20\x22','\x20new','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','\x20resources?','llm_project','action','\x20updated','New\x20project:\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','output','newProjectId','\x22:\x20','\x20\x20tdx\x20agent\x20clone\x20agents/','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','Agent:\x20','Source:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory','green','dryRun','\x20=\x20','\x22...','unchanged','\x20\x20Source:\x20','error','\x0aChanges:','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20#\x20Pull\x20specific\x20agent','\x20files?','\x20\x20Agent\x20\x22','872vAhVXZ','\x22\x20from\x20project\x20\x22','✔\x20Context\x20set:\x20','New\x20project\x20ID:\x20','cwd','pushAgent','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','1164224iFOUyX','1290640NBXViG','\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)','join','site','1104630mlEeqI','Pushing\x20agent\x20from\x20\x22','name','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','\x20total','Current\x20context\x20has\x20llm_project=\x22','Clone\x20\x22','total','outputDir','15hHWuGL','INVALID_ARGUMENT','6XZZcPc','diff','\x0aChanges\x20to\x20prompt\x20\x27','\x20\x20Prompts:\x20','Push\x20local\x20agent\x20files\x20to\x20LLM\x20project','Analyzing\x20project\x20\x22','log','parse','\x20\x20Agents:\x20','Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files','Agent\x20pulled\x20successfully','\x20errors','utf-8','Writing\x20files...','pushProject','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','agent.yml','prompts','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','pullProject','new','dirname','agentId','563124qYxzbt','\x20resources\x20to\x20\x27','cyan','58473cTlzGl','Summary:'];a12_0x138e=function(){return _0x5b13c0;};return a12_0x138e();}(function(_0x5a96fd,_0x322e8b){const _0x21ab9c=a12_0x1f51,_0x5a0c4c=_0x5a96fd();while(!![]){try{const _0x3e056c=-parseInt(_0x21ab9c(0x11a))/0x1+parseInt(_0x21ab9c(0xf4))/0x2+parseInt(_0x21ab9c(0x101))/0x3*(parseInt(_0x21ab9c(0xf3))/0x4)+parseInt(_0x21ab9c(0x153))/0x5*(-parseInt(_0x21ab9c(0x103))/0x6)+-parseInt(_0x21ab9c(0x13b))/0x7+-parseInt(_0x21ab9c(0xec))/0x8*(-parseInt(_0x21ab9c(0x11d))/0x9)+parseInt(_0x21ab9c(0xf8))/0xa;if(_0x3e056c===_0x322e8b)break;else _0x5a0c4c['push'](_0x5a0c4c['shift']());}catch(_0x387606){_0x5a0c4c['push'](_0x5a0c4c['shift']());}}}(a12_0x138e,0xd3547));import a12_0x1b787 from'chalk';import a12_0x526e48 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{findAgentConfigPath}from'../utils/agent-config.js';import{saveSessionContext}from'../core/session.js';import{normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';function formatCountSummary(_0x12f317){const _0x4322ff=a12_0x1f51,_0x1ab42b=[];if(_0x12f317[_0x4322ff(0xff)]!==undefined)_0x1ab42b[_0x4322ff(0x14c)](_0x12f317[_0x4322ff(0xff)]+_0x4322ff(0xfc));if(_0x12f317['new']!==undefined&&_0x12f317[_0x4322ff(0x117)]>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0xe0)](_0x12f317[_0x4322ff(0x117)]+_0x4322ff(0x16a)));if(_0x12f317[_0x4322ff(0x131)]!==undefined&&_0x12f317[_0x4322ff(0x131)]>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0xe0)](_0x12f317['created']+'\x20created'));if(_0x12f317[_0x4322ff(0x141)]!==undefined&&_0x12f317[_0x4322ff(0x141)]>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0x130)](_0x12f317[_0x4322ff(0x141)]+_0x4322ff(0x16f)));if(_0x12f317['unchanged']!==undefined&&_0x12f317['unchanged']>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0x154)](_0x12f317[_0x4322ff(0xe4)]+_0x4322ff(0x145)));if(_0x12f317['errors']!==undefined&&_0x12f317[_0x4322ff(0x11f)]>0x0)_0x1ab42b[_0x4322ff(0x14c)](a12_0x1b787[_0x4322ff(0x162)](_0x12f317[_0x4322ff(0x11f)]+_0x4322ff(0x10e)));return _0x1ab42b[_0x4322ff(0xf6)](',\x20');}function displayDiffs(_0x554f6f,_0x379d1f,_0x49f885){const _0x835dc1=a12_0x1f51;for(const _0x5eb7cf of _0x554f6f){if(_0x5eb7cf[_0x835dc1(0x104)]){const _0x3282d3=_0x5eb7cf['agentName']||_0x5eb7cf['name'];console['log'](_0x835dc1(0x14e)+_0x3282d3+'\x27:'),console[_0x835dc1(0x109)]('─'['repeat'](0x3c)),console[_0x835dc1(0x109)](_0x5eb7cf[_0x835dc1(0x104)]),console[_0x835dc1(0x109)]('─'['repeat'](0x3c));}}for(const _0x25feed of _0x379d1f){_0x25feed[_0x835dc1(0x104)]&&(console['log'](_0x835dc1(0x16b)+_0x25feed[_0x835dc1(0xfa)]+'\x27:'),console[_0x835dc1(0x109)]('─'[_0x835dc1(0x139)](0x3c)),console[_0x835dc1(0x109)](_0x25feed[_0x835dc1(0x104)]),console[_0x835dc1(0x109)]('─'[_0x835dc1(0x139)](0x3c)));}for(const _0x18c9d5 of _0x49f885){_0x18c9d5[_0x835dc1(0x104)]&&(console[_0x835dc1(0x109)](_0x835dc1(0x105)+_0x18c9d5['name']+'\x27:'),console[_0x835dc1(0x109)]('─'[_0x835dc1(0x139)](0x3c)),console[_0x835dc1(0x109)](_0x18c9d5[_0x835dc1(0x104)]),console[_0x835dc1(0x109)]('─'[_0x835dc1(0x139)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a12_0x470ddf(0xfa)]=a12_0x470ddf(0x150);['description']=a12_0x470ddf(0x10c);async[a12_0x470ddf(0x140)](_0xf03793){const _0x45748c=a12_0x470ddf,{options:_0x3ec86d,args:_0x537940,tdx:_0x3cae18}=_0xf03793,_0x3de9ca=_0x537940[0x0],_0xaaaba6=_0x537940[0x1],_0x206566=_0x3ec86d[_0x45748c(0x172)],_0x1bb179=_0x3ec86d[_0x45748c(0xe1)],_0x15e5d7=_0x3ec86d[_0x45748c(0x151)],_0x9eb4cf=_0x3ec86d[_0x45748c(0x124)],_0x37a3ab=_0x3ec86d[_0x45748c(0x12b)];let _0x4ead19,_0x3da1a8;const _0x88a7e1=findAgentConfigPath(process[_0x45748c(0xf0)]());if(_0x3de9ca){const _0x5620fb=a12_0x526e48[_0x45748c(0xf6)](_0x3de9ca,_0x45748c(0x148));if(existsSync(_0x5620fb))try{const _0x119440=JSON['parse'](readFileSync(_0x5620fb,_0x45748c(0x10f)));_0x4ead19=_0x119440[_0x45748c(0x16d)],_0x3da1a8=_0x3de9ca,console['log'](a12_0x1b787['dim'](_0x45748c(0x136)+_0x5620fb+':\x20'+_0x4ead19));}catch{_0x4ead19=_0x3de9ca;}else _0x4ead19=_0x3de9ca;}else{if(_0x88a7e1)try{const _0x53ff59=JSON[_0x45748c(0x10a)](readFileSync(_0x88a7e1,_0x45748c(0x10f)));_0x4ead19=_0x53ff59[_0x45748c(0x16d)],_0x3da1a8=a12_0x526e48[_0x45748c(0x118)](_0x88a7e1),console['log'](a12_0x1b787[_0x45748c(0x146)](_0x45748c(0x15b)+_0x4ead19));}catch{_0x4ead19=_0x37a3ab;}else _0x4ead19=_0x37a3ab;}if(!_0x4ead19)return console[_0x45748c(0x109)](a12_0x1b787['yellow'](_0x45748c(0xfb))),console[_0x45748c(0x109)]('Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x45748c(0x109)](_0x45748c(0xdc)),console[_0x45748c(0x109)](_0x45748c(0xdf)),console['log'](_0x45748c(0xe9)),0x1;if(_0xaaaba6){const {data:_0x5b7ded}=await withSpinner(_0x45748c(0x14b)+_0xaaaba6+_0x45748c(0xed)+_0x4ead19+'\x22...',()=>_0x3cae18[_0x45748c(0x135)][_0x45748c(0x156)](_0x4ead19,_0xaaaba6,_0x206566,{'dryRun':_0x1bb179,'force':_0x15e5d7}));if(_0x1bb179)return console[_0x45748c(0x109)](a12_0x1b787[_0x45748c(0x130)](_0x45748c(0x14a))),console[_0x45748c(0x109)](_0x45748c(0x138)+_0x5b7ded[_0x45748c(0x160)]),console['log'](_0x45748c(0x129)+_0x5b7ded[_0x45748c(0x155)]),_0x5b7ded[_0x45748c(0x104)]&&(console[_0x45748c(0x109)](_0x45748c(0xe7)),console[_0x45748c(0x109)]('─'[_0x45748c(0x139)](0x3c)),console[_0x45748c(0x109)](_0x5b7ded[_0x45748c(0x104)]),console[_0x45748c(0x109)]('─'[_0x45748c(0x139)](0x3c))),0x0;return console[_0x45748c(0x109)](a12_0x1b787['green'](_0x45748c(0x10d))),console[_0x45748c(0x109)](_0x45748c(0xdd)+_0x5b7ded[_0x45748c(0x160)]),console[_0x45748c(0x109)](_0x45748c(0x161)+_0x5b7ded[_0x45748c(0x155)]),console[_0x45748c(0x109)](_0x45748c(0x121)+(_0x5b7ded['isNew']?a12_0x1b787['green']('new'):_0x5b7ded[_0x45748c(0x12d)]?a12_0x1b787[_0x45748c(0x130)]('updated'):a12_0x1b787[_0x45748c(0x154)](_0x45748c(0xe4)))),0x0;}const _0x11582f=_0x3da1a8||_0x206566,{data:_0x576f8e}=await withSpinner(_0x45748c(0x108)+_0x4ead19+_0x45748c(0xe3),()=>_0x3cae18[_0x45748c(0x135)][_0x45748c(0x116)](_0x4ead19,_0x11582f,{'dryRun':!![]})),_0x2832b9=_0x576f8e[_0x45748c(0x127)][_0x45748c(0x13a)][_0x45748c(0x117)]+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x125)]['new']+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x114)][_0x45748c(0x117)],_0x4fd44a=_0x576f8e[_0x45748c(0x127)][_0x45748c(0x13a)][_0x45748c(0x141)]+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x125)][_0x45748c(0x141)]+_0x576f8e[_0x45748c(0x127)]['prompts']['updated'],_0x916789=_0x576f8e[_0x45748c(0x127)][_0x45748c(0x13a)][_0x45748c(0xe4)]+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x125)][_0x45748c(0xe4)]+_0x576f8e[_0x45748c(0x127)][_0x45748c(0x114)]['unchanged'];console['log']('\x0aPull\x20summary\x20for\x20\x27'+_0x576f8e[_0x45748c(0x144)]+'\x27:'),console[_0x45748c(0x109)]('\x20\x20'+a12_0x1b787[_0x45748c(0xe0)]('+\x20'+_0x2832b9+_0x45748c(0x16a))+_0x45748c(0x167)+a12_0x1b787[_0x45748c(0x130)]('~\x20'+_0x4fd44a+_0x45748c(0x158))+_0x45748c(0x167)+a12_0x1b787[_0x45748c(0x146)]('=\x20'+_0x916789+_0x45748c(0x145))),console['log'](_0x45748c(0x10b)+formatCountSummary(_0x576f8e[_0x45748c(0x127)][_0x45748c(0x13a)])),console['log'](_0x45748c(0x166)+formatCountSummary(_0x576f8e[_0x45748c(0x127)]['knowledgeBases'])),console[_0x45748c(0x109)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x576f8e[_0x45748c(0x127)]['prompts'])),console['log'](_0x45748c(0x13c)+a12_0x1b787[_0x45748c(0x11c)](_0x576f8e['outputDir'])),displayDiffs(_0x576f8e['agents'],_0x576f8e[_0x45748c(0x125)],_0x576f8e['prompts']);if(_0x1bb179)return console[_0x45748c(0x109)](a12_0x1b787['yellow'](_0x45748c(0x115))),0x0;if(_0x2832b9===0x0&&_0x4fd44a===0x0)return console[_0x45748c(0x109)](a12_0x1b787['green']('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x576f8e[_0x45748c(0x144)]},_0x3ec86d[_0x45748c(0x164)]),console[_0x45748c(0x109)](a12_0x1b787[_0x45748c(0xe0)](_0x45748c(0xee)+a12_0x1b787['dim'](_0x45748c(0x16d))+_0x45748c(0xe2)+a12_0x1b787[_0x45748c(0x11c)](_0x576f8e[_0x45748c(0x144)]))),0x0;if(!_0x9eb4cf&&!_0x15e5d7){const _0x10d062=await confirmKey('\x0aWrite\x20'+(_0x2832b9+_0x4fd44a)+_0x45748c(0xea));if(!_0x10d062)return console[_0x45748c(0x109)]('Pull\x20cancelled'),0x0;}const {data:_0x192ba6}=await withSpinner(_0x45748c(0x110),()=>_0x3cae18['llm'][_0x45748c(0x116)](_0x4ead19,_0x11582f,{'force':_0x15e5d7}));return console['log'](a12_0x1b787['green']('\x0a✔\x20Pulled\x20'+(_0x2832b9+_0x4fd44a)+'\x20files\x20to\x20'+_0x192ba6[_0x45748c(0x100)])),saveSessionContext({'llm_project':_0x192ba6[_0x45748c(0x144)]},_0x3ec86d[_0x45748c(0x164)]),console[_0x45748c(0x109)](a12_0x1b787['green'](_0x45748c(0xee)+a12_0x1b787[_0x45748c(0x146)](_0x45748c(0x16d))+_0x45748c(0xe2)+a12_0x1b787[_0x45748c(0x11c)](_0x192ba6[_0x45748c(0x144)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a12_0x470ddf(0xfa)]=a12_0x470ddf(0x120);[a12_0x470ddf(0x123)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async['execute'](_0x246f05){const _0xcc5d83=a12_0x470ddf,{options:_0x4522dc,args:_0x1e4bcf,tdx:_0x1cc9aa}=_0x246f05,_0x1bca6a=_0x1e4bcf[0x0],_0x4c7398=_0x4522dc[_0xcc5d83(0xfa)],_0x5981a8=_0x4522dc[_0xcc5d83(0xe1)],_0x5de5ac=_0x4522dc[_0xcc5d83(0x124)],_0x28e5ca=_0x4522dc[_0xcc5d83(0xf7)],_0x230e5a=_0x4522dc[_0xcc5d83(0x12b)];let _0x3e6128;const _0x18f689=findAgentConfigPath(process[_0xcc5d83(0xf0)]());if(_0x1bca6a){const _0x4240d4=a12_0x526e48['join'](_0x1bca6a,_0xcc5d83(0x148));existsSync(_0x4240d4)?(_0x3e6128=_0x1bca6a,console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x146)](_0xcc5d83(0x147)+_0x1bca6a))):_0x3e6128=_0x1bca6a;}else{if(_0x18f689)_0x3e6128=a12_0x526e48[_0xcc5d83(0x118)](_0x18f689),console['log'](a12_0x1b787['dim'](_0xcc5d83(0x12f)+_0x3e6128));else{if(_0x230e5a){const _0x2eb9ed=normalizeName(_0x230e5a),_0x31c1fe=a12_0x526e48[_0xcc5d83(0xf6)](process[_0xcc5d83(0xf0)](),'agents',_0x2eb9ed,_0xcc5d83(0x148));if(existsSync(_0x31c1fe))_0x3e6128=a12_0x526e48[_0xcc5d83(0x118)](_0x31c1fe),console['log'](a12_0x1b787[_0xcc5d83(0x146)](_0xcc5d83(0x147)+_0x3e6128));else{const _0x252507=_0x4522dc[_0xcc5d83(0x13d)];if(_0x252507)throw new SDKError(ErrorCode[_0xcc5d83(0x102)],_0xcc5d83(0x15d)+_0x230e5a+_0xcc5d83(0x168),undefined,{'helpText':_0xcc5d83(0x14f)+_0xcc5d83(0x112)+('\x20\x20tdx\x20agent\x20pull\x20'+_0x230e5a+'\x0a')+(_0xcc5d83(0xdb)+_0x2eb9ed+'\x20--name\x20'+(_0x4c7398||'<new-name>')+_0xcc5d83(0x128)+_0x252507)});_0x3e6128=_0x230e5a,console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x146)](_0xcc5d83(0x163)+_0x230e5a));}}}}if(!_0x3e6128)return console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x130)](_0xcc5d83(0x15c))),console[_0xcc5d83(0x109)](_0xcc5d83(0xf2)),console[_0xcc5d83(0x109)](_0xcc5d83(0x12e)),console[_0xcc5d83(0x109)](_0xcc5d83(0xf5)),console[_0xcc5d83(0x109)]('\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>'),0x1;if(!_0x4c7398)throw new SDKError(ErrorCode[_0xcc5d83(0x142)],_0xcc5d83(0x132),undefined,{'helpText':_0xcc5d83(0xe8)});if(!_0x5de5ac&&!_0x5981a8){const _0x5b444d=await confirmKey(_0xcc5d83(0xfe)+_0x3e6128+'\x22\x20to\x20new\x20project\x20\x22'+_0x4c7398+'\x22?');if(!_0x5b444d)return console[_0xcc5d83(0x109)](_0xcc5d83(0x133)),0x0;}const {data:_0x53f1a7}=await withSpinner('Cloning\x20\x22'+_0x3e6128+'\x22\x20to\x20\x22'+_0x4c7398+_0xcc5d83(0xe3),()=>_0x1cc9aa[_0xcc5d83(0x135)]['cloneProject'](_0x3e6128,_0x4c7398,{'dryRun':_0x5981a8}));if(_0x5981a8)return console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x130)](_0xcc5d83(0x165))),console['log']('Source:\x20'+_0x53f1a7[_0xcc5d83(0x126)]),console[_0xcc5d83(0x109)](_0xcc5d83(0x170)+_0x4c7398),console[_0xcc5d83(0x109)](_0xcc5d83(0x152)),console[_0xcc5d83(0x109)]('\x20\x20Agents:\x20'+_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x13a)][_0xcc5d83(0x131)]),console['log'](_0xcc5d83(0x166)+_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x125)][_0xcc5d83(0x131)]),console['log'](_0xcc5d83(0x106)+_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x114)]['created']),0x0;const _0x3e0162=_0x53f1a7['counts'][_0xcc5d83(0x13a)]['errors']>0x0||_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x125)]['errors']>0x0||_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x114)][_0xcc5d83(0x11f)]>0x0;_0x3e0162?console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x130)](_0xcc5d83(0x13e))):console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0xe0)]('Project\x20cloned\x20successfully'));console[_0xcc5d83(0x109)](_0xcc5d83(0xde)+_0x53f1a7[_0xcc5d83(0x126)]),console[_0xcc5d83(0x109)](_0xcc5d83(0x170)+_0x53f1a7[_0xcc5d83(0x134)]),console['log'](_0xcc5d83(0xef)+_0x53f1a7[_0xcc5d83(0x173)]),console[_0xcc5d83(0x109)](),console[_0xcc5d83(0x109)](_0xcc5d83(0x11e)),console['log'](_0xcc5d83(0x10b)+formatCountSummary(_0x53f1a7[_0xcc5d83(0x127)]['agents'])),console[_0xcc5d83(0x109)](_0xcc5d83(0x166)+formatCountSummary(_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x125)])),console[_0xcc5d83(0x109)](_0xcc5d83(0x106)+formatCountSummary(_0x53f1a7[_0xcc5d83(0x127)][_0xcc5d83(0x114)]));if(_0x3e0162){console[_0xcc5d83(0x109)](),console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x162)](_0xcc5d83(0x14d)));for(const _0x11e682 of _0x53f1a7[_0xcc5d83(0x13a)]){_0x11e682[_0xcc5d83(0x16e)]==='error'&&console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x162)]('\x20\x20Agent\x20\x22'+_0x11e682[_0xcc5d83(0x160)]+'\x22:\x20'+_0x11e682[_0xcc5d83(0xe6)]));}for(const _0x2cb8d0 of _0x53f1a7[_0xcc5d83(0x125)]){_0x2cb8d0[_0xcc5d83(0x16e)]===_0xcc5d83(0xe6)&&console[_0xcc5d83(0x109)](a12_0x1b787['red'](_0xcc5d83(0x169)+_0x2cb8d0[_0xcc5d83(0xfa)]+'\x22:\x20'+_0x2cb8d0[_0xcc5d83(0xe6)]));}for(const _0x3fe384 of _0x53f1a7[_0xcc5d83(0x114)]){_0x3fe384['action']===_0xcc5d83(0xe6)&&console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0x162)]('\x20\x20Prompt\x20\x22'+_0x3fe384['name']+_0xcc5d83(0x174)+_0x3fe384[_0xcc5d83(0xe6)]));}return 0x1;}saveSessionContext({'llm_project':_0x53f1a7[_0xcc5d83(0x134)]},_0x4522dc[_0xcc5d83(0x164)]),console[_0xcc5d83(0x109)](),console[_0xcc5d83(0x109)](a12_0x1b787[_0xcc5d83(0xe0)](_0xcc5d83(0x12a)+a12_0x1b787[_0xcc5d83(0x146)](_0xcc5d83(0x16d))+'\x20=\x20'+a12_0x1b787[_0xcc5d83(0x11c)](_0x53f1a7[_0xcc5d83(0x134)])));const _0x66bbcd=getLLMProjectUrl(_0x28e5ca,_0x53f1a7[_0xcc5d83(0x173)]);return console[_0xcc5d83(0x109)]('Project:\x20'+a12_0x1b787['cyan'](_0x66bbcd)),0x0;}}export class AgentPushCommand extends BaseCommand{[a12_0x470ddf(0xfa)]='agent:push';[a12_0x470ddf(0x123)]=a12_0x470ddf(0x107);async[a12_0x470ddf(0x140)](_0x40741f){const _0x48a2d0=a12_0x470ddf,{options:_0x4c9f2b,args:_0x437289,tdx:_0x260bf2}=_0x40741f;let _0x4aaeab=_0x437289[0x0]||process['cwd']();const _0x3e5c20=_0x4c9f2b['dryRun'],_0x4519e1=_0x4c9f2b['force'],_0xeaa618=_0x4c9f2b[_0x48a2d0(0x124)],_0x17db8b=_0x4c9f2b['site'],_0x5f193=a12_0x526e48[_0x48a2d0(0xf6)](_0x4aaeab,_0x48a2d0(0x113)),_0x4ce4d9=existsSync(_0x5f193);if(_0x4ce4d9){const {data:_0x369b89}=await withSpinner(_0x48a2d0(0xf9)+_0x4aaeab+'\x22...',()=>_0x260bf2[_0x48a2d0(0x135)][_0x48a2d0(0xf1)](_0x4aaeab,{'dryRun':_0x3e5c20,'force':_0x4519e1}));if(_0x3e5c20)return console[_0x48a2d0(0x109)](a12_0x1b787['yellow'](_0x48a2d0(0x165))),console[_0x48a2d0(0x109)]('Would\x20push\x20agent:\x20'+_0x369b89[_0x48a2d0(0x160)]),0x0;if(_0x369b89['action']===_0x48a2d0(0xe6))return console[_0x48a2d0(0x109)](a12_0x1b787['red']('Failed\x20to\x20push\x20agent:\x20'+_0x369b89[_0x48a2d0(0xe6)])),0x1;console[_0x48a2d0(0x109)](a12_0x1b787['green']('Agent\x20'+_0x369b89['action']+_0x48a2d0(0x143))),console['log'](_0x48a2d0(0xdd)+_0x369b89[_0x48a2d0(0x160)]);if(_0x369b89[_0x48a2d0(0x119)]&&_0x369b89[_0x48a2d0(0x12c)]){const _0x299c15=getLLMAgentChatUrl(_0x17db8b,_0x369b89['projectId'],_0x369b89[_0x48a2d0(0x119)]);console['log']('Chat:\x20'+a12_0x1b787[_0x48a2d0(0x11c)](_0x299c15));}return 0x0;}let _0x127bb8=a12_0x526e48[_0x48a2d0(0xf6)](_0x4aaeab,'tdx.json');if(!existsSync(_0x127bb8)){const _0x2c2937=findAgentConfigPath(_0x4aaeab);if(_0x2c2937)_0x4aaeab=a12_0x526e48[_0x48a2d0(0x118)](_0x2c2937),_0x127bb8=_0x2c2937,console[_0x48a2d0(0x109)](a12_0x1b787['dim'](_0x48a2d0(0x15b)+_0x4aaeab));else{const _0x1a8d17=_0x4c9f2b[_0x48a2d0(0x12b)];if(_0x1a8d17){const _0x19dd60=normalizeName(_0x1a8d17),_0x31639=a12_0x526e48[_0x48a2d0(0xf6)](_0x4aaeab,_0x48a2d0(0x13a)),_0xa7bb5c=a12_0x526e48[_0x48a2d0(0xf6)](_0x31639,_0x19dd60,_0x48a2d0(0x148));existsSync(_0xa7bb5c)&&(_0x4aaeab=a12_0x526e48['dirname'](_0xa7bb5c),_0x127bb8=_0xa7bb5c,console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x146)](_0x48a2d0(0x15b)+_0x4aaeab)));}if(!existsSync(_0x127bb8)){let _0x238fa8='Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.';_0x1a8d17&&(_0x238fa8=_0x48a2d0(0xfd)+_0x1a8d17+'\x22\x20but\x20no\x20local\x20folder\x20found.\x0a'+('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x1a8d17+_0x48a2d0(0x171)));throw new SDKError(ErrorCode[_0x48a2d0(0x102)],_0x48a2d0(0x122)+_0x4aaeab,undefined,{'helpText':_0x238fa8});}}}const {data:_0x10d8c3}=await withSpinner(_0x48a2d0(0x159),()=>_0x260bf2[_0x48a2d0(0x135)]['pushProject'](_0x4aaeab,{'dryRun':!![]})),_0x2cc373=_0x10d8c3['counts'][_0x48a2d0(0x13a)][_0x48a2d0(0x11f)]>0x0;if(_0x2cc373){console[_0x48a2d0(0x109)](a12_0x1b787['red']('\x0aErrors\x20found:'));for(const _0x4e72d2 of _0x10d8c3[_0x48a2d0(0x13a)]){_0x4e72d2[_0x48a2d0(0x16e)]===_0x48a2d0(0xe6)&&console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x162)](_0x48a2d0(0xeb)+_0x4e72d2['agentName']+_0x48a2d0(0x174)+_0x4e72d2['error']));}return 0x1;}const _0xcc9d45=_0x10d8c3[_0x48a2d0(0x127)]['agents'][_0x48a2d0(0x131)]+_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x125)][_0x48a2d0(0x131)]+_0x10d8c3['counts'][_0x48a2d0(0x114)][_0x48a2d0(0x131)],_0x47551b=_0x10d8c3['counts'][_0x48a2d0(0x13a)]['updated']+_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x125)][_0x48a2d0(0x141)]+_0x10d8c3['counts'][_0x48a2d0(0x114)]['updated'],_0x4fd72a=_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x13a)][_0x48a2d0(0xe4)]+_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x125)][_0x48a2d0(0xe4)]+_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x114)][_0x48a2d0(0xe4)];console['log']('\x0aPush\x20summary\x20for\x20\x27'+_0x10d8c3[_0x48a2d0(0x144)]+'\x27:'),console[_0x48a2d0(0x109)]('\x20\x20'+a12_0x1b787['green']('+\x20'+_0xcc9d45+'\x20new')+_0x48a2d0(0x167)+a12_0x1b787[_0x48a2d0(0x130)]('~\x20'+_0x47551b+_0x48a2d0(0x158))+_0x48a2d0(0x167)+a12_0x1b787[_0x48a2d0(0x146)]('=\x20'+_0x4fd72a+_0x48a2d0(0x145))),console[_0x48a2d0(0x109)](_0x48a2d0(0x10b)+formatCountSummary(_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x13a)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x10d8c3['counts']['knowledgeBases'])),console[_0x48a2d0(0x109)](_0x48a2d0(0x106)+formatCountSummary(_0x10d8c3[_0x48a2d0(0x127)][_0x48a2d0(0x114)])),console[_0x48a2d0(0x109)](_0x48a2d0(0xe5)+a12_0x1b787['cyan'](_0x4aaeab)),displayDiffs(_0x10d8c3[_0x48a2d0(0x13a)],_0x10d8c3[_0x48a2d0(0x125)],_0x10d8c3[_0x48a2d0(0x114)]);if(_0x3e5c20)return console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x130)](_0x48a2d0(0x15f))),0x0;if(_0xcc9d45===0x0&&_0x47551b===0x0){console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0xe0)](_0x48a2d0(0x149)));const _0x148c01=getLLMProjectUrl(_0x17db8b,_0x10d8c3['projectId']);return console['log'](_0x48a2d0(0x157)+a12_0x1b787[_0x48a2d0(0x11c)](_0x148c01)),0x0;}if(!_0xeaa618&&!_0x4519e1){const _0x1cdd21=await confirmKey('\x0aPush\x20'+(_0xcc9d45+_0x47551b)+_0x48a2d0(0x16c));if(!_0x1cdd21)return console[_0x48a2d0(0x109)](_0x48a2d0(0x137)),0x0;}const {data:_0x3d4d9f}=await withSpinner(_0x48a2d0(0x15e),()=>_0x260bf2[_0x48a2d0(0x135)][_0x48a2d0(0x111)](_0x4aaeab,{'force':_0x4519e1})),_0xd4affc=_0x3d4d9f[_0x48a2d0(0x127)][_0x48a2d0(0x13a)][_0x48a2d0(0x11f)]>0x0||_0x3d4d9f[_0x48a2d0(0x127)][_0x48a2d0(0x125)][_0x48a2d0(0x11f)]>0x0||_0x3d4d9f['counts'][_0x48a2d0(0x114)][_0x48a2d0(0x11f)]>0x0;if(_0xd4affc){console['log'](a12_0x1b787[_0x48a2d0(0x130)](_0x48a2d0(0x13f))),console[_0x48a2d0(0x109)](),console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x162)](_0x48a2d0(0x14d)));for(const _0x1f168b of _0x3d4d9f[_0x48a2d0(0x13a)]){_0x1f168b[_0x48a2d0(0x16e)]===_0x48a2d0(0xe6)&&console['log'](a12_0x1b787['red'](_0x48a2d0(0xeb)+_0x1f168b['agentName']+'\x22:\x20'+_0x1f168b[_0x48a2d0(0xe6)]));}for(const _0x1f339b of _0x3d4d9f[_0x48a2d0(0x125)]){_0x1f339b[_0x48a2d0(0x16e)]===_0x48a2d0(0xe6)&&console[_0x48a2d0(0x109)](a12_0x1b787[_0x48a2d0(0x162)](_0x48a2d0(0x169)+_0x1f339b[_0x48a2d0(0xfa)]+_0x48a2d0(0x174)+_0x1f339b[_0x48a2d0(0xe6)]));}for(const _0x2ca812 of _0x3d4d9f[_0x48a2d0(0x114)]){_0x2ca812['action']===_0x48a2d0(0xe6)&&console[_0x48a2d0(0x109)](a12_0x1b787['red']('\x20\x20Prompt\x20\x22'+_0x2ca812[_0x48a2d0(0xfa)]+'\x22:\x20'+_0x2ca812['error']));}return 0x1;}console['log'](a12_0x1b787['green'](_0x48a2d0(0x15a)+(_0xcc9d45+_0x47551b)+_0x48a2d0(0x11b)+_0x3d4d9f[_0x48a2d0(0x144)]+'\x27'));const _0x20a9eb=getLLMProjectUrl(_0x17db8b,_0x3d4d9f[_0x48a2d0(0x12c)]);return console['log'](_0x48a2d0(0x157)+a12_0x1b787[_0x48a2d0(0x11c)](_0x20a9eb)),0x0;}}
@@ -1 +1 @@
1
- const a13_0x364099=a13_0x56e4;(function(_0x4520d5,_0x2a25fa){const _0x36d875=a13_0x56e4,_0x4557b9=_0x4520d5();while(!![]){try{const _0x56a2d8=-parseInt(_0x36d875(0x202))/0x1+parseInt(_0x36d875(0x1db))/0x2+-parseInt(_0x36d875(0x1cb))/0x3*(parseInt(_0x36d875(0x1ef))/0x4)+-parseInt(_0x36d875(0x1d7))/0x5+-parseInt(_0x36d875(0x1e3))/0x6+parseInt(_0x36d875(0x205))/0x7+-parseInt(_0x36d875(0x200))/0x8*(-parseInt(_0x36d875(0x1da))/0x9);if(_0x56a2d8===_0x2a25fa)break;else _0x4557b9['push'](_0x4557b9['shift']());}catch(_0x4c9b3d){_0x4557b9['push'](_0x4557b9['shift']());}}}(a13_0x12b4,0x75a96));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a13_0x364099(0x1dc),a13_0x364099(0x204),a13_0x364099(0x1e5),a13_0x364099(0x1d5),a13_0x364099(0x1dd),a13_0x364099(0x1cd),a13_0x364099(0x20b),a13_0x364099(0x1d0)]);function isSensitiveHeader(_0x7d88fc){const _0x1c7150=a13_0x364099;return SENSITIVE_HEADERS[_0x1c7150(0x1ce)](_0x7d88fc['toLowerCase']());}function a13_0x12b4(){const _0x42391b=['message','Invalid\x20HTTP\x20method:\x20','type','readBodyFromFile','GET','cdp','data','6430376NOkgjG','\x0aStack\x20trace:\x0a','380374UphSbm','headers','proxy-authorization','4014955GOSUgT','file','method','join','color','Endpoint\x20must\x20start\x20with\x20/:\x20','x-auth-token','Invalid\x20header\x20format:\x20\x22','Error:\x20','includes','<\x20HTTP/1.1\x20','97401NkSUuX','POST','x-xsrf-token','has','header','x-trino-user','output','DELETE','name','Invalid\x20API\x20type:\x20','set-cookie','api','3597895KWAlYo','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','substring','18fRDlZX','829202ISFCEI','authorization','set-cookie2','trino','validate','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','toUpperCase','execute','4524774ZXjgOh','stack','cookie','log','indexOf','workflow','error','PUT','length','entries','llm','Results\x20saved\x20to\x20','32tvvJVb','verbose','isArray','keys','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','site','\x22.\x20','trim','PATCH','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.'];a13_0x12b4=function(){return _0x42391b;};return a13_0x12b4();}function a13_0x56e4(_0x4f91bc,_0x142b1e){_0x4f91bc=_0x4f91bc-0x1c8;const _0x12b4a2=a13_0x12b4();let _0x56e40c=_0x12b4a2[_0x4f91bc];return _0x56e40c;}function parseHeader(_0x589a4e){const _0x1a116f=a13_0x364099,_0x37bd61=_0x589a4e[_0x1a116f(0x1e7)](':');if(_0x37bd61===-0x1)throw new Error(_0x1a116f(0x20c)+_0x589a4e+_0x1a116f(0x1f5)+_0x1a116f(0x1f3));const _0x57e125=_0x589a4e[_0x1a116f(0x1d9)](0x0,_0x37bd61)[_0x1a116f(0x1f6)](),_0x34f95a=_0x589a4e['substring'](_0x37bd61+0x1)[_0x1a116f(0x1f6)]();if(!_0x57e125)throw new Error(_0x1a116f(0x1d8)+_0x589a4e+'\x22');return[_0x57e125,_0x34f95a];}export class ApiCommand extends BaseCommand{[a13_0x364099(0x1d3)]=a13_0x364099(0x1d6);['description']=a13_0x364099(0x1e0);[a13_0x364099(0x1df)](_0x289059){const _0x437c1f=a13_0x364099,{args:_0x1bd69a,options:_0x4102a6}=_0x289059,_0x1e0d1b=_0x4102a6;if(_0x1bd69a[_0x437c1f(0x1eb)]===0x0)return'Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list';const _0x2ea295=_0x1bd69a[0x0];if(!_0x2ea295['startsWith']('/'))return _0x437c1f(0x20a)+_0x2ea295;const _0x2c890e=_0x1e0d1b['data'],_0x3c0a75=_0x1e0d1b['file'];if(_0x2c890e&&_0x3c0a75)return _0x437c1f(0x1f8);const _0x40267f=_0x1e0d1b[_0x437c1f(0x207)]||_0x437c1f(0x1fd),_0x390240=['GET',_0x437c1f(0x1cc),_0x437c1f(0x1ea),_0x437c1f(0x1d2),_0x437c1f(0x1f7)];if(!_0x390240['includes'](_0x40267f[_0x437c1f(0x1e1)]()))return _0x437c1f(0x1fa)+_0x40267f+'.\x20Valid\x20methods:\x20'+_0x390240['join'](',\x20');const _0x22046d=_0x1e0d1b[_0x437c1f(0x1fb)]||'td',_0x105b53=['td',_0x437c1f(0x1fe),_0x437c1f(0x1e8),_0x437c1f(0x1de),_0x437c1f(0x1ed)];if(!_0x105b53[_0x437c1f(0x1c9)](_0x22046d))return _0x437c1f(0x1d4)+_0x22046d+'.\x20Valid\x20types:\x20'+_0x105b53[_0x437c1f(0x208)](',\x20');return undefined;}async[a13_0x364099(0x1e2)](_0x3b5c0c){const _0x2b3a52=a13_0x364099,{options:_0x526d00,args:_0x48af65,tdx:_0x3b9f82}=_0x3b5c0c,_0x1d01b3=_0x526d00,_0x4a998f=_0x48af65[0x0],_0x51b8e6=(_0x1d01b3[_0x2b3a52(0x207)]||'GET')[_0x2b3a52(0x1e1)](),_0x31561f=_0x1d01b3['data'],_0x2b1484=_0x1d01b3[_0x2b3a52(0x206)],_0x148ffe=_0x1d01b3[_0x2b3a52(0x1cf)],_0x2238ef=_0x1d01b3[_0x2b3a52(0x1fb)]||'td';try{const _0x21fc10={};if(_0x148ffe){const _0x29d1ef=Array[_0x2b3a52(0x1f1)](_0x148ffe)?_0x148ffe:[_0x148ffe];for(const _0xce6219 of _0x29d1ef){const [_0x543c23,_0x5ee833]=parseHeader(_0xce6219);_0x21fc10[_0x543c23]=_0x5ee833;}}let _0x345b96;if(_0x31561f)_0x345b96=_0x31561f;else{if(_0x2b1484)try{_0x345b96=RawAPI[_0x2b3a52(0x1fc)](_0x2b1484);}catch(_0x4698d4){return console[_0x2b3a52(0x1e9)]('Error:\x20'+(_0x4698d4 instanceof Error?_0x4698d4['message']:String(_0x4698d4))),0x1;}}const _0x5ac7b1={'method':_0x51b8e6,'apiType':_0x2238ef,'includeHeaders':_0x526d00[_0x2b3a52(0x1f0)]};_0x345b96&&(_0x5ac7b1['body']=_0x345b96);Object[_0x2b3a52(0x1f2)](_0x21fc10)[_0x2b3a52(0x1eb)]>0x0&&(_0x5ac7b1[_0x2b3a52(0x203)]=_0x21fc10);if(_0x526d00[_0x2b3a52(0x1f0)]){const _0x24076f=resolveSite(_0x526d00[_0x2b3a52(0x1f4)]),_0x2ba1d6=getEndpoint(_0x24076f,_0x2238ef),_0x5a5535=''+_0x2ba1d6+_0x4a998f;console[_0x2b3a52(0x1e9)]('>\x20'+_0x51b8e6+'\x20'+_0x5a5535);const _0x4e717d=getAuthHeaders(_0x24076f),_0x3a33b3={..._0x4e717d,..._0x21fc10};for(const [_0x3e6602,_0x4a6f81]of Object[_0x2b3a52(0x1ec)](_0x3a33b3)){!isSensitiveHeader(_0x3e6602)&&console[_0x2b3a52(0x1e9)]('>\x20'+_0x3e6602+':\x20'+_0x4a6f81);}_0x345b96&&console[_0x2b3a52(0x1e9)]('>'),console[_0x2b3a52(0x1e9)]('');}const _0x1438fa=await _0x3b9f82[_0x2b3a52(0x1d6)]['request'](_0x4a998f,_0x5ac7b1);if(_0x526d00[_0x2b3a52(0x1f0)]&&_0x1438fa['headers']){console[_0x2b3a52(0x1e9)](_0x2b3a52(0x1ca)+_0x1438fa['status']);for(const [_0x5e553b,_0x7f6b19]of Object[_0x2b3a52(0x1ec)](_0x1438fa[_0x2b3a52(0x203)])){!isSensitiveHeader(_0x5e553b)&&console[_0x2b3a52(0x1e9)]('<\x20'+_0x5e553b+':\x20'+_0x7f6b19);}console[_0x2b3a52(0x1e9)]('');}const _0x56d908=Boolean(_0x526d00[_0x2b3a52(0x1d1)]),_0x193486={'color':_0x526d00[_0x2b3a52(0x209)],'noColor':_0x526d00['noColor']||_0x56d908&&!_0x526d00[_0x2b3a52(0x209)]},_0xf18bae=colorizeJSON(_0x1438fa[_0x2b3a52(0x1ff)],_0x193486);return _0x526d00['output']?(writeFileSync(_0x526d00[_0x2b3a52(0x1d1)],_0xf18bae),console['error'](_0x2b3a52(0x1ee)+_0x526d00['output'])):console[_0x2b3a52(0x1e6)](_0xf18bae),0x0;}catch(_0xa8f4dc){return _0xa8f4dc instanceof Error?(console[_0x2b3a52(0x1e9)](_0x2b3a52(0x1c8)+_0xa8f4dc[_0x2b3a52(0x1f9)]),_0x526d00[_0x2b3a52(0x1f0)]&&_0xa8f4dc[_0x2b3a52(0x1e4)]&&console['error'](_0x2b3a52(0x201)+_0xa8f4dc[_0x2b3a52(0x1e4)])):console[_0x2b3a52(0x1e9)](_0x2b3a52(0x1c8)+String(_0xa8f4dc)),0x1;}}}
1
+ const a13_0x2fb127=a13_0x5984;(function(_0x264b77,_0x1f2e1d){const _0x194c80=a13_0x5984,_0x4aca0d=_0x264b77();while(!![]){try{const _0x242326=-parseInt(_0x194c80(0x1a4))/0x1+parseInt(_0x194c80(0x1bf))/0x2*(parseInt(_0x194c80(0x1c2))/0x3)+parseInt(_0x194c80(0x1b0))/0x4+-parseInt(_0x194c80(0x18b))/0x5*(parseInt(_0x194c80(0x1a1))/0x6)+-parseInt(_0x194c80(0x1a3))/0x7*(parseInt(_0x194c80(0x1b6))/0x8)+parseInt(_0x194c80(0x195))/0x9+-parseInt(_0x194c80(0x188))/0xa*(-parseInt(_0x194c80(0x1bb))/0xb);if(_0x242326===_0x1f2e1d)break;else _0x4aca0d['push'](_0x4aca0d['shift']());}catch(_0x3ef5fd){_0x4aca0d['push'](_0x4aca0d['shift']());}}}(a13_0x3b84,0x895d2));import{BaseCommand}from'./command.js';function a13_0x5984(_0x59d39e,_0x3ff5c0){_0x59d39e=_0x59d39e-0x186;const _0x3b84ac=a13_0x3b84();let _0x59845d=_0x3b84ac[_0x59d39e];return _0x59845d;}import{RawAPI}from'../sdk/api.js';function a13_0x3b84(){const _0x478c83=['2IWtZUz','Error:\x20','body','1512597jnoEGl','api','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','error','workflow','data','name','3558580RGSlGz','x-xsrf-token','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','5fqSyXW','PUT','toUpperCase','validate','PATCH','\x0aStack\x20trace:\x0a','includes','has','verbose','proxy-authorization','3749319vFchku','.\x20Valid\x20methods:\x20','output','x-auth-token','startsWith','indexOf','execute','cdp','join','trino','Invalid\x20header\x20format:\x20\x22','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','2597712uhPAzV','length','6853FmVwlD','216086EePexq','message','Invalid\x20API\x20type:\x20','color','set-cookie2','log','site','toLowerCase','Endpoint\x20must\x20start\x20with\x20/:\x20','<\x20HTTP/1.1\x20','method','entries','4000736lzPOWw','Invalid\x20HTTP\x20method:\x20','GET','type','keys','noColor','8704wURTFd','isArray','file','set-cookie','llm','11mjEPEA','headers','trim','\x22.\x20'];a13_0x3b84=function(){return _0x478c83;};return a13_0x3b84();}import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set(['authorization',a13_0x2fb127(0x194),'cookie',a13_0x2fb127(0x1b9),a13_0x2fb127(0x1a8),a13_0x2fb127(0x189),a13_0x2fb127(0x198),'x-trino-user']);function isSensitiveHeader(_0x16704a){const _0x48a615=a13_0x2fb127;return SENSITIVE_HEADERS[_0x48a615(0x192)](_0x16704a[_0x48a615(0x1ab)]());}function parseHeader(_0x22b26f){const _0x554d0a=a13_0x2fb127,_0x3ddb6b=_0x22b26f[_0x554d0a(0x19a)](':');if(_0x3ddb6b===-0x1)throw new Error(_0x554d0a(0x19f)+_0x22b26f+_0x554d0a(0x1be)+_0x554d0a(0x18a));const _0xf0b52c=_0x22b26f['substring'](0x0,_0x3ddb6b)[_0x554d0a(0x1bd)](),_0x7c3920=_0x22b26f['substring'](_0x3ddb6b+0x1)[_0x554d0a(0x1bd)]();if(!_0xf0b52c)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x22b26f+'\x22');return[_0xf0b52c,_0x7c3920];}export class ApiCommand extends BaseCommand{[a13_0x2fb127(0x187)]=a13_0x2fb127(0x1c3);['description']=a13_0x2fb127(0x1c4);[a13_0x2fb127(0x18e)](_0x5e23ac){const _0x4c9c1c=a13_0x2fb127,{args:_0x1db55b,options:_0x2643a0}=_0x5e23ac,_0x2f49b9=_0x2643a0;if(_0x1db55b[_0x4c9c1c(0x1a2)]===0x0)return _0x4c9c1c(0x1a0);const _0x1d667a=_0x1db55b[0x0];if(!_0x1d667a[_0x4c9c1c(0x199)]('/'))return _0x4c9c1c(0x1ac)+_0x1d667a;const _0x3ca716=_0x2f49b9[_0x4c9c1c(0x186)],_0x5885ff=_0x2f49b9[_0x4c9c1c(0x1b8)];if(_0x3ca716&&_0x5885ff)return'Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.';const _0x1645cb=_0x2f49b9[_0x4c9c1c(0x1ae)]||_0x4c9c1c(0x1b2),_0x2a1b53=[_0x4c9c1c(0x1b2),'POST',_0x4c9c1c(0x18c),'DELETE',_0x4c9c1c(0x18f)];if(!_0x2a1b53['includes'](_0x1645cb[_0x4c9c1c(0x18d)]()))return _0x4c9c1c(0x1b1)+_0x1645cb+_0x4c9c1c(0x196)+_0x2a1b53[_0x4c9c1c(0x19d)](',\x20');const _0x312290=_0x2f49b9[_0x4c9c1c(0x1b3)]||'td',_0x5b29d9=['td',_0x4c9c1c(0x19c),_0x4c9c1c(0x1c6),_0x4c9c1c(0x19e),_0x4c9c1c(0x1ba)];if(!_0x5b29d9[_0x4c9c1c(0x191)](_0x312290))return _0x4c9c1c(0x1a6)+_0x312290+'.\x20Valid\x20types:\x20'+_0x5b29d9['join'](',\x20');return undefined;}async[a13_0x2fb127(0x19b)](_0x2580ab){const _0x507335=a13_0x2fb127,{options:_0x21323d,args:_0x5b7b4b,tdx:_0x3454d2}=_0x2580ab,_0x5b9c2a=_0x21323d,_0xcc6c12=_0x5b7b4b[0x0],_0x2c16d3=(_0x5b9c2a['method']||'GET')[_0x507335(0x18d)](),_0x152c7a=_0x5b9c2a[_0x507335(0x186)],_0x4f0b88=_0x5b9c2a[_0x507335(0x1b8)],_0x206bd1=_0x5b9c2a['header'],_0x474b63=_0x5b9c2a[_0x507335(0x1b3)]||'td';try{const _0x20286b={};if(_0x206bd1){const _0x1f6f6f=Array[_0x507335(0x1b7)](_0x206bd1)?_0x206bd1:[_0x206bd1];for(const _0x1068cc of _0x1f6f6f){const [_0x525a25,_0x3308c8]=parseHeader(_0x1068cc);_0x20286b[_0x525a25]=_0x3308c8;}}let _0x900aa9;if(_0x152c7a)_0x900aa9=_0x152c7a;else{if(_0x4f0b88)try{_0x900aa9=RawAPI['readBodyFromFile'](_0x4f0b88);}catch(_0x41545f){return console['error'](_0x507335(0x1c0)+(_0x41545f instanceof Error?_0x41545f[_0x507335(0x1a5)]:String(_0x41545f))),0x1;}}const _0xfa4173={'method':_0x2c16d3,'apiType':_0x474b63,'includeHeaders':_0x21323d[_0x507335(0x193)]};_0x900aa9&&(_0xfa4173[_0x507335(0x1c1)]=_0x900aa9);Object[_0x507335(0x1b4)](_0x20286b)[_0x507335(0x1a2)]>0x0&&(_0xfa4173[_0x507335(0x1bc)]=_0x20286b);if(_0x21323d['verbose']){const _0x473341=resolveSite(_0x21323d[_0x507335(0x1aa)]),_0x36606d=getEndpoint(_0x473341,_0x474b63),_0x57334c=''+_0x36606d+_0xcc6c12;console[_0x507335(0x1c5)]('>\x20'+_0x2c16d3+'\x20'+_0x57334c);const _0x24c45c=getAuthHeaders(_0x473341),_0x3a7f99={..._0x24c45c,..._0x20286b};for(const [_0x57266d,_0x5d62c4]of Object[_0x507335(0x1af)](_0x3a7f99)){!isSensitiveHeader(_0x57266d)&&console[_0x507335(0x1c5)]('>\x20'+_0x57266d+':\x20'+_0x5d62c4);}_0x900aa9&&console['error']('>'),console[_0x507335(0x1c5)]('');}const _0x162183=await _0x3454d2[_0x507335(0x1c3)]['request'](_0xcc6c12,_0xfa4173);if(_0x21323d['verbose']&&_0x162183['headers']){console[_0x507335(0x1c5)](_0x507335(0x1ad)+_0x162183['status']);for(const [_0x36d180,_0x523a33]of Object[_0x507335(0x1af)](_0x162183[_0x507335(0x1bc)])){!isSensitiveHeader(_0x36d180)&&console[_0x507335(0x1c5)]('<\x20'+_0x36d180+':\x20'+_0x523a33);}console[_0x507335(0x1c5)]('');}const _0x23c84c=Boolean(_0x21323d['output']),_0x119eb3={'color':_0x21323d[_0x507335(0x1a7)],'noColor':_0x21323d[_0x507335(0x1b5)]||_0x23c84c&&!_0x21323d[_0x507335(0x1a7)]},_0x5d6ff3=colorizeJSON(_0x162183[_0x507335(0x186)],_0x119eb3);return _0x21323d[_0x507335(0x197)]?(writeFileSync(_0x21323d['output'],_0x5d6ff3),console['error']('Results\x20saved\x20to\x20'+_0x21323d[_0x507335(0x197)])):console[_0x507335(0x1a9)](_0x5d6ff3),0x0;}catch(_0x5244c8){return _0x5244c8 instanceof Error?(console[_0x507335(0x1c5)]('Error:\x20'+_0x5244c8[_0x507335(0x1a5)]),_0x21323d[_0x507335(0x193)]&&_0x5244c8['stack']&&console['error'](_0x507335(0x190)+_0x5244c8['stack'])):console[_0x507335(0x1c5)]('Error:\x20'+String(_0x5244c8)),0x1;}}}
@@ -1 +1 @@
1
- const a14_0x5ec66e=a14_0x2337;(function(_0x5abb06,_0x2229bf){const _0x2e6d5c=a14_0x2337,_0x115368=_0x5abb06();while(!![]){try{const _0x2737b5=parseInt(_0x2e6d5c(0xa7))/0x1+-parseInt(_0x2e6d5c(0x8d))/0x2*(-parseInt(_0x2e6d5c(0xad))/0x3)+-parseInt(_0x2e6d5c(0xb3))/0x4+parseInt(_0x2e6d5c(0x7d))/0x5*(-parseInt(_0x2e6d5c(0xc4))/0x6)+parseInt(_0x2e6d5c(0xbc))/0x7*(-parseInt(_0x2e6d5c(0x7e))/0x8)+-parseInt(_0x2e6d5c(0xae))/0x9*(-parseInt(_0x2e6d5c(0xc0))/0xa)+parseInt(_0x2e6d5c(0x91))/0xb*(parseInt(_0x2e6d5c(0xa6))/0xc);if(_0x2737b5===_0x2229bf)break;else _0x115368['push'](_0x115368['shift']());}catch(_0x41428a){_0x115368['push'](_0x115368['shift']());}}}(a14_0xf5e4,0x94d62));import{BaseCommand,printAuthError}from'./command.js';function a14_0x2337(_0x2749f5,_0x1db339){_0x2749f5=_0x2749f5-0x73;const _0xf5e433=a14_0xf5e4();let _0x23374c=_0xf5e433[_0x2749f5];return _0x23374c;}import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../types/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a14_0x5ecffe from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a14_0x3796ab from'chalk';function a14_0xf5e4(){const _0x211174=['value','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','No\x20API\x20key\x20found\x20in\x20keychain','bold','error','site','us01','ap02\x20-\x20Korea','warn','✓\x20Authentication\x20successful\x0a','log','/app/mp/ak','tdx:\x20auth\x20clear','✓\x20Profile\x20\x27','tdx\x20profile:\x20','639660hSlKmk','62936WHCPux','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','execute','Enter\x20site\x20name:','last_name','yellow','52803NGqcop','9djybjC','test','name','Setting\x20up\x20authentication\x20for\x20site:\x20','\x20(site:\x20','3752872zUMwjD','\x20for\x20profile:\x20','message','push','description','filter','\x20\x20tdx','Setup\x20API\x20key\x20authentication\x20interactively','Enter\x20custom\x20site','100142uTMbRr','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20registered','tdx:\x20auth\x20setup','6318630JXhDPx','✗\x20Validation\x20failed:\x20','length','apiKey','17100RkmKUq','ap02','\x0aSetup\x20cancelled','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','profile','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','email','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','API\x20key\x20cannot\x20be\x20empty','auth:clear','jobs','customSite','1745OWlVPe','424Fbqzzr','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Remove\x20API\x20key\x20from\x20system\x20keychain','create','eu\x20\x20\x20-\x20Europe','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','other','You\x20can\x20find\x20your\x20API\x20key\x20at:','first_name','auth','\x20--profile\x20','getUserInfo','ERROR','System\x20keychain\x20is\x20not\x20available','logLevel','72piOcOL','Validating\x20API\x20key...','red','trim','407XLYBnu','auth:setup','Read\x20credential\x20from\x20','Name:\x20','\x20(profile:\x20'];a14_0xf5e4=function(){return _0x211174;};return a14_0xf5e4();}export class AuthSetupCommand extends BaseCommand{['name']=a14_0x5ec66e(0x92);[a14_0x5ec66e(0xb7)]=a14_0x5ec66e(0xba);async[a14_0x5ec66e(0xa9)](_0x33bbdf){const _0x75b61a=a14_0x5ec66e,{options:_0x4085a3}=_0x33bbdf,_0x2161f8=_0x4085a3[_0x75b61a(0x75)];console['log'](a14_0x3796ab[_0x75b61a(0x9a)](_0x75b61a(0xbf)));const _0x44b53d=_0x4085a3['site']||_0x75b61a(0x9d),_0x593175=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x75b61a(0x9d)},{'title':'jp\x20\x20\x20-\x20Japan','value':'jp01'},{'title':_0x75b61a(0x82),'value':'eu01'},{'title':_0x75b61a(0x9e),'value':_0x75b61a(0xc5)}];let _0x97b718=_0x593175['findIndex'](_0x5ded59=>_0x5ded59[_0x75b61a(0x96)]===_0x44b53d);_0x97b718===-0x1&&_0x44b53d!=='us01'&&(_0x593175[_0x75b61a(0xb6)]({'title':_0x44b53d,'value':_0x44b53d}),_0x97b718=_0x593175[_0x75b61a(0xc2)]-0x1);_0x593175[_0x75b61a(0xb6)]({'title':_0x75b61a(0xbb),'value':'other'});const _0x5e3111=_0x2161f8?_0x75b61a(0xa8)+_0x2161f8+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x347287=await a14_0x5ecffe({'type':'select','name':'site','message':_0x5e3111,'choices':_0x593175,'initial':_0x97b718>=0x0?_0x97b718:0x0});if(!_0x347287[_0x75b61a(0x9c)])return console[_0x75b61a(0xa1)](_0x75b61a(0x73)),0x1;let _0x59cdec;if(_0x347287['site']===_0x75b61a(0x84)){const _0x39ec00=await a14_0x5ecffe({'type':'text','name':_0x75b61a(0x7c),'message':_0x75b61a(0xaa),'initial':'us01','validate':_0x28277f=>{const _0x2a18d4=_0x75b61a;if(!_0x28277f||!_0x28277f[_0x2a18d4(0x90)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x2a18d4(0xaf)](_0x28277f[_0x2a18d4(0x90)]()))return _0x2a18d4(0x74);return!![];}});if(!_0x39ec00['customSite'])return console[_0x75b61a(0xa1)](_0x75b61a(0x73)),0x1;_0x59cdec=_0x39ec00[_0x75b61a(0x7c)];}else _0x59cdec=_0x347287[_0x75b61a(0x9c)];const _0x1ecc3b=resolveSite(_0x59cdec);console[_0x75b61a(0xa1)](_0x75b61a(0xb1)+_0x1ecc3b),console[_0x75b61a(0xa1)](_0x75b61a(0x85)),console[_0x75b61a(0xa1)]('\x20\x20'+getConsoleUrl(_0x1ecc3b,_0x75b61a(0xa2)));const _0x17412c=await a14_0x5ecffe({'type':'password','name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x207cbf=>{const _0x200893=_0x75b61a;if(!_0x207cbf||!_0x207cbf[_0x200893(0x90)]())return _0x200893(0x79);return!![];}});if(!_0x17412c[_0x75b61a(0xc3)])return console[_0x75b61a(0xa1)]('\x0aSetup\x20cancelled'),0x1;const _0x36081f=_0x17412c['apiKey'];console[_0x75b61a(0xa1)](_0x75b61a(0x8e));try{const _0x5a7c4d=TDX[_0x75b61a(0x81)]({'site':_0x1ecc3b,'apiKey':_0x36081f[_0x75b61a(0x90)](),'logLevel':_0x4085a3[_0x75b61a(0x8c)]??LogLevel[_0x75b61a(0x8a)]}),_0x4d4e5b=await _0x5a7c4d[_0x75b61a(0x7b)][_0x75b61a(0x89)]();console[_0x75b61a(0xa1)](_0x75b61a(0xbd)+_0x4d4e5b[_0x75b61a(0x77)]+')');const _0x5ee66f=await isKeychainAvailable();_0x5ee66f?(await saveAPIKeyAsync(_0x36081f[_0x75b61a(0x90)](),_0x1ecc3b,_0x2161f8),console[_0x75b61a(0xa1)](_0x75b61a(0x76)+(_0x2161f8?_0x75b61a(0x95)+_0x2161f8+')':''))):(console[_0x75b61a(0x9f)](a14_0x3796ab[_0x75b61a(0xac)](_0x75b61a(0x97))),console['warn'](a14_0x3796ab[_0x75b61a(0xac)](_0x75b61a(0x7f))));if(_0x2161f8){const _0x132670={'site':_0x1ecc3b};saveProfileToUserConfig(_0x2161f8,_0x132670),console[_0x75b61a(0xa1)](_0x75b61a(0xa4)+_0x2161f8+_0x75b61a(0xbe));}const _0x43a01b=_0x2161f8?_0x75b61a(0x88)+_0x2161f8:'';return console[_0x75b61a(0xa1)](),console[_0x75b61a(0xa1)](_0x75b61a(0x98)),console[_0x75b61a(0xa1)](_0x75b61a(0xb9)+_0x43a01b+_0x75b61a(0x83)),console[_0x75b61a(0xa1)](_0x75b61a(0xb9)+_0x43a01b+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x320b58){if(_0x320b58 instanceof HTTPClientError&&_0x320b58['status']===0x191)return printAuthError(_0x320b58),0x1;return console['error'](a14_0x3796ab['red'](_0x75b61a(0xc1)+(_0x320b58 instanceof Error?_0x320b58[_0x75b61a(0xb5)]:String(_0x320b58)))),console[_0x75b61a(0x9b)]('API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.'),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a14_0x5ec66e(0xb0)]=a14_0x5ec66e(0x87);[a14_0x5ec66e(0xb7)]=a14_0x5ec66e(0x78);async[a14_0x5ec66e(0xa9)](_0x54dc53){const _0xf53a96=a14_0x5ec66e,{options:_0x433a78,tdx:_0x1db147}=_0x54dc53,_0x277874=_0x433a78[_0xf53a96(0x9c)],_0x50ea5c=_0x433a78[_0xf53a96(0x75)],_0x6af05c=_0x50ea5c?_0x50ea5c:'N/A';console[_0xf53a96(0xa1)](_0xf53a96(0xa5)+_0x6af05c+_0xf53a96(0xb2)+_0x277874+')');const _0x51d03c=await resolveAPIKeyAsync(_0x277874,_0x50ea5c);if(_0x51d03c){const {source:_0x79e68d,isDeprecated:_0x352792}=_0x51d03c,_0x85895a=_0xf53a96(0x93)+_0x79e68d;console[_0xf53a96(0xa1)](_0x352792?a14_0x3796ab[_0xf53a96(0xac)](_0x85895a):_0x85895a);}else console[_0xf53a96(0xa1)](a14_0x3796ab[_0xf53a96(0xac)]('No\x20credential\x20found'));try{const _0x10faf9=await _0x1db147[_0xf53a96(0x7b)][_0xf53a96(0x89)]();return console['log'](a14_0x3796ab['green'](_0xf53a96(0xa0))),console[_0xf53a96(0xa1)]('User:\x20'+_0x10faf9['email']),(_0x10faf9[_0xf53a96(0x86)]||_0x10faf9['last_name'])&&console[_0xf53a96(0xa1)](_0xf53a96(0x94)+[_0x10faf9[_0xf53a96(0x86)],_0x10faf9[_0xf53a96(0xab)]][_0xf53a96(0xb8)](Boolean)['join']('\x20')),0x0;}catch(_0x227dd4){return _0x227dd4 instanceof HTTPClientError&&_0x227dd4['status']===0x191?printAuthError(_0x227dd4,!![],_0x50ea5c):console[_0xf53a96(0x9b)](a14_0x3796ab[_0xf53a96(0x8f)](_0xf53a96(0xc1)+(_0x227dd4 instanceof Error?_0x227dd4[_0xf53a96(0xb5)]:String(_0x227dd4)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a14_0x5ec66e(0xb0)]=a14_0x5ec66e(0x7a);[a14_0x5ec66e(0xb7)]=a14_0x5ec66e(0x80);async[a14_0x5ec66e(0xa9)](_0x5bde6c){const _0x4ed1c8=a14_0x5ec66e,{options:_0x3a977c}=_0x5bde6c,_0x313bbe=_0x3a977c[_0x4ed1c8(0x75)];console[_0x4ed1c8(0xa1)](a14_0x3796ab[_0x4ed1c8(0x9a)](_0x4ed1c8(0xa3)));const _0x158ede=await isKeychainAvailable();if(!_0x158ede)return console[_0x4ed1c8(0x9b)](a14_0x3796ab[_0x4ed1c8(0x8f)](_0x4ed1c8(0x8b))),0x1;const _0x42c734=await deleteKeychainAPIKey(_0x313bbe);return _0x42c734?(clearCredentialCache(),console[_0x4ed1c8(0xa1)]('✓\x20API\x20key\x20removed\x20from\x20keychain'+(_0x313bbe?_0x4ed1c8(0x95)+_0x313bbe+')':'')),0x0):(console[_0x4ed1c8(0xa1)](_0x4ed1c8(0x99)+(_0x313bbe?_0x4ed1c8(0xb4)+_0x313bbe:'')),0x1);}}
1
+ const a14_0x1ff32b=a14_0x3215;function a14_0x241f(){const _0x1f77f7=['4152ooVRVt','tdx\x20profile:\x20','warn','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','✓\x20Authentication\x20successful\x0a','\x20\x20tdx','status','auth:setup','Remove\x20API\x20key\x20from\x20system\x20keychain','execute','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','select','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','push','\x20(profile:\x20','create','last_name','profile','logLevel','text','You\x20can\x20find\x20your\x20API\x20key\x20at:','System\x20keychain\x20is\x20not\x20available','tdx:\x20auth\x20setup','50cQTrvE','red','Validating\x20API\x20key...','API\x20key\x20cannot\x20be\x20empty','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','No\x20API\x20key\x20found\x20in\x20keychain','ERROR','log','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Enter\x20your\x20TD\x20API\x20key:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','error','apiKey','16GdFRlG','other','\x20(site:\x20','ap02','Setup\x20API\x20key\x20authentication\x20interactively','yellow','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','1869gowTln','us01','message','bold','Read\x20credential\x20from\x20','eu01','No\x20credential\x20found','trim','jp01','ap02\x20-\x20Korea','219654bhKwtv','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','auth','site','167910kzvhZV','1216737vKbbUY','customSite','value','143196gfgNPw','getUserInfo','N/A','filter','\x27\x20registered','email','join','✓\x20API\x20key\x20removed\x20from\x20keychain','findIndex','\x0aSetup\x20cancelled','length','name','tdx:\x20auth\x20clear','jobs','\x20--profile\x20','description','green','439855XaaUwz','✗\x20Validation\x20failed:\x20','first_name','jp\x20\x20\x20-\x20Japan','/app/mp/ak','us\x20\x20\x20-\x20United\x20States','5LQgtrO','5907121GfGhmq'];a14_0x241f=function(){return _0x1f77f7;};return a14_0x241f();}(function(_0x3e9850,_0x523481){const _0x3d3880=a14_0x3215,_0x2e9053=_0x3e9850();while(!![]){try{const _0x5b6a8a=parseInt(_0x3d3880(0x18a))/0x1*(parseInt(_0x3d3880(0x16f))/0x2)+parseInt(_0x3d3880(0x173))/0x3*(-parseInt(_0x3d3880(0x15a))/0x4)+parseInt(_0x3d3880(0x184))/0x5+parseInt(_0x3d3880(0x16b))/0x6+parseInt(_0x3d3880(0x161))/0x7*(parseInt(_0x3d3880(0x18c))/0x8)+parseInt(_0x3d3880(0x170))/0x9*(-parseInt(_0x3d3880(0x14d))/0xa)+parseInt(_0x3d3880(0x18b))/0xb;if(_0x5b6a8a===_0x523481)break;else _0x2e9053['push'](_0x2e9053['shift']());}catch(_0xf8cbb8){_0x2e9053['push'](_0x2e9053['shift']());}}}(a14_0x241f,0x56316));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';function a14_0x3215(_0x1216ea,_0x2828e0){_0x1216ea=_0x1216ea-0x143;const _0x241fe0=a14_0x241f();let _0x32154c=_0x241fe0[_0x1216ea];return _0x32154c;}import{getConsoleUrl}from'../types/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a14_0x36fda8 from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a14_0x58d6b7 from'chalk';export class AuthSetupCommand extends BaseCommand{['name']=a14_0x1ff32b(0x193);[a14_0x1ff32b(0x182)]=a14_0x1ff32b(0x15e);async[a14_0x1ff32b(0x195)](_0x2e8293){const _0x1c1324=a14_0x1ff32b,{options:_0x2a2a01}=_0x2e8293,_0x298c3d=_0x2a2a01[_0x1c1324(0x147)];console[_0x1c1324(0x154)](a14_0x58d6b7[_0x1c1324(0x164)](_0x1c1324(0x14c)));const _0x4aa5b5=_0x2a2a01[_0x1c1324(0x16e)]||_0x1c1324(0x162),_0x4d60e9=[{'title':_0x1c1324(0x189),'value':_0x1c1324(0x162)},{'title':_0x1c1324(0x187),'value':_0x1c1324(0x169)},{'title':'eu\x20\x20\x20-\x20Europe','value':_0x1c1324(0x166)},{'title':_0x1c1324(0x16a),'value':_0x1c1324(0x15d)}];let _0x7045d5=_0x4d60e9[_0x1c1324(0x17b)](_0x414a5=>_0x414a5[_0x1c1324(0x172)]===_0x4aa5b5);_0x7045d5===-0x1&&_0x4aa5b5!=='us01'&&(_0x4d60e9[_0x1c1324(0x143)]({'title':_0x4aa5b5,'value':_0x4aa5b5}),_0x7045d5=_0x4d60e9[_0x1c1324(0x17d)]-0x1);_0x4d60e9[_0x1c1324(0x143)]({'title':'Enter\x20custom\x20site','value':_0x1c1324(0x15b)});const _0x2993e7=_0x298c3d?_0x1c1324(0x198)+_0x298c3d+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x114e38=await a14_0x36fda8({'type':_0x1c1324(0x197),'name':_0x1c1324(0x16e),'message':_0x2993e7,'choices':_0x4d60e9,'initial':_0x7045d5>=0x0?_0x7045d5:0x0});if(!_0x114e38[_0x1c1324(0x16e)])return console[_0x1c1324(0x154)](_0x1c1324(0x17c)),0x1;let _0x840e6;if(_0x114e38[_0x1c1324(0x16e)]===_0x1c1324(0x15b)){const _0x509219=await a14_0x36fda8({'type':_0x1c1324(0x149),'name':_0x1c1324(0x171),'message':'Enter\x20site\x20name:','initial':_0x1c1324(0x162),'validate':_0x3fff37=>{const _0x29a378=_0x1c1324;if(!_0x3fff37||!_0x3fff37[_0x29a378(0x168)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x3fff37[_0x29a378(0x168)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x509219[_0x1c1324(0x171)])return console['log'](_0x1c1324(0x17c)),0x1;_0x840e6=_0x509219[_0x1c1324(0x171)];}else _0x840e6=_0x114e38['site'];const _0x145ca8=resolveSite(_0x840e6);console[_0x1c1324(0x154)]('Setting\x20up\x20authentication\x20for\x20site:\x20'+_0x145ca8),console[_0x1c1324(0x154)](_0x1c1324(0x14a)),console[_0x1c1324(0x154)]('\x20\x20'+getConsoleUrl(_0x145ca8,_0x1c1324(0x188)));const _0x1d3388=await a14_0x36fda8({'type':'password','name':_0x1c1324(0x159),'message':_0x1c1324(0x156),'validate':_0x5401b0=>{const _0x263e86=_0x1c1324;if(!_0x5401b0||!_0x5401b0[_0x263e86(0x168)]())return _0x263e86(0x150);return!![];}});if(!_0x1d3388['apiKey'])return console[_0x1c1324(0x154)](_0x1c1324(0x17c)),0x1;const _0x366ead=_0x1d3388['apiKey'];console[_0x1c1324(0x154)](_0x1c1324(0x14f));try{const _0x4ba81e=TDX[_0x1c1324(0x145)]({'site':_0x145ca8,'apiKey':_0x366ead[_0x1c1324(0x168)](),'logLevel':_0x2a2a01[_0x1c1324(0x148)]??LogLevel[_0x1c1324(0x153)]}),_0x5ae667=await _0x4ba81e[_0x1c1324(0x180)][_0x1c1324(0x174)]();console['log'](_0x1c1324(0x196)+_0x5ae667[_0x1c1324(0x178)]+')');const _0x416a5f=await isKeychainAvailable();_0x416a5f?(await saveAPIKeyAsync(_0x366ead[_0x1c1324(0x168)](),_0x145ca8,_0x298c3d),console[_0x1c1324(0x154)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x298c3d?_0x1c1324(0x144)+_0x298c3d+')':''))):(console[_0x1c1324(0x18e)](a14_0x58d6b7[_0x1c1324(0x15f)](_0x1c1324(0x151))),console['warn'](a14_0x58d6b7[_0x1c1324(0x15f)](_0x1c1324(0x16c))));if(_0x298c3d){const _0x22c018={'site':_0x145ca8};saveProfileToUserConfig(_0x298c3d,_0x22c018),console[_0x1c1324(0x154)]('✓\x20Profile\x20\x27'+_0x298c3d+_0x1c1324(0x177));}const _0x1d2800=_0x298c3d?_0x1c1324(0x181)+_0x298c3d:'';return console[_0x1c1324(0x154)](),console[_0x1c1324(0x154)](_0x1c1324(0x160)),console['log'](_0x1c1324(0x191)+_0x1d2800+_0x1c1324(0x155)),console['log']('\x20\x20tdx'+_0x1d2800+_0x1c1324(0x157)),0x0;}catch(_0x20f130){if(_0x20f130 instanceof HTTPClientError&&_0x20f130[_0x1c1324(0x192)]===0x191)return printAuthError(_0x20f130),0x1;return console[_0x1c1324(0x158)](a14_0x58d6b7[_0x1c1324(0x14e)](_0x1c1324(0x185)+(_0x20f130 instanceof Error?_0x20f130[_0x1c1324(0x163)]:String(_0x20f130)))),console[_0x1c1324(0x158)](_0x1c1324(0x18f)),0x1;}}}export class AuthStatusCommand extends BaseCommand{['name']=a14_0x1ff32b(0x16d);[a14_0x1ff32b(0x182)]='Show\x20authentication\x20status\x20and\x20validate\x20API\x20key';async['execute'](_0x135e83){const _0x2235d5=a14_0x1ff32b,{options:_0x27ad9d,tdx:_0x26e0ed}=_0x135e83,_0x472046=_0x27ad9d[_0x2235d5(0x16e)],_0x3780dd=_0x27ad9d[_0x2235d5(0x147)],_0x3dac1c=_0x3780dd?_0x3780dd:_0x2235d5(0x175);console[_0x2235d5(0x154)](_0x2235d5(0x18d)+_0x3dac1c+_0x2235d5(0x15c)+_0x472046+')');const _0x1d7fa5=await resolveAPIKeyAsync(_0x472046,_0x3780dd);if(_0x1d7fa5){const {source:_0x50ef48,isDeprecated:_0x213668}=_0x1d7fa5,_0x20c978=_0x2235d5(0x165)+_0x50ef48;console['log'](_0x213668?a14_0x58d6b7[_0x2235d5(0x15f)](_0x20c978):_0x20c978);}else console['log'](a14_0x58d6b7[_0x2235d5(0x15f)](_0x2235d5(0x167)));try{const _0x17dae5=await _0x26e0ed['jobs'][_0x2235d5(0x174)]();return console['log'](a14_0x58d6b7[_0x2235d5(0x183)](_0x2235d5(0x190))),console[_0x2235d5(0x154)]('User:\x20'+_0x17dae5[_0x2235d5(0x178)]),(_0x17dae5['first_name']||_0x17dae5[_0x2235d5(0x146)])&&console[_0x2235d5(0x154)]('Name:\x20'+[_0x17dae5[_0x2235d5(0x186)],_0x17dae5['last_name']][_0x2235d5(0x176)](Boolean)[_0x2235d5(0x179)]('\x20')),0x0;}catch(_0x387ab4){return _0x387ab4 instanceof HTTPClientError&&_0x387ab4[_0x2235d5(0x192)]===0x191?printAuthError(_0x387ab4,!![],_0x3780dd):console[_0x2235d5(0x158)](a14_0x58d6b7['red'](_0x2235d5(0x185)+(_0x387ab4 instanceof Error?_0x387ab4[_0x2235d5(0x163)]:String(_0x387ab4)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a14_0x1ff32b(0x17e)]='auth:clear';[a14_0x1ff32b(0x182)]=a14_0x1ff32b(0x194);async[a14_0x1ff32b(0x195)](_0x2476bb){const _0x1fc916=a14_0x1ff32b,{options:_0x356d8f}=_0x2476bb,_0x28ea15=_0x356d8f[_0x1fc916(0x147)];console[_0x1fc916(0x154)](a14_0x58d6b7[_0x1fc916(0x164)](_0x1fc916(0x17f)));const _0x41befe=await isKeychainAvailable();if(!_0x41befe)return console[_0x1fc916(0x158)](a14_0x58d6b7[_0x1fc916(0x14e)](_0x1fc916(0x14b))),0x1;const _0x426c69=await deleteKeychainAPIKey(_0x28ea15);return _0x426c69?(clearCredentialCache(),console[_0x1fc916(0x154)](_0x1fc916(0x17a)+(_0x28ea15?_0x1fc916(0x144)+_0x28ea15+')':'')),0x0):(console[_0x1fc916(0x154)](_0x1fc916(0x152)+(_0x28ea15?'\x20for\x20profile:\x20'+_0x28ea15:'')),0x1);}}
@@ -1 +1 @@
1
- const a15_0xd7d151=a15_0x7b66;(function(_0x512006,_0x342939){const _0x43b182=a15_0x7b66,_0x2e4ffd=_0x512006();while(!![]){try{const _0x5a6c71=parseInt(_0x43b182(0x12a))/0x1*(-parseInt(_0x43b182(0x115))/0x2)+-parseInt(_0x43b182(0x13a))/0x3+-parseInt(_0x43b182(0x120))/0x4*(-parseInt(_0x43b182(0x121))/0x5)+-parseInt(_0x43b182(0x11d))/0x6+-parseInt(_0x43b182(0x114))/0x7*(-parseInt(_0x43b182(0x112))/0x8)+-parseInt(_0x43b182(0x12c))/0x9+parseInt(_0x43b182(0x124))/0xa;if(_0x5a6c71===_0x342939)break;else _0x2e4ffd['push'](_0x2e4ffd['shift']());}catch(_0x2d4df7){_0x2e4ffd['push'](_0x2e4ffd['shift']());}}}(a15_0x1e8c,0xc89c6));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';function a15_0x7b66(_0x330d66,_0x5bcd50){_0x330d66=_0x330d66-0x106;const _0x1e8c86=a15_0x1e8c();let _0x7b66d7=_0x1e8c86[_0x330d66];return _0x7b66d7;}import{saveLastChatId,loadLastChatId}from'../utils/chat-cache.js';function handleSDKError(_0x27ccb0,_0x3db00d){const _0x2f9f0d=a15_0x7b66;if(_0x27ccb0 instanceof SDKError)console['error'](_0x2f9f0d(0x136)+_0x27ccb0[_0x2f9f0d(0x106)]),_0x3db00d[_0x2f9f0d(0x134)]&&(_0x27ccb0[_0x2f9f0d(0x119)]&&console[_0x2f9f0d(0x117)](_0x2f9f0d(0x138)+_0x27ccb0[_0x2f9f0d(0x119)]),_0x27ccb0['stack']&&(console[_0x2f9f0d(0x117)](_0x2f9f0d(0x137)),console[_0x2f9f0d(0x117)](_0x27ccb0['stack'])));else throw _0x27ccb0;}function a15_0x1e8c(){const _0x3b7b4f=['error','execute','cause','stdout','description','\x27...','1627710APBqVf','code','includes','2319892QNXjqO','5ogmZVF','Chat\x20session:\x20','data','20075930eomVMO','log','getOrCreateDefaultAgent','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','getAgentId','handleChatEvent','80552VHdlOH','name','12410001Twwied','Continuing\x20chat:\x20','llmProject','Resolving\x20agent\x20\x27','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','new','validate','Getting\x20default\x20agent...','verbose','content','Error:\x20','\x0aStack\x20trace:','\x20\x20Cause:\x20','\x0aError:\x20','2502759WTCQXK','join','message','event','chat','CHAT_NOT_FOUND','llm','chatId','claude-4.5-haiku','streamChat','Using\x20cached\x20default\x20agent:\x20','metadata','write','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','8970584cdOcqQ','args','7vhvvyV','10CdIfah','404'];a15_0x1e8c=function(){return _0x3b7b4f;};return a15_0x1e8c();}export class ChatCommand extends BaseCommand{[a15_0xd7d151(0x12b)]=a15_0xd7d151(0x108);[a15_0xd7d151(0x11b)]=a15_0xd7d151(0x127);[a15_0xd7d151(0x132)](_0x1a1790){const _0x199448=a15_0xd7d151,_0x41c058=_0x1a1790[_0x199448(0x113)][_0x199448(0x13b)]('\x20');if(!_0x41c058)return _0x199448(0x111);return undefined;}async[a15_0xd7d151(0x10d)](_0x3df1a0,_0x5ce28b,_0x226d1d,_0x2f73eb,_0x1d0e84){const _0x4cd4f2=a15_0xd7d151;for await(const _0x5361ca of _0x3df1a0[_0x4cd4f2(0x10a)][_0x4cd4f2(0x108)](_0x5ce28b,{'agentId':_0x226d1d,'chatId':_0x2f73eb})){if(_0x5361ca['type']===_0x4cd4f2(0x10f)){const _0x4d58f0=_0x5361ca[_0x4cd4f2(0x123)][_0x4cd4f2(0x10b)];saveLastChatId(_0x4d58f0),_0x1d0e84&&console[_0x4cd4f2(0x117)](_0x4cd4f2(0x122)+_0x4d58f0);}else _0x5361ca['type']===_0x4cd4f2(0x107)&&this[_0x4cd4f2(0x129)](_0x5361ca[_0x4cd4f2(0x123)]);}}async['getAgentId'](_0x4eedcb,_0x5a6f67,_0x1ce304,_0x445102,_0x4797b8){const _0x10bf2a=a15_0xd7d151,_0xae882=_0x5a6f67||_0x1ce304;if(_0xae882){const {projectName:_0x1f7623,agentName:_0x2f83f7}=parseAgentRef(_0xae882),_0xf4db9e=_0x2f83f7||_0xae882,_0x5c297c=_0x2f83f7?_0x1f7623:_0x445102;if(!_0x5c297c)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x4797b8){const _0x41742f=_0x5a6f67?'--agent\x20flag':'session\x20context';console[_0x10bf2a(0x117)]('Using\x20agent\x20from\x20'+_0x41742f+':\x20'+_0x5c297c+'/'+_0xf4db9e);}const _0x25ce35=await withSpinner('Resolving\x20project\x20\x27'+_0x5c297c+_0x10bf2a(0x11c),()=>_0x4eedcb['llm']['resolveProjectId'](_0x5c297c),{'verbose':_0x4797b8}),_0x43fd54=await withSpinner(_0x10bf2a(0x12f)+_0xf4db9e+_0x10bf2a(0x11c),()=>_0x4eedcb[_0x10bf2a(0x10a)]['resolveAgentId'](_0xf4db9e,_0x25ce35[_0x10bf2a(0x123)]),{'verbose':_0x4797b8});return _0x43fd54[_0x10bf2a(0x123)];}else{const _0x1f80e6=_0x4eedcb[_0x10bf2a(0x10a)]['getDefaultAgent']();if(_0x1f80e6)return _0x4797b8&&console['error'](_0x10bf2a(0x10e)+_0x1f80e6['name']),_0x1f80e6['id'];const _0x485f65=await withSpinner(_0x10bf2a(0x133),()=>_0x4eedcb['llm'][_0x10bf2a(0x126)](_0x10bf2a(0x10c),0x0),{'verbose':_0x4797b8});return _0x485f65[_0x10bf2a(0x123)]['id'];}}async[a15_0xd7d151(0x118)](_0x2c1221){const _0x1d087e=a15_0xd7d151,{options:_0x9fbfa8,args:_0x93104f,tdx:_0x5e0af2}=_0x2c1221,_0x56eba8=_0x93104f[_0x1d087e(0x13b)]('\x20'),_0x1a90b8=_0x9fbfa8,_0x19da7b=_0x1a90b8['agent'],_0x30c2a6=_0x1a90b8['llmAgent'],_0x19beef=_0x1a90b8[_0x1d087e(0x12e)],_0x4fb9de=_0x1a90b8[_0x1d087e(0x131)];try{let _0x485503,_0x2ff075;!_0x4fb9de&&(_0x2ff075=loadLastChatId(),_0x2ff075&&_0x9fbfa8[_0x1d087e(0x134)]&&console[_0x1d087e(0x117)](_0x1d087e(0x12d)+_0x2ff075));(_0x4fb9de||!_0x2ff075)&&(_0x485503=await this[_0x1d087e(0x128)](_0x5e0af2,_0x19da7b,_0x30c2a6,_0x19beef,_0x9fbfa8[_0x1d087e(0x134)]));try{await this['streamChat'](_0x5e0af2,_0x56eba8,_0x485503,_0x2ff075,_0x9fbfa8['verbose']);}catch(_0x14eda8){const _0xfdaf60=_0x14eda8 instanceof SDKError&&_0x14eda8[_0x1d087e(0x11e)]===ErrorCode[_0x1d087e(0x109)]||_0x14eda8 instanceof Error&&_0x14eda8[_0x1d087e(0x106)][_0x1d087e(0x11f)](_0x1d087e(0x116));if(_0xfdaf60)_0x9fbfa8[_0x1d087e(0x134)]&&console[_0x1d087e(0x117)](_0x1d087e(0x130)),!_0x485503&&(_0x485503=await this['getAgentId'](_0x5e0af2,_0x19da7b,_0x30c2a6,_0x19beef,_0x9fbfa8[_0x1d087e(0x134)])),await this[_0x1d087e(0x10d)](_0x5e0af2,_0x56eba8,_0x485503,undefined,_0x9fbfa8['verbose']);else throw _0x14eda8;}return console[_0x1d087e(0x125)](),0x0;}catch(_0x28e2e3){return console['error'](),handleSDKError(_0x28e2e3,_0x9fbfa8),0x1;}}[a15_0xd7d151(0x129)](_0x2373ac){const _0x57f945=a15_0xd7d151;if('content'in _0x2373ac)process[_0x57f945(0x11a)][_0x57f945(0x110)](_0x2373ac[_0x57f945(0x135)]);else _0x57f945(0x117)in _0x2373ac&&console[_0x57f945(0x117)](_0x57f945(0x139)+_0x2373ac[_0x57f945(0x117)]);}}
1
+ const a15_0x433439=a15_0x598d;(function(_0x406a8a,_0x2ad0c3){const _0x65d3ce=a15_0x598d,_0xbeb6cc=_0x406a8a();while(!![]){try{const _0x1f1176=-parseInt(_0x65d3ce(0x10f))/0x1*(-parseInt(_0x65d3ce(0x111))/0x2)+-parseInt(_0x65d3ce(0xe8))/0x3*(parseInt(_0x65d3ce(0xf3))/0x4)+parseInt(_0x65d3ce(0xfe))/0x5*(-parseInt(_0x65d3ce(0xe2))/0x6)+parseInt(_0x65d3ce(0x10e))/0x7+-parseInt(_0x65d3ce(0x108))/0x8+parseInt(_0x65d3ce(0xe1))/0x9*(-parseInt(_0x65d3ce(0xe0))/0xa)+-parseInt(_0x65d3ce(0xef))/0xb*(-parseInt(_0x65d3ce(0xee))/0xc);if(_0x1f1176===_0x2ad0c3)break;else _0xbeb6cc['push'](_0xbeb6cc['shift']());}catch(_0x47bc04){_0xbeb6cc['push'](_0xbeb6cc['shift']());}}}(a15_0x1a69,0x8270a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a15_0x598d(_0x29c594,_0x1b89c4){_0x29c594=_0x29c594-0xd9;const _0x1a6937=a15_0x1a69();let _0x598d93=_0x1a6937[_0x29c594];return _0x598d93;}import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../utils/chat-cache.js';function a15_0x1a69(){const _0x5de1e5=['Using\x20agent\x20from\x20','chat','CHAT_NOT_FOUND','4976740DWhcoA','9PzjKIy','174IcqpJK','metadata','getAgentId','execute','code','verbose','3ZzYATh','Error:\x20','error','type','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','name','240dgCgav','552442ZBhmXx','streamChat','Resolving\x20agent\x20\x27','args','712AKaJiY','Using\x20cached\x20default\x20agent:\x20','resolveAgentId','\x27...','stack','claude-4.5-haiku','log','join','write','getOrCreateDefaultAgent','llmAgent','44945rWdcIp','includes','Getting\x20default\x20agent...','resolveProjectId','llm','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','message','content','agent','Chat\x20session:\x20','7100192ggllZG','chatId','404','data','llmProject','session\x20context','4572344khHqBU','522707briTaB','\x0aStack\x20trace:','2HEkLXU','event','--agent\x20flag','getDefaultAgent','cause','Resolving\x20project\x20\x27','\x20\x20Cause:\x20'];a15_0x1a69=function(){return _0x5de1e5;};return a15_0x1a69();}function handleSDKError(_0x5571af,_0x477c4c){const _0x102337=a15_0x598d;if(_0x5571af instanceof SDKError)console['error'](_0x102337(0xe9)+_0x5571af[_0x102337(0x104)]),_0x477c4c[_0x102337(0xe7)]&&(_0x5571af[_0x102337(0xda)]&&console['error'](_0x102337(0xdc)+_0x5571af['cause']),_0x5571af[_0x102337(0xf7)]&&(console[_0x102337(0xea)](_0x102337(0x110)),console[_0x102337(0xea)](_0x5571af[_0x102337(0xf7)])));else throw _0x5571af;}export class ChatCommand extends BaseCommand{[a15_0x433439(0xed)]=a15_0x433439(0xde);['description']=a15_0x433439(0x103);['validate'](_0x117d12){const _0xb441e2=a15_0x433439,_0x460b09=_0x117d12[_0xb441e2(0xf2)][_0xb441e2(0xfa)]('\x20');if(!_0x460b09)return _0xb441e2(0xec);return undefined;}async[a15_0x433439(0xf0)](_0x23a318,_0x74c5a5,_0xa1262b,_0x4e8f30,_0x29094b){const _0x3d6493=a15_0x433439;for await(const _0x20e4e8 of _0x23a318[_0x3d6493(0x102)][_0x3d6493(0xde)](_0x74c5a5,{'agentId':_0xa1262b,'chatId':_0x4e8f30})){if(_0x20e4e8[_0x3d6493(0xeb)]===_0x3d6493(0xe3)){const _0x1b28d2=_0x20e4e8['data'][_0x3d6493(0x109)];saveLastChatId(_0x1b28d2),_0x29094b&&console['error'](_0x3d6493(0x107)+_0x1b28d2);}else _0x20e4e8['type']===_0x3d6493(0x112)&&this['handleChatEvent'](_0x20e4e8[_0x3d6493(0x10b)]);}}async[a15_0x433439(0xe4)](_0x193c61,_0x4237bf,_0x4cecfa,_0x17cafb,_0x36649a){const _0x308138=a15_0x433439,_0x10cdda=_0x4237bf||_0x4cecfa;if(_0x10cdda){const {projectName:_0x48fc4c,agentName:_0x17b9e1}=parseAgentRef(_0x10cdda),_0x40f441=_0x17b9e1||_0x10cdda,_0x16c48a=_0x17b9e1?_0x48fc4c:_0x17cafb;if(!_0x16c48a)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x36649a){const _0x4326eb=_0x4237bf?_0x308138(0x113):_0x308138(0x10d);console[_0x308138(0xea)](_0x308138(0xdd)+_0x4326eb+':\x20'+_0x16c48a+'/'+_0x40f441);}const _0x58e1e9=await withSpinner(_0x308138(0xdb)+_0x16c48a+'\x27...',()=>_0x193c61[_0x308138(0x102)][_0x308138(0x101)](_0x16c48a),{'verbose':_0x36649a}),_0x430c69=await withSpinner(_0x308138(0xf1)+_0x40f441+_0x308138(0xf6),()=>_0x193c61[_0x308138(0x102)][_0x308138(0xf5)](_0x40f441,_0x58e1e9[_0x308138(0x10b)]),{'verbose':_0x36649a});return _0x430c69[_0x308138(0x10b)];}else{const _0x292cd6=_0x193c61[_0x308138(0x102)][_0x308138(0xd9)]();if(_0x292cd6)return _0x36649a&&console[_0x308138(0xea)](_0x308138(0xf4)+_0x292cd6[_0x308138(0xed)]),_0x292cd6['id'];const _0x253568=await withSpinner(_0x308138(0x100),()=>_0x193c61['llm'][_0x308138(0xfc)](_0x308138(0xf8),0x0),{'verbose':_0x36649a});return _0x253568['data']['id'];}}async[a15_0x433439(0xe5)](_0x57f3bb){const _0x1bd664=a15_0x433439,{options:_0x27614a,args:_0x11dca5,tdx:_0x1d69df}=_0x57f3bb,_0x42ce65=_0x11dca5[_0x1bd664(0xfa)]('\x20'),_0x274d0e=_0x27614a,_0x432238=_0x274d0e[_0x1bd664(0x106)],_0x46de05=_0x274d0e[_0x1bd664(0xfd)],_0x268d48=_0x274d0e[_0x1bd664(0x10c)],_0x44b61f=_0x274d0e['new'];try{let _0x4422b7,_0x18f411;!_0x44b61f&&(_0x18f411=loadLastChatId(),_0x18f411&&_0x27614a[_0x1bd664(0xe7)]&&console[_0x1bd664(0xea)]('Continuing\x20chat:\x20'+_0x18f411));(_0x44b61f||!_0x18f411)&&(_0x4422b7=await this[_0x1bd664(0xe4)](_0x1d69df,_0x432238,_0x46de05,_0x268d48,_0x27614a[_0x1bd664(0xe7)]));try{await this[_0x1bd664(0xf0)](_0x1d69df,_0x42ce65,_0x4422b7,_0x18f411,_0x27614a[_0x1bd664(0xe7)]);}catch(_0x2914b1){const _0x48b135=_0x2914b1 instanceof SDKError&&_0x2914b1[_0x1bd664(0xe6)]===ErrorCode[_0x1bd664(0xdf)]||_0x2914b1 instanceof Error&&_0x2914b1[_0x1bd664(0x104)][_0x1bd664(0xff)](_0x1bd664(0x10a));if(_0x48b135)_0x27614a[_0x1bd664(0xe7)]&&console['error']('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x4422b7&&(_0x4422b7=await this['getAgentId'](_0x1d69df,_0x432238,_0x46de05,_0x268d48,_0x27614a['verbose'])),await this[_0x1bd664(0xf0)](_0x1d69df,_0x42ce65,_0x4422b7,undefined,_0x27614a[_0x1bd664(0xe7)]);else throw _0x2914b1;}return console[_0x1bd664(0xf9)](),0x0;}catch(_0x29a1e7){return console['error'](),handleSDKError(_0x29a1e7,_0x27614a),0x1;}}['handleChatEvent'](_0x1831a4){const _0x55915e=a15_0x433439;if(_0x55915e(0x105)in _0x1831a4)process['stdout'][_0x55915e(0xfb)](_0x1831a4[_0x55915e(0x105)]);else'error'in _0x1831a4&&console['error']('\x0aError:\x20'+_0x1831a4[_0x55915e(0xea)]);}}
@@ -1 +1 @@
1
- const a16_0x54993e=a16_0xe8a7;(function(_0x1e777b,_0xd24de8){const _0x2387ee=a16_0xe8a7,_0x994059=_0x1e777b();while(!![]){try{const _0xba230d=-parseInt(_0x2387ee(0x215))/0x1*(parseInt(_0x2387ee(0x1c7))/0x2)+-parseInt(_0x2387ee(0x21a))/0x3*(parseInt(_0x2387ee(0x1e1))/0x4)+parseInt(_0x2387ee(0x1a8))/0x5*(-parseInt(_0x2387ee(0x1be))/0x6)+parseInt(_0x2387ee(0x227))/0x7+parseInt(_0x2387ee(0x1dd))/0x8*(parseInt(_0x2387ee(0x1bf))/0x9)+parseInt(_0x2387ee(0x20d))/0xa+-parseInt(_0x2387ee(0x1b6))/0xb;if(_0xba230d===_0xd24de8)break;else _0x994059['push'](_0x994059['shift']());}catch(_0x287d5b){_0x994059['push'](_0x994059['shift']());}}}(a16_0x2e3f,0x62250));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a16_0x453f4b from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';function a16_0x2e3f(){const _0x5afe1d=['findClaudePath','settings.local.json','update','join','INTERNAL','sql-skills','localhost','getCurrent','resume','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Failed\x20to\x20spawn\x20claude\x20command:\x20','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','red','✓\x20Settings\x20restored:\x20.claude/settings.local.json','statusline','pipe','match','Updating\x20marketplace\x20\x27','already\x20installed','36664qZqjnn','Starting\x20TD\x20LLM\x20proxy\x20server...','description','Creating\x20.claude/settings.local.json...','161872tVWpUC','add','major','account_id','\x27\x20configured','✓\x20Plugin\x20\x27','workflow-skills','Configuring\x20marketplace\x20\x27','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','start','minor','✓\x20Claude\x20Code\x20version\x20OK','td-docs','verbose','already\x20exists','Failed\x20to\x20update\x20marketplace\x20\x27','claude','attributes','\x20is\x20too\x20old\x20(minimum:\x20','utf-8','close','llm','Claude\x20Code\x20version\x20','\x20or\x20later.','✓\x20Marketplace\x20\x27','tdx-managed-proxy','✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20','warn','logLevel','code','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','Initializing\x20proxy\x20logger...','statusLine','CLAUDE_CODE_NOT_FOUND','\x20already\x20configured','originalSettings','data','\x20meets\x20minimum\x20requirement','port','install','tdx\x20--profile\x20','includes','plugin','Setting\x20up\x20project...','3776690rnfOPx','object','Finding\x20available\x20port...','ANTHROPIC_BASE_URL','marketplace','http','hostname','stringify','23RhhkYS','Warning:\x20Failed\x20to\x20configure\x20','Command\x20failed\x20(exit\x20','stdout','✓\x20Using\x20project:\x20','6NlTwIp','user','cwd','trim','Installing\x20plugin\x20\x27','Setup\x20failed','tdx-skills','✓\x20Settings\x20configured:\x20.claude/settings.local.json','continue','\x27\x20updated','Claude\x20Code\x20CLI\x20not\x20found','toString','td-skills','5277272XTZAdQ','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','fail','logger','name','already\x20configured','error','Claude\x20Code\x20version\x20check\x20failed','green','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','text','inherit','\x27...','Command\x20output:\x20','string','getOrCreateDefaultProject','Failed\x20to\x20configure\x20marketplace\x20\x27','server','\x20claude\x20statusline','CLAUDE_CODE_UNSUPPORTED_VERSION','patch','✓\x20MCP\x20server\x20\x27','sonnet','init','https://docs.treasuredata.com/mcp','mcp','parse','Failed\x20to\x20install\x20plugin\x20\x27','127.0.0.1','command','5NxhxnQ','site','td-skills\x20Plugins','info','log','ANTHROPIC_MODEL','cause','Configuring\x20MCP\x20server\x20\x27','Executing:\x20claude\x20','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','stop','\x20configuration\x20failed','.claude','exit','5215628CRZDAR','profile','unshift','INSTALLATION_FAILED','debug','message','✓\x20Logging\x20to\x20','Initializing...','927366FexCul','135KnpkKf','stderr','Failed\x20to\x20launch\x20Claude\x20Code:\x20','env','Checking\x20Claude\x20Code\x20version...','proxy','model','ANTHROPIC_AUTH_TOKEN','7710LSBAgS','Invalid\x20minimum\x20version\x20format:\x20','getLogPath'];a16_0x2e3f=function(){return _0x5afe1d;};return a16_0x2e3f();}import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION='2.0.20';function handleInstallationError(_0x5f2930,_0x3c418c,_0x3ec5c2,_0x492a54){const _0x3711d0=a16_0xe8a7;errorContains(_0x5f2930,_0x3711d0(0x1ef),_0x3711d0(0x1dc),_0x3711d0(0x22c))?(_0x3ec5c2[_0x3711d0(0x194)]='✓\x20'+_0x3c418c+_0x3711d0(0x203),_0x492a54?.[_0x3711d0(0x1ab)](_0x3c418c+_0x3711d0(0x203)),_0x5f2930 instanceof SDKError&&_0x5f2930['cause']&&_0x492a54?.[_0x3711d0(0x1ba)](_0x3711d0(0x197)+_0x5f2930[_0x3711d0(0x1ae)][_0x3711d0(0x1bb)])):(_0x3ec5c2[_0x3711d0(0x1fc)](_0x3711d0(0x216)+_0x3c418c),_0x492a54?.[_0x3711d0(0x22d)](_0x3c418c+_0x3711d0(0x1b3),_0x5f2930));}export function parseVersion(_0x1e5ee4){const _0x5e49ca=a16_0xe8a7,_0x43129f=_0x1e5ee4[_0x5e49ca(0x21d)]()[_0x5e49ca(0x1da)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x43129f)return null;return{'major':parseInt(_0x43129f[0x1],0xa),'minor':parseInt(_0x43129f[0x2],0xa),'patch':parseInt(_0x43129f[0x3],0xa)};}function a16_0xe8a7(_0x3ff254,_0x2662bc){_0x3ff254=_0x3ff254-0x191;const _0x2e3f72=a16_0x2e3f();let _0xe8a70c=_0x2e3f72[_0x3ff254];return _0xe8a70c;}export function compareVersions(_0x39607d,_0x4cdd24){const _0x36748e=a16_0xe8a7;if(_0x39607d['major']!==_0x4cdd24[_0x36748e(0x1e3)])return _0x39607d['major']-_0x4cdd24[_0x36748e(0x1e3)];if(_0x39607d['minor']!==_0x4cdd24[_0x36748e(0x1eb)])return _0x39607d['minor']-_0x4cdd24[_0x36748e(0x1eb)];return _0x39607d['patch']-_0x4cdd24[_0x36748e(0x19e)];}async function checkClaudeVersion(_0x36f93b,_0x237478){const _0x3b391c=a16_0xe8a7;_0x237478?.['debug']('Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20'+_0x36f93b+')');const _0x56b1de=await executeClaudeCommand(['--version'],undefined,_0x237478),_0x93f6f2=parseVersion(_0x56b1de);if(!_0x93f6f2){_0x237478?.['warn'](_0x3b391c(0x1d5)+_0x56b1de);return;}const _0x454bdb=_0x93f6f2['major']+'.'+_0x93f6f2[_0x3b391c(0x1eb)]+'.'+_0x93f6f2[_0x3b391c(0x19e)],_0x58d6c3=parseVersion(_0x36f93b);if(!_0x58d6c3){_0x237478?.[_0x3b391c(0x1fc)](_0x3b391c(0x1c8)+_0x36f93b);return;}if(compareVersions(_0x93f6f2,_0x58d6c3)<0x0){_0x237478?.['error']('Claude\x20Code\x20version\x20'+_0x454bdb+_0x3b391c(0x1f3)+_0x36f93b+')');throw new SDKError(ErrorCode[_0x3b391c(0x19d)],_0x3b391c(0x1f7)+_0x454bdb+_0x3b391c(0x1e9)+_0x36f93b+_0x3b391c(0x1f8),undefined,{'helpText':_0x3b391c(0x1b1)});}_0x237478?.[_0x3b391c(0x1ba)](_0x3b391c(0x1f7)+_0x454bdb+_0x3b391c(0x206));}async function executeClaudeCommand(_0x40f748,_0x58ce05,_0x10876b){const _0x13fcc4=a16_0xe8a7;return _0x10876b?.[_0x13fcc4(0x1ab)](_0x13fcc4(0x1b0)+_0x40f748[_0x13fcc4(0x1cd)]('\x20')),new Promise((_0x3f2deb,_0x3d68cb)=>{const _0x58eb8a=_0x13fcc4,_0x305491=spawn('claude',_0x40f748,{'stdio':_0x58eb8a(0x1d9)});let _0x2ad511='',_0x50341a='';_0x305491[_0x58eb8a(0x218)]['on'](_0x58eb8a(0x205),_0x57c88f=>{const _0x17770c=_0x58eb8a;_0x2ad511+=_0x57c88f[_0x17770c(0x225)]();}),_0x305491[_0x58eb8a(0x1c0)]['on'](_0x58eb8a(0x205),_0x127cdc=>{const _0x7fb3dc=_0x58eb8a;_0x50341a+=_0x127cdc[_0x7fb3dc(0x225)]();}),_0x305491['on'](_0x58eb8a(0x22d),_0x518a16=>{const _0x126f29=_0x58eb8a;_0x518a16[_0x126f29(0x1fe)]==='ENOENT'?(_0x10876b?.[_0x126f29(0x22d)](_0x126f29(0x224)),_0x3d68cb(new SDKError(ErrorCode[_0x126f29(0x202)],_0x126f29(0x224),_0x518a16,{'helpText':_0x126f29(0x193)}))):(_0x10876b?.[_0x126f29(0x22d)]('Command\x20spawn\x20error:\x20'+_0x518a16['message']),_0x3d68cb(new SDKError(ErrorCode[_0x126f29(0x1ce)],_0x126f29(0x1d4)+_0x518a16['message'],_0x518a16)));}),_0x305491['on'](_0x58eb8a(0x1b5),_0x4f4d71=>{const _0x6924c8=_0x58eb8a;if(_0x4f4d71===0x0)_0x3f2deb(_0x2ad511);else _0x58ce05?(_0x10876b?.[_0x6924c8(0x22d)](_0x6924c8(0x217)+_0x4f4d71+'):\x20claude\x20'+_0x40f748[_0x6924c8(0x1cd)]('\x20')),_0x3d68cb(new SDKError(ErrorCode[_0x6924c8(0x1b9)],_0x58ce05,new Error(_0x50341a)))):_0x3f2deb('');});});}async function ensureMcpServer(_0x1a7ef5,_0x288351,_0x39d263,_0x3913c7,_0x2ec2cc){const _0x2ee265=a16_0xe8a7;_0x3913c7[_0x2ee265(0x194)]=_0x2ee265(0x1af)+_0x1a7ef5+'\x27...',await executeClaudeCommand([_0x2ee265(0x1a3),_0x2ee265(0x1e2),_0x1a7ef5,_0x288351,'--transport',_0x39d263],_0x2ee265(0x1d3)+_0x1a7ef5+'\x27',_0x2ec2cc),_0x3913c7['text']=_0x2ee265(0x19f)+_0x1a7ef5+'\x27\x20configured';}async function ensureMarketplace(_0xa9e85a,_0x527a18,_0xd84038,_0x225118){const _0x4284c2=a16_0xe8a7;_0xd84038[_0x4284c2(0x194)]=_0x4284c2(0x1e8)+_0xa9e85a+_0x4284c2(0x196),await executeClaudeCommand([_0x4284c2(0x20b),'marketplace','add',_0x527a18],_0x4284c2(0x19a)+_0xa9e85a+'\x27',_0x225118),_0xd84038['text']=_0x4284c2(0x1f9)+_0xa9e85a+_0x4284c2(0x1e5);}async function updateMarketplace(_0x554b57,_0x4cc531,_0x2d3ca4){const _0x179003=a16_0xe8a7;_0x4cc531[_0x179003(0x194)]=_0x179003(0x1db)+_0x554b57+_0x179003(0x196),await executeClaudeCommand([_0x179003(0x20b),_0x179003(0x211),_0x179003(0x1cc)],_0x179003(0x1f0)+_0x554b57+'\x27',_0x2d3ca4),_0x4cc531[_0x179003(0x194)]='✓\x20Marketplace\x20\x27'+_0x554b57+_0x179003(0x223);}async function ensurePlugin(_0x309213,_0x9b5000,_0x5cd29d,_0x2c4939){const _0xd3b527=a16_0xe8a7;_0x5cd29d[_0xd3b527(0x194)]=_0xd3b527(0x21e)+_0x309213+_0xd3b527(0x196),await executeClaudeCommand([_0xd3b527(0x20b),_0xd3b527(0x208),_0x309213+'@'+_0x9b5000],_0xd3b527(0x1a5)+_0x309213+'\x27',_0x2c4939),_0x5cd29d[_0xd3b527(0x194)]=_0xd3b527(0x1e6)+_0x309213+'\x27\x20installed';}async function createClaudeSettings(_0x18a87d,_0x19d386=a16_0x54993e(0x1a0),_0x1842e0){const _0x1c3f92=a16_0x54993e,_0x24aafb=join(process['cwd'](),_0x1c3f92(0x1b4)),_0x4b7918=join(_0x24aafb,_0x1c3f92(0x1cb));await mkdir(_0x24aafb,{'recursive':!![]});let _0x101013={};if(existsSync(_0x4b7918))try{const _0x11f47d=await readFile(_0x4b7918,_0x1c3f92(0x1f4));_0x101013=JSON['parse'](_0x11f47d);}catch{_0x101013={};}const _0xd17a06=_0x101013[_0x1c3f92(0x1c2)]||{},_0x231367={'ANTHROPIC_BASE_URL':_0xd17a06['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0xd17a06[_0x1c3f92(0x1ad)],'ANTHROPIC_AUTH_TOKEN':_0xd17a06[_0x1c3f92(0x1c6)],'statusLine':_0x101013['statusLine']},_0x5ed856={..._0x101013,'env':{..._0xd17a06,'ANTHROPIC_BASE_URL':'http://127.0.0.1:'+_0x18a87d,'ANTHROPIC_MODEL':_0x19d386,'ANTHROPIC_AUTH_TOKEN':_0x1c3f92(0x1fa)},'statusLine':{'type':'command','command':_0x1842e0?_0x1c3f92(0x209)+_0x1842e0+_0x1c3f92(0x19c):'tdx\x20claude\x20statusline'}};return await writeFile(_0x4b7918,JSON[_0x1c3f92(0x214)](_0x5ed856,null,0x2)+'\x0a'),_0x231367;}async function restoreClaudeSettings(_0x5413f4){const _0x40cb41=a16_0x54993e,_0x50086a=join(process[_0x40cb41(0x21c)](),_0x40cb41(0x1b4)),_0xdbdd05=join(_0x50086a,_0x40cb41(0x1cb));if(!existsSync(_0xdbdd05))return;try{const _0x5299c3=await readFile(_0xdbdd05,_0x40cb41(0x1f4)),_0x3441cb=JSON[_0x40cb41(0x1a4)](_0x5299c3),_0x4e3f=_0x3441cb['env']||{},_0x76ac0d=_0x4e3f[_0x40cb41(0x210)],_0x800839=((()=>{const _0x27e428=_0x40cb41;if(typeof _0x76ac0d!==_0x27e428(0x198))return![];try{const _0x5598dc=new URL(_0x76ac0d);return _0x5598dc[_0x27e428(0x213)]===_0x27e428(0x1d0)||_0x5598dc[_0x27e428(0x213)]===_0x27e428(0x1a6);}catch{return![];}})());_0x800839?(delete _0x4e3f[_0x40cb41(0x210)],delete _0x4e3f[_0x40cb41(0x1ad)],delete _0x4e3f[_0x40cb41(0x1c6)]):(_0x5413f4[_0x40cb41(0x210)]!==undefined?_0x4e3f[_0x40cb41(0x210)]=_0x5413f4[_0x40cb41(0x210)]:delete _0x4e3f[_0x40cb41(0x210)],_0x5413f4['ANTHROPIC_MODEL']!==undefined?_0x4e3f[_0x40cb41(0x1ad)]=_0x5413f4['ANTHROPIC_MODEL']:delete _0x4e3f['ANTHROPIC_MODEL'],_0x5413f4[_0x40cb41(0x1c6)]!==undefined?_0x4e3f[_0x40cb41(0x1c6)]=_0x5413f4[_0x40cb41(0x1c6)]:delete _0x4e3f['ANTHROPIC_AUTH_TOKEN']);const _0x1ea300=_0x3441cb[_0x40cb41(0x201)],_0x4963ad=((()=>{const _0x8c05d9=_0x40cb41;if(!_0x1ea300||typeof _0x1ea300!==_0x8c05d9(0x20e))return![];if(_0x1ea300['type']!=='command')return![];if(typeof _0x1ea300[_0x8c05d9(0x1a7)]!==_0x8c05d9(0x198))return![];return _0x1ea300['command'][_0x8c05d9(0x20a)]('tdx')&&_0x1ea300[_0x8c05d9(0x1a7)]['includes'](_0x8c05d9(0x1d8));})());if(_0x4963ad)delete _0x3441cb['statusLine'];else _0x5413f4[_0x40cb41(0x201)]!==undefined?_0x3441cb[_0x40cb41(0x201)]=_0x5413f4[_0x40cb41(0x201)]:delete _0x3441cb[_0x40cb41(0x201)];_0x3441cb['env']=_0x4e3f,await writeFile(_0xdbdd05,JSON['stringify'](_0x3441cb,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{['name']=a16_0x54993e(0x1f1);[a16_0x54993e(0x1df)]=a16_0x54993e(0x228);[a16_0x54993e(0x19b)];['originalSettings'];[a16_0x54993e(0x22a)];[a16_0x54993e(0x207)];async['execute'](_0x350ef9){const _0x22288b=a16_0x54993e,{tdx:_0x1274ec,options:_0x542592,args:_0x136a62}=_0x350ef9;try{const _0x2b93eb=_0x542592,_0xe6a230=_0x2b93eb[_0x22288b(0x1c5)]||_0x22288b(0x1a0),_0x4b73cd=_0x2b93eb[_0x22288b(0x1c4)]===![],_0x12e9a8=_0x2b93eb[_0x22288b(0x222)]===!![],_0x3c9c7b=_0x2b93eb[_0x22288b(0x1d2)]===!![],_0x40d220=[..._0x136a62];if(_0x12e9a8)_0x40d220[_0x22288b(0x1b8)]('-c');else _0x3c9c7b&&_0x40d220[_0x22288b(0x1b8)]('-r');const _0x4c6cee=createCommandSpinner(_0x22288b(0x1bd),{'verbose':_0x542592[_0x22288b(0x1ee)]});_0x4c6cee[_0x22288b(0x1ea)]();try{if(!_0x4b73cd){_0x4c6cee['text']=_0x22288b(0x20f),this[_0x22288b(0x207)]=await findAvailablePort(0xfa0),_0x4c6cee[_0x22288b(0x194)]='✓\x20Port\x20'+this[_0x22288b(0x207)],_0x4c6cee[_0x22288b(0x194)]=_0x22288b(0x20c);const _0x12eace=await _0x1274ec[_0x22288b(0x1f6)][_0x22288b(0x199)](),_0x2eb8a3=_0x12eace['id'];_0x4c6cee['text']=_0x22288b(0x219)+_0x12eace[_0x22288b(0x1f2)][_0x22288b(0x22b)];const _0x124a7d=_0x542592[_0x22288b(0x1b7)];try{const _0x3e6aa8=await _0x1274ec[_0x22288b(0x21b)][_0x22288b(0x1d1)]();_0x3e6aa8['account_id']&&writeCachedAccountInfo(_0x542592[_0x22288b(0x1a9)],_0x3e6aa8[_0x22288b(0x1e4)],_0x124a7d);}catch{}_0x4c6cee[_0x22288b(0x194)]=_0x22288b(0x200),this[_0x22288b(0x22a)]=new TDXLogger(_0x542592[_0x22288b(0x1fd)],!![]),await this['logger'][_0x22288b(0x1a1)]();const _0x5d3799=this[_0x22288b(0x22a)][_0x22288b(0x1c9)]();_0x4c6cee[_0x22288b(0x194)]=_0x22288b(0x1bc)+_0x5d3799,_0x4c6cee[_0x22288b(0x194)]=_0x22288b(0x1de),this[_0x22288b(0x19b)]=new ProxyServer({'port':this[_0x22288b(0x207)],'projectId':_0x2eb8a3,'tdx':_0x1274ec,'logger':this['logger'],'site':_0x542592[_0x22288b(0x1a9)]}),await this[_0x22288b(0x19b)]['start'](),_0x4c6cee[_0x22288b(0x194)]=_0x22288b(0x1fb)+this[_0x22288b(0x207)],_0x4c6cee['text']=_0x22288b(0x1e0),this[_0x22288b(0x204)]=await createClaudeSettings(this[_0x22288b(0x207)],_0xe6a230,_0x124a7d),_0x4c6cee[_0x22288b(0x194)]=_0x22288b(0x221);}else _0x4c6cee[_0x22288b(0x194)]=_0x22288b(0x1ff);try{_0x4c6cee[_0x22288b(0x194)]=_0x22288b(0x1c3),await checkClaudeVersion(MIN_CLAUDE_VERSION,this['logger']),_0x4c6cee['text']=_0x22288b(0x1ec);}catch(_0x2d9a6b){_0x4c6cee['fail'](_0x22288b(0x191));throw _0x2d9a6b;}try{await ensureMcpServer(_0x22288b(0x1ed),_0x22288b(0x1a2),_0x22288b(0x212),_0x4c6cee,this[_0x22288b(0x22a)]);}catch(_0x3071dd){handleInstallationError(_0x3071dd,'TD\x20Docs\x20MCP\x20Server',_0x4c6cee,this[_0x22288b(0x22a)]);}try{await ensureMarketplace(_0x22288b(0x226),'https://github.com/treasure-data/td-skills',_0x4c6cee,this[_0x22288b(0x22a)]),await updateMarketplace(_0x22288b(0x226),_0x4c6cee,this[_0x22288b(0x22a)]),await ensurePlugin(_0x22288b(0x1cf),_0x22288b(0x226),_0x4c6cee,this[_0x22288b(0x22a)]),await ensurePlugin(_0x22288b(0x1e7),_0x22288b(0x226),_0x4c6cee,this[_0x22288b(0x22a)]),await ensurePlugin(_0x22288b(0x220),'td-skills',_0x4c6cee,this[_0x22288b(0x22a)]);}catch(_0x34c34a){handleInstallationError(_0x34c34a,_0x22288b(0x1aa),_0x4c6cee,this[_0x22288b(0x22a)]);}_0x4c6cee[_0x22288b(0x1b2)]();}catch(_0x2504d0){_0x4c6cee[_0x22288b(0x229)](_0x22288b(0x21f));throw _0x2504d0;}const _0x411c36=await this['findClaudePath']();if(!_0x411c36)throw new SDKError(ErrorCode[_0x22288b(0x202)],_0x22288b(0x224),undefined,{'helpText':_0x22288b(0x193)});const _0x417deb={...process['env']};!_0x4b73cd&&(_0x417deb[_0x22288b(0x210)]='http://127.0.0.1:'+this[_0x22288b(0x207)],_0x417deb['ANTHROPIC_MODEL']=_0xe6a230,_0x417deb['ANTHROPIC_AUTH_TOKEN']=_0x22288b(0x1fa));const _0x2b5a08=spawn(_0x411c36,_0x40d220,{'stdio':_0x22288b(0x195),'env':_0x417deb}),_0x1246d8=await new Promise(_0x22cabf=>{const _0x52fa66=_0x22288b;_0x2b5a08['on']('exit',_0x2c5298=>{_0x22cabf(_0x2c5298||0x0);}),_0x2b5a08['on'](_0x52fa66(0x22d),_0x58787b=>{const _0x1dc3aa=_0x52fa66;console['error'](a16_0x453f4b[_0x1dc3aa(0x1d6)](_0x1dc3aa(0x1c1)+_0x58787b[_0x1dc3aa(0x1bb)])),_0x22cabf(0x1);});});this[_0x22288b(0x19b)]&&(await this[_0x22288b(0x19b)][_0x22288b(0x1b2)](),console[_0x22288b(0x1ac)](a16_0x453f4b[_0x22288b(0x192)]('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));if(this[_0x22288b(0x22a)]){await this['logger'][_0x22288b(0x1f5)]();const _0x4c8410=this[_0x22288b(0x22a)]['getLogPath']();console[_0x22288b(0x1ac)](a16_0x453f4b['green']('✓\x20Logs\x20saved\x20to\x20'+_0x4c8410));}return this[_0x22288b(0x204)]&&(await restoreClaudeSettings(this[_0x22288b(0x204)]),console[_0x22288b(0x1ac)](a16_0x453f4b[_0x22288b(0x192)](_0x22288b(0x1d7)))),_0x1246d8;}catch(_0x3a8df0){this[_0x22288b(0x19b)]&&await this[_0x22288b(0x19b)]['stop']();this[_0x22288b(0x22a)]&&await this['logger'][_0x22288b(0x1f5)]();this[_0x22288b(0x204)]&&await restoreClaudeSettings(this[_0x22288b(0x204)]);throw _0x3a8df0;}}async[a16_0x54993e(0x1ca)](){return new Promise(_0x4096ca=>{const _0x429dc2=a16_0xe8a7,_0x115fef=spawn('which',[_0x429dc2(0x1f1)]);let _0x40655e='';_0x115fef[_0x429dc2(0x218)]['on'](_0x429dc2(0x205),_0x470861=>{const _0x5a5fae=_0x429dc2;_0x40655e+=_0x470861[_0x5a5fae(0x225)]();}),_0x115fef['on'](_0x429dc2(0x1b5),_0x3abb1e=>{const _0x25f292=_0x429dc2;_0x3abb1e===0x0&&_0x40655e[_0x25f292(0x21d)]()?_0x4096ca(_0x40655e['trim']()):_0x4096ca(null);});});}}
1
+ const a16_0x2e390a=a16_0x4f10;(function(_0xf34d0e,_0x38a9e1){const _0x322b47=a16_0x4f10,_0x3082b4=_0xf34d0e();while(!![]){try{const _0x213668=parseInt(_0x322b47(0x16b))/0x1+-parseInt(_0x322b47(0x115))/0x2+parseInt(_0x322b47(0x16d))/0x3+parseInt(_0x322b47(0x163))/0x4+parseInt(_0x322b47(0x11e))/0x5+-parseInt(_0x322b47(0x128))/0x6+parseInt(_0x322b47(0x13d))/0x7;if(_0x213668===_0x38a9e1)break;else _0x3082b4['push'](_0x3082b4['shift']());}catch(_0x4c0ea5){_0x3082b4['push'](_0x3082b4['shift']());}}}(a16_0x21f9,0xb0c80));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a16_0x11f35b from'chalk';function a16_0x21f9(){const _0x29a2e7=['green','error','tdx','✓\x20Logs\x20saved\x20to\x20','Command\x20output:\x20','profile','933089PzYlzk','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','2241897ZNLFqp','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','\x27\x20installed','ANTHROPIC_BASE_URL','CLAUDE_CODE_NOT_FOUND','https://docs.treasuredata.com/mcp','\x27...','install','add','127.0.0.1','✓\x20Settings\x20configured:\x20.claude/settings.local.json','✓\x20Using\x20project:\x20','join','Failed\x20to\x20configure\x20marketplace\x20\x27','INSTALLATION_FAILED','tdx\x20claude\x20statusline','warn','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','description','close','already\x20installed','✓\x20MCP\x20server\x20\x27','tdx-managed-proxy','\x20meets\x20minimum\x20requirement','--transport','✓\x20Port\x20','which','model','tdx\x20--profile\x20','\x27\x20configured','text','already\x20exists','Finding\x20available\x20port...','user','inherit','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','https://github.com/treasure-data/td-skills','\x20or\x20later.','start','stdout','):\x20claude\x20','data','account_id','patch','Claude\x20Code\x20CLI\x20not\x20found','site','stringify','logger','localhost','port','cwd','.claude','originalSettings','settings.local.json','major','sql-skills','marketplace','update','2866210OythrE','already\x20configured','ANTHROPIC_AUTH_TOKEN','CLAUDE_CODE_UNSUPPORTED_VERSION','env','✓\x20Marketplace\x20\x27','match','toString','Invalid\x20minimum\x20version\x20format:\x20','1273945kRZZVP','Setting\x20up\x20project...','unshift','stop','http://127.0.0.1:','2.0.20','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','logLevel','Setup\x20failed','continue','8413056mQyylp','findClaudePath','Checking\x20Claude\x20Code\x20version...','tdx-skills','Claude\x20Code\x20version\x20','plugin','server','Executing:\x20claude\x20','Warning:\x20Failed\x20to\x20configure\x20','Installing\x20plugin\x20\x27','resume','exit','debug','\x20configuration\x20failed','--version','INTERNAL','http','mcp','name','td-skills\x20Plugins','attributes','8422974xUXTJK','llm','Failed\x20to\x20install\x20plugin\x20\x27','init','workflow-skills','parse','utf-8','fail','log','getLogPath','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','✓\x20TD\x20LLM\x20proxy\x20server\x20stopped','ANTHROPIC_MODEL','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','Initializing...','Initializing\x20proxy\x20logger...','ENOENT','object','trim','minor','Claude\x20Code\x20version\x20check\x20failed','proxy','Failed\x20to\x20spawn\x20claude\x20command:\x20','command','Configuring\x20MCP\x20server\x20\x27','claude','statusLine','td-skills','Failed\x20to\x20launch\x20Claude\x20Code:\x20','message','info','code','hostname','sonnet','string','✓\x20Logging\x20to\x20','\x27\x20updated','cause','1683672LvfrHQ','includes'];a16_0x21f9=function(){return _0x29a2e7;};return a16_0x21f9();}import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a16_0x2e390a(0x123);function handleInstallationError(_0x2b2bd5,_0x58c854,_0x1e94ab,_0x56e121){const _0x5cb7c2=a16_0x2e390a;errorContains(_0x2b2bd5,_0x5cb7c2(0xfa),_0x5cb7c2(0x181),_0x5cb7c2(0x116))?(_0x1e94ab[_0x5cb7c2(0xf9)]='✓\x20'+_0x58c854+'\x20already\x20configured',_0x56e121?.['info'](_0x58c854+'\x20already\x20configured'),_0x2b2bd5 instanceof SDKError&&_0x2b2bd5[_0x5cb7c2(0x162)]&&_0x56e121?.[_0x5cb7c2(0x134)](_0x5cb7c2(0x169)+_0x2b2bd5[_0x5cb7c2(0x162)][_0x5cb7c2(0x15a)])):(_0x1e94ab[_0x5cb7c2(0x17d)](_0x5cb7c2(0x130)+_0x58c854),_0x56e121?.[_0x5cb7c2(0x166)](_0x58c854+_0x5cb7c2(0x135),_0x2b2bd5));}export function parseVersion(_0x427a75){const _0x7ffb80=a16_0x2e390a,_0x1ea7da=_0x427a75[_0x7ffb80(0x14f)]()[_0x7ffb80(0x11b)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x1ea7da)return null;return{'major':parseInt(_0x1ea7da[0x1],0xa),'minor':parseInt(_0x1ea7da[0x2],0xa),'patch':parseInt(_0x1ea7da[0x3],0xa)};}export function compareVersions(_0x596b48,_0x49e1da){const _0xcc12a5=a16_0x2e390a;if(_0x596b48[_0xcc12a5(0x111)]!==_0x49e1da[_0xcc12a5(0x111)])return _0x596b48[_0xcc12a5(0x111)]-_0x49e1da[_0xcc12a5(0x111)];if(_0x596b48[_0xcc12a5(0x150)]!==_0x49e1da[_0xcc12a5(0x150)])return _0x596b48[_0xcc12a5(0x150)]-_0x49e1da[_0xcc12a5(0x150)];return _0x596b48[_0xcc12a5(0x106)]-_0x49e1da['patch'];}async function checkClaudeVersion(_0x26d10b,_0x28ae2e){const _0x2c0e97=a16_0x2e390a;_0x28ae2e?.[_0x2c0e97(0x134)](_0x2c0e97(0x16c)+_0x26d10b+')');const _0x577144=await executeClaudeCommand([_0x2c0e97(0x136)],undefined,_0x28ae2e),_0x451cda=parseVersion(_0x577144);if(!_0x451cda){_0x28ae2e?.[_0x2c0e97(0x17d)](_0x2c0e97(0x147)+_0x577144);return;}const _0x1598c2=_0x451cda[_0x2c0e97(0x111)]+'.'+_0x451cda[_0x2c0e97(0x150)]+'.'+_0x451cda[_0x2c0e97(0x106)],_0x1d400f=parseVersion(_0x26d10b);if(!_0x1d400f){_0x28ae2e?.[_0x2c0e97(0x17d)](_0x2c0e97(0x11d)+_0x26d10b);return;}if(compareVersions(_0x451cda,_0x1d400f)<0x0){_0x28ae2e?.[_0x2c0e97(0x166)](_0x2c0e97(0x12c)+_0x1598c2+'\x20is\x20too\x20old\x20(minimum:\x20'+_0x26d10b+')');throw new SDKError(ErrorCode[_0x2c0e97(0x118)],_0x2c0e97(0x12c)+_0x1598c2+_0x2c0e97(0x16e)+_0x26d10b+_0x2c0e97(0x100),undefined,{'helpText':_0x2c0e97(0x17e)});}_0x28ae2e?.['debug'](_0x2c0e97(0x12c)+_0x1598c2+_0x2c0e97(0xf2));}async function executeClaudeCommand(_0x3d28ea,_0xbb8f1,_0x5964be){const _0x75bde8=a16_0x2e390a;return _0x5964be?.[_0x75bde8(0x15b)](_0x75bde8(0x12f)+_0x3d28ea[_0x75bde8(0x179)]('\x20')),new Promise((_0x10147d,_0x1b03be)=>{const _0x145820=_0x75bde8,_0x5b5560=spawn(_0x145820(0x156),_0x3d28ea,{'stdio':'pipe'});let _0x1cbacf='',_0x22e97f='';_0x5b5560[_0x145820(0x102)]['on']('data',_0x1170d9=>{const _0x2d3f89=_0x145820;_0x1cbacf+=_0x1170d9[_0x2d3f89(0x11c)]();}),_0x5b5560['stderr']['on'](_0x145820(0x104),_0x1d8624=>{_0x22e97f+=_0x1d8624['toString']();}),_0x5b5560['on']('error',_0x15b974=>{const _0x38010c=_0x145820;_0x15b974[_0x38010c(0x15c)]===_0x38010c(0x14d)?(_0x5964be?.[_0x38010c(0x166)]('Claude\x20Code\x20CLI\x20not\x20found'),_0x1b03be(new SDKError(ErrorCode[_0x38010c(0x171)],'Claude\x20Code\x20CLI\x20not\x20found',_0x15b974,{'helpText':_0x38010c(0xfe)}))):(_0x5964be?.[_0x38010c(0x166)]('Command\x20spawn\x20error:\x20'+_0x15b974['message']),_0x1b03be(new SDKError(ErrorCode[_0x38010c(0x137)],_0x38010c(0x153)+_0x15b974[_0x38010c(0x15a)],_0x15b974)));}),_0x5b5560['on']('exit',_0x3a97be=>{const _0x3205d8=_0x145820;if(_0x3a97be===0x0)_0x10147d(_0x1cbacf);else _0xbb8f1?(_0x5964be?.[_0x3205d8(0x166)]('Command\x20failed\x20(exit\x20'+_0x3a97be+_0x3205d8(0x103)+_0x3d28ea[_0x3205d8(0x179)]('\x20')),_0x1b03be(new SDKError(ErrorCode[_0x3205d8(0x17b)],_0xbb8f1,new Error(_0x22e97f)))):_0x10147d('');});});}async function ensureMcpServer(_0x293eb7,_0x4a7e46,_0x51e6ef,_0x12bd42,_0x591147){const _0x5beb8a=a16_0x2e390a;_0x12bd42[_0x5beb8a(0xf9)]=_0x5beb8a(0x155)+_0x293eb7+_0x5beb8a(0x173),await executeClaudeCommand([_0x5beb8a(0x139),_0x5beb8a(0x175),_0x293eb7,_0x4a7e46,_0x5beb8a(0xf3),_0x51e6ef],_0x5beb8a(0x124)+_0x293eb7+'\x27',_0x591147),_0x12bd42[_0x5beb8a(0xf9)]=_0x5beb8a(0x182)+_0x293eb7+_0x5beb8a(0xf8);}async function ensureMarketplace(_0x7369f2,_0x11d47a,_0x481e6e,_0x4549b1){const _0x1d15b6=a16_0x2e390a;_0x481e6e[_0x1d15b6(0xf9)]='Configuring\x20marketplace\x20\x27'+_0x7369f2+'\x27...',await executeClaudeCommand(['plugin',_0x1d15b6(0x113),_0x1d15b6(0x175),_0x11d47a],_0x1d15b6(0x17a)+_0x7369f2+'\x27',_0x4549b1),_0x481e6e['text']=_0x1d15b6(0x11a)+_0x7369f2+_0x1d15b6(0xf8);}function a16_0x4f10(_0x27818a,_0x1295bb){_0x27818a=_0x27818a-0xf1;const _0x21f9ba=a16_0x21f9();let _0x4f10bf=_0x21f9ba[_0x27818a];return _0x4f10bf;}async function updateMarketplace(_0x44a248,_0x294b02,_0x309b85){const _0xa19ee=a16_0x2e390a;_0x294b02[_0xa19ee(0xf9)]='Updating\x20marketplace\x20\x27'+_0x44a248+'\x27...',await executeClaudeCommand([_0xa19ee(0x12d),_0xa19ee(0x113),_0xa19ee(0x114)],'Failed\x20to\x20update\x20marketplace\x20\x27'+_0x44a248+'\x27',_0x309b85),_0x294b02[_0xa19ee(0xf9)]=_0xa19ee(0x11a)+_0x44a248+_0xa19ee(0x161);}async function ensurePlugin(_0x5b3037,_0x1a930f,_0x20752e,_0x48c2e8){const _0x2259ce=a16_0x2e390a;_0x20752e['text']=_0x2259ce(0x131)+_0x5b3037+_0x2259ce(0x173),await executeClaudeCommand([_0x2259ce(0x12d),_0x2259ce(0x174),_0x5b3037+'@'+_0x1a930f],_0x2259ce(0x13f)+_0x5b3037+'\x27',_0x48c2e8),_0x20752e[_0x2259ce(0xf9)]='✓\x20Plugin\x20\x27'+_0x5b3037+_0x2259ce(0x16f);}async function createClaudeSettings(_0x1dc48c,_0x511161=a16_0x2e390a(0x15e),_0x478c14){const _0x362989=a16_0x2e390a,_0x1d2c31=join(process[_0x362989(0x10d)](),_0x362989(0x10e)),_0x894e3=join(_0x1d2c31,_0x362989(0x110));await mkdir(_0x1d2c31,{'recursive':!![]});let _0x59313c={};if(existsSync(_0x894e3))try{const _0x4edc9d=await readFile(_0x894e3,_0x362989(0x143));_0x59313c=JSON[_0x362989(0x142)](_0x4edc9d);}catch{_0x59313c={};}const _0x2d0f64=_0x59313c[_0x362989(0x119)]||{},_0x1970c0={'ANTHROPIC_BASE_URL':_0x2d0f64['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0x2d0f64[_0x362989(0x149)],'ANTHROPIC_AUTH_TOKEN':_0x2d0f64[_0x362989(0x117)],'statusLine':_0x59313c[_0x362989(0x157)]},_0x262e87={..._0x59313c,'env':{..._0x2d0f64,'ANTHROPIC_BASE_URL':_0x362989(0x122)+_0x1dc48c,'ANTHROPIC_MODEL':_0x511161,'ANTHROPIC_AUTH_TOKEN':_0x362989(0xf1)},'statusLine':{'type':_0x362989(0x154),'command':_0x478c14?_0x362989(0xf7)+_0x478c14+'\x20claude\x20statusline':_0x362989(0x17c)}};return await writeFile(_0x894e3,JSON['stringify'](_0x262e87,null,0x2)+'\x0a'),_0x1970c0;}async function restoreClaudeSettings(_0x446a0e){const _0x5837fd=a16_0x2e390a,_0x424f37=join(process[_0x5837fd(0x10d)](),_0x5837fd(0x10e)),_0x5564b5=join(_0x424f37,'settings.local.json');if(!existsSync(_0x5564b5))return;try{const _0x1aed00=await readFile(_0x5564b5,_0x5837fd(0x143)),_0x4b4bc6=JSON[_0x5837fd(0x142)](_0x1aed00),_0x384eff=_0x4b4bc6[_0x5837fd(0x119)]||{},_0x5047f3=_0x384eff['ANTHROPIC_BASE_URL'],_0x79e027=((()=>{const _0xce7dfb=_0x5837fd;if(typeof _0x5047f3!==_0xce7dfb(0x15f))return![];try{const _0xa4374=new URL(_0x5047f3);return _0xa4374[_0xce7dfb(0x15d)]===_0xce7dfb(0x10b)||_0xa4374[_0xce7dfb(0x15d)]===_0xce7dfb(0x176);}catch{return![];}})());_0x79e027?(delete _0x384eff[_0x5837fd(0x170)],delete _0x384eff['ANTHROPIC_MODEL'],delete _0x384eff[_0x5837fd(0x117)]):(_0x446a0e['ANTHROPIC_BASE_URL']!==undefined?_0x384eff[_0x5837fd(0x170)]=_0x446a0e[_0x5837fd(0x170)]:delete _0x384eff[_0x5837fd(0x170)],_0x446a0e[_0x5837fd(0x149)]!==undefined?_0x384eff['ANTHROPIC_MODEL']=_0x446a0e[_0x5837fd(0x149)]:delete _0x384eff[_0x5837fd(0x149)],_0x446a0e['ANTHROPIC_AUTH_TOKEN']!==undefined?_0x384eff[_0x5837fd(0x117)]=_0x446a0e['ANTHROPIC_AUTH_TOKEN']:delete _0x384eff['ANTHROPIC_AUTH_TOKEN']);const _0xda1620=_0x4b4bc6[_0x5837fd(0x157)],_0x33c424=((()=>{const _0x238953=_0x5837fd;if(!_0xda1620||typeof _0xda1620!==_0x238953(0x14e))return![];if(_0xda1620['type']!==_0x238953(0x154))return![];if(typeof _0xda1620['command']!==_0x238953(0x15f))return![];return _0xda1620[_0x238953(0x154)]['includes'](_0x238953(0x167))&&_0xda1620[_0x238953(0x154)][_0x238953(0x164)]('statusline');})());if(_0x33c424)delete _0x4b4bc6['statusLine'];else _0x446a0e['statusLine']!==undefined?_0x4b4bc6['statusLine']=_0x446a0e[_0x5837fd(0x157)]:delete _0x4b4bc6[_0x5837fd(0x157)];_0x4b4bc6[_0x5837fd(0x119)]=_0x384eff,await writeFile(_0x5564b5,JSON[_0x5837fd(0x109)](_0x4b4bc6,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a16_0x2e390a(0x13a)]=a16_0x2e390a(0x156);[a16_0x2e390a(0x17f)]='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';[a16_0x2e390a(0x12e)];[a16_0x2e390a(0x10f)];['logger'];[a16_0x2e390a(0x10c)];async['execute'](_0x47330c){const _0x2cc30f=a16_0x2e390a,{tdx:_0x51f355,options:_0x2728b4,args:_0x19f96d}=_0x47330c;try{const _0x5c1173=_0x2728b4,_0x592d41=_0x5c1173[_0x2cc30f(0xf6)]||_0x2cc30f(0x15e),_0x563769=_0x5c1173[_0x2cc30f(0x152)]===![],_0x19d76c=_0x5c1173[_0x2cc30f(0x127)]===!![],_0x40391a=_0x5c1173[_0x2cc30f(0x132)]===!![],_0x53bd64=[..._0x19f96d];if(_0x19d76c)_0x53bd64[_0x2cc30f(0x120)]('-c');else _0x40391a&&_0x53bd64[_0x2cc30f(0x120)]('-r');const _0x453b50=createCommandSpinner(_0x2cc30f(0x14b),{'verbose':_0x2728b4['verbose']});_0x453b50['start']();try{if(!_0x563769){_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0xfb),this['port']=await findAvailablePort(0xfa0),_0x453b50['text']=_0x2cc30f(0xf4)+this[_0x2cc30f(0x10c)],_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x11f);const _0x46d651=await _0x51f355[_0x2cc30f(0x13e)]['getOrCreateDefaultProject'](),_0x5e5277=_0x46d651['id'];_0x453b50['text']=_0x2cc30f(0x178)+_0x46d651[_0x2cc30f(0x13c)][_0x2cc30f(0x13a)];const _0xb64fa2=_0x2728b4[_0x2cc30f(0x16a)];try{const _0x5e6a81=await _0x51f355[_0x2cc30f(0xfc)]['getCurrent']();_0x5e6a81[_0x2cc30f(0x105)]&&writeCachedAccountInfo(_0x2728b4[_0x2cc30f(0x108)],_0x5e6a81[_0x2cc30f(0x105)],_0xb64fa2);}catch{}_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x14c),this[_0x2cc30f(0x10a)]=new TDXLogger(_0x2728b4[_0x2cc30f(0x125)],!![]),await this[_0x2cc30f(0x10a)][_0x2cc30f(0x140)]();const _0x180dcc=this[_0x2cc30f(0x10a)][_0x2cc30f(0x146)]();_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x160)+_0x180dcc,_0x453b50[_0x2cc30f(0xf9)]='Starting\x20TD\x20LLM\x20proxy\x20server...',this['server']=new ProxyServer({'port':this[_0x2cc30f(0x10c)],'projectId':_0x5e5277,'tdx':_0x51f355,'logger':this[_0x2cc30f(0x10a)],'site':_0x2728b4[_0x2cc30f(0x108)]}),await this['server'][_0x2cc30f(0x101)](),_0x453b50[_0x2cc30f(0xf9)]='✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20'+this[_0x2cc30f(0x10c)],_0x453b50[_0x2cc30f(0xf9)]='Creating\x20.claude/settings.local.json...',this['originalSettings']=await createClaudeSettings(this['port'],_0x592d41,_0xb64fa2),_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x177);}else _0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x14a);try{_0x453b50[_0x2cc30f(0xf9)]=_0x2cc30f(0x12a),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x2cc30f(0x10a)]),_0x453b50['text']='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x1ef51c){_0x453b50[_0x2cc30f(0x144)](_0x2cc30f(0x151));throw _0x1ef51c;}try{await ensureMcpServer('td-docs',_0x2cc30f(0x172),_0x2cc30f(0x138),_0x453b50,this[_0x2cc30f(0x10a)]);}catch(_0x356b77){handleInstallationError(_0x356b77,'TD\x20Docs\x20MCP\x20Server',_0x453b50,this['logger']);}try{await ensureMarketplace('td-skills',_0x2cc30f(0xff),_0x453b50,this[_0x2cc30f(0x10a)]),await updateMarketplace(_0x2cc30f(0x158),_0x453b50,this['logger']),await ensurePlugin(_0x2cc30f(0x112),_0x2cc30f(0x158),_0x453b50,this[_0x2cc30f(0x10a)]),await ensurePlugin(_0x2cc30f(0x141),_0x2cc30f(0x158),_0x453b50,this[_0x2cc30f(0x10a)]),await ensurePlugin(_0x2cc30f(0x12b),_0x2cc30f(0x158),_0x453b50,this[_0x2cc30f(0x10a)]);}catch(_0x155d1c){handleInstallationError(_0x155d1c,_0x2cc30f(0x13b),_0x453b50,this[_0x2cc30f(0x10a)]);}_0x453b50[_0x2cc30f(0x121)]();}catch(_0x4989e){_0x453b50['fail'](_0x2cc30f(0x126));throw _0x4989e;}const _0x232d29=await this[_0x2cc30f(0x129)]();if(!_0x232d29)throw new SDKError(ErrorCode[_0x2cc30f(0x171)],_0x2cc30f(0x107),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x3be0ca={...process['env']};!_0x563769&&(_0x3be0ca[_0x2cc30f(0x170)]='http://127.0.0.1:'+this[_0x2cc30f(0x10c)],_0x3be0ca['ANTHROPIC_MODEL']=_0x592d41,_0x3be0ca[_0x2cc30f(0x117)]=_0x2cc30f(0xf1));const _0x3c3494=spawn(_0x232d29,_0x53bd64,{'stdio':_0x2cc30f(0xfd),'env':_0x3be0ca}),_0x4c7df6=await new Promise(_0x36e0b9=>{const _0x4aa130=_0x2cc30f;_0x3c3494['on'](_0x4aa130(0x133),_0x2148b5=>{_0x36e0b9(_0x2148b5||0x0);}),_0x3c3494['on']('error',_0x2dfd65=>{const _0x4e26e3=_0x4aa130;console[_0x4e26e3(0x166)](a16_0x11f35b['red'](_0x4e26e3(0x159)+_0x2dfd65['message'])),_0x36e0b9(0x1);});});this[_0x2cc30f(0x12e)]&&(await this[_0x2cc30f(0x12e)][_0x2cc30f(0x121)](),console[_0x2cc30f(0x145)](a16_0x11f35b[_0x2cc30f(0x165)](_0x2cc30f(0x148))));if(this[_0x2cc30f(0x10a)]){await this[_0x2cc30f(0x10a)][_0x2cc30f(0x180)]();const _0x58d073=this['logger'][_0x2cc30f(0x146)]();console[_0x2cc30f(0x145)](a16_0x11f35b[_0x2cc30f(0x165)](_0x2cc30f(0x168)+_0x58d073));}return this[_0x2cc30f(0x10f)]&&(await restoreClaudeSettings(this[_0x2cc30f(0x10f)]),console['log'](a16_0x11f35b[_0x2cc30f(0x165)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x4c7df6;}catch(_0xf90095){this['server']&&await this[_0x2cc30f(0x12e)][_0x2cc30f(0x121)]();this[_0x2cc30f(0x10a)]&&await this[_0x2cc30f(0x10a)][_0x2cc30f(0x180)]();this[_0x2cc30f(0x10f)]&&await restoreClaudeSettings(this[_0x2cc30f(0x10f)]);throw _0xf90095;}}async[a16_0x2e390a(0x129)](){return new Promise(_0x382e27=>{const _0x261314=a16_0x4f10,_0x59738f=spawn(_0x261314(0xf5),[_0x261314(0x156)]);let _0x45de36='';_0x59738f[_0x261314(0x102)]['on'](_0x261314(0x104),_0x24e912=>{const _0x162ece=_0x261314;_0x45de36+=_0x24e912[_0x162ece(0x11c)]();}),_0x59738f['on'](_0x261314(0x133),_0x257a72=>{const _0x1e63d4=_0x261314;_0x257a72===0x0&&_0x45de36[_0x1e63d4(0x14f)]()?_0x382e27(_0x45de36[_0x1e63d4(0x14f)]()):_0x382e27(null);});});}}
@@ -1 +1 @@
1
- const a17_0x2ac540=a17_0x3fea;(function(_0x24ce20,_0x45ff4b){const _0x471db5=a17_0x3fea,_0x25b9e9=_0x24ce20();while(!![]){try{const _0x441e86=-parseInt(_0x471db5(0x119))/0x1+parseInt(_0x471db5(0x10c))/0x2+-parseInt(_0x471db5(0x103))/0x3+-parseInt(_0x471db5(0x112))/0x4*(parseInt(_0x471db5(0x106))/0x5)+parseInt(_0x471db5(0x115))/0x6*(-parseInt(_0x471db5(0x124))/0x7)+-parseInt(_0x471db5(0x116))/0x8+parseInt(_0x471db5(0x117))/0x9*(parseInt(_0x471db5(0x109))/0xa);if(_0x441e86===_0x45ff4b)break;else _0x25b9e9['push'](_0x25b9e9['shift']());}catch(_0x47bdd7){_0x25b9e9['push'](_0x25b9e9['shift']());}}}(a17_0x4ed7,0x41e19));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';function a17_0x3fea(_0x1c5d5a,_0xe4099f){_0x1c5d5a=_0x1c5d5a-0x100;const _0x4ed727=a17_0x4ed7();let _0x3fea12=_0x4ed727[_0x1c5d5a];return _0x3fea12;}import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../utils/model-factors.js';async function readStdinJson(_0x29fd11=0x64){return new Promise(_0x4c66fa=>{const _0x583b49=a17_0x3fea;let _0x543a6f='',_0x1b8c3f=![];const _0x3a91e2=createInterface({'input':process[_0x583b49(0x113)],'terminal':![]}),_0x1e5571=_0x25fd48=>{const _0x49c505=_0x583b49;if(_0x1b8c3f)return;_0x1b8c3f=!![],clearTimeout(_0x308ada),_0x3a91e2[_0x49c505(0x122)](),_0x4c66fa(_0x25fd48);},_0x308ada=setTimeout(()=>{_0x1e5571(null);},_0x29fd11);_0x3a91e2['on'](_0x583b49(0x11a),_0x41e11f=>{_0x543a6f+=_0x41e11f;}),_0x3a91e2['on']('close',()=>{const _0x1fc0a1=_0x583b49;if(_0x1b8c3f)return;try{const _0x26716d=JSON[_0x1fc0a1(0x125)](_0x543a6f);_0x1e5571(_0x26716d);}catch{_0x1e5571(null);}});});}function a17_0x4ed7(){const _0x4556ac=['💎\x20tdx\x20-\x20Claude','44569oieoeq','parse','statusline','session_id','model','💎\x20','813810dWlvgd','profile','sessionCredits','6230ROcunA','join','Claude','170SUrlMa','accountId','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','976750fFpGht','\x20month','toFixed','site','tdx','monthCredits','1372AizrSL','stdin','🧠\x20','66RxjCkw','4137384mcMDCJ','771561xHZUIF','log','390061TZpSCO','line','tdx\x20','\x20|\x20','latestInputTokens','description','push','\x20session\x20/\x20','options','close'];a17_0x4ed7=function(){return _0x4556ac;};return a17_0x4ed7();}function formatCredits(_0x587987){const _0x47b578=a17_0x3fea;return _0x587987[_0x47b578(0x10e)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{['name']=a17_0x2ac540(0x126);[a17_0x2ac540(0x11e)]=a17_0x2ac540(0x10b);async['execute'](_0x1bdd14){const _0x548cbd=a17_0x2ac540;try{const _0x3a0a9b=await readStdinJson();if(!_0x3a0a9b?.[_0x548cbd(0x100)])return console[_0x548cbd(0x118)]('💎\x20tdx\x20-\x20Claude'),0x0;const _0x44d95e=_0x3a0a9b[_0x548cbd(0x100)],_0x488808=_0x3a0a9b[_0x548cbd(0x101)]?.['id']||'',_0x2bfb8f=_0x3a0a9b[_0x548cbd(0x104)]||_0x1bdd14[_0x548cbd(0x121)][_0x548cbd(0x104)],_0x40665d=await getUsageStats(_0x44d95e,_0x2bfb8f),_0x4ae400=[],_0x14ccd8=readCachedAccountInfo(_0x2bfb8f),_0x4ec119=_0x14ccd8?_0x548cbd(0x11b)+_0x14ccd8[_0x548cbd(0x10f)]+':'+_0x14ccd8[_0x548cbd(0x10a)]:_0x548cbd(0x110),_0x58bca9=_0x488808?getModelDisplayName(_0x488808):_0x548cbd(0x108);_0x4ae400[_0x548cbd(0x11f)](_0x548cbd(0x102)+_0x4ec119+'\x20-\x20'+_0x58bca9);const _0x2c49b1=formatCredits(_0x40665d[_0x548cbd(0x105)]),_0x308daa=formatCredits(_0x40665d['todayCredits']),_0x5b9f73=formatCredits(_0x40665d[_0x548cbd(0x111)]);_0x4ae400[_0x548cbd(0x11f)]('🪙\x20credit:\x20'+_0x2c49b1+_0x548cbd(0x120)+_0x308daa+'\x20today\x20/\x20'+_0x5b9f73+_0x548cbd(0x10d));if(_0x40665d[_0x548cbd(0x11d)]>0x0&&_0x488808){const _0x57085e=formatTokenCount(_0x40665d[_0x548cbd(0x11d)]),_0x42af75=calculateContextPercentage(_0x40665d[_0x548cbd(0x11d)],_0x488808);_0x4ae400['push'](_0x548cbd(0x114)+_0x57085e+'\x20('+_0x42af75+'%)');}return console['log'](_0x4ae400[_0x548cbd(0x107)](_0x548cbd(0x11c))),0x0;}catch{return console[_0x548cbd(0x118)](_0x548cbd(0x123)),0x0;}}}
1
+ const a17_0x448700=a17_0x19bd;(function(_0x3574c6,_0x53c426){const _0x2ff917=a17_0x19bd,_0x3296b5=_0x3574c6();while(!![]){try{const _0x1e1054=-parseInt(_0x2ff917(0xa4))/0x1*(-parseInt(_0x2ff917(0x86))/0x2)+-parseInt(_0x2ff917(0x8e))/0x3*(parseInt(_0x2ff917(0xa7))/0x4)+parseInt(_0x2ff917(0x98))/0x5+-parseInt(_0x2ff917(0x9f))/0x6*(-parseInt(_0x2ff917(0x9b))/0x7)+-parseInt(_0x2ff917(0xa8))/0x8+-parseInt(_0x2ff917(0x94))/0x9*(parseInt(_0x2ff917(0x87))/0xa)+parseInt(_0x2ff917(0x90))/0xb*(parseInt(_0x2ff917(0x93))/0xc);if(_0x1e1054===_0x53c426)break;else _0x3296b5['push'](_0x3296b5['shift']());}catch(_0x44e653){_0x3296b5['push'](_0x3296b5['shift']());}}}(a17_0x4403,0xa3219));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../utils/model-factors.js';function a17_0x4403(){const _0x318067=['Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','statusline','session_id','1fkjjDV','\x20session\x20/\x20','stdin','4IWCLYe','9279792UUmyaX','toFixed','line','options','💎\x20','log','accountId','1613574EgguME','4050DPsWCo','latestInputTokens','\x20month','todayCredits','join','sessionCredits','\x20-\x20','1886865PbTeFC','profile','22jgAxCR','tdx','execute','3291540wUpvWJ','3096maIZZQ','site','🪙\x20credit:\x20','parse','3602130XnHjUu','description','push','7FvJILp','💎\x20tdx\x20-\x20Claude','model','close','3123786SoyemB','\x20|\x20'];a17_0x4403=function(){return _0x318067;};return a17_0x4403();}async function readStdinJson(_0x10f3c8=0x64){return new Promise(_0x311431=>{const _0x28a95e=a17_0x19bd;let _0x29e5ed='',_0x2c8f8b=![];const _0x164a46=createInterface({'input':process[_0x28a95e(0xa6)],'terminal':![]}),_0x1498aa=_0x560c50=>{const _0x528955=_0x28a95e;if(_0x2c8f8b)return;_0x2c8f8b=!![],clearTimeout(_0x345275),_0x164a46[_0x528955(0x9e)](),_0x311431(_0x560c50);},_0x345275=setTimeout(()=>{_0x1498aa(null);},_0x10f3c8);_0x164a46['on'](_0x28a95e(0xaa),_0x2b6805=>{_0x29e5ed+=_0x2b6805;}),_0x164a46['on'](_0x28a95e(0x9e),()=>{const _0x3e098f=_0x28a95e;if(_0x2c8f8b)return;try{const _0x6d0bd6=JSON[_0x3e098f(0x97)](_0x29e5ed);_0x1498aa(_0x6d0bd6);}catch{_0x1498aa(null);}});});}function a17_0x19bd(_0x3ff240,_0x3844b7){_0x3ff240=_0x3ff240-0x86;const _0x4403e0=a17_0x4403();let _0x19bdae=_0x4403e0[_0x3ff240];return _0x19bdae;}function formatCredits(_0xf35d69){const _0x503e16=a17_0x19bd;return _0xf35d69[_0x503e16(0xa9)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{['name']=a17_0x448700(0xa2);[a17_0x448700(0x99)]=a17_0x448700(0xa1);async[a17_0x448700(0x92)](_0x31cf49){const _0x226edc=a17_0x448700;try{const _0xf93b79=await readStdinJson();if(!_0xf93b79?.[_0x226edc(0xa3)])return console[_0x226edc(0xad)](_0x226edc(0x9c)),0x0;const _0x59b599=_0xf93b79[_0x226edc(0xa3)],_0x488641=_0xf93b79[_0x226edc(0x9d)]?.['id']||'',_0x5a9b27=_0xf93b79[_0x226edc(0x8f)]||_0x31cf49[_0x226edc(0xab)][_0x226edc(0x8f)],_0x5d2862=await getUsageStats(_0x59b599,_0x5a9b27),_0x4fd99c=[],_0x149fe1=readCachedAccountInfo(_0x5a9b27),_0x5b0305=_0x149fe1?'tdx\x20'+_0x149fe1[_0x226edc(0x95)]+':'+_0x149fe1[_0x226edc(0xae)]:_0x226edc(0x91),_0x426d4f=_0x488641?getModelDisplayName(_0x488641):'Claude';_0x4fd99c[_0x226edc(0x9a)](_0x226edc(0xac)+_0x5b0305+_0x226edc(0x8d)+_0x426d4f);const _0x42612d=formatCredits(_0x5d2862[_0x226edc(0x8c)]),_0x3a5768=formatCredits(_0x5d2862[_0x226edc(0x8a)]),_0x3b44c6=formatCredits(_0x5d2862['monthCredits']);_0x4fd99c[_0x226edc(0x9a)](_0x226edc(0x96)+_0x42612d+_0x226edc(0xa5)+_0x3a5768+'\x20today\x20/\x20'+_0x3b44c6+_0x226edc(0x89));if(_0x5d2862['latestInputTokens']>0x0&&_0x488641){const _0xc1de74=formatTokenCount(_0x5d2862[_0x226edc(0x88)]),_0x43f642=calculateContextPercentage(_0x5d2862[_0x226edc(0x88)],_0x488641);_0x4fd99c[_0x226edc(0x9a)]('🧠\x20'+_0xc1de74+'\x20('+_0x43f642+'%)');}return console['log'](_0x4fd99c[_0x226edc(0x8b)](_0x226edc(0xa0))),0x0;}catch{return console[_0x226edc(0xad)]('💎\x20tdx\x20-\x20Claude'),0x0;}}}
@@ -1 +1 @@
1
- function a18_0xa47d(_0x5b7cc2,_0x2fbe9e){_0x5b7cc2=_0x5b7cc2-0x1e2;const _0x315be4=a18_0x315b();let _0xa47de8=_0x315be4[_0x5b7cc2];return _0xa47de8;}const a18_0x3bbd1f=a18_0xa47d;(function(_0x452ba0,_0x46e91b){const _0x51de2b=a18_0xa47d,_0x1b3485=_0x452ba0();while(!![]){try{const _0x4a0f5f=-parseInt(_0x51de2b(0x20f))/0x1+-parseInt(_0x51de2b(0x21a))/0x2*(parseInt(_0x51de2b(0x1f4))/0x3)+-parseInt(_0x51de2b(0x217))/0x4*(-parseInt(_0x51de2b(0x1ff))/0x5)+-parseInt(_0x51de2b(0x204))/0x6*(-parseInt(_0x51de2b(0x1f2))/0x7)+-parseInt(_0x51de2b(0x1e5))/0x8+-parseInt(_0x51de2b(0x1ec))/0x9+-parseInt(_0x51de2b(0x208))/0xa*(-parseInt(_0x51de2b(0x1ef))/0xb);if(_0x4a0f5f===_0x46e91b)break;else _0x1b3485['push'](_0x1b3485['shift']());}catch(_0x5d0439){_0x1b3485['push'](_0x1b3485['shift']());}}}(a18_0x315b,0x70e33));function a18_0x315b(){const _0x3723bd=['6033288XivdsS','\x20\x20Total:\x20\x20\x20','entryCount','outputTable','all','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','log','1744272mKtkvo','\x20\x20Month:\x20\x20\x20','today\x20','1305106XYiEFD','json','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','5084107ZYEcjS','lastUsedAt','12MPRRPs','never','description','dim','padStart','totalCredits','bold','padEnd','toLocaleTimeString','toFixed','yesterday','142390UsfNfk','execute','en-US','cyan','default','6XepQog','map','Credits','outputStructured','110EidPDs','toLocaleDateString','todayCredits','short','format','usage','numeric','18159JQRZNX','getTime','Requests','2-digit','Last\x20Used','Profile','profile','max','32ZHezrm','length','\x20days\x20ago','415358ybHeSv','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','jsonl','\x20credits','credits','profileCount','monthCredits'];a18_0x315b=function(){return _0x3723bd;};return a18_0x315b();}import a18_0x34c5c2 from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x177b20){const _0x114540=a18_0xa47d;return _0x177b20[_0x114540(0x1fd)](0x2);}function formatLastUsed(_0x22639d){const _0x264c65=a18_0xa47d;if(!_0x22639d)return _0x264c65(0x1f5);const _0xb2e8fb=new Date(_0x22639d),_0x5e7b5c=new Date(),_0x39e6bb=_0xb2e8fb[_0x264c65(0x209)]('en-CA'),_0x4d73b6=_0x5e7b5c[_0x264c65(0x209)]('en-CA');if(_0x39e6bb===_0x4d73b6)return _0x264c65(0x1ee)+_0xb2e8fb[_0x264c65(0x1fc)]('en-US',{'hour':'2-digit','minute':_0x264c65(0x212)});const _0x561c43=new Date(_0x39e6bb),_0xf59cc=new Date(_0x4d73b6),_0x19bc28=Math['round']((_0xf59cc[_0x264c65(0x210)]()-_0x561c43[_0x264c65(0x210)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x19bc28===0x1)return _0x264c65(0x1fe);else return _0x19bc28>0x1&&_0x19bc28<0x7?_0x19bc28+_0x264c65(0x219):_0xb2e8fb[_0x264c65(0x209)](_0x264c65(0x201),{'month':_0x264c65(0x20b),'day':_0x264c65(0x20e)});}export class ClaudeUsageCommand extends BaseCommand{['name']=a18_0x3bbd1f(0x20d);[a18_0x3bbd1f(0x1f6)]=a18_0x3bbd1f(0x1f1);async[a18_0x3bbd1f(0x200)](_0x37136e){const _0x47aaff=a18_0x3bbd1f,{options:_0x5c9f2e}=_0x37136e,_0x327104=_0x5c9f2e[_0x47aaff(0x20c)]===_0x47aaff(0x1f0)||_0x5c9f2e[_0x47aaff(0x20c)]===_0x47aaff(0x21c)||_0x5c9f2e[_0x47aaff(0x1f0)];try{const [_0x3522fe,_0x33ffa0]=await Promise[_0x47aaff(0x1e9)]([getAllProfileStats(),getUsageSummary()]);return _0x327104?await this[_0x47aaff(0x207)](_0x3522fe,_0x33ffa0,_0x5c9f2e):this[_0x47aaff(0x1e8)](_0x3522fe,_0x33ffa0),0x0;}catch(_0xf49749){const _0x15986c=_0xf49749 instanceof Error?_0xf49749['message']:'Unknown\x20error';return console['error'](a18_0x34c5c2['red']('Error:\x20'+_0x15986c)),0x1;}}async[a18_0x3bbd1f(0x207)](_0x1978f9,_0xd912ed,_0x507449){const _0x20c19a=a18_0x3bbd1f,_0x14e516={'summary':{'todayCredits':_0xd912ed[_0x20c19a(0x20a)],'monthCredits':_0xd912ed[_0x20c19a(0x1e4)],'totalCredits':_0xd912ed[_0x20c19a(0x1f9)],'profileCount':_0xd912ed[_0x20c19a(0x1e3)]},'profiles':_0x1978f9[_0x20c19a(0x205)](_0x52b368=>({'profile':_0x52b368['profile'],'credits':_0x52b368[_0x20c19a(0x1e2)],'requests':_0x52b368[_0x20c19a(0x1e7)],'lastUsedAt':_0x52b368[_0x20c19a(0x1f3)]}))};await handleSDKOutput([_0x14e516],_0x507449);}['outputTable'](_0x225a23,_0x3331b2){const _0x22f54a=a18_0x3bbd1f;console[_0x22f54a(0x1eb)](a18_0x34c5c2[_0x22f54a(0x1fa)]('\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary')),console[_0x22f54a(0x1eb)](a18_0x34c5c2['dim']('─'['repeat'](0x32))),console['log']('\x20\x20Today:\x20\x20\x20'+a18_0x34c5c2[_0x22f54a(0x202)](formatCredits(_0x3331b2[_0x22f54a(0x20a)]))+_0x22f54a(0x21d)),console[_0x22f54a(0x1eb)](_0x22f54a(0x1ed)+a18_0x34c5c2[_0x22f54a(0x202)](formatCredits(_0x3331b2[_0x22f54a(0x1e4)]))+_0x22f54a(0x21d)),console[_0x22f54a(0x1eb)](_0x22f54a(0x1e6)+a18_0x34c5c2[_0x22f54a(0x202)](formatCredits(_0x3331b2[_0x22f54a(0x1f9)]))+_0x22f54a(0x21d)),console[_0x22f54a(0x1eb)]();if(_0x225a23['length']===0x0){console[_0x22f54a(0x1eb)](a18_0x34c5c2[_0x22f54a(0x1f7)](_0x22f54a(0x21b))),console['log'](a18_0x34c5c2[_0x22f54a(0x1f7)](_0x22f54a(0x1ea)));return;}console['log'](a18_0x34c5c2[_0x22f54a(0x1fa)]('Usage\x20by\x20Profile')),console['log'](a18_0x34c5c2['dim']('─'['repeat'](0x3c)));const _0x7c469e=Math[_0x22f54a(0x216)](0xc,..._0x225a23[_0x22f54a(0x205)](_0x2f6df1=>_0x2f6df1['profile']===_0x22f54a(0x203)?'(default)'[_0x22f54a(0x218)]:_0x2f6df1[_0x22f54a(0x215)][_0x22f54a(0x218)])),_0x36911c=0xa,_0x221836=0xa;console['log']('\x20\x20'+_0x22f54a(0x214)['padEnd'](_0x7c469e)+'\x20\x20'+_0x22f54a(0x206)[_0x22f54a(0x1f8)](_0x36911c)+'\x20\x20'+_0x22f54a(0x211)[_0x22f54a(0x1f8)](_0x221836)+'\x20\x20'+_0x22f54a(0x213));for(const _0x40a22b of _0x225a23){const _0xfd9006=_0x40a22b['profile']===_0x22f54a(0x203)?'(default)':_0x40a22b['profile'],_0x3347a1=_0xfd9006[_0x22f54a(0x1fb)](_0x7c469e),_0x21683f=_0x40a22b[_0x22f54a(0x215)]===_0x22f54a(0x203)?a18_0x34c5c2['dim'](_0x3347a1):_0x3347a1;console[_0x22f54a(0x1eb)]('\x20\x20'+_0x21683f+'\x20\x20'+a18_0x34c5c2[_0x22f54a(0x202)](formatCredits(_0x40a22b[_0x22f54a(0x1e2)])[_0x22f54a(0x1f8)](_0x36911c))+'\x20\x20'+String(_0x40a22b[_0x22f54a(0x1e7)])['padStart'](_0x221836)+'\x20\x20'+a18_0x34c5c2[_0x22f54a(0x1f7)](formatLastUsed(_0x40a22b['lastUsedAt'])));}console['log'](),console[_0x22f54a(0x1eb)](a18_0x34c5c2[_0x22f54a(0x1f7)]('Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.')),console[_0x22f54a(0x1eb)]();}}
1
+ function a18_0x12ef(){const _0x5b4c5d=['toLocaleTimeString','Last\x20Used','yesterday','error','round','format','190306uIZSmJ','toLocaleDateString','1682472plncAa','outputStructured','2ICLJxg','en-US','today\x20','Usage\x20by\x20Profile','execute','profile','lastUsedAt','bold','Credits','padStart','totalCredits','outputTable','short','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','89564KHRIzz','88ifqqMG','getTime','numeric','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','red','2-digit','10087965gUcbhW','repeat','5736BItafZ','Requests','69736APdqZo','dim','Error:\x20','profileCount','(default)','log','default','Unknown\x20error','description','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','message','cyan','\x20\x20Month:\x20\x20\x20','map','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','3222060WjnYoh','monthCredits','Profile','credits','padEnd','length','5185DMQDDF','never','all','toFixed','\x20credits','en-CA','161dpgdJN','name','141SkDDpe','\x20\x20Total:\x20\x20\x20','todayCredits'];a18_0x12ef=function(){return _0x5b4c5d;};return a18_0x12ef();}const a18_0x2c7ca5=a18_0x3b12;(function(_0x190e5a,_0x72dc5f){const _0x18baf7=a18_0x3b12,_0x156a1c=_0x190e5a();while(!![]){try{const _0x2f527a=-parseInt(_0x18baf7(0x1d4))/0x1*(-parseInt(_0x18baf7(0x1d0))/0x2)+-parseInt(_0x18baf7(0x1c7))/0x3*(parseInt(_0x18baf7(0x1e2))/0x4)+parseInt(_0x18baf7(0x1bf))/0x5*(parseInt(_0x18baf7(0x1eb))/0x6)+parseInt(_0x18baf7(0x1c5))/0x7*(parseInt(_0x18baf7(0x1ed))/0x8)+-parseInt(_0x18baf7(0x1e9))/0x9+parseInt(_0x18baf7(0x1b9))/0xa+parseInt(_0x18baf7(0x1e3))/0xb*(parseInt(_0x18baf7(0x1d2))/0xc);if(_0x2f527a===_0x72dc5f)break;else _0x156a1c['push'](_0x156a1c['shift']());}catch(_0x5e0025){_0x156a1c['push'](_0x156a1c['shift']());}}}(a18_0x12ef,0x9f5d9));import a18_0xf7275e from'chalk';function a18_0x3b12(_0x5dda9d,_0x2560d5){_0x5dda9d=_0x5dda9d-0x1ac;const _0x12ef41=a18_0x12ef();let _0x3b127e=_0x12ef41[_0x5dda9d];return _0x3b127e;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{getAllProfileStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x1be720){const _0x133a4d=a18_0x3b12;return _0x1be720[_0x133a4d(0x1c2)](0x2);}function formatLastUsed(_0x2fc356){const _0x3daaff=a18_0x3b12;if(!_0x2fc356)return _0x3daaff(0x1c0);const _0x346905=new Date(_0x2fc356),_0x53668f=new Date(),_0x5b06cd=_0x346905[_0x3daaff(0x1d1)]('en-CA'),_0x3580bb=_0x53668f['toLocaleDateString'](_0x3daaff(0x1c4));if(_0x5b06cd===_0x3580bb)return _0x3daaff(0x1d6)+_0x346905[_0x3daaff(0x1ca)](_0x3daaff(0x1d5),{'hour':_0x3daaff(0x1e8),'minute':_0x3daaff(0x1e8)});const _0x3ef9df=new Date(_0x5b06cd),_0x1db51d=new Date(_0x3580bb),_0x12dc56=Math[_0x3daaff(0x1ce)]((_0x1db51d['getTime']()-_0x3ef9df[_0x3daaff(0x1e4)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x12dc56===0x1)return _0x3daaff(0x1cc);else return _0x12dc56>0x1&&_0x12dc56<0x7?_0x12dc56+'\x20days\x20ago':_0x346905[_0x3daaff(0x1d1)](_0x3daaff(0x1d5),{'month':_0x3daaff(0x1e0),'day':_0x3daaff(0x1e5)});}export class ClaudeUsageCommand extends BaseCommand{[a18_0x2c7ca5(0x1c6)]='usage';[a18_0x2c7ca5(0x1b2)]=a18_0x2c7ca5(0x1b3);async[a18_0x2c7ca5(0x1d8)](_0x33a438){const _0x4515b0=a18_0x2c7ca5,{options:_0x289cf4}=_0x33a438,_0x32e63d=_0x289cf4[_0x4515b0(0x1cf)]==='json'||_0x289cf4[_0x4515b0(0x1cf)]==='jsonl'||_0x289cf4['json'];try{const [_0x499a78,_0x359bb2]=await Promise[_0x4515b0(0x1c1)]([getAllProfileStats(),getUsageSummary()]);return _0x32e63d?await this[_0x4515b0(0x1d3)](_0x499a78,_0x359bb2,_0x289cf4):this[_0x4515b0(0x1df)](_0x499a78,_0x359bb2),0x0;}catch(_0x1beaa9){const _0x2bc81b=_0x1beaa9 instanceof Error?_0x1beaa9[_0x4515b0(0x1b4)]:_0x4515b0(0x1b1);return console[_0x4515b0(0x1cd)](a18_0xf7275e[_0x4515b0(0x1e7)](_0x4515b0(0x1ac)+_0x2bc81b)),0x1;}}async['outputStructured'](_0x5d5430,_0x1675e6,_0x38e6fc){const _0x132919=a18_0x2c7ca5,_0x52d994={'summary':{'todayCredits':_0x1675e6[_0x132919(0x1c9)],'monthCredits':_0x1675e6[_0x132919(0x1ba)],'totalCredits':_0x1675e6[_0x132919(0x1de)],'profileCount':_0x1675e6[_0x132919(0x1ad)]},'profiles':_0x5d5430[_0x132919(0x1b7)](_0x3e8352=>({'profile':_0x3e8352[_0x132919(0x1d9)],'credits':_0x3e8352['credits'],'requests':_0x3e8352['entryCount'],'lastUsedAt':_0x3e8352[_0x132919(0x1da)]}))};await handleSDKOutput([_0x52d994],_0x38e6fc);}[a18_0x2c7ca5(0x1df)](_0x4ff55f,_0x3e6880){const _0x10c67c=a18_0x2c7ca5;console[_0x10c67c(0x1af)](a18_0xf7275e[_0x10c67c(0x1db)](_0x10c67c(0x1e1))),console[_0x10c67c(0x1af)](a18_0xf7275e[_0x10c67c(0x1ee)]('─'['repeat'](0x32))),console[_0x10c67c(0x1af)]('\x20\x20Today:\x20\x20\x20'+a18_0xf7275e[_0x10c67c(0x1b5)](formatCredits(_0x3e6880['todayCredits']))+_0x10c67c(0x1c3)),console[_0x10c67c(0x1af)](_0x10c67c(0x1b6)+a18_0xf7275e['cyan'](formatCredits(_0x3e6880[_0x10c67c(0x1ba)]))+_0x10c67c(0x1c3)),console['log'](_0x10c67c(0x1c8)+a18_0xf7275e[_0x10c67c(0x1b5)](formatCredits(_0x3e6880[_0x10c67c(0x1de)]))+'\x20credits'),console[_0x10c67c(0x1af)]();if(_0x4ff55f[_0x10c67c(0x1be)]===0x0){console[_0x10c67c(0x1af)](a18_0xf7275e[_0x10c67c(0x1ee)](_0x10c67c(0x1e6))),console[_0x10c67c(0x1af)](a18_0xf7275e['dim']('\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a'));return;}console['log'](a18_0xf7275e['bold'](_0x10c67c(0x1d7))),console[_0x10c67c(0x1af)](a18_0xf7275e['dim']('─'[_0x10c67c(0x1ea)](0x3c)));const _0x524127=Math['max'](0xc,..._0x4ff55f[_0x10c67c(0x1b7)](_0x20b87b=>_0x20b87b[_0x10c67c(0x1d9)]===_0x10c67c(0x1b0)?_0x10c67c(0x1ae)[_0x10c67c(0x1be)]:_0x20b87b[_0x10c67c(0x1d9)]['length'])),_0x109dcf=0xa,_0x338c13=0xa;console['log']('\x20\x20'+_0x10c67c(0x1bb)[_0x10c67c(0x1bd)](_0x524127)+'\x20\x20'+_0x10c67c(0x1dc)[_0x10c67c(0x1dd)](_0x109dcf)+'\x20\x20'+_0x10c67c(0x1ec)[_0x10c67c(0x1dd)](_0x338c13)+'\x20\x20'+_0x10c67c(0x1cb));for(const _0x1f8000 of _0x4ff55f){const _0x266334=_0x1f8000[_0x10c67c(0x1d9)]===_0x10c67c(0x1b0)?_0x10c67c(0x1ae):_0x1f8000[_0x10c67c(0x1d9)],_0x4b8194=_0x266334[_0x10c67c(0x1bd)](_0x524127),_0x4d26d3=_0x1f8000[_0x10c67c(0x1d9)]===_0x10c67c(0x1b0)?a18_0xf7275e[_0x10c67c(0x1ee)](_0x4b8194):_0x4b8194;console[_0x10c67c(0x1af)]('\x20\x20'+_0x4d26d3+'\x20\x20'+a18_0xf7275e['cyan'](formatCredits(_0x1f8000[_0x10c67c(0x1bc)])[_0x10c67c(0x1dd)](_0x109dcf))+'\x20\x20'+String(_0x1f8000['entryCount'])['padStart'](_0x338c13)+'\x20\x20'+a18_0xf7275e[_0x10c67c(0x1ee)](formatLastUsed(_0x1f8000['lastUsedAt'])));}console[_0x10c67c(0x1af)](),console['log'](a18_0xf7275e[_0x10c67c(0x1ee)](_0x10c67c(0x1b8))),console['log']();}}