Wave 7 chunk B: remove the embeddings machinery — the ladder collapses

The owner's wave-7 ruling: embeddings die entirely (git history is the
stash); clustering is birth-session derived (chunk A, 950ddfd), labels
are session names, and the prober's graph tools replace injection.

- settings: GraphSettings collapses to { enabled } — embedding,
  embeddingModel, clustering, labeling all die. Migration story: stale
  record keys are UNREAD and dropped by the sanitizer's reconstruction;
  the next graph-section PUT (replace-whole) persists the collapsed
  shape. The settings-panel GraphSection renders one master row.
- deleted: src/server/embeddings.ts (adapters, resolveEmbeddingPortFor,
  embedNewNodes, embeddingPort, embeddingModelCatalog), the
  GET /api/models/embeddings route, scripts/embed-graph.ts, tests for
  all three, and the /api/models/embeddings picker surfaces in the UI.
- prices: EMBEDDING_PRICES overlay + callCost fallback die. cost-summary:
  the embedding stage fold dies — back to three stages (extraction/
  audit/naming) per the owner ruling; historical stages.embedding spend
  in old run records is simply not displayed.
- ports: EmbeddingPort/EmbeddingResult/EmbeddingTask die. The embeddings
  LEDGER surface (readEmbeddings/writeEmbeddings + EmbeddingsLedger +
  EMBEDDINGS_FILE + graph-deletion's vector pruning) STAYS — inert data,
  kept only so graph-context.ts compiles until Teacher's pass removes
  it; the seam dies in the follow-up interlude.
- chat-handler (approved cross-lane unwiring, wave-6 precedent): the
  extraction pipeline's embedder becomes a documented no-op (nothing
  embedded, nothing spent, ledger untouched) until Teacher's pass
  removes the phase; the graph-context injection dispatch gate, the
  graphContext deps wiring, the setContextRespawn seam, and
  turn-service's triggerGraphContext are gone — injection is dead
  code pending Teacher's file deletions.
- scripts: backfill-graph/import-notes pass the same no-op embedder;
  replay-layout derives clusters from birthSessionPartition (the same
  partition the real settle uses) instead of the embeddings ledger.
- settings-body: parseGraphSettingsBody reads the master switch only —
  old-shape keys in a body are ignored, not rejected; bad shapes 400.
- next.config: the @huggingface tracing-exclusion guards die with the
  last reference.

Cross-lane flags: extraction.ts/graph-context.ts keep stale embed
comments + the embed phase until Teacher's full pass (their parallel
interlude owns those files — zero overlap kept by design);
semantic-clusters.ts + its test stay one more round (extraction.test.ts,
Teacher's file, still imports it — they delete it with the namer cases);
ChatSettings.graphContextTokens + the graph-context-control UI stay
until Teacher+UI.

Gates: tsc clean, eslint clean, 885/885 tests, build compiles.
Live-verified on the port-3004 dev tree: PUT /api/settings/graph with
dead keys collapses on write, bad shapes 400, GET reads {enabled: true},
/api/models/embeddings 404s.
This commit is contained in:
amosblomqvist
2026-09-23 15:02:55 +03:00
parent 0fcffdffaf
commit c86430e8bf
26 changed files with 120 additions and 1823 deletions
+8 -21
View File
@@ -55,12 +55,13 @@ export interface GraphCostSummary {
totalDollars: number;
/** Runs where EVERY stage was unpriced (totalDollars excludes them). */
unpricedRuns: number;
/** The billable pipeline stages (wave 6: the embedder became one —
* provider embeddings cost money; merger is the only free stage). */
/** The billable pipeline stages. (Wave 7, owner ruling 2026-09-23:
* back to three — the embedding stage is gone with the provider
* embedder; historical records' stages.embedding spend is simply not
* displayed.) */
stages: {
extraction: StageCost;
audit: StageCost;
embedding: StageCost;
naming: StageCost;
};
/** Newest first, capped at `recentCap` (default 10). */
@@ -115,7 +116,6 @@ function mergeTokens(into: CallUsage, steps: readonly CallUsage[]): void {
export function graphCostSummary(input: CostSummaryInput): GraphCostSummary {
const extraction = emptyStage();
const audit = emptyStage();
const embedding = emptyStage();
const naming = emptyStage();
const runs: RecentRun[] = [];
@@ -134,25 +134,12 @@ export function graphCostSummary(input: CostSummaryInput): GraphCostSummary {
if (audDollars === null) audit.unpricedRuns++;
else audit.dollars += audDollars;
// Wave 6: the embedding tail — present only when an embedding model
// ran (absent stage = the run embedded nothing, never "free").
let embDollars: number | null = null;
let embSteps: CallUsage[] = [];
if (stages.embedding) {
embedding.runs++;
embSteps = stages.embedding.steps;
mergeTokens(embedding.tokens, embSteps);
embDollars = stageDollars(stages.embedding.model, embSteps);
if (embDollars === null) embedding.unpricedRuns++;
else embedding.dollars += embDollars;
}
// Run-level: null only when EVERY stage is unpriced.
const allStages: Array<number | null> = [extDollars, audDollars, embDollars];
const allStages: Array<number | null> = [extDollars, audDollars];
const runDollars = allStages.every((d) => d === null)
? null
: allStages.reduce<number>((a, d) => a + (d ?? 0), 0);
const allSteps = [...stages.extractor.steps, ...stages.auditor.steps, ...embSteps];
const allSteps = [...stages.extractor.steps, ...stages.auditor.steps];
runs.push({
startedAt: run.startedAt,
at: run.at,
@@ -195,9 +182,9 @@ export function graphCostSummary(input: CostSummaryInput): GraphCostSummary {
// A run is "unpriced" when it billed nothing countable at all.
const unpricedRuns = runs.filter((r) => r.dollars === null).length;
return {
totalDollars: extraction.dollars + audit.dollars + embedding.dollars + naming.dollars,
totalDollars: extraction.dollars + audit.dollars + naming.dollars,
unpricedRuns,
stages: { extraction, audit, embedding, naming },
stages: { extraction, audit, naming },
runs: capped,
};
}