@camstack/addon-pipeline 1.2.375 → 1.2.601

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.
Files changed (34) hide show
  1. package/dist/audio-analyzer/index.js +3 -3
  2. package/dist/audio-analyzer/index.mjs +3 -3
  3. package/dist/{custom-model-catalog-DF5qs8u4.mjs → custom-model-catalog-CK9GK3N5.mjs} +2 -2
  4. package/dist/{custom-model-catalog-gbLoUFki.js → custom-model-catalog-DgyafyuW.js} +2 -2
  5. package/dist/detection-pipeline/index.js +4 -4
  6. package/dist/detection-pipeline/index.mjs +4 -4
  7. package/dist/{dist-QyeZXkAO.mjs → dist-BaHsDOWa.mjs} +391 -22
  8. package/dist/{dist-C0Mg8e3I.js → dist-BqI10eLV.js} +396 -21
  9. package/dist/{model-catalogs-CIE4Dz4x.mjs → model-catalogs-DM5sVj1T.mjs} +1 -1
  10. package/dist/{model-catalogs-BTuX-P0k.js → model-catalogs-DhGVt_sH.js} +1 -1
  11. package/dist/motion-wasm/index.js +1 -1
  12. package/dist/motion-wasm/index.mjs +1 -1
  13. package/dist/{node-ndjp9DQO.mjs → node-B0a0dXhg.mjs} +38 -3
  14. package/dist/{node-CifGKjsd.js → node-CgwqjGz0.js} +42 -1
  15. package/dist/pipeline-runner/index.js +4 -4
  16. package/dist/pipeline-runner/index.mjs +4 -4
  17. package/dist/{process-memory-BMfSP5-i.js → process-memory-C0zbWvwD.js} +1 -1
  18. package/dist/{process-memory-CaMI-Ry2.mjs → process-memory-sfdcLVkW.mjs} +1 -1
  19. package/dist/recorder/index.js +343 -516
  20. package/dist/recorder/index.mjs +343 -516
  21. package/dist/{segment-demux-js-LhwVw18z.js → segment-demux-js-B9lL2VCC.js} +1 -1
  22. package/dist/{segment-demux-js-CLXBgUTo.mjs → segment-demux-js-BB4CUAB5.mjs} +1 -1
  23. package/dist/stream-broker/_stub.js +2 -2
  24. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-B4MD_B4k.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CbN9DjoK.mjs} +3 -3
  25. package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BvMrdOCD.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Boq8JqyD.mjs} +1 -1
  26. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-B25q1OKG.mjs +26 -0
  27. package/dist/stream-broker/demux-worker-child.js +1 -1
  28. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  29. package/dist/stream-broker/{hostInit-DBDp5YHD.mjs → hostInit-BSYHAfPt.mjs} +3 -3
  30. package/dist/stream-broker/index.js +10 -9
  31. package/dist/stream-broker/index.mjs +10 -9
  32. package/dist/stream-broker/remoteEntry.js +1 -1
  33. package/package.json +1 -1
  34. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-JVFs9LgI.mjs +0 -26
@@ -4123,6 +4123,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4123
4123
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4124
4124
  json.type = "boolean";
4125
4125
  };
4126
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4127
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4128
+ };
4129
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4130
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4131
+ };
4126
4132
  var nullProcessor = (_schema, ctx, json, _params) => {
4127
4133
  if (ctx.target === "openapi-3.0") {
4128
4134
  json.type = "string";
@@ -4130,12 +4136,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4130
4136
  json.enum = [null];
4131
4137
  } else json.type = "null";
4132
4138
  };
4139
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4140
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4141
+ };
4133
4142
  var voidProcessor = (_schema, ctx, _json, _params) => {
4134
4143
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4135
4144
  };
4136
4145
  var neverProcessor = (_schema, _ctx, json, _params) => {
4137
4146
  json.not = {};
4138
4147
  };
4148
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4149
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4139
4150
  var dateProcessor = (_schema, ctx, _json, _params) => {
4140
4151
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4141
4152
  };
