@dominevo/types 0.1.0 → 0.1.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/CHANGELOG.md +8 -0
- package/dist/addon/base-addon.d.ts +2 -16
- package/dist/addon.d.ts +4 -4
- package/dist/addon.js +2 -2
- package/dist/addon.mjs +2 -2
- package/dist/app-bridge.d.ts +16 -16
- package/dist/auth/app-callback.d.ts +2 -3
- package/dist/auth/credential-scope.d.ts +1 -1
- package/dist/auth/device-certificate.d.ts +5 -5
- package/dist/auth/sso-state.d.ts +1 -1
- package/dist/brokers/smtp-inbound.d.ts +1 -1
- package/dist/cap-call-context.d.ts +2 -2
- package/dist/capabilities/backup.cap.d.ts +1 -1
- package/dist/capabilities/capability-definition.d.ts +1 -1
- package/dist/capabilities/custom-model-registry.cap.d.ts +8 -8
- package/dist/capabilities/display-palette.cap.d.ts +2 -2
- package/dist/capabilities/hub-address.d.ts +5 -5
- package/dist/capabilities/index.d.ts +2 -2
- package/dist/capabilities/keychain-admin.cap.d.ts +2 -2
- package/dist/capabilities/load-contribution.cap.d.ts +1 -1
- package/dist/capabilities/local-network.cap.d.ts +1 -1
- package/dist/capabilities/metrics-provider.cap.d.ts +1 -1
- package/dist/capabilities/migrations.cap.d.ts +1 -1
- package/dist/capabilities/model-convert.cap.d.ts +2 -2
- package/dist/capabilities/model-distributor.cap.d.ts +4 -4
- package/dist/capabilities/notification-rules.cap.d.ts +1 -1
- package/dist/capabilities/oauth-integration.cap.d.ts +1 -1
- package/dist/capabilities/pipeline-executor.cap.d.ts +5 -5
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +1 -1
- package/dist/capabilities/pipeline-runner.cap.d.ts +1 -1
- package/dist/capabilities/recording.cap.d.ts +5 -5
- package/dist/capabilities/reserved-collection-sources.d.ts +1 -1
- package/dist/capabilities/server-management.cap.d.ts +4 -4
- package/dist/capabilities/settings-store.cap.d.ts +1 -1
- package/dist/capabilities/training.cap.d.ts +1 -1
- package/dist/capabilities/videoclips.cap.d.ts +5 -5
- package/dist/capabilities/viewer-link-url.d.ts +4 -4
- package/dist/catalogs/display-palette-tables.d.ts +2 -2
- package/dist/catalogs/display-palette.d.ts +3 -3
- package/dist/catalogs/palette-entries.d.ts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +19 -27
- package/dist/client.mjs +19 -27
- package/dist/constants.d.ts +2 -2
- package/dist/deps/edgetpu-delegate.d.ts +4 -4
- package/dist/deps/ffmpeg-binary-source.d.ts +2 -2
- package/dist/deps/ffmpeg-downloader.d.ts +1 -1
- package/dist/device/icon-catalog.generated.d.ts +2 -5
- package/dist/enums/event-category.d.ts +2 -2
- package/dist/enums.js +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/esm/addon/base-addon.mjs +2 -22
- package/dist/esm/addon/notification-targets.mjs +1 -1
- package/dist/esm/addon/record-integration-instances.mjs +2 -2
- package/dist/esm/addon.mjs +1 -1
- package/dist/esm/app-bridge.mjs +2 -2
- package/dist/esm/auth/app-callback.mjs +3 -9
- package/dist/esm/auth/credential-scope.mjs +2 -2
- package/dist/esm/auth/device-certificate.mjs +6 -11
- package/dist/esm/auth/sso-state.mjs +1 -1
- package/dist/esm/brokers/smtp-inbound.mjs +1 -1
- package/dist/esm/cap-call-context.mjs +2 -2
- package/dist/esm/capabilities/backup.cap.mjs +1 -1
- package/dist/esm/capabilities/custom-model-registry.cap.mjs +1 -1
- package/dist/esm/capabilities/device-export.cap.mjs +1 -1
- package/dist/esm/capabilities/face-gallery.cap.mjs +1 -1
- package/dist/esm/capabilities/hub-address.mjs +8 -8
- package/dist/esm/capabilities/ir-transmitter.cap.mjs +1 -1
- package/dist/esm/capabilities/keychain-admin.cap.mjs +2 -2
- package/dist/esm/capabilities/load-contribution.cap.mjs +1 -1
- package/dist/esm/capabilities/local-network.cap.mjs +1 -1
- package/dist/esm/capabilities/mesh-network.cap.mjs +2 -2
- package/dist/esm/capabilities/metrics-provider.cap.mjs +2 -2
- package/dist/esm/capabilities/migrations.cap.mjs +1 -1
- package/dist/esm/capabilities/notification-rules.cap.mjs +1 -1
- package/dist/esm/capabilities/oauth-integration.cap.mjs +1 -1
- package/dist/esm/capabilities/pipeline-orchestrator.cap.mjs +2 -2
- package/dist/esm/capabilities/pipeline-runner.cap.mjs +2 -2
- package/dist/esm/capabilities/recording.cap.mjs +7 -7
- package/dist/esm/capabilities/reserved-collection-sources.mjs +1 -1
- package/dist/esm/capabilities/server-management.cap.mjs +4 -4
- package/dist/esm/capabilities/settings-store.cap.mjs +1 -1
- package/dist/esm/capabilities/sso-bridge.cap.mjs +1 -1
- package/dist/esm/capabilities/training-provider.cap.mjs +1 -1
- package/dist/esm/capabilities/videoclips.cap.mjs +6 -6
- package/dist/esm/capabilities/viewer-link-url.mjs +5 -5
- package/dist/esm/catalogs/display-palette-tables.mjs +3 -3
- package/dist/esm/catalogs/display-palette.mjs +6 -6
- package/dist/esm/catalogs/event-taxonomy.mjs +2 -2
- package/dist/esm/catalogs/palette-entries.mjs +1 -1
- package/dist/esm/constants.mjs +1 -1
- package/dist/esm/deps/binary-downloader.mjs +1 -1
- package/dist/esm/deps/edgetpu-delegate.mjs +6 -6
- package/dist/esm/deps/ffmpeg-artifacts.mjs +1 -1
- package/dist/esm/deps/ffmpeg-binary-source.mjs +2 -2
- package/dist/esm/deps/ffmpeg-downloader.mjs +1 -1
- package/dist/esm/deps/python-downloader.mjs +1 -1
- package/dist/esm/device/icon-catalog.generated.mjs +2 -5
- package/dist/esm/enums/event-category.mjs +2 -2
- package/dist/esm/ffmpeg/egress-sharing-key.mjs +19 -0
- package/dist/esm/ffmpeg/sharing-key.mjs +1 -35
- package/dist/esm/generated/method-descriptions.mjs +3 -3
- package/dist/esm/generated/scope-presets.mjs +1 -1
- package/dist/esm/i18n/{camstack-error.mjs → dominevo-error.mjs} +5 -5
- package/dist/esm/index.mjs +7 -8
- package/dist/esm/interfaces/addon-data-plane.mjs +2 -2
- package/dist/esm/interfaces/config-ui-secrets.mjs +1 -1
- package/dist/esm/interfaces/storage-location-declaration.mjs +4 -4
- package/dist/esm/keychain/known-secrets.mjs +1 -1
- package/dist/esm/keychain/secret-marker.mjs +1 -1
- package/dist/esm/node.mjs +5 -2
- package/dist/esm/notification/email-mime.mjs +2 -2
- package/dist/esm/notification/scope-picker-items.mjs +3 -3
- package/dist/esm/pipeline/native-lease.mjs +1 -1
- package/dist/esm/pipeline/node-benchmark/schemas.mjs +1 -1
- package/dist/esm/records/errors.mjs +1 -1
- package/dist/esm/records/in-memory-records-rows.mjs +1 -1
- package/dist/esm/records/secret-views.mjs +1 -1
- package/dist/esm/storage/atomic-write.mjs +1 -1
- package/dist/esm/storage/filesystem-storage-provider.mjs +3 -3
- package/dist/esm/template/automation-template.mjs +1 -1
- package/dist/esm/training/trainer-contract.mjs +10 -10
- package/dist/esm/treeshake-canary.mjs +1 -1
- package/dist/esm/types/models.mjs +7 -7
- package/dist/esm/util/models-dir.mjs +19 -0
- package/dist/esm/utils/pool-memory-watchdog.mjs +8 -8
- package/dist/esm/vendor-login-proxy/login-proxy.mjs +1 -1
- package/dist/esm/vendor-login-proxy/url-rewrite.mjs +1 -1
- package/dist/{event-category-7IiGF_Ui.mjs → event-category-CwprdwEL.mjs} +2 -2
- package/dist/{event-category-BJe9O5KZ.js → event-category-DhlUHlM5.js} +2 -2
- package/dist/ffmpeg/egress-sharing-key.d.ts +19 -0
- package/dist/ffmpeg/sharing-key.d.ts +19 -12
- package/dist/generated/addon-api.d.ts +2 -2
- package/dist/i18n/{camstack-error.d.ts → dominevo-error.d.ts} +2 -2
- package/dist/index.d.ts +3 -4
- package/dist/index.js +133 -326
- package/dist/index.mjs +126 -316
- package/dist/interfaces/addon-data-plane.d.ts +4 -4
- package/dist/interfaces/addon.d.ts +11 -11
- package/dist/interfaces/analysis.d.ts +2 -2
- package/dist/interfaces/capability.d.ts +1 -1
- package/dist/interfaces/config-ui-secrets.d.ts +1 -1
- package/dist/interfaces/context.d.ts +2 -2
- package/dist/interfaces/detection-addon.d.ts +2 -2
- package/dist/interfaces/device-provider.d.ts +2 -2
- package/dist/interfaces/event-bus.d.ts +1 -1
- package/dist/interfaces/kernel-abstractions.d.ts +1 -1
- package/dist/interfaces/storage-location-declaration.d.ts +1 -1
- package/dist/node.d.ts +3 -0
- package/dist/node.js +168 -13
- package/dist/node.mjs +164 -13
- package/dist/notification/scope-picker-items.d.ts +2 -2
- package/dist/{runtime-capabilities-B9CE8DzI.js → runtime-capabilities-Db29ELdy.js} +26 -46
- package/dist/{runtime-capabilities-CAGwQ-Ec.mjs → runtime-capabilities-Dg5DXZkO.mjs} +21 -41
- package/dist/storage/filesystem-storage-provider.d.ts +1 -1
- package/dist/template/automation-template.d.ts +2 -2
- package/dist/training/trainer-contract.d.ts +9 -9
- package/dist/treeshake-canary.d.ts +3 -3
- package/dist/types/agent-pipeline-settings.d.ts +1 -1
- package/dist/types/models.d.ts +11 -11
- package/dist/util/models-dir.d.ts +10 -0
- package/dist/utils/pool-memory-watchdog.d.ts +1 -1
- package/dist/{wake-on-lan-BocEJPCO.js → wake-on-lan-CAbNKvo9.js} +62 -34
- package/dist/{wake-on-lan-Dm-fxZ7N.mjs → wake-on-lan-DqbzeHhm.mjs} +57 -35
- package/package.json +4 -4
|
@@ -6,7 +6,7 @@ import type { RouteAccess } from './addon-routes.js';
|
|
|
6
6
|
* hub can reach the addon's `127.0.0.1` listener. Defined here (shared by the
|
|
7
7
|
* core proxy and the kernel listener) to keep both off a kernel↔core import.
|
|
8
8
|
*/
|
|
9
|
-
export declare const DATAPLANE_SECRET_HEADER = "x-
|
|
9
|
+
export declare const DATAPLANE_SECRET_HEADER = "x-dominevo-dataplane-secret";
|
|
10
10
|
/**
|
|
11
11
|
* The authenticated caller's username, written by the HUB gate on every
|
|
12
12
|
* non-public data-plane request AFTER it verified the credential. Whatever the
|
|
@@ -14,7 +14,7 @@ export declare const DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
|
|
|
14
14
|
* identity of the request, percent-encoded (a viewer's log batch is attributed with it, never
|
|
15
15
|
* with a field of its own body).
|
|
16
16
|
*/
|
|
17
|
-
export declare const CALLER_USERNAME_HEADER = "x-
|
|
17
|
+
export declare const CALLER_USERNAME_HEADER = "x-dominevo-user";
|
|
18
18
|
/**
|
|
19
19
|
* Addon HTTP **data-plane** — a generic, framework-level mechanism for an addon
|
|
20
20
|
* to serve HTTP responses of ANY shape (files with `Range`, live streams, large
|
|
@@ -69,8 +69,8 @@ export interface AddonDataPlaneServeOptions {
|
|
|
69
69
|
* token is refused here (403), whatever `access` says: a share link is a
|
|
70
70
|
* bearer credential for one view of a few devices, not a session, and a
|
|
71
71
|
* plane that never read the scope headers would serve every device to it.
|
|
72
|
-
* A plane that opts in receives `x-
|
|
73
|
-
* `x-
|
|
72
|
+
* A plane that opts in receives `x-dominevo-share-kind` and
|
|
73
|
+
* `x-dominevo-share-devices` (comma-separated device ids) set by the hub —
|
|
74
74
|
* never by the client — and MUST refuse a device outside that list.
|
|
75
75
|
*/
|
|
76
76
|
readonly share?: readonly ShareViewKind[];
|
|
@@ -141,7 +141,7 @@ export interface IAddonDepsManager {
|
|
|
141
141
|
/**
|
|
142
142
|
* AddonContext -- injected into every addon at initialize().
|
|
143
143
|
*
|
|
144
|
-
* The context includes both the
|
|
144
|
+
* The context includes both the DominevoContext fields (id, logger, eventBus, storage, config)
|
|
145
145
|
* and addon-specific extras (addonConfig, models, locationPaths, router, network).
|
|
146
146
|
*/
|
|
147
147
|
/**
|
|
@@ -154,7 +154,7 @@ export interface IAddonDepsManager {
|
|
|
154
154
|
* To regenerate after changing routers: npx tsx scripts/generate-api-types.ts
|
|
155
155
|
*/
|
|
156
156
|
/**
|
|
157
|
-
* A capability provider binding returned from `
|
|
157
|
+
* A capability provider binding returned from `IDominevoAddon.initialize()`.
|
|
158
158
|
* The kernel registers each entry in the CapabilityRegistry after init completes.
|
|
159
159
|
*/
|
|
160
160
|
export interface ProviderRegistration<TCap extends CapabilityDefinition = CapabilityDefinition> {
|
|
@@ -187,7 +187,7 @@ export interface ProviderRegistration<TCap extends CapabilityDefinition = Capabi
|
|
|
187
187
|
readonly defaultActive?: boolean;
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
|
-
* Return value of `
|
|
190
|
+
* Return value of `IDominevoAddon.initialize()`. Both sections are optional —
|
|
191
191
|
* addons that provide only capabilities omit `customActions`; addons that only
|
|
192
192
|
* expose actions omit `providers`; pure consumers may return void.
|
|
193
193
|
*/
|
|
@@ -308,7 +308,7 @@ export interface IKernelServices {
|
|
|
308
308
|
/**
|
|
309
309
|
* Per-addon storage-location declarations across every installed addon.
|
|
310
310
|
*
|
|
311
|
-
* Each inner array is one addon's `
|
|
311
|
+
* Each inner array is one addon's `dominevo.addons[].storageLocations`
|
|
312
312
|
* declaration (addons declaring none are omitted). The storage-orchestrator
|
|
313
313
|
* builtin aggregates these via `buildStorageLocationRegistry(perAddon)` to
|
|
314
314
|
* seed one `<id>:default` instance per declared location.
|
|
@@ -489,7 +489,7 @@ export interface AddonContext<TConfig = Record<string, unknown>> {
|
|
|
489
489
|
*/
|
|
490
490
|
readonly dataDir: string;
|
|
491
491
|
/**
|
|
492
|
-
* Node-local data ROOT for this node (`
|
|
492
|
+
* Node-local data ROOT for this node (`DOMINEVO_DATA` ?? the kernel boot dir).
|
|
493
493
|
* The single, centralized anchor for internal per-node working directories
|
|
494
494
|
* (models, logs, addons-data). Always writable on the local node — unlike the
|
|
495
495
|
* hub-singleton `storage` cap, which returns the hub's path to every node.
|
|
@@ -511,7 +511,7 @@ export interface AddonContext<TConfig = Record<string, unknown>> {
|
|
|
511
511
|
* `system-config` addon.
|
|
512
512
|
*
|
|
513
513
|
* The addon combines these raw reads with its own schema via
|
|
514
|
-
* `hydrateSchema()` inside the scoped and device settings readers on `
|
|
514
|
+
* `hydrateSchema()` inside the scoped and device settings readers on `IDominevoAddon`. There is no defaults
|
|
515
515
|
* injection or cross-level merge at this layer.
|
|
516
516
|
*
|
|
517
517
|
* KEYCHAIN (D798): the view a `BaseAddon` reaches as `this.ctx.settings`
|
|
@@ -870,7 +870,7 @@ export interface CapabilitiesAccess {
|
|
|
870
870
|
/** The active provider of a singleton capability (by cap name). */
|
|
871
871
|
get<T = unknown>(name: string): T | undefined;
|
|
872
872
|
}
|
|
873
|
-
export interface
|
|
873
|
+
export interface IDominevoAddon {
|
|
874
874
|
readonly id?: string;
|
|
875
875
|
/** Addon declaration — injected by the framework from package.json. Do not declare in addon class. */
|
|
876
876
|
readonly manifest?: AddonDeclaration;
|
|
@@ -1037,7 +1037,7 @@ export interface IAdminUI {
|
|
|
1037
1037
|
}>;
|
|
1038
1038
|
}
|
|
1039
1039
|
/**
|
|
1040
|
-
* Full addon declaration — lives in package.json `
|
|
1040
|
+
* Full addon declaration — lives in package.json `dominevo.addons[]`.
|
|
1041
1041
|
* This is the SINGLE SOURCE OF TRUTH for addon identity and metadata.
|
|
1042
1042
|
* Addon classes no longer declare a `manifest` property.
|
|
1043
1043
|
*/
|
|
@@ -1200,7 +1200,7 @@ export interface AddonDeclaration {
|
|
|
1200
1200
|
*
|
|
1201
1201
|
* Example:
|
|
1202
1202
|
* ```jsonc
|
|
1203
|
-
* "
|
|
1203
|
+
* "dominevo": {
|
|
1204
1204
|
* "addons": [{
|
|
1205
1205
|
* "id": "detection-pipeline",
|
|
1206
1206
|
* "python": { "requirements": "./python/requirements.txt" }
|
|
@@ -1227,7 +1227,7 @@ export interface AddonDeclaration {
|
|
|
1227
1227
|
*
|
|
1228
1228
|
* Example:
|
|
1229
1229
|
* ```jsonc
|
|
1230
|
-
* "
|
|
1230
|
+
* "dominevo": {
|
|
1231
1231
|
* "addons": [{
|
|
1232
1232
|
* "id": "smb-storage",
|
|
1233
1233
|
* "systemDependencies": [
|
|
@@ -1365,7 +1365,7 @@ export interface AddonPackageManifest {
|
|
|
1365
1365
|
*
|
|
1366
1366
|
* Example:
|
|
1367
1367
|
* ```jsonc
|
|
1368
|
-
* "
|
|
1368
|
+
* "dominevo": {
|
|
1369
1369
|
* "nativeDependencies": {
|
|
1370
1370
|
* "better-sqlite3": "^12.8.0",
|
|
1371
1371
|
* "ssh2": "^1.16.0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IDominevoAddon } from './addon.js';
|
|
2
2
|
import type { FrameInput } from '../types/io.js';
|
|
3
3
|
import type { PipelineConfig, PipelineStatus } from '../types/pipeline.js';
|
|
4
4
|
import type { DetectionEvent } from '../types/events.js';
|
|
@@ -26,7 +26,7 @@ export interface AnalysisFrameOutput {
|
|
|
26
26
|
readonly events: readonly DetectionEvent[];
|
|
27
27
|
readonly enrichedFrame: FrameResult | null;
|
|
28
28
|
}
|
|
29
|
-
export interface IAnalysisAddon extends
|
|
29
|
+
export interface IAnalysisAddon extends IDominevoAddon, ICameraAnalyticsProvider {
|
|
30
30
|
/**
|
|
31
31
|
* Process a frame through the analysis pipeline (tracking, scene state,
|
|
32
32
|
* face recognition, etc.) and emit any resulting detection events.
|
|
@@ -28,7 +28,7 @@ export type IPipelineStepProvider = StepDefinition;
|
|
|
28
28
|
*/
|
|
29
29
|
export type CapabilityMode = 'singleton' | 'collection' | 'per-node';
|
|
30
30
|
/**
|
|
31
|
-
* Declared in addon package.json manifests under
|
|
31
|
+
* Declared in addon package.json manifests under dominevo.addons[].capabilities.
|
|
32
32
|
*
|
|
33
33
|
* Mode (singleton / collection) is **not** declared here — the single source
|
|
34
34
|
* of truth is the cap definition in `packages/types/src/capabilities/*.cap.ts`.
|
|
@@ -32,7 +32,7 @@ import type { ConfigField } from './config-ui.js';
|
|
|
32
32
|
* plausibly choose as a real password would turn that convenience into a way
|
|
33
33
|
* to lock yourself out, hence the sentinel shape.
|
|
34
34
|
*/
|
|
35
|
-
export declare const REDACTED_SECRET = "
|
|
35
|
+
export declare const REDACTED_SECRET = "__dominevo_redacted__";
|
|
36
36
|
/** Is this field's stored value a credential? */
|
|
37
37
|
export declare function isSecretConfigField(field: ConfigField): boolean;
|
|
38
38
|
/**
|
|
@@ -2,7 +2,7 @@ import type { IScopedLogger } from './logging.js';
|
|
|
2
2
|
import type { IEventBus } from './event-bus.js';
|
|
3
3
|
import type { ISettingsBackend, IStorageProvider } from './storage.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* DominevoContext -- injected into every provider, device, and addon.
|
|
6
6
|
*
|
|
7
7
|
* Each element receives a context scoped to its identity:
|
|
8
8
|
* - logger is pre-scoped: (Reolink)[FrontDoor] for a device, (Reolink) for a provider
|
|
@@ -14,7 +14,7 @@ import type { ISettingsBackend, IStorageProvider } from './storage.js';
|
|
|
14
14
|
* The `id` is an immutable progressive identifier assigned at creation time.
|
|
15
15
|
* It never changes even if the element is renamed.
|
|
16
16
|
*/
|
|
17
|
-
export interface
|
|
17
|
+
export interface DominevoContext {
|
|
18
18
|
/** Immutable progressive ID of this element (e.g., 'provider:reolink-1', 'device:reolink-1/front-door') */
|
|
19
19
|
readonly id: string;
|
|
20
20
|
/** Pre-scoped logger -- logs automatically include this element's scope chain */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IDominevoAddon } from './addon.js';
|
|
2
2
|
import type { IPipelineSlotProvider } from './pipeline-slot.js';
|
|
3
3
|
import type { ConfigUISchema } from './config-ui.js';
|
|
4
4
|
import type { ClassMapDefinition, LabelDefinition } from '../types/labels.js';
|
|
5
5
|
import type { ModelCatalogEntry, DetectionModel } from '../types/models.js';
|
|
6
6
|
import type { ProbeResult } from '../types/config.js';
|
|
7
|
-
export interface IDetectionAddon extends Omit<
|
|
7
|
+
export interface IDetectionAddon extends Omit<IDominevoAddon, 'getConfigSchema' | 'getModelCatalog'>, IPipelineSlotProvider {
|
|
8
8
|
getConfigSchema(): Promise<ConfigUISchema>;
|
|
9
9
|
getClassMap(): Promise<ClassMapDefinition>;
|
|
10
10
|
getModelCatalog(): Promise<ModelCatalogEntry[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DominevoContext } from './context.js';
|
|
2
2
|
import type { ConfigUISchema, FieldProbeResult } from './config-ui.js';
|
|
3
3
|
export interface ProviderStatus {
|
|
4
4
|
connected: boolean;
|
|
@@ -18,7 +18,7 @@ export interface IDeviceProvider {
|
|
|
18
18
|
readonly name: string;
|
|
19
19
|
readonly discoveryMode: 'auto' | 'manual' | 'both';
|
|
20
20
|
/** The provider's context -- logger, storage, eventBus scoped to this provider */
|
|
21
|
-
readonly ctx:
|
|
21
|
+
readonly ctx: DominevoContext;
|
|
22
22
|
start(): Promise<void>;
|
|
23
23
|
stop(): Promise<void>;
|
|
24
24
|
getStatus(): ProviderStatus;
|
|
@@ -1573,7 +1573,7 @@ export interface EventCatalog {
|
|
|
1573
1573
|
};
|
|
1574
1574
|
/**
|
|
1575
1575
|
* Periodic per-node process-tree snapshot (`NodeProcess[]` —
|
|
1576
|
-
*
|
|
1576
|
+
* dominevo-related pids with root / managed / system classification).
|
|
1577
1577
|
* One event per node per tick. Replaces polling on
|
|
1578
1578
|
* `metricsProvider.listNodeProcesses`.
|
|
1579
1579
|
*/
|
|
@@ -91,7 +91,7 @@ export interface ICapabilityRegistry {
|
|
|
91
91
|
/** List device-scoped capability names that apply to a device type. */
|
|
92
92
|
listDeviceScopedCapsForType(deviceType: string): readonly string[];
|
|
93
93
|
}
|
|
94
|
-
/** An engine instance returned by IEngineManager — typed interface instead of raw
|
|
94
|
+
/** An engine instance returned by IEngineManager — typed interface instead of raw IDominevoAddon */
|
|
95
95
|
export interface IEngineInstance {
|
|
96
96
|
/** Run inference on a frame or crop */
|
|
97
97
|
process(input: FrameInput | CropInput): Promise<InferenceOutput>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* `StorageLocationDeclaration` — a single storage-location entry declared by
|
|
4
|
-
* an addon in its `package.json` under `
|
|
4
|
+
* an addon in its `package.json` under `dominevo.storageLocations`.
|
|
5
5
|
*
|
|
6
6
|
* Design intent:
|
|
7
7
|
* - **Addon declares its needs** — each addon describes the logical storage
|
package/dist/node.d.ts
CHANGED
|
@@ -31,3 +31,6 @@ export type { DeviceExportShape, ExportDelta, ExportTargetEntry, } from './utils
|
|
|
31
31
|
export { canonicalDeviceFingerprint, diffExportTargets, resolveExportFingerprint, } from './utils/export-reconciler.js';
|
|
32
32
|
export type { WakeOnLanDeps, WakeOnLanInterface, WakeOnLanInterfaces, WakeOnLanRefusal, WakeOnLanRequest, WakeOnLanResult, WakeOnLanSocket, WakeOnLanTargetFailure, } from './network/wake-on-lan-node.js';
|
|
33
33
|
export { WOL_REFUSAL_REASONS, sendWakeOnLan } from './network/wake-on-lan-node.js';
|
|
34
|
+
export { egressTranscodeSharingKey } from './ffmpeg/egress-sharing-key.js';
|
|
35
|
+
export { calendarRecordId, moveCalendarIdsToRecords } from './migrations/calendar-ids-to-records.js';
|
|
36
|
+
export { resolveModelsDir } from './util/models-dir.js';
|
package/dist/node.js
CHANGED
|
@@ -22,8 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
24
|
const require_composed_stable_id = require("./composed-stable-id-C9Vwl-Qd.js");
|
|
25
|
-
const require_wake_on_lan = require("./wake-on-lan-
|
|
26
|
-
let node_crypto = require("node:crypto");
|
|
25
|
+
const require_wake_on_lan = require("./wake-on-lan-CAbNKvo9.js");
|
|
27
26
|
let node_fs = require("node:fs");
|
|
28
27
|
node_fs = __toESM(node_fs);
|
|
29
28
|
let node_path = require("node:path");
|
|
@@ -31,6 +30,7 @@ node_path = __toESM(node_path);
|
|
|
31
30
|
let node_stream_promises = require("node:stream/promises");
|
|
32
31
|
let node_stream = require("node:stream");
|
|
33
32
|
let node_child_process = require("node:child_process");
|
|
33
|
+
let node_crypto = require("node:crypto");
|
|
34
34
|
let node_zlib = require("node:zlib");
|
|
35
35
|
let node_os = require("node:os");
|
|
36
36
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -457,7 +457,7 @@ async function probeFfmpegBinary(path) {
|
|
|
457
457
|
* The ffmpeg this node runs, downloading the pinned build if it is not here
|
|
458
458
|
* yet, and reporting what it got.
|
|
459
459
|
*
|
|
460
|
-
* Order: the operator's `
|
|
460
|
+
* Order: the operator's `DOMINEVO_FFMPEG_PATH` → the pinned build already on
|
|
461
461
|
* disk → download it. No PATH, no image copy, no per-platform special case —
|
|
462
462
|
* see `ffmpeg-binary-source.ts` for why the image stopped being special after
|
|
463
463
|
* exactly one day.
|
|
@@ -1052,14 +1052,14 @@ function installLibraryFromDeb(debPath, memberName, targetPath, workDir, extract
|
|
|
1052
1052
|
* Windows delegate is built for a TFLite ai-edge-litert 2.1.6 cannot load.
|
|
1053
1053
|
*
|
|
1054
1054
|
* Resolution order, mirrored by `edgetpu_device.edgetpu_library_path` in the
|
|
1055
|
-
* Python pool: the `
|
|
1056
|
-
* under `<
|
|
1055
|
+
* Python pool: the `DOMINEVO_EDGETPU_LIB` path override → the copy staged
|
|
1056
|
+
* under `<DOMINEVO_DATA>/deps/edgetpu/lib/` → the hub's historical
|
|
1057
1057
|
* `/data/deps/edgetpu/lib/libedgetpu.so.1`. On the hub image
|
|
1058
|
-
* `
|
|
1058
|
+
* `DOMINEVO_DATA=/data`, so the staged path and the historical one are the
|
|
1059
1059
|
* same file and nothing moves.
|
|
1060
1060
|
*/
|
|
1061
1061
|
/** The path override (a library PATH, never a secret). */
|
|
1062
|
-
var EDGETPU_LIB_ENV = "
|
|
1062
|
+
var EDGETPU_LIB_ENV = "DOMINEVO_EDGETPU_LIB";
|
|
1063
1063
|
/** The pinned feranick release. Changing it is the delegate version change. */
|
|
1064
1064
|
var EDGETPU_DELEGATE_RELEASE = "16.0TF2.17.1-1";
|
|
1065
1065
|
/** Where the hub image's installer has always put the delegate. */
|
|
@@ -1147,7 +1147,7 @@ function chooseEdgetpuDelegate(lookup) {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
/** The node data root the way every node process names it. */
|
|
1149
1149
|
function nodeDataRootFromEnv(env) {
|
|
1150
|
-
return env["
|
|
1150
|
+
return env["DOMINEVO_DATA"] ?? env["DOMINEVO_DATA_DIR"];
|
|
1151
1151
|
}
|
|
1152
1152
|
/** Under 1 MB each: held whole, written once, hashed from disk before use. */
|
|
1153
1153
|
async function download(url, target) {
|
|
@@ -1193,7 +1193,7 @@ async function stageFile(file, libDir, workRoot) {
|
|
|
1193
1193
|
* without on this line; `installPythonRequirements` stages it after pip.
|
|
1194
1194
|
* (`ai-edge-litert` imports without the delegate and is useless without it.)
|
|
1195
1195
|
*/
|
|
1196
|
-
var EDGETPU_DELEGATE_DIRECTIVE = "#
|
|
1196
|
+
var EDGETPU_DELEGATE_DIRECTIVE = "# dominevo-native-dep: edgetpu-delegate";
|
|
1197
1197
|
function declaresEdgetpuDelegate(requirementsText) {
|
|
1198
1198
|
return requirementsText.split(/\r?\n/).some((line) => line.trim() === EDGETPU_DELEGATE_DIRECTIVE);
|
|
1199
1199
|
}
|
|
@@ -2360,7 +2360,7 @@ var DEFAULT_LOCATION_SUBDIRS = {
|
|
|
2360
2360
|
"event-images": "event-images",
|
|
2361
2361
|
models: "models",
|
|
2362
2362
|
"addons-data": "addons-data",
|
|
2363
|
-
cache: "/tmp/
|
|
2363
|
+
cache: "/tmp/dominevo-cache",
|
|
2364
2364
|
logs: "logs",
|
|
2365
2365
|
backups: "backups"
|
|
2366
2366
|
};
|
|
@@ -2375,7 +2375,7 @@ var DEFAULT_LOCATION_SUBDIRS = {
|
|
|
2375
2375
|
* {rootPath}/models/
|
|
2376
2376
|
* {rootPath}/addons-data/
|
|
2377
2377
|
* {rootPath}/logs/
|
|
2378
|
-
* /tmp/
|
|
2378
|
+
* /tmp/dominevo-cache/ (cache is always local)
|
|
2379
2379
|
*
|
|
2380
2380
|
* Individual location paths can be overridden.
|
|
2381
2381
|
*/
|
|
@@ -2538,6 +2538,39 @@ function containsOrEquals(outer, inner) {
|
|
|
2538
2538
|
return relative !== "" && !relative.startsWith("..") && !node_path.default.isAbsolute(relative);
|
|
2539
2539
|
}
|
|
2540
2540
|
//#endregion
|
|
2541
|
+
//#region src/utils/canonical-hash.ts
|
|
2542
|
+
/**
|
|
2543
|
+
* Deterministic SHA-256 hash of an arbitrary serialisable value. The
|
|
2544
|
+
* canonical form sorts object keys alphabetically at every depth so two
|
|
2545
|
+
* structurally-equal inputs with different key insertion orders produce
|
|
2546
|
+
* the same hash. Returns a 64-char lowercase hex digest.
|
|
2547
|
+
*
|
|
2548
|
+
* Used by export adapters (Alexa, HAP) to short-circuit re-discovery /
|
|
2549
|
+
* accessory-rebuild work when the upstream shape is byte-identical to
|
|
2550
|
+
* the last applied state — preventing user-visible "re-discovery"
|
|
2551
|
+
* notifications on every addon-runner respawn. Each respawn re-fires
|
|
2552
|
+
* `DeviceBindingsChanged` for every cap registration, which without
|
|
2553
|
+
* this guard would propagate redundant pushes.
|
|
2554
|
+
*
|
|
2555
|
+
* Note: this is a SYMPTOMATIC fix layered on top of the binding-change
|
|
2556
|
+
* subscription. The proper fix is a single "device ready" lifecycle
|
|
2557
|
+
* barrier so exports react only when the full cap set has landed —
|
|
2558
|
+
* tracked separately for post-HA-integration work.
|
|
2559
|
+
*/
|
|
2560
|
+
function canonicalHash(value) {
|
|
2561
|
+
const canonical = JSON.stringify(value, replaceWithSortedKeys);
|
|
2562
|
+
return (0, node_crypto.createHash)("sha256").update(canonical ?? "").digest("hex");
|
|
2563
|
+
}
|
|
2564
|
+
function replaceWithSortedKeys(_key, value) {
|
|
2565
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2566
|
+
const obj = value;
|
|
2567
|
+
const out = {};
|
|
2568
|
+
for (const k of Object.keys(obj).toSorted()) out[k] = obj[k];
|
|
2569
|
+
return out;
|
|
2570
|
+
}
|
|
2571
|
+
return value;
|
|
2572
|
+
}
|
|
2573
|
+
//#endregion
|
|
2541
2574
|
//#region src/composition/customization-name.ts
|
|
2542
2575
|
/**
|
|
2543
2576
|
* The stored name of the implicit block that customizes an existing device
|
|
@@ -2621,7 +2654,7 @@ function verifyExpiringUrl(input) {
|
|
|
2621
2654
|
*/
|
|
2622
2655
|
function canonicalDeviceFingerprint(shape) {
|
|
2623
2656
|
const features = [...new Set(shape.features)].toSorted();
|
|
2624
|
-
return
|
|
2657
|
+
return canonicalHash({
|
|
2625
2658
|
deviceType: shape.deviceType,
|
|
2626
2659
|
features
|
|
2627
2660
|
});
|
|
@@ -2815,6 +2848,124 @@ async function sendWakeOnLan(request, deps = REAL_DEPS) {
|
|
|
2815
2848
|
};
|
|
2816
2849
|
}
|
|
2817
2850
|
//#endregion
|
|
2851
|
+
//#region src/ffmpeg/egress-sharing-key.ts
|
|
2852
|
+
/**
|
|
2853
|
+
* The refcount / dedup key. `canonicalHash` sorts object keys at every depth,
|
|
2854
|
+
* so a request built with a different field order produces the same digest.
|
|
2855
|
+
*
|
|
2856
|
+
* The handle this keys is IMMUTABLE: there is no `reconfigure`. A consumer
|
|
2857
|
+
* whose requirements change RELEASES and re-acquires; the refcount does the
|
|
2858
|
+
* rest. That is what stops co-tenants disturbing each other — the co-tenant
|
|
2859
|
+
* hazard that made Alexa's shared `derived:alexa-<id>` stream a hazard was
|
|
2860
|
+
* exactly a mutable shared object, where one consumer's downgrade dragged
|
|
2861
|
+
* every other consumer to 360p.
|
|
2862
|
+
*/
|
|
2863
|
+
function egressTranscodeSharingKey(request, delivery = require_wake_on_lan.egressTransportFromRequest(request)) {
|
|
2864
|
+
return `egress:${canonicalHash(require_wake_on_lan.canonicalEgressPlan(request, delivery))}`;
|
|
2865
|
+
}
|
|
2866
|
+
//#endregion
|
|
2867
|
+
//#region src/migrations/calendar-ids-to-records.ts
|
|
2868
|
+
/**
|
|
2869
|
+
* The calendars an account imports leave the account (D1013). An account record used to carry a
|
|
2870
|
+
* `calendarIds` array; each calendar is now a record of its own that LINKS to the account
|
|
2871
|
+
* (`calendars`, one per account and calendar). For every account row with an array:
|
|
2872
|
+
*
|
|
2873
|
+
* 1. each entry becomes a calendar record under a deterministic id (an existing one is kept);
|
|
2874
|
+
* 2. each record is read back and must name this account and calendar;
|
|
2875
|
+
* 3. only then is the array cleared (a patch: nothing else on the account is touched).
|
|
2876
|
+
*
|
|
2877
|
+
* An entry that names another account, or is not a calendar id at all, selected nothing before
|
|
2878
|
+
* (the reader only matched its own account's ids): it is counted, named in a warning and goes with
|
|
2879
|
+
* the array. An array that is not a list of strings is left where it is. A failure on one account
|
|
2880
|
+
* does not stop the others; the run then throws, and the accounts that failed keep their array.
|
|
2881
|
+
* Accounts are never created or deleted. Idempotent: with the arrays cleared nothing is left to do.
|
|
2882
|
+
*/
|
|
2883
|
+
/** The id of the calendar record of one (account, calendar): the same pair is always the same row. */
|
|
2884
|
+
function calendarRecordId(accountId, calendarId) {
|
|
2885
|
+
return `cal_${(0, node_crypto.createHash)("sha1").update(`${accountId}\0${calendarId}`).digest("hex").slice(0, 16)}`;
|
|
2886
|
+
}
|
|
2887
|
+
function entriesOf(value) {
|
|
2888
|
+
if (!Array.isArray(value)) return null;
|
|
2889
|
+
const out = [];
|
|
2890
|
+
for (const item of value) {
|
|
2891
|
+
if (typeof item !== "string") return null;
|
|
2892
|
+
out.push(item);
|
|
2893
|
+
}
|
|
2894
|
+
return out;
|
|
2895
|
+
}
|
|
2896
|
+
async function moveCalendarIdsToRecords(ports, spec) {
|
|
2897
|
+
let created = 0;
|
|
2898
|
+
let cleared = 0;
|
|
2899
|
+
let dropped = 0;
|
|
2900
|
+
const failed = [];
|
|
2901
|
+
for (const account of await ports.listAccounts()) {
|
|
2902
|
+
if (account.calendarIds === void 0 || account.calendarIds === null) continue;
|
|
2903
|
+
const entries = entriesOf(account.calendarIds);
|
|
2904
|
+
if (entries === null) {
|
|
2905
|
+
ports.warn(`account '${account.id}': calendarIds is not a list of ids and stays as it is`);
|
|
2906
|
+
failed.push(account.id);
|
|
2907
|
+
continue;
|
|
2908
|
+
}
|
|
2909
|
+
try {
|
|
2910
|
+
const own = /* @__PURE__ */ new Set();
|
|
2911
|
+
const inert = [];
|
|
2912
|
+
for (const entry of entries) {
|
|
2913
|
+
const calendarId = spec.calendarIdOf(account.id, entry);
|
|
2914
|
+
if (calendarId === null || calendarId === "") inert.push(entry);
|
|
2915
|
+
else own.add(calendarId);
|
|
2916
|
+
}
|
|
2917
|
+
for (const calendarId of own) {
|
|
2918
|
+
const recordId = calendarRecordId(account.id, calendarId);
|
|
2919
|
+
const body = {
|
|
2920
|
+
name: calendarId,
|
|
2921
|
+
accountId: account.id,
|
|
2922
|
+
calendarId
|
|
2923
|
+
};
|
|
2924
|
+
if (await ports.readCalendar(recordId) === null) {
|
|
2925
|
+
await ports.putCalendar(recordId, body);
|
|
2926
|
+
created += 1;
|
|
2927
|
+
}
|
|
2928
|
+
const back = await ports.readCalendar(recordId);
|
|
2929
|
+
if (back?.accountId !== account.id || back.calendarId !== calendarId) throw new Error(`account '${account.id}': the calendar record '${recordId}' did not read back; the array stays`);
|
|
2930
|
+
}
|
|
2931
|
+
if (inert.length > 0) {
|
|
2932
|
+
ports.warn(`account '${account.id}': ${inert.length} entr${inert.length === 1 ? "y" : "ies"} of calendarIds named another account or no calendar and selected nothing: ${inert.join(", ")}`);
|
|
2933
|
+
dropped += inert.length;
|
|
2934
|
+
}
|
|
2935
|
+
await ports.clearCalendarIds(account.id);
|
|
2936
|
+
cleared += 1;
|
|
2937
|
+
} catch (error) {
|
|
2938
|
+
ports.warn(error instanceof Error ? error.message : String(error));
|
|
2939
|
+
failed.push(account.id);
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
if (failed.length > 0) throw new Error(`calendarIds kept on ${failed.length} account(s) (${failed.join(", ")}); ${created} calendar record(s) written, ${cleared} account(s) cleared`);
|
|
2943
|
+
return {
|
|
2944
|
+
outcome: created === 0 && cleared === 0 ? "already-done" : "done",
|
|
2945
|
+
summary: {
|
|
2946
|
+
created,
|
|
2947
|
+
cleared,
|
|
2948
|
+
dropped
|
|
2949
|
+
}
|
|
2950
|
+
};
|
|
2951
|
+
}
|
|
2952
|
+
//#endregion
|
|
2953
|
+
//#region src/util/models-dir.ts
|
|
2954
|
+
/**
|
|
2955
|
+
* The shared, node-local models directory: `<nodeDataDir>/models`, created when missing.
|
|
2956
|
+
*
|
|
2957
|
+
* The SINGLE resolver for every inference addon (detection-pipeline, audio-analyzer,
|
|
2958
|
+
* embedding-encoder, model-studio, ai). It is anchored at the node's own writable data root
|
|
2959
|
+
* (`ctx.nodeDataDir`) — never the hub-singleton `storage` cap, which returns the hub's
|
|
2960
|
+
* `/data/models` to every node and breaks a node whose real data dir differs (the macOS agent).
|
|
2961
|
+
* Node-only, hence `@dominevo/types/node`, off the browser-facing root entry.
|
|
2962
|
+
*/
|
|
2963
|
+
async function resolveModelsDir(nodeDataDir) {
|
|
2964
|
+
const dir = (0, node_path.join)(nodeDataDir, "models");
|
|
2965
|
+
await node_fs.promises.mkdir(dir, { recursive: true });
|
|
2966
|
+
return dir;
|
|
2967
|
+
}
|
|
2968
|
+
//#endregion
|
|
2818
2969
|
exports.ChildCostRegistry = ChildCostRegistry;
|
|
2819
2970
|
exports.EDGETPU_DELEGATE_DIRECTIVE = EDGETPU_DELEGATE_DIRECTIVE;
|
|
2820
2971
|
exports.EDGETPU_DELEGATE_RELEASE = EDGETPU_DELEGATE_RELEASE;
|
|
@@ -2831,8 +2982,9 @@ exports.OwnerOnlyError = OwnerOnlyError;
|
|
|
2831
2982
|
exports.PYTHON_VERSION = PYTHON_VERSION;
|
|
2832
2983
|
exports.WOL_REFUSAL_REASONS = WOL_REFUSAL_REASONS;
|
|
2833
2984
|
exports.buildBinaryPath = buildBinaryPath;
|
|
2985
|
+
exports.calendarRecordId = calendarRecordId;
|
|
2834
2986
|
exports.canonicalDeviceFingerprint = canonicalDeviceFingerprint;
|
|
2835
|
-
exports.canonicalHash =
|
|
2987
|
+
exports.canonicalHash = canonicalHash;
|
|
2836
2988
|
exports.chooseEdgetpuDelegate = chooseEdgetpuDelegate;
|
|
2837
2989
|
exports.containsOrEquals = containsOrEquals;
|
|
2838
2990
|
exports.customizationBlockName = customizationBlockName;
|
|
@@ -2843,6 +2995,7 @@ exports.diffExportTargets = diffExportTargets;
|
|
|
2843
2995
|
exports.downloadBinary = downloadBinary;
|
|
2844
2996
|
exports.edgetpuDelegateFileName = edgetpuDelegateFileName;
|
|
2845
2997
|
exports.edgetpuLibDir = edgetpuLibDir;
|
|
2998
|
+
exports.egressTranscodeSharingKey = egressTranscodeSharingKey;
|
|
2846
2999
|
exports.ensureBinary = ensureBinary;
|
|
2847
3000
|
exports.ensureEdgetpuDelegate = ensureEdgetpuDelegate;
|
|
2848
3001
|
exports.ensureFfmpeg = ensureFfmpeg;
|
|
@@ -2860,6 +3013,7 @@ exports.installLibraryFromDeb = installLibraryFromDeb;
|
|
|
2860
3013
|
exports.installPythonPackages = installPythonPackages;
|
|
2861
3014
|
exports.installPythonRequirements = installPythonRequirements;
|
|
2862
3015
|
exports.mkdirOwnerOnlySync = mkdirOwnerOnlySync;
|
|
3016
|
+
exports.moveCalendarIdsToRecords = moveCalendarIdsToRecords;
|
|
2863
3017
|
exports.nodeDataRootFromEnv = nodeDataRootFromEnv;
|
|
2864
3018
|
exports.nodeProcStatReader = nodeProcStatReader;
|
|
2865
3019
|
exports.parseFfmpegCapabilities = parseFfmpegCapabilities;
|
|
@@ -2871,6 +3025,7 @@ exports.probeFfmpegBinary = probeFfmpegBinary;
|
|
|
2871
3025
|
exports.readArMembers = readArMembers;
|
|
2872
3026
|
exports.readProcessCost = readProcessCost;
|
|
2873
3027
|
exports.resolveExportFingerprint = resolveExportFingerprint;
|
|
3028
|
+
exports.resolveModelsDir = resolveModelsDir;
|
|
2874
3029
|
exports.resolvePinnedFfmpegSpawner = resolvePinnedFfmpegSpawner;
|
|
2875
3030
|
exports.restrictDirToOwnerSync = restrictDirToOwnerSync;
|
|
2876
3031
|
exports.restrictFileToOwnerSync = restrictFileToOwnerSync;
|