@nervur.org/installer-node 0.0.0-stage → 0.37.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/LICENSE +105 -0
  2. package/README.md +159 -2
  3. package/SECURITY.md +8 -0
  4. package/bin/nervur.js +5 -0
  5. package/cargo/emscripten-module.wasm +0 -0
  6. package/cargo/manifest.json +1 -0
  7. package/cargo/sqlite3.wasm +0 -0
  8. package/cargo/table-i-i.wasm +0 -0
  9. package/cargo/table-i-ii.wasm +0 -0
  10. package/cargo/table-i-iii.wasm +0 -0
  11. package/cargo/table-i-iiii.wasm +0 -0
  12. package/cargo/table-i-iiiii.wasm +0 -0
  13. package/cargo/table-i-iiij.wasm +0 -0
  14. package/cargo/table-i-ij.wasm +0 -0
  15. package/cargo/table-v-ii.wasm +0 -0
  16. package/cargo/table-v-iii.wasm +0 -0
  17. package/cargo/worker.js +30808 -0
  18. package/organs/console/node/guard.d.ts +10 -0
  19. package/organs/console/node/guard.js +52 -0
  20. package/organs/console/node/index.d.ts +4 -0
  21. package/organs/console/node/index.js +5 -0
  22. package/organs/console/node/line.d.ts +16 -0
  23. package/organs/console/node/line.js +150 -0
  24. package/organs/console/node/main.js +51 -0
  25. package/organs/console/node/program.d.ts +1 -0
  26. package/organs/console/node/program.js +5 -0
  27. package/organs/console/node/proof.d.ts +15 -0
  28. package/organs/console/node/proof.js +84 -0
  29. package/organs/console/node/socket.d.ts +15 -0
  30. package/organs/console/node/socket.js +99 -0
  31. package/organs/disk/index.d.ts +1 -0
  32. package/organs/disk/index.js +2 -0
  33. package/organs/disk/node/files.js +162 -0
  34. package/organs/disk/node/main.js +20 -0
  35. package/organs/disk/node/program.d.ts +1 -0
  36. package/organs/disk/node/program.js +5 -0
  37. package/organs/disk/organ.d.ts +5 -0
  38. package/organs/disk/organ.js +69 -0
  39. package/organs/network/node/fill.d.ts +21 -0
  40. package/organs/network/node/fill.js +195 -0
  41. package/organs/network/node/flows.js +66 -0
  42. package/organs/network/node/half.js +260 -0
  43. package/organs/network/node/lines.d.ts +29 -0
  44. package/organs/network/node/lines.js +236 -0
  45. package/organs/network/node/link.d.ts +24 -0
  46. package/organs/network/node/link.js +215 -0
  47. package/organs/network/node/main.js +41 -0
  48. package/organs/network/node/moved.d.ts +2 -0
  49. package/organs/network/node/moved.js +20 -0
  50. package/organs/network/node/near.d.ts +63 -0
  51. package/organs/network/node/near.js +263 -0
  52. package/organs/network/node/program.d.ts +1 -0
  53. package/organs/network/node/program.js +5 -0
  54. package/organs/network/node/schemes.d.ts +1 -0
  55. package/organs/network/node/schemes.js +2 -0
  56. package/organs/network/node/sent.d.ts +13 -0
  57. package/organs/network/node/sent.js +101 -0
  58. package/organs/network/node/served.d.ts +19 -0
  59. package/organs/network/node/served.js +237 -0
  60. package/organs/screen/node/client.js +3 -0
  61. package/organs/screen/node/follow.js +266 -0
  62. package/organs/screen/node/frames.js +26 -0
  63. package/organs/screen/node/held.js +27 -0
  64. package/organs/screen/node/http.js +179 -0
  65. package/organs/screen/node/lay.js +116 -0
  66. package/organs/screen/node/leave.js +27 -0
  67. package/organs/screen/node/linked.js +69 -0
  68. package/organs/screen/node/listen.js +61 -0
  69. package/organs/screen/node/look.js +121 -0
  70. package/organs/screen/node/loop.js +154 -0
  71. package/organs/screen/node/main.js +74 -0
  72. package/organs/screen/node/mirror.js +112 -0
  73. package/organs/screen/node/notice.js +44 -0
  74. package/organs/screen/node/presser.js +11 -0
  75. package/organs/screen/node/presses.js +108 -0
  76. package/organs/screen/node/program.d.ts +1 -0
  77. package/organs/screen/node/program.js +5 -0
  78. package/organs/screen/node/shown.js +205 -0
  79. package/organs/screen/node/standing.js +29 -0
  80. package/organs/screen/node/state.js +80 -0
  81. package/organs/screen/node/tell.js +47 -0
  82. package/organs/screen/node/uid.js +65 -0
  83. package/organs/screen/node/worn.js +23 -0
  84. package/organs/shell/index.d.ts +1 -0
  85. package/organs/shell/index.js +2 -0
  86. package/organs/shell/node/main.js +26 -0
  87. package/organs/shell/node/output.js +70 -0
  88. package/organs/shell/node/pressure.js +14 -0
  89. package/organs/shell/node/program.d.ts +1 -0
  90. package/organs/shell/node/program.js +5 -0
  91. package/organs/shell/node/runs.js +220 -0
  92. package/organs/shell/node/told.js +70 -0
  93. package/organs/shell/organ.d.ts +5 -0
  94. package/organs/shell/organ.js +59 -0
  95. package/package.json +43 -4
  96. package/src/command/act.d.ts +31 -0
  97. package/src/command/act.js +261 -0
  98. package/src/command/answers.d.ts +3 -0
  99. package/src/command/answers.js +232 -0
  100. package/src/command/args.d.ts +14 -0
  101. package/src/command/args.js +220 -0
  102. package/src/command/arrive.d.ts +2 -0
  103. package/src/command/arrive.js +21 -0
  104. package/src/command/asked.d.ts +18 -0
  105. package/src/command/asked.js +49 -0
  106. package/src/command/backup.d.ts +18 -0
  107. package/src/command/backup.js +261 -0
  108. package/src/command/before.d.ts +40 -0
  109. package/src/command/before.js +249 -0
  110. package/src/command/born.d.ts +27 -0
  111. package/src/command/born.js +103 -0
  112. package/src/command/bridge.d.ts +19 -0
  113. package/src/command/bridge.js +152 -0
  114. package/src/command/chain.d.ts +9 -0
  115. package/src/command/chain.js +48 -0
  116. package/src/command/channel.d.ts +29 -0
  117. package/src/command/channel.js +263 -0
  118. package/src/command/choices.d.ts +35 -0
  119. package/src/command/choices.js +173 -0
  120. package/src/command/claim.d.ts +12 -0
  121. package/src/command/claim.js +46 -0
  122. package/src/command/commands.d.ts +16 -0
  123. package/src/command/commands.js +257 -0
  124. package/src/command/ends.d.ts +16 -0
  125. package/src/command/ends.js +78 -0
  126. package/src/command/follow.d.ts +12 -0
  127. package/src/command/follow.js +66 -0
  128. package/src/command/given.d.ts +39 -0
  129. package/src/command/given.js +53 -0
  130. package/src/command/held.d.ts +15 -0
  131. package/src/command/held.js +56 -0
  132. package/src/command/index.d.ts +1 -0
  133. package/src/command/index.js +203 -0
  134. package/src/command/jailer.d.ts +28 -0
  135. package/src/command/jailer.js +135 -0
  136. package/src/command/laid.d.ts +6 -0
  137. package/src/command/laid.js +31 -0
  138. package/src/command/left.d.ts +9 -0
  139. package/src/command/left.js +34 -0
  140. package/src/command/line.d.ts +7 -0
  141. package/src/command/line.js +39 -0
  142. package/src/command/link.d.ts +30 -0
  143. package/src/command/link.js +123 -0
  144. package/src/command/lobes.d.ts +1 -0
  145. package/src/command/lobes.js +10 -0
  146. package/src/command/locks.d.ts +17 -0
  147. package/src/command/locks.js +76 -0
  148. package/src/command/mcp/calls.d.ts +27 -0
  149. package/src/command/mcp/calls.js +155 -0
  150. package/src/command/mcp/notices.d.ts +22 -0
  151. package/src/command/mcp/notices.js +203 -0
  152. package/src/command/mcp/resources.d.ts +31 -0
  153. package/src/command/mcp/resources.js +108 -0
  154. package/src/command/mcp/server.d.ts +19 -0
  155. package/src/command/mcp/server.js +149 -0
  156. package/src/command/mcp/tools.d.ts +39 -0
  157. package/src/command/mcp/tools.js +131 -0
  158. package/src/command/mcp.d.ts +8 -0
  159. package/src/command/mcp.js +39 -0
  160. package/src/command/noticed.d.ts +11 -0
  161. package/src/command/noticed.js +55 -0
  162. package/src/command/older.d.ts +11 -0
  163. package/src/command/older.js +45 -0
  164. package/src/command/open.d.ts +24 -0
  165. package/src/command/open.js +107 -0
  166. package/src/command/passphrase.d.ts +6 -0
  167. package/src/command/passphrase.js +82 -0
  168. package/src/command/reclaim.d.ts +7 -0
  169. package/src/command/reclaim.js +47 -0
  170. package/src/command/refused.d.ts +4 -0
  171. package/src/command/refused.js +27 -0
  172. package/src/command/release.d.ts +27 -0
  173. package/src/command/release.js +153 -0
  174. package/src/command/repo.d.ts +31 -0
  175. package/src/command/repo.js +133 -0
  176. package/src/command/rewrap.d.ts +16 -0
  177. package/src/command/rewrap.js +175 -0
  178. package/src/command/runtime.d.ts +25 -0
  179. package/src/command/runtime.js +175 -0
  180. package/src/command/salvage.d.ts +4 -0
  181. package/src/command/salvage.js +42 -0
  182. package/src/command/screen.d.ts +14 -0
  183. package/src/command/screen.js +62 -0
  184. package/src/command/spawn.d.ts +23 -0
  185. package/src/command/spawn.js +213 -0
  186. package/src/command/start.d.ts +34 -0
  187. package/src/command/start.js +246 -0
  188. package/src/command/state.d.ts +5 -0
  189. package/src/command/state.js +39 -0
  190. package/src/command/token.d.ts +1 -0
  191. package/src/command/token.js +9 -0
  192. package/src/command/trial.d.ts +18 -0
  193. package/src/command/trial.js +108 -0
  194. package/src/command/undone.d.ts +3 -0
  195. package/src/command/undone.js +21 -0
  196. package/src/command/vouch.d.ts +1 -0
  197. package/src/command/vouch.js +15 -0
  198. package/src/command/windows-processes.d.ts +2 -0
  199. package/src/command/windows-processes.js +22 -0
  200. package/src/command/wipe.d.ts +9 -0
  201. package/src/command/wipe.js +105 -0
  202. package/src/command/words.d.ts +5 -0
  203. package/src/command/words.js +53 -0
  204. package/src/door/claim.d.ts +5 -0
  205. package/src/door/claim.js +21 -0
  206. package/src/door/claimed.d.ts +7 -0
  207. package/src/door/claimed.js +110 -0
  208. package/src/door/configuration.d.ts +40 -0
  209. package/src/door/configuration.js +206 -0
  210. package/src/door/design.d.ts +13 -0
  211. package/src/door/design.js +71 -0
  212. package/src/door/digests.d.ts +7 -0
  213. package/src/door/digests.js +36 -0
  214. package/src/door/distribution.d.ts +25 -0
  215. package/src/door/distribution.js +88 -0
  216. package/src/door/door.d.ts +41 -0
  217. package/src/door/door.js +219 -0
  218. package/src/door/dressed.d.ts +34 -0
  219. package/src/door/dressed.js +182 -0
  220. package/src/door/faculties.d.ts +29 -0
  221. package/src/door/faculties.js +88 -0
  222. package/src/door/longest.d.ts +6 -0
  223. package/src/door/longest.js +25 -0
  224. package/src/fills/account-only.d.ts +3 -0
  225. package/src/fills/account-only.js +24 -0
  226. package/src/fills/boot-key.d.ts +21 -0
  227. package/src/fills/boot-key.js +70 -0
  228. package/src/fills/boot-move.d.ts +25 -0
  229. package/src/fills/boot-move.js +86 -0
  230. package/src/fills/bridge.d.ts +13 -0
  231. package/src/fills/bridge.js +86 -0
  232. package/src/fills/chance.d.ts +2 -0
  233. package/src/fills/chance.js +7 -0
  234. package/src/fills/crypto.d.ts +2 -0
  235. package/src/fills/crypto.js +94 -0
  236. package/src/fills/flushed.d.ts +9 -0
  237. package/src/fills/flushed.js +80 -0
  238. package/src/fills/hardware.d.ts +18 -0
  239. package/src/fills/hardware.js +70 -0
  240. package/src/fills/held.d.ts +31 -0
  241. package/src/fills/held.js +171 -0
  242. package/src/fills/keepers.d.ts +23 -0
  243. package/src/fills/keepers.js +151 -0
  244. package/src/fills/keyring.d.ts +19 -0
  245. package/src/fills/keyring.js +131 -0
  246. package/src/fills/pages.d.ts +3 -0
  247. package/src/fills/pages.js +260 -0
  248. package/src/fills/reserve.d.ts +11 -0
  249. package/src/fills/reserve.js +72 -0
  250. package/src/fills/time.d.ts +2 -0
  251. package/src/fills/time.js +29 -0
  252. package/src/fills/unlocker.d.ts +6 -0
  253. package/src/fills/unlocker.js +26 -0
  254. package/src/fills/vitals.d.ts +8 -0
  255. package/src/fills/vitals.js +100 -0
  256. package/src/fills/windows-start.d.ts +2 -0
  257. package/src/fills/windows-start.js +21 -0
  258. package/src/halves/build.d.ts +10 -0
  259. package/src/halves/build.js +219 -0
  260. package/src/halves/end.d.ts +17 -0
  261. package/src/halves/end.js +157 -0
  262. package/src/halves/genome.d.ts +3 -0
  263. package/src/halves/genome.js +21 -0
  264. package/src/halves/handler.d.ts +8 -0
  265. package/src/halves/handler.js +40 -0
  266. package/src/halves/index.d.ts +5 -0
  267. package/src/halves/index.js +6 -0
  268. package/src/halves/laid.d.ts +12 -0
  269. package/src/halves/laid.js +103 -0
  270. package/src/halves/lent.d.ts +6 -0
  271. package/src/halves/lent.js +147 -0
  272. package/src/halves/native.d.ts +12 -0
  273. package/src/halves/native.js +53 -0
  274. package/src/halves/statements.d.ts +23 -0
  275. package/src/halves/statements.js +165 -0
  276. package/src/halves/tokens.d.ts +22 -0
  277. package/src/halves/tokens.js +135 -0
  278. package/src/link/link.d.ts +4 -0
  279. package/src/link/link.js +4 -0
  280. package/src/link/placeholder.d.ts +1 -0
  281. package/src/link/placeholder.js +21 -0
  282. package/src/link/steps.d.ts +52 -0
  283. package/src/link/steps.js +118 -0
  284. package/src/lobes/calls.d.ts +76 -0
  285. package/src/lobes/calls.js +61 -0
  286. package/src/lobes/channel.d.ts +76 -0
  287. package/src/lobes/channel.js +202 -0
  288. package/src/lobes/index.d.ts +1 -0
  289. package/src/lobes/index.js +2 -0
  290. package/src/lobes/lobes.d.ts +15 -0
  291. package/src/lobes/lobes.js +244 -0
  292. package/src/lobes/main.js +107 -0
  293. package/src/lobes/thread.d.ts +22 -0
  294. package/src/lobes/thread.js +270 -0
  295. package/src/organism/act.d.ts +8 -0
  296. package/src/organism/act.js +63 -0
  297. package/src/organism/beat.d.ts +5 -0
  298. package/src/organism/beat.js +45 -0
  299. package/src/organism/compiled.d.ts +2 -0
  300. package/src/organism/compiled.js +24 -0
  301. package/src/organism/folder.d.ts +88 -0
  302. package/src/organism/folder.js +259 -0
  303. package/src/organism/main.d.ts +1 -0
  304. package/src/organism/main.js +11 -0
  305. package/src/organism/organism.d.ts +1 -0
  306. package/src/organism/organism.js +220 -0
  307. package/src/organism/said.d.ts +12 -0
  308. package/src/organism/said.js +30 -0
  309. package/src/organism/told.d.ts +5 -0
  310. package/src/organism/told.js +110 -0
  311. package/src/organism/unlock.d.ts +8 -0
  312. package/src/organism/unlock.js +95 -0
  313. package/src/organism/upgrade.d.ts +24 -0
  314. package/src/organism/upgrade.js +145 -0
  315. package/src/organism/via.d.ts +7 -0
  316. package/src/organism/via.js +20 -0
  317. package/src/service/body.d.ts +8 -0
  318. package/src/service/body.js +34 -0
  319. package/src/service/handler.d.ts +20 -0
  320. package/src/service/handler.js +128 -0
  321. package/src/service/index.d.ts +4 -0
  322. package/src/service/index.js +16 -0
  323. package/src/service/manager.d.ts +18 -0
  324. package/src/service/manager.js +185 -0
  325. package/src/service/service.d.ts +24 -0
  326. package/src/service/service.js +200 -0
  327. package/src/service/swap.d.ts +12 -0
  328. package/src/service/swap.js +74 -0
  329. package/src/service/watchdog.d.ts +6 -0
  330. package/src/service/watchdog.js +31 -0
  331. package/src/tcp/crowd.d.ts +18 -0
  332. package/src/tcp/crowd.js +85 -0
  333. package/src/tcp/dial.d.ts +23 -0
  334. package/src/tcp/dial.js +102 -0
  335. package/src/tcp/frame.d.ts +23 -0
  336. package/src/tcp/frame.js +159 -0
  337. package/src/tcp/listen.d.ts +50 -0
  338. package/src/tcp/listen.js +207 -0
  339. package/src/tcp/source.d.ts +2 -0
  340. package/src/tcp/source.js +26 -0
  341. package/src/version/index.d.ts +1 -0
  342. package/src/version/index.js +2 -0
  343. package/src/version/version.d.ts +1 -0
  344. package/src/version/version.js +2 -0
  345. package/src/work/first.d.ts +11 -0
  346. package/src/work/first.js +91 -0
  347. package/src/work/index.d.ts +2 -0
  348. package/src/work/index.js +15 -0
  349. package/src/work/work.d.ts +20 -0
  350. package/src/work/work.js +136 -0
  351. package/src/ws/dial.d.ts +7 -0
  352. package/src/ws/dial.js +252 -0
  353. package/src/ws/dialing.d.ts +50 -0
  354. package/src/ws/dialing.js +72 -0
  355. package/src/ws/frame.d.ts +32 -0
  356. package/src/ws/frame.js +124 -0
  357. package/src/ws/handshake.d.ts +4 -0
  358. package/src/ws/handshake.js +27 -0
  359. package/src/ws/line.d.ts +45 -0
  360. package/src/ws/line.js +250 -0
  361. package/src/ws/listen.d.ts +42 -0
  362. package/src/ws/listen.js +272 -0
  363. package/src/ws/rfc6455.d.ts +18 -0
  364. package/src/ws/rfc6455.js +187 -0
