interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / docs / BRING.md

252 lines · 18941 bytes Raw Blame History Rendered
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:
5source in `tools/bring/src/`, built by `tools/bring/build.sh`, tested by `tools/bring/tests/run.sh`.
6What each target can do and why is in `tools/bring/PLATFORMS.md`.
7
8```
9interplane bring [folder] publish a folder (default: the current folder)
10interplane get <page address|rid> download a project into ./<name>/
11interplane withdraw <page address|rid> take your project off the shelf (only from the computer that brought it)
12interplane 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
14interplane pack <folder> <file> the walk, scan and archive only (no network, no key): for checks
15interplane unpack <file> <folder> the strict unpack only
16interplane --version
17```
18
19## What bring does, in order
20
211. **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>`.
252. **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.
313. **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.
344. **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...`.
365. **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.
386. **Statement** `interplane-bring 1 / sha256 / files / bytes / name`, signed with namespace
39 `interplane-bring`.
407. **Sign-in** (`GET /login`, sign `interplane-forge-login:<nonce>:<ts>` with namespace
41 `interplane-forge`, `POST /login`, `GET /open/` for the write csrf).
428. **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.
479. **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).
5410. **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`.
60Both GETs wait out a busy server: the forge serves release and archive files through a cold-build
61cache 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
63count. Any other code stops with `Interplane answered with HTTP <code>` and status 1.
64The whole archive is validated before anything is written. Then `./<name>/` is created (refused if
65it exists) and regular files are written inside it, each created exclusively. Refused: absolute
66paths, 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),
68NUL, unknown entry types, bad checksums, a truncated archive.
69Directory entries are implied, a pax global header (git archive's commit comment) is skipped, and
70link entries are never created (listed as skipped).
71
72## withdraw
73
74The line people paste is `curl -fsSL https://interplane.io/withdraw.sh | sh -s https://interplane.io/open/<rid>`.
75
761. **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.
792. **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.
823. **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.
874. **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.
945. **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
97The hub's own gates (only the bringer's key can withdraw; withdrawal unseeds and removes the
98download) 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
104inside a git work tree whose commits on top of the project's `main` are the patch. The forge side,
105the checks and the answers are in `docs/API.md` "Git patches".
106
1071. **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.
1112. **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.
1303. **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`).
1414. **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).
1465. **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.
1506. **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.
1537. **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
158Exit status: 0 sent (or already there), 1 nothing sent (usage, no work tree, no base, nothing or too
159much to send, git failed, a local check failed, no consent), 2 the server refused it. A failure of the
160sign-in itself stops with a message and exit 1, after the sign-in request but before the patch is
161sent. The tool never fetches, pushes, or writes the work tree, the index or any ref.
162
163Tests: `patch/tests/run.sh` (the tool against a test forged: consent, the summary, replay, options,
164refusals, arguments; part of `./run.sh check-patch`) and `patch/tests/e2e.sh` (the loopback run: the
165raw route is byte-equal to `git format-patch` with the flags above, and `git am` of it onto the base
166gives the tool's tree).
167
168## Programs and network
169
170The tool starts only `/usr/bin/curl` (the one network path; `--proto =https`, no redirects, a
171cleared environment, no shell), `/usr/bin/ssh-keygen` and, for `patch` only, `/usr/bin/git`. bring
172starts curl and ssh-keygen only after the yes; withdraw reads the shelf JSON with curl before asking,
173and 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
175only after the yes. `BASE` is `https://interplane.io`; `INTERPLANE_BASE` may name another `https://`
176base, 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```
1870.1.0
188https://interplane.io/receipts/#tool-0.1.0
189Linux-aarch64 https://.../interplane-linux-aarch64 <sha256>
190Darwin-arm64 https://.../interplane-macos-arm64 <sha256>
191```
192
193Release 0.1.1 also carries `Linux-x86_64` (`interplane-linux-x86_64`, built by `build.sh x86linux`).
194It is released checked under emulation, not yet on a real x86-64 machine: under qemu-x86_64 (binfmt
195on the AArch64 Spark), e2e-tool-x86 ran bring, get and withdraw against a sandboxed forged, 34 pass
1960 fail at 10ace1ad (`~/handoffs/open-builds/e2e-tool-x86-10ace1ad.log`). See
197`tools/bring/PLATFORMS.md`.
198
199A script detects `uname -s`-`uname -m`, downloads with curl over HTTPS only, prints the downloaded
200SHA-256, the expected one and the receipt page to compare against, refuses a mismatch without running
201anything, then runs the binary with stdin from `/dev/tty`. The download is a loop with no count: curl
202writes 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
204the fingerprint check; anything else prints `The download failed with HTTP <code>. Nothing was run.`
205and exits 1. HUP, INT and TERM exit (the EXIT trap removes the download), so Ctrl-C stops the wait.
206Only https URLs, printable bytes without
207quotes, known targets (once each) and lowercase 64-hex hashes are accepted; on any refusal no
208script 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
211as release assets: `https://interplane.io/drakestapleton/hop/releases/download/v0.4.0/Hop-0.4.0.zip`
212with a `SHA256SUMS` beside it, and the receipt page carries the fingerprints (`dl/dl.om`: release
213assets are files in the tag's `release-assets/` folder, cached with a `.sha256` sidecar computed in
214Omega). The same shape for the tool: a repository `drakestapleton/interplane` holding this program,
215tag `v0.1.0`, `release-assets/interplane-linux-aarch64`, `interplane-macos-arm64`, `SHA256SUMS`,
216and the manifest. `bring.sh` and `get.sh` would be served at `BASE/bring.sh` and `BASE/get.sh`, the
217receipt rows on `/receipts/`, so the line is `curl -fsSL https://interplane.io/bring.sh | sh`. The
218repository 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
243aarch64). The stand-in hub `tools/bring/tests/standin.om` (seeded Omega) answers the contract's
244routes 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
246the finish; each holds 3-digit codes, e.g. `503429`). POST /open/ saves `withdraw.form`; the shelf JSON
247answers once more after it, then 404. The installer scripts run against a stand-in curl that answers
248a list of codes and a stand-in sleep that
249logs its argument. strace (execve, connect, openat) is the
250outside oracle for "no program, no connection"; a counting listener stands in for a partial clone's
251promisor remote. GNU tar, ssh-keygen -Y verify and basenc are the outside checks of the archive, the
252signatures and the uploaded bytes. Mutants remove one guard each and must fail.