@empire-builder-kit/nx 1.0.0-rc.45 → 1.0.0-rc.47

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 (187) hide show
  1. package/generators.json +11 -1
  2. package/package.json +3 -3
  3. package/src/aws-authority/stage-authority.d.ts +30 -2
  4. package/src/aws-authority/stage-authority.js +220 -25
  5. package/src/developer-agent/generator-planning.js +109 -9
  6. package/src/developer-agent/model.d.ts +7 -3
  7. package/src/developer-agent/model.js +1 -0
  8. package/src/developer-agent/operation-registry.d.ts +1 -0
  9. package/src/developer-agent/operation-registry.js +44 -3
  10. package/src/developer-agent/planning.js +5 -2
  11. package/src/developer-agent/preview-changes.js +10 -0
  12. package/src/developer-agent/validation.js +7 -3
  13. package/src/developer-agent/workspace-inspection.js +51 -4
  14. package/src/executors/deployment-plan/deployment-plan.js +3 -0
  15. package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
  16. package/src/executors/dev-doctor/dev-doctor.js +136 -49
  17. package/src/executors/dev-setup/dev-setup.d.ts +18 -1
  18. package/src/executors/dev-setup/dev-setup.js +320 -196
  19. package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
  20. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
  21. package/src/executors/github-bootstrap/github-bootstrap.d.ts +3 -0
  22. package/src/executors/github-bootstrap/github-bootstrap.js +28 -0
  23. package/src/executors/github-bootstrap/schema.json +14 -0
  24. package/src/executors/infrastructure-plan/infrastructure-plan.js +10 -3
  25. package/src/executors/local-deploy/local-deploy.d.ts +15 -0
  26. package/src/executors/local-deploy/local-deploy.js +96 -14
  27. package/src/executors/sst-lifecycle/logging-preflight.js +12 -1
  28. package/src/executors/sst-lifecycle/run-sst-command.js +51 -5
  29. package/src/foundation/cost-estimate.js +1 -1
  30. package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
  31. package/src/foundation/identity-domain-parent-ready.js +333 -0
  32. package/src/foundation/identity-domain.d.ts +94 -0
  33. package/src/foundation/identity-domain.js +115 -0
  34. package/src/foundation/index.d.ts +2 -0
  35. package/src/foundation/index.js +7 -0
  36. package/src/foundation/preflight.js +17 -1
  37. package/src/foundation/root-site-readiness.d.ts +27 -0
  38. package/src/foundation/root-site-readiness.js +78 -0
  39. package/src/foundation/root-site.d.ts +81 -0
  40. package/src/foundation/root-site.js +268 -0
  41. package/src/generators/framework-prerequisites.d.ts +2 -0
  42. package/src/generators/framework-prerequisites.js +34 -0
  43. package/src/generators/function/function-registration.d.ts +24 -0
  44. package/src/generators/function/function-registration.js +66 -0
  45. package/src/generators/function/function.d.ts +16 -1
  46. package/src/generators/function/function.js +101 -18
  47. package/src/generators/function/schema.d.ts +1 -0
  48. package/src/generators/function/schema.json +6 -0
  49. package/src/generators/function-access/function-access.d.ts +14 -0
  50. package/src/generators/function-access/function-access.js +141 -0
  51. package/src/generators/function-access/schema.d.ts +6 -0
  52. package/src/generators/function-access/schema.json +25 -0
  53. package/src/generators/post-generation-install.d.ts +1 -1
  54. package/src/generators/post-generation-install.js +1 -1
  55. package/src/generators/preset/dependency-overrides.d.ts +1 -1
  56. package/src/generators/preset/dependency-overrides.js +1 -1
  57. package/src/generators/preset/workspace-files-adopter-skills.js +14 -0
  58. package/src/generators/preset/workspace-files-developer-agent.js +17 -11
  59. package/src/generators/preset/workspace-files-stage-authority.js +58 -1
  60. package/src/generators/preset/workspace-files-thin-deploy.d.ts +11 -0
  61. package/src/generators/preset/workspace-files-thin-deploy.js +52 -5
  62. package/src/generators/preset/workspace-files-thin-docs.js +33 -5
  63. package/src/generators/preset/workspace-files.js +238 -41
  64. package/src/generators/repository-policy/repository-policy.js +2 -1
  65. package/src/generators/repository-policy/schema.d.ts +2 -0
  66. package/src/generators/repository-policy/schema.json +7 -2
  67. package/src/generators/site/built-in-site-documentation-files.d.ts +2 -0
  68. package/src/generators/site/built-in-site-documentation-files.js +92 -0
  69. package/src/generators/site/built-in-site-files.d.ts +8 -0
  70. package/src/generators/site/built-in-site-files.js +40 -0
  71. package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -0
  72. package/src/generators/site/built-in-site-infrastructure-files.js +275 -0
  73. package/src/generators/site/built-in-site-plan.d.ts +19 -0
  74. package/src/generators/site/built-in-site-plan.js +65 -0
  75. package/src/generators/site/built-in-site-project-files.d.ts +3 -0
  76. package/src/generators/site/built-in-site-project-files.js +258 -0
  77. package/src/generators/site/built-in-site-script-files.d.ts +2 -0
  78. package/src/generators/site/built-in-site-script-files.js +306 -0
  79. package/src/generators/site/built-in-site-shared.d.ts +9 -0
  80. package/src/generators/site/built-in-site-shared.js +21 -0
  81. package/src/generators/site/built-in-site-smoke-files.d.ts +2 -0
  82. package/src/generators/site/built-in-site-smoke-files.js +37 -0
  83. package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -0
  84. package/src/generators/site/built-in-site-sst-config-files.js +39 -0
  85. package/src/generators/site/built-in-site-web-files.d.ts +2 -0
  86. package/src/generators/site/built-in-site-web-files.js +284 -0
  87. package/src/generators/site/schema.d.ts +4 -0
  88. package/src/generators/site/schema.json +20 -0
  89. package/src/generators/site/site.d.ts +13 -0
  90. package/src/generators/site/site.js +221 -0
  91. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +9 -0
  92. package/src/generators/slice/built-in-plan-alarm-identity.js +8 -1
  93. package/src/generators/slice/built-in-plan-api-contract-files.js +18 -0
  94. package/src/generators/slice/built-in-plan-async-work-files.js +18 -0
  95. package/src/generators/slice/built-in-plan-data-files.js +126 -14
  96. package/src/generators/slice/built-in-plan-foundation-files.d.ts +12 -0
  97. package/src/generators/slice/built-in-plan-foundation-files.js +114 -5
  98. package/src/generators/slice/built-in-plan-frontend-files.js +2 -271
  99. package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +6 -0
  100. package/src/generators/slice/built-in-plan-frontend-header-proof.js +282 -0
  101. package/src/generators/slice/built-in-plan-infrastructure-files.js +151 -237
  102. package/src/generators/slice/built-in-plan-key-value-cleanup.js +4 -3
  103. package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +29 -0
  104. package/src/generators/slice/built-in-plan-log-group-helpers.js +130 -0
  105. package/src/generators/slice/built-in-plan-metadata-files.js +25 -5
  106. package/src/generators/slice/built-in-plan-next-build-authority.d.ts +5 -0
  107. package/src/generators/slice/built-in-plan-next-build-authority.js +124 -0
  108. package/src/generators/slice/built-in-plan-operations-files.d.ts +6 -0
  109. package/src/generators/slice/built-in-plan-operations-files.js +107 -219
  110. package/src/generators/slice/built-in-plan-performance-files.js +6 -1
  111. package/src/generators/slice/built-in-plan-release-files.js +0 -1
  112. package/src/generators/slice/built-in-plan-reliability-files.js +12 -8
  113. package/src/generators/slice/built-in-plan-shared.d.ts +1 -1
  114. package/src/generators/slice/built-in-plan-shared.js +1 -1
  115. package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
  116. package/src/generators/slice/built-in-plan-sst-config.js +160 -0
  117. package/src/generators/slice/built-in-plan-testing-files.js +92 -49
  118. package/src/generators/slice/built-in-plan-verification-files.js +15 -5
  119. package/src/generators/slice/built-in-plan-web-files.js +69 -5
  120. package/src/generators/slice/built-in-plan.js +1 -2
  121. package/src/generators/slice/deployed-smoke-diagnostics.d.ts +35 -0
  122. package/src/generators/slice/deployed-smoke-diagnostics.js +189 -0
  123. package/src/generators/slice/deployed-smoke-readiness.d.ts +7 -0
  124. package/src/generators/slice/deployed-smoke-readiness.js +118 -23
  125. package/src/generators/slice/persistence-contract.js +2 -2
  126. package/src/generators/slice/pnpm-launch-script.d.ts +13 -0
  127. package/src/generators/slice/pnpm-launch-script.js +28 -0
  128. package/src/generators/slice/slice.js +27 -0
  129. package/src/generators/upgrade/custom-domain-notice.d.ts +19 -0
  130. package/src/generators/upgrade/custom-domain-notice.js +38 -0
  131. package/src/generators/upgrade/external-blueprint-compositions.d.ts +84 -0
  132. package/src/generators/upgrade/external-blueprint-compositions.js +478 -0
  133. package/src/generators/upgrade/framework-package-upgrade.d.ts +58 -0
  134. package/src/generators/upgrade/framework-package-upgrade.js +78 -0
  135. package/src/generators/upgrade/function-authentication-notice.d.ts +29 -0
  136. package/src/generators/upgrade/function-authentication-notice.js +74 -0
  137. package/src/generators/upgrade/schema.json +2 -2
  138. package/src/generators/upgrade/upgrade-plan.d.ts +52 -0
  139. package/src/generators/upgrade/upgrade-plan.js +406 -0
  140. package/src/generators/upgrade/upgrade.d.ts +1 -35
  141. package/src/generators/upgrade/upgrade.js +347 -595
  142. package/src/generators/workload/reliability-registration.d.ts +1 -1
  143. package/src/generators/workload/reliability-registration.js +9 -9
  144. package/src/generators/workload/workload.d.ts +1 -1
  145. package/src/generators/workload/workload.js +87 -13
  146. package/src/git-policy/github-bootstrap.d.ts +24 -5
  147. package/src/git-policy/github-bootstrap.js +105 -10
  148. package/src/local-dev/fleet-process.d.ts +9 -2
  149. package/src/local-dev/fleet-process.js +27 -7
  150. package/src/local-dev/fleet-session.js +41 -4
  151. package/src/local-dev/fleet-supervisor-daemon.js +1 -5
  152. package/src/local-dev/fleet-supervisor.d.ts +1 -0
  153. package/src/local-dev/fleet-supervisor.js +34 -11
  154. package/src/local-dev/gateway-daemon.d.ts +1 -1
  155. package/src/local-dev/gateway-daemon.js +6 -4
  156. package/src/local-dev/portless.d.ts +5 -0
  157. package/src/local-dev/portless.js +5 -0
  158. package/src/local-dev/process-group.d.ts +10 -0
  159. package/src/local-dev/process-group.js +33 -0
  160. package/src/local-dev/tls.js +31 -2
  161. package/src/local-dev/trust-store.d.ts +42 -0
  162. package/src/local-dev/trust-store.js +87 -0
  163. package/src/ownership/composition.d.ts +7 -0
  164. package/src/ownership/composition.js +64 -56
  165. package/src/ownership/index.d.ts +1 -0
  166. package/src/ownership/index.js +1 -0
  167. package/src/ownership/record.d.ts +19 -0
  168. package/src/ownership/record.js +26 -2
  169. package/src/ownership/site-record.d.ts +18 -0
  170. package/src/ownership/site-record.js +105 -0
  171. package/src/repository-policy/deployment-plan.d.ts +3 -0
  172. package/src/repository-policy/deployment-plan.js +33 -4
  173. package/src/repository-policy/index.d.ts +1 -0
  174. package/src/repository-policy/index.js +1 -0
  175. package/src/repository-policy/policy.d.ts +13 -1
  176. package/src/repository-policy/policy.js +55 -1
  177. package/src/repository-policy/public-dns.d.ts +65 -0
  178. package/src/repository-policy/public-dns.js +168 -0
  179. package/src/schemas/generated-ownership-v2.json +6 -0
  180. package/src/schemas/repository-policy-v1.json +67 -1
  181. package/src/supply-chain/blueprint-trust-git.js +24 -0
  182. package/src/supply-chain/blueprint-verification-authority.js +42 -3
  183. package/src/supply-chain/generated-blueprint-trust-command.js +15 -0
  184. package/src/supply-chain/sbom.js +74 -12
  185. package/src/work-markers/work-markers.js +4 -1
  186. package/src/workspace-deployment/ownership.d.ts +15 -0
  187. package/src/workspace-deployment/ownership.js +19 -3
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.windowsChainTrustCommand = windowsChainTrustCommand;
3
4
  exports.inspectCertificateTrust = inspectCertificateTrust;
