blun-king-cli 9.1.643 → 9.1.644

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 (266) hide show
  1. package/LIESMICH.txt +18 -0
  2. package/README.md +20 -6
  3. package/bin/blun.js +3 -3
  4. package/bin/king.js +3 -3
  5. package/bin/launcher-mode.js +125 -126
  6. package/bin/launcher-runtime.js +603 -616
  7. package/bin/plugin-bootstrap.js +339 -405
  8. package/bin/rename-private-staging.cjs +2 -2
  9. package/bin/retired-bundled-plugins.cjs +84 -0
  10. package/bin/startup-security-host.cjs +105 -0
  11. package/bin/startup-security.cjs +9 -105
  12. package/bin/startup-warning-policy.cjs +22 -0
  13. package/bin/update-lease-installer.cjs +125 -0
  14. package/bin/update-lease-sockets.cjs +228 -0
  15. package/bin/update-lease.js +22 -327
  16. package/bin/verify-bundled-agent-sources.cjs +2 -4
  17. package/blun.mjs +18 -179
  18. package/bundled-agent-sources.json +1 -552
  19. package/package.json +1 -5
  20. package/tool-liveness642/receipt.json +1 -1
  21. package/worker-host.mjs +3 -119
  22. package/agent-spine-plugin/.claude-plugin/marketplace.json +0 -20
  23. package/agent-spine-plugin/.claude-plugin/plugin.json +0 -14
  24. package/agent-spine-plugin/.codex-plugin/plugin.json +0 -47
  25. package/agent-spine-plugin/.mcp.json +0 -8
  26. package/agent-spine-plugin/CHANGELOG.md +0 -1614
  27. package/agent-spine-plugin/LICENSE +0 -186
  28. package/agent-spine-plugin/README.md +0 -432
  29. package/agent-spine-plugin/assets/agentspine-banner.svg +0 -32
  30. package/agent-spine-plugin/bin/agentspine-mcp.js +0 -4
  31. package/agent-spine-plugin/bin/agentspine.js +0 -7
  32. package/agent-spine-plugin/blun.plugin.json +0 -68
  33. package/agent-spine-plugin/docs/acceptance.md +0 -61
  34. package/agent-spine-plugin/docs/artifact-evaluation.md +0 -93
  35. package/agent-spine-plugin/docs/host-integration.md +0 -193
  36. package/agent-spine-plugin/docs/preflight-recall.md +0 -71
  37. package/agent-spine-plugin/docs/preservation-contract.md +0 -53
  38. package/agent-spine-plugin/docs/quality-gates.md +0 -50
  39. package/agent-spine-plugin/docs/session-timeline.md +0 -112
  40. package/agent-spine-plugin/docs/source-roots.md +0 -113
  41. package/agent-spine-plugin/docs/world-model.md +0 -119
  42. package/agent-spine-plugin/hooks/codex.json +0 -47
  43. package/agent-spine-plugin/hooks/hooks.json +0 -106
  44. package/agent-spine-plugin/hooks/version.json +0 -5
  45. package/agent-spine-plugin/package.json +0 -77
  46. package/agent-spine-plugin/scripts/check-codex-install.js +0 -226
  47. package/agent-spine-plugin/scripts/check-hosts.js +0 -208
  48. package/agent-spine-plugin/scripts/check-install-hook.js +0 -227
  49. package/agent-spine-plugin/scripts/check-install-selfstarter.js +0 -154
  50. package/agent-spine-plugin/scripts/check-install.js +0 -478
  51. package/agent-spine-plugin/scripts/check-line-budget.js +0 -58
  52. package/agent-spine-plugin/scripts/check-syntax.js +0 -29
  53. package/agent-spine-plugin/scripts/github-actions.js +0 -11
  54. package/agent-spine-plugin/scripts/hermetic-process.js +0 -191
  55. package/agent-spine-plugin/scripts/release-check.js +0 -150
  56. package/agent-spine-plugin/scripts/run-acceptance.js +0 -19
  57. package/agent-spine-plugin/scripts/run-checks.js +0 -50
  58. package/agent-spine-plugin/scripts/run-tests-hermetic.js +0 -112
  59. package/agent-spine-plugin/skills/agent-spine/SKILL.md +0 -99
  60. package/agent-spine-plugin/spine-example/1-identity.md +0 -12
  61. package/agent-spine-plugin/spine-example/2-voice.md +0 -6
  62. package/agent-spine-plugin/spine-example/3-conduct.md +0 -8
  63. package/agent-spine-plugin/spine-example/4-history.md +0 -4
  64. package/agent-spine-plugin/src/cli-agent.js +0 -315
  65. package/agent-spine-plugin/src/cli-attention.js +0 -95
  66. package/agent-spine-plugin/src/cli-autonomy.js +0 -36
  67. package/agent-spine-plugin/src/cli-common.js +0 -71
  68. package/agent-spine-plugin/src/cli-continuity.js +0 -116
  69. package/agent-spine-plugin/src/cli-core.js +0 -128
  70. package/agent-spine-plugin/src/cli-diagnostics.js +0 -291
  71. package/agent-spine-plugin/src/cli-host.js +0 -21
  72. package/agent-spine-plugin/src/cli-learning.js +0 -320
  73. package/agent-spine-plugin/src/cli-premortem.js +0 -16
  74. package/agent-spine-plugin/src/cli-sharing.js +0 -230
  75. package/agent-spine-plugin/src/cli.js +0 -181
  76. package/agent-spine-plugin/src/codex-reader-launcher.js +0 -182
  77. package/agent-spine-plugin/src/hook.js +0 -500
  78. package/agent-spine-plugin/src/index.js +0 -108
  79. package/agent-spine-plugin/src/lib/acceptance.js +0 -435
  80. package/agent-spine-plugin/src/lib/action-lesson-recall.js +0 -118
  81. package/agent-spine-plugin/src/lib/attention-context.js +0 -167
  82. package/agent-spine-plugin/src/lib/attention-events.js +0 -113
  83. package/agent-spine-plugin/src/lib/attention-privacy.js +0 -72
  84. package/agent-spine-plugin/src/lib/attention-schema.js +0 -164
  85. package/agent-spine-plugin/src/lib/attention-storage.js +0 -93
  86. package/agent-spine-plugin/src/lib/attention.js +0 -164
  87. package/agent-spine-plugin/src/lib/audit-premortem.js +0 -223
  88. package/agent-spine-plugin/src/lib/audit.js +0 -401
  89. package/agent-spine-plugin/src/lib/authentication.js +0 -515
  90. package/agent-spine-plugin/src/lib/autonomy-policy.js +0 -110
  91. package/agent-spine-plugin/src/lib/autonomy-store.js +0 -202
  92. package/agent-spine-plugin/src/lib/autonomy.js +0 -8
  93. package/agent-spine-plugin/src/lib/briefing.js +0 -493
  94. package/agent-spine-plugin/src/lib/catalog-document-read.js +0 -51
  95. package/agent-spine-plugin/src/lib/catalog.js +0 -167
  96. package/agent-spine-plugin/src/lib/channel-continuity.js +0 -19
  97. package/agent-spine-plugin/src/lib/channel-runtime.js +0 -665
  98. package/agent-spine-plugin/src/lib/codex-installation.js +0 -231
  99. package/agent-spine-plugin/src/lib/codex-skill-installation.js +0 -211
  100. package/agent-spine-plugin/src/lib/context.js +0 -156
  101. package/agent-spine-plugin/src/lib/continuity.js +0 -338
  102. package/agent-spine-plugin/src/lib/coordination.js +0 -577
  103. package/agent-spine-plugin/src/lib/delivery-agent-usage.js +0 -231
  104. package/agent-spine-plugin/src/lib/delivery-assignment.js +0 -220
  105. package/agent-spine-plugin/src/lib/delivery-command-actions.js +0 -462
  106. package/agent-spine-plugin/src/lib/delivery-knowledge.js +0 -78
  107. package/agent-spine-plugin/src/lib/delivery-premortem-binding.js +0 -107
  108. package/agent-spine-plugin/src/lib/delivery-premortem-closure.js +0 -171
  109. package/agent-spine-plugin/src/lib/delivery-premortem-codec.js +0 -45
  110. package/agent-spine-plugin/src/lib/delivery-premortem-correction.js +0 -101
  111. package/agent-spine-plugin/src/lib/delivery-premortem-file.js +0 -21
  112. package/agent-spine-plugin/src/lib/delivery-premortem-index.js +0 -493
  113. package/agent-spine-plugin/src/lib/delivery-premortem-inspection.js +0 -37
  114. package/agent-spine-plugin/src/lib/delivery-premortem-recovery.js +0 -120
  115. package/agent-spine-plugin/src/lib/delivery-premortem-rejection.js +0 -65
  116. package/agent-spine-plugin/src/lib/delivery-premortem-results.js +0 -28
  117. package/agent-spine-plugin/src/lib/delivery-premortem-session-guard.js +0 -46
  118. package/agent-spine-plugin/src/lib/delivery-premortem-write-ledger.js +0 -285
  119. package/agent-spine-plugin/src/lib/delivery-premortem.js +0 -499
  120. package/agent-spine-plugin/src/lib/delivery-shell-heredoc.js +0 -115
  121. package/agent-spine-plugin/src/lib/delivery-shell-substitutions.js +0 -111
  122. package/agent-spine-plugin/src/lib/delivery-shell-wrapper.js +0 -64
  123. package/agent-spine-plugin/src/lib/delivery-target.js +0 -73
  124. package/agent-spine-plugin/src/lib/delivery-verification.js +0 -445
  125. package/agent-spine-plugin/src/lib/documents.js +0 -239
  126. package/agent-spine-plugin/src/lib/feed-transport.js +0 -499
  127. package/agent-spine-plugin/src/lib/filesystem-retry.js +0 -34
  128. package/agent-spine-plugin/src/lib/gateway-common.js +0 -68
  129. package/agent-spine-plugin/src/lib/gateway-control.js +0 -370
  130. package/agent-spine-plugin/src/lib/gateway-delivery.js +0 -103
  131. package/agent-spine-plugin/src/lib/gateway-execution.js +0 -350
  132. package/agent-spine-plugin/src/lib/gateway-group-response.js +0 -128
  133. package/agent-spine-plugin/src/lib/gateway-host-fencing.js +0 -92
  134. package/agent-spine-plugin/src/lib/gateway-host-lifecycle.js +0 -193
  135. package/agent-spine-plugin/src/lib/gateway-inspection.js +0 -85
  136. package/agent-spine-plugin/src/lib/gateway-knowledge.js +0 -129
  137. package/agent-spine-plugin/src/lib/gateway-policy-provenance.js +0 -197
  138. package/agent-spine-plugin/src/lib/gateway-premortem-disposition.js +0 -82
  139. package/agent-spine-plugin/src/lib/gateway-premortem.js +0 -363
  140. package/agent-spine-plugin/src/lib/gateway-prepared-host.js +0 -28
  141. package/agent-spine-plugin/src/lib/gateway-runs.js +0 -345
  142. package/agent-spine-plugin/src/lib/gateway-runtime-identity.js +0 -31
  143. package/agent-spine-plugin/src/lib/gateway-runtime-records.js +0 -21
  144. package/agent-spine-plugin/src/lib/gateway-runtime.js +0 -18
  145. package/agent-spine-plugin/src/lib/gateway-state-transaction.js +0 -356
  146. package/agent-spine-plugin/src/lib/gateway-state.js +0 -344
  147. package/agent-spine-plugin/src/lib/graph.js +0 -337
  148. package/agent-spine-plugin/src/lib/hook-artifact-guards.js +0 -356
  149. package/agent-spine-plugin/src/lib/hook-audit.js +0 -43
  150. package/agent-spine-plugin/src/lib/hook-briefing-use.js +0 -78
  151. package/agent-spine-plugin/src/lib/hook-context.js +0 -441
  152. package/agent-spine-plugin/src/lib/hook-final-message.js +0 -26
  153. package/agent-spine-plugin/src/lib/hook-input.js +0 -27
  154. package/agent-spine-plugin/src/lib/hook-output.js +0 -284
  155. package/agent-spine-plugin/src/lib/hook-premortem.js +0 -257
  156. package/agent-spine-plugin/src/lib/hook-process-advisory.js +0 -36
  157. package/agent-spine-plugin/src/lib/hook-protection.js +0 -95
  158. package/agent-spine-plugin/src/lib/hook-stop-verification.js +0 -84
  159. package/agent-spine-plugin/src/lib/hook-timeline.js +0 -102
  160. package/agent-spine-plugin/src/lib/host-instruction-budget.js +0 -11
  161. package/agent-spine-plugin/src/lib/https-transport.js +0 -392
  162. package/agent-spine-plugin/src/lib/identifier-analysis.js +0 -446
  163. package/agent-spine-plugin/src/lib/indexed-memory-offline.js +0 -40
  164. package/agent-spine-plugin/src/lib/indexed-memory.js +0 -298
  165. package/agent-spine-plugin/src/lib/knowledge-evidence.js +0 -431
  166. package/agent-spine-plugin/src/lib/learning-applications.js +0 -441
  167. package/agent-spine-plugin/src/lib/learning-artifact-evaluator.js +0 -114
  168. package/agent-spine-plugin/src/lib/learning-candidates.js +0 -274
  169. package/agent-spine-plugin/src/lib/learning-context.js +0 -137
  170. package/agent-spine-plugin/src/lib/learning-delivery-contracts.js +0 -310
  171. package/agent-spine-plugin/src/lib/learning-evaluation-contracts.js +0 -350
  172. package/agent-spine-plugin/src/lib/learning-evaluation-registration.js +0 -372
  173. package/agent-spine-plugin/src/lib/learning-evaluation-revocation.js +0 -292
  174. package/agent-spine-plugin/src/lib/learning-evidence-contracts.js +0 -321
  175. package/agent-spine-plugin/src/lib/learning-findings.js +0 -458
  176. package/agent-spine-plugin/src/lib/learning-measurement-contracts.js +0 -285
  177. package/agent-spine-plugin/src/lib/learning-measurements.js +0 -265
  178. package/agent-spine-plugin/src/lib/learning-outcome-contracts.js +0 -165
  179. package/agent-spine-plugin/src/lib/learning-outcomes.js +0 -343
  180. package/agent-spine-plugin/src/lib/learning-reconciliation.js +0 -290
  181. package/agent-spine-plugin/src/lib/learning-retry-contracts.js +0 -188
  182. package/agent-spine-plugin/src/lib/learning-schema.js +0 -229
  183. package/agent-spine-plugin/src/lib/learning-scope-targets.js +0 -424
  184. package/agent-spine-plugin/src/lib/learning-state-upgrade.js +0 -477
  185. package/agent-spine-plugin/src/lib/learning-status-configuration.js +0 -476
  186. package/agent-spine-plugin/src/lib/learning-storage.js +0 -203
  187. package/agent-spine-plugin/src/lib/learning-trial-recovery.js +0 -218
  188. package/agent-spine-plugin/src/lib/learning-validation-contracts.js +0 -375
  189. package/agent-spine-plugin/src/lib/learning-validation-renewal.js +0 -298
  190. package/agent-spine-plugin/src/lib/learning-validation-runtime.js +0 -234
  191. package/agent-spine-plugin/src/lib/learning.js +0 -36
  192. package/agent-spine-plugin/src/lib/lesson-recall-session.js +0 -172
  193. package/agent-spine-plugin/src/lib/mcp-autonomy-tools.js +0 -37
  194. package/agent-spine-plugin/src/lib/mcp-delivery-completion.js +0 -124
  195. package/agent-spine-plugin/src/lib/mcp-delivery-tools.js +0 -45
  196. package/agent-spine-plugin/src/lib/mcp-premortem.js +0 -68
  197. package/agent-spine-plugin/src/lib/mcp-runtime.js +0 -355
  198. package/agent-spine-plugin/src/lib/mcp-source-context.js +0 -61
  199. package/agent-spine-plugin/src/lib/mcp-timeline-tools.js +0 -240
  200. package/agent-spine-plugin/src/lib/mcp-world-tools.js +0 -52
  201. package/agent-spine-plugin/src/lib/object-transport.js +0 -206
  202. package/agent-spine-plugin/src/lib/owned-file-lock.js +0 -182
  203. package/agent-spine-plugin/src/lib/paths.js +0 -109
  204. package/agent-spine-plugin/src/lib/peer-transport.js +0 -283
  205. package/agent-spine-plugin/src/lib/persona-runtime.js +0 -581
  206. package/agent-spine-plugin/src/lib/pre-answer-timeline-recall.js +0 -104
  207. package/agent-spine-plugin/src/lib/preflight-delivery-id.js +0 -27
  208. package/agent-spine-plugin/src/lib/preflight.js +0 -688
  209. package/agent-spine-plugin/src/lib/project-portfolio.js +0 -176
  210. package/agent-spine-plugin/src/lib/runtime.js +0 -13
  211. package/agent-spine-plugin/src/lib/selfstarter-core.js +0 -382
  212. package/agent-spine-plugin/src/lib/selfstarter-jobs.js +0 -149
  213. package/agent-spine-plugin/src/lib/selfstarter-lease.js +0 -204
  214. package/agent-spine-plugin/src/lib/selfstarter-policy.js +0 -90
  215. package/agent-spine-plugin/src/lib/selfstarter-workspace.js +0 -111
  216. package/agent-spine-plugin/src/lib/selfstarter.js +0 -11
  217. package/agent-spine-plugin/src/lib/session-timeline-auth.js +0 -316
  218. package/agent-spine-plugin/src/lib/session-timeline-codex.js +0 -69
  219. package/agent-spine-plugin/src/lib/session-timeline-contract.js +0 -56
  220. package/agent-spine-plugin/src/lib/session-timeline-enrollment-source.js +0 -38
  221. package/agent-spine-plugin/src/lib/session-timeline-enrollment-storage.js +0 -128
  222. package/agent-spine-plugin/src/lib/session-timeline-enrollment-transport.js +0 -15
  223. package/agent-spine-plugin/src/lib/session-timeline-enrollment.js +0 -478
  224. package/agent-spine-plugin/src/lib/session-timeline-event-extract.js +0 -186
  225. package/agent-spine-plugin/src/lib/session-timeline-host-origin.js +0 -73
  226. package/agent-spine-plugin/src/lib/session-timeline-host-receipt.js +0 -117
  227. package/agent-spine-plugin/src/lib/session-timeline-invocation.js +0 -201
  228. package/agent-spine-plugin/src/lib/session-timeline-king.js +0 -93
  229. package/agent-spine-plugin/src/lib/session-timeline-prior.js +0 -57
  230. package/agent-spine-plugin/src/lib/session-timeline-provider.js +0 -36
  231. package/agent-spine-plugin/src/lib/session-timeline-query.js +0 -56
  232. package/agent-spine-plugin/src/lib/session-timeline-results.js +0 -56
  233. package/agent-spine-plugin/src/lib/session-timeline-root.js +0 -11
  234. package/agent-spine-plugin/src/lib/session-timeline-search.js +0 -82
  235. package/agent-spine-plugin/src/lib/session-timeline-sid-acl.js +0 -213
  236. package/agent-spine-plugin/src/lib/session-timeline-source-open.js +0 -30
  237. package/agent-spine-plugin/src/lib/session-timeline-source.js +0 -80
  238. package/agent-spine-plugin/src/lib/session-timeline-state.js +0 -45
  239. package/agent-spine-plugin/src/lib/session-timeline-transport.js +0 -42
  240. package/agent-spine-plugin/src/lib/session-timeline-windows-acl.js +0 -145
  241. package/agent-spine-plugin/src/lib/session-timeline.js +0 -462
  242. package/agent-spine-plugin/src/lib/sharing.js +0 -969
  243. package/agent-spine-plugin/src/lib/source-roots.js +0 -475
  244. package/agent-spine-plugin/src/lib/source-tree-scan.js +0 -178
  245. package/agent-spine-plugin/src/lib/sqlite-transport.js +0 -501
  246. package/agent-spine-plugin/src/lib/task-knowledge-context.js +0 -99
  247. package/agent-spine-plugin/src/lib/telegram-adapter.js +0 -119
  248. package/agent-spine-plugin/src/lib/timeline-continuation-update.js +0 -100
  249. package/agent-spine-plugin/src/lib/timeline-tool-guard.js +0 -225
  250. package/agent-spine-plugin/src/lib/timeline-user-feedback.js +0 -216
  251. package/agent-spine-plugin/src/lib/timeline-world-capture.js +0 -233
  252. package/agent-spine-plugin/src/lib/voice-runtime.js +0 -39
  253. package/agent-spine-plugin/src/lib/world-knowledge.js +0 -306
  254. package/agent-spine-plugin/src/lib/world-model.js +0 -333
  255. package/agent-spine-plugin/src/mcp.js +0 -456
  256. package/agent-spine-plugin/src/version.js +0 -1
  257. package/agent-spine-plugin/src/worker.js +0 -257
  258. package/bin/agentspine-king-goal-inbox.mjs +0 -127
  259. package/bin/agentspine-king-goal-intake.mjs +0 -106
  260. package/bin/agentspine-king-host-runner.mjs +0 -109
  261. package/bin/agentspine-king-snapshot-policy.cjs +0 -80
  262. package/bin/agentspine-king-status-policy.mjs +0 -226
  263. package/bin/agentspine-king-worker-host.mjs +0 -160
  264. package/bin/managed-plugin-selection.cjs +0 -141
  265. package/bin/verify-agent-behavior.cjs +0 -122
  266. package/bin/verify-agent-components.cjs +0 -104
