@nervur.org/installer-node 0.0.0-stage → 0.37.1
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.
- package/LICENSE +105 -0
- package/README.md +158 -2
- package/SECURITY.md +8 -0
- package/bin/nervur.js +5 -0
- package/cargo/emscripten-module.wasm +0 -0
- package/cargo/manifest.json +1 -0
- package/cargo/sqlite3.wasm +0 -0
- package/cargo/table-i-i.wasm +0 -0
- package/cargo/table-i-ii.wasm +0 -0
- package/cargo/table-i-iii.wasm +0 -0
- package/cargo/table-i-iiii.wasm +0 -0
- package/cargo/table-i-iiiii.wasm +0 -0
- package/cargo/table-i-iiij.wasm +0 -0
- package/cargo/table-i-ij.wasm +0 -0
- package/cargo/table-v-ii.wasm +0 -0
- package/cargo/table-v-iii.wasm +0 -0
- package/cargo/worker.js +30756 -0
- package/organs/console/node/guard.d.ts +10 -0
- package/organs/console/node/guard.js +52 -0
- package/organs/console/node/index.d.ts +4 -0
- package/organs/console/node/index.js +5 -0
- package/organs/console/node/line.d.ts +16 -0
- package/organs/console/node/line.js +150 -0
- package/organs/console/node/main.js +51 -0
- package/organs/console/node/program.d.ts +1 -0
- package/organs/console/node/program.js +5 -0
- package/organs/console/node/proof.d.ts +15 -0
- package/organs/console/node/proof.js +84 -0
- package/organs/console/node/socket.d.ts +15 -0
- package/organs/console/node/socket.js +99 -0
- package/organs/disk/index.d.ts +1 -0
- package/organs/disk/index.js +2 -0
- package/organs/disk/node/files.js +162 -0
- package/organs/disk/node/main.js +20 -0
- package/organs/disk/node/program.d.ts +1 -0
- package/organs/disk/node/program.js +5 -0
- package/organs/disk/organ.d.ts +5 -0
- package/organs/disk/organ.js +69 -0
- package/organs/network/node/fill.d.ts +21 -0
- package/organs/network/node/fill.js +195 -0
- package/organs/network/node/flows.js +66 -0
- package/organs/network/node/half.js +260 -0
- package/organs/network/node/lines.d.ts +29 -0
- package/organs/network/node/lines.js +236 -0
- package/organs/network/node/link.d.ts +24 -0
- package/organs/network/node/link.js +215 -0
- package/organs/network/node/main.js +41 -0
- package/organs/network/node/moved.d.ts +2 -0
- package/organs/network/node/moved.js +20 -0
- package/organs/network/node/near.d.ts +63 -0
- package/organs/network/node/near.js +263 -0
- package/organs/network/node/program.d.ts +1 -0
- package/organs/network/node/program.js +5 -0
- package/organs/network/node/schemes.d.ts +1 -0
- package/organs/network/node/schemes.js +2 -0
- package/organs/network/node/sent.d.ts +13 -0
- package/organs/network/node/sent.js +101 -0
- package/organs/network/node/served.d.ts +19 -0
- package/organs/network/node/served.js +237 -0
- package/organs/screen/node/client.js +3 -0
- package/organs/screen/node/follow.js +266 -0
- package/organs/screen/node/frames.js +26 -0
- package/organs/screen/node/held.js +27 -0
- package/organs/screen/node/http.js +179 -0
- package/organs/screen/node/lay.js +116 -0
- package/organs/screen/node/leave.js +27 -0
- package/organs/screen/node/linked.js +69 -0
- package/organs/screen/node/listen.js +61 -0
- package/organs/screen/node/look.js +121 -0
- package/organs/screen/node/loop.js +154 -0
- package/organs/screen/node/main.js +74 -0
- package/organs/screen/node/mirror.js +112 -0
- package/organs/screen/node/notice.js +44 -0
- package/organs/screen/node/presser.js +11 -0
- package/organs/screen/node/presses.js +108 -0
- package/organs/screen/node/program.d.ts +1 -0
- package/organs/screen/node/program.js +5 -0
- package/organs/screen/node/shown.js +205 -0
- package/organs/screen/node/standing.js +29 -0
- package/organs/screen/node/state.js +80 -0
- package/organs/screen/node/tell.js +47 -0
- package/organs/screen/node/uid.js +65 -0
- package/organs/screen/node/worn.js +23 -0
- package/organs/shell/index.d.ts +1 -0
- package/organs/shell/index.js +2 -0
- package/organs/shell/node/main.js +26 -0
- package/organs/shell/node/output.js +70 -0
- package/organs/shell/node/pressure.js +14 -0
- package/organs/shell/node/program.d.ts +1 -0
- package/organs/shell/node/program.js +5 -0
- package/organs/shell/node/runs.js +220 -0
- package/organs/shell/node/told.js +70 -0
- package/organs/shell/organ.d.ts +5 -0
- package/organs/shell/organ.js +59 -0
- package/package.json +43 -4
- package/src/command/act.d.ts +31 -0
- package/src/command/act.js +256 -0
- package/src/command/answers.d.ts +3 -0
- package/src/command/answers.js +232 -0
- package/src/command/args.d.ts +14 -0
- package/src/command/args.js +220 -0
- package/src/command/arrive.d.ts +2 -0
- package/src/command/arrive.js +21 -0
- package/src/command/asked.d.ts +18 -0
- package/src/command/asked.js +49 -0
- package/src/command/backup.d.ts +18 -0
- package/src/command/backup.js +261 -0
- package/src/command/before.d.ts +41 -0
- package/src/command/before.js +237 -0
- package/src/command/born.d.ts +27 -0
- package/src/command/born.js +103 -0
- package/src/command/bridge.d.ts +19 -0
- package/src/command/bridge.js +152 -0
- package/src/command/chain.d.ts +9 -0
- package/src/command/chain.js +48 -0
- package/src/command/channel.d.ts +29 -0
- package/src/command/channel.js +263 -0
- package/src/command/choices.d.ts +35 -0
- package/src/command/choices.js +173 -0
- package/src/command/claim.d.ts +12 -0
- package/src/command/claim.js +46 -0
- package/src/command/commands.d.ts +16 -0
- package/src/command/commands.js +257 -0
- package/src/command/ends.d.ts +16 -0
- package/src/command/ends.js +78 -0
- package/src/command/follow.d.ts +12 -0
- package/src/command/follow.js +66 -0
- package/src/command/given.d.ts +39 -0
- package/src/command/given.js +53 -0
- package/src/command/held.d.ts +15 -0
- package/src/command/held.js +56 -0
- package/src/command/index.d.ts +1 -0
- package/src/command/index.js +203 -0
- package/src/command/jailer.d.ts +28 -0
- package/src/command/jailer.js +135 -0
- package/src/command/laid.d.ts +6 -0
- package/src/command/laid.js +31 -0
- package/src/command/left.d.ts +9 -0
- package/src/command/left.js +34 -0
- package/src/command/line.d.ts +7 -0
- package/src/command/line.js +39 -0
- package/src/command/link.d.ts +30 -0
- package/src/command/link.js +123 -0
- package/src/command/lobes.d.ts +1 -0
- package/src/command/lobes.js +10 -0
- package/src/command/locks.d.ts +17 -0
- package/src/command/locks.js +76 -0
- package/src/command/mcp/calls.d.ts +27 -0
- package/src/command/mcp/calls.js +155 -0
- package/src/command/mcp/notices.d.ts +22 -0
- package/src/command/mcp/notices.js +203 -0
- package/src/command/mcp/resources.d.ts +31 -0
- package/src/command/mcp/resources.js +108 -0
- package/src/command/mcp/server.d.ts +19 -0
- package/src/command/mcp/server.js +149 -0
- package/src/command/mcp/tools.d.ts +39 -0
- package/src/command/mcp/tools.js +131 -0
- package/src/command/mcp.d.ts +8 -0
- package/src/command/mcp.js +39 -0
- package/src/command/noticed.d.ts +11 -0
- package/src/command/noticed.js +55 -0
- package/src/command/older.d.ts +11 -0
- package/src/command/older.js +45 -0
- package/src/command/open.d.ts +24 -0
- package/src/command/open.js +107 -0
- package/src/command/passphrase.d.ts +6 -0
- package/src/command/passphrase.js +82 -0
- package/src/command/reclaim.d.ts +7 -0
- package/src/command/reclaim.js +47 -0
- package/src/command/refused.d.ts +4 -0
- package/src/command/refused.js +27 -0
- package/src/command/release.d.ts +27 -0
- package/src/command/release.js +153 -0
- package/src/command/repo.d.ts +31 -0
- package/src/command/repo.js +133 -0
- package/src/command/rewrap.d.ts +16 -0
- package/src/command/rewrap.js +175 -0
- package/src/command/runtime.d.ts +25 -0
- package/src/command/runtime.js +175 -0
- package/src/command/salvage.d.ts +4 -0
- package/src/command/salvage.js +42 -0
- package/src/command/screen.d.ts +14 -0
- package/src/command/screen.js +62 -0
- package/src/command/spawn.d.ts +23 -0
- package/src/command/spawn.js +213 -0
- package/src/command/start.d.ts +34 -0
- package/src/command/start.js +246 -0
- package/src/command/state.d.ts +5 -0
- package/src/command/state.js +39 -0
- package/src/command/token.d.ts +1 -0
- package/src/command/token.js +9 -0
- package/src/command/trial.d.ts +17 -0
- package/src/command/trial.js +92 -0
- package/src/command/vouch.d.ts +1 -0
- package/src/command/vouch.js +15 -0
- package/src/command/windows-processes.d.ts +2 -0
- package/src/command/windows-processes.js +22 -0
- package/src/command/wipe.d.ts +9 -0
- package/src/command/wipe.js +105 -0
- package/src/command/words.d.ts +5 -0
- package/src/command/words.js +53 -0
- package/src/door/claim.d.ts +5 -0
- package/src/door/claim.js +21 -0
- package/src/door/claimed.d.ts +7 -0
- package/src/door/claimed.js +110 -0
- package/src/door/configuration.d.ts +40 -0
- package/src/door/configuration.js +206 -0
- package/src/door/design.d.ts +13 -0
- package/src/door/design.js +71 -0
- package/src/door/digests.d.ts +7 -0
- package/src/door/digests.js +36 -0
- package/src/door/distribution.d.ts +25 -0
- package/src/door/distribution.js +88 -0
- package/src/door/door.d.ts +41 -0
- package/src/door/door.js +219 -0
- package/src/door/dressed.d.ts +34 -0
- package/src/door/dressed.js +182 -0
- package/src/door/faculties.d.ts +29 -0
- package/src/door/faculties.js +88 -0
- package/src/door/longest.d.ts +6 -0
- package/src/door/longest.js +25 -0
- package/src/fills/account-only.d.ts +3 -0
- package/src/fills/account-only.js +24 -0
- package/src/fills/boot-key.d.ts +21 -0
- package/src/fills/boot-key.js +70 -0
- package/src/fills/boot-move.d.ts +25 -0
- package/src/fills/boot-move.js +86 -0
- package/src/fills/bridge.d.ts +13 -0
- package/src/fills/bridge.js +86 -0
- package/src/fills/chance.d.ts +2 -0
- package/src/fills/chance.js +7 -0
- package/src/fills/crypto.d.ts +2 -0
- package/src/fills/crypto.js +94 -0
- package/src/fills/flushed.d.ts +9 -0
- package/src/fills/flushed.js +80 -0
- package/src/fills/hardware.d.ts +18 -0
- package/src/fills/hardware.js +70 -0
- package/src/fills/held.d.ts +31 -0
- package/src/fills/held.js +171 -0
- package/src/fills/keepers.d.ts +23 -0
- package/src/fills/keepers.js +151 -0
- package/src/fills/keyring.d.ts +19 -0
- package/src/fills/keyring.js +131 -0
- package/src/fills/pages.d.ts +3 -0
- package/src/fills/pages.js +260 -0
- package/src/fills/reserve.d.ts +11 -0
- package/src/fills/reserve.js +72 -0
- package/src/fills/time.d.ts +2 -0
- package/src/fills/time.js +29 -0
- package/src/fills/unlocker.d.ts +6 -0
- package/src/fills/unlocker.js +26 -0
- package/src/fills/vitals.d.ts +8 -0
- package/src/fills/vitals.js +100 -0
- package/src/fills/windows-start.d.ts +2 -0
- package/src/fills/windows-start.js +21 -0
- package/src/halves/build.d.ts +10 -0
- package/src/halves/build.js +219 -0
- package/src/halves/end.d.ts +17 -0
- package/src/halves/end.js +157 -0
- package/src/halves/genome.d.ts +3 -0
- package/src/halves/genome.js +21 -0
- package/src/halves/handler.d.ts +8 -0
- package/src/halves/handler.js +40 -0
- package/src/halves/index.d.ts +5 -0
- package/src/halves/index.js +6 -0
- package/src/halves/laid.d.ts +12 -0
- package/src/halves/laid.js +103 -0
- package/src/halves/lent.d.ts +6 -0
- package/src/halves/lent.js +147 -0
- package/src/halves/native.d.ts +12 -0
- package/src/halves/native.js +53 -0
- package/src/halves/statements.d.ts +23 -0
- package/src/halves/statements.js +165 -0
- package/src/halves/tokens.d.ts +22 -0
- package/src/halves/tokens.js +135 -0
- package/src/link/link.d.ts +4 -0
- package/src/link/link.js +4 -0
- package/src/link/placeholder.d.ts +1 -0
- package/src/link/placeholder.js +21 -0
- package/src/link/steps.d.ts +52 -0
- package/src/link/steps.js +118 -0
- package/src/lobes/calls.d.ts +76 -0
- package/src/lobes/calls.js +61 -0
- package/src/lobes/channel.d.ts +76 -0
- package/src/lobes/channel.js +202 -0
- package/src/lobes/index.d.ts +1 -0
- package/src/lobes/index.js +2 -0
- package/src/lobes/lobes.d.ts +15 -0
- package/src/lobes/lobes.js +244 -0
- package/src/lobes/main.js +107 -0
- package/src/lobes/thread.d.ts +22 -0
- package/src/lobes/thread.js +270 -0
- package/src/organism/act.d.ts +8 -0
- package/src/organism/act.js +63 -0
- package/src/organism/beat.d.ts +5 -0
- package/src/organism/beat.js +45 -0
- package/src/organism/compiled.d.ts +2 -0
- package/src/organism/compiled.js +24 -0
- package/src/organism/folder.d.ts +88 -0
- package/src/organism/folder.js +259 -0
- package/src/organism/main.d.ts +1 -0
- package/src/organism/main.js +11 -0
- package/src/organism/organism.d.ts +1 -0
- package/src/organism/organism.js +219 -0
- package/src/organism/said.d.ts +12 -0
- package/src/organism/said.js +30 -0
- package/src/organism/told.d.ts +5 -0
- package/src/organism/told.js +110 -0
- package/src/organism/unlock.d.ts +8 -0
- package/src/organism/unlock.js +95 -0
- package/src/organism/upgrade.d.ts +24 -0
- package/src/organism/upgrade.js +145 -0
- package/src/organism/via.d.ts +7 -0
- package/src/organism/via.js +20 -0
- package/src/service/body.d.ts +8 -0
- package/src/service/body.js +34 -0
- package/src/service/handler.d.ts +20 -0
- package/src/service/handler.js +128 -0
- package/src/service/index.d.ts +4 -0
- package/src/service/index.js +16 -0
- package/src/service/manager.d.ts +18 -0
- package/src/service/manager.js +185 -0
- package/src/service/service.d.ts +24 -0
- package/src/service/service.js +200 -0
- package/src/service/swap.d.ts +12 -0
- package/src/service/swap.js +74 -0
- package/src/service/watchdog.d.ts +6 -0
- package/src/service/watchdog.js +31 -0
- package/src/tcp/crowd.d.ts +18 -0
- package/src/tcp/crowd.js +85 -0
- package/src/tcp/dial.d.ts +23 -0
- package/src/tcp/dial.js +102 -0
- package/src/tcp/frame.d.ts +23 -0
- package/src/tcp/frame.js +159 -0
- package/src/tcp/listen.d.ts +50 -0
- package/src/tcp/listen.js +207 -0
- package/src/tcp/source.d.ts +2 -0
- package/src/tcp/source.js +26 -0
- package/src/version/index.d.ts +1 -0
- package/src/version/index.js +2 -0
- package/src/version/version.d.ts +1 -0
- package/src/version/version.js +2 -0
- package/src/work/first.d.ts +11 -0
- package/src/work/first.js +91 -0
- package/src/work/index.d.ts +2 -0
- package/src/work/index.js +15 -0
- package/src/work/work.d.ts +20 -0
- package/src/work/work.js +136 -0
- package/src/ws/dial.d.ts +7 -0
- package/src/ws/dial.js +252 -0
- package/src/ws/dialing.d.ts +50 -0
- package/src/ws/dialing.js +72 -0
- package/src/ws/frame.d.ts +32 -0
- package/src/ws/frame.js +124 -0
- package/src/ws/handshake.d.ts +4 -0
- package/src/ws/handshake.js +27 -0
- package/src/ws/line.d.ts +45 -0
- package/src/ws/line.js +250 -0
- package/src/ws/listen.d.ts +42 -0
- package/src/ws/listen.js +272 -0
- package/src/ws/rfc6455.d.ts +18 -0
- package/src/ws/rfc6455.js +187 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
3
|
+
|
|
4
|
+
export const listedProcesses = (listing ) =>
|
|
5
|
+
listing.split(/\r?\n/u).flatMap((line) => {
|
|
6
|
+
const read = /^\s*(\d+)\s(.*)$/u.exec(line);
|
|
7
|
+
return read === null ? [] : [[Number(read[1]), (read[2] ?? '').replaceAll('"', '')] ];
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const windowsProcesses = (where = '') =>
|
|
11
|
+
listedProcesses(
|
|
12
|
+
execFileSync(
|
|
13
|
+
'powershell',
|
|
14
|
+
[
|
|
15
|
+
'-NoProfile',
|
|
16
|
+
'-NonInteractive',
|
|
17
|
+
'-Command',
|
|
18
|
+
`Get-CimInstance Win32_Process -Filter "Name='node.exe'${where}" | ForEach-Object { "$($_.ProcessId) $($_.CommandLine)" }`,
|
|
19
|
+
],
|
|
20
|
+
{ encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] },
|
|
21
|
+
),
|
|
22
|
+
);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Work } from '../work/index.js';
|
|
2
|
+
import { type Given, type Outcome } from './given.js';
|
|
3
|
+
export declare const bodyOf: (organism: string, work: Work | undefined) => {
|
|
4
|
+
readonly halves: string;
|
|
5
|
+
readonly lent: string;
|
|
6
|
+
readonly disk: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const wipe: ({ home, asker, print }: Given) => Promise<Outcome>;
|
|
9
|
+
export declare const removedLaid: (...laid: readonly string[]) => void;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
3
|
+
import { existsSync, rmSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { setTimeout as passing } from 'node:timers/promises';
|
|
6
|
+
import { LONGEST_WAIT } from '../door/longest.js';
|
|
7
|
+
import { readFolder } from '../organism/folder.js';
|
|
8
|
+
import { laidService, removeService } from '../service/index.js';
|
|
9
|
+
import { workHalvesOf, } from '../work/index.js';
|
|
10
|
+
import { lockAt, lockPid } from './before.js';
|
|
11
|
+
import { organismOf, } from './given.js';
|
|
12
|
+
import { alive, runningOf, startsOn } from './spawn.js';
|
|
13
|
+
import { stopped } from './start.js';
|
|
14
|
+
|
|
15
|
+
const WORD = 'wipe';
|
|
16
|
+
|
|
17
|
+
export const bodyOf = (
|
|
18
|
+
organism ,
|
|
19
|
+
work ,
|
|
20
|
+
) => ({
|
|
21
|
+
halves: workHalvesOf(organism),
|
|
22
|
+
lent: join(dirname(organism), 'lent'),
|
|
23
|
+
disk: join(work === undefined ? organism : work.home, 'disk'),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const removed = (path ) => {
|
|
27
|
+
try {
|
|
28
|
+
rmSync(path, { recursive: true, force: true });
|
|
29
|
+
return null;
|
|
30
|
+
} catch (failed) {
|
|
31
|
+
return {
|
|
32
|
+
why: `${path} was not removed (${failed instanceof Error ? failed.message : String(failed)}): wipe again`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const ended = async (organism ) => {
|
|
38
|
+
const left = startsOn(organism);
|
|
39
|
+
for (const pid of left)
|
|
40
|
+
try {
|
|
41
|
+
process.kill(pid, 'SIGKILL');
|
|
42
|
+
} catch {
|
|
43
|
+
}
|
|
44
|
+
for (let waited = 0; left.some(alive); waited += 10) {
|
|
45
|
+
if (waited >= LONGEST_WAIT)
|
|
46
|
+
return {
|
|
47
|
+
why: `process ${left.filter(alive).join(', ')}, started on ${organism}, did not end: nothing was wiped`,
|
|
48
|
+
};
|
|
49
|
+
await passing(10);
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const removedDisk = (disk , work ) => {
|
|
55
|
+
if (work === undefined) return removed(disk);
|
|
56
|
+
try {
|
|
57
|
+
execFileSync('sudo', ['-n', '-u', work.account, '--', 'rm', '-rf', '--', disk], {
|
|
58
|
+
stdio: 'ignore',
|
|
59
|
+
});
|
|
60
|
+
return null;
|
|
61
|
+
} catch {
|
|
62
|
+
return { why: `${disk} was not removed as ${work.account}: remove it as root` };
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const wipe = async ({ home, asker, print } ) => {
|
|
67
|
+
const organism = organismOf(home);
|
|
68
|
+
if (!existsSync(organism)) return { why: `no organism stands at ${organism}` };
|
|
69
|
+
const act = lockPid(lockAt(home));
|
|
70
|
+
if (act !== null && alive(act))
|
|
71
|
+
return { why: `an update runs on the organism at ${organism}, as process ${act}: wipe once it ends` };
|
|
72
|
+
const read = readFolder(organism);
|
|
73
|
+
const work = 'laid' in read ? read.laid.work : undefined;
|
|
74
|
+
const body = bodyOf(organism, work);
|
|
75
|
+
const typed = await asker.ask(
|
|
76
|
+
`Wiping destroys the organism at ${organism}, its store and everything it holds, and its body: the halves laid at ${body.halves}, the genome lent at ${body.lent} and the disk's files at ${body.disk}, every repo's bytes among them, for good. Type ${WORD} to go on: `,
|
|
77
|
+
);
|
|
78
|
+
if (typed?.trim() !== WORD) return { why: 'the organism was not wiped' };
|
|
79
|
+
const service = laidService(organism);
|
|
80
|
+
const unlaid = service === null ? null : await removeService(service);
|
|
81
|
+
if (unlaid !== null) return unlaid;
|
|
82
|
+
const running = runningOf(organism);
|
|
83
|
+
const stop = running === null ? null : await stopped(organism, running);
|
|
84
|
+
if (stop !== null) return stop;
|
|
85
|
+
const gone = await ended(organism);
|
|
86
|
+
if (gone !== null) return gone;
|
|
87
|
+
for (const removal of [
|
|
88
|
+
() => removed(body.halves),
|
|
89
|
+
() => removed(body.lent),
|
|
90
|
+
() => removedDisk(body.disk, work),
|
|
91
|
+
() => removed(lockAt(home)),
|
|
92
|
+
() => removed(organism),
|
|
93
|
+
]) {
|
|
94
|
+
const refused = removal();
|
|
95
|
+
if (refused !== null) return refused;
|
|
96
|
+
}
|
|
97
|
+
print(
|
|
98
|
+
`The organism at ${organism} is wiped, with its body${service === null ? '' : `, and its service ${service.file} removed`}.`,
|
|
99
|
+
);
|
|
100
|
+
return null;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const removedLaid = (...laid ) => {
|
|
104
|
+
for (const folder of laid) rmSync(folder, { recursive: true, force: true });
|
|
105
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { dataText, isFields, readText } from '@nervur.org/genome/standard';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const textsInto = (word , texts ) => {
|
|
8
|
+
const read = word === undefined ? { data: {} } : readText(word);
|
|
9
|
+
if ('why' in read) return { why: `the args are no JSON: ${read.why}, in ${word ?? ''}` };
|
|
10
|
+
if (!isFields(read.data)) return { why: '--text adds a field to args that are an object' };
|
|
11
|
+
const fields = { ...read.data };
|
|
12
|
+
for (const one of texts) {
|
|
13
|
+
const at = one.indexOf('=');
|
|
14
|
+
if (at < 1) return { why: `--text is <field>=<file>, not ${one}` };
|
|
15
|
+
const [field, file] = [one.slice(0, at), one.slice(at + 1)];
|
|
16
|
+
if (field in fields) return { why: `--text names ${field}, which the args hold already` };
|
|
17
|
+
try {
|
|
18
|
+
fields[field] = readFileSync(file, 'utf8');
|
|
19
|
+
} catch (thrown) {
|
|
20
|
+
return {
|
|
21
|
+
why: `--text reads no file at ${file}: ${thrown instanceof Error ? thrown.message : String(thrown)}`,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return { word: dataText(fields) };
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const acceptOf = (rest , texts ) => {
|
|
29
|
+
const [one] = texts;
|
|
30
|
+
const at = one === undefined ? -1 : one.indexOf('=');
|
|
31
|
+
const field = one === undefined ? '' : one.slice(0, at);
|
|
32
|
+
if (texts.length !== 1 || at < 1 || (field !== 'invitation' && field !== 'link'))
|
|
33
|
+
return { why: 'accept takes one --text, invitation=<file> or link=<file>' };
|
|
34
|
+
try {
|
|
35
|
+
const given =
|
|
36
|
+
readFileSync(one?.slice(at + 1) ?? '', 'utf8')
|
|
37
|
+
.trim()
|
|
38
|
+
.split('\n')[0]
|
|
39
|
+
?.trim() ?? '';
|
|
40
|
+
return field === 'link' ? ['accept', given, ...rest] : ['accept', rest[0] ?? '', given, ...rest.slice(1)];
|
|
41
|
+
} catch (thrown) {
|
|
42
|
+
return { why: `--text reads no file: ${thrown instanceof Error ? thrown.message : String(thrown)}` };
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const wordsOf = (name , rest , texts ) => {
|
|
47
|
+
if (texts.length === 0) return [name, ...rest];
|
|
48
|
+
if (name === 'accept') return acceptOf(rest, texts);
|
|
49
|
+
if (name !== 'ask' && name !== 'lobe') return { why: '--text is for ask, lobe and accept' };
|
|
50
|
+
if (rest[1] === undefined) return { why: '--text gives args to a method, and a describe takes none' };
|
|
51
|
+
const args = textsInto(rest[2], texts);
|
|
52
|
+
return 'why' in args ? args : [name, rest[0] ?? '', rest[1] ?? '', args.word];
|
|
53
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CLAIM_PATH = "/.nervur/claim";
|
|
2
|
+
export declare const isClaim: (text: string) => boolean;
|
|
3
|
+
export declare const sameText: (a: string, b: string) => boolean;
|
|
4
|
+
export declare const namesClaim: (claim: string | undefined, method: string, authorization: string | undefined) => boolean;
|
|
5
|
+
export declare const claimAnswer: (invitation: string) => string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
|
|
3
|
+
export const CLAIM_PATH = '/.nervur/claim';
|
|
4
|
+
|
|
5
|
+
const TOKEN = /^[A-Za-z0-9\-._~+/]+=*$/u;
|
|
6
|
+
|
|
7
|
+
export const isClaim = (text ) => TOKEN.test(text);
|
|
8
|
+
|
|
9
|
+
export const sameText = (a , b ) => {
|
|
10
|
+
if (a.length !== b.length) return false;
|
|
11
|
+
let differs = 0;
|
|
12
|
+
for (let at = 0; at < a.length; at += 1) differs |= a.charCodeAt(at) ^ b.charCodeAt(at);
|
|
13
|
+
return differs === 0;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const namesClaim = (claim , method , authorization ) => {
|
|
17
|
+
const named = /^Bearer (.+)$/u.exec(authorization ?? '')?.[1];
|
|
18
|
+
return method === 'POST' && claim !== undefined && named !== undefined && sameText(named, claim);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const claimAnswer = (invitation ) => `{"invitation":${invitation}}`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type WebCarrier } from '@nervur.org/genome/seams';
|
|
2
|
+
import { type Data } from '@nervur.org/genome/standard';
|
|
3
|
+
export type ClaimedWeb = {
|
|
4
|
+
readonly web: WebCarrier;
|
|
5
|
+
readonly keep: (invitation: Data) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const claimedWeb: (web: WebCarrier, claim: string, endpoints: readonly string[], warned: (why: string) => void, limit?: number) => ClaimedWeb;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
import {
|
|
3
|
+
NO_REST,
|
|
4
|
+
piecesOf,
|
|
5
|
+
UNHEARD,
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
} from '@nervur.org/genome/seams';
|
|
11
|
+
import { dataText, utf8Bytes, } from '@nervur.org/genome/standard';
|
|
12
|
+
import { CLAIM_PATH, claimAnswer, namesClaim } from './claim.js';
|
|
13
|
+
import { LONGEST_WAIT, ringPast } from './longest.js';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const answered = (
|
|
19
|
+
web ,
|
|
20
|
+
exchange ,
|
|
21
|
+
status ,
|
|
22
|
+
contentType ,
|
|
23
|
+
bytes ,
|
|
24
|
+
) => {
|
|
25
|
+
const { first, rest } = piecesOf(bytes);
|
|
26
|
+
web.respond(exchange, { status, headers: { 'content-type': contentType }, body: first }, rest);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const elsewhereAt =
|
|
35
|
+
(web , genome , endpoint ) =>
|
|
36
|
+
(exchange, request, rest) => {
|
|
37
|
+
const taken = genome.get(endpoint);
|
|
38
|
+
if (taken !== undefined) return taken(exchange, request, rest);
|
|
39
|
+
web.respond(exchange, UNHEARD, NO_REST);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const waiting = (limit ) => {
|
|
43
|
+
const holding = new Set ();
|
|
44
|
+
return {
|
|
45
|
+
hold: (done ) => {
|
|
46
|
+
const stop = ringPast(limit, () => {
|
|
47
|
+
holding.delete(told);
|
|
48
|
+
done(false);
|
|
49
|
+
});
|
|
50
|
+
const told = () => {
|
|
51
|
+
stop();
|
|
52
|
+
holding.delete(told);
|
|
53
|
+
done(true);
|
|
54
|
+
};
|
|
55
|
+
holding.add(told);
|
|
56
|
+
},
|
|
57
|
+
answerAll: () => {
|
|
58
|
+
for (const told of holding) told();
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const claimedWeb = (
|
|
64
|
+
web ,
|
|
65
|
+
claim ,
|
|
66
|
+
endpoints ,
|
|
67
|
+
warned ,
|
|
68
|
+
limit = LONGEST_WAIT,
|
|
69
|
+
) => {
|
|
70
|
+
let kept = null;
|
|
71
|
+
const waits = waiting(limit);
|
|
72
|
+
const genome = new Map ();
|
|
73
|
+
const served = new Map ();
|
|
74
|
+
const told = (exchange ) =>
|
|
75
|
+
answered(web, exchange, 200, 'application/json', utf8Bytes(claimAnswer(kept ?? '')));
|
|
76
|
+
const arrivedAt = (endpoint ) => {
|
|
77
|
+
const elsewhere = elsewhereAt(web, genome, endpoint);
|
|
78
|
+
return (exchange, request, rest) => {
|
|
79
|
+
if (request.path !== CLAIM_PATH || !namesClaim(claim, request.method, request.headers['authorization']))
|
|
80
|
+
return elsewhere(exchange, request, rest);
|
|
81
|
+
if (kept !== null) return told(exchange);
|
|
82
|
+
waits.hold((heard) => (heard ? told(exchange) : elsewhere(exchange, request, rest)));
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const begin = (endpoint ) => {
|
|
86
|
+
const serving = web.serve(endpoint, arrivedAt(endpoint));
|
|
87
|
+
served.set(endpoint, serving);
|
|
88
|
+
return serving;
|
|
89
|
+
};
|
|
90
|
+
for (const endpoint of endpoints)
|
|
91
|
+
void begin(endpoint).then((found) => {
|
|
92
|
+
if ('why' in found) warned(`the claim is answered nowhere at ${endpoint}: ${found.why}`);
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
web: {
|
|
96
|
+
request: (request, rest, wait) => web.request(request, rest, wait),
|
|
97
|
+
respond: (exchange, response, rest) => web.respond(exchange, response, rest),
|
|
98
|
+
serve: async (endpoint, arrived) => {
|
|
99
|
+
genome.set(endpoint, arrived);
|
|
100
|
+
const was = served.get(endpoint);
|
|
101
|
+
const found = was === undefined ? undefined : await was;
|
|
102
|
+
return found === undefined || 'why' in found ? begin(endpoint) : found;
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
keep: (invitation) => {
|
|
106
|
+
kept = dataText(invitation);
|
|
107
|
+
waits.answerAll();
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Configuration, type Given } from '@nervur.org/genome/seams';
|
|
2
|
+
import { type Data } from '@nervur.org/genome/standard';
|
|
3
|
+
import type { Distribution } from './distribution.js';
|
|
4
|
+
import type { Size } from './dressed.js';
|
|
5
|
+
import type { Work } from '../work/index.js';
|
|
6
|
+
export declare const NETWORK = "network";
|
|
7
|
+
export declare const PORT = 9110;
|
|
8
|
+
export type BootMode = 'present' | 'keyring' | 'remote' | 'file' | 'hardware';
|
|
9
|
+
export declare const personSits: (platform: NodeJS.Platform, screen?: boolean) => boolean;
|
|
10
|
+
export declare const sitsAtInstall: (platform: NodeJS.Platform, env: Readonly<Record<string, string | undefined>>, word?: boolean) => boolean;
|
|
11
|
+
export declare const screenLaid: (platform: NodeJS.Platform, env: Readonly<Record<string, string | undefined>>, word?: boolean) => {
|
|
12
|
+
readonly screen?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const bootModeOf: (platform: NodeJS.Platform, screen?: boolean) => BootMode;
|
|
15
|
+
export declare const screenPortOf: (port: number) => number;
|
|
16
|
+
export declare const networkOf: ({ publicHost, work, ws, wss, }: Pick<Chosen, 'publicHost' | 'work' | 'ws' | 'wss'>) => {
|
|
17
|
+
readonly reach: Data;
|
|
18
|
+
readonly half: {
|
|
19
|
+
readonly form: 'native';
|
|
20
|
+
readonly digest: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type Chosen = {
|
|
24
|
+
readonly port: number;
|
|
25
|
+
readonly bootMode: BootMode;
|
|
26
|
+
readonly publicHost?: string;
|
|
27
|
+
readonly ws?: string;
|
|
28
|
+
readonly wss?: string;
|
|
29
|
+
readonly work?: Work;
|
|
30
|
+
readonly witnessEachCommit?: boolean;
|
|
31
|
+
readonly floor?: Distribution;
|
|
32
|
+
readonly design?: Given;
|
|
33
|
+
readonly size?: Size;
|
|
34
|
+
readonly screen?: boolean;
|
|
35
|
+
readonly claim?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const RECOVERY_KEY_DELAY: number;
|
|
38
|
+
export declare const configurationOf: (chosen: Chosen, home: string, platform?: NodeJS.Platform) => Configuration;
|
|
39
|
+
export declare const workApartOf: (configuration: Configuration) => boolean;
|
|
40
|
+
export declare const bodyOf: (configuration: Configuration) => readonly string[];
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
import { userInfo } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { LOBE_MEMORY, queueOf, } from '@nervur.org/genome/seams';
|
|
5
|
+
import { isFields, } from '@nervur.org/genome/standard';
|
|
6
|
+
import { CONSOLE, SCREEN } from '@nervur.org/genome';
|
|
7
|
+
import { DISK } from '../../organs/disk/index.js';
|
|
8
|
+
import { SHELL } from '../../organs/shell/index.js';
|
|
9
|
+
import { socketOf } from '../../organs/console/node/index.js';
|
|
10
|
+
import { shippedOf, skinsOf, WINDOW } from './faculties.js';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import { LONGEST_TIMEOUT } from './longest.js';
|
|
14
|
+
import { nativeHalves } from '../halves/index.js';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export const NETWORK = 'network';
|
|
18
|
+
|
|
19
|
+
export const PORT = 9110;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const sitsByDefault = (platform ) => platform === 'darwin' || platform === 'win32';
|
|
24
|
+
|
|
25
|
+
export const personSits = (platform , screen ) => screen ?? sitsByDefault(platform);
|
|
26
|
+
|
|
27
|
+
const graphical = (env ) =>
|
|
28
|
+
!env['SSH_CONNECTION'] &&
|
|
29
|
+
(Boolean(env['WAYLAND_DISPLAY']) ||
|
|
30
|
+
Boolean(env['DISPLAY']) ||
|
|
31
|
+
['x11', 'wayland'].includes(env['XDG_SESSION_TYPE'] ?? ''));
|
|
32
|
+
|
|
33
|
+
export const sitsAtInstall = (
|
|
34
|
+
platform ,
|
|
35
|
+
env ,
|
|
36
|
+
word ,
|
|
37
|
+
) => word ?? (sitsByDefault(platform) || (platform === 'linux' && graphical(env)));
|
|
38
|
+
|
|
39
|
+
export const screenLaid = (
|
|
40
|
+
platform ,
|
|
41
|
+
env ,
|
|
42
|
+
word ,
|
|
43
|
+
) => {
|
|
44
|
+
const screen = sitsAtInstall(platform, env, word);
|
|
45
|
+
return screen === sitsByDefault(platform) ? {} : { screen };
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const bootModeOf = (platform , screen ) =>
|
|
49
|
+
personSits(platform, screen) ? 'present' : 'file';
|
|
50
|
+
|
|
51
|
+
export const screenPortOf = (port ) => (port === 0 ? 0 : port + 3);
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const installerOrgansOf = (
|
|
60
|
+
home ,
|
|
61
|
+
{ work, port, floor, screen, design, size } ,
|
|
62
|
+
platform ,
|
|
63
|
+
) => {
|
|
64
|
+
const halves = nativeHalves();
|
|
65
|
+
const skins = skinsOf(floor, design);
|
|
66
|
+
const organ = ({ id, blueprint, skin } , reach ) => {
|
|
67
|
+
const digest = halves.get(id)?.digest;
|
|
68
|
+
if (digest === undefined) throw new Error(`Node lays no host half for the organ ${id}`);
|
|
69
|
+
return [
|
|
70
|
+
id,
|
|
71
|
+
{
|
|
72
|
+
blueprint,
|
|
73
|
+
reach,
|
|
74
|
+
half: { form: 'native', digest },
|
|
75
|
+
...(skin === undefined ? {} : { skin }),
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
};
|
|
79
|
+
return Object.fromEntries([
|
|
80
|
+
organ({ ...CONSOLE, skin: skins.console }, { socket: socketOf(home) }),
|
|
81
|
+
...(personSits(platform, screen)
|
|
82
|
+
? [
|
|
83
|
+
organ(
|
|
84
|
+
{ ...SCREEN, skin: skins.screen },
|
|
85
|
+
{ port: screenPortOf(port), ...(size === undefined ? {} : { size }) },
|
|
86
|
+
),
|
|
87
|
+
]
|
|
88
|
+
: []),
|
|
89
|
+
organ(SHELL, { account: work?.account ?? accountName() }),
|
|
90
|
+
organ(
|
|
91
|
+
DISK,
|
|
92
|
+
work === undefined ? { folder: join(home, 'disk') } : { folder: join(work.home, 'disk'), account: work.account },
|
|
93
|
+
),
|
|
94
|
+
]);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const accountName = () => {
|
|
98
|
+
try {
|
|
99
|
+
return userInfo().username;
|
|
100
|
+
} catch {
|
|
101
|
+
return String(process.getuid?.() ?? 'unknown');
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const networkOf = ({
|
|
106
|
+
publicHost,
|
|
107
|
+
work,
|
|
108
|
+
ws,
|
|
109
|
+
wss,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
) => {
|
|
114
|
+
const digest = nativeHalves().get(NETWORK)?.digest;
|
|
115
|
+
if (digest === undefined) throw new Error(`Node lays no host half for the organ ${NETWORK}`);
|
|
116
|
+
return {
|
|
117
|
+
reach: {
|
|
118
|
+
account: work?.account ?? accountName(),
|
|
119
|
+
...(publicHost === undefined ? {} : { public: publicHost }),
|
|
120
|
+
...(ws === undefined ? {} : { ws }),
|
|
121
|
+
...(wss === undefined ? {} : { wss }),
|
|
122
|
+
},
|
|
123
|
+
half: { form: 'native', digest },
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
const presenceOf = (
|
|
149
|
+
{ screen, claim } ,
|
|
150
|
+
platform ,
|
|
151
|
+
) =>
|
|
152
|
+
claim === undefined
|
|
153
|
+
? { presentLobes: personSits(platform, screen) ? [CONSOLE.id, SCREEN.id] : [CONSOLE.id], anchor: CONSOLE.id }
|
|
154
|
+
: {};
|
|
155
|
+
|
|
156
|
+
export const RECOVERY_KEY_DELAY = 7 * 24 * 3_600_000;
|
|
157
|
+
|
|
158
|
+
export const configurationOf = (
|
|
159
|
+
chosen ,
|
|
160
|
+
home ,
|
|
161
|
+
platform = process.platform,
|
|
162
|
+
) => {
|
|
163
|
+
const { port, bootMode, publicHost, ws, witnessEachCommit } = chosen;
|
|
164
|
+
return {
|
|
165
|
+
bootMode: bootMode === 'keyring' ? 'present' : bootMode,
|
|
166
|
+
endpoints: [
|
|
167
|
+
`tcp://${publicHost === undefined ? '127.0.0.1' : '[::]'}:${port}`,
|
|
168
|
+
...(ws === undefined
|
|
169
|
+
? []
|
|
170
|
+
: [
|
|
171
|
+
`ws://${publicHost === undefined || ws.startsWith('wss:') ? '127.0.0.1' : '[::]'}:${port === 0 ? 0 : port + 2}/quo`,
|
|
172
|
+
]),
|
|
173
|
+
],
|
|
174
|
+
web: [`http://${publicHost === undefined ? '127.0.0.1' : '[::]'}:${port === 0 ? 0 : port + 1}`],
|
|
175
|
+
network: networkOf(chosen),
|
|
176
|
+
...queueOf(LOBE_MEMORY),
|
|
177
|
+
longestBudget: 5000,
|
|
178
|
+
longestTimeout: LONGEST_TIMEOUT,
|
|
179
|
+
lobeMemory: LOBE_MEMORY,
|
|
180
|
+
letters: { attempts: 5, span: 3_600_000, ceiling: 1000 },
|
|
181
|
+
removedKeysSpan: 604_800_000,
|
|
182
|
+
recoveryKeyDelay: RECOVERY_KEY_DELAY,
|
|
183
|
+
traced: 256,
|
|
184
|
+
diskSickBelowFull: 1_073_741_824,
|
|
185
|
+
installerOrgans: installerOrgansOf(home, chosen, platform),
|
|
186
|
+
faculties: shippedOf(chosen.floor)
|
|
187
|
+
.filter((one) => one.name !== WINDOW || personSits(platform, chosen.screen))
|
|
188
|
+
.map((one) => one.faculty),
|
|
189
|
+
...presenceOf(chosen, platform),
|
|
190
|
+
...(witnessEachCommit === true ? { witnessEachCommit } : {}),
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const namesAccount = (reach ) => typeof reach === 'object' && reach !== null && 'account' in reach;
|
|
195
|
+
|
|
196
|
+
export const workApartOf = (configuration ) => {
|
|
197
|
+
const reach = configuration.installerOrgans?.[SHELL.id]?.reach;
|
|
198
|
+
return isFields(reach) && typeof reach['account'] === 'string' && reach['account'] !== accountName();
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const bodyOf = (configuration ) => {
|
|
202
|
+
const organs = Object.entries(configuration.installerOrgans ?? {})
|
|
203
|
+
.filter(([, organ]) => namesAccount(organ.reach))
|
|
204
|
+
.map(([id]) => id);
|
|
205
|
+
return [...organs, ...(namesAccount(configuration.network?.reach) ? [NETWORK] : [])].toSorted();
|
|
206
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Given } from '@nervur.org/genome/seams';
|
|
2
|
+
import { type Data } from '@nervur.org/genome/standard';
|
|
3
|
+
import { type Size } from './dressed.js';
|
|
4
|
+
type Why = {
|
|
5
|
+
readonly why: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const designIn: (file: string) => Promise<{
|
|
8
|
+
readonly design?: Given;
|
|
9
|
+
readonly size?: Size;
|
|
10
|
+
} | Why>;
|
|
11
|
+
export declare const designData: ({ faculty, assets, settings }: Given) => Data;
|
|
12
|
+
export declare const designOf: (value: unknown) => Given | null;
|
|
13
|
+
export {};
|