|
| 1 | +import { registerSingleProviderPlugin } from "openclaw/plugin-sdk/plugin-test-runtime"; |
| 2 | +import { describe, expect, it } from "vitest"; |
| 3 | +import plugin from "./index.js"; |
| 4 | + |
| 5 | +describe("sglang provider plugin", () => { |
| 6 | +it("owns OpenAI-compatible replay without dropping reasoning history", async () => { |
| 7 | +const provider = await registerSingleProviderPlugin(plugin); |
| 8 | +const policy = provider.buildReplayPolicy?.({ |
| 9 | +provider: "sglang", |
| 10 | +modelApi: "openai-completions", |
| 11 | +modelId: "moonshotai/kimi-k2-thinking", |
| 12 | +} as never); |
| 13 | + |
| 14 | +expect(policy).toMatchObject({ |
| 15 | +sanitizeToolCallIds: true, |
| 16 | +toolCallIdMode: "strict", |
| 17 | +applyAssistantFirstOrderingFix: true, |
| 18 | +validateGeminiTurns: true, |
| 19 | +validateAnthropicTurns: true, |
| 20 | +}); |
| 21 | +expect(policy).not.toHaveProperty("dropReasoningFromHistory"); |
| 22 | +}); |
| 23 | + |
| 24 | +it("still drops historical reasoning for Gemma 4 chat-completions models", async () => { |
| 25 | +const provider = await registerSingleProviderPlugin(plugin); |
| 26 | +const policy = provider.buildReplayPolicy?.({ |
| 27 | +provider: "sglang", |
| 28 | +modelApi: "openai-completions", |
| 29 | +modelId: "google/gemma-4-26b-a4b-it", |
| 30 | +} as never); |
| 31 | + |
| 32 | +expect(policy).toHaveProperty("dropReasoningFromHistory", true); |
| 33 | +}); |
| 34 | +}); |