omnicell-router 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/backend/dist/cli/clients/base.d.ts +13 -2
  2. package/backend/dist/cli/clients/claude.d.ts +2 -2
  3. package/backend/dist/cli/clients/codex.d.ts +2 -2
  4. package/backend/dist/cli/clients/core-adapters.d.ts +3 -4
  5. package/backend/dist/cli/clients/core-adapters.js +3 -4
  6. package/backend/dist/cli/clients/cursor-proxy.d.ts +88 -0
  7. package/backend/dist/cli/clients/cursor-proxy.js +421 -0
  8. package/backend/dist/cli/clients/dsh.d.ts +2 -2
  9. package/backend/dist/cli/clients/grok.d.ts +2 -2
  10. package/backend/dist/cli/clients/index.d.ts +8 -1
  11. package/backend/dist/cli/clients/index.js +48 -20
  12. package/backend/dist/cli/clients/kimi.d.ts +2 -2
  13. package/backend/dist/cli/clients/launcher.d.ts +8 -0
  14. package/backend/dist/cli/clients/model-meta.js +1 -1
  15. package/backend/dist/cli/clients/omp.d.ts +2 -2
  16. package/backend/dist/cli/clients/openclaw.d.ts +2 -2
  17. package/backend/dist/cli/clients/opencode-proxy.d.ts +11 -0
  18. package/backend/dist/cli/clients/opencode-proxy.js +351 -0
  19. package/backend/dist/cli/clients/opencode.d.ts +2 -2
  20. package/backend/dist/cli/clients/pi.d.ts +2 -2
  21. package/backend/dist/cli/clients/plugin-adapters.d.ts +3 -1
  22. package/backend/dist/cli/clients/plugin-adapters.js +6 -29
  23. package/backend/dist/cli/clients/qoder-proxy.d.ts +84 -0
  24. package/backend/dist/cli/clients/qoder-proxy.js +497 -0
  25. package/backend/dist/cli/clients/reserved.d.ts +2 -6
  26. package/backend/dist/cli/clients/reserved.js +2 -0
  27. package/backend/dist/cli/clients/workbuddy.d.ts +2 -2
  28. package/backend/dist/cli/index.js +60 -9
  29. package/backend/dist/cli/types.d.ts +20 -8
  30. package/backend/dist/compression/caveman-prompts.d.ts +1 -1
  31. package/backend/dist/config/comments-en.js +6 -12
  32. package/backend/dist/config/comments-zh.js +6 -12
  33. package/backend/dist/config/defaults.d.ts +56 -1
  34. package/backend/dist/config/defaults.js +68 -0
  35. package/backend/dist/config/index.d.ts +9 -2
  36. package/backend/dist/config/index.js +26 -3
  37. package/backend/dist/config/types.d.ts +55 -43
  38. package/backend/dist/forward-proxy/egress.d.ts +10 -2
  39. package/backend/dist/forward-proxy/egress.js +42 -4
  40. package/backend/dist/forward-proxy/ordered-relay.d.ts +29 -0
  41. package/backend/dist/forward-proxy/ordered-relay.js +46 -0
  42. package/backend/dist/forward-proxy/rules.d.ts +66 -19
  43. package/backend/dist/forward-proxy/rules.js +61 -14
  44. package/backend/dist/forward-proxy/server.js +226 -77
  45. package/backend/dist/forward-proxy/system-proxy.d.ts +42 -2
  46. package/backend/dist/forward-proxy/system-proxy.js +199 -22
  47. package/backend/dist/harness/common/market.d.ts +3 -3
  48. package/backend/dist/harness/host/adapters/amp.d.ts +1 -1
  49. package/backend/dist/harness/host/adapters/antigravity.d.ts +1 -1
  50. package/backend/dist/harness/host/adapters/claude.d.ts +1 -1
  51. package/backend/dist/harness/host/adapters/cline.d.ts +1 -1
  52. package/backend/dist/harness/host/adapters/codex.d.ts +1 -1
  53. package/backend/dist/harness/host/adapters/cursor.d.ts +1 -1
  54. package/backend/dist/harness/host/adapters/dsh.d.ts +2 -2
  55. package/backend/dist/harness/host/adapters/factory.d.ts +1 -1
  56. package/backend/dist/harness/host/adapters/gemini-cli.d.ts +1 -1
  57. package/backend/dist/harness/host/adapters/grok.d.ts +1 -1
  58. package/backend/dist/harness/host/adapters/kimi.d.ts +1 -1
  59. package/backend/dist/harness/host/adapters/omp.d.ts +1 -1
  60. package/backend/dist/harness/host/adapters/openclaw.d.ts +1 -1
  61. package/backend/dist/harness/host/adapters/opencode.d.ts +1 -1
  62. package/backend/dist/harness/host/adapters/pi.d.ts +1 -1
  63. package/backend/dist/harness/host/adapters/universal.d.ts +1 -1
  64. package/backend/dist/harness/host/adapters/windsurf.d.ts +1 -1
  65. package/backend/dist/harness/host/adapters/zed.d.ts +1 -1
  66. package/backend/dist/harness/skill/skills-sh.d.ts +1 -1
  67. package/backend/dist/harness/translation.js +64 -21
  68. package/backend/dist/harness/types.d.ts +1 -1
  69. package/backend/dist/harness/types.js +1 -1
  70. package/backend/dist/index.js +31 -18
  71. package/backend/dist/ir/adapters/anthropic-stream.d.ts +18 -0
  72. package/backend/dist/ir/adapters/anthropic-stream.js +247 -0
  73. package/backend/dist/ir/adapters/anthropic.d.ts +29 -0
  74. package/backend/dist/ir/adapters/anthropic.js +788 -0
  75. package/backend/dist/ir/adapters/chat.d.ts +15 -0
  76. package/backend/dist/ir/adapters/chat.js +602 -0
  77. package/backend/dist/ir/adapters/google-stream.d.ts +22 -0
  78. package/backend/dist/ir/adapters/google-stream.js +242 -0
  79. package/backend/dist/ir/adapters/google.d.ts +9 -0
  80. package/backend/dist/ir/adapters/google.js +317 -0
  81. package/backend/dist/ir/adapters/openai-responses-output.js +8 -5
  82. package/backend/dist/ir/adapters/openai-responses.d.ts +15 -0
  83. package/backend/dist/ir/adapters/openai-responses.js +26 -1
  84. package/backend/dist/ir/adapters/responses-output.d.ts +50 -0
  85. package/backend/dist/ir/adapters/responses-output.js +348 -0
  86. package/backend/dist/ir/adapters/responses-stream.d.ts +12 -0
  87. package/backend/dist/ir/adapters/responses-stream.js +178 -0
  88. package/backend/dist/ir/adapters/responses.d.ts +14 -0
  89. package/backend/dist/ir/adapters/responses.js +646 -0
  90. package/backend/dist/ir/errors.d.ts +2 -2
  91. package/backend/dist/ir/types.d.ts +2 -1
  92. package/backend/dist/metrics/request-cost.d.ts +11 -2
  93. package/backend/dist/metrics/request-cost.js +12 -3
  94. package/backend/dist/observability/request-identity.d.ts +1 -1
  95. package/backend/dist/observability/trace-id.d.ts +40 -0
  96. package/backend/dist/observability/trace-id.js +134 -0
  97. package/backend/dist/observability/upstream-events.d.ts +82 -60
  98. package/backend/dist/observability/upstream-events.js +142 -67
  99. package/backend/dist/opencode/catalog/types.d.ts +9 -0
  100. package/backend/dist/opencode/credentials/types.d.ts +2 -2
  101. package/backend/dist/opencode/probe.d.ts +24 -1
  102. package/backend/dist/opencode/probe.js +28 -4
  103. package/backend/dist/opencode/user-config.d.ts +5 -0
  104. package/backend/dist/pipeline/directives.d.ts +6 -2
  105. package/backend/dist/pipeline/directives.js +7 -3
  106. package/backend/dist/pipeline/orchestrator.d.ts +28 -27
  107. package/backend/dist/pipeline/orchestrator.js +220 -194
  108. package/backend/dist/pipeline/unresolved-model.d.ts +33 -0
  109. package/backend/dist/pipeline/unresolved-model.js +43 -0
  110. package/backend/dist/plugins/catalog-def.d.ts +143 -0
  111. package/backend/dist/plugins/catalog-def.js +177 -0
  112. package/backend/dist/plugins/gateways.d.ts +62 -3
  113. package/backend/dist/plugins/gateways.js +139 -2
  114. package/backend/dist/plugins/host.d.ts +42 -5
  115. package/backend/dist/plugins/host.js +454 -38
  116. package/backend/dist/plugins/manifest.d.ts +119 -10
  117. package/backend/dist/plugins/manifest.js +265 -14
  118. package/backend/dist/plugins/pack.js +26 -0
  119. package/backend/dist/plugins/types.d.ts +187 -21
  120. package/backend/dist/protocols/systemone/convert.d.ts +1 -0
  121. package/backend/dist/protocols/systemone/convert.js +6 -1
  122. package/backend/dist/protocols/systemone/decide.js +18 -8
  123. package/backend/dist/providers/anthropic-messages.d.ts +12 -0
  124. package/backend/dist/providers/anthropic-messages.js +53 -0
  125. package/backend/dist/providers/anthropic.d.ts +7 -8
  126. package/backend/dist/providers/anthropic.js +36 -324
  127. package/backend/dist/providers/base.d.ts +14 -2
  128. package/backend/dist/providers/boot-direct.js +68 -38
  129. package/backend/dist/providers/dispatch.d.ts +5 -19
  130. package/backend/dist/providers/dispatch.js +46 -58
  131. package/backend/dist/providers/executors/anthropic-messages.d.ts +1 -0
  132. package/backend/dist/providers/executors/anthropic-messages.js +3 -0
  133. package/backend/dist/providers/executors/dispatch.d.ts +16 -2
  134. package/backend/dist/providers/executors/dispatch.js +39 -9
  135. package/backend/dist/providers/executors/google-gemini.d.ts +1 -0
  136. package/backend/dist/providers/executors/google-gemini.js +3 -0
  137. package/backend/dist/providers/executors/http-stream.js +16 -3
  138. package/backend/dist/providers/executors/openai-chat.d.ts +1 -0
  139. package/backend/dist/providers/executors/openai-chat.js +3 -0
  140. package/backend/dist/providers/executors/openai-responses.d.ts +1 -0
  141. package/backend/dist/providers/executors/openai-responses.js +3 -0
  142. package/backend/dist/providers/executors/plugin-adapter.js +4 -4
  143. package/backend/dist/providers/google-gemini.d.ts +12 -0
  144. package/backend/dist/providers/google-gemini.js +50 -0
  145. package/backend/dist/providers/google.d.ts +7 -8
  146. package/backend/dist/providers/google.js +35 -308
  147. package/backend/dist/providers/http-json.d.ts +19 -0
  148. package/backend/dist/providers/http-json.js +104 -0
  149. package/backend/dist/providers/http-stream.d.ts +52 -0
  150. package/backend/dist/providers/http-stream.js +423 -0
  151. package/backend/dist/providers/member-match.d.ts +4 -5
  152. package/backend/dist/providers/member-match.js +4 -5
  153. package/backend/dist/providers/openai-chat.d.ts +13 -0
  154. package/backend/dist/providers/openai-chat.js +99 -0
  155. package/backend/dist/providers/openai-compatible.d.ts +7 -4
  156. package/backend/dist/providers/openai-compatible.js +71 -368
  157. package/backend/dist/providers/openai-responses.d.ts +12 -0
  158. package/backend/dist/providers/openai-responses.js +68 -0
  159. package/backend/dist/providers/opencode-proxy.d.ts +5 -5
  160. package/backend/dist/providers/opencode-proxy.js +49 -125
  161. package/backend/dist/providers/plugin-adapter.d.ts +9 -0
  162. package/backend/dist/providers/plugin-adapter.js +31 -0
  163. package/backend/dist/providers/registry.d.ts +49 -24
  164. package/backend/dist/providers/registry.js +97 -55
  165. package/backend/dist/providers/responses.d.ts +7 -28
  166. package/backend/dist/providers/responses.js +45 -253
  167. package/backend/dist/providers/tool-markup-leak.d.ts +41 -0
  168. package/backend/dist/providers/tool-markup-leak.js +57 -0
  169. package/backend/dist/providers/tool-markup-recovery.d.ts +27 -0
  170. package/backend/dist/providers/tool-markup-recovery.js +786 -0
  171. package/backend/dist/providers/virtual-meta.d.ts +21 -2
  172. package/backend/dist/providers/virtual-meta.js +49 -9
  173. package/backend/dist/proxy/asset-download.d.ts +54 -0
  174. package/backend/dist/proxy/asset-download.js +420 -0
  175. package/backend/dist/proxy/manual-node-spec.d.ts +16 -16
  176. package/backend/dist/proxy/mihomo-binary.d.ts +17 -2
  177. package/backend/dist/proxy/mihomo-binary.js +62 -51
  178. package/backend/dist/proxy/mihomo-client.js +15 -1
  179. package/backend/dist/proxy/mihomo-config.js +11 -2
  180. package/backend/dist/proxy/mihomo-geo.d.ts +87 -0
  181. package/backend/dist/proxy/mihomo-geo.js +213 -0
  182. package/backend/dist/proxy/mihomo-logs.d.ts +27 -0
  183. package/backend/dist/proxy/mihomo-logs.js +70 -0
  184. package/backend/dist/proxy/mihomo-pac.d.ts +11 -0
  185. package/backend/dist/proxy/mihomo-pac.js +15 -0
  186. package/backend/dist/proxy/mihomo-rules-import.d.ts +1 -1
  187. package/backend/dist/proxy/mihomo-rules-import.js +7 -7
  188. package/backend/dist/proxy/mihomo-sidecar.d.ts +17 -1
  189. package/backend/dist/proxy/mihomo-sidecar.js +148 -26
  190. package/backend/dist/quota/adapters/minimax.js +36 -13
  191. package/backend/dist/quota/cli-login.d.ts +8 -0
  192. package/backend/dist/quota/cli-login.js +18 -0
  193. package/backend/dist/quota/declarations.js +10 -0
  194. package/backend/dist/quota/dsl.js +18 -5
  195. package/backend/dist/quota/engine.d.ts +22 -1
  196. package/backend/dist/quota/engine.js +170 -29
  197. package/backend/dist/quota/prober.d.ts +5 -0
  198. package/backend/dist/quota/prober.js +11 -2
  199. package/backend/dist/quota/types.d.ts +87 -8
  200. package/backend/dist/quota/verdict.d.ts +35 -0
  201. package/backend/dist/quota/verdict.js +135 -0
  202. package/backend/dist/ratelimit/admission.d.ts +131 -0
  203. package/backend/dist/ratelimit/admission.js +233 -0
  204. package/backend/dist/ratelimit/rate-limiter.js +6 -0
  205. package/backend/dist/resilience/types.d.ts +2 -2
  206. package/backend/dist/router/layer2-decision.d.ts +1 -1
  207. package/backend/dist/router/layer2-decision.js +5 -8
  208. package/backend/dist/routes/console.js +242 -51
  209. package/backend/dist/routes/mihomo.d.ts +2 -0
  210. package/backend/dist/routes/mihomo.js +334 -29
  211. package/backend/dist/routes/responses.d.ts +87 -8
  212. package/backend/dist/routes/responses.js +314 -33
  213. package/backend/dist/server.js +26 -6
  214. package/backend/dist/session/session-manager.d.ts +6 -0
  215. package/backend/dist/session/session-manager.js +20 -9
  216. package/backend/dist/surfaces/chat-pipeline.d.ts +2 -2
  217. package/backend/dist/surfaces/chat-pipeline.js +17 -7
  218. package/backend/dist/surfaces/chat.js +15 -0
  219. package/backend/dist/surfaces/decision-pipeline.js +7 -10
  220. package/backend/dist/surfaces/direct-forward.d.ts +3 -0
  221. package/backend/dist/surfaces/direct-forward.js +206 -0
  222. package/backend/dist/surfaces/rate-limit-response.d.ts +17 -0
  223. package/backend/dist/surfaces/rate-limit-response.js +57 -0
  224. package/backend/dist/surfaces/types.d.ts +11 -0
  225. package/backend/dist/trace/tracker.d.ts +32 -1
  226. package/backend/dist/trace/tracker.js +29 -4
  227. package/backend/dist/types/router.d.ts +34 -12
  228. package/backend/dist/types/router.js +35 -6
  229. package/backend/dist/utils/chat-stream.d.ts +21 -8
  230. package/backend/dist/utils/chat-stream.js +46 -9
  231. package/backend/dist/utils/event-ring.d.ts +4 -0
  232. package/backend/dist/utils/event-ring.js +4 -0
  233. package/backend/dist/utils/popularity.js +29 -4
  234. package/backend/dist/utils/proxy.d.ts +7 -0
  235. package/backend/dist/utils/proxy.js +35 -10
  236. package/backend/dist/utils/retry-after.d.ts +21 -0
  237. package/backend/dist/utils/retry-after.js +36 -0
  238. package/bin/ocr.js +2 -2
  239. package/frontend/dist/assets/index-Cn3QMOQx.js +1487 -0
  240. package/frontend/dist/assets/{index-CQSLGFTV.css → index-DxZ9MHKB.css} +1 -1
  241. package/frontend/dist/index.html +2 -2
  242. package/package.json +1 -1
  243. package/frontend/dist/assets/index-CLvxJjp_.js +0 -1476
