@quolu/lattice 0.1.0 → 0.12.2

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 (370) hide show
  1. package/README.md +87 -4
  2. package/bin/lattice-bridge.mjs +87 -0
  3. package/bin/lattice-dashboard.mjs +70 -0
  4. package/bin/lattice-mcp.mjs +9 -9
  5. package/bin/lattice.mjs +61 -8
  6. package/docs/bridge-setup.md +87 -0
  7. package/docs/schemas/lattice.plan_create_input.v1.schema.json +56 -0
  8. package/docs/schemas/lattice.plan_create_input.v2.schema.json +72 -0
  9. package/docs/schemas/lattice.plan_create_input.v3.schema.json +81 -0
  10. package/package.json +19 -7
  11. package/sensor/dist/bin/command-supervision.d.ts +1 -1
  12. package/sensor/dist/bin/command-supervision.js +4 -4
  13. package/sensor/dist/bin/command-supervision.js.map +1 -1
  14. package/sensor/dist/bin/fatal-handler.js +2 -2
  15. package/sensor/dist/bin/fatal-handler.js.map +1 -1
  16. package/sensor/dist/bin/{codegraph.js → lattice-sensor.js} +207 -328
  17. package/sensor/dist/bin/node-version-check.d.ts +7 -5
  18. package/sensor/dist/bin/node-version-check.d.ts.map +1 -1
  19. package/sensor/dist/bin/node-version-check.js +19 -14
  20. package/sensor/dist/bin/node-version-check.js.map +1 -1
  21. package/sensor/dist/context/index.d.ts +1 -1
  22. package/sensor/dist/context/index.js +6 -6
  23. package/sensor/dist/context/index.js.map +1 -1
  24. package/sensor/dist/db/index.d.ts +5 -5
  25. package/sensor/dist/db/index.d.ts.map +1 -1
  26. package/sensor/dist/db/index.js +7 -7
  27. package/sensor/dist/db/index.js.map +1 -1
  28. package/sensor/dist/db/migrations.js +1 -1
  29. package/sensor/dist/db/migrations.js.map +1 -1
  30. package/sensor/dist/db/queries.d.ts +1 -1
  31. package/sensor/dist/db/queries.js +5 -5
  32. package/sensor/dist/db/queries.js.map +1 -1
  33. package/sensor/dist/db/schema.sql +2 -2
  34. package/sensor/dist/db/sqlite-adapter.d.ts +2 -2
  35. package/sensor/dist/db/sqlite-adapter.js +3 -3
  36. package/sensor/dist/db/sqlite-adapter.js.map +1 -1
  37. package/sensor/dist/db/wal-valve.d.ts +1 -1
  38. package/sensor/dist/db/wal-valve.d.ts.map +1 -1
  39. package/sensor/dist/db/wal-valve.js +2 -2
  40. package/sensor/dist/db/wal-valve.js.map +1 -1
  41. package/sensor/dist/directory.d.ts +27 -63
  42. package/sensor/dist/directory.d.ts.map +1 -1
  43. package/sensor/dist/directory.js +78 -134
  44. package/sensor/dist/directory.js.map +1 -1
  45. package/sensor/dist/errors.d.ts +15 -15
  46. package/sensor/dist/errors.d.ts.map +1 -1
  47. package/sensor/dist/errors.js +21 -21
  48. package/sensor/dist/errors.js.map +1 -1
  49. package/sensor/dist/extraction/dynamic-import.d.ts +1 -1
  50. package/sensor/dist/extraction/dynamic-import.js +1 -1
  51. package/sensor/dist/extraction/extraction-version.d.ts +1 -1
  52. package/sensor/dist/extraction/extraction-version.js +1 -1
  53. package/sensor/dist/extraction/generated-detection.d.ts +1 -1
  54. package/sensor/dist/extraction/generated-detection.js +1 -1
  55. package/sensor/dist/extraction/grammars.d.ts +3 -3
  56. package/sensor/dist/extraction/grammars.js +5 -5
  57. package/sensor/dist/extraction/grammars.js.map +1 -1
  58. package/sensor/dist/extraction/index.d.ts +6 -6
  59. package/sensor/dist/extraction/index.js +50 -50
  60. package/sensor/dist/extraction/index.js.map +1 -1
  61. package/sensor/dist/extraction/kernel/decode.d.ts +1 -1
  62. package/sensor/dist/extraction/kernel/decode.js +1 -1
  63. package/sensor/dist/extraction/kernel/index.d.ts +3 -3
  64. package/sensor/dist/extraction/kernel/index.js +6 -6
  65. package/sensor/dist/extraction/kernel/index.js.map +1 -1
  66. package/sensor/dist/extraction/kernel/layout.d.ts +1 -1
  67. package/sensor/dist/extraction/kernel/layout.js +1 -1
  68. package/sensor/dist/extraction/kernel/loader.d.ts +6 -6
  69. package/sensor/dist/extraction/kernel/loader.js +13 -13
  70. package/sensor/dist/extraction/kernel/loader.js.map +1 -1
  71. package/sensor/dist/extraction/languages/cfquery.d.ts +1 -1
  72. package/sensor/dist/extraction/languages/cfquery.js +1 -1
  73. package/sensor/dist/extraction/languages/lua.d.ts +11 -0
  74. package/sensor/dist/extraction/languages/lua.d.ts.map +1 -1
  75. package/sensor/dist/extraction/languages/lua.js +1 -0
  76. package/sensor/dist/extraction/languages/lua.js.map +1 -1
  77. package/sensor/dist/extraction/parse-pool.d.ts +5 -5
  78. package/sensor/dist/extraction/parse-pool.d.ts.map +1 -1
  79. package/sensor/dist/extraction/parse-pool.js +4 -4
  80. package/sensor/dist/extraction/parse-worker.js +1 -1
  81. package/sensor/dist/extraction/parse-worker.js.map +1 -1
  82. package/sensor/dist/extraction/store-writer.d.ts +1 -1
  83. package/sensor/dist/extraction/store-writer.js +1 -1
  84. package/sensor/dist/extraction/svelte-extractor.d.ts +1 -1
  85. package/sensor/dist/extraction/svelte-extractor.js +1 -1
  86. package/sensor/dist/extraction/tree-sitter-helpers.js +1 -1
  87. package/sensor/dist/extraction/tree-sitter.d.ts +2 -2
  88. package/sensor/dist/extraction/tree-sitter.d.ts.map +1 -1
  89. package/sensor/dist/extraction/tree-sitter.js +71 -4
  90. package/sensor/dist/extraction/tree-sitter.js.map +1 -1
  91. package/sensor/dist/extraction/wasm-runtime-flags.d.ts +2 -2
  92. package/sensor/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  93. package/sensor/dist/extraction/wasm-runtime-flags.js +5 -5
  94. package/sensor/dist/extraction/wasm-runtime-flags.js.map +1 -1
  95. package/sensor/dist/index.d.ts +36 -36
  96. package/sensor/dist/index.d.ts.map +1 -1
  97. package/sensor/dist/index.js +71 -71
  98. package/sensor/dist/index.js.map +1 -1
  99. package/sensor/dist/mcp/daemon-manager.js +1 -1
  100. package/sensor/dist/mcp/daemon-paths.d.ts +3 -3
  101. package/sensor/dist/mcp/daemon-paths.js +7 -7
  102. package/sensor/dist/mcp/daemon-paths.js.map +1 -1
  103. package/sensor/dist/mcp/daemon-registry.d.ts +2 -2
  104. package/sensor/dist/mcp/daemon-registry.js +5 -5
  105. package/sensor/dist/mcp/daemon.d.ts +7 -7
  106. package/sensor/dist/mcp/daemon.d.ts.map +1 -1
  107. package/sensor/dist/mcp/daemon.js +21 -21
  108. package/sensor/dist/mcp/daemon.js.map +1 -1
  109. package/sensor/dist/mcp/dynamic-boundaries.js +1 -1
  110. package/sensor/dist/mcp/engine.d.ts +9 -9
  111. package/sensor/dist/mcp/engine.d.ts.map +1 -1
  112. package/sensor/dist/mcp/engine.js +44 -44
  113. package/sensor/dist/mcp/engine.js.map +1 -1
  114. package/sensor/dist/mcp/index.d.ts +14 -14
  115. package/sensor/dist/mcp/index.d.ts.map +1 -1
  116. package/sensor/dist/mcp/index.js +41 -41
  117. package/sensor/dist/mcp/index.js.map +1 -1
  118. package/sensor/dist/mcp/liveness-watchdog.js +7 -7
  119. package/sensor/dist/mcp/liveness-watchdog.js.map +1 -1
  120. package/sensor/dist/mcp/ppid-watchdog.d.ts +3 -3
  121. package/sensor/dist/mcp/ppid-watchdog.js +2 -2
  122. package/sensor/dist/mcp/proxy.d.ts.map +1 -1
  123. package/sensor/dist/mcp/proxy.js +37 -37
  124. package/sensor/dist/mcp/proxy.js.map +1 -1
  125. package/sensor/dist/mcp/query-pool.d.ts +3 -3
  126. package/sensor/dist/mcp/query-pool.js +7 -7
  127. package/sensor/dist/mcp/query-pool.js.map +1 -1
  128. package/sensor/dist/mcp/query-worker.d.ts +2 -2
  129. package/sensor/dist/mcp/query-worker.js +7 -7
  130. package/sensor/dist/mcp/query-worker.js.map +1 -1
  131. package/sensor/dist/mcp/server-instructions.d.ts +10 -12
  132. package/sensor/dist/mcp/server-instructions.d.ts.map +1 -1
  133. package/sensor/dist/mcp/server-instructions.js +39 -37
  134. package/sensor/dist/mcp/server-instructions.js.map +1 -1
  135. package/sensor/dist/mcp/session.d.ts +2 -2
  136. package/sensor/dist/mcp/session.js +18 -18
  137. package/sensor/dist/mcp/session.js.map +1 -1
  138. package/sensor/dist/mcp/startup-handshake.d.ts +3 -3
  139. package/sensor/dist/mcp/startup-handshake.d.ts.map +1 -1
  140. package/sensor/dist/mcp/startup-handshake.js +3 -3
  141. package/sensor/dist/mcp/startup-handshake.js.map +1 -1
  142. package/sensor/dist/mcp/tools.d.ts +53 -53
  143. package/sensor/dist/mcp/tools.d.ts.map +1 -1
  144. package/sensor/dist/mcp/tools.js +180 -216
  145. package/sensor/dist/mcp/tools.js.map +1 -1
  146. package/sensor/dist/mcp/transport.d.ts +1 -1
  147. package/sensor/dist/mcp/transport.js +6 -6
  148. package/sensor/dist/mcp/transport.js.map +1 -1
  149. package/sensor/dist/mcp/version.d.ts +2 -2
  150. package/sensor/dist/mcp/version.d.ts.map +1 -1
  151. package/sensor/dist/mcp/version.js +3 -3
  152. package/sensor/dist/mcp/version.js.map +1 -1
  153. package/sensor/dist/project-config.d.ts +6 -6
  154. package/sensor/dist/project-config.d.ts.map +1 -1
  155. package/sensor/dist/project-config.js +10 -10
  156. package/sensor/dist/project-config.js.map +1 -1
  157. package/sensor/dist/resolution/callback-synthesizer.js +4 -4
  158. package/sensor/dist/resolution/callback-synthesizer.js.map +1 -1
  159. package/sensor/dist/resolution/frameworks/drupal.d.ts +3 -3
  160. package/sensor/dist/resolution/frameworks/drupal.js +3 -3
  161. package/sensor/dist/resolution/frameworks/fabric.js +1 -1
  162. package/sensor/dist/resolution/frameworks/fabric.js.map +1 -1
  163. package/sensor/dist/resolution/frameworks/java.js +1 -1
  164. package/sensor/dist/resolution/frameworks/java.js.map +1 -1
  165. package/sensor/dist/resolution/frameworks/svelte.js +1 -1
  166. package/sensor/dist/resolution/frameworks/svelte.js.map +1 -1
  167. package/sensor/dist/resolution/goframe-synthesizer.d.ts +1 -1
  168. package/sensor/dist/resolution/goframe-synthesizer.js +1 -1
  169. package/sensor/dist/resolution/index.d.ts +1 -1
  170. package/sensor/dist/resolution/index.js +9 -9
  171. package/sensor/dist/resolution/index.js.map +1 -1
  172. package/sensor/dist/resolution/name-matcher.js +2 -2
  173. package/sensor/dist/resolution/name-matcher.js.map +1 -1
  174. package/sensor/dist/resolution/resolver-pool.d.ts +2 -2
  175. package/sensor/dist/resolution/resolver-pool.js +4 -4
  176. package/sensor/dist/resolution/resolver-pool.js.map +1 -1
  177. package/sensor/dist/resolution/resolver-worker.js +2 -2
  178. package/sensor/dist/resolution/resolver-worker.js.map +1 -1
  179. package/sensor/dist/resolution/workspace-packages.js +1 -1
  180. package/sensor/dist/resolution/workspace-packages.js.map +1 -1
  181. package/sensor/dist/search/identifier-segments.d.ts +1 -1
  182. package/sensor/dist/search/identifier-segments.js +1 -1
  183. package/sensor/dist/search/query-utils.d.ts +1 -0
  184. package/sensor/dist/search/query-utils.d.ts.map +1 -1
  185. package/sensor/dist/search/query-utils.js +10 -3
  186. package/sensor/dist/search/query-utils.js.map +1 -1
  187. package/sensor/dist/sync/git-hooks.d.ts +9 -9
  188. package/sensor/dist/sync/git-hooks.d.ts.map +1 -1
  189. package/sensor/dist/sync/git-hooks.js +15 -15
  190. package/sensor/dist/sync/git-hooks.js.map +1 -1
  191. package/sensor/dist/sync/watch-policy.d.ts +2 -2
  192. package/sensor/dist/sync/watch-policy.js +5 -5
  193. package/sensor/dist/sync/watch-policy.js.map +1 -1
  194. package/sensor/dist/sync/watcher.d.ts +2 -2
  195. package/sensor/dist/sync/watcher.d.ts.map +1 -1
  196. package/sensor/dist/sync/watcher.js +16 -16
  197. package/sensor/dist/sync/watcher.js.map +1 -1
  198. package/sensor/dist/sync/worktree.d.ts +5 -5
  199. package/sensor/dist/sync/worktree.d.ts.map +1 -1
  200. package/sensor/dist/sync/worktree.js +9 -9
  201. package/sensor/dist/sync/worktree.js.map +1 -1
  202. package/sensor/dist/telemetry/index.d.ts +8 -8
  203. package/sensor/dist/telemetry/index.d.ts.map +1 -1
  204. package/sensor/dist/telemetry/index.js +16 -16
  205. package/sensor/dist/telemetry/index.js.map +1 -1
  206. package/sensor/dist/types.d.ts +2 -2
  207. package/sensor/dist/types.js +1 -1
  208. package/sensor/dist/ui/color.d.ts +2 -2
  209. package/sensor/dist/ui/color.js +2 -2
  210. package/sensor/dist/ui/glyphs.d.ts +3 -3
  211. package/sensor/dist/ui/glyphs.js +7 -7
  212. package/sensor/dist/ui/glyphs.js.map +1 -1
  213. package/sensor/dist/utils.d.ts +4 -4
  214. package/sensor/dist/utils.js +8 -8
  215. package/sensor/dist/utils.js.map +1 -1
  216. package/sensor/package.json +8 -13
  217. package/src/artifact-contracts.mjs +2 -2
  218. package/src/boundary-compiler.mjs +28 -28
  219. package/src/boundary-observation-compiler-v2.mjs +10 -10
  220. package/src/bounded-seam.mjs +144 -0
  221. package/src/bridge-cli.mjs +227 -0
  222. package/src/bridge-config.mjs +346 -0
  223. package/src/bridge-daemon.mjs +328 -0
  224. package/src/bridge-launch-agent.mjs +311 -0
  225. package/src/bridge-server.mjs +309 -0
  226. package/src/cli-help.mjs +163 -0
  227. package/src/control-compiler.mjs +30 -30
  228. package/src/dag-chain.mjs +261 -0
  229. package/src/factory-diagnostics.mjs +8 -7
  230. package/src/hash-chain.mjs +76 -0
  231. package/src/node-version-guard.mjs +5 -4
  232. package/src/project-cli.mjs +392 -0
  233. package/src/project-identity.mjs +71 -0
  234. package/src/rc1-evidence-bundle.mjs +16 -16
  235. package/src/rc1-v4-campaign.mjs +15 -14
  236. package/src/rc1-v5-artifact-set.mjs +2 -2
  237. package/src/rc1-v5-campaign.mjs +15 -14
  238. package/src/rc1-v6-artifact-set.mjs +18 -18
  239. package/src/rc1-v6-campaign.mjs +16 -16
  240. package/src/rc1-v6-causal-binding.mjs +16 -14
  241. package/src/rc1-v6-measurement.mjs +20 -38
  242. package/src/rc2-artifact-set.mjs +45 -40
  243. package/src/rc2-campaign.mjs +48 -66
  244. package/src/rc2-delivery-policy-front-end.mjs +30 -30
  245. package/src/rc2-rc1-transfer-front-end.mjs +5 -5
  246. package/src/rc3-actual-dogfood.mjs +6 -6
  247. package/src/rc3-dogfood-scaffold.mjs +12 -7
  248. package/src/rc3-scripted-campaign.mjs +75 -21
  249. package/src/rc4-stage1-dogfood.mjs +24 -7
  250. package/src/runtime-cli.mjs +2424 -45
  251. package/src/runtime-contracts.mjs +7 -7
  252. package/src/runtime-control-store.mjs +547 -0
  253. package/src/runtime-controller-protocol.mjs +517 -0
  254. package/src/runtime-direct-os-observer.mjs +284 -0
  255. package/src/runtime-engine.mjs +2 -2
  256. package/src/runtime-errors.mjs +1 -1
  257. package/src/runtime-event-store.mjs +15 -43
  258. package/src/runtime-front-end.mjs +26 -26
  259. package/src/runtime-gate-store.mjs +477 -0
  260. package/src/runtime-hold-recompile.mjs +214 -23
  261. package/src/runtime-lifecycle-lock.mjs +290 -0
  262. package/src/runtime-managed-supervisor.mjs +1276 -0
  263. package/src/runtime-multi-epoch-store.mjs +761 -0
  264. package/src/runtime-projection.mjs +62 -0
  265. package/src/seam-transform.mjs +38 -38
  266. package/src/{codegraph-adapter.mjs → sensor-adapter.mjs} +7 -7
  267. package/src/sensor-cli.mjs +107 -0
  268. package/src/sensor-runtime.mjs +48 -0
  269. package/src/timestamp-contract.mjs +8 -0
  270. package/src/todo-chain.mjs +178 -0
  271. package/src/todo-cli.mjs +1032 -0
  272. package/src/todo-contracts.mjs +501 -0
  273. package/src/todo-dashboard-registry.mjs +318 -0
  274. package/src/todo-gantt-html.mjs +416 -0
  275. package/src/todo-gantt-layout.mjs +603 -0
  276. package/src/todo-gantt-live.mjs +269 -0
  277. package/src/todo-gantt-presentation.mjs +217 -0
  278. package/src/todo-gantt-svg.mjs +249 -0
  279. package/src/todo-markdown-renderer.mjs +260 -0
  280. package/src/todo-migration.mjs +260 -0
  281. package/src/todo-narrative-anchor.mjs +130 -0
  282. package/src/todo-revision.mjs +425 -0
  283. package/src/todo-status.mjs +340 -0
  284. package/src/todo-store.mjs +3451 -0
  285. package/src/treatment-compiler.mjs +28 -28
  286. package/src/treatment-runner.mjs +42 -44
  287. package/sensor/dist/bin/codegraph.d.ts +0 -26
  288. package/sensor/dist/bin/codegraph.d.ts.map +0 -1
  289. package/sensor/dist/bin/codegraph.js.map +0 -1
  290. package/sensor/dist/bin/uninstall.d.ts +0 -14
  291. package/sensor/dist/bin/uninstall.d.ts.map +0 -1
  292. package/sensor/dist/bin/uninstall.js +0 -36
  293. package/sensor/dist/bin/uninstall.js.map +0 -1
  294. package/sensor/dist/installer/beta-signup.d.ts +0 -54
  295. package/sensor/dist/installer/beta-signup.d.ts.map +0 -1
  296. package/sensor/dist/installer/beta-signup.js +0 -178
  297. package/sensor/dist/installer/beta-signup.js.map +0 -1
  298. package/sensor/dist/installer/config-writer.d.ts +0 -28
  299. package/sensor/dist/installer/config-writer.d.ts.map +0 -1
  300. package/sensor/dist/installer/config-writer.js +0 -91
  301. package/sensor/dist/installer/config-writer.js.map +0 -1
  302. package/sensor/dist/installer/index.d.ts +0 -142
  303. package/sensor/dist/installer/index.d.ts.map +0 -1
  304. package/sensor/dist/installer/index.js +0 -622
  305. package/sensor/dist/installer/index.js.map +0 -1
  306. package/sensor/dist/installer/instructions-template.d.ts +0 -41
  307. package/sensor/dist/installer/instructions-template.d.ts.map +0 -1
  308. package/sensor/dist/installer/instructions-template.js +0 -53
  309. package/sensor/dist/installer/instructions-template.js.map +0 -1
  310. package/sensor/dist/installer/targets/antigravity.d.ts +0 -57
  311. package/sensor/dist/installer/targets/antigravity.d.ts.map +0 -1
  312. package/sensor/dist/installer/targets/antigravity.js +0 -308
  313. package/sensor/dist/installer/targets/antigravity.js.map +0 -1
  314. package/sensor/dist/installer/targets/claude.d.ts +0 -62
  315. package/sensor/dist/installer/targets/claude.d.ts.map +0 -1
  316. package/sensor/dist/installer/targets/claude.js +0 -454
  317. package/sensor/dist/installer/targets/claude.js.map +0 -1
  318. package/sensor/dist/installer/targets/codex.d.ts +0 -18
  319. package/sensor/dist/installer/targets/codex.d.ts.map +0 -1
  320. package/sensor/dist/installer/targets/codex.js +0 -185
  321. package/sensor/dist/installer/targets/codex.js.map +0 -1
  322. package/sensor/dist/installer/targets/cursor.d.ts +0 -35
  323. package/sensor/dist/installer/targets/cursor.d.ts.map +0 -1
  324. package/sensor/dist/installer/targets/cursor.js +0 -254
  325. package/sensor/dist/installer/targets/cursor.js.map +0 -1
  326. package/sensor/dist/installer/targets/gemini.d.ts +0 -26
  327. package/sensor/dist/installer/targets/gemini.d.ts.map +0 -1
  328. package/sensor/dist/installer/targets/gemini.js +0 -165
  329. package/sensor/dist/installer/targets/gemini.js.map +0 -1
  330. package/sensor/dist/installer/targets/hermes.d.ts +0 -18
  331. package/sensor/dist/installer/targets/hermes.d.ts.map +0 -1
  332. package/sensor/dist/installer/targets/hermes.js +0 -359
  333. package/sensor/dist/installer/targets/hermes.js.map +0 -1
  334. package/sensor/dist/installer/targets/kiro.d.ts +0 -27
  335. package/sensor/dist/installer/targets/kiro.d.ts.map +0 -1
  336. package/sensor/dist/installer/targets/kiro.js +0 -178
  337. package/sensor/dist/installer/targets/kiro.js.map +0 -1
  338. package/sensor/dist/installer/targets/opencode.d.ts +0 -38
  339. package/sensor/dist/installer/targets/opencode.d.ts.map +0 -1
  340. package/sensor/dist/installer/targets/opencode.js +0 -288
  341. package/sensor/dist/installer/targets/opencode.js.map +0 -1
  342. package/sensor/dist/installer/targets/registry.d.ts +0 -35
  343. package/sensor/dist/installer/targets/registry.d.ts.map +0 -1
  344. package/sensor/dist/installer/targets/registry.js +0 -91
  345. package/sensor/dist/installer/targets/registry.js.map +0 -1
  346. package/sensor/dist/installer/targets/shared.d.ts +0 -101
  347. package/sensor/dist/installer/targets/shared.d.ts.map +0 -1
  348. package/sensor/dist/installer/targets/shared.js +0 -264
  349. package/sensor/dist/installer/targets/shared.js.map +0 -1
  350. package/sensor/dist/installer/targets/toml.d.ts +0 -52
  351. package/sensor/dist/installer/targets/toml.d.ts.map +0 -1
  352. package/sensor/dist/installer/targets/toml.js +0 -147
  353. package/sensor/dist/installer/targets/toml.js.map +0 -1
  354. package/sensor/dist/installer/targets/types.d.ts +0 -108
  355. package/sensor/dist/installer/targets/types.d.ts.map +0 -1
  356. package/sensor/dist/installer/targets/types.js +0 -16
  357. package/sensor/dist/installer/targets/types.js.map +0 -1
  358. package/sensor/dist/upgrade/index.d.ts +0 -171
  359. package/sensor/dist/upgrade/index.d.ts.map +0 -1
  360. package/sensor/dist/upgrade/index.js +0 -659
  361. package/sensor/dist/upgrade/index.js.map +0 -1
  362. package/sensor/dist/upgrade/remove-binary.d.ts +0 -87
  363. package/sensor/dist/upgrade/remove-binary.d.ts.map +0 -1
  364. package/sensor/dist/upgrade/remove-binary.js +0 -289
  365. package/sensor/dist/upgrade/remove-binary.js.map +0 -1
  366. package/sensor/dist/upgrade/update-check.d.ts +0 -92
  367. package/sensor/dist/upgrade/update-check.d.ts.map +0 -1
  368. package/sensor/dist/upgrade/update-check.js +0 -258
  369. package/sensor/dist/upgrade/update-check.js.map +0 -1
  370. package/src/bootstrap.mjs +0 -88
