@legioncodeinc/nectar 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +662 -0
- package/README.md +307 -0
- package/dist/api/daemon-api-wiring.d.ts +72 -0
- package/dist/api/daemon-api-wiring.d.ts.map +1 -0
- package/dist/api/daemon-api-wiring.js +150 -0
- package/dist/api/daemon-api-wiring.js.map +1 -0
- package/dist/api/hive-graph-api.d.ts +136 -0
- package/dist/api/hive-graph-api.d.ts.map +1 -0
- package/dist/api/hive-graph-api.js +234 -0
- package/dist/api/hive-graph-api.js.map +1 -0
- package/dist/api/loopback-client.d.ts +27 -0
- package/dist/api/loopback-client.d.ts.map +1 -0
- package/dist/api/loopback-client.js +87 -0
- package/dist/api/loopback-client.js.map +1 -0
- package/dist/api/router.d.ts +172 -0
- package/dist/api/router.d.ts.map +1 -0
- package/dist/api/router.js +212 -0
- package/dist/api/router.js.map +1 -0
- package/dist/api/status-query.d.ts +49 -0
- package/dist/api/status-query.d.ts.map +1 -0
- package/dist/api/status-query.js +103 -0
- package/dist/api/status-query.js.map +1 -0
- package/dist/brood-guard.d.ts +24 -0
- package/dist/brood-guard.d.ts.map +1 -0
- package/dist/brood-guard.js +19 -0
- package/dist/brood-guard.js.map +1 -0
- package/dist/brood-prereqs.d.ts +62 -0
- package/dist/brood-prereqs.d.ts.map +1 -0
- package/dist/brood-prereqs.js +87 -0
- package/dist/brood-prereqs.js.map +1 -0
- package/dist/brooding/bucketing.d.ts +68 -0
- package/dist/brooding/bucketing.d.ts.map +1 -0
- package/dist/brooding/bucketing.js +122 -0
- package/dist/brooding/bucketing.js.map +1 -0
- package/dist/brooding/cli.d.ts +78 -0
- package/dist/brooding/cli.d.ts.map +1 -0
- package/dist/brooding/cli.js +140 -0
- package/dist/brooding/cli.js.map +1 -0
- package/dist/brooding/constants.d.ts +75 -0
- package/dist/brooding/constants.d.ts.map +1 -0
- package/dist/brooding/constants.js +91 -0
- package/dist/brooding/constants.js.map +1 -0
- package/dist/brooding/cost.d.ts +110 -0
- package/dist/brooding/cost.d.ts.map +1 -0
- package/dist/brooding/cost.js +96 -0
- package/dist/brooding/cost.js.map +1 -0
- package/dist/brooding/describe.d.ts +152 -0
- package/dist/brooding/describe.d.ts.map +1 -0
- package/dist/brooding/describe.js +281 -0
- package/dist/brooding/describe.js.map +1 -0
- package/dist/brooding/discovery.d.ts +116 -0
- package/dist/brooding/discovery.d.ts.map +1 -0
- package/dist/brooding/discovery.js +179 -0
- package/dist/brooding/discovery.js.map +1 -0
- package/dist/brooding/index.d.ts +23 -0
- package/dist/brooding/index.d.ts.map +1 -0
- package/dist/brooding/index.js +33 -0
- package/dist/brooding/index.js.map +1 -0
- package/dist/brooding/pipeline-async.d.ts +97 -0
- package/dist/brooding/pipeline-async.d.ts.map +1 -0
- package/dist/brooding/pipeline-async.js +364 -0
- package/dist/brooding/pipeline-async.js.map +1 -0
- package/dist/brooding/pipeline.d.ts +198 -0
- package/dist/brooding/pipeline.d.ts.map +1 -0
- package/dist/brooding/pipeline.js +454 -0
- package/dist/brooding/pipeline.js.map +1 -0
- package/dist/brooding/precheck.d.ts +52 -0
- package/dist/brooding/precheck.d.ts.map +1 -0
- package/dist/brooding/precheck.js +143 -0
- package/dist/brooding/precheck.js.map +1 -0
- package/dist/brooding/resumability.d.ts +57 -0
- package/dist/brooding/resumability.d.ts.map +1 -0
- package/dist/brooding/resumability.js +46 -0
- package/dist/brooding/resumability.js.map +1 -0
- package/dist/cli.d.ts +139 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +912 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-file.d.ts +52 -0
- package/dist/config-file.d.ts.map +1 -0
- package/dist/config-file.js +130 -0
- package/dist/config-file.js.map +1 -0
- package/dist/config.d.ts +49 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +98 -0
- package/dist/config.js.map +1 -0
- package/dist/daemon.d.ts +265 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +664 -0
- package/dist/daemon.js.map +1 -0
- package/dist/doctor-registry.d.ts +134 -0
- package/dist/doctor-registry.d.ts.map +1 -0
- package/dist/doctor-registry.js +173 -0
- package/dist/doctor-registry.js.map +1 -0
- package/dist/embeddings/cohere-portkey.d.ts +67 -0
- package/dist/embeddings/cohere-portkey.d.ts.map +1 -0
- package/dist/embeddings/cohere-portkey.js +171 -0
- package/dist/embeddings/cohere-portkey.js.map +1 -0
- package/dist/embeddings/config.d.ts +74 -0
- package/dist/embeddings/config.d.ts.map +1 -0
- package/dist/embeddings/config.js +131 -0
- package/dist/embeddings/config.js.map +1 -0
- package/dist/embeddings/guard.d.ts +34 -0
- package/dist/embeddings/guard.d.ts.map +1 -0
- package/dist/embeddings/guard.js +67 -0
- package/dist/embeddings/guard.js.map +1 -0
- package/dist/embeddings/hosted-portkey.d.ts +73 -0
- package/dist/embeddings/hosted-portkey.d.ts.map +1 -0
- package/dist/embeddings/hosted-portkey.js +179 -0
- package/dist/embeddings/hosted-portkey.js.map +1 -0
- package/dist/embeddings/http.d.ts +33 -0
- package/dist/embeddings/http.d.ts.map +1 -0
- package/dist/embeddings/http.js +19 -0
- package/dist/embeddings/http.js.map +1 -0
- package/dist/embeddings/index.d.ts +17 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +17 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/embeddings/local-nomic.d.ts +78 -0
- package/dist/embeddings/local-nomic.d.ts.map +1 -0
- package/dist/embeddings/local-nomic.js +126 -0
- package/dist/embeddings/local-nomic.js.map +1 -0
- package/dist/embeddings/provider.d.ts +79 -0
- package/dist/embeddings/provider.d.ts.map +1 -0
- package/dist/embeddings/provider.js +50 -0
- package/dist/embeddings/provider.js.map +1 -0
- package/dist/enricher/config.d.ts +43 -0
- package/dist/enricher/config.d.ts.map +1 -0
- package/dist/enricher/config.js +34 -0
- package/dist/enricher/config.js.map +1 -0
- package/dist/enricher/content-cache.d.ts +29 -0
- package/dist/enricher/content-cache.d.ts.map +1 -0
- package/dist/enricher/content-cache.js +24 -0
- package/dist/enricher/content-cache.js.map +1 -0
- package/dist/enricher/cycle.d.ts +71 -0
- package/dist/enricher/cycle.d.ts.map +1 -0
- package/dist/enricher/cycle.js +319 -0
- package/dist/enricher/cycle.js.map +1 -0
- package/dist/enricher/describe.d.ts +61 -0
- package/dist/enricher/describe.d.ts.map +1 -0
- package/dist/enricher/describe.js +175 -0
- package/dist/enricher/describe.js.map +1 -0
- package/dist/enricher/failure.d.ts +25 -0
- package/dist/enricher/failure.d.ts.map +1 -0
- package/dist/enricher/failure.js +46 -0
- package/dist/enricher/failure.js.map +1 -0
- package/dist/enricher/index.d.ts +22 -0
- package/dist/enricher/index.d.ts.map +1 -0
- package/dist/enricher/index.js +22 -0
- package/dist/enricher/index.js.map +1 -0
- package/dist/enricher/jaccard.d.ts +11 -0
- package/dist/enricher/jaccard.d.ts.map +1 -0
- package/dist/enricher/jaccard.js +29 -0
- package/dist/enricher/jaccard.js.map +1 -0
- package/dist/enricher/loop.d.ts +22 -0
- package/dist/enricher/loop.d.ts.map +1 -0
- package/dist/enricher/loop.js +34 -0
- package/dist/enricher/loop.js.map +1 -0
- package/dist/enricher/meaningful-change.d.ts +28 -0
- package/dist/enricher/meaningful-change.d.ts.map +1 -0
- package/dist/enricher/meaningful-change.js +41 -0
- package/dist/enricher/meaningful-change.js.map +1 -0
- package/dist/enricher/observability.d.ts +22 -0
- package/dist/enricher/observability.d.ts.map +1 -0
- package/dist/enricher/observability.js +55 -0
- package/dist/enricher/observability.js.map +1 -0
- package/dist/enricher/pending-query.d.ts +35 -0
- package/dist/enricher/pending-query.d.ts.map +1 -0
- package/dist/enricher/pending-query.js +54 -0
- package/dist/enricher/pending-query.js.map +1 -0
- package/dist/enricher/sql-update.d.ts +7 -0
- package/dist/enricher/sql-update.d.ts.map +1 -0
- package/dist/enricher/sql-update.js +22 -0
- package/dist/enricher/sql-update.js.map +1 -0
- package/dist/enricher/store-adapter.d.ts +98 -0
- package/dist/enricher/store-adapter.d.ts.map +1 -0
- package/dist/enricher/store-adapter.js +129 -0
- package/dist/enricher/store-adapter.js.map +1 -0
- package/dist/enricher/store.d.ts +58 -0
- package/dist/enricher/store.d.ts.map +1 -0
- package/dist/enricher/store.js +126 -0
- package/dist/enricher/store.js.map +1 -0
- package/dist/enricher/tokenize.d.ts +10 -0
- package/dist/enricher/tokenize.d.ts.map +1 -0
- package/dist/enricher/tokenize.js +28 -0
- package/dist/enricher/tokenize.js.map +1 -0
- package/dist/errors.d.ts +41 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +56 -0
- package/dist/errors.js.map +1 -0
- package/dist/health.d.ts +147 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +168 -0
- package/dist/health.js.map +1 -0
- package/dist/hive-graph/deeplake-credentials.d.ts +68 -0
- package/dist/hive-graph/deeplake-credentials.d.ts.map +1 -0
- package/dist/hive-graph/deeplake-credentials.js +135 -0
- package/dist/hive-graph/deeplake-credentials.js.map +1 -0
- package/dist/hive-graph/deeplake-heal.d.ts +63 -0
- package/dist/hive-graph/deeplake-heal.d.ts.map +1 -0
- package/dist/hive-graph/deeplake-heal.js +118 -0
- package/dist/hive-graph/deeplake-heal.js.map +1 -0
- package/dist/hive-graph/deeplake-store.d.ts +199 -0
- package/dist/hive-graph/deeplake-store.d.ts.map +1 -0
- package/dist/hive-graph/deeplake-store.js +541 -0
- package/dist/hive-graph/deeplake-store.js.map +1 -0
- package/dist/hive-graph/deeplake-transport.d.ts +89 -0
- package/dist/hive-graph/deeplake-transport.d.ts.map +1 -0
- package/dist/hive-graph/deeplake-transport.js +145 -0
- package/dist/hive-graph/deeplake-transport.js.map +1 -0
- package/dist/hive-graph/hash.d.ts +3 -0
- package/dist/hive-graph/hash.d.ts.map +1 -0
- package/dist/hive-graph/hash.js +12 -0
- package/dist/hive-graph/hash.js.map +1 -0
- package/dist/hive-graph/memory-store.d.ts +39 -0
- package/dist/hive-graph/memory-store.d.ts.map +1 -0
- package/dist/hive-graph/memory-store.js +125 -0
- package/dist/hive-graph/memory-store.js.map +1 -0
- package/dist/hive-graph/model.d.ts +109 -0
- package/dist/hive-graph/model.d.ts.map +1 -0
- package/dist/hive-graph/model.js +36 -0
- package/dist/hive-graph/model.js.map +1 -0
- package/dist/hive-graph/paths.d.ts +7 -0
- package/dist/hive-graph/paths.d.ts.map +1 -0
- package/dist/hive-graph/paths.js +26 -0
- package/dist/hive-graph/paths.js.map +1 -0
- package/dist/hive-graph/project-scope.d.ts +99 -0
- package/dist/hive-graph/project-scope.d.ts.map +1 -0
- package/dist/hive-graph/project-scope.js +286 -0
- package/dist/hive-graph/project-scope.js.map +1 -0
- package/dist/hive-graph/schema.d.ts +53 -0
- package/dist/hive-graph/schema.d.ts.map +1 -0
- package/dist/hive-graph/schema.js +139 -0
- package/dist/hive-graph/schema.js.map +1 -0
- package/dist/hive-graph/search-types.d.ts +82 -0
- package/dist/hive-graph/search-types.d.ts.map +1 -0
- package/dist/hive-graph/search-types.js +2 -0
- package/dist/hive-graph/search-types.js.map +1 -0
- package/dist/hive-graph/search.d.ts +51 -0
- package/dist/hive-graph/search.d.ts.map +1 -0
- package/dist/hive-graph/search.js +417 -0
- package/dist/hive-graph/search.js.map +1 -0
- package/dist/hive-graph/sql-guards.d.ts +99 -0
- package/dist/hive-graph/sql-guards.d.ts.map +1 -0
- package/dist/hive-graph/sql-guards.js +129 -0
- package/dist/hive-graph/sql-guards.js.map +1 -0
- package/dist/hive-graph/store.d.ts +151 -0
- package/dist/hive-graph/store.d.ts.map +1 -0
- package/dist/hive-graph/store.js +2 -0
- package/dist/hive-graph/store.js.map +1 -0
- package/dist/hive-graph/ulid.d.ts +14 -0
- package/dist/hive-graph/ulid.d.ts.map +1 -0
- package/dist/hive-graph/ulid.js +109 -0
- package/dist/hive-graph/ulid.js.map +1 -0
- package/dist/hivedoctor-registry.d.ts +111 -0
- package/dist/hivedoctor-registry.d.ts.map +1 -0
- package/dist/hivedoctor-registry.js +143 -0
- package/dist/hivedoctor-registry.js.map +1 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/lock.d.ts +66 -0
- package/dist/lock.d.ts.map +1 -0
- package/dist/lock.js +282 -0
- package/dist/lock.js.map +1 -0
- package/dist/poll-loop.d.ts +71 -0
- package/dist/poll-loop.d.ts.map +1 -0
- package/dist/poll-loop.js +130 -0
- package/dist/poll-loop.js.map +1 -0
- package/dist/portkey/config.d.ts +46 -0
- package/dist/portkey/config.d.ts.map +1 -0
- package/dist/portkey/config.js +68 -0
- package/dist/portkey/config.js.map +1 -0
- package/dist/portkey/describe-model.d.ts +53 -0
- package/dist/portkey/describe-model.d.ts.map +1 -0
- package/dist/portkey/describe-model.js +56 -0
- package/dist/portkey/describe-model.js.map +1 -0
- package/dist/portkey/headers.d.ts +31 -0
- package/dist/portkey/headers.d.ts.map +1 -0
- package/dist/portkey/headers.js +37 -0
- package/dist/portkey/headers.js.map +1 -0
- package/dist/portkey/transport.d.ts +89 -0
- package/dist/portkey/transport.d.ts.map +1 -0
- package/dist/portkey/transport.js +167 -0
- package/dist/portkey/transport.js.map +1 -0
- package/dist/projection/format.d.ts +51 -0
- package/dist/projection/format.d.ts.map +1 -0
- package/dist/projection/format.js +81 -0
- package/dist/projection/format.js.map +1 -0
- package/dist/projection/generate.d.ts +31 -0
- package/dist/projection/generate.d.ts.map +1 -0
- package/dist/projection/generate.js +83 -0
- package/dist/projection/generate.js.map +1 -0
- package/dist/projection/inherit.d.ts +27 -0
- package/dist/projection/inherit.d.ts.map +1 -0
- package/dist/projection/inherit.js +128 -0
- package/dist/projection/inherit.js.map +1 -0
- package/dist/projection/load.d.ts +47 -0
- package/dist/projection/load.d.ts.map +1 -0
- package/dist/projection/load.js +258 -0
- package/dist/projection/load.js.map +1 -0
- package/dist/projection/store-adapter.d.ts +42 -0
- package/dist/projection/store-adapter.d.ts.map +1 -0
- package/dist/projection/store-adapter.js +42 -0
- package/dist/projection/store-adapter.js.map +1 -0
- package/dist/projection/write.d.ts +79 -0
- package/dist/projection/write.d.ts.map +1 -0
- package/dist/projection/write.js +122 -0
- package/dist/projection/write.js.map +1 -0
- package/dist/registration/classify.d.ts +33 -0
- package/dist/registration/classify.d.ts.map +1 -0
- package/dist/registration/classify.js +32 -0
- package/dist/registration/classify.js.map +1 -0
- package/dist/registration/copy-detect.d.ts +22 -0
- package/dist/registration/copy-detect.d.ts.map +1 -0
- package/dist/registration/copy-detect.js +12 -0
- package/dist/registration/copy-detect.js.map +1 -0
- package/dist/registration/disk-fs.d.ts +41 -0
- package/dist/registration/disk-fs.d.ts.map +1 -0
- package/dist/registration/disk-fs.js +175 -0
- package/dist/registration/disk-fs.js.map +1 -0
- package/dist/registration/fs-watch.d.ts +114 -0
- package/dist/registration/fs-watch.d.ts.map +1 -0
- package/dist/registration/fs-watch.js +266 -0
- package/dist/registration/fs-watch.js.map +1 -0
- package/dist/registration/ignore.d.ts +77 -0
- package/dist/registration/ignore.d.ts.map +1 -0
- package/dist/registration/ignore.js +249 -0
- package/dist/registration/ignore.js.map +1 -0
- package/dist/registration/ladder.d.ts +211 -0
- package/dist/registration/ladder.d.ts.map +1 -0
- package/dist/registration/ladder.js +378 -0
- package/dist/registration/ladder.js.map +1 -0
- package/dist/registration/paths-safe.d.ts +21 -0
- package/dist/registration/paths-safe.d.ts.map +1 -0
- package/dist/registration/paths-safe.js +88 -0
- package/dist/registration/paths-safe.js.map +1 -0
- package/dist/registration/prune-cli.d.ts +48 -0
- package/dist/registration/prune-cli.d.ts.map +1 -0
- package/dist/registration/prune-cli.js +57 -0
- package/dist/registration/prune-cli.js.map +1 -0
- package/dist/registration/review-cli.d.ts +42 -0
- package/dist/registration/review-cli.d.ts.map +1 -0
- package/dist/registration/review-cli.js +110 -0
- package/dist/registration/review-cli.js.map +1 -0
- package/dist/registration/review-store.d.ts +73 -0
- package/dist/registration/review-store.d.ts.map +1 -0
- package/dist/registration/review-store.js +243 -0
- package/dist/registration/review-store.js.map +1 -0
- package/dist/registration/service.d.ts +196 -0
- package/dist/registration/service.d.ts.map +1 -0
- package/dist/registration/service.js +384 -0
- package/dist/registration/service.js.map +1 -0
- package/dist/registration/store-bridge.d.ts +133 -0
- package/dist/registration/store-bridge.d.ts.map +1 -0
- package/dist/registration/store-bridge.js +159 -0
- package/dist/registration/store-bridge.js.map +1 -0
- package/dist/registration/tlsh.d.ts +125 -0
- package/dist/registration/tlsh.d.ts.map +1 -0
- package/dist/registration/tlsh.js +274 -0
- package/dist/registration/tlsh.js.map +1 -0
- package/dist/server.d.ts +26 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +156 -0
- package/dist/server.js.map +1 -0
- package/dist/service/argv.d.ts +52 -0
- package/dist/service/argv.d.ts.map +1 -0
- package/dist/service/argv.js +127 -0
- package/dist/service/argv.js.map +1 -0
- package/dist/service/command-runner.d.ts +54 -0
- package/dist/service/command-runner.d.ts.map +1 -0
- package/dist/service/command-runner.js +55 -0
- package/dist/service/command-runner.js.map +1 -0
- package/dist/service/index.d.ts +83 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/service/index.js +270 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/platform.d.ts +110 -0
- package/dist/service/platform.d.ts.map +1 -0
- package/dist/service/platform.js +157 -0
- package/dist/service/platform.js.map +1 -0
- package/dist/service/templates.d.ts +88 -0
- package/dist/service/templates.d.ts.map +1 -0
- package/dist/service/templates.js +212 -0
- package/dist/service/templates.js.map +1 -0
- package/dist/source-graph/deeplake-credentials.d.ts +57 -0
- package/dist/source-graph/deeplake-credentials.d.ts.map +1 -0
- package/dist/source-graph/deeplake-credentials.js +109 -0
- package/dist/source-graph/deeplake-credentials.js.map +1 -0
- package/dist/source-graph/deeplake-heal.d.ts +53 -0
- package/dist/source-graph/deeplake-heal.d.ts.map +1 -0
- package/dist/source-graph/deeplake-heal.js +41 -0
- package/dist/source-graph/deeplake-heal.js.map +1 -0
- package/dist/source-graph/deeplake-store.d.ts +151 -0
- package/dist/source-graph/deeplake-store.d.ts.map +1 -0
- package/dist/source-graph/deeplake-store.js +389 -0
- package/dist/source-graph/deeplake-store.js.map +1 -0
- package/dist/source-graph/deeplake-transport.d.ts +74 -0
- package/dist/source-graph/deeplake-transport.d.ts.map +1 -0
- package/dist/source-graph/deeplake-transport.js +107 -0
- package/dist/source-graph/deeplake-transport.js.map +1 -0
- package/dist/source-graph/hash.d.ts +3 -0
- package/dist/source-graph/hash.d.ts.map +1 -0
- package/dist/source-graph/hash.js +12 -0
- package/dist/source-graph/hash.js.map +1 -0
- package/dist/source-graph/memory-store.d.ts +32 -0
- package/dist/source-graph/memory-store.d.ts.map +1 -0
- package/dist/source-graph/memory-store.js +81 -0
- package/dist/source-graph/memory-store.js.map +1 -0
- package/dist/source-graph/model.d.ts +102 -0
- package/dist/source-graph/model.d.ts.map +1 -0
- package/dist/source-graph/model.js +36 -0
- package/dist/source-graph/model.js.map +1 -0
- package/dist/source-graph/paths.d.ts +7 -0
- package/dist/source-graph/paths.d.ts.map +1 -0
- package/dist/source-graph/paths.js +26 -0
- package/dist/source-graph/paths.js.map +1 -0
- package/dist/source-graph/schema.d.ts +44 -0
- package/dist/source-graph/schema.d.ts.map +1 -0
- package/dist/source-graph/schema.js +123 -0
- package/dist/source-graph/schema.js.map +1 -0
- package/dist/source-graph/sql-guards.d.ts +99 -0
- package/dist/source-graph/sql-guards.d.ts.map +1 -0
- package/dist/source-graph/sql-guards.js +129 -0
- package/dist/source-graph/sql-guards.js.map +1 -0
- package/dist/source-graph/store.d.ts +101 -0
- package/dist/source-graph/store.d.ts.map +1 -0
- package/dist/source-graph/store.js +2 -0
- package/dist/source-graph/store.js.map +1 -0
- package/dist/source-graph/ulid.d.ts +9 -0
- package/dist/source-graph/ulid.d.ts.map +1 -0
- package/dist/source-graph/ulid.js +61 -0
- package/dist/source-graph/ulid.js.map +1 -0
- package/dist/telemetry/checkin.d.ts +66 -0
- package/dist/telemetry/checkin.d.ts.map +1 -0
- package/dist/telemetry/checkin.js +142 -0
- package/dist/telemetry/checkin.js.map +1 -0
- package/dist/telemetry/db.d.ts +34 -0
- package/dist/telemetry/db.d.ts.map +1 -0
- package/dist/telemetry/db.js +122 -0
- package/dist/telemetry/db.js.map +1 -0
- package/dist/telemetry/index.d.ts +76 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +98 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/logs.d.ts +83 -0
- package/dist/telemetry/logs.d.ts.map +1 -0
- package/dist/telemetry/logs.js +110 -0
- package/dist/telemetry/logs.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +82 -0
- package/dist/telemetry/metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics.js +148 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/telemetry-usage/emit.d.ts +105 -0
- package/dist/telemetry-usage/emit.d.ts.map +1 -0
- package/dist/telemetry-usage/emit.js +267 -0
- package/dist/telemetry-usage/emit.js.map +1 -0
- package/dist/telemetry-usage/posthog-key.d.ts +22 -0
- package/dist/telemetry-usage/posthog-key.d.ts.map +1 -0
- package/dist/telemetry-usage/posthog-key.js +22 -0
- package/dist/telemetry-usage/posthog-key.js.map +1 -0
- package/dist/worker.d.ts +69 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +91 -0
- package/dist/worker.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin adapter over {@link HiveGraphStore} for projection generation (PRD-011).
|
|
3
|
+
*
|
|
4
|
+
* The exported store lists each nectar's absolute latest version via
|
|
5
|
+
* `listLatestVersions`. When that latest row is `described`, it is projected
|
|
6
|
+
* verbatim. When it is not described, a minimal entry (path + content_hash,
|
|
7
|
+
* empty title/description) is emitted per the corpus. The edge case where the
|
|
8
|
+
* absolute latest is pending but an older described version exists requires a
|
|
9
|
+
* store extension (`listVersionsForNectar` or equivalent); until wired, only
|
|
10
|
+
* the absolute latest is considered.
|
|
11
|
+
*/
|
|
12
|
+
import type { HiveGraphRow, HiveGraphVersionRow, Tenancy } from "../hive-graph/model.js";
|
|
13
|
+
import type { AsyncHiveGraphStore, HiveGraphStore } from "../hive-graph/store.js";
|
|
14
|
+
/** One nectar row selected for projection output. */
|
|
15
|
+
export interface ProjectionNectarSource {
|
|
16
|
+
readonly identity: HiveGraphRow;
|
|
17
|
+
readonly version: HiveGraphVersionRow;
|
|
18
|
+
}
|
|
19
|
+
export interface CollectProjectionSourcesOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Optional hook to resolve the latest described version when the store's
|
|
22
|
+
* absolute latest is not described. Integration can supply this once the
|
|
23
|
+
* store exposes per-nectar version history.
|
|
24
|
+
*/
|
|
25
|
+
readonly getLatestDescribedVersion?: (nectar: string) => HiveGraphVersionRow | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** Collect nectar/version pairs from the store, scoped to `tenancy`. */
|
|
28
|
+
export declare function collectProjectionSources(store: HiveGraphStore, tenancy: Tenancy, opts?: CollectProjectionSourcesOptions): ProjectionNectarSource[];
|
|
29
|
+
/**
|
|
30
|
+
* The async twin of {@link collectProjectionSources} for the durable
|
|
31
|
+
* {@link AsyncHiveGraphStore} (Deep Lake). The sync store's synchronous
|
|
32
|
+
* `getLatestDescribedVersion` hook cannot be honored over HTTP, so this reads
|
|
33
|
+
* both the latest version per nectar and the latest DESCRIBED version per nectar
|
|
34
|
+
* from the async store and overlays them: a nectar with a described version
|
|
35
|
+
* carries that version verbatim; a minted-but-undescribed nectar keeps its
|
|
36
|
+
* latest observed version (a minimal projection entry). This reproduces
|
|
37
|
+
* {@link pickVersion}'s "described if any, else latest" choice against the
|
|
38
|
+
* durable store without a sync bridge, and matches the PRD-011c scan (latest
|
|
39
|
+
* described version per nectar, scoped to the project).
|
|
40
|
+
*/
|
|
41
|
+
export declare function collectProjectionSourcesAsync(store: AsyncHiveGraphStore, tenancy: Tenancy): Promise<ProjectionNectarSource[]>;
|
|
42
|
+
//# sourceMappingURL=store-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-adapter.d.ts","sourceRoot":"","sources":["../../src/projection/store-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAElF,qDAAqD;AACrD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;CACvC;AAED,MAAM,WAAW,+BAA+B;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,mBAAmB,GAAG,SAAS,CAAC;CAC1F;AAYD,wEAAwE;AACxE,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,EAChB,IAAI,GAAE,+BAAoC,GACzC,sBAAsB,EAAE,CAM1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAWnC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function pickVersion(latest, getLatestDescribed) {
|
|
2
|
+
if (latest.describeStatus === "described")
|
|
3
|
+
return latest;
|
|
4
|
+
const described = getLatestDescribed?.(latest.nectar);
|
|
5
|
+
if (described !== undefined)
|
|
6
|
+
return described;
|
|
7
|
+
return latest;
|
|
8
|
+
}
|
|
9
|
+
/** Collect nectar/version pairs from the store, scoped to `tenancy`. */
|
|
10
|
+
export function collectProjectionSources(store, tenancy, opts = {}) {
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const { identity, version: latest } of store.listLatestVersions(tenancy)) {
|
|
13
|
+
out.push({ identity, version: pickVersion(latest, opts.getLatestDescribedVersion) });
|
|
14
|
+
}
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The async twin of {@link collectProjectionSources} for the durable
|
|
19
|
+
* {@link AsyncHiveGraphStore} (Deep Lake). The sync store's synchronous
|
|
20
|
+
* `getLatestDescribedVersion` hook cannot be honored over HTTP, so this reads
|
|
21
|
+
* both the latest version per nectar and the latest DESCRIBED version per nectar
|
|
22
|
+
* from the async store and overlays them: a nectar with a described version
|
|
23
|
+
* carries that version verbatim; a minted-but-undescribed nectar keeps its
|
|
24
|
+
* latest observed version (a minimal projection entry). This reproduces
|
|
25
|
+
* {@link pickVersion}'s "described if any, else latest" choice against the
|
|
26
|
+
* durable store without a sync bridge, and matches the PRD-011c scan (latest
|
|
27
|
+
* described version per nectar, scoped to the project).
|
|
28
|
+
*/
|
|
29
|
+
export async function collectProjectionSourcesAsync(store, tenancy) {
|
|
30
|
+
const [latest, described] = await Promise.all([
|
|
31
|
+
store.listLatestVersions(tenancy),
|
|
32
|
+
store.listLatestDescribedVersions(tenancy),
|
|
33
|
+
]);
|
|
34
|
+
const describedByNectar = new Map();
|
|
35
|
+
for (const { identity, version } of described)
|
|
36
|
+
describedByNectar.set(identity.nectar, version);
|
|
37
|
+
return latest.map(({ identity, version }) => ({
|
|
38
|
+
identity,
|
|
39
|
+
version: describedByNectar.get(identity.nectar) ?? version,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=store-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-adapter.js","sourceRoot":"","sources":["../../src/projection/store-adapter.ts"],"names":[],"mappings":"AA6BA,SAAS,WAAW,CAClB,MAA2B,EAC3B,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AQ;QACR,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO;KAC3D,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Tenancy } from "../hive-graph/model.js";
|
|
2
|
+
import type { AsyncHiveGraphStore, HiveGraphStore } from "../hive-graph/store.js";
|
|
3
|
+
import { type PortableProjection } from "./format.js";
|
|
4
|
+
import { type BuildProjectionFromStoreOptions, type BuildProjectionOptions } from "./generate.js";
|
|
5
|
+
export interface Timer {
|
|
6
|
+
set(fn: () => void, ms: number): unknown;
|
|
7
|
+
clear(handle: unknown): void;
|
|
8
|
+
}
|
|
9
|
+
/** Default timer backed by Node's global timers. */
|
|
10
|
+
export declare const realTimer: Timer;
|
|
11
|
+
export declare const DEFAULT_WRITE_DEBOUNCE_MS = 30000;
|
|
12
|
+
export interface WriteProjectionOptions {
|
|
13
|
+
/** Project root; final path is join(root, relPath). */
|
|
14
|
+
readonly projectRoot: string;
|
|
15
|
+
readonly relPath?: string;
|
|
16
|
+
readonly pid?: number;
|
|
17
|
+
readonly nowMs?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function projectionFinalPath(projectRoot: string, relPath?: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Serialize and write atomically (temp + rename). A crash mid-write leaves the
|
|
22
|
+
* prior final file intact (AC-1).
|
|
23
|
+
*/
|
|
24
|
+
export declare function writeProjectionAtomic(doc: PortableProjection, opts: WriteProjectionOptions): string;
|
|
25
|
+
export interface ProjectionWriterOptions {
|
|
26
|
+
readonly projectRoot: string;
|
|
27
|
+
readonly relPath?: string;
|
|
28
|
+
readonly debounceMs?: number;
|
|
29
|
+
readonly timer?: Timer;
|
|
30
|
+
readonly pid?: number;
|
|
31
|
+
readonly nowMs?: () => number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Debounced writer for triggers #1 (end of brooding) and #2 (end of enricher
|
|
35
|
+
* cycle). Coalesces rapid rewrites into one flush after `debounceMs`.
|
|
36
|
+
*/
|
|
37
|
+
export declare class ProjectionWriter {
|
|
38
|
+
private readonly projectRoot;
|
|
39
|
+
private readonly relPath;
|
|
40
|
+
private readonly debounceMs;
|
|
41
|
+
private readonly timer;
|
|
42
|
+
private readonly pid;
|
|
43
|
+
private readonly nowMs;
|
|
44
|
+
private pending;
|
|
45
|
+
private handle;
|
|
46
|
+
constructor(opts: ProjectionWriterOptions);
|
|
47
|
+
/** Queue a debounced rewrite (AC-2). */
|
|
48
|
+
scheduleWrite(doc: PortableProjection): void;
|
|
49
|
+
/** Cancel a pending debounced write without flushing. */
|
|
50
|
+
cancelPending(): void;
|
|
51
|
+
/** Flush immediately if a write is queued (for tests). */
|
|
52
|
+
flushNow(): string | null;
|
|
53
|
+
get hasPending(): boolean;
|
|
54
|
+
private flushPending;
|
|
55
|
+
}
|
|
56
|
+
export interface RebuildProjectionOptions extends WriteProjectionOptions, BuildProjectionFromStoreOptions {
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Full regeneration from the store (trigger #3). Scans latest described per
|
|
60
|
+
* nectar and writes immediately, bypassing debounce (AC-3).
|
|
61
|
+
*/
|
|
62
|
+
export declare function rebuildProjection(store: HiveGraphStore, tenancy: Tenancy, opts: RebuildProjectionOptions): {
|
|
63
|
+
doc: PortableProjection;
|
|
64
|
+
path: string;
|
|
65
|
+
};
|
|
66
|
+
export interface RebuildProjectionAsyncOptions extends WriteProjectionOptions, BuildProjectionOptions {
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Full regeneration from the durable {@link AsyncHiveGraphStore} (Deep Lake),
|
|
70
|
+
* trigger #3 (PRD-011c). The async twin of {@link rebuildProjection}: it scans
|
|
71
|
+
* the latest described version per nectar (scoped to the project) and writes
|
|
72
|
+
* immediately, bypassing debounce (AC-3). The `nectar rebuild-projection`
|
|
73
|
+
* CLI verb calls this against the real `DeepLakeHiveGraphStore`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function rebuildProjectionAsync(store: AsyncHiveGraphStore, tenancy: Tenancy, opts: RebuildProjectionAsyncOptions): Promise<{
|
|
76
|
+
doc: PortableProjection;
|
|
77
|
+
path: string;
|
|
78
|
+
}>;
|
|
79
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/projection/write.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,+BAA+B,EACpC,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,KAAK;IACpB,GAAG,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACzC,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED,oDAAoD;AACpD,eAAO,MAAM,SAAS,EAAE,KAGvB,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,MAAoC,GAC5C,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,kBAAkB,EACvB,IAAI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,CAI3C;AAED,MAAM,WAAW,6BAA8B,SAAQ,sBAAsB,EAAE,sBAAsB;CAAG;AAExG;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC;IAAE,GAAG,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAIpD"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomic projection writer and debounced rewrite seam (PRD-011a).
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the CodeGraph `writeSnapshotAtomic` pattern: temp file in the same
|
|
5
|
+
* directory, then `renameSync`. Trigger #1/#2 use the debounced writer; trigger
|
|
6
|
+
* #3 (`rebuildProjection`) bypasses debounce and writes immediately (AC-3).
|
|
7
|
+
*/
|
|
8
|
+
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
|
+
import { DEFAULT_PROJECTION_REL_PATH, canonicalSerialize, } from "./format.js";
|
|
11
|
+
import { buildProjectionFromAsyncStore, buildProjectionFromStore, } from "./generate.js";
|
|
12
|
+
/** Default timer backed by Node's global timers. */
|
|
13
|
+
export const realTimer = {
|
|
14
|
+
set: (fn, ms) => setTimeout(fn, ms),
|
|
15
|
+
clear: (handle) => clearTimeout(handle),
|
|
16
|
+
};
|
|
17
|
+
export const DEFAULT_WRITE_DEBOUNCE_MS = 30_000;
|
|
18
|
+
export function projectionFinalPath(projectRoot, relPath = DEFAULT_PROJECTION_REL_PATH) {
|
|
19
|
+
return join(projectRoot, relPath);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Serialize and write atomically (temp + rename). A crash mid-write leaves the
|
|
23
|
+
* prior final file intact (AC-1).
|
|
24
|
+
*/
|
|
25
|
+
export function writeProjectionAtomic(doc, opts) {
|
|
26
|
+
const relPath = opts.relPath ?? DEFAULT_PROJECTION_REL_PATH;
|
|
27
|
+
const finalPath = projectionFinalPath(opts.projectRoot, relPath);
|
|
28
|
+
const dir = dirname(finalPath);
|
|
29
|
+
mkdirSync(dir, { recursive: true });
|
|
30
|
+
const baseName = relPath.split(/[/\\]/).pop() ?? "nectars.json";
|
|
31
|
+
const pid = opts.pid ?? process.pid;
|
|
32
|
+
const now = opts.nowMs ?? Date.now();
|
|
33
|
+
const tmpPath = join(dir, `.${baseName}.${pid}.${now}.tmp`);
|
|
34
|
+
writeFileSync(tmpPath, canonicalSerialize(doc), "utf8");
|
|
35
|
+
renameSync(tmpPath, finalPath);
|
|
36
|
+
return finalPath;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Debounced writer for triggers #1 (end of brooding) and #2 (end of enricher
|
|
40
|
+
* cycle). Coalesces rapid rewrites into one flush after `debounceMs`.
|
|
41
|
+
*/
|
|
42
|
+
export class ProjectionWriter {
|
|
43
|
+
projectRoot;
|
|
44
|
+
relPath;
|
|
45
|
+
debounceMs;
|
|
46
|
+
timer;
|
|
47
|
+
pid;
|
|
48
|
+
nowMs;
|
|
49
|
+
pending = null;
|
|
50
|
+
handle = null;
|
|
51
|
+
constructor(opts) {
|
|
52
|
+
this.projectRoot = opts.projectRoot;
|
|
53
|
+
this.relPath = opts.relPath ?? DEFAULT_PROJECTION_REL_PATH;
|
|
54
|
+
this.debounceMs = opts.debounceMs ?? DEFAULT_WRITE_DEBOUNCE_MS;
|
|
55
|
+
this.timer = opts.timer ?? realTimer;
|
|
56
|
+
this.pid = opts.pid ?? process.pid;
|
|
57
|
+
this.nowMs = opts.nowMs ?? (() => Date.now());
|
|
58
|
+
}
|
|
59
|
+
/** Queue a debounced rewrite (AC-2). */
|
|
60
|
+
scheduleWrite(doc) {
|
|
61
|
+
this.pending = doc;
|
|
62
|
+
if (this.handle !== null)
|
|
63
|
+
this.timer.clear(this.handle);
|
|
64
|
+
this.handle = this.timer.set(() => {
|
|
65
|
+
this.handle = null;
|
|
66
|
+
this.flushPending();
|
|
67
|
+
}, this.debounceMs);
|
|
68
|
+
}
|
|
69
|
+
/** Cancel a pending debounced write without flushing. */
|
|
70
|
+
cancelPending() {
|
|
71
|
+
if (this.handle !== null) {
|
|
72
|
+
this.timer.clear(this.handle);
|
|
73
|
+
this.handle = null;
|
|
74
|
+
}
|
|
75
|
+
this.pending = null;
|
|
76
|
+
}
|
|
77
|
+
/** Flush immediately if a write is queued (for tests). */
|
|
78
|
+
flushNow() {
|
|
79
|
+
if (this.handle !== null) {
|
|
80
|
+
this.timer.clear(this.handle);
|
|
81
|
+
this.handle = null;
|
|
82
|
+
}
|
|
83
|
+
return this.flushPending();
|
|
84
|
+
}
|
|
85
|
+
get hasPending() {
|
|
86
|
+
return this.pending !== null;
|
|
87
|
+
}
|
|
88
|
+
flushPending() {
|
|
89
|
+
const doc = this.pending;
|
|
90
|
+
if (doc === null)
|
|
91
|
+
return null;
|
|
92
|
+
this.pending = null;
|
|
93
|
+
return writeProjectionAtomic(doc, {
|
|
94
|
+
projectRoot: this.projectRoot,
|
|
95
|
+
relPath: this.relPath,
|
|
96
|
+
pid: this.pid,
|
|
97
|
+
nowMs: this.nowMs(),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Full regeneration from the store (trigger #3). Scans latest described per
|
|
103
|
+
* nectar and writes immediately, bypassing debounce (AC-3).
|
|
104
|
+
*/
|
|
105
|
+
export function rebuildProjection(store, tenancy, opts) {
|
|
106
|
+
const doc = buildProjectionFromStore(store, tenancy, opts);
|
|
107
|
+
const path = writeProjectionAtomic(doc, opts);
|
|
108
|
+
return { doc, path };
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Full regeneration from the durable {@link AsyncHiveGraphStore} (Deep Lake),
|
|
112
|
+
* trigger #3 (PRD-011c). The async twin of {@link rebuildProjection}: it scans
|
|
113
|
+
* the latest described version per nectar (scoped to the project) and writes
|
|
114
|
+
* immediately, bypassing debounce (AC-3). The `nectar rebuild-projection`
|
|
115
|
+
* CLI verb calls this against the real `DeepLakeHiveGraphStore`.
|
|
116
|
+
*/
|
|
117
|
+
export async function rebuildProjectionAsync(store, tenancy, opts) {
|
|
118
|
+
const doc = await buildProjectionFromAsyncStore(store, tenancy, opts);
|
|
119
|
+
const path = writeProjectionAtomic(doc, opts);
|
|
120
|
+
return { doc, path };
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/projection/write.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,GAEnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GAGzB,MAAM,eAAe,CAAC;AAOvB,oDAAoD;AACpD,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;IACnC,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAuC,CAAC;CACzE,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAUhD,MAAM,UAAU,mBAAmB,CACjC,WAAmB,EACnB,UAAkB,2BAA2B;IAE7C,OAAO,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAuB,EACvB,IAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,2BAA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AAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;QACzB,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,qBAAqB,CAAC,GAAG,EAAE;YAChC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;SACpB,CAAC,CAAC;IACL,CAAC;CACF;AAID;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAqB,EACrB,OAAgB,EAChB,IAA8B;IAE9B,MAAM,GAAG,GAAG,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC;AAID;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,KAA0B,EAC1B,OAAgB,EAChB,IAAmC;IAEnC,MAAM,GAAG,GAAG,MAAM,6BAA6B,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event-to-ladder-step classification (PRD-006b).
|
|
3
|
+
*
|
|
4
|
+
* A pure function that maps a debounced path observation to exactly one of the
|
|
5
|
+
* three inputs the re-association ladder consumes: a new path (exists, no nectar),
|
|
6
|
+
* a changed path (exists, has a nectar; the ladder still hashes to decide no-op
|
|
7
|
+
* vs edit), or a missing path (a known nectar's path is gone from disk). A path
|
|
8
|
+
* that neither exists nor is known is a no-op (for example a temp file created
|
|
9
|
+
* and deleted inside the debounce window) and classifies to null.
|
|
10
|
+
*
|
|
11
|
+
* PRD-018c NEC-034 / AC-018c.8: the `known` lookup takes an optional `fold`
|
|
12
|
+
* function so a case-insensitive workspace can compare case-folded (the
|
|
13
|
+
* caller pre-folds `knownPaths`'s entries with the SAME function, service.ts's
|
|
14
|
+
* `knownPaths()`). `fold` defaults to the identity, preserving case-sensitive
|
|
15
|
+
* behavior. The RETURNED `relPath` is always `obs.relPath` verbatim - the
|
|
16
|
+
* fold is a lookup-only concern; stored rows keep the observed on-disk casing.
|
|
17
|
+
*/
|
|
18
|
+
export interface PathObservation {
|
|
19
|
+
readonly relPath: string;
|
|
20
|
+
readonly existsOnDisk: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type LadderInputKind = "new-path" | "changed-path" | "missing-path";
|
|
23
|
+
export interface LadderInput {
|
|
24
|
+
readonly kind: LadderInputKind;
|
|
25
|
+
readonly relPath: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Classify one observation against the set of paths currently known to the store
|
|
29
|
+
* (from `store.listLatestVersions(...)` -> version.path). Returns null when there
|
|
30
|
+
* is nothing to do.
|
|
31
|
+
*/
|
|
32
|
+
export declare function classifyPath(obs: PathObservation, knownPaths: ReadonlySet<string>, fold?: (relPath: string) => string): LadderInput | null;
|
|
33
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/registration/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,cAAc,GAAG,cAAc,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,eAAe,EACpB,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,EAC/B,IAAI,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAA6B,GACvD,WAAW,GAAG,IAAI,CAOpB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event-to-ladder-step classification (PRD-006b).
|
|
3
|
+
*
|
|
4
|
+
* A pure function that maps a debounced path observation to exactly one of the
|
|
5
|
+
* three inputs the re-association ladder consumes: a new path (exists, no nectar),
|
|
6
|
+
* a changed path (exists, has a nectar; the ladder still hashes to decide no-op
|
|
7
|
+
* vs edit), or a missing path (a known nectar's path is gone from disk). A path
|
|
8
|
+
* that neither exists nor is known is a no-op (for example a temp file created
|
|
9
|
+
* and deleted inside the debounce window) and classifies to null.
|
|
10
|
+
*
|
|
11
|
+
* PRD-018c NEC-034 / AC-018c.8: the `known` lookup takes an optional `fold`
|
|
12
|
+
* function so a case-insensitive workspace can compare case-folded (the
|
|
13
|
+
* caller pre-folds `knownPaths`'s entries with the SAME function, service.ts's
|
|
14
|
+
* `knownPaths()`). `fold` defaults to the identity, preserving case-sensitive
|
|
15
|
+
* behavior. The RETURNED `relPath` is always `obs.relPath` verbatim - the
|
|
16
|
+
* fold is a lookup-only concern; stored rows keep the observed on-disk casing.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Classify one observation against the set of paths currently known to the store
|
|
20
|
+
* (from `store.listLatestVersions(...)` -> version.path). Returns null when there
|
|
21
|
+
* is nothing to do.
|
|
22
|
+
*/
|
|
23
|
+
export function classifyPath(obs, knownPaths, fold = (relPath) => relPath) {
|
|
24
|
+
const known = knownPaths.has(fold(obs.relPath));
|
|
25
|
+
if (obs.existsOnDisk) {
|
|
26
|
+
return { kind: known ? "changed-path" : "new-path", relPath: obs.relPath };
|
|
27
|
+
}
|
|
28
|
+
if (known)
|
|
29
|
+
return { kind: "missing-path", relPath: obs.relPath };
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=classify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/registration/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,GAAoB,EACpB,UAA+B,EAC/B,OAAoC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO;IAExD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;QACrB,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;IAC7E,CAAC;IACD,IAAI,KAAK;QAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;IACjE,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy-paste detection (PRD-006c), from ai/identity-and-reassociation.md.
|
|
3
|
+
*
|
|
4
|
+
* When a new path's content hash equals some existing nectar's LATEST version
|
|
5
|
+
* hash, that is a copy event: the new file gets a fresh nectar with
|
|
6
|
+
* `derived_from_nectar` pointing at the source and `fork_content_hash` = the
|
|
7
|
+
* shared content hash. Otherwise it is a genuinely new file and mints plainly.
|
|
8
|
+
*
|
|
9
|
+
* This is the step-5 decision for a new path that is NOT a move (moves are caught
|
|
10
|
+
* earlier by the ladder's step 3, gated on the source path being gone from disk).
|
|
11
|
+
*/
|
|
12
|
+
import type { Tenancy } from "../hive-graph/model.js";
|
|
13
|
+
import type { HiveGraphStore } from "../hive-graph/store.js";
|
|
14
|
+
export type NewFileDecision = {
|
|
15
|
+
readonly action: "mint";
|
|
16
|
+
} | {
|
|
17
|
+
readonly action: "copy";
|
|
18
|
+
readonly sourceNectar: string;
|
|
19
|
+
readonly forkContentHash: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function classifyNewFile(store: HiveGraphStore, tenancy: Tenancy, newContentHash: string): NewFileDecision;
|
|
22
|
+
//# sourceMappingURL=copy-detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-detect.d.ts","sourceRoot":"","sources":["../../src/registration/copy-detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjG,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACrB,eAAe,CAUjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function classifyNewFile(store, tenancy, newContentHash) {
|
|
2
|
+
const existing = store.latestVersionByHash(tenancy, newContentHash);
|
|
3
|
+
if (existing !== undefined) {
|
|
4
|
+
return {
|
|
5
|
+
action: "copy",
|
|
6
|
+
sourceNectar: existing.identity.nectar,
|
|
7
|
+
forkContentHash: newContentHash,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return { action: "mint" };
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=copy-detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-detect.js","sourceRoot":"","sources":["../../src/registration/copy-detect.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,eAAe,CAC7B,KAAqB,EACrB,OAAgB,EAChB,cAAsB;IAEtB,MAAM,QAAQ,GAAG,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACpE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO;YACL,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;YACtC,eAAe,EAAE,cAAc;SAChC,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A real-disk {@link RegistrationFs} with workspace-path containment (CWE-22).
|
|
3
|
+
*
|
|
4
|
+
* This is the concrete filesystem seam the daemon uses to stat, read, and list
|
|
5
|
+
* files under the workspace root. Every disk access is clamped by
|
|
6
|
+
* {@link realpathContained}: a path that is absolute, contains a `..` segment,
|
|
7
|
+
* or (via a symlink) resolves outside the real workspace root is refused before
|
|
8
|
+
* any `stat`/`read`, and `listPaths` never follows a symlink out of the tree.
|
|
9
|
+
* Tests and local dev may still inject an in-memory `RegistrationFs`; this is
|
|
10
|
+
* the production disk implementation.
|
|
11
|
+
*
|
|
12
|
+
* PRD-018c NEC-007 point 2 / AC-018c.4: `walk` takes an ignore predicate and
|
|
13
|
+
* prunes an ignored DIRECTORY at descent time (never `readdirSync`s into it),
|
|
14
|
+
* instead of enumerating the whole subtree and filtering per yielded path.
|
|
15
|
+
*/
|
|
16
|
+
import { statSync, type Dirent } from "node:fs";
|
|
17
|
+
import type { IgnorePredicate } from "./ignore.js";
|
|
18
|
+
import type { RegistrationFs } from "./service.js";
|
|
19
|
+
/** The directory-listing seam `walk` uses. Injectable so a test can prove descent-time pruning by counting visited directories (default: `node:fs`'s real `readdirSync`). */
|
|
20
|
+
export type ReadDirSync = (dir: string) => Dirent[];
|
|
21
|
+
export declare function createDiskRegistrationFs(root: string, isIgnored?: IgnorePredicate, readDirSync?: ReadDirSync): RegistrationFs;
|
|
22
|
+
/**
|
|
23
|
+
* Test/wiring seam for {@link probeCaseInsensitiveFs} (CodeRabbit PR-18
|
|
24
|
+
* finding #5): defaults to `node:fs`'s real `statSync`. Lets a test simulate
|
|
25
|
+
* the marker vanishing (or an EPERM/AV-interference-shaped fault) between the
|
|
26
|
+
* write and the re-stat without needing a real filesystem race.
|
|
27
|
+
*/
|
|
28
|
+
export interface ProbeCaseInsensitiveFsIo {
|
|
29
|
+
statSync: typeof statSync;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Probe whether `root`'s filesystem is case-insensitive (PRD-018c NEC-034 /
|
|
33
|
+
* AC-018c.8): a REAL filesystem probe, never a platform guess. Creates a
|
|
34
|
+
* uniquely-named marker file under `root`, then stats a case-flipped version
|
|
35
|
+
* of that same name; if it resolves to the identical inode, the volume is
|
|
36
|
+
* case-insensitive. Fails closed (returns `false`, i.e. case-SENSITIVE, the
|
|
37
|
+
* behavior-preserving default) when `root` is not writable/statable, so a
|
|
38
|
+
* probe failure never silently enables case-folding.
|
|
39
|
+
*/
|
|
40
|
+
export declare function probeCaseInsensitiveFs(root: string, io?: ProbeCaseInsensitiveFsIo): boolean;
|
|
41
|
+
//# sourceMappingURL=disk-fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disk-fs.d.ts","sourceRoot":"","sources":["../../src/registration/disk-fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAwC,QAAQ,EAA6B,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,cAAc,CAAC;AAqB/D,6KAA6K;AAC7K,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;AAIpD,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,eAA6B,EACxC,WAAW,GAAE,WAAgC,GAC5C,cAAc,CA2ChB;AA2BD;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,OAAO,QAAQ,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAE,wBAAuC,GAAG,OAAO,CAsCzG"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A real-disk {@link RegistrationFs} with workspace-path containment (CWE-22).
|
|
3
|
+
*
|
|
4
|
+
* This is the concrete filesystem seam the daemon uses to stat, read, and list
|
|
5
|
+
* files under the workspace root. Every disk access is clamped by
|
|
6
|
+
* {@link realpathContained}: a path that is absolute, contains a `..` segment,
|
|
7
|
+
* or (via a symlink) resolves outside the real workspace root is refused before
|
|
8
|
+
* any `stat`/`read`, and `listPaths` never follows a symlink out of the tree.
|
|
9
|
+
* Tests and local dev may still inject an in-memory `RegistrationFs`; this is
|
|
10
|
+
* the production disk implementation.
|
|
11
|
+
*
|
|
12
|
+
* PRD-018c NEC-007 point 2 / AC-018c.4: `walk` takes an ignore predicate and
|
|
13
|
+
* prunes an ignored DIRECTORY at descent time (never `readdirSync`s into it),
|
|
14
|
+
* instead of enumerating the whole subtree and filtering per yielded path.
|
|
15
|
+
*/
|
|
16
|
+
import { lstatSync, readdirSync, readFileSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { join, relative } from "node:path";
|
|
18
|
+
import { containedPath, isSafeRelPath, realpathContained } from "./paths-safe.js";
|
|
19
|
+
/**
|
|
20
|
+
* True when `rel` is itself a symlink (NEC-042 item 10 / AC-018l.17). `walk`
|
|
21
|
+
* already skips every symlink entry, but `statPath`/`existsOnDisk` resolved
|
|
22
|
+
* through symlinks (`realpathContained`), so a symlinked file registered via a
|
|
23
|
+
* live watch event was invisible to a resync walk. Skipping symlinks in both
|
|
24
|
+
* paths gives the watcher and the resync ONE contract (both skip, matching git).
|
|
25
|
+
* Uses `lstat` (does not follow the link); fails closed (not-a-symlink) when the
|
|
26
|
+
* path is unsafe or does not exist.
|
|
27
|
+
*/
|
|
28
|
+
function isSymlinkPath(root, rel) {
|
|
29
|
+
const literal = containedPath(root, rel);
|
|
30
|
+
if (literal === null)
|
|
31
|
+
return false;
|
|
32
|
+
try {
|
|
33
|
+
return lstatSync(literal).isSymbolicLink();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const defaultReadDirSync = (dir) => readdirSync(dir, { withFileTypes: true });
|
|
40
|
+
export function createDiskRegistrationFs(root, isIgnored = () => false, readDirSync = defaultReadDirSync) {
|
|
41
|
+
return {
|
|
42
|
+
statPath(rel) {
|
|
43
|
+
if (isSymlinkPath(root, rel))
|
|
44
|
+
return null; // AC-018l.17: skip symlinks, matching walk
|
|
45
|
+
const abs = realpathContained(root, rel);
|
|
46
|
+
if (abs === null)
|
|
47
|
+
return null; // escapes the workspace, or does not exist
|
|
48
|
+
let st;
|
|
49
|
+
try {
|
|
50
|
+
st = statSync(abs);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
if (!st.isFile())
|
|
56
|
+
return null;
|
|
57
|
+
return {
|
|
58
|
+
sizeBytes: st.size,
|
|
59
|
+
mtimeObserved: st.mtime.toISOString(),
|
|
60
|
+
readContent: () => readFileSync(abs),
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
existsOnDisk(rel) {
|
|
64
|
+
if (isSymlinkPath(root, rel))
|
|
65
|
+
return false; // AC-018l.17: skip symlinks, matching walk
|
|
66
|
+
const abs = realpathContained(root, rel);
|
|
67
|
+
if (abs === null)
|
|
68
|
+
return false;
|
|
69
|
+
try {
|
|
70
|
+
return statSync(abs).isFile(); // a directory (or anything non-file) is NOT a tracked path
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
/** True when `rel` currently exists on disk AS A DIRECTORY (PRD-018c NEC-008 / AC-018c.5). */
|
|
77
|
+
isDirectory(rel) {
|
|
78
|
+
const abs = realpathContained(root, rel);
|
|
79
|
+
if (abs === null)
|
|
80
|
+
return false;
|
|
81
|
+
try {
|
|
82
|
+
return statSync(abs).isDirectory();
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
listPaths() {
|
|
89
|
+
return walk(root, root, isIgnored, readDirSync);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Recursively yield repo-relative, forward-slashed file paths under `dir`,
|
|
95
|
+
* never following a symlink out of `root`. An ignored directory is pruned at
|
|
96
|
+
* descent time (AC-018c.4): `readDirSync` is never called on it.
|
|
97
|
+
*/
|
|
98
|
+
function* walk(root, dir, isIgnored, readDirSync) {
|
|
99
|
+
let entries;
|
|
100
|
+
try {
|
|
101
|
+
entries = readDirSync(dir);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
for (const entry of entries) {
|
|
107
|
+
if (entry.isSymbolicLink())
|
|
108
|
+
continue; // never follow a symlink (defeats symlink escape)
|
|
109
|
+
const abs = join(dir, entry.name);
|
|
110
|
+
const rel = relative(root, abs).replace(/\\/g, "/");
|
|
111
|
+
if (entry.isDirectory()) {
|
|
112
|
+
if (isIgnored(rel))
|
|
113
|
+
continue; // descent-time pruning: never readDirSync an ignored subtree
|
|
114
|
+
yield* walk(root, abs, isIgnored, readDirSync);
|
|
115
|
+
}
|
|
116
|
+
else if (entry.isFile()) {
|
|
117
|
+
if (isSafeRelPath(rel) && !isIgnored(rel))
|
|
118
|
+
yield rel;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Probe whether `root`'s filesystem is case-insensitive (PRD-018c NEC-034 /
|
|
124
|
+
* AC-018c.8): a REAL filesystem probe, never a platform guess. Creates a
|
|
125
|
+
* uniquely-named marker file under `root`, then stats a case-flipped version
|
|
126
|
+
* of that same name; if it resolves to the identical inode, the volume is
|
|
127
|
+
* case-insensitive. Fails closed (returns `false`, i.e. case-SENSITIVE, the
|
|
128
|
+
* behavior-preserving default) when `root` is not writable/statable, so a
|
|
129
|
+
* probe failure never silently enables case-folding.
|
|
130
|
+
*/
|
|
131
|
+
export function probeCaseInsensitiveFs(root, io = { statSync }) {
|
|
132
|
+
const base = `NectarCaseProbe-${process.pid.toString(36)}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
133
|
+
const lowerRel = base.toLowerCase();
|
|
134
|
+
const upperRel = base.toUpperCase();
|
|
135
|
+
const lowerAbs = join(root, lowerRel);
|
|
136
|
+
const upperAbs = join(root, upperRel);
|
|
137
|
+
try {
|
|
138
|
+
writeFileSync(lowerAbs, "", { flag: "wx" });
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return false; // cannot probe (root missing/unwritable) - assume case-sensitive
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
// CodeRabbit PR-18 finding #5: the post-write `statSync(lowerAbs)` itself
|
|
145
|
+
// can throw (EPERM, antivirus interference, a marker removed out from
|
|
146
|
+
// under us) just as readily as the case-flipped `statSync(upperAbs)`
|
|
147
|
+
// below already accounted for. An uncaught throw here used to bubble out
|
|
148
|
+
// of RegistrationService construction; wrap it the same way, failing
|
|
149
|
+
// closed (case-SENSITIVE) rather than crashing the caller.
|
|
150
|
+
let lowerStat;
|
|
151
|
+
try {
|
|
152
|
+
lowerStat = io.statSync(lowerAbs);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return false; // cannot re-stat our own marker -> assume case-sensitive
|
|
156
|
+
}
|
|
157
|
+
let upperStat;
|
|
158
|
+
try {
|
|
159
|
+
upperStat = io.statSync(upperAbs);
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return false; // the case-flipped name does not resolve -> case-sensitive
|
|
163
|
+
}
|
|
164
|
+
return lowerStat.ino === upperStat.ino && lowerStat.dev === upperStat.dev;
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
try {
|
|
168
|
+
unlinkSync(lowerAbs);
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// best-effort cleanup; a leftover probe marker is harmless and tiny
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=disk-fs.js.map
|