Docs site
Rendering paths
| Source | Published | Author owns |
|---|---|---|
| HTML document | Article on the shared foundation, plus a generated .html.md copy | Content only; see Writing a docs page |
| Markdown | Article in the site layout | Generated reference pages only; hand-written pages are HTML documents |
| Interactive prototype | Site page with an iframe, plus a .raw.html payload | Own layout, theme and internal navigation |
Only pages in PROTOTYPE_PAGES (governance/policy.py) take this path; any other page that breaks the format fails the build. See Docs governance. The iframe separates layout; it is not a sandbox for untrusted scripts.
Implementation ownership
| Owner | Responsibility |
|---|---|
scripts/docs_site/nav.py | Discovery, language pairing, nine tabs, section placement, PAGE_ORDER |
scripts/docs_site/build.py | Rendering, relative links, static assets, search records, redirects, atomic output |
scripts/docs_site/html_source.py | HTML document parsing, heading ids, Markdown copy |
scripts/docs_site/template.py | Shared layout and page metadata |
scripts/docs_site/search.py | Search index |
scripts/docs_site/assets/site.css | Foundation: type, spacing, responsive layout, light and dark tokens |
scripts/docs_site/assets/site.js | Navigation, language, search, fullscreen, code copy |
scripts/docs_site/assets/theme.js | Theme controller, runs before the body is parsed |
openprogram/interfaces/server/routes/docs.py | Source or packaged site selection, the default worker's /docs/ mount |
Reading and visual design
New pages are HTML documents on one foundation: neutrals with a single blue accent, light and dark. Prototype pages work through --bg, --bg-code, --tx, --tx-soft, --acc and --bd, aliases of the foundation tokens. An article never repeats a fixed light-only palette.
- A page starts from its question, reader, scope and implementation boundary; public entry and data flow come before detail; remaining work closes the page.
- Stable heading
idvalues feed the page navigation. - Diagrams have an accessible title and description. Native disclosure holds detailed evidence. Keyboard focus, reduced motion and phone reading are part of acceptance.
- Wide tables stay in keyboard-accessible horizontal scroll regions at a readable column width. Standalone HTML also gets diagram scroll regions and an opaque fallback canvas when it defines no background. These helpers do not certify the implementation a page describes.
Navigation and bilingual sources
| Rule | Behaviour |
|---|---|
| Tabs | start, install, capabilities, interfaces, models, integrations, server, reference, virtual design. Design sources stay under docs/reference/design/. |
| Order | TAB_SECTIONS sets reading order, PAGE_ORDER page order. An entry naming topic.md also applies to topic.html once the Markdown is gone. Other pages group by directory, under configured labels or README titles. The sidebar is not a filesystem tree. |
| Language | English is default. topic.zh.md pairs with topic.md, topic.zh.html with topic.html, reached through the language control. Change both together. |
| Same-name companions | Beside a Markdown source, the HTML output is topic.viz.html (Chinese topic.zh.viz.html). A relative topic.md link targets the text, topic.html the companion, keeping its anchor. Compatibility only; compare and merge rather than keep two explanations. |
| Excluded | _site, _site.tmp, _site.old, _static_root, images, node_modules. A leading underscore alone excludes nothing. |
Build and serving
python -m scripts.docs_site.check --all
python -m scripts.docs_site.build
python -m scripts.docs_site.checklinks
python -m scripts.docs_site.checklang
python -m scripts.docs_site.check_landing
Run from the repository root with the docs dependencies; the contributor guide lists the uv run form. check needs no build; checklinks reads built HTML, so build first. checklang scans default-language sources, not the pairing with Chinese.
| Stage | Behaviour |
|---|---|
| Build | Regenerates CLI, config and provider reference pages, writes docs/_site.tmp/, then replaces the Git-ignored docs/_site/. |
docs/_static_root/ | Copied in, outside navigation and search; {{SITE_URL}} in its text files becomes the site address. .github/workflows/docs-pages.yml moves root files (robots.txt, sitemap.xml, llms.txt, Search Console proof, IndexNow key, and CNAME when the build writes one for a custom domain) to the site root and checks the proof's contents. The generated sitemap.xml is the only sitemap. |
| Source checkout | Serves its docs/_site/. The worker checks for a rebuild when registering routes; HTTP reads never scan or rebuild. No watch mode. |
| Installed runtime | Serves the bundle under the Server's _frontend/docs/. Rebuilding another checkout does not update it: compare the served page before claiming acceptance. |
Design alternatives
The in-repository Python renderer keeps native HTML, SVG and script content and fits the single-port worker. It uses markdown-it-py, mdit-py-plugins and Pygments, with no client framework, editor or CMS. This compares against this project's needs, not current external products.
| Consideration | Python renderer | VitePress | MkDocs |
|---|---|---|---|
| Native visual documents | Kept as fragments or independent pages | Component and layout integration to evaluate | Raw-HTML and theme integration to evaluate |
| Navigation, search | Maintained here | Built-in, to evaluate | Built-in, to evaluate |
| Toolchain | Python, static browser assets | Additional Node build | Python build and theme configuration |
| Maintenance | Project owns layout, navigation, accessibility | Framework configuration and upgrades | Framework, theme configuration and upgrades |
Reader navigation
| Part | Behaviour |
|---|---|
| Layout | Category tabs above grouped page navigation, central reading column, section index. Narrow: page index becomes a drawer; section index sits behind an expandable reading-progress control. |
| Indicator | One continuous dashed line from the first row to the selected row, rounded at the label center; height changes within a group. Hover and focus preview a separate neutral indicator. Focus is a text underline and subtle row background. Filtering, wrapping, language and resize recompute geometry. |
| Progress | Tracks the active heading in the current scroll container. The disclosure exposes real anchors; choosing one closes it and moves there; Escape and outside clicks dismiss. SPA navigation rebuilds references. Fullscreen uses the content scroller. Hidden for standalone iframes. Reduced motion disables animated scrolling. |
| Code blocks | Language header and an always available copy button outside horizontal overflow. Copies code text only and reports success or failure. Authored copy controls stay. |
| Root overview | Explicit English and Chinese labels, not filename-derived. |
| Dependencies | No external runtime requests. |
Interaction references and acceptance
Rare UI Hook Sidebar, Scroll Progress and Code Block inform an independent implementation in the static assets. No Rare UI source or React dependency is included; reusing component source has separate licensing requirements. Decorative orb, proximity scaling and gooey navigation are excluded because stable text targets matter for reading.
Acceptance: deep links, category and page changes, browser history, language switching, keyboard dismissal, code copying, long and short articles, fullscreen, phone overflow, iframe isolation.
Design information architecture
Three levels: area, module, page. Seven areas: architecture, agents and workflows, context and memory, interfaces, models and external connections, security and engineering, supporting material. The landing page uses the same seven. Architecture lists entry pages directly.
- Each page belongs to one module. Loading or navigating to a page expands its ancestors.
- Filtering matches page and category names, keeps matching ancestors open; clearing restores the prior state at every level. Native details and summary give keyboard operation.
- New pages appear in an Uncategorized area.
- Both languages share hierarchy, order and output mapping.
- Prototypes, implementation records and research stay distinct under Supporting material and do not imply implemented behavior.
Sidebar hierarchy and acceptance
| Element | Rule |
|---|---|
| Label size | Area 13px, module 12px, page 13px |
| Layout | Modules indent 12px only; pages align and wrap naturally |
| Counts | Area level only |
| Selection | Continuous indicator and accent text, no background fill |
| Hover | Stays transparent |
| Keyboard focus | A separate inset ring; no underline on multiline labels |
| Borders | No redundant vertical borders |
| Scope | Design navigation only, in both themes and on narrow screens |
Acceptance: complete unique membership, seven top-level entries, ancestor expansion, filter restoration, bilingual and phone behavior, compatibility with other tabs.
Canonical documents and stable URLs
- One topic, one maintained source. A merge keeps unique diagrams, constraints, status and evidence, and every retired heading as an anchor. Rationale and model-selection analysis sit beside the design contract; usage guides and API references stay separate.
- Filenames are descriptive lowercase hyphenated words, with no dates, TODO or PROBLEM prefixes. Deferred proposals state it in the title.
- Inside a subsystem directory, names and titles omit the subsystem:
context/statistics.html,memory/editor.html,runtime/dag/layout.html. Established terms stay when dropping a word changes meaning. A diagram qualifier is used when a text page already owns the shorter name.
| Redirect aspect | Rule |
|---|---|
| Source | docs/redirects.json, retired output paths to canonical pages, including standalone raw and companion URLs |
| Output | Redirect-only HTML outside navigation, search and sitemap; query strings and fragments kept |
| Execution | Same-origin redirect.js under the worker's CSP; no inline scripts. SPA navigation does a full load, reloading when history already selected that URL |
| Validity | Targets exist; aliases never replace real pages or point to another alias, or the atomic build aborts. Old aliases flatten to the latest output. Language-specific URLs keep their language when a counterpart exists |
Acceptance: each surviving source discovered once, every old URL resolves directly, unique content retained, links and language pass, navigation and redirects verified on the default local mount. Consolidation does not certify deferred designs.
Language consistency
| Item | Rule |
|---|---|
| Authored documents | Full English and Chinese bodies, including diagrams, code, identifiers, links and status boundaries |
| Headings, visible diagram labels | Follow the document language |
| Sidebar, breadcrumbs, previous/next, search | Localized title and destination |
| Language checks | Cover design notes, HTML, SVG and accessible labels, keeping technical identifiers and compatibility anchors; interactive pages also check script-generated text |
| Feature matrix | Both versions use the same numeric, detail-row and chart-consistency checks |
Navigation names
- Form
- Short noun phrases, separate from the full heading, in sentence case keeping proper nouns and acronyms
- English
- Prefer two or three words; one if unambiguous; at most four words and 26 characters
- Chinese
- At most 12 characters
- Removed
- Product or parent prefixes, completeness claims, code signatures, parentheticals
- Modifiers
- Diagram, comparison, prototype, used consistently
- Uniqueness
- Within the same leaf section
- Source
- One bilingual catalogue,
page_titles.json, keyed by canonical source path, supplies navigation, breadcrumbs, search and previous/next. Generated reference names stay code-derived - Check
- Labels fit the sidebar without clipping or ellipsis; bodies, URLs, anchors and hierarchy unchanged
Documentation completeness
The repository README, with a Chinese counterpart of the same structure, introduces the project, verified entry commands, examples and citation. The docs homepage directs to the nine tabs rather than repeating it. Reference overviews link to task guides and generated details.
Reference generation emits English and Chinese pairs from the same argparse tree, settings schema and provider manifests; names, flags, keys, defaults and protocol values stay exact.
- A source-string catalogue (
reference_zh.json) supplies Chinese; a missing translation fails generation. - Both languages traverse every command depth with the same options, and write only when content changes. Removed command pages go in both.
- Reads schema defaults, never user configuration; no credentials.
- Generators finish before discovery; failure aborts the build.
Acceptance: all reference pairs, recursive option parity, missing-translation failure, idempotence, stale-page removal, homepage language links, short names, links, language checks, visible language switching on the default local instance.
Theme preference
| Aspect | Behaviour |
|---|---|
| Preferences | System, light, dark, in op-docs-theme. Missing or invalid values resolve to system |
| System | Follows prefers-color-scheme live |
| Cross-tab | A storage event updates the preference without writing it back |
| Storage failure | In-memory controls and system following keep working |
| First paint | Synchronous same-origin theme.js in the head applies palette, color-scheme and syntax styles before the body parses; replaces an inline bootstrap the script-src 'self' policy rejects |
| Controller | Owns state, media listeners and the accessible, localized three-option menu; survives SPA navigation; dispatches documentThemeChange on the window |
| Boundary | Does not change standalone iframes, which do not receive the event, or the operating system appearance |
Acceptance: first load in both palettes, live system change, overrides and return to system, invalid values, unavailable storage, cross-tab, menu keyboard and language, code colors, SPA navigation. Browser media emulation is restored afterwards.
Heading hierarchy
- A page with no on-page contents hides the empty column and gives it to the article; the fullscreen control stays at the right edge; SPA navigation updates this.
- Nested lists cover h2 through h6. Each heading belongs to the nearest preceding shallower heading; skipped levels make no empty groups. Order, labels and anchors are unchanged.
- Each group has its own indented dashed guide. The selected heading and ancestor path get group-owned indicators; no line spans unrelated depths. Neutral child guides show structure before a child is selected.
- Headings with children use the sidebar's details/summary chevron, which toggles only that subtree; the link still navigates. Leaves have no chevron and keep curved guide endpoints. Groups start expanded and scrolling respects user collapse; a collapsed active descendant marks its parent path, tracking the nearest visible ancestor. No row boxes on hover or selection.
- Endpoints use actual wrapped rows. Previews stay within the sibling group. One
aria-currentlocation. Resize and SPA changes recompute geometry and dispose old observers.
Acceptance: multiple parent groups, skipped levels, deep headings, wrapped rows, active ancestors, hover, resizing, SPA navigation.
Implementation status
| Area | State | Boundary |
|---|---|---|
| HTML document, generated Markdown and prototype rendering | Implemented | Each path has its own layout responsibility |
| Bilingual routing, nine tabs | Implemented | Pairing does not translate the body |
| Atomic build, packaged serving | Implemented | A successful build does not update an installed bundle |
| Shared foundation | Applied to HTML document pages | Remaining standalone pages need individual review |
Frontmatter scripts, styles injection | Not implemented | Use supported HTML paths |
| Continuous source watching | Not implemented | Rebuild explicitly |