perf(plugins): thread prepared manifest plugins through runtime norma… · openclaw/openclaw@ef3e5f5
zeroaltitude
·
2026-06-16
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -230,4 +230,36 @@ describe("model-selection plugin runtime normalization", () => {
|
230 | 230 | expect(state.model).toBe("custom-modern-model"); |
231 | 231 | expect(state.resetModelOverride).toBe(false); |
232 | 232 | }); |
| 233 | + |
| 234 | +it("forwards manifestPlugins to the runtime normalization call so it can skip the slot-or-load disk walk", async () => { |
| 235 | +normalizeProviderModelIdWithPluginMock.mockReturnValue(undefined); |
| 236 | +const preparedPlugins = [ |
| 237 | +{ |
| 238 | +modelIdNormalization: { |
| 239 | +providers: { |
| 240 | +custom: { prefixWhenBare: "prepared" }, |
| 241 | +}, |
| 242 | +}, |
| 243 | +}, |
| 244 | +]; |
| 245 | +const { normalizeModelRef } = await import("./model-selection-normalize.js"); |
| 246 | +normalizeModelRef("custom", "my-model", { manifestPlugins: preparedPlugins }); |
| 247 | +expect(normalizeProviderModelIdWithPluginMock).toHaveBeenCalledWith( |
| 248 | +expect.objectContaining({ |
| 249 | +provider: "custom", |
| 250 | +plugins: preparedPlugins, |
| 251 | +}), |
| 252 | +); |
| 253 | +}); |
| 254 | + |
| 255 | +it("omits plugins from the runtime call when no manifestPlugins are prepared (preserves current behavior)", async () => { |
| 256 | +normalizeProviderModelIdWithPluginMock.mockReturnValue(undefined); |
| 257 | +const { normalizeModelRef } = await import("./model-selection-normalize.js"); |
| 258 | +normalizeModelRef("custom", "my-model"); |
| 259 | +const callArgs = normalizeProviderModelIdWithPluginMock.mock.calls[0]?.[0] as |
| 260 | +| { plugins?: unknown } |
| 261 | +| undefined; |
| 262 | +expect(callArgs).toBeDefined(); |
| 263 | +expect(callArgs?.plugins).toBeUndefined(); |
| 264 | +}); |
233 | 265 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。