@awebai/oats 0.64.0 → 0.66.0

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 (51) hide show
  1. package/README.md +11 -5
  2. package/bin/oats.mjs +109 -11
  3. package/docs/desktop-cli-api.md +88 -5
  4. package/docs/desktop.md +14 -5
  5. package/docs/implementation.md +26 -3
  6. package/docs/integrations.md +1 -1
  7. package/docs/official-catalog.md +2 -2
  8. package/docs/packages.md +7 -7
  9. package/docs/release-notes/v0.65.0.md +187 -0
  10. package/docs/release-notes/v0.66.0.md +183 -0
  11. package/docs/servers.md +2 -2
  12. package/docs/tui.md +548 -249
  13. package/docs/upgrading.md +1 -1
  14. package/docs/workspaces.md +132 -1
  15. package/lib/core.mjs +14 -4
  16. package/lib/deployments.mjs +341 -0
  17. package/lib/resolved-deployment.mjs +37 -0
  18. package/lib/workspace.mjs +2 -0
  19. package/package-catalog.json +2 -2
  20. package/package.json +1 -1
  21. package/packages/client/cli-locator.mjs +2 -2
  22. package/packages/client/deployment-label.mjs +2 -2
  23. package/packages/client/deployment-list-cli.mjs +98 -0
  24. package/packages/client/deployment-list.mjs +91 -0
  25. package/packages/client/keymap.mjs +133 -0
  26. package/packages/client/machine-contract.mjs +1 -5
  27. package/packages/client/own-codes.mjs +2 -0
  28. package/packages/client/panel-views.mjs +1 -1
  29. package/packages/client/workspace-admission.mjs +2 -1
  30. package/packages/record/bin/setup.mjs +10 -2
  31. package/packages/record/docs/capture-service.md +45 -6
  32. package/packages/record/lib/capture-service-install.mjs +6 -95
  33. package/packages/record/lib/capture-setup-write.mjs +233 -0
  34. package/packages/tui/README.md +10 -9
  35. package/packages/tui/lib/actions.mjs +89 -64
  36. package/packages/tui/lib/client.mjs +4 -1
  37. package/packages/tui/lib/config.mjs +184 -36
  38. package/packages/tui/lib/main.mjs +161 -40
  39. package/packages/tui/lib/model.mjs +73 -41
  40. package/packages/tui/lib/read.mjs +15 -45
  41. package/packages/tui/lib/store.mjs +174 -40
  42. package/packages/tui/lib/term/keys.mjs +135 -33
  43. package/packages/tui/lib/term/kitty.mjs +198 -0
  44. package/packages/tui/lib/term/through.mjs +160 -24
  45. package/packages/tui/lib/term/tty.mjs +43 -12
  46. package/packages/tui/lib/views/act.mjs +17 -13
  47. package/packages/tui/lib/views/frame.mjs +418 -421
  48. package/packages/tui/lib/views/help.mjs +90 -29
  49. package/packages/tui/lib/views/instances.mjs +38 -9
  50. package/packages/tui/lib/views/switcher.mjs +65 -21
  51. package/skills/oats-getting-started/SKILL.md +102 -32
@@ -1,15 +1,16 @@
1
1
  // The user's key file, tui.json: which keys do what, whether the screen is drawn in ASCII, and the
2
2
  // key that takes the focus from an agent's terminal back to the list.
3
- // Read once at start and never written. A file that is wrong in any way is refused whole, each
4
- // problem as one line that says what to change: the TUI resolves no conflict and guesses nothing
3
+ // Read once at start, and never written but by its move from where it was before (moved()). A file
4
+ // that is wrong in any way is refused whole, each problem as one line that says what to change:
5
+ // the TUI resolves no conflict and guesses nothing
5
6
  // (there is no "last wins"), because a key that silently does something else is worse than a
6
7
  // program that does not start. The lines go to a terminal, so nothing taken from the file, and
7
8
  // no path, reaches one unless it is plain printable ASCII.
8
- import { closeSync, openSync, readSync, statSync } from "node:fs";
9
+ import { closeSync, fstatSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readSync, renameSync, statSync, unlinkSync, writeSync } from "node:fs";
9
10
  import { homedir } from "node:os";
10
- import { isAbsolute, join } from "node:path";
11
+ import { basename, dirname, isAbsolute, join } from "node:path";
11
12
  import { ACTIONS, bindings, keyLabel } from "./actions.mjs";
