// The platform guide: what the tower does, what each page is for, how to use it, and the words it uses.
import { Icon } from "../lib/icons.jsx";
import { useData } from "../lib/data.jsx";
import { CardHead, KindTag } from "../components/common.jsx";
import { Page } from "./Page.jsx";
import { titleCase, tr, trx } from "../lib/i18n.js";
// Built when the page renders, so it is in the language chosen in Settings.
const FLOW = () => [
{ icon: "mail", t: tr("Message arrives"), p: tr("A supplier email, plant alert, dealer note or rumor lands in the event feed.") },
{ icon: "cpu", t: tr("Read"), p: tr("The LLM reads it and explains its reasoning; the rule reader checks the reading against the company tables.") },
{ icon: "graph", t: tr("Trace"), p: tr("Agents follow the knowledge graph from the part, plant or lot to every order, dealer and vehicle affected.") },
{ icon: "wrench", t: tr("Act"), p: tr("Specialist agents plan tool calls; the coordinator checks each one against the handbook, then runs it.") },
{ icon: "alert", t: tr("Escalate"), p: tr("Rumors and anything that can't be confirmed go to a human. Nothing is changed for them.") },
];
// Built when the page renders, so it is in the language chosen in Settings. demo: online, the number of
// demo events (the short set the online version uses); 0 on a laptop.
const TOUR = (demo) => [
{ id: "overview", icon: "home", t: tr("Overview"), p: tr("The state of the run at a glance."),
points: [tr("Headline counts: events, tool calls, escalations, test pass rate"), tr("Agent team and what each agent may do"), tr("Tool calls per event; click a bar to open that event")] },
{ id: "events", icon: "feed", t: tr("Event center"), p: tr("Every message and exactly what the tower did about it."),
points: [tr("Every event, filterable by outcome and incident type"), tr("How it was read and the graph path it traced"), tr("Every tool call and the audit trail")] },
{ id: "add", icon: "plus", t: tr("Add events"), p: tr("Give the tower a new message, or run the whole feed."),
points: [tr("Type, paste, attach a file, or dictate by voice (Safari or Chrome)"), tr("The tower reads it, acts or escalates, and adds it to the feed"), demo ? tr("Run events walks the {n} demo events", { n: demo }) : tr("Run events walks the 15 given events and the chat's events")] },
{ id: "tests", icon: "check", t: tr("Tests"), p: tr("How well the tower predicts, scored against answer keys."),
points: [demo ? tr("Run tests and watch each of the {n} demo events pass or fail as it finishes", { n: demo }) : tr("Run tests and watch each of the 15 given events pass or fail as it finishes"), tr("Pass rate by kind of message"), tr("Open one event: input, expected output, actual output")] },
{ id: "ontology", icon: "graph", t: tr("Knowledge graph"), p: tr("The company's records and how they connect."),
points: [tr("Network, schema, or one event's traced records"), tr("Drag, click to focus, scroll to zoom"), tr("Edge types and the traversals agents use")] },
{ id: "records", icon: "table", t: tr("Company records"), p: tr("The company's tables, to write your own test messages."),
points: [tr("Suppliers, shipments and lots for delays and quality holds"), tr("Plants, dealers, orders, vehicles and customers"), tr("Search any table and page through the large ones")] },
{ id: "logs", icon: "doc", t: tr("Logs"), p: tr("The raw record behind every page."),
points: [tr("Every tool call, filterable by event or failure"), tr("Every notification and agent handoff, across all events"), tr("History of every test run")] },
];
// Built when the page renders, so it is in the language chosen in Settings.
const TERMS = () => [
{ term: , d: tr("A part or shipment will arrive late. Production orders that need it are moved.") },
{ term: , d: tr("A plant can't build for some days. Its orders move to the earliest feasible slot.") },
{ term: , d: tr("A lot is defective. The lot is held, unsold vehicles stop sale, owners are told.") },
{ term: , d: tr("Hearsay or a report that can't be checked. Escalated to a human; nothing changes.") },
{ term: , d: tr("Not operational (a brochure question, a thank-you). No action.") },
{ term: {titleCase(tr("Reader"))}, d: tr("What turned the message into incidents: the model (checked by rules) or the rules alone.") },
{ term: {titleCase(tr("Expected output"))}, d: tr("A test case's answer key traced through the company tables: what a correct tower would change.") },
];
// Built when the page renders, so it is in the language chosen in Settings.
const USE = (demo) => [
{ icon: "plus", t: tr("Give it events"), p: demo ? tr("On Add Events, type or paste a message, attach a file, or dictate it. Run Events plays the {n} demo events in as if they were arriving live.", { n: demo })
: tr("On Add Events, type or paste a message, attach a file, or dictate it. Run Events plays the 15 given events in as if they were arriving live.") },
{ icon: "feed", t: tr("See what it did"), p: tr("The Event Center opens on Results: what the tower did with each event. Switch to Feed for how each message was read and every action taken.") },
{ icon: "doc", t: tr("Export the history"), p: tr("From the Event Center, download the events shown as a readable log, a spreadsheet, or a full data file.") },
{ icon: "check", t: tr("Check the scores"), p: demo ? tr("Tests compares the tower's actions with answer keys, case by case, for the demo events.")
: tr("Tests compares the tower's actions with answer keys, case by case, for the given events and the blind set.") },
{ icon: "graph", t: tr("Explore the records"), p: tr("The Knowledge Graph shows the company's records and the paths the agents follow from a problem to the people it affects.") },
{ icon: "wrench", t: tr("Make it yours"), p: tr("Settings sets the theme, language, number format, time zone and voice input.") },
];
// Built when the page renders, so it is in the language chosen in Settings.
const SOURCES = (demo) => [
[tr("Overview, Event center"), tr("The events in the feed and every action the tower took")],
[tr("Tests"), tr("Saved test runs, scored against answer keys")],
[tr("Answer keys"), demo ? tr("Written by hand for each demo event") : tr("Written by hand for the 15 given events; built from the company records for the blind set")],
[tr("Knowledge graph"), tr("The company records: plants, parts, suppliers, orders, dealers, vehicles and owners")],
[tr("Logs"), tr("Every tool call, notification and agent handoff, and the test history")],
[tr("Notifications"), tr("The messages sent to dealers and owners for each event")],
];
export default function Guide() {
const d = useData();
return (
{tr("What the control tower does and how to use each page")}{trx("Start on {page}", { page: {titleCase(tr("Add events"))} })}>}>