@@ -4167,12 +4178,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4167
4178
  json.enum = vals;
4168
4179
  }
4169
4180
  };
4181
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4182
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4183
+ };
4184
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4185
+ const _json = json;
4186
+ const pattern = schema._zod.pattern;
4187
+ if (!pattern) throw new Error("Pattern not found in template literal");
4188
+ _json.type = "string";
4189
+ _json.pattern = pattern.source;
4190
+ };
4191
+ var fileProcessor = (schema, _ctx, json, _params) => {
4192
+ const _json = json;
4193
+ const file = {
4194
+ type: "string",
4195
+ format: "binary",
4196
+ contentEncoding: "binary"
4197
+ };
4198
+ const { minimum, maximum, mime } = schema._zod.bag;
4199
+ if (minimum !== void 0) file.minLength = minimum;
4200
+ if (maximum !== void 0) file.maxLength = maximum;
4201
+ if (mime) if (mime.length === 1) {
4202
+ file.contentMediaType = mime[0];
4203
+ Object.assign(_json, file);
4204
+ } else {
4205
+ Object.assign(_json, file);
4206
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4207
+ }
4208
+ else Object.assign(_json, file);
4209
+ };
4210
+ var successProcessor = (_schema, _ctx, json, _params) => {
4211
+ json.type = "boolean";
4212
+ };
4170
4213
  var customProcessor = (_schema, ctx, _json, _params) => {
4171
4214
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4172
4215
  };
4216
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4217
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4218
+ };
4173
4219
  var transformProcessor = (_schema, ctx, _json, _params) => {
4174
4220
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4175
4221
  };
4222
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4223
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4224
+ };
4225
+ var setProcessor = (_schema, ctx, _json, _params) => {
4226
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4227
+ };
4176
4228
  var arrayProcessor = (schema, ctx, _json, params) => {
4177
4229
  const json = _json;
4178
4230
  const def = schema._zod.def;
@@ -4377,6 +4429,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4377
4429
  seen.ref = def.innerType;
4378
4430
  json.readOnly = true;
4379
4431
  };
4432
+ var promiseProcessor = (schema, ctx, _json, params) => {
4433
+ const def = schema._zod.def;
4434
+ process(def.innerType, ctx, params);
4435
+ const seen = ctx.seen.get(schema);
4436
+ seen.ref = def.innerType;
4437
+ };
4380
4438
  var optionalProcessor = (schema, ctx, _json, params) => {
4381
4439
  const def = schema._zod.def;
4382
4440
  process(def.innerType, ctx, params);
@@ -4389,6 +4447,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4389
4447
  const seen = ctx.seen.get(schema);
4390
4448
  seen.ref = innerType;
4391
4449
  };
