@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,258 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Background update-availability check for long-lived servers (#1243).
|
|
4
|
-
*
|
|
5
|
-
* The recommended MCP config launches the LOCAL `codegraph` binary, so the
|
|
6
|
-
* server (and the prompt hook alongside it) silently stays on whatever version
|
|
7
|
-
* was last manually upgraded — users discover the drift only when something
|
|
8
|
-
* breaks. This module gives the running server *visibility* without changing
|
|
9
|
-
* behavior: a non-blocking check against the latest GitHub release, surfaced
|
|
10
|
-
* as a one-line notice (stderr log, MCP initialize instructions, and
|
|
11
|
-
* `codegraph_status`) telling the user to run `codegraph upgrade`.
|
|
12
|
-
*
|
|
13
|
-
* Invariants (mirrors the telemetry module's contract):
|
|
14
|
-
* - Never stdout — stdio is the MCP protocol channel.
|
|
15
|
-
* - Never blocking: the network refresh is fire-and-forget; every reader
|
|
16
|
-
* (`getUpdateNotice`) is a cheap synchronous cache read, so the #172
|
|
17
|
-
* respond-fast handshake contract holds.
|
|
18
|
-
* - Fail silent: offline / rate-limited / disk-full all degrade to "no
|
|
19
|
-
* notice", never an error, never a retry loop.
|
|
20
|
-
* - Off is off: `CODEGRAPH_NO_UPDATE_CHECK` (dedicated) or `DO_NOT_TRACK`
|
|
21
|
-
* (broad don't-phone-home convention — set by e.g. the Pro container's
|
|
22
|
-
* data plane) suppresses the network call AND the notice entirely.
|
|
23
|
-
*
|
|
24
|
-
* The check itself reuses `resolveLatestVersion` — the GitHub release-redirect
|
|
25
|
-
* trick with the API fallback — so version resolution can't drift from what
|
|
26
|
-
* `codegraph upgrade` installs. Results are cached in `~/.codegraph/` (the
|
|
27
|
-
* same global state dir telemetry and the daemon registry use) with a 24h TTL
|
|
28
|
-
* on success and a 1h backoff after failure, shared across every proxy /
|
|
29
|
-
* daemon process on the machine.
|
|
30
|
-
*/
|
|
31
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
32
|
-
if (k2 === undefined) k2 = k;
|
|
33
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
34
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
35
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
36
|
-
}
|
|
37
|
-
Object.defineProperty(o, k2, desc);
|
|
38
|
-
}) : (function(o, m, k, k2) {
|
|
39
|
-
if (k2 === undefined) k2 = k;
|
|
40
|
-
o[k2] = m[k];
|
|
41
|
-
}));
|
|
42
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
43
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
44
|
-
}) : function(o, v) {
|
|
45
|
-
o["default"] = v;
|
|
46
|
-
});
|
|
47
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
48
|
-
var ownKeys = function(o) {
|
|
49
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
50
|
-
var ar = [];
|
|
51
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
52
|
-
return ar;
|
|
53
|
-
};
|
|
54
|
-
return ownKeys(o);
|
|
55
|
-
};
|
|
56
|
-
return function (mod) {
|
|
57
|
-
if (mod && mod.__esModule) return mod;
|
|
58
|
-
var result = {};
|
|
59
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
60
|
-
__setModuleDefault(result, mod);
|
|
61
|
-
return result;
|
|
62
|
-
};
|
|
63
|
-
})();
|
|
64
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
exports.UPDATE_CHECK_FAILURE_BACKOFF_MS = exports.UPDATE_CHECK_TTL_MS = void 0;
|
|
66
|
-
exports.updateCheckDisabled = updateCheckDisabled;
|
|
67
|
-
exports.updateCheckCachePath = updateCheckCachePath;
|
|
68
|
-
exports.readUpdateCheckCache = readUpdateCheckCache;
|
|
69
|
-
exports.canonicalVersionTag = canonicalVersionTag;
|
|
70
|
-
exports.formatUpdateNotice = formatUpdateNotice;
|
|
71
|
-
exports.refreshUpdateCheck = refreshUpdateCheck;
|
|
72
|
-
exports.getUpdateNotice = getUpdateNotice;
|
|
73
|
-
exports.resetUpdateNoticeMemo = resetUpdateNoticeMemo;
|
|
74
|
-
exports.checkForUpdateInBackground = checkForUpdateInBackground;
|
|
75
|
-
const fs = __importStar(require("fs"));
|
|
76
|
-
const path = __importStar(require("path"));
|
|
77
|
-
const os = __importStar(require("os"));
|
|
78
|
-
const index_1 = require("./index");
|
|
79
|
-
const version_1 = require("../mcp/version");
|
|
80
|
-
/** Re-check the release feed after this long (successful checks). */
|
|
81
|
-
exports.UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1000;
|
|
82
|
-
/** Back off this long after a failed check (offline, rate-limited). */
|
|
83
|
-
exports.UPDATE_CHECK_FAILURE_BACKOFF_MS = 60 * 60 * 1000;
|
|
84
|
-
/** Short network budget — the refresh is background work, not a handshake. */
|
|
85
|
-
const UPDATE_CHECK_NETWORK_TIMEOUT_MS = 5000;
|
|
86
|
-
function resolveDeps(deps = {}) {
|
|
87
|
-
return {
|
|
88
|
-
dir: deps.dir ?? path.join(os.homedir(), '.codegraph'),
|
|
89
|
-
env: deps.env ?? process.env,
|
|
90
|
-
now: deps.now ?? Date.now,
|
|
91
|
-
resolveLatest: deps.resolveLatest ?? (() => (0, index_1.resolveLatestVersion)(undefined, UPDATE_CHECK_NETWORK_TIMEOUT_MS)),
|
|
92
|
-
currentVersion: deps.currentVersion ?? version_1.CodeGraphPackageVersion,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function envTruthy(raw) {
|
|
96
|
-
return raw !== undefined && raw !== '' && raw !== '0' && raw.toLowerCase() !== 'false';
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* True when the update check must not run at all — no network call, no
|
|
100
|
-
* notice. `DO_NOT_TRACK` uses the same truthiness the telemetry opt-out does.
|
|
101
|
-
*/
|
|
102
|
-
function updateCheckDisabled(env = process.env) {
|
|
103
|
-
return envTruthy(env.CODEGRAPH_NO_UPDATE_CHECK) || envTruthy(env.DO_NOT_TRACK);
|
|
104
|
-
}
|
|
105
|
-
function updateCheckCachePath(dir) {
|
|
106
|
-
return path.join(dir, 'update-check.json');
|
|
107
|
-
}
|
|
108
|
-
function readUpdateCheckCache(dir) {
|
|
109
|
-
try {
|
|
110
|
-
const raw = fs.readFileSync(updateCheckCachePath(dir), 'utf8');
|
|
111
|
-
const parsed = JSON.parse(raw);
|
|
112
|
-
if (typeof parsed?.lastAttemptAt !== 'number')
|
|
113
|
-
return null;
|
|
114
|
-
return parsed;
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
return null; // missing / torn / unparseable — same as no cache
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function writeUpdateCheckCache(dir, cache) {
|
|
121
|
-
try {
|
|
122
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
123
|
-
fs.writeFileSync(updateCheckCachePath(dir), JSON.stringify(cache));
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
/* fail silent — a read-only home dir must not break the server */
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Rebuild a canonical `vX.Y.Z[-pre]` tag from the PARSED semver fields, or
|
|
131
|
-
* null when the input isn't version-shaped. The notice ends up inside the MCP
|
|
132
|
-
* initialize instructions — agent-visible, system-prompt-adjacent text — and
|
|
133
|
-
* the `latest` value arrives from a network redirect via an on-disk cache, so
|
|
134
|
-
* only a reconstructed canonical string may ever be interpolated, never the
|
|
135
|
-
* raw value. (`parseSemver`'s regex is not end-anchored: a value like
|
|
136
|
-
* `1.2.3-x <arbitrary text>` parses "valid" while the raw string would carry
|
|
137
|
-
* the trailing text straight into every session's instructions.)
|
|
138
|
-
*/
|
|
139
|
-
function canonicalVersionTag(v) {
|
|
140
|
-
const s = (0, index_1.parseSemver)(v);
|
|
141
|
-
if (!s)
|
|
142
|
-
return null;
|
|
143
|
-
return `v${s.major}.${s.minor}.${s.patch}${s.pre ? `-${s.pre}` : ''}`;
|
|
144
|
-
}
|
|
145
|
-
/** One user-facing sentence; every surface (stderr, instructions, status) shows this. */
|
|
146
|
-
function formatUpdateNotice(current, latest) {
|
|
147
|
-
return (`CodeGraph ${latest} is available (this server is running ` +
|
|
148
|
-
`${current}). Update with \`codegraph upgrade\`.`);
|
|
149
|
-
}
|
|
150
|
-
function noticeFrom(cache, d) {
|
|
151
|
-
if (!cache?.latest)
|
|
152
|
-
return null;
|
|
153
|
-
// A dev build whose package.json couldn't be read reports the sentinel
|
|
154
|
-
// version; any comparison against it would always claim an update.
|
|
155
|
-
if (d.currentVersion === '0.0.0-unknown')
|
|
156
|
-
return null;
|
|
157
|
-
// Canonicalize BOTH sides before comparing or rendering — a non-semver
|
|
158
|
-
// `latest` (garbage redirect, tampered cache) yields no notice at all
|
|
159
|
-
// rather than flowing into agent-visible text.
|
|
160
|
-
const latest = canonicalVersionTag(cache.latest);
|
|
161
|
-
const current = canonicalVersionTag(d.currentVersion);
|
|
162
|
-
if (!latest || !current)
|
|
163
|
-
return null;
|
|
164
|
-
return (0, index_1.isUpdateAvailable)(current, latest) ? formatUpdateNotice(current, latest) : null;
|
|
165
|
-
}
|
|
166
|
-
function cacheIsFresh(cache, nowMs) {
|
|
167
|
-
if (!cache)
|
|
168
|
-
return false;
|
|
169
|
-
if (cache.lastSuccessAt !== undefined && nowMs - cache.lastSuccessAt < exports.UPDATE_CHECK_TTL_MS) {
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
172
|
-
// No recent success: only the failure backoff holds the network call off.
|
|
173
|
-
return nowMs - cache.lastAttemptAt < exports.UPDATE_CHECK_FAILURE_BACKOFF_MS;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Ensure the on-disk cache is fresh (hitting the network only past the TTL /
|
|
177
|
-
* backoff) and return the current notice, or null. Never throws.
|
|
178
|
-
*/
|
|
179
|
-
async function refreshUpdateCheck(deps = {}) {
|
|
180
|
-
const d = resolveDeps(deps);
|
|
181
|
-
if (updateCheckDisabled(d.env))
|
|
182
|
-
return null;
|
|
183
|
-
const cached = readUpdateCheckCache(d.dir);
|
|
184
|
-
const nowMs = d.now();
|
|
185
|
-
if (cacheIsFresh(cached, nowMs))
|
|
186
|
-
return noticeFrom(cached, d);
|
|
187
|
-
try {
|
|
188
|
-
const latest = canonicalVersionTag(await d.resolveLatest());
|
|
189
|
-
// A response that isn't version-shaped is a failure, not a result —
|
|
190
|
-
// fall through to the backoff path and keep the previous known-good tag.
|
|
191
|
-
if (!latest)
|
|
192
|
-
throw new Error('release feed returned a non-version tag');
|
|
193
|
-
const next = { lastAttemptAt: nowMs, lastSuccessAt: nowMs, latest };
|
|
194
|
-
writeUpdateCheckCache(d.dir, next);
|
|
195
|
-
return noticeFrom(next, d);
|
|
196
|
-
}
|
|
197
|
-
catch {
|
|
198
|
-
// Record the attempt (starts the backoff) but KEEP the previous latest —
|
|
199
|
-
// a transient outage must not hide an already-known update.
|
|
200
|
-
const next = {
|
|
201
|
-
lastAttemptAt: nowMs,
|
|
202
|
-
lastSuccessAt: cached?.lastSuccessAt,
|
|
203
|
-
latest: cached?.latest,
|
|
204
|
-
};
|
|
205
|
-
writeUpdateCheckCache(d.dir, next);
|
|
206
|
-
return noticeFrom(next, d);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
// Per-process memo so the sync read path (MCP initialize, codegraph_status)
|
|
210
|
-
// touches the disk at most once a minute, not once per handshake.
|
|
211
|
-
const NOTICE_MEMO_TTL_MS = 60 * 1000;
|
|
212
|
-
let noticeMemo = null;
|
|
213
|
-
/**
|
|
214
|
-
* The current update notice from the on-disk cache — synchronous and cheap
|
|
215
|
-
* (memoized disk read), safe on the initialize respond-fast path. When the
|
|
216
|
-
* cache has gone stale (e.g. a daemon that has been up for weeks), kicks a
|
|
217
|
-
* background refresh so the NEXT reader sees a current answer; this call
|
|
218
|
-
* still returns immediately from the stale cache.
|
|
219
|
-
*/
|
|
220
|
-
function getUpdateNotice(deps = {}) {
|
|
221
|
-
const d = resolveDeps(deps);
|
|
222
|
-
if (updateCheckDisabled(d.env))
|
|
223
|
-
return null;
|
|
224
|
-
const useMemo = deps.dir === undefined && deps.now === undefined;
|
|
225
|
-
const nowMs = d.now();
|
|
226
|
-
if (useMemo && noticeMemo && nowMs - noticeMemo.at < NOTICE_MEMO_TTL_MS) {
|
|
227
|
-
return noticeMemo.value;
|
|
228
|
-
}
|
|
229
|
-
const cached = readUpdateCheckCache(d.dir);
|
|
230
|
-
if (!cacheIsFresh(cached, nowMs)) {
|
|
231
|
-
void refreshUpdateCheck(deps).catch(() => { });
|
|
232
|
-
}
|
|
233
|
-
const value = noticeFrom(cached, d);
|
|
234
|
-
if (useMemo)
|
|
235
|
-
noticeMemo = { at: nowMs, value };
|
|
236
|
-
return value;
|
|
237
|
-
}
|
|
238
|
-
/** Test hook: clear the per-process memo. */
|
|
239
|
-
function resetUpdateNoticeMemo() {
|
|
240
|
-
noticeMemo = null;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Fire-and-forget entry point for server startup: refresh the cache in the
|
|
244
|
-
* background and, if an update is available, emit ONE stderr line (stderr is
|
|
245
|
-
* the MCP-safe channel; hosts surface it in their server logs). Never throws,
|
|
246
|
-
* never blocks, never writes stdout.
|
|
247
|
-
*/
|
|
248
|
-
function checkForUpdateInBackground(deps = {}, log = (line) => process.stderr.write(line)) {
|
|
249
|
-
refreshUpdateCheck(deps)
|
|
250
|
-
.then((notice) => {
|
|
251
|
-
// The shared notice sentence starts with "CodeGraph …"; drop the word
|
|
252
|
-
// after the log tag so the line doesn't read "[CodeGraph] CodeGraph …".
|
|
253
|
-
if (notice)
|
|
254
|
-
log(`[CodeGraph] ${notice.replace(/^CodeGraph /, '')}\n`);
|
|
255
|
-
})
|
|
256
|
-
.catch(() => { });
|
|
257
|
-
}
|
|
258
|
-
//# sourceMappingURL=update-check.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-check.js","sourceRoot":"","sources":["../../src/upgrade/update-check.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DH,kDAEC;AAED,oDAEC;AAED,oDASC;AAqBD,kDAIC;AAGD,gDAKC;AA6BD,gDA2BC;AAcD,0CAiBC;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ETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
const SCHEMA = 'lattice.bootstrap_diagnostics.v1';
|
|
2
|
-
const STATUS = 'bootstrap_ready';
|
|
3
|
-
const CONTRACT_REF = 'docs/00_product-contract.md';
|
|
4
|
-
const PLAN_REF = 'docs/plan_lattice.md';
|
|
5
|
-
const MAX_NODE_VERSION_LENGTH = 64;
|
|
6
|
-
|
|
7
|
-
function isPlainObject(value) {
|
|
8
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
9
|
-
&& Object.getPrototypeOf(value) === Object.prototype;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function hasExactKeys(value, keys) {
|
|
13
|
-
const actualKeys = Object.keys(value).sort();
|
|
14
|
-
const expectedKeys = [...keys].sort();
|
|
15
|
-
return actualKeys.length === expectedKeys.length
|
|
16
|
-
&& actualKeys.every((key, index) => key === expectedKeys[index]);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function isNodeVersion(value) {
|
|
20
|
-
return typeof value === 'string'
|
|
21
|
-
&& value.length > 1
|
|
22
|
-
&& value.length <= MAX_NODE_VERSION_LENGTH
|
|
23
|
-
&& /^v\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(value);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Builds the bounded, canonical bootstrap diagnostics object used by the CLI.
|
|
28
|
-
* @param {{ nodeVersion?: string }} options
|
|
29
|
-
* @returns {object}
|
|
30
|
-
*/
|
|
31
|
-
export function buildBootstrapDiagnostics({ nodeVersion = process.version } = {}) {
|
|
32
|
-
const diagnostics = {
|
|
33
|
-
schema: SCHEMA,
|
|
34
|
-
status: STATUS,
|
|
35
|
-
runtime: { node_version: nodeVersion },
|
|
36
|
-
references: {
|
|
37
|
-
contract: CONTRACT_REF,
|
|
38
|
-
plan: PLAN_REF,
|
|
39
|
-
},
|
|
40
|
-
implementation: {
|
|
41
|
-
boundary_compile: false,
|
|
42
|
-
recompile: false,
|
|
43
|
-
transform: false,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
if (!validateBootstrapDiagnostics(diagnostics)) {
|
|
48
|
-
throw new TypeError('invalid bootstrap diagnostics input');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return diagnostics;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Strictly validates the public bootstrap diagnostics schema.
|
|
56
|
-
* @param {unknown} value
|
|
57
|
-
* @returns {boolean}
|
|
58
|
-
*/
|
|
59
|
-
export function validateBootstrapDiagnostics(value) {
|
|
60
|
-
if (!isPlainObject(value) || !hasExactKeys(value, [
|
|
61
|
-
'schema', 'status', 'runtime', 'references', 'implementation',
|
|
62
|
-
])) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (value.schema !== SCHEMA || value.status !== STATUS) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (!isPlainObject(value.runtime)
|
|
71
|
-
|| !hasExactKeys(value.runtime, ['node_version'])
|
|
72
|
-
|| !isNodeVersion(value.runtime.node_version)) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (!isPlainObject(value.references)
|
|
77
|
-
|| !hasExactKeys(value.references, ['contract', 'plan'])
|
|
78
|
-
|| value.references.contract !== CONTRACT_REF
|
|
79
|
-
|| value.references.plan !== PLAN_REF) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return isPlainObject(value.implementation)
|
|
84
|
-
&& hasExactKeys(value.implementation, ['boundary_compile', 'recompile', 'transform'])
|
|
85
|
-
&& value.implementation.boundary_compile === false
|
|
86
|
-
&& value.implementation.recompile === false
|
|
87
|
-
&& value.implementation.transform === false;
|
|
88
|
-
}
|