@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,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform + scope resolution for nectar's OS service unit (PRD-003b).
|
|
3
|
+
*
|
|
4
|
+
* nectar registers itself with the OS so it survives its own crash and a reboot,
|
|
5
|
+
* mirroring doctor's own self-registration module
|
|
6
|
+
* (doctor/src/service/platform.ts:1-187) with nectar's own label/unit/task
|
|
7
|
+
* names and run command. WHICH service manager and at WHICH scope is decided here,
|
|
8
|
+
* once, from three injected facts (the platform, the home dir, and whether the
|
|
9
|
+
* process is privileged) so the rest of the service module is pure string + argv
|
|
10
|
+
* construction and fully hermetic in tests.
|
|
11
|
+
*
|
|
12
|
+
* The binding rulings (PRD-003b):
|
|
13
|
+
* - macOS -> launchd, user scope = LaunchAgent (`~/Library/LaunchAgents`).
|
|
14
|
+
* - Linux -> systemd, user scope = `systemctl --user` unit (`~/.config/systemd/user`).
|
|
15
|
+
* - Windows -> Scheduled Task (per-user, no admin/UAC) is the default; a Windows
|
|
16
|
+
* Service (`sc.exe`) is the enterprise opt-in, never the userland default.
|
|
17
|
+
*
|
|
18
|
+
* User scope is the default everywhere (US-003b.3): it needs no root/admin and matches
|
|
19
|
+
* a per-user `npm i -g`. A privileged context MAY use system scope, but an unprivileged
|
|
20
|
+
* context MUST fall back to user scope rather than failing the install.
|
|
21
|
+
*
|
|
22
|
+
* Built-ins only; this module is pure (its inputs are injected).
|
|
23
|
+
*/
|
|
24
|
+
/** The OS families nectar knows how to register a service on. */
|
|
25
|
+
export type ServicePlatform = "darwin" | "linux" | "win32";
|
|
26
|
+
/** Which service manager backs a plan. */
|
|
27
|
+
export type ServiceManager = "launchd" | "systemd" | "schtasks" | "sc";
|
|
28
|
+
/** The privilege scope a unit is installed at. */
|
|
29
|
+
export type ServiceScope = "user" | "system";
|
|
30
|
+
/**
|
|
31
|
+
* The stable label the launchd unit is registered under. Decision #32
|
|
32
|
+
* (2026-07-02, `library/requirements/PRD-DECISIONS-AND-DEFAULTS.md`): the
|
|
33
|
+
* fleet-wide scheme is reverse-DNS `com.legioncode.<shortname>` with the
|
|
34
|
+
* product short name `nectar`, superseding the shipped `com.hivenectar.daemon`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SERVICE_LABEL: "com.legioncode.nectar";
|
|
37
|
+
/** The systemd unit file name (decision #32: `<shortname>.service`). */
|
|
38
|
+
export declare const SYSTEMD_UNIT_NAME: "nectar.service";
|
|
39
|
+
/** The Windows Scheduled Task / Service name (decision #32: the bare short name). */
|
|
40
|
+
export declare const WINDOWS_TASK_NAME: "nectar";
|
|
41
|
+
/** The pre-decision-#32 launchd label, deregistered on install (migration path). */
|
|
42
|
+
export declare const LEGACY_SERVICE_LABEL: "com.hivenectar.daemon";
|
|
43
|
+
/** The pre-decision-#32 systemd unit name, deregistered on install. */
|
|
44
|
+
export declare const LEGACY_SYSTEMD_UNIT_NAME: "hivenectar.service";
|
|
45
|
+
/** The pre-decision-#32 Windows task name, deregistered on install. */
|
|
46
|
+
export declare const LEGACY_WINDOWS_TASK_NAME: "HivenectarDaemon";
|
|
47
|
+
/** The raw facts the resolver consumes (injected so the resolver is hermetic). */
|
|
48
|
+
export interface ServiceEnvironment {
|
|
49
|
+
/** `process.platform`. An unknown value is rejected by {@link resolveServicePlan}. */
|
|
50
|
+
readonly platform: NodeJS.Platform;
|
|
51
|
+
/** The user's home directory (where user-scope units are written). */
|
|
52
|
+
readonly home: string;
|
|
53
|
+
/** True iff the process can install a system-scoped unit (root on POSIX, admin on Windows). */
|
|
54
|
+
readonly privileged: boolean;
|
|
55
|
+
/** The absolute path to the `nectar` executable the unit will exec. */
|
|
56
|
+
readonly execPath: string;
|
|
57
|
+
/**
|
|
58
|
+
* Opt INTO system scope when privileged (enterprise path). Default false: even as root
|
|
59
|
+
* we prefer a user unit unless the operator explicitly asked for a system one.
|
|
60
|
+
*/
|
|
61
|
+
readonly preferSystemScope?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** The fully-resolved plan: which manager, which scope, and the unit's on-disk location. */
|
|
64
|
+
export interface ServicePlan {
|
|
65
|
+
/** The normalized platform family. */
|
|
66
|
+
readonly platform: ServicePlatform;
|
|
67
|
+
/** The backing service manager. */
|
|
68
|
+
readonly manager: ServiceManager;
|
|
69
|
+
/** The resolved install scope (user by default; system only when privileged + opted in). */
|
|
70
|
+
readonly scope: ServiceScope;
|
|
71
|
+
/** True when system scope was REQUESTED but the process is unprivileged, so we fell back to user. */
|
|
72
|
+
readonly fellBackToUser: boolean;
|
|
73
|
+
/** The absolute path the unit file is written to (plist / systemd unit). Empty for schtasks/sc. */
|
|
74
|
+
readonly unitPath: string;
|
|
75
|
+
/** The label/name the unit is registered under. */
|
|
76
|
+
readonly label: string;
|
|
77
|
+
/** The executable the unit execs. */
|
|
78
|
+
readonly execPath: string;
|
|
79
|
+
/** The home dir (units reference it for logs / working dir). */
|
|
80
|
+
readonly home: string;
|
|
81
|
+
}
|
|
82
|
+
/** Gather the real {@link ServiceEnvironment} at the edge (the one impure call site). */
|
|
83
|
+
export declare function resolveServiceContext(execPath: string, preferSystemScope?: boolean): ServiceEnvironment;
|
|
84
|
+
/**
|
|
85
|
+
* Detect whether the current process can install a system-scoped unit. On POSIX that is
|
|
86
|
+
* uid 0 (root); on Windows there is no cheap built-in admin check without shelling out,
|
|
87
|
+
* so we conservatively report NOT privileged and let the default per-user Scheduled Task
|
|
88
|
+
* path win. Never throws.
|
|
89
|
+
*/
|
|
90
|
+
export declare function isPrivileged(): boolean;
|
|
91
|
+
/** Map a raw Node platform to a {@link ServicePlatform}, or null when unsupported. */
|
|
92
|
+
export declare function normalizePlatform(platform: NodeJS.Platform): ServicePlatform | null;
|
|
93
|
+
/**
|
|
94
|
+
* The on-disk unit path the PRE-decision-#32 install would have used for this
|
|
95
|
+
* plan's platform + scope. Install removes it (best-effort) so a re-run
|
|
96
|
+
* migrates a legacy unit instead of leaving two units racing over one daemon.
|
|
97
|
+
* Empty when the platform keeps no unit file (Windows).
|
|
98
|
+
*/
|
|
99
|
+
export declare function legacyUnitPath(plan: ServicePlan): string;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve the service plan from the environment. The fallback ordering (US-003b.3):
|
|
102
|
+
* 1. If system scope was requested AND the process is privileged -> system scope.
|
|
103
|
+
* 2. Otherwise -> user scope (LaunchAgent / systemd --user / per-user Scheduled Task),
|
|
104
|
+
* recording `fellBackToUser` when a system unit was wanted but privilege was absent.
|
|
105
|
+
*
|
|
106
|
+
* Throws ONLY for a genuinely unsupported platform; the caller maps that to a clean
|
|
107
|
+
* "unsupported platform" result rather than a stack trace (US-003b.3).
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveServicePlan(env: ServiceEnvironment): ServicePlan;
|
|
110
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/service/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,iEAAiE;AACjE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC;AAEvE,kDAAkD;AAClD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAG,uBAAgC,CAAC;AAE9D,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,EAAG,gBAAyB,CAAC;AAE3D,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,EAAG,QAAiB,CAAC;AAEnD,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,EAAG,uBAAgC,CAAC;AAErE,uEAAuE;AACvE,eAAO,MAAM,wBAAwB,EAAG,oBAA6B,CAAC;AAEtE,uEAAuE;AACvE,eAAO,MAAM,wBAAwB,EAAG,kBAA2B,CAAC;AAEpE,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IACnC,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+FAA+F;IAC/F,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,4FAA4F;AAC5F,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,qGAAqG;IACrG,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,mGAAmG;IACnG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,yFAAyF;AACzF,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,UAAQ,GAAG,kBAAkB,CAQrG;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAQtC;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe,GAAG,IAAI,CAGnF;AA4BD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAaxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,kBAAkB,GAAG,WAAW,CAiCvE"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform + scope resolution for nectar's OS service unit (PRD-003b).
|
|
3
|
+
*
|
|
4
|
+
* nectar registers itself with the OS so it survives its own crash and a reboot,
|
|
5
|
+
* mirroring doctor's own self-registration module
|
|
6
|
+
* (doctor/src/service/platform.ts:1-187) with nectar's own label/unit/task
|
|
7
|
+
* names and run command. WHICH service manager and at WHICH scope is decided here,
|
|
8
|
+
* once, from three injected facts (the platform, the home dir, and whether the
|
|
9
|
+
* process is privileged) so the rest of the service module is pure string + argv
|
|
10
|
+
* construction and fully hermetic in tests.
|
|
11
|
+
*
|
|
12
|
+
* The binding rulings (PRD-003b):
|
|
13
|
+
* - macOS -> launchd, user scope = LaunchAgent (`~/Library/LaunchAgents`).
|
|
14
|
+
* - Linux -> systemd, user scope = `systemctl --user` unit (`~/.config/systemd/user`).
|
|
15
|
+
* - Windows -> Scheduled Task (per-user, no admin/UAC) is the default; a Windows
|
|
16
|
+
* Service (`sc.exe`) is the enterprise opt-in, never the userland default.
|
|
17
|
+
*
|
|
18
|
+
* User scope is the default everywhere (US-003b.3): it needs no root/admin and matches
|
|
19
|
+
* a per-user `npm i -g`. A privileged context MAY use system scope, but an unprivileged
|
|
20
|
+
* context MUST fall back to user scope rather than failing the install.
|
|
21
|
+
*
|
|
22
|
+
* Built-ins only; this module is pure (its inputs are injected).
|
|
23
|
+
*/
|
|
24
|
+
import { homedir, userInfo } from "node:os";
|
|
25
|
+
/**
|
|
26
|
+
* The stable label the launchd unit is registered under. Decision #32
|
|
27
|
+
* (2026-07-02, `library/requirements/PRD-DECISIONS-AND-DEFAULTS.md`): the
|
|
28
|
+
* fleet-wide scheme is reverse-DNS `com.legioncode.<shortname>` with the
|
|
29
|
+
* product short name `nectar`, superseding the shipped `com.hivenectar.daemon`.
|
|
30
|
+
*/
|
|
31
|
+
export const SERVICE_LABEL = "com.legioncode.nectar";
|
|
32
|
+
/** The systemd unit file name (decision #32: `<shortname>.service`). */
|
|
33
|
+
export const SYSTEMD_UNIT_NAME = "nectar.service";
|
|
34
|
+
/** The Windows Scheduled Task / Service name (decision #32: the bare short name). */
|
|
35
|
+
export const WINDOWS_TASK_NAME = "nectar";
|
|
36
|
+
/** The pre-decision-#32 launchd label, deregistered on install (migration path). */
|
|
37
|
+
export const LEGACY_SERVICE_LABEL = "com.hivenectar.daemon";
|
|
38
|
+
/** The pre-decision-#32 systemd unit name, deregistered on install. */
|
|
39
|
+
export const LEGACY_SYSTEMD_UNIT_NAME = "hivenectar.service";
|
|
40
|
+
/** The pre-decision-#32 Windows task name, deregistered on install. */
|
|
41
|
+
export const LEGACY_WINDOWS_TASK_NAME = "HivenectarDaemon";
|
|
42
|
+
/** Gather the real {@link ServiceEnvironment} at the edge (the one impure call site). */
|
|
43
|
+
export function resolveServiceContext(execPath, preferSystemScope = false) {
|
|
44
|
+
return {
|
|
45
|
+
platform: process.platform,
|
|
46
|
+
home: homedir(),
|
|
47
|
+
privileged: isPrivileged(),
|
|
48
|
+
execPath,
|
|
49
|
+
preferSystemScope,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Detect whether the current process can install a system-scoped unit. On POSIX that is
|
|
54
|
+
* uid 0 (root); on Windows there is no cheap built-in admin check without shelling out,
|
|
55
|
+
* so we conservatively report NOT privileged and let the default per-user Scheduled Task
|
|
56
|
+
* path win. Never throws.
|
|
57
|
+
*/
|
|
58
|
+
export function isPrivileged() {
|
|
59
|
+
try {
|
|
60
|
+
if (process.platform === "win32")
|
|
61
|
+
return false;
|
|
62
|
+
const uid = userInfo().uid;
|
|
63
|
+
return uid === 0;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Map a raw Node platform to a {@link ServicePlatform}, or null when unsupported. */
|
|
70
|
+
export function normalizePlatform(platform) {
|
|
71
|
+
if (platform === "darwin" || platform === "linux" || platform === "win32")
|
|
72
|
+
return platform;
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
/** Build the user-scope unit path for a given platform (where we WRITE the plist/unit file). */
|
|
76
|
+
function userUnitPath(platform, home) {
|
|
77
|
+
switch (platform) {
|
|
78
|
+
case "darwin":
|
|
79
|
+
return `${home}/Library/LaunchAgents/${SERVICE_LABEL}.plist`;
|
|
80
|
+
case "linux":
|
|
81
|
+
return `${home}/.config/systemd/user/${SYSTEMD_UNIT_NAME}`;
|
|
82
|
+
case "win32":
|
|
83
|
+
// Scheduled Task is registered via schtasks (no file we own on disk).
|
|
84
|
+
return "";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Build the system-scope unit path for a given platform. */
|
|
88
|
+
function systemUnitPath(platform) {
|
|
89
|
+
switch (platform) {
|
|
90
|
+
case "darwin":
|
|
91
|
+
return `/Library/LaunchDaemons/${SERVICE_LABEL}.plist`;
|
|
92
|
+
case "linux":
|
|
93
|
+
return `/etc/systemd/system/${SYSTEMD_UNIT_NAME}`;
|
|
94
|
+
case "win32":
|
|
95
|
+
// Windows Service is registered via sc.exe (no unit file we own on disk).
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The on-disk unit path the PRE-decision-#32 install would have used for this
|
|
101
|
+
* plan's platform + scope. Install removes it (best-effort) so a re-run
|
|
102
|
+
* migrates a legacy unit instead of leaving two units racing over one daemon.
|
|
103
|
+
* Empty when the platform keeps no unit file (Windows).
|
|
104
|
+
*/
|
|
105
|
+
export function legacyUnitPath(plan) {
|
|
106
|
+
switch (plan.platform) {
|
|
107
|
+
case "darwin":
|
|
108
|
+
return plan.scope === "system"
|
|
109
|
+
? `/Library/LaunchDaemons/${LEGACY_SERVICE_LABEL}.plist`
|
|
110
|
+
: `${plan.home}/Library/LaunchAgents/${LEGACY_SERVICE_LABEL}.plist`;
|
|
111
|
+
case "linux":
|
|
112
|
+
return plan.scope === "system"
|
|
113
|
+
? `/etc/systemd/system/${LEGACY_SYSTEMD_UNIT_NAME}`
|
|
114
|
+
: `${plan.home}/.config/systemd/user/${LEGACY_SYSTEMD_UNIT_NAME}`;
|
|
115
|
+
case "win32":
|
|
116
|
+
return "";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Resolve the service plan from the environment. The fallback ordering (US-003b.3):
|
|
121
|
+
* 1. If system scope was requested AND the process is privileged -> system scope.
|
|
122
|
+
* 2. Otherwise -> user scope (LaunchAgent / systemd --user / per-user Scheduled Task),
|
|
123
|
+
* recording `fellBackToUser` when a system unit was wanted but privilege was absent.
|
|
124
|
+
*
|
|
125
|
+
* Throws ONLY for a genuinely unsupported platform; the caller maps that to a clean
|
|
126
|
+
* "unsupported platform" result rather than a stack trace (US-003b.3).
|
|
127
|
+
*/
|
|
128
|
+
export function resolveServicePlan(env) {
|
|
129
|
+
const platform = normalizePlatform(env.platform);
|
|
130
|
+
if (platform === null) {
|
|
131
|
+
throw new Error(`unsupported platform: ${env.platform}`);
|
|
132
|
+
}
|
|
133
|
+
const wantsSystem = env.preferSystemScope === true;
|
|
134
|
+
const canSystem = env.privileged;
|
|
135
|
+
const scope = wantsSystem && canSystem ? "system" : "user";
|
|
136
|
+
const fellBackToUser = wantsSystem && !canSystem;
|
|
137
|
+
const manager = platform === "darwin"
|
|
138
|
+
? "launchd"
|
|
139
|
+
: platform === "linux"
|
|
140
|
+
? "systemd"
|
|
141
|
+
: // Windows: per-user Scheduled Task by default; Windows Service (sc) only at system scope.
|
|
142
|
+
scope === "system"
|
|
143
|
+
? "sc"
|
|
144
|
+
: "schtasks";
|
|
145
|
+
const unitPath = scope === "system" ? systemUnitPath(platform) : userUnitPath(platform, env.home);
|
|
146
|
+
return {
|
|
147
|
+
platform,
|
|
148
|
+
manager,
|
|
149
|
+
scope,
|
|
150
|
+
fellBackToUser,
|
|
151
|
+
unitPath,
|
|
152
|
+
label: SERVICE_LABEL,
|
|
153
|
+
execPath: env.execPath,
|
|
154
|
+
home: env.home,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/service/platform.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vendored per-OS service-unit TEMPLATES for nectar (PRD-003b).
|
|
3
|
+
*
|
|
4
|
+
* Mirrors doctor's own unit templates (doctor/src/service/templates.ts)
|
|
5
|
+
* with nectar's run command (`daemon`, not `run`) and nectar's label/unit
|
|
6
|
+
* names (src/service/platform.ts). Three pure string builders, one per service
|
|
7
|
+
* manager, that render the unit text from a {@link ServicePlan}. No I/O, no
|
|
8
|
+
* shell-out - just deterministic text a test can snapshot-assert.
|
|
9
|
+
*
|
|
10
|
+
* Every template encodes the two non-negotiables of self-supervision (PRD-003b
|
|
11
|
+
* Goals):
|
|
12
|
+
* - restart-on-crash (launchd `KeepAlive`, systemd `Restart=always`, schtasks
|
|
13
|
+
* `RestartOnFailure`);
|
|
14
|
+
* - start-on-boot (launchd `RunAtLoad`, systemd `WantedBy=default.target`,
|
|
15
|
+
* schtasks `LogonTrigger`).
|
|
16
|
+
*
|
|
17
|
+
* Built-ins only; XML/plist are hand-built with the few entities they need escaped.
|
|
18
|
+
*/
|
|
19
|
+
import { SERVICE_LABEL, type ServicePlan } from "./platform.js";
|
|
20
|
+
/** The subcommand nectar's unit execs to start the process (no shell). */
|
|
21
|
+
export declare const NECTAR_RUN_COMMAND: "daemon";
|
|
22
|
+
/**
|
|
23
|
+
* The directory the launchd unit writes stdout/stderr logs into
|
|
24
|
+
* (`<home>/.honeycomb/nectar`). Single-sourced here so the install path
|
|
25
|
+
* (`service/index.ts`) creates exactly the directory the plist references,
|
|
26
|
+
* rather than the daemon silently losing its logs on macOS (NEC-042 item 2 /
|
|
27
|
+
* AC-018l.9). Forward slashes match the plist's own path style.
|
|
28
|
+
*/
|
|
29
|
+
export declare function launchdLogDir(home: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Seconds the OS waits before restarting a crashed nectar on POSIX. Used by the
|
|
32
|
+
* launchd `ThrottleInterval` and the systemd `RestartSec` directives; both take
|
|
33
|
+
* seconds. Mirrors doctor's `RESTART_SEC` (doctor/src/service/templates.ts).
|
|
34
|
+
*/
|
|
35
|
+
export declare const RESTART_SEC: 5;
|
|
36
|
+
/**
|
|
37
|
+
* The Windows Task Scheduler `RestartOnFailure`/`Interval` duration as an ISO-8601
|
|
38
|
+
* time interval. Task Scheduler REJECTS sub-minute intervals; the minimum it accepts
|
|
39
|
+
* is `PT1M`. This is Windows-only; POSIX keeps `RESTART_SEC` (seconds). Mirrors
|
|
40
|
+
* doctor's `WINDOWS_RESTART_INTERVAL`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const WINDOWS_RESTART_INTERVAL: "PT1M";
|
|
43
|
+
/**
|
|
44
|
+
* systemd restart rate-limiting window (seconds) and burst count (daemon-api
|
|
45
|
+
* review H4). The old template disabled rate limiting (`StartLimitIntervalSec=0`),
|
|
46
|
+
* so a genuinely broken unit crash-looped every {@link RESTART_SEC} seconds
|
|
47
|
+
* forever. A finite burst over a finite window makes systemd give up and surface
|
|
48
|
+
* a failed state instead of burning CPU and journal space indefinitely.
|
|
49
|
+
*/
|
|
50
|
+
export declare const START_LIMIT_INTERVAL_SEC: 60;
|
|
51
|
+
export declare const START_LIMIT_BURST: 5;
|
|
52
|
+
/**
|
|
53
|
+
* Quote a single token for a systemd `ExecStart` line. systemd does NOT invoke a
|
|
54
|
+
* shell, but a bare token splits on whitespace, so a space-bearing exec path would
|
|
55
|
+
* mis-split. Wrapping the token in double quotes preserves the spaces.
|
|
56
|
+
*/
|
|
57
|
+
export declare function quoteSystemdToken(value: string): string;
|
|
58
|
+
/** Escape the five XML predefined entities so an exec path with `&`/quotes cannot break the doc. */
|
|
59
|
+
export declare function escapeXml(value: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Render a launchd plist (macOS). `RunAtLoad` = start-on-boot/login; `KeepAlive` =
|
|
62
|
+
* restart-on-crash. `ProgramArguments` is an argv array (no shell), so a path with
|
|
63
|
+
* spaces is safe. Logs go under the user's home so a LaunchAgent never needs root.
|
|
64
|
+
*/
|
|
65
|
+
export declare function renderLaunchdPlist(plan: ServicePlan): string;
|
|
66
|
+
/**
|
|
67
|
+
* Render a systemd unit (Linux). `Restart=always` + `RestartSec` = restart-on-crash;
|
|
68
|
+
* `WantedBy=default.target` (with `systemctl --user enable`) = start-on-login/boot.
|
|
69
|
+
* `Type=simple` because nectar stays in the foreground of its own process.
|
|
70
|
+
*/
|
|
71
|
+
export declare function renderSystemdUnit(plan: ServicePlan): string;
|
|
72
|
+
/**
|
|
73
|
+
* Render a Windows Scheduled Task definition XML (per-user, the Windows DEFAULT).
|
|
74
|
+
* The `LogonTrigger` starts it at user logon (start-on-boot equivalent without
|
|
75
|
+
* admin); `RestartOnFailure` gives restart-on-crash; `MultipleInstancesPolicy=IgnoreNew`
|
|
76
|
+
* keeps a single instance (pairs with nectar's single-instance lock, PRD-003a).
|
|
77
|
+
* `<Command>`/`<Arguments>` are separate (no shell parsing).
|
|
78
|
+
*
|
|
79
|
+
* Consumed via `schtasks /Create /XML <file>`, so the per-user task needs no admin/UAC.
|
|
80
|
+
* Uses {@link WINDOWS_RESTART_INTERVAL} (`PT1M`), NOT {@link RESTART_SEC}: Task
|
|
81
|
+
* Scheduler rejects sub-minute intervals.
|
|
82
|
+
*/
|
|
83
|
+
export declare function renderScheduledTaskXml(plan: ServicePlan): string;
|
|
84
|
+
/** The single entry point: render whichever unit text the plan's manager needs. */
|
|
85
|
+
export declare function renderUnit(plan: ServicePlan): string;
|
|
86
|
+
/** Re-export the label so callers building argv share one source of truth. */
|
|
87
|
+
export { SERVICE_LABEL };
|
|
88
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/service/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAqB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAEnF,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,EAAG,QAAiB,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAG,CAAU,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAG,MAAe,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAG,EAAW,CAAC;AACpD,eAAO,MAAM,iBAAiB,EAAG,CAAU,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,oGAAoG;AACpG,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAgC5D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAyB3D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CA2ChE;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAapD;AAED,8EAA8E;AAC9E,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vendored per-OS service-unit TEMPLATES for nectar (PRD-003b).
|
|
3
|
+
*
|
|
4
|
+
* Mirrors doctor's own unit templates (doctor/src/service/templates.ts)
|
|
5
|
+
* with nectar's run command (`daemon`, not `run`) and nectar's label/unit
|
|
6
|
+
* names (src/service/platform.ts). Three pure string builders, one per service
|
|
7
|
+
* manager, that render the unit text from a {@link ServicePlan}. No I/O, no
|
|
8
|
+
* shell-out - just deterministic text a test can snapshot-assert.
|
|
9
|
+
*
|
|
10
|
+
* Every template encodes the two non-negotiables of self-supervision (PRD-003b
|
|
11
|
+
* Goals):
|
|
12
|
+
* - restart-on-crash (launchd `KeepAlive`, systemd `Restart=always`, schtasks
|
|
13
|
+
* `RestartOnFailure`);
|
|
14
|
+
* - start-on-boot (launchd `RunAtLoad`, systemd `WantedBy=default.target`,
|
|
15
|
+
* schtasks `LogonTrigger`).
|
|
16
|
+
*
|
|
17
|
+
* Built-ins only; XML/plist are hand-built with the few entities they need escaped.
|
|
18
|
+
*/
|
|
19
|
+
import { SERVICE_LABEL, WINDOWS_TASK_NAME } from "./platform.js";
|
|
20
|
+
/** The subcommand nectar's unit execs to start the process (no shell). */
|
|
21
|
+
export const NECTAR_RUN_COMMAND = "daemon";
|
|
22
|
+
/**
|
|
23
|
+
* The directory the launchd unit writes stdout/stderr logs into
|
|
24
|
+
* (`<home>/.honeycomb/nectar`). Single-sourced here so the install path
|
|
25
|
+
* (`service/index.ts`) creates exactly the directory the plist references,
|
|
26
|
+
* rather than the daemon silently losing its logs on macOS (NEC-042 item 2 /
|
|
27
|
+
* AC-018l.9). Forward slashes match the plist's own path style.
|
|
28
|
+
*/
|
|
29
|
+
export function launchdLogDir(home) {
|
|
30
|
+
return `${home}/.honeycomb/nectar`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Seconds the OS waits before restarting a crashed nectar on POSIX. Used by the
|
|
34
|
+
* launchd `ThrottleInterval` and the systemd `RestartSec` directives; both take
|
|
35
|
+
* seconds. Mirrors doctor's `RESTART_SEC` (doctor/src/service/templates.ts).
|
|
36
|
+
*/
|
|
37
|
+
export const RESTART_SEC = 5;
|
|
38
|
+
/**
|
|
39
|
+
* The Windows Task Scheduler `RestartOnFailure`/`Interval` duration as an ISO-8601
|
|
40
|
+
* time interval. Task Scheduler REJECTS sub-minute intervals; the minimum it accepts
|
|
41
|
+
* is `PT1M`. This is Windows-only; POSIX keeps `RESTART_SEC` (seconds). Mirrors
|
|
42
|
+
* doctor's `WINDOWS_RESTART_INTERVAL`.
|
|
43
|
+
*/
|
|
44
|
+
export const WINDOWS_RESTART_INTERVAL = "PT1M";
|
|
45
|
+
/**
|
|
46
|
+
* systemd restart rate-limiting window (seconds) and burst count (daemon-api
|
|
47
|
+
* review H4). The old template disabled rate limiting (`StartLimitIntervalSec=0`),
|
|
48
|
+
* so a genuinely broken unit crash-looped every {@link RESTART_SEC} seconds
|
|
49
|
+
* forever. A finite burst over a finite window makes systemd give up and surface
|
|
50
|
+
* a failed state instead of burning CPU and journal space indefinitely.
|
|
51
|
+
*/
|
|
52
|
+
export const START_LIMIT_INTERVAL_SEC = 60;
|
|
53
|
+
export const START_LIMIT_BURST = 5;
|
|
54
|
+
/**
|
|
55
|
+
* Quote a single token for a systemd `ExecStart` line. systemd does NOT invoke a
|
|
56
|
+
* shell, but a bare token splits on whitespace, so a space-bearing exec path would
|
|
57
|
+
* mis-split. Wrapping the token in double quotes preserves the spaces.
|
|
58
|
+
*/
|
|
59
|
+
export function quoteSystemdToken(value) {
|
|
60
|
+
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
61
|
+
}
|
|
62
|
+
/** Escape the five XML predefined entities so an exec path with `&`/quotes cannot break the doc. */
|
|
63
|
+
export function escapeXml(value) {
|
|
64
|
+
return value
|
|
65
|
+
.replaceAll("&", "&")
|
|
66
|
+
.replaceAll("<", "<")
|
|
67
|
+
.replaceAll(">", ">")
|
|
68
|
+
.replaceAll('"', """)
|
|
69
|
+
.replaceAll("'", "'");
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Render a launchd plist (macOS). `RunAtLoad` = start-on-boot/login; `KeepAlive` =
|
|
73
|
+
* restart-on-crash. `ProgramArguments` is an argv array (no shell), so a path with
|
|
74
|
+
* spaces is safe. Logs go under the user's home so a LaunchAgent never needs root.
|
|
75
|
+
*/
|
|
76
|
+
export function renderLaunchdPlist(plan) {
|
|
77
|
+
const node = escapeXml(process.execPath);
|
|
78
|
+
const exec = escapeXml(plan.execPath);
|
|
79
|
+
const logDir = escapeXml(launchdLogDir(plan.home));
|
|
80
|
+
const label = escapeXml(plan.label);
|
|
81
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
82
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
83
|
+
<plist version="1.0">
|
|
84
|
+
<dict>
|
|
85
|
+
<key>Label</key>
|
|
86
|
+
<string>${label}</string>
|
|
87
|
+
<key>ProgramArguments</key>
|
|
88
|
+
<array>
|
|
89
|
+
<string>${node}</string>
|
|
90
|
+
<string>${exec}</string>
|
|
91
|
+
<string>${NECTAR_RUN_COMMAND}</string>
|
|
92
|
+
</array>
|
|
93
|
+
<key>RunAtLoad</key>
|
|
94
|
+
<true/>
|
|
95
|
+
<key>KeepAlive</key>
|
|
96
|
+
<true/>
|
|
97
|
+
<key>ThrottleInterval</key>
|
|
98
|
+
<integer>${RESTART_SEC}</integer>
|
|
99
|
+
<key>ProcessType</key>
|
|
100
|
+
<string>Background</string>
|
|
101
|
+
<key>StandardOutPath</key>
|
|
102
|
+
<string>${logDir}/launchd.out.log</string>
|
|
103
|
+
<key>StandardErrorPath</key>
|
|
104
|
+
<string>${logDir}/launchd.err.log</string>
|
|
105
|
+
</dict>
|
|
106
|
+
</plist>
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Render a systemd unit (Linux). `Restart=always` + `RestartSec` = restart-on-crash;
|
|
111
|
+
* `WantedBy=default.target` (with `systemctl --user enable`) = start-on-login/boot.
|
|
112
|
+
* `Type=simple` because nectar stays in the foreground of its own process.
|
|
113
|
+
*/
|
|
114
|
+
export function renderSystemdUnit(plan) {
|
|
115
|
+
// Prefix `process.execPath` (the node interpreter) exactly as the launchd and
|
|
116
|
+
// Scheduled Task templates do (daemon-api review H4): execing the CLI entry
|
|
117
|
+
// directly relied on `node` being on the systemd user manager's PATH, which it
|
|
118
|
+
// is not on an nvm/fnm/volta install, producing an infinite crash loop. Both
|
|
119
|
+
// tokens are quoted so a space-bearing path cannot mis-split into two argv
|
|
120
|
+
// tokens; the run subcommand is a fixed literal with no spaces.
|
|
121
|
+
const node = quoteSystemdToken(process.execPath);
|
|
122
|
+
const exec = quoteSystemdToken(plan.execPath);
|
|
123
|
+
return `[Unit]
|
|
124
|
+
Description=nectar - semantic memory layer daemon
|
|
125
|
+
Documentation=https://get.theapiary.sh
|
|
126
|
+
After=network.target
|
|
127
|
+
StartLimitIntervalSec=${START_LIMIT_INTERVAL_SEC}
|
|
128
|
+
StartLimitBurst=${START_LIMIT_BURST}
|
|
129
|
+
|
|
130
|
+
[Service]
|
|
131
|
+
Type=simple
|
|
132
|
+
ExecStart=${node} ${exec} ${NECTAR_RUN_COMMAND}
|
|
133
|
+
Restart=always
|
|
134
|
+
RestartSec=${RESTART_SEC}
|
|
135
|
+
|
|
136
|
+
[Install]
|
|
137
|
+
WantedBy=default.target
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Render a Windows Scheduled Task definition XML (per-user, the Windows DEFAULT).
|
|
142
|
+
* The `LogonTrigger` starts it at user logon (start-on-boot equivalent without
|
|
143
|
+
* admin); `RestartOnFailure` gives restart-on-crash; `MultipleInstancesPolicy=IgnoreNew`
|
|
144
|
+
* keeps a single instance (pairs with nectar's single-instance lock, PRD-003a).
|
|
145
|
+
* `<Command>`/`<Arguments>` are separate (no shell parsing).
|
|
146
|
+
*
|
|
147
|
+
* Consumed via `schtasks /Create /XML <file>`, so the per-user task needs no admin/UAC.
|
|
148
|
+
* Uses {@link WINDOWS_RESTART_INTERVAL} (`PT1M`), NOT {@link RESTART_SEC}: Task
|
|
149
|
+
* Scheduler rejects sub-minute intervals.
|
|
150
|
+
*/
|
|
151
|
+
export function renderScheduledTaskXml(plan) {
|
|
152
|
+
const node = escapeXml(process.execPath);
|
|
153
|
+
const exec = escapeXml(plan.execPath);
|
|
154
|
+
return `<?xml version="1.0" encoding="UTF-16"?>
|
|
155
|
+
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
156
|
+
<RegistrationInfo>
|
|
157
|
+
<Description>nectar - semantic memory layer daemon</Description>
|
|
158
|
+
<URI>\\${escapeXml(WINDOWS_TASK_NAME)}</URI>
|
|
159
|
+
</RegistrationInfo>
|
|
160
|
+
<Triggers>
|
|
161
|
+
<LogonTrigger>
|
|
162
|
+
<Enabled>true</Enabled>
|
|
163
|
+
</LogonTrigger>
|
|
164
|
+
</Triggers>
|
|
165
|
+
<Principals>
|
|
166
|
+
<Principal id="Author">
|
|
167
|
+
<LogonType>InteractiveToken</LogonType>
|
|
168
|
+
<RunLevel>LeastPrivilege</RunLevel>
|
|
169
|
+
</Principal>
|
|
170
|
+
</Principals>
|
|
171
|
+
<Settings>
|
|
172
|
+
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
173
|
+
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
174
|
+
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
175
|
+
<AllowHardTerminate>true</AllowHardTerminate>
|
|
176
|
+
<StartWhenAvailable>true</StartWhenAvailable>
|
|
177
|
+
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
|
178
|
+
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
|
|
179
|
+
<Enabled>true</Enabled>
|
|
180
|
+
<Hidden>false</Hidden>
|
|
181
|
+
<RestartOnFailure>
|
|
182
|
+
<Interval>${WINDOWS_RESTART_INTERVAL}</Interval>
|
|
183
|
+
<Count>999</Count>
|
|
184
|
+
</RestartOnFailure>
|
|
185
|
+
</Settings>
|
|
186
|
+
<Actions Context="Author">
|
|
187
|
+
<Exec>
|
|
188
|
+
<Command>${node}</Command>
|
|
189
|
+
<Arguments>"${exec}" ${NECTAR_RUN_COMMAND}</Arguments>
|
|
190
|
+
</Exec>
|
|
191
|
+
</Actions>
|
|
192
|
+
</Task>
|
|
193
|
+
`;
|
|
194
|
+
}
|
|
195
|
+
/** The single entry point: render whichever unit text the plan's manager needs. */
|
|
196
|
+
export function renderUnit(plan) {
|
|
197
|
+
switch (plan.manager) {
|
|
198
|
+
case "launchd":
|
|
199
|
+
return renderLaunchdPlist(plan);
|
|
200
|
+
case "systemd":
|
|
201
|
+
return renderSystemdUnit(plan);
|
|
202
|
+
case "schtasks":
|
|
203
|
+
case "sc":
|
|
204
|
+
// Both Windows backends consume the same Scheduled-Task XML when file-based; sc.exe
|
|
205
|
+
// (system service) is created via argv (see argv.ts) and does not use this template,
|
|
206
|
+
// but a single renderer keeps the XML available for the schtasks path.
|
|
207
|
+
return renderScheduledTaskXml(plan);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/** Re-export the label so callers building argv share one source of truth. */
|
|
211
|
+
export { SERVICE_LABEL };
|
|
212
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/service/templates.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** The SHARED credentials directory name under the user's home. */
|
|
2
|
+
export declare const CREDENTIALS_DIR_NAME = ".deeplake";
|
|
3
|
+
/** The credentials file name within the dir. */
|
|
4
|
+
export declare const CREDENTIALS_FILE_NAME = "credentials.json";
|
|
5
|
+
/** The canonical Deep Lake API base URL used when a file omits `apiUrl`. */
|
|
6
|
+
export declare const DEFAULT_DEEPLAKE_API_URL = "https://api.deeplake.ai";
|
|
7
|
+
/** The validated Deep Lake connection details the transport is built from. */
|
|
8
|
+
export interface DeepLakeCredentials {
|
|
9
|
+
/** Deep Lake HTTP query endpoint. Defaults to {@link DEFAULT_DEEPLAKE_API_URL}. */
|
|
10
|
+
readonly apiUrl: string;
|
|
11
|
+
/** The org-bound bearer token (SECRET; never logged in full). */
|
|
12
|
+
readonly token: string;
|
|
13
|
+
/** The org id the token is bound to. */
|
|
14
|
+
readonly orgId: string;
|
|
15
|
+
/** The active workspace id. */
|
|
16
|
+
readonly workspaceId: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for {@link loadDeepLakeCredentials}, injectable so a test points the
|
|
20
|
+
* file read at a temp dir without touching the real `~/.deeplake` (mirrors
|
|
21
|
+
* honeycomb's `CredentialsFileProviderOptions`). All optional.
|
|
22
|
+
*/
|
|
23
|
+
export interface LoadCredentialsOptions {
|
|
24
|
+
/** Override the credentials directory (tests). Defaults to `~/.deeplake`. */
|
|
25
|
+
readonly dir?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Structured, fail-closed rejection. Carries exactly which fields were missing
|
|
29
|
+
* or invalid so a caller (or an operator reading a log line) knows what to
|
|
30
|
+
* fix without the loader ever echoing the file's contents (which may hold the
|
|
31
|
+
* token).
|
|
32
|
+
*/
|
|
33
|
+
export declare class DeepLakeCredentialsError extends Error {
|
|
34
|
+
readonly missing: readonly string[];
|
|
35
|
+
constructor(missing: readonly string[]);
|
|
36
|
+
}
|
|
37
|
+
/** Resolve the credentials directory, honoring the test override. */
|
|
38
|
+
export declare function credentialsDir(options?: LoadCredentialsOptions): string;
|
|
39
|
+
/** Resolve the full credentials file path within the (possibly overridden) dir. */
|
|
40
|
+
export declare function credentialsPath(options?: LoadCredentialsOptions): string;
|
|
41
|
+
/**
|
|
42
|
+
* Load and validate `~/.deeplake/credentials.json` (or the overridden dir in
|
|
43
|
+
* `options.dir`). Throws {@link DeepLakeCredentialsError} listing every
|
|
44
|
+
* problem found: a missing file, invalid JSON, a non-object payload, or a
|
|
45
|
+
* missing/empty `token` / `orgId` / `workspaceId`. Never returns a partial
|
|
46
|
+
* credential — the caller either gets a fully-populated `DeepLakeCredentials`
|
|
47
|
+
* or a clear, typed reason it could not.
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadDeepLakeCredentials(options?: LoadCredentialsOptions): DeepLakeCredentials;
|
|
50
|
+
/**
|
|
51
|
+
* Redact a token for logs and errors. Never echoes a token in full: keeps the
|
|
52
|
+
* last 4 chars for correlation, masks the rest. An empty/short value collapses
|
|
53
|
+
* to a fixed mask so length isn't leaked either. Mirrors honeycomb's
|
|
54
|
+
* `redactToken` (`src/daemon/runtime/auth/credentials-store.ts:254-257`).
|
|
55
|
+
*/
|
|
56
|
+
export declare function redactToken(value: string): string;
|
|
57
|
+
//# sourceMappingURL=deeplake-credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deeplake-credentials.d.ts","sourceRoot":"","sources":["../../src/source-graph/deeplake-credentials.ts"],"names":[],"mappings":"AA4BA,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAChD,gDAAgD;AAChD,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAElE,8EAA8E;AAC9E,MAAM,WAAW,mBAAmB;IAClC,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+BAA+B;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;gBACxB,OAAO,EAAE,SAAS,MAAM,EAAE;CAKvC;AAED,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAE3E;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAE5E;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,sBAA2B,GAAG,mBAAmB,CAkCjG;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjD"}
|