Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/docs/CONTRACT.md # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / docs / CONTRACT.md` 292 lines · 24365 bytes Raw Blame History Source # forged interface contract (v2) Owner: ForgeServer. Applies to every unit composed into `forged`. Questions: `write agent://ForgeServer`. `forged` is ONE seeded-Omega program (OM-2), built with the pinned omc (omega-mv `f4df8239`, `seed/out/omc` sha256 `3ad9f10f…3194`, at spark `~/work/flux/omega-mv`). It serves sequentially: one request at a time, so all request/response state lives in globals that every handler reads and writes by name (omc refuses a global as an argument, error 19). Handlers never touch the http.om connection arrays `cs`/`io`. ## 1. Build and unit order `run.sh build` concatenates, in this order, and pipes into omc (`./run.sh units` prints the list): ``` om2 omega-mv seed/net/http.om (names h*, H*) omega-mv seed/net/notls.om omega-mv om/tls/sha2.om (sha256 for anyone: see its own header) server/util.om (this contract: globals f*, helpers f*, texts tf*) server/repos.om (allow-list helpers, repo metadata: both repository sources use them) server/radsrc.om (Radicle source: RIDS.md allow-list, routing table; or .build/store.om + store/repos.om) nodes/head.om (default branch from HEAD; or store/head.om) browse/*.om or server/nobrowse.om ForgeBrowse prefix br* (fns), gb* / tb* (globals / texts) dl/*.om or server/nodl.om ForgeDownloads prefix dl*, gd* / td* (dl/dlclone.om: the clone panel) collab/*.om or server/nocollab.om ForgePatches prefix co*, gc* / tc* social/*.om or server/nosocial.om ForgeSocial prefix so*, gs* / ts* server/json.om server/counts.om (ForgeServer: JSON form fj* / tfj*, counts fz* / tfz*; docs/API.md) store/moving.om (store-reading build only: the 503 "moving" answer mv*, fmvng; docs/API.md) growth/*.om or server/nogrowth.om ForgeGrowth prefix gr* / gg* / tg*; docs/GROWTH.md; after counts so it can read them (store-reading build: store/mvgrowth.om, /trending and /trending.json answer 503) salvage/[0-9][0-9]*.om or server/nosalvage.om salvage (submissions) prefix sl* / gl* / tl*; docs/SALVAGE.md; needs collab/ and social/ composed; salvage/collector.om is its own program (store-reading build: store/mvsalvage.om, salvage/... answers 503) community/[0-9][0-9]*.om or server/nocommunity.om Community Machines prefix cm_*; docs/COMMUNITY.md (store-reading build: store/mvcommunity.om, community/... answers 503) open/route.om or server/noopen.om open builds (Open Humanity shelf) prefix oh* / go* / to*; docs/OPEN-BUILDS.md; needs salvage/ composed; open/intake.om is its own program (store-reading build: store/mvopen.om, open/..., open.json, bring.sh, get.sh, withdraw.sh answer 503) research/route.om or server/noresearch.om research pages and questions prefix rx* / gx* / tx*; research/README.md salvage, open and research each define nav (slnav, ohnav, rxnav): one entry in the forge row of server/pages.om fhead; the seam defines it empty door/*.om or server/nodoor.om the agent door: event stream, feed prefix ev* / gev* / tev*; docs/AGENT-DOOR.md; needs collab/ and social/ composed; evnav is its forge row entry .build/agents.om server/agents.om (ForgeServer: agents.json, fqa* / tfqa*; .build/agents.om is server/agents.tsv compiled by run.sh at every build) server/pages.om server/jsonp.om (jsonp: the JSON of every other page, fy* / tfy*; after pages.om for its globals) server/route.om server/main.om ``` - A slice dir is composed only when it holds a `READY` file (ForgeServer sets it after a live test); otherwise its seam is used. Check your unit composes BEFORE asking for integration: `cd ~/work/forge/web && FORGE_TRY= FORGED_OUT=/tmp/x.try ./run.sh build` (rc 0 = composes). - Every name you define (fn, global, text, const) MUST start with your prefix. Globals/texts are at most 8 characters. Never define `f*`, `F*`, `tf*`, `h*`, `H*`. Texts are NOT forward-declared: define a text above its first use. Known keyword clash: `faccess` (and likely other host-word names) is refused with error 16. - Files in your dir are composed in `ls` order. No `om2` line, no `fn main`, no `struct`, in your files. - Functions may be called before their definition (forward calls work across units). - The seam `server/no.om` defines your required functions with "not available" behaviour (route returns 0; nodl also defines an empty `dlclone`). ### Store-reading build (interplane-native DESIGN.md step 2) `FORGE_STORE= FORGED_OUT= ./run.sh build` (optional `FORGE_CLONE_BASE=https:////`) builds the same source with a second repository source. `run.sh storegen` writes `.build/store.om` (texts `tfsroot`, `tfcbase`, const `FSCB`), composed after `server/repos.om`, and these units are composed in place of the default ones: Default unit Store-reading unit What it gives `server/radsrc.om` `store/repos.om` the allow-list, reload check, identifiers, identity words, JSON clone object, footer line, routing table `nodes/head.om` `store/head.om` the default branch (the catalog's field instead of the HEAD file) `dl/dlclone.om` `store/clone.om` the clone panel (no `rad clone` line; HTTPS only with a clone base) `collab/`, `quiet/`, `growth/`, `salvage/`, `community/`, `open/` their `server/no.om` seams collab and quiet read Radicle patches and issues; growth, salvage, community and open need collab or salvage `research/intake-route.om` `research/noadd.om` the intake runs `rad` through the open shelf Both sources define the same words, used by the units around them: `fload` (fills the allow-list, returns the count or -1), `fsrcchg` (true when the source changed: RIDS.md mtime, or the catalog's inode, size and mtime), `fputid i` (the identifier in machine forms: `rad:` or `git:<64-hex id>`), `fhasal i` (repo i has an old Radicle id), `fradsrc` (Radicle node data may be read: server/counts.om `fzseeds` and its line), `fradwalk` / `fradseeds i` (the routing table), `fpjterms` (the identity words of the "For developers" section), `fjclone i` (the JSON clone object) and the text `tfsf4` (the footer line). `fkgit` / `fkgiti` stay in server/util.om: `store/repos.om` sets `fsrcst` to 1 and `fsrt` to the store root when it loads, and they then name `projects//repo.git`. `deploy` and `restart` refuse `FORGE_STORE`; a store-reading build never writes `server/forged`. The store layout and its rules are interplane-native's CONTRACT.md v0; `store/repos.om` says which of them forged checks. `store/tests/compare.sh` is the acceptance test. The store repository home resolves its default branch once and pins the README/file links, Files tab and clone panel to that commit. `brpinhd` copies `gbsha` into `fpin` (uchar 40), calls `frepohd 0`, then clears `fpin[0]`; tree pages use the same wrapper. `fputpin` writes its 40 bytes. A full 40-hex ref segment is interpreted as a commit even if a branch has that exact name. Without `FORGE_CLONE_BASE`, the Git command is omitted but the pinned archive links remain. An empty repository has no clone panel. The public Git edge, not `dlroute`, answers `/drakestapleton//archive/commits/<40-lower-case-hex>.zip|.tar.gz` (`infra/nginx/snippets/bazinga-git.conf`, `infra/bazinga/omega-read`). The object must be a commit reachable from a root `refs/heads` or `refs/tags` in the public filtered Git mirror, including older history and commits on another branch or only under a tag. The download's prefix is `-/`, ETag is the quoted SHA, and Cache-Control is `no-cache`. HEAD sends no body. Malformed paths fall through to forged; a well-formed but unknown, non-commit or unreachable SHA gets an empty 404 from the edge. Existing branch archives retain their branch-based prefix. Forged's legacy `/archive/<7..40-hex>` remains a 302 only for a commit at a canonical head or tag tip, otherwise 404. It does not implement the edge's `/archive/commits/` path. ## 2. Request (set by the server before dispatch; read only) Scalars are `global X ulong 1`, read with `get X 0`. Global Type Meaning `fmeth` ulong 1 1 GET or HEAD (http.om drops the body of a HEAD response itself, so handlers treat HEAD as GET), 3 POST, 0 other. 2 is never delivered `fpath`, `fpathl` uchar 4096 raw request path (before `?`), starts with `/`. The server already refused (400) any `..` or `.` segment (raw or `%2e`), `//`, NUL, control bytes, and paths over 4096 `fqs`, `fqsl` uchar 4096 raw query string without `?` `fbody`, `fbodyl` uchar 65536 POST body (at most 64 KiB; larger = 413 before dispatch) `fck`, `fckl` uchar 4096 Cookie header value `fip`, `fipl` uchar 64 client IP: `X-Real-IP` from nginx when present, else `127.0.0.1` `fbase`, `fbasel` uchar 64 `/` or `/forge/` (from `X-Forge-Base`; any other value = `/`). Always ends in `/` `fridx` ulong 1 allow-list index of the repo for `///...`, else 9999 `frid`, `fridl` uchar 64 that repo's key: its RID without `rad:` (store-reading build: the old RID from record 1, or the 64-hex id of a project without one) `fown`, `fownl` uchar 64 owner segment (`drakestapleton`) `frepo`, `frepol` uchar 128 repo name exactly as in the allow-list `frest`, `frestl` uchar 4096 the path after `//`; empty for the repo home, else starts with `/` (e.g. `/tree/main/src`) `fuser`, `fuserl` uchar 64 signed-in user name; `fuserl` 0 = signed out (set by `sosess`) `fcsrf`, `fcsrfl` uchar 64 the session's CSRF token (set by `sosess`), for hidden form fields `finm`, `finml` uchar 256 `If-None-Match` header value `forig`, `forigl` uchar 256 `Origin` header value (empty when absent) `facc`, `faccl` uchar 512 `Accept` header value (cut at 512); `fjwant` is true when it names `application/json` and not `text/html` Allow-list (loaded at start, on the reload flag, and when the source changes): default build from spark `~/handoffs/radicle/RIDS.md`, first table only; store-reading build from `/catalog.tsv`: every public line (there is no served list since 2026-11-14; RIDS.md is not read), every project checked as `store/repos.om` says (folders not links, record 1 hashes to the id and names the same project, deny list by name or old id, no old id already served, head equal to `refs/heads/`; a malformed catalog serves nothing; a private line is skipped; a project that fails a check is left out with one stderr line). `fan` (count), and per index `i < fan`: `fputrn i` appends the name, `fputrid i` the key (no `rad:`), `fputid i` the identifier (the bare `` since `9a4420a` / `git:`), `frnlen i`/`fridlen i` lengths, `frnbyte i k`/`fridbyte i k` one byte. `frepoix` returns the index of the repo whose name equals `frepo[0,frepol)` or 9999. A repo not in the table does not exist for any handler: the server returns 404 before dispatch, and handlers MUST NOT read other storage dirs. The table holds `FAMAX` (256) repositories (`fano` and the per-repo arrays, every loop over them `bound FAMAX`); a project past it is left out alone ("the allow-list table is full"), and `store/tests/capacity.sh` alarms when the store's public lines (or, in the default build, the RIDS.md first table) pass 192. In the store-reading build the sandbox (`infra/spark/forged-sandbox.sh` with `FORGED_STORE`) holds only the projects `forged-public.sh store_names` selects (public, valid name, not denied); a project created after the start is bound at the next start. Constants: `tfgit` = `/usr/bin/git`, `tfdata` = `/home/drakestapleton/forge-data/`. Default build: `tfstore` = `/home/drakestapleton/.radicle/storage/` (server/util.om, used by fkgit / fkgiti while `fsrcst` is 0); store-reading build: `tfsroot` (.build/store.om). Owner name text `tfowner` = `drakestapleton`, owner NID text `tfnid` = `z6MkfZDue1TbaNFi3ZzcD9uiTeduPLC52ucdFVuLKZwexxhK` (the namespace of copied Radicle refs). ## 3. Response (written by the handler) Global Meaning `fob`, `fobl` body, uchar `8388608`. Append with the helpers below only (they cap at the size and set `fobtr` 1 when cut) `fkind` 0 = HTML content fragment: the server wraps it in the layout (header, footer) with title `fti`/`ftil` (uchar 256, plain text, escaped by the server). 1 = raw body with content type `fct`/`fctl`. 2 = redirect to `floc`/`flocl` (status 302 or 303). 3 = stream a file: path in `ffile`/`ffilel`, content type `fct`, size cap 512 MiB. 4 = stream a command's stdout: the argv left in `fpk` runs again at send time, its stdout goes out as a chunked body with content type `fct` (for output above `fxo`'s 16 MiB that the handler already ran once with `fexec`, e.g. browse `/commit/.diff`); a failure after the head cuts the connection without the last chunk kind 5 (generated shelf stream) `ohbody` fills the next complete-row batch in `fob` and returns true, or false at EOF; `ohbodyend` closes its input. `fsend5` sends chunked with `fct`, keeps HTML layout/translation and `format=text`, and calls again until EOF. No total response size limit. `fobtr` or a send failure closes without the final chunk, so a client detects an incomplete body. `server/noopen.om` provides the inactive seam. Used by `/open/` and `/open.json`; the developer page is unchanged. `fct`, `fctl` uchar 128 content type for kinds 1, 3, 4 and 5 `fcd`, `fcdl` uchar 512 optional `Content-Disposition` value (kinds 1 and 3) `fsck`, `fsckl` uchar 512 optional `Set-Cookie` value (`fsetsck t` / `fscc c`) `floc`, `flocl` uchar 4096 Location for kind 2. Build it with `flocb` (base) + `flocc`/`floct`; `flocrepo` appends `/` `fetag`, `fetagl` uchar 128 optional `ETag` value, quotes included (`fetc c`). With kind 1 or 3: when `finm` equals it, return 304 with kind 1 and empty `fob`; the server sends no body and no Content-Type `fcc`, `fccl` uchar 128 optional `Cache-Control` replacing `no-store` (`fsetcc t` / `fccc c`) `fretry` ulong; nonzero = also send `Retry-After: ` (seconds), e.g. with a 503 `fcspsb` ulong; nonzero = send the sandbox CSP `sandbox; default-src 'none'; img-src 'self'; style-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'` instead of the page CSP. Set it with `fsetsbx` (browse `/raw/`) The server resets all response globals before each dispatch (kind 0, lengths 0). Every response gets `Content-Security-Policy: default-src 'none'; style-src 'self'; img-src 'self'; script-src 'none'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'`, `X-Content-Type-Options: nosniff`, `Referrer-Policy: same-origin`, `Cache-Control: no-store` (kinds 0-2). No JavaScript, ever: no `