@mago-foundation/mago-ski 0.4.0 → 0.5.0-beta.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.
Files changed (59) hide show
  1. package/README.md +5 -3
  2. package/action.yml +21 -2
  3. package/dist/hosts/github/check.d.ts +21 -0
  4. package/dist/hosts/github/check.js +124 -0
  5. package/dist/hosts/github/publish.d.ts +7 -0
  6. package/dist/hosts/github/publish.js +52 -0
  7. package/dist/hosts/github/run.d.ts +12 -0
  8. package/dist/hosts/github/run.js +32 -18
  9. package/dist/hosts/pi/index.js +40 -18
  10. package/dist/src/admin.d.ts +2 -1
  11. package/dist/src/admin.js +3 -2
  12. package/dist/src/admission-evidence.d.ts +15 -0
  13. package/dist/src/admission-evidence.js +48 -0
  14. package/dist/src/admission.d.ts +102 -0
  15. package/dist/src/admission.js +316 -0
  16. package/dist/src/canonical-json.d.ts +6 -0
  17. package/dist/src/canonical-json.js +11 -0
  18. package/dist/src/cli.d.ts +2 -0
  19. package/dist/src/cli.js +229 -5
  20. package/dist/src/diff.d.ts +9 -0
  21. package/dist/src/diff.js +3 -2
  22. package/dist/src/dsse.js +2 -2
  23. package/dist/src/experimental/sigstore.d.ts +30 -0
  24. package/dist/src/experimental/sigstore.js +35 -5
  25. package/dist/src/fs-safe.d.ts +15 -2
  26. package/dist/src/fs-safe.js +68 -50
  27. package/dist/src/gate/adapters/claude-code.js +8 -5
  28. package/dist/src/gate/adapters/codex.js +5 -6
  29. package/dist/src/gate/generations.js +2 -0
  30. package/dist/src/gate/instance.js +7 -7
  31. package/dist/src/gate/proc.d.ts +6 -0
  32. package/dist/src/gate/proc.js +14 -3
  33. package/dist/src/gate/service.js +3 -0
  34. package/dist/src/gate/setup.d.ts +5 -5
  35. package/dist/src/gate/setup.js +128 -88
  36. package/dist/src/policy.d.ts +7 -0
  37. package/dist/src/policy.js +19 -2
  38. package/dist/src/profile.d.ts +34 -0
  39. package/dist/src/profile.js +182 -0
  40. package/dist/src/published-by.d.ts +64 -0
  41. package/dist/src/published-by.js +227 -0
  42. package/dist/src/recovery-admin.js +7 -4
  43. package/dist/src/root-events.d.ts +2 -0
  44. package/dist/src/root-events.js +61 -4
  45. package/dist/src/tree-digest.d.ts +6 -0
  46. package/dist/src/tree-digest.js +8 -0
  47. package/dist/src/usf-check.d.ts +28 -0
  48. package/dist/src/usf-check.js +128 -0
  49. package/dist/src/usf.d.ts +48 -0
  50. package/dist/src/usf.js +238 -0
  51. package/docs/hosts/publish.md +65 -0
  52. package/docs/hosts/skill-check.md +91 -0
  53. package/docs/spec/admission-v0.md +84 -0
  54. package/docs/spec/gui-admin-rack-v1.md +1 -1
  55. package/docs/spec/observed-profile-v1.md +51 -0
  56. package/docs/spec/root-recovery-v1.md +3 -2
  57. package/docs/spec/trust-documents-v1.md +1 -1
  58. package/docs/threat-model.md +12 -0
  59. package/package.json +5 -1
@@ -3,13 +3,28 @@ import { constants as fsConstants } from 'node:fs';
3
3
  import { lstat, open, realpath, rename, unlink } from 'node:fs/promises';
4
4
  import path from 'node:path';
5
5
  const noFollow = fsConstants.O_NOFOLLOW ?? 0;
6
- // Never block in open(2) on a FIFO swapped in after the lstat check; the fstat below then rejects it.
6
+ // Never block in open(2) on a FIFO; O_NONBLOCK lets open return (or fail with ENXIO) and fstat rejects non-regular files.
7
7
  const nonBlock = fsConstants.O_NONBLOCK ?? 0;
8
8
  const DEFAULT_MAX_READ_BYTES = 1024 * 1024;
9
9
  const READ_CHUNK_BYTES = 64 * 1024;