@@ -1,8 +1,6 @@
1
1
  import { execFile } from 'node:child_process';
2
2
  import { createHash } from 'node:crypto';
3
- import { constants as fsConstants } from 'node:fs';
4
3
  import {
5
- access,
6
4
  lstat,
7
5
  readFile,
8
6
  realpath,
@@ -20,6 +18,7 @@ import {
20
18
  createRc1V6EvidenceBundleDescriptor,
21
19
  verifyRc1V6RunEvidence,
22
20
  } from './rc1-v6-causal-binding.mjs';
21
+ import { LATTICE_SENSOR_CLI } from './sensor-runtime.mjs';
23
22
 
24
23
  const SHA256 = /^[0-9a-f]{64}$/;
25
24
  const GIT_SHA1 = /^[0-9a-f]{40}$/;
@@ -78,7 +77,7 @@ function validateSourceSnapshot(value) {
78
77
  && value.files.every(validSnapshotFile);
79
78
  }
80
79
 
81
- /** behavior fixed surfaceをCodegraph measurement用source snapshotへ投影する。 */
80
+ /** behavior fixed surfaceをLatticeSensor measurement用source snapshotへ投影する。 */
82
81
  export function sourceSnapshotFromRc1BehaviorSurface(surface) {
83
82
  if (!exactRecord(surface, ['schema', 'files'])
84
83
  || surface.schema !== 'lattice.rc1.behavior_surface_snapshot.v1'
@@ -162,40 +161,23 @@ export async function captureRc1V6SourceSnapshot({ repoRoot, paths } = {}) {
162
161
  return sourceSnapshot(files);
163
162
  }
164
163
 
165
- async function resolveExecutable(command) {
166
- const pathEntries = String(process.env.PATH ?? '').split(path.delimiter).filter(Boolean);
167
- for (const directory of pathEntries) {
168
- const candidate = path.join(directory, command);
169
- try {
170
- await access(candidate, fsConstants.X_OK);
171
- const resolved = await realpath(candidate);
172
- const stat = await lstat(resolved);
173
- if (stat.isFile()) return resolved;
174
- } catch (error) {
175
- if (error?.code !== 'ENOENT' && error?.code !== 'EACCES') throw error;
176
- }
177
- }
178
- throw new TypeError(`RC1 v6 executableをPATHから解決できない: ${command}`);
179
- }
180
-
181
- /** 実行予定Codegraphのidentityと、そのdigestを再計算できる実bytesを同時captureする。 */
182
- export async function captureRc1V6CodegraphExecutable() {
183
- const executablePath = await resolveExecutable('codegraph');
184
- const executableBytes = await readFile(executablePath);
185
- const { stdout } = await execFileAsync(executablePath, ['--version'], {
164
+ /** Lattice内蔵sensorのidentityと、そのdigestを再計算できる実bytesを同時captureする。 */
165
+ export async function captureRc1V6LatticeSensorExecutable() {
166
+ const executableBytes = await readFile(LATTICE_SENSOR_CLI);
167
+ const { stdout } = await execFileAsync(process.execPath, [LATTICE_SENSOR_CLI, '--version'], {
186
168
  encoding: 'utf8',
187
169
  maxBuffer: 64 * 1024,
188
170
  env: { ...process.env, NO_COLOR: '1' },
189
171
  });
190
172
  const version = stdout.trim();
191
173
  if (!VERSION.test(version)) {
192
- throw new TypeError('RC1 v6 Codegraph versionがsemverでない');
174
+ throw new TypeError('RC1 v6 LatticeSensor versionがsemverでない');
193
175
  }
194
176
  return {
195
177
  identity: {
196
- schema: 'lattice.rc1.codegraph_identity.v1',
178
+ schema: 'lattice.rc1.sensor_identity.v1',
197
179
  version,
198
- executable_ref: 'codegraph',
180
+ executable_ref: 'lattice-sensor',
199
181
  executable_digest: sha256(executableBytes),
200
182
  },
201
183
  executable_bytes: executableBytes,
@@ -203,8 +185,8 @@ export async function captureRc1V6CodegraphExecutable() {
203
185
  }
204
186
 
205
187
  /** portable identityだけを必要とする既存caller向け入口。 */
206
- export async function resolveRc1V6CodegraphIdentity() {
207
- return (await captureRc1V6CodegraphExecutable()).identity;
188
+ export async function resolveRc1V6LatticeSensorIdentity() {
189
+ return (await captureRc1V6LatticeSensorExecutable()).identity;
208
190
  }
209
191
 
210
192
  /** v1 evidence bundleへsource/tool measurementを追加する。 */
@@ -214,7 +196,7 @@ export function bindRc1V6EvidenceBundle(options = {}) {
214
196
  'base_sha',
215
197
  'patch_digest',
216
198
  'snapshot',
217
- 'codegraph_identity',
199
+ 'sensor_identity',
218
200
  'query_set_digest',
219
201
  ])
220
202
  || !validateRc1EvidenceBundle(options.bundle)
@@ -225,13 +207,13 @@ export function bindRc1V6EvidenceBundle(options = {}) {
225
207
  throw new TypeError('RC1 v6 evidence measurement inputが不正');
226
208
  }
227
209
  const measurement = {
228
- schema: 'lattice.rc1.codegraph_measurement.v1',
210
+ schema: 'lattice.rc1.sensor_measurement.v1',
229
211
  base_sha: options.base_sha,
230
212
  patch_digest: options.patch_digest,
231
213
  snapshot: structuredClone(options.snapshot),
232
214
  snapshot_digest: digestArtifact(options.snapshot),
233
- codegraph_identity: structuredClone(options.codegraph_identity),
234
- codegraph_identity_digest: digestArtifact(options.codegraph_identity),
215
+ sensor_identity: structuredClone(options.sensor_identity),
216
+ sensor_identity_digest: digestArtifact(options.sensor_identity),
235
217
  query_set_digest: options.query_set_digest,
236
218
  raw_evidence_digest: options.bundle.raw.payload_digest,
237
219
  };
@@ -249,7 +231,7 @@ export function bindRc1V6EvidenceBundle(options = {}) {
249
231
  base_sha: options.base_sha,
250
232
  patch_digest: options.patch_digest,
251
233
  snapshot: options.snapshot,
252
- codegraph_identity: options.codegraph_identity,
234
+ sensor_identity: options.sensor_identity,
253
235
  query_set_digest: options.query_set_digest,
254
236
  },
255
237
  });
@@ -281,7 +263,7 @@ function decodeRawEvidence(bundle) {
281
263
  try {
282
264
  return JSON.parse(Buffer.from(bundle.raw.payload_base64, 'base64').toString('utf8'));
283
265
  } catch {
284
- throw new TypeError('RC1 v6 raw Codegraph evidenceをdecodeできない');
266
+ throw new TypeError('RC1 v6 raw LatticeSensor evidenceをdecodeできない');
285
267
  }
286
268
  }
287
269
 
@@ -317,14 +299,14 @@ export function compileRc1V6BoundaryCondition(options = {}) {
317
299
  candidateSpec: options.candidateSpec,
318
300
  manualEvidence: options.manualEvidence,
319
301
  querySet: options.querySet,
320
- codegraphEvidence: decodeRawEvidence(options.bundle),
302
+ sensorEvidence: decodeRawEvidence(options.bundle),
321
303
  codeSnapshotDigest: options.bundle.measurement.snapshot_digest,
322
304
  planVersion: options.planVersion,
323
305
  });
324
306
  if (compiled.boundary_manifest.source.code_snapshot_digest
325
307
  !== options.bundle.measurement.snapshot_digest
326
- || compiled.boundary_manifest.source.codegraph_version
327
- !== options.bundle.measurement.codegraph_identity.version) {
308
+ || compiled.boundary_manifest.source.sensor_version
309
+ !== options.bundle.measurement.sensor_identity.version) {
328
310
  throw new TypeError('RC1 v6 compiler outputがmeasurement identityと一致しない');
329
311
  }
330
312
  return compiled;
@@ -57,10 +57,10 @@ const RC1_INPUT_PATHS = Object.freeze({
57
57
  oracle: 'inputs/rc1/behavior-oracle-v2.json',
58
58
  });
59
59
 
60
- const CODEGRAPH_CONFIG_PATH = 'identity/codegraph-config.json';
60
+ const SENSOR_CONFIG_PATH = 'identity/lattice-sensor-config.json';
61
61
  // ratified config epochのallowlist。artifactのconfig bytesはこのいずれかと完全一致し、
62
62
  // かつidentity.jsonのproject_config_digestと自己整合でなければreject(第三のbytesはfail closed)。
63
- const CODEGRAPH_CONFIG_EPOCHS = Object.freeze([
63
+ const SENSOR_CONFIG_EPOCHS = Object.freeze([
64
64
  // ADR 0040 epoch(RC2 v2〜v4 canonical artifactが保存する当時のratified config)
65
65
  Buffer.from('{"exclude":["research/campaigns/**/artifacts/**/identity/"]}\n', 'utf8'),
66
66
  // ADR 0044 Decision 10.3 epoch(research/runs/ event store除外、RC3-B以降のfresh実行)
@@ -68,11 +68,16 @@ const CODEGRAPH_CONFIG_EPOCHS = Object.freeze([
68
68
  '{"exclude":["research/campaigns/**/artifacts/**/identity/","research/runs/"]}\n',
69
69
  'utf8',
70
70
  ),
71
+ // ADR 0053 Decision 3 epoch(Lattice TODO state/generated artifact除外、G2以降のfresh実行)
72
+ Buffer.from(
73
+ '{"exclude":["research/campaigns/**/artifacts/**/identity/","research/runs/",".lattice/todo/",".lattice/generated/"]}\n',
74
+ 'utf8',
75
+ ),
71
76
  ]);
72
77
 
73
78
  const V1_IDENTITY_PATHS = Object.freeze([
74
- 'identity/codegraph-adapter.mjs',
75
- 'identity/codegraph-executable',
79
+ 'identity/lattice-sensor-adapter.mjs',
80
+ 'identity/lattice-sensor-executable',
76
81
  'identity/rc1-black-box-oracle.mjs',
77
82
  'identity/rc1-boundary-compiler.mjs',
78
83
  'identity/rc1-evidence-bundle.mjs',
@@ -88,7 +93,7 @@ const V1_IDENTITY_PATHS = Object.freeze([
88
93
 
89
94
  const V2_IDENTITY_PATHS = Object.freeze([
90
95
  ...V1_IDENTITY_PATHS,
91
- CODEGRAPH_CONFIG_PATH,
96
+ SENSOR_CONFIG_PATH,
92
97
  ]);
93
98
 
94
99
  const V3_IDENTITY_PATHS = V2_IDENTITY_PATHS;
@@ -133,7 +138,7 @@ const BYTE_PRESERVING_JSON_PATHS = new Set([
133
138
  'predecessors/rc1-v6-artifact-manifest.json',
134
139
  'predecessors/rc1-v6-transform-artifact.json',
135
140
  'predecessors/rc1-v6-transform-receipt.json',
136
- CODEGRAPH_CONFIG_PATH,
141
+ SENSOR_CONFIG_PATH,
137
142
  ]);
138
143
 
139
144
  const TRANSFORM_PATHS = Object.freeze([
@@ -392,10 +397,10 @@ function verifyIdentity(context) {
392
397
  const identity = context.json.get('identity.json');
393
398
  const projectConfigBound = context.artifactVersion !== 'v1';
394
399
  const expectedIdentitySchema = `lattice.rc2.execution_identity.${context.artifactVersion}`;
395
- const expectedCodegraphSchema = projectConfigBound
396
- ? 'lattice.rc2.codegraph_identity.v2'
397
- : 'lattice.rc2.codegraph_identity.v1';
398
- const codegraphKeys = projectConfigBound
400
+ const expectedLatticeSensorSchema = projectConfigBound
401
+ ? 'lattice.rc2.sensor_identity.v2'
402
+ : 'lattice.rc2.sensor_identity.v1';
403
+ const sensorKeys = projectConfigBound
399
404
  ? [
400
405
  'schema',
401
406
  'version',
@@ -408,30 +413,30 @@ function verifyIdentity(context) {
408
413
  if (!exactRecord(identity, [
409
414
  'schema',
410
415
  'sources',
411
- 'codegraph_identity',
412
- 'codegraph_identity_digest',
416
+ 'sensor_identity',
417
+ 'sensor_identity_digest',
413
418
  'before_digest',
414
419
  'after_digest',
415
420
  ])
416
421
  || identity.schema !== expectedIdentitySchema
417
422
  || !Array.isArray(identity.sources)
418
423
  || identity.sources.length !== V1_IDENTITY_PATHS.length - 1
419
- || !exactRecord(identity.codegraph_identity, codegraphKeys)
420
- || identity.codegraph_identity.schema !== expectedCodegraphSchema
421
- || !SHA256.test(identity.codegraph_identity.executable_digest)
422
- || identity.codegraph_identity.executable_digest
423
- !== sha256(context.payloads.get('identity/codegraph-executable'))
424
+ || !exactRecord(identity.sensor_identity, sensorKeys)
425
+ || identity.sensor_identity.schema !== expectedLatticeSensorSchema
426
+ || !SHA256.test(identity.sensor_identity.executable_digest)
427
+ || identity.sensor_identity.executable_digest
428
+ !== sha256(context.payloads.get('identity/lattice-sensor-executable'))
424
429
  || (projectConfigBound && (
425
- identity.codegraph_identity.project_config_ref !== CODEGRAPH_CONFIG_PATH
426
- || !SHA256.test(identity.codegraph_identity.project_config_digest)
427
- || identity.codegraph_identity.project_config_digest
428
- !== sha256(context.payloads.get(CODEGRAPH_CONFIG_PATH))
430
+ identity.sensor_identity.project_config_ref !== SENSOR_CONFIG_PATH
431
+ || !SHA256.test(identity.sensor_identity.project_config_digest)
432
+ || identity.sensor_identity.project_config_digest
433
+ !== sha256(context.payloads.get(SENSOR_CONFIG_PATH))
429
434
  ))
430
- || identity.codegraph_identity_digest !== digestArtifact(identity.codegraph_identity)) {
435
+ || identity.sensor_identity_digest !== digestArtifact(identity.sensor_identity)) {
431
436
  return false;
432
437
  }
433
438
  const expectedSourceRefs = V1_IDENTITY_PATHS
434
- .filter((relativePath) => relativePath !== 'identity/codegraph-executable');
439
+ .filter((relativePath) => relativePath !== 'identity/lattice-sensor-executable');
435
440
  const actualRefs = identity.sources.map(({ artifact_ref: ref }) => ref).sort();
436
441
  if (!sameArtifact(actualRefs, expectedSourceRefs)) return false;
437
442
  for (const source of identity.sources) {
@@ -448,20 +453,20 @@ function verifyIdentity(context) {
448
453
  artifact_ref: artifactRef,
449
454
  digest,
450
455
  })),
451
- codegraph_identity: identity.codegraph_identity,
456
+ sensor_identity: identity.sensor_identity,
452
457
  };
453
458
  const digest = digestArtifact(snapshot);
454
459
  return identity.before_digest === digest && identity.after_digest === digest;
455
460
  }
456
461
 
457
- function verifyCodegraphConfig(context) {
462
+ function verifyLatticeSensorConfig(context) {
458
463
  if (context.artifactVersion === 'v1') return false;
459
- const bytes = context.payloads.get(CODEGRAPH_CONFIG_PATH);
464
+ const bytes = context.payloads.get(SENSOR_CONFIG_PATH);
460
465
  const identity = context.json.get('identity.json');
461
466
  return Buffer.isBuffer(bytes)
462
- && CODEGRAPH_CONFIG_EPOCHS.some((epochBytes) => bytes.equals(epochBytes))
463
- && identity?.codegraph_identity?.project_config_ref === CODEGRAPH_CONFIG_PATH
464
- && identity.codegraph_identity.project_config_digest === sha256(bytes);
467
+ && SENSOR_CONFIG_EPOCHS.some((epochBytes) => bytes.equals(epochBytes))
468
+ && identity?.sensor_identity?.project_config_ref === SENSOR_CONFIG_PATH
469
+ && identity.sensor_identity.project_config_digest === sha256(bytes);
465
470
  }
466
471
 
467
472
  function verifySurfaceSnapshot(snapshot, expectedPaths, expectedPresentPaths) {
@@ -812,8 +817,8 @@ function rehydrateStoredEvidence(evidence) {
812
817
  'payload_digest',
813
818
  'payload_base64_chunks',
814
819
  ])
815
- || raw.schema !== 'lattice.rc2.chunked_codegraph_raw_receipt.v1'
816
- || raw.source_schema !== 'lattice.codegraph_raw_opaque_receipt.v1'
820
+ || raw.schema !== 'lattice.rc2.chunked_sensor_raw_receipt.v1'
821
+ || raw.source_schema !== 'lattice.sensor_raw_opaque_receipt.v1'
817
822
  || raw.source_encoding !== 'canonical-json-base64'
818
823
  || raw.storage_encoding !== 'ordered-base64-chunks'
819
824
  || !Number.isSafeInteger(raw.canonical_bytes)
@@ -890,7 +895,7 @@ function verifyRuns(context) {
890
895
  ? null
891
896
  : (family === 'primary' ? accepted?.patch?.digest : rc1Transform?.patch?.digest);
892
897
  if (!plainRecord(run)
893
- || run.schema !== 'lattice.rc2.fresh_codegraph_run.v1'
898
+ || run.schema !== 'lattice.rc2.fresh_sensor_run.v1'
894
899
  || run.run_id !== runId
895
900
  || run.family !== family
896
901
  || run.condition !== condition
@@ -901,12 +906,12 @@ function verifyRuns(context) {
901
906
  || run.evidence.run_id !== runId
902
907
  || run.evidence.condition !== condition
903
908
  || run.evidence.query_set_digest !== digestArtifact(inputs.querySet)
904
- || run.measurement?.schema !== 'lattice.rc2.codegraph_measurement.v1'
909
+ || run.measurement?.schema !== 'lattice.rc2.sensor_measurement.v1'
905
910
  || run.measurement.base_sha !== context.manifest.base_sha
906
911
  || run.measurement.patch_digest !== expectedPatch
907
912
  || run.measurement.snapshot_digest !== digestArtifact(run.measurement.snapshot)
908
- || run.measurement.codegraph_identity_digest !== identity.codegraph_identity_digest
909
- || !sameArtifact(run.measurement.codegraph_identity, identity.codegraph_identity)
913
+ || run.measurement.sensor_identity_digest !== identity.sensor_identity_digest
914
+ || !sameArtifact(run.measurement.sensor_identity, identity.sensor_identity)
910
915
  || run.measurement.query_set_digest !== digestArtifact(inputs.querySet)
911
916
  || run.measurement.raw_evidence_digest !== run.evidence.raw.payload_digest
912
917
  || run.source_invariant?.outcome !== 'passed'
@@ -952,7 +957,7 @@ function compilePrimaryRecord({ run, inputs, manualEvidence, planInput, conditio
952
957
  manualEvidence,
953
958
  querySet: inputs.querySet,
954
959
  sourceSnapshot: run.measurement.snapshot,
955
- codegraphEvidence: run.evidence.portable,
960
+ sensorEvidence: run.evidence.portable,
956
961
  });
957
962
  return compiledRecord({
958
963
  condition,
@@ -969,7 +974,7 @@ function compileUnknownRecord({ run, inputs }) {
969
974
  manualEvidence: inputs.unknownManualEvidence,
970
975
  querySet: inputs.querySet,
971
976
  sourceSnapshot: run.measurement.snapshot,
972
- codegraphEvidence: run.evidence.portable,
977
+ sensorEvidence: run.evidence.portable,
973
978
  });
974
979
  const outcome = compileSchedulabilityGraphV2(bundle.graph);
975
980
  const verification = verifySchedulabilityPlanV2(bundle.graph, {
@@ -995,7 +1000,7 @@ function recompileLegacy(run, inputs, manualEvidence, label) {
995
1000
  candidateSpec: inputs.candidateSpec,
996
1001
  manualEvidence,
997
1002
  querySet: inputs.querySet,
998
- codegraphEvidence: rawEvidence,
1003
+ sensorEvidence: rawEvidence,
999
1004
  codeSnapshotDigest: run.measurement.snapshot_digest,
1000
1005
  planVersion: `rc2-${run.condition}-transfer-${label}`,
1001
1006
  });
@@ -1264,7 +1269,7 @@ function expectedPredecessorKinds(context) {
1264
1269
  expected.set('identity/schedulability-compiler-v2.mjs', 'compiler_identity');
1265
1270
  expected.set('identity/schedulability-verifier-v2.mjs', 'verifier_identity');
1266
1271
  if (context.artifactVersion !== 'v1') {
1267
- expected.set(CODEGRAPH_CONFIG_PATH, 'codegraph_project_config');
1272
+ expected.set(SENSOR_CONFIG_PATH, 'sensor_project_config');
1268
1273
  }
1269
1274
  return expected;
1270
1275
  }
@@ -1520,7 +1525,7 @@ export function verifyRc2CampaignArtifactSet(options = {}) {
1520
1525
 
1521
1526
  check('identity_binding', verifyIdentity(context));
1522
1527
  if (context.artifactVersion !== 'v1') {
1523
- check('codegraph_config_binding', verifyCodegraphConfig(context));
1528
+ check('sensor_config_binding', verifyLatticeSensorConfig(context));
1524
1529
  }
1525
1530
  check('transform_binding', verifyTransform(context));
1526
1531
  check('fresh_run_binding', verifyRuns(context));
@@ -1,8 +1,6 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { createHash } from 'node:crypto';
3
- import { constants as fsConstants } from 'node:fs';
4
3
  import {
5
- access,
6
4
  lstat,
7
5
  mkdir,
8
6
  mkdtemp,
@@ -22,7 +20,8 @@ import {
22
20
  digestArtifact,
23
21
  } from './artifact-contracts.mjs';
24
22
  import { compileBoundaryCondition } from './boundary-compiler.mjs';
25
- import { collectCodegraphEvidence } from './codegraph-adapter.mjs';
23
+ import { collectSensorEvidence } from './sensor-adapter.mjs';
24
+ import { invokeSensorCli, LATTICE_SENSOR_CLI } from './sensor-runtime.mjs';
26
25
  import { runIsolatedTransform } from './isolation-runner.mjs';
27
26
  import { runRc1BlackBoxOracle } from './rc1-black-box-oracle.mjs';
28
27
  import { createRc1EvidenceBundle } from './rc1-evidence-bundle.mjs';
@@ -48,16 +47,16 @@ const ARTIFACT_ROOTS = Object.freeze({
48
47
  v3: 'research/campaigns/rc2/artifacts/v3',
49
48
  v4: 'research/campaigns/rc2/artifacts/v4',
50
49
  });
51
- const CODEGRAPH_CONFIG_REPO_PATH = 'codegraph.json';
52
- const CODEGRAPH_CONFIG_ARTIFACT_PATH = 'identity/codegraph-config.json';
53
- // live実行は現在ratifiedなconfig(ADR 0044 Decision 10.3 epoch)との完全一致だけを受理する。
50
+ const SENSOR_CONFIG_REPO_PATH = 'lattice-sensor.json';
51
+ const SENSOR_CONFIG_ARTIFACT_PATH = 'identity/lattice-sensor-config.json';
52
+ // live実行は現在ratifiedなconfig(ADR 0053 Decision 3 epoch)との完全一致だけを受理する。
54
53
  // 過去epochのartifact検証はrc2-artifact-set.mjsのratified epoch allowlistが担う。
55
- const CODEGRAPH_CONFIG_BYTES = Buffer.from(
56
- '{"exclude":["research/campaigns/**/artifacts/**/identity/","research/runs/"]}\n',
54
+ const SENSOR_CONFIG_BYTES = Buffer.from(
55
+ '{"exclude":["research/campaigns/**/artifacts/**/identity/","research/runs/",".lattice/todo/",".lattice/generated/"]}\n',
57
56
  'utf8',
58
57
  );
59
58
  const V2_ONLY_ARTIFACT_PATHS = Object.freeze([
60
- CODEGRAPH_CONFIG_ARTIFACT_PATH,
59
+ SENSOR_CONFIG_ARTIFACT_PATH,
61
60
  'predecessors/adr-0040.md',
62
61
  'predecessors/rc2-v1-artifact-manifest.json',
63
62
  'predecessors/rc2-v1-new-plan-version.json',
@@ -125,7 +124,7 @@ const RC1_ARTIFACT_INPUTS = Object.freeze({
125
124
  });
126
125
 
127
126
  const SOURCE_IDENTITIES = Object.freeze([
128
- ['src/codegraph-adapter.mjs', 'identity/codegraph-adapter.mjs', new URL('./codegraph-adapter.mjs', import.meta.url)],
127
+ ['src/sensor-adapter.mjs', 'identity/lattice-sensor-adapter.mjs', new URL('./sensor-adapter.mjs', import.meta.url)],
129
128
  ['src/rc1-black-box-oracle.mjs', 'identity/rc1-black-box-oracle.mjs', new URL('./rc1-black-box-oracle.mjs', import.meta.url)],
130
129
  ['src/boundary-compiler.mjs', 'identity/rc1-boundary-compiler.mjs', new URL('./boundary-compiler.mjs', import.meta.url)],
131
130
  ['src/rc1-evidence-bundle.mjs', 'identity/rc1-evidence-bundle.mjs', new URL('./rc1-evidence-bundle.mjs', import.meta.url)],
@@ -149,7 +148,7 @@ const PREDECESSOR_FILES = Object.freeze({
149
148
  'predecessors/rc1-v6-seam.patch': `${RC1_ARTIFACT_ROOT}/transform/seam.patch`,
150
149
  'predecessors/rc1-v6-transform-artifact.json': `${RC1_ARTIFACT_ROOT}/transform/transform-artifact.json`,
151
150
  'predecessors/rc1-v6-transform-receipt.json': `${RC1_ARTIFACT_ROOT}/transform/transform-receipt.json`,
152
- 'predecessors/adr-0040.md': 'docs/adr/0040-rc2-post-publication-codegraph-scope-and-artifact-v2.md',
151
+ 'predecessors/adr-0040.md': 'docs/adr/0040-rc2-post-publication-lattice-sensor-scope-and-artifact-v2.md',
153
152
  'predecessors/rc2-v1-artifact-manifest.json': `${ARTIFACT_ROOTS.v1}/artifact-manifest.json`,
154
153
  'predecessors/rc2-v1-new-plan-version.json': `${ARTIFACT_ROOTS.v1}/new-plan-version.json`,
155
154
  'predecessors/adr-0041.md': 'docs/adr/0041-rc2-artifact-semantic-oracle-mutation-binding.md',
@@ -228,22 +227,6 @@ function run(command, args, { cwd, input, allowExitCodes = [0] } = {}) {
228
227
  });
229
228
  }
230
229
 
231
- async function resolveExecutable(command) {
232
- const entries = String(process.env.PATH ?? '').split(path.delimiter).filter(Boolean);
233
- for (const directory of entries) {
234
- const candidate = path.join(directory, command);
235
- try {
236
- await access(candidate, fsConstants.X_OK);
237
- const resolved = await realpath(candidate);
238
- const stat = await lstat(resolved);
239
- if (stat.isFile()) return resolved;
240
- } catch (error) {
241
- if (error?.code !== 'ENOENT' && error?.code !== 'EACCES') throw error;
242
- }
243
- }
244
- throw new TypeError(`${command} executableをPATHから解決できない`);
245
- }
246
-
247
230
  async function captureExecutionIdentity(repoRoot) {
248
231
  const sources = [];
249
232
  const payloads = new Map();
@@ -252,25 +235,24 @@ async function captureExecutionIdentity(repoRoot) {
252
235
  payloads.set(artifactRef, bytes);
253
236
  sources.push({ runtime_path: runtimePath, artifact_ref: artifactRef, digest: sha256(bytes) });
254
237
  }
255
- const executablePath = await resolveExecutable('codegraph');
256
- const executableBytes = await readFile(executablePath);
257
- const version = (await run(executablePath, ['--version'])).stdout.toString('utf8').trim();
258
- if (!SEMVER.test(version)) throw new TypeError('Codegraph versionがsemverではない');
259
- const projectConfigBytes = await readFile(path.join(repoRoot, CODEGRAPH_CONFIG_REPO_PATH));
260
- if (!projectConfigBytes.equals(CODEGRAPH_CONFIG_BYTES)) {
261
- throw new TypeError('Codegraph project config bytesがRC2 v2 contractと一致しない');
238
+ const executableBytes = await readFile(LATTICE_SENSOR_CLI);
239
+ const version = (await run(process.execPath, [LATTICE_SENSOR_CLI, '--version'])).stdout.toString('utf8').trim();
240
+ if (!SEMVER.test(version)) throw new TypeError('LatticeSensor versionがsemverではない');
241
+ const projectConfigBytes = await readFile(path.join(repoRoot, SENSOR_CONFIG_REPO_PATH));
242
+ if (!projectConfigBytes.equals(SENSOR_CONFIG_BYTES)) {
243
+ throw new TypeError('LatticeSensor project config bytesがRC2 v2 contractと一致しない');
262
244
  }
263
- const codegraphIdentity = {
264
- schema: 'lattice.rc2.codegraph_identity.v2',
245
+ const sensorIdentity = {
246
+ schema: 'lattice.rc2.sensor_identity.v2',
265
247
  version,
266
- executable_ref: 'codegraph',
248
+ executable_ref: 'lattice-sensor',
267
249
  executable_digest: sha256(executableBytes),
268
- project_config_ref: CODEGRAPH_CONFIG_ARTIFACT_PATH,
250
+ project_config_ref: SENSOR_CONFIG_ARTIFACT_PATH,
269
251
  project_config_digest: sha256(projectConfigBytes),
270
252
  };
271
- payloads.set('identity/codegraph-executable', executableBytes);
272
- payloads.set(CODEGRAPH_CONFIG_ARTIFACT_PATH, projectConfigBytes);
273
- const snapshot = { sources, codegraph_identity: codegraphIdentity };
253
+ payloads.set('identity/lattice-sensor-executable', executableBytes);
254
+ payloads.set(SENSOR_CONFIG_ARTIFACT_PATH, projectConfigBytes);
255
+ const snapshot = { sources, sensor_identity: sensorIdentity };
274
256
  return { snapshot, digest: digestArtifact(snapshot), payloads };
275
257
  }
276
258
 
@@ -385,21 +367,21 @@ async function applyPatch(worktreePath, patch) {
385
367
  await run('git', ['apply', '--binary', '-'], { cwd: worktreePath, input: patch });
386
368
  }
387
369
 
388
- async function captureCodegraphBootstrap(worktreePath) {
370
+ async function captureLatticeSensorBootstrap(worktreePath) {
389
371
  try {
390
- return await readFile(path.join(worktreePath, '.codegraph', '.gitignore'));
372
+ return await readFile(path.join(worktreePath, '.lattice/sensor', '.gitignore'));
391
373
  } catch (error) {
392
374
  if (error?.code === 'ENOENT') return null;
393
375
  throw error;
394
376
  }
395
377
  }
396
378
 
397
- async function restoreCodegraphBootstrap(worktreePath, bootstrap) {
398
- const codegraphPath = path.join(worktreePath, '.codegraph');
399
- await rm(codegraphPath, { recursive: true, force: true });
379
+ async function restoreLatticeSensorBootstrap(worktreePath, bootstrap) {
380
+ const sensorPath = path.join(worktreePath, '.lattice/sensor');
381
+ await rm(sensorPath, { recursive: true, force: true });
400
382
  if (bootstrap === null) return;
401
- await mkdir(codegraphPath, { recursive: true });
402
- await writeFile(path.join(codegraphPath, '.gitignore'), bootstrap);
383
+ await mkdir(sensorPath, { recursive: true });
384
+ await writeFile(path.join(sensorPath, '.gitignore'), bootstrap);
403
385
  }
404
386
 
405
387
  async function worktreeCount(repoRoot) {
@@ -422,7 +404,7 @@ async function observeFreshIndex({
422
404
  paths,
423
405
  patch,
424
406
  allowedPaths,
425
- codegraphIdentity,
407
+ sensorIdentity,
426
408
  oracle,
427
409
  rc1Inputs,
428
410
  costMeasurements,
@@ -452,16 +434,16 @@ async function observeFreshIndex({
452
434
  : await runRc1BlackBoxOracle({ repoRoot: worktreePath, oracle });
453
435
  oracleElapsedMs = roundedMilliseconds(oracleStarted);
454
436
  if (oracleReceipt.outcome !== 'passed') throw new TypeError(`${runId} oracle failed`);
455
- const bootstrap = await captureCodegraphBootstrap(worktreePath);
437
+ const bootstrap = await captureLatticeSensorBootstrap(worktreePath);
456
438
  try {
457
439
  const indexStarted = performance.now();
458
- await run('codegraph', ['init', '.'], { cwd: worktreePath });
440
+ await invokeSensorCli(run, ['init', '.'], { cwd: worktreePath });
459
441
  indexElapsedMs = roundedMilliseconds(indexStarted);
460
442
  const queryStarted = performance.now();
461
- rawEvidence = await collectCodegraphEvidence({ cwd: worktreePath, querySet });
443
+ rawEvidence = await collectSensorEvidence({ cwd: worktreePath, querySet });
462
444
  queryElapsedMs = roundedMilliseconds(queryStarted);
463
445
  } finally {
464
- await restoreCodegraphBootstrap(worktreePath, bootstrap);
446
+ await restoreLatticeSensorBootstrap(worktreePath, bootstrap);
465
447
  }
466
448
  },
467
449
  });
@@ -480,13 +462,13 @@ async function observeFreshIndex({
480
462
  const evidence = createRc1EvidenceBundle({ condition, runId, querySet, rawEvidence });
481
463
  const patchDigest = condition === 'treatment' ? sha256(isolated.patch) : null;
482
464
  const measurement = {
483
- schema: 'lattice.rc2.codegraph_measurement.v1',
465
+ schema: 'lattice.rc2.sensor_measurement.v1',
484
466
  base_sha: baseSha,
485
467
  patch_digest: patchDigest,
486
468
  snapshot,
487
469
  snapshot_digest: digestArtifact(snapshot),
488
- codegraph_identity: structuredClone(codegraphIdentity),
489
- codegraph_identity_digest: digestArtifact(codegraphIdentity),
470
+ sensor_identity: structuredClone(sensorIdentity),
471
+ sensor_identity_digest: digestArtifact(sensorIdentity),
490
472
  query_set_digest: digestArtifact(querySet),
491
473
  raw_evidence_digest: evidence.raw.payload_digest,
492
474
  };
@@ -503,7 +485,7 @@ async function observeFreshIndex({
503
485
  });
504
486
  }
505
487
  const runRecord = {
506
- schema: 'lattice.rc2.fresh_codegraph_run.v1',
488
+ schema: 'lattice.rc2.fresh_sensor_run.v1',
507
489
  family,
508
490
  condition,
509
491
  run_id: runId,
@@ -529,7 +511,7 @@ async function observeFreshIndex({
529
511
  candidateSpec: rc1Inputs.candidateSpec,
530
512
  manualEvidence,
531
513
  querySet: rc1Inputs.querySet,
532
- codegraphEvidence: raw,
514
+ sensorEvidence: raw,
533
515
  codeSnapshotDigest: measurement.snapshot_digest,
534
516
  planVersion: `rc2-${condition}-transfer-${label}`,
535
517
  });
@@ -585,7 +567,7 @@ function compilePrimary({ runRecord, inputs, manualEvidence, planInput, conditio
585
567
  manualEvidence,
586
568
  querySet: inputs.querySet,
587
569
  sourceSnapshot: runRecord.measurement.snapshot,
588
- codegraphEvidence: runRecord.evidence.portable,
570
+ sensorEvidence: runRecord.evidence.portable,
589
571
  })
590
572
  ));
591
573
  return compiledRecord({ condition, runId: runRecord.run_id, bundle, costMeasurements });
@@ -600,7 +582,7 @@ function compileUnknown({ runRecord, inputs, costMeasurements }) {
600
582
  manualEvidence: inputs.unknownManualEvidence,
601
583
  querySet: inputs.querySet,
602
584
  sourceSnapshot: runRecord.measurement.snapshot,
603
- codegraphEvidence: runRecord.evidence.portable,
585
+ sensorEvidence: runRecord.evidence.portable,
604
586
  })
605
587
  ));
606
588
  const outcome = timedSync(`compile.${condition}.${runRecord.run_id}`, costMeasurements, () => (
@@ -796,7 +778,7 @@ function storedEvidence(evidence) {
796
778
  'payload_digest',
797
779
  'payload_base64',
798
780
  ])
799
- || raw.schema !== 'lattice.codegraph_raw_opaque_receipt.v1'
781
+ || raw.schema !== 'lattice.sensor_raw_opaque_receipt.v1'
800
782
  || raw.encoding !== 'canonical-json-base64'
801
783
  || typeof raw.payload_base64 !== 'string') {
802
784
  throw new TypeError('run raw evidence receipt is invalid');
@@ -824,7 +806,7 @@ function storedEvidence(evidence) {
824
806
  return {
825
807
  ...structuredClone(evidence),
826
808
  raw: {
827
- schema: 'lattice.rc2.chunked_codegraph_raw_receipt.v1',
809
+ schema: 'lattice.rc2.chunked_sensor_raw_receipt.v1',
828
810
  source_schema: raw.schema,
829
811
  media_type: raw.media_type,
830
812
  source_encoding: raw.encoding,
@@ -881,7 +863,7 @@ function predecessorDescriptors(payloads) {
881
863
  add('execution_identity', 'identity.json');
882
864
  add('compiler_identity', 'identity/schedulability-compiler-v2.mjs');
883
865
  add('verifier_identity', 'identity/schedulability-verifier-v2.mjs');
884
- add('codegraph_project_config', CODEGRAPH_CONFIG_ARTIFACT_PATH);
866
+ add('sensor_project_config', SENSOR_CONFIG_ARTIFACT_PATH);
885
867
  return descriptors;
886
868
  }
887
869
 
@@ -1204,7 +1186,7 @@ export async function runRc2Campaign(options = {}) {
1204
1186
  const common = {
1205
1187
  repoRoot: root,
1206
1188
  baseSha,
1207
- codegraphIdentity: identityBefore.snapshot.codegraph_identity,
1189
+ sensorIdentity: identityBefore.snapshot.sensor_identity,
1208
1190
  costMeasurements,
1209
1191
  };
1210
1192
  const primaryControl = [];
@@ -1278,8 +1260,8 @@ export async function runRc2Campaign(options = {}) {
1278
1260
  const identity = {
1279
1261
  schema: 'lattice.rc2.execution_identity.v4',
1280
1262
  sources: identityBefore.snapshot.sources,
1281
- codegraph_identity: identityBefore.snapshot.codegraph_identity,
1282
- codegraph_identity_digest: digestArtifact(identityBefore.snapshot.codegraph_identity),
1263
+ sensor_identity: identityBefore.snapshot.sensor_identity,
1264
+ sensor_identity_digest: digestArtifact(identityBefore.snapshot.sensor_identity),
1283
1265
  before_digest: identityBefore.digest,
1284
1266
  after_digest: identityAfter.digest,
1285
1267
  };