@alm-allen/dsh-multi-provider 0.0.0-stage → 0.90.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 (857) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +21 -0
  3. package/README.md +229 -2
  4. package/cordis.patch.yml +6 -0
  5. package/icon.svg +28 -0
  6. package/lib/client.js +25708 -0
  7. package/lib/client.js.map +1 -0
  8. package/lib/index.js +93587 -0
  9. package/lib/types/client/CodexComposerQuota.d.ts +13 -0
  10. package/lib/types/client/CodexComposerQuota.d.ts.map +1 -0
  11. package/lib/types/client/CodexSubscriptionSection.d.ts +42 -0
  12. package/lib/types/client/CodexSubscriptionSection.d.ts.map +1 -0
  13. package/lib/types/client/ProviderHubSection.d.ts +21 -0
  14. package/lib/types/client/ProviderHubSection.d.ts.map +1 -0
  15. package/lib/types/client/api.d.ts +66 -0
  16. package/lib/types/client/api.d.ts.map +1 -0
  17. package/lib/types/client/claude/ClaudeComposerQuota.d.ts +29 -0
  18. package/lib/types/client/claude/ClaudeComposerQuota.d.ts.map +1 -0
  19. package/lib/types/client/claude/ClaudeSection.d.ts +12 -0
  20. package/lib/types/client/claude/ClaudeSection.d.ts.map +1 -0
  21. package/lib/types/client/claude/locales.d.ts +489 -0
  22. package/lib/types/client/claude/locales.d.ts.map +1 -0
  23. package/lib/types/client/claude/styles.d.ts +15 -0
  24. package/lib/types/client/claude/styles.d.ts.map +1 -0
  25. package/lib/types/client/claude/useClaudeSection.d.ts +106 -0
  26. package/lib/types/client/claude/useClaudeSection.d.ts.map +1 -0
  27. package/lib/types/client/claude-api/ClaudeApiSection.d.ts +5 -0
  28. package/lib/types/client/claude-api/ClaudeApiSection.d.ts.map +1 -0
  29. package/lib/types/client/claude-api/api.d.ts +23 -0
  30. package/lib/types/client/claude-api/api.d.ts.map +1 -0
  31. package/lib/types/client/claude-api/locales.d.ts +161 -0
  32. package/lib/types/client/claude-api/locales.d.ts.map +1 -0
  33. package/lib/types/client/claude-api/styles.d.ts +4 -0
  34. package/lib/types/client/claude-api/styles.d.ts.map +1 -0
  35. package/lib/types/client/claude-api/useClaudeApiSection.d.ts +37 -0
  36. package/lib/types/client/claude-api/useClaudeApiSection.d.ts.map +1 -0
  37. package/lib/types/client/cline-pass/ClinePassComposerQuota.d.ts +23 -0
  38. package/lib/types/client/cline-pass/ClinePassComposerQuota.d.ts.map +1 -0
  39. package/lib/types/client/cline-pass/ClinePassSection.d.ts +17 -0
  40. package/lib/types/client/cline-pass/ClinePassSection.d.ts.map +1 -0
  41. package/lib/types/client/cline-pass/api.d.ts +85 -0
  42. package/lib/types/client/cline-pass/api.d.ts.map +1 -0
  43. package/lib/types/client/cline-pass/locales.d.ts +911 -0
  44. package/lib/types/client/cline-pass/locales.d.ts.map +1 -0
  45. package/lib/types/client/cline-pass/styles.d.ts +7 -0
  46. package/lib/types/client/cline-pass/styles.d.ts.map +1 -0
  47. package/lib/types/client/command-code/CommandCodeComposerQuota.d.ts +20 -0
  48. package/lib/types/client/command-code/CommandCodeComposerQuota.d.ts.map +1 -0
  49. package/lib/types/client/command-code/CommandCodeSection.d.ts +8 -0
  50. package/lib/types/client/command-code/CommandCodeSection.d.ts.map +1 -0
  51. package/lib/types/client/command-code/locales.d.ts +305 -0
  52. package/lib/types/client/command-code/locales.d.ts.map +1 -0
  53. package/lib/types/client/common/AccountPoolSection.d.ts +104 -0
  54. package/lib/types/client/common/AccountPoolSection.d.ts.map +1 -0
  55. package/lib/types/client/common/ComposerQuotaBadge.d.ts +63 -0
  56. package/lib/types/client/common/ComposerQuotaBadge.d.ts.map +1 -0
  57. package/lib/types/client/common/ContextWindowEditor.d.ts +71 -0
  58. package/lib/types/client/common/ContextWindowEditor.d.ts.map +1 -0
  59. package/lib/types/client/common/LineProxySection.d.ts +78 -0
  60. package/lib/types/client/common/LineProxySection.d.ts.map +1 -0
  61. package/lib/types/client/common/ModelChecklist.d.ts +29 -0
  62. package/lib/types/client/common/ModelChecklist.d.ts.map +1 -0
  63. package/lib/types/client/common/account-pool-labels.d.ts +74 -0
  64. package/lib/types/client/common/account-pool-labels.d.ts.map +1 -0
  65. package/lib/types/client/common/account-quota.d.ts +60 -0
  66. package/lib/types/client/common/account-quota.d.ts.map +1 -0
  67. package/lib/types/client/common/format.d.ts +70 -0
  68. package/lib/types/client/common/format.d.ts.map +1 -0
  69. package/lib/types/client/common/host-locale-mirror.d.ts +24 -0
  70. package/lib/types/client/common/host-locale-mirror.d.ts.map +1 -0
  71. package/lib/types/client/common/line-api.d.ts +8 -0
  72. package/lib/types/client/common/line-api.d.ts.map +1 -0
  73. package/lib/types/client/common/line-locale.d.ts +21 -0
  74. package/lib/types/client/common/line-locale.d.ts.map +1 -0
  75. package/lib/types/client/common/model-checklist-styles.d.ts +2 -0
  76. package/lib/types/client/common/model-checklist-styles.d.ts.map +1 -0
  77. package/lib/types/client/common/plugin-style.d.ts +23 -0
  78. package/lib/types/client/common/plugin-style.d.ts.map +1 -0
  79. package/lib/types/client/common/quota-follow-up.d.ts +30 -0
  80. package/lib/types/client/common/quota-follow-up.d.ts.map +1 -0
  81. package/lib/types/client/common/styles.d.ts +11 -0
  82. package/lib/types/client/common/styles.d.ts.map +1 -0
  83. package/lib/types/client/common/use-store.d.ts +3 -0
  84. package/lib/types/client/common/use-store.d.ts.map +1 -0
  85. package/lib/types/client/glm-coding-plan/GlmCodingPlanComposerQuota.d.ts +27 -0
  86. package/lib/types/client/glm-coding-plan/GlmCodingPlanComposerQuota.d.ts.map +1 -0
  87. package/lib/types/client/glm-coding-plan/GlmCodingPlanSection.d.ts +22 -0
  88. package/lib/types/client/glm-coding-plan/GlmCodingPlanSection.d.ts.map +1 -0
  89. package/lib/types/client/glm-coding-plan/api.d.ts +4 -0
  90. package/lib/types/client/glm-coding-plan/api.d.ts.map +1 -0
  91. package/lib/types/client/glm-coding-plan/locales.d.ts +409 -0
  92. package/lib/types/client/glm-coding-plan/locales.d.ts.map +1 -0
  93. package/lib/types/client/glm-coding-plan/styles.d.ts +16 -0
  94. package/lib/types/client/glm-coding-plan/styles.d.ts.map +1 -0
  95. package/lib/types/client/glm-coding-plan/useGlmCodingPlanSection.d.ts +65 -0
  96. package/lib/types/client/glm-coding-plan/useGlmCodingPlanSection.d.ts.map +1 -0
  97. package/lib/types/client/hub/HubOverview.d.ts +16 -0
  98. package/lib/types/client/hub/HubOverview.d.ts.map +1 -0
  99. package/lib/types/client/hub/brand-icons.d.ts +64 -0
  100. package/lib/types/client/hub/brand-icons.d.ts.map +1 -0
  101. package/lib/types/client/hub/brand-svg.d.ts +51 -0
  102. package/lib/types/client/hub/brand-svg.d.ts.map +1 -0
  103. package/lib/types/client/hub/hub-styles.d.ts +2 -0
  104. package/lib/types/client/hub/hub-styles.d.ts.map +1 -0
  105. package/lib/types/client/hub/providers.d.ts +55 -0
  106. package/lib/types/client/hub/providers.d.ts.map +1 -0
  107. package/lib/types/client/index.d.ts +67 -0
  108. package/lib/types/client/index.d.ts.map +1 -0
  109. package/lib/types/client/kimi-code/KimiCodeComposerQuota.d.ts +21 -0
  110. package/lib/types/client/kimi-code/KimiCodeComposerQuota.d.ts.map +1 -0
  111. package/lib/types/client/kimi-code/KimiCodeSection.d.ts +8 -0
  112. package/lib/types/client/kimi-code/KimiCodeSection.d.ts.map +1 -0
  113. package/lib/types/client/kimi-code/KimiModelCapabilities.d.ts +16 -0
  114. package/lib/types/client/kimi-code/KimiModelCapabilities.d.ts.map +1 -0
  115. package/lib/types/client/kimi-code/KimiQuotaCard.d.ts +31 -0
  116. package/lib/types/client/kimi-code/KimiQuotaCard.d.ts.map +1 -0
  117. package/lib/types/client/kimi-code/labels.d.ts +66 -0
  118. package/lib/types/client/kimi-code/labels.d.ts.map +1 -0
  119. package/lib/types/client/kimi-code/locales.d.ts +640 -0
  120. package/lib/types/client/kimi-code/locales.d.ts.map +1 -0
  121. package/lib/types/client/kimi-code/staff-art.d.ts +19 -0
  122. package/lib/types/client/kimi-code/staff-art.d.ts.map +1 -0
  123. package/lib/types/client/kimi-code/styles.d.ts +4 -0
  124. package/lib/types/client/kimi-code/styles.d.ts.map +1 -0
  125. package/lib/types/client/locales-ru/account-pool.d.ts +11 -0
  126. package/lib/types/client/locales-ru/account-pool.d.ts.map +1 -0
  127. package/lib/types/client/locales-ru/claude-api.d.ts +3 -0
  128. package/lib/types/client/locales-ru/claude-api.d.ts.map +1 -0
  129. package/lib/types/client/locales-ru/claude.d.ts +3 -0
  130. package/lib/types/client/locales-ru/claude.d.ts.map +1 -0
  131. package/lib/types/client/locales-ru/cline-pass.d.ts +11 -0
  132. package/lib/types/client/locales-ru/cline-pass.d.ts.map +1 -0
  133. package/lib/types/client/locales-ru/command-code.d.ts +9 -0
  134. package/lib/types/client/locales-ru/command-code.d.ts.map +1 -0
  135. package/lib/types/client/locales-ru/glm-coding-plan.d.ts +10 -0
  136. package/lib/types/client/locales-ru/glm-coding-plan.d.ts.map +1 -0
  137. package/lib/types/client/locales-ru/hub.d.ts +3 -0
  138. package/lib/types/client/locales-ru/hub.d.ts.map +1 -0
  139. package/lib/types/client/locales-ru/index.d.ts +26 -0
  140. package/lib/types/client/locales-ru/index.d.ts.map +1 -0
  141. package/lib/types/client/locales-ru/kimi-code.d.ts +10 -0
  142. package/lib/types/client/locales-ru/kimi-code.d.ts.map +1 -0
  143. package/lib/types/client/locales-ru/minimax-code.d.ts +9 -0
  144. package/lib/types/client/locales-ru/minimax-code.d.ts.map +1 -0
  145. package/lib/types/client/locales-ru/ollama.d.ts +10 -0
  146. package/lib/types/client/locales-ru/ollama.d.ts.map +1 -0
  147. package/lib/types/client/locales-ru/opencode-go.d.ts +3 -0
  148. package/lib/types/client/locales-ru/opencode-go.d.ts.map +1 -0
  149. package/lib/types/client/locales-ru/opendesign.d.ts +10 -0
  150. package/lib/types/client/locales-ru/opendesign.d.ts.map +1 -0
  151. package/lib/types/client/locales-ru/qianwen-token-plan.d.ts +3 -0
  152. package/lib/types/client/locales-ru/qianwen-token-plan.d.ts.map +1 -0
  153. package/lib/types/client/locales-ru/qoder.d.ts +11 -0
  154. package/lib/types/client/locales-ru/qoder.d.ts.map +1 -0
  155. package/lib/types/client/locales-ru/relayone.d.ts +3 -0
  156. package/lib/types/client/locales-ru/relayone.d.ts.map +1 -0
  157. package/lib/types/client/locales-ru/step-code.d.ts +9 -0
  158. package/lib/types/client/locales-ru/step-code.d.ts.map +1 -0
  159. package/lib/types/client/locales-ru/workbuddy.d.ts +10 -0
  160. package/lib/types/client/locales-ru/workbuddy.d.ts.map +1 -0
  161. package/lib/types/client/locales.d.ts +497 -0
  162. package/lib/types/client/locales.d.ts.map +1 -0
  163. package/lib/types/client/minimax-code/MinimaxCodeComposerQuota.d.ts +23 -0
  164. package/lib/types/client/minimax-code/MinimaxCodeComposerQuota.d.ts.map +1 -0
  165. package/lib/types/client/minimax-code/MinimaxCodeSection.d.ts +23 -0
  166. package/lib/types/client/minimax-code/MinimaxCodeSection.d.ts.map +1 -0
  167. package/lib/types/client/minimax-code/api.d.ts +35 -0
  168. package/lib/types/client/minimax-code/api.d.ts.map +1 -0
  169. package/lib/types/client/minimax-code/commands-contract.d.ts +46 -0
  170. package/lib/types/client/minimax-code/commands-contract.d.ts.map +1 -0
  171. package/lib/types/client/minimax-code/locales.d.ts +422 -0
  172. package/lib/types/client/minimax-code/locales.d.ts.map +1 -0
  173. package/lib/types/client/minimax-code/styles.d.ts +12 -0
  174. package/lib/types/client/minimax-code/styles.d.ts.map +1 -0
  175. package/lib/types/client/minimax-code/useMinimaxCodeSection.d.ts +164 -0
  176. package/lib/types/client/minimax-code/useMinimaxCodeSection.d.ts.map +1 -0
  177. package/lib/types/client/ollama/OllamaSection.d.ts +25 -0
  178. package/lib/types/client/ollama/OllamaSection.d.ts.map +1 -0
  179. package/lib/types/client/ollama/api.d.ts +49 -0
  180. package/lib/types/client/ollama/api.d.ts.map +1 -0
  181. package/lib/types/client/ollama/locales.d.ts +479 -0
  182. package/lib/types/client/ollama/locales.d.ts.map +1 -0
  183. package/lib/types/client/opencode-go/OpenCodeGoQuotaCard.d.ts +20 -0
  184. package/lib/types/client/opencode-go/OpenCodeGoQuotaCard.d.ts.map +1 -0
  185. package/lib/types/client/opencode-go/OpenCodeGoSection.d.ts +8 -0
  186. package/lib/types/client/opencode-go/OpenCodeGoSection.d.ts.map +1 -0
  187. package/lib/types/client/opencode-go/locales.d.ts +210 -0
  188. package/lib/types/client/opencode-go/locales.d.ts.map +1 -0
  189. package/lib/types/client/opencode-go/styles.d.ts +10 -0
  190. package/lib/types/client/opencode-go/styles.d.ts.map +1 -0
  191. package/lib/types/client/opendesign/OpenDesignComposerQuota.d.ts +26 -0
  192. package/lib/types/client/opendesign/OpenDesignComposerQuota.d.ts.map +1 -0
  193. package/lib/types/client/opendesign/OpenDesignSection.d.ts +19 -0
  194. package/lib/types/client/opendesign/OpenDesignSection.d.ts.map +1 -0
  195. package/lib/types/client/opendesign/api.d.ts +45 -0
  196. package/lib/types/client/opendesign/api.d.ts.map +1 -0
  197. package/lib/types/client/opendesign/locales.d.ts +815 -0
  198. package/lib/types/client/opendesign/locales.d.ts.map +1 -0
  199. package/lib/types/client/opendesign/styles.d.ts +16 -0
  200. package/lib/types/client/opendesign/styles.d.ts.map +1 -0
  201. package/lib/types/client/qianwen-token-plan/QianwenComposerQuota.d.ts +14 -0
  202. package/lib/types/client/qianwen-token-plan/QianwenComposerQuota.d.ts.map +1 -0
  203. package/lib/types/client/qianwen-token-plan/QianwenTokenPlanSection.d.ts +4 -0
  204. package/lib/types/client/qianwen-token-plan/QianwenTokenPlanSection.d.ts.map +1 -0
  205. package/lib/types/client/qianwen-token-plan/api.d.ts +5 -0
  206. package/lib/types/client/qianwen-token-plan/api.d.ts.map +1 -0
  207. package/lib/types/client/qianwen-token-plan/locales.d.ts +158 -0
  208. package/lib/types/client/qianwen-token-plan/locales.d.ts.map +1 -0
  209. package/lib/types/client/qianwen-token-plan/styles.d.ts +3 -0
  210. package/lib/types/client/qianwen-token-plan/styles.d.ts.map +1 -0
  211. package/lib/types/client/qianwen-token-plan/useQianwenSection.d.ts +32 -0
  212. package/lib/types/client/qianwen-token-plan/useQianwenSection.d.ts.map +1 -0
  213. package/lib/types/client/qoder/QoderComposerQuota.d.ts +41 -0
  214. package/lib/types/client/qoder/QoderComposerQuota.d.ts.map +1 -0
  215. package/lib/types/client/qoder/QoderSection.d.ts +37 -0
  216. package/lib/types/client/qoder/QoderSection.d.ts.map +1 -0
  217. package/lib/types/client/qoder/api.d.ts +4 -0
  218. package/lib/types/client/qoder/api.d.ts.map +1 -0
  219. package/lib/types/client/qoder/locales.d.ts +322 -0
  220. package/lib/types/client/qoder/locales.d.ts.map +1 -0
  221. package/lib/types/client/qoder/styles.d.ts +16 -0
  222. package/lib/types/client/qoder/styles.d.ts.map +1 -0
  223. package/lib/types/client/qoder/useQoderSection.d.ts +97 -0
  224. package/lib/types/client/qoder/useQoderSection.d.ts.map +1 -0
  225. package/lib/types/client/quota.d.ts +9 -0
  226. package/lib/types/client/quota.d.ts.map +1 -0
  227. package/lib/types/client/relayone/RelayOneComposerQuota.d.ts +14 -0
  228. package/lib/types/client/relayone/RelayOneComposerQuota.d.ts.map +1 -0
  229. package/lib/types/client/relayone/RelayOneSection.d.ts +4 -0
  230. package/lib/types/client/relayone/RelayOneSection.d.ts.map +1 -0
  231. package/lib/types/client/relayone/api.d.ts +5 -0
  232. package/lib/types/client/relayone/api.d.ts.map +1 -0
  233. package/lib/types/client/relayone/locales.d.ts +221 -0
  234. package/lib/types/client/relayone/locales.d.ts.map +1 -0
  235. package/lib/types/client/relayone/quota-format.d.ts +6 -0
  236. package/lib/types/client/relayone/quota-format.d.ts.map +1 -0
  237. package/lib/types/client/relayone/styles.d.ts +3 -0
  238. package/lib/types/client/relayone/styles.d.ts.map +1 -0
  239. package/lib/types/client/relayone/useRelayOneSection.d.ts +32 -0
  240. package/lib/types/client/relayone/useRelayOneSection.d.ts.map +1 -0
  241. package/lib/types/client/step-code/StepCodeComposerQuota.d.ts +50 -0
  242. package/lib/types/client/step-code/StepCodeComposerQuota.d.ts.map +1 -0
  243. package/lib/types/client/step-code/StepCodeSection.d.ts +28 -0
  244. package/lib/types/client/step-code/StepCodeSection.d.ts.map +1 -0
  245. package/lib/types/client/step-code/api.d.ts +4 -0
  246. package/lib/types/client/step-code/api.d.ts.map +1 -0
  247. package/lib/types/client/step-code/locales.d.ts +657 -0
  248. package/lib/types/client/step-code/locales.d.ts.map +1 -0
  249. package/lib/types/client/step-code/styles.d.ts +28 -0
  250. package/lib/types/client/step-code/styles.d.ts.map +1 -0
  251. package/lib/types/client/step-code/useStepCodeSection.d.ts +122 -0
  252. package/lib/types/client/step-code/useStepCodeSection.d.ts.map +1 -0
  253. package/lib/types/client/store.d.ts +19 -0
  254. package/lib/types/client/store.d.ts.map +1 -0
  255. package/lib/types/client/styles.d.ts +26 -0
  256. package/lib/types/client/styles.d.ts.map +1 -0
  257. package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts +34 -0
  258. package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts.map +1 -0
  259. package/lib/types/client/workbuddy/WorkBuddySection.d.ts +91 -0
  260. package/lib/types/client/workbuddy/WorkBuddySection.d.ts.map +1 -0
  261. package/lib/types/client/workbuddy/locales.d.ts +768 -0
  262. package/lib/types/client/workbuddy/locales.d.ts.map +1 -0
  263. package/lib/types/client/workbuddy/styles.d.ts +21 -0
  264. package/lib/types/client/workbuddy/styles.d.ts.map +1 -0
  265. package/lib/types/client/workbuddy/useWorkBuddySection.d.ts +149 -0
  266. package/lib/types/client/workbuddy/useWorkBuddySection.d.ts.map +1 -0
  267. package/lib/types/compat.d.ts +139 -0
  268. package/lib/types/compat.d.ts.map +1 -0
  269. package/lib/types/host/adapter.d.ts +43 -0
  270. package/lib/types/host/adapter.d.ts.map +1 -0
  271. package/lib/types/host/callback-server.d.ts +22 -0
  272. package/lib/types/host/callback-server.d.ts.map +1 -0
  273. package/lib/types/host/claude/account-pool.d.ts +583 -0
  274. package/lib/types/host/claude/account-pool.d.ts.map +1 -0
  275. package/lib/types/host/claude/adapter.d.ts +424 -0
  276. package/lib/types/host/claude/adapter.d.ts.map +1 -0
  277. package/lib/types/host/claude/adopt.d.ts +292 -0
  278. package/lib/types/host/claude/adopt.d.ts.map +1 -0
  279. package/lib/types/host/claude/client.d.ts +579 -0
  280. package/lib/types/host/claude/client.d.ts.map +1 -0
  281. package/lib/types/host/claude/mapper.d.ts +802 -0
  282. package/lib/types/host/claude/mapper.d.ts.map +1 -0
  283. package/lib/types/host/claude/model-catalog.d.ts +560 -0
  284. package/lib/types/host/claude/model-catalog.d.ts.map +1 -0
  285. package/lib/types/host/claude/oauth.d.ts +419 -0
  286. package/lib/types/host/claude/oauth.d.ts.map +1 -0
  287. package/lib/types/host/claude/routes.d.ts +131 -0
  288. package/lib/types/host/claude/routes.d.ts.map +1 -0
  289. package/lib/types/host/claude/token-store.d.ts +347 -0
  290. package/lib/types/host/claude/token-store.d.ts.map +1 -0
  291. package/lib/types/host/claude/types.d.ts +417 -0
  292. package/lib/types/host/claude/types.d.ts.map +1 -0
  293. package/lib/types/host/claude-api/adapter.d.ts +70 -0
  294. package/lib/types/host/claude-api/adapter.d.ts.map +1 -0
  295. package/lib/types/host/claude-api/capability-memory.d.ts +4 -0
  296. package/lib/types/host/claude-api/capability-memory.d.ts.map +1 -0
  297. package/lib/types/host/claude-api/catalog-manager.d.ts +57 -0
  298. package/lib/types/host/claude-api/catalog-manager.d.ts.map +1 -0
  299. package/lib/types/host/claude-api/client-version.d.ts +4 -0
  300. package/lib/types/host/claude-api/client-version.d.ts.map +1 -0
  301. package/lib/types/host/claude-api/client.d.ts +55 -0
  302. package/lib/types/host/claude-api/client.d.ts.map +1 -0
  303. package/lib/types/host/claude-api/compaction-instruction.d.ts +23 -0
  304. package/lib/types/host/claude-api/compaction-instruction.d.ts.map +1 -0
  305. package/lib/types/host/claude-api/compaction-store.d.ts +62 -0
  306. package/lib/types/host/claude-api/compaction-store.d.ts.map +1 -0
  307. package/lib/types/host/claude-api/compaction.d.ts +47 -0
  308. package/lib/types/host/claude-api/compaction.d.ts.map +1 -0
  309. package/lib/types/host/claude-api/mapper.d.ts +61 -0
  310. package/lib/types/host/claude-api/mapper.d.ts.map +1 -0
  311. package/lib/types/host/claude-api/model-catalog.d.ts +76 -0
  312. package/lib/types/host/claude-api/model-catalog.d.ts.map +1 -0
  313. package/lib/types/host/claude-api/routes.d.ts +22 -0
  314. package/lib/types/host/claude-api/routes.d.ts.map +1 -0
  315. package/lib/types/host/claude-api/stream.d.ts +88 -0
  316. package/lib/types/host/claude-api/stream.d.ts.map +1 -0
  317. package/lib/types/host/claude-api/token-store.d.ts +60 -0
  318. package/lib/types/host/claude-api/token-store.d.ts.map +1 -0
  319. package/lib/types/host/claude-api/types.d.ts +68 -0
  320. package/lib/types/host/claude-api/types.d.ts.map +1 -0
  321. package/lib/types/host/cline-pass/account-pool.d.ts +63 -0
  322. package/lib/types/host/cline-pass/account-pool.d.ts.map +1 -0
  323. package/lib/types/host/cline-pass/adapter.d.ts +60 -0
  324. package/lib/types/host/cline-pass/adapter.d.ts.map +1 -0
  325. package/lib/types/host/cline-pass/catalog.d.ts +49 -0
  326. package/lib/types/host/cline-pass/catalog.d.ts.map +1 -0
  327. package/lib/types/host/cline-pass/client.d.ts +109 -0
  328. package/lib/types/host/cline-pass/client.d.ts.map +1 -0
  329. package/lib/types/host/cline-pass/engine.d.ts +93 -0
  330. package/lib/types/host/cline-pass/engine.d.ts.map +1 -0
  331. package/lib/types/host/cline-pass/line.d.ts +55 -0
  332. package/lib/types/host/cline-pass/line.d.ts.map +1 -0
  333. package/lib/types/host/cline-pass/mapper.d.ts +138 -0
  334. package/lib/types/host/cline-pass/mapper.d.ts.map +1 -0
  335. package/lib/types/host/cline-pass/oauth.d.ts +134 -0
  336. package/lib/types/host/cline-pass/oauth.d.ts.map +1 -0
  337. package/lib/types/host/cline-pass/protocol.d.ts +44 -0
  338. package/lib/types/host/cline-pass/protocol.d.ts.map +1 -0
  339. package/lib/types/host/cline-pass/routes.d.ts +92 -0
  340. package/lib/types/host/cline-pass/routes.d.ts.map +1 -0
  341. package/lib/types/host/cline-pass/store.d.ts +75 -0
  342. package/lib/types/host/cline-pass/store.d.ts.map +1 -0
  343. package/lib/types/host/cline-pass/token-store.d.ts +170 -0
  344. package/lib/types/host/cline-pass/token-store.d.ts.map +1 -0
  345. package/lib/types/host/cline-pass/tools.d.ts +21 -0
  346. package/lib/types/host/cline-pass/tools.d.ts.map +1 -0
  347. package/lib/types/host/cline-pass/types.d.ts +127 -0
  348. package/lib/types/host/cline-pass/types.d.ts.map +1 -0
  349. package/lib/types/host/codex-account-pool.d.ts +223 -0
  350. package/lib/types/host/codex-account-pool.d.ts.map +1 -0
  351. package/lib/types/host/codex-adopt.d.ts +255 -0
  352. package/lib/types/host/codex-adopt.d.ts.map +1 -0
  353. package/lib/types/host/codex-catalog.d.ts +69 -0
  354. package/lib/types/host/codex-catalog.d.ts.map +1 -0
  355. package/lib/types/host/codex-fetch.d.ts +17 -0
  356. package/lib/types/host/codex-fetch.d.ts.map +1 -0
  357. package/lib/types/host/codex-file-import.d.ts +35 -0
  358. package/lib/types/host/codex-file-import.d.ts.map +1 -0
  359. package/lib/types/host/codex-identity.d.ts +132 -0
  360. package/lib/types/host/codex-identity.d.ts.map +1 -0
  361. package/lib/types/host/codex-remote-compaction.d.ts +41 -0
  362. package/lib/types/host/codex-remote-compaction.d.ts.map +1 -0
  363. package/lib/types/host/codex-search.d.ts +11 -0
  364. package/lib/types/host/codex-search.d.ts.map +1 -0
  365. package/lib/types/host/command-code/account-pool.d.ts +72 -0
  366. package/lib/types/host/command-code/account-pool.d.ts.map +1 -0
  367. package/lib/types/host/command-code/adapter.d.ts +89 -0
  368. package/lib/types/host/command-code/adapter.d.ts.map +1 -0
  369. package/lib/types/host/command-code/client.d.ts +126 -0
  370. package/lib/types/host/command-code/client.d.ts.map +1 -0
  371. package/lib/types/host/command-code/mapper.d.ts +199 -0
  372. package/lib/types/host/command-code/mapper.d.ts.map +1 -0
  373. package/lib/types/host/command-code/model-catalog.d.ts +90 -0
  374. package/lib/types/host/command-code/model-catalog.d.ts.map +1 -0
  375. package/lib/types/host/command-code/oauth.d.ts +95 -0
  376. package/lib/types/host/command-code/oauth.d.ts.map +1 -0
  377. package/lib/types/host/command-code/plans.d.ts +40 -0
  378. package/lib/types/host/command-code/plans.d.ts.map +1 -0
  379. package/lib/types/host/command-code/routes.d.ts +44 -0
  380. package/lib/types/host/command-code/routes.d.ts.map +1 -0
  381. package/lib/types/host/command-code/token-store.d.ts +100 -0
  382. package/lib/types/host/command-code/token-store.d.ts.map +1 -0
  383. package/lib/types/host/command-code/types.d.ts +222 -0
  384. package/lib/types/host/command-code/types.d.ts.map +1 -0
  385. package/lib/types/host/common/account-pool.d.ts +584 -0
  386. package/lib/types/host/common/account-pool.d.ts.map +1 -0
  387. package/lib/types/host/common/account-quota.d.ts +44 -0
  388. package/lib/types/host/common/account-quota.d.ts.map +1 -0
  389. package/lib/types/host/common/brand-compat.d.ts +4 -0
  390. package/lib/types/host/common/brand-compat.d.ts.map +1 -0
  391. package/lib/types/host/common/cache-activity.d.ts +16 -0
  392. package/lib/types/host/common/cache-activity.d.ts.map +1 -0
  393. package/lib/types/host/common/cache-affinity.d.ts +23 -0
  394. package/lib/types/host/common/cache-affinity.d.ts.map +1 -0
  395. package/lib/types/host/common/cache-hint.d.ts +18 -0
  396. package/lib/types/host/common/cache-hint.d.ts.map +1 -0
  397. package/lib/types/host/common/capabilities.d.ts +100 -0
  398. package/lib/types/host/common/capabilities.d.ts.map +1 -0
  399. package/lib/types/host/common/catalog-snapshot.d.ts +80 -0
  400. package/lib/types/host/common/catalog-snapshot.d.ts.map +1 -0
  401. package/lib/types/host/common/claude-capability-memory.d.ts +51 -0
  402. package/lib/types/host/common/claude-capability-memory.d.ts.map +1 -0
  403. package/lib/types/host/common/claude-code-cch.d.ts +28 -0
  404. package/lib/types/host/common/claude-code-cch.d.ts.map +1 -0
  405. package/lib/types/host/common/claude-code-corrections.d.ts +6 -0
  406. package/lib/types/host/common/claude-code-corrections.d.ts.map +1 -0
  407. package/lib/types/host/common/claude-code-first-party.d.ts +68 -0
  408. package/lib/types/host/common/claude-code-first-party.d.ts.map +1 -0
  409. package/lib/types/host/common/claude-code-version.d.ts +90 -0
  410. package/lib/types/host/common/claude-code-version.d.ts.map +1 -0
  411. package/lib/types/host/common/concurrency-gate.d.ts +46 -0
  412. package/lib/types/host/common/concurrency-gate.d.ts.map +1 -0
  413. package/lib/types/host/common/context-budget-fetch.d.ts +7 -0
  414. package/lib/types/host/common/context-budget-fetch.d.ts.map +1 -0
  415. package/lib/types/host/common/context-overflow.d.ts +7 -0
  416. package/lib/types/host/common/context-overflow.d.ts.map +1 -0
  417. package/lib/types/host/common/context-window-overrides.d.ts +12 -0
  418. package/lib/types/host/common/context-window-overrides.d.ts.map +1 -0
  419. package/lib/types/host/common/credential-read-cache.d.ts +82 -0
  420. package/lib/types/host/common/credential-read-cache.d.ts.map +1 -0
  421. package/lib/types/host/common/credentials-compat.d.ts +73 -0
  422. package/lib/types/host/common/credentials-compat.d.ts.map +1 -0
  423. package/lib/types/host/common/failure-classification.d.ts +21 -0
  424. package/lib/types/host/common/failure-classification.d.ts.map +1 -0
  425. package/lib/types/host/common/file-preferences.d.ts +49 -0
  426. package/lib/types/host/common/file-preferences.d.ts.map +1 -0
  427. package/lib/types/host/common/gpt-engineering-guidance.d.ts +16 -0
  428. package/lib/types/host/common/gpt-engineering-guidance.d.ts.map +1 -0
  429. package/lib/types/host/common/home.d.ts +8 -0
  430. package/lib/types/host/common/home.d.ts.map +1 -0
  431. package/lib/types/host/common/hosted-media.d.ts +36 -0
  432. package/lib/types/host/common/hosted-media.d.ts.map +1 -0
  433. package/lib/types/host/common/i18n/en.d.ts +9 -0
  434. package/lib/types/host/common/i18n/en.d.ts.map +1 -0
  435. package/lib/types/host/common/i18n/index.d.ts +13 -0
  436. package/lib/types/host/common/i18n/index.d.ts.map +1 -0
  437. package/lib/types/host/common/i18n/provider-name.d.ts +10 -0
  438. package/lib/types/host/common/i18n/provider-name.d.ts.map +1 -0
  439. package/lib/types/host/common/i18n/ru.d.ts +10 -0
  440. package/lib/types/host/common/i18n/ru.d.ts.map +1 -0
  441. package/lib/types/host/common/i18n/runtime.d.ts +54 -0
  442. package/lib/types/host/common/i18n/runtime.d.ts.map +1 -0
  443. package/lib/types/host/common/i18n/t.d.ts +38 -0
  444. package/lib/types/host/common/i18n/t.d.ts.map +1 -0
  445. package/lib/types/host/common/i18n/zh.d.ts +172 -0
  446. package/lib/types/host/common/i18n/zh.d.ts.map +1 -0
  447. package/lib/types/host/common/idle-watchdog.d.ts +58 -0
  448. package/lib/types/host/common/idle-watchdog.d.ts.map +1 -0
  449. package/lib/types/host/common/legacy-preferences.d.ts +29 -0
  450. package/lib/types/host/common/legacy-preferences.d.ts.map +1 -0
  451. package/lib/types/host/common/llm-compat.d.ts +157 -0
  452. package/lib/types/host/common/llm-compat.d.ts.map +1 -0
  453. package/lib/types/host/common/model-request-control.d.ts +21 -0
  454. package/lib/types/host/common/model-request-control.d.ts.map +1 -0
  455. package/lib/types/host/common/orphan-tool-calls.d.ts +47 -0
  456. package/lib/types/host/common/orphan-tool-calls.d.ts.map +1 -0
  457. package/lib/types/host/common/output-reservation.d.ts +11 -0
  458. package/lib/types/host/common/output-reservation.d.ts.map +1 -0
  459. package/lib/types/host/common/pool-storage-settings.d.ts +41 -0
  460. package/lib/types/host/common/pool-storage-settings.d.ts.map +1 -0
  461. package/lib/types/host/common/pool-storage.d.ts +143 -0
  462. package/lib/types/host/common/pool-storage.d.ts.map +1 -0
  463. package/lib/types/host/common/prefix-request-coordinator.d.ts +46 -0
  464. package/lib/types/host/common/prefix-request-coordinator.d.ts.map +1 -0
  465. package/lib/types/host/common/prefix-stability.d.ts +24 -0
  466. package/lib/types/host/common/prefix-stability.d.ts.map +1 -0
  467. package/lib/types/host/common/prompt-cache-policy.d.ts +47 -0
  468. package/lib/types/host/common/prompt-cache-policy.d.ts.map +1 -0
  469. package/lib/types/host/common/prompt-estimate.d.ts +22 -0
  470. package/lib/types/host/common/prompt-estimate.d.ts.map +1 -0
  471. package/lib/types/host/common/provider-route.d.ts +56 -0
  472. package/lib/types/host/common/provider-route.d.ts.map +1 -0
  473. package/lib/types/host/common/quota-refresh.d.ts +35 -0
  474. package/lib/types/host/common/quota-refresh.d.ts.map +1 -0
  475. package/lib/types/host/common/reasoning-dialect.d.ts +24 -0
  476. package/lib/types/host/common/reasoning-dialect.d.ts.map +1 -0
  477. package/lib/types/host/common/reasoning-efforts.d.ts +2 -0
  478. package/lib/types/host/common/reasoning-efforts.d.ts.map +1 -0
  479. package/lib/types/host/common/request-diagnostics.d.ts +79 -0
  480. package/lib/types/host/common/request-diagnostics.d.ts.map +1 -0
  481. package/lib/types/host/common/request-images.d.ts +275 -0
  482. package/lib/types/host/common/request-images.d.ts.map +1 -0
  483. package/lib/types/host/common/same-origin.d.ts +30 -0
  484. package/lib/types/host/common/same-origin.d.ts.map +1 -0
  485. package/lib/types/host/common/session-cache-state.d.ts +29 -0
  486. package/lib/types/host/common/session-cache-state.d.ts.map +1 -0
  487. package/lib/types/host/common/session-effort-memory.d.ts +35 -0
  488. package/lib/types/host/common/session-effort-memory.d.ts.map +1 -0
  489. package/lib/types/host/common/settings-compat.d.ts +55 -0
  490. package/lib/types/host/common/settings-compat.d.ts.map +1 -0
  491. package/lib/types/host/common/sticky-image-budget.d.ts +10 -0
  492. package/lib/types/host/common/sticky-image-budget.d.ts.map +1 -0
  493. package/lib/types/host/common/stream-error.d.ts +93 -0
  494. package/lib/types/host/common/stream-error.d.ts.map +1 -0
  495. package/lib/types/host/common/tool-schema.d.ts +27 -0
  496. package/lib/types/host/common/tool-schema.d.ts.map +1 -0
  497. package/lib/types/host/common/video-request.d.ts +81 -0
  498. package/lib/types/host/common/video-request.d.ts.map +1 -0
  499. package/lib/types/host/common/video.d.ts +90 -0
  500. package/lib/types/host/common/video.d.ts.map +1 -0
  501. package/lib/types/host/common/webserver-compat.d.ts +7 -0
  502. package/lib/types/host/common/webserver-compat.d.ts.map +1 -0
  503. package/lib/types/host/credential-store-secret-service.d.ts +66 -0
  504. package/lib/types/host/credential-store-secret-service.d.ts.map +1 -0
  505. package/lib/types/host/fetch-address-policy.d.ts +79 -0
  506. package/lib/types/host/fetch-address-policy.d.ts.map +1 -0
  507. package/lib/types/host/fetch-configuration.d.ts +6 -0
  508. package/lib/types/host/fetch-configuration.d.ts.map +1 -0
  509. package/lib/types/host/glm-coding-plan/account-pool.d.ts +152 -0
  510. package/lib/types/host/glm-coding-plan/account-pool.d.ts.map +1 -0
  511. package/lib/types/host/glm-coding-plan/adapter.d.ts +169 -0
  512. package/lib/types/host/glm-coding-plan/adapter.d.ts.map +1 -0
  513. package/lib/types/host/glm-coding-plan/adopt.d.ts +354 -0
  514. package/lib/types/host/glm-coding-plan/adopt.d.ts.map +1 -0
  515. package/lib/types/host/glm-coding-plan/biz-token-cache.d.ts +99 -0
  516. package/lib/types/host/glm-coding-plan/biz-token-cache.d.ts.map +1 -0
  517. package/lib/types/host/glm-coding-plan/client.d.ts +218 -0
  518. package/lib/types/host/glm-coding-plan/client.d.ts.map +1 -0
  519. package/lib/types/host/glm-coding-plan/exchange.d.ts +223 -0
  520. package/lib/types/host/glm-coding-plan/exchange.d.ts.map +1 -0
  521. package/lib/types/host/glm-coding-plan/mapper-anthropic.d.ts +312 -0
  522. package/lib/types/host/glm-coding-plan/mapper-anthropic.d.ts.map +1 -0
  523. package/lib/types/host/glm-coding-plan/mapper-openai.d.ts +213 -0
  524. package/lib/types/host/glm-coding-plan/mapper-openai.d.ts.map +1 -0
  525. package/lib/types/host/glm-coding-plan/model-catalog.d.ts +241 -0
  526. package/lib/types/host/glm-coding-plan/model-catalog.d.ts.map +1 -0
  527. package/lib/types/host/glm-coding-plan/oauth.d.ts +211 -0
  528. package/lib/types/host/glm-coding-plan/oauth.d.ts.map +1 -0
  529. package/lib/types/host/glm-coding-plan/routes.d.ts +93 -0
  530. package/lib/types/host/glm-coding-plan/routes.d.ts.map +1 -0
  531. package/lib/types/host/glm-coding-plan/token-store.d.ts +202 -0
  532. package/lib/types/host/glm-coding-plan/token-store.d.ts.map +1 -0
  533. package/lib/types/host/glm-coding-plan/types.d.ts +492 -0
  534. package/lib/types/host/glm-coding-plan/types.d.ts.map +1 -0
  535. package/lib/types/host/hub-overview.d.ts +32 -0
  536. package/lib/types/host/hub-overview.d.ts.map +1 -0
  537. package/lib/types/host/kimi-code/account-pool.d.ts +124 -0
  538. package/lib/types/host/kimi-code/account-pool.d.ts.map +1 -0
  539. package/lib/types/host/kimi-code/adapter.d.ts +451 -0
  540. package/lib/types/host/kimi-code/adapter.d.ts.map +1 -0
  541. package/lib/types/host/kimi-code/api-key.d.ts +55 -0
  542. package/lib/types/host/kimi-code/api-key.d.ts.map +1 -0
  543. package/lib/types/host/kimi-code/cache-affinity.d.ts +112 -0
  544. package/lib/types/host/kimi-code/cache-affinity.d.ts.map +1 -0
  545. package/lib/types/host/kimi-code/cache-hint.d.ts +65 -0
  546. package/lib/types/host/kimi-code/cache-hint.d.ts.map +1 -0
  547. package/lib/types/host/kimi-code/client.d.ts +306 -0
  548. package/lib/types/host/kimi-code/client.d.ts.map +1 -0
  549. package/lib/types/host/kimi-code/mapper.d.ts +913 -0
  550. package/lib/types/host/kimi-code/mapper.d.ts.map +1 -0
  551. package/lib/types/host/kimi-code/media-files.d.ts +206 -0
  552. package/lib/types/host/kimi-code/media-files.d.ts.map +1 -0
  553. package/lib/types/host/kimi-code/modalities.d.ts +23 -0
  554. package/lib/types/host/kimi-code/modalities.d.ts.map +1 -0
  555. package/lib/types/host/kimi-code/model-catalog.d.ts +125 -0
  556. package/lib/types/host/kimi-code/model-catalog.d.ts.map +1 -0
  557. package/lib/types/host/kimi-code/oauth.d.ts +213 -0
  558. package/lib/types/host/kimi-code/oauth.d.ts.map +1 -0
  559. package/lib/types/host/kimi-code/routes.d.ts +52 -0
  560. package/lib/types/host/kimi-code/routes.d.ts.map +1 -0
  561. package/lib/types/host/kimi-code/session-cache-state.d.ts +156 -0
  562. package/lib/types/host/kimi-code/session-cache-state.d.ts.map +1 -0
  563. package/lib/types/host/kimi-code/token-store.d.ts +182 -0
  564. package/lib/types/host/kimi-code/token-store.d.ts.map +1 -0
  565. package/lib/types/host/kimi-code/tool-argument-guard.d.ts +43 -0
  566. package/lib/types/host/kimi-code/tool-argument-guard.d.ts.map +1 -0
  567. package/lib/types/host/kimi-code/types.d.ts +458 -0
  568. package/lib/types/host/kimi-code/types.d.ts.map +1 -0
  569. package/lib/types/host/kimi-code/warmup-streak.d.ts +66 -0
  570. package/lib/types/host/kimi-code/warmup-streak.d.ts.map +1 -0
  571. package/lib/types/host/minimax-code/account-pool.d.ts +309 -0
  572. package/lib/types/host/minimax-code/account-pool.d.ts.map +1 -0
  573. package/lib/types/host/minimax-code/adapter.d.ts +207 -0
  574. package/lib/types/host/minimax-code/adapter.d.ts.map +1 -0
  575. package/lib/types/host/minimax-code/checkin-gateway.d.ts +145 -0
  576. package/lib/types/host/minimax-code/checkin-gateway.d.ts.map +1 -0
  577. package/lib/types/host/minimax-code/checkin.d.ts +207 -0
  578. package/lib/types/host/minimax-code/checkin.d.ts.map +1 -0
  579. package/lib/types/host/minimax-code/client.d.ts +242 -0
  580. package/lib/types/host/minimax-code/client.d.ts.map +1 -0
  581. package/lib/types/host/minimax-code/files-api.d.ts +117 -0
  582. package/lib/types/host/minimax-code/files-api.d.ts.map +1 -0
  583. package/lib/types/host/minimax-code/iso-bmff-duration.d.ts +84 -0
  584. package/lib/types/host/minimax-code/iso-bmff-duration.d.ts.map +1 -0
  585. package/lib/types/host/minimax-code/mapper.d.ts +351 -0
  586. package/lib/types/host/minimax-code/mapper.d.ts.map +1 -0
  587. package/lib/types/host/minimax-code/matrix-client.d.ts +168 -0
  588. package/lib/types/host/minimax-code/matrix-client.d.ts.map +1 -0
  589. package/lib/types/host/minimax-code/modalities.d.ts +20 -0
  590. package/lib/types/host/minimax-code/modalities.d.ts.map +1 -0
  591. package/lib/types/host/minimax-code/model-catalog.d.ts +227 -0
  592. package/lib/types/host/minimax-code/model-catalog.d.ts.map +1 -0
  593. package/lib/types/host/minimax-code/oauth.d.ts +220 -0
  594. package/lib/types/host/minimax-code/oauth.d.ts.map +1 -0
  595. package/lib/types/host/minimax-code/reset-card.d.ts +136 -0
  596. package/lib/types/host/minimax-code/reset-card.d.ts.map +1 -0
  597. package/lib/types/host/minimax-code/routes.d.ts +82 -0
  598. package/lib/types/host/minimax-code/routes.d.ts.map +1 -0
  599. package/lib/types/host/minimax-code/token-store.d.ts +328 -0
  600. package/lib/types/host/minimax-code/token-store.d.ts.map +1 -0
  601. package/lib/types/host/minimax-code/tool-argument-repair.d.ts +72 -0
  602. package/lib/types/host/minimax-code/tool-argument-repair.d.ts.map +1 -0
  603. package/lib/types/host/minimax-code/types.d.ts +378 -0
  604. package/lib/types/host/minimax-code/types.d.ts.map +1 -0
  605. package/lib/types/host/model-catalog.d.ts +43 -0
  606. package/lib/types/host/model-catalog.d.ts.map +1 -0
  607. package/lib/types/host/oauth-service.d.ts +242 -0
  608. package/lib/types/host/oauth-service.d.ts.map +1 -0
  609. package/lib/types/host/ollama/account-pool.d.ts +65 -0
  610. package/lib/types/host/ollama/account-pool.d.ts.map +1 -0
  611. package/lib/types/host/ollama/adapter.d.ts +90 -0
  612. package/lib/types/host/ollama/adapter.d.ts.map +1 -0
  613. package/lib/types/host/ollama/client.d.ts +166 -0
  614. package/lib/types/host/ollama/client.d.ts.map +1 -0
  615. package/lib/types/host/ollama/mapper.d.ts +49 -0
  616. package/lib/types/host/ollama/mapper.d.ts.map +1 -0
  617. package/lib/types/host/ollama/routes.d.ts +22 -0
  618. package/lib/types/host/ollama/routes.d.ts.map +1 -0
  619. package/lib/types/host/ollama/token-store.d.ts +78 -0
  620. package/lib/types/host/ollama/token-store.d.ts.map +1 -0
  621. package/lib/types/host/ollama/types.d.ts +247 -0
  622. package/lib/types/host/ollama/types.d.ts.map +1 -0
  623. package/lib/types/host/opencode-go/account-pool.d.ts +50 -0
  624. package/lib/types/host/opencode-go/account-pool.d.ts.map +1 -0
  625. package/lib/types/host/opencode-go/adapter.d.ts +38 -0
  626. package/lib/types/host/opencode-go/adapter.d.ts.map +1 -0
  627. package/lib/types/host/opencode-go/client.d.ts +13 -0
  628. package/lib/types/host/opencode-go/client.d.ts.map +1 -0
  629. package/lib/types/host/opencode-go/mapper-gemini.d.ts +13 -0
  630. package/lib/types/host/opencode-go/mapper-gemini.d.ts.map +1 -0
  631. package/lib/types/host/opencode-go/mapper-messages.d.ts +8 -0
  632. package/lib/types/host/opencode-go/mapper-messages.d.ts.map +1 -0
  633. package/lib/types/host/opencode-go/mapper-responses.d.ts +9 -0
  634. package/lib/types/host/opencode-go/mapper-responses.d.ts.map +1 -0
  635. package/lib/types/host/opencode-go/mapper.d.ts +38 -0
  636. package/lib/types/host/opencode-go/mapper.d.ts.map +1 -0
  637. package/lib/types/host/opencode-go/model-catalog.d.ts +57 -0
  638. package/lib/types/host/opencode-go/model-catalog.d.ts.map +1 -0
  639. package/lib/types/host/opencode-go/native-shared.d.ts +31 -0
  640. package/lib/types/host/opencode-go/native-shared.d.ts.map +1 -0
  641. package/lib/types/host/opencode-go/protocol.d.ts +13 -0
  642. package/lib/types/host/opencode-go/protocol.d.ts.map +1 -0
  643. package/lib/types/host/opencode-go/routes.d.ts +13 -0
  644. package/lib/types/host/opencode-go/routes.d.ts.map +1 -0
  645. package/lib/types/host/opencode-go/token-store.d.ts +29 -0
  646. package/lib/types/host/opencode-go/token-store.d.ts.map +1 -0
  647. package/lib/types/host/opencode-go/types.d.ts +20 -0
  648. package/lib/types/host/opencode-go/types.d.ts.map +1 -0
  649. package/lib/types/host/opendesign/account-pool.d.ts +54 -0
  650. package/lib/types/host/opendesign/account-pool.d.ts.map +1 -0
  651. package/lib/types/host/opendesign/adapter.d.ts +88 -0
  652. package/lib/types/host/opendesign/adapter.d.ts.map +1 -0
  653. package/lib/types/host/opendesign/catalog.d.ts +58 -0
  654. package/lib/types/host/opendesign/catalog.d.ts.map +1 -0
  655. package/lib/types/host/opendesign/client.d.ts +304 -0
  656. package/lib/types/host/opendesign/client.d.ts.map +1 -0
  657. package/lib/types/host/opendesign/line.d.ts +60 -0
  658. package/lib/types/host/opendesign/line.d.ts.map +1 -0
  659. package/lib/types/host/opendesign/mapper.d.ts +218 -0
  660. package/lib/types/host/opendesign/mapper.d.ts.map +1 -0
  661. package/lib/types/host/opendesign/oauth.d.ts +105 -0
  662. package/lib/types/host/opendesign/oauth.d.ts.map +1 -0
  663. package/lib/types/host/opendesign/routes.d.ts +75 -0
  664. package/lib/types/host/opendesign/routes.d.ts.map +1 -0
  665. package/lib/types/host/opendesign/token-store.d.ts +241 -0
  666. package/lib/types/host/opendesign/token-store.d.ts.map +1 -0
  667. package/lib/types/host/opendesign/types.d.ts +235 -0
  668. package/lib/types/host/opendesign/types.d.ts.map +1 -0
  669. package/lib/types/host/platform-token-store.d.ts +3 -0
  670. package/lib/types/host/platform-token-store.d.ts.map +1 -0
  671. package/lib/types/host/preferences.d.ts +26 -0
  672. package/lib/types/host/preferences.d.ts.map +1 -0
  673. package/lib/types/host/proxy-manager.d.ts +261 -0
  674. package/lib/types/host/proxy-manager.d.ts.map +1 -0
  675. package/lib/types/host/qianwen-token-plan/adapter.d.ts +37 -0
  676. package/lib/types/host/qianwen-token-plan/adapter.d.ts.map +1 -0
  677. package/lib/types/host/qianwen-token-plan/cache-stats.d.ts +17 -0
  678. package/lib/types/host/qianwen-token-plan/cache-stats.d.ts.map +1 -0
  679. package/lib/types/host/qianwen-token-plan/client.d.ts +5 -0
  680. package/lib/types/host/qianwen-token-plan/client.d.ts.map +1 -0
  681. package/lib/types/host/qianwen-token-plan/mapper.d.ts +71 -0
  682. package/lib/types/host/qianwen-token-plan/mapper.d.ts.map +1 -0
  683. package/lib/types/host/qianwen-token-plan/model-catalog.d.ts +28 -0
  684. package/lib/types/host/qianwen-token-plan/model-catalog.d.ts.map +1 -0
  685. package/lib/types/host/qianwen-token-plan/routes.d.ts +12 -0
  686. package/lib/types/host/qianwen-token-plan/routes.d.ts.map +1 -0
  687. package/lib/types/host/qianwen-token-plan/token-store.d.ts +56 -0
  688. package/lib/types/host/qianwen-token-plan/token-store.d.ts.map +1 -0
  689. package/lib/types/host/qianwen-token-plan/types.d.ts +13 -0
  690. package/lib/types/host/qianwen-token-plan/types.d.ts.map +1 -0
  691. package/lib/types/host/qoder/account-pool.d.ts +141 -0
  692. package/lib/types/host/qoder/account-pool.d.ts.map +1 -0
  693. package/lib/types/host/qoder/adapter.d.ts +167 -0
  694. package/lib/types/host/qoder/adapter.d.ts.map +1 -0
  695. package/lib/types/host/qoder/adopt.d.ts +146 -0
  696. package/lib/types/host/qoder/adopt.d.ts.map +1 -0
  697. package/lib/types/host/qoder/client.d.ts +323 -0
  698. package/lib/types/host/qoder/client.d.ts.map +1 -0
  699. package/lib/types/host/qoder/cosy.d.ts +173 -0
  700. package/lib/types/host/qoder/cosy.d.ts.map +1 -0
  701. package/lib/types/host/qoder/mapper.d.ts +332 -0
  702. package/lib/types/host/qoder/mapper.d.ts.map +1 -0
  703. package/lib/types/host/qoder/model-catalog.d.ts +231 -0
  704. package/lib/types/host/qoder/model-catalog.d.ts.map +1 -0
  705. package/lib/types/host/qoder/oauth.d.ts +151 -0
  706. package/lib/types/host/qoder/oauth.d.ts.map +1 -0
  707. package/lib/types/host/qoder/routes.d.ts +119 -0
  708. package/lib/types/host/qoder/routes.d.ts.map +1 -0
  709. package/lib/types/host/qoder/token-store.d.ts +280 -0
  710. package/lib/types/host/qoder/token-store.d.ts.map +1 -0
  711. package/lib/types/host/qoder/types.d.ts +262 -0
  712. package/lib/types/host/qoder/types.d.ts.map +1 -0
  713. package/lib/types/host/relayone/account-pool.d.ts +129 -0
  714. package/lib/types/host/relayone/account-pool.d.ts.map +1 -0
  715. package/lib/types/host/relayone/adapter.d.ts +87 -0
  716. package/lib/types/host/relayone/adapter.d.ts.map +1 -0
  717. package/lib/types/host/relayone/catalog-manager.d.ts +45 -0
  718. package/lib/types/host/relayone/catalog-manager.d.ts.map +1 -0
  719. package/lib/types/host/relayone/client.d.ts +5 -0
  720. package/lib/types/host/relayone/client.d.ts.map +1 -0
  721. package/lib/types/host/relayone/mapper-anthropic.d.ts +49 -0
  722. package/lib/types/host/relayone/mapper-anthropic.d.ts.map +1 -0
  723. package/lib/types/host/relayone/mapper-openai.d.ts +36 -0
  724. package/lib/types/host/relayone/mapper-openai.d.ts.map +1 -0
  725. package/lib/types/host/relayone/mapper-shared.d.ts +25 -0
  726. package/lib/types/host/relayone/mapper-shared.d.ts.map +1 -0
  727. package/lib/types/host/relayone/model-catalog.d.ts +70 -0
  728. package/lib/types/host/relayone/model-catalog.d.ts.map +1 -0
  729. package/lib/types/host/relayone/quota.d.ts +29 -0
  730. package/lib/types/host/relayone/quota.d.ts.map +1 -0
  731. package/lib/types/host/relayone/routes.d.ts +33 -0
  732. package/lib/types/host/relayone/routes.d.ts.map +1 -0
  733. package/lib/types/host/relayone/token-store.d.ts +49 -0
  734. package/lib/types/host/relayone/token-store.d.ts.map +1 -0
  735. package/lib/types/host/relayone/types.d.ts +22 -0
  736. package/lib/types/host/relayone/types.d.ts.map +1 -0
  737. package/lib/types/host/responses-client.d.ts +125 -0
  738. package/lib/types/host/responses-client.d.ts.map +1 -0
  739. package/lib/types/host/responses-mapper.d.ts +133 -0
  740. package/lib/types/host/responses-mapper.d.ts.map +1 -0
  741. package/lib/types/host/routes.d.ts +30 -0
  742. package/lib/types/host/routes.d.ts.map +1 -0
  743. package/lib/types/host/search-provider-switcher.d.ts +45 -0
  744. package/lib/types/host/search-provider-switcher.d.ts.map +1 -0
  745. package/lib/types/host/session-title-guard/index.d.ts +80 -0
  746. package/lib/types/host/session-title-guard/index.d.ts.map +1 -0
  747. package/lib/types/host/step-code/account-pool.d.ts +187 -0
  748. package/lib/types/host/step-code/account-pool.d.ts.map +1 -0
  749. package/lib/types/host/step-code/adapter.d.ts +156 -0
  750. package/lib/types/host/step-code/adapter.d.ts.map +1 -0
  751. package/lib/types/host/step-code/adopt.d.ts +201 -0
  752. package/lib/types/host/step-code/adopt.d.ts.map +1 -0
  753. package/lib/types/host/step-code/cache-stats.d.ts +181 -0
  754. package/lib/types/host/step-code/cache-stats.d.ts.map +1 -0
  755. package/lib/types/host/step-code/client.d.ts +339 -0
  756. package/lib/types/host/step-code/client.d.ts.map +1 -0
  757. package/lib/types/host/step-code/mapper.d.ts +305 -0
  758. package/lib/types/host/step-code/mapper.d.ts.map +1 -0
  759. package/lib/types/host/step-code/model-catalog.d.ts +247 -0
  760. package/lib/types/host/step-code/model-catalog.d.ts.map +1 -0
  761. package/lib/types/host/step-code/oauth.d.ts +265 -0
  762. package/lib/types/host/step-code/oauth.d.ts.map +1 -0
  763. package/lib/types/host/step-code/routes.d.ts +129 -0
  764. package/lib/types/host/step-code/routes.d.ts.map +1 -0
  765. package/lib/types/host/step-code/token-store.d.ts +325 -0
  766. package/lib/types/host/step-code/token-store.d.ts.map +1 -0
  767. package/lib/types/host/step-code/types.d.ts +492 -0
  768. package/lib/types/host/step-code/types.d.ts.map +1 -0
  769. package/lib/types/host/token-store-linux.d.ts +20 -0
  770. package/lib/types/host/token-store-linux.d.ts.map +1 -0
  771. package/lib/types/host/token-store-macos.d.ts +39 -0
  772. package/lib/types/host/token-store-macos.d.ts.map +1 -0
  773. package/lib/types/host/token-store-windows.d.ts +26 -0
  774. package/lib/types/host/token-store-windows.d.ts.map +1 -0
  775. package/lib/types/host/token-store.d.ts +81 -0
  776. package/lib/types/host/token-store.d.ts.map +1 -0
  777. package/lib/types/host/usage-service.d.ts +109 -0
  778. package/lib/types/host/usage-service.d.ts.map +1 -0
  779. package/lib/types/host/web-provider-reconciler.d.ts +34 -0
  780. package/lib/types/host/web-provider-reconciler.d.ts.map +1 -0
  781. package/lib/types/host/wire-auth.d.ts +63 -0
  782. package/lib/types/host/wire-auth.d.ts.map +1 -0
  783. package/lib/types/host/workbuddy/account-pool.d.ts +389 -0
  784. package/lib/types/host/workbuddy/account-pool.d.ts.map +1 -0
  785. package/lib/types/host/workbuddy/adapter.d.ts +248 -0
  786. package/lib/types/host/workbuddy/adapter.d.ts.map +1 -0
  787. package/lib/types/host/workbuddy/atrest.d.ts +98 -0
  788. package/lib/types/host/workbuddy/atrest.d.ts.map +1 -0
  789. package/lib/types/host/workbuddy/checkin.d.ts +150 -0
  790. package/lib/types/host/workbuddy/checkin.d.ts.map +1 -0
  791. package/lib/types/host/workbuddy/client.d.ts +214 -0
  792. package/lib/types/host/workbuddy/client.d.ts.map +1 -0
  793. package/lib/types/host/workbuddy/dsml.d.ts +55 -0
  794. package/lib/types/host/workbuddy/dsml.d.ts.map +1 -0
  795. package/lib/types/host/workbuddy/guardrails.d.ts +111 -0
  796. package/lib/types/host/workbuddy/guardrails.d.ts.map +1 -0
  797. package/lib/types/host/workbuddy/identity.d.ts +71 -0
  798. package/lib/types/host/workbuddy/identity.d.ts.map +1 -0
  799. package/lib/types/host/workbuddy/mapper.d.ts +238 -0
  800. package/lib/types/host/workbuddy/mapper.d.ts.map +1 -0
  801. package/lib/types/host/workbuddy/model-catalog.d.ts +239 -0
  802. package/lib/types/host/workbuddy/model-catalog.d.ts.map +1 -0
  803. package/lib/types/host/workbuddy/oauth.d.ts +47 -0
  804. package/lib/types/host/workbuddy/oauth.d.ts.map +1 -0
  805. package/lib/types/host/workbuddy/outbound-identity.d.ts +139 -0
  806. package/lib/types/host/workbuddy/outbound-identity.d.ts.map +1 -0
  807. package/lib/types/host/workbuddy/routes.d.ts +56 -0
  808. package/lib/types/host/workbuddy/routes.d.ts.map +1 -0
  809. package/lib/types/host/workbuddy/token-store.d.ts +370 -0
  810. package/lib/types/host/workbuddy/token-store.d.ts.map +1 -0
  811. package/lib/types/host/workbuddy/types.d.ts +185 -0
  812. package/lib/types/host/workbuddy/types.d.ts.map +1 -0
  813. package/lib/types/index.d.ts +248 -0
  814. package/lib/types/index.d.ts.map +1 -0
  815. package/lib/types/shared/account-pool-contracts.d.ts +99 -0
  816. package/lib/types/shared/account-pool-contracts.d.ts.map +1 -0
  817. package/lib/types/shared/claude-api-contracts.d.ts +98 -0
  818. package/lib/types/shared/claude-api-contracts.d.ts.map +1 -0
  819. package/lib/types/shared/claude-contracts.d.ts +370 -0
  820. package/lib/types/shared/claude-contracts.d.ts.map +1 -0
  821. package/lib/types/shared/cline-pass-contracts.d.ts +234 -0
  822. package/lib/types/shared/cline-pass-contracts.d.ts.map +1 -0
  823. package/lib/types/shared/command-code-contracts.d.ts +163 -0
  824. package/lib/types/shared/command-code-contracts.d.ts.map +1 -0
  825. package/lib/types/shared/contracts.d.ts +343 -0
  826. package/lib/types/shared/contracts.d.ts.map +1 -0
  827. package/lib/types/shared/glm-coding-plan-contracts.d.ts +315 -0
  828. package/lib/types/shared/glm-coding-plan-contracts.d.ts.map +1 -0
  829. package/lib/types/shared/hub-contracts.d.ts +37 -0
  830. package/lib/types/shared/hub-contracts.d.ts.map +1 -0
  831. package/lib/types/shared/i18n-contracts.d.ts +35 -0
  832. package/lib/types/shared/i18n-contracts.d.ts.map +1 -0
  833. package/lib/types/shared/kimi-code-contracts.d.ts +435 -0
  834. package/lib/types/shared/kimi-code-contracts.d.ts.map +1 -0
  835. package/lib/types/shared/minimax-code-contracts.d.ts +263 -0
  836. package/lib/types/shared/minimax-code-contracts.d.ts.map +1 -0
  837. package/lib/types/shared/model-catalog.d.ts +302 -0
  838. package/lib/types/shared/model-catalog.d.ts.map +1 -0
  839. package/lib/types/shared/ollama-contracts.d.ts +73 -0
  840. package/lib/types/shared/ollama-contracts.d.ts.map +1 -0
  841. package/lib/types/shared/opencode-go-contracts.d.ts +80 -0
  842. package/lib/types/shared/opencode-go-contracts.d.ts.map +1 -0
  843. package/lib/types/shared/opendesign-contracts.d.ts +262 -0
  844. package/lib/types/shared/opendesign-contracts.d.ts.map +1 -0
  845. package/lib/types/shared/preferences.d.ts +60 -0
  846. package/lib/types/shared/preferences.d.ts.map +1 -0
  847. package/lib/types/shared/qianwen-token-plan-contracts.d.ts +94 -0
  848. package/lib/types/shared/qianwen-token-plan-contracts.d.ts.map +1 -0
  849. package/lib/types/shared/qoder-contracts.d.ts +342 -0
  850. package/lib/types/shared/qoder-contracts.d.ts.map +1 -0
  851. package/lib/types/shared/relayone-contracts.d.ts +95 -0
  852. package/lib/types/shared/relayone-contracts.d.ts.map +1 -0
  853. package/lib/types/shared/step-code-contracts.d.ts +443 -0
  854. package/lib/types/shared/step-code-contracts.d.ts.map +1 -0
  855. package/lib/types/shared/workbuddy-contracts.d.ts +531 -0
  856. package/lib/types/shared/workbuddy-contracts.d.ts.map +1 -0
  857. package/package.json +147 -4