@@ -0,0 +1,228 @@
1
+ 'use strict';
2
+
3
+ const { createHash } = require('node:crypto');
4
+ const fs = require('node:fs');
5
+ const net = require('node:net');
6
+ const os = require('node:os');
7
+ const path = require('node:path');
8
+
9
+ const LEASE_PROTOCOL_VERSION = 'BLUN_UPDATE_LEASE_V3';
10
+ const LEASE_PROBE_TIMEOUT_MS = 500;
11
+ const MAX_POSIX_SOCKET_PATH_BYTES = 96;
12
+ const LEASE_CONNECTIONS = Symbol('blunLeaseConnections');
13
+
14
+ function canonicalPackageIdentity(packageRoot, options = {}) {
15
+ if (typeof packageRoot !== 'string' || packageRoot.trim().length === 0) {
16
+ throw new Error('UPDATE_PACKAGE_ROOT_REQUIRED');
17
+ }
18
+ const fsImpl = options.fsImpl || fs;
19
+ const platform = options.platform || process.platform;
20
+ const realpath = fsImpl.realpathSync.native || fsImpl.realpathSync;
21
+ let canonical = realpath(path.resolve(packageRoot));
22
+ if (!fsImpl.statSync(canonical).isDirectory()) throw new Error('INVALID_UPDATE_PACKAGE_ROOT');
23
+ canonical = canonical.replaceAll('\\', '/');
24
+ if (platform === 'win32') canonical = canonical.toLowerCase();
25
+ return canonical;
26
+ }
27
+
28
+ function deriveUpdateLeaseEndpoint(packageRoot, options = {}) {
29
+ const platform = options.platform || process.platform;
30
+ const role = options.role === 'install'
31
+ ? 'install'
32
+ : options.role === 'runtime'
33
+ ? 'runtime'
34
+ : 'notice';
35
+ const identity = canonicalPackageIdentity(packageRoot, options);
36
+ const digest = createHash('sha256')
37
+ .update(`blun-update-v3\0${role}\0${identity}`)
38
+ .digest('hex');
39
+ const magic = `${LEASE_PROTOCOL_VERSION} ${digest}\n`;
40
+ if (platform === 'win32') {
41
+ return Object.freeze({
42
+ magic,
43
+ path: `\\\\.\\pipe\\blun-update-v3-${digest.slice(0, 32)}`,
44
+ platform,
45
+ });
46
+ }
47
+
48
+ const uid = options.uid ?? (typeof process.getuid === 'function' ? process.getuid() : undefined);
49
+ const directoryName = `blun-update-${uid ?? digest.slice(0, 12)}`;
50
+ const requestedRoot = String(options.socketDirectory || options.tempDir || os.tmpdir())
51
+ .replaceAll('\\', '/');
52
+ let directory = options.socketDirectory
53
+ ? requestedRoot
54
+ : path.posix.join(requestedRoot, directoryName);
55
+ let socketPath = path.posix.join(directory, `lease-${digest.slice(0, 24)}.sock`);
56
+ if (Buffer.byteLength(socketPath, 'utf8') > MAX_POSIX_SOCKET_PATH_BYTES) {
57
+ directory = path.posix.join('/tmp', directoryName);
58
+ socketPath = path.posix.join(directory, `lease-${digest.slice(0, 24)}.sock`);
59
+ }
60
+ if (Buffer.byteLength(socketPath, 'utf8') > MAX_POSIX_SOCKET_PATH_BYTES) {
61
+ throw new Error('UPDATE_LEASE_SOCKET_PATH_TOO_LONG');
62
+ }
63
+ return Object.freeze({ directory, magic, path: socketPath, platform });
64
+ }
65
+
66
+ function closeServer(server) {
67
+ for (const socket of server[LEASE_CONNECTIONS] || []) {
68
+ try {
69
+ socket.destroy();
70
+ } catch {}
71
+ }
72
+ if (!server.listening) return Promise.resolve();
73
+ try {
74
+ server.close();
75
+ server.unref?.();
76
+ } catch {}
77
+ return Promise.resolve();
78
+ }
79
+
80
+ function ensurePrivateSocketDirectory(endpoint, options = {}) {
81
+ if (endpoint.platform === 'win32') return;
82
+ const fsImpl = options.fsImpl || fs;
83
+ fsImpl.mkdirSync(endpoint.directory, { recursive: true, mode: 0o700 });
84
+ const stat = fsImpl.lstatSync(endpoint.directory);
85
+ if (!stat.isDirectory() || stat.isSymbolicLink()) {
86
+ throw new Error('INVALID_UPDATE_LEASE_DIRECTORY');
87
+ }
88
+ if (typeof process.getuid === 'function'
89
+ && Number.isInteger(stat.uid)
90
+ && stat.uid !== process.getuid()) {
91
+ throw new Error('INVALID_UPDATE_LEASE_DIRECTORY_OWNER');
92
+ }
93
+ fsImpl.chmodSync(endpoint.directory, 0o700);
94
+ }
95
+
96
+ function listenForLease(endpoint, options = {}) {
97
+ const netImpl = options.netImpl || net;
98
+ return new Promise((resolve, reject) => {
99
+ const server = netImpl.createServer((socket) => {
100
+ server[LEASE_CONNECTIONS].add(socket);
101
+ socket.once('close', () => server[LEASE_CONNECTIONS].delete(socket));
102
+ socket.on('error', () => {});
103
+ socket.end(endpoint.magic);
104
+ });
105
+ server[LEASE_CONNECTIONS] = new Set();
106
+ const onError = (error) => {
107
+ server.removeListener('error', onError);
108
+ reject(error);
109
+ };
110
+ server.once('error', onError);
111
+ server.listen({ path: endpoint.path, exclusive: true }, () => {
112
+ server.removeListener('error', onError);
113
+ resolve(server);
114
+ });
115
+ });
116
+ }
117
+
118
+ function probeExistingLease(endpoint, options = {}) {
119
+ const netImpl = options.netImpl || net;
120
+ const timeoutMs = options.probeTimeoutMs || LEASE_PROBE_TIMEOUT_MS;
121
+ return new Promise((resolve) => {
122
+ let settled = false;
123
+ let received = '';
124
+ let socket;
125
+ const finish = (state, error) => {
126
+ if (settled) return;
127
+ settled = true;
128
+ clearTimeout(timer);
129
+ try {
130
+ socket?.destroy();
131
+ } catch {}
132
+ // oxlint-disable-next-line promise/no-multiple-resolved -- settled is the idempotence guard.
133
+ resolve({ error, state });
134
+ };
135
+ const timer = setTimeout(() => finish('foreign'), timeoutMs);
136
+ timer.unref?.();
137
+ try {
138
+ socket = netImpl.createConnection({ path: endpoint.path });
139
+ socket.setEncoding?.('utf8');
140
+ socket.on('data', (chunk) => {
141
+ received += String(chunk);
142
+ if (Buffer.byteLength(received, 'utf8') > Buffer.byteLength(endpoint.magic, 'utf8')) {
143
+ finish('foreign');
144
+ }
145
+ });
146
+ socket.once('end', () => finish(received === endpoint.magic ? 'owner' : 'foreign'));
147
+ socket.once('error', (error) => {
148
+ const stale = error?.code === 'ECONNREFUSED' || error?.code === 'ENOENT';
149
+ finish(stale ? 'stale' : 'foreign', error);
150
+ });
151
+ socket.once('close', () => {
152
+ if (!settled) finish(received === endpoint.magic ? 'owner' : 'foreign');
153
+ });
154
+ } catch (error) {
155
+ const stale = error?.code === 'ECONNREFUSED' || error?.code === 'ENOENT';
156
+ finish(stale ? 'stale' : 'foreign', error);
157
+ }
158
+ });
159
+ }
160
+
161
+ function observeSocketPath(endpoint, options = {}) {
162
+ if (endpoint.platform === 'win32') return { state: 'not_applicable' };
163
+ const fsImpl = options.fsImpl || fs;
164
+ try {
165
+ const stat = fsImpl.lstatSync(endpoint.path);
166
+ if (!stat.isSocket() || stat.isSymbolicLink()) return { state: 'unsafe' };
167
+ return { dev: stat.dev, ino: stat.ino, state: 'socket' };
168
+ } catch (error) {
169
+ return error?.code === 'ENOENT' ? { state: 'missing' } : { state: 'unsafe' };
170
+ }
171
+ }
172
+
173
+ function removeObservedStaleSocket(endpoint, observed, options = {}) {
174
+ if (endpoint.platform === 'win32') return false;
175
+ const fsImpl = options.fsImpl || fs;
176
+ try {
177
+ const stat = fsImpl.lstatSync(endpoint.path);
178
+ if (observed.state !== 'socket'
179
+ || !stat.isSocket()
180
+ || stat.isSymbolicLink()
181
+ || stat.dev !== observed.dev
182
+ || stat.ino !== observed.ino) {
183
+ return false;
184
+ }
185
+ fsImpl.unlinkSync(endpoint.path);
186
+ return true;
187
+ } catch (error) {
188
+ return error?.code === 'ENOENT' && observed.state === 'missing';
189
+ }
190
+ }
191
+
192
+ function recordSocketIdentity(endpoint, options = {}) {
193
+ if (endpoint.platform === 'win32') return undefined;
194
+ const fsImpl = options.fsImpl || fs;
195
+ const stat = fsImpl.lstatSync(endpoint.path);
196
+ if (!stat.isSocket() || stat.isSymbolicLink()) throw new Error('INVALID_UPDATE_LEASE_SOCKET');
197
+ fsImpl.chmodSync(endpoint.path, 0o600);
198
+ return { dev: stat.dev, ino: stat.ino };
199
+ }
200
+
201
+ function removeOwnedSocket(endpoint, identity, options = {}) {
202
+ if (endpoint.platform === 'win32' || !identity) return;
203
+ const fsImpl = options.fsImpl || fs;
204
+ try {
205
+ const stat = fsImpl.lstatSync(endpoint.path);
206
+ if (stat.isSocket()
207
+ && !stat.isSymbolicLink()
208
+ && stat.dev === identity.dev
209
+ && stat.ino === identity.ino) {
210
+ fsImpl.unlinkSync(endpoint.path);
211
+ }
212
+ } catch {}
213
+ }
214
+
215
+ module.exports = {
216
+ LEASE_CONNECTIONS,
217
+ LEASE_PROBE_TIMEOUT_MS,
218
+ canonicalPackageIdentity,
219
+ deriveUpdateLeaseEndpoint,
220
+ closeServer,
221
+ ensurePrivateSocketDirectory,
222
+ listenForLease,
223
+ probeExistingLease,
224
+ observeSocketPath,
225
+ removeObservedStaleSocket,
226
+ recordSocketIdentity,
227
+ removeOwnedSocket,
228
+ };
@@ -1,74 +1,17 @@
1
1
  'use strict';
