@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,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQL-safety escaping helpers for the Deep Lake adapter (PRD-005).
|
|
3
|
+
*
|
|
4
|
+
* Ported (not imported) from honeycomb's `src/daemon/storage/sql.ts`, per
|
|
5
|
+
* ADR-0002: nectar reaches Deep Lake over the network through its own
|
|
6
|
+
* client and never imports the honeycomb runtime in-process, so the escaping
|
|
7
|
+
* floor is mirrored here rather than shared across the process boundary.
|
|
8
|
+
*
|
|
9
|
+
* The Deep Lake HTTP query endpoint binds no parameters: every value is
|
|
10
|
+
* escaped and interpolated into the statement by hand before it is sent.
|
|
11
|
+
* There is no parameterized fallback to forget to use, so these helpers ARE
|
|
12
|
+
* the parameter binding. Every dynamic value the Deep Lake adapter builds
|
|
13
|
+
* (`schema.ts`'s `buildCreateTableSql`, `deeplake-store.ts`'s query builders)
|
|
14
|
+
* routes through `sqlStr` / `sqlLike` / `sqlIdent` / `sLiteral` / `eLiteral`.
|
|
15
|
+
*
|
|
16
|
+
* These functions are pure, synchronous, side-effect-free, and dependency-free
|
|
17
|
+
* beyond the language runtime (nectar's zero-runtime-dependency rule).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Escape a string for use inside a single-quoted SQL literal.
|
|
21
|
+
*
|
|
22
|
+
* Order matters: backslashes are doubled FIRST (so the backslash added for a
|
|
23
|
+
* doubled quote is not itself re-escaped), then single quotes are doubled,
|
|
24
|
+
* then NUL and the C0/C1 control characters are dropped. The result is the
|
|
25
|
+
* inner body of the literal; the caller wraps it in quotes (`'${sqlStr(v)}'`,
|
|
26
|
+
* or via {@link sLiteral}) or uses the `E'...'` form via {@link eLiteral} when
|
|
27
|
+
* the body carries escape sequences.
|
|
28
|
+
*
|
|
29
|
+
* Because every quote is doubled and every backslash is doubled, an injection
|
|
30
|
+
* payload like `'; DROP TABLE x; --` collapses to one inert literal: the
|
|
31
|
+
* embedded quote can never close the string early, so no second statement is
|
|
32
|
+
* ever produced.
|
|
33
|
+
*/
|
|
34
|
+
export declare function sqlStr(value: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Escape a string for use inside a `LIKE` / `ILIKE` pattern.
|
|
37
|
+
*
|
|
38
|
+
* Escapes the `LIKE` metacharacters (`%` and `_`) so a literal substring
|
|
39
|
+
* search is never reinterpreted as a wildcard match, alongside the same
|
|
40
|
+
* quote-doubling and control stripping {@link sqlStr} performs. Not currently
|
|
41
|
+
* exercised by the hive-graph store's equality-only reads, but ported
|
|
42
|
+
* alongside `sqlStr`/`sqlIdent` so a future prefix/substring query never has
|
|
43
|
+
* to reach for a hand-rolled escape.
|
|
44
|
+
*/
|
|
45
|
+
export declare function sqlLike(value: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Validate a table/column identifier against `^[a-zA-Z_][a-zA-Z0-9_]*$`.
|
|
48
|
+
* Returns the name UNCHANGED on success; throws on anything else.
|
|
49
|
+
*
|
|
50
|
+
* Strict by design: it THROWS rather than sanitizing, because a silently
|
|
51
|
+
* rewritten identifier would be a worse, harder-to-debug failure than a
|
|
52
|
+
* rejected one. Callers pass only known schema names (table and column
|
|
53
|
+
* identifiers from `HIVE_GRAPH_COLUMNS` / `HIVE_GRAPH_VERSIONS_COLUMNS`),
|
|
54
|
+
* so a rejection is always a programmer error worth surfacing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function sqlIdent(name: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Build an ordinary single-quoted literal from a value. Thin convenience
|
|
59
|
+
* around `'${sqlStr(v)}'` so call sites read as a builder call rather than raw
|
|
60
|
+
* quote assembly. Use for ids, paths, hashes, enum-like values, and dates.
|
|
61
|
+
* Use {@link eLiteral} instead when the body may carry escape sequences
|
|
62
|
+
* (free-text title/description/concepts).
|
|
63
|
+
*/
|
|
64
|
+
export declare function sLiteral(value: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Build an `E'...'` escape-string literal from a raw text body.
|
|
67
|
+
*
|
|
68
|
+
* Free-text bodies that may contain escape sequences (a description or title
|
|
69
|
+
* with a literal backslash) must use the `E'...'` form so the
|
|
70
|
+
* doubled-backslash escaping from {@link sqlStr} round-trips to the intended
|
|
71
|
+
* bytes; a plain `'...'` literal for a body with backslashes would corrupt it.
|
|
72
|
+
*/
|
|
73
|
+
export declare function eLiteral(body: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* Validate and render a numeric value for bare (unquoted) SQL interpolation.
|
|
76
|
+
* Throws unless `value` is, at runtime, a finite JavaScript `number` -
|
|
77
|
+
* TypeScript's `number` type is erased at runtime, so a value that merely
|
|
78
|
+
* carries the `number` type at compile time (e.g. `row.seq`, `row.sizeBytes`,
|
|
79
|
+
* `row.confidence`, or one entry of an embedding vector) is not actually
|
|
80
|
+
* guaranteed to be a safe, quote-free numeric literal unless this is checked
|
|
81
|
+
* here. Without this guard, a non-numeric value smuggled past the type
|
|
82
|
+
* system (a string, `NaN`, `Infinity`, or an object) would be interpolated
|
|
83
|
+
* bare via `String(value)` with no escaping at all - the same injection
|
|
84
|
+
* shape `sqlStr`/`sqlIdent` close for text and identifiers, just for the
|
|
85
|
+
* numeric case. Rejects `NaN`/`Infinity`/`-Infinity` too, since those are not
|
|
86
|
+
* valid bare-numeric SQL tokens.
|
|
87
|
+
*/
|
|
88
|
+
export declare function sqlNum(value: number): string;
|
|
89
|
+
/**
|
|
90
|
+
* Serialize a `number[]` to a `FLOAT4[]` SQL literal (`ARRAY[...]::float4[]`),
|
|
91
|
+
* mirroring honeycomb's `serializeFloat4Array` (`src/daemon/storage/vector.ts`).
|
|
92
|
+
* Every entry is validated via {@link sqlNum} before interpolation - the
|
|
93
|
+
* dimension contract (`isValidEmbedding`, 768) is a separate application-level
|
|
94
|
+
* check the caller is still responsible for, but this function does not rely
|
|
95
|
+
* on the caller to have validated *finiteness*: a non-numeric or non-finite
|
|
96
|
+
* entry throws here rather than being interpolated bare into the statement.
|
|
97
|
+
*/
|
|
98
|
+
export declare function sqlFloat4Array(vector: readonly number[]): string;
|
|
99
|
+
//# sourceMappingURL=sql-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-guards.d.ts","sourceRoot":"","sources":["../../src/hive-graph/sql-guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO5C;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAGhE"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQL-safety escaping helpers for the Deep Lake adapter (PRD-005).
|
|
3
|
+
*
|
|
4
|
+
* Ported (not imported) from honeycomb's `src/daemon/storage/sql.ts`, per
|
|
5
|
+
* ADR-0002: nectar reaches Deep Lake over the network through its own
|
|
6
|
+
* client and never imports the honeycomb runtime in-process, so the escaping
|
|
7
|
+
* floor is mirrored here rather than shared across the process boundary.
|
|
8
|
+
*
|
|
9
|
+
* The Deep Lake HTTP query endpoint binds no parameters: every value is
|
|
10
|
+
* escaped and interpolated into the statement by hand before it is sent.
|
|
11
|
+
* There is no parameterized fallback to forget to use, so these helpers ARE
|
|
12
|
+
* the parameter binding. Every dynamic value the Deep Lake adapter builds
|
|
13
|
+
* (`schema.ts`'s `buildCreateTableSql`, `deeplake-store.ts`'s query builders)
|
|
14
|
+
* routes through `sqlStr` / `sqlLike` / `sqlIdent` / `sLiteral` / `eLiteral`.
|
|
15
|
+
*
|
|
16
|
+
* These functions are pure, synchronous, side-effect-free, and dependency-free
|
|
17
|
+
* beyond the language runtime (nectar's zero-runtime-dependency rule).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Escape a string for use inside a single-quoted SQL literal.
|
|
21
|
+
*
|
|
22
|
+
* Order matters: backslashes are doubled FIRST (so the backslash added for a
|
|
23
|
+
* doubled quote is not itself re-escaped), then single quotes are doubled,
|
|
24
|
+
* then NUL and the C0/C1 control characters are dropped. The result is the
|
|
25
|
+
* inner body of the literal; the caller wraps it in quotes (`'${sqlStr(v)}'`,
|
|
26
|
+
* or via {@link sLiteral}) or uses the `E'...'` form via {@link eLiteral} when
|
|
27
|
+
* the body carries escape sequences.
|
|
28
|
+
*
|
|
29
|
+
* Because every quote is doubled and every backslash is doubled, an injection
|
|
30
|
+
* payload like `'; DROP TABLE x; --` collapses to one inert literal: the
|
|
31
|
+
* embedded quote can never close the string early, so no second statement is
|
|
32
|
+
* ever produced.
|
|
33
|
+
*/
|
|
34
|
+
export function sqlStr(value) {
|
|
35
|
+
return value
|
|
36
|
+
.replace(/\\/g, "\\\\")
|
|
37
|
+
.replace(/'/g, "''")
|
|
38
|
+
.replace(/\0/g, "")
|
|
39
|
+
// Drop C0 controls except \t (0x09) \n (0x0A) \r (0x0D), plus DEL (0x7f).
|
|
40
|
+
.replace(/[\x01-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Escape a string for use inside a `LIKE` / `ILIKE` pattern.
|
|
44
|
+
*
|
|
45
|
+
* Escapes the `LIKE` metacharacters (`%` and `_`) so a literal substring
|
|
46
|
+
* search is never reinterpreted as a wildcard match, alongside the same
|
|
47
|
+
* quote-doubling and control stripping {@link sqlStr} performs. Not currently
|
|
48
|
+
* exercised by the hive-graph store's equality-only reads, but ported
|
|
49
|
+
* alongside `sqlStr`/`sqlIdent` so a future prefix/substring query never has
|
|
50
|
+
* to reach for a hand-rolled escape.
|
|
51
|
+
*/
|
|
52
|
+
export function sqlLike(value) {
|
|
53
|
+
return value
|
|
54
|
+
.replace(/[\\%_]/g, "\\$&")
|
|
55
|
+
.replace(/'/g, "''")
|
|
56
|
+
.replace(/\0/g, "")
|
|
57
|
+
.replace(/[\x01-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Validate a table/column identifier against `^[a-zA-Z_][a-zA-Z0-9_]*$`.
|
|
61
|
+
* Returns the name UNCHANGED on success; throws on anything else.
|
|
62
|
+
*
|
|
63
|
+
* Strict by design: it THROWS rather than sanitizing, because a silently
|
|
64
|
+
* rewritten identifier would be a worse, harder-to-debug failure than a
|
|
65
|
+
* rejected one. Callers pass only known schema names (table and column
|
|
66
|
+
* identifiers from `HIVE_GRAPH_COLUMNS` / `HIVE_GRAPH_VERSIONS_COLUMNS`),
|
|
67
|
+
* so a rejection is always a programmer error worth surfacing.
|
|
68
|
+
*/
|
|
69
|
+
export function sqlIdent(name) {
|
|
70
|
+
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name)) {
|
|
71
|
+
throw new Error(`Invalid SQL identifier: ${JSON.stringify(name)}`);
|
|
72
|
+
}
|
|
73
|
+
return name;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build an ordinary single-quoted literal from a value. Thin convenience
|
|
77
|
+
* around `'${sqlStr(v)}'` so call sites read as a builder call rather than raw
|
|
78
|
+
* quote assembly. Use for ids, paths, hashes, enum-like values, and dates.
|
|
79
|
+
* Use {@link eLiteral} instead when the body may carry escape sequences
|
|
80
|
+
* (free-text title/description/concepts).
|
|
81
|
+
*/
|
|
82
|
+
export function sLiteral(value) {
|
|
83
|
+
return `'${sqlStr(value)}'`;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Build an `E'...'` escape-string literal from a raw text body.
|
|
87
|
+
*
|
|
88
|
+
* Free-text bodies that may contain escape sequences (a description or title
|
|
89
|
+
* with a literal backslash) must use the `E'...'` form so the
|
|
90
|
+
* doubled-backslash escaping from {@link sqlStr} round-trips to the intended
|
|
91
|
+
* bytes; a plain `'...'` literal for a body with backslashes would corrupt it.
|
|
92
|
+
*/
|
|
93
|
+
export function eLiteral(body) {
|
|
94
|
+
return `E'${sqlStr(body)}'`;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Validate and render a numeric value for bare (unquoted) SQL interpolation.
|
|
98
|
+
* Throws unless `value` is, at runtime, a finite JavaScript `number` -
|
|
99
|
+
* TypeScript's `number` type is erased at runtime, so a value that merely
|
|
100
|
+
* carries the `number` type at compile time (e.g. `row.seq`, `row.sizeBytes`,
|
|
101
|
+
* `row.confidence`, or one entry of an embedding vector) is not actually
|
|
102
|
+
* guaranteed to be a safe, quote-free numeric literal unless this is checked
|
|
103
|
+
* here. Without this guard, a non-numeric value smuggled past the type
|
|
104
|
+
* system (a string, `NaN`, `Infinity`, or an object) would be interpolated
|
|
105
|
+
* bare via `String(value)` with no escaping at all - the same injection
|
|
106
|
+
* shape `sqlStr`/`sqlIdent` close for text and identifiers, just for the
|
|
107
|
+
* numeric case. Rejects `NaN`/`Infinity`/`-Infinity` too, since those are not
|
|
108
|
+
* valid bare-numeric SQL tokens.
|
|
109
|
+
*/
|
|
110
|
+
export function sqlNum(value) {
|
|
111
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
112
|
+
throw new Error(`Invalid SQL numeric value: ${JSON.stringify(value)}`);
|
|
113
|
+
}
|
|
114
|
+
return String(value);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Serialize a `number[]` to a `FLOAT4[]` SQL literal (`ARRAY[...]::float4[]`),
|
|
118
|
+
* mirroring honeycomb's `serializeFloat4Array` (`src/daemon/storage/vector.ts`).
|
|
119
|
+
* Every entry is validated via {@link sqlNum} before interpolation - the
|
|
120
|
+
* dimension contract (`isValidEmbedding`, 768) is a separate application-level
|
|
121
|
+
* check the caller is still responsible for, but this function does not rely
|
|
122
|
+
* on the caller to have validated *finiteness*: a non-numeric or non-finite
|
|
123
|
+
* entry throws here rather than being interpolated bare into the statement.
|
|
124
|
+
*/
|
|
125
|
+
export function sqlFloat4Array(vector) {
|
|
126
|
+
const numbersLit = vector.map((v) => sqlNum(v)).join(",");
|
|
127
|
+
return `ARRAY[${numbersLit}]::float4[]`;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=sql-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-guards.js","sourceRoot":"","sources":["../../src/hive-graph/sql-guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,OAAO,KAAK;SACT,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QACnB,0EAA0E;SACzE,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,OAAO,KAAK;SACT,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,MAAyB;IACtD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1D,OAAO,SAAS,UAAU,aAAa,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HiveGraphStore seam (PRD-005).
|
|
3
|
+
*
|
|
4
|
+
* The interface both the in-memory adapter (PRD-005, this project, tests + local
|
|
5
|
+
* dev) and the future Deep Lake adapter (the real substrate, per ADR-0002 reached
|
|
6
|
+
* through nectar's own client) implement. The file-registration ladder
|
|
7
|
+
* (PRD-006) is written entirely against this interface, so it is testable with the
|
|
8
|
+
* in-memory adapter and unchanged when the Deep Lake adapter lands.
|
|
9
|
+
*
|
|
10
|
+
* All reads/writes are tenancy-scoped (org+workspace at the layer, project_id as a
|
|
11
|
+
* column filter, per PRD-005c). "latest version" always means MAX(seq) for a nectar.
|
|
12
|
+
*/
|
|
13
|
+
import type { HiveGraphRow, HiveGraphVersionRow, Tenancy } from "./model.js";
|
|
14
|
+
/** A candidate for re-association: a nectar plus its latest observed version. */
|
|
15
|
+
export interface LatestVersion {
|
|
16
|
+
readonly identity: HiveGraphRow;
|
|
17
|
+
readonly version: HiveGraphVersionRow;
|
|
18
|
+
}
|
|
19
|
+
export interface HiveGraphStore {
|
|
20
|
+
/** Insert a `hive_graph` identity row (mint). Throws if the nectar already exists. */
|
|
21
|
+
insertIdentity(row: HiveGraphRow): void;
|
|
22
|
+
/** Fetch an identity row by nectar, or undefined. */
|
|
23
|
+
getIdentity(nectar: string): HiveGraphRow | undefined;
|
|
24
|
+
/** Bump a nectar's `last_update_date` (called when a new version is appended). */
|
|
25
|
+
touchIdentity(nectar: string, lastUpdateDate: string): void;
|
|
26
|
+
/** Append a `hive_graph_versions` row. The caller supplies seq via `nextSeq`. */
|
|
27
|
+
appendVersion(row: HiveGraphVersionRow): void;
|
|
28
|
+
/** The next monotonic seq for a nectar (0 if it has no versions yet). */
|
|
29
|
+
nextSeq(nectar: string): number;
|
|
30
|
+
/** The latest (MAX seq) version row for a nectar, or undefined. */
|
|
31
|
+
latestVersion(nectar: string): HiveGraphVersionRow | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Every nectar's latest version, scoped to the tenancy. The ladder derives the
|
|
34
|
+
* known-paths set, the missing-files set, and the by-latest-hash copy index from this.
|
|
35
|
+
*/
|
|
36
|
+
listLatestVersions(tenancy: Tenancy): LatestVersion[];
|
|
37
|
+
/**
|
|
38
|
+
* Every nectar's latest DESCRIBED version, scoped to the tenancy: for each
|
|
39
|
+
* nectar that has at least one `describe_status = 'described'` version, the
|
|
40
|
+
* highest-seq described row. Nectars with no described version are omitted.
|
|
41
|
+
*
|
|
42
|
+
* This is the projection scan (PRD-011c / `data/portable-registry.md` §
|
|
43
|
+
* Generation and regeneration: "latest described version per nectar, scoped to
|
|
44
|
+
* the project"). The projection builder overlays this onto
|
|
45
|
+
* {@link listLatestVersions} so an undescribed nectar still keeps a minimal
|
|
46
|
+
* entry (identity + path + content_hash) while a described one carries the
|
|
47
|
+
* latest description verbatim.
|
|
48
|
+
*/
|
|
49
|
+
listLatestDescribedVersions(tenancy: Tenancy): LatestVersion[];
|
|
50
|
+
/** The latest version whose current path equals `path` (ladder steps 1-2), scoped. */
|
|
51
|
+
latestVersionByPath(tenancy: Tenancy, path: string): LatestVersion | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* A nectar whose latest version content_hash equals `contentHash` (ladder step 3
|
|
54
|
+
* exact-move, and the copy-event index), scoped. Returns the first match.
|
|
55
|
+
*/
|
|
56
|
+
latestVersionByHash(tenancy: Tenancy, contentHash: string): LatestVersion | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Delete a nectar (its identity row + every version row), scoped to `tenancy`.
|
|
59
|
+
* This is the SOLE nectar-deletion path (`prune --confirm`, PRD-006d); the
|
|
60
|
+
* re-association ladder never deletes or reuses nectars. A no-op if the nectar
|
|
61
|
+
* does not exist OR its identity is outside `tenancy` (a cross-project delete
|
|
62
|
+
* is refused, never applied, per AC-20).
|
|
63
|
+
*/
|
|
64
|
+
deleteNectar(tenancy: Tenancy, nectar: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Every `hive_graph` identity row, scoped to `tenancy` - INCLUDING an
|
|
67
|
+
* identity with zero `hive_graph_versions` rows (which
|
|
68
|
+
* {@link listLatestVersions} can never surface, since it joins through the
|
|
69
|
+
* latest version). OPTIONAL and ADDITIVE (PRD-018d): the ladder's crash-repair
|
|
70
|
+
* sweep (`repairLadderState`) uses this to find an orphan identity left by a
|
|
71
|
+
* mint crashing between `insertIdentity` and `appendVersion`. Omit on an
|
|
72
|
+
* adapter that has no cheap way to enumerate bare identities; the sweep skips
|
|
73
|
+
* orphan-identity healing (only) when this is undefined, and reports the gap
|
|
74
|
+
* rather than guessing.
|
|
75
|
+
*/
|
|
76
|
+
listIdentities?(tenancy: Tenancy): HiveGraphRow[];
|
|
77
|
+
/**
|
|
78
|
+
* Every distinct nectar that has AT LEAST ONE `hive_graph_versions` row,
|
|
79
|
+
* scoped to `tenancy` (via the version rows' own tenancy columns, since an
|
|
80
|
+
* orphan version's nectar may have no `hive_graph` identity row to scope
|
|
81
|
+
* against). OPTIONAL and ADDITIVE (PRD-018 close-out, CodeRabbit PR-18
|
|
82
|
+
* finding #8): the ladder's crash-repair sweep (`repairLadderState`) uses
|
|
83
|
+
* this, together with {@link getIdentity}, to find an orphan VERSION - a
|
|
84
|
+
* version row whose nectar has no matching identity (the inverse of the
|
|
85
|
+
* orphan-IDENTITY case {@link listIdentities} already heals) - left by a
|
|
86
|
+
* durable identity-insert flush that failed after a later version for the
|
|
87
|
+
* same nectar still landed. Omit on an adapter with no cheap way to
|
|
88
|
+
* enumerate distinct version nectars; the sweep skips orphan-version
|
|
89
|
+
* healing (only) when this is undefined.
|
|
90
|
+
*/
|
|
91
|
+
listVersionNectars?(tenancy: Tenancy): string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The async twin of {@link HiveGraphStore} (PRD-005's Deep Lake adapter).
|
|
95
|
+
*
|
|
96
|
+
* `HiveGraphStore` is synchronous by design: the in-memory adapter backs it
|
|
97
|
+
* with plain `Map`s, and the file-registration ladder (`registration/ladder.ts`)
|
|
98
|
+
* calls it synchronously throughout, with no `await` anywhere in the ladder's
|
|
99
|
+
* control flow. A real Deep Lake adapter does its work over HTTP and cannot
|
|
100
|
+
* honor that synchronous contract, so this is a SEPARATE interface with the
|
|
101
|
+
* same method names and semantics, each wrapped in a `Promise` — not a
|
|
102
|
+
* variant of `HiveGraphStore` and not a substitute for it.
|
|
103
|
+
*
|
|
104
|
+
* `DeepLakeHiveGraphStore` (`deeplake-store.ts`) implements this interface,
|
|
105
|
+
* not `HiveGraphStore`. Wiring the ladder to run against an async store is
|
|
106
|
+
* out of scope for PRD-005's adapter work: that would mean either making the
|
|
107
|
+
* ladder's own control flow async (touching `registration/ladder.ts`, which
|
|
108
|
+
* this task does not touch) or adapting between the two seams at the call
|
|
109
|
+
* site. Either is a future PRD's decision once a caller actually needs the
|
|
110
|
+
* durable adapter wired into the live worker loop; today `InMemoryHiveGraphStore`
|
|
111
|
+
* remains the ladder's only consumer and is unchanged by this addition.
|
|
112
|
+
*/
|
|
113
|
+
export interface AsyncHiveGraphStore {
|
|
114
|
+
/** Insert a `hive_graph` identity row (mint). Rejects if the nectar already exists. */
|
|
115
|
+
insertIdentity(row: HiveGraphRow): Promise<void>;
|
|
116
|
+
/** Fetch an identity row by nectar, or undefined. */
|
|
117
|
+
getIdentity(nectar: string): Promise<HiveGraphRow | undefined>;
|
|
118
|
+
/** Bump a nectar's `last_update_date` (called when a new version is appended). */
|
|
119
|
+
touchIdentity(nectar: string, lastUpdateDate: string): Promise<void>;
|
|
120
|
+
/** Append a `hive_graph_versions` row. The caller supplies seq via `nextSeq`. */
|
|
121
|
+
appendVersion(row: HiveGraphVersionRow): Promise<void>;
|
|
122
|
+
/** The next monotonic seq for a nectar (0 if it has no versions yet). */
|
|
123
|
+
nextSeq(nectar: string): Promise<number>;
|
|
124
|
+
/** The latest (MAX seq) version row for a nectar, or undefined. */
|
|
125
|
+
latestVersion(nectar: string): Promise<HiveGraphVersionRow | undefined>;
|
|
126
|
+
/** Every nectar's latest version, scoped to the tenancy (soft-filtered by `project_id`). */
|
|
127
|
+
listLatestVersions(tenancy: Tenancy): Promise<LatestVersion[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Every nectar's latest DESCRIBED version, scoped to the tenancy: for each
|
|
130
|
+
* nectar with at least one `describe_status = 'described'` version, the
|
|
131
|
+
* highest-seq described row (nectars with no described version omitted). The
|
|
132
|
+
* async twin of {@link HiveGraphStore.listLatestDescribedVersions}; the
|
|
133
|
+
* projection scan (PRD-011c) the durable `rebuild-projection` CLI runs against
|
|
134
|
+
* Deep Lake, overlaid onto {@link listLatestVersions} so undescribed nectars
|
|
135
|
+
* keep a minimal entry.
|
|
136
|
+
*/
|
|
137
|
+
listLatestDescribedVersions(tenancy: Tenancy): Promise<LatestVersion[]>;
|
|
138
|
+
/** The latest version whose current path equals `path`, scoped. */
|
|
139
|
+
latestVersionByPath(tenancy: Tenancy, path: string): Promise<LatestVersion | undefined>;
|
|
140
|
+
/** A nectar whose latest version content_hash equals `contentHash`, scoped. First match. */
|
|
141
|
+
latestVersionByHash(tenancy: Tenancy, contentHash: string): Promise<LatestVersion | undefined>;
|
|
142
|
+
/**
|
|
143
|
+
* Delete a nectar (identity + versions), scoped to `tenancy`. The SOLE
|
|
144
|
+
* deletion path (`prune --confirm`); a no-op when the nectar does not exist or
|
|
145
|
+
* its identity is outside `tenancy` (a cross-project delete is refused, AC-20).
|
|
146
|
+
* The tenancy predicate makes the Deep Lake adapter inherit the same guard the
|
|
147
|
+
* in-memory adapter enforces, so no delete crosses a project boundary.
|
|
148
|
+
*/
|
|
149
|
+
deleteNectar(tenancy: Tenancy, nectar: string): Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/hive-graph/store.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/hive-graph/store.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mint a fresh nectar (26-char ULID). Never derived from content; created once.
|
|
3
|
+
* Within the same millisecond the random component is incremented (monotonic),
|
|
4
|
+
* so `mintNectar(t)` called repeatedly at the same `t` yields strictly
|
|
5
|
+
* increasing ULIDs; a new millisecond re-randomizes it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mintNectar(nowMs?: number): string;
|
|
8
|
+
/** Decode a nectar's embedded 48-bit timestamp back to milliseconds since epoch. */
|
|
9
|
+
export declare function nectarTimestampMs(nectar: string): number;
|
|
10
|
+
/** The nectar's creation time as an ISO 8601 string (for hive_graph.created_at). */
|
|
11
|
+
export declare function nectarCreatedAt(nectar: string): string;
|
|
12
|
+
/** Shape check: 26 chars, all in the Crockford alphabet. */
|
|
13
|
+
export declare function isValidNectar(value: string): boolean;
|
|
14
|
+
//# sourceMappingURL=ulid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ulid.d.ts","sourceRoot":"","sources":["../../src/hive-graph/ulid.ts"],"names":[],"mappings":"AAuEA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,GAAE,MAAmB,GAAG,MAAM,CAS7D;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CASxD;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIpD"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ULID minting for nectars (PRD-005 / PRD-006, per ai/identity-and-reassociation.md).
|
|
3
|
+
*
|
|
4
|
+
* A nectar is a 26-char ULID: 48-bit millisecond timestamp + 80 bits of
|
|
5
|
+
* randomness, Crockford base32, uppercase. Two load-bearing properties (per the
|
|
6
|
+
* corpus): lexicographic sortability by creation time - MONOTONIC even within a
|
|
7
|
+
* single millisecond via a same-ms counter (NEC-042 item 6 / AC-018l.13), so two
|
|
8
|
+
* nectars minted in the same millisecond still sort in creation order - and
|
|
9
|
+
* registry-free collision resistance so minting is lock-free and parallel-safe.
|
|
10
|
+
* Node built-ins only (`node:crypto`); no `ulid` package dependency.
|
|
11
|
+
*
|
|
12
|
+
* The same-ms counter is the standard `monotonicFactory` behavior: within one
|
|
13
|
+
* millisecond, the 80-bit random component is INCREMENTED per mint instead of
|
|
14
|
+
* re-randomized, so the ULIDs are strictly increasing. The encoded timestamp is
|
|
15
|
+
* always the supplied `nowMs` (never clamped forward), so `nectarTimestampMs`
|
|
16
|
+
* decodes it exactly; a new millisecond re-randomizes the component.
|
|
17
|
+
*/
|
|
18
|
+
import { randomBytes } from "node:crypto";
|
|
19
|
+
/** Crockford base32 alphabet (excludes I, L, O, U). 32 symbols, 5 bits each. */
|
|
20
|
+
const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
21
|
+
const TIME_LEN = 10; // 10 chars * 5 bits = 50 bits, covers the 48-bit ms timestamp
|
|
22
|
+
const RANDOM_LEN = 16; // 16 chars * 5 bits = 80 bits of randomness
|
|
23
|
+
function encodeTime(ms, len) {
|
|
24
|
+
let now = Math.floor(ms);
|
|
25
|
+
let out = "";
|
|
26
|
+
for (let i = 0; i < len; i++) {
|
|
27
|
+
out = ENCODING[now % 32] + out;
|
|
28
|
+
now = Math.floor(now / 32);
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
/** Fresh randomness as `len` base32 symbol indices (0..31). 256 % 32 == 0, so `byte % 32` is unbiased. */
|
|
33
|
+
function freshRandomDigits(len) {
|
|
34
|
+
const bytes = randomBytes(len);
|
|
35
|
+
const out = [];
|
|
36
|
+
for (let i = 0; i < len; i++)
|
|
37
|
+
out.push(bytes[i] % 32);
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Increment a base32-digit array by one (least-significant last), carrying on a
|
|
42
|
+
* 31 -> 0 rollover. On a full overflow (every digit was 31, astronomically
|
|
43
|
+
* unlikely with 80 bits) it falls back to fresh randomness rather than throwing,
|
|
44
|
+
* so minting never crashes.
|
|
45
|
+
*/
|
|
46
|
+
function incrementDigits(digits) {
|
|
47
|
+
const out = digits.slice();
|
|
48
|
+
for (let i = out.length - 1; i >= 0; i--) {
|
|
49
|
+
const d = out[i];
|
|
50
|
+
if (d < 31) {
|
|
51
|
+
out[i] = d + 1;
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
out[i] = 0;
|
|
55
|
+
}
|
|
56
|
+
return freshRandomDigits(out.length);
|
|
57
|
+
}
|
|
58
|
+
function digitsToString(digits) {
|
|
59
|
+
let out = "";
|
|
60
|
+
for (const d of digits)
|
|
61
|
+
out += ENCODING[d];
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
/** The last millisecond minted at, and its (possibly incremented) random component, for same-ms monotonicity. */
|
|
65
|
+
let lastMintMs = -1;
|
|
66
|
+
let lastRandomDigits = [];
|
|
67
|
+
/**
|
|
68
|
+
* Mint a fresh nectar (26-char ULID). Never derived from content; created once.
|
|
69
|
+
* Within the same millisecond the random component is incremented (monotonic),
|
|
70
|
+
* so `mintNectar(t)` called repeatedly at the same `t` yields strictly
|
|
71
|
+
* increasing ULIDs; a new millisecond re-randomizes it.
|
|
72
|
+
*/
|
|
73
|
+
export function mintNectar(nowMs = Date.now()) {
|
|
74
|
+
const t = Math.floor(nowMs);
|
|
75
|
+
if (t === lastMintMs) {
|
|
76
|
+
lastRandomDigits = incrementDigits(lastRandomDigits);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
lastMintMs = t;
|
|
80
|
+
lastRandomDigits = freshRandomDigits(RANDOM_LEN);
|
|
81
|
+
}
|
|
82
|
+
return encodeTime(t, TIME_LEN) + digitsToString(lastRandomDigits);
|
|
83
|
+
}
|
|
84
|
+
/** Decode a nectar's embedded 48-bit timestamp back to milliseconds since epoch. */
|
|
85
|
+
export function nectarTimestampMs(nectar) {
|
|
86
|
+
const timeChars = nectar.slice(0, TIME_LEN);
|
|
87
|
+
let ms = 0;
|
|
88
|
+
for (const ch of timeChars) {
|
|
89
|
+
const idx = ENCODING.indexOf(ch);
|
|
90
|
+
if (idx === -1)
|
|
91
|
+
throw new Error(`invalid ULID time char: ${ch}`);
|
|
92
|
+
ms = ms * 32 + idx;
|
|
93
|
+
}
|
|
94
|
+
return ms;
|
|
95
|
+
}
|
|
96
|
+
/** The nectar's creation time as an ISO 8601 string (for hive_graph.created_at). */
|
|
97
|
+
export function nectarCreatedAt(nectar) {
|
|
98
|
+
return new Date(nectarTimestampMs(nectar)).toISOString();
|
|
99
|
+
}
|
|
100
|
+
/** Shape check: 26 chars, all in the Crockford alphabet. */
|
|
101
|
+
export function isValidNectar(value) {
|
|
102
|
+
if (value.length !== TIME_LEN + RANDOM_LEN)
|
|
103
|
+
return false;
|
|
104
|
+
for (const ch of value)
|
|
105
|
+
if (ENCODING.indexOf(ch) === -1)
|
|
106
|
+
return false;
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=ulid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ulid.js","sourceRoot":"","sources":["../../src/hive-graph/ulid.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hivenectar's registry entry in hivedoctor's daemon registry (PRD-003c).
|
|
3
|
+
*
|
|
4
|
+
* hivenectar becomes a supervised daemon by appending ONE entry to hivedoctor's
|
|
5
|
+
* registry file (`~/.honeycomb/hivedoctor.daemons.json`, the schema PRD-004a
|
|
6
|
+
* specifies, mirrored read-side in `hivedoctor/src/registry.ts`). That entry
|
|
7
|
+
* carries hivenectar's `healthUrl`, `pidPath`, `probeIntervalMs`, `startupGraceMs`,
|
|
8
|
+
* and restart thresholds. At the next hivedoctor boot, hivedoctor reads the
|
|
9
|
+
* registry and spawns one supervisor instance for hivenectar alongside honeycomb
|
|
10
|
+
* and thehive.
|
|
11
|
+
*
|
|
12
|
+
* Registration is a FILE EDIT at install time (PRD-003c "Registration mechanics"),
|
|
13
|
+
* never a runtime call: this module does not restart hivedoctor, does not open an
|
|
14
|
+
* HTTP connection, and does not hot-reload anything. It is idempotent - re-running
|
|
15
|
+
* the installer replaces hivenectar's own entry (keyed by `name: "hivenectar"`)
|
|
16
|
+
* rather than appending a duplicate, and every other daemon's entry is preserved
|
|
17
|
+
* byte-for-byte apart from array position.
|
|
18
|
+
*
|
|
19
|
+
* A PRESENT-but-malformed registry file fails loudly (this module never silently
|
|
20
|
+
* clobbers a broken file it cannot safely parse), mirroring hivedoctor's own
|
|
21
|
+
* fail-loud posture for a malformed registry (`hivedoctor/src/registry.ts`).
|
|
22
|
+
* PRD-017a deliberately does NOT change this posture to match hivedoctor's own
|
|
23
|
+
* fail-soft posture for a malformed registry read - the two are intentionally
|
|
24
|
+
* different (this writer refuses to clobber a broken install-time file; a
|
|
25
|
+
* malformed registry read is hivedoctor's own runtime concern, not this one).
|
|
26
|
+
*
|
|
27
|
+
* PRD-017a extends this entry with `telemetryDbPath`: the absolute path to
|
|
28
|
+
* hivenectar's runtime telemetry SQLite database (`telemetry/db.ts`,
|
|
29
|
+
* `~/.honeycomb/telemetry/hivenectar.sqlite` by default), per hivedoctor's
|
|
30
|
+
* `ADR-0002-service-registration-static-registry-plus-runtime-sqlite.md`. It is
|
|
31
|
+
* derived from `config.pidFilePath`'s directory (the same resolved runtime dir
|
|
32
|
+
* `healthUrl`/`pidPath` already come from), so a test-overridden runtime dir
|
|
33
|
+
* (`HIVENECTAR_RUNTIME_DIR` / `resolveConfig({ runtimeDir })`) keeps every
|
|
34
|
+
* per-daemon artifact - pid, lock, and now telemetry DB - colocated, with no
|
|
35
|
+
* separate `~` round-trip needed here (same rationale as `healthUrl`/`pidPath`).
|
|
36
|
+
*
|
|
37
|
+
* Built-ins only: node:fs, node:os, node:path.
|
|
38
|
+
*/
|
|
39
|
+
import type { RuntimeConfig } from "./config.js";
|
|
40
|
+
/** The daemon name hivenectar registers itself under. */
|
|
41
|
+
export declare const HIVENECTAR_DAEMON_NAME: "hivenectar";
|
|
42
|
+
/**
|
|
43
|
+
* One registry entry, matching the schema hivedoctor's registry loader parses
|
|
44
|
+
* (PRD-004a / `hivedoctor/src/registry.ts`).
|
|
45
|
+
*/
|
|
46
|
+
export interface HivedoctorRegistryEntry {
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly healthUrl: string;
|
|
49
|
+
readonly pidPath: string;
|
|
50
|
+
readonly probeIntervalMs: number;
|
|
51
|
+
readonly startupGraceMs: number;
|
|
52
|
+
readonly restartGiveUpThreshold: number;
|
|
53
|
+
readonly restartCooldownMs: number;
|
|
54
|
+
/**
|
|
55
|
+
* The absolute path to hivenectar's runtime telemetry SQLite database
|
|
56
|
+
* (PRD-017a), so hivedoctor knows where to poll (read-only) for check-in
|
|
57
|
+
* status, metrics, and logs. Optional in the type only so a pre-PRD-017
|
|
58
|
+
* entry a test constructs by hand still type-checks; `buildHivenectarRegistryEntry`
|
|
59
|
+
* always populates it.
|
|
60
|
+
*/
|
|
61
|
+
readonly telemetryDbPath?: string;
|
|
62
|
+
}
|
|
63
|
+
/** hivedoctor's per-daemon defaults hivenectar's entry resolves to (PRD-003c table). */
|
|
64
|
+
export declare const DEFAULT_PROBE_INTERVAL_MS = 30000;
|
|
65
|
+
export declare const DEFAULT_STARTUP_GRACE_MS = 60000;
|
|
66
|
+
export declare const DEFAULT_RESTART_GIVE_UP_THRESHOLD = 3;
|
|
67
|
+
export declare const DEFAULT_RESTART_COOLDOWN_MS = 5000;
|
|
68
|
+
/** Thrown when a PRESENT registry file cannot be safely parsed/edited. */
|
|
69
|
+
export declare class HivedoctorRegistryError extends Error {
|
|
70
|
+
constructor(message: string);
|
|
71
|
+
}
|
|
72
|
+
/** The default registry file location, alongside the other `~/.honeycomb` artifacts. */
|
|
73
|
+
export declare function defaultHivedoctorRegistryPath(home?: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* Build hivenectar's registry entry from its resolved {@link RuntimeConfig}
|
|
76
|
+
* (PRD-003c table): `healthUrl`/`pidPath` come from hivenectar's own runtime
|
|
77
|
+
* config (already home-expanded, so no `~` round-trip is needed here); the
|
|
78
|
+
* remaining fields are hivedoctor's per-daemon defaults unless overridden.
|
|
79
|
+
*
|
|
80
|
+
* `telemetryDbPath` (PRD-017a) defaults to `<runtimeDir>/telemetry/hivenectar.sqlite`,
|
|
81
|
+
* where `runtimeDir` is `pidFilePath`'s own directory - the same resolved
|
|
82
|
+
* runtime dir every other per-daemon artifact already lives under, so a
|
|
83
|
+
* test-overridden runtime dir keeps pid/lock/telemetry colocated automatically.
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildHivenectarRegistryEntry(config: Pick<RuntimeConfig, "host" | "port" | "pidFilePath">, overrides?: Partial<Pick<HivedoctorRegistryEntry, "probeIntervalMs" | "startupGraceMs" | "restartGiveUpThreshold" | "restartCooldownMs" | "telemetryDbPath">>): HivedoctorRegistryEntry;
|
|
86
|
+
export interface RegisterWithHivedoctorOptions {
|
|
87
|
+
/** hivenectar's runtime config (supplies healthUrl + pidPath). */
|
|
88
|
+
readonly config: Pick<RuntimeConfig, "host" | "port" | "pidFilePath">;
|
|
89
|
+
/** Override the registry file path (default: {@link defaultHivedoctorRegistryPath}). */
|
|
90
|
+
readonly registryPath?: string;
|
|
91
|
+
/** Override the entry's per-daemon fields (default: hivedoctor's built-in defaults). */
|
|
92
|
+
readonly overrides?: Partial<Pick<HivedoctorRegistryEntry, "probeIntervalMs" | "startupGraceMs" | "restartGiveUpThreshold" | "restartCooldownMs" | "telemetryDbPath">>;
|
|
93
|
+
}
|
|
94
|
+
export interface RegisterWithHivedoctorResult {
|
|
95
|
+
/** The path the registry file was written to. */
|
|
96
|
+
readonly registryPath: string;
|
|
97
|
+
/** The entry that was written for hivenectar. */
|
|
98
|
+
readonly entry: HivedoctorRegistryEntry;
|
|
99
|
+
/** True when the registry file did not exist and was created fresh. */
|
|
100
|
+
readonly created: boolean;
|
|
101
|
+
/** True when an existing hivenectar entry was replaced (idempotent re-install). */
|
|
102
|
+
readonly replaced: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Append (or idempotently replace) hivenectar's entry in hivedoctor's registry
|
|
106
|
+
* file (PRD-003c US-003c.1). Every OTHER daemon's entry is preserved unchanged.
|
|
107
|
+
* Does NOT restart hivedoctor and does NOT touch anything besides this one file -
|
|
108
|
+
* the entry takes effect at hivedoctor's next natural boot (PRD-003c Non-Goals).
|
|
109
|
+
*/
|
|
110
|
+
export declare function registerWithHivedoctor(options: RegisterWithHivedoctorOptions): RegisterWithHivedoctorResult;
|
|
111
|
+
//# sourceMappingURL=hivedoctor-registry.d.ts.map
|