12
- import { displayLine } from "./client.mjs";
13
+ import { displayLine, leaderKey } from "./client.mjs";
13
14
  import { isKeyId } from "./term/keys.mjs";
14
15
  import { BACK_KEY_RULE, backKeyId, isBackKey } from "./term/through.mjs";
15
16
 
@@ -19,9 +20,19 @@ export const CONFIG_LIMIT = 64 * 1024;
19
20
  const TOO_LARGE = `it is larger than ${CONFIG_LIMIT / 1024} KiB`;
20
21
  const NOT_AN_OBJECT = 'it is not one JSON object, like {"keys": {"quit": ["q"]}}';
21
22
  const SETTINGS = "the settings are keys, ascii and open";
22
- /** The back key when tui.json names none: the key that takes the focus from an agent's terminal
23
- * back to the list (the setting keeps its name, `open.detachKey`, from when it left a viewer). */
24
- export const DETACH_KEY = "C-\\";
23
+ /** A key id of the shared keymap (`ctrl+\\`, `alt+o`) in the back key's spelling (`C-\\`, `M-o`):
24
+ * Ctrl or Alt and one character, which is what the shared leader is. Anything else: null. */
25
+ function backKeyOf(keyId) {
26
+ const [, mod, rest] = /^(ctrl|alt)\+(.)$/.exec(keyId) ?? [];
27
+ return mod === undefined ? null : `${mod === "ctrl" ? "C" : "M"}-${rest}`;
28
+ }
29
+ /** The back key when tui.json names none, on `platform` (a `process.platform` value): the key that
30
+ * takes the focus from an agent's terminal back to the list, the leader (the setting keeps its
31
+ * name, `open.detachKey`, from when it left a viewer). It is the shared leader, the Desktop's too
32
+ * (packages/client/keymap.mjs leaderKey): `C-\\` on macOS, whose terminals send Option as Meta
33
+ * only when told to; `M-o` (Alt+O) elsewhere. Both are read as keys no action of ACTIONS holds
34
+ * (`ctrl+\\`, `alt+o`), which the check of the leader below keeps true. */
35
+ export const defaultDetachKey = (platform = process.platform) => backKeyOf(leaderKey(platform === "darwin"));
25
36
  /** An action id this program had and has no more, with what it is called now. */
26
37
  const RENAMED = Object.freeze({ "open-workspace": "open" });
27
38
  const KEY_IDS = "key ids look like q, ctrl+c, shift+tab, f5, space";
@@ -33,7 +44,7 @@ const ERROR_CODE = /^[A-Z][A-Z0-9_]{0,30}$/;
33
44
  export const MAX_PROBLEMS = 20;
34
45
 
35
46
  const plain = (name) => typeof name === "string" && PLAIN_NAME.test(name);
36
- /** Whether the footer and the help can name a key: its label is drawn as text from outside (the
47
+ /** Whether the cheat sheet and the help can name a key: its label is drawn as text from outside (the
37
48
  * shared display filter), and a label that filter would change would name another key, or none.
38
49
  * Such a key (a bidi override, a combining mark on a space) is refused here, with the file named,
39
50
  * where a key the views cannot draw would otherwise be bound and never said. */
@@ -42,16 +53,27 @@ const isObject = (value) => value !== null && typeof value === "object" && !Arra
42
53
  /** Never the text of an error, which may hold anything: its code, when that is a plain one. */
43
54
  const unreadable = (error) => { const code = error?.code; return `it cannot be read${typeof code === "string" && ERROR_CODE.test(code) ? ` (${code})` : ""}`; };
44
55
 
45
- /** The path of tui.json: `$XDG_CONFIG_HOME/oats/tui.json` when that variable is set, not empty
46
- * and absolute (the XDG rule: a relative value is ignored), else `<home>/.config/oats/tui.json`. */
56
+ /** The path of tui.json: `config/tui.json` in OATS's own directory of this user, `$OATS_HOME_DIR`
57
+ * when that is set and not empty, else `<home>/.oats` (the kernel's rule for its files, as
58
+ * lib/deployments.mjs has it for this computer's list of deployments). */
47
59
  export function configPath(env, home) {
60
+ const own = env?.OATS_HOME_DIR;
61
+ return join(typeof own === "string" && own !== "" ? own : join(home, ".oats"), "config", "tui.json");
62
+ }
63
+ /** Where tui.json was before awebai/oats#1390 step (b), and is looked for only to move it
64
+ * (moved()): `$XDG_CONFIG_HOME/oats/tui.json` when that variable is set, not empty and absolute
65
+ * (the XDG rule: a relative value is ignored), else `<home>/.config/oats/tui.json`. */
66
+ export function oldConfigPath(env, home) {
48
67
  const xdg = env?.XDG_CONFIG_HOME;
49
68
  return join(typeof xdg === "string" && xdg !== "" && isAbsolute(xdg) ? xdg : join(home, ".config"), "oats", "tui.json");
50
69
  }
