interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / docs / BRING.md
| 1 | # interplane: bring a project, get a project, withdraw a project, send a patch |
| 2 | |
| 3 | `interplane` is the person's program in the one-command contract |
| 4 | (`~/handoffs/yourtrained-cortex/briefs/one-command-contract.md`, slice TOOL). It is seeded Omega: |
| 5 | source in `tools/bring/src/`, built by `tools/bring/build.sh`, tested by `tools/bring/tests/run.sh`. |
| 6 | What each target can do and why is in `tools/bring/PLATFORMS.md`. |
| 7 | |
| 8 | ``` |
| 9 | interplane bring [folder] publish a folder (default: the current folder) |
| 10 | interplane get <page address|rid> download a project into ./<name>/ |
| 11 | interplane withdraw <page address|rid> take your project off the shelf (only from the computer that brought it) |
| 12 | interplane patch [--base REF] [--title T] [--message-file F] [--yes] OWNER/REPO |
| 13 | send the commits of this git work tree as a patch to OWNER/REPO |
| 14 | interplane pack <folder> <file> the walk, scan and archive only (no network, no key): for checks |
| 15 | interplane unpack <file> <folder> the strict unpack only |
| 16 | interplane --version |
| 17 | ``` |
| 18 | |
| 19 | ## What bring does, in order |
| 20 | |
| 21 | 1. **Walk.** Regular files under the folder. `.git` (in any letter case: `.GIT`, `.Git`, as a folder |
| 22 | or a file, at any depth) is left out without being opened (no git runs, so a partial clone never |
| 23 | fetches). Symlinks, devices, sockets and FIFOs are left out. Paths that |
| 24 | POSIX ustar cannot hold (over 255 bytes) are left out. Each is listed as `Left out: <path>: <reason>`. |
| 25 | 2. **Secret scan.** By name: `.env*`, `id_*`, `*.pem`, `*.key`, `*.p12`, `.netrc`, `credentials`. |
| 26 | By content, read once while the file is copied to a private spool: a `PRIVATE KEY-----` block, |
| 27 | `ghp_`, `github_pat_`, `AKIA`, `xox`, `sk_live_`, `AIza`, `sk-ant-`, and assignments such as |
| 28 | `DB_PASSWORD = "hunter2hunter2"` (password/passwd/secret/token, `=` or `:`, a value of 8 or more |
| 29 | bytes). A file with a hit is left out and listed. The scan is a safety net, not a guarantee; the |
| 30 | hub refuses private key blocks again. |
| 31 | 3. **Summary and consent.** Name, file count, total size, then the contract's text. One line is read |
| 32 | from `/dev/tty` (never stdin). Anything but exactly `yes` prints `Nothing sent.` and exits 1: |
| 33 | no key is made, no program is started, no connection is opened. |
| 34 | 4. **Key.** `~/.interplane/key` (ed25519, mode 0600, folder 0700) is made once with |
| 35 | `/usr/bin/ssh-keygen -t ed25519`. It never leaves the machine. Its DID is `did:key:z6Mk...`. |
| 36 | 5. **Archive.** POSIX ustar from the spool (the bytes that were scanned), sorted by path, mode 0644 or |
| 37 | 0755, uid/gid 0, empty names, mtime 0, two zero blocks. The same folder gives the same bytes. |
| 38 | 6. **Statement** `interplane-bring 1 / sha256 / files / bytes / name`, signed with namespace |
| 39 | `interplane-bring`. |
| 40 | 7. **Sign-in** (`GET /login`, sign `interplane-forge-login:<nonce>:<ts>` with namespace |
| 41 | `interplane-forge`, `POST /login`, `GET /open/` for the write csrf). |
| 42 | 8. **Chunks** of 45000 bytes, base64url without padding, with a progress line. 409 resumes at the |
| 43 | server's `next`; 429 waits a second and sends the same chunk again, for as long as it lasts; |
| 44 | 503 (queue or storage full) prints `The download server is busy; trying again in 10 seconds.`, |
| 45 | waits 10 seconds and sends the same chunk again, for as long as it lasts; 413 and 403 stop with a |
| 46 | plain message. |
| 47 | 9. **Finish**, then the status JSON once a second until `stored` or `refused: <reason>`. A 429 on |
| 48 | the finish (the forge write gate allows a key 30 writes in a clock minute, and every accepted chunk |
| 49 | counts as one, so a finish right after the 30th chunk gets 429) waits a second and sends the same |
| 50 | finish again, quietly, as the chunk loop does. A 503 (the hub's queue is full; it keeps nothing of |
| 51 | that try) gets the busy line, 10 seconds and the same finish again. Resending is safe: when the |
| 52 | .sig already exists, the hub answers "queued" and queues nothing. The status GET waits out a busy |
| 53 | server like get does (below). |
| 54 | 10. **Final lines**: `Your project page: <BASE>/open/<rid>` and |
| 55 | `Developer details: Radicle ID rad:..., rad clone rad:...`. |
| 56 | |
| 57 | ## get |
| 58 | |
| 59 | `GET /open/<rid>.json`, then the `download` path; the file's SHA-256 must equal `download_sha256`. |
| 60 | Both GETs wait out a busy server: the forge serves release and archive files through a cold-build |
| 61 | cache that answers 503 with Retry-After for up to a minute, so 503, 502, 504 and 429 print |
| 62 | `The download server is busy; trying again in 10 seconds.`, wait 10 seconds and ask again, with no |
| 63 | count. Any other code stops with `Interplane answered with HTTP <code>` and status 1. |
| 64 | The whole archive is validated before anything is written. Then `./<name>/` is created (refused if |
| 65 | it exists) and regular files are written inside it, each created exclusively. Refused: absolute |
| 66 | paths, empty, `.` or `..` components, a `.git` component in any letter case (the hub's rule in |
| 67 | `open/intake.om`; downloads of open and held rows come from repositories the intake never parsed), |
| 68 | NUL, unknown entry types, bad checksums, a truncated archive. |
| 69 | Directory entries are implied, a pax global header (git archive's commit comment) is skipped, and |
| 70 | link entries are never created (listed as skipped). |
| 71 | |
| 72 | ## withdraw |
| 73 | |
| 74 | The line people paste is `curl -fsSL https://interplane.io/withdraw.sh | sh -s https://interplane.io/open/<rid>`. |
| 75 | |
| 76 | 1. **Key.** `~/.interplane/key` must already exist; withdraw never makes one. Without it the tool |
| 77 | says plainly that only the computer that brought a project can withdraw it, and stops with no |
| 78 | program started and no request sent. |
| 79 | 2. **Shelf row.** `GET /open/<rid>.json` (busy codes waited out as for get): `Project: <name>` and |
| 80 | `Brought by: <did>` are shown. 404 says the project is not on the shelf. If `brought_by` is not this |
| 81 | key's `did:key`, the tool refuses plainly before asking anything, and nothing is sent. |
| 82 | 3. **Text and consent.** It prints: "Withdrawing takes your project off the Interplane shelf, stops |
| 83 | this site serving it and stops the Interplane hub sharing it on Radicle. It cannot remove copies |
| 84 | that other computers already fetched: publishing was permanent." Then it reads one line from |
| 85 | `/dev/tty` after `Type yes to withdraw it, anything else to stop:`. Anything but exactly `yes` |
| 86 | prints `Nothing sent.` and exits 1, with no sign-in and no POST. |
| 87 | 4. **On yes:** the sign-in of bring (step 7, which also takes the write csrf from `GET /open/`), |
| 88 | then `POST /open/` with `csrf`, `action=withdraw` and `rid=rad:<rid>`. 429 waits a second and sends |
| 89 | again, quietly. 503, 502 and 504 print the busy line, wait 10 seconds and send again. Only a 303 |
| 90 | whose `Location` is `<base>/open/` counts as taken: absolute, or the base's path plus `open/`, which |
| 91 | is what the hub writes, e.g. `/open/`. A 303 to `/login` means the hub signed this key out; the tool |
| 92 | prints `Interplane signed you out before the withdraw was sent; nothing was withdrawn. Run the line |
| 93 | again.` and exits 1 without polling. Any other answer stops with a plain message. |
| 94 | 5. **Poll** `GET /open/<rid>.json` once a second until it answers 404 (off the shelf; the hub lists |
| 95 | only open, held and stored rows, whoever asks), then print `Withdrawn.` |
| 96 | |
| 97 | The hub's own gates (only the bringer's key can withdraw; withdrawal unseeds and removes the |
| 98 | download) are tested in `open/tests/up.sh`. |
| 99 | |
| 100 | ## patch |
| 101 | |
| 102 | `interplane patch [--base REF] [--title T] [--message-file F] [--yes] OWNER/REPO` (source |
| 103 | `tools/bring/src/50patch.om`, contract `~/work/lanes/CONTRACT-interplane-connector-r1.md` F7). Run it |
| 104 | inside a git work tree whose commits on top of the project's `main` are the patch. The forge side, |
| 105 | the checks and the answers are in `docs/API.md` "Git patches". |
| 106 | |
| 107 | 1. **Arguments.** OWNER/REPO is two names of letters, digits, `.`, `-` and `_` around one slash, given |
| 108 | once. `--title` takes 1 to 256 bytes; a `--base` value that starts with `-` is refused as naming no |
| 109 | commit; a flag given twice keeps its last value. A missing value, an unknown word or a second |
| 110 | OWNER/REPO prints the usage line and exits 1. |
| 111 | 2. **git, read only.** Every git run is `/usr/bin/git` started with an argument list (no shell, no |
| 112 | PATH search), an empty environment, standard input `/dev/null`, its output into the tool's private |
| 113 | temp folder, in the current folder. In order: |
| 114 | - `git rev-parse --is-inside-work-tree` must print `true`, and `git rev-parse --verify --quiet |
| 115 | HEAD^{commit}` must name a commit (else: not inside a git work tree / no commit at HEAD). |
| 116 | - The base: `--base REF` is `git rev-parse --verify --quiet --end-of-options REF^{commit}`; |
| 117 | without it, `git merge-base HEAD refs/remotes/origin/main` (no such ref: the message says to |
| 118 | name the base with `--base`). |
| 119 | - `git rev-list --count BASE..HEAD`: 1 to 100 commits (0: nothing to send; more than 100: refused |
| 120 | here, a patch holds at most 100). |
| 121 | - `git format-patch --stdout --no-color --no-ext-diff --no-textconv --no-attach --no-thread |
| 122 | --no-cover-letter --src-prefix=a/ --dst-prefix=b/ --no-signature BASE..HEAD`: the mbox, at most |
| 123 | 2097152 bytes (larger: nothing sent). The flags pin what a repository's configuration could |
| 124 | otherwise change in the output; with no `HOME`, no user configuration is read. |
| 125 | - `git diff --name-only -z BASE HEAD`: the number of files changed. |
| 126 | - The title: `--title`, else `git log -1 --format=%s HEAD` (the HEAD commit's subject); 1 to 256 |
| 127 | bytes on one line, no control byte. |
| 128 | - The description: the bytes of `--message-file` (none: empty), carriage returns dropped, blanks |
| 129 | and line feeds at the end trimmed, at most 60000 bytes. |
| 130 | 3. **What would be sent.** Seven lines, then the question: |
| 131 | ``` |
| 132 | Repository: drakestapleton/fixrepo |
| 133 | Base: 937467a8c4a62d02a8dedb574a8603b17c5aa87e |
| 134 | Commits: 2 |
| 135 | Files changed: 2 |
| 136 | Bytes: 854 |
| 137 | Title: src: e2e line, the patch title |
| 138 | Send to: http://127.0.0.1:18488 |
| 139 | ``` |
| 140 | (a real run: `patch/tests/e2e.sh` on 2026-11-17 against a scratch forge, with `--yes`). |
| 141 | 4. **Consent.** Without `--yes` it asks `Type yes to send this patch, anything else to stop:` and reads |
| 142 | one line from `/dev/tty` (never stdin). Anything but exactly `yes`, or no terminal, prints |
| 143 | `Nothing sent.` and exits 1: no key is made, ssh-keygen and curl are not started, and nothing |
| 144 | reaches the forge. `--yes` is the consent given on the command line (a harness's own permission |
| 145 | prompt for the command is then the human gate). |
| 146 | 5. **Key and statement.** `~/.interplane/key` is made once as bring makes it. The statement |
| 147 | `interplane-patch 1\nOWNER/REPO\nBASE\n<sha256 of the mbox>\n<sha256 of title, line feed, |
| 148 | description>\n` is signed with `ssh-keygen -Y sign -n interplane-patch`. The key never leaves the |
| 149 | computer. |
| 150 | 6. **Sign-in and send.** The sign-in of bring, then one `POST <BASE>/OWNER/REPO/patches/new` with |
| 151 | the form csrf, repo, base, title, description, mbox (base64url, no padding) and sig. A 429 (the |
| 152 | write gate) waits a second and sends the same form again, for as long as it lasts. |
| 153 | 7. **Final lines.** `201`: `Patch page: <BASE>/OWNER/REPO/patches/<id>`, exit 0. `200` (the forge |
| 154 | already has this statement): `Interplane already has this patch.` and the same line, exit 0. Any |
| 155 | other answer: `interplane: Interplane refused the patch: <the server's reason>` (or the HTTP code |
| 156 | when the answer has no reason line), exit 2. |
| 157 | |
| 158 | Exit status: 0 sent (or already there), 1 nothing sent (usage, no work tree, no base, nothing or too |
| 159 | much to send, git failed, a local check failed, no consent), 2 the server refused it. A failure of the |
| 160 | sign-in itself stops with a message and exit 1, after the sign-in request but before the patch is |
| 161 | sent. The tool never fetches, pushes, or writes the work tree, the index or any ref. |
| 162 | |
| 163 | Tests: `patch/tests/run.sh` (the tool against a test forged: consent, the summary, replay, options, |
| 164 | refusals, arguments; part of `./run.sh check-patch`) and `patch/tests/e2e.sh` (the loopback run: the |
| 165 | raw route is byte-equal to `git format-patch` with the flags above, and `git am` of it onto the base |
| 166 | gives the tool's tree). |
| 167 | |
| 168 | ## Programs and network |
| 169 | |
| 170 | The tool starts only `/usr/bin/curl` (the one network path; `--proto =https`, no redirects, a |
| 171 | cleared environment, no shell), `/usr/bin/ssh-keygen` and, for `patch` only, `/usr/bin/git`. bring |
| 172 | starts curl and ssh-keygen only after the yes; withdraw reads the shelf JSON with curl before asking, |
| 173 | and signs only after the yes; patch runs git (read only: `rev-parse`, `merge-base`, `rev-list`, |
| 174 | `format-patch`, `diff`, `log`; never fetch, push or any write) before asking, and curl and ssh-keygen |
| 175 | only after the yes. `BASE` is `https://interplane.io`; `INTERPLANE_BASE` may name another `https://` |
| 176 | base, or `http://127.0.0.1:` or `http://localhost:` for tests. On Linux the start word is `execprog` |
| 177 | (empty environment, every descriptor above 2 closed); on macOS `posix_spawn` with |
| 178 | `POSIX_SPAWN_CLOEXEC_DEFAULT`. |
| 179 | |
| 180 | ## Installer |
| 181 | |
| 182 | `tools/bring/installer.om` reads a release manifest on stdin and writes `bring.sh`, `get.sh` and |
| 183 | `withdraw.sh`. They are the same script apart from the last line, which runs `bring`, `get` or |
| 184 | `withdraw` with the script's arguments: |
| 185 | |
| 186 | ``` |
| 187 | 0.1.0 |
| 188 | https://interplane.io/receipts/#tool-0.1.0 |
| 189 | Linux-aarch64 https://.../interplane-linux-aarch64 <sha256> |
| 190 | Darwin-arm64 https://.../interplane-macos-arm64 <sha256> |
| 191 | ``` |
| 192 | |
| 193 | Release 0.1.1 also carries `Linux-x86_64` (`interplane-linux-x86_64`, built by `build.sh x86linux`). |
| 194 | It is released checked under emulation, not yet on a real x86-64 machine: under qemu-x86_64 (binfmt |
| 195 | on the AArch64 Spark), e2e-tool-x86 ran bring, get and withdraw against a sandboxed forged, 34 pass |
| 196 | 0 fail at 10ace1ad (`~/handoffs/open-builds/e2e-tool-x86-10ace1ad.log`). See |
| 197 | `tools/bring/PLATFORMS.md`. |
| 198 | |
| 199 | A script detects `uname -s`-`uname -m`, downloads with curl over HTTPS only, prints the downloaded |
| 200 | SHA-256, the expected one and the receipt page to compare against, refuses a mismatch without running |
| 201 | anything, then runs the binary with stdin from `/dev/tty`. The download is a loop with no count: curl |
| 202 | writes the HTTP code (`-w '%{http_code}'`); 503, 502, 504 and 429 print |
| 203 | `The download server is busy; trying again in 10 seconds.`, sleep 10 and ask again; 200 goes on to |
| 204 | the fingerprint check; anything else prints `The download failed with HTTP <code>. Nothing was run.` |
| 205 | and exits 1. HUP, INT and TERM exit (the EXIT trap removes the download), so Ctrl-C stops the wait. |
| 206 | Only https URLs, printable bytes without |
| 207 | quotes, known targets (once each) and lowercase 64-hex hashes are accepted; on any refusal no |
| 208 | script is left behind. A target missing from the manifest prints that this platform has no release. |
| 209 | |
| 210 | **Where the release files live (PROPOSED, nothing published).** Hop's files are served by the forge |
| 211 | as release assets: `https://interplane.io/drakestapleton/hop/releases/download/v0.4.0/Hop-0.4.0.zip` |
| 212 | with a `SHA256SUMS` beside it, and the receipt page carries the fingerprints (`dl/dl.om`: release |
| 213 | assets are files in the tag's `release-assets/` folder, cached with a `.sha256` sidecar computed in |
| 214 | Omega). The same shape for the tool: a repository `drakestapleton/interplane` holding this program, |
| 215 | tag `v0.1.0`, `release-assets/interplane-linux-aarch64`, `interplane-macos-arm64`, `SHA256SUMS`, |
| 216 | and the manifest. `bring.sh` and `get.sh` would be served at `BASE/bring.sh` and `BASE/get.sh`, the |
| 217 | receipt rows on `/receipts/`, so the line is `curl -fsSL https://interplane.io/bring.sh | sh`. The |
| 218 | repository name and the receipt anchors are Drake's to confirm. |
| 219 | |
| 220 | ## Caps met in this slice (no-hard-caps point 6) |
| 221 | |
| 222 | | Where | Number | Why | What was done | |
| 223 | |---|---|---|---| |
| 224 | | file count, file size, archive size | none | | walk records go to a temp file, file bytes to a spool, the sort is a file-backed merge sort; nothing is held in memory per file | |
| 225 | | ustar path | 255 bytes (name 100 + prefix 155) | the archive format the contract names | kept as a format boundary; longer paths are listed as left out | |
| 226 | | chunk size | 45000 bytes | the contract's wire field | kept | |
| 227 | | project size | none at the hub since 2026-11-11 (its free-space reserves bound it) | | not checked in the tool; a 413 (now only a proxy in front of the hub could send one) is shown in plain words | |
| 228 | | one argument list | 4096 bytes, 64 records | `execprog` packet limit at the pinned omc (OMEGESE s10) | compiler boundary; the tool's lists are under 600 bytes. A path that would not fit stops with a message, never truncated | |
| 229 | | one path | 4095 bytes | the compiler's path boundary (OMEGESE s10) | compiler boundary | |
| 230 | | a JSON or form value read back | 4096 bytes | wire fields (csrf, sha, rid, page) | a longer value is refused as an answer the program does not understand; responses of any size are scanned through a window | |
| 231 | | status poll | no limit | the contract: poll until stored or refused | a line says the hub is still publishing | |
| 232 | | 429 retry | no limit | the contract: never give up while the server says 429 | kept | |
| 233 | | busy retry (503, 502, 504, 429 on get's GETs, the status GET and withdraw's GETs and POST; 503 on a chunk or the finish; the scripts' download) | no limit | the owner's rule: a stranger's first run must not fail on a cold cache | one line per try, 10 seconds apart; Ctrl-C stops it. The Omega loops carry `bound 9223372036854775807`, the language's required loop bound, not a give-up count | |
| 234 | | write-gate 429 on the finish and the withdraw POST | no limit | 30 writes a key a clock minute; every chunk counts | a quiet second and the same request again, as for chunks | |
| 235 | | patch: commits | 100 | the contract (F1) and the forge's check | refused before anything is sent | |
| 236 | | patch: mbox | 2097152 bytes | the contract (F1) and the forge's check | refused before anything is sent | |
| 237 | | patch: title, description | 256 bytes, 60000 bytes | the forge's field rules (`docs/collab-write.md` section 2) | refused before anything is sent | |
| 238 | | patch: write-gate 429 | no limit | 30 writes a key a clock minute | a quiet second and the same form again | |
| 239 | |
| 240 | ## Tests |
| 241 | |
| 242 | `flock ~/handoffs/hive/queen/pool-17.lock taskset -c 17 bash tools/bring/tests/run.sh` (Linux |
| 243 | aarch64). The stand-in hub `tools/bring/tests/standin.om` (seeded Omega) answers the contract's |
| 244 | routes on a private port and injects one 429 and one 409; files in its folder inject busy answers |
| 245 | (`busyj`, `busyt` for get's JSON and archive, `busyp` for a chunk or the withdraw POST, `busyf` for |
| 246 | the finish; each holds 3-digit codes, e.g. `503429`). POST /open/ saves `withdraw.form`; the shelf JSON |
| 247 | answers once more after it, then 404. The installer scripts run against a stand-in curl that answers |
| 248 | a list of codes and a stand-in sleep that |
| 249 | logs its argument. strace (execve, connect, openat) is the |
| 250 | outside oracle for "no program, no connection"; a counting listener stands in for a partial clone's |
| 251 | promisor remote. GNU tar, ssh-keygen -Y verify and basenc are the outside checks of the archive, the |
| 252 | signatures and the uploaded bytes. Mutants remove one guard each and must fail. |