@camstack/types 1.2.27 → 1.2.29

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/index.js CHANGED
@@ -14972,6 +14972,16 @@ function createSystemProxy(api) {
14972
14972
  getState: (input) => dispatch("broker", "getState", "query", input),
14973
14973
  getStatus: (input) => dispatch("broker", "getStatus", "query", input)
14974
14974
  },
14975
+ coreBlocks: {
14976
+ list: (input) => dispatch("coreBlocks", "list", "query", input),
14977
+ get: (input) => dispatch("coreBlocks", "get", "query", input),
14978
+ create: (input) => dispatch("coreBlocks", "create", "mutation", input),
14979
+ update: (input) => dispatch("coreBlocks", "update", "mutation", input),
14980
+ delete: (input) => dispatch("coreBlocks", "delete", "mutation", input),
14981
+ setEnabled: (input) => dispatch("coreBlocks", "setEnabled", "mutation", input),
14982
+ compile: (input) => dispatch("coreBlocks", "compile", "mutation", input),
14983
+ getTypeDefs: (input) => dispatch("coreBlocks", "getTypeDefs", "query", input)
14984
+ },
14975
14985
  decoder: {
14976
14986
  supportsCodec: (input) => dispatch("decoder", "supportsCodec", "query", input),
14977
14987
  getInfo: (input) => dispatch("decoder", "getInfo", "query", input),
@@ -19045,8 +19055,30 @@ var deviceManagerCapability = {
19045
19055
  }),
19046
19056
  /** List persisted devices for an addon (DB, for restore). */
19047
19057
  listPersistedByAddon: require_sleep.method(zod.z.object({ addonId: zod.z.string() }), zod.z.array(SavedDeviceRowSchema)),
19048
- /** List all devices (live registry), optionally filtered by addonId. */
19049
- listAll: require_sleep.method(zod.z.object({ addonId: zod.z.string().optional() }), zod.z.array(DeviceInfoSchema)),
19058
+ /**
19059
+ * List all devices (live registry), optionally filtered by addonId.
19060
+ *
19061
+ * **Ask for `projection: 'slim'` unless you need `config`.** A full listing
19062
+ * of 293 devices measured 271 KB, of which `config` was 113 KB and
19063
+ * `metadata` 22 KB — half the payload — and the viewer's camera list, the
19064
+ * largest consumer, reads 1.8 KB of it. Worse, the persisted branch reads
19065
+ * each device's settings row one at a time, so `config` costs a
19066
+ * per-device round-trip as well as its bytes.
19067
+ */
19068
+ listAll: require_sleep.method(zod.z.object({
19069
+ addonId: zod.z.string().optional(),
19070
+ /**
19071
+ * `slim` omits `config` (returned `{}`), `metadata` (null) and the
19072
+ * `sourceInfo` derived from config — and skips the per-device settings
19073
+ * read that produces them. Everything identifying a device (id, name,
19074
+ * type, online, features, isCamera, parent/link ids) is unchanged.
19075
+ * Do not use it for dispatch routing, which needs `sourceInfo`.
19076
+ */
19077
+ projection: zod.z.enum(["full", "slim"]).optional(),
19078
+ /** Return only camera devices. Filtering server-side instead of
19079
+ * shipping 293 rows to find 12. */
19080
+ isCamera: zod.z.boolean().optional()
19081
+ }), zod.z.array(DeviceInfoSchema)),
19050
19082
  /** Get a single device by numeric deviceId. */
19051
19083
  getDevice: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), DeviceInfoSchema.nullable()),
19052
19084
  /** List children of a parent device (by parent numeric id). */
@@ -20792,6 +20824,137 @@ var notificationOutputCapability = {
20792
20824
  }
20793
20825
  };
20794
20826
  //#endregion