70
+ /** What the old file is renamed to once it is copied: beside it, so it is never lost. */
71
+ export const MIGRATED = "tui.json.migrated";
51
72
 
52
- /** What tui.json says, checked: `value` is the file already parsed, `defaults` the action table.
53
- * Pure. Answers `{ ok: true, actions, ascii, detachKey }` or `{ ok: false, problems }`:
54
- * `detachKey` is `open.detachKey`, or DETACH_KEY when the file names none.
73
+ /** What tui.json says, checked: `value` is the file already parsed, `defaults` the action table,
74
+ * `platform` the one the TUI runs on (a `process.platform` value). Pure. Answers
75
+ * `{ ok: true, actions, ascii, detachKey }` or `{ ok: false, problems }`: `detachKey` is
76
+ * `open.detachKey`, or defaultDetachKey(platform) when the file names none.
55
77
  *
56
78
  * `actions` is a frozen table shaped exactly like `defaults` (same order, ids and labels, frozen
57
79
  * rows with frozen `keys`) in which the list of each action the file names REPLACES that action's
@@ -63,7 +85,7 @@ export function configPath(env, home) {
63
85
  * order. A key given to two actions is judged with the kept defaults included and names both. An
64
86
  * action whose list is refused takes no part in that judgement: what it was meant to hold is not
65
87
  * known. The ids of `defaults` are the program's own; one that is not plain is still never echoed. */
