deadbyte-mcp 0.8.10 → 0.9.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 (347) hide show
  1. package/CONTEXT.md +41 -0
  2. package/MANIFEST.SHA256 +346 -82
  3. package/R34-BASELINE.json +9 -0
  4. package/README.txt +135 -9
  5. package/bench/fixtures/corpus.json +17 -0
  6. package/bin/WORKER-REGISTRY.txt +3 -3
  7. package/bin/appcontainer-stage.exe +0 -0
  8. package/bin/appcontainer-stage.obj +0 -0
  9. package/bin/bootstrap-advapi32.exe +0 -0
  10. package/bin/bootstrap-advapi32.obj +0 -0
  11. package/bin/bootstrap-exitcode.exe +0 -0
  12. package/bin/bootstrap-exitcode.obj +0 -0
  13. package/bin/bootstrap-kernel32.exe +0 -0
  14. package/bin/bootstrap-kernel32.obj +0 -0
  15. package/bin/child-control-probe.exe +0 -0
  16. package/bin/child-control-probe.obj +0 -0
  17. package/bin/child-control-stage.exe +0 -0
  18. package/bin/child-control-stage.obj +0 -0
  19. package/bin/contained-reverse-worker.exe +0 -0
  20. package/bin/contained-reverse-worker.obj +0 -0
  21. package/bin/contained-transform-worker.exe +0 -0
  22. package/bin/contained-transform-worker.obj +0 -0
  23. package/bin/containment-probe.exe +0 -0
  24. package/bin/containment-probe.obj +0 -0
  25. package/bin/deadbyte-contain.exe +0 -0
  26. package/bin/deadbyte-contain.obj +0 -0
  27. package/bin/deadbyte-exec.exe +0 -0
  28. package/bin/deadbyte-exec.obj +0 -0
  29. package/bin/deadbyte-process-host.exe +0 -0
  30. package/bin/deadbyte-process-host.obj +0 -0
  31. package/bin/deadbyte-tunnel-host.exe +0 -0
  32. package/bin/deadbyte-tunnel-host.obj +0 -0
  33. package/controller/README.TXT +10 -4
  34. package/controller/deadbyte-controller.config.psd1.example +14 -0
  35. package/controller/deadbyte-controller.ps1 +144 -19
  36. package/controller/deadbyte-process-policy.json +5 -5
  37. package/controller/deadbyte-semantic-lsp-config.json +95 -0
  38. package/docs/ADR-0001-PRODUCTION-BASELINE-SEAMS.md +29 -0
  39. package/docs/ARCHITECTURE.md +6 -5
  40. package/docs/superpowers/plans/2026-09-16-deadbyte-loop-engine.md +846 -0
  41. package/docs/superpowers/plans/2026-09-17-r35-production-successor.md +408 -0
  42. package/docs/superpowers/specs/2026-09-16-deadbyte-loop-engine-design.md +435 -0
  43. package/docs/superpowers/specs/2026-09-17-r35-production-successor-design.md +220 -0
  44. package/node_modules/typescript/LICENSE.txt +55 -0
  45. package/node_modules/typescript/README.md +50 -0
  46. package/node_modules/typescript/SECURITY.md +41 -0
  47. package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  48. package/node_modules/typescript/bin/tsc +2 -0
  49. package/node_modules/typescript/bin/tsserver +2 -0
  50. package/node_modules/typescript/lib/_tsc.js +133818 -0
  51. package/node_modules/typescript/lib/_tsserver.js +659 -0
  52. package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  53. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  54. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  55. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  56. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  57. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  58. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  59. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  60. package/node_modules/typescript/lib/lib.d.ts +22 -0
  61. package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  62. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  63. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  64. package/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  65. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  66. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  67. package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  68. package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  69. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  70. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  71. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  72. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  73. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  74. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  75. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  76. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  77. package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  78. package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  79. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  80. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  81. package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  82. package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  83. package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  84. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  85. package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  86. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  87. package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  88. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  89. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  90. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  91. package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  92. package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  93. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  94. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  95. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  96. package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  97. package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  98. package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  99. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  100. package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  101. package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  102. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  103. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  104. package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  105. package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  106. package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  107. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  108. package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  109. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  110. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  111. package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  112. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  113. package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  114. package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  115. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  116. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  117. package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  118. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  119. package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  120. package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  121. package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  122. package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  123. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  124. package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  125. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  126. package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  127. package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  128. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  129. package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  130. package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  131. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  132. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  133. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  134. package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  135. package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  136. package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  137. package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  138. package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  139. package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  140. package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  141. package/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  142. package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  143. package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  144. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  145. package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  146. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  147. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  148. package/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  149. package/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  150. package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  151. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  152. package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  153. package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  154. package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  155. package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  156. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  157. package/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  158. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  159. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  160. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  161. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  162. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  163. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  164. package/node_modules/typescript/lib/tsc.js +8 -0
  165. package/node_modules/typescript/lib/tsserver.js +8 -0
  166. package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  167. package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  168. package/node_modules/typescript/lib/typesMap.json +497 -0
  169. package/node_modules/typescript/lib/typescript.d.ts +11437 -0
  170. package/node_modules/typescript/lib/typescript.js +200276 -0
  171. package/node_modules/typescript/lib/typingsInstaller.js +8 -0
  172. package/node_modules/typescript/lib/watchGuard.js +53 -0
  173. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  174. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  175. package/node_modules/typescript/package.json +120 -0
  176. package/package.json +5 -3
  177. package/proof/CONTAINMENT-BUILD.txt +6 -6
  178. package/proof/R34-TASK8-SUPERVISOR-CHECKPOINT.json +29 -0
  179. package/proof/R34-TASK9-MCP-SURFACE-CHECKPOINT.json +28 -0
  180. package/scripts/capability-benchmark.mjs +27 -0
  181. package/scripts/deferred-slot-operation.mjs +4 -2
  182. package/scripts/final-closure-verify.mjs +10 -10
  183. package/scripts/final-closure.mjs +11 -11
  184. package/scripts/gate-windows.ps1 +3 -3
  185. package/scripts/release-parity.mjs +14 -14
  186. package/scripts/semantic-preflight.ps1 +73 -0
  187. package/scripts/tool-surface-snapshot.mjs +73 -0
  188. package/scripts/windows-gate-evidence.mjs +5 -5
  189. package/src/audit-verify.mjs +6 -2
  190. package/src/autonomous-action-reconcile.mjs +142 -0
  191. package/src/autonomous-context-engine.mjs +255 -0
  192. package/src/autonomous-live-state.mjs +17 -0
  193. package/src/autonomous-local-supervisor.mjs +249 -0
  194. package/src/autonomous-loop-state.mjs +304 -0
  195. package/src/autonomous-output-contracts.mjs +22 -3
  196. package/src/autonomous-plan.mjs +181 -0
  197. package/src/autonomous-planner-contracts.mjs +44 -0
  198. package/src/autonomous-planner.mjs +91 -6
  199. package/src/autonomous-policy.mjs +15 -2
  200. package/src/autonomous-progress.mjs +127 -0
  201. package/src/autonomous-runtime.mjs +601 -48
  202. package/src/autonomous-supervisor-host.mjs +70 -0
  203. package/src/autonomous-supervisor.mjs +31 -8
  204. package/src/capability-benchmark-runner.mjs +108 -0
  205. package/src/capability-benchmark.mjs +50 -0
  206. package/src/coding-mcp-tools.mjs +46 -3
  207. package/src/coding-output-contracts.mjs +45 -0
  208. package/src/context-provenance.mjs +86 -0
  209. package/src/deadbyte-cli.mjs +117 -25
  210. package/src/document-adapter.mjs +43 -0
  211. package/src/lsp-stdio-client.mjs +112 -0
  212. package/src/machine-fs-smoke-client.mjs +2 -1
  213. package/src/mcp-server.mjs +17 -3
  214. package/src/observation-smoke-client.mjs +3 -2
  215. package/src/operator-surface.mjs +37 -0
  216. package/src/provider-circuit.mjs +125 -0
  217. package/src/release-generation.mjs +44 -5
  218. package/src/remote-mcp-autonomous-smoke-client.mjs +53 -14
  219. package/src/remote-mcp-coding-smoke-client.mjs +5 -4
  220. package/src/remote-mcp-r24-disarmed-smoke-client.mjs +4 -2
  221. package/src/remote-mcp-r34-parity-client.mjs +177 -0
  222. package/src/remote-mcp-smoke-client.mjs +2 -1
  223. package/src/remote-result-journal.mjs +114 -0
  224. package/src/runtime-update.mjs +58 -8
  225. package/src/semantic-backend-registry.mjs +39 -0
  226. package/src/semantic-code.mjs +179 -0
  227. package/src/semantic-lsp-backend.mjs +183 -0
  228. package/src/semantic-lsp-config.mjs +112 -0
  229. package/src/tool-surface-ledger.mjs +92 -0
  230. package/src/version.mjs +1 -1
  231. package/test/audit-verify.test.mjs +1 -1
  232. package/test/autonomous-action-reconcile.test.mjs +106 -0
  233. package/test/autonomous-adversarial.test.mjs +149 -6
  234. package/test/autonomous-context-engine.test.mjs +181 -0
  235. package/test/autonomous-live-state.test.mjs +27 -0
  236. package/test/autonomous-local-supervisor.test.mjs +403 -0
  237. package/test/autonomous-loop-state.test.mjs +126 -0
  238. package/test/autonomous-loop-v2.test.mjs +105 -0
  239. package/test/autonomous-loop.test.mjs +79 -1
  240. package/test/autonomous-output-contract.test.mjs +54 -0
  241. package/test/autonomous-plan.test.mjs +101 -0
  242. package/test/autonomous-progress.test.mjs +106 -0
  243. package/test/autonomous-r34-e2e.test.mjs +338 -0
  244. package/test/autonomous-runtime.test.mjs +3 -3
  245. package/test/autonomous-supervisor-integration.test.mjs +48 -3
  246. package/test/capability-benchmark-runner.test.mjs +49 -0
  247. package/test/capability-benchmark.test.mjs +47 -0
  248. package/test/cli-entrypoint.test.mjs +12 -0
  249. package/test/coding-catalog-consistency.test.mjs +24 -0
  250. package/test/coding-plane.test.mjs +3 -3
  251. package/test/context-provenance.test.mjs +61 -0
  252. package/test/controller-r27.test.mjs +4 -3
  253. package/test/controller.test.mjs +52 -0
  254. package/test/core.test.mjs +1 -1
  255. package/test/deferred-slot-operation-behavior.test.mjs +5 -1
  256. package/test/deferred-slot-operation.test.mjs +2 -1
  257. package/test/document-adapter.test.mjs +23 -0
  258. package/test/fixtures/lsp-framed-server.mjs +33 -0
  259. package/test/fixtures/semantic/cpp/compile_commands.json +4 -0
  260. package/test/fixtures/semantic/cpp/lib.cpp +2 -0
  261. package/test/fixtures/semantic/cpp/lib.hpp +2 -0
  262. package/test/fixtures/semantic/cpp/main.cpp +2 -0
  263. package/test/fixtures/semantic/python/lib.py +2 -0
  264. package/test/fixtures/semantic/python/main.py +2 -0
  265. package/test/fixtures/semantic/rust/Cargo.lock +7 -0
  266. package/test/fixtures/semantic/rust/Cargo.toml +8 -0
  267. package/test/fixtures/semantic/rust/src/lib.rs +3 -0
  268. package/test/fixtures/semantic/rust/src/main.rs +5 -0
  269. package/test/fixtures/semantic/rust/src/math.rs +3 -0
  270. package/test/fixtures/semantic/rust/target/.rustc_info.json +1 -0
  271. package/test/fixtures/semantic/rust/target/CACHEDIR.TAG +3 -0
  272. package/test/fixtures/semantic/rust/target/debug/.cargo-lock +0 -0
  273. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/dep-test-lib-semantic_rust +0 -0
  274. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/invoked.timestamp +1 -0
  275. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust +1 -0
  276. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-4c168fa33c79d09c/test-lib-semantic_rust.json +1 -0
  277. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/dep-test-bin-semantic_rust_bin +0 -0
  278. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/invoked.timestamp +1 -0
  279. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin +1 -0
  280. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-5dcd474439c54a26/test-bin-semantic_rust_bin.json +1 -0
  281. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/dep-lib-semantic_rust +0 -0
  282. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/invoked.timestamp +1 -0
  283. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust +1 -0
  284. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-6212ccd976aa3808/lib-semantic_rust.json +1 -0
  285. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin +1 -0
  286. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/bin-semantic_rust_bin.json +1 -0
  287. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/dep-bin-semantic_rust_bin +0 -0
  288. package/test/fixtures/semantic/rust/target/debug/.fingerprint/semantic_rust-d741378dccdef61c/invoked.timestamp +1 -0
  289. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-4c168fa33c79d09c.rmeta +0 -0
  290. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust-6212ccd976aa3808.rmeta +0 -0
  291. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-5dcd474439c54a26.rmeta +0 -0
  292. package/test/fixtures/semantic/rust/target/debug/deps/libsemantic_rust_bin-d741378dccdef61c.rmeta +0 -0
  293. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-4c168fa33c79d09c.d +5 -0
  294. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust-6212ccd976aa3808.d +5 -0
  295. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-5dcd474439c54a26.d +6 -0
  296. package/test/fixtures/semantic/rust/target/debug/deps/semantic_rust_bin-d741378dccdef61c.d +6 -0
  297. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/dep-graph.bin +0 -0
  298. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/query-cache.bin +0 -0
  299. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc-1qb77z00k06rqw4jdkj92spax/work-products.bin +0 -0
  300. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-1nzlugxi6lq16/s-hmdgo8b6hg-1n6glhc.lock +0 -0
  301. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/dep-graph.bin +0 -0
  302. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/metadata.rmeta +0 -0
  303. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/query-cache.bin +0 -0
  304. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq-9twkpivsqnjon278x20bddozq/work-products.bin +0 -0
  305. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust-3s436v7g6f5xm/s-hmdgo8b58k-1ekj4lq.lock +0 -0
  306. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/dep-graph.bin +0 -0
  307. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/query-cache.bin +0 -0
  308. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3-cmu3jai030no72y8u9eurrnjj/work-products.bin +0 -0
  309. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-1jxcbdeehal7q/s-hmdgo8bxlf-1qr24o3.lock +0 -0
  310. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/dep-graph.bin +0 -0
  311. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/query-cache.bin +0 -0
  312. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt-diy9mqvc2eoiblmhjs3stcgi3/work-products.bin +0 -0
  313. package/test/fixtures/semantic/rust/target/debug/incremental/semantic_rust_bin-2ocx55p60ni6b/s-hmdgo8bxj8-0ir41qt.lock +0 -0
  314. package/test/fixtures/semantic/rust/target/flycheck0/stderr +1 -0
  315. package/test/fixtures/semantic/rust/target/flycheck0/stdout +5 -0
  316. package/test/fixtures/semantic/typescript/lib.ts +3 -0
  317. package/test/fixtures/semantic/typescript/main.ts +2 -0
  318. package/test/fixtures/tool-surface-stdio-server.mjs +14 -0
  319. package/test/helpers/autonomous-r34-fixture.mjs +120 -0
  320. package/test/lsp-stdio-client.test.mjs +72 -0
  321. package/test/multi-file-read.test.mjs +41 -0
  322. package/test/observation-integration.test.mjs +3 -3
  323. package/test/production-docs.test.mjs +48 -0
  324. package/test/prompts-resources.test.mjs +35 -0
  325. package/test/provider-circuit.test.mjs +93 -0
  326. package/test/public-autonomous-ingress-budget.test.mjs +28 -0
  327. package/test/r33-closeout-regression.test.mjs +3 -3
  328. package/test/r33-finalization.test.mjs +19 -16
  329. package/test/release-generation.test.mjs +23 -2
  330. package/test/release-version.test.mjs +24 -17
  331. package/test/remote-r24-catalog.test.mjs +5 -4
  332. package/test/remote-result-journal.test.mjs +58 -0
  333. package/test/remote-session-cli.test.mjs +112 -17
  334. package/test/runtime-self-update.test.mjs +63 -0
  335. package/test/semantic-backend-registry.test.mjs +29 -0
  336. package/test/semantic-code.test.mjs +66 -0
  337. package/test/semantic-lsp-backend.test.mjs +99 -0
  338. package/test/semantic-lsp-config.test.mjs +81 -0
  339. package/test/semantic-lsp-readiness.test.mjs +34 -0
  340. package/test/semantic-lsp-transient-empty.test.mjs +32 -0
  341. package/test/semantic-lsp-transient-null.test.mjs +31 -0
  342. package/test/semantic-multilang.test.mjs +72 -0
  343. package/test/semantic-runtime-routing.test.mjs +32 -0
  344. package/test/semantic-server-config-integration.test.mjs +66 -0
  345. package/test/tool-surface-ledger.test.mjs +59 -0
  346. package/test/tool-surface-snapshot.test.mjs +17 -0
  347. package/test/tracer-bullet.test.mjs +77 -0
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { lstat, mkdir, open, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises';
3
3
  import { spawn, spawnSync } from 'node:child_process';
4
- import { randomBytes } from 'node:crypto';
4
+ import { createHash, randomBytes } from 'node:crypto';
5
5
  import os from 'node:os';
6
6
  import path from 'node:path';
7
7
  import { setTimeout as sleep } from 'node:timers/promises';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { defaultPublicKeyPath } from './trust.mjs';
10
10
  import { verifyAuditChain } from './audit-verify.mjs';
11
+ import { openRemoteResultJournal, parseRemoteResultCursor } from './remote-result-journal.mjs';
11
12
 
12
13
  const REMOTE_COMMANDS=new Set([
13
14
  'menu','start','resume','park','stop','restart','status','url','test','fulltest','toggle','clean','machinetest',
@@ -22,15 +23,23 @@ const SESSION_STATUS=[
22
23
  ['hoststatus',/^Host plane\s*:\s*ARMED\b/m]
23
24
  ];
24
25
  const SESSION_CLEANUP=['disarmautonomous','disarmcoding','disarmprocess','disarmhost','park'];
26
+ const SUPERVISOR_COMMANDS=Object.freeze({
27
+ start:'supervisorstart',stop:'supervisorstop',status:'supervisorstatus',recover:'supervisorrecover'
28
+ });
25
29
 
26
30
  function stateRoot(){return path.resolve(process.env.DEADBYTE_STATE_ROOT||path.join(os.homedir(),'.deadbyte-mcp'));}
27
31
  async function requireRegular(file,label){const info=await lstat(file);if(!info.isFile()||info.isSymbolicLink()) throw new Error(`${label} must be a regular non-symlink file`);return file;}
28
32
  function printHelp(){
29
33
  process.stdout.write([
30
34
  'DEADBYTE MCP CLI','',
31
- ' npx deadbyte-mcp@latest remote # foreground device session',
35
+ ' npx deadbyte-mcp@latest mcp # stdio MCP server for local clients',
36
+ ' npx deadbyte-mcp@latest remote # compact foreground device session',
37
+ ' npx deadbyte-mcp@latest remote --verbose # detailed audit + bridge logs',
38
+ ' npx deadbyte-mcp@latest remote --resume <cursor> # replay missed compact results, then reconnect',
32
39
  ' npx deadbyte-mcp@latest remote status',
33
40
  ' npx deadbyte-mcp@latest remote restart',
41
+ ' npx deadbyte-mcp@latest supervisor status',
42
+ ' npx deadbyte-mcp@latest supervisor recover',
34
43
  ' npx deadbyte-mcp@latest audit verify',
35
44
  ' npx deadbyte-mcp@latest audit status',''
36
45
  ].join('\n'));
@@ -43,7 +52,7 @@ async function remoteContext(){
43
52
  const powershell=await requireRegular(path.join(systemRoot,'System32','WindowsPowerShell','v1.0','powershell.exe'),'Windows PowerShell');
44
53
  return {root,launcher,powershell};
45
54
  }
46
- function invokeController(ctx,command,{capture=false,allowFailure=false}={}){
55
+ function invokeController(ctx,command,{capture=false,allowFailure=false,echoCaptured=true}={}){
47
56
  const result=spawnSync(ctx.powershell,['-NoLogo','-NoProfile','-ExecutionPolicy','Bypass','-File',ctx.launcher,command],{
48
57
  stdio:capture?['ignore','pipe','pipe']:'inherit',encoding:capture?'utf8':undefined,windowsHide:false,shell:false
49
58
  });
@@ -51,7 +60,7 @@ function invokeController(ctx,command,{capture=false,allowFailure=false}={}){
51
60
  const status=Number.isInteger(result.status)?result.status:1;
52
61
  const stdout=capture?String(result.stdout||''):'';
53
62
  const stderr=capture?String(result.stderr||''):'';
54
- if(capture){if(stdout) process.stdout.write(stdout);if(stderr) process.stderr.write(stderr);}
63
+ if(capture&&echoCaptured){if(stdout) process.stdout.write(stdout);if(stderr) process.stderr.write(stderr);}
55
64
  if(status!==0&&!allowFailure) throw new Error(`remote controller '${command}' failed exit=${status}`);
56
65
  return {status,stdout,stderr};
57
66
  }
@@ -68,11 +77,16 @@ async function listLogFiles(root){
68
77
  }
69
78
  return files;
70
79
  }
71
- function formatLogLine(file,line){
80
+ function formatLogLine(file,line,{verbose=false}={}){
72
81
  if(!line) return null;
73
82
  if(/^segment-\d{8}\.jsonl$/.test(path.basename(file))){
74
83
  try{
75
84
  const event=JSON.parse(line);
85
+ if(!verbose){
86
+ if(event.event_type!=='tool.result') return null;
87
+ const tool=typeof event.tool==='string'&&event.tool?event.tool:'tool';
88
+ return `${event.outcome?.is_error===true?'[ERR]':'[OK]'} ${tool}`;
89
+ }
76
90
  const seq=Number.isInteger(event.seq)?`#${event.seq}`:'#?';
77
91
  const request=typeof event.request_id==='string'?` ${event.request_id.slice(0,8)}`:'';
78
92
  const tool=typeof event.tool==='string'?` ${event.tool}`:'';
@@ -84,8 +98,9 @@ function formatLogLine(file,line){
84
98
  else marker='📤 ';
85
99
  }
86
100
  return `${marker}[AUDIT ${seq}] ${event.event_type||'event'}${tool}${request}`;
87
- }catch{return `[AUDIT] ${line}`;}
101
+ }catch{return verbose?`[AUDIT] ${line}`:null;}
88
102
  }
103
+ if(!verbose) return null;
89
104
  const label=path.basename(file).replace(/\.log$/i,'').toUpperCase();
90
105
  let marker='';
91
106
  if(/\[TOOL IN \]/.test(line)) marker='📥 ';
@@ -96,6 +111,31 @@ function formatLogLine(file,line){
96
111
  }
97
112
  return `${marker}[${label}] ${line}`;
98
113
  }
114
+ function remoteResultJournalPath(root,sessionId){return path.join(root,'runtime','remote-results',`${sessionId}.json`);}
115
+ function auditTerminalResult(file,line){
116
+ if(!/^segment-\d{8}\.jsonl$/.test(path.basename(file))||!line) return null;
117
+ let event;try{event=JSON.parse(line);}catch{return null;}
118
+ if(event?.event_type!=='tool.result'||typeof event.request_id!=='string'||!event.request_id||typeof event.tool!=='string'||!event.tool) return null;
119
+ const observed=Number.isFinite(Date.parse(event.created_at_utc))?new Date(Date.parse(event.created_at_utc)).toISOString():new Date().toISOString();
120
+ return {request_id:event.request_id,tool:event.tool,status:event.outcome?.is_error===true?'error':'ok',observed_at_utc:observed,
121
+ payload_sha256:createHash('sha256').update(Buffer.from(line,'utf8')).digest('hex')};
122
+ }
123
+ async function replayRemoteResults(root,cursor,{verbose=false}={}){
124
+ const parsed=parseRemoteResultCursor(cursor);
125
+ const file=remoteResultJournalPath(root,parsed.session_id);
126
+ await requireRegular(file,'remote result journal');
127
+ const journal=await openRemoteResultJournal({filePath:file,sessionId:parsed.session_id,maxEntries:2048});
128
+ let next=cursor;
129
+ for(;;){
130
+ const page=await journal.replayAfter(next,{limit:200});
131
+ for(const event of page.events){
132
+ const marker=event.status==='error'?'[ERR]':'[OK]';
133
+ process.stdout.write(`${verbose?'[REPLAY] ': '[REPLAY] '}${marker} ${event.tool} [cursor r1:${event.session_id}:${event.seq}]\n`);
134
+ }
135
+ next=page.next_cursor;
136
+ if(!page.has_more) return next;
137
+ }
138
+ }
99
139
  async function readAppend(file,offset){
100
140
  let info;try{info=await stat(file);}catch(error){if(error?.code==='ENOENT') return {offset:0,text:''};throw error;}
101
141
  let start=offset;
@@ -107,28 +147,41 @@ async function readAppend(file,offset){
107
147
  try{await handle.read(buffer,0,length,start);}finally{await handle.close();}
108
148
  return {offset:info.size,text:buffer.toString('utf8')};
109
149
  }
110
- async function tailRemoteLogs(root,signal){
150
+ async function tailRemoteLogs(root,signal,{verbose=false,journal=null}={}){
111
151
  const offsets=new Map();
112
152
  for(const file of await listLogFiles(root)){
113
153
  try{offsets.set(file,(await stat(file)).size);}catch{}
114
154
  }
115
- process.stdout.write('📜 [LOG] Live logs active. Press Ctrl+C to disconnect and revoke authority.\n');
155
+ process.stdout.write(verbose
156
+ ?'📜 [LOG] Live logs active. Press Ctrl+C to disconnect and revoke authority.\n'
157
+ :'[LOG] Live tool results. Ctrl+C disconnects and revokes authority.\n');
116
158
  while(!signal.aborted){
117
159
  for(const file of await listLogFiles(root)){
118
160
  const prior=offsets.has(file)?offsets.get(file):0;
119
161
  const next=await readAppend(file,prior);
120
162
  offsets.set(file,next.offset);
121
163
  for(const line of next.text.split(/\r?\n/)){
122
- const formatted=formatLogLine(file,line);
123
- if(formatted) process.stdout.write(`${formatted}\n`);
164
+ const terminal=auditTerminalResult(file,line);
165
+ let recorded=null;
166
+ if(terminal&&journal) recorded=await journal.recordTerminal(terminal);
167
+ if(recorded?.duplicate&&!verbose) continue;
168
+ const formatted=formatLogLine(file,line,{verbose});
169
+ if(!formatted) continue;
170
+ if(!verbose&&recorded) process.stdout.write(`${formatted} [cursor ${recorded.cursor}]\n`);
171
+ else process.stdout.write(`${formatted}\n`);
124
172
  }
125
173
  }
126
174
  try{await sleep(250,null,{signal});}catch(error){if(error?.name!=='AbortError') throw error;}
127
175
  }
128
176
  }
129
- async function cleanupRemoteSession(ctx){
177
+ async function cleanupRemoteSession(ctx,{verbose=false}={}){
130
178
  for(const command of SESSION_CLEANUP){
131
- try{invokeController(ctx,command,{allowFailure:true});}
179
+ try{
180
+ const result=invokeController(ctx,command,verbose
181
+ ?{allowFailure:true}
182
+ :{allowFailure:true,capture:true,echoCaptured:false});
183
+ if(result.status!==0) process.stderr.write(`⚠️ [WARN] cleanup ${command} exit=${result.status}\n`);
184
+ }
132
185
  catch(error){process.stderr.write(`⚠️ [WARN] cleanup ${command}: ${String(error?.message||error)}\n`);}
133
186
  }
134
187
  }
@@ -150,7 +203,8 @@ async function readRemoteSessionMarker(root){
150
203
  if(value?.schema==='deadbyte.remote-session.v2'){
151
204
  if(!Number.isInteger(value?.owner_pid)||value.owner_pid<1||
152
205
  !/^[0-9a-f]{64}$/.test(String(value?.session_nonce||''))||
153
- !Number.isInteger(value?.guardian_pid)||value.guardian_pid<1) throw new Error('remote session marker schema invalid');
206
+ !Number.isInteger(value?.guardian_pid)||value.guardian_pid<1||
207
+ (value.result_session_id!==undefined&&!/^[0-9a-f]{24}$/.test(String(value.result_session_id)))) throw new Error('remote session marker schema invalid');
154
208
  return value;
155
209
  }
156
210
  throw new Error('remote session marker schema invalid');
@@ -177,7 +231,9 @@ async function recoverRemoteSession(ctx){
177
231
  async function claimRemoteSession(ctx){
178
232
  const dir=path.join(ctx.root,'runtime');await mkdir(dir,{recursive:true});
179
233
  const nonce=randomBytes(32).toString('hex');
180
- const marker={schema:'deadbyte.remote-session.v2',owner_pid:process.pid,guardian_pid:0,session_nonce:nonce,started_at_utc:new Date().toISOString()};
234
+ const resultSessionId=randomBytes(12).toString('hex');
235
+ const marker={schema:'deadbyte.remote-session.v2',owner_pid:process.pid,guardian_pid:0,session_nonce:nonce,
236
+ result_session_id:resultSessionId,started_at_utc:new Date().toISOString()};
181
237
  const markerPath=remoteSessionMarker(ctx.root);
182
238
  try{await writeFile(markerPath,`${JSON.stringify(marker)}\n`,{encoding:'utf8',flag:'wx'});}
183
239
  catch(error){if(error?.code==='EEXIST') throw new Error('remote session already claimed');throw error;}
@@ -202,10 +258,14 @@ async function releaseRemoteSession(ctx,marker){
202
258
  const same=current?.schema==='deadbyte.remote-session.v2'&&current.owner_pid===marker.owner_pid&&current.session_nonce===marker.session_nonce;
203
259
  if(same) await rm(remoteSessionMarker(ctx.root),{force:true});
204
260
  }
205
- async function runRemoteSession(){
261
+ async function runRemoteSession({verbose=false,resumeCursor=null}={}){
206
262
  const ctx=await remoteContext();
263
+ if(resumeCursor!==null) await replayRemoteResults(ctx.root,resumeCursor,{verbose});
207
264
  await recoverRemoteSession(ctx);
208
265
  const marker=await claimRemoteSession(ctx);
266
+ const resultJournal=await openRemoteResultJournal({
267
+ filePath:remoteResultJournalPath(ctx.root,marker.result_session_id),sessionId:marker.result_session_id,maxEntries:2048
268
+ });
209
269
  const aborter=new AbortController();
210
270
  const abort=()=>aborter.abort();
211
271
  const watchStdin=!process.stdin.isTTY;
@@ -213,33 +273,59 @@ async function runRemoteSession(){
213
273
  if(watchStdin){process.stdin.once('end',abort);process.stdin.once('close',abort);process.stdin.resume();}
214
274
  let ready=false;
215
275
  try{
216
- process.stdout.write('DEADBYTE MCP DEVICE SESSION\n');
217
- process.stdout.write('[INFO] Starting local + remote runtime...\n');
218
- for(const command of SESSION_START) invokeController(ctx,command);
219
- process.stdout.write('🛡️ [AUTHORITY] Verifying runtime planes...\n');
276
+ if(verbose){
277
+ process.stdout.write('DEADBYTE MCP DEVICE SESSION\n');
278
+ process.stdout.write('[INFO] Starting local + remote runtime...\n');
279
+ for(const command of SESSION_START) invokeController(ctx,command);
280
+ process.stdout.write('🛡️ [AUTHORITY] Verifying runtime planes...\n');
281
+ }else{
282
+ process.stdout.write('DEADBYTE MCP\n');
283
+ const started=[];
284
+ for(const command of SESSION_START) started.push(invokeController(ctx,command,{capture:true,echoCaptured:false}));
285
+ const startText=started[0]?.stdout||'';
286
+ const url=startText.match(/^URL\s*:\s*(\S+)/m)?.[1]||'';
287
+ process.stdout.write('[OK] ONLINE\n');
288
+ if(url) process.stdout.write(`URL: ${url}\n`);
289
+ }
220
290
  for(const [command,pattern] of SESSION_STATUS){
221
- const result=invokeController(ctx,command,{capture:true});
291
+ const result=invokeController(ctx,command,{capture:true,echoCaptured:verbose});
222
292
  if(!pattern.test(result.stdout)) throw new Error(`remote session authority verification failed: ${command} did not report ARMED`);
223
293
  }
224
294
  ready=true;
225
- process.stdout.write('[DEVICE] DEADBYTE MCP online; all authority planes ARMED.\n');
226
- await tailRemoteLogs(ctx.root,aborter.signal);
295
+ if(verbose) process.stdout.write('[DEVICE] DEADBYTE MCP online; all authority planes ARMED.\n');
296
+ else process.stdout.write('[OK] Authority ARMED: process, coding, autonomous, host\n');
297
+ await tailRemoteLogs(ctx.root,aborter.signal,{verbose,journal:resultJournal});
227
298
  }finally{
228
299
  process.removeListener('SIGINT',abort);process.removeListener('SIGTERM',abort);
229
300
  if(watchStdin){process.stdin.removeListener('end',abort);process.stdin.removeListener('close',abort);process.stdin.pause();}
230
- if(ready||!aborter.signal.aborted) process.stdout.write('[INFO] Closing remote device session and revoking authority...\n');
231
- await cleanupRemoteSession(ctx);
301
+ if(ready||!aborter.signal.aborted) process.stdout.write(verbose?'[INFO] Closing remote device session and revoking authority...\n':'[INFO] Disconnecting; revoking authority...\n');
302
+ await cleanupRemoteSession(ctx,{verbose});
232
303
  await releaseRemoteSession(ctx,marker);
233
304
  }
234
305
  }
235
306
  async function runRemote(args){
236
307
  if(args.length===0){await runRemoteSession();return;}
237
- if(args.length>1) throw new Error('remote accepts at most one controller command');
308
+ if(args.length===1&&args[0]==='--verbose'){await runRemoteSession({verbose:true});return;}
309
+ if(args.length===2&&args[0]==='--resume'){await runRemoteSession({resumeCursor:args[1]});return;}
310
+ if(args.length===3&&args[0]==='--verbose'&&args[1]==='--resume'){
311
+ await runRemoteSession({verbose:true,resumeCursor:args[2]});return;
312
+ }
313
+ if(args.length===3&&args[0]==='--resume'&&args[2]==='--verbose'){
314
+ await runRemoteSession({verbose:true,resumeCursor:args[1]});return;
315
+ }
316
+ if(args.length>1) throw new Error('remote accepts one controller command, --verbose, or --resume <cursor>');
238
317
  const command=args[0];if(!REMOTE_COMMANDS.has(command)) throw new Error(`unsupported remote command '${command}'`);
239
318
  const ctx=await remoteContext();
240
319
  const result=invokeController(ctx,command,{allowFailure:true});
241
320
  process.exitCode=result.status;
242
321
  }
322
+ async function runSupervisor(args){
323
+ const action=args[0]||'status';
324
+ if(args.length>1||!Object.hasOwn(SUPERVISOR_COMMANDS,action)) throw new Error(`unsupported supervisor command '${action}'`);
325
+ const ctx=await remoteContext();
326
+ const result=invokeController(ctx,SUPERVISOR_COMMANDS[action],{allowFailure:true});
327
+ process.exitCode=result.status;
328
+ }
243
329
  async function runAudit(args){
244
330
  const command=args[0]||'status';if(args.length>1) throw new Error('audit accepts one command');
245
331
  if(!['verify','status'].includes(command)) throw new Error(`unsupported audit command '${command}'`);
@@ -251,7 +337,13 @@ async function runAudit(args){
251
337
  async function main(argv){
252
338
  const [command,...rest]=argv;
253
339
  if(!command||command==='help'||command==='--help'||command==='-h'){printHelp();return;}
340
+ if(command==='mcp'){
341
+ if(rest.length) throw new Error('mcp accepts no arguments');
342
+ await import('./mcp-server.mjs');
343
+ return;
344
+ }
254
345
  if(command==='remote'){await runRemote(rest);return;}
346
+ if(command==='supervisor'){await runSupervisor(rest);return;}
255
347
  if(command==='audit'){await runAudit(rest);return;}
256
348
  throw new Error(`unknown command '${command}'`);
257
349
  }
@@ -0,0 +1,43 @@
1
+ const ID=/^[A-Za-z0-9._-]{1,64}$/;
2
+ const OP=/^[a-z][a-z0-9._-]{0,63}$/;
3
+ const MIME=/^[A-Za-z0-9!#$&^_.+-]+\/[A-Za-z0-9!#$&^_.+-]+$/;
4
+ function bound(value,name,min,max){if(!Number.isInteger(value)||value<min||value>max)throw new Error(`${name} must be an integer in [${min}, ${max}]`);return value;}
5
+ function validateDescriptor(value){
6
+ if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('document adapter must be an object');
7
+ if(!ID.test(value.id??''))throw new Error('document adapter id invalid');
8
+ if(!OP.test(value.operation??''))throw new Error('document adapter operation invalid');
9
+ if(!Array.isArray(value.inputMime)||value.inputMime.length<1||value.inputMime.length>16||value.inputMime.some(x=>typeof x!=='string'||!MIME.test(x)))throw new Error('document adapter inputMime invalid');
10
+ if(typeof value.outputMime!=='string'||!MIME.test(value.outputMime))throw new Error('document adapter outputMime invalid');
11
+ if(typeof value.transform!=='function')throw new Error('document adapter transform must be a function');
12
+ return {id:value.id,operation:value.operation,inputMime:[...new Set(value.inputMime)],outputMime:value.outputMime,transform:value.transform};
13
+ }
14
+ function metadataObject(value){
15
+ if(value===undefined)return {};
16
+ if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('document adapter metadata must be an object');
17
+ JSON.stringify(value);
18
+ return value;
19
+ }
20
+ export function createDocumentAdapterRegistry({maxInputBytes=8*1024*1024,maxOutputBytes=16*1024*1024}={}){
21
+ bound(maxInputBytes,'maxInputBytes',1,64*1024*1024); bound(maxOutputBytes,'maxOutputBytes',1,128*1024*1024);
22
+ const adapters=new Map();
23
+ function register(value){
24
+ const adapter=validateDescriptor(value);
25
+ if(adapters.has(adapter.id))throw new Error(`document adapter '${adapter.id}' already registered`);
26
+ adapters.set(adapter.id,adapter);
27
+ return {id:adapter.id};
28
+ }
29
+ function list(){return [...adapters.values()].map(a=>({id:a.id,operation:a.operation,input_mime:[...a.inputMime],output_mime:a.outputMime})).sort((a,b)=>a.id.localeCompare(b.id));}
30
+ async function run({adapterId,operation,inputMime,bytes}){
31
+ const adapter=adapters.get(adapterId);
32
+ if(!adapter)throw new Error(`document adapter '${adapterId}' is not registered`);
33
+ if(operation!==adapter.operation)throw new Error(`document adapter operation mismatch: expected ${adapter.operation}`);
34
+ if(!adapter.inputMime.includes(inputMime))throw new Error(`document adapter input MIME denied: ${inputMime}`);
35
+ if(!Buffer.isBuffer(bytes))throw new Error('document adapter input bytes must be a Buffer');
36
+ if(bytes.length>maxInputBytes)throw new Error(`document adapter input exceeds ${maxInputBytes} byte limit`);
37
+ const result=await adapter.transform({bytes:Buffer.from(bytes),inputMime,operation});
38
+ if(!result||!Buffer.isBuffer(result.bytes))throw new Error('document adapter transform must return Buffer bytes');
39
+ if(result.bytes.length>maxOutputBytes)throw new Error(`document adapter output exceeds ${maxOutputBytes} byte limit`);
40
+ return {status:'ok',adapter_id:adapter.id,operation:adapter.operation,input_mime:inputMime,output_mime:adapter.outputMime,bytes:Buffer.from(result.bytes),metadata:metadataObject(result.metadata)};
41
+ }
42
+ return Object.freeze({register,list,run});
43
+ }
@@ -0,0 +1,112 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFileSync } from 'node:fs';
3
+ import { spawn } from 'node:child_process';
4
+
5
+ const HEX64=/^[0-9a-f]{64}$/;
6
+ const sha256File=file=>createHash('sha256').update(readFileSync(file)).digest('hex');
7
+ const frame=value=>{const body=Buffer.from(JSON.stringify(value),'utf8');return Buffer.concat([Buffer.from(`Content-Length: ${body.length}\r\n\r\n`,'ascii'),body]);};
8
+
9
+ export function createLspStdioClient({executablePath,expectedSha256,args=[],cwd,env={},dependencies=[],requestTimeoutMs=10000,maxMessageBytes=4*1024*1024}){
10
+ if(typeof executablePath!=='string'||executablePath.length<1) throw new Error('LSP executable path missing');
11
+ if(!HEX64.test(expectedSha256??'')) throw new Error('LSP executable SHA-256 invalid');
12
+ const actual=sha256File(executablePath);
13
+ if(actual!==expectedSha256) throw new Error(`LSP executable SHA-256 mismatch: expected ${expectedSha256}, found ${actual}`);
14
+ if(!Array.isArray(dependencies)) throw new Error('LSP dependencies must be an array');
15
+ for(const dependency of dependencies){
16
+ if(!dependency||typeof dependency!=='object'||typeof dependency.path!=='string'||dependency.path.length<1||!HEX64.test(dependency.expectedSha256??'')) throw new Error('LSP dependency identity invalid');
17
+ const observed=sha256File(dependency.path);
18
+ if(observed!==dependency.expectedSha256) throw new Error(`LSP dependency SHA-256 mismatch: expected ${dependency.expectedSha256}, found ${observed}`);
19
+ }
20
+ if(!Array.isArray(args)||args.some(item=>typeof item!=='string')) throw new Error('LSP args must be strings');
21
+ if(!Number.isInteger(requestTimeoutMs)||requestTimeoutMs<1) throw new Error('LSP request timeout invalid');
22
+ if(!Number.isInteger(maxMessageBytes)||maxMessageBytes<256) throw new Error('LSP max message bytes invalid');
23
+ const child=spawn(executablePath,args,{cwd,env:{...env},stdio:['pipe','pipe','pipe'],shell:false,windowsHide:true});
24
+ let input=Buffer.alloc(0);
25
+ let nextId=1;
26
+ let closed=false;
27
+ let expectedExit=false;
28
+ let initialized=false;
29
+ let fatalError=null;
30
+ const pending=new Map();
31
+
32
+ const rejectAll=error=>{
33
+ if(!fatalError) fatalError=error;
34
+ for(const entry of pending.values()) { clearTimeout(entry.timer); entry.reject(error); }
35
+ pending.clear();
36
+ };
37
+ const fail=error=>{
38
+ rejectAll(error instanceof Error?error:new Error(String(error)));
39
+ if(!child.killed) child.kill();
40
+ };
41
+ const dispatch=message=>{
42
+ if(!message||typeof message!=='object') return;
43
+ if(message.id===undefined||message.id===null) return;
44
+ const entry=pending.get(message.id);
45
+ if(!entry) return;
46
+ pending.delete(message.id); clearTimeout(entry.timer);
47
+ if(message.error) entry.reject(new Error(`LSP error ${message.error.code??''}: ${message.error.message??'unknown'}`));
48
+ else entry.resolve(message.result);
49
+ };
50
+ const drain=()=>{
51
+ while(input.length>0){
52
+ const marker=input.indexOf('\r\n\r\n');
53
+ if(marker<0){ if(input.length>8192) fail(new Error('LSP header exceeds 8192 bytes')); return; }
54
+ const header=input.subarray(0,marker).toString('ascii');
55
+ const match=/(?:^|\r\n)Content-Length:\s*(\d+)\s*(?:\r\n|$)/i.exec(header);
56
+ if(!match){ fail(new Error('LSP Content-Length header missing')); return; }
57
+ const size=Number(match[1]);
58
+ if(!Number.isSafeInteger(size)||size<0){ fail(new Error('LSP Content-Length invalid')); return; }
59
+ if(size>maxMessageBytes){ fail(new Error(`LSP message exceeds ${maxMessageBytes} bytes`)); return; }
60
+ const start=marker+4;
61
+ if(input.length<start+size) return;
62
+ const body=input.subarray(start,start+size); input=input.subarray(start+size);
63
+ let parsed;
64
+ try { parsed=JSON.parse(body.toString('utf8')); }
65
+ catch { fail(new Error('LSP message JSON invalid')); return; }
66
+ dispatch(parsed);
67
+ }
68
+ };
69
+ child.stdout.on('data',chunk=>{ if(closed) return; input=Buffer.concat([input,chunk]); drain(); });
70
+ child.on('error',error=>rejectAll(new Error(`LSP process error: ${error.message}`)));
71
+ child.on('exit',(code,signal)=>{
72
+ closed=true;
73
+ if(!expectedExit) rejectAll(new Error(`LSP process exited unexpectedly with code ${code===null?'null':code}${signal?` signal ${signal}`:''}`));
74
+ else rejectAll(new Error('LSP process closed'));
75
+ });
76
+
77
+ const send=value=>{
78
+ if(fatalError) throw fatalError;
79
+ if(closed||child.stdin.destroyed) throw new Error('LSP process is closed');
80
+ child.stdin.write(frame(value));
81
+ };
82
+ const request=(method,params=undefined)=>{
83
+ if(typeof method!=='string'||method.length<1) return Promise.reject(new Error('LSP request method missing'));
84
+ if(fatalError) return Promise.reject(fatalError);
85
+ const id=nextId++;
86
+ return new Promise((resolve,reject)=>{
87
+ const timer=setTimeout(()=>{pending.delete(id);reject(new Error(`LSP request timeout after ${requestTimeoutMs}ms: ${method}`));},requestTimeoutMs);
88
+ pending.set(id,{resolve,reject,timer,method});
89
+ try { const message={jsonrpc:'2.0',id,method}; if(params!==undefined) message.params=params; send(message); }
90
+ catch(error){clearTimeout(timer);pending.delete(id);reject(error);}
91
+ });
92
+ };
93
+ const notify=(method,params=undefined)=>{const message={jsonrpc:'2.0',method};if(params!==undefined)message.params=params;send(message);};
94
+ const initialize=async params=>{
95
+ const result=await request('initialize',params??{});
96
+ initialized=true;
97
+ notify('initialized',{});
98
+ return result;
99
+ };
100
+ const shutdown=async()=>{
101
+ if(expectedExit||closed) return;
102
+ expectedExit=true;
103
+ let shutdownError=null;
104
+ try { if(initialized) await request('shutdown'); }
105
+ catch(error){ shutdownError=error; }
106
+ try { if(!closed) notify('exit'); } catch {}
107
+ if(!closed) await new Promise(resolve=>{const timer=setTimeout(()=>{if(!child.killed)child.kill();resolve();},250);child.once('exit',()=>{clearTimeout(timer);resolve();});});
108
+ closed=true;
109
+ if(shutdownError) throw shutdownError;
110
+ };
111
+ return Object.freeze({initialize,notify,request,shutdown});
112
+ }
@@ -58,8 +58,9 @@ const stderrChunks = [];
58
58
  transport.stderr?.on('data', chunk => stderrChunks.push(Buffer.from(chunk)));
59
59
  const baseTools = ['contained_transform','evidence_verify','file_read','proof_execute','workspace_open'];
60
60
  const codingTools = [
61
- 'coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write',
61
+ 'coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_files_read',
62
62
  'coding_receipt_verify','coding_search','coding_session_status','coding_stat',
63
+ 'coding_symbol_definition','coding_symbol_outline','coding_symbol_references','coding_symbol_replace',
63
64
  'coding_task_approve','coding_task_cancel','coding_task_events','coding_task_run',
64
65
  'coding_task_status','coding_task_submit','coding_task_verify','coding_text_replace','coding_tree'
65
66
  ];
@@ -24,6 +24,8 @@ import { createProcessRuntime } from './process-runtime.mjs';
24
24
  import { registerProcessTools } from './process-mcp-tools.mjs';
25
25
  import { createCodingRuntime, loadCodingPolicy } from './coding-plane.mjs';
26
26
  import { createCodingTaskRuntime } from './coding-task-runtime.mjs';
27
+ import { createSemanticCodeRuntime } from './semantic-code.mjs';
28
+ import { loadSemanticLspBackends, semanticConfigBindingFromEnv } from './semantic-lsp-config.mjs';
27
29
  import { registerCodingTools } from './coding-mcp-tools.mjs';
28
30
  import { createMachineFsRuntime } from './machine-fs.mjs';
29
31
  import { registerMachineFsTools } from './machine-fs-mcp-tools.mjs';
@@ -36,6 +38,7 @@ import { startAutonomousSupervisor } from './autonomous-supervisor.mjs';
36
38
  import { registerAutonomousTools } from './autonomous-mcp-tools.mjs';
37
39
  import { createToolAudit, installToolAudit } from './tool-audit.mjs';
38
40
  import { createAuditContextProvider } from './audit-context.mjs';
41
+ import { registerOperatorSurface } from './operator-surface.mjs';
39
42
  import {
40
43
  containedTransformOutputSchema,
41
44
  evidenceVerifyOutputSchema,
@@ -99,6 +102,11 @@ if (codingRuntimeMode === '1' && !codingPolicyPath) throw new Error('DEADBYTE_CO
99
102
  const codingPolicy = codingRuntimeMode === '1' ? await loadCodingPolicy(codingPolicyPath) : null;
100
103
  const codingRuntime = codingPolicy ? createCodingRuntime({ policy: codingPolicy, signingKeyPath, verifyKeyPath }) : null;
101
104
  const codingTaskRuntime = codingRuntime ? createCodingTaskRuntime({ codingRuntime, signingKeyPath, verifyKeyPath }) : null;
105
+ const semanticLspBinding = semanticConfigBindingFromEnv(process.env);
106
+ const semanticLsp = codingRuntime && semanticLspBinding
107
+ ? await loadSemanticLspBackends({ ...semanticLspBinding, codingRuntime })
108
+ : { backends: [], required_ids: [] };
109
+ const semanticRuntime = codingRuntime ? createSemanticCodeRuntime({ codingRuntime, backends: semanticLsp.backends }) : null;
102
110
  const machineFsRuntimeMode = process.env.DEADBYTE_MACHINE_FS_RUNTIME ?? '0';
103
111
  if (!['0','1'].includes(machineFsRuntimeMode)) throw new Error('DEADBYTE_MACHINE_FS_RUNTIME must be 0 or 1');
104
112
  if (machineFsRuntimeMode === '1' && !codingPolicy) throw new Error('DEADBYTE_MACHINE_FS_RUNTIME=1 requires DEADBYTE_CODING_RUNTIME=1');
@@ -116,6 +124,10 @@ const observationRuntime = observationRuntimeMode === '1'
116
124
 
117
125
  const autonomousRuntimeMode = process.env.DEADBYTE_AUTONOMOUS_RUNTIME ?? '0';
118
126
  if (!['0','1'].includes(autonomousRuntimeMode)) throw new Error('DEADBYTE_AUTONOMOUS_RUNTIME must be 0 or 1');
127
+ const autonomousSupervisorMode = process.env.DEADBYTE_AUTONOMOUS_SUPERVISOR_MODE ?? 'in_process';
128
+ if (!['in_process','external'].includes(autonomousSupervisorMode)) {
129
+ throw new Error('DEADBYTE_AUTONOMOUS_SUPERVISOR_MODE must be in_process or external');
130
+ }
119
131
  if (autonomousRuntimeMode === '1' && !codingRuntime) throw new Error('DEADBYTE_AUTONOMOUS_RUNTIME=1 requires DEADBYTE_CODING_RUNTIME=1');
120
132
  const localAutonomousPolicyPath = path.join(packageRoot,'controller','deadbyte-autonomous-policy.json');
121
133
  let autonomousPolicyPath = process.env.DEADBYTE_AUTONOMOUS_POLICY ?? '';
@@ -128,7 +140,8 @@ const autonomousPolicy = autonomousRuntimeMode === '1' ? await loadAutonomousPol
128
140
  const nativeDiffRuntime = autonomousPolicy ? createNativeDiffRuntime({ policy:autonomousPolicy,codingRuntime,signingKeyPath,verifyKeyPath }) : null;
129
141
  const autonomousRuntime = autonomousPolicy ? createAutonomousRuntime({ policy:autonomousPolicy,codingRuntime,nativeDiffRuntime,
130
142
  machineFsRuntime,observationRuntime,processRuntime,signingKeyPath,verifyKeyPath }) : null;
131
- const autonomousSupervisor = autonomousRuntime && autonomousPolicy.planner.backend === 'openai_compatible'
143
+ const autonomousSupervisor = autonomousRuntime && autonomousPolicy.planner.backend === 'openai_compatible' &&
144
+ autonomousSupervisorMode === 'in_process'
132
145
  ? startAutonomousSupervisor({ runtime: autonomousRuntime, policy: autonomousPolicy })
133
146
  : null;
134
147
  void autonomousSupervisor;
@@ -158,6 +171,7 @@ function textResult(schema, object, isError = false) {
158
171
 
159
172
  serveStdio(() => {
160
173
  const server = new McpServer({ name: 'deadbyte-mcp', version: DEADBYTE_VERSION });
174
+ registerOperatorSurface(server,{packageRoot});
161
175
  if (toolAudit) installToolAudit(server,toolAudit);
162
176
 
163
177
  server.registerTool(
@@ -313,8 +327,8 @@ serveStdio(() => {
313
327
  registerProcessTools(server, { runtime: processRuntime });
314
328
  }
315
329
 
316
- if (codingRuntime && codingTaskRuntime) {
317
- registerCodingTools(server, { codingRuntime, taskRuntime: codingTaskRuntime });
330
+ if (codingRuntime && codingTaskRuntime && semanticRuntime) {
331
+ registerCodingTools(server, { codingRuntime, taskRuntime: codingTaskRuntime, semanticRuntime });
318
332
  }
319
333
 
320
334
  if (machineFsRuntime) {
@@ -53,8 +53,9 @@ const transport=new StdioClientTransport({command:process.execPath,args:[serverP
53
53
  const stderr=[]; transport.stderr?.on('data',chunk=>stderr.push(Buffer.from(chunk)));
54
54
  const base=['contained_transform','evidence_verify','file_read','proof_execute','workspace_open'];
55
55
  const machine=['machine_list','machine_ping','machine_revoke','machine_status'];
56
- const coding=['coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_receipt_verify','coding_search',
57
- 'coding_session_status','coding_stat','coding_task_approve','coding_task_cancel','coding_task_events','coding_task_run','coding_task_status',
56
+ const coding=['coding_benchmark_run','coding_command_run','coding_file_read','coding_file_write','coding_files_read','coding_receipt_verify','coding_search',
57
+ 'coding_session_status','coding_stat','coding_symbol_definition','coding_symbol_outline','coding_symbol_references','coding_symbol_replace',
58
+ 'coding_task_approve','coding_task_cancel','coding_task_events','coding_task_run','coding_task_status',
58
59
  'coding_task_submit','coding_task_verify','coding_text_replace','coding_tree'];
59
60
  const observation=['machine_process_list','machine_search_cancel','machine_search_page','machine_search_start','machine_search_status','machine_system_status'];
60
61
  const expected=[...base,...machine,...coding,...observation].sort();
@@ -0,0 +1,37 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import * as z from 'zod/v4';
4
+
5
+ function userMessage(text){return {messages:[{role:'user',content:{type:'text',text}}]};}
6
+ function workflow(goal,verb){
7
+ return [
8
+ `${verb}: ${goal}`,
9
+ 'Read deadbyte://context only if domain vocabulary or invariants are needed.',
10
+ 'Inspect the smallest relevant source/evidence slice; prefer semantic navigation or bounded search over whole-repo reads.',
11
+ 'State the acceptance condition, reproduce the current behavior, then make one surgical change.',
12
+ 'Verify with the narrow test first, then relevant regression gates. If a tool fails, change the hypothesis instead of retrying blindly.',
13
+ 'Report observed outcome and remaining blockers; never call a claim verified without evidence.'
14
+ ].join('\n');
15
+ }
16
+
17
+ export function registerOperatorSurface(server,{packageRoot}){
18
+ if(!server||!packageRoot) throw new Error('operator surface requires server and packageRoot');
19
+ const contextPath=path.join(packageRoot,'CONTEXT.md');
20
+ const architecturePath=path.join(packageRoot,'docs','ADR-0001-PRODUCTION-BASELINE-SEAMS.md');
21
+ const argSchema=z.strictObject({goal:z.string().min(1).max(2000)});
22
+ for(const [name,title,verb] of [
23
+ ['deadbyte.review','Review','Review the requested code or change'],
24
+ ['deadbyte.patch','Patch','Patch the requested behavior'],
25
+ ['deadbyte.diagnose','Diagnose','Diagnose the reported failure'],
26
+ ['deadbyte.run-tests','Run tests','Verify the requested behavior with tests']
27
+ ]){
28
+ server.registerPrompt(name,{title,description:`Compact DEADBYTE ${title.toLowerCase()} workflow with evidence-first verification.`,argsSchema:argSchema},
29
+ async ({goal})=>userMessage(workflow(goal,verb)));
30
+ }
31
+ server.registerResource('deadbyte-context','deadbyte://context',{
32
+ title:'DEADBYTE MCP Context',description:'Canonical production vocabulary, context discipline, and Final-baseline invariants.',mimeType:'text/markdown'
33
+ },async uri=>({contents:[{uri:uri.href,mimeType:'text/markdown',text:await readFile(contextPath,'utf8')}]}));
34
+ server.registerResource('deadbyte-architecture','deadbyte://architecture',{
35
+ title:'DEADBYTE MCP Architecture',description:'Production module seams, tracer bullet, policy, telemetry, semantic and remote decisions.',mimeType:'text/markdown'
36
+ },async uri=>({contents:[{uri:uri.href,mimeType:'text/markdown',text:await readFile(architecturePath,'utf8')}]}));
37
+ }