4450
+ var allProcessors = {
4451
+ string: stringProcessor,
4452
+ number: numberProcessor,
4453
+ boolean: booleanProcessor,
4454
+ bigint: bigintProcessor,
4455
+ symbol: symbolProcessor,
4456
+ null: nullProcessor,
4457
+ undefined: undefinedProcessor,
4458
+ void: voidProcessor,
4459
+ never: neverProcessor,
4460
+ any: anyProcessor,
4461
+ unknown: unknownProcessor,
4462
+ date: dateProcessor,
4463
+ enum: enumProcessor,
4464
+ literal: literalProcessor,
4465
+ nan: nanProcessor,
4466
+ template_literal: templateLiteralProcessor,
4467
+ file: fileProcessor,
4468
+ success: successProcessor,
4469
+ custom: customProcessor,
4470
+ function: functionProcessor,
4471
+ transform: transformProcessor,
4472
+ map: mapProcessor,
4473
+ set: setProcessor,
4474
+ array: arrayProcessor,
4475
+ object: objectProcessor,
4476
+ union: unionProcessor,
4477
+ intersection: intersectionProcessor,
4478
+ tuple: tupleProcessor,
4479
+ record: recordProcessor,
4480
+ nullable: nullableProcessor,
4481
+ nonoptional: nonoptionalProcessor,
4482
+ default: defaultProcessor,
4483
+ prefault: prefaultProcessor,
4484
+ catch: catchProcessor,
4485
+ pipe: pipeProcessor,
4486
+ readonly: readonlyProcessor,
4487
+ promise: promiseProcessor,
4488
+ optional: optionalProcessor,
4489
+ lazy: lazyProcessor
4490
+ };
4491
+ function toJSONSchema(input, params) {
4492
+ if ("_idmap" in input) {
4493
+ const registry = input;
4494
+ const ctx = initializeContext({
4495
+ ...params,
4496
+ processors: allProcessors
4497
+ });
4498
+ const defs = {};
4499
+ for (const entry of registry._idmap.entries()) {
4500
+ const [_, schema] = entry;
4501
+ process(schema, ctx);
4502
+ }
4503
+ const schemas = {};
4504
+ ctx.external = {
4505
+ registry,
4506
+ uri: params?.uri,
4507
+ defs
4508
+ };
4509
+ for (const entry of registry._idmap.entries()) {
4510
+ const [key, schema] = entry;
4511
+ extractDefs(ctx, schema);
4512
+ schemas[key] = finalize(ctx, schema);
4513
+ }
4514
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4515
+ return { schemas };
4516
+ }
4517
+ const ctx = initializeContext({
4518
+ ...params,
4519
+ processors: allProcessors
4520
+ });
4521
+ process(input, ctx);
4522
+ extractDefs(ctx, input);
4523
+ return finalize(ctx, input);
4524
+ }
4392
4525
  //#endregion
4393
4526
  //#region ../../node_modules/zod/v4/classic/iso.js