@@ -3,7 +3,7 @@ import { CORE_ADAPTERS } from './core-adapters.js';
3
3
  import { retiredClientHint } from './reserved.js';
4
4
  import { popularityRank } from '../../utils/popularity.js';
5
5
  import { compareVersions } from '../../utils/semver.js';
6
- import { getPluginClientAdapter, listPluginClientAdapters, pluginIdForClient } from './plugin-adapters.js';
6
+ import { getPluginClientAdapter, listPluginClientAdapters, pluginClientRank, pluginIdForClient } from './plugin-adapters.js';
7
7
  /** The hooks this build ships (`core-adapters.ts`) — the authoritative answer
8
8
  * for "what is always available", even before the plugin host has run. */
9
9
  const adapters = CORE_ADAPTERS;
@@ -63,7 +63,8 @@ function unknownClientMessage(name) {
63
63
  export function getAllClientAdapters() {
64
64
  // Plugin rows ride AFTER the built-in ones: they are additive, and the
65
65
  // console's roster order must not reshuffle when a package is installed.
66
- const contributed = listPluginClientAdapters().sort((a, b) => popularityRank(a.name) - popularityRank(b.name) || a.name.localeCompare(b.name));
66
+ const contributed = listPluginClientAdapters().sort((a, b) => (pluginClientRank(a.name) ?? Number.MAX_SAFE_INTEGER) - (pluginClientRank(b.name) ?? Number.MAX_SAFE_INTEGER) ||
67
+ a.name.localeCompare(b.name));
67
68
  return [...ORDERED_ADAPTERS, ...contributed];
68
69
  }
69
70
  /**
@@ -95,7 +96,9 @@ async function buildRoster() {
95
96
  // publishes. Stamped here so no console table and no CLI constant has to
96
97
  // know a client id in advance.
97
98
  const pluginId = pluginIdForClient(adapter.name);
98
- const launch = adapter.launchVerbs?.().map((v) => v.verb);
99
+ const published = adapter.launchVerbs?.() ?? [];
100
+ const launch = published.map((v) => v.verb);
101
+ const launchAliases = published.flatMap((v) => v.aliases ?? []);
99
102
  return {
100
103
  ...status,
101
104
  hookKind: adapter.hookKind,
@@ -103,7 +106,8 @@ async function buildRoster() {
103
106
  ...(adapter.shortName ? { shortName: adapter.shortName } : {}),
104
107
  ...(pluginId ? { pluginId } : {}),
105
108
  ...(adapter.catalogPlugin ? { catalogPlugin: adapter.catalogPlugin } : {}),
106
- ...(launch && launch.length > 0 ? { launch } : {}),
109
+ ...(launch.length > 0 ? { launch } : {}),
110
+ ...(launchAliases.length > 0 ? { launchAliases } : {}),
107
111
  };
108
112
  }));
109
113
  }
@@ -133,16 +137,33 @@ export function listLaunchVerbs() {
133
137
  const verbs = [];
134
138
  for (const adapter of getAllClientAdapters()) {
135
139
  for (const v of adapter.launchVerbs?.() ?? []) {
136
- verbs.push({ client: adapter.name, ...v });
140
+ const { aliases, ...row } = v;
141
+ verbs.push({ client: adapter.name, ...row, ...(aliases && aliases.length > 0 ? { aliases } : {}) });
137
142
  }
138
143
  }
139
144
  return verbs;
140
145
  }
141
- /** One launch verb by name, or undefined when nobody publishes it. */
146
+ /** One launch verb by name, or undefined when nobody publishes it. A retired
147
+ * alias names nobody here: it resolves only through `currentLaunchVerb`. */
142
148
  export function findLaunchVerb(verb) {
143
149
  const key = String(verb ?? '').trim();
144
150
  return listLaunchVerbs().find((v) => v.verb === key);
145
151
  }
152
+ /** The CURRENT spelling of a launch verb, whether `verb` is that spelling or a
153
+ * retired alias (`agy` → `antigravity-cli`), or undefined when nobody
154
+ * publishes either. Calls that must refuse a retired spelling use this. */
155
+ export function currentLaunchVerb(verb) {
156
+ const key = String(verb ?? '').trim().toLowerCase();
157
+ if (!key)
158
+ return undefined;
159
+ for (const v of listLaunchVerbs()) {
160
+ if (v.verb === key)
161
+ return key;
162
+ if ((v.aliases ?? []).includes(key))
163
+ return v.verb;
164
+ }
165
+ return undefined;
166
+ }
146
167
  export async function setupClient(name, options) {
147
168
  // Plugin-contributed hooks (e.g. the packaged OpenCode proxy mode) are only
148
169
  // resolvable once the plugin host has run in this process.
@@ -154,23 +175,30 @@ export async function setupClient(name, options) {
154
175
  message: unknownClientMessage(name),
155
176
  };
156
177
  }
157
- // The two opencode hooks are mutually exclusive — provider injection owns
158
- // opencode.json(c), proxy mode owns the service env. Enabling one decouples
159
- // the other first (only when actually hooked) so `hooked` status never shows
160
- // both at once; a failed sibling teardown is surfaced in the result message
178
+ // Hook exclusivity is package-declared (`ClientAdapter.exclusiveWith`, one
179
+ // side naming the other is enough): enabling this hook tears down every
180
+ // installed, actually-hooked sibling — the one this hook names, and any
181
+ // installed hook that names this one — so `hooked` status never shows both
182
+ // at once. A failed sibling teardown is surfaced in the result message
161
183
  // instead of silently swallowed.
184
+ const siblingIds = new Set(adapter.exclusiveWith ?? []);
185
+ for (const other of getAllClientAdapters()) {
186
+ if (other !== adapter && (other.exclusiveWith ?? []).includes(adapter.name))
187
+ siblingIds.add(other.name);
188
+ }
162
189
  let siblingNote = '';
163
- if (name === 'opencode' || name === 'opencode-gateway') {
164
- const sibling = name === 'opencode' ? 'opencode-gateway' : 'opencode';
190
+ for (const sibling of siblingIds) {
165
191
  const siblingAdapter = getClientAdapter(sibling);
166
- if (siblingAdapter && (await siblingAdapter.getStatus()).hooked) {
167
- const r = await teardownClient(sibling).catch((err) => ({
168
- success: false,
169
- message: err instanceof Error ? err.message : String(err),
170
- }));
171
- if (!r.success)
172
- siblingNote = ` (note: previous ${sibling} hook teardown failed: ${r.message})`;
173
- }
192
+ if (!siblingAdapter || siblingAdapter === adapter)
193
+ continue;
194
+ if (!(await siblingAdapter.getStatus()).hooked)
195
+ continue;
196
+ const r = await teardownClient(sibling).catch((err) => ({
197
+ success: false,
198
+ message: err instanceof Error ? err.message : String(err),
199
+ }));
200
+ if (!r.success)
201
+ siblingNote += ` (note: previous ${sibling} hook teardown failed: ${r.message})`;
174
202
  }
175
203
  const result = await adapter.setup(options);
176
204
  // A hook flip invalidates the roster snapshot: the next read rebuilds.
@@ -21,8 +21,8 @@ import { ClientHookStatus } from '../types.js';
21
21
  * safety net.
22
22
  */
23
23
  export declare class KimiClientAdapter implements ClientAdapter {
24
- name: 'kimi';
25
- hookKind: 'config';
24
+ name: "kimi";
25
+ hookKind: "config";
26
26
  displayName: string;
27
27
  /**
28
28
  * Compatibility floor = the kimi-code changelog floor (0.2.0, 2026-05-26):
@@ -12,6 +12,14 @@
12
12
  export interface ClientLaunchVerb {
13
13
  /** The word after `ocr` (`cursor`, `cursor-agent`). */
14
14
  verb: string;
15
+ /**
16
+ * Retired spellings of `verb` (`agy` after `antigravity-cli` took its name).
17
+ * `ocr setup ‹alias›` names the hook that publishes the verb, and `ocr ‹alias›`
18
+ * fails with the CURRENT spelling — a silent run would keep the old command
19
+ * in scripts forever, and a generic "unknown command" hides where it went.
20
+ * An alias is never dispatched and never listed in the help text.
21
+ */
22
+ aliases?: string[];
15
23
  /** Absolute path of the managed launcher script this verb runs. */
16
24
  script: string;
17
25
  /**
@@ -131,7 +131,7 @@ export async function resolveClientModelMeta(ids) {
131
131
  }
132
132
  const reg = registry.getModel(id);
133
133
  if (reg) {
134
- const supported = modelSupportsEfforts(reg.supportedReasoningEfforts, reg.supportsReasoningEffort);
134
+ const supported = modelSupportsEfforts(reg.supportedReasoningEfforts, reg.supportsReasoningEffort, reg.reasoningDisableable);
135
135
  const cat = await findCatalogModel(id, catalogList);
136
136
  out[id] = {
137
137
  ...(cat ? displayMeta(cat) : {}),
@@ -4,8 +4,8 @@ import { ClientHookStatus } from '../types.js';
4
4
  * `.yaml` (omp's own precedence); the `.yml` name is the default target. */
5
5
  export declare function resolveOmpModelsPath(dir: string): string;
6
6
  export declare class OmpClientAdapter implements ClientAdapter {
7
- name: 'omp';
8
- hookKind: 'config';
7
+ name: "omp";
8
+ hookKind: "config";
9
9
  displayName: string;
10
10
  /** models.yml (or models.yaml when only that exists) — the hook target. */
11
11
  getConfigPath(): string;
@@ -20,8 +20,8 @@ import { ClientHookStatus } from '../types.js';
20
20
  * rewritten.
21
21
  */
22
22
  export declare class OpenClawClientAdapter implements ClientAdapter {
23
- name: 'openclaw';
24
- hookKind: 'config';
23
+ name: "openclaw";
24
+ hookKind: "config";
25
25
  displayName: string;
26
26
  versionCmd: string[];
27
27
  /** Provider entry this adapter owns inside `models.providers`. */
@@ -0,0 +1,11 @@
1
+ import { ClientAdapter, ClientActionResult } from './base.js';
2
+ import { ClientHookStatus } from '../types.js';
3
+ export declare class OpenCodeProxyClientAdapter implements ClientAdapter {
4
+ name: "opencode-proxy";
5
+ hookKind: "service-env";
6
+ displayName: string;
7
+ getConfigPath(): string;
8
+ getStatus(): Promise<Omit<ClientHookStatus, 'hookKind'>>;
9
+ setup(): Promise<ClientActionResult>;
10
+ teardown(): Promise<ClientActionResult>;
11
+ }
@@ -0,0 +1,351 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { resolveForwardProxyEndpoint } from './base.js';
4
+ import { runCommand } from '../../utils/run-command.js';
5
+ import { getOcrHomeDir } from '../paths.js';
6
+ import { caCertPath } from '../../forward-proxy/ca.js';
7
+ /**
8
+ * OpenCode "proxy mode" client adapter.
9
+ *
10
+ * Unlike OpenCodeClientAdapter (provider injection into opencode.json(c)),
11
+ * this hook leaves the client config file untouched and points OpenCode's OWN
12
+ * outbound traffic at OCR's inbound forward proxy by persisting managed
13
+ * service environment variables (OpenCode v2 managed service):
14
+ *
15
+ * opencode service set env HTTPS_PROXY http://127.0.0.1:<forwardProxy.port>
16
+ * opencode service set env HTTP_PROXY http://127.0.0.1:<forwardProxy.port>
17
+ * opencode service set env NO_PROXY localhost,127.0.0.1,::1 (REQUIRED:
18
+ * the opencode CLI talks to its background service over local HTTP —
19
+ * routing that through any proxy breaks opencode itself)
20
+ * opencode service set env NODE_EXTRA_CA_CERTS <forwardProxy.caDir>/ca.pem
21
+ * (the forward proxy is a full-capture MITM — its CA must be trusted)
22
+ *
23
+ * The forward proxy intercepts only canonical LLM endpoints
24
+ * (/v1/chat/completions, /v1/messages, /v1/responses) into the routing
25
+ * pipeline; every other destination is forwarded transparently, so pointing
26
+ * ALL of opencode's HTTPS traffic at it is safe. Models and API keys stay
27
+ * opencode-native — the gateway key / provider-injection model picker do not
28
+ * apply to this mode (modelSlots stays empty).
29
+ *
30
+ * Every value is resolved from the RUNTIME config snapshot
31
+ * (getRuntimeConfigRef() || loadConfig()) — never hardcoded — so what gets
32
+ * written into opencode always matches the RUNNING forward proxy. A fresh
33
+ * loadConfig() after a hot reload could advertise a port the running proxy
34
+ * no longer listens on.
35
+ *
36
+ * Scope caveat (opencode v2 docs): `service set env` configures the managed
37
+ * background service ONLY. `opencode --standalone`, `opencode serve` and
38
+ * shell-launched CLIs read their own process environment — the setup message
39
+ * tells the user to set the same variables there manually.
40
+ */
41
+ const PROXY_ENV_KEYS = ['HTTPS_PROXY', 'HTTP_PROXY', 'NO_PROXY', 'NODE_EXTRA_CA_CERTS'];
42
+ const LOOPBACK_NO_PROXY = 'localhost,127.0.0.1,::1';
43
+ /** Stable sidecar recording the service env values we replaced (teardown restores them). */
44
+ function metaPath() {
45
+ return path.join(getOcrHomeDir(), 'opencode-proxy.env-meta.json');
46
+ }
47
+ function readMeta() {
48
+ try {
49
+ if (fs.existsSync(metaPath()))
50
+ return JSON.parse(fs.readFileSync(metaPath(), 'utf8'));
51
+ }
52
+ catch {
53
+ // ignore — treated as "no originals recorded"
54
+ }
55
+ return {};
56
+ }
57
+ function writeMeta(meta) {
58
+ try {
59
+ fs.writeFileSync(metaPath(), JSON.stringify(meta, null, 2), 'utf8');
60
+ }
61
+ catch {
62
+ // best effort — teardown then just unsets whatever we set
63
+ }
64
+ }
65
+ /**
66
+ * Run `opencode <args>` ASYNCHRONOUSLY — getStatus is polled (~4s) by the
67
+ * console, so a sync spawn here would block the whole gateway event loop.
68
+ */
69
+ function runOpenCode(args) {
70
+ return runCommand('opencode', args, 20_000);
71
+ }
72
+ /**
73
+ * `opencode service get env` probe with a 30s TTL — the console polls status
74
+ * every ~4s and spawning the CLI that often is wasteful. Invalidated by
75
+ * setup/teardown so hook-state changes reflect immediately.
76
+ */
77
+ const PROBE_TTL_MS = 30_000;
78
+ let probeCache = null;
79
+ function probeServiceEnv() {
80
+ if (probeCache && Date.now() - probeCache.at < PROBE_TTL_MS)
81
+ return Promise.resolve(probeCache.result);
82
+ return runOpenCode(['service', 'get', 'env']).then(result => {
83
+ probeCache = { at: Date.now(), result };
84
+ return result;
85
+ });
86
+ }
87
+ function invalidateProbe() {
88
+ probeCache = null;
89
+ }
90
+ /**
91
+ * Substring test for our proxy URL with a digit-boundary guard — plain
92
+ * `includes` would collide on port prefixes (4555 vs 45550).
93
+ */
94
+ function urlMentioned(raw, url) {
95
+ const escaped = url.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
96
+ return new RegExp(escaped + '(?![0-9])').test(raw);
97
+ }
98
+ /**
99
+ * Parse `opencode service get env` output. The exact rendering is not a
100
+ * stable contract (JSON object, KEY=value lines or bullet lists), so accept
101
+ * JSON (flat or one level of wrapper objects) and per-line `KEY[=:] value`
102
+ * pairs. Only OUR four keys are ever read back, so extra output is harmless.
103
+ */
104
+ function parseServiceEnv(raw) {
105
+ const out = {};
106
+ const trimmed = (raw || '').trim();
107
+ if (!trimmed)
108
+ return out;
109
+ if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
110
+ try {
111
+ const obj = JSON.parse(trimmed);
112
+ const collect = (input, depth) => {
113
+ if (!input || typeof input !== 'object' || depth > 1)
114
+ return;
115
+ for (const [k, v] of Object.entries(input)) {
116
+ if (typeof v === 'string')
117
+ out[k.toUpperCase()] = v;
118
+ else
119
+ collect(v, depth + 1);
120
+ }
121
+ };
122
+ collect(obj, 0);
123
+ if (Object.keys(out).length > 0)
124
+ return out;
125
+ }
126
+ catch {
127
+ // fall through to line parsing
128
+ }
129
+ }
130
+ for (const line of trimmed.split(/\r?\n/)) {
131
+ const m = line.match(/^\s*\*?\s*-?\s*([A-Za-z_][A-Za-z0-9_]*)\s*[=:]\s*(.*)$/);
132
+ if (m)
133
+ out[m[1].toUpperCase()] = m[2].trim().replace(/^['"]|['"]$/g, '');
134
+ }
135
+ return out;
136
+ }
137
+ /**
138
+ * Heuristic: does this env value belong to OUR hook (vs the user's own proxy
139
+ * like clash)? Used by teardown when no sidecar originals were recorded —
140
+ * only then is it safe to unset.
141
+ */
142
+ function looksLikeOurs(key, value, fp) {
143
+ if (!value)
144
+ return false;
145
+ const v = value.trim();
146
+ if (fp && v === fp.url)
147
+ return true;
148
+ if (key === 'NO_PROXY')
149
+ return v.replace(/\s/g, '') === LOOPBACK_NO_PROXY;
150
+ if (key === 'NODE_EXTRA_CA_CERTS') {
151
+ const ours = path.resolve(fp?.caPath || caCertPath());
152
+ try {
153
+ return path.resolve(v) === ours;
154
+ }
155
+ catch {
156
+ return false;
157
+ }
158
+ }
159
+ return false;
160
+ }
161
+ export class OpenCodeProxyClientAdapter {
162
+ name = 'opencode-proxy';
163
+ hookKind = 'service-env';
164
+ displayName = 'OpenCode (Proxy Mode)';
165
+ getConfigPath() {
166
+ // Proxy mode owns no client config file; the meaningful artifact is the
167
+ // MITM CA written into opencode's trust store (NODE_EXTRA_CA_CERTS).
168
+ return resolveForwardProxyEndpoint()?.caPath || caCertPath();
169
+ }
170
+ async getStatus() {
171
+ const fp = resolveForwardProxyEndpoint();
172
+ const probe = await probeServiceEnv();
173
+ const exists = probe.ok; // CLI reachable AND the v2 `service` subcommand works
174
+ const backupExists = fs.existsSync(metaPath());
175
+ let hooked = false;
176
+ let details;
177
+ if (!probe.ok) {
178
+ details = /not recognized|ENOENT|not found/i.test(probe.stderr)
179
+ ? 'opencode CLI not detected on PATH'
180
+ : 'opencode detected but `service` command unavailable (OpenCode v2 required)';
181
+ }
182
+ else if (!fp) {
183
+ details = 'forwardProxy disabled in config.yaml — enable it before hooking proxy mode';
184
+ }
185
+ else {
186
+ const env = parseServiceEnv(probe.stdout);
187
+ const proxyValue = (env.HTTPS_PROXY || env.HTTP_PROXY || '').trim();
188
+ const oursProxy = proxyValue === fp.url || urlMentioned(probe.stdout, fp.url);
189
+ const oursCa = (env.NODE_EXTRA_CA_CERTS || '').trim().length > 0 || /NODE_EXTRA_CA_CERTS/i.test(probe.stdout);
190
+ if (oursProxy && oursCa) {
191
+ hooked = true;
192
+ details = `Proxied through OCR forward proxy (${fp.url}); CA: ${env.NODE_EXTRA_CA_CERTS || fp.caPath}`;
193
+ }
194
+ else if (proxyValue) {
195
+ details = `Active with another proxy (${proxyValue}) — setup will replace it (previous value kept for teardown)`;
196
+ }
197
+ else {
198
+ details = 'opencode service env has no proxy configured';
199
+ }
200
+ }
201
+ return {
202
+ name: this.name,
203
+ displayName: this.displayName,
204
+ configPath: this.getConfigPath(),
205
+ exists,
206
+ hooked,
207
+ backupExists,
208
+ details,
209
+ modelSlots: [], // no model picker — models/keys stay opencode-native in proxy mode
210
+ };
211
+ }
212
+ async setup() {
213
+ invalidateProbe();
214
+ const fp = resolveForwardProxyEndpoint();
215
+ if (!fp) {
216
+ return {
217
+ success: false,
218
+ reasonCode: 'forwardProxyDisabled',
219
+ message: 'forwardProxy is not enabled in config.yaml — set `forwardProxy.enabled: true` (and keep the gateway running) before enabling OpenCode proxy mode.',
220
+ };
221
+ }
222
+ if (!fs.existsSync(fp.caPath)) {
223
+ return {
224
+ success: false,
225
+ reasonCode: 'forwardProxyCaMissing',
226
+ params: { path: fp.caPath },
227
+ message: `Forward-proxy MITM CA not found at ${fp.caPath} — it is generated when the gateway boots with forwardProxy enabled. Start the gateway and retry.`,
228
+ };
229
+ }
230
+ const probe = await probeServiceEnv();
231
+ if (!probe.ok) {
232
+ return {
233
+ success: false,
234
+ reasonCode: 'serviceProbeFailed',
235
+ params: { detail: (probe.stderr || probe.stdout).trim() },
236
+ message: `\`opencode service get env\` failed — OpenCode v2 with the managed service is required for proxy mode. ${(probe.stderr || probe.stdout).trim()}`.trim(),
237
+ };
238
+ }
239
+ // Record originals BEFORE overwriting: if a later `set env` fails midway,
240
+ // teardown must still restore what setup replaced — the looksLikeOurs
241
+ // fallback can only unset OUR values, which would lose the user's
242
+ // original. Restoring an identical value on a never-replaced key is
243
+ // harmless; data preservation wins over the stale-restore edge case.
244
+ const current = parseServiceEnv(probe.stdout);
245
+ const previous = {};
246
+ for (const k of PROXY_ENV_KEYS) {
247
+ const v = current[k];
248
+ if (typeof v === 'string' && v.length > 0)
249
+ previous[k] = v;
250
+ }
251
+ writeMeta({ previous });
252
+ for (const [k, v] of [
253
+ ['HTTPS_PROXY', fp.url],
254
+ ['HTTP_PROXY', fp.url],
255
+ ['NO_PROXY', LOOPBACK_NO_PROXY],
256
+ ['NODE_EXTRA_CA_CERTS', fp.caPath],
257
+ ]) {
258
+ const r = await runOpenCode(['service', 'set', 'env', k, v]);
259
+ if (!r.ok) {
260
+ return {
261
+ success: false,
262
+ reasonCode: 'serviceSetEnvFailed',
263
+ params: { key: k, detail: (r.stderr || r.stdout).trim() },
264
+ message: `\`opencode service set env ${k}\` failed: ${(r.stderr || r.stdout).trim()}`,
265
+ };
266
+ }
267
+ }
268
+ const start = await runOpenCode(['service', 'start']);
269
+ if (!start.ok) {
270
+ return {
271
+ success: false,
272
+ reasonCode: 'serviceStartFailed',
273
+ params: { url: fp.url, detail: (start.stderr || start.stdout).trim() },
274
+ message: `Proxy env persisted (${fp.url}) but \`opencode service start\` failed: ${(start.stderr || start.stdout).trim()} — run it manually, or teardown to revert.`,
275
+ };
276
+ }
277
+ return {
278
+ success: true,
279
+ message: `OpenCode proxy mode enabled: HTTPS_PROXY/HTTP_PROXY → ${fp.url}, NO_PROXY → ${LOOPBACK_NO_PROXY}, NODE_EXTRA_CA_CERTS → ${fp.caPath}. LLM endpoints are intercepted into the OCR pipeline, other traffic forwards transparently. NOTE: \`opencode --standalone\`/\`serve\` and shell-launched CLIs read their own process env — set the same variables there manually if you use those modes.`,
280
+ };
281
+ }
282
+ async teardown() {
283
+ invalidateProbe();
284
+ const probe = await probeServiceEnv();
285
+ if (!probe.ok) {
286
+ return {
287
+ success: false,
288
+ reasonCode: 'serviceProbeFailed',
289
+ params: { detail: (probe.stderr || probe.stdout).trim() },
290
+ message: `\`opencode service get env\` failed — cannot inspect opencode service env. ${(probe.stderr || probe.stdout).trim()}`.trim(),
291
+ };
292
+ }
293
+ const { previous } = readMeta();
294
+ const current = parseServiceEnv(probe.stdout);
295
+ const fp = resolveForwardProxyEndpoint();
296
+ const touched = [];
297
+ let oursPresent = false;
298
+ for (const k of PROXY_ENV_KEYS) {
299
+ const prev = previous?.[k];
300
+ const cur = current[k] || '';
301
+ if (prev !== undefined) {
302
+ const r = await runOpenCode(['service', 'set', 'env', k, prev]);
303
+ if (!r.ok) {
304
+ return {
305
+ success: false,
306
+ reasonCode: 'serviceSetEnvFailed',
307
+ params: { key: k, detail: (r.stderr || r.stdout).trim() },
308
+ message: `\`opencode service set env ${k}\` failed: ${(r.stderr || r.stdout).trim()}`,
309
+ };
310
+ }
311
+ touched.push(`${k} (restored)`);
312
+ oursPresent = true;
313
+ }
314
+ else if (cur && looksLikeOurs(k, cur, fp)) {
315
+ const r = await runOpenCode(['service', 'unset', 'env', k]);
316
+ if (!r.ok) {
317
+ return {
318
+ success: false,
319
+ reasonCode: 'serviceSetEnvFailed',
320
+ params: { key: k, detail: (r.stderr || r.stdout).trim() },
321
+ message: `\`opencode service unset env ${k}\` failed: ${(r.stderr || r.stdout).trim()}`,
322
+ };
323
+ }
324
+ touched.push(`${k} (removed)`);
325
+ oursPresent = true;
326
+ }
327
+ }
328
+ try {
329
+ fs.unlinkSync(metaPath());
330
+ }
331
+ catch {
332
+ // best effort
333
+ }
334
+ if (!oursPresent) {
335
+ return { success: false, reasonCode: 'notActive', message: 'OpenCode proxy mode is not active — nothing to tear down.' };
336
+ }
337
+ const start = await runOpenCode(['service', 'start']);
338
+ if (!start.ok) {
339
+ return {
340
+ success: false,
341
+ reasonCode: 'serviceStartFailed',
342
+ params: { detail: (start.stderr || start.stdout).trim() },
343
+ message: `Env restored (${touched.join(', ')}) but \`opencode service start\` failed: ${(start.stderr || start.stdout).trim()} — run it manually.`,
344
+ };
345
+ }
346
+ return {
347
+ success: true,
348
+ message: `OpenCode proxy mode disabled: ${touched.join(', ')}. Service restarted with the previous environment.`,
349
+ };
350
+ }
351
+ }
@@ -1,8 +1,8 @@
1
1
  import { ClientAdapter } from './base.js';
2
2
  import { ClientHookStatus } from '../types.js';
3
3
  export declare class OpenCodeClientAdapter implements ClientAdapter {
4
- name: 'opencode';
5
- hookKind: 'config';
4
+ name: "opencode";
5
+ hookKind: "config";
6
6
  displayName: string;
7
7
  getConfigPath(): string;
8
8
  getStatus(): Promise<Omit<ClientHookStatus, 'hookKind'>>;
@@ -1,8 +1,8 @@
1
1
  import { ClientAdapter } from './base.js';
2
2
  import { ClientHookStatus } from '../types.js';
3
3
  export declare class PiClientAdapter implements ClientAdapter {
4
- name: 'pi';
5
- hookKind: 'config';
4
+ name: "pi";
5
+ hookKind: "config";
6
6
  displayName: string;
7
7
  getConfigPath(): string;
8
8
  /**
@@ -11,10 +11,12 @@ export declare function clearPluginClientAdapters(): void;
11
11
  * must surface as a load error on the plugin's own console row, never as a
12
12
  * silent override.
13
13
  */
14
- export declare function registerPluginClientAdapter(pluginId: string, adapter: ClientAdapter): void;
14
+ export declare function registerPluginClientAdapter(pluginId: string, adapter: ClientAdapter, rank?: number): void;
15
15
  /** One plugin-contributed adapter by client id (core lookup already missed). */
16
16
  export declare function getPluginClientAdapter(name: string): ClientAdapter | undefined;
17
17
  /** Which package provides this client hook — undefined for a core hook. */
18
18
  export declare function pluginIdForClient(name: string): string | undefined;
19
19
  /** All plugin-contributed adapters, registration order. */
20
20
  export declare function listPluginClientAdapters(): ClientAdapter[];
21
+ /** Manifest `clientRank` for a contributed hook — undefined = unranked tail. */
22
+ export declare function pluginClientRank(name: string): number | undefined;
@@ -1,31 +1,4 @@
1
1
  import { isCoreClientId, RETIRED_CLIENT_IDS } from './reserved.js';
2
- /**
3
- * Client adapters contributed by PLUGINS (`type: 'client-adapter'`, ADR-0027).
4
- *
5
- * Kept apart from the core registry on purpose:
6
- *
7
- * - the core registry is the answer to "what can this build hook?", a fixed
8
- * map keyed by the reserved id list in `reserved.ts` — compile-time
9
- * knowledge the CLI help text, the console roster and the i18n labels are
10
- * built on;
11
- * - this map is the answer to "what has this install additionally hooked?",
12
- * which changes at runtime (install / uninstall / disable / a failed load)
13
- * and must never be able to shadow a core id.
14
- *
15
- * The lookup order in `clients/index.ts` is core first, so a package can never
16
- * silently replace a built-in hook — a colliding id is REFUSED at load with the
17
- * package's own error message instead of becoming a row whose behaviour
18
- * depends on which copy happened to register last.
19
- *
20
- * The plugin host owns the write side and rebuilds TRANSACTIONALLY, exactly
21
- * like the gateway registry: `beginPluginClientAdapterRebuild()` opens a
22
- * staging map, each loaded package registers into it, and
23
- * `commitPluginClientAdapterRebuild()` swaps it in. A rebuild that throws
24
- * before the commit therefore leaves the PREVIOUS adapter set live instead of
25
- * an empty one — a failed scan must not blind the Client Hub while the proxy
26
- * legs keep serving. Registration outside a rebuild (tests, callers without a
27
- * host) writes to the live map.
28
- */
29
2
  const byName = new Map();
30
3
  /** Staging target while a rebuild is open; undefined = write live. */
31
4
  let staged;
@@ -53,7 +26,7 @@ export function clearPluginClientAdapters() {
53
26
  * must surface as a load error on the plugin's own console row, never as a
54
27
  * silent override.
55
28
  */
56
- export function registerPluginClientAdapter(pluginId, adapter) {
29
+ export function registerPluginClientAdapter(pluginId, adapter, rank) {
57
30
  const name = String(adapter?.name ?? '').trim().toLowerCase();
58
31
  if (!name)
59
32
  throw new Error('client-adapter plugin returned no adapter name');
@@ -72,7 +45,7 @@ export function registerPluginClientAdapter(pluginId, adapter) {
72
45
  if (existing && existing.pluginId !== pluginId) {
73
46
  throw new Error(`client '${name}' is already provided by plugin '${existing.pluginId}'`);
74
47
  }
75
- target.set(name, { pluginId, adapter });
48
+ target.set(name, { pluginId, adapter, ...(rank !== undefined ? { rank } : {}) });
76
49
  }
77
50
  /** One plugin-contributed adapter by client id (core lookup already missed). */
78
51
  export function getPluginClientAdapter(name) {
@@ -86,3 +59,7 @@ export function pluginIdForClient(name) {
86
59
  export function listPluginClientAdapters() {
87
60
  return [...byName.values()].map((entry) => entry.adapter);
88
61
  }
62
+ /** Manifest `clientRank` for a contributed hook — undefined = unranked tail. */
63
+ export function pluginClientRank(name) {
64
+ return byName.get(String(name ?? '').trim().toLowerCase())?.rank;
65
+ }