@quolu/lattice 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +20 -0
- package/bin/lattice-mcp.mjs +134 -0
- package/bin/lattice.mjs +78 -0
- package/package.json +47 -0
- package/sensor/LICENSE +21 -0
- package/sensor/NOTICE +30 -0
- package/sensor/dist/bin/codegraph.d.ts +26 -0
- package/sensor/dist/bin/codegraph.d.ts.map +1 -0
- package/sensor/dist/bin/codegraph.js +2279 -0
- package/sensor/dist/bin/codegraph.js.map +1 -0
- package/sensor/dist/bin/command-supervision.d.ts +49 -0
- package/sensor/dist/bin/command-supervision.d.ts.map +1 -0
- package/sensor/dist/bin/command-supervision.js +95 -0
- package/sensor/dist/bin/command-supervision.js.map +1 -0
- package/sensor/dist/bin/fatal-handler.d.ts +20 -0
- package/sensor/dist/bin/fatal-handler.d.ts.map +1 -0
- package/sensor/dist/bin/fatal-handler.js +118 -0
- package/sensor/dist/bin/fatal-handler.js.map +1 -0
- package/sensor/dist/bin/node-version-check.d.ts +37 -0
- package/sensor/dist/bin/node-version-check.d.ts.map +1 -0
- package/sensor/dist/bin/node-version-check.js +79 -0
- package/sensor/dist/bin/node-version-check.js.map +1 -0
- package/sensor/dist/bin/uninstall.d.ts +14 -0
- package/sensor/dist/bin/uninstall.d.ts.map +1 -0
- package/sensor/dist/bin/uninstall.js +36 -0
- package/sensor/dist/bin/uninstall.js.map +1 -0
- package/sensor/dist/context/formatter.d.ts +30 -0
- package/sensor/dist/context/formatter.d.ts.map +1 -0
- package/sensor/dist/context/formatter.js +263 -0
- package/sensor/dist/context/formatter.js.map +1 -0
- package/sensor/dist/context/index.d.ts +119 -0
- package/sensor/dist/context/index.d.ts.map +1 -0
- package/sensor/dist/context/index.js +1326 -0
- package/sensor/dist/context/index.js.map +1 -0
- package/sensor/dist/context/markers.d.ts +19 -0
- package/sensor/dist/context/markers.d.ts.map +1 -0
- package/sensor/dist/context/markers.js +22 -0
- package/sensor/dist/context/markers.js.map +1 -0
- package/sensor/dist/db/index.d.ts +264 -0
- package/sensor/dist/db/index.d.ts.map +1 -0
- package/sensor/dist/db/index.js +603 -0
- package/sensor/dist/db/index.js.map +1 -0
- package/sensor/dist/db/migrations.d.ts +44 -0
- package/sensor/dist/db/migrations.d.ts.map +1 -0
- package/sensor/dist/db/migrations.js +241 -0
- package/sensor/dist/db/migrations.js.map +1 -0
- package/sensor/dist/db/queries.d.ts +563 -0
- package/sensor/dist/db/queries.d.ts.map +1 -0
- package/sensor/dist/db/queries.js +2179 -0
- package/sensor/dist/db/queries.js.map +1 -0
- package/sensor/dist/db/schema.sql +196 -0
- package/sensor/dist/db/sqlite-adapter.d.ts +55 -0
- package/sensor/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/sensor/dist/db/sqlite-adapter.js +135 -0
- package/sensor/dist/db/sqlite-adapter.js.map +1 -0
- package/sensor/dist/db/wal-valve.d.ts +106 -0
- package/sensor/dist/db/wal-valve.d.ts.map +1 -0
- package/sensor/dist/db/wal-valve.js +208 -0
- package/sensor/dist/db/wal-valve.js.map +1 -0
- package/sensor/dist/directory.d.ts +183 -0
- package/sensor/dist/directory.d.ts.map +1 -0
- package/sensor/dist/directory.js +797 -0
- package/sensor/dist/directory.js.map +1 -0
- package/sensor/dist/errors.d.ts +136 -0
- package/sensor/dist/errors.d.ts.map +1 -0
- package/sensor/dist/errors.js +219 -0
- package/sensor/dist/errors.js.map +1 -0
- package/sensor/dist/extraction/astro-extractor.d.ts +79 -0
- package/sensor/dist/extraction/astro-extractor.d.ts.map +1 -0
- package/sensor/dist/extraction/astro-extractor.js +320 -0
- package/sensor/dist/extraction/astro-extractor.js.map +1 -0
- package/sensor/dist/extraction/cfml-extractor.d.ts +107 -0
- package/sensor/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/sensor/dist/extraction/cfml-extractor.js +494 -0
- package/sensor/dist/extraction/cfml-extractor.js.map +1 -0
- package/sensor/dist/extraction/dfm-extractor.d.ts +31 -0
- package/sensor/dist/extraction/dfm-extractor.d.ts.map +1 -0
- package/sensor/dist/extraction/dfm-extractor.js +151 -0
- package/sensor/dist/extraction/dfm-extractor.js.map +1 -0
- package/sensor/dist/extraction/dynamic-import.d.ts +82 -0
- package/sensor/dist/extraction/dynamic-import.d.ts.map +1 -0
- package/sensor/dist/extraction/dynamic-import.js +313 -0
- package/sensor/dist/extraction/dynamic-import.js.map +1 -0
- package/sensor/dist/extraction/extraction-version.d.ts +25 -0
- package/sensor/dist/extraction/extraction-version.d.ts.map +1 -0
- package/sensor/dist/extraction/extraction-version.js +28 -0
- package/sensor/dist/extraction/extraction-version.js.map +1 -0
- package/sensor/dist/extraction/function-ref.d.ts +118 -0
- package/sensor/dist/extraction/function-ref.d.ts.map +1 -0
- package/sensor/dist/extraction/function-ref.js +727 -0
- package/sensor/dist/extraction/function-ref.js.map +1 -0
- package/sensor/dist/extraction/generated-detection.d.ts +30 -0
- package/sensor/dist/extraction/generated-detection.d.ts.map +1 -0
- package/sensor/dist/extraction/generated-detection.js +83 -0
- package/sensor/dist/extraction/generated-detection.js.map +1 -0
- package/sensor/dist/extraction/grammars.d.ts +138 -0
- package/sensor/dist/extraction/grammars.d.ts.map +1 -0
- package/sensor/dist/extraction/grammars.js +648 -0
- package/sensor/dist/extraction/grammars.js.map +1 -0
- package/sensor/dist/extraction/index.d.ts +251 -0
- package/sensor/dist/extraction/index.d.ts.map +1 -0
- package/sensor/dist/extraction/index.js +2563 -0
- package/sensor/dist/extraction/index.js.map +1 -0
- package/sensor/dist/extraction/kernel/decode.d.ts +9 -0
- package/sensor/dist/extraction/kernel/decode.d.ts.map +1 -0
- package/sensor/dist/extraction/kernel/decode.js +156 -0
- package/sensor/dist/extraction/kernel/decode.js.map +1 -0
- package/sensor/dist/extraction/kernel/index.d.ts +62 -0
- package/sensor/dist/extraction/kernel/index.d.ts.map +1 -0
- package/sensor/dist/extraction/kernel/index.js +165 -0
- package/sensor/dist/extraction/kernel/index.js.map +1 -0
- package/sensor/dist/extraction/kernel/layout.d.ts +92 -0
- package/sensor/dist/extraction/kernel/layout.d.ts.map +1 -0
- package/sensor/dist/extraction/kernel/layout.js +95 -0
- package/sensor/dist/extraction/kernel/layout.js.map +1 -0
- package/sensor/dist/extraction/kernel/loader.d.ts +61 -0
- package/sensor/dist/extraction/kernel/loader.d.ts.map +1 -0
- package/sensor/dist/extraction/kernel/loader.js +146 -0
- package/sensor/dist/extraction/kernel/loader.js.map +1 -0
- package/sensor/dist/extraction/languages/arkts.d.ts +3 -0
- package/sensor/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/arkts.js +127 -0
- package/sensor/dist/extraction/languages/arkts.js.map +1 -0
- package/sensor/dist/extraction/languages/c-cpp.d.ts +111 -0
- package/sensor/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/c-cpp.js +878 -0
- package/sensor/dist/extraction/languages/c-cpp.js.map +1 -0
- package/sensor/dist/extraction/languages/cfquery.d.ts +12 -0
- package/sensor/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/cfquery.js +28 -0
- package/sensor/dist/extraction/languages/cfquery.js.map +1 -0
- package/sensor/dist/extraction/languages/cfscript.d.ts +3 -0
- package/sensor/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/cfscript.js +73 -0
- package/sensor/dist/extraction/languages/cfscript.js.map +1 -0
- package/sensor/dist/extraction/languages/cobol.d.ts +33 -0
- package/sensor/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/cobol.js +499 -0
- package/sensor/dist/extraction/languages/cobol.js.map +1 -0
- package/sensor/dist/extraction/languages/csharp.d.ts +25 -0
- package/sensor/dist/extraction/languages/csharp.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/csharp.js +175 -0
- package/sensor/dist/extraction/languages/csharp.js.map +1 -0
- package/sensor/dist/extraction/languages/dart.d.ts +3 -0
- package/sensor/dist/extraction/languages/dart.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/dart.js +374 -0
- package/sensor/dist/extraction/languages/dart.js.map +1 -0
- package/sensor/dist/extraction/languages/erlang.d.ts +3 -0
- package/sensor/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/erlang.js +350 -0
- package/sensor/dist/extraction/languages/erlang.js.map +1 -0
- package/sensor/dist/extraction/languages/go.d.ts +3 -0
- package/sensor/dist/extraction/languages/go.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/go.js +111 -0
- package/sensor/dist/extraction/languages/go.js.map +1 -0
- package/sensor/dist/extraction/languages/index.d.ts +10 -0
- package/sensor/dist/extraction/languages/index.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/index.js +71 -0
- package/sensor/dist/extraction/languages/index.js.map +1 -0
- package/sensor/dist/extraction/languages/java.d.ts +3 -0
- package/sensor/dist/extraction/languages/java.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/java.js +315 -0
- package/sensor/dist/extraction/languages/java.js.map +1 -0
- package/sensor/dist/extraction/languages/javascript.d.ts +3 -0
- package/sensor/dist/extraction/languages/javascript.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/javascript.js +106 -0
- package/sensor/dist/extraction/languages/javascript.js.map +1 -0
- package/sensor/dist/extraction/languages/kotlin.d.ts +3 -0
- package/sensor/dist/extraction/languages/kotlin.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/kotlin.js +379 -0
- package/sensor/dist/extraction/languages/kotlin.js.map +1 -0
- package/sensor/dist/extraction/languages/lua.d.ts +3 -0
- package/sensor/dist/extraction/languages/lua.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/lua.js +150 -0
- package/sensor/dist/extraction/languages/lua.js.map +1 -0
- package/sensor/dist/extraction/languages/luau.d.ts +3 -0
- package/sensor/dist/extraction/languages/luau.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/luau.js +37 -0
- package/sensor/dist/extraction/languages/luau.js.map +1 -0
- package/sensor/dist/extraction/languages/nix.d.ts +3 -0
- package/sensor/dist/extraction/languages/nix.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/nix.js +294 -0
- package/sensor/dist/extraction/languages/nix.js.map +1 -0
- package/sensor/dist/extraction/languages/objc.d.ts +3 -0
- package/sensor/dist/extraction/languages/objc.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/objc.js +175 -0
- package/sensor/dist/extraction/languages/objc.js.map +1 -0
- package/sensor/dist/extraction/languages/pascal.d.ts +3 -0
- package/sensor/dist/extraction/languages/pascal.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/pascal.js +77 -0
- package/sensor/dist/extraction/languages/pascal.js.map +1 -0
- package/sensor/dist/extraction/languages/php.d.ts +3 -0
- package/sensor/dist/extraction/languages/php.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/php.js +196 -0
- package/sensor/dist/extraction/languages/php.js.map +1 -0
- package/sensor/dist/extraction/languages/python.d.ts +3 -0
- package/sensor/dist/extraction/languages/python.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/python.js +56 -0
- package/sensor/dist/extraction/languages/python.js.map +1 -0
- package/sensor/dist/extraction/languages/r.d.ts +3 -0
- package/sensor/dist/extraction/languages/r.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/r.js +314 -0
- package/sensor/dist/extraction/languages/r.js.map +1 -0
- package/sensor/dist/extraction/languages/ruby.d.ts +3 -0
- package/sensor/dist/extraction/languages/ruby.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/ruby.js +149 -0
- package/sensor/dist/extraction/languages/ruby.js.map +1 -0
- package/sensor/dist/extraction/languages/rust.d.ts +3 -0
- package/sensor/dist/extraction/languages/rust.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/rust.js +142 -0
- package/sensor/dist/extraction/languages/rust.js.map +1 -0
- package/sensor/dist/extraction/languages/scala.d.ts +3 -0
- package/sensor/dist/extraction/languages/scala.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/scala.js +209 -0
- package/sensor/dist/extraction/languages/scala.js.map +1 -0
- package/sensor/dist/extraction/languages/solidity.d.ts +3 -0
- package/sensor/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/solidity.js +293 -0
- package/sensor/dist/extraction/languages/solidity.js.map +1 -0
- package/sensor/dist/extraction/languages/swift.d.ts +3 -0
- package/sensor/dist/extraction/languages/swift.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/swift.js +152 -0
- package/sensor/dist/extraction/languages/swift.js.map +1 -0
- package/sensor/dist/extraction/languages/terraform.d.ts +3 -0
- package/sensor/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/terraform.js +641 -0
- package/sensor/dist/extraction/languages/terraform.js.map +1 -0
- package/sensor/dist/extraction/languages/typescript.d.ts +16 -0
- package/sensor/dist/extraction/languages/typescript.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/typescript.js +167 -0
- package/sensor/dist/extraction/languages/typescript.js.map +1 -0
- package/sensor/dist/extraction/languages/vbnet.d.ts +11 -0
- package/sensor/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/sensor/dist/extraction/languages/vbnet.js +141 -0
- package/sensor/dist/extraction/languages/vbnet.js.map +1 -0
- package/sensor/dist/extraction/liquid-extractor.d.ts +59 -0
- package/sensor/dist/extraction/liquid-extractor.d.ts.map +1 -0
- package/sensor/dist/extraction/liquid-extractor.js +357 -0
- package/sensor/dist/extraction/liquid-extractor.js.map +1 -0
- package/sensor/dist/extraction/mybatis-extractor.d.ts +68 -0
- package/sensor/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/sensor/dist/extraction/mybatis-extractor.js +300 -0
- package/sensor/dist/extraction/mybatis-extractor.js.map +1 -0
- package/sensor/dist/extraction/parse-pool.d.ts +160 -0
- package/sensor/dist/extraction/parse-pool.d.ts.map +1 -0
- package/sensor/dist/extraction/parse-pool.js +402 -0
- package/sensor/dist/extraction/parse-pool.js.map +1 -0
- package/sensor/dist/extraction/parse-worker.d.ts +8 -0
- package/sensor/dist/extraction/parse-worker.d.ts.map +1 -0
- package/sensor/dist/extraction/parse-worker.js +138 -0
- package/sensor/dist/extraction/parse-worker.js.map +1 -0
- package/sensor/dist/extraction/razor-extractor.d.ts +42 -0
- package/sensor/dist/extraction/razor-extractor.d.ts.map +1 -0
- package/sensor/dist/extraction/razor-extractor.js +285 -0
- package/sensor/dist/extraction/razor-extractor.js.map +1 -0
- package/sensor/dist/extraction/spawn-invokes.d.ts +101 -0
- package/sensor/dist/extraction/spawn-invokes.d.ts.map +1 -0
- package/sensor/dist/extraction/spawn-invokes.js +327 -0
- package/sensor/dist/extraction/spawn-invokes.js.map +1 -0
- package/sensor/dist/extraction/store-worker.d.ts +24 -0
- package/sensor/dist/extraction/store-worker.d.ts.map +1 -0
- package/sensor/dist/extraction/store-worker.js +110 -0
- package/sensor/dist/extraction/store-worker.js.map +1 -0
- package/sensor/dist/extraction/store-writer.d.ts +63 -0
- package/sensor/dist/extraction/store-writer.d.ts.map +1 -0
- package/sensor/dist/extraction/store-writer.js +174 -0
- package/sensor/dist/extraction/store-writer.js.map +1 -0
- package/sensor/dist/extraction/svelte-extractor.d.ts +56 -0
- package/sensor/dist/extraction/svelte-extractor.d.ts.map +1 -0
- package/sensor/dist/extraction/svelte-extractor.js +275 -0
- package/sensor/dist/extraction/svelte-extractor.js.map +1 -0
- package/sensor/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/sensor/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
- package/sensor/dist/extraction/tree-sitter-helpers.js +153 -0
- package/sensor/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/sensor/dist/extraction/tree-sitter-types.d.ts +258 -0
- package/sensor/dist/extraction/tree-sitter-types.d.ts.map +1 -0
- package/sensor/dist/extraction/tree-sitter-types.js +10 -0
- package/sensor/dist/extraction/tree-sitter-types.js.map +1 -0
- package/sensor/dist/extraction/tree-sitter.d.ts +724 -0
- package/sensor/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/sensor/dist/extraction/tree-sitter.js +6721 -0
- package/sensor/dist/extraction/tree-sitter.js.map +1 -0
- package/sensor/dist/extraction/vue-extractor.d.ts +51 -0
- package/sensor/dist/extraction/vue-extractor.d.ts.map +1 -0
- package/sensor/dist/extraction/vue-extractor.js +254 -0
- package/sensor/dist/extraction/vue-extractor.js.map +1 -0
- package/sensor/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/sensor/dist/extraction/wasm-runtime-flags.d.ts +53 -0
- package/sensor/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/sensor/dist/extraction/wasm-runtime-flags.js +130 -0
- package/sensor/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/sensor/dist/graph/index.d.ts +8 -0
- package/sensor/dist/graph/index.d.ts.map +1 -0
- package/sensor/dist/graph/index.js +13 -0
- package/sensor/dist/graph/index.js.map +1 -0
- package/sensor/dist/graph/queries.d.ts +106 -0
- package/sensor/dist/graph/queries.d.ts.map +1 -0
- package/sensor/dist/graph/queries.js +339 -0
- package/sensor/dist/graph/queries.js.map +1 -0
- package/sensor/dist/graph/traversal.d.ts +127 -0
- package/sensor/dist/graph/traversal.d.ts.map +1 -0
- package/sensor/dist/graph/traversal.js +599 -0
- package/sensor/dist/graph/traversal.js.map +1 -0
- package/sensor/dist/index.d.ts +653 -0
- package/sensor/dist/index.d.ts.map +1 -0
- package/sensor/dist/index.js +1646 -0
- package/sensor/dist/index.js.map +1 -0
- package/sensor/dist/installer/beta-signup.d.ts +54 -0
- package/sensor/dist/installer/beta-signup.d.ts.map +1 -0
- package/sensor/dist/installer/beta-signup.js +178 -0
- package/sensor/dist/installer/beta-signup.js.map +1 -0
- package/sensor/dist/installer/config-writer.d.ts +28 -0
- package/sensor/dist/installer/config-writer.d.ts.map +1 -0
- package/sensor/dist/installer/config-writer.js +91 -0
- package/sensor/dist/installer/config-writer.js.map +1 -0
- package/sensor/dist/installer/index.d.ts +142 -0
- package/sensor/dist/installer/index.d.ts.map +1 -0
- package/sensor/dist/installer/index.js +622 -0
- package/sensor/dist/installer/index.js.map +1 -0
- package/sensor/dist/installer/instructions-template.d.ts +41 -0
- package/sensor/dist/installer/instructions-template.d.ts.map +1 -0
- package/sensor/dist/installer/instructions-template.js +53 -0
- package/sensor/dist/installer/instructions-template.js.map +1 -0
- package/sensor/dist/installer/targets/antigravity.d.ts +57 -0
- package/sensor/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/sensor/dist/installer/targets/antigravity.js +308 -0
- package/sensor/dist/installer/targets/antigravity.js.map +1 -0
- package/sensor/dist/installer/targets/claude.d.ts +62 -0
- package/sensor/dist/installer/targets/claude.d.ts.map +1 -0
- package/sensor/dist/installer/targets/claude.js +454 -0
- package/sensor/dist/installer/targets/claude.js.map +1 -0
- package/sensor/dist/installer/targets/codex.d.ts +18 -0
- package/sensor/dist/installer/targets/codex.d.ts.map +1 -0
- package/sensor/dist/installer/targets/codex.js +185 -0
- package/sensor/dist/installer/targets/codex.js.map +1 -0
- package/sensor/dist/installer/targets/cursor.d.ts +35 -0
- package/sensor/dist/installer/targets/cursor.d.ts.map +1 -0
- package/sensor/dist/installer/targets/cursor.js +254 -0
- package/sensor/dist/installer/targets/cursor.js.map +1 -0
- package/sensor/dist/installer/targets/gemini.d.ts +26 -0
- package/sensor/dist/installer/targets/gemini.d.ts.map +1 -0
- package/sensor/dist/installer/targets/gemini.js +165 -0
- package/sensor/dist/installer/targets/gemini.js.map +1 -0
- package/sensor/dist/installer/targets/hermes.d.ts +18 -0
- package/sensor/dist/installer/targets/hermes.d.ts.map +1 -0
- package/sensor/dist/installer/targets/hermes.js +359 -0
- package/sensor/dist/installer/targets/hermes.js.map +1 -0
- package/sensor/dist/installer/targets/kiro.d.ts +27 -0
- package/sensor/dist/installer/targets/kiro.d.ts.map +1 -0
- package/sensor/dist/installer/targets/kiro.js +178 -0
- package/sensor/dist/installer/targets/kiro.js.map +1 -0
- package/sensor/dist/installer/targets/opencode.d.ts +38 -0
- package/sensor/dist/installer/targets/opencode.d.ts.map +1 -0
- package/sensor/dist/installer/targets/opencode.js +288 -0
- package/sensor/dist/installer/targets/opencode.js.map +1 -0
- package/sensor/dist/installer/targets/registry.d.ts +35 -0
- package/sensor/dist/installer/targets/registry.d.ts.map +1 -0
- package/sensor/dist/installer/targets/registry.js +91 -0
- package/sensor/dist/installer/targets/registry.js.map +1 -0
- package/sensor/dist/installer/targets/shared.d.ts +101 -0
- package/sensor/dist/installer/targets/shared.d.ts.map +1 -0
- package/sensor/dist/installer/targets/shared.js +264 -0
- package/sensor/dist/installer/targets/shared.js.map +1 -0
- package/sensor/dist/installer/targets/toml.d.ts +52 -0
- package/sensor/dist/installer/targets/toml.d.ts.map +1 -0
- package/sensor/dist/installer/targets/toml.js +147 -0
- package/sensor/dist/installer/targets/toml.js.map +1 -0
- package/sensor/dist/installer/targets/types.d.ts +108 -0
- package/sensor/dist/installer/targets/types.d.ts.map +1 -0
- package/sensor/dist/installer/targets/types.js +16 -0
- package/sensor/dist/installer/targets/types.js.map +1 -0
- package/sensor/dist/mcp/daemon-manager.d.ts +42 -0
- package/sensor/dist/mcp/daemon-manager.d.ts.map +1 -0
- package/sensor/dist/mcp/daemon-manager.js +129 -0
- package/sensor/dist/mcp/daemon-manager.js.map +1 -0
- package/sensor/dist/mcp/daemon-paths.d.ts +73 -0
- package/sensor/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/sensor/dist/mcp/daemon-paths.js +170 -0
- package/sensor/dist/mcp/daemon-paths.js.map +1 -0
- package/sensor/dist/mcp/daemon-registry.d.ts +54 -0
- package/sensor/dist/mcp/daemon-registry.d.ts.map +1 -0
- package/sensor/dist/mcp/daemon-registry.js +241 -0
- package/sensor/dist/mcp/daemon-registry.js.map +1 -0
- package/sensor/dist/mcp/daemon.d.ts +290 -0
- package/sensor/dist/mcp/daemon.d.ts.map +1 -0
- package/sensor/dist/mcp/daemon.js +867 -0
- package/sensor/dist/mcp/daemon.js.map +1 -0
- package/sensor/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/sensor/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
- package/sensor/dist/mcp/dynamic-boundaries.js +360 -0
- package/sensor/dist/mcp/dynamic-boundaries.js.map +1 -0
- package/sensor/dist/mcp/early-ppid.d.ts +26 -0
- package/sensor/dist/mcp/early-ppid.d.ts.map +1 -0
- package/sensor/dist/mcp/early-ppid.js +29 -0
- package/sensor/dist/mcp/early-ppid.js.map +1 -0
- package/sensor/dist/mcp/engine.d.ts +130 -0
- package/sensor/dist/mcp/engine.d.ts.map +1 -0
- package/sensor/dist/mcp/engine.js +375 -0
- package/sensor/dist/mcp/engine.js.map +1 -0
- package/sensor/dist/mcp/index.d.ts +113 -0
- package/sensor/dist/mcp/index.d.ts.map +1 -0
- package/sensor/dist/mcp/index.js +551 -0
- package/sensor/dist/mcp/index.js.map +1 -0
- package/sensor/dist/mcp/liveness-watchdog.d.ts +35 -0
- package/sensor/dist/mcp/liveness-watchdog.d.ts.map +1 -0
- package/sensor/dist/mcp/liveness-watchdog.js +267 -0
- package/sensor/dist/mcp/liveness-watchdog.js.map +1 -0
- package/sensor/dist/mcp/ppid-watchdog.d.ts +62 -0
- package/sensor/dist/mcp/ppid-watchdog.d.ts.map +1 -0
- package/sensor/dist/mcp/ppid-watchdog.js +64 -0
- package/sensor/dist/mcp/ppid-watchdog.js.map +1 -0
- package/sensor/dist/mcp/proxy.d.ts +99 -0
- package/sensor/dist/mcp/proxy.d.ts.map +1 -0
- package/sensor/dist/mcp/proxy.js +737 -0
- package/sensor/dist/mcp/proxy.js.map +1 -0
- package/sensor/dist/mcp/query-pool.d.ts +108 -0
- package/sensor/dist/mcp/query-pool.d.ts.map +1 -0
- package/sensor/dist/mcp/query-pool.js +315 -0
- package/sensor/dist/mcp/query-pool.js.map +1 -0
- package/sensor/dist/mcp/query-worker.d.ts +24 -0
- package/sensor/dist/mcp/query-worker.d.ts.map +1 -0
- package/sensor/dist/mcp/query-worker.js +87 -0
- package/sensor/dist/mcp/query-worker.js.map +1 -0
- package/sensor/dist/mcp/server-instructions.d.ts +34 -0
- package/sensor/dist/mcp/server-instructions.d.ts.map +1 -0
- package/sensor/dist/mcp/server-instructions.js +106 -0
- package/sensor/dist/mcp/server-instructions.js.map +1 -0
- package/sensor/dist/mcp/session.d.ts +92 -0
- package/sensor/dist/mcp/session.d.ts.map +1 -0
- package/sensor/dist/mcp/session.js +355 -0
- package/sensor/dist/mcp/session.js.map +1 -0
- package/sensor/dist/mcp/startup-handshake.d.ts +44 -0
- package/sensor/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/sensor/dist/mcp/startup-handshake.js +73 -0
- package/sensor/dist/mcp/startup-handshake.js.map +1 -0
- package/sensor/dist/mcp/stdin-teardown.d.ts +27 -0
- package/sensor/dist/mcp/stdin-teardown.d.ts.map +1 -0
- package/sensor/dist/mcp/stdin-teardown.js +49 -0
- package/sensor/dist/mcp/stdin-teardown.js.map +1 -0
- package/sensor/dist/mcp/tools.d.ts +651 -0
- package/sensor/dist/mcp/tools.d.ts.map +1 -0
- package/sensor/dist/mcp/tools.js +4574 -0
- package/sensor/dist/mcp/tools.js.map +1 -0
- package/sensor/dist/mcp/transport.d.ts +188 -0
- package/sensor/dist/mcp/transport.d.ts.map +1 -0
- package/sensor/dist/mcp/transport.js +377 -0
- package/sensor/dist/mcp/transport.js.map +1 -0
- package/sensor/dist/mcp/version.d.ts +30 -0
- package/sensor/dist/mcp/version.d.ts.map +1 -0
- package/sensor/dist/mcp/version.js +85 -0
- package/sensor/dist/mcp/version.js.map +1 -0
- package/sensor/dist/project-config.d.ts +94 -0
- package/sensor/dist/project-config.d.ts.map +1 -0
- package/sensor/dist/project-config.js +374 -0
- package/sensor/dist/project-config.js.map +1 -0
- package/sensor/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
- package/sensor/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/c-fnptr-synthesizer.js +1070 -0
- package/sensor/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/callback-synthesizer.d.ts +59 -0
- package/sensor/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/callback-synthesizer.js +3961 -0
- package/sensor/dist/resolution/callback-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/cooperative-yield.d.ts +40 -0
- package/sensor/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/sensor/dist/resolution/cooperative-yield.js +44 -0
- package/sensor/dist/resolution/cooperative-yield.js.map +1 -0
- package/sensor/dist/resolution/frameworks/astro.d.ts +9 -0
- package/sensor/dist/resolution/frameworks/astro.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/astro.js +169 -0
- package/sensor/dist/resolution/frameworks/astro.js.map +1 -0
- package/sensor/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/sensor/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/sensor/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
- package/sensor/dist/resolution/frameworks/cics.d.ts +20 -0
- package/sensor/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/cics.js +90 -0
- package/sensor/dist/resolution/frameworks/cics.js.map +1 -0
- package/sensor/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/sensor/dist/resolution/frameworks/csharp.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/csharp.js +241 -0
- package/sensor/dist/resolution/frameworks/csharp.js.map +1 -0
- package/sensor/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/sensor/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/drupal.js +367 -0
- package/sensor/dist/resolution/frameworks/drupal.js.map +1 -0
- package/sensor/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/sensor/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/expo-modules.js +148 -0
- package/sensor/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/sensor/dist/resolution/frameworks/express.d.ts +8 -0
- package/sensor/dist/resolution/frameworks/express.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/express.js +308 -0
- package/sensor/dist/resolution/frameworks/express.js.map +1 -0
- package/sensor/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/sensor/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/fabric.js +354 -0
- package/sensor/dist/resolution/frameworks/fabric.js.map +1 -0
- package/sensor/dist/resolution/frameworks/go.d.ts +8 -0
- package/sensor/dist/resolution/frameworks/go.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/go.js +184 -0
- package/sensor/dist/resolution/frameworks/go.js.map +1 -0
- package/sensor/dist/resolution/frameworks/goframe.d.ts +41 -0
- package/sensor/dist/resolution/frameworks/goframe.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/goframe.js +112 -0
- package/sensor/dist/resolution/frameworks/goframe.js.map +1 -0
- package/sensor/dist/resolution/frameworks/index.d.ts +50 -0
- package/sensor/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/index.js +175 -0
- package/sensor/dist/resolution/frameworks/index.js.map +1 -0
- package/sensor/dist/resolution/frameworks/java.d.ts +8 -0
- package/sensor/dist/resolution/frameworks/java.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/java.js +517 -0
- package/sensor/dist/resolution/frameworks/java.js.map +1 -0
- package/sensor/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/sensor/dist/resolution/frameworks/laravel.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/laravel.js +257 -0
- package/sensor/dist/resolution/frameworks/laravel.js.map +1 -0
- package/sensor/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/sensor/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/nestjs.js +698 -0
- package/sensor/dist/resolution/frameworks/nestjs.js.map +1 -0
- package/sensor/dist/resolution/frameworks/play.d.ts +19 -0
- package/sensor/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/play.js +111 -0
- package/sensor/dist/resolution/frameworks/play.js.map +1 -0
- package/sensor/dist/resolution/frameworks/python.d.ts +10 -0
- package/sensor/dist/resolution/frameworks/python.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/python.js +400 -0
- package/sensor/dist/resolution/frameworks/python.js.map +1 -0
- package/sensor/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/sensor/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/react-native.js +410 -0
- package/sensor/dist/resolution/frameworks/react-native.js.map +1 -0
- package/sensor/dist/resolution/frameworks/react.d.ts +8 -0
- package/sensor/dist/resolution/frameworks/react.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/react.js +334 -0
- package/sensor/dist/resolution/frameworks/react.js.map +1 -0
- package/sensor/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/sensor/dist/resolution/frameworks/ruby.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/ruby.js +302 -0
- package/sensor/dist/resolution/frameworks/ruby.js.map +1 -0
- package/sensor/dist/resolution/frameworks/rust.d.ts +8 -0
- package/sensor/dist/resolution/frameworks/rust.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/rust.js +304 -0
- package/sensor/dist/resolution/frameworks/rust.js.map +1 -0
- package/sensor/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/sensor/dist/resolution/frameworks/svelte.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/svelte.js +253 -0
- package/sensor/dist/resolution/frameworks/svelte.js.map +1 -0
- package/sensor/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/sensor/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/swift-objc.js +252 -0
- package/sensor/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/sensor/dist/resolution/frameworks/swift.d.ts +10 -0
- package/sensor/dist/resolution/frameworks/swift.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/swift.js +400 -0
- package/sensor/dist/resolution/frameworks/swift.js.map +1 -0
- package/sensor/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/sensor/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/terraform.js +277 -0
- package/sensor/dist/resolution/frameworks/terraform.js.map +1 -0
- package/sensor/dist/resolution/frameworks/vue.d.ts +9 -0
- package/sensor/dist/resolution/frameworks/vue.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/vue.js +303 -0
- package/sensor/dist/resolution/frameworks/vue.js.map +1 -0
- package/sensor/dist/resolution/go-module.d.ts +26 -0
- package/sensor/dist/resolution/go-module.d.ts.map +1 -0
- package/sensor/dist/resolution/go-module.js +78 -0
- package/sensor/dist/resolution/go-module.js.map +1 -0
- package/sensor/dist/resolution/goframe-synthesizer.d.ts +29 -0
- package/sensor/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/goframe-synthesizer.js +163 -0
- package/sensor/dist/resolution/goframe-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/import-resolver.d.ts +84 -0
- package/sensor/dist/resolution/import-resolver.d.ts.map +1 -0
- package/sensor/dist/resolution/import-resolver.js +2172 -0
- package/sensor/dist/resolution/import-resolver.js.map +1 -0
- package/sensor/dist/resolution/index.d.ts +309 -0
- package/sensor/dist/resolution/index.d.ts.map +1 -0
- package/sensor/dist/resolution/index.js +2050 -0
- package/sensor/dist/resolution/index.js.map +1 -0
- package/sensor/dist/resolution/lru-cache.d.ts +24 -0
- package/sensor/dist/resolution/lru-cache.d.ts.map +1 -0
- package/sensor/dist/resolution/lru-cache.js +62 -0
- package/sensor/dist/resolution/lru-cache.js.map +1 -0
- package/sensor/dist/resolution/name-matcher.d.ts +126 -0
- package/sensor/dist/resolution/name-matcher.d.ts.map +1 -0
- package/sensor/dist/resolution/name-matcher.js +1968 -0
- package/sensor/dist/resolution/name-matcher.js.map +1 -0
- package/sensor/dist/resolution/path-aliases.d.ts +68 -0
- package/sensor/dist/resolution/path-aliases.d.ts.map +1 -0
- package/sensor/dist/resolution/path-aliases.js +238 -0
- package/sensor/dist/resolution/path-aliases.js.map +1 -0
- package/sensor/dist/resolution/resolver-pool.d.ts +66 -0
- package/sensor/dist/resolution/resolver-pool.d.ts.map +1 -0
- package/sensor/dist/resolution/resolver-pool.js +244 -0
- package/sensor/dist/resolution/resolver-pool.js.map +1 -0
- package/sensor/dist/resolution/resolver-worker.d.ts +17 -0
- package/sensor/dist/resolution/resolver-worker.d.ts.map +1 -0
- package/sensor/dist/resolution/resolver-worker.js +114 -0
- package/sensor/dist/resolution/resolver-worker.js.map +1 -0
- package/sensor/dist/resolution/strip-comments.d.ts +27 -0
- package/sensor/dist/resolution/strip-comments.d.ts.map +1 -0
- package/sensor/dist/resolution/strip-comments.js +492 -0
- package/sensor/dist/resolution/strip-comments.js.map +1 -0
- package/sensor/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/sensor/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/sensor/dist/resolution/swift-objc-bridge.js +256 -0
- package/sensor/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/sensor/dist/resolution/types.d.ts +265 -0
- package/sensor/dist/resolution/types.d.ts.map +1 -0
- package/sensor/dist/resolution/types.js +8 -0
- package/sensor/dist/resolution/types.js.map +1 -0
- package/sensor/dist/resolution/workspace-packages.d.ts +58 -0
- package/sensor/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/sensor/dist/resolution/workspace-packages.js +346 -0
- package/sensor/dist/resolution/workspace-packages.js.map +1 -0
- package/sensor/dist/search/identifier-segments.d.ts +60 -0
- package/sensor/dist/search/identifier-segments.d.ts.map +1 -0
- package/sensor/dist/search/identifier-segments.js +176 -0
- package/sensor/dist/search/identifier-segments.js.map +1 -0
- package/sensor/dist/search/query-parser.d.ts +57 -0
- package/sensor/dist/search/query-parser.d.ts.map +1 -0
- package/sensor/dist/search/query-parser.js +177 -0
- package/sensor/dist/search/query-parser.js.map +1 -0
- package/sensor/dist/search/query-utils.d.ts +87 -0
- package/sensor/dist/search/query-utils.d.ts.map +1 -0
- package/sensor/dist/search/query-utils.js +449 -0
- package/sensor/dist/search/query-utils.js.map +1 -0
- package/sensor/dist/sync/git-hooks.d.ts +45 -0
- package/sensor/dist/sync/git-hooks.d.ts.map +1 -0
- package/sensor/dist/sync/git-hooks.js +227 -0
- package/sensor/dist/sync/git-hooks.js.map +1 -0
- package/sensor/dist/sync/index.d.ts +19 -0
- package/sensor/dist/sync/index.d.ts.map +1 -0
- package/sensor/dist/sync/index.js +35 -0
- package/sensor/dist/sync/index.js.map +1 -0
- package/sensor/dist/sync/watch-policy.d.ts +48 -0
- package/sensor/dist/sync/watch-policy.d.ts.map +1 -0
- package/sensor/dist/sync/watch-policy.js +124 -0
- package/sensor/dist/sync/watch-policy.js.map +1 -0
- package/sensor/dist/sync/watcher.d.ts +372 -0
- package/sensor/dist/sync/watcher.d.ts.map +1 -0
- package/sensor/dist/sync/watcher.js +879 -0
- package/sensor/dist/sync/watcher.js.map +1 -0
- package/sensor/dist/sync/worktree.d.ts +63 -0
- package/sensor/dist/sync/worktree.d.ts.map +1 -0
- package/sensor/dist/sync/worktree.js +182 -0
- package/sensor/dist/sync/worktree.js.map +1 -0
- package/sensor/dist/telemetry/index.d.ts +157 -0
- package/sensor/dist/telemetry/index.d.ts.map +1 -0
- package/sensor/dist/telemetry/index.js +556 -0
- package/sensor/dist/telemetry/index.js.map +1 -0
- package/sensor/dist/types.d.ts +458 -0
- package/sensor/dist/types.d.ts.map +1 -0
- package/sensor/dist/types.js +117 -0
- package/sensor/dist/types.js.map +1 -0
- package/sensor/dist/ui/color.d.ts +21 -0
- package/sensor/dist/ui/color.d.ts.map +1 -0
- package/sensor/dist/ui/color.js +42 -0
- package/sensor/dist/ui/color.js.map +1 -0
- package/sensor/dist/ui/glyphs.d.ts +67 -0
- package/sensor/dist/ui/glyphs.d.ts.map +1 -0
- package/sensor/dist/ui/glyphs.js +125 -0
- package/sensor/dist/ui/glyphs.js.map +1 -0
- package/sensor/dist/ui/shimmer-progress.d.ts +11 -0
- package/sensor/dist/ui/shimmer-progress.d.ts.map +1 -0
- package/sensor/dist/ui/shimmer-progress.js +164 -0
- package/sensor/dist/ui/shimmer-progress.js.map +1 -0
- package/sensor/dist/ui/shimmer-worker.d.ts +2 -0
- package/sensor/dist/ui/shimmer-worker.d.ts.map +1 -0
- package/sensor/dist/ui/shimmer-worker.js +126 -0
- package/sensor/dist/ui/shimmer-worker.js.map +1 -0
- package/sensor/dist/ui/types.d.ts +15 -0
- package/sensor/dist/ui/types.d.ts.map +1 -0
- package/sensor/dist/ui/types.js +3 -0
- package/sensor/dist/ui/types.js.map +1 -0
- package/sensor/dist/upgrade/index.d.ts +171 -0
- package/sensor/dist/upgrade/index.d.ts.map +1 -0
- package/sensor/dist/upgrade/index.js +659 -0
- package/sensor/dist/upgrade/index.js.map +1 -0
- package/sensor/dist/upgrade/remove-binary.d.ts +87 -0
- package/sensor/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/sensor/dist/upgrade/remove-binary.js +289 -0
- package/sensor/dist/upgrade/remove-binary.js.map +1 -0
- package/sensor/dist/upgrade/update-check.d.ts +92 -0
- package/sensor/dist/upgrade/update-check.d.ts.map +1 -0
- package/sensor/dist/upgrade/update-check.js +258 -0
- package/sensor/dist/upgrade/update-check.js.map +1 -0
- package/sensor/dist/utils.d.ts +224 -0
- package/sensor/dist/utils.d.ts.map +1 -0
- package/sensor/dist/utils.js +583 -0
- package/sensor/dist/utils.js.map +1 -0
- package/sensor/package.json +61 -0
- package/src/artifact-contracts-v2.mjs +325 -0
- package/src/artifact-contracts.mjs +895 -0
- package/src/bootstrap.mjs +88 -0
- package/src/boundary-compiler.mjs +712 -0
- package/src/boundary-observation-compiler-v2.mjs +339 -0
- package/src/codegraph-adapter.mjs +422 -0
- package/src/control-compiler.mjs +532 -0
- package/src/factory-diagnostics.mjs +187 -0
- package/src/isolation-runner.mjs +333 -0
- package/src/node-version-guard.mjs +43 -0
- package/src/rc1-black-box-oracle.mjs +906 -0
- package/src/rc1-comparison.mjs +154 -0
- package/src/rc1-evidence-bundle.mjs +456 -0
- package/src/rc1-v4-campaign.mjs +707 -0
- package/src/rc1-v4-transform.mjs +467 -0
- package/src/rc1-v5-artifact-set.mjs +855 -0
- package/src/rc1-v5-behavior-evidence.mjs +594 -0
- package/src/rc1-v5-campaign.mjs +796 -0
- package/src/rc1-v5-transform.mjs +421 -0
- package/src/rc1-v6-artifact-set.mjs +807 -0
- package/src/rc1-v6-behavior-evidence.mjs +273 -0
- package/src/rc1-v6-campaign.mjs +623 -0
- package/src/rc1-v6-causal-binding.mjs +471 -0
- package/src/rc1-v6-measurement.mjs +331 -0
- package/src/rc2-artifact-set.mjs +1579 -0
- package/src/rc2-campaign.mjs +1520 -0
- package/src/rc2-delivery-policy-front-end.mjs +1079 -0
- package/src/rc2-delivery-policy-oracle.mjs +134 -0
- package/src/rc2-delivery-policy-transform.mjs +1127 -0
- package/src/rc2-rc1-transfer-front-end.mjs +511 -0
- package/src/rc3-actual-dogfood.mjs +648 -0
- package/src/rc3-dogfood-scaffold.mjs +310 -0
- package/src/rc3-scripted-campaign.mjs +1301 -0
- package/src/rc4-stage1-dogfood.mjs +652 -0
- package/src/runtime-cli.mjs +504 -0
- package/src/runtime-contracts.mjs +631 -0
- package/src/runtime-decision-verifier.mjs +607 -0
- package/src/runtime-diff-observer.mjs +265 -0
- package/src/runtime-engine.mjs +674 -0
- package/src/runtime-errors.mjs +356 -0
- package/src/runtime-event-store.mjs +217 -0
- package/src/runtime-front-end.mjs +764 -0
- package/src/runtime-hold-recompile.mjs +606 -0
- package/src/runtime-projection.mjs +180 -0
- package/src/runtime-scripted-executor.mjs +163 -0
- package/src/runtime-worktree-executor.mjs +199 -0
- package/src/schedulability-compiler-v2.mjs +303 -0
- package/src/schedulability-verifier-v2.mjs +317 -0
- package/src/seam-transform.mjs +554 -0
- package/src/treatment-compiler.mjs +728 -0
- package/src/treatment-runner.mjs +658 -0
|
@@ -0,0 +1,1520 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { constants as fsConstants } from 'node:fs';
|
|
4
|
+
import {
|
|
5
|
+
access,
|
|
6
|
+
lstat,
|
|
7
|
+
mkdir,
|
|
8
|
+
mkdtemp,
|
|
9
|
+
open,
|
|
10
|
+
readFile,
|
|
11
|
+
realpath,
|
|
12
|
+
rename,
|
|
13
|
+
rm,
|
|
14
|
+
writeFile,
|
|
15
|
+
} from 'node:fs/promises';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
import { performance } from 'node:perf_hooks';
|
|
18
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
canonicalizeArtifact,
|
|
22
|
+
digestArtifact,
|
|
23
|
+
} from './artifact-contracts.mjs';
|
|
24
|
+
import { compileBoundaryCondition } from './boundary-compiler.mjs';
|
|
25
|
+
import { collectCodegraphEvidence } from './codegraph-adapter.mjs';
|
|
26
|
+
import { runIsolatedTransform } from './isolation-runner.mjs';
|
|
27
|
+
import { runRc1BlackBoxOracle } from './rc1-black-box-oracle.mjs';
|
|
28
|
+
import { createRc1EvidenceBundle } from './rc1-evidence-bundle.mjs';
|
|
29
|
+
import {
|
|
30
|
+
RC2_ARTIFACT_PATHS,
|
|
31
|
+
verifyRc2CampaignArtifactSet,
|
|
32
|
+
} from './rc2-artifact-set.mjs';
|
|
33
|
+
import { compileDeliveryPolicyBoundaryBundleV2 } from './rc2-delivery-policy-front-end.mjs';
|
|
34
|
+
import { runRc2DeliveryPolicyOracle } from './rc2-delivery-policy-oracle.mjs';
|
|
35
|
+
import {
|
|
36
|
+
applyRc2DeliveryPolicyTransform,
|
|
37
|
+
RC2_DELIVERY_POLICY_TRANSFORM_PATHS,
|
|
38
|
+
runRc2DeliveryPolicySeamTransform,
|
|
39
|
+
} from './rc2-delivery-policy-transform.mjs';
|
|
40
|
+
import { compileRc1TransferBundleV2 } from './rc2-rc1-transfer-front-end.mjs';
|
|
41
|
+
import { compileSchedulabilityGraphV2 } from './schedulability-compiler-v2.mjs';
|
|
42
|
+
import { verifySchedulabilityPlanV2 } from './schedulability-verifier-v2.mjs';
|
|
43
|
+
|
|
44
|
+
const ARTIFACT_VERSION = 'v4';
|
|
45
|
+
const ARTIFACT_ROOTS = Object.freeze({
|
|
46
|
+
v1: 'research/campaigns/rc2/artifacts/v1',
|
|
47
|
+
v2: 'research/campaigns/rc2/artifacts/v2',
|
|
48
|
+
v3: 'research/campaigns/rc2/artifacts/v3',
|
|
49
|
+
v4: 'research/campaigns/rc2/artifacts/v4',
|
|
50
|
+
});
|
|
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)との完全一致だけを受理する。
|
|
54
|
+
// 過去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',
|
|
57
|
+
'utf8',
|
|
58
|
+
);
|
|
59
|
+
const V2_ONLY_ARTIFACT_PATHS = Object.freeze([
|
|
60
|
+
CODEGRAPH_CONFIG_ARTIFACT_PATH,
|
|
61
|
+
'predecessors/adr-0040.md',
|
|
62
|
+
'predecessors/rc2-v1-artifact-manifest.json',
|
|
63
|
+
'predecessors/rc2-v1-new-plan-version.json',
|
|
64
|
+
]);
|
|
65
|
+
const V3_ONLY_ARTIFACT_PATHS = Object.freeze([
|
|
66
|
+
'predecessors/adr-0041.md',
|
|
67
|
+
'predecessors/rc2-semantic-reseal-characterization.md',
|
|
68
|
+
'predecessors/rc2-v2-artifact-manifest.json',
|
|
69
|
+
'predecessors/rc2-v2-new-plan-version.json',
|
|
70
|
+
]);
|
|
71
|
+
const V4_ONLY_ARTIFACT_PATHS = Object.freeze([
|
|
72
|
+
'predecessors/adr-0042.md',
|
|
73
|
+
'predecessors/rc2-v3-version-downgrade-refutation.md',
|
|
74
|
+
'predecessors/rc2-v3-artifact-manifest.json',
|
|
75
|
+
'predecessors/rc2-v3-new-plan-version.json',
|
|
76
|
+
]);
|
|
77
|
+
const RC2_V3_ARTIFACT_PATHS = Object.freeze(RC2_ARTIFACT_PATHS.filter((relativePath) => (
|
|
78
|
+
!V4_ONLY_ARTIFACT_PATHS.includes(relativePath)
|
|
79
|
+
)));
|
|
80
|
+
const RC2_V2_ARTIFACT_PATHS = Object.freeze(RC2_V3_ARTIFACT_PATHS.filter((relativePath) => (
|
|
81
|
+
!V3_ONLY_ARTIFACT_PATHS.includes(relativePath)
|
|
82
|
+
)));
|
|
83
|
+
const RC2_V1_ARTIFACT_PATHS = Object.freeze(RC2_V2_ARTIFACT_PATHS.filter((relativePath) => (
|
|
84
|
+
!V2_ONLY_ARTIFACT_PATHS.includes(relativePath)
|
|
85
|
+
)));
|
|
86
|
+
const GIT_SHA1 = /^[0-9a-f]{40}$/;
|
|
87
|
+
const SEMVER = /^\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?$/;
|
|
88
|
+
const RAW_EVIDENCE_CHUNK_BYTES = 12_000;
|
|
89
|
+
|
|
90
|
+
const PRIMARY_INPUT_FILES = Object.freeze({
|
|
91
|
+
planInput: 'research/campaigns/rc2/inputs/plan-input.json',
|
|
92
|
+
candidateSpec: 'research/campaigns/rc2/inputs/candidate-spec-v1.json',
|
|
93
|
+
normalManualEvidence: 'research/campaigns/rc2/inputs/manual-evidence.normal.json',
|
|
94
|
+
partialManualEvidence: 'research/campaigns/rc2/inputs/manual-evidence.partial-state-negative.json',
|
|
95
|
+
unknownManualEvidence: 'research/campaigns/rc2/inputs/manual-evidence.third-only-unknown.json',
|
|
96
|
+
querySet: 'research/campaigns/rc2/inputs/query-set-v2.json',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const RC1_ARTIFACT_ROOT = 'research/campaigns/rc1/artifacts/v6';
|
|
100
|
+
const RC1_INPUT_FILES = Object.freeze({
|
|
101
|
+
planInput: `${RC1_ARTIFACT_ROOT}/inputs/plan-input.json`,
|
|
102
|
+
candidateSpec: `${RC1_ARTIFACT_ROOT}/inputs/candidate-spec-v2.json`,
|
|
103
|
+
normalManualEvidence: `${RC1_ARTIFACT_ROOT}/inputs/manual-evidence.normal.json`,
|
|
104
|
+
negativeManualEvidence: `${RC1_ARTIFACT_ROOT}/inputs/manual-evidence.shared-state-negative.json`,
|
|
105
|
+
querySet: `${RC1_ARTIFACT_ROOT}/inputs/query-set-v2.json`,
|
|
106
|
+
oracle: `${RC1_ARTIFACT_ROOT}/inputs/behavior-oracle-v2.json`,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const PRIMARY_ARTIFACT_INPUTS = Object.freeze({
|
|
110
|
+
planInput: 'inputs/primary/plan-input.json',
|
|
111
|
+
candidateSpec: 'inputs/primary/candidate-spec-v1.json',
|
|
112
|
+
normalManualEvidence: 'inputs/primary/manual-evidence.normal.json',
|
|
113
|
+
partialManualEvidence: 'inputs/primary/manual-evidence.partial-state-negative.json',
|
|
114
|
+
unknownManualEvidence: 'inputs/primary/manual-evidence.third-only-unknown.json',
|
|
115
|
+
querySet: 'inputs/primary/query-set-v2.json',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const RC1_ARTIFACT_INPUTS = Object.freeze({
|
|
119
|
+
planInput: 'inputs/rc1/plan-input.json',
|
|
120
|
+
candidateSpec: 'inputs/rc1/candidate-spec-v2.json',
|
|
121
|
+
normalManualEvidence: 'inputs/rc1/manual-evidence.normal.json',
|
|
122
|
+
negativeManualEvidence: 'inputs/rc1/manual-evidence.shared-state-negative.json',
|
|
123
|
+
querySet: 'inputs/rc1/query-set-v2.json',
|
|
124
|
+
oracle: 'inputs/rc1/behavior-oracle-v2.json',
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const SOURCE_IDENTITIES = Object.freeze([
|
|
128
|
+
['src/codegraph-adapter.mjs', 'identity/codegraph-adapter.mjs', new URL('./codegraph-adapter.mjs', import.meta.url)],
|
|
129
|
+
['src/rc1-black-box-oracle.mjs', 'identity/rc1-black-box-oracle.mjs', new URL('./rc1-black-box-oracle.mjs', import.meta.url)],
|
|
130
|
+
['src/boundary-compiler.mjs', 'identity/rc1-boundary-compiler.mjs', new URL('./boundary-compiler.mjs', import.meta.url)],
|
|
131
|
+
['src/rc1-evidence-bundle.mjs', 'identity/rc1-evidence-bundle.mjs', new URL('./rc1-evidence-bundle.mjs', import.meta.url)],
|
|
132
|
+
['src/rc2-artifact-set.mjs', 'identity/rc2-artifact-set.mjs', new URL('./rc2-artifact-set.mjs', import.meta.url)],
|
|
133
|
+
['src/rc2-campaign.mjs', 'identity/rc2-campaign.mjs', new URL(import.meta.url)],
|
|
134
|
+
['src/rc2-delivery-policy-front-end.mjs', 'identity/rc2-delivery-policy-front-end.mjs', new URL('./rc2-delivery-policy-front-end.mjs', import.meta.url)],
|
|
135
|
+
['src/rc2-delivery-policy-oracle.mjs', 'identity/rc2-delivery-policy-oracle.mjs', new URL('./rc2-delivery-policy-oracle.mjs', import.meta.url)],
|
|
136
|
+
['src/rc2-delivery-policy-transform.mjs', 'identity/rc2-delivery-policy-transform.mjs', new URL('./rc2-delivery-policy-transform.mjs', import.meta.url)],
|
|
137
|
+
['src/rc2-rc1-transfer-front-end.mjs', 'identity/rc2-rc1-transfer-front-end.mjs', new URL('./rc2-rc1-transfer-front-end.mjs', import.meta.url)],
|
|
138
|
+
['src/schedulability-compiler-v2.mjs', 'identity/schedulability-compiler-v2.mjs', new URL('./schedulability-compiler-v2.mjs', import.meta.url)],
|
|
139
|
+
['src/schedulability-verifier-v2.mjs', 'identity/schedulability-verifier-v2.mjs', new URL('./schedulability-verifier-v2.mjs', import.meta.url)],
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
const PREDECESSOR_FILES = Object.freeze({
|
|
143
|
+
'predecessors/adr-0031.md': 'docs/adr/0031-rc1-v6-phase-gate-support.md',
|
|
144
|
+
'predecessors/adr-0032.md': 'docs/adr/0032-rc2-bounded-graph-compiler-and-three-way-seam.md',
|
|
145
|
+
'predecessors/adr-0037.md': 'docs/adr/0037-rc2-delivery-policy-transform-transaction.md',
|
|
146
|
+
'predecessors/adr-0038.md': 'docs/adr/0038-rc2-closed-loop-version-and-artifact-contract.md',
|
|
147
|
+
'predecessors/rc1-v6-artifact-manifest.json': `${RC1_ARTIFACT_ROOT}/artifact-manifest.json`,
|
|
148
|
+
'predecessors/rc1-v6-plan.md': 'docs/archive/2026-07-16-plan-lattice-research-campaign-1-v6-phase-supported.md',
|
|
149
|
+
'predecessors/rc1-v6-seam.patch': `${RC1_ARTIFACT_ROOT}/transform/seam.patch`,
|
|
150
|
+
'predecessors/rc1-v6-transform-artifact.json': `${RC1_ARTIFACT_ROOT}/transform/transform-artifact.json`,
|
|
151
|
+
'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',
|
|
153
|
+
'predecessors/rc2-v1-artifact-manifest.json': `${ARTIFACT_ROOTS.v1}/artifact-manifest.json`,
|
|
154
|
+
'predecessors/rc2-v1-new-plan-version.json': `${ARTIFACT_ROOTS.v1}/new-plan-version.json`,
|
|
155
|
+
'predecessors/adr-0041.md': 'docs/adr/0041-rc2-artifact-semantic-oracle-mutation-binding.md',
|
|
156
|
+
'predecessors/rc2-semantic-reseal-characterization.md': 'docs/evidence/2026-07-16-rc2-artifact-semantic-reseal-characterization.md',
|
|
157
|
+
'predecessors/rc2-v2-artifact-manifest.json': `${ARTIFACT_ROOTS.v2}/artifact-manifest.json`,
|
|
158
|
+
'predecessors/rc2-v2-new-plan-version.json': `${ARTIFACT_ROOTS.v2}/new-plan-version.json`,
|
|
159
|
+
'predecessors/adr-0042.md': 'docs/adr/0042-rc2-artifact-version-witness-epoch-and-v4.md',
|
|
160
|
+
'predecessors/rc2-v3-version-downgrade-refutation.md': 'docs/evidence/2026-07-16-rc2-v3-version-downgrade-refutation.md',
|
|
161
|
+
'predecessors/rc2-v3-artifact-manifest.json': `${ARTIFACT_ROOTS.v3}/artifact-manifest.json`,
|
|
162
|
+
'predecessors/rc2-v3-new-plan-version.json': `${ARTIFACT_ROOTS.v3}/new-plan-version.json`,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const RUN_IDS = Object.freeze([
|
|
166
|
+
'primary-control-1',
|
|
167
|
+
'primary-control-2',
|
|
168
|
+
'primary-treatment-1',
|
|
169
|
+
'primary-treatment-2',
|
|
170
|
+
'rc1-transfer-control-1',
|
|
171
|
+
'rc1-transfer-treatment-1',
|
|
172
|
+
]);
|
|
173
|
+
|
|
174
|
+
function plainRecord(value) {
|
|
175
|
+
return value !== null
|
|
176
|
+
&& typeof value === 'object'
|
|
177
|
+
&& !Array.isArray(value)
|
|
178
|
+
&& Object.getPrototypeOf(value) === Object.prototype;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function exactRecord(value, keys) {
|
|
182
|
+
if (!plainRecord(value)) return false;
|
|
183
|
+
const actual = Object.keys(value).sort();
|
|
184
|
+
const expected = [...keys].sort();
|
|
185
|
+
return actual.length === expected.length
|
|
186
|
+
&& actual.every((key, index) => key === expected[index]);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function sha256(bytes) {
|
|
190
|
+
return createHash('sha256').update(bytes).digest('hex');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function jsonBytes(value) {
|
|
194
|
+
return Buffer.from(canonicalizeArtifact(value), 'utf8');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function roundedMilliseconds(startedAt) {
|
|
198
|
+
return Math.round((performance.now() - startedAt) * 1_000) / 1_000;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function run(command, args, { cwd, input, allowExitCodes = [0] } = {}) {
|
|
202
|
+
return new Promise((resolve, reject) => {
|
|
203
|
+
const child = spawn(command, args, {
|
|
204
|
+
cwd,
|
|
205
|
+
shell: false,
|
|
206
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
207
|
+
env: { ...process.env, NO_COLOR: '1' },
|
|
208
|
+
});
|
|
209
|
+
const stdout = [];
|
|
210
|
+
const stderr = [];
|
|
211
|
+
child.stdout.on('data', (chunk) => stdout.push(chunk));
|
|
212
|
+
child.stderr.on('data', (chunk) => stderr.push(chunk));
|
|
213
|
+
child.once('error', reject);
|
|
214
|
+
child.once('close', (code, signal) => {
|
|
215
|
+
const result = {
|
|
216
|
+
code,
|
|
217
|
+
signal,
|
|
218
|
+
stdout: Buffer.concat(stdout),
|
|
219
|
+
stderr: Buffer.concat(stderr),
|
|
220
|
+
};
|
|
221
|
+
if (allowExitCodes.includes(code) && signal === null) resolve(result);
|
|
222
|
+
else reject(Object.assign(
|
|
223
|
+
new Error(`${command} failed (${signal ?? code}): ${result.stderr.toString('utf8').trim()}`),
|
|
224
|
+
result,
|
|
225
|
+
));
|
|
226
|
+
});
|
|
227
|
+
child.stdin.end(input);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
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
|
+
async function captureExecutionIdentity(repoRoot) {
|
|
248
|
+
const sources = [];
|
|
249
|
+
const payloads = new Map();
|
|
250
|
+
for (const [runtimePath, artifactRef, sourceUrl] of SOURCE_IDENTITIES) {
|
|
251
|
+
const bytes = await readFile(sourceUrl);
|
|
252
|
+
payloads.set(artifactRef, bytes);
|
|
253
|
+
sources.push({ runtime_path: runtimePath, artifact_ref: artifactRef, digest: sha256(bytes) });
|
|
254
|
+
}
|
|
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と一致しない');
|
|
262
|
+
}
|
|
263
|
+
const codegraphIdentity = {
|
|
264
|
+
schema: 'lattice.rc2.codegraph_identity.v2',
|
|
265
|
+
version,
|
|
266
|
+
executable_ref: 'codegraph',
|
|
267
|
+
executable_digest: sha256(executableBytes),
|
|
268
|
+
project_config_ref: CODEGRAPH_CONFIG_ARTIFACT_PATH,
|
|
269
|
+
project_config_digest: sha256(projectConfigBytes),
|
|
270
|
+
};
|
|
271
|
+
payloads.set('identity/codegraph-executable', executableBytes);
|
|
272
|
+
payloads.set(CODEGRAPH_CONFIG_ARTIFACT_PATH, projectConfigBytes);
|
|
273
|
+
const snapshot = { sources, codegraph_identity: codegraphIdentity };
|
|
274
|
+
return { snapshot, digest: digestArtifact(snapshot), payloads };
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async function readJson(repoRoot, relativePath) {
|
|
278
|
+
return JSON.parse(await readFile(path.join(repoRoot, relativePath), 'utf8'));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
async function loadInputs(repoRoot) {
|
|
282
|
+
const primary = {};
|
|
283
|
+
const rc1 = {};
|
|
284
|
+
for (const [key, relativePath] of Object.entries(PRIMARY_INPUT_FILES)) {
|
|
285
|
+
primary[key] = await readJson(repoRoot, relativePath);
|
|
286
|
+
}
|
|
287
|
+
for (const [key, relativePath] of Object.entries(RC1_INPUT_FILES)) {
|
|
288
|
+
rc1[key] = await readJson(repoRoot, relativePath);
|
|
289
|
+
}
|
|
290
|
+
return { primary, rc1 };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
async function loadPredecessors(repoRoot) {
|
|
294
|
+
const payloads = new Map();
|
|
295
|
+
for (const [artifactPath, repoPath] of Object.entries(PREDECESSOR_FILES)) {
|
|
296
|
+
payloads.set(artifactPath, await readFile(path.join(repoRoot, repoPath)));
|
|
297
|
+
}
|
|
298
|
+
return payloads;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function loadV3PlanPredecessor(payloads) {
|
|
302
|
+
const manifestBytes = payloads.get('predecessors/rc2-v3-artifact-manifest.json');
|
|
303
|
+
const planBytes = payloads.get('predecessors/rc2-v3-new-plan-version.json');
|
|
304
|
+
let manifest;
|
|
305
|
+
let plan;
|
|
306
|
+
try {
|
|
307
|
+
manifest = JSON.parse(manifestBytes.toString('utf8'));
|
|
308
|
+
plan = JSON.parse(planBytes.toString('utf8'));
|
|
309
|
+
} catch {
|
|
310
|
+
throw new TypeError('RC2 v3 predecessor JSONをparseできない');
|
|
311
|
+
}
|
|
312
|
+
const paths = Array.isArray(manifest?.files)
|
|
313
|
+
? manifest.files.map(({ path: relativePath }) => relativePath).sort()
|
|
314
|
+
: [];
|
|
315
|
+
const entry = manifest?.files?.find(({ path: relativePath }) => (
|
|
316
|
+
relativePath === 'new-plan-version.json'
|
|
317
|
+
));
|
|
318
|
+
if (!jsonBytes(manifest).equals(manifestBytes)
|
|
319
|
+
|| !jsonBytes(plan).equals(planBytes)
|
|
320
|
+
|| manifest.schema !== 'lattice.rc2.artifact_manifest.v3'
|
|
321
|
+
|| !isDeepStrictEqual(paths, [...RC2_V3_ARTIFACT_PATHS])
|
|
322
|
+
|| !exactRecord(entry, ['path', 'media_type', 'bytes', 'sha256'])
|
|
323
|
+
|| entry.media_type !== 'application/json'
|
|
324
|
+
|| entry.bytes !== planBytes.byteLength
|
|
325
|
+
|| entry.sha256 !== sha256(planBytes)
|
|
326
|
+
|| plan.schema !== 'lattice.rc2.plan_version.v1'
|
|
327
|
+
|| plan.version !== 'rc2-delivery-policy-v4'
|
|
328
|
+
|| plan.plan_digest !== digestArtifact(plan.plan)) {
|
|
329
|
+
throw new TypeError('RC2 v3 predecessor manifest/plan bindingが不正');
|
|
330
|
+
}
|
|
331
|
+
return plan;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
async function resolveRepository(repoRoot, baseRef) {
|
|
335
|
+
if (typeof repoRoot !== 'string' || repoRoot.length === 0
|
|
336
|
+
|| typeof baseRef !== 'string' || baseRef.length === 0) {
|
|
337
|
+
throw new TypeError('repoRoot and baseRef are required');
|
|
338
|
+
}
|
|
339
|
+
const root = await realpath(repoRoot);
|
|
340
|
+
const status = await run('git', ['status', '--porcelain=v1', '-z'], { cwd: root });
|
|
341
|
+
if (status.stdout.length > 0) throw new TypeError('RC2 campaign source repository must be clean');
|
|
342
|
+
const head = (await run('git', ['rev-parse', '--verify', 'HEAD^{commit}'], { cwd: root }))
|
|
343
|
+
.stdout.toString('utf8').trim();
|
|
344
|
+
const baseSha = (await run('git', ['rev-parse', '--verify', `${baseRef}^{commit}`], { cwd: root }))
|
|
345
|
+
.stdout.toString('utf8').trim();
|
|
346
|
+
if (!GIT_SHA1.test(head) || !GIT_SHA1.test(baseSha) || head !== baseSha) {
|
|
347
|
+
throw new TypeError('RC2 campaign requires clean HEAD === baseRef');
|
|
348
|
+
}
|
|
349
|
+
return { root, baseSha };
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function surfacePaths(candidateSpec) {
|
|
353
|
+
const result = new Set();
|
|
354
|
+
if (candidateSpec.fixed_oracle?.path) result.add(candidateSpec.fixed_oracle.path);
|
|
355
|
+
for (const todo of candidateSpec.todos) {
|
|
356
|
+
for (const mode of ['current', 'proposed']) {
|
|
357
|
+
result.add(todo[mode].production.path);
|
|
358
|
+
todo[mode].tests.forEach(({ path: testPath }) => result.add(testPath));
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return [...result].sort();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
async function captureSourceSnapshot(repoRoot, paths) {
|
|
365
|
+
const files = [];
|
|
366
|
+
for (const relativePath of paths) {
|
|
367
|
+
const absolutePath = path.join(repoRoot, relativePath);
|
|
368
|
+
try {
|
|
369
|
+
const stat = await lstat(absolutePath);
|
|
370
|
+
if (!stat.isFile() || stat.isSymbolicLink()) {
|
|
371
|
+
throw new TypeError(`snapshot pathが通常fileではない: ${relativePath}`);
|
|
372
|
+
}
|
|
373
|
+
files.push({ path: relativePath, state: 'file', content_digest: sha256(await readFile(absolutePath)) });
|
|
374
|
+
} catch (error) {
|
|
375
|
+
if (error?.code !== 'ENOENT') throw error;
|
|
376
|
+
files.push({ path: relativePath, state: 'absent', content_digest: null });
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return { schema_version: 'lattice.rc2.source_snapshot.v1', files };
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
async function applyPatch(worktreePath, patch) {
|
|
383
|
+
if (!Buffer.isBuffer(patch) || patch.length === 0) throw new TypeError('accepted patch bytes are required');
|
|
384
|
+
await run('git', ['apply', '--check', '--binary', '-'], { cwd: worktreePath, input: patch });
|
|
385
|
+
await run('git', ['apply', '--binary', '-'], { cwd: worktreePath, input: patch });
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
async function captureCodegraphBootstrap(worktreePath) {
|
|
389
|
+
try {
|
|
390
|
+
return await readFile(path.join(worktreePath, '.codegraph', '.gitignore'));
|
|
391
|
+
} catch (error) {
|
|
392
|
+
if (error?.code === 'ENOENT') return null;
|
|
393
|
+
throw error;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
async function restoreCodegraphBootstrap(worktreePath, bootstrap) {
|
|
398
|
+
const codegraphPath = path.join(worktreePath, '.codegraph');
|
|
399
|
+
await rm(codegraphPath, { recursive: true, force: true });
|
|
400
|
+
if (bootstrap === null) return;
|
|
401
|
+
await mkdir(codegraphPath, { recursive: true });
|
|
402
|
+
await writeFile(path.join(codegraphPath, '.gitignore'), bootstrap);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
async function worktreeCount(repoRoot) {
|
|
406
|
+
const output = (await run('git', ['worktree', 'list', '--porcelain'], { cwd: repoRoot }))
|
|
407
|
+
.stdout.toString('utf8');
|
|
408
|
+
return output.split('\n').filter((line) => line.startsWith('worktree ')).length;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function measured(elapsedMs) {
|
|
412
|
+
return { state: 'measured', elapsed_ms: elapsedMs };
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
async function observeFreshIndex({
|
|
416
|
+
repoRoot,
|
|
417
|
+
baseSha,
|
|
418
|
+
family,
|
|
419
|
+
condition,
|
|
420
|
+
runId,
|
|
421
|
+
querySet,
|
|
422
|
+
paths,
|
|
423
|
+
patch,
|
|
424
|
+
allowedPaths,
|
|
425
|
+
codegraphIdentity,
|
|
426
|
+
oracle,
|
|
427
|
+
rc1Inputs,
|
|
428
|
+
costMeasurements,
|
|
429
|
+
}) {
|
|
430
|
+
const beforeCount = await worktreeCount(repoRoot);
|
|
431
|
+
let rawEvidence;
|
|
432
|
+
let snapshot;
|
|
433
|
+
let oracleReceipt;
|
|
434
|
+
let isolationInstanceDigest;
|
|
435
|
+
let indexElapsedMs;
|
|
436
|
+
let queryElapsedMs;
|
|
437
|
+
let oracleElapsedMs;
|
|
438
|
+
const isolated = await runIsolatedTransform({
|
|
439
|
+
repoRoot,
|
|
440
|
+
baseRef: baseSha,
|
|
441
|
+
allowedPaths,
|
|
442
|
+
transform: async ({ worktreePath }) => {
|
|
443
|
+
if (condition === 'treatment') await applyPatch(worktreePath, patch);
|
|
444
|
+
},
|
|
445
|
+
verifyCommands: [],
|
|
446
|
+
observe: async ({ worktreePath }) => {
|
|
447
|
+
isolationInstanceDigest = sha256(Buffer.from(worktreePath, 'utf8'));
|
|
448
|
+
snapshot = await captureSourceSnapshot(worktreePath, paths);
|
|
449
|
+
const oracleStarted = performance.now();
|
|
450
|
+
oracleReceipt = family === 'primary'
|
|
451
|
+
? await runRc2DeliveryPolicyOracle({ repoRoot: worktreePath })
|
|
452
|
+
: await runRc1BlackBoxOracle({ repoRoot: worktreePath, oracle });
|
|
453
|
+
oracleElapsedMs = roundedMilliseconds(oracleStarted);
|
|
454
|
+
if (oracleReceipt.outcome !== 'passed') throw new TypeError(`${runId} oracle failed`);
|
|
455
|
+
const bootstrap = await captureCodegraphBootstrap(worktreePath);
|
|
456
|
+
try {
|
|
457
|
+
const indexStarted = performance.now();
|
|
458
|
+
await run('codegraph', ['init', '.'], { cwd: worktreePath });
|
|
459
|
+
indexElapsedMs = roundedMilliseconds(indexStarted);
|
|
460
|
+
const queryStarted = performance.now();
|
|
461
|
+
rawEvidence = await collectCodegraphEvidence({ cwd: worktreePath, querySet });
|
|
462
|
+
queryElapsedMs = roundedMilliseconds(queryStarted);
|
|
463
|
+
} finally {
|
|
464
|
+
await restoreCodegraphBootstrap(worktreePath, bootstrap);
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
const afterCount = await worktreeCount(repoRoot);
|
|
469
|
+
if (!rawEvidence || !snapshot || !oracleReceipt || !isolationInstanceDigest
|
|
470
|
+
|| isolated.sourceInvariant?.outcome !== 'passed'
|
|
471
|
+
|| beforeCount !== afterCount) {
|
|
472
|
+
throw new TypeError(`${runId} fresh observation is incomplete`);
|
|
473
|
+
}
|
|
474
|
+
if (condition === 'treatment' && !isolated.patch.equals(patch)) {
|
|
475
|
+
throw new TypeError(`${runId} did not replay the accepted patch exactly`);
|
|
476
|
+
}
|
|
477
|
+
if (condition === 'control' && isolated.patch.length !== 0) {
|
|
478
|
+
throw new TypeError(`${runId} control unexpectedly changed source`);
|
|
479
|
+
}
|
|
480
|
+
const evidence = createRc1EvidenceBundle({ condition, runId, querySet, rawEvidence });
|
|
481
|
+
const patchDigest = condition === 'treatment' ? sha256(isolated.patch) : null;
|
|
482
|
+
const measurement = {
|
|
483
|
+
schema: 'lattice.rc2.codegraph_measurement.v1',
|
|
484
|
+
base_sha: baseSha,
|
|
485
|
+
patch_digest: patchDigest,
|
|
486
|
+
snapshot,
|
|
487
|
+
snapshot_digest: digestArtifact(snapshot),
|
|
488
|
+
codegraph_identity: structuredClone(codegraphIdentity),
|
|
489
|
+
codegraph_identity_digest: digestArtifact(codegraphIdentity),
|
|
490
|
+
query_set_digest: digestArtifact(querySet),
|
|
491
|
+
raw_evidence_digest: evidence.raw.payload_digest,
|
|
492
|
+
};
|
|
493
|
+
const cost = {
|
|
494
|
+
index: measured(indexElapsedMs),
|
|
495
|
+
query: measured(queryElapsedMs),
|
|
496
|
+
oracle: measured(oracleElapsedMs),
|
|
497
|
+
};
|
|
498
|
+
for (const [stage, value] of Object.entries(cost)) {
|
|
499
|
+
costMeasurements.push({
|
|
500
|
+
stage: `run.${runId}.${stage}`,
|
|
501
|
+
state: value.state,
|
|
502
|
+
elapsed_ms: value.elapsed_ms,
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
const runRecord = {
|
|
506
|
+
schema: 'lattice.rc2.fresh_codegraph_run.v1',
|
|
507
|
+
family,
|
|
508
|
+
condition,
|
|
509
|
+
run_id: runId,
|
|
510
|
+
fresh_index: true,
|
|
511
|
+
isolation_instance_digest: isolationInstanceDigest,
|
|
512
|
+
evidence,
|
|
513
|
+
measurement,
|
|
514
|
+
oracle_receipt: oracleReceipt,
|
|
515
|
+
legacy_boundary_manifests: null,
|
|
516
|
+
source_invariant: isolated.sourceInvariant,
|
|
517
|
+
cleanup: {
|
|
518
|
+
schema: 'lattice.rc2.worktree_cleanup_receipt.v1',
|
|
519
|
+
outcome: 'passed',
|
|
520
|
+
worktree_count_before: beforeCount,
|
|
521
|
+
worktree_count_after: afterCount,
|
|
522
|
+
},
|
|
523
|
+
cost,
|
|
524
|
+
};
|
|
525
|
+
if (family === 'rc1_transfer') {
|
|
526
|
+
const raw = JSON.parse(Buffer.from(evidence.raw.payload_base64, 'base64').toString('utf8'));
|
|
527
|
+
const compileLegacy = (manualEvidence, label) => compileBoundaryCondition({
|
|
528
|
+
planInput: rc1Inputs.planInput,
|
|
529
|
+
candidateSpec: rc1Inputs.candidateSpec,
|
|
530
|
+
manualEvidence,
|
|
531
|
+
querySet: rc1Inputs.querySet,
|
|
532
|
+
codegraphEvidence: raw,
|
|
533
|
+
codeSnapshotDigest: measurement.snapshot_digest,
|
|
534
|
+
planVersion: `rc2-${condition}-transfer-${label}`,
|
|
535
|
+
});
|
|
536
|
+
runRecord.legacy_boundary_manifests = {
|
|
537
|
+
normal: compileLegacy(rc1Inputs.normalManualEvidence, 'normal').boundary_manifest,
|
|
538
|
+
negative: compileLegacy(rc1Inputs.negativeManualEvidence, 'negative').boundary_manifest,
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
return runRecord;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function verdictFor(bundle, compiled) {
|
|
545
|
+
return {
|
|
546
|
+
schema_version: 'lattice.boundary_verdict.v2',
|
|
547
|
+
normalized_graph_digest: bundle.graph_digest,
|
|
548
|
+
verdicts: compiled.pairwise_verdicts,
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function timedSync(stage, costMeasurements, execute) {
|
|
553
|
+
const startedAt = performance.now();
|
|
554
|
+
const value = execute();
|
|
555
|
+
costMeasurements.push({ stage, state: 'measured', elapsed_ms: roundedMilliseconds(startedAt) });
|
|
556
|
+
return value;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
function compiledRecord({ condition, runId, bundle, costMeasurements }) {
|
|
560
|
+
const compiled = timedSync(`compile.${condition}.${runId}`, costMeasurements, () => (
|
|
561
|
+
compileSchedulabilityGraphV2(bundle.graph)
|
|
562
|
+
));
|
|
563
|
+
if (compiled.outcome !== 'compiled') throw new TypeError(`${condition} did not compile`);
|
|
564
|
+
const verdict = verdictFor(bundle, compiled);
|
|
565
|
+
const verification = timedSync(`verify.${condition}.${runId}`, costMeasurements, () => (
|
|
566
|
+
verifySchedulabilityPlanV2(bundle.graph, compiled.plan)
|
|
567
|
+
));
|
|
568
|
+
if (verification.outcome !== 'verified') throw new TypeError(`${condition} minimum is unverified`);
|
|
569
|
+
const stable = { bundle, verdict, plan: compiled.plan, verification };
|
|
570
|
+
return {
|
|
571
|
+
schema: 'lattice.rc2.compiled_condition.v1',
|
|
572
|
+
condition,
|
|
573
|
+
run_id: runId,
|
|
574
|
+
outcome: 'compiled',
|
|
575
|
+
...stable,
|
|
576
|
+
artifact_digest: digestArtifact(stable),
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function compilePrimary({ runRecord, inputs, manualEvidence, planInput, condition, costMeasurements }) {
|
|
581
|
+
const bundle = timedSync(`front-end.${condition}.${runRecord.run_id}`, costMeasurements, () => (
|
|
582
|
+
compileDeliveryPolicyBoundaryBundleV2({
|
|
583
|
+
planInput,
|
|
584
|
+
candidateSpec: inputs.candidateSpec,
|
|
585
|
+
manualEvidence,
|
|
586
|
+
querySet: inputs.querySet,
|
|
587
|
+
sourceSnapshot: runRecord.measurement.snapshot,
|
|
588
|
+
codegraphEvidence: runRecord.evidence.portable,
|
|
589
|
+
})
|
|
590
|
+
));
|
|
591
|
+
return compiledRecord({ condition, runId: runRecord.run_id, bundle, costMeasurements });
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
function compileUnknown({ runRecord, inputs, costMeasurements }) {
|
|
595
|
+
const condition = 'primary-treatment-third-only-unknown';
|
|
596
|
+
const bundle = timedSync(`front-end.${condition}.${runRecord.run_id}`, costMeasurements, () => (
|
|
597
|
+
compileDeliveryPolicyBoundaryBundleV2({
|
|
598
|
+
planInput: inputs.planInput,
|
|
599
|
+
candidateSpec: inputs.candidateSpec,
|
|
600
|
+
manualEvidence: inputs.unknownManualEvidence,
|
|
601
|
+
querySet: inputs.querySet,
|
|
602
|
+
sourceSnapshot: runRecord.measurement.snapshot,
|
|
603
|
+
codegraphEvidence: runRecord.evidence.portable,
|
|
604
|
+
})
|
|
605
|
+
));
|
|
606
|
+
const outcome = timedSync(`compile.${condition}.${runRecord.run_id}`, costMeasurements, () => (
|
|
607
|
+
compileSchedulabilityGraphV2(bundle.graph)
|
|
608
|
+
));
|
|
609
|
+
const verification = timedSync(`verify.${condition}.${runRecord.run_id}`, costMeasurements, () => (
|
|
610
|
+
verifySchedulabilityPlanV2(bundle.graph, {
|
|
611
|
+
schema_version: 'lattice.plan_graph.v2',
|
|
612
|
+
waves: [],
|
|
613
|
+
minimum_feasible_waves: 0,
|
|
614
|
+
})
|
|
615
|
+
));
|
|
616
|
+
if (outcome.outcome !== 'unknown' || verification.outcome !== 'unknown') {
|
|
617
|
+
throw new TypeError('third-only unknown became dispatchable');
|
|
618
|
+
}
|
|
619
|
+
return {
|
|
620
|
+
schema: 'lattice.rc2.non_dispatchable_condition.v1',
|
|
621
|
+
condition,
|
|
622
|
+
run_id: runRecord.run_id,
|
|
623
|
+
bundle,
|
|
624
|
+
outcome,
|
|
625
|
+
verification,
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function compileTransfer({ runRecord, inputs, manualEvidence, label, costMeasurements }) {
|
|
630
|
+
const condition = `rc1-transfer-${runRecord.condition}-${label}`;
|
|
631
|
+
const transferred = timedSync(`front-end.${condition}.${runRecord.run_id}`, costMeasurements, () => (
|
|
632
|
+
compileRc1TransferBundleV2({
|
|
633
|
+
planInput: inputs.planInput,
|
|
634
|
+
candidateSpec: inputs.candidateSpec,
|
|
635
|
+
manualEvidence,
|
|
636
|
+
querySet: inputs.querySet,
|
|
637
|
+
boundaryManifest: runRecord.legacy_boundary_manifests[label],
|
|
638
|
+
})
|
|
639
|
+
));
|
|
640
|
+
const verification = timedSync(`verify.${condition}.${runRecord.run_id}`, costMeasurements, () => (
|
|
641
|
+
verifySchedulabilityPlanV2(transferred.bundle.graph, transferred.plan)
|
|
642
|
+
));
|
|
643
|
+
if (verification.outcome !== 'verified') throw new TypeError(`${condition} minimum is unverified`);
|
|
644
|
+
const stable = {
|
|
645
|
+
bundle: transferred.bundle,
|
|
646
|
+
verdict: transferred.verdict,
|
|
647
|
+
plan: transferred.plan,
|
|
648
|
+
verification,
|
|
649
|
+
};
|
|
650
|
+
return {
|
|
651
|
+
schema: 'lattice.rc2.compiled_condition.v1',
|
|
652
|
+
condition,
|
|
653
|
+
run_id: runRecord.run_id,
|
|
654
|
+
outcome: 'compiled',
|
|
655
|
+
...stable,
|
|
656
|
+
artifact_digest: digestArtifact(stable),
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
function compileAllConditions({ runs, inputs, costMeasurements }) {
|
|
661
|
+
const primaryControl = runs.primary.control.map((runRecord) => compilePrimary({
|
|
662
|
+
runRecord,
|
|
663
|
+
inputs: inputs.primary,
|
|
664
|
+
manualEvidence: inputs.primary.normalManualEvidence,
|
|
665
|
+
planInput: inputs.primary.planInput,
|
|
666
|
+
condition: 'primary-control-normal',
|
|
667
|
+
costMeasurements,
|
|
668
|
+
}));
|
|
669
|
+
const primaryTreatment = runs.primary.treatment.map((runRecord) => compilePrimary({
|
|
670
|
+
runRecord,
|
|
671
|
+
inputs: inputs.primary,
|
|
672
|
+
manualEvidence: inputs.primary.normalManualEvidence,
|
|
673
|
+
planInput: inputs.primary.planInput,
|
|
674
|
+
condition: 'primary-treatment-normal',
|
|
675
|
+
costMeasurements,
|
|
676
|
+
}));
|
|
677
|
+
if (new Set(primaryControl.map(({ artifact_digest: digest }) => digest)).size !== 1
|
|
678
|
+
|| new Set(primaryTreatment.map(({ artifact_digest: digest }) => digest)).size !== 1) {
|
|
679
|
+
throw new TypeError('primary repeated compilation is not structurally reproducible');
|
|
680
|
+
}
|
|
681
|
+
const treatmentRun = runs.primary.treatment[0];
|
|
682
|
+
const capacityPlan = structuredClone(inputs.primary.planInput);
|
|
683
|
+
capacityPlan.capacity.writers = 2;
|
|
684
|
+
const partialState = compilePrimary({
|
|
685
|
+
runRecord: treatmentRun,
|
|
686
|
+
inputs: inputs.primary,
|
|
687
|
+
manualEvidence: inputs.primary.partialManualEvidence,
|
|
688
|
+
planInput: inputs.primary.planInput,
|
|
689
|
+
condition: 'primary-treatment-partial-state',
|
|
690
|
+
costMeasurements,
|
|
691
|
+
});
|
|
692
|
+
const capacity2 = compilePrimary({
|
|
693
|
+
runRecord: treatmentRun,
|
|
694
|
+
inputs: inputs.primary,
|
|
695
|
+
manualEvidence: inputs.primary.normalManualEvidence,
|
|
696
|
+
planInput: capacityPlan,
|
|
697
|
+
condition: 'primary-treatment-capacity-2',
|
|
698
|
+
costMeasurements,
|
|
699
|
+
});
|
|
700
|
+
const unknown = compileUnknown({ runRecord: treatmentRun, inputs: inputs.primary, costMeasurements });
|
|
701
|
+
const transferControl = runs.rc1_transfer.control[0];
|
|
702
|
+
const transferTreatment = runs.rc1_transfer.treatment[0];
|
|
703
|
+
return {
|
|
704
|
+
primary: {
|
|
705
|
+
control: primaryControl,
|
|
706
|
+
treatment: primaryTreatment,
|
|
707
|
+
partial_state: partialState,
|
|
708
|
+
capacity_2: capacity2,
|
|
709
|
+
third_only_unknown: unknown,
|
|
710
|
+
},
|
|
711
|
+
rc1_transfer: {
|
|
712
|
+
control: {
|
|
713
|
+
normal: compileTransfer({
|
|
714
|
+
runRecord: transferControl,
|
|
715
|
+
inputs: inputs.rc1,
|
|
716
|
+
manualEvidence: inputs.rc1.normalManualEvidence,
|
|
717
|
+
label: 'normal',
|
|
718
|
+
costMeasurements,
|
|
719
|
+
}),
|
|
720
|
+
negative: compileTransfer({
|
|
721
|
+
runRecord: transferControl,
|
|
722
|
+
inputs: inputs.rc1,
|
|
723
|
+
manualEvidence: inputs.rc1.negativeManualEvidence,
|
|
724
|
+
label: 'negative',
|
|
725
|
+
costMeasurements,
|
|
726
|
+
}),
|
|
727
|
+
},
|
|
728
|
+
treatment: {
|
|
729
|
+
normal: compileTransfer({
|
|
730
|
+
runRecord: transferTreatment,
|
|
731
|
+
inputs: inputs.rc1,
|
|
732
|
+
manualEvidence: inputs.rc1.normalManualEvidence,
|
|
733
|
+
label: 'normal',
|
|
734
|
+
costMeasurements,
|
|
735
|
+
}),
|
|
736
|
+
negative: compileTransfer({
|
|
737
|
+
runRecord: transferTreatment,
|
|
738
|
+
inputs: inputs.rc1,
|
|
739
|
+
manualEvidence: inputs.rc1.negativeManualEvidence,
|
|
740
|
+
label: 'negative',
|
|
741
|
+
costMeasurements,
|
|
742
|
+
}),
|
|
743
|
+
},
|
|
744
|
+
},
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
function compiledPayloads(compiled) {
|
|
749
|
+
return new Map([
|
|
750
|
+
['compiled/primary-control-1-normal.json', jsonBytes(compiled.primary.control[0])],
|
|
751
|
+
['compiled/primary-control-2-normal.json', jsonBytes(compiled.primary.control[1])],
|
|
752
|
+
['compiled/primary-treatment-1-normal.json', jsonBytes(compiled.primary.treatment[0])],
|
|
753
|
+
['compiled/primary-treatment-2-normal.json', jsonBytes(compiled.primary.treatment[1])],
|
|
754
|
+
['compiled/primary-treatment-partial-state.json', jsonBytes(compiled.primary.partial_state)],
|
|
755
|
+
['compiled/primary-treatment-capacity-2.json', jsonBytes(compiled.primary.capacity_2)],
|
|
756
|
+
['compiled/primary-treatment-third-only-unknown.json', jsonBytes(compiled.primary.third_only_unknown)],
|
|
757
|
+
['compiled/rc1-transfer-control-normal.json', jsonBytes(compiled.rc1_transfer.control.normal)],
|
|
758
|
+
['compiled/rc1-transfer-control-negative.json', jsonBytes(compiled.rc1_transfer.control.negative)],
|
|
759
|
+
['compiled/rc1-transfer-treatment-normal.json', jsonBytes(compiled.rc1_transfer.treatment.normal)],
|
|
760
|
+
['compiled/rc1-transfer-treatment-negative.json', jsonBytes(compiled.rc1_transfer.treatment.negative)],
|
|
761
|
+
]);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function inputPayloads(inputs) {
|
|
765
|
+
const result = new Map();
|
|
766
|
+
for (const [key, relativePath] of Object.entries(PRIMARY_ARTIFACT_INPUTS)) {
|
|
767
|
+
result.set(relativePath, jsonBytes(inputs.primary[key]));
|
|
768
|
+
}
|
|
769
|
+
for (const [key, relativePath] of Object.entries(RC1_ARTIFACT_INPUTS)) {
|
|
770
|
+
result.set(relativePath, jsonBytes(inputs.rc1[key]));
|
|
771
|
+
}
|
|
772
|
+
return result;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
function transformPayloads(transform) {
|
|
776
|
+
return new Map([
|
|
777
|
+
['transform/accepted-artifact.json', jsonBytes(transform.accepted.artifact)],
|
|
778
|
+
['transform/accepted-receipt.json', jsonBytes(transform.accepted.receipt)],
|
|
779
|
+
['transform/behavior-evidence.json', jsonBytes(transform.accepted.behavior_evidence)],
|
|
780
|
+
['transform/mutation-evidence.json', jsonBytes(transform.accepted.mutation_evidence)],
|
|
781
|
+
['transform/rejected-incomplete-artifact.json', jsonBytes(transform.rejected.incomplete.artifact)],
|
|
782
|
+
['transform/rejected-incomplete-receipt.json', jsonBytes(transform.rejected.incomplete.receipt)],
|
|
783
|
+
['transform/rejected-scope-artifact.json', jsonBytes(transform.rejected.scope.artifact)],
|
|
784
|
+
['transform/rejected-scope-receipt.json', jsonBytes(transform.rejected.scope.receipt)],
|
|
785
|
+
['transform/seam.patch', Buffer.from(transform.accepted.patch)],
|
|
786
|
+
]);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
function storedEvidence(evidence) {
|
|
790
|
+
const raw = evidence?.raw;
|
|
791
|
+
if (!exactRecord(raw, [
|
|
792
|
+
'schema',
|
|
793
|
+
'media_type',
|
|
794
|
+
'encoding',
|
|
795
|
+
'canonical_bytes',
|
|
796
|
+
'payload_digest',
|
|
797
|
+
'payload_base64',
|
|
798
|
+
])
|
|
799
|
+
|| raw.schema !== 'lattice.codegraph_raw_opaque_receipt.v1'
|
|
800
|
+
|| raw.encoding !== 'canonical-json-base64'
|
|
801
|
+
|| typeof raw.payload_base64 !== 'string') {
|
|
802
|
+
throw new TypeError('run raw evidence receipt is invalid');
|
|
803
|
+
}
|
|
804
|
+
const payload = Buffer.from(raw.payload_base64, 'base64');
|
|
805
|
+
if (payload.toString('base64') !== raw.payload_base64
|
|
806
|
+
|| payload.byteLength !== raw.canonical_bytes
|
|
807
|
+
|| sha256(payload) !== raw.payload_digest) {
|
|
808
|
+
throw new TypeError('run raw evidence payload binding is invalid');
|
|
809
|
+
}
|
|
810
|
+
const payloadBase64Chunks = [];
|
|
811
|
+
for (let offset = 0; offset < raw.payload_base64.length; offset += RAW_EVIDENCE_CHUNK_BYTES) {
|
|
812
|
+
payloadBase64Chunks.push(raw.payload_base64.slice(
|
|
813
|
+
offset,
|
|
814
|
+
offset + RAW_EVIDENCE_CHUNK_BYTES,
|
|
815
|
+
));
|
|
816
|
+
}
|
|
817
|
+
if (payloadBase64Chunks.length === 0
|
|
818
|
+
|| payloadBase64Chunks.slice(0, -1).some((chunk) => (
|
|
819
|
+
Buffer.byteLength(chunk, 'utf8') !== RAW_EVIDENCE_CHUNK_BYTES
|
|
820
|
+
))
|
|
821
|
+
|| Buffer.byteLength(payloadBase64Chunks.at(-1), 'utf8') > RAW_EVIDENCE_CHUNK_BYTES) {
|
|
822
|
+
throw new TypeError('run raw evidence chunks are invalid');
|
|
823
|
+
}
|
|
824
|
+
return {
|
|
825
|
+
...structuredClone(evidence),
|
|
826
|
+
raw: {
|
|
827
|
+
schema: 'lattice.rc2.chunked_codegraph_raw_receipt.v1',
|
|
828
|
+
source_schema: raw.schema,
|
|
829
|
+
media_type: raw.media_type,
|
|
830
|
+
source_encoding: raw.encoding,
|
|
831
|
+
storage_encoding: 'ordered-base64-chunks',
|
|
832
|
+
canonical_bytes: raw.canonical_bytes,
|
|
833
|
+
payload_digest: raw.payload_digest,
|
|
834
|
+
payload_base64_chunks: payloadBase64Chunks,
|
|
835
|
+
},
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
function storedRunRecord(runRecord) {
|
|
840
|
+
return {
|
|
841
|
+
...structuredClone(runRecord),
|
|
842
|
+
evidence: storedEvidence(runRecord.evidence),
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
function runPayloads(runs) {
|
|
847
|
+
const records = [
|
|
848
|
+
...runs.primary.control,
|
|
849
|
+
...runs.primary.treatment,
|
|
850
|
+
...runs.rc1_transfer.control,
|
|
851
|
+
...runs.rc1_transfer.treatment,
|
|
852
|
+
];
|
|
853
|
+
return new Map(records.map((runRecord) => [
|
|
854
|
+
`evidence/${runRecord.run_id}.json`,
|
|
855
|
+
jsonBytes(storedRunRecord(runRecord)),
|
|
856
|
+
]));
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
function mergePayloads(...maps) {
|
|
860
|
+
const result = new Map();
|
|
861
|
+
for (const map of maps) {
|
|
862
|
+
for (const [relativePath, bytes] of map) {
|
|
863
|
+
if (result.has(relativePath)) throw new TypeError(`duplicate artifact payload: ${relativePath}`);
|
|
864
|
+
result.set(relativePath, Buffer.from(bytes));
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return result;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
function predecessorDescriptors(payloads) {
|
|
871
|
+
const descriptors = [];
|
|
872
|
+
const add = (kind, ref) => descriptors.push({ kind, ref, digest: sha256(payloads.get(ref)) });
|
|
873
|
+
for (const ref of Object.keys(PREDECESSOR_FILES).sort()) {
|
|
874
|
+
add(ref === 'predecessors/rc1-v6-plan.md' ? 'rc1_v6_phase_archive' : 'immutable_predecessor', ref);
|
|
875
|
+
}
|
|
876
|
+
add('accepted_transform', 'transform/accepted-artifact.json');
|
|
877
|
+
add('behavior_envelope', 'transform/behavior-evidence.json');
|
|
878
|
+
add('mutation_evidence', 'transform/mutation-evidence.json');
|
|
879
|
+
for (const runId of RUN_IDS) add('evidence_bundle', `evidence/${runId}.json`);
|
|
880
|
+
for (const ref of Object.values(PRIMARY_ARTIFACT_INPUTS).sort()) add('fixed_input', ref);
|
|
881
|
+
add('execution_identity', 'identity.json');
|
|
882
|
+
add('compiler_identity', 'identity/schedulability-compiler-v2.mjs');
|
|
883
|
+
add('verifier_identity', 'identity/schedulability-verifier-v2.mjs');
|
|
884
|
+
add('codegraph_project_config', CODEGRAPH_CONFIG_ARTIFACT_PATH);
|
|
885
|
+
return descriptors;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
function buildVersionBarrier({ inputs, compiled, predecessors, predecessorPlan }) {
|
|
889
|
+
const treatment = compiled.primary.treatment[0];
|
|
890
|
+
const affectedTodos = inputs.primary.planInput.todos.map(({ id }) => id);
|
|
891
|
+
const newPlanVersion = {
|
|
892
|
+
schema: 'lattice.rc2.plan_version.v1',
|
|
893
|
+
version: 'rc2-delivery-policy-v5',
|
|
894
|
+
predecessor_version: predecessorPlan.version,
|
|
895
|
+
plan: treatment.plan,
|
|
896
|
+
plan_digest: digestArtifact(treatment.plan),
|
|
897
|
+
bundle_digest: digestArtifact(treatment.bundle),
|
|
898
|
+
verdict_digest: digestArtifact(treatment.verdict),
|
|
899
|
+
affected_todos: affectedTodos,
|
|
900
|
+
causal_predecessors: predecessors,
|
|
901
|
+
};
|
|
902
|
+
const planDiff = {
|
|
903
|
+
schema: 'lattice.rc2.plan_diff.v1',
|
|
904
|
+
old_plan: {
|
|
905
|
+
version: predecessorPlan.version,
|
|
906
|
+
digest: digestArtifact(predecessorPlan),
|
|
907
|
+
},
|
|
908
|
+
new_plan: {
|
|
909
|
+
version: newPlanVersion.version,
|
|
910
|
+
digest: digestArtifact(newPlanVersion),
|
|
911
|
+
},
|
|
912
|
+
causal_predecessors: predecessors,
|
|
913
|
+
affected_todos: affectedTodos,
|
|
914
|
+
invalidated_contexts: [
|
|
915
|
+
{ kind: 'old_plan', ref: predecessorPlan.version,
|
|
916
|
+
reason: 'the v4 artifact semantics cannot receive v5 bindings by append' },
|
|
917
|
+
{ kind: 'agent_context', ref: `${predecessorPlan.version}-agent-context`,
|
|
918
|
+
reason: 'v4 agent context does not bind the version witness verifier identity' },
|
|
919
|
+
{ kind: 'partial_patch', ref: `${predecessorPlan.version}-partial-patch`,
|
|
920
|
+
reason: 'patches compiled before version witness binding cannot cross the barrier' },
|
|
921
|
+
{ kind: 'interface_assumption', ref: `${predecessorPlan.version}-interface-assumption`,
|
|
922
|
+
reason: 'v4 interface evidence does not bind the active witness epoch' },
|
|
923
|
+
{ kind: 'boundary_evidence', ref: `${predecessorPlan.version}-boundary-evidence`,
|
|
924
|
+
reason: 'only fresh version-bound treatment evidence is valid for plan v5' },
|
|
925
|
+
],
|
|
926
|
+
};
|
|
927
|
+
return { newPlanVersion, planDiff };
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function distinctConflictPairs(record) {
|
|
931
|
+
return new Set(record.bundle.graph.conflicts.map(({ todo_ids: todoIds }) => (
|
|
932
|
+
[...todoIds].sort().join('\u0000')
|
|
933
|
+
))).size;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
function conditionMetrics(record) {
|
|
937
|
+
return {
|
|
938
|
+
conflict_records: record.bundle.graph.conflicts.length,
|
|
939
|
+
distinct_conflict_pairs: distinctConflictPairs(record),
|
|
940
|
+
minimum_feasible_waves: record.plan.minimum_feasible_waves,
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
function buildComparison({ baseSha, identity, transform, compiled, newPlanVersion, planDiff }) {
|
|
945
|
+
return {
|
|
946
|
+
schema: 'lattice.rc2.control_treatment_comparison.v1',
|
|
947
|
+
base_sha: baseSha,
|
|
948
|
+
identity_digest: digestArtifact(identity),
|
|
949
|
+
independent_variable: {
|
|
950
|
+
kind: 'accepted_registry_shard_patch',
|
|
951
|
+
transform_artifact_digest: digestArtifact(transform.accepted.artifact),
|
|
952
|
+
patch_digest: transform.accepted.artifact.patch.digest,
|
|
953
|
+
},
|
|
954
|
+
condition_artifact_digests: {
|
|
955
|
+
primary_control: compiled.primary.control.map(({ artifact_digest: digest }) => digest),
|
|
956
|
+
primary_treatment: compiled.primary.treatment.map(({ artifact_digest: digest }) => digest),
|
|
957
|
+
primary_partial_state: compiled.primary.partial_state.artifact_digest,
|
|
958
|
+
primary_capacity_2: compiled.primary.capacity_2.artifact_digest,
|
|
959
|
+
primary_unknown: digestArtifact(compiled.primary.third_only_unknown),
|
|
960
|
+
rc1_transfer_control_normal: compiled.rc1_transfer.control.normal.artifact_digest,
|
|
961
|
+
rc1_transfer_control_negative: compiled.rc1_transfer.control.negative.artifact_digest,
|
|
962
|
+
rc1_transfer_treatment_normal: compiled.rc1_transfer.treatment.normal.artifact_digest,
|
|
963
|
+
rc1_transfer_treatment_negative: compiled.rc1_transfer.treatment.negative.artifact_digest,
|
|
964
|
+
},
|
|
965
|
+
metrics: {
|
|
966
|
+
primary_control: conditionMetrics(compiled.primary.control[0]),
|
|
967
|
+
primary_treatment: conditionMetrics(compiled.primary.treatment[0]),
|
|
968
|
+
primary_partial_state: conditionMetrics(compiled.primary.partial_state),
|
|
969
|
+
primary_capacity_2: conditionMetrics(compiled.primary.capacity_2),
|
|
970
|
+
rc1_transfer_control_normal: conditionMetrics(compiled.rc1_transfer.control.normal),
|
|
971
|
+
rc1_transfer_control_negative: conditionMetrics(compiled.rc1_transfer.control.negative),
|
|
972
|
+
rc1_transfer_treatment_normal: conditionMetrics(compiled.rc1_transfer.treatment.normal),
|
|
973
|
+
rc1_transfer_treatment_negative: conditionMetrics(compiled.rc1_transfer.treatment.negative),
|
|
974
|
+
},
|
|
975
|
+
version_barrier: {
|
|
976
|
+
new_plan_version_digest: digestArtifact(newPlanVersion),
|
|
977
|
+
plan_diff_digest: digestArtifact(planDiff),
|
|
978
|
+
causal_predecessors_digest: digestArtifact(planDiff.causal_predecessors),
|
|
979
|
+
},
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
function evaluateHypothesis(comparison, compiled, transform) {
|
|
984
|
+
const checks = [
|
|
985
|
+
{ id: 'accepted_transform_only', passed: transform.accepted.status === 'accepted' },
|
|
986
|
+
{
|
|
987
|
+
id: 'primary_repeat_reproducible',
|
|
988
|
+
passed: new Set(compiled.primary.control.map(({ artifact_digest: digest }) => digest)).size === 1
|
|
989
|
+
&& new Set(compiled.primary.treatment.map(({ artifact_digest: digest }) => digest)).size === 1,
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
id: 'primary_conflicts_removed',
|
|
993
|
+
passed: comparison.metrics.primary_control.conflict_records === 12
|
|
994
|
+
&& comparison.metrics.primary_control.distinct_conflict_pairs === 3
|
|
995
|
+
&& comparison.metrics.primary_treatment.conflict_records === 0,
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
id: 'primary_waves_reduced',
|
|
999
|
+
passed: comparison.metrics.primary_control.minimum_feasible_waves === 3
|
|
1000
|
+
&& comparison.metrics.primary_treatment.minimum_feasible_waves === 1,
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
id: 'partial_state_preserved',
|
|
1004
|
+
passed: comparison.metrics.primary_partial_state.conflict_records === 1
|
|
1005
|
+
&& comparison.metrics.primary_partial_state.minimum_feasible_waves === 2,
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
id: 'capacity_control_preserved',
|
|
1009
|
+
passed: comparison.metrics.primary_capacity_2.conflict_records === 0
|
|
1010
|
+
&& comparison.metrics.primary_capacity_2.minimum_feasible_waves === 2,
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
id: 'third_only_unknown_closed',
|
|
1014
|
+
passed: compiled.primary.third_only_unknown.outcome.outcome === 'unknown'
|
|
1015
|
+
&& compiled.primary.third_only_unknown.verification.outcome === 'unknown',
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
id: 'rc1_transfer_isomorphic',
|
|
1019
|
+
passed: comparison.metrics.rc1_transfer_control_normal.conflict_records === 3
|
|
1020
|
+
&& comparison.metrics.rc1_transfer_control_normal.minimum_feasible_waves === 2
|
|
1021
|
+
&& comparison.metrics.rc1_transfer_treatment_normal.conflict_records === 0
|
|
1022
|
+
&& comparison.metrics.rc1_transfer_treatment_normal.minimum_feasible_waves === 1
|
|
1023
|
+
&& comparison.metrics.rc1_transfer_control_negative.minimum_feasible_waves === 2
|
|
1024
|
+
&& comparison.metrics.rc1_transfer_treatment_negative.minimum_feasible_waves === 2,
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
id: 'all_minimum_verified',
|
|
1028
|
+
passed: [
|
|
1029
|
+
...compiled.primary.control,
|
|
1030
|
+
...compiled.primary.treatment,
|
|
1031
|
+
compiled.primary.partial_state,
|
|
1032
|
+
compiled.primary.capacity_2,
|
|
1033
|
+
compiled.rc1_transfer.control.normal,
|
|
1034
|
+
compiled.rc1_transfer.control.negative,
|
|
1035
|
+
compiled.rc1_transfer.treatment.normal,
|
|
1036
|
+
compiled.rc1_transfer.treatment.negative,
|
|
1037
|
+
].every(({ verification }) => verification.outcome === 'verified'),
|
|
1038
|
+
},
|
|
1039
|
+
];
|
|
1040
|
+
return {
|
|
1041
|
+
schema: 'lattice.rc2.hypothesis_evaluation.v1',
|
|
1042
|
+
checks,
|
|
1043
|
+
supported: checks.every(({ passed }) => passed),
|
|
1044
|
+
failed_conditions: checks.filter(({ passed }) => !passed).map(({ id }) => id),
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
function patchReviewLines(patch) {
|
|
1049
|
+
return patch.toString('utf8').split('\n').filter((line) => (
|
|
1050
|
+
(line.startsWith('+') && !line.startsWith('+++'))
|
|
1051
|
+
|| (line.startsWith('-') && !line.startsWith('---'))
|
|
1052
|
+
)).length;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
function buildCost(costMeasurements, transform) {
|
|
1056
|
+
const elapsed = Math.round(costMeasurements
|
|
1057
|
+
.reduce((sum, measurement) => sum + measurement.elapsed_ms, 0) * 1_000) / 1_000;
|
|
1058
|
+
return {
|
|
1059
|
+
schema: 'lattice.rc2.stage_cost.v1',
|
|
1060
|
+
measurements: costMeasurements,
|
|
1061
|
+
aggregate: {
|
|
1062
|
+
measured_count: costMeasurements.length,
|
|
1063
|
+
not_measured_count: 0,
|
|
1064
|
+
elapsed_ms: elapsed,
|
|
1065
|
+
},
|
|
1066
|
+
intervention: {
|
|
1067
|
+
patch_bytes: transform.accepted.patch.byteLength,
|
|
1068
|
+
files: transform.accepted.artifact.scope.changed_paths.length,
|
|
1069
|
+
review_lines: patchReviewLines(transform.accepted.patch),
|
|
1070
|
+
},
|
|
1071
|
+
rework: { rejected_attempts: 2, retries: 0, rollbacks: 0 },
|
|
1072
|
+
unverified: [
|
|
1073
|
+
'actual multi-agent wall-clock improvement',
|
|
1074
|
+
'elapsed measurement attestation beyond saved arithmetic binding',
|
|
1075
|
+
'arbitrary-repository seam success rate',
|
|
1076
|
+
],
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
function allCompiledRecords(compiled) {
|
|
1081
|
+
return [
|
|
1082
|
+
...compiled.primary.control,
|
|
1083
|
+
...compiled.primary.treatment,
|
|
1084
|
+
compiled.primary.partial_state,
|
|
1085
|
+
compiled.primary.capacity_2,
|
|
1086
|
+
compiled.primary.third_only_unknown,
|
|
1087
|
+
compiled.rc1_transfer.control.normal,
|
|
1088
|
+
compiled.rc1_transfer.control.negative,
|
|
1089
|
+
compiled.rc1_transfer.treatment.normal,
|
|
1090
|
+
compiled.rc1_transfer.treatment.negative,
|
|
1091
|
+
];
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
function buildExecutionEvidence({
|
|
1095
|
+
baseSha,
|
|
1096
|
+
identity,
|
|
1097
|
+
transform,
|
|
1098
|
+
runs,
|
|
1099
|
+
compiled,
|
|
1100
|
+
newPlanVersion,
|
|
1101
|
+
planDiff,
|
|
1102
|
+
comparison,
|
|
1103
|
+
hypothesis,
|
|
1104
|
+
cost,
|
|
1105
|
+
}) {
|
|
1106
|
+
const runRecords = [
|
|
1107
|
+
...runs.primary.control,
|
|
1108
|
+
...runs.primary.treatment,
|
|
1109
|
+
...runs.rc1_transfer.control,
|
|
1110
|
+
...runs.rc1_transfer.treatment,
|
|
1111
|
+
];
|
|
1112
|
+
return {
|
|
1113
|
+
schema: 'lattice.rc2.campaign_execution_evidence.v1',
|
|
1114
|
+
base_sha: baseSha,
|
|
1115
|
+
identity_digest: digestArtifact(identity),
|
|
1116
|
+
transform_artifact_digest: digestArtifact(transform.accepted.artifact),
|
|
1117
|
+
run_digests: runRecords.map((runRecord) => digestArtifact(storedRunRecord(runRecord))),
|
|
1118
|
+
compiled_condition_digests: allCompiledRecords(compiled).map(digestArtifact),
|
|
1119
|
+
new_plan_version_digest: digestArtifact(newPlanVersion),
|
|
1120
|
+
plan_diff_digest: digestArtifact(planDiff),
|
|
1121
|
+
comparison_digest: digestArtifact(comparison),
|
|
1122
|
+
hypothesis_evaluation_digest: digestArtifact(hypothesis),
|
|
1123
|
+
cost_digest: digestArtifact(cost),
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
async function timedAsync(stage, costMeasurements, execute) {
|
|
1128
|
+
const startedAt = performance.now();
|
|
1129
|
+
const value = await execute();
|
|
1130
|
+
costMeasurements.push({ stage, state: 'measured', elapsed_ms: roundedMilliseconds(startedAt) });
|
|
1131
|
+
return value;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
async function runTransforms({ root, baseSha, candidateSpec, costMeasurements }) {
|
|
1135
|
+
const accepted = await timedAsync('transform.accepted', costMeasurements, () => (
|
|
1136
|
+
runRc2DeliveryPolicySeamTransform({ repoRoot: root, baseRef: baseSha, candidateSpec })
|
|
1137
|
+
));
|
|
1138
|
+
if (accepted.status !== 'accepted' || !Buffer.isBuffer(accepted.patch)) {
|
|
1139
|
+
throw new TypeError('default RC2 transform was not accepted');
|
|
1140
|
+
}
|
|
1141
|
+
const incomplete = await timedAsync('transform.rejected.incomplete', costMeasurements, () => (
|
|
1142
|
+
runRc2DeliveryPolicySeamTransform({
|
|
1143
|
+
repoRoot: root,
|
|
1144
|
+
baseRef: baseSha,
|
|
1145
|
+
candidateSpec,
|
|
1146
|
+
transform: async ({ worktreePath }) => {
|
|
1147
|
+
await applyRc2DeliveryPolicyTransform({ worktreePath });
|
|
1148
|
+
await rm(path.join(worktreePath, 'test/rc2-delivery-policy-sms.test.mjs'));
|
|
1149
|
+
},
|
|
1150
|
+
})
|
|
1151
|
+
));
|
|
1152
|
+
const scope = await timedAsync('transform.rejected.scope', costMeasurements, () => (
|
|
1153
|
+
runRc2DeliveryPolicySeamTransform({
|
|
1154
|
+
repoRoot: root,
|
|
1155
|
+
baseRef: baseSha,
|
|
1156
|
+
candidateSpec,
|
|
1157
|
+
transform: async ({ worktreePath }) => {
|
|
1158
|
+
await applyRc2DeliveryPolicyTransform({ worktreePath });
|
|
1159
|
+
await writeFile(path.join(worktreePath, 'rc2-scope-violation.tmp'), 'forbidden\n');
|
|
1160
|
+
},
|
|
1161
|
+
})
|
|
1162
|
+
));
|
|
1163
|
+
if (incomplete.status !== 'rejected'
|
|
1164
|
+
|| incomplete.artifact.rejection.kind !== 'incomplete_transform'
|
|
1165
|
+
|| scope.status !== 'rejected'
|
|
1166
|
+
|| scope.artifact.rejection.kind !== 'scope_violation') {
|
|
1167
|
+
throw new TypeError('RC2 rejected transform controls did not preserve typed outcomes');
|
|
1168
|
+
}
|
|
1169
|
+
return { accepted, rejected: { incomplete, scope } };
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/** accepted seamを独立変数にfresh sensor→v2 compile→new planまで実行する。 */
|
|
1173
|
+
export async function runRc2Campaign(options = {}) {
|
|
1174
|
+
if (!exactRecord(options, ['repoRoot', 'baseRef', 'artifactVersion'])
|
|
1175
|
+
|| options.artifactVersion !== ARTIFACT_VERSION) {
|
|
1176
|
+
throw new TypeError('runRc2Campaign options must select exact artifactVersion v4');
|
|
1177
|
+
}
|
|
1178
|
+
const { root, baseSha } = await resolveRepository(options.repoRoot, options.baseRef);
|
|
1179
|
+
const [inputs, predecessors, identityBefore] = await Promise.all([
|
|
1180
|
+
loadInputs(root),
|
|
1181
|
+
loadPredecessors(root),
|
|
1182
|
+
captureExecutionIdentity(root),
|
|
1183
|
+
]);
|
|
1184
|
+
const predecessorPlan = loadV3PlanPredecessor(predecessors);
|
|
1185
|
+
const costMeasurements = [];
|
|
1186
|
+
const transform = await runTransforms({
|
|
1187
|
+
root,
|
|
1188
|
+
baseSha,
|
|
1189
|
+
candidateSpec: inputs.primary.candidateSpec,
|
|
1190
|
+
costMeasurements,
|
|
1191
|
+
});
|
|
1192
|
+
const primaryPaths = surfacePaths(inputs.primary.candidateSpec);
|
|
1193
|
+
const rc1Paths = surfacePaths(inputs.rc1.candidateSpec);
|
|
1194
|
+
if (primaryPaths.length !== 9 || rc1Paths.length !== 6) {
|
|
1195
|
+
throw new TypeError('campaign fixed surface cardinality is invalid');
|
|
1196
|
+
}
|
|
1197
|
+
const rc1TransformArtifact = JSON.parse(
|
|
1198
|
+
predecessors.get('predecessors/rc1-v6-transform-artifact.json').toString('utf8'),
|
|
1199
|
+
);
|
|
1200
|
+
const rc1Patch = predecessors.get('predecessors/rc1-v6-seam.patch');
|
|
1201
|
+
if (rc1TransformArtifact.patch.digest !== sha256(rc1Patch)) {
|
|
1202
|
+
throw new TypeError('RC1 v6 predecessor patch binding is invalid');
|
|
1203
|
+
}
|
|
1204
|
+
const common = {
|
|
1205
|
+
repoRoot: root,
|
|
1206
|
+
baseSha,
|
|
1207
|
+
codegraphIdentity: identityBefore.snapshot.codegraph_identity,
|
|
1208
|
+
costMeasurements,
|
|
1209
|
+
};
|
|
1210
|
+
const primaryControl = [];
|
|
1211
|
+
const primaryTreatment = [];
|
|
1212
|
+
for (let index = 1; index <= 2; index += 1) {
|
|
1213
|
+
primaryControl.push(await observeFreshIndex({
|
|
1214
|
+
...common,
|
|
1215
|
+
family: 'primary',
|
|
1216
|
+
condition: 'control',
|
|
1217
|
+
runId: `primary-control-${index}`,
|
|
1218
|
+
querySet: inputs.primary.querySet,
|
|
1219
|
+
paths: primaryPaths,
|
|
1220
|
+
patch: null,
|
|
1221
|
+
allowedPaths: [],
|
|
1222
|
+
oracle: null,
|
|
1223
|
+
rc1Inputs: null,
|
|
1224
|
+
}));
|
|
1225
|
+
}
|
|
1226
|
+
for (let index = 1; index <= 2; index += 1) {
|
|
1227
|
+
primaryTreatment.push(await observeFreshIndex({
|
|
1228
|
+
...common,
|
|
1229
|
+
family: 'primary',
|
|
1230
|
+
condition: 'treatment',
|
|
1231
|
+
runId: `primary-treatment-${index}`,
|
|
1232
|
+
querySet: inputs.primary.querySet,
|
|
1233
|
+
paths: primaryPaths,
|
|
1234
|
+
patch: transform.accepted.patch,
|
|
1235
|
+
allowedPaths: [...RC2_DELIVERY_POLICY_TRANSFORM_PATHS],
|
|
1236
|
+
oracle: null,
|
|
1237
|
+
rc1Inputs: null,
|
|
1238
|
+
}));
|
|
1239
|
+
}
|
|
1240
|
+
const transferControl = await observeFreshIndex({
|
|
1241
|
+
...common,
|
|
1242
|
+
family: 'rc1_transfer',
|
|
1243
|
+
condition: 'control',
|
|
1244
|
+
runId: 'rc1-transfer-control-1',
|
|
1245
|
+
querySet: inputs.rc1.querySet,
|
|
1246
|
+
paths: rc1Paths,
|
|
1247
|
+
patch: null,
|
|
1248
|
+
allowedPaths: [],
|
|
1249
|
+
oracle: inputs.rc1.oracle,
|
|
1250
|
+
rc1Inputs: inputs.rc1,
|
|
1251
|
+
});
|
|
1252
|
+
const transferTreatment = await observeFreshIndex({
|
|
1253
|
+
...common,
|
|
1254
|
+
family: 'rc1_transfer',
|
|
1255
|
+
condition: 'treatment',
|
|
1256
|
+
runId: 'rc1-transfer-treatment-1',
|
|
1257
|
+
querySet: inputs.rc1.querySet,
|
|
1258
|
+
paths: rc1Paths,
|
|
1259
|
+
patch: rc1Patch,
|
|
1260
|
+
allowedPaths: [...rc1TransformArtifact.scope.allowed_paths],
|
|
1261
|
+
oracle: inputs.rc1.oracle,
|
|
1262
|
+
rc1Inputs: inputs.rc1,
|
|
1263
|
+
});
|
|
1264
|
+
const runs = {
|
|
1265
|
+
primary: { control: primaryControl, treatment: primaryTreatment },
|
|
1266
|
+
rc1_transfer: { control: [transferControl], treatment: [transferTreatment] },
|
|
1267
|
+
};
|
|
1268
|
+
const compiled = compileAllConditions({ runs, inputs, costMeasurements });
|
|
1269
|
+
|
|
1270
|
+
const identityAfter = await captureExecutionIdentity(root);
|
|
1271
|
+
if (!isDeepStrictEqual(identityBefore.snapshot, identityAfter.snapshot)
|
|
1272
|
+
|| identityBefore.payloads.size !== identityAfter.payloads.size
|
|
1273
|
+
|| [...identityBefore.payloads].some(([relativePath, bytes]) => (
|
|
1274
|
+
!identityAfter.payloads.get(relativePath)?.equals(bytes)
|
|
1275
|
+
))) {
|
|
1276
|
+
throw new TypeError('RC2 execution identity drifted during campaign');
|
|
1277
|
+
}
|
|
1278
|
+
const identity = {
|
|
1279
|
+
schema: 'lattice.rc2.execution_identity.v4',
|
|
1280
|
+
sources: identityBefore.snapshot.sources,
|
|
1281
|
+
codegraph_identity: identityBefore.snapshot.codegraph_identity,
|
|
1282
|
+
codegraph_identity_digest: digestArtifact(identityBefore.snapshot.codegraph_identity),
|
|
1283
|
+
before_digest: identityBefore.digest,
|
|
1284
|
+
after_digest: identityAfter.digest,
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
const preliminaryPayloads = mergePayloads(
|
|
1288
|
+
inputPayloads(inputs),
|
|
1289
|
+
identityBefore.payloads,
|
|
1290
|
+
predecessors,
|
|
1291
|
+
transformPayloads(transform),
|
|
1292
|
+
runPayloads(runs),
|
|
1293
|
+
new Map([['identity.json', jsonBytes(identity)]]),
|
|
1294
|
+
);
|
|
1295
|
+
const causalPredecessors = predecessorDescriptors(preliminaryPayloads);
|
|
1296
|
+
const { newPlanVersion, planDiff } = buildVersionBarrier({
|
|
1297
|
+
inputs,
|
|
1298
|
+
compiled,
|
|
1299
|
+
predecessors: causalPredecessors,
|
|
1300
|
+
predecessorPlan,
|
|
1301
|
+
});
|
|
1302
|
+
const comparison = buildComparison({
|
|
1303
|
+
baseSha,
|
|
1304
|
+
identity,
|
|
1305
|
+
transform,
|
|
1306
|
+
compiled,
|
|
1307
|
+
newPlanVersion,
|
|
1308
|
+
planDiff,
|
|
1309
|
+
});
|
|
1310
|
+
const hypothesisEvaluation = evaluateHypothesis(comparison, compiled, transform);
|
|
1311
|
+
if (!hypothesisEvaluation.supported) {
|
|
1312
|
+
throw new TypeError(
|
|
1313
|
+
`RC2 hypothesis is not supported: ${hypothesisEvaluation.failed_conditions.join(', ')}`,
|
|
1314
|
+
);
|
|
1315
|
+
}
|
|
1316
|
+
const cost = buildCost(costMeasurements, transform);
|
|
1317
|
+
const executionEvidence = buildExecutionEvidence({
|
|
1318
|
+
baseSha,
|
|
1319
|
+
identity,
|
|
1320
|
+
transform,
|
|
1321
|
+
runs,
|
|
1322
|
+
compiled,
|
|
1323
|
+
newPlanVersion,
|
|
1324
|
+
planDiff,
|
|
1325
|
+
comparison,
|
|
1326
|
+
hypothesis: hypothesisEvaluation,
|
|
1327
|
+
cost,
|
|
1328
|
+
});
|
|
1329
|
+
return {
|
|
1330
|
+
schema: 'lattice.rc2.campaign_result.v4',
|
|
1331
|
+
artifact_version: ARTIFACT_VERSION,
|
|
1332
|
+
base_sha: baseSha,
|
|
1333
|
+
fixed_inputs: inputs,
|
|
1334
|
+
identity,
|
|
1335
|
+
identity_payloads: identityBefore.payloads,
|
|
1336
|
+
predecessor_payloads: predecessors,
|
|
1337
|
+
transform,
|
|
1338
|
+
runs,
|
|
1339
|
+
compiled,
|
|
1340
|
+
new_plan_version: newPlanVersion,
|
|
1341
|
+
plan_diff: planDiff,
|
|
1342
|
+
comparison,
|
|
1343
|
+
hypothesis_evaluation: hypothesisEvaluation,
|
|
1344
|
+
cost,
|
|
1345
|
+
execution_evidence: executionEvidence,
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
function artifactFiles(result) {
|
|
1350
|
+
const files = mergePayloads(
|
|
1351
|
+
inputPayloads(result.fixed_inputs),
|
|
1352
|
+
result.identity_payloads,
|
|
1353
|
+
result.predecessor_payloads,
|
|
1354
|
+
transformPayloads(result.transform),
|
|
1355
|
+
runPayloads(result.runs),
|
|
1356
|
+
compiledPayloads(result.compiled),
|
|
1357
|
+
new Map([
|
|
1358
|
+
['identity.json', jsonBytes(result.identity)],
|
|
1359
|
+
['new-plan-version.json', jsonBytes(result.new_plan_version)],
|
|
1360
|
+
['plan-diff.json', jsonBytes(result.plan_diff)],
|
|
1361
|
+
['comparison.json', jsonBytes(result.comparison)],
|
|
1362
|
+
['hypothesis-evaluation.json', jsonBytes(result.hypothesis_evaluation)],
|
|
1363
|
+
['cost.json', jsonBytes(result.cost)],
|
|
1364
|
+
['execution-evidence.json', jsonBytes(result.execution_evidence)],
|
|
1365
|
+
]),
|
|
1366
|
+
);
|
|
1367
|
+
if (!isDeepStrictEqual([...files.keys()].sort(), [...RC2_ARTIFACT_PATHS])) {
|
|
1368
|
+
throw new TypeError('RC2 artifact payload set differs from the exact contract');
|
|
1369
|
+
}
|
|
1370
|
+
return files;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
function artifactMediaType(relativePath) {
|
|
1374
|
+
if (relativePath.endsWith('.json')) return 'application/json';
|
|
1375
|
+
if (relativePath.endsWith('.mjs')) return 'application/javascript';
|
|
1376
|
+
if (relativePath.endsWith('.patch')) return 'text/x-diff';
|
|
1377
|
+
if (relativePath.endsWith('.md')) return 'text/markdown';
|
|
1378
|
+
return 'application/octet-stream';
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
async function syncDirectory(directory) {
|
|
1382
|
+
const handle = await open(directory, 'r');
|
|
1383
|
+
try {
|
|
1384
|
+
await handle.sync();
|
|
1385
|
+
} finally {
|
|
1386
|
+
await handle.close();
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
async function writeDurableFile(target, bytes) {
|
|
1391
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
1392
|
+
const handle = await open(target, 'wx');
|
|
1393
|
+
try {
|
|
1394
|
+
await handle.writeFile(bytes);
|
|
1395
|
+
await handle.sync();
|
|
1396
|
+
} finally {
|
|
1397
|
+
await handle.close();
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
async function syncArtifactDirectories(root, relativePaths) {
|
|
1402
|
+
const directories = new Set([root]);
|
|
1403
|
+
for (const relativePath of relativePaths) {
|
|
1404
|
+
let current = path.dirname(path.join(root, relativePath));
|
|
1405
|
+
while (current.startsWith(root)) {
|
|
1406
|
+
directories.add(current);
|
|
1407
|
+
if (current === root) break;
|
|
1408
|
+
current = path.dirname(current);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
const ordered = [...directories].sort((left, right) => right.length - left.length);
|
|
1412
|
+
for (const directory of ordered) await syncDirectory(directory);
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/** verified exact artifact setを既存rootへ上書きせずatomicに発行する。 */
|
|
1416
|
+
export async function writeRc2CampaignArtifacts(options = {}) {
|
|
1417
|
+
if (!exactRecord(options, ['repoRoot', 'result'])
|
|
1418
|
+
|| typeof options.repoRoot !== 'string'
|
|
1419
|
+
|| options.repoRoot.length === 0
|
|
1420
|
+
|| options.result?.schema !== 'lattice.rc2.campaign_result.v4'
|
|
1421
|
+
|| options.result?.artifact_version !== ARTIFACT_VERSION) {
|
|
1422
|
+
throw new TypeError('writeRc2CampaignArtifacts options are invalid');
|
|
1423
|
+
}
|
|
1424
|
+
const root = await realpath(options.repoRoot);
|
|
1425
|
+
const artifactRoot = path.join(root, ARTIFACT_ROOTS.v4);
|
|
1426
|
+
try {
|
|
1427
|
+
await lstat(artifactRoot);
|
|
1428
|
+
throw new Error('RC2 artifact root already exists; immutable evidence is not overwritten');
|
|
1429
|
+
} catch (error) {
|
|
1430
|
+
if (error?.code !== 'ENOENT') throw error;
|
|
1431
|
+
}
|
|
1432
|
+
const files = artifactFiles(options.result);
|
|
1433
|
+
const manifest = {
|
|
1434
|
+
schema: 'lattice.rc2.artifact_manifest.v4',
|
|
1435
|
+
base_sha: options.result.base_sha,
|
|
1436
|
+
result_digest: digestArtifact(options.result.hypothesis_evaluation),
|
|
1437
|
+
files: [...files].map(([relativePath, bytes]) => ({
|
|
1438
|
+
path: relativePath,
|
|
1439
|
+
media_type: artifactMediaType(relativePath),
|
|
1440
|
+
bytes: bytes.byteLength,
|
|
1441
|
+
sha256: sha256(bytes),
|
|
1442
|
+
})).sort((left, right) => left.path.localeCompare(right.path)),
|
|
1443
|
+
};
|
|
1444
|
+
const payloads = [...files].map(([relativePath, bytes]) => ({ path: relativePath, bytes }));
|
|
1445
|
+
const verification = verifyRc2CampaignArtifactSet({ manifest, payloads });
|
|
1446
|
+
if (!verification.valid) {
|
|
1447
|
+
throw new TypeError(
|
|
1448
|
+
`RC2 artifact set is invalid: ${verification.failed_conditions.join(', ')}`,
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
const parent = path.dirname(artifactRoot);
|
|
1452
|
+
await mkdir(parent, { recursive: true });
|
|
1453
|
+
const temporaryRoot = await mkdtemp(path.join(parent, '.v4-write-'));
|
|
1454
|
+
try {
|
|
1455
|
+
for (const [relativePath, bytes] of files) {
|
|
1456
|
+
await writeDurableFile(path.join(temporaryRoot, relativePath), bytes);
|
|
1457
|
+
}
|
|
1458
|
+
await writeDurableFile(path.join(temporaryRoot, 'artifact-manifest.json'), jsonBytes(manifest));
|
|
1459
|
+
await syncArtifactDirectories(temporaryRoot, [
|
|
1460
|
+
...RC2_ARTIFACT_PATHS,
|
|
1461
|
+
'artifact-manifest.json',
|
|
1462
|
+
]);
|
|
1463
|
+
await rename(temporaryRoot, artifactRoot);
|
|
1464
|
+
await syncDirectory(parent);
|
|
1465
|
+
} catch (error) {
|
|
1466
|
+
await rm(temporaryRoot, { recursive: true, force: true });
|
|
1467
|
+
throw error;
|
|
1468
|
+
}
|
|
1469
|
+
return manifest;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
function artifactPathsForVersion(artifactVersion) {
|
|
1473
|
+
if (artifactVersion === 'v1') return RC2_V1_ARTIFACT_PATHS;
|
|
1474
|
+
if (artifactVersion === 'v2') return RC2_V2_ARTIFACT_PATHS;
|
|
1475
|
+
if (artifactVersion === 'v3') return RC2_V3_ARTIFACT_PATHS;
|
|
1476
|
+
if (artifactVersion === 'v4') return RC2_ARTIFACT_PATHS;
|
|
1477
|
+
return null;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
function invalidDiskReceipt(condition) {
|
|
1481
|
+
return {
|
|
1482
|
+
schema: 'lattice.rc2.artifact_set_verification.v1',
|
|
1483
|
+
valid: false,
|
|
1484
|
+
checks: [{ id: condition, passed: false }],
|
|
1485
|
+
failed_conditions: [condition],
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/** immutable rootを再読し、in-memory resultなしでpure verifierへ渡す。 */
|
|
1490
|
+
export async function verifyRc2CampaignArtifactsOnDisk(options = {}) {
|
|
1491
|
+
if (!exactRecord(options, ['repoRoot', 'artifactVersion'])
|
|
1492
|
+
|| typeof options.repoRoot !== 'string'
|
|
1493
|
+
|| options.repoRoot.length === 0
|
|
1494
|
+
|| artifactPathsForVersion(options.artifactVersion) === null) {
|
|
1495
|
+
throw new TypeError('verifyRc2CampaignArtifactsOnDisk options are invalid');
|
|
1496
|
+
}
|
|
1497
|
+
const artifactRoot = path.join(options.repoRoot, ARTIFACT_ROOTS[options.artifactVersion]);
|
|
1498
|
+
const artifactPaths = artifactPathsForVersion(options.artifactVersion);
|
|
1499
|
+
let manifestBytes;
|
|
1500
|
+
let manifest;
|
|
1501
|
+
try {
|
|
1502
|
+
manifestBytes = await readFile(path.join(artifactRoot, 'artifact-manifest.json'));
|
|
1503
|
+
manifest = JSON.parse(manifestBytes.toString('utf8'));
|
|
1504
|
+
} catch {
|
|
1505
|
+
return invalidDiskReceipt('manifest_canonical');
|
|
1506
|
+
}
|
|
1507
|
+
if (!jsonBytes(manifest).equals(manifestBytes)) {
|
|
1508
|
+
return invalidDiskReceipt('manifest_canonical');
|
|
1509
|
+
}
|
|
1510
|
+
let payloads;
|
|
1511
|
+
try {
|
|
1512
|
+
payloads = await Promise.all(artifactPaths.map(async (relativePath) => ({
|
|
1513
|
+
path: relativePath,
|
|
1514
|
+
bytes: await readFile(path.join(artifactRoot, relativePath)),
|
|
1515
|
+
})));
|
|
1516
|
+
} catch {
|
|
1517
|
+
return invalidDiskReceipt('exact_artifact_set');
|
|
1518
|
+
}
|
|
1519
|
+
return verifyRc2CampaignArtifactSet({ manifest, payloads });
|
|
1520
|
+
}
|