2026-08-04 18:38:05 +08:00
|
|
|
/** Parent adapter that fails if the composition-only Loader test starts a turn. */
|
2026-08-04 16:02:17 +08:00
|
|
|
|
2026-08-10 22:04:06 +08:00
|
|
|
import type { Context } from '@deepseek-ai/cordis'
|
2026-08-04 16:02:17 +08:00
|
|
|
import type { GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm'
|
2026-08-04 18:38:05 +08:00
|
|
|
import { LlmAdapter } from '@deepseek-ai/dsh-llm'
|
2026-08-04 16:02:17 +08:00
|
|
|
|
2026-08-04 18:38:05 +08:00
|
|
|
class CompositionOnlyAdapter extends LlmAdapter {
|
|
|
|
|
async * stream(_options: GenerateOptions): AsyncIterable<StreamChunk> {
|
|
|
|
|
throw new Error('subagent-codex Loader composition must not invoke a model')
|
2026-08-04 16:02:17 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-04 18:38:05 +08:00
|
|
|
export const name = 'codex-loader-composition-fixture'
|
|
|
|
|
export const inject = ['llm']
|
2026-08-04 16:02:17 +08:00
|
|
|
|
|
|
|
|
/**
|
2026-08-04 18:38:05 +08:00
|
|
|
* Register a parent adapter solely so the host composition is complete.
|
|
|
|
|
* @param ctx - Loader context supplying the LLM seam.
|
2026-08-04 16:02:17 +08:00
|
|
|
*/
|
|
|
|
|
export function apply(ctx: Context): void {
|
2026-08-04 18:38:05 +08:00
|
|
|
ctx.llm.registerAdapter(['mock'], new CompositionOnlyAdapter())
|
2026-08-04 16:02:17 +08:00
|
|
|
}
|