@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,148 @@
|
|
|
1
|
+
function zeroCounts() {
|
|
2
|
+
return {
|
|
3
|
+
filesRegistered: 0,
|
|
4
|
+
nectarsMinted: 0,
|
|
5
|
+
descriptionsGenerated: 0,
|
|
6
|
+
hiveGraphVersions: 0,
|
|
7
|
+
embeddingsComputed: 0,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export class MetricsWriter {
|
|
11
|
+
db;
|
|
12
|
+
nowFn;
|
|
13
|
+
counts = zeroCounts();
|
|
14
|
+
constructor(opts) {
|
|
15
|
+
this.db = opts.db;
|
|
16
|
+
this.nowFn = opts.now ?? (() => new Date().toISOString());
|
|
17
|
+
// Establish the zero baseline immediately: a poll that lands before any
|
|
18
|
+
// pipeline work still reads a real all-zero row, never a missing one.
|
|
19
|
+
this.flush();
|
|
20
|
+
}
|
|
21
|
+
snapshot() {
|
|
22
|
+
return { ...this.counts };
|
|
23
|
+
}
|
|
24
|
+
incrementFilesRegistered() {
|
|
25
|
+
this.counts.filesRegistered += 1;
|
|
26
|
+
this.flush();
|
|
27
|
+
}
|
|
28
|
+
incrementNectarsMinted() {
|
|
29
|
+
this.counts.nectarsMinted += 1;
|
|
30
|
+
this.flush();
|
|
31
|
+
}
|
|
32
|
+
incrementDescriptionsGenerated() {
|
|
33
|
+
this.counts.descriptionsGenerated += 1;
|
|
34
|
+
this.flush();
|
|
35
|
+
}
|
|
36
|
+
incrementHiveGraphVersions() {
|
|
37
|
+
this.counts.hiveGraphVersions += 1;
|
|
38
|
+
this.flush();
|
|
39
|
+
}
|
|
40
|
+
incrementEmbeddingsComputed() {
|
|
41
|
+
this.counts.embeddingsComputed += 1;
|
|
42
|
+
this.flush();
|
|
43
|
+
}
|
|
44
|
+
flush() {
|
|
45
|
+
try {
|
|
46
|
+
this.db
|
|
47
|
+
.prepare(`INSERT INTO service_metrics (id, files_registered, nectars_minted, descriptions_generated, hive_graph_versions, embeddings_computed, updated_at)
|
|
48
|
+
VALUES (1, ?, ?, ?, ?, ?, ?)
|
|
49
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
50
|
+
files_registered = excluded.files_registered,
|
|
51
|
+
nectars_minted = excluded.nectars_minted,
|
|
52
|
+
descriptions_generated = excluded.descriptions_generated,
|
|
53
|
+
hive_graph_versions = excluded.hive_graph_versions,
|
|
54
|
+
embeddings_computed = excluded.embeddings_computed,
|
|
55
|
+
updated_at = excluded.updated_at`)
|
|
56
|
+
.run(this.counts.filesRegistered, this.counts.nectarsMinted, this.counts.descriptionsGenerated, this.counts.hiveGraphVersions, this.counts.embeddingsComputed, this.nowFn());
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// fail-soft (AC-7 / AC-017b): a metrics write error never surfaces into the pipeline.
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Wrap a {@link HiveGraphStore} so the two counters with a precise 1:1
|
|
65
|
+
* store-level definition increment at their REAL completion point, with ZERO
|
|
66
|
+
* changes to the ladder (`registration/ladder.ts`) or the store adapters:
|
|
67
|
+
*
|
|
68
|
+
* - `nectarsMinted`: one `insertIdentity()` call = one freshly minted nectar
|
|
69
|
+
* (the ladder's step-5 `mintOrCopy` is the only caller in this repo). A
|
|
70
|
+
* THROWING insert (duplicate nectar, the store's own dedup guard) never
|
|
71
|
+
* increments, because the throw happens before the increment line below -
|
|
72
|
+
* no double counting across a rejected mint.
|
|
73
|
+
* - `hiveGraphVersions`: one `appendVersion()` call = one
|
|
74
|
+
* `hive_graph_versions` row written (ladder steps 2/3/4/5), the exact
|
|
75
|
+
* PRD-005 catalog write.
|
|
76
|
+
*
|
|
77
|
+
* `descriptionsGenerated` and `embeddingsComputed` are wired to the CLOSEST
|
|
78
|
+
* REAL signal available in this repo today rather than a fabricated hook: a
|
|
79
|
+
* version row only ever carries `describeStatus === "described"` or a
|
|
80
|
+
* non-null `embedding` once the enricher (PRD-007/PRD-016) and the embeddings
|
|
81
|
+
* provider (PRD-014) actually populate those fields on the row they pass to
|
|
82
|
+
* `appendVersion`. Neither pipeline exists in this repo yet - `ladder.ts`'s
|
|
83
|
+
* `baseVersion()` always writes `title/description: ""`, `describeStatus:
|
|
84
|
+
* "pending"`, and `embedding: null` - so both counters correctly read 0 until
|
|
85
|
+
* those PRDs land. This is a documented, intentional approximation (see the
|
|
86
|
+
* PRD-017 ledger evidence): the day a future PRD starts writing a "described"
|
|
87
|
+
* row or a non-null embedding through this same `appendVersion` call, the
|
|
88
|
+
* counter starts moving with no further wiring required.
|
|
89
|
+
*/
|
|
90
|
+
export function wrapStoreWithMetrics(store, sink) {
|
|
91
|
+
return new Proxy(store, {
|
|
92
|
+
get(target, prop, receiver) {
|
|
93
|
+
if (prop === "insertIdentity") {
|
|
94
|
+
return (row) => {
|
|
95
|
+
target.insertIdentity(row);
|
|
96
|
+
sink.incrementNectarsMinted();
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (prop === "appendVersion") {
|
|
100
|
+
return (row) => {
|
|
101
|
+
target.appendVersion(row);
|
|
102
|
+
sink.incrementHiveGraphVersions();
|
|
103
|
+
if (row.describeStatus === "described")
|
|
104
|
+
sink.incrementDescriptionsGenerated();
|
|
105
|
+
if (row.embedding !== null)
|
|
106
|
+
sink.incrementEmbeddingsComputed();
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return Reflect.get(target, prop, receiver);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The async twin of {@link wrapStoreWithMetrics}: wrap an
|
|
115
|
+
* {@link AsyncHiveGraphStore} so the same four store-level counters increment at
|
|
116
|
+
* their REAL completion point on the LIVE (durable) brood path, with ZERO
|
|
117
|
+
* changes to `runBroodAsync` or the Deep Lake adapter. The increment fires only
|
|
118
|
+
* AFTER the awaited write resolves - a rejected `insertIdentity` (the mint dedup
|
|
119
|
+
* guard) or `appendVersion` never increments, because the `await` throws before
|
|
120
|
+
* the increment line. This is what makes the PRD-017b `descriptionsGenerated` /
|
|
121
|
+
* `hiveGraphVersions` / `embeddingsComputed` / `nectarsMinted` counters move in
|
|
122
|
+
* production once the daemon actually broods against Deep Lake (the counters that
|
|
123
|
+
* previously stayed 0 because the pipeline never ran on the live boot path).
|
|
124
|
+
*/
|
|
125
|
+
export function wrapAsyncStoreWithMetrics(store, sink) {
|
|
126
|
+
return new Proxy(store, {
|
|
127
|
+
get(target, prop, receiver) {
|
|
128
|
+
if (prop === "insertIdentity") {
|
|
129
|
+
return async (row) => {
|
|
130
|
+
await target.insertIdentity(row);
|
|
131
|
+
sink.incrementNectarsMinted();
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (prop === "appendVersion") {
|
|
135
|
+
return async (row) => {
|
|
136
|
+
await target.appendVersion(row);
|
|
137
|
+
sink.incrementHiveGraphVersions();
|
|
138
|
+
if (row.describeStatus === "described")
|
|
139
|
+
sink.incrementDescriptionsGenerated();
|
|
140
|
+
if (row.embedding !== null)
|
|
141
|
+
sink.incrementEmbeddingsComputed();
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return Reflect.get(target, prop, receiver);
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/telemetry/metrics.ts"],"names":[],"mappings":"AAmDA,SAAS,UAAU;IACjB,OAAO;QACL,eAAe,EAAE,CAAC;QAClB,aAAa,EAAE,CAAC;QAChB,qBAAqB,EAAE,CAAC;QACxB,iBAAiB,EAAE,CAAC;QACpB,kBAAkB,EAAE,CAAC;KACtB,CAAC;AACJ,CAAC;AAQD,MAAM,OAAO,aAAa;IACP,EAAE,CAAqB;IACvB,KAAK,CAAe;IAC7B,MAAM,GAAkB,UAAU,EAAE,CAAC;IAE7C,YAAY,IAA0B;QACpC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QAC1D,wEAAwE;QACxE,sEAAsE;QACtE,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,QAAQ;QACN,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC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AG,CAAC,cAAc,KAAK,WAAW;wBAAE,IAAI,CAAC,8BAA8B,EAAE,CAAC;oBAC9E,IAAI,GAAG,CAAC,SAAS,KAAK,IAAI;wBAAE,IAAI,CAAC,2BAA2B,EAAE,CAAC;gBACjE,CAAC,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;KACF,CAAM,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** The pinned PostHog capture path. The full ingest URL is `${host}${POSTHOG_CAPTURE_PATH}`. */
|
|
2
|
+
export declare const POSTHOG_CAPTURE_PATH = "/i/v0/e/";
|
|
3
|
+
/** The default PostHog US cloud ingest host, used when no host was baked. */
|
|
4
|
+
export declare const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
|
|
5
|
+
/** The bounded POST timeout: a telemetry POST never delays a CLI verb longer than this. */
|
|
6
|
+
export declare const DEFAULT_EMIT_TIMEOUT_MS = 2000;
|
|
7
|
+
/** nectar's OWN opt-out env var. `NECTAR_TELEMETRY=0` silences all usage telemetry (ADR-0002: nectar depends on no honeycomb env). */
|
|
8
|
+
export declare const ENV_TELEMETRY = "NECTAR_TELEMETRY";
|
|
9
|
+
/**
|
|
10
|
+
* Honeycomb's family opt-out, DETECTED and honored when present (never
|
|
11
|
+
* required): an operator who silenced the honeycomb install with
|
|
12
|
+
* `HONEYCOMB_TELEMETRY=0` should not have to discover a second switch for a
|
|
13
|
+
* co-installed nectar. Detection-only per ADR-0002; nectar functions
|
|
14
|
+
* identically when honeycomb is absent.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DETECTED_FAMILY_TELEMETRY = "HONEYCOMB_TELEMETRY";
|
|
17
|
+
/** The cross-tool opt-out standard. Any value other than empty or "0" silences all usage telemetry. */
|
|
18
|
+
export declare const ENV_DO_NOT_TRACK = "DO_NOT_TRACK";
|
|
19
|
+
/** The installer-minted anonymous id file shared across the honeycomb product family. */
|
|
20
|
+
export declare const INSTALL_ID_FILE_NAME = "install-id";
|
|
21
|
+
/** The dedupe ledger + fallback distinct id file, namespaced so it coexists in the shared runtime dir. */
|
|
22
|
+
export declare const USAGE_LEDGER_FILE_NAME = "nectar-usage-telemetry.json";
|
|
23
|
+
/** The four lifecycle events this chokepoint may ever emit. */
|
|
24
|
+
export type UsageEventName = "nectar_installed" | "nectar_uninstalled" | "nectar_first_run" | "nectar_updated";
|
|
25
|
+
/** The CLOSED payload shape. Nothing outside these five keys ever leaves the machine. */
|
|
26
|
+
export interface UsageProperties {
|
|
27
|
+
readonly package: "nectar";
|
|
28
|
+
readonly version: string;
|
|
29
|
+
readonly os: string;
|
|
30
|
+
readonly arch: string;
|
|
31
|
+
readonly node: string;
|
|
32
|
+
}
|
|
33
|
+
/** Why an emit did NOT send. Resolved, never thrown. */
|
|
34
|
+
export type UsageSkipReason = "disabled" | "opted_out" | "already_reported" | "send_failed";
|
|
35
|
+
/** The outcome of one emit call (always resolves, never rejects). */
|
|
36
|
+
export interface UsageEmitOutcome {
|
|
37
|
+
readonly sent: boolean;
|
|
38
|
+
readonly skipped?: UsageSkipReason;
|
|
39
|
+
}
|
|
40
|
+
/** The minimal fetch response shape the chokepoint reads. */
|
|
41
|
+
export interface UsageFetchResponse {
|
|
42
|
+
readonly ok: boolean;
|
|
43
|
+
readonly status: number;
|
|
44
|
+
}
|
|
45
|
+
/** The minimal request init the chokepoint passes. */
|
|
46
|
+
export interface UsageFetchRequestInit {
|
|
47
|
+
readonly method: string;
|
|
48
|
+
readonly headers: Record<string, string>;
|
|
49
|
+
readonly body: string;
|
|
50
|
+
readonly signal?: AbortSignal;
|
|
51
|
+
}
|
|
52
|
+
/** The injectable fetch seam so tests record the POST instead of hitting PostHog. */
|
|
53
|
+
export type UsageFetch = (url: string, init: UsageFetchRequestInit) => Promise<UsageFetchResponse>;
|
|
54
|
+
/** The injectable seams. Production defaults are the global fetch, process.env, and ~/.honeycomb. */
|
|
55
|
+
export interface UsageEmitDeps {
|
|
56
|
+
readonly fetch?: UsageFetch;
|
|
57
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
58
|
+
/** Override the state dir (tests point this at a temp dir). Default: `~/.honeycomb`. */
|
|
59
|
+
readonly dir?: string;
|
|
60
|
+
/** Override the baked key (tests force the keyed branch without a bake). */
|
|
61
|
+
readonly posthogKey?: string;
|
|
62
|
+
/** Override the capture host. */
|
|
63
|
+
readonly posthogHost?: string;
|
|
64
|
+
readonly timeoutMs?: number;
|
|
65
|
+
/** Override the reported version (default: read from package.json). */
|
|
66
|
+
readonly version?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* True when the user opted out via nectar's own env var, the detected
|
|
70
|
+
* honeycomb family opt-out, or DO_NOT_TRACK (consoledonottrack.com convention).
|
|
71
|
+
*/
|
|
72
|
+
export declare function isOptedOut(env?: NodeJS.ProcessEnv): boolean;
|
|
73
|
+
/** Build the full capture URL from a host (trailing slashes trimmed). */
|
|
74
|
+
export declare function captureUrl(host: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* The nectar version, read from the package.json two levels above this
|
|
77
|
+
* module (src/telemetry-usage/ and dist/telemetry-usage/ both sit two levels
|
|
78
|
+
* below the package root). Fail-soft to "0.0.0" so a packaging anomaly never
|
|
79
|
+
* breaks a CLI verb.
|
|
80
|
+
*/
|
|
81
|
+
export declare function readPackageVersion(): string;
|
|
82
|
+
/**
|
|
83
|
+
* THE CHOKEPOINT. Emit one lifecycle event through the gates (disabled, opted
|
|
84
|
+
* out, already reported) and, past all three, a single bounded fire-and-forget
|
|
85
|
+
* POST. On a 2xx the dedupe key is recorded in the ledger. Never throws.
|
|
86
|
+
*/
|
|
87
|
+
export declare function emitUsageEvent(event: UsageEventName, deps?: UsageEmitDeps): Promise<UsageEmitOutcome>;
|
|
88
|
+
/** Fired by `nectar install` after the installer succeeds. Once per machine. */
|
|
89
|
+
export declare function emitInstalled(deps?: UsageEmitDeps): Promise<UsageEmitOutcome>;
|
|
90
|
+
/** Fired by `nectar uninstall` before teardown. Fire-and-forget. */
|
|
91
|
+
export declare function emitUninstalled(deps?: UsageEmitDeps): Promise<UsageEmitOutcome>;
|
|
92
|
+
/** The outcome of the daemon-start hook: which of the two events were attempted. */
|
|
93
|
+
export interface DaemonStartTelemetry {
|
|
94
|
+
readonly firstRun: UsageEmitOutcome | null;
|
|
95
|
+
readonly updated: UsageEmitOutcome | null;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The daemon-start hook: fires `nectar_first_run` (once per machine) and,
|
|
99
|
+
* when the persisted last-seen version differs from the current one, fires
|
|
100
|
+
* `nectar_updated` (deduped per version), then persists the new version.
|
|
101
|
+
* The version bookkeeping is a local file write and happens regardless of the
|
|
102
|
+
* emit gates, so a later opt-in never replays a stale backlog. Never throws.
|
|
103
|
+
*/
|
|
104
|
+
export declare function recordDaemonStart(deps?: UsageEmitDeps): Promise<DaemonStartTelemetry>;
|
|
105
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/telemetry-usage/emit.ts"],"names":[],"mappings":"AA0CA,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAE/D,2FAA2F;AAC3F,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,sIAAsI;AACtI,eAAO,MAAM,aAAa,qBAAqB,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,yFAAyF;AACzF,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,0GAA0G;AAC1G,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AAEpE,+DAA+D;AAC/D,M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usage-telemetry chokepoint for nectar.
|
|
3
|
+
*
|
|
4
|
+
* NOT src/telemetry/: that module is the doctor SQLite fleet-telemetry
|
|
5
|
+
* store (check-ins, heartbeats, logs). THIS module is the only place in the
|
|
6
|
+
* codebase that posts anonymous lifecycle events (installed, uninstalled,
|
|
7
|
+
* first_run, updated) to the PostHog capture endpoint. It mirrors honeycomb's
|
|
8
|
+
* emit chokepoint posture (honeycomb src/daemon/runtime/telemetry/emit.ts):
|
|
9
|
+
*
|
|
10
|
+
* - body is exactly { api_key, event, properties, distinct_id }, POSTed to
|
|
11
|
+
* {host}/i/v0/e/ with a 2 second AbortController timeout;
|
|
12
|
+
* - the payload is built from a CLOSED allow-list, never from caller input:
|
|
13
|
+
* { package: "nectar", version, os, arch, node } and nothing else;
|
|
14
|
+
* - gates, in order: (1) empty baked key means hard-disabled (every dev or
|
|
15
|
+
* source build), (2) NECTAR_TELEMETRY=0 (nectar's own switch), the
|
|
16
|
+
* DETECTED HONEYCOMB_TELEMETRY=0 family opt-out, or DO_NOT_TRACK truthy
|
|
17
|
+
* means opted out, (3) the dedupe ledger means at most once per machine
|
|
18
|
+
* (per version for nectar_updated);
|
|
19
|
+
* - fail-soft everywhere: emit never throws, never blocks past the bounded
|
|
20
|
+
* timeout, and never changes a host flow's exit code. A network error, a
|
|
21
|
+
* timeout, a 4xx, a 5xx, or a ledger IO failure all resolve to a skipped
|
|
22
|
+
* outcome instead of propagating.
|
|
23
|
+
*
|
|
24
|
+
* The key arrives via src/telemetry-usage/posthog-key.ts, a committed-empty
|
|
25
|
+
* stub that scripts/bake-posthog-key.mjs rewrites in dist/ at release time
|
|
26
|
+
* (plain tsc build, so there is no esbuild define mechanism here).
|
|
27
|
+
*
|
|
28
|
+
* distinct_id is anonymous: the honeycomb installer's ~/.honeycomb/install-id
|
|
29
|
+
* when present (so the funnel correlates across the product family), else a
|
|
30
|
+
* random UUID minted once and persisted in the ledger file under nectar's
|
|
31
|
+
* runtime dir (~/.honeycomb by default, resolveConfig's RUNTIME_DIR_NAME).
|
|
32
|
+
* Never an email, an account id, a hostname, or a path.
|
|
33
|
+
*/
|
|
34
|
+
import { randomUUID } from "node:crypto";
|
|
35
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
36
|
+
import { arch, homedir, platform } from "node:os";
|
|
37
|
+
import { dirname, join } from "node:path";
|
|
38
|
+
import { fileURLToPath } from "node:url";
|
|
39
|
+
import { RUNTIME_DIR_NAME } from "../config.js";
|
|
40
|
+
import { POSTHOG_HOST, POSTHOG_KEY } from "./posthog-key.js";
|
|
41
|
+
/** The pinned PostHog capture path. The full ingest URL is `${host}${POSTHOG_CAPTURE_PATH}`. */
|
|
42
|
+
export const POSTHOG_CAPTURE_PATH = "/i/v0/e/";
|
|
43
|
+
/** The default PostHog US cloud ingest host, used when no host was baked. */
|
|
44
|
+
export const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
|
|
45
|
+
/** The bounded POST timeout: a telemetry POST never delays a CLI verb longer than this. */
|
|
46
|
+
export const DEFAULT_EMIT_TIMEOUT_MS = 2000;
|
|
47
|
+
/** nectar's OWN opt-out env var. `NECTAR_TELEMETRY=0` silences all usage telemetry (ADR-0002: nectar depends on no honeycomb env). */
|
|
48
|
+
export const ENV_TELEMETRY = "NECTAR_TELEMETRY";
|
|
49
|
+
/**
|
|
50
|
+
* Honeycomb's family opt-out, DETECTED and honored when present (never
|
|
51
|
+
* required): an operator who silenced the honeycomb install with
|
|
52
|
+
* `HONEYCOMB_TELEMETRY=0` should not have to discover a second switch for a
|
|
53
|
+
* co-installed nectar. Detection-only per ADR-0002; nectar functions
|
|
54
|
+
* identically when honeycomb is absent.
|
|
55
|
+
*/
|
|
56
|
+
export const DETECTED_FAMILY_TELEMETRY = "HONEYCOMB_TELEMETRY";
|
|
57
|
+
/** The cross-tool opt-out standard. Any value other than empty or "0" silences all usage telemetry. */
|
|
58
|
+
export const ENV_DO_NOT_TRACK = "DO_NOT_TRACK";
|
|
59
|
+
/** The installer-minted anonymous id file shared across the honeycomb product family. */
|
|
60
|
+
export const INSTALL_ID_FILE_NAME = "install-id";
|
|
61
|
+
/** The dedupe ledger + fallback distinct id file, namespaced so it coexists in the shared runtime dir. */
|
|
62
|
+
export const USAGE_LEDGER_FILE_NAME = "nectar-usage-telemetry.json";
|
|
63
|
+
/**
|
|
64
|
+
* The falsy family a boolean-style opt-out accepts: `0`, `false`, `off`
|
|
65
|
+
* (case-insensitive), plus `no`. NEC-042 item 4 / AC-018l.11: `NECTAR_TELEMETRY`
|
|
66
|
+
* honored only the literal `"0"` before, so `NECTAR_TELEMETRY=false`/`off` were
|
|
67
|
+
* silently IGNORED (telemetry stayed on). Now the whole falsy family opts out.
|
|
68
|
+
*/
|
|
69
|
+
function isFalsyFlag(raw) {
|
|
70
|
+
if (raw === undefined)
|
|
71
|
+
return false;
|
|
72
|
+
const v = raw.trim().toLowerCase();
|
|
73
|
+
return v === "0" || v === "false" || v === "off" || v === "no";
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* True when the user opted out via nectar's own env var, the detected
|
|
77
|
+
* honeycomb family opt-out, or DO_NOT_TRACK (consoledonottrack.com convention).
|
|
78
|
+
*/
|
|
79
|
+
export function isOptedOut(env = process.env) {
|
|
80
|
+
if (isFalsyFlag(env[ENV_TELEMETRY]))
|
|
81
|
+
return true;
|
|
82
|
+
if (env[DETECTED_FAMILY_TELEMETRY] === "0")
|
|
83
|
+
return true;
|
|
84
|
+
const dnt = env[ENV_DO_NOT_TRACK];
|
|
85
|
+
return dnt !== undefined && dnt !== "" && dnt !== "0";
|
|
86
|
+
}
|
|
87
|
+
/** Build the full capture URL from a host (trailing slashes trimmed). */
|
|
88
|
+
export function captureUrl(host) {
|
|
89
|
+
return `${host.replace(/\/+$/, "")}${POSTHOG_CAPTURE_PATH}`;
|
|
90
|
+
}
|
|
91
|
+
/** The default state dir: nectar's runtime dir convention (shared `~/.honeycomb`). */
|
|
92
|
+
function defaultStateDir() {
|
|
93
|
+
return join(homedir(), RUNTIME_DIR_NAME);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The nectar version, read from the package.json two levels above this
|
|
97
|
+
* module (src/telemetry-usage/ and dist/telemetry-usage/ both sit two levels
|
|
98
|
+
* below the package root). Fail-soft to "0.0.0" so a packaging anomaly never
|
|
99
|
+
* breaks a CLI verb.
|
|
100
|
+
*/
|
|
101
|
+
export function readPackageVersion() {
|
|
102
|
+
try {
|
|
103
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
104
|
+
const raw = readFileSync(join(here, "..", "..", "package.json"), "utf8");
|
|
105
|
+
const parsed = JSON.parse(raw);
|
|
106
|
+
return typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "0.0.0";
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return "0.0.0";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** Load the ledger, treating a missing or corrupt file as a fresh one (fail-soft). */
|
|
113
|
+
function loadLedger(dir) {
|
|
114
|
+
try {
|
|
115
|
+
const raw = readFileSync(join(dir, USAGE_LEDGER_FILE_NAME), "utf8");
|
|
116
|
+
const parsed = JSON.parse(raw);
|
|
117
|
+
return {
|
|
118
|
+
...(typeof parsed.distinctId === "string" ? { distinctId: parsed.distinctId } : {}),
|
|
119
|
+
reported: Array.isArray(parsed.reported) ? parsed.reported.filter((e) => typeof e === "string") : [],
|
|
120
|
+
...(typeof parsed.lastSeenVersion === "string" ? { lastSeenVersion: parsed.lastSeenVersion } : {}),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return { reported: [] };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** Persist the ledger, creating the state dir (0o700) when needed. Throws on IO failure; callers swallow. */
|
|
128
|
+
function saveLedger(dir, ledger) {
|
|
129
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
130
|
+
writeFileSync(join(dir, USAGE_LEDGER_FILE_NAME), `${JSON.stringify(ledger, null, 2)}\n`, "utf8");
|
|
131
|
+
}
|
|
132
|
+
/** Read the installer's anonymous install-id when present and non-empty, else undefined. */
|
|
133
|
+
function readInstallId(dir) {
|
|
134
|
+
try {
|
|
135
|
+
const raw = readFileSync(join(dir, INSTALL_ID_FILE_NAME), "utf8").trim();
|
|
136
|
+
return raw.length > 0 ? raw : undefined;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** The dedupe ledger key: plain event name, except updated which dedupes per version. */
|
|
143
|
+
function dedupeKey(event, version) {
|
|
144
|
+
return event === "nectar_updated" ? `${event}@${version}` : event;
|
|
145
|
+
}
|
|
146
|
+
/** Assemble the closed allow-list payload. This is the only payload builder; no caller input flows in. */
|
|
147
|
+
function buildProperties(version) {
|
|
148
|
+
return { package: "nectar", version, os: platform(), arch: arch(), node: process.version };
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* THE CHOKEPOINT. Emit one lifecycle event through the gates (disabled, opted
|
|
152
|
+
* out, already reported) and, past all three, a single bounded fire-and-forget
|
|
153
|
+
* POST. On a 2xx the dedupe key is recorded in the ledger. Never throws.
|
|
154
|
+
*/
|
|
155
|
+
export async function emitUsageEvent(event, deps = {}) {
|
|
156
|
+
const key = deps.posthogKey ?? POSTHOG_KEY;
|
|
157
|
+
// Gate 1: empty baked key means hard-disabled (dev or source build). No IO, no network.
|
|
158
|
+
if (key.length === 0)
|
|
159
|
+
return { sent: false, skipped: "disabled" };
|
|
160
|
+
// Gate 2: opted out via either env var. No IO, no network.
|
|
161
|
+
if (isOptedOut(deps.env ?? process.env))
|
|
162
|
+
return { sent: false, skipped: "opted_out" };
|
|
163
|
+
try {
|
|
164
|
+
const dir = deps.dir ?? defaultStateDir();
|
|
165
|
+
const version = deps.version ?? readPackageVersion();
|
|
166
|
+
const ledger = loadLedger(dir);
|
|
167
|
+
// distinct_id preference: the installer's install-id when present, else a
|
|
168
|
+
// UUID minted once and persisted in the ledger so it stays stable.
|
|
169
|
+
let distinctId = readInstallId(dir);
|
|
170
|
+
if (distinctId === undefined) {
|
|
171
|
+
if (ledger.distinctId === undefined) {
|
|
172
|
+
ledger.distinctId = randomUUID();
|
|
173
|
+
saveLedger(dir, ledger);
|
|
174
|
+
}
|
|
175
|
+
distinctId = ledger.distinctId;
|
|
176
|
+
}
|
|
177
|
+
// Gate 3: dedupe. Each event sends at most once per machine (per version for updated).
|
|
178
|
+
const dedupe = dedupeKey(event, version);
|
|
179
|
+
if (ledger.reported.includes(dedupe))
|
|
180
|
+
return { sent: false, skipped: "already_reported" };
|
|
181
|
+
const ok = await postCapture(event, buildProperties(version), distinctId, key, deps);
|
|
182
|
+
if (!ok)
|
|
183
|
+
return { sent: false, skipped: "send_failed" };
|
|
184
|
+
// 2xx: record the dedupe key. The persist is best-effort; a failure here
|
|
185
|
+
// must not flip a successful send into send_failed.
|
|
186
|
+
try {
|
|
187
|
+
ledger.reported.push(dedupe);
|
|
188
|
+
saveLedger(dir, ledger);
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
// A persist hiccup after a successful send is non-fatal.
|
|
192
|
+
}
|
|
193
|
+
return { sent: true };
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
// Fail-soft: any unexpected error (IO, a thrown fetch) is swallowed.
|
|
197
|
+
return { sent: false, skipped: "send_failed" };
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/** Issue the ONE bounded-timeout POST and report whether it was a 2xx. Swallows everything. */
|
|
201
|
+
async function postCapture(event, properties, distinctId, key, deps) {
|
|
202
|
+
const doFetch = deps.fetch ?? globalThis.fetch;
|
|
203
|
+
const host = deps.posthogHost ?? (POSTHOG_HOST.length > 0 ? POSTHOG_HOST : DEFAULT_POSTHOG_HOST);
|
|
204
|
+
const timeoutMs = deps.timeoutMs ?? DEFAULT_EMIT_TIMEOUT_MS;
|
|
205
|
+
const body = { api_key: key, event, properties, distinct_id: distinctId };
|
|
206
|
+
const controller = new AbortController();
|
|
207
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
208
|
+
try {
|
|
209
|
+
const resp = await doFetch(captureUrl(host), {
|
|
210
|
+
method: "POST",
|
|
211
|
+
headers: { "Content-Type": "application/json" },
|
|
212
|
+
body: JSON.stringify(body),
|
|
213
|
+
signal: controller.signal,
|
|
214
|
+
});
|
|
215
|
+
return resp.ok;
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
// A dropped lifecycle event is acceptable; a hung CLI verb is not.
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
finally {
|
|
222
|
+
clearTimeout(timer);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/** Fired by `nectar install` after the installer succeeds. Once per machine. */
|
|
226
|
+
export async function emitInstalled(deps = {}) {
|
|
227
|
+
return emitUsageEvent("nectar_installed", deps);
|
|
228
|
+
}
|
|
229
|
+
/** Fired by `nectar uninstall` before teardown. Fire-and-forget. */
|
|
230
|
+
export function emitUninstalled(deps = {}) {
|
|
231
|
+
return emitUsageEvent("nectar_uninstalled", deps);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The daemon-start hook: fires `nectar_first_run` (once per machine) and,
|
|
235
|
+
* when the persisted last-seen version differs from the current one, fires
|
|
236
|
+
* `nectar_updated` (deduped per version), then persists the new version.
|
|
237
|
+
* The version bookkeeping is a local file write and happens regardless of the
|
|
238
|
+
* emit gates, so a later opt-in never replays a stale backlog. Never throws.
|
|
239
|
+
*/
|
|
240
|
+
export async function recordDaemonStart(deps = {}) {
|
|
241
|
+
try {
|
|
242
|
+
const dir = deps.dir ?? defaultStateDir();
|
|
243
|
+
const version = deps.version ?? readPackageVersion();
|
|
244
|
+
const lastSeen = loadLedger(dir).lastSeenVersion;
|
|
245
|
+
const firstRun = await emitUsageEvent("nectar_first_run", deps);
|
|
246
|
+
let updated = null;
|
|
247
|
+
if (lastSeen !== undefined && lastSeen !== version) {
|
|
248
|
+
updated = await emitUsageEvent("nectar_updated", deps);
|
|
249
|
+
}
|
|
250
|
+
if (lastSeen !== version) {
|
|
251
|
+
// Reload: the emits above may have persisted dedupe entries or a distinct id.
|
|
252
|
+
const ledger = loadLedger(dir);
|
|
253
|
+
ledger.lastSeenVersion = version;
|
|
254
|
+
try {
|
|
255
|
+
saveLedger(dir, ledger);
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
// Best-effort; the updated event's per-version dedupe is the backstop.
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return { firstRun, updated };
|
|
262
|
+
}
|
|
263
|
+
catch {
|
|
264
|
+
return { firstRun: null, updated: null };
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=emit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/telemetry-usage/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE7D,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAE/D,2FAA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AI,CAAC,CAAC;QAEhE,IAAI,OAAO,GAA4B,IAAI,CAAC;QAC5C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACnD,OAAO,GAAG,MAAM,cAAc,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,8EAA8E;YAC9E,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,CAAC,eAAe,GAAG,OAAO,CAAC;YACjC,IAAI,CAAC;gBACH,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAC1B,CAAC;YAAC,MAAM,CAAC;gBACP,uEAAuE;YACzE,CAAC;QACH,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PostHog ingest destination stub for USAGE telemetry (lifecycle events).
|
|
3
|
+
* Not related to src/telemetry/, which is the doctor SQLite fleet store.
|
|
4
|
+
*
|
|
5
|
+
* BOTH constants are committed EMPTY and MUST stay "" in source. nectar
|
|
6
|
+
* builds with plain tsc (no esbuild, so no `define` mechanism); the real
|
|
7
|
+
* values are baked into the compiled OUTPUT instead: the release workflow's
|
|
8
|
+
* gate job runs scripts/bake-posthog-key.mjs after the last build step, which
|
|
9
|
+
* rewrites dist/telemetry-usage/posthog-key.js in place from the
|
|
10
|
+
* NECTAR_POSTHOG_KEY / NECTAR_POSTHOG_HOST environment (the HONEYCOMB_* names
|
|
11
|
+
* are a detected fallback while the family shares one ingest project; never
|
|
12
|
+
* required, per ADR-0002). The baked dist/ is what the publish job ships
|
|
13
|
+
* verbatim.
|
|
14
|
+
*
|
|
15
|
+
* An empty key hard-disables usage telemetry (src/telemetry-usage/emit.ts
|
|
16
|
+
* gate 1), so every dev/source/fork build sends nothing. The key is a public
|
|
17
|
+
* write-only PostHog ingest key, not a read-capable secret; it is still kept
|
|
18
|
+
* out of source so unkeyed builds stay silent by construction.
|
|
19
|
+
*/
|
|
20
|
+
export declare const POSTHOG_KEY = "";
|
|
21
|
+
export declare const POSTHOG_HOST = "";
|
|
22
|
+
//# sourceMappingURL=posthog-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog-key.d.ts","sourceRoot":"","sources":["../../src/telemetry-usage/posthog-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,YAAY,KAAK,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PostHog ingest destination stub for USAGE telemetry (lifecycle events).
|
|
3
|
+
* Not related to src/telemetry/, which is the doctor SQLite fleet store.
|
|
4
|
+
*
|
|
5
|
+
* BOTH constants are committed EMPTY and MUST stay "" in source. nectar
|
|
6
|
+
* builds with plain tsc (no esbuild, so no `define` mechanism); the real
|
|
7
|
+
* values are baked into the compiled OUTPUT instead: the release workflow's
|
|
8
|
+
* gate job runs scripts/bake-posthog-key.mjs after the last build step, which
|
|
9
|
+
* rewrites dist/telemetry-usage/posthog-key.js in place from the
|
|
10
|
+
* NECTAR_POSTHOG_KEY / NECTAR_POSTHOG_HOST environment (the HONEYCOMB_* names
|
|
11
|
+
* are a detected fallback while the family shares one ingest project; never
|
|
12
|
+
* required, per ADR-0002). The baked dist/ is what the publish job ships
|
|
13
|
+
* verbatim.
|
|
14
|
+
*
|
|
15
|
+
* An empty key hard-disables usage telemetry (src/telemetry-usage/emit.ts
|
|
16
|
+
* gate 1), so every dev/source/fork build sends nothing. The key is a public
|
|
17
|
+
* write-only PostHog ingest key, not a read-capable secret; it is still kept
|
|
18
|
+
* out of source so unkeyed builds stay silent by construction.
|
|
19
|
+
*/
|
|
20
|
+
export const POSTHOG_KEY = "";
|
|
21
|
+
export const POSTHOG_HOST = "";
|
|
22
|
+
//# sourceMappingURL=posthog-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog-key.js","sourceRoot":"","sources":["../../src/telemetry-usage/posthog-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC"}
|