fix(curation): kill dev-artefact leak + rename agent honestly

Oracle remediation batch 1 — closing gaps #1 (agent overclaim), #4
(demo-data leak), #5 (raw-ID exposure):

- src/lib/flowCuration.ts: shared isDevArtefact + curatedPublishedFlows
  filter for the whole codebase. Patterns drop rv_/orphan/Atlas F1/MCP
  SDX/Codex Test/sidekick/process_<ts>/backfill/smoke/probe/fixture and
  the EA2_* internal source_contexts.
- src/scenes/Hub.tsx: loadPublishedFlows uses the shared curator
- src/lib/agentTools.ts: list_processes and start_process both use the
  shared curator; raw transaction_id no longer in start reply
- src/state/store.ts: snapshot + live merges curated; resolveDefaultStepId
  guards against scenarios whose defaultStepId references a stale step
- src/scenes/Wizard.tsx: 'Process definition <hex>' confirmation replaced
  with the user-facing process name
- src/scenes/Hub.tsx: start toast no longer shows transaction_id prefix
- src/scenes/Agent.tsx + App.tsx + Landing.tsx: rename Pi -> FlowMaster
  Command Assistant. Welcome message says explicitly that this is a
  deterministic router and the LLM agent + tenant memory are on the
  roadmap. Tab label, hub chip, turn author all rebranded.
- src/scenes/GeoAttendance.tsx: scene re-titled to 'Attendance map ·
  preview' with honest copy explaining the dataset is illustrative until
  the EA2 attendance feed is wired in.
- src/data/synthetic.ts: orphaned from runtime (kept in tree for tests).
  Snapshot now sources only the live-cached EA2 read (scenarios.json),
  filtered through the same curator.

29/29 tests green. No more 'rv test flow 0' / 'orphan' / 'Atlas F1' / raw
32-char hex IDs visible to a buyer.
This commit is contained in:
2026-06-14 13:11:54 +04:00
parent 7ceb5c05bb
commit 8933148719
9 changed files with 109 additions and 48 deletions
+9 -21
View File
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
import { useApp } from "../state/store";
import { api } from "../lib/api";
import { wizardApi } from "../lib/wizardApi";
import { curatedPublishedFlows } from "../lib/flowCuration";
import { Branch, Layers, Pulse } from "../components/icons";
export type HubKey = "procurement" | "hr" | "it";
@@ -57,32 +58,18 @@ interface PublishedFlow {
name?: string;
}
const NON_BUSINESS_SOURCE_CONTEXTS = new Set([
"EA2_CHAT_THREAD",
"EA2_CHAT_MSG",
"EA2_WIZARD_STEP",
]);
async function loadPublishedFlows(): Promise<PublishedFlow[]> {
const res = await fetch(`${api.config.baseUrl}/api/ea2/flow/processes?limit=200`, {
headers: { Authorization: `Bearer ${sessionStorage.getItem("fm.mc.token.v1")}` },
});
if (!res.ok) throw new Error(`processes ${res.status}`);
const body = await res.json();
return ((body?.items || []) as any[])
.filter(
(it) =>
it.status === "published" &&
it.kind === "definition" &&
it.display_name &&
!NON_BUSINESS_SOURCE_CONTEXTS.has(it.source_context)
)
.map((it) => ({
_key: it._key,
display_name: it.display_name,
description: it.description,
name: it.name,
}));
return curatedPublishedFlows((body?.items || []) as any[]).map((it) => ({
_key: it._key,
display_name: it.display_name!,
description: it.description,
name: it.name,
}));
}
export default function Hub({ hub }: { hub: HubKey }) {
@@ -110,7 +97,8 @@ export default function Hub({ hub }: { hub: HubKey }) {
setBusy(flowKey);
try {
const res = await wizardApi.startInstance(flowKey, subject);
pushToast("ok", `Started ${label}${subject ? ` for ${subject}` : ""}${res.transaction_id?.slice(0, 8) || "ok"}`);
void res;
pushToast("ok", `Started ${label}${subject ? ` for ${subject}` : ""}.`);
setScene("mission");
} catch (err: any) {
pushToast("err", `Start failed: ${err.message}`);