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:
+12
-31
@@ -289,41 +289,22 @@ export function parseAppearanceSettingsBody(body: unknown): SettingsBodyResult<A
|
||||
return { ok: true, settings };
|
||||
}
|
||||
|
||||
/** graph: the four-rung ladder { enabled?, embedding?, clustering?, labeling? }
|
||||
* + embeddingModel? — the BYOK provider embedding model (wave 6,
|
||||
* 2026-09-23): null or a "provider:id" slug of a shipped provider.
|
||||
* Catalog validity is network-dependent — the parser checks SHAPE only
|
||||
* (the federated /api/models/embeddings gives the picker real options). */
|
||||
/** graph: the collapsed section { enabled? } (wave 7, owner ruling
|
||||
* 2026-09-23): the master switch ONLY — the embedding/clustering/labeling
|
||||
* rungs and the BYOK embeddingModel died with the provider embedder
|
||||
* (clustering is the free birth-session partition, labels are session
|
||||
* names). Old-shape keys in a body are ignored, not rejected. */
|
||||
export function parseGraphSettingsBody(body: unknown): SettingsBodyResult<GraphSettings> {
|
||||
const raw = asRecord(body);
|
||||
if (!raw) return { ok: false, error: "Invalid JSON body" };
|
||||
// Wave 7 collapse (owner ruling 2026-09-23): the section is the master
|
||||
// switch ONLY. PUT is replace-whole — a body like {enabled: true} IS the
|
||||
// whole section now; the dead rungs' keys in old records are unread
|
||||
// (the sanitizer drops them; see sanitizeGraph).
|
||||
const settings: GraphSettings = {};
|
||||
for (const key of ["enabled", "embedding", "clustering", "labeling"] as const) {
|
||||
if (raw[key] !== undefined) {
|
||||
if (typeof raw[key] !== "boolean") {
|
||||
return { ok: false, error: `${key} must be a boolean` };
|
||||
}
|
||||
settings[key] = raw[key];
|
||||
}
|
||||
}
|
||||
if (raw.embeddingModel !== undefined) {
|
||||
if (raw.embeddingModel !== null) {
|
||||
// NOTE: the id may itself contain colons (OpenRouter suffixes like
|
||||
// "liquid/lfm-2.5-embedding-350m:free") — the provider is the part
|
||||
// before the FIRST colon, so the id half just forbids whitespace.
|
||||
if (
|
||||
typeof raw.embeddingModel !== "string" ||
|
||||
!/^(openrouter|openai|google):\S+$/.test(raw.embeddingModel)
|
||||
) {
|
||||
return {
|
||||
ok: false,
|
||||
error: 'embeddingModel must be null or a "openrouter|openai|google:model-id" slug',
|
||||
};
|
||||
}
|
||||
settings.embeddingModel = raw.embeddingModel;
|
||||
} else {
|
||||
settings.embeddingModel = null;
|
||||
}
|
||||
if (raw.enabled !== undefined) {
|
||||
if (typeof raw.enabled !== "boolean") return { ok: false, error: "enabled must be a boolean" };
|
||||
settings.enabled = raw.enabled;
|
||||
}
|
||||
return { ok: true, settings };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user