fixture.ts 806 B

12345678910111213141516171819202122
  1. /** Parent adapter that fails if the composition-only Loader test starts a turn. */
  2. import type { Context } from '@deepseek-ai/cordis'
  3. import type { GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm'
  4. import { LlmAdapter } from '@deepseek-ai/dsh-llm'
  5. class CompositionOnlyAdapter extends LlmAdapter {
  6. async * stream(_options: GenerateOptions): AsyncIterable<StreamChunk> {
  7. throw new Error('subagent-codex Loader composition must not invoke a model')
  8. }
  9. }
  10. export const name = 'codex-loader-composition-fixture'
  11. export const inject = ['llm']
  12. /**
  13. * Register a parent adapter solely so the host composition is complete.
  14. * @param ctx - Loader context supplying the LLM seam.
  15. */
  16. export function apply(ctx: Context): void {
  17. ctx.llm.registerAdapter(['mock'], new CompositionOnlyAdapter())
  18. }