Download packages/agent-core-v2/test/llm-adapter/protocol/protocol.test.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/test/llm-adapter/protocol/protocol.test.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/test/llm-adapter/protocol/protocol.test.ts
-
curl -L -o protocol.test.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/test/llm-adapter/protocol/protocol.test.ts
1.59 kB
| import { describe, expect, it } from 'vitest'; | |
| import { | |
| IProtocolAdapterRegistry, | |
| ProtocolSchema, | |
| type ProtocolAdapterConfig, | |
| } from '#/llm-adapter/protocol/protocol'; | |
| describe('ProtocolSchema', () => { | |
| it('accepts the four real wire protocols', () => { | |
| for (const protocol of [ | |
| 'anthropic', | |
| 'openai', | |
| 'openai_responses', | |
| 'google-genai', | |
| ]) { | |
| expect(ProtocolSchema.parse(protocol)).toBe(protocol); | |
| } | |
| }); | |
| it('rejects vendor names and unknown values', () => { | |
| expect(ProtocolSchema.safeParse('kimi').success).toBe(false); | |
| expect(ProtocolSchema.safeParse('vertexai').success).toBe(false); | |
| expect(ProtocolSchema.safeParse('azure').success).toBe(false); | |
| expect(ProtocolSchema.safeParse('').success).toBe(false); | |
| expect(ProtocolSchema.safeParse(42).success).toBe(false); | |
| }); | |
| }); | |
| describe('ProtocolAdapterConfig', () => { | |
| it('carries a free-form providerType string, unenumerated at parse time', () => { | |
| const config: ProtocolAdapterConfig = { | |
| protocol: 'openai', | |
| providerType: 'vendor-registered-elsewhere', | |
| modelName: 'vendor-model-1', | |
| }; | |
| expect(config.providerType).toBe('vendor-registered-elsewhere'); | |
| const withoutVendor: ProtocolAdapterConfig = { | |
| protocol: 'anthropic', | |
| modelName: 'claude-sonnet-4', | |
| }; | |
| expect(withoutVendor.providerType).toBeUndefined(); | |
| }); | |
| }); | |
| describe('IProtocolAdapterRegistry', () => { | |
| it('keeps the established DI identity', () => { | |
| expect(IProtocolAdapterRegistry.toString()).toBe('protocolAdapterRegistry'); | |
| }); | |
| }); | |