@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
package/dist/health.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `/health` contract for the nectar daemon.
|
|
3
|
+
*
|
|
4
|
+
* Per PRD-001b (decision #20, revised): the top-level coarse `status` bit is
|
|
5
|
+
* what doctor classifies on (modeled on honeycomb's `PipelineStatus`,
|
|
6
|
+
* honeycomb/src/daemon/runtime/health.ts:42), and the body carries
|
|
7
|
+
* nectar-native subsystem fields honeycomb's `/health` does not have
|
|
8
|
+
* (brooding, enricher queue, projection, cost, provider state). The HTTP status
|
|
9
|
+
* gates 200 when ok / 503 when degraded (PRD-003a; mirrors server.ts:318-341).
|
|
10
|
+
*/
|
|
11
|
+
export type PipelineStatus = "ok" | "degraded";
|
|
12
|
+
export interface HealthBody {
|
|
13
|
+
status: PipelineStatus;
|
|
14
|
+
uptimeMs: number;
|
|
15
|
+
brooding: {
|
|
16
|
+
active: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Machine-readable reason brooding is inactive, or null when active/ready
|
|
19
|
+
* (PRD-018k AC-018k.3). `"credentials_missing"` / `"portkey_disabled"` name
|
|
20
|
+
* the unmet prerequisite so supervision and humans can both see WHY a booted
|
|
21
|
+
* daemon describes nothing, rather than inferring it from the provider bits.
|
|
22
|
+
*/
|
|
23
|
+
reason: string | null;
|
|
24
|
+
filesDescribed: number;
|
|
25
|
+
filesTotal: number;
|
|
26
|
+
lastEventAt: string | null;
|
|
27
|
+
};
|
|
28
|
+
enricher: {
|
|
29
|
+
queueDepth: number;
|
|
30
|
+
lastCycleAt: string | null;
|
|
31
|
+
consecutiveFailures: number;
|
|
32
|
+
lastFileDescribed: string | null;
|
|
33
|
+
};
|
|
34
|
+
projection: {
|
|
35
|
+
lastWriteAt: string | null;
|
|
36
|
+
lastContentHash: string | null;
|
|
37
|
+
};
|
|
38
|
+
cost: {
|
|
39
|
+
broodTotalTokens: number;
|
|
40
|
+
broodTotalUsd: number;
|
|
41
|
+
};
|
|
42
|
+
embeddings: {
|
|
43
|
+
provider: "local-nomic" | "hosted" | "off";
|
|
44
|
+
};
|
|
45
|
+
portkey: {
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
};
|
|
48
|
+
watch: {
|
|
49
|
+
/** True once the update-on-change registration pipeline's NodeFS watcher is running (PRD-018b). */
|
|
50
|
+
running: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Why the watch leg is not running, when it is not: `"no-credentials"` when
|
|
53
|
+
* the daemon booted without a durable store (the pipeline is dormant, not
|
|
54
|
+
* broken - AC-018b.7), `"disabled"` when explicitly turned off, or null when
|
|
55
|
+
* running (or simply not yet started). Surfaced so a dormant watch leg is
|
|
56
|
+
* observable rather than silent.
|
|
57
|
+
*/
|
|
58
|
+
reason: string | null;
|
|
59
|
+
/** Durable flushes from the sync/async bridge that failed (surfaced, not swallowed - AC-018b.4). */
|
|
60
|
+
flushFailures: number;
|
|
61
|
+
/** ISO 8601 timestamp of the most recent durable-flush failure, or null when none has failed. */
|
|
62
|
+
lastFlushErrorAt: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* PRD-018c AC-018c.6/7: the watcher's own liveness, independent of
|
|
65
|
+
* `reason` (which explains why the watch leg is dormant AT ALL, e.g.
|
|
66
|
+
* no-credentials). `"running"` mirrors `running=true`; `"restarting"`
|
|
67
|
+
* surfaces an active error-backoff recovery; `"degraded"` means restart
|
|
68
|
+
* attempts were exhausted (the periodic resync backstop keeps
|
|
69
|
+
* reconciling); `"stopped"` is the pre-start/post-shutdown default.
|
|
70
|
+
*/
|
|
71
|
+
state: "stopped" | "running" | "restarting" | "degraded";
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Mutable daemon health state. Subsystems update their slices as later PRDs
|
|
76
|
+
* (007 brooding, 016 enricher, 011 projection, 010 portkey, 014 embeddings) land;
|
|
77
|
+
* until then the fields report their honest zero/off values. `degrade()` flips
|
|
78
|
+
* the coarse bit doctor classifies on.
|
|
79
|
+
*/
|
|
80
|
+
export declare class HealthState {
|
|
81
|
+
private startedAtMs;
|
|
82
|
+
private status;
|
|
83
|
+
readonly brooding: HealthBody["brooding"];
|
|
84
|
+
readonly enricher: HealthBody["enricher"];
|
|
85
|
+
readonly projection: HealthBody["projection"];
|
|
86
|
+
readonly cost: HealthBody["cost"];
|
|
87
|
+
readonly embeddings: HealthBody["embeddings"];
|
|
88
|
+
readonly portkey: HealthBody["portkey"];
|
|
89
|
+
readonly watch: HealthBody["watch"];
|
|
90
|
+
markStarted(atMs?: number): void;
|
|
91
|
+
/**
|
|
92
|
+
* Record the resolved provider state (PRD-010 / PRD-014, decision #20's
|
|
93
|
+
* purpose-built health shape). Resolved ONCE at assemble/start from the
|
|
94
|
+
* env-backed config, never per `/health` request. `new HealthState()` keeps
|
|
95
|
+
* the honest defaults (`portkey.enabled = false`, `embeddings.provider = off`)
|
|
96
|
+
* until a composition root calls this.
|
|
97
|
+
*/
|
|
98
|
+
setProviderState(state: {
|
|
99
|
+
portkeyEnabled: boolean;
|
|
100
|
+
embeddingsProvider: HealthBody["embeddings"]["provider"];
|
|
101
|
+
}): void;
|
|
102
|
+
/**
|
|
103
|
+
* Merge the brooding subsystem slice (PRD-007 / decision #20). Called by the
|
|
104
|
+
* daemon's auto-brood path and the CLI/API brood mechanic as a brood advances.
|
|
105
|
+
* Fail-soft: an absent subsystem never calls this and the honest zero defaults
|
|
106
|
+
* stand; a partial only overwrites the fields it carries.
|
|
107
|
+
*/
|
|
108
|
+
setBroodingState(state: Partial<HealthBody["brooding"]>): void;
|
|
109
|
+
/**
|
|
110
|
+
* Merge the enricher subsystem slice (PRD-016 / decision #20). Fed by the
|
|
111
|
+
* enricher loop's per-cycle sink; absent subsystems leave the zero defaults.
|
|
112
|
+
*/
|
|
113
|
+
setEnricherState(state: Partial<HealthBody["enricher"]>): void;
|
|
114
|
+
/** Merge the projection subsystem slice (PRD-011): last write time + content hash. */
|
|
115
|
+
setProjectionState(state: Partial<HealthBody["projection"]>): void;
|
|
116
|
+
/**
|
|
117
|
+
* Accumulate brooding cost (PRD-007b / decision #20). Additive: each completed
|
|
118
|
+
* brood adds its estimated input tokens + USD to the running totals. Negative
|
|
119
|
+
* or non-finite deltas are ignored so a bad estimate never corrupts the total.
|
|
120
|
+
*/
|
|
121
|
+
addBroodCost(delta: {
|
|
122
|
+
tokens?: number;
|
|
123
|
+
usd?: number;
|
|
124
|
+
}): void;
|
|
125
|
+
/**
|
|
126
|
+
* Merge the watch-leg slice (PRD-018b): whether the NodeFS watcher is running
|
|
127
|
+
* and, when it is not, why. The daemon calls this at start (running once the
|
|
128
|
+
* pipeline starts after auto-brood settles, or dormant with `"no-credentials"`
|
|
129
|
+
* when no durable store resolved) and at shutdown (running false). Only the
|
|
130
|
+
* fields the partial carries are overwritten.
|
|
131
|
+
*/
|
|
132
|
+
setWatchState(state: Partial<Pick<HealthBody["watch"], "running" | "reason" | "state">>): void;
|
|
133
|
+
/**
|
|
134
|
+
* Record a durable-flush failure from the sync/async bridge (PRD-018b
|
|
135
|
+
* AC-018b.4): bump the count and stamp the time, so a failed durable write is
|
|
136
|
+
* visible on `/health` rather than silently dropped.
|
|
137
|
+
*/
|
|
138
|
+
recordWatchFlushFailure(atIso?: string): void;
|
|
139
|
+
setStatus(status: PipelineStatus): void;
|
|
140
|
+
degrade(): void;
|
|
141
|
+
get pipelineStatus(): PipelineStatus;
|
|
142
|
+
/** The full `/health` body, snapshotted from cached state (no synchronous probe). */
|
|
143
|
+
snapshot(nowMs?: number): HealthBody;
|
|
144
|
+
}
|
|
145
|
+
/** Map the coarse pipeline bit to the HTTP status code (200 ok / 503 degraded). */
|
|
146
|
+
export declare function healthHttpStatus(status: PipelineStatus): 200 | 503;
|
|
147
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../src/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,UAAU,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE;QACR,MAAM,EAAE,OAAO,CAAC;QAChB;;;;;WAKG;QACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,E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GAAE,MAAmB,GAAG,UAAU;CAajD;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,GAAG,GAAG,CAElE"}
|
package/dist/health.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `/health` contract for the nectar daemon.
|
|
3
|
+
*
|
|
4
|
+
* Per PRD-001b (decision #20, revised): the top-level coarse `status` bit is
|
|
5
|
+
* what doctor classifies on (modeled on honeycomb's `PipelineStatus`,
|
|
6
|
+
* honeycomb/src/daemon/runtime/health.ts:42), and the body carries
|
|
7
|
+
* nectar-native subsystem fields honeycomb's `/health` does not have
|
|
8
|
+
* (brooding, enricher queue, projection, cost, provider state). The HTTP status
|
|
9
|
+
* gates 200 when ok / 503 when degraded (PRD-003a; mirrors server.ts:318-341).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Mutable daemon health state. Subsystems update their slices as later PRDs
|
|
13
|
+
* (007 brooding, 016 enricher, 011 projection, 010 portkey, 014 embeddings) land;
|
|
14
|
+
* until then the fields report their honest zero/off values. `degrade()` flips
|
|
15
|
+
* the coarse bit doctor classifies on.
|
|
16
|
+
*/
|
|
17
|
+
export class HealthState {
|
|
18
|
+
startedAtMs = Date.now();
|
|
19
|
+
status = "ok";
|
|
20
|
+
brooding = {
|
|
21
|
+
active: false,
|
|
22
|
+
reason: null,
|
|
23
|
+
filesDescribed: 0,
|
|
24
|
+
filesTotal: 0,
|
|
25
|
+
lastEventAt: null,
|
|
26
|
+
};
|
|
27
|
+
enricher = {
|
|
28
|
+
queueDepth: 0,
|
|
29
|
+
lastCycleAt: null,
|
|
30
|
+
consecutiveFailures: 0,
|
|
31
|
+
lastFileDescribed: null,
|
|
32
|
+
};
|
|
33
|
+
projection = {
|
|
34
|
+
lastWriteAt: null,
|
|
35
|
+
lastContentHash: null,
|
|
36
|
+
};
|
|
37
|
+
cost = {
|
|
38
|
+
broodTotalTokens: 0,
|
|
39
|
+
broodTotalUsd: 0,
|
|
40
|
+
};
|
|
41
|
+
embeddings = { provider: "off" };
|
|
42
|
+
portkey = { enabled: false };
|
|
43
|
+
watch = {
|
|
44
|
+
running: false,
|
|
45
|
+
reason: null,
|
|
46
|
+
flushFailures: 0,
|
|
47
|
+
lastFlushErrorAt: null,
|
|
48
|
+
state: "stopped",
|
|
49
|
+
};
|
|
50
|
+
markStarted(atMs = Date.now()) {
|
|
51
|
+
this.startedAtMs = atMs;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Record the resolved provider state (PRD-010 / PRD-014, decision #20's
|
|
55
|
+
* purpose-built health shape). Resolved ONCE at assemble/start from the
|
|
56
|
+
* env-backed config, never per `/health` request. `new HealthState()` keeps
|
|
57
|
+
* the honest defaults (`portkey.enabled = false`, `embeddings.provider = off`)
|
|
58
|
+
* until a composition root calls this.
|
|
59
|
+
*/
|
|
60
|
+
setProviderState(state) {
|
|
61
|
+
this.portkey.enabled = state.portkeyEnabled;
|
|
62
|
+
this.embeddings.provider = state.embeddingsProvider;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Merge the brooding subsystem slice (PRD-007 / decision #20). Called by the
|
|
66
|
+
* daemon's auto-brood path and the CLI/API brood mechanic as a brood advances.
|
|
67
|
+
* Fail-soft: an absent subsystem never calls this and the honest zero defaults
|
|
68
|
+
* stand; a partial only overwrites the fields it carries.
|
|
69
|
+
*/
|
|
70
|
+
setBroodingState(state) {
|
|
71
|
+
if (state.active !== undefined)
|
|
72
|
+
this.brooding.active = state.active;
|
|
73
|
+
if (state.reason !== undefined)
|
|
74
|
+
this.brooding.reason = state.reason;
|
|
75
|
+
if (state.filesDescribed !== undefined)
|
|
76
|
+
this.brooding.filesDescribed = state.filesDescribed;
|
|
77
|
+
if (state.filesTotal !== undefined)
|
|
78
|
+
this.brooding.filesTotal = state.filesTotal;
|
|
79
|
+
if (state.lastEventAt !== undefined)
|
|
80
|
+
this.brooding.lastEventAt = state.lastEventAt;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Merge the enricher subsystem slice (PRD-016 / decision #20). Fed by the
|
|
84
|
+
* enricher loop's per-cycle sink; absent subsystems leave the zero defaults.
|
|
85
|
+
*/
|
|
86
|
+
setEnricherState(state) {
|
|
87
|
+
if (state.queueDepth !== undefined)
|
|
88
|
+
this.enricher.queueDepth = state.queueDepth;
|
|
89
|
+
if (state.lastCycleAt !== undefined)
|
|
90
|
+
this.enricher.lastCycleAt = state.lastCycleAt;
|
|
91
|
+
if (state.consecutiveFailures !== undefined)
|
|
92
|
+
this.enricher.consecutiveFailures = state.consecutiveFailures;
|
|
93
|
+
if (state.lastFileDescribed !== undefined)
|
|
94
|
+
this.enricher.lastFileDescribed = state.lastFileDescribed;
|
|
95
|
+
}
|
|
96
|
+
/** Merge the projection subsystem slice (PRD-011): last write time + content hash. */
|
|
97
|
+
setProjectionState(state) {
|
|
98
|
+
if (state.lastWriteAt !== undefined)
|
|
99
|
+
this.projection.lastWriteAt = state.lastWriteAt;
|
|
100
|
+
if (state.lastContentHash !== undefined)
|
|
101
|
+
this.projection.lastContentHash = state.lastContentHash;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Accumulate brooding cost (PRD-007b / decision #20). Additive: each completed
|
|
105
|
+
* brood adds its estimated input tokens + USD to the running totals. Negative
|
|
106
|
+
* or non-finite deltas are ignored so a bad estimate never corrupts the total.
|
|
107
|
+
*/
|
|
108
|
+
addBroodCost(delta) {
|
|
109
|
+
if (typeof delta.tokens === "number" && Number.isFinite(delta.tokens) && delta.tokens > 0) {
|
|
110
|
+
this.cost.broodTotalTokens += delta.tokens;
|
|
111
|
+
}
|
|
112
|
+
if (typeof delta.usd === "number" && Number.isFinite(delta.usd) && delta.usd > 0) {
|
|
113
|
+
this.cost.broodTotalUsd += delta.usd;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Merge the watch-leg slice (PRD-018b): whether the NodeFS watcher is running
|
|
118
|
+
* and, when it is not, why. The daemon calls this at start (running once the
|
|
119
|
+
* pipeline starts after auto-brood settles, or dormant with `"no-credentials"`
|
|
120
|
+
* when no durable store resolved) and at shutdown (running false). Only the
|
|
121
|
+
* fields the partial carries are overwritten.
|
|
122
|
+
*/
|
|
123
|
+
setWatchState(state) {
|
|
124
|
+
if (state.running !== undefined)
|
|
125
|
+
this.watch.running = state.running;
|
|
126
|
+
if (state.reason !== undefined)
|
|
127
|
+
this.watch.reason = state.reason;
|
|
128
|
+
if (state.state !== undefined)
|
|
129
|
+
this.watch.state = state.state;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Record a durable-flush failure from the sync/async bridge (PRD-018b
|
|
133
|
+
* AC-018b.4): bump the count and stamp the time, so a failed durable write is
|
|
134
|
+
* visible on `/health` rather than silently dropped.
|
|
135
|
+
*/
|
|
136
|
+
recordWatchFlushFailure(atIso = new Date().toISOString()) {
|
|
137
|
+
this.watch.flushFailures += 1;
|
|
138
|
+
this.watch.lastFlushErrorAt = atIso;
|
|
139
|
+
}
|
|
140
|
+
setStatus(status) {
|
|
141
|
+
this.status = status;
|
|
142
|
+
}
|
|
143
|
+
degrade() {
|
|
144
|
+
this.status = "degraded";
|
|
145
|
+
}
|
|
146
|
+
get pipelineStatus() {
|
|
147
|
+
return this.status;
|
|
148
|
+
}
|
|
149
|
+
/** The full `/health` body, snapshotted from cached state (no synchronous probe). */
|
|
150
|
+
snapshot(nowMs = Date.now()) {
|
|
151
|
+
return {
|
|
152
|
+
status: this.status,
|
|
153
|
+
uptimeMs: Math.max(0, nowMs - this.startedAtMs),
|
|
154
|
+
brooding: { ...this.brooding },
|
|
155
|
+
enricher: { ...this.enricher },
|
|
156
|
+
projection: { ...this.projection },
|
|
157
|
+
cost: { ...this.cost },
|
|
158
|
+
embeddings: { ...this.embeddings },
|
|
159
|
+
portkey: { ...this.portkey },
|
|
160
|
+
watch: { ...this.watch },
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/** Map the coarse pipeline bit to the HTTP status code (200 ok / 503 degraded). */
|
|
165
|
+
export function healthHttpStatus(status) {
|
|
166
|
+
return status === "ok" ? 200 : 503;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../src/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmEH;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IACd,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,MAAM,GAAmB,IAAI,CAAC;IAE7B,QAAQ,GAA2B;QAC1C,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,IAAI;QACZ,cAAc,EAAE,CAAC;QACjB,UAAU,EAAE,CAAC;QACb,WAAW,EAAE,IAAI;KAClB,CAAC;IACO,QAAQ,GAA2B;QAC1C,UAAU,EAAE,CAAC;QACb,WAAW,EAAE,IAAI;QACjB,mBAAmB,EAAE,CAAC;QACtB,iBAAiB,EAAE,IAAI;KACxB,CAAC;IACO,UAAU,GAA6B;QAC9C,WAAW,EAAE,IAAI;QACjB,eAAe,EAAE,IAAI;KACtB,CAAC;IACO,IAAI,GAAuB;QAClC,gBAAgB,EAAE,CAAC;QACnB,aAAa,EAAE,CAAC;KACjB,CAAC;IACO,UAAU,GAA6B,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC3D,OAAO,GAA0B,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACpD,KAAK,GAAwB;QACpC,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE,CAAC;QAChB,gBAAgB,EAAE,IAAI;QACtB,KAAK,EAAE,SAAS;KACjB,CAAC;IAEF,WAAW,CAAC,OAAe,IAAI,CAAC,GAAG,EAAE;QACnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,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ED credentials directory name under the user's home. */
|
|
2
|
+
export declare const CREDENTIALS_DIR_NAME = ".deeplake";
|
|
3
|
+
/** The credentials file name within the dir. */
|
|
4
|
+
export declare const CREDENTIALS_FILE_NAME = "credentials.json";
|
|
5
|
+
/** The canonical Deep Lake API base URL used when a file omits `apiUrl`. */
|
|
6
|
+
export declare const DEFAULT_DEEPLAKE_API_URL = "https://api.deeplake.ai";
|
|
7
|
+
/** The validated Deep Lake connection details the transport is built from. */
|
|
8
|
+
export interface DeepLakeCredentials {
|
|
9
|
+
/** Deep Lake HTTP query endpoint. Defaults to {@link DEFAULT_DEEPLAKE_API_URL}. */
|
|
10
|
+
readonly apiUrl: string;
|
|
11
|
+
/** The org-bound bearer token (SECRET; never logged in full). */
|
|
12
|
+
readonly token: string;
|
|
13
|
+
/** The org id the token is bound to. */
|
|
14
|
+
readonly orgId: string;
|
|
15
|
+
/** The active workspace id. */
|
|
16
|
+
readonly workspaceId: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for {@link loadDeepLakeCredentials}, injectable so a test points the
|
|
20
|
+
* file read at a temp dir without touching the real `~/.deeplake` (mirrors
|
|
21
|
+
* honeycomb's `CredentialsFileProviderOptions`). All optional.
|
|
22
|
+
*/
|
|
23
|
+
export interface LoadCredentialsOptions {
|
|
24
|
+
/** Override the credentials directory (tests). Defaults to `~/.deeplake`. */
|
|
25
|
+
readonly dir?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Warning sink for the group/other-readable advisory (NEC-042 item 13 /
|
|
28
|
+
* AC-018l.20). Defaults to stderr. A no-op on Windows, where POSIX mode bits
|
|
29
|
+
* do not map to a meaningful readability check.
|
|
30
|
+
*/
|
|
31
|
+
readonly warn?: (message: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* The platform whose permission model applies (default: `process.platform`).
|
|
34
|
+
* Injectable so a test can exercise the POSIX advisory path deterministically.
|
|
35
|
+
*/
|
|
36
|
+
readonly platform?: NodeJS.Platform;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Structured, fail-closed rejection. Carries exactly which fields were missing
|
|
40
|
+
* or invalid so a caller (or an operator reading a log line) knows what to
|
|
41
|
+
* fix without the loader ever echoing the file's contents (which may hold the
|
|
42
|
+
* token).
|
|
43
|
+
*/
|
|
44
|
+
export declare class DeepLakeCredentialsError extends Error {
|
|
45
|
+
readonly missing: readonly string[];
|
|
46
|
+
constructor(missing: readonly string[]);
|
|
47
|
+
}
|
|
48
|
+
/** Resolve the credentials directory, honoring the test override. */
|
|
49
|
+
export declare function credentialsDir(options?: LoadCredentialsOptions): string;
|
|
50
|
+
/** Resolve the full credentials file path within the (possibly overridden) dir. */
|
|
51
|
+
export declare function credentialsPath(options?: LoadCredentialsOptions): string;
|
|
52
|
+
/**
|
|
53
|
+
* Load and validate `~/.deeplake/credentials.json` (or the overridden dir in
|
|
54
|
+
* `options.dir`). Throws {@link DeepLakeCredentialsError} listing every
|
|
55
|
+
* problem found: a missing file, invalid JSON, a non-object payload, or a
|
|
56
|
+
* missing/empty `token` / `orgId` / `workspaceId`. Never returns a partial
|
|
57
|
+
* credential — the caller either gets a fully-populated `DeepLakeCredentials`
|
|
58
|
+
* or a clear, typed reason it could not.
|
|
59
|
+
*/
|
|
60
|
+
export declare function loadDeepLakeCredentials(options?: LoadCredentialsOptions): DeepLakeCredentials;
|
|
61
|
+
/**
|
|
62
|
+
* Redact a token for logs and errors. Never echoes a token in full: keeps the
|
|
63
|
+
* last 4 chars for correlation, masks the rest. An empty/short value collapses
|
|
64
|
+
* to a fixed mask so length isn't leaked either. Mirrors honeycomb's
|
|
65
|
+
* `redactToken` (`src/daemon/runtime/auth/credentials-store.ts:254-257`).
|
|
66
|
+
*/
|
|
67
|
+
export declare function redactToken(value: string): string;
|
|
68
|
+
//# sourceMappingURL=deeplake-credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deeplake-credentials.d.ts","sourceRoot":"","sources":["../../src/hive-gra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CAGjD"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep Lake credentials loader for nectar (PRD-005).
|
|
3
|
+
*
|
|
4
|
+
* Reads the SHARED `~/.deeplake/credentials.json` file that `hivemind login`
|
|
5
|
+
* (and honeycomb) already write, mirroring the shape honeycomb's
|
|
6
|
+
* `loadDiskCredentials` / `deeplakeCredentialsFileProvider`
|
|
7
|
+
* (`src/daemon/runtime/auth/credentials-store.ts`,
|
|
8
|
+
* `src/daemon/storage/config.ts`) read: `{ apiUrl, token, orgId, workspaceId }`.
|
|
9
|
+
* Per ADR-0002, nectar never imports honeycomb's runtime for this; it
|
|
10
|
+
* reads the same on-disk file with its own loader.
|
|
11
|
+
*
|
|
12
|
+
* Fail-closed by design (mirrors honeycomb's `StorageConfigError` posture): a
|
|
13
|
+
* missing file, malformed JSON, or a missing required field throws a
|
|
14
|
+
* `DeepLakeCredentialsError` listing exactly what is wrong, rather than
|
|
15
|
+
* returning a partially-undefined credential object a caller could
|
|
16
|
+
* accidentally use. `apiUrl` is the one field with a documented default (a
|
|
17
|
+
* legacy or hand-written file may omit it); `token`, `orgId`, and
|
|
18
|
+
* `workspaceId` are load-bearing and always required.
|
|
19
|
+
*
|
|
20
|
+
* The token is never logged or included in an error message in full;
|
|
21
|
+
* `redactToken` keeps only the last 4 characters, exactly like honeycomb's
|
|
22
|
+
* `redactToken` (`src/daemon/runtime/auth/credentials-store.ts:254-257`, its
|
|
23
|
+
* `defaultCredentialProvider` variant).
|
|
24
|
+
*/
|
|
25
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
26
|
+
import { homedir } from "node:os";
|
|
27
|
+
import { join } from "node:path";
|
|
28
|
+
/** The SHARED credentials directory name under the user's home. */
|
|
29
|
+
export const CREDENTIALS_DIR_NAME = ".deeplake";
|
|
30
|
+
/** The credentials file name within the dir. */
|
|
31
|
+
export const CREDENTIALS_FILE_NAME = "credentials.json";
|
|
32
|
+
/** The canonical Deep Lake API base URL used when a file omits `apiUrl`. */
|
|
33
|
+
export const DEFAULT_DEEPLAKE_API_URL = "https://api.deeplake.ai";
|
|
34
|
+
/**
|
|
35
|
+
* Structured, fail-closed rejection. Carries exactly which fields were missing
|
|
36
|
+
* or invalid so a caller (or an operator reading a log line) knows what to
|
|
37
|
+
* fix without the loader ever echoing the file's contents (which may hold the
|
|
38
|
+
* token).
|
|
39
|
+
*/
|
|
40
|
+
export class DeepLakeCredentialsError extends Error {
|
|
41
|
+
missing;
|
|
42
|
+
constructor(missing) {
|
|
43
|
+
super(`Invalid Deep Lake credentials: ${missing.join("; ")}`);
|
|
44
|
+
this.name = "DeepLakeCredentialsError";
|
|
45
|
+
this.missing = missing;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Resolve the credentials directory, honoring the test override. */
|
|
49
|
+
export function credentialsDir(options = {}) {
|
|
50
|
+
return options.dir ?? join(homedir(), CREDENTIALS_DIR_NAME);
|
|
51
|
+
}
|
|
52
|
+
/** Resolve the full credentials file path within the (possibly overridden) dir. */
|
|
53
|
+
export function credentialsPath(options = {}) {
|
|
54
|
+
return join(credentialsDir(options), CREDENTIALS_FILE_NAME);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Load and validate `~/.deeplake/credentials.json` (or the overridden dir in
|
|
58
|
+
* `options.dir`). Throws {@link DeepLakeCredentialsError} listing every
|
|
59
|
+
* problem found: a missing file, invalid JSON, a non-object payload, or a
|
|
60
|
+
* missing/empty `token` / `orgId` / `workspaceId`. Never returns a partial
|
|
61
|
+
* credential — the caller either gets a fully-populated `DeepLakeCredentials`
|
|
62
|
+
* or a clear, typed reason it could not.
|
|
63
|
+
*/
|
|
64
|
+
export function loadDeepLakeCredentials(options = {}) {
|
|
65
|
+
const path = credentialsPath(options);
|
|
66
|
+
if (!existsSync(path)) {
|
|
67
|
+
throw new DeepLakeCredentialsError([`credentials file not found at ${path}`]);
|
|
68
|
+
}
|
|
69
|
+
warnIfWorldReadable(path, options);
|
|
70
|
+
let parsed;
|
|
71
|
+
try {
|
|
72
|
+
parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
throw new DeepLakeCredentialsError([`credentials file at ${path} is not valid JSON`]);
|
|
76
|
+
}
|
|
77
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
78
|
+
throw new DeepLakeCredentialsError([`credentials file at ${path} does not contain a JSON object`]);
|
|
79
|
+
}
|
|
80
|
+
const record = parsed;
|
|
81
|
+
const missing = [];
|
|
82
|
+
if (typeof record.token !== "string" || record.token.length === 0)
|
|
83
|
+
missing.push("token");
|
|
84
|
+
if (typeof record.orgId !== "string" || record.orgId.length === 0)
|
|
85
|
+
missing.push("orgId");
|
|
86
|
+
if (typeof record.workspaceId !== "string" || record.workspaceId.length === 0)
|
|
87
|
+
missing.push("workspaceId");
|
|
88
|
+
if (missing.length > 0) {
|
|
89
|
+
throw new DeepLakeCredentialsError(missing);
|
|
90
|
+
}
|
|
91
|
+
const apiUrl = typeof record.apiUrl === "string" && record.apiUrl.length > 0 ? record.apiUrl : DEFAULT_DEEPLAKE_API_URL;
|
|
92
|
+
return {
|
|
93
|
+
apiUrl,
|
|
94
|
+
token: record.token,
|
|
95
|
+
orgId: record.orgId,
|
|
96
|
+
workspaceId: record.workspaceId,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Advisory (NEC-042 item 13 / AC-018l.20): warn when the token file is
|
|
101
|
+
* group- or other-readable on a POSIX platform, naming the octal mode, mirroring
|
|
102
|
+
* ssh's posture toward a loose private key. nectar is not the file's writer, so
|
|
103
|
+
* this never throws or blocks the load; it is a no-op on Windows (mode bits do
|
|
104
|
+
* not map) and when the stat itself fails.
|
|
105
|
+
*/
|
|
106
|
+
function warnIfWorldReadable(path, options) {
|
|
107
|
+
const platform = options.platform ?? process.platform;
|
|
108
|
+
if (platform === "win32")
|
|
109
|
+
return;
|
|
110
|
+
let mode;
|
|
111
|
+
try {
|
|
112
|
+
mode = statSync(path).mode & 0o777;
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return; // cannot stat; skip the advisory rather than failing the load
|
|
116
|
+
}
|
|
117
|
+
if ((mode & 0o077) === 0)
|
|
118
|
+
return; // owner-only (0600/0400): silent
|
|
119
|
+
const octal = `0${mode.toString(8).padStart(3, "0")}`;
|
|
120
|
+
const warn = options.warn ?? ((message) => process.stderr.write(`${message}\n`));
|
|
121
|
+
warn(`nectar: ${path} is group/other-readable (mode ${octal}); this token file should be owner-only. ` +
|
|
122
|
+
`Tighten it with: chmod 600 ${path}`);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Redact a token for logs and errors. Never echoes a token in full: keeps the
|
|
126
|
+
* last 4 chars for correlation, masks the rest. An empty/short value collapses
|
|
127
|
+
* to a fixed mask so length isn't leaked either. Mirrors honeycomb's
|
|
128
|
+
* `redactToken` (`src/daemon/runtime/auth/credentials-store.ts:254-257`).
|
|
129
|
+
*/
|
|
130
|
+
export function redactToken(value) {
|
|
131
|
+
if (value.length <= 4)
|
|
132
|
+
return "****";
|
|
133
|
+
return `****${value.slice(-4)}`;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=deeplake-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deeplake-credentials.js","sourceRoot":"","sources":["../../src/hive-graph/deeplake-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAChD,gDAAgD;AAChD,MAAM,CAAC,MAAM,qBAA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QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACtD,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO;IACjC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,8DAA8D;IACxE,CAAC;IACD,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,iCAAiC;IACnE,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC;IACzF,IAAI,CACF,WAAW,IAAI,kCAAkC,KAAK,2CAA2C;QAC/F,8BAA8B,IAAI,EAAE,CACvC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IACrC,OAAO,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heal-on-first-write for the Deep Lake adapter (PRD-005).
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the missing-table branch of honeycomb's `withHeal`
|
|
5
|
+
* (`src/daemon/storage/heal.ts:286-313`), scoped down to what the
|
|
6
|
+
* hive-graph tables need: a write that fails because its table does not
|
|
7
|
+
* exist yet triggers exactly ONE create-then-retry. Any other failure
|
|
8
|
+
* (permission, connection, timeout, a genuine syntax error) propagates
|
|
9
|
+
* unchanged and never triggers a create — the same anti-mask rule honeycomb's
|
|
10
|
+
* `classifyFailure` documents: a credentials or syntax problem must never be
|
|
11
|
+
* misread as a schema gap behind a confusing CREATE attempt.
|
|
12
|
+
*
|
|
13
|
+
* Column healing (honeycomb's `healColumns` / `ALTER TABLE ADD COLUMN`) is now
|
|
14
|
+
* ported for the additive case (PRD-018i / NEC-018): a write whose statement
|
|
15
|
+
* references a column the live table does not carry yet (an additive nullable
|
|
16
|
+
* column added to the catalog after CREATE, e.g. `embed_model`) triggers exactly
|
|
17
|
+
* ONE `ALTER TABLE ADD COLUMN`-then-retry, mirroring the missing-table branch.
|
|
18
|
+
* Any other failure still propagates unhealed.
|
|
19
|
+
*/
|
|
20
|
+
import type { CatalogTable } from "./schema.js";
|
|
21
|
+
import type { DeepLakeRow } from "./deeplake-transport.js";
|
|
22
|
+
import { TransportError } from "./deeplake-transport.js";
|
|
23
|
+
/**
|
|
24
|
+
* The minimal shape `withHeal` needs from a transport: one method that runs a
|
|
25
|
+
* SQL statement. `HttpDeepLakeTransport` satisfies this structurally (its
|
|
26
|
+
* `query` method is public even though its connection fields are private), so
|
|
27
|
+
* production callers pass it directly; a test can pass a plain fake object
|
|
28
|
+
* with a `query` method instead, without needing to construct a real
|
|
29
|
+
* `HttpDeepLakeTransport` or reach for a mocking library (nectar has
|
|
30
|
+
* none, by design).
|
|
31
|
+
*/
|
|
32
|
+
export interface QueryRunner {
|
|
33
|
+
query(sql: string): Promise<DeepLakeRow[]>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Classify a `query`-kind `TransportError` message as a missing-table failure
|
|
37
|
+
* (mirrors honeycomb's `classifyFailure`, `src/daemon/storage/heal.ts:77-98`,
|
|
38
|
+
* missing-table branch only). Auth/permission failures are excluded first so a
|
|
39
|
+
* message that happens to mention a relation is never misread as a schema gap.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isMissingTableError(err: TransportError): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Extract the missing-column name from a `query`-kind `TransportError`, or null
|
|
44
|
+
* when the message is not a missing-column failure. Auth/permission failures are
|
|
45
|
+
* excluded first (same anti-mask rule as {@link isMissingTableError}) so a
|
|
46
|
+
* message that happens to mention a column is never misread as a schema gap.
|
|
47
|
+
* Recognizes the common phrasings across SQL backends (`column "x" does not
|
|
48
|
+
* exist`, `no such column: x`, `unknown column 'x'`, `undefined column: x`).
|
|
49
|
+
*/
|
|
50
|
+
export declare function missingColumnName(err: TransportError): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Run a write, healing the two additive schema gaps EXACTLY ONCE each:
|
|
53
|
+
* - a missing-table failure -> CREATE the table (IF NOT EXISTS) and retry;
|
|
54
|
+
* - a missing-column failure whose column is a nullable additive column in
|
|
55
|
+
* `table` -> `ALTER TABLE ADD COLUMN` and retry (PRD-018i / NEC-018).
|
|
56
|
+
* Any other failure (or a success) returns/throws immediately and unhealed. A
|
|
57
|
+
* second failure after a heal propagates without a further retry (no loop).
|
|
58
|
+
*
|
|
59
|
+
* `runWrite` is the original statement's thunk so the retry re-issues the
|
|
60
|
+
* identical write.
|
|
61
|
+
*/
|
|
62
|
+
export declare function withHeal(transport: QueryRunner, table: CatalogTable, runWrite: () => Promise<DeepLakeRow[]>): Promise<DeepLakeRow[]>;
|
|
63
|
+
//# sourceMappingURL=deeplake-heal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deeplake-heal.d.ts","sourceRoot":"","sources":["../../src/hive-graph/deeplake-heal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;CAC5C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAahE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CA6BpE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC,GACrC,OAAO,CAAC,WAAW,EAAE,CAAC,CAwCxB"}
|