@@ -13,8 +13,10 @@ describe("clawrouter provider plugin", () => {
|
13 | 13 | docsPath: "/providers/clawrouter", |
14 | 14 | envVars: ["CLAWROUTER_API_KEY"], |
15 | 15 | isModernModelRef: expect.any(Function), |
| 16 | +buildReplayPolicy: expect.any(Function), |
16 | 17 | normalizeResolvedModel: expect.any(Function), |
17 | 18 | resolveDynamicModel: expect.any(Function), |
| 19 | +sanitizeReplayHistory: expect.any(Function), |
18 | 20 | }); |
19 | 21 | expect(provider?.auth[0]).toMatchObject({ |
20 | 22 | id: "api-key", |
@@ -37,4 +39,40 @@ describe("clawrouter provider plugin", () => {
|
37 | 39 | baseUrl: "https://clawrouter.example/v1", |
38 | 40 | }); |
39 | 41 | }); |
| 42 | + |
| 43 | +it("keeps replay handling aligned with each discovered transport", () => { |
| 44 | +const provider = capturePluginRegistration(plugin).providers[0]; |
| 45 | +const buildReplayPolicy = provider?.buildReplayPolicy; |
| 46 | + |
| 47 | +expect( |
| 48 | +buildReplayPolicy?.({ |
| 49 | +provider: "clawrouter", |
| 50 | +modelApi: "anthropic-messages", |
| 51 | +modelId: "anthropic/default", |
| 52 | +} as never), |
| 53 | +).toMatchObject({ |
| 54 | +preserveNativeAnthropicToolUseIds: true, |
| 55 | +preserveSignatures: true, |
| 56 | +validateAnthropicTurns: true, |
| 57 | +}); |
| 58 | +expect( |
| 59 | +buildReplayPolicy?.({ |
| 60 | +provider: "clawrouter", |
| 61 | +modelApi: "google-generative-ai", |
| 62 | +modelId: "google/gemini-default", |
| 63 | +} as never), |
| 64 | +).toMatchObject({ |
| 65 | +validateGeminiTurns: true, |
| 66 | +}); |
| 67 | +expect( |
| 68 | +buildReplayPolicy?.({ |
| 69 | +provider: "clawrouter", |
| 70 | +modelApi: "openai-responses", |
| 71 | +modelId: "openai/gpt-5.5-mini", |
| 72 | +} as never), |
| 73 | +).toMatchObject({ |
| 74 | +validateGeminiTurns: false, |
| 75 | +validateAnthropicTurns: false, |
| 76 | +}); |
| 77 | +}); |
40 | 78 | }); |