@nervur.org/installer-node 0.37.2 → 0.37.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nervur.org/installer-node",
3
- "version": "0.37.2",
3
+ "version": "0.37.3",
4
4
  "description": "Nervur's installer for Node: the nervur command, the door, the host's organs (console, shell, disk, network) with their blueprints. 0.x, unstable.",
5
5
  "keywords": [
6
6
  "cli",
@@ -36,8 +36,8 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
- "@nervur.org/floor": "0.37.2",
40
- "@nervur.org/genome": "0.37.2"
39
+ "@nervur.org/floor": "0.37.3",
40
+ "@nervur.org/genome": "0.37.3"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=22.23.5"
@@ -1,4 +1,3 @@
1
- import { type Bridging } from './bridge.js';
2
1
  import { type Found, type Taking } from './channel.js';
3
2
  import { type Given, type Outcome } from './given.js';
4
3
  type Why = {
@@ -9,13 +8,14 @@ export type Reaches = {
9
8
  readonly take: (version: string, taking: Taking) => Promise<null | Why>;
10
9
  readonly keep: (home: string) => Promise<null | Why>;
11
10
  readonly moves: (home: string, installer: string) => boolean;
12
- readonly tried: (given: Given, home: string, installer: string, floor: ((given: Given, home: string) => Promise<null | Why>) | null) => Promise<Outcome>;
11
+ readonly tried: (given: Given, home: string, installer: string) => Promise<Outcome>;
13
12
  readonly back: (given: Given, home: string) => Promise<boolean | Why>;
14
13
  readonly handOver: (installer: string, words?: readonly string[]) => Promise<number | Why>;
15
14
  readonly sealed: (given: Given, home: string, genome: string) => Promise<string | Why>;
16
15
  readonly commit: (home: string) => void;
17
16
  readonly left: (home: string) => readonly string[];
18
17
  readonly ran: (home: string) => string | null;
18
+ readonly last: (home: string) => string | null;
19
19
  readonly install: (given: Given) => Promise<Outcome>;
20
20
  readonly account: (print: (line: string) => void) => Promise<{
21
21
  readonly free: () => void;
@@ -25,7 +25,7 @@ export type Reaches = {
25
25
  readonly alive: (pid: number) => boolean;
26
26
  readonly pid: number;
27
27
  readonly parent: number;
28
- } & Bridging;
28
+ };
29
29
  export declare const REAL: Reaches;
30
30
  export declare const act: (given: Given, reaches?: Reaches) => Promise<Outcome>;
31
31
  export {};
@@ -5,7 +5,6 @@ import { socketOf, socketTooLong } from '../../organs/console/node/index.js';
5
5
  import { INSTALLER_VERSION, ranOn, readFolder } from '../organism/folder.js';
6
6
  import { beforeOf, committed, keptOld, wentBack } from './before.js';
7
7
  import { leftIn } from './undone.js';
8
- import { BRIDGING, floorsAside, floored, } from './bridge.js';
9
8
  import { atHand, handedOver, taken, viewed, } from './channel.js';
10
9
  import { accountHeld, locked } from './locks.js';
11
10
  import { designWordOf, floorWordOf } from './choices.js';
@@ -31,13 +30,8 @@ import { moves, tried, TRYING } from './trial.js';
31
30
 
32
31
 
33
32
 
34
-
35
-
36
-
37
-
38
-
39
-
40
-
33
+
34
+
41
35
 
42
36
 
43
37
 
@@ -50,6 +44,8 @@ import { moves, tried, TRYING } from './trial.js';
50
44
 
51
45
 
52
46
 
47
+
48
+
53
49
 
54
50
 
55
51
 
@@ -61,7 +57,7 @@ import { moves, tried, TRYING } from './trial.js';
61
57
 
62
58
 
63
59
 
64
-
60
+
65
61
 
66
62
  const VERSION = /^\d+\.\d+\.\d+$/;
67
63
  const DIGEST = /^[0-9a-f]{64}$/;
@@ -83,18 +79,18 @@ export const REAL = {
83
79
  take: taken,
84
80
  keep: keptOld,
85
81
  moves,
86
- tried: (given, home, installer, floor) => {
82
+ tried: (given, home, installer) => {
87
83
  const folder = readFolder(home);
88
84
  if ('why' in folder) return Promise.resolve(folder);
89
- return tried(given, home, folder.laid, installer, { ...TRYING, floor });
85
+ return tried(given, home, folder.laid, installer, TRYING);
90
86
  },
91
- ...BRIDGING,
92
87
  back: goneBack,
93
88
  handOver: handedOver,
94
89
  sealed: (_given, home, genome) => sealedBack(home, genome),
95
90
  commit: committed,
96
91
  left: leftIn,
97
92
  ran: (home) => (runningOf(home) === null ? null : (ranOn(home) ?? '0.0.0')),
93
+ last: ranOn,
98
94
  install,
99
95
  account: (print) => accountHeld(print),
100
96
  node: () => nodeFinished(),
@@ -111,7 +107,7 @@ const checked = (home , installer , reaches ) =>
111
107
  return null;
112
108
  };
113
109
 
114
- const finished = async (given , reaches , installer , taking ) => {
110
+ const finished = async (given , reaches , installer ) => {
115
111
  const home = organismOf(given.home);
116
112
  if (installer !== INSTALLER_VERSION)
117
113
  return { why: `installer-node ${installer} was asked, and the command that runs carries ${INSTALLER_VERSION}` };
@@ -120,15 +116,14 @@ const finished = async (given , reaches , installer , takin
120
116
  return {
121
117
  why: `installer-node ${installer} is older than ${ran}, which the organism runs: a genome never carries memory backwards`,
122
118
  };
119
+ const last = reaches.last(home);
120
+ if (last !== null && isOlder(last, FLOOR))
121
+ return {
122
+ why: `the organism last ran installer-node ${last}, below ${FLOOR}, the oldest this release carries forward: update it to nervur@${FLOOR} first, then to this release`,
123
+ };
123
124
  const once = { ...given, asker: askedOnce(given.asker) };
124
125
  if (reaches.moves(home, installer)) {
125
- const floors = await floorsAside(once, reaches, home, taking);
126
- if ('why' in floors) return floors;
127
- const floor =
128
- floors.length === 0
129
- ? null
130
- : (asked , at ) => floored(asked, reaches, at, floors);
131
- const trial = await reaches.tried(once, home, installer, floor);
126
+ const trial = await reaches.tried(once, home, installer);
132
127
  if (trial !== null) return trial;
133
128
  }
134
129
  const done = await reaches.install(once);
@@ -213,7 +208,7 @@ const byChannel = async (given , reaches , asked , t
213
208
  if ('why' in found) {
214
209
  if (ran !== null || (asked !== null && asked !== INSTALLER_VERSION)) return found;
215
210
  given.print(`${found.why}: the installer at hand, ${INSTALLER_VERSION}, goes on.`);
216
- return finished(given, reaches, INSTALLER_VERSION, taking);
211
+ return finished(given, reaches, INSTALLER_VERSION);
217
212
  }
218
213
  if (ran !== null && isOlder(found.installer, ran)) {
219
214
  if (asked === null)
@@ -227,7 +222,7 @@ const byChannel = async (given , reaches , asked , t
227
222
  return null;
228
223
  }
229
224
  if (found.installer === INSTALLER_VERSION && taking.digest === undefined)
230
- return finished(given, reaches, found.installer, taking);
225
+ return finished(given, reaches, found.installer);
231
226
  return handedTo(given, reaches, found, taking);
232
227
  };
233
228
 
@@ -246,8 +241,8 @@ export const act = async (given , reaches = REAL)
246
241
  const lock = locked(given.home, reaches);
247
242
  if ('why' in lock) return lock;
248
243
  try {
249
- if (reaches.handed !== null) return await finished(given, reaches, reaches.handed, taking);
250
- if (!channel) return await finished(given, reaches, INSTALLER_VERSION, taking);
244
+ if (reaches.handed !== null) return await finished(given, reaches, reaches.handed);
245
+ if (!channel) return await finished(given, reaches, INSTALLER_VERSION);
251
246
  const account = await reaches.account(given.print);
252
247
  if ('why' in account) return account;
253
248
  try {
@@ -2,11 +2,12 @@
2
2
  import { parseArgs } from 'node:util';
3
3
  import { CIPHERS } from '@nervur.org/genome';
4
4
  import { PORT } from '../door/configuration.js';
5
- import { INSTALLER_VERSION, ownHome, ranOn, wsAddressOf } from '../organism/folder.js';
5
+ import { INSTALLER_VERSION, ranOn, wsAddressOf } from '../organism/folder.js';
6
6
  import { addressAt } from '../tcp/frame.js';
7
7
  import { act } from './act.js';
8
8
  import { claimIn } from './claim.js';
9
9
  import { chainOf } from './chain.js';
10
+ import { homeOf } from './home.js';
10
11
  import { start, stop, } from './commands.js';
11
12
  import { line } from './line.js';
12
13
  import { accept, offer } from './link.js';
@@ -192,6 +193,8 @@ export const readArgs = (argv )
192
193
  if (name === undefined) return { why: '' };
193
194
  const command = COMMANDS.get(name);
194
195
  if (command === undefined) return { why: `no command ${name}` };
196
+ const home = homeOf(values.home);
197
+ if ('why' in home) return home;
195
198
  const choices = choicesOf(values);
196
199
  if ('why' in choices) return choices;
197
200
  if (choices.cipher !== null && name !== 'rekey') return { why: '--cipher is for rekey' };
@@ -207,8 +210,7 @@ export const readArgs = (argv )
207
210
  return {
208
211
  command: command.run,
209
212
  given: {
210
- home: values.home ?? ownHome(),
211
- served: values.home === undefined,
213
+ ...home,
212
214
  ...choices,
213
215
  ...claim,
214
216
  words,
@@ -26,8 +26,6 @@ export declare const keptOld: (home: string, standing?: () => Promise<Standing |
26
26
  export declare const sealing: (home: string) => void;
27
27
  export declare const storeAside: (home: string) => void;
28
28
  export declare const logAside: (home: string) => null | Why;
29
- export declare const storeCopied: (home: string) => null | Why;
30
- export declare const startedBy: (bin: string, words: readonly string[]) => Promise<null | Why>;
31
29
  export declare const committed: (home: string, processes?: Processes) => void;
32
30
  export declare const wentBack: (home: string) => {
33
31
  readonly store: boolean;
@@ -1,15 +1,14 @@
1
1
  // SPDX-License-Identifier: FSL-1.1-ALv2
2
- import { cpSync, existsSync, readdirSync, readFileSync, rmdirSync, rmSync, statfsSync, statSync } from 'node:fs';
3
- import { execFileSync, spawn } from 'node:child_process';
2
+ import { existsSync, readdirSync, readFileSync, rmdirSync, rmSync, statfsSync, statSync } from 'node:fs';
4
3
  import { join } from 'node:path';
5
4
  import { storeOf } from '../door/door.js';
6
- import { foldersLaid, laidWhole, movedWhole, removedWhole, treeFlushed } from '../fills/flushed.js';
5
+ import { foldersLaid, laidWhole, movedWhole, removedWhole } from '../fills/flushed.js';
7
6
  import { halvesOf, laidHalves, pruneHalves } from '../halves/index.js';
8
7
  import { stoppedOf } from '../organism/folder.js';
9
8
  import { workHalvesOf } from '../work/index.js';
10
9
  import { standingCommand } from './channel.js';
11
10
  import { leftOf } from './undone.js';
12
- import { heldBy, madeToHold, reachedBy, releasesPruned, scriptOf, } from './release.js';
11
+ import { heldBy, madeToHold, reachedBy, releasesPruned, } from './release.js';
13
12
  import { alive, HOST_PROCESSES } from './spawn.js';
14
13
 
15
14
 
@@ -129,35 +128,6 @@ const logBack = (home ) => {
129
128
  return true;
130
129
  };
131
130
 
132
- const CLONE = {
133
- darwin: ['-c', '-R', '-p'],
134
- linux: ['-R', '-p', '--reflink=auto'],
135
- };
136
-
137
- export const storeCopied = (home ) => {
138
- const kept = keptStoreOf(home);
139
- const store = storeOf(home);
140
- if (existsSync(store)) return { why: `a store stands at ${store}, where the trial's copy goes` };
141
- const room = roomFor(home, sizeOf(kept));
142
- if (room !== null) return room;
143
- const clone = CLONE[process.platform];
144
- try {
145
- if (clone !== undefined) execFileSync('cp', [...clone, kept, store], { stdio: 'ignore' });
146
- } catch {
147
- rmSync(store, { recursive: true, force: true });
148
- }
149
- try {
150
- if (!existsSync(store)) cpSync(kept, store, { recursive: true, errorOnExist: true, force: false });
151
- } catch (thrown) {
152
- rmSync(store, { recursive: true, force: true });
153
- return {
154
- why: `the store is not copied for the trial: ${thrown instanceof Error ? thrown.message : String(thrown)}`,
155
- };
156
- }
157
- treeFlushed(store);
158
- return null;
159
- };
160
-
161
131
  const letGo = (home ) => {
162
132
  const going = `${beforeOf(home)}.gone`;
163
133
  rmSync(going, { recursive: true, force: true });
@@ -175,19 +145,6 @@ const commandKept = (home )
175
145
  }
176
146
  };
177
147
 
178
- export const startedBy = async (bin , words ) => {
179
- const { NERVUR_HANDED: _handed, ...env } = process.env;
180
- const script = scriptOf(bin);
181
- if (typeof script !== 'string') return script;
182
- const code = await new Promise ((done) => {
183
- const child = spawn(process.execPath, [script, ...words], { stdio: 'inherit', env });
184
- child.on('error', (failed) => done({ why: `its command did not start: ${failed.message}` }));
185
- child.on('close', (ended) => done(ended ?? 1));
186
- });
187
- if (typeof code === 'object') return code;
188
- return code === 0 ? null : { why: `its start ended ${code}` };
189
- };
190
-
191
148
  export const committed = (home , processes = HOST_PROCESSES) => {
192
149
  const command = commandKept(home);
193
150
  letGo(home);
@@ -18,7 +18,6 @@ export type Taking = {
18
18
  readonly package?: string;
19
19
  };
20
20
  export declare const taken: (version: string, taking?: Taking) => Promise<null | Why>;
21
- export declare const takenAside: (version: string, taking?: Taking) => Promise<null | Why>;
22
21
  export declare const atHand: (folder: string) => Found | Why;
23
22
  export declare const standingCommand: () => Promise<Standing | Why>;
24
23
  export declare const commanded: () => Promise<string | Why>;
@@ -148,25 +148,23 @@ const laidBeside = async (
148
148
  spec ,
149
149
  words ,
150
150
  registry = null,
151
- hold = true,
152
151
  ) => {
153
152
  const prefix = await run('npm', ['prefix', '-g']);
154
153
  if (prefix.code !== 0) return { why: 'npm tells no global prefix to lay the package in' };
155
154
  const global = prefix.out.trim();
156
155
  const beside = join(global, STAGED);
157
- if (hold) leftGone(global, HOST_PROCESSES);
158
- else rmSync(beside, { recursive: true, force: true });
156
+ leftGone(global, HOST_PROCESSES);
159
157
  try {
160
158
  const ran = await run('npm', ['install', '-g', '--prefix', beside, ...words], registry);
161
159
  if (ran.code !== 0) return { why: await refusedWhy(spec, ran, registry) };
162
- const node = hold ? await nodeLaid(stagedPackage(beside)) : null;
163
- return node ?? releaseLaid(global, beside, hold);
160
+ const node = await nodeLaid(stagedPackage(beside));
161
+ return node ?? releaseLaid(global, beside);
164
162
  } finally {
165
163
  rmSync(beside, { recursive: true, force: true });
166
164
  }
167
165
  };
168
166
 
169
- const fromChannel = async (version , taking , hold = true) => {
167
+ const fromChannel = async (version , taking ) => {
170
168
  const spec = `nervur@${version}`;
171
169
  const registry = await channel(taking.channel ?? null);
172
170
  const folder = mkdtempSync(join(tmpdir(), 'nervur-'));
@@ -175,7 +173,7 @@ const fromChannel = async (version , taking , hold = true
175
173
  if (typeof file !== 'string') return file;
176
174
  const held = sha256(file);
177
175
  if (taking.digest !== undefined && held !== taking.digest) return refusedDigest(spec, held, taking.digest);
178
- return await laidBeside(spec, [file, ...scoped(registry)], registry, hold);
176
+ return await laidBeside(spec, [file, ...scoped(registry)], registry);
179
177
  } finally {
180
178
  rmSync(folder, { recursive: true, force: true });
181
179
  }
@@ -186,21 +184,18 @@ const packagesIn = (folder ) =>
186
184
  .filter((name) => name.endsWith('.tgz'))
187
185
  .map((name) => join(folder, name));
188
186
 
189
- const fromHand = async (version , taking , folder , hold = true) => {
187
+ const fromHand = async (version , taking , folder ) => {
190
188
  const spec = `nervur@${version}`;
191
189
  const file = join(folder, `nervur-${version}.tgz`);
192
190
  if (!existsSync(file)) return { why: `${folder} holds no ${spec}` };
193
191
  const held = sha256(file);
194
192
  if (taking.digest !== undefined && held !== taking.digest) return refusedDigest(spec, held, taking.digest);
195
- return laidBeside(spec, [...packagesIn(folder)], null, hold);
193
+ return laidBeside(spec, [...packagesIn(folder)], null);
196
194
  };
197
195
 
198
196
  export const taken = (version , taking = {}) =>
199
197
  taking.package === undefined ? fromChannel(version, taking) : fromHand(version, taking, taking.package);
200
198
 
201
- export const takenAside = (version , taking = {}) =>
202
- taking.package === undefined ? fromChannel(version, taking, false) : fromHand(version, taking, taking.package, false);
203
-
204
199
  export const atHand = (folder ) => {
205
200
  const named = readdirSync(folder).flatMap((name) => /^nervur-(\d+\.\d+\.\d+)\.tgz$/.exec(name)?.[1] ?? []);
206
201
  const version = named.toSorted((one, other) => one.localeCompare(other, undefined, { numeric: true })).at(-1);
@@ -13,7 +13,6 @@ import { costOf, homeOpened, recoveryCostOf, networkStarts, workHalvesOf, workOf
13
13
  import { RECOVERY_KEY_DELAY } from '../door/configuration.js';
14
14
  import { chosenOf, wordsOf, } from './choices.js';
15
15
  import { INSTALLER_VERSION, layFolder, ranOn, readFolder, typedFor, } from '../organism/folder.js';
16
- import { keepChannel } from '../organism/via.js';
17
16
  import { removeService, serviceFor, swapSaid, unitsOf } from '../service/index.js';
18
17
  import { laidHalves } from './laid.js';
19
18
  import { floorTaken } from './channel.js';
@@ -237,7 +236,6 @@ export const install = async (given ) => {
237
236
  if ('why' in first) return first;
238
237
  ({ key, laid } = first);
239
238
  }
240
- keepChannel(home, given.package === null && (given.served || given.take) ? { named: given.channel } : false);
241
239
  if (given.served) {
242
240
  const served = await keptAtBoot(given, home, key);
243
241
  if (served !== null) return 'laid' in folder ? served : undone(home, served);
@@ -0,0 +1,8 @@
1
+ type Why = {
2
+ readonly why: string;
3
+ };
4
+ export declare const homeOf: (named: string | undefined) => {
5
+ readonly home: string;
6
+ readonly served: boolean;
7
+ } | Why;
8
+ export {};
@@ -0,0 +1,39 @@
1
+ // SPDX-License-Identifier: FSL-1.1-ALv2
2
+ import { realpathSync } from 'node:fs';
3
+ import { tmpdir } from 'node:os';
4
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
5
+ import { ownHome } from '../organism/folder.js';
6
+
7
+
8
+
9
+ const realOf = (path ) => {
10
+ const whole = resolve(path);
11
+ const unmade = [];
12
+ let at = whole;
13
+ for (;;) {
14
+ try {
15
+ return join(realpathSync.native(at), ...unmade);
16
+ } catch {
17
+ const up = dirname(at);
18
+ if (up === at) return whole;
19
+ unmade.unshift(basename(at));
20
+ at = up;
21
+ }
22
+ }
23
+ };
24
+
25
+ const within = (path , folder ) => {
26
+ const way = relative(folder, path);
27
+ return way !== '' && way !== '..' && !way.startsWith(`..${sep}`) && !isAbsolute(way);
28
+ };
29
+
30
+ export const homeOf = (named ) => {
31
+ const own = ownHome();
32
+ if (named === undefined) return { home: own, served: true };
33
+ const real = realOf(named);
34
+ if (real === realOf(own)) return { home: own, served: true };
35
+ if (within(real, realOf(tmpdir()))) return { home: named, served: false };
36
+ return {
37
+ why: `--home ${named} is refused: an account holds one organism, in ${own}, and a folder of your own is for a test, kept under the temporary folder, ${tmpdir()}. Another organism takes another account.`,
38
+ };
39
+ };
@@ -111,8 +111,9 @@ const USAGE = `nervur <command> [--home <folder>] [--port <port>] [--reserve <by
111
111
  for accept, invitation=<file> or link=<file> in place of the invitation or the link
112
112
  --follow for ask and lobe: a job the answer names waited on to its end, as the organism tells it,
113
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
114
+ --home the folder of your organism, ~/.nervur by default: an account holds one organism, so another
115
+ folder is a test's, refused outside the temporary folder, and an install lays it no service
116
+ and takes no package
116
117
  --port the port the organism listens on, ${PORT} by default
117
118
  --reserve the bytes kept so a full disk still lets the organism answer you, 67108864 by default, 0 for none
118
119
  --boot how the organism gets its boot key at every boot: present, a passphrase
@@ -3,7 +3,6 @@ type Why = {
3
3
  };
4
4
  export declare const STAGED = ".nervur-taking";
5
5
  export declare const commandIn: (prefix: string) => string;
6
- export declare const releasePackage: (bin: string, version: string) => string | null;
7
6
  export type Standing = {
8
7
  readonly bin: string;
9
8
  readonly held: string;
@@ -13,7 +12,6 @@ export declare const heldBy: (bin: string) => string | null;
13
12
  export declare const madeToHold: (bin: string, held: string) => void;
14
13
  export declare const stagedPackage: (staged: string) => string;
15
14
  export declare const releaseLaid: (prefix: string, staged: string, hold?: boolean) => null | Why;
16
- export declare const releaseHeld: (bin: string, version: string) => (() => void) | Why;
17
15
  export declare const reachedBy: (bin: string, held: string) => string | null;
18
16
  export declare const scriptOf: (bin: string) => string | Why;
19
17
  export type Told = readonly [number, readonly string[] | string];
@@ -19,11 +19,6 @@ const prefixOf = (bin ) => (WINDOWS ? dirname(bin) : dirname(dirn
19
19
 
20
20
  const releasesIn = (prefix ) => join(modulesIn(prefix), 'nervur', '.releases');
21
21
 
22
- export const releasePackage = (bin , version ) => {
23
- const release = join(releasesIn(prefixOf(bin)), version);
24
- return existsSync(release) ? join(modulesIn(release), 'nervur') : null;
25
- };
26
-
27
22
 
28
23
 
29
24
  export const heldBy = (bin ) => {
@@ -69,15 +64,6 @@ export const releaseLaid = (prefix , staged , hold = true
69
64
  return null;
70
65
  };
71
66
 
72
- export const releaseHeld = (bin , version ) => {
73
- const release = join(releasesIn(prefixOf(bin)), version);
74
- if (!existsSync(release)) return { why: `the release ${version} is not laid beside the command` };
75
- const before = heldBy(bin);
76
- if (before === null) return { why: `the command's name at ${bin} holds no release` };
77
- madeToHold(bin, heldFor(bin, release));
78
- return () => madeToHold(bin, before);
79
- };
80
-
81
67
  export const reachedBy = (bin , held ) => {
82
68
  if (!WINDOWS) return resolve(dirname(bin), held);
83
69
  const named = /%~?dp0%?\\([^"]+)"/u.exec(held)?.[1];
@@ -8,8 +8,6 @@ export type Trying = {
8
8
  readonly ran: (home: string) => string | null;
9
9
  readonly stop: (home: string) => Promise<null | Why>;
10
10
  readonly log: (home: string) => null | Why;
11
- readonly copy: (home: string) => null | Why;
12
- readonly floor: ((given: Given, home: string) => Promise<null | Why>) | null;
13
11
  readonly start: (home: string, key: Uint8Array | null, moves: (said: Moves) => void) => Promise<null | Why>;
14
12
  };
15
13
  export declare const TRYING: Trying;
@@ -3,17 +3,7 @@ import { existsSync } from 'node:fs';
3
3
  import { storeOf } from '../door/door.js';
4
4
  import { ranOn, } from '../organism/folder.js';
5
5
 
6
- import {
7
- beforeOf,
8
- committed,
9
- halvesBack,
10
- keptAside,
11
- logAside,
12
- storeAside,
13
- storeBack,
14
- storeCopied,
15
- wentBack,
16
- } from './before.js';
6
+ import { beforeOf, committed, halvesBack, keptAside, logAside, storeBack, wentBack } from './before.js';
17
7
 
18
8
  import { laidHalves } from './laid.js';
19
9
  import { runningOf, startOrganism } from './spawn.js';
@@ -34,10 +24,6 @@ const checkOf = (home , installer , reaches ) =
34
24
 
35
25
 
36
26
 
37
-
38
-
39
-
40
-
41
27
 
42
28
 
43
29
 
@@ -51,17 +37,9 @@ export const TRYING = {
51
37
  ran: ranOn,
52
38
  stop: ended,
53
39
  log: logAside,
54
- copy: storeCopied,
55
- floor: null,
56
40
  start: (home, key, moves) => startOrganism(home, 'trial', key, moves),
57
41
  };
58
42
 
59
- const keptFor = async (given , home , reaches ) => {
60
- if (reaches.floor === null) return reaches.log(home);
61
- if (existsSync(storeOf(home))) storeAside(home);
62
- return reaches.copy(home) ?? (await reaches.floor(given, home));
63
- };
64
-
65
43
  export const tried = async (
66
44
  given ,
67
45
  home ,
@@ -88,7 +66,7 @@ export const tried = async (
88
66
  if (halves !== null) return back(halves);
89
67
  const down = await reaches.stop(home);
90
68
  if (down !== null) return back({ why: `the organism did not stop for the trial: ${down.why}` });
91
- const kept = await keptFor(given, home, reaches);
69
+ const kept = reaches.log(home);
92
70
  if (kept !== null) return back(kept);
93
71
  let moves = { moved: [], refused: [] };
94
72
  const started = await reaches.start(home, key, (said) => {
@@ -18,7 +18,7 @@ import { listenAct } from './act.js';
18
18
  import { beginBeat, endBeat } from './beat.js';
19
19
  import { lineOf, STOPPED, } from './said.js';
20
20
  import { keyAtSocket } from './unlock.js';
21
- import { checking, upgradeOf } from './upgrade.js';
21
+ import { upgradeOf } from './upgrade.js';
22
22
  import { actLives, beforeOf, bootOf, floorOf, stayOf, wentBack } from '../command/before.js';
23
23
  import { leftAt, leftOf } from '../command/undone.js';
24
24
  import { prunedBeside } from '../command/laid.js';
@@ -217,4 +217,3 @@ writeFileSync(versionOf(home), `${INSTALLER_VERSION}\n`, { mode: 0o600 });
217
217
  await answering(null);
218
218
  say({ started: true, ...opened.shipped });
219
219
  console.error(`the organism started, ${kind}, process ${process.pid}`);
220
- if (!trial) checking(home);
@@ -1,6 +1,5 @@
1
1
  import type { PureStart } from '@nervur.org/genome/seams';
2
2
  import { commandScript, digestOn, viewed } from '../command/channel.js';
3
- import { channelKept } from './via.js';
4
3
  type Upgrade = NonNullable<PureStart['upgrade']>;
5
4
  export type Reaches = {
6
5
  readonly view: typeof viewed;
@@ -10,15 +9,6 @@ export type Reaches = {
10
9
  };
11
10
  export declare const apartOf: (env: NodeJS.ProcessEnv, program: readonly [string, ...string[]], args: readonly string[], log: string) => readonly [string, ...string[]];
12
11
  export declare const startApart: (env: NodeJS.ProcessEnv, started: readonly [string, ...string[]], args: readonly string[], log: string) => void;
13
- export declare const actWords: (home: string, version: string, digest: string | null, channel: string | null) => readonly string[];
12
+ export declare const actWords: (home: string, version: string, digest: string, channel: string | null) => readonly string[];
14
13
  export declare const upgradeOf: (home: string, reaches?: Reaches) => Upgrade;
15
- export declare const CHECK_EVERY = 3600000;
16
- export type Checks = Pick<Reaches, 'view' | 'command' | 'start'> & {
17
- readonly kept: typeof channelKept;
18
- readonly busy: (home: string) => boolean;
19
- readonly installer: string;
20
- readonly every: (ms: number, run: () => void) => void;
21
- readonly said: (line: string) => void;
22
- };
23
- export declare const checking: (home: string, reaches?: Checks) => void;
24
14
  export {};