Download src/query/deps.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/chenbhao/codev/resolve/afbc7edaae4e6bb0102ba024b49ce8be89d2264c/src/query/deps.ts
- Command line
-
hf download hf://chenbhao/codev@afbc7edaae4e6bb0102ba024b49ce8be89d2264c/src/query/deps.ts
-
curl -L -o deps.ts https://huggingface.co/chenbhao/codev/resolve/afbc7edaae4e6bb0102ba024b49ce8be89d2264c/src/query/deps.ts
1.45 kB
| import { randomUUID } from 'crypto' | |
| import { queryModelWithStreaming } from '../services/api/claude.js' | |
| import { autoCompactIfNeeded } from '../services/compact/autoCompact.js' | |
| import { microcompactMessages } from '../services/compact/microCompact.js' | |
| // -- deps | |
| // I/O dependencies for query(). Passing a `deps` override into QueryParams | |
| // lets tests inject fakes directly instead of spyOn-per-module — the most | |
| // common mocks (callModel, autocompact) are each spied in 6-8 test files | |
| // today with module-import-and-spy boilerplate. | |
| // | |
| // Using `typeof fn` keeps signatures in sync with the real implementations | |
| // automatically. This file imports the real functions for both typing and | |
| // the production factory — tests that import this file for typing are | |
| // already importing query.ts (which imports everything), so there's no | |
| // new module-graph cost. | |
| // | |
| // Scope is intentionally narrow (4 deps) to prove the pattern. Followup | |
| // PRs can add runTools, handleStopHooks, logEvent, queue ops, etc. | |
| export type QueryDeps = { | |
| // -- model | |
| callModel: typeof queryModelWithStreaming | |
| // -- compaction | |
| microcompact: typeof microcompactMessages | |
| autocompact: typeof autoCompactIfNeeded | |
| // -- platform | |
| uuid: () => string | |
| } | |
| export function productionDeps(): QueryDeps { | |
| return { | |
| callModel: queryModelWithStreaming, | |
| microcompact: microcompactMessages, | |
| autocompact: autoCompactIfNeeded, | |
| uuid: randomUUID, | |
| } | |
| } | |