@inventarch/distribution 0.0.0-stage → 1.1.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 (176) hide show
  1. package/LANGUAGE.md +56 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +4 -0
  4. package/README.md +2 -2
  5. package/SPEC.md +5 -0
  6. package/assets/host-launcher.mjs +167 -0
  7. package/dist/acquire.d.ts +13 -0
  8. package/dist/acquire.d.ts.map +1 -0
  9. package/dist/acquire.js +46 -0
  10. package/dist/acquire.js.map +1 -0
  11. package/dist/archive.d.ts +20 -0
  12. package/dist/archive.d.ts.map +1 -0
  13. package/dist/archive.js +165 -0
  14. package/dist/archive.js.map +1 -0
  15. package/dist/authoring-assets.d.ts +11 -0
  16. package/dist/authoring-assets.d.ts.map +1 -0
  17. package/dist/authoring-assets.js +251 -0
  18. package/dist/authoring-assets.js.map +1 -0
  19. package/dist/bounded-fetch.d.ts +17 -0
  20. package/dist/bounded-fetch.d.ts.map +1 -0
  21. package/dist/bounded-fetch.js +67 -0
  22. package/dist/bounded-fetch.js.map +1 -0
  23. package/dist/cli.d.ts +3 -0
  24. package/dist/cli.d.ts.map +1 -0
  25. package/dist/cli.js +51 -0
  26. package/dist/cli.js.map +1 -0
  27. package/dist/command.d.ts +6 -0
  28. package/dist/command.d.ts.map +1 -0
  29. package/dist/command.js +189 -0
  30. package/dist/command.js.map +1 -0
  31. package/dist/config.d.ts +4 -0
  32. package/dist/config.d.ts.map +1 -0
  33. package/dist/config.js +43 -0
  34. package/dist/config.js.map +1 -0
  35. package/dist/decisions.d.ts +26 -0
  36. package/dist/decisions.d.ts.map +1 -0
  37. package/dist/decisions.js +119 -0
  38. package/dist/decisions.js.map +1 -0
  39. package/dist/files.d.ts +38 -0
  40. package/dist/files.d.ts.map +1 -0
  41. package/dist/files.js +224 -0
  42. package/dist/files.js.map +1 -0
  43. package/dist/guard-registration.d.ts +95 -0
  44. package/dist/guard-registration.d.ts.map +1 -0
  45. package/dist/guard-registration.js +282 -0
  46. package/dist/guard-registration.js.map +1 -0
  47. package/dist/host-home.d.ts +33 -0
  48. package/dist/host-home.d.ts.map +1 -0
  49. package/dist/host-home.js +116 -0
  50. package/dist/host-home.js.map +1 -0
  51. package/dist/host-modes.d.ts +13 -0
  52. package/dist/host-modes.d.ts.map +1 -0
  53. package/dist/host-modes.js +36 -0
  54. package/dist/host-modes.js.map +1 -0
  55. package/dist/host-observe.d.ts +24 -0
  56. package/dist/host-observe.d.ts.map +1 -0
  57. package/dist/host-observe.js +233 -0
  58. package/dist/host-observe.js.map +1 -0
  59. package/dist/host.d.ts +100 -0
  60. package/dist/host.d.ts.map +1 -0
  61. package/dist/host.js +505 -0
  62. package/dist/host.js.map +1 -0
  63. package/dist/hosts.d.ts +66 -0
  64. package/dist/hosts.d.ts.map +1 -0
  65. package/dist/hosts.js +39 -0
  66. package/dist/hosts.js.map +1 -0
  67. package/dist/ia-home.d.ts +15 -0
  68. package/dist/ia-home.d.ts.map +1 -0
  69. package/dist/ia-home.js +101 -0
  70. package/dist/ia-home.js.map +1 -0
  71. package/dist/install.d.ts +56 -0
  72. package/dist/install.d.ts.map +1 -0
  73. package/dist/install.js +402 -0
  74. package/dist/install.js.map +1 -0
  75. package/dist/installation-core.d.ts +41 -0
  76. package/dist/installation-core.d.ts.map +1 -0
  77. package/dist/installation-core.js +163 -0
  78. package/dist/installation-core.js.map +1 -0
  79. package/dist/inventory.d.ts +3 -0
  80. package/dist/inventory.d.ts.map +1 -0
  81. package/dist/inventory.js +49 -0
  82. package/dist/inventory.js.map +1 -0
  83. package/dist/json-edit.d.ts +19 -0
  84. package/dist/json-edit.d.ts.map +1 -0
  85. package/dist/json-edit.js +81 -0
  86. package/dist/json-edit.js.map +1 -0
  87. package/dist/lifecycle-registration.d.ts +47 -0
  88. package/dist/lifecycle-registration.d.ts.map +1 -0
  89. package/dist/lifecycle-registration.js +351 -0
  90. package/dist/lifecycle-registration.js.map +1 -0
  91. package/dist/minting.d.ts +46 -0
  92. package/dist/minting.d.ts.map +1 -0
  93. package/dist/minting.js +192 -0
  94. package/dist/minting.js.map +1 -0
  95. package/dist/native-command.d.ts +6 -0
  96. package/dist/native-command.d.ts.map +1 -0
  97. package/dist/native-command.js +273 -0
  98. package/dist/native-command.js.map +1 -0
  99. package/dist/pack.d.ts +4 -0
  100. package/dist/pack.d.ts.map +1 -0
  101. package/dist/pack.js +30 -0
  102. package/dist/pack.js.map +1 -0
  103. package/dist/plugin-home.d.ts +45 -0
  104. package/dist/plugin-home.d.ts.map +1 -0
  105. package/dist/plugin-home.js +371 -0
  106. package/dist/plugin-home.js.map +1 -0
  107. package/dist/program.d.ts +64 -0
  108. package/dist/program.d.ts.map +1 -0
  109. package/dist/program.js +126 -0
  110. package/dist/program.js.map +1 -0
  111. package/dist/projection.d.ts +45 -0
  112. package/dist/projection.d.ts.map +1 -0
  113. package/dist/projection.js +218 -0
  114. package/dist/projection.js.map +1 -0
  115. package/dist/publication.d.ts +20 -0
  116. package/dist/publication.d.ts.map +1 -0
  117. package/dist/publication.js +284 -0
  118. package/dist/publication.js.map +1 -0
  119. package/dist/registry-admission.d.ts +5 -0
  120. package/dist/registry-admission.d.ts.map +1 -0
  121. package/dist/registry-admission.js +17 -0
  122. package/dist/registry-admission.js.map +1 -0
  123. package/dist/registry-build.d.ts +35 -0
  124. package/dist/registry-build.d.ts.map +1 -0
  125. package/dist/registry-build.js +156 -0
  126. package/dist/registry-build.js.map +1 -0
  127. package/dist/registry-config.d.ts +32 -0
  128. package/dist/registry-config.d.ts.map +1 -0
  129. package/dist/registry-config.js +191 -0
  130. package/dist/registry-config.js.map +1 -0
  131. package/dist/registry-layout.d.ts +41 -0
  132. package/dist/registry-layout.d.ts.map +1 -0
  133. package/dist/registry-layout.js +142 -0
  134. package/dist/registry-layout.js.map +1 -0
  135. package/dist/registry-resolve.d.ts +56 -0
  136. package/dist/registry-resolve.d.ts.map +1 -0
  137. package/dist/registry-resolve.js +406 -0
  138. package/dist/registry-resolve.js.map +1 -0
  139. package/dist/registry-source.d.ts +37 -0
  140. package/dist/registry-source.d.ts.map +1 -0
  141. package/dist/registry-source.js +101 -0
  142. package/dist/registry-source.js.map +1 -0
  143. package/dist/registry.d.ts +10 -0
  144. package/dist/registry.d.ts.map +1 -0
  145. package/dist/registry.js +6 -0
  146. package/dist/registry.js.map +1 -0
  147. package/dist/resolve.d.ts +31 -0
  148. package/dist/resolve.d.ts.map +1 -0
  149. package/dist/resolve.js +115 -0
  150. package/dist/resolve.js.map +1 -0
  151. package/dist/services.d.ts +179 -0
  152. package/dist/services.d.ts.map +1 -0
  153. package/dist/services.js +290 -0
  154. package/dist/services.js.map +1 -0
  155. package/dist/snapshot.d.ts +24 -0
  156. package/dist/snapshot.d.ts.map +1 -0
  157. package/dist/snapshot.js +343 -0
  158. package/dist/snapshot.js.map +1 -0
  159. package/dist/system-package.d.ts +71 -0
  160. package/dist/system-package.d.ts.map +1 -0
  161. package/dist/system-package.js +169 -0
  162. package/dist/system-package.js.map +1 -0
  163. package/dist/transfer.d.ts +22 -0
  164. package/dist/transfer.d.ts.map +1 -0
  165. package/dist/transfer.js +98 -0
  166. package/dist/transfer.js.map +1 -0
  167. package/dist/updates.d.ts +57 -0
  168. package/dist/updates.d.ts.map +1 -0
  169. package/dist/updates.js +201 -0
  170. package/dist/updates.js.map +1 -0
  171. package/dist/ustar.d.ts +28 -0
  172. package/dist/ustar.d.ts.map +1 -0
  173. package/dist/ustar.js +145 -0
  174. package/dist/ustar.js.map +1 -0
  175. package/package.json +323 -3
  176. package/references/system-package.md +13 -0
