All files / src/apps/home/pages/docs/content reference.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444    2x                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
import type { DocContent } from "../docsTypes";
 
export const reference: Record<string, DocContent> = {
  "/docs/reference": {
    title: "Reference",
    description:
      "Resource shapes, the rule vocabulary, the widget catalogue, settings, and platform security.",
    image: { src: "/pages/sec.jpg", alt: "Security and governance across CHAIN-R" },
    sections: [
      {
        paragraphs: [
          "The reference pages are the tables behind the guides: what each resource is made of, exactly what a rule may say, every widget a board can hold, what each settings page controls, and how authentication, access and data handling work under the hood.",
        ],
      },
      {
        heading: "In this section",
        cards: [
          { title: "Resource Reference", text: "Every resource type, what it is for, and what you set on it." },
          { title: "Rule Vocabulary", text: "Scopes, condition fields, operators, actions and their parameters, and the outcomes a rule records." },
          { title: "Widget Catalogue", text: "Every widget type with its provenance class, and the metrics, dimensions and periods a breakdown tile can use." },
          { title: "Evaluations & Simulations", text: "How the two differ, and where simulations stand today." },
          { title: "Settings & Account", text: "Profile, subscription, security and sessions, appearance, and how your data is handled." },
          { title: "Roles, Access & Security", text: "Sign-in, sessions, internal authentication, membership and data handling." },
        ],
      },
    ],
  },
 
  "/docs/reference/resources": {
    title: "Resource Reference",
    description: "Every resource type CHAIN-R is built from, what it is for, and what you set on it.",
    sections: [
      {
        paragraphs: [
          "Every resource below is owned by you, a project or an organisation, keeps an edit history, and can carry generative provenance. Models are the exception: they are the platform's records.",
        ],
        table: {
          headers: ["Resource", "Where", "What it is"],
          plainFirstColumn: true,
          rows: [
            ["Agent", "Inference → Agents", "A named assistant: system prompt, model, appearance, and attached repositories and skillsets."],
            ["Model", "Inference → Models", "A provider model with capabilities, effort band, context window, data region and pricing. Has a chat playground. No history."],
            ["Skill", "Inference → Skillsets → Skills", "A typed graph of worker, tool and transform nodes with an input/output interface."],
            ["Skillset", "Inference → Skillsets", "A named bundle of skills, attached to agents."],
            ["Knowledge source", "Knowledge → Sources", "One knowledge base: uploaded files, a website, a database, an API or a graph."],
            ["Repository", "Knowledge → Repositories", "A group of sources granted to agents as a whole."],
            ["Rule", "Governance → Rules", "A rule in one layer — Access, Input or Output — with a scope, conditions and actions."],
            ["Dataset", "Governance → Evaluation → Datasets", "Questions and what a good answer to each is; home to its experiments."],
            ["Experiment", "Governance → Evaluation → a dataset", "One scorer and one or more variants on its dataset; owns its runs."],
            ["Dashboard", "Dashboards", "A board of widgets with a layout; one is your home board."],
            ["Project", "Projects", "A workspace inside an organisation that owns resources and has members."],
            ["Organisation", "Orgs", "The top-level team container that owns resources and projects and has members."],
          ],
        },
      },
      {
        heading: "What you configure",
        paragraphs: [
          "Each resource is configured from its own page. The settings below are the ones that shape how a resource behaves — the rest are managed for you.",
        ],
        table: {
          headers: ["Resource", "What you set"],
          plainFirstColumn: true,
          rows: [
            ["Agent", "Name, description, icon and accent; the system prompt; the repositories and skillsets it may draw on. The model is assigned or defaults to the platform's chat model."],
            ["Skill", "Name, description and tags; the graph — nodes, their bindings and per-node model pins, edges and conditional routing; the skill's typed inputs and outputs."],
            ["Skillset", "Name, description, appearance, and the skills it bundles."],
            ["Knowledge source", "Name, description, appearance, type, and the type's configuration: documents and folders, URLs and crawl depth, a connection string and query, or an endpoint and auth header."],
            ["Repository", "Name, description, appearance, and the sources it groups."],
            ["Rule", "Name, type, priority, scope (and a pinned resource), conditions, and actions with their parameters."],
            ["Dataset", "Name, description, criteria for every case, and cases — each with input, conversation so far, variables, criteria, reference answer, graded examples, checks and tags — added by hand or imported from CSV, JSONL or JSON."],
            ["Experiment", "Name, scorer and its settings (pass mark, judge model, matching options), and variants — each a target, a system prompt and its knowledge and tools. Its dataset is set when it is created."],
            ["Dashboard", "Name, icon and accent, whether it is your home board, and its widgets — each with a type, title, size, position, configuration and refresh interval."],
            ["Project / Organisation", "Name and description; members and roles."],
          ],
        },
      },
      {
        callout: {
          tone: "info",
          title: "Every change is versioned",
          text: "Editing any of these resources records a new version with the change, who made it and when — so the configuration in force at any past moment can be recovered and evidenced. See Version History & Traceability.",
        },
      },
    ],
  },
 
  "/docs/reference/rule-vocabulary": {
    title: "Rule Vocabulary",
    description:
      "Exactly what a rule may say: scopes, condition fields, operators, actions and their parameters, and the outcomes a rule records.",
    sections: [
      {
        paragraphs: [
          "The rule builder offers only what the rule engine can evaluate, and this page lists that vocabulary. A rule using anything outside it — which can only happen through the API — never matches and never fires, and logs a warning.",
        ],
      },
      {
        heading: "Scopes",
        table: {
          headers: ["Scope", "Covers", "Pin to a resource?"],
          rows: [
            ["global", "Every invocation you make.", "No"],
            ["organisation", "Everything owned by an organisation.", "Optional"],
            ["project", "Everything owned by a project.", "Optional"],
            ["model", "Every turn that resolves to a model, including through an agent.", "Optional"],
            ["agent", "An agent's turns.", "Optional"],
            ["skill", "A skill, wherever it runs.", "Optional"],
            ["worker", "A worker, in any skill.", "Optional"],
          ],
        },
      },
      {
        paragraphs: [
          "A scope without a pin covers every resource of that kind. An invocation is matched against the whole chain of resources it touches, so a rule applies when it targets any link. Ordering is by priority, then narrowest first.",
        ],
      },
      {
        heading: "Condition fields",
        table: {
          headers: ["Field", "Group", "Type", "Available to"],
          rows: [
            ["always", "general", "—", "All types"],
            ["prompt", "content", "text", "Policy, audit"],
            ["response", "content", "text", "Audit"],
            ["pii_detected", "classifier", "boolean", "Policy, audit"],
            ["pii_types", "classifier", "list", "Policy, audit"],
            ["execution_type", "invocation", "text", "All types"],
            ["user_id", "invocation", "text", "All types"],
            ["agent_id", "invocation", "text", "All types"],
            ["agent_name", "invocation", "text", "All types"],
            ["tags", "invocation", "list", "All types"],
            ["model_name", "model", "text", "All types"],
            ["provider", "model", "text", "All types"],
            ["prompt_tokens", "cost", "number", "Policy, audit"],
            ["response_tokens", "cost", "number", "Audit"],
            ["total_tokens", "cost", "number", "Audit"],
            ["estimated_cost_usd", "cost", "number", "Audit"],
            ["latency_ms", "cost", "number", "Audit"],
          ],
        },
      },
      {
        heading: "Operators",
        table: {
          headers: ["Operator", "Reads as", "Applies to"],
          rows: [
            ["eq / neq", "is / is not", "Any"],
            ["contains / not_contains", "contains / does not contain", "Text, list"],
            ["starts_with / ends_with", "starts with / ends with", "Text"],
            ["matches / not_matches", "matches regex / does not match regex", "Text"],
            ["gt / gte", "is greater than / is at least", "Number"],
            ["lt / lte", "is less than / is at most", "Number"],
            ["in / not_in", "is one of / is none of", "Any"],
            ["has_any / has_all / has_none", "has any of / has all of / has none of", "List"],
          ],
        },
      },
      {
        paragraphs: [
          "Text comparisons ignore case. Numeric operators compare as numbers, so a value typed into the builder never compares lexically. Regular expressions are capped in length and in the amount of text scanned. An operator paired with a field type it does not apply to never matches.",
        ],
      },
      {
        heading: "Actions and their parameters",
        table: {
          headers: ["Action", "Layer", "Parameters"],
          rows: [
            ["rate_limit", "access", "max_invocations, window_seconds (default one hour), message."],
            ["cost_cap", "access", "max_usd, period, window_seconds (default one day), message."],
            ["require_evaluation", "access", "dataset_id (optional; empty means every dataset the agent ran), min_score (optional; overrides the dataset's pass mark), message."],
            ["block", "input", "message — what the caller is told."],
            ["redact_pii", "input", "kinds (optional) — the kinds of personal data to replace; empty means the default set. Applies to the prompt, the conversation history, attached documents and answers."],
            ["redact_pii", "output", "kinds (optional), as in the Input layer. Applies to the response as it streams, its trace and what is stored."],
            ["flag_for_review", "output", "reviewer (optional), retention_days (optional; empty keeps the flag indefinitely)."],
          ],
        },
      },
      {
        heading: "Outcomes",
        table: {
          headers: ["Outcome", "Meaning"],
          rows: [
            ["blocked", "The rule refused the invocation."],
            ["applied", "It matched and its actions changed something."],
            ["no_change", "It matched, its actions ran, and there was nothing to do."],
            ["not_matched", "Its conditions did not hold, so no action ran."],
          ],
        },
      },
      {
        callout: {
          tone: "info",
          title: "Quotas are evaluated centrally",
          text: "Rate limits, cost caps and the evaluation gate are evaluated in the control plane before a model is called; Input and Output actions are also re-enforced inside a skill graph run. Unknown fields, operators and actions never match — an unevaluable condition is never treated as true.",
        },
      },
    ],
  },
 
  "/docs/reference/widgets": {
    title: "Widget Catalogue",
    description:
      "Every widget type a board can hold, its provenance class, and the metrics, dimensions and periods a breakdown tile can use.",
    sections: [
      {
        paragraphs: [
          "The widget catalogue is served by the platform, so a new widget type appears in the picker without a release of the app. Each declares its **provenance class** — where its content comes from — and whether it is **dynamic**, meaning it refreshes on a schedule.",
        ],
        table: {
          headers: ["Widget", "Provenance", "What it shows"],
          rows: [
            ["note", "stored", "A markdown note — context, a checklist, a reminder."],
            ["shortcuts", "stored", "Quick links to the pages and resources you use most."],
            ["stat", "platform", "One usage or cost metric as a headline number."],
            ["chart", "platform", "Spend, tokens, latency or source trust over time, account-wide."],
            ["breakdown", "platform", "A metric split by agent, model, project, organisation, rule and more, as a bar chart, list or value."],
            ["pinned_message", "stored", "One answer kept from a chat, with a link back."],
            ["message_list", "stored", "A list you save chat answers into."],
            ["resource_list", "platform", "Your most recent agents, knowledge bases, skillsets or chats."],
            ["weather", "feed", "Current conditions and a multi-day forecast for a place you pick."],
            ["rss", "feed", "Headlines straight from a source's own feed — no model in between."],
            ["market", "feed", "Quotes for a watchlist and a price chart from a market data vendor."],
            ["automation", "generated", "A prompt run on a schedule by an agent or model — a digest, a summary, an analysis."],
            ["comparison", "generated", "Subjects placed on one to four named axes by a model; two axes render as a scatter plot."],
          ],
        },
      },
      {
        heading: "Breakdown metrics",
        paragraphs: [
          "A breakdown names a **metric**; the metric determines which record it counts from, so a tile can never state a table its figure did not come from.",
        ],
        table: {
          headers: ["Metric", "Source", "Unit"],
          rows: [
            ["invocations", "usage", "count of invocations that came back"],
            ["input_tokens / output_tokens / total_tokens", "usage", "tokens"],
            ["estimated_cost_usd", "usage", "USD — a lower bound; an unpriced model contributes nothing"],
            ["avg_latency_ms", "usage", "milliseconds, over timed invocations"],
            ["errors / error_rate", "usage", "count / percent of attempts"],
            ["evaluations", "governance", "every rule evaluated, matched or not"],
            ["blocked / applied / no_change / not_matched", "governance", "count per outcome"],
            ["block_rate", "governance", "percent of evaluations"],
            ["redacted_values / redaction_events", "redactions", "values removed / responses with something removed"],
            ["flags / pending_flags / reviewed_flags / dismissed_flags", "reviews", "count per status"],
          ],
        },
      },
      {
        heading: "Breakdown dimensions",
        table: {
          headers: ["Dimension", "Source", "Buckets by"],
          rows: [
            ["agent, model, skill, worker", "usage", "the resource that ran"],
            ["project, organisation", "usage", "the resource's owner"],
            ["execution_type, outcome", "usage", "what kind of run, and whether it succeeded"],
            ["rule, rule_type, governance_outcome, phase, enforced_in", "governance, redactions", "the rule, its type, the outcome, prompt or response, and where it ran"],
            ["governed_agent, governed_execution_type", "governance, redactions", "the agent and run kind the rule governed"],
            ["redaction_kind", "redactions", "email, card and other kinds"],
            ["flag_rule, review_status, reviewer, flagged_agent", "reviews", "the flag's columns"],
          ],
        },
      },
      {
        paragraphs: [
          "A metric and a dimension must come from the same source; a pairing across sources is refused when the tile is saved and again when it refreshes, rather than answered with an unlabelled total. Buckets are named from the resource's current name and keep their figure, marked missing, once it is deleted.",
        ],
      },
      {
        heading: "Periods",
        table: {
          headers: ["Period", "Window"],
          rows: [
            ["last_24_hours", "The trailing day."],
            ["last_7_days", "The trailing week."],
            ["last_30_days", "The trailing thirty days."],
            ["this_month", "Since the first of the current month — re-evaluated every time, so a tile made in January reports March in March."],
            ["all_time", "Everything recorded."],
          ],
        },
      },
      {
        callout: {
          tone: "info",
          title: "Nulls are not zeros",
          text: "A cost over a model with no published price, or a latency over untimed rows, is unmeasured rather than zero, and the tile shows a dash rather than $0.00. A bucket that aggregates to nothing measurable is left off the chart rather than drawn as an empty bar.",
        },
      },
    ],
  },
 
  "/docs/reference/evaluations-simulations": {
    title: "Evaluations & Simulations",
    description:
      "Measuring how agents and prompts perform against your own cases, and exploring how they behave together.",
    sections: [
      {
        heading: "Experiments",
        paragraphs: [
          "An **experiment** belongs to one **dataset** of cases, grades every answer with one **scorer**, and compares the **variants** — the models, agents and prompts — you add to it. Each **run** produces a ranked leaderboard, a per-case matrix and a verdict against the experiment's previous run, and **Reports** reads runs across every experiment. The full walkthrough, including how datasets, experiments and reports divide the work, is in **Evaluating Agents** under the Platform Guide.",
        ],
        table: {
          headers: ["Scorer", "Grades by"],
          rows: [
            ["exact_match", "The answer equals the expected output."],
            ["contains / not_contains", "The answer includes, or does not include, the text in the case's checks."],
            ["regex", "The answer matches the case's pattern."],
            ["json_match", "The answer is JSON matching a structure."],
            ["llm", "A judge model scores the answer against the dataset's and the case's criteria and graded examples."],
            ["manual", "Unscored; a person grades it."],
          ],
        },
      },
      {
        heading: "Simulations",
        paragraphs: [
          "A **simulation** runs one or more agents inside a defined world and scenario, end to end, and captures the resulting transcript and outcome. Simulations produce no score, so they sit apart from experiments: use them to see how agents behave together in a controlled, repeatable setting.",
        ],
      },
      {
        callout: {
          tone: "info",
          title: "On our roadmap",
          text: "Simulations currently run a stand-in built from the agent's prompt rather than the agent itself, so they are reachable by link but not in the main navigation. Running the real agent, with its knowledge, tools and rules, is planned as the basis of an agent testing sandbox.",
        },
      },
    ],
  },
 
  "/docs/reference/settings": {
    title: "Settings & Account",
    description:
      "Profile, subscription, security and sessions, appearance, and how your data is handled — what each settings page shows.",
    sections: [
      {
        appPath: ["Settings"],
        paragraphs: [
          "Settings is grouped into **Account** — Profile, Subscription, Security — **Preferences** — Appearance — and **Data & privacy** — Data, Privacy. Each page is a tab of the same layout. Data and Privacy state how the platform handles your data rather than offer settings: where it is stored and processed is a property of the deployment, not a per-user choice.",
        ],
        table: {
          headers: ["Page", "What it controls"],
          plainFirstColumn: true,
          rows: [
            ["Profile", "Your display name, nickname and email address, whether the email is verified, and your user id."],
            ["Subscription", "Your plan, and usage against its limits — models, agents, projects, knowledge bases and organisations."],
            ["Security", "Email verification, password, and your **active sessions**: every device signed in as you, where it signed in from, with the option to revoke one or sign out everywhere else."],
            ["Appearance", "Theme (light, dark or follow the system) and the accent colour used for highlights and controls."],
            ["Data", "Where your data is stored, which model providers and other services receive it and in which region, how long it is kept. **Download your data** gives you a zip of everything you own, credentials left out; account deletion is by email for now."],
            ["Privacy", "What the platform records about your use of it (no product analytics, no outside error reporting), what model providers do with your prompts, and the cookies it uses."],
          ],
        },
      },
      {
        heading: "Sessions and sign-in locations",
        appPath: ["Settings", "Security", "Sessions"],
        paragraphs: [
          "Every sign-in creates a session, recorded with the device and an approximate location resolved offline from the sign-in address — the platform never sends your address to a third party to place it. The Security page lists active sessions on a map and as rows, and each can be revoked. Revoking a session signs that device out immediately.",
        ],
      },
      {
        heading: "The developer portal",
        paragraphs: [
          "There is no developer portal in the navigation yet, because there is no API behind it. A **governed API**, giving your own applications server-to-server access to your agents through the same rules, cost ledger and audit trail, and a managed **secrets vault** are both on the roadmap. See **Roles, Access & Security**.",
        ],
      },
      {
        callout: {
          tone: "info",
          title: "Appearance is saved in your browser",
          text: "Theme and accent colour are kept in the browser you set them in, so another device starts from the defaults. CHAIN-R sends no email yet, so there are no email preferences.",
        },
      },
    ],
  },
 
  "/docs/reference/security": {
    title: "Roles, Access & Security",
    description:
      "How authentication, sessions, internal service authentication, membership and data handling work across CHAIN-R.",
    sections: [
      {
        heading: "Signing in",
        paragraphs: [
          "CHAIN-R is used through the web application, authenticated over **OAuth2** against a managed identity provider. Once you are signed in, your browser holds only a signed, HTTP-only session cookie — credentials and provider tokens are never exposed to client-side code and are held server-side for the life of the session. Sessions are listed and revocable under Settings → Security.",
        ],
      },
      {
        callout: {
          tone: "info",
          title: "Coming soon",
          text: "Single sign-on against your own identity provider, and server-to-server API key access for external integrations, are both on our roadmap — neither is available yet.",
        },
      },
      {
        heading: "How requests are protected",
        diagram: {
          kind: "stack",
          bands: [
            { node: { label: "TLS at the edge", sub: "then an encrypted tunnel to our servers, which accept no inbound connections; everything else is on private networks" } },
            { node: { label: "Session check", sub: "every app request is gated on your session before it reaches a service" } },
            { node: { label: "Service-to-service tokens", sub: "each internal hop carries a short-lived, audience-bound credential — nothing trusts a request for arriving from inside" } },
            { node: { label: "Explicit egress", sub: "only the inference service reaches model providers; only feed widgets reach feed sources; the data stores reach nothing" } },
          ],
        },
        diagramCaption:
          "User-supplied feed URLs are refused if they resolve to a private, loopback or reserved address, and re-checked on redirect, so a dashboard tile cannot be used to reach inside the platform.",
      },
      {
        heading: "Membership & access",
        paragraphs: [
          "Access to an organisation's or project's resources is governed by membership. A resource is reachable by its owner — you, or the members of the project or organisation that owns it — and by no one else. In an organisation, **admins** manage members, invites and settings, and each **member** holds a level — reader, writer or editor — in each of four areas: agents, knowledge, governance and dashboards. Readers use, writers also create and change their own, editors change anything; it always keeps one admin.",
          "Invites are single-use links bound to one email address, valid for seven days. Only a hash of each link is stored, so a link cannot be recovered once it has been shown, and accepting one is refused to anyone signed in with a different address.",
          "Each workspace — Personal, an organisation, or a project — owns its own work, and its rules govern the work done in it, whoever does it; a person's own rules don't follow them into an organisation. Only an organisation's governance editors can change its rules or require one of every project; its quotas count the organisation and all its projects together, and a flag lands in the review queue of the workspace it was raised in. An organisation's agent is judged on the organisation's evaluations, so every member is held to the same evidence.",
          "Experiments honour the same boundary: a variant can only be given knowledge and tools that the experiment's own owner can reach, and an id outside that reports as not found.",
        ],
      },
      {
        callout: {
          tone: "info",
          title: "On our roadmap",
          text: "Finer-grained, per-resource access control — who may invoke which agent, edit which prompt, read which knowledge base — a managed secrets vault for credentials that agents reference by name, and MCP servers for connecting agents to your own tools are planned additions.",
        },
      },
      {
        heading: "Data handling",
        list: [
          "**Knowledge** is indexed into an isolated store per owner, so retrieval never crosses organisational boundaries.",
          "**Credentials** in a resource's configuration — a source's auth header, say — are excluded from its version snapshots and from stored generation arguments.",
          "**Redactions** are logged as kinds and counts, never as the matched text; review excerpts are taken after redaction rules have run.",
          "**Usage and governance records** are append-only and written in the same transaction as the turn they describe, so they can never count a turn that was rolled back.",
          "**Model providers** receive only what a governed turn sends them — after Access and Input rules have run on the prompt.",
        ],
      },
      {
        heading: "Monitoring and incident response",
        paragraphs: [
          "The platform ships with metrics, logs and traces behind a monitoring surface, security findings routed to on-call, and an incident path. See **Rules & Governance** for how Access, Input, Tools and Output rules are enforced on top of this at inference time, and **Governance Activity & Reviews** for the evidence they leave.",
        ],
      },
    ],
  },
};