interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / apps / interplane-forge / server / radsrc.om

300 lines · 6997 bytes Raw Blame History
1note forged server/radsrc.om: the Radicle source of the default build (the live binary), composed after
2note server/repos.om (the shared allow-list helpers and per-repo metadata). It defines what a
3note repository source gives the rest of forged: fload (the public allow-list), fsrcchg (the source
4note changed: reload), fputid (a repository's identifier in machine forms), fhasal (it has an old
5note Radicle id), fradsrc (Radicle node data may be read) with fradwalk / fradseeds (the routing
6note table), fpjterms (the identity words of the "For developers" section), fjclone (the JSON clone
7note object) and tfsf4 (the footer line). Git paths are server/util.om fkgit / fkgiti (tfstore + RID).
8note The store-reading build composes store/repos.om in place of this unit (run.sh units, FORGE_STORE).
9note Allow-list: the FIRST table of ~/handoffs/radicle/RIDS.md (header "| repo | RID | default
10note branch"). A row is kept only when the name, RID and branch are well formed and
11note ~/.radicle/storage/<rid> exists. Fail closed: when the file cannot be read or has no table, fan
12note is 0 and every repo URL is 404.
13text tfrids "/home/drakestapleton/handoffs/radicle/RIDS.md"
14text tfthd "| repo | RID | default branch"
15fn flmat s ulong ln ulong to bool
16if gt add s len tfthd ln
17ret false
18end
19for k ulong len tfthd bound 64
20if ne get fxo add s k get tfthd k
21ret false
22end
23end
24ret true
25end
26fn flfind ln ulong to ulong
27p = ulong 0
28for it ulong 100000
29if ge p ln
30ret ln
31end
32if flmat p ln
33ret p
34end
35p = flnext p ln
36end
37ret ln
38end
39fn flbar p ulong e ulong to ulong
40j = p
41while lt j e bound 16777216
42if eq get fxo j 124
43ret j
44end
45j = add j 1
46end
47ret e
48end
49fn fidput k ulong a ulong b ulong to bool
50s = ftrs a b
51t = ftre s b
52if lt sub t s 6
53ret false
54end
55if or ne get fxo s 114 ne get fxo add s 1 97
56ret false
57end
58if or ne get fxo add s 2 100 ne get fxo add s 3 58
59ret false
60end
61s = add s 4
62n = sub t s
63if gt n 60
64ret false
65end
66cur = fidcur k
67if gt add cur n len faid
68ret false
69end
70put faio k cur
71put fail k n
72for i ulong n bound 64
73c = get fxo add s i
74if not fisaln c
75ret false
76end
77put faid add cur i c
78end
79ret true
80end
81note fstok: ~/.radicle/storage/<rid of k> exists
82fn fstok k ulong to bool
83fpb
84fpt tfstore
85for i ulong get fail k bound 64
86fpc fridbyte k i
87end
88r = stat fpth 0 get fpthl 0 fstb 0 128
89ret ge r 0
90end
91fn frow p ulong e ulong to void
92b1 = flbar add p 1 e
93b2 = flbar add b1 1 e
94b3 = flbar add b2 1 e
95if ge b3 e
96ret
97end
98k = get fan 0
99if ge k FAMAX
100ret
101end
102if not fnmput k add p 1 b1
103ret
104end
105if not fidput k add b1 1 b2
106ret
107end
108if not fbrput k add b2 1 b3
109ret
110end
111put fan 0 add k 1
112end
113fn fload to long
114put fan 0 0
115fpb
116fpt tfrids
117put famt 0 fmtime
118n = frdall
119if le n 0
120ret -1
121end
122ln = ulong n
123p = flfind ln
124if ge p ln
125ret -2
126end
127p = flnext p ln
128p = flnext p ln
129for it ulong FAMAX
130if ge p ln
131break
132end
133if ne get fxo p 124
134break
135end
136e = fleol p ln
137frow p e
138p = flnext p ln
139end
140fdrop
141for i ulong get fan 0 bound FAMAX
142fmeta i
143end
144ret long get fan 0
145end
146note fdrop: remove denied rows and rows whose storage dir is missing (keeps order; areas stay valid)
147fn fdrop to void
148w = ulong 0
149for i ulong get fan 0 bound FAMAX
150if and not fdeny i fstok i
151fmove w i
152w = add w 1
153end
154end
155put fan 0 w
156end
157note fsrcchg: true when RIDS.md changed since fload read it (main.om fchkrl reloads then)
158fn fsrcchg to bool
159fpb
160fpt tfrids
161m = fmtime
162ret ne m get famt 0
163end
164note fputid: the identifier of allow-list repo i in the machine forms ("rid" fields): the bare RID
165note (z then base58; the rad: prefix is no longer shown since Radicle was removed on 2026-11-14)
166fn fputid i ulong to void
167fputrid i
168end
169note fhasal: every repository of this source has a Radicle id
170fn fhasal i ulong to bool
171ret true
172end
173note fradsrc: Radicle node data (the routing table, server/counts.om fzseeds) belongs to this source
174fn fradsrc to bool
175ret true
176end
177note ---- seeds: rad node routing --rid rad:<RID> --json, read again when the node database changed
178text tfzenv "/usr/bin/env"
179text tfzhenv "HOME=/home/drakestapleton"
180text tfzrad "/home/drakestapleton/.radicle/bin/rad"
181text tfznode "node"
182text tfzrout "routing"
183text tfzrid "--rid"
184text tfzjson "--json"
185text tfzradp "rad:"
186text tfzwal "/home/drakestapleton/.radicle/node/node.db-wal"
187text tfzrow "{\"rid\":\"rad:"
188text tfznid "\"nid\":\""
189note fradwalk: the change key of the node database (node.db-wal mtime in ns), 0 when it is missing
190fn fradwalk to ulong
191fpb
192fpt tfzwal
193r = stat fpth 0 get fpthl 0 fstb 0 128
194if lt r 0
195ret 0
196end
197ret add mul fradle8 88 1000000000 fradle8 96
198end
199fn fradle8 o ulong to ulong
200v = ulong 0
201for i ulong 8
202v = or v shl ulong get fstb add o i mul i 8
203end
204ret v
205end
206note fradseeds: the nodes this node's routing table says seed repo i (this node included), or -1 when
207note rad did not answer
208fn fradseeds i ulong to long
209fkb
210fka tfzenv
211fka tfzhenv
212fka tfzrad
213fka tfznode
214fka tfzrout
215fka tfzrid
216fkopen
217fkt tfzradp
218for k ulong get fail i bound 64
219fkc fridbyte i k
220end
221fka tfzjson
222st = fexec 5000000000
223if ne st 0
224ret -1
225end
226ret long fzrows i
227end
228note fzrows: lines of fxo that are {"rid":"rad:<RID of i>",...,"nid":"...
229fn fzrows i ulong to ulong
230ln = get fxol 0
231p = ulong 0
232n = ulong 0
233for it ulong 1000000
234if ge p ln
235break
236end
237e = fleol p ln
238if fzrowok i p e
239n = add n 1
240end
241p = add e 1
242end
243ret n
244end
245fn fzxpre a ulong e ulong t view uchar * to bool
246if gt add a len t e
247ret false
248end
249for k ulong len t bound 64
250if ne get fxo add a k get t k
251ret false
252end
253end
254ret true
255end
256fn fzrowok i ulong p ulong e ulong to bool
257if not fzxpre p e tfzrow
258ret false
259end
260a = add p len tfzrow
261l = get fail i
262if gt add a add l 2 e
263ret false
264end
265for k ulong l bound 64
266if ne get fxo add a k fridbyte i k
267ret false
268end
269end
270if ne get fxo add a l 34
271ret false
272end
273q = add add a l 1
274for it ulong sub e q bound 16777216
275if fzxpre q e tfznid
276ret true
277end
278q = add q 1
279end
280ret false
281end
282note ---- the footer line that says what forged serves (server/pages.om ffoot)
283text tfsf4 "<p class=\"foot-fine\">INTERPLANE Forge: agents express intent; the forge retains authority. Repositories are served by forged, a seeded-Omega web server, with no JavaScript.</p>\n<p class=\"foot-fine\"><a href=\""
284note ---- the identity words of the "For developers" section (server/pages.om fpjdev1): Delegate,
285note Refs and HEAD, and Patch up to its link
286text tfdv3 "<dt>Delegate</dt><dd>A key that may sign the project's official versions. This forge lists the project under "
287text tfdv4 ".</dd>\n<dt>Refs and HEAD</dt><dd>Refs are the names that point at versions: branches and tags. HEAD is the version a fresh copy starts from, the newest commit of the default branch.</dd>\n<dt>Patch</dt><dd>A proposed change, stored in the repository and reviewed before it is merged. The list is under <a href=\""
288fn fpjterms to void
289fput tfdv3
290fputown
291fput tfdv4
292end
293note ---- the clone object of the JSON repo form (server/json.om fjrepo)
294text tfjcl1 ",\n\"clone\":{\"rad\":\""
295text tfjcl2 "\",\"rad_clone\":null,\"git_https\":null}"
296fn fjclone i ulong to void
297fput tfjcl1
298fputrid i
299fput tfjcl2
300end