@@ -0,0 +1,33 @@
1
+ export interface HostPin {
2
+ readonly release: string;
3
+ readonly archive: string;
4
+ readonly files: number;
5
+ readonly bytes: number;
6
+ }
7
+ /** M5.3 §3.3's per-OS data directory, kept only so `doctor` can recognize registrations pinned there (host plugin distribution spec §3). */
8
+ export declare function legacyHostHome(env: Readonly<Record<string, string | undefined>>, platform: string, home: string): string;
9
+ export declare const hostPayloadPath: (home: string, release: string) => string;
10
+ /** Spec §3.3 step 1: read and shape-check the pin, and require the archive; its digest is checked by `materializeHostPayload`. A missing or malformed asset is ARTIFACT-UNAVAILABLE. */
11
+ export declare function readHostPin(packageRoot: string): {
12
+ readonly pin: HostPin;
13
+ readonly pinPath: string;
14
+ readonly archivePath: string;
15
+ readonly archive: () => Buffer;
16
+ };
17
+ /**
18
+ * Spec §3.3: the consumer root MUST NOT be inside the host home, and a home inside the workspace would put per-user payload
19
+ * bytes in it; both refuse. Nesting is judged on disk, so another spelling a case- or normalization-folding volume opens as
20
+ * the same directory nests too (#315).
21
+ */
22
+ export declare function assertHomeOutsideWorkspace(home: string, root: string): void;
23
+ /** Spec §3.3 steps 3-4: verify-or-reuse, never overwrite; stage beside the target and rename into place. */
24
+ export declare function materializeHostPayload(input: {
25
+ readonly home: string;
26
+ readonly archive: Buffer;
27
+ readonly pin: HostPin;
28
+ }): {
29
+ directory: string;
30
+ release: string;
31
+ reused: boolean;
32
+ };
33
+ //# sourceMappingURL=host-home.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-home.d.ts","sourceRoot":"","sources":["../src/host-home.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAWD,4IAA4I;AAC5I,wBAAgB,cAAc,CAC5B,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACjD,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,CAIR;AACD,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,MAAsC,CAAC;AAIvG,wLAAwL;AACxL,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG;IAChD,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;CAChC,CA0BA;AACD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAI3E;AACD,4GAA4G;AAC5G,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAyC1D"}
@@ -0,0 +1,116 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
3
+ import { dirname, isAbsolute, join, resolve } from 'node:path';
4
+ import { within } from '@inventarch/db';
5
+ import { DistributionError, fail, sha256 } from './files.js';
6
+ import { verifyHostCache } from './host.js';
7
+ import { ensureIaHome } from './ia-home.js';
8
+ import { HOST_TREE_LIMITS, unpackTree } from './ustar.js';
9
+ /** Spec §3.3 step 3: a failed verification of an existing payload must name the directory it refuses. */
10
+ function verifyNaming(target) {
11
+ try {
12
+ return verifyHostCache(target);
13
+ }
14
+ catch (error) {
15
+ if (error instanceof DistributionError)
16
+ throw new DistributionError(error.code, `${error.message} at ${target}; delete that directory`);
17
+ throw error;
18
+ }
19
+ }
20
+ /** M5.3 §3.3's per-OS data directory, kept only so `doctor` can recognize registrations pinned there (host plugin distribution spec §3). */
21
+ export function legacyHostHome(env, platform, home) {
22
+ if (platform === 'win32')
23
+ return join(env['LOCALAPPDATA'] || join(home, 'AppData', 'Local'), 'ia');
24
+ if (platform === 'darwin')
25
+ return join(home, 'Library/Application Support', 'ia');
26
+ return join(env['XDG_DATA_HOME'] || join(home, '.local/share'), 'ia');
27
+ }
28
+ export const hostPayloadPath = (home, release) => join(home, 'hosts', release);
29
+ /** Spec §3.3 step 1: where a package carries its embedded payload, relative to its own root (tools/distribution/host-payload.mjs writes both). */
30
+ const HOST_PIN_PATH = 'assets/host.json';
31
+ const hostArchivePath = (archive) => `assets/host/${archive}.tgz`;
32
+ /** Spec §3.3 step 1: read and shape-check the pin, and require the archive; its digest is checked by `materializeHostPayload`. A missing or malformed asset is ARTIFACT-UNAVAILABLE. */
33
+ export function readHostPin(packageRoot) {
34
+ const pinPath = resolve(packageRoot, HOST_PIN_PATH);
35
+ let pin;
36
+ try {
37
+ const value = JSON.parse(readFileSync(pinPath, 'utf8'));
38
+ if (value === null ||
39
+ typeof value !== 'object' ||
40
+ Object.keys(value).sort().join(',') !== 'archive,bytes,files,release' ||
41
+ !/^[a-f0-9]{64}$/.test(String(value['release'])) ||
42
+ !/^[a-f0-9]{64}$/.test(String(value['archive'])) ||
43
+ !Number.isSafeInteger(value['files']) ||
44
+ !Number.isSafeInteger(value['bytes']))
45
+ throw new Error('unexpected fields');
46
+ pin = value;
47
+ }
48
+ catch (error) {
49
+ return fail('ARTIFACT-UNAVAILABLE', `The bundled host payload pin cannot be read (${error instanceof Error ? error.message : String(error)}): ${pinPath}`);
50
+ }
51
+ const archivePath = resolve(packageRoot, hostArchivePath(pin.archive));
52
+ if (!existsSync(archivePath))
53
+ fail('ARTIFACT-UNAVAILABLE', `The bundled host payload archive is missing: ${archivePath}`);
54
+ return { pin, pinPath, archivePath, archive: () => readFileSync(archivePath) };
55
+ }
56
+ /**
57
+ * Spec §3.3: the consumer root MUST NOT be inside the host home, and a home inside the workspace would put per-user payload
58
+ * bytes in it; both refuse. Nesting is judged on disk, so another spelling a case- or normalization-folding volume opens as
59
+ * the same directory nests too (#315).
60
+ */
61
+ export function assertHomeOutsideWorkspace(home, root) {
62
+ if (!isAbsolute(home) || !isAbsolute(root))
63
+ fail('INPUT-INVALID', 'Host home and workspace root must be absolute');
64
+ if (within(home, root))
65
+ fail('PATH-UNSAFE', `Consumer workspace cannot be inside the host home ${home}`);
66
+ if (within(root, home))
67
+ fail('PATH-UNSAFE', `Host home cannot be inside the consumer workspace: ${home}`);
68
+ }
69
+ /** Spec §3.3 steps 3-4: verify-or-reuse, never overwrite; stage beside the target and rename into place. */
70
+ export function materializeHostPayload(input) {
71
+ const { home, archive, pin } = input;
72
+ if (!/^[a-f0-9]{64}$/.test(pin.release) || !/^[a-f0-9]{64}$/.test(pin.archive))
73
+ fail('INPUT-INVALID', 'Invalid host payload pin');
74
+ const target = hostPayloadPath(home, pin.release);
75
+ if (sha256(archive) !== pin.archive)
76
+ fail('INTEGRITY-MISMATCH', 'Bundled host payload differs from its pin');
77
+ if (existsSync(target)) {
78
+ const found = verifyNaming(target);
79
+ if (found.release !== pin.release)
80
+ fail('INTEGRITY-MISMATCH', `Host payload at ${target} differs from its release; delete that directory`);
81
+ return { directory: found.directory, release: found.release, reused: true };
82
+ }
83
+ const tree = unpackTree(archive, HOST_TREE_LIMITS), release = tree.get('release.json');
84
+ if (!release || sha256(release) !== pin.release)
85
+ fail('INTEGRITY-MISMATCH', 'Bundled host payload release differs from its pin');
86
+ // Deferred past every integrity check: a bad bundled archive fails before the home is even created or marked.
87
+ ensureIaHome(home);
88
+ const stage = join(home, 'hosts', `.stage-${randomUUID()}`);
89
+ mkdirSync(stage, { recursive: true });
90
+ let won = true;
91
+ try {
92
+ for (const [path, bytes] of tree) {
93
+ const file = join(stage, path);
94
+ mkdirSync(dirname(file), { recursive: true });
95
+ writeFileSync(file, bytes, { flag: 'wx' });
96
+ }
97
+ verifyHostCache(stage);
98
+ try {
99
+ renameSync(stage, target);
100
+ }
101
+ catch (error) {
102
+ if (!existsSync(target))
103
+ throw error;
104
+ won = false;
105
+ } // another process won the race; verify its copy below
106
+ }
107
+ finally {
108
+ if (existsSync(stage))
109
+ rmSync(stage, { recursive: true, force: true });
110
+ }
111
+ const found = verifyNaming(target);
112
+ if (found.release !== pin.release)
113
+ fail('INTEGRITY-MISMATCH', `Host payload at ${target} differs from its release; delete that directory`);
114
+ return { directory: found.directory, release: found.release, reused: !won };
115
+ }
116
+ //# sourceMappingURL=host-home.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-home.js","sourceRoot":"","sources":["../src/host-home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ1D,yGAAyG;AACzG,SAAS,YAAY,CAAC,MAAc;IAClC,IAAI,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,iBAAiB;YACpC,MAAM,IAAI,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,OAAO,OAAO,MAAM,yBAAyB,CAAC,CAAC;QAClG,MAAM,KAAK,CAAC;IACd,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EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * REQ-LCS-4: the launcher's public modes as data. Every description of how to invoke scripts/ia.mjs is rendered
3
+ * from this list; tests/context-launcher.test.ts asserts the launcher accepts exactly these.
4
+ */
5
+ export interface HostMode {
6
+ readonly mode: string;
7
+ readonly arguments: string;
8
+ readonly meaning: string;
9
+ }
10
+ export declare const HOST_MODES: readonly HostMode[];
11
+ /** How one mode is written in generated instructions; `<cache>` is literal because the path is per user. */
12
+ export declare const launcherInvocation: (row: HostMode) => string;
13
+ //# sourceMappingURL=host-modes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-modes.d.ts","sourceRoot":"","sources":["../src/host-modes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AACD,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAkCzC,CAAC;AACF,4GAA4G;AAC5G,eAAO,MAAM,kBAAkB,GAAI,KAAK,QAAQ,KAAG,MACmC,CAAC"}
@@ -0,0 +1,36 @@
1
+ export const HOST_MODES = Object.freeze([
2
+ {
3
+ mode: 'verify',
4
+ arguments: '',
5
+ meaning: 'Verify the whole cache against its pinned inventory and print its identity',
6
+ },
7
+ {
8
+ mode: 'mcp',
9
+ arguments: '--root <absolute workspace>',
10
+ meaning: 'Serve the read-only workspace door over MCP stdio',
11
+ },
12
+ {
13
+ mode: 'door',
14
+ arguments: '<operation> --root <absolute workspace> [--params <JSON|->]',
15
+ meaning: 'Run one read-only door operation and print its JSON response',
16
+ },
17
+ {
18
+ mode: 'distribution',
19
+ arguments: '<command> --root <absolute workspace> ...',
20
+ meaning: 'Run the bundled ia-distribution mechanism CLI',
21
+ },
22
+ {
23
+ mode: 'guard',
24
+ arguments: '--root <absolute workspace> [--actors <absolute file>]',
25
+ meaning: 'Evaluate one PreToolUse event on stdin against the steward guard',
26
+ },
27
+ { mode: 'claude-guard', arguments: '', meaning: 'The guard with the root taken from CLAUDE_PROJECT_DIR' },
28
+ {
29
+ mode: 'context',
30
+ arguments: 'identity | --root <absolute workspace> --binding <absolute file> [--part <0-11>]',
31
+ meaning: 'Lifecycle context hook; not the door operation of the same name',
32
+ },
33
+ ].map((row) => Object.freeze(row)));
34
+ /** How one mode is written in generated instructions; `<cache>` is literal because the path is per user. */
35
+ export const launcherInvocation = (row) => `node <cache>/scripts/ia.mjs ${row.mode}${row.arguments ? ' ' + row.arguments : ''}`;
36
+ //# sourceMappingURL=host-modes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-modes.js","sourceRoot":"","sources":["../src/host-modes.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,UAAU,GAAwB,MAAM,CAAC,MAAM,CAC1D;IACE;QACE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,4EAA4E;KACtF;IACD;QACE,IAAI,EAAE,KAAK;QACX,SAAS,EAAE,6BAA6B;QACxC,OAAO,EAAE,mDAAmD;KAC7D;IACD;QACE,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,6DAA6D;QACxE,OAAO,EAAE,8DAA8D;KACxE;IACD;QACE,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,2CAA2C;QACtD,OAAO,EAAE,+CAA+C;KACzD;IACD;QACE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,wDAAwD;QACnE,OAAO,EAAE,kEAAkE;KAC5E;IACD,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,uDAAuD,EAAE;IACzG;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,kFAAkF;QAC7F,OAAO,EAAE,iEAAiE;KAC3E;CACF,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CACnC,CAAC;AACF,4GAA4G;AAC5G,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAa,EAAU,EAAE,CAC1D,+BAA+B,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { WorkspaceHost as Host } from './hosts.js';
2
+ type Element = 'mcp' | 'hooks' | 'projection';
3
+ export type StaleReason = 'release' | 'launcher-missing' | 'launcher-unverified' | 'mcp-modified' | 'guard-modified' | 'guard-form' | 'guard-release' | 'guard-launcher' | 'node-missing' | 'state-invalid';
4
+ export interface HostObservation {
5
+ readonly host: Host;
6
+ readonly status: 'registered' | 'stale';
7
+ readonly release: string | null;
8
+ readonly cache: string | null;
9
+ readonly launcher: string | null;
10
+ readonly launcherExists: boolean;
11
+ readonly reasons: readonly StaleReason[];
12
+ readonly elements: readonly Element[];
13
+ }
14
+ /**
15
+ * Spec §7. `currentRelease` is the running CLI's payload release, or null when it ships none. Never writes; never
16
+ * throws. Two independent failure surfaces are both absorbed rather than propagated: a malformed or unreadable
17
+ * *user* file (`.mcp.json`, `.codex/config.toml`, `.claude/settings.local.json`) reads as the corresponding
18
+ * `*-modified` drift, and a corrupted or unreadable *own* file (`stateRow`/`guardRow`/`hasProjection` above) —
19
+ * either our own `IA-DIST-*` refusal or the filesystem's/JSON codec's own error — degrades to `state-invalid`
20
+ * rather than aborting `readInstalledState`/`ia inspect` for every host over one bad file.
21
+ */
22
+ export declare function observeHosts(rootInput: string, currentRelease: string | null): HostObservation[];
23
+ export {};
24
+ //# sourceMappingURL=host-observe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-observe.d.ts","sourceRoot":"","sources":["../src/host-observe.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAGxD,KAAK,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,YAAY,CAAC;AAC9C,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,kBAAkB,GAClB,qBAAqB,GACrB,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,eAAe,CAAC;AACpB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;CACvC;AAwGD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,EAAE,CAyGhG"}
@@ -0,0 +1,233 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { decodeDistributionJson } from '@inventarch/db/distribution';
4
+ import { bytes, json, utf8, workspace } from './files.js';
5
+ import { reconcileConfig } from './config.js';
6
+ import { derivedCommand, HOST_CONFIG, HOST_REGISTRATION, recordedNode, saved as readHostState, verifyHostCache, } from './host.js';
7
+ import { currentGuardForm, guardNode, saved as readGuardState } from './guard-registration.js';
8
+ import { WORKSPACE_HOSTS, workspaceRow } from './hosts.js';
9
+ const area = '.ia/distributions/hosts';
10
+ /** Our own state files: written only by `applyHost`/`applyGuardRegistration`/`applyProjection`. */
11
+ const readOwned = (root, path) => {
12
+ const value = bytes(root, path, 1024 * 1024);
13
+ return value === null ? null : utf8(value);
14
+ };
15
+ /**
16
+ * `.mcp.json`, `.codex/config.toml` and `.claude/settings.local.json` are user-owned surfaces this authority only
17
+ * partially controls. Observation must survive a hand-corrupted or non-UTF-8 file: unreadable bytes are reported
18
+ * as drift, never an exception (spec §7/§9: doctor never claims more than it observed, and never crashes on it).
19
+ */
20
+ const readUser = (root, path) => {
21
+ try {
22
+ const value = bytes(root, path, 1024 * 1024);
23
+ return value === null ? null : utf8(value);
24
+ }
25
+ catch {
26
+ return null;
27
+ }
28
+ };
29
+ /** As `readUser`, but also swallows a JSON syntax error so a malformed `.mcp.json`/settings file yields a `*-modified` reason instead of a crash. */
30
+ function readUserJson(root, path) {
31
+ const text = readUser(root, path);
32
+ if (text === null)
33
+ return null;
34
+ try {
35
+ const value = decodeDistributionJson(text);
36
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
37
+ ? value
38
+ : null;
39
+ }
40
+ catch {
41
+ return null;
42
+ }
43
+ }
44
+ /** Memoizes `verifyHostCache` per cache directory for the lifetime of one `observeHosts` call: the mcp and guard elements often (though not always) name the same cache, and re-scanning its whole payload twice buys nothing. Failures are cached too, so a repeated broken directory only scans once. */
45
+ function verifier() {
46
+ const cache = new Map();
47
+ return (directory) => {
48
+ let entry = cache.get(directory);
49
+ if (!entry) {
50
+ try {
51
+ entry = { ok: true, value: verifyHostCache(directory) };
52
+ }
53
+ catch (error) {
54
+ entry = { ok: false, error };
55
+ }
56
+ cache.set(directory, entry);
57
+ }
58
+ if (!entry.ok)
59
+ throw entry.error;
60
+ return entry.value;
61
+ };
62
+ }
63
+ /** Spec §9: never a guess. A corrupted own state file is reported, not fabricated data for the fields it would have supplied. */
64
+ function invalid(host) {
65
+ return {
66
+ host,
67
+ status: 'stale',
68
+ release: null,
69
+ cache: null,
70
+ launcher: null,
71
+ launcherExists: false,
72
+ reasons: ['state-invalid'],
73
+ elements: [],
74
+ };
75
+ }
76
+ const ABSENT = 'absent', BROKEN = 'broken';
77
+ /**
78
+ * Every read of one of *our own* files below is wrapped, not just the parse: `readOwned` itself can throw
79
+ * (non-UTF-8 bytes, a file over the byte cap, a hardlinked or otherwise unaliased path, or a directory sitting at
80
+ * the expected path), and a hostile or corrupted filesystem must degrade one host's row rather than abort the
81
+ * whole call. `ABSENT` (no file — not a failure) and `BROKEN` (a file exists but could not be read or validated)
82
+ * are kept distinct so an absent registration stays silently absent while a broken one is reported.
83
+ */
84
+ function stateRow(root, host) {
85
+ try {
86
+ const text = readOwned(root, `${area}/${host}-${HOST_REGISTRATION}.json`);
87
+ if (text === null)
88
+ return ABSENT;
89
+ return readHostState(text, host, HOST_REGISTRATION) ?? BROKEN;
90
+ }
91
+ catch {
92
+ return BROKEN;
93
+ }
94
+ }
95
+ function guardRow(root) {
96
+ try {
97
+ const text = readOwned(root, `${area}/claude-guard-${HOST_REGISTRATION}.json`);
98
+ if (text === null)
99
+ return ABSENT;
100
+ return readGuardState(text, root, HOST_REGISTRATION) ?? BROKEN;
101
+ }
102
+ catch {
103
+ return BROKEN;
104
+ }
105
+ }
106
+ function hasProjection(root, host) {
107
+ try {
108
+ return readOwned(root, `${area}/${host}-projection.json`) !== null;
109
+ }
110
+ catch {
111
+ return BROKEN;
112
+ }
113
+ }
114
+ /**
115
+ * Spec §7. `currentRelease` is the running CLI's payload release, or null when it ships none. Never writes; never
116
+ * throws. Two independent failure surfaces are both absorbed rather than propagated: a malformed or unreadable
117
+ * *user* file (`.mcp.json`, `.codex/config.toml`, `.claude/settings.local.json`) reads as the corresponding
118
+ * `*-modified` drift, and a corrupted or unreadable *own* file (`stateRow`/`guardRow`/`hasProjection` above) —
119
+ * either our own `IA-DIST-*` refusal or the filesystem's/JSON codec's own error — degrades to `state-invalid`
120
+ * rather than aborting `readInstalledState`/`ia inspect` for every host over one bad file.
121
+ */
122
+ export function observeHosts(rootInput, currentRelease) {
123
+ const root = workspace(rootInput), out = [], verify = verifier();
124
+ for (const host of WORKSPACE_HOSTS) {
125
+ const found = stateRow(root, host);
126
+ if (found === ABSENT)
127
+ continue;
128
+ if (found === BROKEN) {
129
+ out.push(invalid(host));
130
+ continue;
131
+ }
132
+ const state = found, launcher = join(state.cache, 'scripts/ia.mjs'), launcherExists = existsSync(launcher);
133
+ const reasons = [], elements = ['mcp'];
134
+ const stale = (reason) => {
135
+ if (!reasons.includes(reason))
136
+ reasons.push(reason);
137
+ };
138
+ if (currentRelease !== null && state.release !== currentRelease)
139
+ reasons.push('release');
140
+ if (!launcherExists)
141
+ reasons.push('launcher-missing');
142
+ else {
143
+ try {
144
+ if (verify(state.cache).release !== state.release)
145
+ reasons.push('launcher-unverified');
146
+ }
147
+ catch {
148
+ reasons.push('launcher-unverified');
149
+ }
150
+ }
151
+ // The recorded entry must be the one derived from the state's own cache and this root, run by a Node executable
152
+ // that is still there: a state whose owned entry names another command is not a registration this authority wrote.
153
+ const command = derivedCommand(state, root), node = command === null ? 'modified' : recordedNode(command);
154
+ if (node === 'modified')
155
+ stale('mcp-modified');
156
+ else if (node === 'missing')
157
+ stale('node-missing');
158
+ if (HOST_CONFIG[host].format === 'json') {
159
+ const servers = readUserJson(root, HOST_CONFIG[host].file)?.['mcpServers'], table = servers !== null && typeof servers === 'object' && !Array.isArray(servers)
160
+ ? servers
161
+ : {};
162
+ if (json(table[`ia-${HOST_REGISTRATION}`]) !== state.owned)
163
+ stale('mcp-modified');
164
+ }
165
+ else {
166
+ // Mirrors what `planHost`'s codex branch enforces on apply: the owned block must be uniquely located, byte-identical, and its parsed role must carry no field beyond what this authority wrote (a sibling table extending the same key fails this the same way a hand edit does).
167
+ try {
168
+ reconcileConfig(readUser(root, '.codex/config.toml') ?? '', 'host-' + HOST_REGISTRATION, state.owned, state.owned, 'mcp_servers');
169
+ }
170
+ catch {
171
+ stale('mcp-modified');
172
+ }
173
+ }
174
+ // The steward guard is a hooks element, so it is observed only for a host whose row declares hooks (spec §4).
175
+ if (workspaceRow(host)?.hooks) {
176
+ const guard = guardRow(root);
177
+ if (guard !== ABSENT) {
178
+ elements.push('hooks');
179
+ if (guard === BROKEN)
180
+ reasons.push('state-invalid');
181
+ else {
182
+ const settings = readUserJson(root, '.claude/settings.local.json');
183
+ const hooksField = settings?.['hooks'], preToolUse = hooksField !== null && typeof hooksField === 'object' && !Array.isArray(hooksField)
184
+ ? hooksField['PreToolUse']
185
+ : undefined;
186
+ const rows = Array.isArray(preToolUse) ? preToolUse : [];
187
+ if (rows.filter((row) => json(row) === json(guard.group)).length !== 1)
188
+ stale('guard-modified');
189
+ // `readGuardState` already holds the group's arguments to the fixed derivation; the Node it runs must be Node's.
190
+ const handler = guard.group.hooks[0] ?? {}, node = recordedNode(guardNode(handler, join(guard.cache, 'scripts/ia.mjs'), root));
191
+ if (node === 'modified')
192
+ stale('guard-modified');
193
+ else if (node === 'missing')
194
+ stale('node-missing');
195
+ // An owned group in a form this release no longer writes (the fail-open direct form on POSIX, an earlier script).
196
+ if (node !== 'modified' && !currentGuardForm(handler))
197
+ stale('guard-form');
198
+ // The guard pins its own cache/release independently of the mcp element; the two can drift apart (e.g. one re-applied, the other not).
199
+ if (guard.release !== state.release)
200
+ reasons.push('guard-release');
201
+ if (!existsSync(join(guard.cache, 'scripts/ia.mjs')))
202
+ reasons.push('guard-launcher');
203
+ else {
204
+ try {
205
+ if (verify(guard.cache).release !== guard.release)
206
+ reasons.push('guard-launcher');
207
+ }
208
+ catch {
209
+ reasons.push('guard-launcher');
210
+ }
211
+ }
212
+ }
213
+ }
214
+ }
215
+ const projection = hasProjection(root, host);
216
+ if (projection === BROKEN)
217
+ reasons.push('state-invalid');
218
+ else if (projection)
219
+ elements.push('projection');
220
+ out.push({
221
+ host,
222
+ status: reasons.length ? 'stale' : 'registered',
223
+ release: state.release,
224
+ cache: state.cache,
225
+ launcher,
226
+ launcherExists,
227
+ reasons,
228
+ elements,
229
+ });
230
+ }
231
+ return out;
232
+ }
233
+ //# sourceMappingURL=host-observe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-observe.js","sourceRoot":"","sources":["../src/host-observe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,KAAK,IAAI,aAAa,EACtB,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAwB3D,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,mGAAmG;AACnG,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,IAAY,EAAiB,EAAE;IAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;IAC7C,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC,CAAC;AACF;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,IAAY,EAAiB,EAAE;IAC7D,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAA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I;YACJ,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY;YAC/C,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ;YACR,cAAc;YACd,OAAO;YACP,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ import type { JsonPath } from './json-edit.js';
2
+ import type { WorkspaceHost as Host } from './hosts.js';
3
+ interface Cache {
4
+ directory: string;
5
+ release: string;
6
+ name: string;
7
+ host: Host | null;
8
+ launcher: string;
9
+ format: 1 | 2;
10
+ }
11
+ /** What the pure planners need of a cache: a verified one, or the v2 payload a caller is about to materialize. */
12
+ export type HostCacheTarget = Pick<Cache, 'directory' | 'release' | 'name' | 'host' | 'launcher'>;
13
+ interface State {
14
+ format: 'ia.host-state.v1';
15
+ host: Host;
16
+ id: string;
17
+ cache: string;
18
+ release: string;
19
+ owned: string;
20
+ created: boolean;
21
+ existing?: readonly JsonPath[];
22
+ }
23
+ export interface HostPlan {
24
+ format: 'ia.host-plan.v1';
25
+ root: string;
26
+ host: Host;
27
+ id: string;
28
+ operation: 'activate' | 'remove';
29
+ cache: string | null;
30
+ release: string | null;
31
+ before: {
32
+ config: string | null;
33
+ state: string | null;
34
+ nativeLock: string | null;
35
+ };
36
+ after: {
37
+ config: string | null;
38
+ state: string | null;
39
+ };
40
+ digest: string;
41
+ }
42
+ /**
43
+ * Spec §4: each workspace host's MCP configuration file and its format. Keyed by `WorkspaceHost`, so a new workspace
44
+ * row in hosts.ts does not compile until it has an entry here, instead of taking another host's file or format.
45
+ */
46
+ export declare const HOST_CONFIG: Readonly<Record<Host, {
47
+ readonly file: string;
48
+ readonly format: 'json' | 'toml';
49
+ }>>;
50
+ /** Spec §5.1: one registration id per workspace and host for the v2 consumer payload. */
51
+ export declare const HOST_REGISTRATION = "workspace";
52
+ /** REQ-HRC-2: the only constructor of an IA server's command and arguments, durable or ephemeral. */
53
+ export declare function doorServer(entrypoint: string, args: readonly string[]): {
54
+ command: string;
55
+ args: string[];
56
+ };
57
+ /**
58
+ * The Node executable a registration recorded, as it reads now: an absolute path that is a file, whatever the file is called
59
+ * (Fedora's Node is `/usr/bin/node-22`), as the context groups accept it. Anything else is not what `doorServer` writes
60
+ * (`modified`); a well-formed path with nothing there is `missing`, which re-applying repairs by recording the running Node.
61
+ */
62
+ export declare function recordedNode(command: unknown): 'ok' | 'modified' | 'missing';
63
+ /**
64
+ * The recorded server's command when the state's `owned` text is exactly the one `planHostWith` derives for that
65
+ * state's own cache and this root, with the recorded command kept as written; null otherwise. The ownership shape
66
+ * alone (`saved`) cannot tell a forged state, whose owned entry runs an arbitrary command, from a real one.
67
+ */
68
+ export declare function derivedCommand(state: Pick<State, 'host' | 'id' | 'cache' | 'owned'>, root: string): string | null;
69
+ /** Exported for `host-observe.ts`: the one real ownership-shape validator for `{host}-workspace.json`, reused rather than duplicated so observation can never drift from what `planHost`/`applyHost` themselves accept. */
70
+ export declare function saved(value: string | null, host: Host, name: string): State | null;
71
+ /** Verify the whole selected artifact before installing a command that can launch it. */
72
+ export declare function verifyHostCache(input: string): Cache;
73
+ export declare function assertHostRegistrationIdle(root: string): void;
74
+ /**
75
+ * The v2 payload a caller will materialize at `directory` with release digest `release`, described without reading it.
76
+ * Planning against it yields the plan `planHost` yields once that payload exists there and verifies; apply always
77
+ * re-plans with verification, so an expectation never reaches a written registration unverified.
78
+ */
79
+ export declare function expectedHostCache(directory: string, release: string): HostCacheTarget;
80
+ /** Descriptive plan: configuration and ownership bytes are always rederived on apply. */
81
+ export declare function planHost(rootInput: string, hostInput: Host, cacheInput: string | null, removeId?: string): HostPlan;
82
+ /** `planHost` against an expected, unverified cache (`expectedHostCache`), or against none for a removal. Never reads the cache. */
83
+ export declare function planHostFor(rootInput: string, hostInput: Host, expected: HostCacheTarget | null, removeId?: string): HostPlan;
84
+ export declare function acquireHostRegistrationLock(root: string, recovery?: boolean): () => void;
85
+ export declare function applyHost(value: unknown, checkpoint?: (name: string) => void): {
86
+ status: 'host-active' | 'host-removed';
87
+ id: string;
88
+ host: Host;
89
+ };
90
+ export declare function recoverHost(rootInput: string): {
91
+ status: 'host-recovered' | 'current';
92
+ };
93
+ /**
94
+ * The Node executable a registration records: the running one, except that a Homebrew keg's versioned path
95
+ * (`<prefix>/Cellar/<formula>/<version>/bin/node`), which `brew upgrade` and cleanup delete, is recorded as the formula's
96
+ * stable `<prefix>/opt/<formula>/bin/node` link while that link reaches the same executable (#323).
97
+ */
98
+ export declare function nodeCommand(execPath?: string): string;
99
+ export {};
100
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAGxD,UAAU,KAAK;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;CACf;AACD,kHAAkH;AAClH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;AAClG,UAAU,KAAK;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MA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