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
+14 -31
View File
@@ -249,23 +249,14 @@ export interface AppearanceSettings {
* meaningful when its parent is on (the UI grays dependents out; stored
* values persist but resolve inert). All default true. */
export interface GraphSettings {
/** MASTER: off = no extraction, no auditor, no embedding, no
* graph-context injection, no clustering. Data stays stored. */
/** MASTER (and, since wave 7, ONLY): off = no extraction, no auditor.
* The wave-7 collapse (owner ruling 2026-09-23) deleted the three
* subordinate rungs — embedding/clustering/labeling — and the BYOK
* embeddingModel: clustering is the free birth-session partition
* derived on read (core/session-clusters.ts), labels ARE session
* names, and the prober graph tools read the ledgers directly — there
* is nothing left to configure. Data stays stored either way. */
enabled?: boolean;
/** Vector embedding + graph-context injection (consumes vectors even
* without clustering — hence its own rung). */
embedding?: boolean;
/** Cluster computation + settle (needs embedding). */
clustering?: boolean;
/** The LLM cluster-namer (needs clustering). */
labeling?: boolean;
/** BYOK embeddings (wave 6, 2026-09-23): the provider embedding model
* as a "provider:id" slug (openrouter:…, openai:…, google:…). null =
* no model — embedding/clustering/injection skip honestly (info log,
* graph stays textual); no factory floor exists. Keys live in the auth
* store, resolved fresh per call. A model CHANGE re-embeds everything
* (the ledger's staleness semantics). */
embeddingModel?: string | null;
}
/** THE record. Every section optional (delta); unknown top-level keys are
@@ -318,7 +309,7 @@ export const FACTORY_SETTINGS: FactorySettings = {
sessionNameSerif: true,
mdRendering: { headingWeight: 900, boldColor: null, italicColor: null },
},
graph: { enabled: true, embedding: true, clustering: true, labeling: true, embeddingModel: null },
graph: { enabled: true },
};
// ─── Sanitizer ─────────────────────────────────────────────────────────────
@@ -467,23 +458,15 @@ function sanitizeAppearance(raw: Record<string, unknown>): AppearanceSettings {
}
function sanitizeGraph(raw: Record<string, unknown>): GraphSettings {
// Wave 7 collapse (owner ruling 2026-09-23): the section is the master
// switch ONLY. The dead rungs' keys (embedding/clustering/labeling/
// embeddingModel) in existing records are simply UNREAD and DROPPED by
// this reconstruction — the migration story: the next graph-section
// write (PUT is replace-whole) persists the collapsed shape, and no
// active code ever looks at the stale fields.
const out: GraphSettings = {};
const enabled = boolOrDrop(raw.enabled);
if (enabled !== undefined) out.enabled = enabled;
const embedding = boolOrDrop(raw.embedding);
if (embedding !== undefined) out.embedding = embedding;
const clustering = boolOrDrop(raw.clustering);
if (clustering !== undefined) out.clustering = clustering;
const labeling = boolOrDrop(raw.labeling);
if (labeling !== undefined) out.labeling = labeling;
// BYOK embeddings (wave 6): null or a provider-qualified slug; anything
// else (bad type, bad shape) DROPS to absent — an invalid write never
// becomes a live model (the PUT parser 400s it first; this is the
// read-side belt-and-suspenders for hand-edited files).
if (raw.embeddingModel === null) out.embeddingModel = null;
else if (typeof raw.embeddingModel === "string" && /^\S+:\S+$/.test(raw.embeddingModel)) {
out.embeddingModel = raw.embeddingModel;
}
return out;
}