2
2
 
3
- const { createHash } = require('node:crypto');
4
- const fs = require('node:fs');
5
3
  const net = require('node:net');
6
4
  const os = require('node:os');
7
5
  const path = require('node:path');
8
6
  const { spawn } = require('node:child_process');
9
7
 
10
- const LEASE_ADOPT_MESSAGE = 'blun-update-lease-adopted';
11
- const LEASE_CANCEL_MESSAGE = 'blun-update-lease-cancel';
12
- const LEASE_COMMIT_MESSAGE = 'blun-update-lease-commit';
13
- const LEASE_HANDOFF_MESSAGE = 'blun-update-lease-handoff';
14
- const LEASE_BUSY_MESSAGE = 'blun-update-lease-busy';
15
- const LEASE_UNAVAILABLE_MESSAGE = 'blun-update-lease-unavailable';
16
- const LEASE_PROTOCOL_VERSION = 'BLUN_UPDATE_LEASE_V3';
17
- const LEASE_PROBE_TIMEOUT_MS = 500;
18
- const MAX_POSIX_SOCKET_PATH_BYTES = 96;
19
- const LEASE_CONNECTIONS = Symbol('blunLeaseConnections');
20
-
21
- function canonicalPackageIdentity(packageRoot, options = {}) {
22
- if (typeof packageRoot !== 'string' || packageRoot.trim().length === 0) {
23
- throw new Error('UPDATE_PACKAGE_ROOT_REQUIRED');
24
- }
25
- const fsImpl = options.fsImpl || fs;
26
- const platform = options.platform || process.platform;
27
- const realpath = fsImpl.realpathSync.native || fsImpl.realpathSync;
28
- let canonical = realpath(path.resolve(packageRoot));
29
- if (!fsImpl.statSync(canonical).isDirectory()) throw new Error('INVALID_UPDATE_PACKAGE_ROOT');
30
- canonical = canonical.replaceAll('\\', '/');
31
- if (platform === 'win32') canonical = canonical.toLowerCase();
32
- return canonical;
33
- }
34
-
35
- function deriveUpdateLeaseEndpoint(packageRoot, options = {}) {
36
- const platform = options.platform || process.platform;
37
- const role = options.role === 'install'
38
- ? 'install'
39
- : options.role === 'runtime'
40
- ? 'runtime'
41
- : 'notice';
42
- const identity = canonicalPackageIdentity(packageRoot, options);
43
- const digest = createHash('sha256')
44
- .update(`blun-update-v3\0${role}\0${identity}`)
45
- .digest('hex');
46
- const magic = `${LEASE_PROTOCOL_VERSION} ${digest}\n`;
47
- if (platform === 'win32') {
48
- return Object.freeze({
49
- magic,
50
- path: `\\\\.\\pipe\\blun-update-v3-${digest.slice(0, 32)}`,
51
- platform,
52
- });
53
- }
54
-
55
- const uid = options.uid ?? (typeof process.getuid === 'function' ? process.getuid() : undefined);
56
- const directoryName = `blun-update-${uid ?? digest.slice(0, 12)}`;
57
- const requestedRoot = String(options.socketDirectory || options.tempDir || os.tmpdir())
58
- .replaceAll('\\', '/');
59
- let directory = options.socketDirectory
60
- ? requestedRoot
61
- : path.posix.join(requestedRoot, directoryName);
62
- let socketPath = path.posix.join(directory, `lease-${digest.slice(0, 24)}.sock`);
63
- if (Buffer.byteLength(socketPath, 'utf8') > MAX_POSIX_SOCKET_PATH_BYTES) {
64
- directory = path.posix.join('/tmp', directoryName);
65
- socketPath = path.posix.join(directory, `lease-${digest.slice(0, 24)}.sock`);
66
- }
67
- if (Buffer.byteLength(socketPath, 'utf8') > MAX_POSIX_SOCKET_PATH_BYTES) {
68
- throw new Error('UPDATE_LEASE_SOCKET_PATH_TOO_LONG');
69
- }
70
- return Object.freeze({ directory, magic, path: socketPath, platform });
71
- }
8
+ const {
9
+ LEASE_CONNECTIONS, LEASE_PROBE_TIMEOUT_MS, canonicalPackageIdentity,
10
+ deriveUpdateLeaseEndpoint, closeServer, ensurePrivateSocketDirectory, listenForLease,
11
+ probeExistingLease, observeSocketPath, removeObservedStaleSocket,
12
+ recordSocketIdentity, removeOwnedSocket,
13
+ } = require('./update-lease-sockets.cjs');
14
+ const { runInstallerWorker } = require('./update-lease-installer.cjs');
72
15
 
