@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,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The injectable HTTP seam shared by both embedding transports (PRD-014).
|
|
3
|
+
*
|
|
4
|
+
* A minimal `fetch`-shaped surface so neither the local nomic client nor the
|
|
5
|
+
* hosted-via-Portkey transport touches the network in a unit test: production
|
|
6
|
+
* binds `globalThis.fetch`, a test injects a fake that returns a canned
|
|
7
|
+
* response. The shape is deliberately identical to the sibling chat transport's
|
|
8
|
+
* `PortkeyFetch` (`src/portkey/transport.ts`) so the Wave-2 integrator can fold
|
|
9
|
+
* the two onto one shared seam without a signature change.
|
|
10
|
+
*/
|
|
11
|
+
/** Bind the real global `fetch` to the {@link FetchLike} shape (Node >=22 ships it as a built-in). */
|
|
12
|
+
export function defaultFetch() {
|
|
13
|
+
return globalThis.fetch.bind(globalThis);
|
|
14
|
+
}
|
|
15
|
+
/** The production sleep, backed by a real timer. */
|
|
16
|
+
export function defaultSleep(ms) {
|
|
17
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/embeddings/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkBH,sGAAsG;AACtG,MAAM,UAAU,YAAY;IAC1B,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAyB,CAAC;AACnE,CAAC;AAKD,oDAAoD;AACpD,MAAM,UAAU,YAAY,CAAC,EAAU;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The embeddings-provider module barrel (PRD-014).
|
|
3
|
+
*
|
|
4
|
+
* The single import surface for the switch and its providers. The Wave-2
|
|
5
|
+
* integrator re-exports what it needs from the top-level `src/index.ts` and
|
|
6
|
+
* wires `resolveEmbedProvider(resolveEmbeddingsConfig())` into the enricher /
|
|
7
|
+
* brooding / recall seams (PRD-007 / 016 / 012 / 013). See the module report for
|
|
8
|
+
* the exact wiring and the `src/portkey/headers.ts` duplication to unify.
|
|
9
|
+
*/
|
|
10
|
+
export { type EmbedProvider, type EmbedProviderSelector, type ResolveEmbedProviderDeps, createOffProvider, resolveEmbedProvider, DEFAULT_EMBED_PROVIDER, } from "./provider.js";
|
|
11
|
+
export { type ResolvedEmbeddingsConfig, type EmbeddingsConfigOverrides, resolveEmbeddingsConfig, normalizeSelector, } from "./config.js";
|
|
12
|
+
export { type DimRejection, type DimRejectionSink, guardVector, withDimGuard, stderrDimRejectionSink, } from "./guard.js";
|
|
13
|
+
export { type LocalNomicConfig, type LocalNomicTransport, type LocalNomicHttpDeps, createLocalNomicHttpTransport, createLocalNomicProvider, DEFAULT_LOCAL_EMBED_HOST, DEFAULT_LOCAL_EMBED_PORT, DEFAULT_LOCAL_EMBED_TIMEOUT_MS, } from "./local-nomic.js";
|
|
14
|
+
export { type HostedEmbeddingsConfig, type HostedPortkeyDeps, createHostedPortkeyProvider, parseEmbeddingsResponse, DEFAULT_HOSTED_EMBED_MODEL, DEFAULT_HOSTED_OUTPUT_DIMENSION, DEFAULT_HOSTED_MAX_ATTEMPTS, DEFAULT_HOSTED_RETRY_BACKOFF_MS, DEFAULT_HOSTED_REQUEST_TIMEOUT_MS, HOSTED_RETRYABLE_STATUSES, } from "./hosted-portkey.js";
|
|
15
|
+
export { type FetchLike, type FetchResponseLike, type SleepFn, defaultFetch, defaultSleep, } from "./http.js";
|
|
16
|
+
export { buildPortkeyHeaders, PORTKEY_BASE_URL, PORTKEY_EMBEDDINGS_URL, PORTKEY_API_KEY_HEADER, PORTKEY_CONFIG_HEADER, } from "../portkey/headers.js";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embeddings/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,WAAW,EACX,YAAY,EACZ,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,6BAA6B,EAC7B,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,+BAA+B,EAC/B,2BAA2B,EAC3B,+BAA+B,EAC/B,iCAAiC,EACjC,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,YAAY,EACZ,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The embeddings-provider module barrel (PRD-014).
|
|
3
|
+
*
|
|
4
|
+
* The single import surface for the switch and its providers. The Wave-2
|
|
5
|
+
* integrator re-exports what it needs from the top-level `src/index.ts` and
|
|
6
|
+
* wires `resolveEmbedProvider(resolveEmbeddingsConfig())` into the enricher /
|
|
7
|
+
* brooding / recall seams (PRD-007 / 016 / 012 / 013). See the module report for
|
|
8
|
+
* the exact wiring and the `src/portkey/headers.ts` duplication to unify.
|
|
9
|
+
*/
|
|
10
|
+
export { createOffProvider, resolveEmbedProvider, DEFAULT_EMBED_PROVIDER, } from "./provider.js";
|
|
11
|
+
export { resolveEmbeddingsConfig, normalizeSelector, } from "./config.js";
|
|
12
|
+
export { guardVector, withDimGuard, stderrDimRejectionSink, } from "./guard.js";
|
|
13
|
+
export { createLocalNomicHttpTransport, createLocalNomicProvider, DEFAULT_LOCAL_EMBED_HOST, DEFAULT_LOCAL_EMBED_PORT, DEFAULT_LOCAL_EMBED_TIMEOUT_MS, } from "./local-nomic.js";
|
|
14
|
+
export { createHostedPortkeyProvider, parseEmbeddingsResponse, DEFAULT_HOSTED_EMBED_MODEL, DEFAULT_HOSTED_OUTPUT_DIMENSION, DEFAULT_HOSTED_MAX_ATTEMPTS, DEFAULT_HOSTED_RETRY_BACKOFF_MS, DEFAULT_HOSTED_REQUEST_TIMEOUT_MS, HOSTED_RETRYABLE_STATUSES, } from "./hosted-portkey.js";
|
|
15
|
+
export { defaultFetch, defaultSleep, } from "./http.js";
|
|
16
|
+
export { buildPortkeyHeaders, PORTKEY_BASE_URL, PORTKEY_EMBEDDINGS_URL, PORTKEY_API_KEY_HEADER, PORTKEY_CONFIG_HEADER, } from "../portkey/headers.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/embeddings/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAIL,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,WAAW,EACX,YAAY,EACZ,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAIL,6BAA6B,EAC7B,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,+BAA+B,EAC/B,2BAA2B,EAC3B,+BAA+B,EAC/B,iCAAiC,EACjC,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIL,YAAY,EACZ,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The local nomic embedding provider (PRD-014a — the zero-marginal-cost DEFAULT).
|
|
3
|
+
*
|
|
4
|
+
* Talks to the local nomic embed daemon the corpus describes
|
|
5
|
+
* (`ai/enricher-and-llm-model.md` § Embeddings: "the local nomic path
|
|
6
|
+
* (`nomic-embed-text-v1.5`, q8 quantization)"). Honeycomb's embed daemon
|
|
7
|
+
* (`honeycomb/embeddings/src/index.ts`) serves that model over a loopback
|
|
8
|
+
* request surface (`POST /embed { text } -> { vector }`, `GET /health`) on
|
|
9
|
+
* `127.0.0.1:3851`. Nectar reaches it over the network through its OWN
|
|
10
|
+
* client rather than importing the honeycomb runtime in-process (ADR-0002); the
|
|
11
|
+
* daemon owns the pinned `MODEL_ID` / `MODEL_REVISION` / `MODEL_QUANTIZATION` /
|
|
12
|
+
* `DOCUMENT_PREFIX` consts (PRD-014a keeps them pinned), so this client only
|
|
13
|
+
* carries the text and receives the vector.
|
|
14
|
+
*
|
|
15
|
+
* ── Fail-soft is the cardinal rule (AC-4) ────────────────────────────────────
|
|
16
|
+
* A dead daemon (connection refused), a not-yet-warm daemon (503 `model not
|
|
17
|
+
* ready`), a non-2xx, or a malformed body ALL resolve to `null` for that text —
|
|
18
|
+
* NEVER a throw into the caller's hot path. A `null` means the caller leaves the
|
|
19
|
+
* column NULL and recall degrades to BM25 (`ai/enricher-and-llm-model.md`). The
|
|
20
|
+
* dimension is NOT checked here; the 768-dim guard (`guard.ts`) owns that at the
|
|
21
|
+
* provider boundary, so a wrong-dim daemon output is discarded there (AC-3).
|
|
22
|
+
*
|
|
23
|
+
* The transport is an injectable seam ({@link LocalNomicTransport}) so a unit
|
|
24
|
+
* test drives the provider without binding a socket or running the ~600 MB model.
|
|
25
|
+
*/
|
|
26
|
+
import { type FetchLike } from "./http.js";
|
|
27
|
+
import type { EmbedProvider } from "./provider.js";
|
|
28
|
+
/**
|
|
29
|
+
* The pinned local nomic model id (PRD-014a / `ai/enricher-and-llm-model.md`).
|
|
30
|
+
* The embed daemon owns the model, revision, and quantization; nectar records
|
|
31
|
+
* this id as `embed_model` provenance on rows the local provider embeds
|
|
32
|
+
* (PRD-018i / NEC-018).
|
|
33
|
+
*/
|
|
34
|
+
export declare const LOCAL_NOMIC_MODEL_ID: "nomic-embed-text-v1.5";
|
|
35
|
+
/** The local embed daemon's loopback host (matches honeycomb's `EMBED_HOST`). */
|
|
36
|
+
export declare const DEFAULT_LOCAL_EMBED_HOST: "127.0.0.1";
|
|
37
|
+
/** The local embed daemon's loopback port (matches honeycomb's `EMBED_PORT` / `src/config.ts` note). */
|
|
38
|
+
export declare const DEFAULT_LOCAL_EMBED_PORT: 3851;
|
|
39
|
+
/** The per-text request timeout (ms) before the client gives up and returns `null` (fail-soft). */
|
|
40
|
+
export declare const DEFAULT_LOCAL_EMBED_TIMEOUT_MS: 10000;
|
|
41
|
+
/** The resolved local-nomic client config (host/port/timeout). */
|
|
42
|
+
export interface LocalNomicConfig {
|
|
43
|
+
readonly host: string;
|
|
44
|
+
readonly port: number;
|
|
45
|
+
readonly requestTimeoutMs: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The injectable local-daemon transport seam. `embedOne` returns the daemon's
|
|
49
|
+
* RAW vector for one text, or `null` on ANY failure (dead/not-warm daemon,
|
|
50
|
+
* non-2xx, malformed body). It never throws. The returned vector is NOT
|
|
51
|
+
* dimension-checked here — the guard owns that.
|
|
52
|
+
*/
|
|
53
|
+
export interface LocalNomicTransport {
|
|
54
|
+
embedOne(text: string): Promise<number[] | null>;
|
|
55
|
+
}
|
|
56
|
+
/** Construction deps for {@link createLocalNomicHttpTransport}; the fetch is injectable for tests. */
|
|
57
|
+
export interface LocalNomicHttpDeps {
|
|
58
|
+
/** The `fetch` implementation; defaults to `globalThis.fetch`. A test injects a fake (no socket). */
|
|
59
|
+
readonly fetch?: FetchLike;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Build the REAL local-nomic transport: a loopback HTTP client to the embed
|
|
63
|
+
* daemon's `POST /embed` (PRD-014a). Every failure path — a network error
|
|
64
|
+
* (daemon down), a non-2xx (e.g. 503 not-warm), or a malformed body — resolves
|
|
65
|
+
* to `null` (fail-soft, AC-4), NEVER a throw. Production uses `globalThis.fetch`;
|
|
66
|
+
* a test injects a fake `fetch` so no socket is bound. An `AbortController`
|
|
67
|
+
* bounds each call so a hung daemon cannot stall the embed path.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createLocalNomicHttpTransport(config: LocalNomicConfig, deps?: LocalNomicHttpDeps): LocalNomicTransport;
|
|
70
|
+
/**
|
|
71
|
+
* Build the local nomic {@link EmbedProvider} over an injected transport. The
|
|
72
|
+
* provider embeds each text through the daemon (order-preserving, 1:1) and maps
|
|
73
|
+
* ANY per-text failure to `null` — a rejected transport promise is caught here so
|
|
74
|
+
* the provider's never-throw contract holds even if a future transport rejects
|
|
75
|
+
* (AC-4). The returned vectors are dimension-guarded by the caller (`guard.ts`).
|
|
76
|
+
*/
|
|
77
|
+
export declare function createLocalNomicProvider(transport: LocalNomicTransport): EmbedProvider;
|
|
78
|
+
//# sourceMappingURL=local-nomic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-nomic.d.ts","sourceRoot":"","sources":["../../src/embeddings/local-nomic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAG,uBAAgC,CAAC;AAErE,iFAAiF;AACjF,eAAO,MAAM,wBAAwB,EAAG,WAAoB,CAAC;AAE7D,wGAAwG;AACxG,eAAO,MAAM,wBAAwB,EAAG,IAAa,CAAC;AAEtD,mGAAmG;AACnG,eAAO,MAAM,8BAA8B,EAAG,KAAe,CAAC;AAE9D,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;CAClD;AAED,sGAAsG;AACtG,MAAM,WAAW,kBAAkB;IACjC,qGAAqG;IACrG,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC5B;AA0BD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,gBAAgB,EACxB,IAAI,GAAE,kBAAuB,GAC5B,mBAAmB,CA0BrB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,mBAAmB,GAAG,aAAa,CAetF"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The local nomic embedding provider (PRD-014a — the zero-marginal-cost DEFAULT).
|
|
3
|
+
*
|
|
4
|
+
* Talks to the local nomic embed daemon the corpus describes
|
|
5
|
+
* (`ai/enricher-and-llm-model.md` § Embeddings: "the local nomic path
|
|
6
|
+
* (`nomic-embed-text-v1.5`, q8 quantization)"). Honeycomb's embed daemon
|
|
7
|
+
* (`honeycomb/embeddings/src/index.ts`) serves that model over a loopback
|
|
8
|
+
* request surface (`POST /embed { text } -> { vector }`, `GET /health`) on
|
|
9
|
+
* `127.0.0.1:3851`. Nectar reaches it over the network through its OWN
|
|
10
|
+
* client rather than importing the honeycomb runtime in-process (ADR-0002); the
|
|
11
|
+
* daemon owns the pinned `MODEL_ID` / `MODEL_REVISION` / `MODEL_QUANTIZATION` /
|
|
12
|
+
* `DOCUMENT_PREFIX` consts (PRD-014a keeps them pinned), so this client only
|
|
13
|
+
* carries the text and receives the vector.
|
|
14
|
+
*
|
|
15
|
+
* ── Fail-soft is the cardinal rule (AC-4) ────────────────────────────────────
|
|
16
|
+
* A dead daemon (connection refused), a not-yet-warm daemon (503 `model not
|
|
17
|
+
* ready`), a non-2xx, or a malformed body ALL resolve to `null` for that text —
|
|
18
|
+
* NEVER a throw into the caller's hot path. A `null` means the caller leaves the
|
|
19
|
+
* column NULL and recall degrades to BM25 (`ai/enricher-and-llm-model.md`). The
|
|
20
|
+
* dimension is NOT checked here; the 768-dim guard (`guard.ts`) owns that at the
|
|
21
|
+
* provider boundary, so a wrong-dim daemon output is discarded there (AC-3).
|
|
22
|
+
*
|
|
23
|
+
* The transport is an injectable seam ({@link LocalNomicTransport}) so a unit
|
|
24
|
+
* test drives the provider without binding a socket or running the ~600 MB model.
|
|
25
|
+
*/
|
|
26
|
+
import { defaultFetch } from "./http.js";
|
|
27
|
+
/**
|
|
28
|
+
* The pinned local nomic model id (PRD-014a / `ai/enricher-and-llm-model.md`).
|
|
29
|
+
* The embed daemon owns the model, revision, and quantization; nectar records
|
|
30
|
+
* this id as `embed_model` provenance on rows the local provider embeds
|
|
31
|
+
* (PRD-018i / NEC-018).
|
|
32
|
+
*/
|
|
33
|
+
export const LOCAL_NOMIC_MODEL_ID = "nomic-embed-text-v1.5";
|
|
34
|
+
/** The local embed daemon's loopback host (matches honeycomb's `EMBED_HOST`). */
|
|
35
|
+
export const DEFAULT_LOCAL_EMBED_HOST = "127.0.0.1";
|
|
36
|
+
/** The local embed daemon's loopback port (matches honeycomb's `EMBED_PORT` / `src/config.ts` note). */
|
|
37
|
+
export const DEFAULT_LOCAL_EMBED_PORT = 3851;
|
|
38
|
+
/** The per-text request timeout (ms) before the client gives up and returns `null` (fail-soft). */
|
|
39
|
+
export const DEFAULT_LOCAL_EMBED_TIMEOUT_MS = 10_000;
|
|
40
|
+
/** Build the `/embed` URL for the resolved host/port. */
|
|
41
|
+
function embedUrl(config) {
|
|
42
|
+
return `http://${config.host}:${config.port}/embed`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse the daemon's `{ vector: number[] }` body defensively. Returns the vector
|
|
46
|
+
* when the body is the expected shape with a finite-number array, else `null`
|
|
47
|
+
* (a malformed body fails soft, same as a transport error). Never throws.
|
|
48
|
+
*/
|
|
49
|
+
function parseVector(raw) {
|
|
50
|
+
let body;
|
|
51
|
+
try {
|
|
52
|
+
body = raw.length > 0 ? JSON.parse(raw) : null;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (typeof body !== "object" || body === null)
|
|
58
|
+
return null;
|
|
59
|
+
const vector = body.vector;
|
|
60
|
+
if (!Array.isArray(vector))
|
|
61
|
+
return null;
|
|
62
|
+
if (!vector.every((n) => typeof n === "number" && Number.isFinite(n)))
|
|
63
|
+
return null;
|
|
64
|
+
return vector;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build the REAL local-nomic transport: a loopback HTTP client to the embed
|
|
68
|
+
* daemon's `POST /embed` (PRD-014a). Every failure path — a network error
|
|
69
|
+
* (daemon down), a non-2xx (e.g. 503 not-warm), or a malformed body — resolves
|
|
70
|
+
* to `null` (fail-soft, AC-4), NEVER a throw. Production uses `globalThis.fetch`;
|
|
71
|
+
* a test injects a fake `fetch` so no socket is bound. An `AbortController`
|
|
72
|
+
* bounds each call so a hung daemon cannot stall the embed path.
|
|
73
|
+
*/
|
|
74
|
+
export function createLocalNomicHttpTransport(config, deps = {}) {
|
|
75
|
+
const doFetch = deps.fetch ?? defaultFetch();
|
|
76
|
+
const url = embedUrl(config);
|
|
77
|
+
return {
|
|
78
|
+
async embedOne(text) {
|
|
79
|
+
const controller = new AbortController();
|
|
80
|
+
const timer = setTimeout(() => controller.abort(), config.requestTimeoutMs);
|
|
81
|
+
try {
|
|
82
|
+
const res = await doFetch(url, {
|
|
83
|
+
method: "POST",
|
|
84
|
+
headers: { "content-type": "application/json" },
|
|
85
|
+
body: JSON.stringify({ text }),
|
|
86
|
+
signal: controller.signal,
|
|
87
|
+
});
|
|
88
|
+
if (!res.ok)
|
|
89
|
+
return null;
|
|
90
|
+
return parseVector(await res.text());
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Dead daemon (ECONNREFUSED), our own abort on `requestTimeoutMs` (a hung/not-warm
|
|
94
|
+
// daemon), or any other transport fault -> null. Never surface the error (fail-soft):
|
|
95
|
+
// the caller leaves the column NULL and recall stays lexical (AC-4).
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
clearTimeout(timer);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Build the local nomic {@link EmbedProvider} over an injected transport. The
|
|
106
|
+
* provider embeds each text through the daemon (order-preserving, 1:1) and maps
|
|
107
|
+
* ANY per-text failure to `null` — a rejected transport promise is caught here so
|
|
108
|
+
* the provider's never-throw contract holds even if a future transport rejects
|
|
109
|
+
* (AC-4). The returned vectors are dimension-guarded by the caller (`guard.ts`).
|
|
110
|
+
*/
|
|
111
|
+
export function createLocalNomicProvider(transport) {
|
|
112
|
+
return {
|
|
113
|
+
kind: "local",
|
|
114
|
+
embed(texts) {
|
|
115
|
+
return Promise.all(texts.map(async (text) => {
|
|
116
|
+
try {
|
|
117
|
+
return await transport.embedOne(text);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}));
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=local-nomic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-nomic.js","sourceRoot":"","sources":["../../src/embeddings/local-nomic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,YAAY,EAAkB,MAAM,WAAW,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAgC,CAAC;AAErE,iFAAiF;AACjF,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAoB,CAAC;AAE7D,wGAAwG;AACxG,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAa,CAAC;AAEtD,mGAAmG;AACnG,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAe,CAAC;AAyB9D,yDAAyD;AACzD,SAAS,QAAQ,CAAC,MAAwB;IACxC,OAAO,UAAU,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,QAAQ,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,IAAa,CAAC;IAClB,IAAI,CAAC;QACH,IAAI,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC3D,MAAM,MAAM,GAAI,IAA6B,CAAC,MAAM,CAAC;IACrD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACnF,OAAO,MAAkB,CAAC;AAC5B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAwB,EACxB,OAA2B,EAAE;IAE7B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,YAAY,EAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO;QACL,KAAK,CAAC,QAAQ,CAAC,IAAY;YACzB,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;YACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAC5E,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE;oBAC7B,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;oBAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC;oBAC9B,MAAM,EAAE,UAAU,CAAC,MAAM;iBAC1B,CAAC,CAAC;gBACH,IAAI,CAAC,GAAG,CAAC,EAAE;oBAAE,OAAO,IAAI,CAAC;gBACzB,OAAO,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YACvC,CAAC;YAAC,MAAM,CAAC;gBACP,mFAAmF;gBACnF,sFAAsF;gBACtF,qEAAqE;gBACrE,OAAO,IAAI,CAAC;YACd,CAAC;oBAAS,CAAC;gBACT,YAAY,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAA8B;IACrE,OAAO;QACL,IAAI,EAAE,OAAO;QACb,KAAK,CAAC,KAAwB;YAC5B,OAAO,OAAO,CAAC,GAAG,CAChB,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;gBACvB,IAAI,CAAC;oBACH,OAAO,MAAM,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACxC,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The embedding provider strategy switch (PRD-014a / DECISION #5).
|
|
3
|
+
*
|
|
4
|
+
* Nectar's embeddings come from two strategies behind ONE selector:
|
|
5
|
+
* - `local` the local nomic daemon (`nomic-embed-text-v1.5`, q8) — the
|
|
6
|
+
* zero-marginal-cost DEFAULT (`local-nomic.ts`).
|
|
7
|
+
* - `hosted` the hosted-via-Portkey embeddings transport — an operator opt-in
|
|
8
|
+
* (`hosted-portkey.ts`).
|
|
9
|
+
* plus the disabled state:
|
|
10
|
+
* - `off` no vector is computed; every embed resolves to `null` so the
|
|
11
|
+
* caller leaves the column NULL and recall falls back to BM25
|
|
12
|
+
* (`ai/enricher-and-llm-model.md` § Embeddings).
|
|
13
|
+
*
|
|
14
|
+
* The selector EXTENDS the vault `embeddings.enabled` switch into a three-value
|
|
15
|
+
* setting rather than adding a parallel enable mechanism (DECISION #5): `off` is
|
|
16
|
+
* the disabled value, `local`/`hosted` pick the provider. No explicit selection
|
|
17
|
+
* resolves to `local` ({@link DEFAULT_EMBED_PROVIDER}, AC-1).
|
|
18
|
+
*
|
|
19
|
+
* Both computing providers are wrapped by the 768-dim guard (`guard.ts`) at this
|
|
20
|
+
* boundary, so a vector of the wrong dimension from EITHER provider is discarded
|
|
21
|
+
* to `null` — the 768-dim contract (`EMBED_DIMS`, `hive-graph/model.ts`) is
|
|
22
|
+
* never violated in storage (AC-3). The disabled provider needs no guard: it
|
|
23
|
+
* already returns only nulls.
|
|
24
|
+
*/
|
|
25
|
+
import type { ResolvedEmbeddingsConfig } from "./config.js";
|
|
26
|
+
import { type DimRejectionSink } from "./guard.js";
|
|
27
|
+
import { type FetchLike, type SleepFn } from "./http.js";
|
|
28
|
+
import { type LocalNomicTransport } from "./local-nomic.js";
|
|
29
|
+
/**
|
|
30
|
+
* The provider selector — the single embeddings switch (DECISION #5). `off`
|
|
31
|
+
* disables embeddings (NULL column, BM25 fallback); `local` and `hosted` pick
|
|
32
|
+
* the computing strategy.
|
|
33
|
+
*/
|
|
34
|
+
export type EmbedProviderSelector = "off" | "local" | "hosted";
|
|
35
|
+
/** The default provider when none is explicitly selected: the local nomic daemon (AC-1 / DECISION #5). */
|
|
36
|
+
export declare const DEFAULT_EMBED_PROVIDER: EmbedProviderSelector;
|
|
37
|
+
/**
|
|
38
|
+
* The strategy contract both computing providers implement. `embed` maps each
|
|
39
|
+
* input text to a vector OR `null` (1:1, order-preserving): `null` means "no
|
|
40
|
+
* usable embedding for this text" — disabled, transport failure, or a wrong-dim
|
|
41
|
+
* vector the guard discarded. `embed` NEVER throws into the caller's hot path
|
|
42
|
+
* (the fail-soft contract, AC-4); a failure surfaces as nulls.
|
|
43
|
+
*/
|
|
44
|
+
export interface EmbedProvider {
|
|
45
|
+
/** Which strategy this instance is (used for observability + AC verification). */
|
|
46
|
+
readonly kind: EmbedProviderSelector;
|
|
47
|
+
/** Embed a batch; returns one `number[] | null` per input, in input order. Never rejects. */
|
|
48
|
+
embed(texts: readonly string[]): Promise<(number[] | null)[]>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The disabled provider: every text maps to `null` regardless of input. This is
|
|
52
|
+
* the `off` selector and the fail-soft floor — the caller leaves the embedding
|
|
53
|
+
* column NULL and recall degrades to BM25 with no error and no quality cliff
|
|
54
|
+
* (AC-4). Pure + total; never touches the network.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createOffProvider(): EmbedProvider;
|
|
57
|
+
/** Injectable seams for {@link resolveEmbedProvider} so a test drives it without the network. */
|
|
58
|
+
export interface ResolveEmbedProviderDeps {
|
|
59
|
+
/**
|
|
60
|
+
* The local nomic transport (test seam). When absent, a real loopback HTTP
|
|
61
|
+
* transport is built from `config.local`. A test injects a fake so AC-1 can
|
|
62
|
+
* assert the local path was invoked without a running embed daemon.
|
|
63
|
+
*/
|
|
64
|
+
readonly localTransport?: LocalNomicTransport;
|
|
65
|
+
/** The `fetch` for the hosted-via-Portkey transport (test seam); defaults to `globalThis.fetch`. */
|
|
66
|
+
readonly fetch?: FetchLike;
|
|
67
|
+
/** The backoff sleep for the hosted transport's bounded retry; a test passes a no-op. */
|
|
68
|
+
readonly sleep?: SleepFn;
|
|
69
|
+
/** Where a discarded wrong-dim vector is reported (AC-3); defaults to a no-op. */
|
|
70
|
+
readonly onDimRejected?: DimRejectionSink;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Resolve the configured {@link EmbedProvider} (the switch, PRD-014a / 014c). The
|
|
74
|
+
* selector routes to the strategy; both computing strategies are wrapped by the
|
|
75
|
+
* 768-dim guard so a wrong-dim vector from either is discarded (AC-3). A test
|
|
76
|
+
* injects a fake `localTransport` / `fetch` so no unit test touches the network.
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveEmbedProvider(config: ResolvedEmbeddingsConfig, deps?: ResolveEmbedProviderDeps): EmbedProvider;
|
|
79
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/embeddings/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAA8B,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAA2D,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGrH;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/D,0GAA0G;AAC1G,eAAO,MAAM,sBAAsB,EAAE,qBAA+B,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,6FAA6F;IAC7F,KAAK,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;CAC/D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAOjD;AAED,iGAAiG;AACjG,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IAC9C,oGAAoG;IACpG,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,yFAAyF;IACzF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,wBAAwB,EAChC,IAAI,GAAE,wBAA6B,GAClC,aAAa,CAsBf"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { withDimGuard } from "./guard.js";
|
|
2
|
+
import { defaultFetch, defaultSleep } from "./http.js";
|
|
3
|
+
import { createLocalNomicProvider, createLocalNomicHttpTransport } from "./local-nomic.js";
|
|
4
|
+
import { createHostedPortkeyProvider } from "./hosted-portkey.js";
|
|
5
|
+
/** The default provider when none is explicitly selected: the local nomic daemon (AC-1 / DECISION #5). */
|
|
6
|
+
export const DEFAULT_EMBED_PROVIDER = "local";
|
|
7
|
+
/**
|
|
8
|
+
* The disabled provider: every text maps to `null` regardless of input. This is
|
|
9
|
+
* the `off` selector and the fail-soft floor — the caller leaves the embedding
|
|
10
|
+
* column NULL and recall degrades to BM25 with no error and no quality cliff
|
|
11
|
+
* (AC-4). Pure + total; never touches the network.
|
|
12
|
+
*/
|
|
13
|
+
export function createOffProvider() {
|
|
14
|
+
return {
|
|
15
|
+
kind: "off",
|
|
16
|
+
embed(texts) {
|
|
17
|
+
return Promise.resolve(texts.map(() => null));
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the configured {@link EmbedProvider} (the switch, PRD-014a / 014c). The
|
|
23
|
+
* selector routes to the strategy; both computing strategies are wrapped by the
|
|
24
|
+
* 768-dim guard so a wrong-dim vector from either is discarded (AC-3). A test
|
|
25
|
+
* injects a fake `localTransport` / `fetch` so no unit test touches the network.
|
|
26
|
+
*/
|
|
27
|
+
export function resolveEmbedProvider(config, deps = {}) {
|
|
28
|
+
const onDimRejected = deps.onDimRejected;
|
|
29
|
+
switch (config.selector) {
|
|
30
|
+
case "off":
|
|
31
|
+
return createOffProvider();
|
|
32
|
+
case "local": {
|
|
33
|
+
const transport = deps.localTransport ?? createLocalNomicHttpTransport(config.local, { fetch: deps.fetch });
|
|
34
|
+
return withDimGuard(createLocalNomicProvider(transport), onDimRejected);
|
|
35
|
+
}
|
|
36
|
+
case "hosted": {
|
|
37
|
+
const provider = createHostedPortkeyProvider(config.hosted, {
|
|
38
|
+
fetch: deps.fetch ?? defaultFetch(),
|
|
39
|
+
sleep: deps.sleep ?? defaultSleep,
|
|
40
|
+
});
|
|
41
|
+
return withDimGuard(provider, onDimRejected);
|
|
42
|
+
}
|
|
43
|
+
default: {
|
|
44
|
+
// Exhaustiveness: a new selector variant fails the build here until handled.
|
|
45
|
+
const unreachable = config.selector;
|
|
46
|
+
return unreachable;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/embeddings/provider.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,YAAY,EAAyB,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAgC,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAA4B,MAAM,kBAAkB,CAAC;AACrH,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AASlE,0GAA0G;AAC1G,MAAM,CAAC,MAAM,sBAAsB,GAA0B,OAAO,CAAC;AAgBrE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO;QACL,IAAI,EAAE,KAAK;QACX,KAAK,CAAC,KAAwB;YAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC;AAkBD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAgC,EAChC,OAAiC,EAAE;IAEnC,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IACzC,QAAQ,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,KAAK,KAAK;YACR,OAAO,iBAAiB,EAAE,CAAC;QAC7B,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,IAAI,6BAA6B,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YAC5G,OAAO,YAAY,CAAC,wBAAwB,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,CAAC;QAC1E,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,QAAQ,GAAG,2BAA2B,CAAC,MAAM,CAAC,MAAM,EAAE;gBAC1D,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,YAAY,EAAE;gBACnC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,YAAY;aAClC,CAAC,CAAC;YACH,OAAO,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,6EAA6E;YAC7E,MAAM,WAAW,GAAU,MAAM,CAAC,QAAQ,CAAC;YAC3C,OAAO,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enricher tunables (PRD-016 / decision #34).
|
|
3
|
+
*
|
|
4
|
+
* All values are config-overridable via `~/.honeycomb/nectar.json`; these are
|
|
5
|
+
* the signed-off defaults from `ai/enricher-and-llm-model.md`.
|
|
6
|
+
*/
|
|
7
|
+
/** Default enricher poll interval (30s). */
|
|
8
|
+
export declare const DEFAULT_ENRICHER_POLL_INTERVAL_MS: 30000;
|
|
9
|
+
/** Watcher intake debounce lives in `registration/fs-watch.ts` (500ms). */
|
|
10
|
+
export declare const DEFAULT_WATCHER_DEBOUNCE_MS: 500;
|
|
11
|
+
/** Cosmetic-change inheritance threshold (Jaccard on token multisets). */
|
|
12
|
+
export declare const DEFAULT_REDESCRIBE_THRESHOLD: 0.85;
|
|
13
|
+
/** Consecutive failed cycles before the persistent alert fires. */
|
|
14
|
+
export declare const DEFAULT_PERSISTENT_FAILURE_THRESHOLD: 5;
|
|
15
|
+
/** Default batch size for pending-work selection (non-solo). */
|
|
16
|
+
export declare const DEFAULT_ENRICHER_BATCH_SIZE: 10;
|
|
17
|
+
/** Rough USD estimate for Gemini 2.5 Flash per-token (observability only). */
|
|
18
|
+
export declare const ENRICHER_INPUT_USD_PER_TOKEN: number;
|
|
19
|
+
export declare const ENRICHER_OUTPUT_USD_PER_TOKEN: number;
|
|
20
|
+
export interface EnricherConfig {
|
|
21
|
+
readonly pollIntervalMs: number;
|
|
22
|
+
readonly redescribeThreshold: number;
|
|
23
|
+
readonly persistentFailureThreshold: number;
|
|
24
|
+
readonly batchSize: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Tunables sourced from the `~/.honeycomb/nectar.json` loader (PRD-018k /
|
|
28
|
+
* NEC-041), already resolved with env-over-file precedence by
|
|
29
|
+
* `resolveNectarTunables`. Only the redescribe threshold applies to the
|
|
30
|
+
* enricher; a value present here is used when no explicit code override
|
|
31
|
+
* (`partial`) supplies one, and both fall back to the signed-off default.
|
|
32
|
+
*/
|
|
33
|
+
export interface EnricherTunables {
|
|
34
|
+
readonly redescribeThreshold?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the enricher config. Precedence for the redescribe threshold is:
|
|
38
|
+
* explicit code override (`partial`) > the resolved config-file/env tunable
|
|
39
|
+
* (`tunables`) > the signed-off {@link DEFAULT_REDESCRIBE_THRESHOLD}. The other
|
|
40
|
+
* fields default from code as before.
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveEnricherConfig(partial?: Partial<EnricherConfig>, tunables?: EnricherTunables): EnricherConfig;
|
|
43
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/enricher/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4CAA4C;AAC5C,eAAO,MAAM,iCAAiC,EAAG,KAAe,CAAC;AAEjE,2EAA2E;AAC3E,eAAO,MAAM,2BAA2B,EAAG,GAAY,CAAC;AAExD,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B,EAAG,IAAa,CAAC;AAE1D,mEAAmE;AACnE,eAAO,MAAM,oCAAoC,EAAG,CAAU,CAAC;AAE/D,gEAAgE;AAChE,eAAO,MAAM,2BAA2B,EAAG,EAAW,CAAC;AAEvD,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,QAAmB,CAAC;AAC7D,eAAO,MAAM,6BAA6B,QAAkB,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,EACrC,QAAQ,GAAE,gBAAqB,GAC9B,cAAc,CAQhB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enricher tunables (PRD-016 / decision #34).
|
|
3
|
+
*
|
|
4
|
+
* All values are config-overridable via `~/.honeycomb/nectar.json`; these are
|
|
5
|
+
* the signed-off defaults from `ai/enricher-and-llm-model.md`.
|
|
6
|
+
*/
|
|
7
|
+
/** Default enricher poll interval (30s). */
|
|
8
|
+
export const DEFAULT_ENRICHER_POLL_INTERVAL_MS = 30_000;
|
|
9
|
+
/** Watcher intake debounce lives in `registration/fs-watch.ts` (500ms). */
|
|
10
|
+
export const DEFAULT_WATCHER_DEBOUNCE_MS = 500;
|
|
11
|
+
/** Cosmetic-change inheritance threshold (Jaccard on token multisets). */
|
|
12
|
+
export const DEFAULT_REDESCRIBE_THRESHOLD = 0.85;
|
|
13
|
+
/** Consecutive failed cycles before the persistent alert fires. */
|
|
14
|
+
export const DEFAULT_PERSISTENT_FAILURE_THRESHOLD = 5;
|
|
15
|
+
/** Default batch size for pending-work selection (non-solo). */
|
|
16
|
+
export const DEFAULT_ENRICHER_BATCH_SIZE = 10;
|
|
17
|
+
/** Rough USD estimate for Gemini 2.5 Flash per-token (observability only). */
|
|
18
|
+
export const ENRICHER_INPUT_USD_PER_TOKEN = 0.65 / 1_000_000;
|
|
19
|
+
export const ENRICHER_OUTPUT_USD_PER_TOKEN = 2.4 / 1_000_000;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the enricher config. Precedence for the redescribe threshold is:
|
|
22
|
+
* explicit code override (`partial`) > the resolved config-file/env tunable
|
|
23
|
+
* (`tunables`) > the signed-off {@link DEFAULT_REDESCRIBE_THRESHOLD}. The other
|
|
24
|
+
* fields default from code as before.
|
|
25
|
+
*/
|
|
26
|
+
export function resolveEnricherConfig(partial = {}, tunables = {}) {
|
|
27
|
+
return {
|
|
28
|
+
pollIntervalMs: partial.pollIntervalMs ?? DEFAULT_ENRICHER_POLL_INTERVAL_MS,
|
|
29
|
+
redescribeThreshold: partial.redescribeThreshold ?? tunables.redescribeThreshold ?? DEFAULT_REDESCRIBE_THRESHOLD,
|
|
30
|
+
persistentFailureThreshold: partial.persistentFailureThreshold ?? DEFAULT_PERSISTENT_FAILURE_THRESHOLD,
|
|
31
|
+
batchSize: partial.batchSize ?? DEFAULT_ENRICHER_BATCH_SIZE,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/enricher/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAe,CAAC;AAEjE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAY,CAAC;AAExD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAa,CAAC;AAE1D,mEAAmE;AACnE,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAU,CAAC;AAE/D,gEAAgE;AAChE,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAW,CAAC;AAEvD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,SAAS,CAAC;AAC7D,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,GAAG,SAAS,CAAC;AAoB7D;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAmC,EAAE,EACrC,WAA6B,EAAE;IAE/B,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,iCAAiC;QAC3E,mBAAmB,EACjB,OAAO,CAAC,mBAAmB,IAAI,QAAQ,CAAC,mBAAmB,IAAI,4BAA4B;QAC7F,0BAA0B,EAAE,OAAO,CAAC,0BAA0B,IAAI,oCAAoC;QACtG,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,2BAA2B;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prior-content cache for the cosmetic-change (Jaccard) gate (PRD-018g / NEC-026).
|
|
3
|
+
*
|
|
4
|
+
* The gate needs the PRIOR described version's file content to compare against
|
|
5
|
+
* the new content, but the hive-graph tables store only a `content_hash`, never
|
|
6
|
+
* the bytes. This bounded in-process cache is the chosen prior-content strategy:
|
|
7
|
+
* whenever the enricher reads a file's content on the describe path, it records
|
|
8
|
+
* `{ contentHash, content }` keyed by nectar, so the NEXT observation of that
|
|
9
|
+
* file can compute Jaccard(priorContent, newContent) without a paid re-describe.
|
|
10
|
+
*
|
|
11
|
+
* The cache is per-daemon-process and lost on restart, so the FIRST post-boot
|
|
12
|
+
* edit of a file cannot inherit (the prior content is unknown) and takes the full
|
|
13
|
+
* describe path - the honest degradation `cli.ts` already documents for a cold
|
|
14
|
+
* boot. The `contentHash` stored alongside lets the gate confirm the cached
|
|
15
|
+
* content actually corresponds to the prior described version before trusting it.
|
|
16
|
+
*/
|
|
17
|
+
export interface PriorContentEntry {
|
|
18
|
+
readonly contentHash: string;
|
|
19
|
+
readonly content: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PriorContentCache {
|
|
22
|
+
get(nectar: string): PriorContentEntry | undefined;
|
|
23
|
+
set(nectar: string, contentHash: string, content: string): void;
|
|
24
|
+
}
|
|
25
|
+
/** Default cap on cached entries; FIFO eviction keeps memory bounded on a large repo. */
|
|
26
|
+
export declare const DEFAULT_PRIOR_CONTENT_CACHE_MAX = 4096;
|
|
27
|
+
/** Build a bounded FIFO prior-content cache. */
|
|
28
|
+
export declare function createPriorContentCache(maxEntries?: number): PriorContentCache;
|
|
29
|
+
//# sourceMappingURL=content-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-cache.d.ts","sourceRoot":"","sources":["../../src/enricher/content-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IACnD,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjE;AAED,yFAAyF;AACzF,eAAO,MAAM,+BAA+B,OAAO,CAAC;AAEpD,gDAAgD;AAChD,wBAAgB,uBAAuB,CAAC,UAAU,GAAE,MAAwC,GAAG,iBAAiB,CAiB/G"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Default cap on cached entries; FIFO eviction keeps memory bounded on a large repo. */
|
|
2
|
+
export const DEFAULT_PRIOR_CONTENT_CACHE_MAX = 4096;
|
|
3
|
+
/** Build a bounded FIFO prior-content cache. */
|
|
4
|
+
export function createPriorContentCache(maxEntries = DEFAULT_PRIOR_CONTENT_CACHE_MAX) {
|
|
5
|
+
const cap = Math.max(1, Math.floor(maxEntries));
|
|
6
|
+
const map = new Map();
|
|
7
|
+
return {
|
|
8
|
+
get(nectar) {
|
|
9
|
+
return map.get(nectar);
|
|
10
|
+
},
|
|
11
|
+
set(nectar, contentHash, content) {
|
|
12
|
+
if (map.has(nectar))
|
|
13
|
+
map.delete(nectar);
|
|
14
|
+
map.set(nectar, { contentHash, content });
|
|
15
|
+
while (map.size > cap) {
|
|
16
|
+
const oldest = map.keys().next().value;
|
|
17
|
+
if (oldest === undefined)
|
|
18
|
+
break;
|
|
19
|
+
map.delete(oldest);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=content-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-cache.js","sourceRoot":"","sources":["../../src/enricher/content-cache.ts"],"names":[],"mappings":"AA0BA,yFAAyF;AACzF,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAEpD,gDAAgD;AAChD,MAAM,UAAU,uBAAuB,CAAC,aAAqB,+BAA+B;IAC1F,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI,GAAG,EAA6B,CAAC;IACjD,OAAO;QACL,GAAG,CAAC,MAAc;YAChB,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QACD,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAE,OAAe;YACtD,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACxC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;YAC1C,OAAO,GAAG,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC;gBACtB,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;gBACvC,IAAI,MAAM,KAAK,SAAS;oBAAE,MAAM;gBAChC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|