@camstack/addon-export-alexa 1.2.145 → 1.2.146

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.
@@ -34,7 +34,7 @@ let node_path = require("node:path");
34
34
  node_path = __toESM(node_path, 1);
35
35
  require("node:child_process");
36
36
  require("node:zlib");
37
- //#region ../types/dist/event-category-C4hVnRo8.mjs
37
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
38
38
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
39
39
  EventCategory["SystemBoot"] = "system.boot";
40
40
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -98,6 +98,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
98
98
  * consumes this category and maps it to the `addon-crash-loop` kind.
99
99
  */
100
100
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
101
+ /**
102
+ * A runner whose addon refused to start with a typed reason (D877) - parked
103
+ * in `refused`, never counted by the crash breaker, retried on operator
104
+ * action. One event per refusal.
105
+ */
106
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
107
+ /**
108
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
109
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
110
+ * runner is still pending) and the alert centre (close a recovered runner).
111
+ */
112
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
113
+ /**
114
+ * The node's one-shot runner boot check (D877): planned runners against the
115
+ * process service, `degraded` when any is failed, refused or missing. The
116
+ * alert centre turns it into one alert and a direct critical push.
117
+ */
118
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
101
119
  EventCategory["AddonError"] = "addon.error";
102
120
  EventCategory["AddonPageReady"] = "addon.page-ready";
