Files
Codeman/src/local-model/harness-facts.ts
T
Codeman maintainer 73ce6a1819 feat(local-model): types and module skeleton for the hardware-aware recommendation
The contract three builders code against in parallel. Nothing is recommended
yet: the route answers 501 and the catalogue is empty.

- src/types/local-model.ts: HardwareFacts, the catalogue rows, HarnessFact,
  Candidate, Recommendation, LocalModelStatus, and LOCAL_MODEL_LABELS, the one
  list of sentences the server may put into the payload (the zh-CN dictionary
  is keyed by them).
- src/local-model/format.ts: formatGb, the one place a byte count becomes a
  size a person reads (decimal GB), and memClassGb.
- src/config/local-model-catalog.ts: the Zod schema (model ids are name:tag,
  lowercase, no slash) and an empty stock catalogue. No override file.
- Skeletons with their final signatures: hardware.ts, recommend.ts,
  harness-facts.ts, routes/local-model-routes.ts (injectable dependencies),
  public/local-model-ui.js with its script tag.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-06 14:56:13 +01:00

31 lines
1.7 KiB
TypeScript

/**
* @fileoverview What the server knows about each catalogue harness on this machine, for the
* local model recommendation. Server side: this is the one module of src/local-model/ that
* reads the CLI registry, so `recommend()` can stay pure and name no CLI.
*
* SKELETON: the exported signature is final, the body is not written yet. `buildHarnessFacts()`
* will, for every `LocalHarnessEntry` of the catalogue:
* - resolve its `cli` in the CLI registry AT CALL TIME (never in a module-level constant), and
* leave out a row whose CLI is unknown, disabled, or has no custom model mechanism
* (`capabilities.customModelInjection.kind` is `unsupported`);
* - report `label` from the registry entry and `installed` from the same probe the other
* routes use;
* - report `installable` only for a CLI that is not installed and whose install command for
* this platform needs no administrator rights (not one that starts with `brew` or `sudo`);
* - supply `acceptsModelId`, the same test a custom model launch applies to the model id
* before anything is written (the launch spec's model pattern).
*
* Rules:
* - No CLI id is compared with a literal here or anywhere: the id comes from the catalogue row
* and everything else from the registry entry it resolves to.
* - Read-only: nothing is installed, written or spawned beyond the existing availability probe.
*/
import type { HarnessFact, LocalModelCatalog } from '../types.js';
/** One fact per catalogue harness that resolves in the CLI registry, in catalogue order. */
export async function buildHarnessFacts(catalog: LocalModelCatalog): Promise<HarnessFact[]> {
void catalog;
throw new Error('not implemented: buildHarnessFacts');
}