@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
package/sensor/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* LatticeSensor
|
|
4
4
|
*
|
|
5
5
|
* A local-first code intelligence system that builds a semantic
|
|
6
6
|
* knowledge graph from any codebase.
|
|
@@ -42,7 +42,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
42
42
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.
|
|
45
|
+
exports.LatticeSensor = exports.MCPServer = exports.LockUnavailableError = exports.FileWatcher = exports.MemoryMonitor = exports.throttle = exports.debounce = exports.processInBatches = exports.FileLock = exports.Mutex = exports.defaultLogger = exports.silentLogger = exports.getLogger = exports.setLogger = exports.ConfigError = exports.VectorError = exports.SearchError = exports.DatabaseError = exports.ParseError = exports.FileError = exports.LatticeSensorError = exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.detectLanguage = exports.LATTICE_SENSOR_DIR = exports.findNearestLatticeSensorRoot = exports.isInitialized = exports.getLatticeSensorDir = exports.QueryBuilder = exports.DatabaseConnection = exports.getDatabasePath = void 0;
|
|
46
46
|
const path = __importStar(require("path"));
|
|
47
47
|
const db_1 = require("./db");
|
|
48
48
|
const wal_valve_1 = require("./db/wal-valve");
|
|
@@ -64,7 +64,7 @@ const resolver_pool_1 = require("./resolution/resolver-pool");
|
|
|
64
64
|
// Re-export types for consumers
|
|
65
65
|
__exportStar(require("./types"), exports);
|
|
66
66
|
// Storage building blocks for embedded/SDK consumers that drive the graph
|
|
67
|
-
// directly (open a DB, run prepared queries) rather than through the
|
|
67
|
+
// directly (open a DB, run prepared queries) rather than through the LatticeSensor
|
|
68
68
|
// facade. Exposed from the package entry so they no longer require deep imports
|
|
69
69
|
// into dist/ (issue #354).
|
|
70
70
|
var db_2 = require("./db");
|
|
@@ -73,10 +73,10 @@ Object.defineProperty(exports, "DatabaseConnection", { enumerable: true, get: fu
|
|
|
73
73
|
var queries_2 = require("./db/queries");
|
|
74
74
|
Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return queries_2.QueryBuilder; } });
|
|
75
75
|
var directory_3 = require("./directory");
|
|
76
|
-
Object.defineProperty(exports, "
|
|
76
|
+
Object.defineProperty(exports, "getLatticeSensorDir", { enumerable: true, get: function () { return directory_3.getLatticeSensorDir; } });
|
|
77
77
|
Object.defineProperty(exports, "isInitialized", { enumerable: true, get: function () { return directory_3.isInitialized; } });
|
|
78
|
-
Object.defineProperty(exports, "
|
|
79
|
-
Object.defineProperty(exports, "
|
|
78
|
+
Object.defineProperty(exports, "findNearestLatticeSensorRoot", { enumerable: true, get: function () { return directory_3.findNearestLatticeSensorRoot; } });
|
|
79
|
+
Object.defineProperty(exports, "LATTICE_SENSOR_DIR", { enumerable: true, get: function () { return directory_3.LATTICE_SENSOR_DIR; } });
|
|
80
80
|
var extraction_2 = require("./extraction");
|
|
81
81
|
Object.defineProperty(exports, "detectLanguage", { enumerable: true, get: function () { return extraction_2.detectLanguage; } });
|
|
82
82
|
Object.defineProperty(exports, "isLanguageSupported", { enumerable: true, get: function () { return extraction_2.isLanguageSupported; } });
|
|
@@ -86,7 +86,7 @@ Object.defineProperty(exports, "initGrammars", { enumerable: true, get: function
|
|
|
86
86
|
Object.defineProperty(exports, "loadGrammarsForLanguages", { enumerable: true, get: function () { return extraction_2.loadGrammarsForLanguages; } });
|
|
87
87
|
Object.defineProperty(exports, "loadAllGrammars", { enumerable: true, get: function () { return extraction_2.loadAllGrammars; } });
|
|
88
88
|
var errors_1 = require("./errors");
|
|
89
|
-
Object.defineProperty(exports, "
|
|
89
|
+
Object.defineProperty(exports, "LatticeSensorError", { enumerable: true, get: function () { return errors_1.LatticeSensorError; } });
|
|
90
90
|
Object.defineProperty(exports, "FileError", { enumerable: true, get: function () { return errors_1.FileError; } });
|
|
91
91
|
Object.defineProperty(exports, "ParseError", { enumerable: true, get: function () { return errors_1.ParseError; } });
|
|
92
92
|
Object.defineProperty(exports, "DatabaseError", { enumerable: true, get: function () { return errors_1.DatabaseError; } });
|
|
@@ -110,11 +110,11 @@ Object.defineProperty(exports, "LockUnavailableError", { enumerable: true, get:
|
|
|
110
110
|
var mcp_1 = require("./mcp");
|
|
111
111
|
Object.defineProperty(exports, "MCPServer", { enumerable: true, get: function () { return mcp_1.MCPServer; } });
|
|
112
112
|
/**
|
|
113
|
-
* Main
|
|
113
|
+
* Main LatticeSensor class
|
|
114
114
|
*
|
|
115
115
|
* Provides the primary interface for interacting with the code knowledge graph.
|
|
116
116
|
*/
|
|
117
|
-
class
|
|
117
|
+
class LatticeSensor {
|
|
118
118
|
db;
|
|
119
119
|
queries;
|
|
120
120
|
projectRoot;
|
|
@@ -136,7 +136,7 @@ class CodeGraph {
|
|
|
136
136
|
this.db = db;
|
|
137
137
|
this.queries = queries;
|
|
138
138
|
this.projectRoot = projectRoot;
|
|
139
|
-
this.fileLock = new utils_1.FileLock(path.join((0, directory_2.
|
|
139
|
+
this.fileLock = new utils_1.FileLock(path.join((0, directory_2.getLatticeSensorDir)(projectRoot), 'sensor.lock'));
|
|
140
140
|
this.wireLayers();
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
@@ -161,9 +161,9 @@ class CodeGraph {
|
|
|
161
161
|
this.contextBuilder = (0, context_1.createContextBuilder)(this.projectRoot, this.queries, this.traverser);
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
|
-
* Heal a stale database handle in place. If `.
|
|
164
|
+
* Heal a stale database handle in place. If `.lattice/sensor/` was removed and
|
|
165
165
|
* recreated at the SAME path while this instance held the DB open — a git
|
|
166
|
-
* worktree removed and re-added, or `rm -rf .
|
|
166
|
+
* worktree removed and re-added, or `rm -rf .lattice/sensor` + `lattice sensor init` —
|
|
167
167
|
* our open fd points at the now-unlinked inode and can never see the new
|
|
168
168
|
* index, so every query returns the pre-removal snapshot until the process
|
|
169
169
|
* restarts (#925). When that's detected, open the live file at the same path,
|
|
@@ -198,20 +198,20 @@ class CodeGraph {
|
|
|
198
198
|
// Lifecycle Methods
|
|
199
199
|
// ===========================================================================
|
|
200
200
|
/**
|
|
201
|
-
* Initialize a new
|
|
201
|
+
* Initialize a new LatticeSensor project
|
|
202
202
|
*
|
|
203
|
-
* Creates the .
|
|
203
|
+
* Creates the .LatticeSensor directory, database, and configuration.
|
|
204
204
|
*
|
|
205
205
|
* @param projectRoot - Path to the project root directory
|
|
206
206
|
* @param options - Initialization options
|
|
207
|
-
* @returns A new
|
|
207
|
+
* @returns A new LatticeSensor instance
|
|
208
208
|
*/
|
|
209
209
|
static async init(projectRoot, options = {}) {
|
|
210
210
|
await (0, extraction_1.initGrammars)();
|
|
211
211
|
const resolvedRoot = path.resolve(projectRoot);
|
|
212
212
|
// Check if already initialized
|
|
213
213
|
if ((0, directory_1.isInitialized)(resolvedRoot)) {
|
|
214
|
-
throw new Error(`
|
|
214
|
+
throw new Error(`LatticeSensor already initialized in ${resolvedRoot}`);
|
|
215
215
|
}
|
|
216
216
|
// Create directory structure
|
|
217
217
|
(0, directory_1.createDirectory)(resolvedRoot);
|
|
@@ -219,7 +219,7 @@ class CodeGraph {
|
|
|
219
219
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
220
220
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
221
221
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
222
|
-
const instance = new
|
|
222
|
+
const instance = new LatticeSensor(db, queries, resolvedRoot);
|
|
223
223
|
// Run initial indexing if requested
|
|
224
224
|
if (options.index) {
|
|
225
225
|
await instance.indexAll({ onProgress: options.onProgress });
|
|
@@ -233,7 +233,7 @@ class CodeGraph {
|
|
|
233
233
|
const resolvedRoot = path.resolve(projectRoot);
|
|
234
234
|
// Check if already initialized
|
|
235
235
|
if ((0, directory_1.isInitialized)(resolvedRoot)) {
|
|
236
|
-
throw new Error(`
|
|
236
|
+
throw new Error(`LatticeSensor already initialized in ${resolvedRoot}`);
|
|
237
237
|
}
|
|
238
238
|
// Create directory structure
|
|
239
239
|
(0, directory_1.createDirectory)(resolvedRoot);
|
|
@@ -241,32 +241,32 @@ class CodeGraph {
|
|
|
241
241
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
242
242
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
243
243
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
244
|
-
return new
|
|
244
|
+
return new LatticeSensor(db, queries, resolvedRoot);
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
247
|
-
* Open an existing
|
|
247
|
+
* Open an existing LatticeSensor project
|
|
248
248
|
*
|
|
249
249
|
* @param projectRoot - Path to the project root directory
|
|
250
250
|
* @param options - Open options
|
|
251
|
-
* @returns A
|
|
251
|
+
* @returns A LatticeSensor instance
|
|
252
252
|
*/
|
|
253
253
|
static async open(projectRoot, options = {}) {
|
|
254
254
|
await (0, extraction_1.initGrammars)();
|
|
255
255
|
const resolvedRoot = path.resolve(projectRoot);
|
|
256
256
|
// Check if initialized
|
|
257
257
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
258
|
-
throw new Error(`
|
|
258
|
+
throw new Error(`LatticeSensor not initialized in ${resolvedRoot}. Run init() first.`);
|
|
259
259
|
}
|
|
260
260
|
// Validate directory structure
|
|
261
261
|
const validation = (0, directory_1.validateDirectory)(resolvedRoot);
|
|
262
262
|
if (!validation.valid) {
|
|
263
|
-
throw new Error(`Invalid
|
|
263
|
+
throw new Error(`Invalid LatticeSensor directory: ${validation.errors.join(', ')}`);
|
|
264
264
|
}
|
|
265
265
|
// Open database
|
|
266
266
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
267
267
|
const db = db_1.DatabaseConnection.open(dbPath);
|
|
268
268
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
269
|
-
const instance = new
|
|
269
|
+
const instance = new LatticeSensor(db, queries, resolvedRoot);
|
|
270
270
|
// Sync if requested
|
|
271
271
|
if (options.sync) {
|
|
272
272
|
await instance.sync();
|
|
@@ -275,11 +275,11 @@ class CodeGraph {
|
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
277
277
|
* Rebuild the project's database from scratch and return a fresh, empty
|
|
278
|
-
* instance — the "same result as a fresh init" semantics that `
|
|
278
|
+
* instance — the "same result as a fresh init" semantics that `lattice sensor
|
|
279
279
|
* index` documents.
|
|
280
280
|
*
|
|
281
281
|
* Unlike `open()` followed by `clear()`, this DISCARDS the existing
|
|
282
|
-
* `.
|
|
282
|
+
* `.lattice/sensor/sensor.db` (and its `-wal`/`-shm` sidecars) before
|
|
283
283
|
* re-initializing, instead of opening the old database and DELETE-ing every
|
|
284
284
|
* row. On a large or pre-fix poisoned index — e.g. an old graph that scanned
|
|
285
285
|
* an ignored gitlink corpus (#1065) into ~1.6M nodes with a multi-GB WAL —
|
|
@@ -295,7 +295,7 @@ class CodeGraph {
|
|
|
295
295
|
// Check if initialized — recreate REBUILDS an existing project; it is not a
|
|
296
296
|
// first-time `init`.
|
|
297
297
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
298
|
-
throw new Error(`
|
|
298
|
+
throw new Error(`LatticeSensor not initialized in ${resolvedRoot}. Run init() first.`);
|
|
299
299
|
}
|
|
300
300
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
301
301
|
try {
|
|
@@ -307,13 +307,13 @@ class CodeGraph {
|
|
|
307
307
|
// an actionable instruction instead of a generic failure.
|
|
308
308
|
const reason = err instanceof Error ? err.message : String(err);
|
|
309
309
|
throw new Error(`Could not rebuild the index — the database file is in use (${reason}). ` +
|
|
310
|
-
`Stop any running
|
|
311
|
-
`or remove the ${(0, directory_2.
|
|
310
|
+
`Stop any running LatticeSensor MCP server/daemon for this project and retry, ` +
|
|
311
|
+
`or remove the ${(0, directory_2.getLatticeSensorDir)(resolvedRoot)} directory and run "lattice sensor init".`);
|
|
312
312
|
}
|
|
313
313
|
// Re-create an empty, freshly-schema'd database at the same path.
|
|
314
314
|
const db = db_1.DatabaseConnection.initialize(dbPath);
|
|
315
315
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
316
|
-
return new
|
|
316
|
+
return new LatticeSensor(db, queries, resolvedRoot);
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
* Open synchronously (without sync)
|
|
@@ -322,27 +322,27 @@ class CodeGraph {
|
|
|
322
322
|
const resolvedRoot = path.resolve(projectRoot);
|
|
323
323
|
// Check if initialized
|
|
324
324
|
if (!(0, directory_1.isInitialized)(resolvedRoot)) {
|
|
325
|
-
throw new Error(`
|
|
325
|
+
throw new Error(`LatticeSensor not initialized in ${resolvedRoot}. Run init() first.`);
|
|
326
326
|
}
|
|
327
327
|
// Validate directory structure
|
|
328
328
|
const validation = (0, directory_1.validateDirectory)(resolvedRoot);
|
|
329
329
|
if (!validation.valid) {
|
|
330
|
-
throw new Error(`Invalid
|
|
330
|
+
throw new Error(`Invalid LatticeSensor directory: ${validation.errors.join(', ')}`);
|
|
331
331
|
}
|
|
332
332
|
// Open database
|
|
333
333
|
const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
|
|
334
334
|
const db = db_1.DatabaseConnection.open(dbPath);
|
|
335
335
|
const queries = new queries_1.QueryBuilder(db.getDb());
|
|
336
|
-
return new
|
|
336
|
+
return new LatticeSensor(db, queries, resolvedRoot);
|
|
337
337
|
}
|
|
338
338
|
/**
|
|
339
|
-
* Check if a directory has been initialized as a
|
|
339
|
+
* Check if a directory has been initialized as a LatticeSensor project
|
|
340
340
|
*/
|
|
341
341
|
static isInitialized(projectRoot) {
|
|
342
342
|
return (0, directory_1.isInitialized)(path.resolve(projectRoot));
|
|
343
343
|
}
|
|
344
344
|
/**
|
|
345
|
-
* Close the
|
|
345
|
+
* Close the LatticeSensor instance and release resources
|
|
346
346
|
*/
|
|
347
347
|
close() {
|
|
348
348
|
this.unwatch();
|
|
@@ -379,16 +379,16 @@ class CodeGraph {
|
|
|
379
379
|
// growth by backfilling PASSIVEly on a worker thread (never blocking
|
|
380
380
|
// the writer or the #850 watchdog heartbeat); runMaintenance below does
|
|
381
381
|
// the final fold-up before the interval is restored in the finally.
|
|
382
|
-
// Kill switch:
|
|
382
|
+
// Kill switch: LATTICE_SENSOR_NO_WAL_DEFER=1. Non-WAL journal modes (some
|
|
383
383
|
// network filesystems) have no WAL to defer — skip.
|
|
384
384
|
// Fast-init: on a COMPLETELY fresh DB, trade crash-durability for speed
|
|
385
385
|
// during the bulk build (journal in memory, no fsync). Safe because the
|
|
386
386
|
// DB is disposable until the index completes — index_state stays
|
|
387
387
|
// 'indexing' and a crashed init is re-run from scratch; existing DBs
|
|
388
388
|
// (re-index/sync) never take this path. Kill switch:
|
|
389
|
-
//
|
|
389
|
+
// LATTICE_SENSOR_NO_FAST_INIT=1 (same pattern as LATTICE_SENSOR_NO_WAL_DEFER).
|
|
390
390
|
const freshDb = this.queries.getNodeAndEdgeCount().nodes === 0;
|
|
391
|
-
const fastInit = process.env.
|
|
391
|
+
const fastInit = process.env.LATTICE_SENSOR_NO_FAST_INIT !== '1' && freshDb;
|
|
392
392
|
if (fastInit) {
|
|
393
393
|
try {
|
|
394
394
|
this.db.getDb().pragma('journal_mode = MEMORY');
|
|
@@ -396,7 +396,7 @@ class CodeGraph {
|
|
|
396
396
|
}
|
|
397
397
|
catch { /* keep WAL */ }
|
|
398
398
|
}
|
|
399
|
-
const deferWal = !fastInit && process.env.
|
|
399
|
+
const deferWal = !fastInit && process.env.LATTICE_SENSOR_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
|
|
400
400
|
let walValve = null;
|
|
401
401
|
let priorAutocheckpoint = 1000;
|
|
402
402
|
// Set when the fastInit+pool path below defers autocheckpointing, so the
|
|
@@ -412,7 +412,7 @@ class CodeGraph {
|
|
|
412
412
|
const before = this.queries.getNodeAndEdgeCount();
|
|
413
413
|
// Mark the index as in-flight BEFORE any writes: a run killed
|
|
414
414
|
// mid-index (OOM, SIGKILL, the #850 liveness watchdog) leaves this
|
|
415
|
-
// marker behind, so `
|
|
415
|
+
// marker behind, so `lattice sensor status` can tell a truncated index
|
|
416
416
|
// from a completed one instead of silently serving partial results.
|
|
417
417
|
try {
|
|
418
418
|
this.queries.setMetadata('index_state', 'indexing');
|
|
@@ -440,7 +440,7 @@ class CodeGraph {
|
|
|
440
440
|
finally {
|
|
441
441
|
const tFts = Date.now();
|
|
442
442
|
this.db.endBulkNodeLoad();
|
|
443
|
-
if (process.env.
|
|
443
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
444
444
|
console.error(`[phase-timing] fts-rebuild: ${Date.now() - tFts}ms`);
|
|
445
445
|
}
|
|
446
446
|
// Fold the parse phase's WAL BEFORE the first post-parse reads
|
|
@@ -463,7 +463,7 @@ class CodeGraph {
|
|
|
463
463
|
// Cross-file finalization (e.g. NestJS RouterModule prefixes). Runs
|
|
464
464
|
// before resolution so updated names show up in subsequent reads.
|
|
465
465
|
this.resolver.runPostExtract();
|
|
466
|
-
if (process.env.
|
|
466
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
467
467
|
console.error(`[phase-timing] resolver-reinit: ${Date.now() - tReinit}ms`);
|
|
468
468
|
}
|
|
469
469
|
// Resolve references to create call/import/extends edges
|
|
@@ -515,7 +515,7 @@ class CodeGraph {
|
|
|
515
515
|
total: totalPasses,
|
|
516
516
|
});
|
|
517
517
|
});
|
|
518
|
-
if (process.env.
|
|
518
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
519
519
|
console.error(`[phase-timing] resolution: ${Date.now() - tResolve}ms`);
|
|
520
520
|
// Second pass: chained calls whose method lives on a supertype the
|
|
521
521
|
// receiver conforms to (protocol-extension / inherited / default-
|
|
@@ -523,13 +523,13 @@ class CodeGraph {
|
|
|
523
523
|
// built, so it runs after resolution (#750).
|
|
524
524
|
const tChained = Date.now();
|
|
525
525
|
await this.resolver.resolveChainedCallsViaConformance();
|
|
526
|
-
if (process.env.
|
|
526
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
527
527
|
console.error(`[synth-timing] chainedConformance: ${Date.now() - tChained}ms`);
|
|
528
528
|
// Same lifecycle for `this.<member>` callback registrations whose
|
|
529
529
|
// member is inherited from a supertype (#808).
|
|
530
530
|
const tDeferred = Date.now();
|
|
531
531
|
await this.resolver.resolveDeferredThisMemberRefs();
|
|
532
|
-
if (process.env.
|
|
532
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
533
533
|
console.error(`[synth-timing] deferredThisMember: ${Date.now() - tDeferred}ms`);
|
|
534
534
|
}
|
|
535
535
|
// Refresh planner stats + checkpoint the WAL after bulk writes.
|
|
@@ -546,7 +546,7 @@ class CodeGraph {
|
|
|
546
546
|
await walValve.drain();
|
|
547
547
|
}
|
|
548
548
|
await this.db.runMaintenance();
|
|
549
|
-
if (process.env.
|
|
549
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
550
550
|
console.error(`[phase-timing] maintenance: ${Date.now() - tMaint}ms`);
|
|
551
551
|
}
|
|
552
552
|
// The orchestrator only sees extraction-phase counts; resolution and
|
|
@@ -555,19 +555,19 @@ class CodeGraph {
|
|
|
555
555
|
if (result.success && result.filesIndexed > 0) {
|
|
556
556
|
const tCount = Date.now();
|
|
557
557
|
const after = this.queries.getNodeAndEdgeCount();
|
|
558
|
-
if (process.env.
|
|
558
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
559
559
|
console.error(`[phase-timing] count-recompute: ${Date.now() - tCount}ms`);
|
|
560
560
|
result.nodesCreated = after.nodes - before.nodes;
|
|
561
561
|
result.edgesCreated = after.edges - before.edges;
|
|
562
562
|
}
|
|
563
|
-
// Stamp the index with the engine that built it, so `
|
|
564
|
-
// and `
|
|
563
|
+
// Stamp the index with the engine that built it, so `lattice sensor status`
|
|
564
|
+
// and `lattice sensor upgrade` can recommend a re-index when the running
|
|
565
565
|
// engine produces richer extraction than the one on disk. Only on a
|
|
566
566
|
// real full index — a sync touches a subset, so it must NOT advance the
|
|
567
567
|
// extraction stamp (the bulk would still be stale). See extraction-version.ts.
|
|
568
568
|
if (result.success && result.filesIndexed > 0) {
|
|
569
569
|
try {
|
|
570
|
-
this.queries.setMetadata('indexed_with_version', version_1.
|
|
570
|
+
this.queries.setMetadata('indexed_with_version', version_1.LatticeSensorPackageVersion);
|
|
571
571
|
this.queries.setMetadata('indexed_with_extraction_version', String(extraction_version_1.EXTRACTION_VERSION));
|
|
572
572
|
}
|
|
573
573
|
catch { /* metadata is advisory — never fail an index over it */ }
|
|
@@ -590,7 +590,7 @@ class CodeGraph {
|
|
|
590
590
|
this.queries.setMetadata('index_files_discovered', String(discovered));
|
|
591
591
|
this.queries.setMetadata('index_files_accounted', String(accounted));
|
|
592
592
|
result.errors.push({
|
|
593
|
-
message: `Index is missing ${shortfall} of ${discovered} discovered files (indexed ${result.filesIndexed}, skipped ${result.filesSkipped}, errored ${result.filesErrored}). The index is PARTIAL — re-run \`
|
|
593
|
+
message: `Index is missing ${shortfall} of ${discovered} discovered files (indexed ${result.filesIndexed}, skipped ${result.filesSkipped}, errored ${result.filesErrored}). The index is PARTIAL — re-run \`lattice sensor index\`.`,
|
|
594
594
|
severity: 'warning',
|
|
595
595
|
code: 'index_partial',
|
|
596
596
|
});
|
|
@@ -679,9 +679,9 @@ class CodeGraph {
|
|
|
679
679
|
// not the change size, so small syncs on big indexes hurt most. The
|
|
680
680
|
// valve bounds WAL growth off-thread; runMaintenance at the end does
|
|
681
681
|
// the final fold-up before the interval is restored in the finally.
|
|
682
|
-
// Same kill switch as indexAll:
|
|
682
|
+
// Same kill switch as indexAll: LATTICE_SENSOR_NO_WAL_DEFER=1. Idle valve
|
|
683
683
|
// cost is one timer, so watcher-frequency syncs stay cheap.
|
|
684
|
-
const deferWal = process.env.
|
|
684
|
+
const deferWal = process.env.LATTICE_SENSOR_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
|
|
685
685
|
let walValve = null;
|
|
686
686
|
let priorAutocheckpoint = 1000;
|
|
687
687
|
if (deferWal) {
|
|
@@ -733,7 +733,7 @@ class CodeGraph {
|
|
|
733
733
|
// Scope resolution to changed files (git fast path — bounded set)
|
|
734
734
|
const tRefLoad = Date.now();
|
|
735
735
|
const unresolvedRefs = this.queries.getUnresolvedReferencesByFiles(result.changedFilePaths);
|
|
736
|
-
if (process.env.
|
|
736
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
737
737
|
console.error(`[phase-timing] sync-ref-load: ${Date.now() - tRefLoad}ms (${unresolvedRefs.length} refs)`);
|
|
738
738
|
options.onProgress?.({
|
|
739
739
|
phase: 'resolving',
|
|
@@ -771,7 +771,7 @@ class CodeGraph {
|
|
|
771
771
|
total: retryable.length,
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
|
-
if (process.env.
|
|
774
|
+
if (process.env.LATTICE_SENSOR_SYNTH_TIMINGS)
|
|
775
775
|
console.error(`[phase-timing] sync-failed-ref-retry: ${Date.now() - tRetry}ms (${retryable.length} refs)`);
|
|
776
776
|
}
|
|
777
777
|
else {
|
|
@@ -808,7 +808,7 @@ class CodeGraph {
|
|
|
808
808
|
// status='failed' for the #1240 retry above), so any pending row now
|
|
809
809
|
// is such an orphan — or a row from an older engine's scoped pass.
|
|
810
810
|
// Grind them down with the batched resolver; this also makes a bare
|
|
811
|
-
// `
|
|
811
|
+
// `lattice sensor sync` the recovery command for a wedged index. On a
|
|
812
812
|
// healthy index this is one COUNT query.
|
|
813
813
|
const orphanCount = this.queries.getUnresolvedReferencesCount();
|
|
814
814
|
if (orphanCount > 0) {
|
|
@@ -976,7 +976,7 @@ class CodeGraph {
|
|
|
976
976
|
/**
|
|
977
977
|
* Most recent index timestamp (ms since epoch) across all tracked files, or
|
|
978
978
|
* null when nothing is indexed yet. Lets library consumers check index
|
|
979
|
-
* freshness without shelling out to `
|
|
979
|
+
* freshness without shelling out to `lattice sensor status --json`. (#329)
|
|
980
980
|
*/
|
|
981
981
|
getLastIndexedAt() {
|
|
982
982
|
return this.queries.getLastIndexedAt();
|
|
@@ -988,7 +988,7 @@ class CodeGraph {
|
|
|
988
988
|
* `'partial'` means the run finished but silently dropped files
|
|
989
989
|
* (discovered > indexed+skipped+errored); `'failed'` means it reported
|
|
990
990
|
* failure. `null` = index predates this marker. Surfaced by
|
|
991
|
-
* `
|
|
991
|
+
* `lattice sensor status`.
|
|
992
992
|
*/
|
|
993
993
|
getIndexState() {
|
|
994
994
|
const raw = this.queries.getMetadata('index_state');
|
|
@@ -1012,8 +1012,8 @@ class CodeGraph {
|
|
|
1012
1012
|
* True when the on-disk index was built by an engine whose extraction is
|
|
1013
1013
|
* older than the one now running — i.e. a re-index would add data a migration
|
|
1014
1014
|
* can't backfill. False when there's no index yet (nothing to refresh) or the
|
|
1015
|
-
* stamp is current. This is the signal behind `
|
|
1016
|
-
* hint and `
|
|
1015
|
+
* stamp is current. This is the signal behind `lattice sensor status`'s re-index
|
|
1016
|
+
* hint and `lattice sensor upgrade`'s reminder.
|
|
1017
1017
|
*/
|
|
1018
1018
|
isIndexStale() {
|
|
1019
1019
|
if (this.queries.getLastIndexedAt() == null)
|
|
@@ -1097,8 +1097,8 @@ class CodeGraph {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
/**
|
|
1099
1099
|
* Active SQLite backend for this project's connection (`node-sqlite` — Node's
|
|
1100
|
-
* built-in real-SQLite module). Surfaced via `
|
|
1101
|
-
* `
|
|
1100
|
+
* built-in real-SQLite module). Surfaced via `lattice sensor status` and the
|
|
1101
|
+
* `lattice_sensor_status` MCP tool alongside the effective journal mode.
|
|
1102
1102
|
*/
|
|
1103
1103
|
getBackend() {
|
|
1104
1104
|
return this.db.getBackend();
|
|
@@ -1107,7 +1107,7 @@ class CodeGraph {
|
|
|
1107
1107
|
* The journal mode actually in effect ('wal', 'delete', …). 'wal' means
|
|
1108
1108
|
* readers never block on a concurrent writer; anything else means they can,
|
|
1109
1109
|
* which is the precondition for the "database is locked" failures in issue
|
|
1110
|
-
* #238. Surfaced via `
|
|
1110
|
+
* #238. Surfaced via `lattice sensor status` and the `lattice_sensor_status` MCP tool.
|
|
1111
1111
|
*/
|
|
1112
1112
|
getJournalMode() {
|
|
1113
1113
|
return this.db.getJournalMode();
|
|
@@ -1215,7 +1215,7 @@ class CodeGraph {
|
|
|
1215
1215
|
const singleWordVariants = variants.filter((v) => variantToWord.get(v).length >= 5);
|
|
1216
1216
|
const counts = this.queries.getSegmentNameCounts(singleWordVariants);
|
|
1217
1217
|
const rare = [...counts.entries()]
|
|
1218
|
-
.filter(([, n]) => n >= 2 && n <=
|
|
1218
|
+
.filter(([, n]) => n >= 2 && n <= LatticeSensor.SEGMENT_RARITY_CEILING)
|
|
1219
1219
|
.sort((a, b) => a[1] - b[1])
|
|
1220
1220
|
.slice(0, 2);
|
|
1221
1221
|
for (const [variant] of rare) {
|
|
@@ -1347,9 +1347,9 @@ class CodeGraph {
|
|
|
1347
1347
|
* Find the project's "primary route file" — the file with the densest
|
|
1348
1348
|
* concentration of framework-emitted `route` nodes (≥3 routes, ≥30%
|
|
1349
1349
|
* of all non-test routes). Used to inline the routing config in
|
|
1350
|
-
* `
|
|
1350
|
+
* `lattice_sensor_explore` responses on small realworld template repos
|
|
1351
1351
|
* (rails-realworld, laravel-realworld, drupal-admintoolbar, …) where
|
|
1352
|
-
* Glob+Read of `routes.rb`/`urls.py`/etc. otherwise beats
|
|
1352
|
+
* Glob+Read of `routes.rb`/`urls.py`/etc. otherwise beats lattice sensor.
|
|
1353
1353
|
*/
|
|
1354
1354
|
getTopRouteFile() {
|
|
1355
1355
|
return this.queries.getTopRouteFile();
|
|
@@ -1630,17 +1630,17 @@ class CodeGraph {
|
|
|
1630
1630
|
this.close();
|
|
1631
1631
|
}
|
|
1632
1632
|
/**
|
|
1633
|
-
* Completely remove
|
|
1634
|
-
* This closes the database and deletes the .
|
|
1633
|
+
* Completely remove LatticeSensor from the project.
|
|
1634
|
+
* This closes the database and deletes the .LatticeSensor directory.
|
|
1635
1635
|
*
|
|
1636
|
-
* WARNING: This permanently deletes all
|
|
1636
|
+
* WARNING: This permanently deletes all LatticeSensor data for the project.
|
|
1637
1637
|
*/
|
|
1638
1638
|
uninitialize() {
|
|
1639
1639
|
this.close();
|
|
1640
1640
|
(0, directory_1.removeDirectory)(this.projectRoot);
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
1643
|
-
exports.
|
|
1643
|
+
exports.LatticeSensor = LatticeSensor;
|
|
1644
1644
|
// Default export
|
|
1645
|
-
exports.default =
|
|
1645
|
+
exports.default = LatticeSensor;
|
|
1646
1646
|
//# sourceMappingURL=index.js.map
|