103
121
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -5422,7 +5440,7 @@ var ZodIssueCode = {
5422
5440
  var ZodFirstPartyTypeKind;
5423
5441
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5424
5442
  //#endregion
5425
- //#region ../types/dist/sleep-bwsTj221.mjs
5443
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5426
5444
  /**
5427
5445
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5428
5446
  * window to float samples (D455).
@@ -5539,7 +5557,7 @@ function isKeychainStoredField(field) {
5539
5557
  var SECRET_CLEAR = { $secretClear: true };
5540
5558
  /** The `'***'` token D634 redaction writes for non-admins. */
5541
5559
  var LEGACY_DEVICE_REDACTION = "***";
5542
- function isRecord$2(value) {
5560
+ function isRecord$5(value) {
5543
5561
  return typeof value === "object" && value !== null && !Array.isArray(value);
5544
5562
  }
5545
5563
  function makeSecretMarker(ref) {
@@ -5550,12 +5568,12 @@ function makeSecretMarker(ref) {
5550
5568
  }
5551
5569
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5552
5570
  function isSecretMarker(value) {
5553
- if (!isRecord$2(value)) return false;
5571
+ if (!isRecord$5(value)) return false;
5554
5572
  const ref = value["$secret"];
5555
5573
  return typeof ref === "string" && ref.length > 0;
5556
5574
  }
5557
5575
  function isSecretClear(value) {
5558
- return isRecord$2(value) && value["$secretClear"] === true;
5576
+ return isRecord$5(value) && value["$secretClear"] === true;
5559
5577
  }
5560
5578
  /**
5561
5579
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6165,7 +6183,7 @@ var KeychainWriteRefusedError = class extends Error {
6165
6183
  }
6166
6184
  };
6167
6185
  var KEEP = { kind: "keep" };
6168
- function isRecord$1(value) {
6186
+ function isRecord$4(value) {
6169
6187
  return typeof value === "object" && value !== null && !Array.isArray(value);
6170
6188
  }
6171
6189
  function defaultMintId() {
@@ -6178,7 +6196,7 @@ function collectSecretMarkerRefs(value, out = []) {
6178
6196
  return out;
6179
6197
  }
6180
6198
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6181
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6199
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6182
6200
  return out;
6183
6201
  }
6184
6202
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6233,7 +6251,7 @@ function rowId(row, idKey) {
6233
6251
  return null;
6234
6252
  }
6235
6253
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6236
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6254
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6237
6255
  if (!Array.isArray(incoming)) {
6238
6256
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6239
6257
  return {
@@ -6249,7 +6267,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6249
6267
  const kept = /* @__PURE__ */ new Set();
6250
6268
  const rows = [];
6251
6269
  for (const row of incoming) {
6252
- if (!isRecord$1(row)) {
6270
+ if (!isRecord$4(row)) {
6253
6271
  rows.push(row);
6254
6272
  continue;
6255
6273
  }
@@ -6274,7 +6292,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6274
6292
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6275
6293
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6276
6294
  case "object": {
6277
- if (!isRecord$1(incoming)) {
6295
+ if (!isRecord$4(incoming)) {
6278
6296
  if (incoming === void 0) return KEEP;
6279
6297
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6280
6298
  return {
@@ -6282,7 +6300,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6282
6300
  value: incoming
6283
6301
  };
6284
6302
  }
6285
- const storedObj = isRecord$1(stored) ? stored : {};
6303
+ const storedObj = isRecord$4(stored) ? stored : {};
6286
6304
  return {
6287
6305
  kind: "value",
6288
6306
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6405,7 +6423,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6405
6423
  value: items
6406
6424
  };
6407
6425
  }
6408
- if (isRecord$1(v)) {
6426
+ if (isRecord$4(v)) {
6409
6427
  const out = {};
6410
6428
  for (const [k, child] of Object.entries(v)) {
6411
6429
  const s = substitute(child);
@@ -7328,7 +7346,7 @@ var BaseAddon = class {
7328
7346
  if (!ctx) return;
7329
7347
  const addonId = ctx.id;
7330
7348
  setImmediate(() => {
7331
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7349
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7332
7350
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7333
7351
  }).catch((err) => {
7334
7352
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7822,6 +7840,89 @@ var PeerBytesTicketSchema = object({
7822
7840
  */
7823
7841
  declaredBytes: number().int().nonnegative().nullable()
7824
7842
  });
7843
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7844
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7845
+ var RECORD_DATABASES = ["settings", "events"];
7846
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7847
+ var RECORD_CLASSES = [
7848
+ "config",
7849
+ "ledger",
7850
+ "audit",
7851
+ "mirror",
7852
+ "ephemeral"
7853
+ ];
7854
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7855
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7856
+ var RECORD_BATCH_MAX = 1e3;
7857
+ var RECORD_QUERY_MAX = 1e3;
7858
+ /**
7859
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7860
+ * Zod row schema that describes it, and the helper that turns the two into the
7861
+ * JSON the engine stores.
7862
+ *
7863
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
7864
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
7865
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
7866
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
7867
+ * never a field name (D879).
7868
+ */
7869
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
7870
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
7871
+ var RecordIndexSchema = object({
7872
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
7873
+ fields: array(RecordFieldPathSchema).min(1).max(4),
7874
+ unique: boolean().optional()
7875
+ }).strict();
7876
+ var RecordRetentionSchema = union([
7877
+ object({
7878
+ ttlMs: number().int().positive(),
7879
+ from: _enum(["at", "write"])
7880
+ }).strict(),
7881
+ object({
7882
+ maxRows: number().int().positive().optional(),
7883
+ maxRowsPerDevice: number().int().positive().optional()
7884
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
7885
+ object({
7886
+ owner: string().min(1),
7887
+ reason: string().min(1)
7888
+ }).strict(),
7889
+ object({ none: string().min(1) }).strict()
7890
+ ]);
7891
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
7892
+ var EntryDescriptorSchema = object({
7893
+ title: string().min(1),
7894
+ /** The record body field shown as the entry's name. */
7895
+ nameField: string().min(1),
7896
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
7897
+ fields: record(string(), unknown())
7898
+ }).strict();
7899
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
7900
+ var RecordKindDeclarationSchema = object({
7901
+ database: _enum(RECORD_DATABASES).default("settings"),
7902
+ class: _enum(RECORD_CLASSES),
7903
+ writeTrigger: string().min(1),
7904
+ device: _enum([
7905
+ "required",
7906
+ "optional",
7907
+ "none"
7908
+ ]).default("none"),
7909
+ at: _enum(["required", "none"]).default("none"),
7910
+ indexes: array(RecordIndexSchema).max(8).default([]),
7911
+ retention: RecordRetentionSchema,
7912
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
7913
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
7914
+ /** Derived from the Zod schema; never written by hand. */
7915
+ secretPaths: array(string().min(1)).default([]),
7916
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
7917
+ secretArrayKeys: record(string(), string()).default({}),
7918
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
7919
+ adoptsFrom: string().min(1).optional(),
7920
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
7921
+ transactFamily: string().min(1).optional(),
7922
+ entry: EntryDescriptorSchema.optional()
7923
+ }).strict();
7924
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
7925
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
7825
7926
  /** Shared Zod schemas used across streaming capabilities. */
7826
7927
  var CamProfileSchema = _enum([
7827
7928
  "high",
@@ -15775,6 +15876,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15775
15876
  keyField: string()
15776
15877
  }).optional()
15777
15878
  })) });
15879
+ /**
15880
+ * The report of a one-shot "move this owner's plaintext secrets into the
15881
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
15882
+ *
15883
+ * The owner runs it on its own rows, through its own write path; an operator
15884
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
15885
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
15886
+ */
15887
+ var RawSecretMigrationInputSchema = object({
15888
+ /** `false` (the default of the script) = report only. */
15889
+ apply: boolean() });
15890
+ var RawSecretMigrationReportSchema = object({
15891
+ apply: boolean(),
15892
+ /** Rows that can carry a secret (a profile, an enrolment). */
15893
+ rows: number().int(),
15894
+ /** Rows whose secret was plaintext when the run started. */
15895
+ raw: number().int(),
15896
+ /** Rows that already held a keychain marker when the run started. */
15897
+ markers: number().int(),
15898
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15899
+ migrated: number().int(),
15900
+ /** Plaintext rows left in place because the move or its read-back failed. */
15901
+ failed: number().int(),
15902
+ /** After the run: rows still holding plaintext. */
15903
+ remainingRaw: number().int(),
15904
+ /** After the run: markers the keychain could not resolve right now. */
15905
+ unresolvedMarkers: number().int(),
15906
+ /**
15907
+ * A second, redundant copy of the secrets' rows that the run found (and, on
15908
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
15909
+ */
15910
+ redundantCopies: number().int().optional(),
15911
+ /** True when nothing is raw and every marker resolves. */
15912
+ verified: boolean()
15913
+ });
15778
15914
  /** Where a block runs. The operator chooses — a block driving a device on an
15779
15915
  * agent is the reason placement is not fixed to the hub. */
15780
15916
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -16001,6 +16137,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
16001
16137
  }), SettingsUpdateResultSchema, {
16002
16138
  kind: "mutation",
16003
16139
  auth: "admin"
16140
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16141
+ kind: "mutation",
16142
+ auth: "admin"
16004
16143
  }), method(object({}), object({ libs: array(object({
16005
16144
  filePath: string(),
16006
16145
  content: string()
@@ -16263,6 +16402,222 @@ id: union([string(), number()]) }), {
16263
16402
  kind: "mutation",
16264
16403
  auth: "admin"
16265
16404
  });
16405
+ /**
16406
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16407
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16408
+ * (operator intent, D870) and device-history (numbers over time, D850).
16409
+ *
16410
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16411
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16412
+ * that with the addon id closed over). It is deliberately NOT in any input
16413
+ * schema, so a session can never supply it, and a call with no stamp is refused
16414
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16415
+ * addons go through the owner's capability.
16416
+ *
16417
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16418
+ * never `[]`. Secret fields are never on the wire: a read shows the
16419
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16420
+ * resolves itself, and a write may carry only a keychain marker bound to the
16421
+ * row's own ref.
16422
+ *
16423
+ * Internal: addons reach it through `ctx.records`, never directly.
16424
+ */
16425
+ var RecordIdSchema = string().min(1).max(256);
16426
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16427
+ var RecordBodySchema = record(string(), unknown());
16428
+ var RecordInputSchema = object({
16429
+ id: RecordIdSchema,
16430
+ /** The device this row belongs to (D865 removal, per-device reads). */
16431
+ deviceId: number().int().optional(),
16432
+ /** The domain clock, ms: observed / created / opened. */
16433
+ at: number().int().optional(),
16434
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16435
+ expiresAt: number().int().optional(),
16436
+ data: RecordBodySchema
16437
+ });
16438
+ var RecordViewSchema = object({
16439
+ id: string(),
16440
+ deviceId: number().int().nullable(),
16441
+ at: number().nullable(),
16442
+ expiresAt: number().nullable(),
16443
+ rev: number().int(),
16444
+ updatedAt: number(),
16445
+ data: RecordBodySchema
16446
+ });
16447
+ /** Declared index fields only. Anything else does not compile, by design. */
16448
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16449
+ string(),
16450
+ number(),
16451
+ boolean(),
16452
+ object({ in: array(union([
16453
+ string(),
16454
+ number(),
16455
+ boolean()
16456
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16457
+ object({
16458
+ gt: union([string(), number()]).optional(),
16459
+ gte: union([string(), number()]).optional(),
16460
+ lt: union([string(), number()]).optional(),
16461
+ lte: union([string(), number()]).optional()
16462
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16463
+ ]));
16464
+ var KindShape = { kind: RecordKindNameSchema };
16465
+ var TimeWindowShape = {
16466
+ deviceId: number().int().optional(),
16467
+ atFrom: number().optional(),
16468
+ atTo: number().optional()
16469
+ };
16470
+ var RecordQueryInputSchema = object({
16471
+ ...KindShape,
16472
+ ...TimeWindowShape,
16473
+ where: RecordWhereSchema.optional(),
16474
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16475
+ order: _enum(["at", "id"]).optional(),
16476
+ desc: boolean().optional(),
16477
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16478
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16479
+ cursor: string().min(1).optional()
16480
+ });
16481
+ var RecordQueryResultSchema = object({
16482
+ records: array(RecordViewSchema),
16483
+ nextCursor: string().nullable()
16484
+ });
16485
+ var RecordKindStateSchema = _enum([
16486
+ "created",
16487
+ "unchanged",
16488
+ "updated"
16489
+ ]);
16490
+ var DeclareKindResultSchema = object({
16491
+ kindId: number().int(),
16492
+ state: RecordKindStateSchema,
16493
+ createdIndexes: array(string()),
16494
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16495
+ adoptionPending: object({
16496
+ legacyTable: string(),
16497
+ legacyRows: number().int()
16498
+ }).nullable()
16499
+ });
16500
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16501
+ var SecretRefsList = array(string());
16502
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16503
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16504
+ kind: "mutation",
16505
+ auth: "admin"
16506
+ }), method(object({
16507
+ ...KindShape,
16508
+ id: RecordIdSchema
16509
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16510
+ ...KindShape,
16511
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16512
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16513
+ ...KindShape,
16514
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16515
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16516
+ ...KindShape,
16517
+ record: RecordInputSchema,
16518
+ /** Compare-and-set. `0` means "the row must not exist". */
16519
+ ifRev: number().int().min(0).optional()
16520
+ }), object({
16521
+ rev: number().int(),
16522
+ releasedRefs: SecretRefsList
16523
+ }), {
16524
+ kind: "mutation",
16525
+ auth: "admin"
16526
+ }), method(object({
16527
+ ...KindShape,
16528
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16529
+ }), object({
16530
+ count: number().int(),
16531
+ releasedRefs: SecretRefsList
16532
+ }), {
16533
+ kind: "mutation",
16534
+ auth: "admin"
16535
+ }), method(object({
16536
+ ...KindShape,
16537
+ id: RecordIdSchema,
16538
+ data: RecordBodySchema,
16539
+ at: number().int().nullable().optional(),
16540
+ expiresAt: number().int().nullable().optional(),
16541
+ ifRev: number().int().min(1).optional()
16542
+ }), object({
16543
+ rev: number().int(),
16544
+ releasedRefs: SecretRefsList
16545
+ }), {
16546
+ kind: "mutation",
16547
+ auth: "admin"
16548
+ }), method(object({
16549
+ ...KindShape,
16550
+ id: RecordIdSchema
16551
+ }), object({
16552
+ deleted: boolean(),
16553
+ secretRefs: SecretRefsList
16554
+ }), {
16555
+ kind: "mutation",
16556
+ auth: "admin"
16557
+ }), method(object({
16558
+ ...KindShape,
16559
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16560
+ }), object({
16561
+ deleted: number().int(),
16562
+ secretRefs: SecretRefsList
16563
+ }), {
16564
+ kind: "mutation",
16565
+ auth: "admin"
16566
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16567
+ ...KindShape,
16568
+ ...TimeWindowShape,
16569
+ where: RecordWhereSchema.optional()
16570
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16571
+ ...KindShape,
16572
+ deviceId: number().int().optional(),
16573
+ from: number(),
16574
+ to: number(),
16575
+ bucketMs: number().int().positive()
16576
+ }), object({ buckets: array(object({
16577
+ bucketStart: number(),
16578
+ count: number().int()
16579
+ })) }), { auth: "admin" }), method(object({
16580
+ ...KindShape,
16581
+ op: _enum([
16582
+ "sum",
16583
+ "min",
16584
+ "max",
16585
+ "count"
16586
+ ]),
16587
+ field: RecordFieldPathSchema.optional(),
16588
+ groupBy: RecordFieldPathSchema.optional(),
16589
+ where: RecordWhereSchema.optional()
16590
+ }), object({ rows: array(object({
16591
+ group: union([
16592
+ string(),
16593
+ number(),
16594
+ _null()
16595
+ ]),
16596
+ value: number().nullable()
16597
+ })) }), { auth: "admin" }), method(object({
16598
+ ...KindShape,
16599
+ deviceId: number().int().optional(),
16600
+ atBefore: number().optional(),
16601
+ where: RecordWhereSchema.optional()
16602
+ }), object({
16603
+ deleted: number().int(),
16604
+ secretRefs: SecretRefsList
16605
+ }), {
16606
+ kind: "mutation",
16607
+ auth: "admin"
16608
+ }), method(object({
16609
+ deviceId: number().int(),
16610
+ kinds: array(RecordKindNameSchema).optional()
16611
+ }), object({
16612
+ deleted: record(string(), number().int()),
16613
+ secretRefs: SecretRefsList
16614
+ }), {
16615
+ kind: "mutation",
16616
+ auth: "admin"
16617
+ }), method(object(KindShape), object({ id: number().int() }), {
16618
+ kind: "mutation",
16619
+ auth: "admin"
16620
+ });
16266
16621
  /** One table of the settings database. */
16267
16622
  var StorageTableSchema = object({
16268
16623
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -16275,6 +16630,28 @@ var StorageTableSchema = object({
16275
16630
  /** Declared by an addon since this engine process started (a running addon claims it). */
16276
16631
  declaredThisBoot: boolean()
16277
16632
  });
16633
+ /** One declared record kind (D881) as System -> Data shows it. */
16634
+ var StorageKindSchema = object({
16635
+ owner: string(),
16636
+ kind: string(),
16637
+ database: _enum(["settings", "events"]),
16638
+ class: string(),
16639
+ state: _enum([
16640
+ "declared",
16641
+ "orphaned",
16642
+ "dropped"
16643
+ ]),
16644
+ /** `null` when the caller asked for no counts (`counts: false`). */
16645
+ rows: number().int().nonnegative().nullable(),
16646
+ /** Rows x the average size of a sample; null for an empty kind. */
16647
+ bytesEstimate: number().int().nonnegative().nullable(),
16648
+ writeTrigger: string(),
16649
+ retention: RecordRetentionSchema,
16650
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16651
+ entry: boolean(),
16652
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16653
+ declaration: RecordKindDeclarationSchema
16654
+ });
16278
16655
  method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16279
16656
  collection: string().min(1),
16280
16657
  expectRows: number().int().nonnegative()
@@ -16284,6 +16661,87 @@ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: arr
16284
16661
  }), {
16285
16662
  kind: "mutation",
16286
16663
  auth: "admin"
16664
+ }), method(object({
16665
+ owner: string().min(1).optional(),
16666
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16667
+ counts: boolean().optional()
16668
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16669
+ owner: string().min(1),
16670
+ kind: RecordKindNameSchema
16671
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16672
+ owner: string().min(1),
16673
+ kind: RecordKindNameSchema,
16674
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16675
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16676
+ complete: boolean().optional()
16677
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16678
+ kind: "mutation",
16679
+ auth: "admin"
16680
+ }), method(object({
16681
+ collection: string().min(1),
16682
+ cursor: string().optional(),
16683
+ limit: number().int().min(1).max(1e3).optional()
16684
+ }), object({
16685
+ rows: array(object({
16686
+ id: string(),
16687
+ data: record(string(), unknown())
16688
+ })),
16689
+ nextCursor: string().nullable()
16690
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16691
+ /**
16692
+ * record-entries - the ONE admin surface for every list of user-created entries
16693
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16694
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16695
+ *
16696
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16697
+ * the entry body with `secret: true` on every credential field, so a password
16698
+ * field is derived from the schema and never from a name. `putEntry` takes the
16699
+ * redaction token for an untouched secret (the stored value is kept), a string
16700
+ * for a new one, and the clear instruction to remove one. A read never carries
16701
+ * a secret value, and a locked keychain refuses the write with
16702
+ * `records/secret-unavailable` instead of storing plaintext.
16703
+ *
16704
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16705
+ */
16706
+ var EntryKindInfoSchema = object({
16707
+ owner: string(),
16708
+ kind: RecordKindNameSchema,
16709
+ title: string(),
16710
+ nameField: string(),
16711
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16712
+ fields: record(string(), unknown()),
16713
+ secretPaths: array(string()),
16714
+ rows: number().int().nonnegative()
16715
+ });
16716
+ var EntryViewSchema = object({
16717
+ id: RecordIdSchema,
16718
+ name: string(),
16719
+ rev: number().int(),
16720
+ updatedAt: number(),
16721
+ /** Secret fields hold the redaction token. */
16722
+ data: RecordBodySchema
16723
+ });
16724
+ var EntryAddress = {
16725
+ owner: string().min(1),
16726
+ kind: RecordKindNameSchema
16727
+ };
16728
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16729
+ ...EntryAddress,
16730
+ id: RecordIdSchema.optional(),
16731
+ data: RecordBodySchema,
16732
+ ifRev: number().int().min(1).optional()
16733
+ }), object({
16734
+ id: string(),
16735
+ rev: number().int()
16736
+ }), {
16737
+ kind: "mutation",
16738
+ auth: "admin"
16739
+ }), method(object({
16740
+ ...EntryAddress,
16741
+ id: RecordIdSchema
16742
+ }), object({ deleted: boolean() }), {
16743
+ kind: "mutation",
16744
+ auth: "admin"
16287
16745
  });
16288
16746
  /**
16289
16747
  * `keychain` — the hub's encrypted store of secret values (D787).
@@ -39330,6 +39788,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39330
39788
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39331
39789
  kind: "mutation",
39332
39790
  auth: "admin"
39791
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39792
+ kind: "mutation",
39793
+ auth: "admin"
39333
39794
  }), method(ProfileRefInputSchema, _void(), {
39334
39795
  kind: "mutation",
39335
39796
  auth: "admin"
@@ -49769,6 +50230,41 @@ var ServerRollbackInfoSchema = object({
49769
50230
  atMs: number(),
49770
50231
  reason: string()
49771
50232
  });
50233
+ /**
50234
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50235
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50236
+ * service holds, because only the hub plans) against the states the process
50237
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50238
+ * every boot, served on `getServerPackageStatus`.
50239
+ *
50240
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50241
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50242
+ * planned runner the process service has no entry for.
50243
+ */
50244
+ var RunnerRefusalSchema = object({
50245
+ runnerId: string(),
50246
+ addonIds: array(string()),
50247
+ reason: string()
50248
+ });
50249
+ var RunnerBootCheckSchema = object({
50250
+ checkedAtMs: number(),
50251
+ /** Runners planned for this node. */
50252
+ expected: number(),
50253
+ /** Planned runners whose process is `running`. */
50254
+ running: number(),
50255
+ failed: array(string()),
50256
+ refused: array(RunnerRefusalSchema),
50257
+ missing: array(string()),
50258
+ /**
50259
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50260
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50261
+ * pushed and the verdict is re-evaluated on the next runner state change.
50262
+ * Optional for version skew (absent = settled).
50263
+ */
50264
+ pending: array(string()).optional(),
50265
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50266
+ planKnown: boolean()
50267
+ });
49772
50268
  var ServerPackageStatusSchema = object({
49773
50269
  /** Root package name (`@camstack/server` on the hub). */
49774
50270
  packageName: string(),
@@ -49831,7 +50327,14 @@ var ServerPackageStatusSchema = object({
49831
50327
  * for version skew: an older provider's payload simply omits it, and an
49832
50328
  * absent wrapper is unknown — never `native`.
49833
50329
  */
49834
- wrapper: WrapperIdentitySchema.optional()
50330
+ wrapper: WrapperIdentitySchema.optional(),
50331
+ /**
50332
+ * What this node PLANNED to run against what its process service reports
50333
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50334
+ * on a provider that predates it. Absent is "not checked yet", never "all
50335
+ * well": a consumer that needs the answer treats it as pending.
50336
+ */
50337
+ runners: RunnerBootCheckSchema.optional()
49835
50338
  });
49836
50339
  var ServerUpdateCheckResultSchema = object({
49837
50340
  packageName: string(),
@@ -49882,6 +50385,13 @@ var ServerUpdateOutcomeSchema = _enum([
49882
50385
  "refused",
49883
50386
  "failed"
49884
50387
  ]);
50388
+ /** One addon the pre-flight found the target version would refuse (D877). */
50389
+ var UpdateBlockerSchema = object({
50390
+ addonId: string(),
50391
+ reason: string(),
50392
+ /** What the operator does about it. */
50393
+ remedy: string()
50394
+ });
49885
50395
  var ServerUpdateActionResultSchema = object({
49886
50396
  accepted: boolean(),
49887
50397
  targetVersion: string().nullable(),
@@ -49899,14 +50409,27 @@ var ServerUpdateActionResultSchema = object({
49899
50409
  * The failure itself, verbatim enough to act on (the npm output for a
49900
50410
  * staging install). Non-null only for `failed`.
49901
50411
  */
49902
- error: string().nullable().optional()
50412
+ error: string().nullable().optional(),
50413
+ /**
50414
+ * The addons the target version would refuse to start on this node's live
50415
+ * store (D877), present when the pre-flight refused the update
50416
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50417
+ */
50418
+ blockers: array(UpdateBlockerSchema).optional()
49903
50419
  });
49904
50420
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49905
50421
  kind: "mutation",
49906
50422
  auth: "admin"
49907
- }), method(object({
49908
- /** Explicit target version; omitted = latest from the registry. */
49909
- version: string().optional() }), ServerUpdateActionResultSchema, {
50423
+ }), method(object({
50424
+ /** Explicit target version; omitted = latest from the registry. */
50425
+ version: string().optional(),
50426
+ /**
50427
+ * Apply even though the pre-flight (D877) found addons the target would
50428
+ * refuse to start. Off by default: those addons stay down until the
50429
+ * remedy is run, which is the incident this gate exists to prevent.
50430
+ */
50431
+ acknowledgeRefusals: boolean().optional()
50432
+ }), ServerUpdateActionResultSchema, {
49910
50433
  kind: "mutation",
49911
50434
  auth: "admin",
49912
50435
  timeoutMs: 16 * 6e4
@@ -52319,7 +52842,9 @@ var ManifestShapeSchema = object({
52319
52842
  var AddonProcessSchema = object({
52320
52843
  pid: number().optional(),
52321
52844
  mode: string(),
52322
- state: string()
52845
+ state: string(),
52846
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
52847
+ reason: string().optional()
52323
52848
  });
52324
52849
  /**
52325
52850
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -60403,7 +60928,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
60403
60928
  kind: "mutation",
60404
60929
  auth: "admin",
60405
60930
  access: "delete"
60406
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
60931
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
60932
+ kind: "mutation",
60933
+ auth: "admin",
60934
+ access: "create"
60935
+ }), method(object({
60407
60936
  userId: string(),
60408
60937
  code: string()
60409
60938
  }), object({ valid: boolean() }), {
@@ -62604,6 +63133,12 @@ Object.freeze({
62604
63133
  addonId: null,
62605
63134
  access: "view"
62606
63135
  },
63136
+ "coreBlocks.migrateRawSecrets": {
63137
+ capName: "core-blocks",
63138
+ capScope: "system",
63139
+ addonId: null,
63140
+ access: "create"
63141
+ },
62607
63142
  "coreBlocks.restart": {
62608
63143
  capName: "core-blocks",
62609
63144
  capScope: "system",
@@ -64464,6 +64999,12 @@ Object.freeze({
64464
64999
  addonId: null,
64465
65000
  access: "view"
64466
65001
  },
65002
+ "llm.migrateRawSecrets": {
65003
+ capName: "llm",
65004
+ capScope: "system",
65005
+ addonId: null,
65006
+ access: "create"
65007
+ },
64467
65008
  "llm.resolveModelRef": {
64468
65009
  capName: "llm",
64469
65010
  capScope: "system",
@@ -67350,6 +67891,30 @@ Object.freeze({
67350
67891
  addonId: null,
67351
67892
  access: "create"
67352
67893
  },
67894
+ "recordEntries.deleteEntry": {
67895
+ capName: "record-entries",
67896
+ capScope: "system",
67897
+ addonId: null,
67898
+ access: "delete"
67899
+ },
67900
+ "recordEntries.listEntries": {
67901
+ capName: "record-entries",
67902
+ capScope: "system",
67903
+ addonId: null,
67904
+ access: "view"
67905
+ },
67906
+ "recordEntries.listEntryKinds": {
67907
+ capName: "record-entries",
67908
+ capScope: "system",
67909
+ addonId: null,
67910
+ access: "view"
67911
+ },
67912
+ "recordEntries.putEntry": {
67913
+ capName: "record-entries",
67914
+ capScope: "system",
67915
+ addonId: null,
67916
+ access: "create"
67917
+ },
67353
67918
  "recording.getAvailability": {
67354
67919
  capName: "recording",
67355
67920
  capScope: "device",
@@ -67650,6 +68215,102 @@ Object.freeze({
67650
68215
  addonId: null,
67651
68216
  access: "view"
67652
68217
  },
68218
+ "records.aggregate": {
68219
+ capName: "records",
68220
+ capScope: "system",
68221
+ addonId: null,
68222
+ access: "view"
68223
+ },
68224
+ "records.allocateId": {
68225
+ capName: "records",
68226
+ capScope: "system",
68227
+ addonId: null,
68228
+ access: "create"
68229
+ },
68230
+ "records.count": {
68231
+ capName: "records",
68232
+ capScope: "system",
68233
+ addonId: null,
68234
+ access: "view"
68235
+ },
68236
+ "records.declareKinds": {
68237
+ capName: "records",
68238
+ capScope: "system",
68239
+ addonId: null,
68240
+ access: "create"
68241
+ },
68242
+ "records.delete": {
68243
+ capName: "records",
68244
+ capScope: "system",
68245
+ addonId: null,
68246
+ access: "delete"
68247
+ },
68248
+ "records.deleteDevice": {
68249
+ capName: "records",
68250
+ capScope: "system",
68251
+ addonId: null,
68252
+ access: "delete"
68253
+ },
68254
+ "records.deleteMany": {
68255
+ capName: "records",
68256
+ capScope: "system",
68257
+ addonId: null,
68258
+ access: "delete"
68259
+ },
68260
+ "records.deleteWhere": {
68261
+ capName: "records",
68262
+ capScope: "system",
68263
+ addonId: null,
68264
+ access: "delete"
68265
+ },
68266
+ "records.get": {
68267
+ capName: "records",
68268
+ capScope: "system",
68269
+ addonId: null,
68270
+ access: "view"
68271
+ },
68272
+ "records.getMany": {
68273
+ capName: "records",
68274
+ capScope: "system",
68275
+ addonId: null,
68276
+ access: "view"
68277
+ },
68278
+ "records.histogram": {
68279
+ capName: "records",
68280
+ capScope: "system",
68281
+ addonId: null,
68282
+ access: "view"
68283
+ },
68284
+ "records.patch": {
68285
+ capName: "records",
68286
+ capScope: "system",
68287
+ addonId: null,
68288
+ access: "create"
68289
+ },
68290
+ "records.put": {
68291
+ capName: "records",
68292
+ capScope: "system",
68293
+ addonId: null,
68294
+ access: "create"
68295
+ },
68296
+ "records.putMany": {
68297
+ capName: "records",
68298
+ capScope: "system",
68299
+ addonId: null,
68300
+ access: "create"
68301
+ },
68302
+ "records.query": {
68303
+ capName: "records",
68304
+ capScope: "system",
68305
+ addonId: null,
68306
+ access: "view"
68307
+ },
68308
+ "records.secretRefs": {
68309
+ capName: "records",
68310
+ capScope: "system",
68311
+ addonId: null,
68312
+ access: "view"
68313
+ },
67653
68314
  "sceneMonitor.captureReference": {
67654
68315
  capName: "scene-monitor",
67655
68316
  capScope: "device",
@@ -68082,18 +68743,48 @@ Object.freeze({
68082
68743
  addonId: null,
68083
68744
  access: "create"
68084
68745
  },
68746
+ "storageAdmin.adoptRecords": {
68747
+ capName: "storage-admin",
68748
+ capScope: "system",
68749
+ addonId: null,
68750
+ access: "create"
68751
+ },
68085
68752
  "storageAdmin.dropCollection": {
68086
68753
  capName: "storage-admin",
68087
68754
  capScope: "system",
68088
68755
  addonId: null,
68089
68756
  access: "delete"
68090
68757
  },
68758
+ "storageAdmin.isAdoptedLegacyTable": {
68759
+ capName: "storage-admin",
68760
+ capScope: "system",
68761
+ addonId: null,
68762
+ access: "view"
68763
+ },
68764
+ "storageAdmin.listKinds": {
68765
+ capName: "storage-admin",
68766
+ capScope: "system",
68767
+ addonId: null,
68768
+ access: "view"
68769
+ },
68091
68770
  "storageAdmin.listTables": {
68092
68771
  capName: "storage-admin",
68093
68772
  capScope: "system",
68094
68773
  addonId: null,
68095
68774
  access: "view"
68096
68775
  },
68776
+ "storageAdmin.readLegacyCollection": {
68777
+ capName: "storage-admin",
68778
+ capScope: "system",
68779
+ addonId: null,
68780
+ access: "view"
68781
+ },
68782
+ "storageAdmin.readRecords": {
68783
+ capName: "storage-admin",
68784
+ capScope: "system",
68785
+ addonId: null,
68786
+ access: "view"
68787
+ },
68097
68788
  "storageEvictable.evict": {
68098
68789
  capName: "storage-evictable",
68099
68790
  capScope: "system",
@@ -69006,6 +69697,12 @@ Object.freeze({
69006
69697
  addonId: null,
69007
69698
  access: "view"
69008
69699
  },
69700
+ "userManagement.migrateRawSecrets": {
69701
+ capName: "user-management",
69702
+ capScope: "system",
69703
+ addonId: null,
69704
+ access: "create"
69705
+ },
69009
69706
  "userManagement.oauthExchangeCode": {
69010
69707
  capName: "user-management",
69011
69708
  capScope: "system",
@@ -71682,6 +72379,37 @@ Object.freeze({
71682
72379
  form: "single",
71683
72380
  optional: false
71684
72381
  }],
72382
+ "records.count": [{
72383
+ name: "deviceId",
72384
+ form: "single",
72385
+ optional: true
72386
+ }],
72387
+ "records.deleteDevice": [{
72388
+ name: "deviceId",
72389
+ form: "single",
72390
+ optional: false
72391
+ }],
72392
+ "records.deleteWhere": [{
72393
+ name: "deviceId",
72394
+ form: "single",
72395
+ optional: true
72396
+ }],
72397
+ "records.histogram": [{
72398
+ name: "deviceId",
72399
+ form: "single",
72400
+ optional: true
72401
+ }],
72402
+ "records.putMany": [{
72403
+ name: "records",
72404
+ form: "object-array",
72405
+ optional: false,
72406
+ itemField: "deviceId"
72407
+ }],
72408
+ "records.query": [{
72409
+ name: "deviceId",
72410
+ form: "single",
72411
+ optional: true
72412
+ }],
71685
72413
  "sceneMonitor.captureReference": [{
71686
72414
  name: "deviceId",
71687
72415
  form: "single",
@@ -71798,6 +72526,17 @@ Object.freeze({
71798
72526
  form: "single",
71799
72527
  optional: false
71800
72528
  }],
72529
+ "storageAdmin.adoptRecords": [{
72530
+ name: "records",
72531
+ form: "object-array",
72532
+ optional: false,
72533
+ itemField: "deviceId"
72534
+ }],
72535
+ "storageAdmin.readRecords": [{
72536
+ name: "deviceId",
72537
+ form: "single",
72538
+ optional: true
72539
+ }],
71801
72540
  "streamBroker.acquireEgressTranscode": [{
71802
72541
  name: "deviceId",
71803
72542
  form: "single",