@@ -0,0 +1,218 @@
1
+ /**
2
+ * GLM(ZCode 账号)线路的上游 I/O:模型目录、配额、订阅列表,外加凭据验活的转出。
3
+ *
4
+ * 本文件有两条互相矛盾、且**不可互相抄**的认证规则,写错任何一处都会得到一个看似合理的
5
+ * 401/鉴权失败,所以它们各自写在自己的函数上方:
6
+ *
7
+ * 1. **模型面**(目录拉取、Anthropic 面、OpenAI 面)用 `Authorization: Bearer {id.secret}`,
8
+ * Anthropic 面还要**成对**发 `x-api-key`。这两个请求头函数直接委托给
9
+ * `./mapper-anthropic.ts` 与 `./mapper-openai.ts` 的实现——它们才是发请求的路径,
10
+ * 在这里另写一份就等于给「认证头」留下第二处可以漂移的真相。
11
+ * 2. **配额 / 订阅面**用**裸 Key**,`authorization: <id>.<secret>`,**不加 `Bearer` 前缀**
12
+ * (逐字证据:`docs/bigmodel-coding-plan-usage-quota.md`,计划 §3.4;官方文档写明
13
+ * 加了 Bearer 会鉴权失败)。`test/glm-coding-plan-client.test.ts` 对此有回归断言。
14
+ *
15
+ * 配额解析的语义照 dsh-web 仓库 `packages/dsh-usage/src/core/adapters.ts` 的 `glmPlan()`
16
+ * 对齐(只读参考,没有复制代码),三条要点都是逐条照抄它的行为:
17
+ *
18
+ * - 上层信封要求 `success === true`,否则不解析;
19
+ * - `TIME_LIMIT` 是 MCP 请求上限,**不是套餐窗口**,跳过;
20
+ * - `unit` 用 `./types.ts` 的 `QUOTA_UNIT_WINDOW` 映射,**未知 unit 一律丢弃**,不发明窗口;
21
+ * - `TOKENS_LIMIT` 的比例取 `percentage`,`CREDIT_LIMIT` 取 `currentValue / usage` 的比例
22
+ * (两者都不成比例时才退回 `percentage`)。
23
+ */
24
+ import type { GlmQuotaSnapshotDto, GlmRegion } from '../../shared/glm-coding-plan-contracts.ts';
25
+ import { QUOTA_PATH, SUBSCRIPTION_PATH } from './types.ts';
26
+ import { modelsUrl } from './mapper-openai.ts';
27
+ import { verifyCodingPlanKey } from './exchange.ts';
28
+ import { catalogSize, isGlmModelId, listModelIds, modelsForRegion, type GlmModelEntry } from './model-catalog.ts';
29
+ export { listModelIds, catalogSize, modelsForRegion, isGlmModelId, verifyCodingPlanKey };
30
+ export type { GlmPlanProbe } from './exchange.ts';
31
+ /** 一次上游读的可调项。`fetchFn` / `signal` 供测试注入,`env` 让 `DSH_GLM_*` 覆盖在调用时生效。 */
32
+ export interface GlmRequestOptions {
33
+ fetchFn?: typeof fetch;
34
+ signal?: AbortSignal;
35
+ env?: NodeJS.ProcessEnv;
36
+ /** 单次请求超时;缺省走 `DISCOVERY_TIMEOUT_MS`。 */
37
+ timeoutMs?: number;
38
+ }
39
+ /**
40
+ * Anthropic 面的请求头(双头:`x-api-key` + `Authorization: Bearer`,同值)。
41
+ *
42
+ * **委托**给 `./mapper-anthropic.ts` 的 `glmAnthropicHeaders`,本文件不复制第二份。
43
+ * 目录拉取与探活都会用它,认证规则只有一处真相。
44
+ */
45
+ export declare function glmAnthropicProbeHeaders(codingPlanKey: string): Record<string, string>;
46
+ /**
47
+ * OpenAI 兼容面的请求头(只有 `Authorization: Bearer`,**没有** `x-api-key`)。
48
+ *
49
+ * **委托**给 `./mapper-openai.ts` 的 `glmOpenAiHeaders`:双头是 Anthropic 面的性质,
50
+ * 这里多发一个头不会更好,只会让复审误以为两面共用一套认证。
51
+ */
52
+ export declare function glmOpenAiProbeHeaders(codingPlanKey: string): Record<string, string>;
53
+ /**
54
+ * 配额 / 订阅面的请求头:**裸 Key,不加 `Bearer`**。
55
+ *
56
+ * 逐字证据:`docs/bigmodel-coding-plan-usage-quota.md`(计划 §3.4)——加了 Bearer 前缀会鉴权失败。
57
+ * 这与模型面正好相反,所以这里没有任何「兼容两种写法」的分支:
58
+ * 那种写法在上游表现为一次必然失败的请求,而失败原因(401)不会告诉你前缀多写了。
59
+ *
60
+ * @param codingPlanKey - 兑换链拼出的 `{apiKeyId}.{secretKey}`。空白即抛错,不发一个注定被拒的请求。
61
+ */
62
+ export declare function quotaRequestHeaders(codingPlanKey: string): Record<string, string>;
63
+ /**
64
+ * 配额 URL:`{business}{QUOTA_PATH}`。
65
+ *
66
+ * 走**业务面** host(国区 `bigmodel.cn` / 国际区 `api.z.ai`)而不是模型面:
67
+ * `./types.ts` 的 `businessHost()` 就是这条路的唯一出处。
68
+ *
69
+ * **未验证**:官方文档写「区域 host `https://api.z.ai` 或 `https://bigmodel.cn`,
70
+ * 国区亦可用 `open.bigmodel.cn`」,国区到底哪个是规范入口没有实测样本(计划 D9:无实机账号)。
71
+ * 本文件取 `businessHost()`,需要指向另一个部署时用 `DSH_GLM_*_BUSINESS_HOST` 覆盖。
72
+ */
73
+ export declare function quotaUrl(region: GlmRegion, env?: NodeJS.ProcessEnv): string;
74
+ /** 订阅列表 URL:`{business}{SUBSCRIPTION_PATH}`(套餐名 / 续费时刻)。 */
75
+ export declare function subscriptionUrl(region: GlmRegion, env?: NodeJS.ProcessEnv): string;
76
+ export { modelsUrl, QUOTA_PATH, SUBSCRIPTION_PATH };
77
+ /**
78
+ * 解析 `/api/coding/paas/v4/models` 的响应。
79
+ *
80
+ * 与随包目录合并的规则(照历史实现 `7e40fce:src/host/zhipu/client.ts` 的 `parseCatalogModels`):
81
+ * **目录里的能力声明永远是权威,实时列表只补它明确给出的那一个字段**——上下文窗口。
82
+ * 梯子、收不收图、可不可关思考、协议面这四项实时列表都不公布(**未验证**:没有样本证明它会公布),
83
+ * 让它们被列表的沉默改写成「猜」就是本文件存在的反面。
84
+ *
85
+ * **未验证**:列表的字段名。历史实现读 `context_window` / `contextWindow` /
86
+ * `max_input_tokens`,本文件连 `context_length` 一起认;真实响应样本缺一份,
87
+ * 上游若换了字段名,表现是「退回随包目录的窗口值」而不是崩溃。
88
+ */
89
+ export declare function parseCatalogListing(payload: unknown, region: GlmRegion): GlmModelEntry[];
90
+ /**
91
+ * 拉一次模型目录。
92
+ *
93
+ * 失败**抛错**而不是静默返回空列表:调用方(连接测试)需要知道「没读到」,
94
+ * 而 {@link loadCatalog} 才是那个负责回落随包目录的函数。
95
+ */
96
+ export declare function fetchCatalog(region: GlmRegion, codingPlanKey: string, options?: GlmRequestOptions): Promise<GlmModelEntry[]>;
97
+ /** 最近一次成功读到的目录;只读缓存,不发请求。 */
98
+ export declare function getCachedCatalog(region?: GlmRegion): GlmModelEntry[];
99
+ /** 忘记目录缓存(登录、登出、测试)。 */
100
+ export declare function clearCachedCatalog(): void;
101
+ /**
102
+ * 带 TTL 的目录读,失败时保留上一份快照、再失败则回落到随包目录。
103
+ *
104
+ * 回落链是有顺序的:**同区域的旧快照** → **随包目录(按区域过滤)**。
105
+ * 绝不让另一区域的快照顶替——它的行只声明了来处那个区域,落到调用方的区域过滤上会一行不剩,
106
+ * 结果是「模型选择器空了」而不是「退回随包目录」。
107
+ */
108
+ export declare function loadCatalog(region: GlmRegion, codingPlanKey: string, options?: GlmRequestOptions & {
109
+ force?: boolean;
110
+ }): Promise<GlmModelEntry[]>;
111
+ /** 上游 `limits` 数组里的一行(只保留本线路要用的字段)。 */
112
+ export interface GlmQuotaLimitRow {
113
+ type: string;
114
+ unit: number | undefined;
115
+ percentage: number | undefined;
116
+ currentValue: number | undefined;
117
+ usage: number | undefined;
118
+ /** 重置时刻(Unix 毫秒);上游没给或给了非正值时为 null。 */
119
+ resetsAt: number | null;
120
+ }
121
+ /**
122
+ * 把 `data.limits` 读成结构化行。
123
+ *
124
+ * 这里**只做搬运不做筛选**:`TIME_LIMIT` 与未知 `unit` 的丢弃发生在
125
+ * {@link parseQuotaSnapshot} 里,留在同一处才能一眼看清「哪些行被丢掉、为什么」。
126
+ *
127
+ * **未验证**:字段名。字段取自历史实现与 dsh-usage 的 `glmPlan()`(`unit` / `type` /
128
+ * `percentage` / `currentValue` / `usage` / `nextResetTime`),没有一份真实响应样本。
129
+ */
130
+ export declare function parseQuotaLimits(payload: unknown): GlmQuotaLimitRow[];
131
+ /** 解析配额快照时由调用方补上的东西(订阅列表读到的部分)。 */
132
+ export interface GlmQuotaParseOptions {
133
+ /** 订阅列表给出的展示套餐名。 */
134
+ planName?: string | null;
135
+ /** 订阅列表给出的续费时刻(Unix 毫秒)。 */
136
+ renewsAt?: number | null;
137
+ /** 本次读取时刻(Unix 毫秒)。 */
138
+ now?: number;
139
+ /** 实际应答的端点路径,供设置卡片诊断。 */
140
+ sources?: readonly string[];
141
+ }
142
+ /**
143
+ * 解析一次配额响应成 `GlmQuotaSnapshotDto`;不可解析时返回 null。
144
+ *
145
+ * 与参考实现 `glmPlan()` 一致的四条:
146
+ *
147
+ * 1. 上层信封必须 `success === true`,否则不解析(这个端点会用 HTTP 200 回一个业务失败);
148
+ * 2. `TIME_LIMIT` 是 MCP 请求上限,**不是套餐窗口**,跳过;
149
+ * 3. `unit` 走封闭映射,**未知编号丢弃**;
150
+ * 4. 剩下的行里 `TOKENS_LIMIT` 取 `percentage`、`CREDIT_LIMIT` 取 `currentValue/usage`。
151
+ *
152
+ * 另外两个本仓库自己的决定:
153
+ *
154
+ * - **同一个窗口键只保留第一行**。上游若给了两行 unit 3,画出来就是两条一模一样的额度条,
155
+ * 而第二条可能是别的计量口径;宁可少画一条,也不把两种口径混成一条。
156
+ * - **一个窗口都没有时返回 null**(参考实现同样把「无窗口」当成没有快照)。
157
+ * 一份没有窗口的快照会在卡片上渲染成「什么都没消耗」,那比不显示更糟。
158
+ */
159
+ export declare function parseQuotaSnapshot(payload: unknown, options?: GlmQuotaParseOptions): GlmQuotaSnapshotDto | null;
160
+ /** `data.level` 是不是本线路认识的机器档位(lite / pro / max)。 */
161
+ export declare function isGlmPlanLevel(value: unknown): value is string;
162
+ /** 订阅列表读到的套餐事实。 */
163
+ export interface GlmSubscriptionPlan {
164
+ planName: string | null;
165
+ renewsAt: number | null;
166
+ }
167
+ /**
168
+ * 解析订阅列表 → 套餐名 / 续费时刻。
169
+ *
170
+ * **尽力而为**:读不到套餐名不影响配额窗口(它们来自另一个端点),
171
+ * 所以本函数的任何不确定都只表现为 null,不会让整张配额卡片失败。
172
+ *
173
+ * **未验证**:字段名。读法取自历史实现(`planName` / `name` / `productName`、
174
+ * `expireTime` / `expiredTime` / `renewTime`,`data` 可以是对象也可以是数组),
175
+ * 没有一份真实响应样本;上游换字段名时表现为「卡片上没有套餐名」,而不是崩溃。
176
+ */
177
+ export declare function parseSubscriptionPlan(payload: unknown): GlmSubscriptionPlan;
178
+ /** 一次配额读的结果。失败以 `error` 呈现,不以异常呈现。 */
179
+ export interface GlmQuotaRead {
180
+ snapshot: GlmQuotaSnapshotDto | null;
181
+ /** 面向用户的失败原因;成功时为 null。与 `GlmStatusDto.quotaError` 是同一个位置。 */
182
+ error: string | null;
183
+ /** 这次是否直接命中缓存。 */
184
+ fromCache: boolean;
185
+ }
186
+ /** 最近一次读到的快照,不发请求。 */
187
+ export declare function getCachedQuota(): GlmQuotaSnapshotDto | null;
188
+ /**
189
+ * 只返回**属于这个账号**的快照,不发请求。
190
+ *
191
+ * 配额跟着账号走:轮转决定了下一个请求花哪个账号的额度,所以一份快照只描述它被读取时
192
+ * 那个账号的消耗。缺省 / 空 id 退回「最新一次读」,那是页面级卡片要的语义。
193
+ */
194
+ export declare function getCachedQuotaFor(accountId?: string | null): GlmQuotaSnapshotDto | null;
195
+ /** 忘记配额缓存(登出、换账号、测试)。不给 id 就全清。 */
196
+ export declare function clearCachedQuota(accountId?: string | null): void;
197
+ /** 读订阅列表;失败一律降级成「没有套餐名」,配额窗口不受影响。 */
198
+ export declare function fetchSubscriptionPlan(region: GlmRegion, codingPlanKey: string, options?: GlmRequestOptions): Promise<GlmSubscriptionPlan | null>;
199
+ /**
200
+ * 读一次配额,返回快照或一句失败原因。
201
+ *
202
+ * 走缓存:命中 `QUOTA_CACHE_TTL_MS` 内的同账号结果直接返回(设置卡片在轮询这个接口)。
203
+ * 订阅列表是**尽力而为**的第二段:它只补套餐名与续费时刻,失败不影响已经拿到的窗口。
204
+ *
205
+ * 为什么不抛异常而用 `error`:卡片的降级契约是「没有数字 + 一句原因」
206
+ * (`GlmStatusDto.quota` 可空、`quotaError` 与它并列),抛异常会把同一个决定
207
+ * 推给七个调用点各写一遍。需要「没读到就算失败」的调用方(连接测试)用
208
+ * {@link verifyCodingPlanKey},它本来就会抛。
209
+ *
210
+ * @param accountId - 这次读是为哪个池内账号做的;缓存按它分桶。
211
+ * @throws 只有一种:凭据是空白。那是调用方的 bug(不该把空凭据发到网络上),
212
+ * 所以它同步抛出,与「上游读失败返回 `error`」那条路径分开。
213
+ */
214
+ export declare function fetchGlmQuota(region: GlmRegion, codingPlanKey: string, options?: GlmRequestOptions & {
215
+ accountId?: string;
216
+ force?: boolean;
217
+ }): Promise<GlmQuotaRead>;
218
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/host/glm-coding-plan/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EACV,mBAAmB,EAGnB,SAAS,EACV,MAAM,2CAA2C,CAAA;AAGlD,OAAO,EAKL,UAAU,EAIV,iBAAiB,EAGlB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAoB,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAA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,CAAC,EAAE,OAAO,CAAA;CAAO,GACxE,OAAO,CAAC,YAAY,CAAC,CAkFvB"}
@@ -0,0 +1,223 @@
1
+ /**
2
+ * 兑换链:OAuth access_token → 可用的 Coding Plan Key(计划 §3.2,证据等级 B)。
3
+ *
4
+ * 链路逐字照三个独立实现(TriDefender/zcode-api、Sakuralaaa/z-code-2api、CLIProxyAPI 插件生态)
5
+ * 同构实现的那一条,四个端点与两种字段形状都记在 `EXCHANGE_PATHS` 的注释里:
6
+ *
7
+ * access_token
8
+ * -> [仅国际区] POST {business}/api/auth/z/login {token} => 业务 JWT + expires_in
9
+ * -> GET {business}/api/biz/customer/getCustomerInfo => 默认机构 orgId / 默认项目 projectId
10
+ * -> GET/POST {business}/api/biz/v1/organization/{org}/projects/{proj}/api_keys => 找或建一把 Key
11
+ * -> GET .../api_keys/copy/{apiKeyId} => secretKey
12
+ * -> {apiKeyId}.{secretKey} => Coding Plan Key
13
+ *
14
+ * **两区的鉴权形状本来就不一样**,这不是实现上的瑕疵(逐字:TriDefender/zcode-api
15
+ * `src/auth/resolver.ts` 的两个分支):
16
+ *
17
+ * - 国际区(`zai`):先 `POST /api/auth/z/login` 换业务 JWT,之后所有 `/api/biz/*`
18
+ * 带 `Authorization: Bearer <bizToken>`。
19
+ * - 国区(`bigmodel`):**跳过 z/login**,直接拿 OAuth access_token 当 `Authorization`
20
+ * 头(裸值,不加 `Bearer`)打 `/api/biz/*`;host 是 `https://bigmodel.cn`
21
+ * (`open.bigmodel.cn` 是**模型面**的 host,别混用)。
22
+ *
23
+ * 推论:国区这一层**没有**业务 JWT,所以 `biz-token-cache.ts` 只服务于国际区。
24
+ *
25
+ * 三条必须写下来的纪律:
26
+ *
27
+ * 1. **本线路用自己的 Key 名**(`GLM_KEY_NAME` = `dsh-glm-coding-plan`):
28
+ * 社区实现用 `zcode-api-key`,撞名会导致本线路登录时轮转或删除官方 ZCode 客户端
29
+ * 正在使用的那把 Key(计划 §3.2)。
30
+ * 2. **落盘前必须验一次**:拿配额接口探一次 Coding Plan 面(裸 Key、无 Bearer,
31
+ * 逐字证据 `docs/bigmodel-coding-plan-usage-quota.md`)。账号没有套餐就在**登录阶段**
32
+ * 报错,而不是等到某次对话里以一个莫名其妙的 429 暴露出来。
33
+ * 3. **国区这一段未验证**(计划 R5 / §9):三个同构实现都以国际区为主,
34
+ * 国区的业务面形状是否同构没有实测。失败时必须给出可操作报错,不得静默。
35
+ *
36
+ * 参考实现的许可证是 null / AGPL-3.0,所以这里**只读协议、照协议重写**,没有复制任何代码。
37
+ */
38
+ import type { GlmAllowanceKind, GlmRegion } from '../../shared/glm-coding-plan-contracts.ts';
39
+ /**
40
+ * 国区兑换链的未验证声明。
41
+ *
42
+ * 任何国区失败都要把它带上:一句「兑换失败」对用户毫无指导意义,
43
+ * 而「国区兑换链未经验证」能直接告诉他下一步是换国际区,还是用 `DSH_GLM_*` 覆盖指向实测过的部署。
44
+ */
45
+ export declare const CN_EXCHANGE_UNVERIFIED_NOTICE: string;
46
+ /** 兑换链的任何一步失败。 */
47
+ export declare class GlmExchangeError extends Error {
48
+ constructor(message: string, options?: {
49
+ cause?: unknown;
50
+ });
51
+ }
52
+ /**
53
+ * 兑换链跑通了,但这把 Key 不能服务 Coding Plan 面。
54
+ *
55
+ * 单独一类是因为处置不同:这不是「再试一次」能解决的,也不是链路的 bug,
56
+ * 而是这个账号没有套餐 / 套餐已失效 / 没有建 Key 的权限,必须让用户在登录阶段就看到。
57
+ */
58
+ export declare class GlmCodingPlanUnavailableError extends Error {
59
+ constructor(message: string);
60
+ }
61
+ /** 兑换链跑通并验过之后的结果。host 侧专用,不进共享契约。 */
62
+ export interface GlmCodingPlanKey {
63
+ region: GlmRegion;
64
+ /** `{apiKeyId}.{secretKey}`:配额接口要的就是这个裸值(不可加 Bearer)。 */
65
+ codingPlanKey: string;
66
+ apiKeyId: string;
67
+ secretKey: string;
68
+ /** Key 名,便于诊断「是不是本线路建的」。 */
69
+ keyName: string;
70
+ /** 本次是新建的还是复用了已存在的同名 Key。 */
71
+ keyCreated: boolean;
72
+ organizationId: string;
73
+ projectId: string;
74
+ /** 控制台侧的机构名,仅用于诊断与卡片展示。 */
75
+ accountName: string | null;
76
+ /**
77
+ * 业务 JWT(控制台口径:zcodejwttoken),落盘给 `biz-token-cache.ts` 用。
78
+ *
79
+ * 国区没有这一层(它拿裸 access_token 直接打 `/api/biz/*`),所以那里是 null。
80
+ */
81
+ bizToken: string | null;
82
+ /** 业务 JWT 的失效时刻(Unix 毫秒);国区为 null。 */
83
+ bizTokenExpiresAt: number | null;
84
+ /** 验活时读到的套餐机器档位(lite / pro / max),上游没给则为 null。 */
85
+ planLevel: string | null;
86
+ /**
87
+ * 验活认定的额度类型。落盘后由设置卡片如实显示,**不假装**免费额度是付费套餐。
88
+ *
89
+ * 缺省取 'unknown' 而不是必填:旧凭据文件里没有这个键,解析时补成 unknown
90
+ * (见 `token-store.ts`),因此它必须允许「读不到」。
91
+ */
92
+ allowance?: GlmAllowanceKind;
93
+ }
94
+ export interface GlmExchangeOptions {
95
+ fetchFn?: typeof fetch;
96
+ signal?: AbortSignal;
97
+ env?: NodeJS.ProcessEnv;
98
+ /** 单次请求超时;缺省走 `DISCOVERY_TIMEOUT_MS`(20s)。 */
99
+ timeoutMs?: number;
100
+ }
101
+ /** 业务 JWT(控制台口径:zcodejwttoken)及其失效时刻。 */
102
+ export interface GlmBizToken {
103
+ token: string;
104
+ /** 上游给的 `expires_in`(秒);上游没给时按 JWT 自身的 `exp` 折算。 */
105
+ expiresInSec: number;
106
+ expiresAt: number;
107
+ }
108
+ /**
109
+ * `POST {business}/api/auth/z/login`,体 `{"token": <oauth access_token>}`。
110
+ *
111
+ * 请求**不带** Authorization 头:access_token 在体里,这是三个同构实现一致的做法。
112
+ * 响应取 `access_token`(同构实现还兼容 `accessToken` 与 `data.access_token`,本线路同样容忍)。
113
+ *
114
+ * `expires_in` 是业务 JWT 缓存的唯一时间来源(计划 §3.6:官方按「提前 120 秒 + 0~60 秒抖动」重取)。
115
+ * 上游漏给时退回 JWT 自身的 `exp`;两者都没有就报错——一个不知道什么时候过期的缓存
116
+ * 等于没有缓存,只会在长会话中途把用户踢出去。
117
+ *
118
+ * **只有国际区会调这个端点**:国区按逆向实现的 bigmodel 分支直接用裸 access_token
119
+ * 打 `/api/biz/*`,根本不经过 z/login(见文件头注释)。留成导出函数是为了让 W6 与测试
120
+ * 都能单独调它,而不是为了两区共用。
121
+ */
122
+ export declare function loginBizToken(accessToken: string, region: GlmRegion, options?: GlmExchangeOptions): Promise<GlmBizToken>;
123
+ /** 默认机构与默认项目。 */
124
+ export interface GlmCustomerScope {
125
+ organizationId: string;
126
+ projectId: string;
127
+ organizationName: string | null;
128
+ projectName: string | null;
129
+ }
130
+ /**
131
+ * `GET {business}/api/biz/customer/getCustomerInfo`:定位默认机构与默认项目。
132
+ *
133
+ * 找不到标记文案时退回列表第一项(同构实现的做法):宁可猜一个,也不要让用户去回答
134
+ * 「你的机构叫什么」——那条交互在本插件里不存在,而列表非空本身就说明账号有机构。
135
+ * 列表为空才是真失败。
136
+ */
137
+ export declare function resolveCustomerScope(region: GlmRegion, authorization: string, options?: GlmExchangeOptions): Promise<GlmCustomerScope>;
138
+ /** 一把 api key 的最小形状。 */
139
+ export interface GlmApiKeyRef {
140
+ apiKeyId: string;
141
+ created: boolean;
142
+ }
143
+ /**
144
+ * 在该机构该项目下找一把本线路的 Key,没有就建一把。
145
+ *
146
+ * 找的条件是**名字等于** `keyName()`(默认 `GLM_KEY_NAME`):撞名的代价是
147
+ * 官方客户端正在用的那把 Key 被轮转或删除(计划 §3.2)。
148
+ * 列表调用失败不直接判死而是继续走新建——同构实现也是这么做的,
149
+ * 因为「列不出来」与「没有建 Key 的权限」是两回事,后者才值得报错。
150
+ */
151
+ export declare function findOrCreateApiKey(region: GlmRegion, authorization: string, scope: {
152
+ organizationId: string;
153
+ projectId: string;
154
+ }, options?: GlmExchangeOptions & {
155
+ name?: string;
156
+ }): Promise<GlmApiKeyRef>;
157
+ /**
158
+ * `GET .../api_keys/copy/{apiKeyId}`:取 secretKey。
159
+ *
160
+ * secret 只在这个端点出现一次,所以每次兑换都要再取一次,没有可依赖的缓存。
161
+ * 缺 secret 是硬失败:Coding Plan Key 的形状就是 `id.secret`(计划 §3.2、D4),
162
+ * 拿半把 Key 去配额接口只会得到一个没有出处的 401。
163
+ */
164
+ export declare function copyApiKeySecret(region: GlmRegion, authorization: string, scope: {
165
+ organizationId: string;
166
+ projectId: string;
167
+ apiKeyId: string;
168
+ }, options?: GlmExchangeOptions): Promise<string>;
169
+ /** 探一次 Coding Plan 面的结果。 */
170
+ export interface GlmPlanProbe {
171
+ planLevel: string | null;
172
+ /**
173
+ * 这次探活认定的额度类型。
174
+ *
175
+ * `plan` = 配额面给出了付费套餐的机器档位;`free-trial` = 配额面明确按套餐/额度维度
176
+ * 拒了它(凭据有效);`unknown` = 分不出是「key 坏了」还是「没有付费套餐」,
177
+ * 而本线路在分不出时**选择放行**。
178
+ */
179
+ allowance: GlmAllowanceKind;
180
+ }
181
+ /**
182
+ * 落盘前的验活:`GET {business}/api/monitor/usage/quota/limit`。
183
+ *
184
+ * 头是 `authorization: <id>.<secret>` **裸值**——加了 Bearer 会鉴权失败,
185
+ * 这与模型面正好相反(逐字:`docs/bigmodel-coding-plan-usage-quota.md`,证据等级 A)。
186
+ *
187
+ * 这一步的价值分两半,而两半的**处置相反**:
188
+ *
189
+ * - 凭据本身坏了(业务码落在 `BAD_CREDENTIAL_REASONS`)→ 登录阶段就失败。一把废 Key
190
+ * 进对话只会让用户在某次请求里以一个莫名其妙的 401 暴露出来。
191
+ * - 凭据有效但**没有付费套餐**(业务码落在 `NO_PLAN_REASONS`,或裸 401/403 分不出)→
192
+ * **放行**,并把额度类型如实记成 `free-trial` / `unknown`。官方文档(逐字:
193
+ * zcode.z.ai/cn/docs/configuration)写明新用户注册即自动获得 5 天、每天 800 万 token 的
194
+ * 「体验套餐:无需付费」,所以「没有付费 Coding Plan」不等于「没有额度」——硬拒在登录阶段
195
+ * 等于把免费额度的新用户全部挡在门外。额度耗尽时上游回 429,那是可恢复的。
196
+ */
197
+ export declare function verifyCodingPlanKey(region: GlmRegion, codingPlanKey: string, options?: GlmExchangeOptions): Promise<GlmPlanProbe>;
198
+ /**
199
+ * 这一层之后 `/api/biz/*` 该带的头。
200
+ *
201
+ * 两区不同,逐字照 TriDefender/zcode-api 的两个分支:国际区换出业务 JWT 再带
202
+ * `Bearer`,国区**跳过换**、直接用裸 access_token。
203
+ */
204
+ export declare function resolveBizAuthorization(accessToken: string, region: GlmRegion, options?: GlmExchangeOptions): Promise<{
205
+ authorization: string;
206
+ bizToken: string | null;
207
+ bizTokenExpiresAt: number | null;
208
+ }>;
209
+ /**
210
+ * 走完整条兑换链并验活。
211
+ *
212
+ * 调用方(W6)拿到的是一把**已经证明凭据有效**的 Coding Plan Key:
213
+ * 任何一步没过都不返回 Key,失败一律以异常形式给出可读原因。
214
+ *
215
+ * 注意「证明可用」这句话现在的口径:它证明的是**这把 Key 会被上游认出来**,
216
+ * 不是「账号有付费套餐」。没有付费套餐(含体验额度)的账号同样在这里成功返回,
217
+ * 额度类型记在 `allowance` 上。
218
+ *
219
+ * @throws {@link GlmCodingPlanUnavailableError} 链路通但这把 Key 不能服务 Coding Plan
220
+ * @throws {@link GlmExchangeError} 链路本身没走通
221
+ */
222
+ export declare function exchangeForCodingPlanKey(accessToken: string, region: GlmRegion, options?: GlmExchangeOptions): Promise<GlmCodingPlanKey>;
223
+ //# sourceMappingURL=exchange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../../../../src/host/glm-coding-plan/exchange.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAA;AAa5F;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,QAE6B,C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