4394
4527
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5405,7 +5538,7 @@ var ZodIssueCode = {
5405
5538
  var ZodFirstPartyTypeKind;
5406
5539
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5407
5540
  //#endregion
5408
- //#region ../types/dist/sleep-WsrozGDL.mjs
5541
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5409
5542
  /**
5410
5543
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5411
5544
  * window to float samples (D455).
@@ -5554,7 +5687,7 @@ function isKeychainStoredField(field) {
5554
5687
  var SECRET_CLEAR = { $secretClear: true };
5555
5688
  /** The `'***'` token D634 redaction writes for non-admins. */
5556
5689
  var LEGACY_DEVICE_REDACTION = "***";
5557
- function isRecord$4(value) {
5690
+ function isRecord$5(value) {
5558
5691
  return typeof value === "object" && value !== null && !Array.isArray(value);
5559
5692
  }
5560
5693
  function makeSecretMarker(ref) {
@@ -5565,12 +5698,12 @@ function makeSecretMarker(ref) {
5565
5698
  }
5566
5699
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5567
5700
  function isSecretMarker(value) {
5568
- if (!isRecord$4(value)) return false;
5701
+ if (!isRecord$5(value)) return false;
5569
5702
  const ref = value["$secret"];
5570
5703
  return typeof ref === "string" && ref.length > 0;
5571
5704
  }
5572
5705
  function isSecretClear(value) {
5573
- return isRecord$4(value) && value["$secretClear"] === true;
5706
+ return isRecord$5(value) && value["$secretClear"] === true;
5574
5707
  }
5575
5708
  /**
5576
5709
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6196,7 +6329,7 @@ var KeychainWriteRefusedError = class extends Error {
6196
6329
  }
6197
6330
  };
6198
6331
  var KEEP = { kind: "keep" };
6199
- function isRecord$3(value) {
6332
+ function isRecord$4(value) {
6200
6333
  return typeof value === "object" && value !== null && !Array.isArray(value);
6201
6334
  }
6202
6335
  function defaultMintId() {
@@ -6209,7 +6342,7 @@ function collectSecretMarkerRefs(value, out = []) {
6209
6342
  return out;
6210
6343
  }
6211
6344
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6212
- else if (isRecord$3(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6345
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6213
6346
  return out;
6214
6347
  }
6215
6348
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6264,7 +6397,7 @@ function rowId(row, idKey) {
6264
6397
  return null;
6265
6398
  }
6266
6399
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6267
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$3) : [];
6400
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6268
6401
  if (!Array.isArray(incoming)) {
6269
6402
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6270
6403
  return {
@@ -6280,7 +6413,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6280
6413
  const kept = /* @__PURE__ */ new Set();
6281
6414
  const rows = [];
6282
6415
  for (const row of incoming) {
6283
- if (!isRecord$3(row)) {
6416
+ if (!isRecord$4(row)) {
6284
6417
  rows.push(row);
6285
6418
  continue;
6286
6419
  }
@@ -6305,7 +6438,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6305
6438
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6306
6439
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6307
6440
  case "object": {
6308
- if (!isRecord$3(incoming)) {
6441
+ if (!isRecord$4(incoming)) {
6309
6442
  if (incoming === void 0) return KEEP;
6310
6443
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6311
6444
  return {
@@ -6313,7 +6446,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6313
6446
  value: incoming
6314
6447
  };
6315
6448
  }
6316
- const storedObj = isRecord$3(stored) ? stored : {};
6449
+ const storedObj = isRecord$4(stored) ? stored : {};
6317
6450
  return {
6318
6451
  kind: "value",
6319
6452
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6436,7 +6569,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6436
6569
  value: items
6437
6570
  };
6438
6571
  }
6439
- if (isRecord$3(v)) {
6572
+ if (isRecord$4(v)) {
6440
6573
  const out = {};
6441
6574
  for (const [k, child] of Object.entries(v)) {
6442
6575
  const s = substitute(child);
@@ -6468,7 +6601,7 @@ var SecretOverwriteRefusedError = class extends Error {
6468
6601
  this.name = "SecretOverwriteRefusedError";
6469
6602
  }
6470
6603
  };
6471
- function isRecord$2$1(value) {
6604
+ function isRecord$3(value) {
6472
6605
  return typeof value === "object" && value !== null && !Array.isArray(value);
6473
6606
  }
6474
6607
  function resolvedValue(pass, marker) {
@@ -6497,7 +6630,7 @@ function inArray(pass, incoming, stored) {
6497
6630
  return incoming.map((item, index) => {
6498
6631
  const twin = stored[index];
6499
6632
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6500
- if (isRecord$2$1(item) && isRecord$2$1(twin)) return inArrayRow(pass, item, twin);
6633
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6501
6634
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6502
6635
  return item;
6503
6636
  });
@@ -6508,7 +6641,7 @@ function inArrayRow(pass, incoming, stored) {
6508
6641
  const twin = stored[key];
6509
6642
  if (isSecretMarker(twin)) {
6510
6643
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6511
- } else if (isRecord$2$1(value) && isRecord$2$1(twin)) out[key] = inArrayRow(pass, value, twin);
6644
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6512
6645
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6513
6646
  }
6514
6647
  return out;
@@ -6516,7 +6649,7 @@ function inArrayRow(pass, incoming, stored) {
6516
6649
  async function walk(pass, incoming, stored) {
6517
6650
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6518
6651
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6519
- if (!isRecord$2$1(incoming) || !isRecord$2$1(stored)) return incoming;
6652
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6520
6653
  const out = { ...incoming };
6521
6654
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6522
6655
  return out;
@@ -6547,7 +6680,7 @@ async function restoreUnchangedSecrets(input) {
6547
6680
  function isJsonEqual(a, b) {
6548
6681
  if (Object.is(a, b)) return true;
6549
6682
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6550
- if (isRecord$2$1(a) && isRecord$2$1(b)) {
6683
+ if (isRecord$3(a) && isRecord$3(b)) {
6551
6684
  const keys = Object.keys(a);
6552
6685
  if (keys.length !== Object.keys(b).length) return false;
6553
6686
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6571,7 +6704,7 @@ function markerKeysOf(blob, owner) {
6571
6704
  }
6572
6705
  function nodeFromStored(value, owner) {
6573
6706
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6574
- if (!isRecord$2$1(value)) return null;
6707
+ if (!isRecord$3(value)) return null;
6575
6708
  const children = /* @__PURE__ */ new Map();
6576
6709
  for (const [key, child] of Object.entries(value)) {
6577
6710
  const node = nodeFromStored(child, owner);
@@ -7359,7 +7492,7 @@ var BaseAddon = class {
7359
7492
  if (!ctx) return;
7360
7493
  const addonId = ctx.id;
7361
7494
  setImmediate(() => {
7362
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7495
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7363
7496
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7364
7497
  }).catch((err) => {
7365
7498
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7868,6 +8001,136 @@ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7868
8001
  var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7869
8002
  var RECORD_BATCH_MAX = 1e3;
7870
8003
  var RECORD_QUERY_MAX = 1e3;
8004
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
8005
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
8006
+ var PREFIX = "records/";
8007
+ /** The base of every records failure. `detail` is the human part of the message. */
8008
+ var RecordsError = class extends Error {
8009
+ code;
8010
+ detail;
8011
+ constructor(code, detail) {
8012
+ super(`${PREFIX}${code}: ${detail}`);
8013
+ this.name = "RecordsError";
8014
+ this.code = code;
8015
+ this.detail = detail;
8016
+ }
8017
+ };
8018
+ var InvalidRecordError = class extends RecordsError {
8019
+ constructor(detail) {
8020
+ super("invalid-record", detail);
8021
+ this.name = "InvalidRecordError";
8022
+ }
8023
+ };
8024
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
8025
+ var DeclarationRefusedError = class extends RecordsError {
8026
+ constructor(detail) {
8027
+ super("declaration-refused", detail);
8028
+ this.name = "DeclarationRefusedError";
8029
+ }
8030
+ };
8031
+ function defOf(schema) {
8032
+ const zodBag = Reflect.get(schema, "_zod");
8033
+ if (typeof zodBag !== "object" || zodBag === null) return {};
8034
+ const def = Reflect.get(zodBag, "def");
8035
+ if (typeof def !== "object" || def === null) return {};
8036
+ return def;
8037
+ }
8038
+ function declaredHere(schema) {
8039
+ return globalRegistry.get(schema)?.secret === true;
8040
+ }
8041
+ /** Wrapper kinds whose `innerType` is the field itself. */
8042
+ var WRAPPERS = new Set([
8043
+ "optional",
8044
+ "nullable",
8045
+ "default",
8046
+ "prefault",
8047
+ "catch",
8048
+ "readonly",
8049
+ "nonoptional"
8050
+ ]);
8051
+ /**
8052
+ * The schema layers that make up ONE field: the schema itself and every
8053
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8054
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8055
+ * `.transform` on `in`).
8056
+ */
8057
+ function layersOf(schema) {
8058
+ const out = [];
8059
+ const queue = [schema];
8060
+ while (queue.length > 0) {
8061
+ const s = queue.shift();
8062
+ if (!s || out.includes(s)) continue;
8063
+ out.push(s);
8064
+ const def = defOf(s);
8065
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8066
+ if (def.type === "pipe") {
8067
+ if (def.in) queue.push(def.in);
8068
+ if (def.out) queue.push(def.out);
8069
+ }
8070
+ }
8071
+ return out;
8072
+ }
8073
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8074
+ function isZodSecret(schema) {
8075
+ return layersOf(schema).some(declaredHere);
8076
+ }
8077
+ /**
8078
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8079
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8080
+ * object or array is reported as one path and not descended into — everything
8081
+ * under it is secret.
8082
+ */
8083
+ function collectZodSecretPaths(schema, prefix = "") {
8084
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8085
+ const paths = [];
8086
+ for (const layer of layersOf(schema)) {
8087
+ const def = defOf(layer);
8088
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8089
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8090
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8091
+ else if (def.type === "intersection") {
8092
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8093
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8094
+ }
8095
+ }
8096
+ return [...new Set(paths)];
8097
+ }
8098
+ /**
8099
+ * Secret fields of a record, addressed the way a Zod schema declares them
8100
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8101
+ * (`auth.accessToken`, `headers[].value`).
8102
+ *
8103
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8104
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8105
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8106
+ * leaf names its element: `headers[X-Api].value`.
8107
+ *
8108
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8109
+ */
8110
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8111
+ function parseSecretPath(path) {
8112
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8113
+ return path.split(".").map((raw) => {
8114
+ const each = raw.endsWith("[]");
8115
+ const key = each ? raw.slice(0, -2) : raw;
8116
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8117
+ return {
8118
+ key,
8119
+ each
8120
+ };
8121
+ });
8122
+ }
8123
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8124
+ function secretArrayPrefixes(path) {
8125
+ const segments = parseSecretPath(path);
8126
+ const prefixes = [];
8127
+ const walked = [];
8128
+ for (const segment of segments) {
8129
+ walked.push(segment.key);
8130
+ if (segment.each) prefixes.push(walked.join("."));
8131
+ }
8132
+ return prefixes;
8133
+ }
7871
8134
  /**
7872
8135
  * Record kinds (D881): the declaration an addon makes of one kind of fact, the
7873
8136
  * Zod row schema that describes it, and the helper that turns the two into the
@@ -7936,6 +8199,90 @@ var RecordKindDeclarationSchema = object({
7936
8199
  }).strict();
7937
8200
  /** The kind names: lower-case, dash separated, short enough for an index name. */
7938
8201
  var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8202
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8203
+ function assertValidDeclaration(name, decl) {
8204
+ const refuse = (why) => {
8205
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8206
+ };
8207
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8208
+ const seen = /* @__PURE__ */ new Set();
8209
+ for (const index of decl.indexes) {
8210
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8211
+ seen.add(index.name);
8212
+ }
8213
+ const { retention } = decl;
8214
+ const hasSecrets = decl.secretPaths.length > 0;
8215
+ if ("ttlMs" in retention) {
8216
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8217
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8218
+ }
8219
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8220
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8221
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8222
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8223
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8224
+ if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
8225
+ }
8226
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8227
+ for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
8228
+ }
8229
+ function bodyFieldsOf(schema) {
8230
+ return { ...toJSONSchema(schema, {
8231
+ unrepresentable: "any",
8232
+ io: "input"
8233
+ }) };
8234
+ }
8235
+ function isRecordLike(value) {
8236
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8237
+ }
8238
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8239
+ function hasNameField(json, field) {
8240
+ const branches = json["oneOf"] ?? json["anyOf"];
8241
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8242
+ const properties = json["properties"];
8243
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8244
+ }
8245
+ /**
8246
+ * Declare the kinds of a package. The keys are the kind names. The result is
8247
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8248
+ * types its handle from.
8249
+ */
8250
+ function defineRecordKinds(specs) {
8251
+ const out = {};
8252
+ for (const [name, spec] of Object.entries(specs)) {
8253
+ const secretPaths = collectZodSecretPaths(spec.schema);
8254
+ const nameField = spec.entry?.nameField ?? "name";
8255
+ const fields = bodyFieldsOf(spec.schema);
8256
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8257
+ const parsed = RecordKindDeclarationSchema.parse({
8258
+ database: spec.database,
8259
+ class: spec.class,
8260
+ writeTrigger: spec.writeTrigger,
8261
+ device: spec.device,
8262
+ at: spec.at,
8263
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8264
+ retention: spec.retention,
8265
+ deviceRemoval: spec.deviceRemoval,
8266
+ maxDataBytes: spec.maxDataBytes,
8267
+ secretPaths: [...secretPaths],
8268
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8269
+ adoptsFrom: spec.adoptsFrom,
8270
+ transactFamily: spec.transactFamily,
8271
+ entry: spec.entry === void 0 ? void 0 : {
8272
+ title: spec.entry.title,
8273
+ nameField,
8274
+ fields
8275
+ }
8276
+ });
8277
+ assertValidDeclaration(name, parsed);
8278
+ out[name] = {
8279
+ name,
8280
+ schema: spec.schema,
8281
+ declaration: parsed
8282
+ };
8283
+ }
8284
+ return out;
8285
+ }
7939
8286
  /** Shared Zod schemas used across streaming capabilities. */
7940
8287
  var CamProfileSchema = _enum([
7941
8288
  "high",
@@ -19309,13 +19656,23 @@ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: arr
19309
19656
  }), RecordQueryResultSchema, { auth: "admin" }), method(object({
19310
19657
  owner: string().min(1),
19311
19658
  kind: RecordKindNameSchema,
19312
- records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX),
19659
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
19313
19660
  /** The LAST batch: the copy is complete, the boot guard stops asking. */
19314
19661
  complete: boolean().optional()
19315
- }), object({ adopted: number().int() }), {
19662
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
19316
19663
  kind: "mutation",
19317
19664
  auth: "admin"
19318
- });
19665
+ }), method(object({
19666
+ collection: string().min(1),
19667
+ cursor: string().optional(),
19668
+ limit: number().int().min(1).max(1e3).optional()
19669
+ }), object({
19670
+ rows: array(object({
19671
+ id: string(),
19672
+ data: record(string(), unknown())
19673
+ })),
19674
+ nextCursor: string().nullable()
19675
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
19319
19676
  /**
19320
19677
  * record-entries - the ONE admin surface for every list of user-created entries
19321
19678
  * (D881): notification targets, brokers, LLM profiles, anything an addon
@@ -73232,6 +73589,12 @@ Object.freeze({
73232
73589
  addonId: null,
73233
73590
  access: "delete"
73234
73591
  },
73592
+ "storageAdmin.isAdoptedLegacyTable": {
73593
+ capName: "storage-admin",
73594
+ capScope: "system",
73595
+ addonId: null,
73596
+ access: "view"
73597
+ },
73235
73598
  "storageAdmin.listKinds": {
73236
73599
  capName: "storage-admin",
73237
73600
  capScope: "system",
@@ -73244,6 +73607,12 @@ Object.freeze({
73244
73607
  addonId: null,
73245
73608
  access: "view"
73246
73609
  },
73610
+ "storageAdmin.readLegacyCollection": {
73611
+ capName: "storage-admin",
73612
+ capScope: "system",
73613
+ addonId: null,
73614
+ access: "view"
73615
+ },
73247
73616
  "storageAdmin.readRecords": {
73248
73617
  capName: "storage-admin",
73249
73618
  capScope: "system",
@@ -80239,6 +80608,12 @@ Object.defineProperty(exports, "defineCustomActions", {
80239
80608
  return defineCustomActions;
80240
80609
  }
80241
80610
  });
80611
+ Object.defineProperty(exports, "defineRecordKinds", {
80612
+ enumerable: true,
80613
+ get: function() {
80614
+ return defineRecordKinds;
80615
+ }
80616
+ });
80242
80617
  Object.defineProperty(exports, "deriveBatteryPresence", {
80243
80618
  enumerable: true,
80244
80619
  get: function() {
@@ -1,4 +1,4 @@
1
- import { Hn as hfModelUrl } from "./dist-QyeZXkAO.mjs";
1
+ import { Un as hfModelUrl } from "./dist-BaHsDOWa.mjs";
2
2
  //#region src/detection-pipeline/registry/model-licenses.ts
3
3
  var COCO_DATA = {
4
4
  name: "COCO 2017",
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-C0Mg8e3I.js");
1
+ const require_dist = require("./dist-BqI10eLV.js");
2
2
  //#region src/detection-pipeline/registry/model-licenses.ts
3
3
  var COCO_DATA = {
4
4
  name: "COCO 2017",
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-C0Mg8e3I.js");
5
+ const require_dist = require("../dist-BqI10eLV.js");
6
6
  const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
7
7
  let node_fs = require("node:fs");
8
8
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Mn as BaseAddon, St as evaluateZoneRules, Un as hydrateSchema, Wt as motionDetectionCapability, kn as DeviceType } from "../dist-QyeZXkAO.mjs";
1
+ import { Mn as BaseAddon, St as evaluateZoneRules, Wn as hydrateSchema, Wt as motionDetectionCapability, kn as DeviceType } from "../dist-BaHsDOWa.mjs";
2
2
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { join } from "node:path";