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