73
16
  function connectRuntimeBroker(endpoint, options = {}) {
74
17
  const netImpl = options.netImpl || net;
@@ -185,7 +128,7 @@ async function runRuntimeBroker(options = {}) {
185
128
  let closing = false;
186
129
  let identity;
187
130
  const closeBroker = async (server) => {
188
- if (closing) return;
131
+ if (closing || holders.size > 0) return;
189
132
  closing = true;
190
133
  clearTimeout(idleTimer);
191
134
  await closeServer(server);
@@ -193,6 +136,11 @@ async function runRuntimeBroker(options = {}) {
193
136
  await install.lease.release();
194
137
  };
195
138
  const server = net.createServer((socket) => {
139
+ if (closing) {
140
+ socket.destroy();
141
+ return;
142
+ }
143
+ server[LEASE_CONNECTIONS].add(socket);
196
144
  socket.setEncoding('utf8');
197
145
  let received = '';
198
146
  let admitted = false;
@@ -202,6 +150,10 @@ async function runRuntimeBroker(options = {}) {
202
150
  } catch {}
203
151
  };
204
152
  const onData = (chunk) => {
153
+ if (closing || socket.destroyed) {
154
+ reject();
155
+ return;
156
+ }
205
157
  if (admitted) return;
206
158
  received += String(chunk);
207
159
  if (Buffer.byteLength(received, 'utf8') > Buffer.byteLength(endpoint.magic, 'utf8')) {
@@ -221,12 +173,15 @@ async function runRuntimeBroker(options = {}) {
221
173
  socket.on('data', onData);
222
174
  socket.on('error', () => {});
223
175
  socket.once('close', () => {
176
+ server[LEASE_CONNECTIONS].delete(socket);
224
177
  holders.delete(socket);
225
178
  if (holders.size === 0 && !closing) {
179
+ clearTimeout(idleTimer);
226
180
  idleTimer = setTimeout(() => { void closeBroker(server); }, 0);
227
181
  }
228
182
  });
229
183
  });
184
+ server[LEASE_CONNECTIONS] = new Set();
230
185
  try {
231
186
  await new Promise((resolve, reject) => {
232
187
  const onError = (error) => {
@@ -241,6 +196,7 @@ async function runRuntimeBroker(options = {}) {
241
196
  });
242
197
  identity = recordSocketIdentity(endpoint);
243
198
  } catch {
199
+ closing = true;
244
200
  await closeServer(server);
245
201
  await install.lease.release();
246
202
  return false;
@@ -251,155 +207,6 @@ async function runRuntimeBroker(options = {}) {
251
207
  return true;
252
208
  }
253
209
 
254
- function closeServer(server) {
255
- for (const socket of server[LEASE_CONNECTIONS] || []) {
256
- try {
257
- socket.destroy();
258
- } catch {}
259
- }
260
- if (!server.listening) return Promise.resolve();
261
- try {
262
- server.close();
263
- server.unref?.();
264
- } catch {}
265
- return Promise.resolve();
266
- }
267
-
268
- function ensurePrivateSocketDirectory(endpoint, options = {}) {
269
- if (endpoint.platform === 'win32') return;
270
- const fsImpl = options.fsImpl || fs;
271
- fsImpl.mkdirSync(endpoint.directory, { recursive: true, mode: 0o700 });
272
- const stat = fsImpl.lstatSync(endpoint.directory);
273
- if (!stat.isDirectory() || stat.isSymbolicLink()) {
274
- throw new Error('INVALID_UPDATE_LEASE_DIRECTORY');
275
- }
276
- if (typeof process.getuid === 'function'
277
- && Number.isInteger(stat.uid)
278
- && stat.uid !== process.getuid()) {
279
- throw new Error('INVALID_UPDATE_LEASE_DIRECTORY_OWNER');
280
- }
281
- fsImpl.chmodSync(endpoint.directory, 0o700);
282
- }
283
-
284
- function listenForLease(endpoint, options = {}) {
285
- const netImpl = options.netImpl || net;
286
- return new Promise((resolve, reject) => {
287
- const server = netImpl.createServer((socket) => {
288
- server[LEASE_CONNECTIONS].add(socket);
289
- socket.once('close', () => server[LEASE_CONNECTIONS].delete(socket));
290
- socket.on('error', () => {});
291
- socket.end(endpoint.magic);
292
- });
293
- server[LEASE_CONNECTIONS] = new Set();
294
- const onError = (error) => {
295
- server.removeListener('error', onError);
296
- reject(error);
297
- };
298
- server.once('error', onError);
299
- server.listen({ path: endpoint.path, exclusive: true }, () => {
300
- server.removeListener('error', onError);
301
- resolve(server);
302
- });
303
- });
304
- }
305
-
306
- function probeExistingLease(endpoint, options = {}) {
307
- const netImpl = options.netImpl || net;
308
- const timeoutMs = options.probeTimeoutMs || LEASE_PROBE_TIMEOUT_MS;
309
- return new Promise((resolve) => {
310
- let settled = false;
311
- let received = '';
312
- let socket;
313
- const finish = (state, error) => {
314
- if (settled) return;
315
- settled = true;
316
- clearTimeout(timer);
317
- try {
318
- socket?.destroy();
319
- } catch {}
320
- // oxlint-disable-next-line promise/no-multiple-resolved -- settled is the idempotence guard.
321
- resolve({ error, state });
322
- };
323
- const timer = setTimeout(() => finish('foreign'), timeoutMs);
324
- timer.unref?.();
325
- try {
326
- socket = netImpl.createConnection({ path: endpoint.path });
327
- socket.setEncoding?.('utf8');
328
- socket.on('data', (chunk) => {
329
- received += String(chunk);
330
- if (Buffer.byteLength(received, 'utf8') > Buffer.byteLength(endpoint.magic, 'utf8')) {
331
- finish('foreign');
332
- }
333
- });
334
- socket.once('end', () => finish(received === endpoint.magic ? 'owner' : 'foreign'));
335
- socket.once('error', (error) => {
336
- const stale = error?.code === 'ECONNREFUSED' || error?.code === 'ENOENT';
337
- finish(stale ? 'stale' : 'foreign', error);
338
- });
339
- socket.once('close', () => {
340
- if (!settled) finish(received === endpoint.magic ? 'owner' : 'foreign');
341
- });
342
- } catch (error) {
343
- const stale = error?.code === 'ECONNREFUSED' || error?.code === 'ENOENT';
344
- finish(stale ? 'stale' : 'foreign', error);
345
- }
346
- });
347
- }
348
-
349
- function observeSocketPath(endpoint, options = {}) {
350
- if (endpoint.platform === 'win32') return { state: 'not_applicable' };
351
- const fsImpl = options.fsImpl || fs;
352
- try {
353
- const stat = fsImpl.lstatSync(endpoint.path);
354
- if (!stat.isSocket() || stat.isSymbolicLink()) return { state: 'unsafe' };
355
- return { dev: stat.dev, ino: stat.ino, state: 'socket' };
356
- } catch (error) {
357
- return error?.code === 'ENOENT' ? { state: 'missing' } : { state: 'unsafe' };
358
- }
359
- }
360
-
361
- function removeObservedStaleSocket(endpoint, observed, options = {}) {
362
- if (endpoint.platform === 'win32') return false;
363
- const fsImpl = options.fsImpl || fs;
364
- try {
365
- const stat = fsImpl.lstatSync(endpoint.path);
366
- if (observed.state !== 'socket'
367
- || !stat.isSocket()
368
- || stat.isSymbolicLink()
369
- || stat.dev !== observed.dev
370
- || stat.ino !== observed.ino) {
371
- return false;
372
- }
373
- fsImpl.unlinkSync(endpoint.path);
374
- return true;
375
- } catch (error) {
376
- return error?.code === 'ENOENT' && observed.state === 'missing';
377
- }
378
- }
379
-
380
- function recordSocketIdentity(endpoint, options = {}) {
381
- if (endpoint.platform === 'win32') return undefined;
382
- const fsImpl = options.fsImpl || fs;
383
- const stat = fsImpl.lstatSync(endpoint.path);
384
- if (!stat.isSocket() || stat.isSymbolicLink()) throw new Error('INVALID_UPDATE_LEASE_SOCKET');
385
- fsImpl.chmodSync(endpoint.path, 0o600);
386
- return { dev: stat.dev, ino: stat.ino };
387
- }
388
-
389
- function removeOwnedSocket(endpoint, identity, options = {}) {
390
- if (endpoint.platform === 'win32' || !identity) return;
391
- const fsImpl = options.fsImpl || fs;
392
- try {
393
- const stat = fsImpl.lstatSync(endpoint.path);
394
- if (stat.isSocket()
395
- && !stat.isSymbolicLink()
396
- && stat.dev === identity.dev
397
- && stat.ino === identity.ino) {
398
- fsImpl.unlinkSync(endpoint.path);
399
- }
400
- } catch {}
401
- }
402
-
403
210
  async function tryAcquireUpdateLease(options = {}) {
404
211
  let endpoint;
405
212
  try {
@@ -467,120 +274,8 @@ async function tryAcquireUpdateLease(options = {}) {
467
274
  return { acquired: true, lease };
468
275
  }
469
276
 
470
- function isInstallerMessage(message) {
471
- if (!message || message.type !== LEASE_HANDOFF_MESSAGE) return false;
472
- const installer = message.installer;
473
- return installer
474
- && typeof installer === 'object'
475
- && typeof message.packageRoot === 'string'
476
- && path.isAbsolute(message.packageRoot)
477
- && typeof installer.npmCliPath === 'string'
478
- && path.isAbsolute(installer.npmCliPath)
479
- && Array.isArray(installer.npmArgs)
480
- && installer.npmArgs.every((entry) => typeof entry === 'string')
481
- && typeof installer.installCwd === 'string'
482
- && path.isAbsolute(installer.installCwd);
483
- }
484
-
485
- function runInstallerWorker() {
486
- let state = 'BOOT';
487
- let started = false;
488
- let installLease;
489
- let installCwd;
490
- const isControlMessage = (message, type) => message
491
- && typeof message === 'object'
492
- && Object.getPrototypeOf(message) === Object.prototype
493
- && Reflect.ownKeys(message).length === 1
494
- && message.type === type;
495
- const exitWithoutInstall = async (code = 0) => {
496
- if (state === 'DONE') return;
497
- state = 'DONE';
498
- try {
499
- await installLease?.release();
500
- } catch {}
501
- process.exit(code);
502
- };
503
- const startInstaller = (installer) => {
504
- if (started || state !== 'COMMITTED') return;
505
- started = true;
506
- try {
507
- installLease.assertOwned();
508
- process.chdir(installer.installCwd);
509
- process.argv = [process.execPath, installer.npmCliPath, ...installer.npmArgs];
510
- require(installer.npmCliPath);
511
- } catch {
512
- process.exit(1);
513
- }
514
- };
515
-
516
- process.once('message', async (message) => {
517
- if (state !== 'BOOT' || !isInstallerMessage(message)) {
518
- process.exit(1);
519
- return;
520
- }
521
- state = 'PREPARED';
522
- installCwd = message.installer.installCwd;
523
- process.once('exit', () => {
524
- if (!installCwd) return;
525
- try {
526
- process.chdir(path.dirname(installCwd));
527
- fs.rmSync(installCwd, { recursive: true, force: true });
528
- } catch {}
529
- });
530
- const leaseResult = await tryAcquireUpdateLease({
531
- packageRoot: message.packageRoot,
532
- role: 'install',
533
- });
534
- if (!leaseResult.acquired) {
535
- const type = leaseResult.reason === 'busy'
536
- ? LEASE_BUSY_MESSAGE
537
- : LEASE_UNAVAILABLE_MESSAGE;
538
- if (process.connected) {
539
- try {
540
- process.send({ type }, () => process.exit(75));
541
- return;
542
- } catch {}
543
- }
544
- process.exit(75);
545
- return;
546
- }
547
- installLease = leaseResult.lease;
548
- state = 'LEASED';
549
- if (!process.connected) {
550
- await exitWithoutInstall();
551
- return;
552
- }
553
- const onControl = (control) => {
554
- if (state !== 'LEASED') {
555
- void exitWithoutInstall(1);
556
- return;
557
- }
558
- if (isControlMessage(control, LEASE_CANCEL_MESSAGE)) {
559
- void exitWithoutInstall();
560
- return;
561
- }
562
- if (!isControlMessage(control, LEASE_COMMIT_MESSAGE)) {
563
- void exitWithoutInstall(1);
564
- return;
565
- }
566
- state = 'COMMITTED';
567
- setImmediate(() => startInstaller(message.installer));
568
- };
569
- process.once('message', onControl);
570
- try {
571
- process.send({ type: LEASE_ADOPT_MESSAGE });
572
- } catch {
573
- process.removeListener('message', onControl);
574
- await exitWithoutInstall();
575
- }
576
- });
577
- process.once('disconnect', () => {
578
- if (state !== 'COMMITTED' && state !== 'DONE') void exitWithoutInstall();
579
- });
580
- }
581
-
582
277
  if (require.main === module && process.argv[2] === '--installer-worker') {
583
- runInstallerWorker();
278
+ runInstallerWorker(tryAcquireUpdateLease);
584
279
  } else if (require.main === module && process.argv[2] === '--runtime-broker') {
585
280
  void runRuntimeBroker().then((started) => {
586
281
  if (!started) process.exitCode = 75;
@@ -4,7 +4,7 @@ const path = require('node:path');
4
4
  const { createHash } = require('node:crypto');
5
5
  const RECEIPT = 'bundled-agent-sources.json';
6
6
  const SCHEMA = 'blun.bundled-agent-sources/v1';
7
- const PREFIXES = ['agent-spine-plugin/', 'standard-skills/translate-native/', 'standard-tools/language-guard/'];
7
+ const PREFIXES = ['standard-skills/translate-native/', 'standard-tools/language-guard/'];
8
8
  const GUARD_RESPONSE_PROFILE = Object.freeze({
9
9
  schema: 'blun.language-guard-response-profile/v2',
10
10
  file: 'translate-native/scripts/blun_language_guard.py',
@@ -24,8 +24,6 @@ const GUARD_RESPONSE_PAYLOADS = Object.freeze([
24
24
  'standard-tools/language-guard/blun_language_guard.py',
25
25
  ]);
26
26
  const REQUIRED = [
27
- 'agent-spine-plugin/blun.plugin.json', 'agent-spine-plugin/src/hook.js',
28
- 'agent-spine-plugin/src/mcp.js', 'agent-spine-plugin/skills/agent-spine/SKILL.md',
29
27
  'standard-skills/translate-native/SKILL.md', ...GUARD_RESPONSE_PAYLOADS,
30
28
  'standard-tools/language-guard/check_diacritics.py', 'standard-tools/language-guard/language_quality.py',
31
29
  'standard-tools/language-guard/guard_service_client.py', 'standard-tools/language-guard/translation_guard.py',
@@ -48,7 +46,7 @@ function payloadInventory(root, prefix = '') {
48
46
  function verifyBundledAgentSources(root, pins) {
49
47
  const receipt = JSON.parse(fs.readFileSync(path.join(root, RECEIPT), 'utf8'));
50
48
  if (receipt.schema !== SCHEMA || !receipt.files || Array.isArray(receipt.files)) throw new Error('Invalid bundled source receipt');
51
- for (const name of ['agentSpine', 'translateNative']) {
49
+ for (const name of ['translateNative']) {
52
50
  if (!/^[a-f0-9]{40}$/.test(receipt.sources?.[name]?.commit || '')) throw new Error('Missing bundled source commit: ' + name);
53
51
  if (pins && JSON.stringify(receipt.sources[name]) !== JSON.stringify(pins[name])) throw new Error('Stale bundled source: ' + name);
54
52
  }