20827
+ //#region src/capabilities/core-blocks.cap.ts
20828
+ /**
20829
+ * core-blocks — user-authored TypeScript, stored in the kernel and executed in
20830
+ * its own process.
20831
+ *
20832
+ * Spec: `docs/superpowers/specs/2026-08-04-core-blocks-and-synthetic-devices-design.md`.
20833
+ *
20834
+ * The first use is **owning devices without being a device provider**: a block
20835
+ * declares devices under a system or custom integration and drives their state,
20836
+ * with the same `ctx` an addon gets. Automations come later; nothing here
20837
+ * models a trigger.
20838
+ *
20839
+ * **Stated plainly, because it does not change by being true:** a block has an
20840
+ * addon's powers — devices, storage, the event bus, `ctx.api`. It is a plugin
20841
+ * with no review step. What makes that survivable is not a sandbox, it is
20842
+ * PROCESS ISOLATION: one process per block, supervised by `CrashSupervisor`,
20843
+ * so a block that throws or never returns is marked `failed` and visible
20844
+ * instead of taking the hub with it (D6). Every method here is admin-only, and
20845
+ * must stay so.
20846
+ */
20847
+ /** Where a block runs. The operator chooses — a block driving a device on an
20848
+ * agent is the reason placement is not fixed to the hub. */
20849
+ var CoreBlockPlacementSchema = zod.z.union([zod.z.literal("hub"), zod.z.string().min(1)]);
20850
+ /** What a block's process is doing. Mirrors the addon runner's own lifecycle so
20851
+ * a failing block reads the same way a failing addon does. */
20852
+ var CoreBlockStatusSchema = zod.z.enum([
20853
+ "stopped",
20854
+ "starting",
20855
+ "running",
20856
+ "failed"
20857
+ ]);
20858
+ /** Client-authored fields. */
20859
+ var CoreBlockInputSchema = zod.z.object({
20860
+ name: zod.z.string().min(1).max(120),
20861
+ /** TypeScript source. Compiled server-side before it is ever stored — a
20862
+ * block that does not compile is a fork failure the operator would meet
20863
+ * minutes later, in a log, instead of in the editor. */
20864
+ code: zod.z.string().max(2e5),
20865
+ enabled: zod.z.boolean(),
20866
+ placement: CoreBlockPlacementSchema,
20867
+ /**
20868
+ * Integration the block's devices hang from. Absent = the system integration
20869
+ * blocks share. A block may declare its own instead.
20870
+ */
20871
+ integrationId: zod.z.string().optional()
20872
+ });
20873
+ /** A stored block. */
20874
+ var CoreBlockSchema = CoreBlockInputSchema.extend({
20875
+ id: zod.z.string(),
20876
+ createdAt: zod.z.number(),
20877
+ updatedAt: zod.z.number(),
20878
+ /** Server-stamped author. */
20879
+ createdBy: zod.z.string(),
20880
+ status: CoreBlockStatusSchema,
20881
+ /**
20882
+ * Why the block is not running, when it is not. The operator's ONLY window
20883
+ * into a block that failed at load — a block that is silently absent is the
20884
+ * failure mode this whole feature has to avoid.
20885
+ */
20886
+ lastError: zod.z.string().optional(),
20887
+ /** Ms epoch of the last state change. */
20888
+ lastChangedAt: zod.z.number()
20889
+ });
20890
+ /** What a compile attempt produced. */
20891
+ var CoreBlockCompileResultSchema = zod.z.object({
20892
+ ok: zod.z.boolean(),
20893
+ /** Present when `ok` is false — the first error, in the author's words. */
20894
+ error: zod.z.string().optional(),
20895
+ line: zod.z.number().optional(),
20896
+ column: zod.z.number().optional()
20897
+ });
20898
+ var coreBlocksCapability = {
20899
+ name: "core-blocks",
20900
+ scope: "system",
20901
+ mode: "singleton",
20902
+ methods: {
20903
+ list: require_sleep.method(zod.z.object({}), zod.z.object({ blocks: zod.z.array(CoreBlockSchema) }), { auth: "admin" }),
20904
+ get: require_sleep.method(zod.z.object({ blockId: zod.z.string() }), zod.z.object({ block: CoreBlockSchema.nullable() }), { auth: "admin" }),
20905
+ /**
20906
+ * Create a block. The code is COMPILED first: storing source that does not
20907
+ * compile turns an editor error into a fork failure the operator meets
20908
+ * minutes later in a log.
20909
+ */
20910
+ create: require_sleep.method(zod.z.object({ block: CoreBlockInputSchema }), zod.z.object({ block: CoreBlockSchema }), {
20911
+ kind: "mutation",
20912
+ auth: "admin",
20913
+ caller: "required"
20914
+ }),
20915
+ update: require_sleep.method(zod.z.object({
20916
+ blockId: zod.z.string(),
20917
+ block: CoreBlockInputSchema.partial()
20918
+ }), zod.z.object({ block: CoreBlockSchema }), {
20919
+ kind: "mutation",
20920
+ auth: "admin",
20921
+ caller: "required"
20922
+ }),
20923
+ delete: require_sleep.method(zod.z.object({ blockId: zod.z.string() }), zod.z.object({ success: zod.z.literal(true) }), {
20924
+ kind: "mutation",
20925
+ auth: "admin"
20926
+ }),
20927
+ setEnabled: require_sleep.method(zod.z.object({
20928
+ blockId: zod.z.string(),
20929
+ enabled: zod.z.boolean()
20930
+ }), zod.z.object({ block: CoreBlockSchema }), {
20931
+ kind: "mutation",
20932
+ auth: "admin"
20933
+ }),
20934
+ /**
20935
+ * Type-check without saving — what the editor calls as the author types, so
20936
+ * the compiler's verdict is the same one the server will reach.
20937
+ */
20938
+ compile: require_sleep.method(zod.z.object({ code: zod.z.string() }), CoreBlockCompileResultSchema, {
20939
+ kind: "mutation",
20940
+ auth: "admin"
20941
+ }),
20942
+ /**
20943
+ * The declaration files the editor type-checks against.
20944
+ *
20945
+ * Served rather than bundled: the graph is 3.4 MB across 344 files, and
20946
+ * bundling it would roughly double the admin remote. Served rather than
20947
+ * hand-stubbed: a block runs with the same `ctx` an addon gets, so a stub
20948
+ * would drift and the editor would confidently autocomplete methods that
20949
+ * do not exist.
20950
+ */
20951
+ getTypeDefs: require_sleep.method(zod.z.object({}), zod.z.object({ libs: zod.z.array(zod.z.object({
20952
+ filePath: zod.z.string(),
20953
+ content: zod.z.string()
20954
+ })) }), { auth: "admin" })
20955
+ }
20956
+ };
20957
+ //#endregion
20795
20958
  //#region src/schemas/auth-records.ts