@@ -0,0 +1,203 @@
1
+ // SPDX-License-Identifier: FSL-1.1-ALv2
2
+ import { bootModeOf, PORT, sitsAtInstall } from '../door/configuration.js';
3
+ import { readArgs } from './args.js';
4
+ import { askerOf } from './passphrase.js';
5
+
6
+ const USAGE = `nervur <command> [--home <folder>] [--port <port>] [--reserve <bytes>] [--boot <present|keyring|remote|file|hardware>] [--public <host>] [--ws <address>] [--work <account>] [--claim <file>] [--design <quo.json>]
7
+
8
+ install [version] [digest] the one act of install and update, idempotent: it takes the package
9
+ nervur@<version>, the newest the channel holds by default, from the
10
+ channel your npm config names, and the command it installed finishes:
11
+ it lays the organism where none stands, else keeps the old package,
12
+ stops the organism as it stands, a run going lost to it as to a
13
+ crash, keeps its store's log aside, then boots the new version on the
14
+ store itself as a trial that writes nothing of it but its log and
15
+ touches nothing of the world, which moves the
16
+ installer's organs and the lobes on its faculties: passed, the
17
+ organism starts on it, and what moved is said; failed, the old
18
+ comes back by itself. A digest named, the SHA-256 of the package, is
19
+ the only bytes laid. It does nothing where that version runs already,
20
+ refuses an update with no room for the log's copy, and a second while
21
+ one runs. With the channel silent and no organism running, the
22
+ installer at hand lays or starts it. It runs by its service, at boot
23
+ from then on, and whoever is present at this account owns it, at its
24
+ console
25
+ start [--floor] asks the passphrase in present mode, and starts the organism after a
26
+ stop: by its service where one is laid, else in a process of its own;
27
+ --floor lays the console and the window this installer ships again,
28
+ whatever the person present moved them to
29
+ stop stops the organism
30
+ update [version] [digest] the same as install
31
+ wipe destroys the organism and everything it holds, for good, once you
32
+ type wipe: its service removed and its folder deleted, the
33
+ installer kept; it needs no boot key
34
+ reclaim reclaims the organism by one of its recovery keys: shows a fresh
35
+ challenge, which you sign with your key's secret off this device and
36
+ type back; every relation to its brain ends, and its anchor is
37
+ taken anew; refused, it boots as it stood
38
+ backup [file] backs the running organism up to a file read by your account alone,
39
+ which it never writes over, and says how it opens
40
+ salvage [file] writes what still opens of a store, boots or not, as a backup, its bytes as they stand
41
+ restore <file> [salt] restores a backup where no organism stands, as a new life under this
42
+ device's own boot key: its lobes stand, every relation dropped; the
43
+ boot key it was made under as hex on standard input, or with its
44
+ salt, the passphrase it was made under
45
+ arrive on a new device, draws the key a move is sealed to and shows its
46
+ public half, to type to move on the old device
47
+ move <key> [file] moves the organism to the device whose key arrive showed: seals it to
48
+ that key alone, writes the file and stops this copy for good, naming
49
+ what the body held, which stays; restore opens the file there
50
+ stay undoes a move's stop, at your word that the new copy never ran
51
+ rewrap changes the boot key: in file mode a new boot.key, in present mode a
52
+ new passphrase; the old opens nothing once the organism took the new,
53
+ but the data key stays, so a copy of the store it opened still opens
54
+ rekey [--cipher <name>] changes the boot key and the data key, writing the organism anew onto
55
+ itself as it starts again, under the cipher named, the one it stands
56
+ under where none is; every relation stands, and a former holder of
57
+ the key opens nothing written after
58
+ repos lays the running organism's jailer, nervur.repos, set up at its disk,
59
+ when you first want a repo: no install lays one, and one that stands
60
+ is kept; an update changes nothing of it
61
+ repo <name> [--starter] makes a repo in one act: the jailer laid as repos lays it where none
62
+ stands, a repo lobe on nervur.repo wired to it and the core, granted
63
+ the folder <name>, and begun by its init, waited on to its end, empty
64
+ or with the floor's small starter by --starter; it answers the repo
65
+ lobe, as {"result": {"lobe": ...}} by --json; a folder a repo lobe
66
+ holds already answers that lobe, and no second is made
67
+ screen the address of this home's own screen, as JSON, where a person sits at
68
+ this host: a page on 127.0.0.1 which only this account's programs
69
+ can open, asked of the running organism, which says why where its
70
+ screen is not available; none on a server
71
+ version this installer's version, and the one the running organism runs on
72
+ mcp serves MCP on standard input and output to a model present at the
73
+ device: its tools ask and lobe, each typed at the console
74
+ help this text
75
+
76
+ The lines of a running organism's console, each answer printed in a few plain lines:
77
+ ask <placeholder> [method] [args] asks over a placeholder the console holds, brain its own organism's;
78
+ naming no method, it describes what that node may be asked
79
+ lobe <lobe> [method] [args] asks a lobe, through the brain, and describes it naming no method
80
+ accept <placeholder> <invitation> [note]
81
+ accepts an owner's invitation, under a placeholder of your naming,
82
+ once the organism it invites to answers; the note, one word of JSON,
83
+ is kept beside the standing on this side alone, never sent
84
+ accept <link> [placeholder] [note] takes a link (https://<domain>/<links>#<reference> or web+quo:…) as a
85
+ screen takes it, held under the placeholder, else the domain's name, the
86
+ note, fields of JSON, kept beside the domain and the time; a place a
87
+ screen blocked is accepted here, the owner's own word
88
+ open <link> hands a link to this home's screen, opened in your browser, which shows
89
+ its offer and asks before anything is accepted: what a link opened
90
+ from a page or a message runs; where the screen does not answer,
91
+ nothing is accepted and a page says why
92
+ offer <link> reads a link's offer and spends nothing: what its invitation says, the
93
+ milliseconds left of its wait and how long the relation lives, as JSON,
94
+ each null for none, or says that the place answered none
95
+ ask <owned> accept '{"relation": "<name>"}' --text invitation=<file>
96
+ has an organism you own from afar accept an invitation, or a link with
97
+ --text link=<file>, as accept does here: held by its present lobes
98
+ under the name, or by "lobe" where the args name one; "note" kept there
99
+ forget <placeholder> ends a relation the console accepted, leaving the far organism's
100
+ brain first, so you are its owner no longer
101
+ relations the placeholders the console accepted
102
+ ends [lobe] every occupant the organism's lobes gave and standing they hold, of one
103
+ lobe where it names one, each with its far organism, side, status and note
104
+ card the organism's card, its public ward and the addresses it is
105
+ reached at, to hand to anyone: a stranger asks it by on the zero head
106
+ state the brain's state, as ask brain state asks it
107
+
108
+ args one word of JSON, as '{"lives": null}'
109
+ --text <field>=<file>, for ask and lobe: the file's text as that field of the args, as
110
+ lobe <repo-lobe> setToken '{"name": "NPM_TOKEN"}' --text value=token.txt sets a secret;
111
+ for accept, invitation=<file> or link=<file> in place of the invitation or the link
112
+ --follow for ask and lobe: a job the answer names waited on to its end, as the organism tells it,
113
+ printed whole, the command exiting on its code
114
+ --home the folder of your organism, ~/.nervur by default; another folder is for tests, and an
115
+ install lays it no service and takes no package
116
+ --port the port the organism listens on, ${PORT} by default
117
+ --reserve the bytes kept so a full disk still lets the organism answer you, 67108864 by default, 0 for none
118
+ --boot how the organism gets its boot key at every boot: present, a passphrase
119
+ you give, keyring, this account's login keychain or Secret Service, remote, a keeper over Quo
120
+ (--keeper <invitation-file> for each, --end the mode the chain ends at, present by default),
121
+ hardware, sealed to this Mac's Secure Enclave, or file, boot.key in its folder;
122
+ ${bootModeOf(process.platform, sitsAtInstall(process.platform, process.env))} on this host by default
123
+ --screen, --no-screen
124
+ at a first install, whether a person sits here, so the organism holds a screen and by default
125
+ boots present: a Mac or Windows does, Linux inside a graphical session does, any other does not
126
+ --public the host the organism is reached at, as a server is: it listens on every
127
+ interface, and announces tcp://<host>:<port>; without it, on this machine alone
128
+ --ws the ws:// or wss:// address the organism's held lines are reached at: it accepts them at a ws
129
+ endpoint of its own, the third port after --port, and reports this address for it; ws://<host>:<port>/quo
130
+ needs --public and that port open, wss://<host>/quo a proxy of this machine with TLS and
131
+ keeps the endpoint on loopback; a later install may add it where none was chosen, and
132
+ a wss:// beside a plain ws:// (a TLS proxy of this machine forwarding to the same
133
+ endpoint, both reported), and the organism starts again with it, but never names another
134
+ --work the account the shell and disk run as, apart from the organism's, so what they
135
+ start never reads its folder: sudo starts programs as it with no password, by a rule a
136
+ root lays; without it, they run as this account
137
+ A later install keeps every choice it does not name, and takes those it names, starting the organism again
138
+ on them: a --port or a --public leaves every invitation drawn naming the old address, a --boot rewraps into that
139
+ mode, and a --work leaves what the old account held where it stands.
140
+ --claim at a first install or a restore, a file holding a claim its layer drew, as openssl rand -hex 32 > claim.txt, for a
141
+ machine laid from afar: the organism names no anchor, and POST /.nervur/claim on its web, the port after
142
+ --port, with "Authorization: Bearer <claim>" answers its first invitation, whose acceptor holds the anchor;
143
+ every other asker hears a path that is none. Until then whoever reads the claim holds the organism, and
144
+ over plain http it crosses in clear: from afar, fetch it through a proxy of this machine with TLS. A
145
+ reclaim here forgets it
146
+ --design at a first install, the quo.json whose organism.design names the design the organism is born in, as a site's
147
+ does in its own file, its parts (design.json and design/) beside it, each checked against its digest: the
148
+ first screen wears it, the floor's design where none is named, and a design that fails the check is
149
+ refused and nothing is laid; wear, as an owner's word, moves it later. Over an organism standing in the
150
+ floor's design it is laid too, worn from its next start unless its person chose another; over one an
151
+ install laid another design in, it is refused. The same file may name the class
152
+ of the screen's size, size, compact, medium or expanded: the screen is then drawn and told in it whatever
153
+ the window's width, and with none named the class is the width's; a file naming a size and no
154
+ design is taken, the floor's design worn in that class. It may name the corner the way out stands at, way, top-start, top-end, bottom-start or bottom-end: a
155
+ default the owner's own word stands above, and with none named, or any other word, none is said
156
+ --channel for install and update, the registry this act takes the package from, in place of the default
157
+ --package for install and update, a folder holding the package nervur-<version>.tgz and those it stands on,
158
+ laid in place of any channel
159
+ --short with a passphrase asked, lets it be shorter than eight characters, at your own word
160
+ --starter for repo, the repo begins with the floor's one small starter as its first commit, a package.json with a
161
+ gate and a conform, tools/conform.mjs and one faculty, and without it begins empty
162
+ --take with --home, takes the package from the channel as the account's own organism does; for tests
163
+ --json each answer printed as the data's one text, for programs, and every other line on
164
+ standard error`;
165
+
166
+ const usage = (why = '') => {
167
+ process.stderr.write(`${why === '' ? '' : `${why}\n\n`}${USAGE}\n`);
168
+ return 2;
169
+ };
170
+
171
+ export const nervur = async (argv ) => {
172
+ if (argv[0] === 'organism') {
173
+ process.argv.splice(2, 1);
174
+ await import('../organism/main.js');
175
+ return Number(process.exitCode ?? 0);
176
+ }
177
+ for (const stream of [process.stdout, process.stderr])
178
+ stream.on('error', (failed ) => {
179
+ if (failed.code === 'EPIPE') process.exit(0);
180
+ throw failed;
181
+ });
182
+ const read = readArgs(argv);
183
+ if ('help' in read) {
184
+ process.stdout.write(`${USAGE}\n`);
185
+ return 0;
186
+ }
187
+ if ('why' in read) return usage(read.why);
188
+ const asker = askerOf();
189
+ try {
190
+ const outcome = await read.command({
191
+ ...read.given,
192
+ asker,
193
+ print: (printed) => void (read.given.json ? process.stderr : process.stdout).write(`${printed}\n`),
194
+ answer: (text) => void process.stdout.write(`${text}\n`),
195
+ });
196
+ if (outcome === null) return 0;
197
+ if ('exit' in outcome) return outcome.exit;
198
+ process.stderr.write(`nervur: ${outcome.why}\n`);
199
+ return 1;
200
+ } finally {
201
+ asker.close();
202
+ }
203
+ };
@@ -0,0 +1,28 @@
1
+ import { type Data } from '@nervur.org/genome/standard';
2
+ import { type Shipped } from '../door/faculties.js';
3
+ import { type Laid } from '../organism/folder.js';
4
+ import { answered } from './asked.js';
5
+ import { type Given, type Outcome } from './given.js';
6
+ import { type Telling } from './noticed.js';
7
+ type Why = {
8
+ readonly why: string;
9
+ };
10
+ export declare const jailerIn: (state: Data, blueprint?: string) => string | null;
11
+ export type Reaches = {
12
+ readonly ask: (home: string, words: readonly string[]) => ReturnType<typeof answered>;
13
+ readonly telling: (home: string) => Telling;
14
+ };
15
+ export declare const reachesAt: Reaches;
16
+ export declare const setUpAt: (home: string, jailer: string, at: string, reaches: Reaches) => Promise<boolean | Why>;
17
+ export type Stand = {
18
+ readonly at: string;
19
+ readonly shipped: Shipped | undefined;
20
+ };
21
+ export declare const standOf: (home: string, laid: Laid) => Stand | Why;
22
+ export declare const jailerAt: (print: Given['print'], home: string, { at, shipped }: Stand, reaches?: Reaches) => Promise<string | Why>;
23
+ export declare const rehomed: (home: string, at: string, reaches?: Reaches) => Promise<{
24
+ readonly jailer: string | null;
25
+ } | Why>;
26
+ export declare const rehomedAt: (given: Given, home: string, laid: Laid) => Promise<void>;
27
+ export declare const repos: (given: Given) => Promise<Outcome>;
28
+ export {};
@@ -0,0 +1,135 @@
1
+ // SPDX-License-Identifier: FSL-1.1-ALv2
2
+ import { dataText, isFields, } from '@nervur.org/genome/standard';
3
+ import { DISK } from '../../organs/disk/index.js';
4
+ import { SHELL } from '../../organs/shell/index.js';
5
+ import { configurationOf } from '../door/configuration.js';
6
+ import { JAILER, shippedOf, } from '../door/faculties.js';
7
+ import { LONGEST_WAIT } from '../door/longest.js';
8
+ import { readFolder, typedFor, } from '../organism/folder.js';
9
+ import { answered, stateOf } from './asked.js';
10
+ import { organismOf, } from './given.js';
11
+ import { tellingAt, toldWithin, } from './noticed.js';
12
+ import { runningOf } from './spawn.js';
13
+
14
+ const holdsOrgan = (state , id ) =>
15
+ isFields(state) && Array.isArray(state['organs']) && state['organs'].some((one) => isFields(one) && one['id'] === id);
16
+
17
+
18
+
19
+ export const jailerIn = (state , blueprint = JAILER) => {
20
+ const nodes = isFields(state) && Array.isArray(state['nodes']) ? state['nodes'] : [];
21
+ const found = nodes.find((node) => isFields(node) && node['kind'] === 'lobe' && node['blueprint'] === blueprint);
22
+ return isFields(found) && typeof found['id'] === 'string' ? found['id'] : null;
23
+ };
24
+
25
+ const folderOf = (home , laid ) => {
26
+ const reach = configurationOf(laid, home).installerOrgans?.[DISK.id]?.reach;
27
+ const folder = isFields(reach) ? reach['folder'] : undefined;
28
+ return typeof folder === 'string' ? folder : { why: 'this installer lays no disk folder' };
29
+ };
30
+
31
+
32
+
33
+
34
+
35
+
36
+ export const reachesAt = { ask: answered, telling: tellingAt };
37
+
38
+ const setupOf = async (home , jailer , ask ) => {
39
+ const read = await ask(home, ['lobe', jailer, 'state', '{}']);
40
+ return 'why' in read ? read : { setup: read.data };
41
+ };
42
+ const fieldOf = (setup , key ) => (isFields(setup) ? setup[key] : undefined);
43
+
44
+ const setUp = async (home , jailer , at , reaches ) => {
45
+ const look = async () => {
46
+ const read = await setupOf(home, jailer, reaches.ask);
47
+ if ('why' in read) return read;
48
+ if (fieldOf(read.setup, 'ready') === true) return { ready: true };
49
+ const failed = fieldOf(read.setup, 'failed');
50
+ return typeof failed === 'string' ? { why: `the jailer ${jailer} is not set up at ${at}: ${failed}` } : null;
51
+ };
52
+ const ended = await toldWithin(reaches.telling(home), LONGEST_WAIT, ({ lobes }) => lobes.includes(jailer), look);
53
+ if (ended === null) return { why: `the jailer ${jailer} was not set up at ${at} within ${LONGEST_WAIT} ms` };
54
+ return 'why' in ended ? ended : null;
55
+ };
56
+
57
+ export const setUpAt = async (home , jailer , at , reaches ) => {
58
+ const read = await setupOf(home, jailer, reaches.ask);
59
+ if ('why' in read) return read;
60
+ if (fieldOf(read.setup, 'ready') === true && fieldOf(read.setup, 'at') === at) return false;
61
+ if (typeof fieldOf(read.setup, 'doing') !== 'string') {
62
+ const asked = await reaches.ask(home, ['lobe', jailer, 'setup', dataText({ at })]);
63
+ if ('why' in asked) return asked;
64
+ }
65
+ const ended = await setUp(home, jailer, at, reaches);
66
+ return ended ?? true;
67
+ };
68
+
69
+ const made = async (home , digest , ask ) => {
70
+ const wiring = { [SHELL.id]: SHELL.id, [DISK.id]: DISK.id };
71
+ const created = await ask(home, ['ask', 'brain', 'create', dataText({ faculty: digest, wiring })]);
72
+ if ('why' in created) return created;
73
+ const id = isFields(created.data) ? created.data['id'] : undefined;
74
+ return typeof id === 'string' ? id : { why: 'the brain named no jailer' };
75
+ };
76
+
77
+
78
+
79
+ export const standOf = (home , laid ) => {
80
+ const at = folderOf(home, laid);
81
+ return typeof at === 'string' ? { at, shipped: shippedOf(laid.floor).find((one) => one.name === JAILER) } : at;
82
+ };
83
+
84
+ export const jailerAt = async (
85
+ print ,
86
+ home ,
87
+ { at, shipped } ,
88
+ reaches = reachesAt,
89
+ ) => {
90
+ const state = await stateOf((words) => reaches.ask(home, words));
91
+ if ('why' in state) return state;
92
+ if (!holdsOrgan(state.data, SHELL.id)) return { why: 'this organism has no shell, and keeps no repos' };
93
+ const jailer = jailerIn(state.data, shipped?.blueprint) ?? (await made(home, shipped?.digest ?? '', reaches.ask));
94
+ if (typeof jailer !== 'string') return jailer;
95
+ const set = await setUpAt(home, jailer, at, reaches);
96
+ if (typeof set !== 'boolean') return set;
97
+ if (set) print(`The jailer ${jailer} stands on ${shipped?.blueprint ?? JAILER}, set up at ${at}.`);
98
+ return jailer;
99
+ };
100
+
101
+ export const rehomed = async (
102
+ home ,
103
+ at ,
104
+ reaches = reachesAt,
105
+ ) => {
106
+ const state = await stateOf((words) => reaches.ask(home, words));
107
+ if ('why' in state) return state;
108
+ const jailer = jailerIn(state.data);
109
+ if (jailer === null) return { jailer };
110
+ const set = await setUpAt(home, jailer, at, reaches);
111
+ return typeof set === 'boolean' ? { jailer } : set;
112
+ };
113
+
114
+ export const rehomedAt = async (given , home , laid ) => {
115
+ const at = folderOf(home, laid);
116
+ if (typeof at !== 'string') return;
117
+ const moved = await rehomed(home, at);
118
+ if ('why' in moved)
119
+ given.print(`The jailer is not set up at ${at}: ${moved.why}; ${typedFor(home)('repos')} sets it up.`);
120
+ else if (moved.jailer !== null)
121
+ given.print(`Its repos stand under ${at}: the jailer ${moved.jailer} is set up there.`);
122
+ };
123
+
124
+ export const repos = async (given ) => {
125
+ const home = organismOf(given.home);
126
+ const folder = readFolder(home);
127
+ if ('why' in folder) return folder;
128
+ if (runningOf(home) === null) return { why: 'the organism is not running' };
129
+ const stand = standOf(home, folder.laid);
130
+ if ('why' in stand) return stand;
131
+ const jailer = await jailerAt(given.print, home, stand);
132
+ if (typeof jailer !== 'string') return jailer;
133
+ given.print(`The organism keeps repos: its jailer is ${jailer}.`);
134
+ return null;
135
+ };
@@ -0,0 +1,6 @@
1
+ import type { Laid } from '../organism/folder.js';
2
+ import { type Work } from '../work/index.js';
3
+ export declare const prunedBeside: (home: string, laid: Pick<Laid, 'work'>, named: readonly string[]) => readonly string[];
4
+ export declare const laidHalves: (home: string, work: Work | undefined) => null | {
5
+ readonly why: string;
6
+ };
@@ -0,0 +1,31 @@
1
+ // SPDX-License-Identifier: FSL-1.1-ALv2
2
+ import { bodyOf, configurationOf } from '../door/configuration.js';
3
+ import { halvesOf, layHalves, nativeHalves, pruneHalves } from '../halves/index.js';
4
+
5
+ import { baseClosed, layWorkHalves, readableAs, workHalvesOf, } from '../work/index.js';
6
+
7
+ export const prunedBeside = (home , laid , named ) => {
8
+ const kept = new Set([...named, ...[...nativeHalves().values()].map((built) => built.digest)]);
9
+ const work = laid.work === undefined ? [] : pruneHalves(workHalvesOf(home), kept);
10
+ return [...pruneHalves(halvesOf(home), kept), ...work];
11
+ };
12
+
13
+ export const laidHalves = (home , work ) => {
14
+ const halves = nativeHalves();
15
+ layHalves(halvesOf(home), halves.values());
16
+ if (work === undefined) {
17
+ baseClosed(home);
18
+ return null;
19
+ }
20
+ const body = bodyOf(configurationOf({ port: 0, bootMode: 'file', work }, home));
21
+ layWorkHalves(
22
+ home,
23
+ body.flatMap((organ) => halves.get(organ) ?? []),
24
+ );
25
+ for (const organ of body) {
26
+ const digest = halves.get(organ)?.digest;
27
+ const unread = digest === undefined ? null : readableAs(work, home, digest);
28
+ if (unread !== null) return unread;
29
+ }
30
+ return null;
31
+ };
@@ -0,0 +1,9 @@
1
+ import { type Line } from './asked.js';
2
+ type Why = {
3
+ readonly why: string;
4
+ };
5
+ export declare const aloneOf: (line: Line) => Promise<{
6
+ readonly alone: readonly string[];
7
+ } | Why>;
8
+ export declare const leftSaid: (alone: readonly string[]) => string | null;
9
+ export {};
@@ -0,0 +1,34 @@
1
+ // SPDX-License-Identifier: FSL-1.1-ALv2
2
+ import { isFields, } from '@nervur.org/genome/standard';
3
+ import { stateOf, } from './asked.js';
4
+
5
+
6
+
7
+ const REPO = 'nervur.repo';
8
+
9
+ const heldElsewhere = (state , occupants ) =>
10
+ (isFields(state) && Array.isArray(state['on']) && state['on'].length > 0) ||
11
+ (Array.isArray(occupants) &&
12
+ occupants.some((one) => isFields(one) && (one['role'] === 'reader' || one['role'] === 'writer')));
13
+
14
+ export const aloneOf = async (line ) => {
15
+ const state = await stateOf(line);
16
+ if ('why' in state) return state;
17
+ const { nodes } = state.data;
18
+ const lobes = (Array.isArray(nodes) ? nodes : []).flatMap((node) =>
19
+ isFields(node) && node['blueprint'] === REPO && typeof node['id'] === 'string' ? [node['id']] : [],
20
+ );
21
+ const alone = [];
22
+ for (const lobe of lobes) {
23
+ const [read, given] = [await line(['lobe', lobe, 'state', '{}']), await line(['lobe', lobe, 'occupants', '{}'])];
24
+ if ('why' in read || 'why' in given) alone.push(lobe);
25
+ else if (isFields(read.data) && !heldElsewhere(read.data, given.data))
26
+ alone.push(typeof read.data['name'] === 'string' ? read.data['name'] : lobe);
27
+ }
28
+ return { alone };
29
+ };
30
+
31
+ export const leftSaid = (alone ) =>
32
+ alone.length === 0
33
+ ? null
34
+ : `A backup and a move carry no repo's bytes, and no other lobe holds these repos, so they stay behind on this device: ${alone.join(', ')}.`;
@@ -0,0 +1,7 @@
1
+ import { type Given, type Outcome } from './given.js';
2
+ export declare const argsTyped: (words: readonly string[]) => {
3
+ readonly words: readonly string[];
4
+ } | {
5
+ readonly why: string;
6
+ };
7
+ export declare const line: ({ home, words, json, follow, print, answer }: Given) => Promise<Outcome>;
@@ -0,0 +1,39 @@
1
+ // SPDX-License-Identifier: FSL-1.1-ALv2
2
+ import { dataText, readText } from '@nervur.org/genome/standard';
3
+ import { socketOf, typeLine, watchConsole } from '../../organs/console/node/index.js';
4
+ import { LONGEST_TIMEOUT } from '../door/longest.js';
5
+ import { typedFor } from '../organism/folder.js';
6
+ import { shown } from './answers.js';
7
+ import { exitOf, followed } from './follow.js';
8
+ import { organismOf, } from './given.js';
9
+ import { notRunningWhy, runningOf } from './spawn.js';
10
+
11
+ export const argsTyped = (
12
+ words ,
13
+ ) => {
14
+ const args = words[3];
15
+ if (args === undefined || !['ask', 'lobe', 'accept'].includes(words[0] ?? '')) return { words };
16
+ const read = readText(args);
17
+ const what = words[0] === 'accept' ? 'the note is' : 'the args are';
18
+ if ('why' in read) return { why: `${what} no JSON: ${read.why}, in ${args}` };
19
+ return { words: [...words.slice(0, 3), dataText(read.data)] };
20
+ };
21
+
22
+ export const line = async ({ home, words, json, follow, print, answer } ) => {
23
+ const organism = organismOf(home);
24
+ if (runningOf(organism) === null) return { why: notRunningWhy(organism) };
25
+ if (follow && words[0] !== 'ask' && words[0] !== 'lobe') return { why: '--follow is for ask and lobe' };
26
+ const typed = argsTyped(words);
27
+ if ('why' in typed) return typed;
28
+ const type = (typing ) => typeLine(socketOf(organism), typing, LONGEST_TIMEOUT);
29
+ const typedOnce = await type(typed.words);
30
+ if ('why' in typedOnce) return typedOnce;
31
+ const watch = (moved, ended) =>
32
+ watchConsole(socketOf(organism), LONGEST_TIMEOUT, moved, ended);
33
+ const heard = follow ? await followed({ type, watch }, typed.words, typedOnce) : typedOnce;
34
+ if ('why' in heard) return heard;
35
+ if (json) answer(heard.text);
36
+ else for (const one of shown(words, heard.text, typedFor(organism))) print(one);
37
+ const exit = follow ? exitOf(heard) : 'error' in heard.answer ? 1 : 0;
38
+ return exit === 0 ? null : { exit };
39
+ };
@@ -0,0 +1,30 @@
1
+ import { type Data } from '@nervur.org/genome/standard';
2
+ import { type Given, type Outcome } from './given.js';
3
+ type Why = {
4
+ readonly why: string;
5
+ };
6
+ export type Reaches = {
7
+ readonly vouch: (domain: string) => Promise<string | null>;
8
+ readonly now: () => string;
9
+ readonly line: (words: readonly string[]) => Promise<{
10
+ readonly data: Data;
11
+ } | Why>;
12
+ };
13
+ export declare const reachesOf: (home: string) => Reaches;
14
+ export declare const isLink: (word: string | undefined) => boolean;
15
+ export declare const acceptLink: (words: readonly string[], reaches: Reaches) => Promise<Outcome>;
16
+ export type Offer = {
17
+ readonly says: Data;
18
+ readonly waits: number | null;
19
+ readonly lives: number | null;
20
+ };
21
+ export declare const offerLink: (text: string | undefined, reaches: Reaches) => Promise<{
22
+ readonly offer: Offer;
23
+ } | {
24
+ readonly offer: null;
25
+ readonly said: string;
26
+ } | Why>;
27
+ export declare const offerPrinted: (given: Given, reaches: Reaches) => Promise<Outcome>;
28
+ export declare const offer: (given: Given) => Promise<Outcome>;
29
+ export declare const accept: (given: Given) => Promise<Outcome>;
30
+ export {};