10
10
  const DEFAULT_FILE_MODE = 0o644;
11
11
  const DEFAULT_LOG_MODE = 0o600;
12
12
  const TEMP_RANDOM_BYTES = 6;
13
+ function isNonRegularOpenError(error) {
14
+ const code = error?.code;
15
+ return code === 'ELOOP' || code === 'EISDIR' || code === 'ENXIO' || code === 'EOPNOTSUPP';
16
+ }
17
+ async function openRegularHandle(filePath, flags, notRegularMessage, mode) {
18
+ try {
19
+ return mode === undefined ? await open(filePath, flags) : await open(filePath, flags, mode);
20
+ }
21
+ catch (error) {
22
+ if (isNonRegularOpenError(error)) {
23
+ throw new Error(notRegularMessage);
24
+ }
25
+ throw error;
26
+ }
27
+ }
13
28
  function sameFileIdentity(left, right) {
14
29
  return left.dev === right.dev && left.ino === right.ino;
15
30
  }
@@ -26,50 +41,64 @@ export function isInside(root, candidate) {
26
41
  return (relative === '' ||
27
42
  (relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative)));
28
43
  }
29
- /**
30
- * Reads a regular, non-symlink file, failing if it changes while being read.
31
- * The type and size are checked before any content is read, and at most `maxBytes` (+1 to detect growth) are read.
32
- */
33
- export async function readRegularFile(filePath, label, maxBytes = DEFAULT_MAX_READ_BYTES) {
44
+ async function readRegularHandle(handle, before, label, maxBytes) {
45
+ if (before.size > BigInt(maxBytes))
46
+ throw new Error(`${label} exceeds the ${maxBytes}-byte limit`);
47
+ const chunks = [];
48
+ let total = 0;
49
+ while (total <= maxBytes) {
50
+ const remaining = maxBytes + 1 - total;
51
+ const chunk = Buffer.allocUnsafe(Math.min(READ_CHUNK_BYTES, remaining));
52
+ const { bytesRead } = await handle.read(chunk, 0, chunk.length, null);
53
+ if (bytesRead === 0)
54
+ break;
55
+ total += bytesRead;
56
+ chunks.push(chunk.subarray(0, bytesRead));
57
+ }
58
+ const after = await handle.stat({ bigint: true });
59
+ if (total > maxBytes || !sameFileVersion(before, after) || BigInt(total) !== after.size)
60
+ throw new Error(`${label} changed while being read or exceeds its size limit`);
61
+ return Buffer.concat(chunks, total);
62
+ }
63
+ async function openAndReadRegularFile(filePath, label, maxBytes, notRegularMessage, validateStat) {
34
64
  if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {
35
65
  throw new Error(`Invalid maxBytes limit for ${label}`);
36
66
  }
37
- const maxLimit = BigInt(maxBytes);
38
- const entry = await lstat(filePath, { bigint: true });
39
- if (entry.isSymbolicLink() || !entry.isFile()) {
40
- throw new Error(`${label} must be a regular, non-symlink file`);
41
- }
42
- if (entry.size > maxLimit) {
43
- throw new Error(`${label} exceeds the ${maxBytes}-byte limit`);
44
- }
45
- let handle;
67
+ const handle = await openRegularHandle(filePath, fsConstants.O_RDONLY | noFollow | nonBlock, notRegularMessage);
46
68
  try {
47
- handle = await open(filePath, fsConstants.O_RDONLY | noFollow | nonBlock);
48
69
  const before = await handle.stat({ bigint: true });
49
- if (!before.isFile() || !sameFileIdentity(entry, before))
50
- throw new Error(`${label} changed while being read`);
51
- if (before.size > maxLimit)
52
- throw new Error(`${label} exceeds the ${maxBytes}-byte limit`);
53
- const chunks = [];
54
- let total = 0;
55
- while (total <= maxBytes) {
56
- const remaining = maxBytes + 1 - total;
57
- const chunk = Buffer.allocUnsafe(Math.min(READ_CHUNK_BYTES, remaining));
58
- const { bytesRead } = await handle.read(chunk, 0, chunk.length, null);
59
- if (bytesRead === 0)
60
- break;
61
- total += bytesRead;
62
- chunks.push(chunk.subarray(0, bytesRead));
63
- }
64
- const after = await handle.stat({ bigint: true });
65
- if (total > maxBytes || !sameFileVersion(before, after) || BigInt(total) !== after.size)
66
- throw new Error(`${label} changed while being read or exceeds its size limit`);
67
- return Buffer.concat(chunks, total);
70
+ if (!before.isFile())
71
+ throw new Error(notRegularMessage);
72
+ validateStat?.(before);
73
+ return await readRegularHandle(handle, before, label, maxBytes);
68
74
  }
69
75
  finally {
70
- await handle?.close();
76
+ await handle.close();
71
77
  }
72
78
  }
79
+ /**
80
+ * Reads a regular, non-symlink file without following symlinks on the final path component, failing if it changes
81
+ * while being read. Opens directly with `O_NOFOLLOW | O_NONBLOCK`, then checks the opened handle's type and size
82
+ * before reading at most `maxBytes` (+1 to detect growth).
83
+ */
84
+ export async function readRegularFile(filePath, label, maxBytes = DEFAULT_MAX_READ_BYTES) {
85
+ return await openAndReadRegularFile(filePath, label, maxBytes, `${label} must be a regular, non-symlink file`);
86
+ }
87
+ /**
88
+ * Reads a regular, non-symlink file whose opened handle is owned by `options.uid` (and by default not writable by
89
+ * group or others), failing if it changes while being read.
90
+ */
91
+ export async function readOwnedRegularFile(filePath, label, options) {
92
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_READ_BYTES;
93
+ const notRegularMessage = options.notRegularMessage ?? `${label} must be a regular, non-symlink file`;
94
+ const ownershipMessage = options.ownershipMessage ?? `${label} must be owned by root and not writable by group or others`;
95
+ const checkMode = options.disallowGroupOtherWrite ?? true;
96
+ return await openAndReadRegularFile(filePath, label, maxBytes, notRegularMessage, (before) => {
97
+ if (before.uid !== BigInt(options.uid) || (checkMode && (before.mode & 18n) !== 0n)) {
98
+ throw new Error(ownershipMessage);
99
+ }
100
+ });
101
+ }
73
102
  /** Resolves a file path and requires it to be outside `root` (both canonicalized). */
74
103
  export async function resolveOutside(filePath, root, label, { allowMissing = false } = {}) {
75
104
  const canonicalRoot = await realpath(path.resolve(root));
@@ -233,23 +262,12 @@ export async function resolveInsideDirectory(base, item, label) {
233
262
  export async function appendToRegularFile(filePath, text, label, mode = DEFAULT_LOG_MODE) {
234
263
  const target = path.resolve(filePath);
235
264
  const flags = fsConstants.O_APPEND | fsConstants.O_CREAT | fsConstants.O_WRONLY | noFollow | nonBlock;
236
- let existing;
237
- try {
238
- existing = await lstat(target, { bigint: true });
239
- if (existing.isSymbolicLink() || !existing.isFile())
240
- throw new Error(`${label} must be a regular, non-symlink file`);
241
- }
242
- catch (error) {
243
- if (error?.code !== 'ENOENT')
244
- throw error;
245
- }
246
- const handle = await open(target, flags, mode);
265
+ const notRegularMessage = `${label} must be a regular, non-symlink file`;
266
+ const handle = await openRegularHandle(target, flags, notRegularMessage, mode);
247
267
  try {
248
268
  const opened = await handle.stat({ bigint: true });
249
269
  if (!opened.isFile())
250
- throw new Error(`${label} must be a regular file`);
251
- if (existing && !sameFileIdentity(existing, opened))
252
- throw new Error(`${label} changed while being opened`);
270
+ throw new Error(notRegularMessage);
253
271
  await handle.appendFile(text, 'utf8');
254
272
  }
255
273
  finally {
@@ -25,9 +25,10 @@
25
25
  // source says enforce (decideAction additionally never lets a service answer downgrade it).
26
26
  // The adapter reads no environment variables. The config, its socket directory and the socket must be owned by root
27
27
  // (uid 0); argv cannot change that (tests inject a uid through HookDeps via their own entry point).
28
- import { lstat, readFile } from 'node:fs/promises';
28
+ import { lstat } from 'node:fs/promises';
29
29
  import path from 'node:path';
30
30
  import { isRecord } from "../../canonical-json.js";
31
+ import { readOwnedRegularFile } from "../../fs-safe.js";
31
32
  import { validateSkillName } from "../../names.js";
32
33
  import { decideAction } from "../contract.js";
33
34
  import { parseStrictJson } from "../strict-json.js";
@@ -44,10 +45,12 @@ const notApproved = (verdict) => `This Skill is not approved by your organisatio
44
45
  export async function loadConfig(file, rootUid = 0, extraKeys = []) {
45
46
  if (!path.isAbsolute(file))
46
47
  throw new Error('config path must be absolute');
47
- const st = await lstat(file);
48
- if (!st.isFile() || (st.mode & 0o022) !== 0 || st.uid !== rootUid)
49
- throw new Error('config must be a regular, root-owned, non-writable file');
50
- const raw = parseStrictJson(await readFile(file));
48
+ const msg = 'config must be a regular, root-owned, non-writable file';
49
+ const raw = parseStrictJson(await readOwnedRegularFile(file, 'config', {
50
+ uid: rootUid,
51
+ notRegularMessage: msg,
52
+ ownershipMessage: msg,
53
+ }));
51
54
  if (!isRecord(raw))
52
55
  throw new Error('config must be an object');
53
56
  const allowed = ['v', 'socket', 'mode', 'host_exes', 'client_deadline_ms', 'self_deadline_ms', ...extraKeys];
@@ -71,7 +71,7 @@
71
71
  // MODE/CONFIG/OWNERSHIP rules are the Claude adapter's (claude-code.ts): argv[1] is the mode, enforce wins, config and
72
72
  // socket must be root-owned, the adapter's own environment is not read. Extra config keys: `admin_root` (default
73
73
  // /etc/codex/skills; must be the gate service's `managedDir`) and `skill_roots` (extra absolute non-admin roots).
74
- import { lstat, open, readdir, readFile, realpath, stat } from 'node:fs/promises';
74
+ import { lstat, open, readdir, realpath, stat } from 'node:fs/promises';
75
75
  import path from 'node:path';
76
76
  import { isRecord } from "../../canonical-json.js";
77
77
  import { readRegularFile } from "../../fs-safe.js";
@@ -302,10 +302,7 @@ export async function readProcEnviron(pid) {
302
302
  async function dotenvMayMoveHome(codexHome) {
303
303
  const file = `${codexHome}/.env`;
304
304
  try {
305
- const st = await lstat(file);
306
- if (!st.isFile() || st.size > MAX_ENVIRON_BYTES)
307
- return true; // symlink, FIFO, directory, huge: not inspected
308
- return (await readFile(file)).includes('HOME');
305
+ return (await readRegularFile(file, '.env', MAX_ENVIRON_BYTES)).includes('HOME');
309
306
  }
310
307
  catch (e) {
311
308
  return e.code !== 'ENOENT';
@@ -494,7 +491,9 @@ function inspectCommand(raw, cfg) {
494
491
  // Any mention of a user/repo Skill location in any spelling (~, $HOME, relative), or of a SKILL.md file other than an
495
492
  // admin Skill's own `<admin_root>/<name>/SKILL.md`.
496
493
  const start = '(?<=^|[\\s\'"`=;|&()<>])'; // the admin path must start a word: `<other>/<admin>/x/SKILL.md` is not admin
497
- const outsideAdmin = command.replace(new RegExp(`${start}${esc}/[A-Za-z0-9][A-Za-z0-9._-]*/SKILL\\.md`, 'giu'), '');
494
+ // Case-sensitive, like the admin-name match below: a spelling such as `<admin_root>` in another case is a different path.
495
+ // It must not be removed here (it would then be neither rogue nor checked by the gate).
496
+ const outsideAdmin = command.replace(new RegExp(`${start}${esc}/[A-Za-z0-9][A-Za-z0-9._-]*/SKILL\\.md`, 'gu'), '');
498
497
  const rogue = /\.(agents|codex)(?![A-Za-z0-9_-])/u.test(command) || /skill\.md/iu.test(outsideAdmin)
499
498
  || cfg.skillRoots.some((r) => command.includes(collapse(r)));
500
499
  const admin = new Set();
@@ -437,10 +437,12 @@ export async function readGeneration(generationsRoot, name, digest) {
437
437
  async function seal(dir, files) {
438
438
  const dirs = new Set(['']);
439
439
  for (const f of files) {
440
+ // nosemgrep: mago-no-path-chown-chmod -- sealing a generation inside the service's root-owned generation store; no user can write there
440
441
  await chmod(path.join(dir, f.path), f.exec ? 0o555 : 0o444);
441
442
  for (let d = path.posix.dirname(f.path); d !== '.'; d = path.posix.dirname(d))
442
443
  dirs.add(d);
443
444
  }
445
+ // nosemgrep: mago-no-path-chown-chmod -- sealing a generation inside the service's root-owned generation store; no user can write there
444
446
  for (const d of [...dirs].sort((a, b) => b.length - a.length))
445
447
  await chmod(path.join(dir, d), 0o555);
446
448
  }
@@ -1,9 +1,9 @@
1
1
  // One gate instance per host (design docs/design/gate-cli.md, section 1, G1, G7). This module is the single place that knows
2
2
  // where an instance keeps its files, what its config file holds and how that maps to the service's own config.
3
- import { lstat, readFile } from 'node:fs/promises';
4
3
  import { createRequire } from 'node:module';
5
4
  import path from 'node:path';
6
5
  import { isRecord } from "../canonical-json.js";
6
+ import { readOwnedRegularFile } from "../fs-safe.js";
7
7
  import { validateKeyId } from "../keys.js";
8
8
  import { MODES } from "./contract.js";
9
9
  import { parseStrictJson } from "./strict-json.js";
@@ -78,12 +78,12 @@ export function parseInstanceConfig(raw) {
78
78
  }
79
79
  /** Reads the instance config. It must be a regular file owned by `rootUid` and not writable by group or others. */
80
80
  export async function readInstanceConfig(file, rootUid = 0) {
81
- const info = await lstat(file);
82
- if (!info.isFile())
83
- throw new Error(`${file} must be a regular file`);
84
- if (info.uid !== rootUid || (info.mode & 0o022) !== 0)
85
- throw new Error(`${file} must be owned by root and not writable by group or others`);
86
- return parseInstanceConfig(parseStrictJson(await readFile(file)));
81
+ const bytes = await readOwnedRegularFile(file, file, {
82
+ uid: rootUid,
83
+ notRegularMessage: `${file} must be a regular file`,
84
+ ownershipMessage: `${file} must be owned by root and not writable by group or others`,
85
+ });
86
+ return parseInstanceConfig(parseStrictJson(bytes));
87
87
  }
88
88
  /** The service's own config for an instance. */
89
89
  export function instanceToServiceConfig(cfg, rootUid = 0) {
@@ -14,6 +14,12 @@ export declare function assertGatePlatform(platform?: NodeJS.Platform): void;
14
14
  export declare function bootId(): Promise<string>;
15
15
  /** Milliseconds since boot (CLOCK_BOOTTIME, so suspend counts and wall-clock steps do not matter). */
16
16
  export declare function bootMs(): Promise<number>;
17
+ /**
18
+ * The first field of /proc/uptime (`seconds.hundredths`) in milliseconds, with integer arithmetic. `Number("2.01") * 1000`
19
+ * is 2009.9999999999998, which floors to 2009: one millisecond before the same instant as processFacts computes it from
20
+ * clock ticks. A host that asked in the tick it started in was then refused as "started in the future".
21
+ */
22
+ export declare function parseUptimeMs(text: string): number;
17
23
  /**
18
24
  * Start time and uid of a PROCESS (a thread-group leader), without its exe. Throws if gone, unreadable, a thread id
19
25
  * (a thread starts later than its process, which would shorten a session's generation set) or a process of a nested
@@ -23,10 +23,21 @@ export async function bootId() {
23
23
  }
24
24
  /** Milliseconds since boot (CLOCK_BOOTTIME, so suspend counts and wall-clock steps do not matter). */
25
25
  export async function bootMs() {
26
- const first = (await readFile('/proc/uptime', 'utf8')).split(' ')[0] ?? '';
27
- if (!/^\d+\.\d+$/u.test(first))
26
+ return parseUptimeMs(await readFile('/proc/uptime', 'utf8'));
27
+ }
28
+ /**
29
+ * The first field of /proc/uptime (`seconds.hundredths`) in milliseconds, with integer arithmetic. `Number("2.01") * 1000`
30
+ * is 2009.9999999999998, which floors to 2009: one millisecond before the same instant as processFacts computes it from
31
+ * clock ticks. A host that asked in the tick it started in was then refused as "started in the future".
32
+ */
33
+ export function parseUptimeMs(text) {
34
+ const m = /^(\d+)\.(\d+)$/u.exec(text.split(' ')[0] ?? '');
35
+ if (!m)
36
+ throw new Error('unexpected /proc/uptime format');
37
+ const ms = Number(m[1]) * 1000 + Number(m[2].padEnd(3, '0').slice(0, 3));
38
+ if (!Number.isSafeInteger(ms))
28
39
  throw new Error('unexpected /proc/uptime format');
29
- return Math.floor(Number(first) * 1000);
40
+ return ms;
30
41
  }
31
42
  /**
32
43
  * Start time and uid of a PROCESS (a thread-group leader), without its exe. Throws if gone, unreadable, a thread id
@@ -161,6 +161,7 @@ async function listen(server, file, mode) {
161
161
  await unlink(file);
162
162
  }
163
163
  await new Promise((resolve, reject) => { server.once('error', reject); server.listen(file, 4096, () => { server.off('error', reject); resolve(); }); });
164
+ // nosemgrep: mago-no-path-chown-chmod -- the service's own socket, just made by listen() in a root-owned socket folder
164
165
  await chmod(file, mode);
165
166
  }
166
167
  /** One request line per connection: read to the first newline (bounded, idle deadline), reply with one line, close. Anything else just closes. */
@@ -653,9 +654,11 @@ export function createGateService(config) {
653
654
  /** Removes a generation this install just created (sealed read-only folders need their mode back first). */
654
655
  async function removeGeneration(name, digest) {
655
656
  const gen = path.join(generationsDir, name, hex(digest));
657
+ // nosemgrep: mago-no-path-chown-chmod -- a generation inside the root-owned generation store, being removed
656
658
  for (const e of await readdir(gen, { recursive: true, withFileTypes: true }).catch(() => []))
657
659
  if (e.isDirectory())
658
660
  await chmod(path.join(e.parentPath, e.name), 0o755).catch(() => { });
661
+ // nosemgrep: mago-no-path-chown-chmod -- a generation inside the root-owned generation store, being removed
659
662
  await chmod(gen, 0o755).catch(() => { });
660
663
  await rm(gen, { recursive: true, force: true });
661
664
  await rm(`${gen}.manifest.json`, { force: true });
@@ -67,9 +67,9 @@ export interface InitOptions extends Seams {
67
67
  /** `--new-root`: the installed instance pins a different root and the administrator means to replace it (design gate-new-root.md N2). */
68
68
  newRoot?: boolean;
69
69
  /** Tests: sets the immutable attribute on a path (default `chattr +i`). A failure stops the command. */
70
- chattr?: (target: string) => Promise<void>;
70
+ chattr?: (target: string, via?: string) => Promise<void>;
71
71
  /** Tests: reads the immutable attribute (default `lsattr -d`). */
72
- isImmutable?: (target: string) => Promise<boolean>;
72
+ isImmutable?: (target: string, via?: string) => Promise<boolean>;
73
73
  now?: () => Date;
74
74
  }
75
75
  export type FileRole = 'instance' | 'hook' | 'unit' | 'dropin' | 'host' | 'managed-config' | 'manifest' | 'shared-manifest';
@@ -149,8 +149,8 @@ export interface ApplyOptions {
149
149
  base?: string;
150
150
  rootUid?: number;
151
151
  now?: () => Date;
152
- chattr?: (target: string) => Promise<void>;
153
- isImmutable?: (target: string) => Promise<boolean>;
152
+ chattr?: (target: string, via?: string) => Promise<void>;
153
+ isImmutable?: (target: string, via?: string) => Promise<boolean>;
154
154
  }
155
155
  export interface ApplyResult {
156
156
  written: string[];
@@ -190,7 +190,7 @@ export interface DoctorOptions extends Seams {
190
190
  /** Codex: the output of `codex --version` for a host binary (default: runs it). */
191
191
  codexVersion?: (exe: string) => Promise<string>;
192
192
  /** Codex: the immutable attribute of a path (default `lsattr -d`). */
193
- isImmutable?: (target: string) => Promise<boolean>;
193
+ isImmutable?: (target: string, via?: string) => Promise<boolean>;
194
194
  /** Tests: smaller bounds for the scan of the listed homes. */
195
195
  skillScanLimits?: SkillScanLimits;
196
196
  }