20796
20959
  /**
20797
20960
  * Zod schemas for persisted record types.
@@ -27460,6 +27623,7 @@ var CAPABILITY_NAMES = {
27460
27623
  consumables: "consumables",
27461
27624
  contact: "contact",
27462
27625
  control: "control",
27626
+ coreBlocks: "core-blocks",
27463
27627
  cover: "cover",
27464
27628
  customModelRegistry: "custom-model-registry",
27465
27629
  dataStoreProvider: "data-store-provider",
@@ -27712,6 +27876,10 @@ var CAPABILITY_ROUTER_KEYS = [
27712
27876
  key: "control",
27713
27877
  name: "control"
27714
27878
  },
27879
+ {
27880
+ key: "coreBlocks",
27881
+ name: "core-blocks"
27882
+ },
27715
27883
  {
27716
27884
  key: "cover",
27717
27885
  name: "cover"
@@ -28194,6 +28362,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
28194
28362
  consumablesCapability,
28195
28363
  contactCapability,
28196
28364
  controlCapability,
28365
+ coreBlocksCapability,
28197
28366
  coverCapability,
28198
28367
  customModelRegistryCapability,
28199
28368
  dataStoreProviderCapability,
@@ -29170,6 +29339,54 @@ var METHOD_ACCESS_MAP = Object.freeze({
29170
29339
  addonId: null,
29171
29340
  access: "create"
29172
29341
  },
29342
+ "coreBlocks.compile": {
29343
+ capName: "core-blocks",
29344
+ capScope: "system",
29345
+ addonId: null,
29346
+ access: "create"
29347
+ },
29348
+ "coreBlocks.create": {
29349
+ capName: "core-blocks",
29350
+ capScope: "system",
29351
+ addonId: null,
29352
+ access: "create"
29353
+ },
29354
+ "coreBlocks.delete": {
29355
+ capName: "core-blocks",
29356
+ capScope: "system",
29357
+ addonId: null,
29358
+ access: "delete"
29359
+ },
29360
+ "coreBlocks.get": {
29361
+ capName: "core-blocks",
29362
+ capScope: "system",
29363
+ addonId: null,
29364
+ access: "view"
29365
+ },
29366
+ "coreBlocks.getTypeDefs": {
29367
+ capName: "core-blocks",
29368
+ capScope: "system",
29369
+ addonId: null,
29370
+ access: "view"
29371
+ },
29372
+ "coreBlocks.list": {
29373
+ capName: "core-blocks",
29374
+ capScope: "system",
29375
+ addonId: null,
29376
+ access: "view"
29377
+ },
29378
+ "coreBlocks.setEnabled": {
29379
+ capName: "core-blocks",
29380
+ capScope: "system",
29381
+ addonId: null,
29382
+ access: "create"
29383
+ },
29384
+ "coreBlocks.update": {
29385
+ capName: "core-blocks",
29386
+ capScope: "system",
29387
+ addonId: null,
29388
+ access: "create"
29389
+ },
29173
29390
  "cover.close": {
29174
29391
  capName: "cover",
29175
29392
  capScope: "device",
@@ -33479,6 +33696,7 @@ var KNOWN_CAP_NAMES = [
33479
33696
  "color",
33480
33697
  "consumables",
33481
33698
  "control",
33699
+ "core-blocks",
33482
33700
  "cover",
33483
33701
  "custom-model-registry",
33484
33702
  "data-store-provider",
@@ -33643,6 +33861,7 @@ var SYSTEM_CAP_NAMES = [
33643
33861
  "auth-provider",
33644
33862
  "backup",
33645
33863
  "broker",
33864
+ "core-blocks",
33646
33865
  "custom-model-registry",
33647
33866
  "data-store-provider",
33648
33867
  "decoder",
@@ -34440,6 +34659,11 @@ exports.ControlStatusSchema = ControlStatusSchema;
34440
34659
  exports.ConvertArtifactSchema = ConvertArtifactSchema;
34441
34660
  exports.ConvertResultSchema = ConvertResultSchema;
34442
34661
  exports.ConvertTargetSchema = ConvertTargetSchema;
34662
+ exports.CoreBlockCompileResultSchema = CoreBlockCompileResultSchema;
34663
+ exports.CoreBlockInputSchema = CoreBlockInputSchema;
34664
+ exports.CoreBlockPlacementSchema = CoreBlockPlacementSchema;
34665
+ exports.CoreBlockSchema = CoreBlockSchema;
34666
+ exports.CoreBlockStatusSchema = CoreBlockStatusSchema;
34443
34667
  exports.CoverStateSchema = CoverStateSchema;
34444
34668
  exports.CoverStatusSchema = CoverStatusSchema;
34445
34669
  exports.CreateApiKeyInputSchema = CreateApiKeyInputSchema;
@@ -35024,6 +35248,7 @@ exports.consumablesCapability = consumablesCapability;
35024
35248
  exports.contactCapability = contactCapability;
35025
35249
  exports.controlCapability = controlCapability;
35026
35250
  exports.convertUnit = convertUnit;
35251
+ exports.coreBlocksCapability = coreBlocksCapability;
35027
35252
  exports.cosineSimilarity = cosineSimilarity;
35028
35253
  exports.coverCapability = coverCapability;
35029
35254
  exports.createDeviceProxy = require_sleep.createDeviceProxy;