66
- export function effectiveConfig(value, defaults = ACTIONS) {
88
+ export function effectiveConfig(value, defaults = ACTIONS, platform = process.platform) {
67
89
  if (!isObject(value)) return { ok: false, problems: [NOT_AN_OBJECT] };
68
90
  for (const [setting, given] of Object.entries(value)) {
69
91
  if (setting === "keys") { if (!isObject(given)) return { ok: false, problems: ['keys must be an object, like {"quit": ["q"]}'] }; }
@@ -106,9 +128,11 @@ export function effectiveConfig(value, defaults = ACTIONS) {
106
128
  }
107
129
  // The leader is read as a key wherever the TUI reads keys (docs/tui.md, "The leader"), so no
108
130
  // action may hold the key it reads as: `C-l` would be redraw's Ctrl+L, `C-j` open's Enter.
109
- const detachKey = value.open?.detachKey ?? DETACH_KEY, leader = backKeyId(detachKey);
131
+ const detachKey = value.open?.detachKey ?? defaultDetachKey(platform), leader = backKeyId(detachKey);
110
132
  const taken = defaults.find((action) => (named.get(action.id) ?? action.keys).includes(leader));
111
- if (taken) problems.push(`open.detachKey ${detachKey} is read as ${keyLabel(leader)}, the key of ${say(taken.id)}; give the leader a key no action has, or give ${say(taken.id)} another`);
133
+ // A file that names no leader is told it is the default, which it did not write.
134
+ const which = value.open?.detachKey === undefined ? `the default leader ${detachKey}` : `open.detachKey ${detachKey}`;
135
+ if (taken) problems.push(`${which} is read as ${keyLabel(leader)}, the key of ${say(taken.id)}; give the leader a key no action has, or give ${say(taken.id)} another`);
112
136
  if (problems.length > 0) return { ok: false, problems };
113
137
 
114
138
  const actions = Object.freeze(defaults.map((action) => Object.freeze({ ...action, keys: Object.freeze([...(named.get(action.id) ?? action.keys)]) })));
@@ -131,9 +155,36 @@ function openProblem(given) {
131
155
 
132
156
  /** The file system as loadConfig needs it. `stat` follows symbolic links and answers null for a
133
157
  * path that does not exist, which includes a path under something that is not a directory (an
134
- * XDG_CONFIG_HOME of /dev/null); every other failure is thrown. `read` never takes in more than
135
- * the limit and one byte, whatever the file became since it was measured. */
158
+ * OATS_HOME_DIR of /dev/null); every other failure is thrown. `read` never takes in more than
159
+ * the limit and one byte, whatever the file became since it was measured, and `bytes` the same as
160
+ * bytes. For the move (moved()): `entry` answers `{ ino }` when an entry is at the path, a link
161
+ * not followed (a link to nothing is an entry), or null; `place` writes `bytes` as a new file at
162
+ * `path`, never over one: a file of its own first (mode 0600, synced), in the directory it makes
163
+ * with mode 0700 when it is missing, then linked there. It answers that file's `{ ino }`, with
164
+ * `taken: true` when an entry was at `path` already and nothing was placed; every failure is
165
+ * thrown, marked `noLinks` when the file system has no hard links. `rename` and `remove` are rename(2) and unlink(2), which act on a link itself. */
136
166
  const NODE_IO = Object.freeze({
167
+ entry: entryAt,
168
+ bytes(path) { return readCapped(path); },
169
+ place(bytes, to) {
170
+ mkdirSync(dirname(to), { recursive: true, mode: 0o700 });
171
+ const own = join(dirname(to), `.${basename(to)}.${process.pid}.${Date.now()}.tmp`);
172
+ const ino = written(own, bytes);
173
+ try {
174
+ linkSync(own, to);
175
+ return { ino };
176
+ } catch (error) {
177
+ if (error?.code === "EEXIST") return { ino, taken: true };
178
+ // A file system without hard links has no step that is both whole and never over a file
179
+ // (there is no rename that refuses one): the move is refused, nothing placed.
180
+ if (NO_LINKS.has(error?.code)) error.noLinks = true;
181
+ throw error;
182
+ } finally {
183
+ try { unlinkSync(own); } catch { /* its own file, in a directory it could write */ }
184
+ }
185
+ },
186
+ rename(from, to) { renameSync(from, to); },
187
+ remove(path) { unlinkSync(path); },
137
188
  stat(path) {
138
189
  try {
139
190
  const found = statSync(path);
@@ -143,39 +194,136 @@ const NODE_IO = Object.freeze({
143
194
  throw error;
144
195
  }
145
196
  },
146
- read(path) {
147
- const fd = openSync(path, "r");
148
- try {
149
- const bytes = Buffer.alloc(CONFIG_LIMIT + 1);
150
- let length = 0, got = 0;
151
- while (length < bytes.length && (got = readSync(fd, bytes, length, bytes.length - length, null)) > 0) length += got;
152
- if (length > CONFIG_LIMIT) throw Object.assign(new Error("tui.json grew past the limit while it was read"), { code: "EFBIG" });
153
- return bytes.toString("utf8", 0, length);
154
- } finally { closeSync(fd); }
155
- },
197
+ read(path) { return readCapped(path).toString("utf8"); },
156
198
  });
199
+ /** What link(2) answers on a file system without hard links (FAT, exFAT, some network mounts). */
200
+ const NO_LINKS = new Set(["EPERM", "ENOTSUP", "EOPNOTSUPP", "ENOSYS"]);
201
+ /** `bytes` as a new file at `path`, made only where nothing is (mode 0600) and synced; answers its
202
+ * inode. A file it made and could not finish is removed. */
203
+ function written(path, bytes) {
204
+ const fd = openSync(path, "wx", 0o600);
205
+ let ino;
206
+ try {
207
+ for (let at = 0; at < bytes.length;) at += writeSync(fd, bytes, at, bytes.length - at);
208
+ fsyncSync(fd);
209
+ ino = fstatSync(fd).ino;
210
+ } catch (error) {
211
+ closeSync(fd);
212
+ try { unlinkSync(path); } catch { /* the error thrown says what failed */ }
213
+ throw error;
214
+ }
215
+ closeSync(fd);
216
+ return ino;
217
+ }
218
+ /** `{ ino }` of the entry at `path`, a link not followed, or null when there is none. */
219
+ function entryAt(path) {
220
+ try { return { ino: lstatSync(path).ino }; } catch (error) {
221
+ if (error?.code === "ENOENT" || error?.code === "ENOTDIR") return null;
222
+ throw error;
223
+ }
224
+ }
225
+ /** At most CONFIG_LIMIT bytes of a file, whatever it became since it was measured. */
226
+ function readCapped(path) {
227
+ const fd = openSync(path, "r");
228
+ try {
229
+ const bytes = Buffer.alloc(CONFIG_LIMIT + 1);
230
+ let length = 0, got = 0;
231
+ while (length < bytes.length && (got = readSync(fd, bytes, length, bytes.length - length, null)) > 0) length += got;
232
+ if (length > CONFIG_LIMIT) throw Object.assign(new Error("tui.json grew past the limit while it was read"), { code: "EFBIG" });
233
+ return bytes.subarray(0, length);
234
+ } finally { closeSync(fd); }
235
+ }
236
+
237
+ /** A path for a line: as it is when it is printable ASCII of at most 200 characters, else `named`. */
238
+ const shownPath = (path, named) => (PLAIN_PATH.test(path) ? path : named);
239
+ /** Why a step of the move failed, for its line: never the text of an error, only its code. */
240
+ const failedBy = (error) => { const code = error?.code; return typeof code === "string" && ERROR_CODE.test(code) ? code : "it failed"; };
241
+
242
+ /** THE MOVE OF tui.json (docs/tui.md, "Change the keys: tui.json"; awebai/oats#1390 §3), before
243
+ * it is read: the file the old rule found (`old`, oldConfigPath) and the one read now (`path`).
244
+ * old present, new absent its bytes are copied to the new path (placed: never over a file),
245
+ * then the old file is renamed to tui.json.migrated beside it (a link
246
+ * is renamed, not followed); then the new file is read. A copy that
247
+ * cannot be made, or a rename that fails, refuses with the line that
248
+ * says to move it by hand, the copy deleted first when it was made.
249
+ * both present refused: the old file is no longer read, and nothing is chosen.
250
+ * old absent nothing to move: the new file is read, or the defaults are used.
251
+ * "Present" is an entry at the path, a link to nothing included: it is reported, not guessed at.
252
+ * Answers null when the new file is to be read, else the line that refuses. A run that loses a
253
+ * race to another one starting (a new file placed by it after this run looked) asks the table
254
+ * again (again()): it reads the file that run placed once that run has moved the old file, and
255
+ * refuses as for both while an old file is still there, its own or the other's not yet renamed. */
256
+ function moved(old, path, io) {
257
+ const from = shownPath(old, "its old configuration file"), to = shownPath(path, "its configuration file");
258
+ const cannot = (reason) => `oats: \`oats tui\` cannot move ${from} to ${to} (${reason}); move it yourself (E_TUI_CONFIG)`;
259
+ const both = `oats: \`oats tui\`: ${from} is no longer read: the TUI reads ${to}. Copy what you need into ${to}, then remove ${from} (E_TUI_CONFIG)`;
260
+ // A step that fails because another run placed a new file since this one looked (the old file
261
+ // renamed, its backup made, the new path taken) asks the table again: a new file and no old one
262
+ // is that run's move, read; a new file beside this run's old one (another XDG_CONFIG_HOME's
263
+ // move) is both, refused; no new file is this step's failure.
264
+ const again = (reason) => {
265
+ try {
266
+ if (io.entry(path) === null) return cannot(reason);
267
+ return io.entry(old) === null ? null : both;
268
+ } catch { return cannot(reason); }
269
+ };
270
+ let had, has;
271
+ try { had = io.entry(old); } catch (error) { return cannot(failedBy(error)); }
272
+ if (had === null) return null;
273
+ try { has = io.entry(path); } catch (error) { return cannot(failedBy(error)); }
274
+ if (has !== null) return both;
275
+ const aside = join(dirname(old), MIGRATED);
276
+ let found, bytes, placed;
277
+ try {
278
+ // A backup of an earlier move is never written over.
279
+ if (io.entry(aside) !== null) return again(`${MIGRATED} is there already`);
280
+ found = io.stat(old);
281
+ } catch (error) { return again(failedBy(error)); }
282
+ if (found === null) return again("it is a link to nothing");
283
+ if (found.file !== true) return cannot("it is not a regular file");
284
+ if (!(typeof found.size === "number" && found.size <= CONFIG_LIMIT)) return cannot(TOO_LARGE);
285
+ try { bytes = io.bytes(old); } catch (error) { return error?.code === "EFBIG" ? cannot(TOO_LARGE) : again(failedBy(error)); }
286
+ try { placed = io.place(bytes, path); } catch (error) { return cannot(error?.noLinks === true ? "this file system has no hard links" : failedBy(error)); }
287
+ // Only an entry found at the new path itself is another run's file; an EEXIST thrown on the way
288
+ // (a `config` that is a file) is a failure like any other.
289
+ if (placed.taken === true) return again("EEXIST");
290
+ try { io.rename(old, aside); } catch (error) {
291
+ // The old file gone and a new one there (moved meanwhile by something else): the copy is the
292
+ // old file's bytes, and it is read; nothing is deleted.
293
+ try { if (io.entry(old) === null && io.entry(path) !== null) return null; } catch { /* refused below */ }
294
+ // The copy is deleted only while it is still the one this run made.
295
+ try { if (io.entry(path)?.ino === placed.ino) io.remove(path); } catch { /* the line says to move it by hand */ }
296
+ return cannot(failedBy(error));
297
+ }
298
+ return null;
299
+ }
157
300
 
158
- /** Read tui.json, once. Answers `{ ok: true, actions, ascii, detachKey, path }`, or
301
+ /** Read tui.json, once, after its move from where it was before (moved()). Answers
302
+ * `{ ok: true, actions, ascii, detachKey, path }`, or
159
303
  * `{ ok: false, lines }`: the complete lines to print (no trailing newline), after which the TUI
160
304
  * must not start. No file is the defaults: `actions` is ACTIONS itself, `ascii` is false and
161
- * `detachKey` is DETACH_KEY.
305
+ * `detachKey` is defaultDetachKey(platform); `platform` is the one the TUI runs on (a
306
+ * `process.platform` value, given so the answer is known for each).
162
307
  *
163
308
  * `io` is the file system (node:fs when omitted): `io.stat(path)` answers `{ file, size }` after
164
309
  * following symbolic links, or null when the path does not exist, and throws for anything else;
165
- * `io.read(path)` answers the text. The size is checked before `read` is called, so a file over
166
- * CONFIG_LIMIT, a directory or a FIFO is never opened. A line holds the path only when it is
310
+ * `io.read(path)` answers the text; the move uses `entry`, `bytes`, `place`, `rename` and `remove`
311
+ * (see NODE_IO). The size is checked before `read` or `bytes` is called, so a file over
312
+ * CONFIG_LIMIT, a directory or a FIFO is never opened. A line holds a path only when it is
167
313
  * printable ASCII, and never the text of an error: only its code, when it is a plain one. */
168
- export function loadConfig({ env = process.env, home = homedir(), io = NODE_IO } = {}) {
314
+ export function loadConfig({ env = process.env, home = homedir(), io = NODE_IO, platform = process.platform } = {}) {
169
315
  const path = configPath(env, home);
316
+ const refusal = moved(oldConfigPath(env, home), path, io);
317
+ if (refusal !== null) return { ok: false, lines: [refusal] };
170
318
  const listed = (problems) => (problems.length > MAX_PROBLEMS ? [...problems.slice(0, MAX_PROBLEMS), problems.length - MAX_PROBLEMS === 1 ? "1 more problem is not listed" : `${problems.length - MAX_PROBLEMS} more problems are not listed`] : problems);
171
319
  const refused = (problems) => ({ ok: false, lines: listed(problems).map((problem) => `oats: \`oats tui\` cannot use ${PLAIN_PATH.test(path) ? path : "its configuration file"}: ${problem} (E_TUI_CONFIG)`) });
172
320
  let found, text, value;
173
321
  try { found = io.stat(path); } catch (error) { return refused([unreadable(error)]); }
174
- if (found === null) return { ok: true, actions: ACTIONS, ascii: false, detachKey: DETACH_KEY, path };
322
+ if (found === null) return { ok: true, actions: ACTIONS, ascii: false, detachKey: defaultDetachKey(platform), path };
175
323
  if (found.file !== true) return refused(["it is not a regular file"]);
176
324
  if (!(typeof found.size === "number" && found.size <= CONFIG_LIMIT)) return refused([TOO_LARGE]); // read only what is known to fit
177
325
  try { text = io.read(path); } catch (error) { return refused([error?.code === "EFBIG" ? TOO_LARGE : unreadable(error)]); }
178
326
  try { value = JSON.parse(text); } catch { return refused(["it is not valid JSON"]); }
179
- const checked = effectiveConfig(value);
327
+ const checked = effectiveConfig(value, ACTIONS, platform);
180
328
  return checked.ok ? { ...checked, path } : refused(checked.problems);
181
329
  }