4
5
  exports.inspectLocalDevelopment = inspectLocalDevelopment;
5
6
  const devkit_1 = require("@nx/devkit");
6
- const node_child_process_1 = require("node:child_process");
7
7
  const node_crypto_1 = require("node:crypto");
8
8
  const node_fs_1 = require("node:fs");
9
9
  const node_os_1 = require("node:os");
@@ -14,6 +14,7 @@ const gateway_js_1 = require("../../local-dev/gateway.js");
14
14
  const identity_js_1 = require("../../local-dev/identity.js");
15
15
  const personal_stage_js_1 = require("../../local-dev/personal-stage.js");
16
16
  const tls_js_1 = require("../../local-dev/tls.js");
17
+ const trust_store_js_1 = require("../../local-dev/trust-store.js");
17
18
  const INVALID_TLS_REMEDIATION = 'Run ebk dev setup --upgrade, inspect the generated root, then explicitly run ebk dev setup --trust.';
18
19
  function invalidTlsResult(hostname, resolver, issues, summary) {
19
20
  return {
@@ -27,49 +28,120 @@ function invalidTlsResult(hostname, resolver, issues, summary) {
27
28
  trust: 'missing',
28
29
  };
29
30
  }
30
- function inspectCertificateTrust(rootCertificatePath, intermediateCertificatePath, leafCertificatePath, hostname) {
31
+ // Builds the chain in the current user's CryptoAPI context, supplying the
32
+ // intermediate from its file, and requires the exact EBK root as the anchor.
33
+ // Paths and the expected thumbprint arrive through the environment, never by
34
+ // script interpolation. Hostname coverage is checked before this runs.
35
+ const WINDOWS_CHAIN_TRUST_SCRIPT = String.raw `
36
+ $ErrorActionPreference = 'Stop'
37
+ $leaf = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $env:EBK_TRUST_LEAF
38
+ $intermediate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $env:EBK_TRUST_INTERMEDIATE
39
+ $chain = New-Object System.Security.Cryptography.X509Certificates.X509Chain -ArgumentList $false
40
+ $chain.ChainPolicy.RevocationMode = [System.Security.Cryptography.X509Certificates.X509RevocationMode]::NoCheck
41
+ [void]$chain.ChainPolicy.ExtraStore.Add($intermediate)
42
+ [void]$chain.ChainPolicy.ApplicationPolicy.Add((New-Object System.Security.Cryptography.Oid -ArgumentList '1.3.6.1.5.5.7.3.1'))
43
+ $built = $chain.Build($leaf)
44
+ $anchor = $chain.ChainElements[$chain.ChainElements.Count - 1].Certificate.Thumbprint
45
+ $status = ($chain.ChainStatus | ForEach-Object { $_.Status.ToString() }) -join ','
46
+ if ($built -and $anchor -eq $env:EBK_TRUST_ROOT_SHA1) { 'EBK-TRUST ready' } else { "EBK-TRUST rejected $status" }
47
+ `;
48
+ // Windows PowerShell can take more than 15 seconds to load on a cold hosted
49
+ // session (see tls.ts); a check that cannot finish reports unknown.
50
+ const WINDOWS_TRUST_TIMEOUT_MS = 45_000;
51
+ function windowsChainTrustCommand(environment = process.env) {
52
+ return {
53
+ args: [
54
+ '-NoLogo',
55
+ '-NoProfile',
56
+ '-NonInteractive',
57
+ '-EncodedCommand',
58
+ Buffer.from(WINDOWS_CHAIN_TRUST_SCRIPT, 'utf16le').toString('base64'),
59
+ ],
60
+ command: node_path_1.win32.join(environment.SystemRoot ?? 'C:\\Windows', 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe'),
61
+ };
62
+ }
63
+ function lastOutputLine(output) {
64
+ return output.trim().split(/\r?\n/u).at(-1)?.trim() ?? '';
65
+ }
66
+ /**
67
+ * Effect-based system trust check for the generated chain. Certificate
68
+ * presence alone never reports `ready`.
69
+ */
70
+ function inspectCertificateTrust(rootCertificatePath, intermediateCertificatePath, leafCertificatePath, hostname, inspection = {}) {
71
+ const targetPlatform = inspection.platform ?? (0, node_os_1.platform)();
72
+ const run = inspection.run ?? trust_store_js_1.runTrustCommand;
31
73
  try {
32
- if ((0, node_os_1.platform)() === 'darwin') {
33
- (0, node_child_process_1.execFileSync)('security', [
34
- 'verify-cert',
35
- '-L',
36
- '-q',
37
- '-c',
38
- leafCertificatePath,
39
- '-c',
40
- intermediateCertificatePath,
41
- '-p',
42
- 'ssl',
43
- '-n',
44
- hostname,
45
- ], { stdio: 'pipe' });
46
- return 'ready';
74
+ if (targetPlatform === 'darwin') {
75
+ const verified = run('security', (0, trust_store_js_1.macosVerifyCertArguments)(leafCertificatePath, intermediateCertificatePath, hostname));
76
+ if ((0, trust_store_js_1.trustCommandSucceeded)(verified))
77
+ return 'ready';
78
+ return verified.error ? 'unknown' : 'missing';
47
79
  }
48
- const expected = new node_crypto_1.X509Certificate((0, node_fs_1.readFileSync)(rootCertificatePath))
49
- .fingerprint256;
50
- if ((0, node_os_1.platform)() === 'win32') {
51
- (0, node_child_process_1.execFileSync)('certutil', [
52
- '-user',
53
- '-store',
54
- 'Root',
55
- new node_crypto_1.X509Certificate((0, node_fs_1.readFileSync)(rootCertificatePath)).fingerprint.replace(/:/g, ''),
56
- ], { stdio: 'pipe' });
57
- return 'ready';
80
+ if (targetPlatform === 'win32') {
81
+ const environment = inspection.environment ?? process.env;
82
+ const { args, command } = windowsChainTrustCommand(environment);
83
+ const verified = run(command, args, {
84
+ env: {
85
+ ...environment,
86
+ EBK_TRUST_INTERMEDIATE: intermediateCertificatePath,
87
+ EBK_TRUST_LEAF: leafCertificatePath,
88
+ EBK_TRUST_ROOT_SHA1: (0, trust_store_js_1.certificateSha1)(rootCertificatePath),
89
+ },
90
+ timeoutMs: WINDOWS_TRUST_TIMEOUT_MS,
91
+ });
92
+ if (!(0, trust_store_js_1.trustCommandSucceeded)(verified))
93
+ return 'unknown';
94
+ const verdict = lastOutputLine(verified.stdout);
95
+ if (verdict === 'EBK-TRUST ready')
96
+ return 'ready';
97
+ return verdict.startsWith('EBK-TRUST rejected') ? 'missing' : 'unknown';
58
98
  }
59
- const pem = (0, node_child_process_1.execFileSync)('certutil', [
99
+ // Linux and other Unix desktops: the NSS database Chromium reads.
100
+ const database = (0, trust_store_js_1.chromiumNssDatabase)(inspection.homeDirectory ?? (0, node_os_1.homedir)(), inspection.pathExists ?? node_fs_1.existsSync);
101
+ if (!(inspection.pathExists ?? node_fs_1.existsSync)(database))
102
+ return 'missing';
103
+ const listed = run('certutil', [
60
104
  '-L',
61
105
  '-d',
62
- `sql:${(0, node_path_1.join)((0, node_os_1.homedir)(), '.pki', 'nssdb')}`,
106
+ `sql:${database}`,
63
107
  '-n',
64
- 'Empire Builder Kit Local Root',
108
+ trust_store_js_1.EBK_LOCAL_ROOT_LABEL,
65
109
  '-a',
66
- ], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
67
- return new node_crypto_1.X509Certificate(pem).fingerprint256 === expected
68
- ? 'ready'
69
- : 'missing';
110
+ ]);
111
+ if ((0, trust_store_js_1.trustCommandMissing)(listed))
112
+ return 'unknown';
113
+ if (!(0, trust_store_js_1.trustCommandSucceeded)(listed)) {
114
+ return /could not find/iu.test(`${listed.stdout}\n${listed.stderr}`)
115
+ ? 'missing'
116
+ : 'unknown';
117
+ }
118
+ const expected = new node_crypto_1.X509Certificate((0, node_fs_1.readFileSync)(rootCertificatePath))
119
+ .fingerprint256;
120
+ if (new node_crypto_1.X509Certificate(listed.stdout).fingerprint256 !== expected) {
121
+ return 'missing';
122
+ }
123
+ // The exact root must validate as a trusted TLS issuing CA (the C trust
124
+ // flag) in that database, not merely be stored there.
125
+ const verified = run('certutil', [
126
+ '-V',
127
+ '-d',
128
+ `sql:${database}`,
129
+ '-n',
130
+ trust_store_js_1.EBK_LOCAL_ROOT_LABEL,
131
+ '-u',
132
+ 'L',
133
+ ]);
134
+ const output = `${verified.stdout}\n${verified.stderr}`;
135
+ if ((0, trust_store_js_1.trustCommandSucceeded)(verified) &&
136
+ /certificate is valid/iu.test(output)) {
137
+ return 'ready';
138
+ }
139
+ return !verified.error && /certificate is invalid/iu.test(output)
140
+ ? 'missing'
141
+ : 'unknown';
70
142
  }
71
143
  catch {
72
- return 'missing';
144
+ return 'unknown';
73
145
  }
74
146
  }
75
147
  function packageVersion() {
@@ -169,9 +241,12 @@ async function inspectLocalDevelopment(options, context, dependencies = {}) {
169
241
  issues.push(`Supported explicit-port TLS effect probe failed: ${error instanceof Error ? error.message : String(error)}`);
170
242
  }
171
243
  }
172
- if (trust !== 'ready') {
244
+ if (trust === 'missing') {
173
245
  issues.push('System trust is not installed. Use the generated verify-local-browser target for browser-scoped trust; human browsers may require explicit ebk dev setup --trust after reviewing the root.');
174
246
  }
247
+ else if (trust === 'unknown') {
248
+ issues.push('System trust could not be verified: the platform trust check is unavailable or returned an unrecognized result (on Linux, install the NSS tools that provide certutil). Doctor never reports trust ready from certificate presence. Use the generated verify-local-browser target for browser-scoped trust.');
249
+ }
175
250
  let state;
176
251
  if ((0, node_fs_1.existsSync)(paths.gatewayState)) {
177
252
  try {
@@ -181,23 +256,32 @@ async function inspectLocalDevelopment(options, context, dependencies = {}) {
181
256
  issues.push(`Gateway state is invalid JSON: ${error instanceof Error ? error.message : String(error)}`);
182
257
  }
183
258
  }
184
- let gateway = 'missing';
259
+ // The machine gateway exists only for recorded portless intent; plain
260
+ // setup starts none, so its absence is not a degraded state.
261
+ let gateway = state?.portless
262
+ ? 'missing'
263
+ : 'not-configured';
185
264
  const send = dependencies.send ?? gateway_js_1.sendGatewayCommand;
186
265
  const capability = (0, node_fs_1.readFileSync)(paths.capability, 'utf8').trim();
187
- try {
188
- const status = await send(paths.gatewaySocket, {
189
- action: 'status',
190
- capability,
191
- });
192
- if (status.protocolVersion !== contracts_js_1.GATEWAY_PROTOCOL_VERSION) {
193
- issues.push(`Machine gateway protocol ${status.protocolVersion} does not match ${contracts_js_1.GATEWAY_PROTOCOL_VERSION}.`);
266
+ if (state?.portless) {
267
+ try {
268
+ const status = await send(paths.gatewaySocket, {
269
+ action: 'status',
270
+ capability,
271
+ });
272
+ if (status.protocolVersion !== contracts_js_1.GATEWAY_PROTOCOL_VERSION) {
273
+ issues.push(`Machine gateway protocol ${status.protocolVersion} does not match ${contracts_js_1.GATEWAY_PROTOCOL_VERSION}.`);
274
+ }
275
+ else {
276
+ gateway = 'ready';
277
+ }
194
278
  }
195
- else {
196
- gateway = 'ready';
279
+ catch (error) {
280
+ issues.push(`Machine gateway status probe failed: ${error instanceof Error ? error.message : String(error)}`);
197
281
  }
198
282
  }
199
- catch (error) {
200
- issues.push(`Machine gateway status probe failed: ${error instanceof Error ? error.message : String(error)}`);
283
+ else if ((0, node_fs_1.existsSync)(paths.gatewayPid)) {
284
+ issues.push('An earlier ebk dev setup recorded a machine gateway process that no fleet uses without --portless. Rerun ebk dev setup to stop it.');
201
285
  }
202
286
  let portless = state?.portless
203
287
  ? 'unreachable'
@@ -280,11 +364,14 @@ const executor = async (options, context) => {
280
364
  devkit_1.logger.warn('Run dev-setup, inspect the generated root, then explicitly rerun with --trust.');
281
365
  }
282
366
  if (result.gateway === 'missing') {
283
- devkit_1.logger.warn('The optional machine gateway is unavailable. Rerun dev-setup before testing experimental portless mode.');
367
+ devkit_1.logger.warn('Portless intent is recorded but the optional machine gateway is unavailable. Rerun dev-setup --upgrade --trust --portless before testing experimental portless mode.');
284
368
  }
285
369
  if (result.trust === 'missing') {
286
370
  devkit_1.logger.warn('The EBK root is not trusted in the detected user/browser trust store. Review it and run dev-setup --trust explicitly.');
287
371
  }
372
+ if (result.trust === 'unknown') {
373
+ devkit_1.logger.warn('EBK could not run an effect-based trust check on this host, so trust is reported unknown rather than ready. Review the reported issue.');
374
+ }
288
375
  if (result.connectivity === 'missing') {
289
376
  devkit_1.logger.warn('The supported explicit-port TLS path did not complete a live trusted handshake. Review the reported effect-probe issue before starting a fleet.');
290
377
  }
@@ -1,4 +1,7 @@
1
1
  import { type PromiseExecutor } from '@nx/devkit';
2
+ import { sendGatewayCommand } from '../../local-dev/gateway.js';
3
+ import { type PrivilegedCommand } from '../../local-dev/portless.js';
4
+ import { type TrustCommandRunner } from '../../local-dev/trust-store.js';
2
5
  export interface DevSetupOptions {
3
6
  appData?: string;
4
7
  hostSuffix?: string;
@@ -7,7 +10,21 @@ export interface DevSetupOptions {
7
10
  trust?: boolean;
8
11
  upgrade?: boolean;
9
12
  }
10
- export declare function applyDevSetup(options: DevSetupOptions): Promise<{
13
+ /**
14
+ * Host seams. Production uses the defaults; unit proofs inject them so no
15
+ * trust store, packet filter, privileged port or daemon is touched.
16
+ */
17
+ export interface DevSetupDependencies {
18
+ applyPrivileged?: (commands: readonly PrivilegedCommand[]) => void;
19
+ gatewayIsRunning?: (pidPath: string) => boolean;
20
+ homeDirectory?: string;
21
+ platform?: NodeJS.Platform;
22
+ run?: TrustCommandRunner;
23
+ send?: typeof sendGatewayCommand;
24
+ startGateway?: (appData: string, internalPort: number) => Promise<void>;
25
+ stopGateway?: (pidPath: string) => void;
26
+ }
27
+ export declare function applyDevSetup(options: DevSetupOptions, dependencies?: DevSetupDependencies): Promise<{
11
28
  success: true;
12
29
  }>;
13
30
  export declare function runDevSetup(options: DevSetupOptions): Promise<{