@camstack/system 1.2.35 → 1.2.37
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/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/block-type-defs.d.ts +14 -0
- package/dist/builtins/core-blocks/compile-block.d.ts +21 -0
- package/dist/builtins/core-blocks/core-block-store.d.ts +73 -0
- package/dist/builtins/core-blocks/core-blocks.addon.d.ts +27 -0
- package/dist/builtins/core-blocks/core-blocks.addon.js +428 -0
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +421 -0
- package/dist/builtins/core-blocks/index.d.ts +4 -0
- package/dist/builtins/core-blocks/index.js +12 -0
- package/dist/builtins/core-blocks/index.mjs +2 -0
- package/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/integration-registry.d.ts +10 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{dist-DyxtdHgI.js → dist-CFinlH7b.js} +190 -0
- package/dist/{dist-DkwTH1dP.mjs → dist-DO76YVO2.mjs} +179 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -2
- package/dist/index.mjs +17 -3
- package/dist/main-CVLq8IzA.js +2356 -0
- package/dist/main-CzH19GkU.mjs +2353 -0
- package/package.json +14 -1
|
@@ -8,6 +8,16 @@ export declare class IntegrationRegistry implements IIntegrationRegistry {
|
|
|
8
8
|
getIntegrationByAddonId(addonId: string): Promise<Integration | null>;
|
|
9
9
|
listIntegrations(): Promise<readonly Integration[]>;
|
|
10
10
|
updateIntegration(id: string, updates: Partial<Pick<Integration, 'name' | 'enabled' | 'info'>>): Promise<Integration | null>;
|
|
11
|
+
/**
|
|
12
|
+
* A FIXED integration exists because an addon declares it, not because an
|
|
13
|
+
* operator added it — the Notification Center's alarm panel is the first.
|
|
14
|
+
* There is no add or delete flow for one, and this is where that is true
|
|
15
|
+
* rather than merely hidden: a UI that only omits the button still leaves the
|
|
16
|
+
* mutation one API call away.
|
|
17
|
+
*/
|
|
18
|
+
static isFixed(integration: {
|
|
19
|
+
readonly info: Readonly<Record<string, unknown>>;
|
|
20
|
+
}): boolean;
|
|
11
21
|
deleteIntegration(id: string): Promise<boolean>;
|
|
12
22
|
getIntegrationSettings(integrationId: string): Promise<Record<string, unknown>>;
|
|
13
23
|
setIntegrationSetting(integrationId: string, key: string, value: unknown): Promise<void>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CFinlH7b.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let better_sqlite3 = require("better-sqlite3");
|
|
9
9
|
better_sqlite3 = require_chunk.__toESM(better_sqlite3);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as dataStoreProviderCapability, ct as BaseAddon, kt as parseJsonUnknown, l as RUNTIME_DEFAULTS, st as errMsg, vt as asJsonObject } from "../../dist-DO76YVO2.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import Database from "better-sqlite3";
|
|
4
4
|
//#region src/builtins/sqlite-storage/filter-compiler.ts
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CFinlH7b.js");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_chunk.__toESM(node_path);
|
|
9
9
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as settingsStoreCapability, Ot as parseJsonObject, ct as BaseAddon, f as StorageLocationTypeSchema, tt as storageCapability } from "../../dist-DO76YVO2.mjs";
|
|
2
2
|
import * as path$1 from "node:path";
|
|
3
3
|
import * as fs from "node:fs/promises";
|
|
4
4
|
import { buildStorageLocationRegistry } from "@camstack/system";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CFinlH7b.js");
|
|
7
7
|
//#region src/builtins/system-config/system-config.addon.ts
|
|
8
8
|
/**
|
|
9
9
|
* Built-in `system-config` addon — Phase 4 of the settings redesign.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Tt as hydrateSchema, ct as BaseAddon, st as errMsg } from "../../dist-DO76YVO2.mjs";
|
|
2
2
|
//#region src/builtins/system-config/system-config.addon.ts
|
|
3
3
|
/**
|
|
4
4
|
* Built-in `system-config` addon — Phase 4 of the settings redesign.
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CFinlH7b.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
let node_path = require("node:path");
|
|
9
9
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as logDestinationCapability, ct as BaseAddon } from "../../dist-DO76YVO2.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import path from "node:path";
|
|
@@ -17729,6 +17729,135 @@ var notificationOutputCapability = {
|
|
|
17729
17729
|
}
|
|
17730
17730
|
};
|
|
17731
17731
|
/**
|
|
17732
|
+
* core-blocks — user-authored TypeScript, stored in the kernel and executed in
|
|
17733
|
+
* its own process.
|
|
17734
|
+
*
|
|
17735
|
+
* Spec: `docs/superpowers/specs/2026-08-04-core-blocks-and-synthetic-devices-design.md`.
|
|
17736
|
+
*
|
|
17737
|
+
* The first use is **owning devices without being a device provider**: a block
|
|
17738
|
+
* declares devices under a system or custom integration and drives their state,
|
|
17739
|
+
* with the same `ctx` an addon gets. Automations come later; nothing here
|
|
17740
|
+
* models a trigger.
|
|
17741
|
+
*
|
|
17742
|
+
* **Stated plainly, because it does not change by being true:** a block has an
|
|
17743
|
+
* addon's powers — devices, storage, the event bus, `ctx.api`. It is a plugin
|
|
17744
|
+
* with no review step. What makes that survivable is not a sandbox, it is
|
|
17745
|
+
* PROCESS ISOLATION: one process per block, supervised by `CrashSupervisor`,
|
|
17746
|
+
* so a block that throws or never returns is marked `failed` and visible
|
|
17747
|
+
* instead of taking the hub with it (D6). Every method here is admin-only, and
|
|
17748
|
+
* must stay so.
|
|
17749
|
+
*/
|
|
17750
|
+
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
17751
|
+
* agent is the reason placement is not fixed to the hub. */
|
|
17752
|
+
var CoreBlockPlacementSchema = zod.z.union([zod.z.literal("hub"), zod.z.string().min(1)]);
|
|
17753
|
+
/** What a block's process is doing. Mirrors the addon runner's own lifecycle so
|
|
17754
|
+
* a failing block reads the same way a failing addon does. */
|
|
17755
|
+
var CoreBlockStatusSchema = zod.z.enum([
|
|
17756
|
+
"stopped",
|
|
17757
|
+
"starting",
|
|
17758
|
+
"running",
|
|
17759
|
+
"failed"
|
|
17760
|
+
]);
|
|
17761
|
+
/** Client-authored fields. */
|
|
17762
|
+
var CoreBlockInputSchema = zod.z.object({
|
|
17763
|
+
name: zod.z.string().min(1).max(120),
|
|
17764
|
+
/** TypeScript source. Compiled server-side before it is ever stored — a
|
|
17765
|
+
* block that does not compile is a fork failure the operator would meet
|
|
17766
|
+
* minutes later, in a log, instead of in the editor. */
|
|
17767
|
+
code: zod.z.string().max(2e5),
|
|
17768
|
+
enabled: zod.z.boolean(),
|
|
17769
|
+
placement: CoreBlockPlacementSchema,
|
|
17770
|
+
/**
|
|
17771
|
+
* Integration the block's devices hang from. Absent = the system integration
|
|
17772
|
+
* blocks share. A block may declare its own instead.
|
|
17773
|
+
*/
|
|
17774
|
+
integrationId: zod.z.string().optional()
|
|
17775
|
+
});
|
|
17776
|
+
/** A stored block. */
|
|
17777
|
+
var CoreBlockSchema = CoreBlockInputSchema.extend({
|
|
17778
|
+
id: zod.z.string(),
|
|
17779
|
+
createdAt: zod.z.number(),
|
|
17780
|
+
updatedAt: zod.z.number(),
|
|
17781
|
+
/** Server-stamped author. */
|
|
17782
|
+
createdBy: zod.z.string(),
|
|
17783
|
+
status: CoreBlockStatusSchema,
|
|
17784
|
+
/**
|
|
17785
|
+
* Why the block is not running, when it is not. The operator's ONLY window
|
|
17786
|
+
* into a block that failed at load — a block that is silently absent is the
|
|
17787
|
+
* failure mode this whole feature has to avoid.
|
|
17788
|
+
*/
|
|
17789
|
+
lastError: zod.z.string().optional(),
|
|
17790
|
+
/** Ms epoch of the last state change. */
|
|
17791
|
+
lastChangedAt: zod.z.number()
|
|
17792
|
+
});
|
|
17793
|
+
/** What a compile attempt produced. */
|
|
17794
|
+
var CoreBlockCompileResultSchema = zod.z.object({
|
|
17795
|
+
ok: zod.z.boolean(),
|
|
17796
|
+
/** Present when `ok` is false — the first error, in the author's words. */
|
|
17797
|
+
error: zod.z.string().optional(),
|
|
17798
|
+
line: zod.z.number().optional(),
|
|
17799
|
+
column: zod.z.number().optional()
|
|
17800
|
+
});
|
|
17801
|
+
var coreBlocksCapability = {
|
|
17802
|
+
name: "core-blocks",
|
|
17803
|
+
scope: "system",
|
|
17804
|
+
mode: "singleton",
|
|
17805
|
+
methods: {
|
|
17806
|
+
list: method(zod.z.object({}), zod.z.object({ blocks: zod.z.array(CoreBlockSchema) }), { auth: "admin" }),
|
|
17807
|
+
get: method(zod.z.object({ blockId: zod.z.string() }), zod.z.object({ block: CoreBlockSchema.nullable() }), { auth: "admin" }),
|
|
17808
|
+
/**
|
|
17809
|
+
* Create a block. The code is COMPILED first: storing source that does not
|
|
17810
|
+
* compile turns an editor error into a fork failure the operator meets
|
|
17811
|
+
* minutes later in a log.
|
|
17812
|
+
*/
|
|
17813
|
+
create: method(zod.z.object({ block: CoreBlockInputSchema }), zod.z.object({ block: CoreBlockSchema }), {
|
|
17814
|
+
kind: "mutation",
|
|
17815
|
+
auth: "admin",
|
|
17816
|
+
caller: "required"
|
|
17817
|
+
}),
|
|
17818
|
+
update: method(zod.z.object({
|
|
17819
|
+
blockId: zod.z.string(),
|
|
17820
|
+
block: CoreBlockInputSchema.partial()
|
|
17821
|
+
}), zod.z.object({ block: CoreBlockSchema }), {
|
|
17822
|
+
kind: "mutation",
|
|
17823
|
+
auth: "admin",
|
|
17824
|
+
caller: "required"
|
|
17825
|
+
}),
|
|
17826
|
+
delete: method(zod.z.object({ blockId: zod.z.string() }), zod.z.object({ success: zod.z.literal(true) }), {
|
|
17827
|
+
kind: "mutation",
|
|
17828
|
+
auth: "admin"
|
|
17829
|
+
}),
|
|
17830
|
+
setEnabled: method(zod.z.object({
|
|
17831
|
+
blockId: zod.z.string(),
|
|
17832
|
+
enabled: zod.z.boolean()
|
|
17833
|
+
}), zod.z.object({ block: CoreBlockSchema }), {
|
|
17834
|
+
kind: "mutation",
|
|
17835
|
+
auth: "admin"
|
|
17836
|
+
}),
|
|
17837
|
+
/**
|
|
17838
|
+
* Type-check without saving — what the editor calls as the author types, so
|
|
17839
|
+
* the compiler's verdict is the same one the server will reach.
|
|
17840
|
+
*/
|
|
17841
|
+
compile: method(zod.z.object({ code: zod.z.string() }), CoreBlockCompileResultSchema, {
|
|
17842
|
+
kind: "mutation",
|
|
17843
|
+
auth: "admin"
|
|
17844
|
+
}),
|
|
17845
|
+
/**
|
|
17846
|
+
* The declaration files the editor type-checks against.
|
|
17847
|
+
*
|
|
17848
|
+
* Served rather than bundled: the graph is 3.4 MB across 344 files, and
|
|
17849
|
+
* bundling it would roughly double the admin remote. Served rather than
|
|
17850
|
+
* hand-stubbed: a block runs with the same `ctx` an addon gets, so a stub
|
|
17851
|
+
* would drift and the editor would confidently autocomplete methods that
|
|
17852
|
+
* do not exist.
|
|
17853
|
+
*/
|
|
17854
|
+
getTypeDefs: method(zod.z.object({}), zod.z.object({ libs: zod.z.array(zod.z.object({
|
|
17855
|
+
filePath: zod.z.string(),
|
|
17856
|
+
content: zod.z.string()
|
|
17857
|
+
})) }), { auth: "admin" })
|
|
17858
|
+
}
|
|
17859
|
+
};
|
|
17860
|
+
/**
|
|
17732
17861
|
* Zod schemas for persisted record types.
|
|
17733
17862
|
*
|
|
17734
17863
|
* These schemas serve as the single source of truth for types that are
|
|
@@ -24263,6 +24392,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
24263
24392
|
consumablesCapability,
|
|
24264
24393
|
contactCapability,
|
|
24265
24394
|
controlCapability,
|
|
24395
|
+
coreBlocksCapability,
|
|
24266
24396
|
coverCapability,
|
|
24267
24397
|
customModelRegistryCapability,
|
|
24268
24398
|
dataStoreProviderCapability,
|
|
@@ -25235,6 +25365,54 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
25235
25365
|
addonId: null,
|
|
25236
25366
|
access: "create"
|
|
25237
25367
|
},
|
|
25368
|
+
"coreBlocks.compile": {
|
|
25369
|
+
capName: "core-blocks",
|
|
25370
|
+
capScope: "system",
|
|
25371
|
+
addonId: null,
|
|
25372
|
+
access: "create"
|
|
25373
|
+
},
|
|
25374
|
+
"coreBlocks.create": {
|
|
25375
|
+
capName: "core-blocks",
|
|
25376
|
+
capScope: "system",
|
|
25377
|
+
addonId: null,
|
|
25378
|
+
access: "create"
|
|
25379
|
+
},
|
|
25380
|
+
"coreBlocks.delete": {
|
|
25381
|
+
capName: "core-blocks",
|
|
25382
|
+
capScope: "system",
|
|
25383
|
+
addonId: null,
|
|
25384
|
+
access: "delete"
|
|
25385
|
+
},
|
|
25386
|
+
"coreBlocks.get": {
|
|
25387
|
+
capName: "core-blocks",
|
|
25388
|
+
capScope: "system",
|
|
25389
|
+
addonId: null,
|
|
25390
|
+
access: "view"
|
|
25391
|
+
},
|
|
25392
|
+
"coreBlocks.getTypeDefs": {
|
|
25393
|
+
capName: "core-blocks",
|
|
25394
|
+
capScope: "system",
|
|
25395
|
+
addonId: null,
|
|
25396
|
+
access: "view"
|
|
25397
|
+
},
|
|
25398
|
+
"coreBlocks.list": {
|
|
25399
|
+
capName: "core-blocks",
|
|
25400
|
+
capScope: "system",
|
|
25401
|
+
addonId: null,
|
|
25402
|
+
access: "view"
|
|
25403
|
+
},
|
|
25404
|
+
"coreBlocks.setEnabled": {
|
|
25405
|
+
capName: "core-blocks",
|
|
25406
|
+
capScope: "system",
|
|
25407
|
+
addonId: null,
|
|
25408
|
+
access: "create"
|
|
25409
|
+
},
|
|
25410
|
+
"coreBlocks.update": {
|
|
25411
|
+
capName: "core-blocks",
|
|
25412
|
+
capScope: "system",
|
|
25413
|
+
addonId: null,
|
|
25414
|
+
access: "create"
|
|
25415
|
+
},
|
|
25238
25416
|
"cover.close": {
|
|
25239
25417
|
capName: "cover",
|
|
25240
25418
|
capScope: "device",
|
|
@@ -29673,6 +29851,12 @@ Object.defineProperty(exports, "CAP_NAMES_WITH_STATUS", {
|
|
|
29673
29851
|
return CAP_NAMES_WITH_STATUS;
|
|
29674
29852
|
}
|
|
29675
29853
|
});
|
|
29854
|
+
Object.defineProperty(exports, "CoreBlockSchema", {
|
|
29855
|
+
enumerable: true,
|
|
29856
|
+
get: function() {
|
|
29857
|
+
return CoreBlockSchema;
|
|
29858
|
+
}
|
|
29859
|
+
});
|
|
29676
29860
|
Object.defineProperty(exports, "DATAPLANE_SECRET_HEADER", {
|
|
29677
29861
|
enumerable: true,
|
|
29678
29862
|
get: function() {
|
|
@@ -29841,6 +30025,12 @@ Object.defineProperty(exports, "buildStreamParamsConfigSchema", {
|
|
|
29841
30025
|
return buildStreamParamsConfigSchema;
|
|
29842
30026
|
}
|
|
29843
30027
|
});
|
|
30028
|
+
Object.defineProperty(exports, "coreBlocksCapability", {
|
|
30029
|
+
enumerable: true,
|
|
30030
|
+
get: function() {
|
|
30031
|
+
return coreBlocksCapability;
|
|
30032
|
+
}
|
|
30033
|
+
});
|
|
29844
30034
|
Object.defineProperty(exports, "createEvent", {
|
|
29845
30035
|
enumerable: true,
|
|
29846
30036
|
get: function() {
|
|
@@ -17729,6 +17729,135 @@ var notificationOutputCapability = {
|
|
|
17729
17729
|
}
|
|
17730
17730
|
};
|
|
17731
17731
|
/**
|
|
17732
|
+
* core-blocks — user-authored TypeScript, stored in the kernel and executed in
|
|
17733
|
+
* its own process.
|
|
17734
|
+
*
|
|
17735
|
+
* Spec: `docs/superpowers/specs/2026-08-04-core-blocks-and-synthetic-devices-design.md`.
|
|
17736
|
+
*
|
|
17737
|
+
* The first use is **owning devices without being a device provider**: a block
|
|
17738
|
+
* declares devices under a system or custom integration and drives their state,
|
|
17739
|
+
* with the same `ctx` an addon gets. Automations come later; nothing here
|
|
17740
|
+
* models a trigger.
|
|
17741
|
+
*
|
|
17742
|
+
* **Stated plainly, because it does not change by being true:** a block has an
|
|
17743
|
+
* addon's powers — devices, storage, the event bus, `ctx.api`. It is a plugin
|
|
17744
|
+
* with no review step. What makes that survivable is not a sandbox, it is
|
|
17745
|
+
* PROCESS ISOLATION: one process per block, supervised by `CrashSupervisor`,
|
|
17746
|
+
* so a block that throws or never returns is marked `failed` and visible
|
|
17747
|
+
* instead of taking the hub with it (D6). Every method here is admin-only, and
|
|
17748
|
+
* must stay so.
|
|
17749
|
+
*/
|
|
17750
|
+
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
17751
|
+
* agent is the reason placement is not fixed to the hub. */
|
|
17752
|
+
var CoreBlockPlacementSchema = z.union([z.literal("hub"), z.string().min(1)]);
|
|
17753
|
+
/** What a block's process is doing. Mirrors the addon runner's own lifecycle so
|
|
17754
|
+
* a failing block reads the same way a failing addon does. */
|
|
17755
|
+
var CoreBlockStatusSchema = z.enum([
|
|
17756
|
+
"stopped",
|
|
17757
|
+
"starting",
|
|
17758
|
+
"running",
|
|
17759
|
+
"failed"
|
|
17760
|
+
]);
|
|
17761
|
+
/** Client-authored fields. */
|
|
17762
|
+
var CoreBlockInputSchema = z.object({
|
|
17763
|
+
name: z.string().min(1).max(120),
|
|
17764
|
+
/** TypeScript source. Compiled server-side before it is ever stored — a
|
|
17765
|
+
* block that does not compile is a fork failure the operator would meet
|
|
17766
|
+
* minutes later, in a log, instead of in the editor. */
|
|
17767
|
+
code: z.string().max(2e5),
|
|
17768
|
+
enabled: z.boolean(),
|
|
17769
|
+
placement: CoreBlockPlacementSchema,
|
|
17770
|
+
/**
|
|
17771
|
+
* Integration the block's devices hang from. Absent = the system integration
|
|
17772
|
+
* blocks share. A block may declare its own instead.
|
|
17773
|
+
*/
|
|
17774
|
+
integrationId: z.string().optional()
|
|
17775
|
+
});
|
|
17776
|
+
/** A stored block. */
|
|
17777
|
+
var CoreBlockSchema = CoreBlockInputSchema.extend({
|
|
17778
|
+
id: z.string(),
|
|
17779
|
+
createdAt: z.number(),
|
|
17780
|
+
updatedAt: z.number(),
|
|
17781
|
+
/** Server-stamped author. */
|
|
17782
|
+
createdBy: z.string(),
|
|
17783
|
+
status: CoreBlockStatusSchema,
|
|
17784
|
+
/**
|
|
17785
|
+
* Why the block is not running, when it is not. The operator's ONLY window
|
|
17786
|
+
* into a block that failed at load — a block that is silently absent is the
|
|
17787
|
+
* failure mode this whole feature has to avoid.
|
|
17788
|
+
*/
|
|
17789
|
+
lastError: z.string().optional(),
|
|
17790
|
+
/** Ms epoch of the last state change. */
|
|
17791
|
+
lastChangedAt: z.number()
|
|
17792
|
+
});
|
|
17793
|
+
/** What a compile attempt produced. */
|
|
17794
|
+
var CoreBlockCompileResultSchema = z.object({
|
|
17795
|
+
ok: z.boolean(),
|
|
17796
|
+
/** Present when `ok` is false — the first error, in the author's words. */
|
|
17797
|
+
error: z.string().optional(),
|
|
17798
|
+
line: z.number().optional(),
|
|
17799
|
+
column: z.number().optional()
|
|
17800
|
+
});
|
|
17801
|
+
var coreBlocksCapability = {
|
|
17802
|
+
name: "core-blocks",
|
|
17803
|
+
scope: "system",
|
|
17804
|
+
mode: "singleton",
|
|
17805
|
+
methods: {
|
|
17806
|
+
list: method(z.object({}), z.object({ blocks: z.array(CoreBlockSchema) }), { auth: "admin" }),
|
|
17807
|
+
get: method(z.object({ blockId: z.string() }), z.object({ block: CoreBlockSchema.nullable() }), { auth: "admin" }),
|
|
17808
|
+
/**
|
|
17809
|
+
* Create a block. The code is COMPILED first: storing source that does not
|
|
17810
|
+
* compile turns an editor error into a fork failure the operator meets
|
|
17811
|
+
* minutes later in a log.
|
|
17812
|
+
*/
|
|
17813
|
+
create: method(z.object({ block: CoreBlockInputSchema }), z.object({ block: CoreBlockSchema }), {
|
|
17814
|
+
kind: "mutation",
|
|
17815
|
+
auth: "admin",
|
|
17816
|
+
caller: "required"
|
|
17817
|
+
}),
|
|
17818
|
+
update: method(z.object({
|
|
17819
|
+
blockId: z.string(),
|
|
17820
|
+
block: CoreBlockInputSchema.partial()
|
|
17821
|
+
}), z.object({ block: CoreBlockSchema }), {
|
|
17822
|
+
kind: "mutation",
|
|
17823
|
+
auth: "admin",
|
|
17824
|
+
caller: "required"
|
|
17825
|
+
}),
|
|
17826
|
+
delete: method(z.object({ blockId: z.string() }), z.object({ success: z.literal(true) }), {
|
|
17827
|
+
kind: "mutation",
|
|
17828
|
+
auth: "admin"
|
|
17829
|
+
}),
|
|
17830
|
+
setEnabled: method(z.object({
|
|
17831
|
+
blockId: z.string(),
|
|
17832
|
+
enabled: z.boolean()
|
|
17833
|
+
}), z.object({ block: CoreBlockSchema }), {
|
|
17834
|
+
kind: "mutation",
|
|
17835
|
+
auth: "admin"
|
|
17836
|
+
}),
|
|
17837
|
+
/**
|
|
17838
|
+
* Type-check without saving — what the editor calls as the author types, so
|
|
17839
|
+
* the compiler's verdict is the same one the server will reach.
|
|
17840
|
+
*/
|
|
17841
|
+
compile: method(z.object({ code: z.string() }), CoreBlockCompileResultSchema, {
|
|
17842
|
+
kind: "mutation",
|
|
17843
|
+
auth: "admin"
|
|
17844
|
+
}),
|
|
17845
|
+
/**
|
|
17846
|
+
* The declaration files the editor type-checks against.
|
|
17847
|
+
*
|
|
17848
|
+
* Served rather than bundled: the graph is 3.4 MB across 344 files, and
|
|
17849
|
+
* bundling it would roughly double the admin remote. Served rather than
|
|
17850
|
+
* hand-stubbed: a block runs with the same `ctx` an addon gets, so a stub
|
|
17851
|
+
* would drift and the editor would confidently autocomplete methods that
|
|
17852
|
+
* do not exist.
|
|
17853
|
+
*/
|
|
17854
|
+
getTypeDefs: method(z.object({}), z.object({ libs: z.array(z.object({
|
|
17855
|
+
filePath: z.string(),
|
|
17856
|
+
content: z.string()
|
|
17857
|
+
})) }), { auth: "admin" })
|
|
17858
|
+
}
|
|
17859
|
+
};
|
|
17860
|
+
/**
|
|
17732
17861
|
* Zod schemas for persisted record types.
|
|
17733
17862
|
*
|
|
17734
17863
|
* These schemas serve as the single source of truth for types that are
|
|
@@ -24263,6 +24392,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
24263
24392
|
consumablesCapability,
|
|
24264
24393
|
contactCapability,
|
|
24265
24394
|
controlCapability,
|
|
24395
|
+
coreBlocksCapability,
|
|
24266
24396
|
coverCapability,
|
|
24267
24397
|
customModelRegistryCapability,
|
|
24268
24398
|
dataStoreProviderCapability,
|
|
@@ -25235,6 +25365,54 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
25235
25365
|
addonId: null,
|
|
25236
25366
|
access: "create"
|
|
25237
25367
|
},
|
|
25368
|
+
"coreBlocks.compile": {
|
|
25369
|
+
capName: "core-blocks",
|
|
25370
|
+
capScope: "system",
|
|
25371
|
+
addonId: null,
|
|
25372
|
+
access: "create"
|
|
25373
|
+
},
|
|
25374
|
+
"coreBlocks.create": {
|
|
25375
|
+
capName: "core-blocks",
|
|
25376
|
+
capScope: "system",
|
|
25377
|
+
addonId: null,
|
|
25378
|
+
access: "create"
|
|
25379
|
+
},
|
|
25380
|
+
"coreBlocks.delete": {
|
|
25381
|
+
capName: "core-blocks",
|
|
25382
|
+
capScope: "system",
|
|
25383
|
+
addonId: null,
|
|
25384
|
+
access: "delete"
|
|
25385
|
+
},
|
|
25386
|
+
"coreBlocks.get": {
|
|
25387
|
+
capName: "core-blocks",
|
|
25388
|
+
capScope: "system",
|
|
25389
|
+
addonId: null,
|
|
25390
|
+
access: "view"
|
|
25391
|
+
},
|
|
25392
|
+
"coreBlocks.getTypeDefs": {
|
|
25393
|
+
capName: "core-blocks",
|
|
25394
|
+
capScope: "system",
|
|
25395
|
+
addonId: null,
|
|
25396
|
+
access: "view"
|
|
25397
|
+
},
|
|
25398
|
+
"coreBlocks.list": {
|
|
25399
|
+
capName: "core-blocks",
|
|
25400
|
+
capScope: "system",
|
|
25401
|
+
addonId: null,
|
|
25402
|
+
access: "view"
|
|
25403
|
+
},
|
|
25404
|
+
"coreBlocks.setEnabled": {
|
|
25405
|
+
capName: "core-blocks",
|
|
25406
|
+
capScope: "system",
|
|
25407
|
+
addonId: null,
|
|
25408
|
+
access: "create"
|
|
25409
|
+
},
|
|
25410
|
+
"coreBlocks.update": {
|
|
25411
|
+
capName: "core-blocks",
|
|
25412
|
+
capScope: "system",
|
|
25413
|
+
addonId: null,
|
|
25414
|
+
access: "create"
|
|
25415
|
+
},
|
|
25238
25416
|
"cover.close": {
|
|
25239
25417
|
capName: "cover",
|
|
25240
25418
|
capScope: "device",
|
|
@@ -29637,4 +29815,4 @@ function enumerateInferenceDevices(hw) {
|
|
|
29637
29815
|
return out;
|
|
29638
29816
|
}
|
|
29639
29817
|
//#endregion
|
|
29640
|
-
export {
|
|
29818
|
+
export { settingsStoreCapability as $, enumerateSchemaFields as A, readinessKey as At, lifecycleJobSchema as B, dataStoreProviderCapability as C, emitReadiness as Ct, doorbellCapability as D, nodePin as Dt, deviceStatusCapability as E, isDeviceConfigCap as Et, isArrayOutputSchema as F, metricsProviderCapability as G, logDestinationCapability as H, isCollectionArrayMethod as I, parseStreamParamsFormPatch as J, normalizeUnit as K, isObjectInput as L, extractNestedAddonId as M, scopeKey as Mt, filesystemBrowseCapability as N, sleep as Nt, enumerateInferenceDevices as O, parseJsonObject as Ot, getByPath as P, EventCategory as Pt, setByPath as Q, isVoidInput as R, coreBlocksCapability as S, emitDownForOwnedCaps as St, deviceStateCapability as T, hydrateSchema as Tt, logLevelAtMost as U, localNetworkCapability as V, looseSchema as W, procedureAuthKey as X, platformProbeCapability as Y, scoreRuntimes as Z, alertsCapability as _, WELL_KNOWN_TAB_MAP as _t, CAP_NAMES_WITH_STATUS as a, userManagementCapability as at, backupCapability as b, asString as bt, METHOD_ACCESS_MAP as c, BaseAddon as ct, ScopedTokenSchema as d, DEVICE_STATUS_METHOD as dt, snapshotCapability as et, StorageLocationTypeSchema as f, DeviceFeature as ft, addonWidgetsCapability as g, ReadinessTimeoutError as gt, addonSettingsCapability as h, ReadinessRegistry as ht, BatteryStatusSchema as i, toExpressionValue as it, evaluateLinkExpression as j, resolveCapMount as jt, enumerateItemArrayFields as k, parseJsonUnknown as kt, RUNTIME_DEFAULTS as l, DATAPLANE_SECRET_HEADER as lt, addonPagesCapability as m, DeviceType as mt, AlertSchema as n, storageProviderCapability as nt, CoreBlockSchema as o, validateExpressionSource as ot, UserRecordSchema as p, DeviceRole as pt, objectInputDeclaresAddonId as q, ApiKeyRecordSchema as r, streamQualityLabel as rt, DeviceStatusSchema as s, errMsg as st, ALL_CAPABILITY_DEFINITIONS as t, storageCapability as tt, STREAM_PROFILE_META as u, DEVICE_SETTINGS_CONTRIBUTION_METHODS as ut, applyTransform as v, asJsonObject as vt, deviceManagerCapability as w, expandCapMethods as wt, buildStreamParamsConfigSchema as x, createEvent as xt, authProviderCapability as y, asNumber as yt, kebabToCamel as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export { AlertCenterAddon } from './builtins/alerts/index.js';
|
|
|
50
50
|
export { LivenessMonitorAddon } from './builtins/liveness-monitor/index.js';
|
|
51
51
|
export { NativeMetricsProvider } from './builtins/native-metrics/native-metrics-provider.js';
|
|
52
52
|
export { SystemConfigAddon } from './builtins/system-config/index.js';
|
|
53
|
+
export { CoreBlocksAddon } from './builtins/core-blocks/index.js';
|
|
53
54
|
export { LocalAuthAddon } from './builtins/local-auth/index.js';
|
|
54
55
|
export { DeviceManagerAddon } from './builtins/device-manager/index.js';
|
|
55
56
|
export { LifecycleStateMachine } from './lifecycle/lifecycle-state-machine.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("./dist-
|
|
3
|
+
const require_dist = require("./dist-CFinlH7b.js");
|
|
4
4
|
const require_model_download_service = require("./model-download-service-hf0ookyy.js");
|
|
5
5
|
const require_manifest_python_deps = require("./manifest-python-deps-BqE5j0-O.js");
|
|
6
6
|
const require_resource_monitor = require("./resource-monitor-DNNomR-i.js");
|
|
@@ -21,6 +21,8 @@ const require_builtins_liveness_monitor_liveness_monitor_addon = require("./buil
|
|
|
21
21
|
require("./builtins/liveness-monitor/index.js");
|
|
22
22
|
const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
|
|
23
23
|
require("./builtins/system-config/index.js");
|
|
24
|
+
const require_builtins_core_blocks_core_blocks_addon = require("./builtins/core-blocks/core-blocks.addon.js");
|
|
25
|
+
require("./builtins/core-blocks/index.js");
|
|
24
26
|
const require_builtins_local_auth_local_auth_addon = require("./builtins/local-auth/local-auth.addon.js");
|
|
25
27
|
require("./builtins/local-auth/index.js");
|
|
26
28
|
const require_builtins_device_manager_device_manager_addon = require("./builtins/device-manager/device-manager.addon.js");
|
|
@@ -2287,7 +2289,7 @@ var INTEGRATIONS = "integrations";
|
|
|
2287
2289
|
var INTEGRATION_SETTINGS = "integration_settings";
|
|
2288
2290
|
var DEVICES = "devices";
|
|
2289
2291
|
var DEVICE_SETTINGS = "device_settings_kv";
|
|
2290
|
-
var IntegrationRegistry = class {
|
|
2292
|
+
var IntegrationRegistry = class IntegrationRegistry {
|
|
2291
2293
|
store;
|
|
2292
2294
|
constructor(backend) {
|
|
2293
2295
|
this.store = backend;
|
|
@@ -2409,7 +2411,19 @@ var IntegrationRegistry = class {
|
|
|
2409
2411
|
});
|
|
2410
2412
|
return this.getIntegration(id);
|
|
2411
2413
|
}
|
|
2414
|
+
/**
|
|
2415
|
+
* A FIXED integration exists because an addon declares it, not because an
|
|
2416
|
+
* operator added it — the Notification Center's alarm panel is the first.
|
|
2417
|
+
* There is no add or delete flow for one, and this is where that is true
|
|
2418
|
+
* rather than merely hidden: a UI that only omits the button still leaves the
|
|
2419
|
+
* mutation one API call away.
|
|
2420
|
+
*/
|
|
2421
|
+
static isFixed(integration) {
|
|
2422
|
+
return integration.info["fixed"] === true;
|
|
2423
|
+
}
|
|
2412
2424
|
async deleteIntegration(id) {
|
|
2425
|
+
const integration = await this.getIntegration(id);
|
|
2426
|
+
if (integration !== null && IntegrationRegistry.isFixed(integration)) throw new Error(`integration "${id}" is fixed — it belongs to the addon that declared it and cannot be deleted`);
|
|
2413
2427
|
const devices = await this.listDevices(id);
|
|
2414
2428
|
for (const d of devices) await this.store.deleteWhere({
|
|
2415
2429
|
collection: DEVICE_SETTINGS,
|
|
@@ -94384,6 +94398,7 @@ exports.ConfigManager = ConfigManager;
|
|
|
94384
94398
|
exports.ConfigStore = require_builtins_sqlite_storage_index.ConfigStore$1;
|
|
94385
94399
|
exports.ConsoleDestination = require_builtins_console_logging_index.ConsoleDestination$1;
|
|
94386
94400
|
exports.ConsoleLoggingAddon = require_builtins_console_logging_index.ConsoleLoggingAddon$1;
|
|
94401
|
+
exports.CoreBlocksAddon = require_builtins_core_blocks_core_blocks_addon.CoreBlocksAddon;
|
|
94387
94402
|
exports.CustomActionRegistry = require_custom_action_registry.CustomActionRegistry;
|
|
94388
94403
|
exports.DEFAULT_DATA_PATH = DEFAULT_DATA_PATH;
|
|
94389
94404
|
exports.DEVICE_SETTINGS_CONTRIBUTION_METHODS = require_dist.DEVICE_SETTINGS_CONTRIBUTION_METHODS;
|