@camstack/types 1.2.380 → 1.2.381

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.
@@ -162,7 +162,7 @@ function collectKeychainStoredKeys(schema) {
162
162
  return keys;
163
163
  }
164
164
  function walkKeychainField(field, out) {
165
- if (!isRecord$5(field)) return;
165
+ if (!isRecord$6(field)) return;
166
166
  const type = field["type"];
167
167
  const key = field["key"];
168
168
  const isSecret = type === "password" || field["secret"] === true;
@@ -187,21 +187,21 @@ function schemaDeclaresAnyField(schema) {
187
187
  for (const section of sectionsOf(schema)) if (fieldsOf(section).length > 0) return true;
188
188
  return false;
189
189
  }
190
- function isRecord$5(value) {
190
+ function isRecord$6(value) {
191
191
  return typeof value === "object" && value !== null && !Array.isArray(value);
192
192
  }
193
193
  function sectionsOf(schema) {
194
- if (!isRecord$5(schema)) return [];
194
+ if (!isRecord$6(schema)) return [];
195
195
  const sections = schema["sections"];
196
196
  return Array.isArray(sections) ? sections : [];
197
197
  }
198
198
  function fieldsOf(node) {
199
- if (!isRecord$5(node)) return [];
199
+ if (!isRecord$6(node)) return [];
200
200
  const fields = node["fields"];
201
201
  return Array.isArray(fields) ? fields : [];
202
202
  }
203
203
  function walkField(field, out) {
204
- if (!isRecord$5(field)) return;
204
+ if (!isRecord$6(field)) return;
205
205
  const type = field["type"];
206
206
  const key = field["key"];
207
207
  if ((type === "password" || field["secret"] === true) && typeof key === "string" && key.length > 0) out.add(key);
@@ -241,7 +241,7 @@ function walkField(field, out) {
241
241
  var SECRET_CLEAR = { $secretClear: true };
242
242
  /** The `'***'` token D634 redaction writes for non-admins. */
243
243
  var LEGACY_DEVICE_REDACTION = "***";
244
- function isRecord$4(value) {
244
+ function isRecord$5(value) {
245
245
  return typeof value === "object" && value !== null && !Array.isArray(value);
246
246
  }
247
247
  function makeSecretMarker(ref) {
@@ -252,19 +252,19 @@ function makeSecretMarker(ref) {
252
252
  }
253
253
  /** A stored marker: an object whose `$secret` is a non-empty string. */
254
254
  function isSecretMarker(value) {
255
- if (!isRecord$4(value)) return false;
255
+ if (!isRecord$5(value)) return false;
256
256
  const ref = value["$secret"];
257
257
  return typeof ref === "string" && ref.length > 0;
258
258
  }
259
259
  /** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
260
260
  function isSecretMarkerLike(value) {
261
- return isRecord$4(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
261
+ return isRecord$5(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
262
262
  }
263
263
  function isSecretClear(value) {
264
- return isRecord$4(value) && value["$secretClear"] === true;
264
+ return isRecord$5(value) && value["$secretClear"] === true;
265
265
  }
266
266
  function isSecretFieldView(value) {
267
- return isRecord$4(value) && value["set"] === true && isSecretMarkerLike(value);
267
+ return isRecord$5(value) && value["set"] === true && isSecretMarkerLike(value);
268
268
  }
269
269
  /**
270
270
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -677,6 +677,33 @@ function typeOf(field) {
677
677
  default: return "other";
678
678
  }
679
679
  }
680
+ /** Strip inline `value` from a hydrated field for schema-only round-trips. */
681
+ function dehydrateConfigField(field) {
682
+ if (field.type === "group") return {
683
+ ...field,
684
+ fields: field.fields.map(dehydrateConfigField)
685
+ };
686
+ if (field.type === "sub-tabs") return {
687
+ ...field,
688
+ tabs: field.tabs.map((tab) => ({
689
+ ...tab,
690
+ fields: tab.fields.map(dehydrateConfigField)
691
+ }))
692
+ };
693
+ if (isValuelessField(field)) return field;
694
+ const { value: _drop, ...rest } = field;
695
+ return rest;
696
+ }
697
+ /** Inverse of {@link hydrateSchema} — drops resolved values from every leaf field. */
698
+ function dehydrateSchema(schema) {
699
+ return {
700
+ ...schema.tabs ? { tabs: [...schema.tabs] } : {},
701
+ sections: schema.sections.map((section) => ({
702
+ ...section,
703
+ fields: section.fields.map(dehydrateConfigField)
704
+ }))
705
+ };
706
+ }
680
707
  //#endregion
681
708
  //#region src/interfaces/event-bus.ts
682
709
  /**
@@ -1018,7 +1045,7 @@ var KeychainWriteRefusedError = class extends Error {
1018
1045
  }
1019
1046
  };
1020
1047
  var KEEP = { kind: "keep" };
1021
- function isRecord$3(value) {
1048
+ function isRecord$4(value) {
1022
1049
  return typeof value === "object" && value !== null && !Array.isArray(value);
1023
1050
  }
1024
1051
  function defaultMintId() {
@@ -1031,7 +1058,7 @@ function collectSecretMarkerRefs(value, out = []) {
1031
1058
  return out;
1032
1059
  }
1033
1060
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
1034
- else if (isRecord$3(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
1061
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
1035
1062
  return out;
1036
1063
  }
1037
1064
  async function storedValueEquals(secrets, marker, candidate) {
@@ -1086,7 +1113,7 @@ function rowId(row, idKey) {
1086
1113
  return null;
1087
1114
  }
1088
1115
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
1089
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$3) : [];
1116
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
1090
1117
  if (!Array.isArray(incoming)) {
1091
1118
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
1092
1119
  return {
@@ -1102,7 +1129,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
1102
1129
  const kept = /* @__PURE__ */ new Set();
1103
1130
  const rows = [];
1104
1131
  for (const row of incoming) {
1105
- if (!isRecord$3(row)) {
1132
+ if (!isRecord$4(row)) {
1106
1133
  rows.push(row);
1107
1134
  continue;
1108
1135
  }
@@ -1127,7 +1154,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
1127
1154
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
1128
1155
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
1129
1156
  case "object": {
1130
- if (!isRecord$3(incoming)) {
1157
+ if (!isRecord$4(incoming)) {
1131
1158
  if (incoming === void 0) return KEEP;
1132
1159
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
1133
1160
  return {
@@ -1135,7 +1162,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
1135
1162
  value: incoming
1136
1163
  };
1137
1164
  }
1138
- const storedObj = isRecord$3(stored) ? stored : {};
1165
+ const storedObj = isRecord$4(stored) ? stored : {};
1139
1166
  return {
1140
1167
  kind: "value",
1141
1168
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -1258,7 +1285,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
1258
1285
  value: items
1259
1286
  };
1260
1287
  }
1261
- if (isRecord$3(v)) {
1288
+ if (isRecord$4(v)) {
1262
1289
  const out = {};
1263
1290
  for (const [k, child] of Object.entries(v)) {
1264
1291
  const s = substitute(child);
@@ -1292,7 +1319,7 @@ var SecretOverwriteRefusedError = class extends Error {
1292
1319
  this.name = "SecretOverwriteRefusedError";
1293
1320
  }
1294
1321
  };
1295
- function isRecord$2(value) {
1322
+ function isRecord$3(value) {
1296
1323
  return typeof value === "object" && value !== null && !Array.isArray(value);
1297
1324
  }
1298
1325
  function resolvedValue(pass, marker) {
@@ -1321,7 +1348,7 @@ function inArray(pass, incoming, stored) {
1321
1348
  return incoming.map((item, index) => {
1322
1349
  const twin = stored[index];
1323
1350
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
1324
- if (isRecord$2(item) && isRecord$2(twin)) return inArrayRow(pass, item, twin);
1351
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
1325
1352
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
1326
1353
  return item;
1327
1354
  });
@@ -1332,7 +1359,7 @@ function inArrayRow(pass, incoming, stored) {
1332
1359
  const twin = stored[key];
1333
1360
  if (isSecretMarker(twin)) {
1334
1361
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
1335
- } else if (isRecord$2(value) && isRecord$2(twin)) out[key] = inArrayRow(pass, value, twin);
1362
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
1336
1363
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
1337
1364
  }
1338
1365
  return out;
@@ -1340,7 +1367,7 @@ function inArrayRow(pass, incoming, stored) {
1340
1367
  async function walk(pass, incoming, stored) {
1341
1368
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
1342
1369
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
1343
- if (!isRecord$2(incoming) || !isRecord$2(stored)) return incoming;
1370
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
1344
1371
  const out = { ...incoming };
1345
1372
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
1346
1373
  return out;
@@ -1371,7 +1398,7 @@ async function restoreUnchangedSecrets(input) {
1371
1398
  function isJsonEqual(a, b) {
1372
1399
  if (Object.is(a, b)) return true;
1373
1400
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
1374
- if (isRecord$2(a) && isRecord$2(b)) {
1401
+ if (isRecord$3(a) && isRecord$3(b)) {
1375
1402
  const keys = Object.keys(a);
1376
1403
  if (keys.length !== Object.keys(b).length) return false;
1377
1404
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -1395,7 +1422,7 @@ function markerKeysOf(blob, owner) {
1395
1422
  }
1396
1423
  function nodeFromStored(value, owner) {
1397
1424
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
1398
- if (!isRecord$2(value)) return null;
1425
+ if (!isRecord$3(value)) return null;
1399
1426
  const children = /* @__PURE__ */ new Map();
1400
1427
  for (const [key, child] of Object.entries(value)) {
1401
1428
  const node = nodeFromStored(child, owner);
@@ -2202,7 +2229,7 @@ var BaseAddon = class {
2202
2229
  if (!ctx) return;
2203
2230
  const addonId = ctx.id;
2204
2231
  setImmediate(() => {
2205
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
2232
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
2206
2233
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
2207
2234
  }).catch((err) => {
2208
2235
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -3359,7 +3386,11 @@ function asRecordsError(err) {
3359
3386
  */
3360
3387
  var SECRET_META = { secret: true };
3361
3388
  function defOf(schema) {
3362
- return schema._zod?.def ?? {};
3389
+ const zodBag = Reflect.get(schema, "_zod");
3390
+ if (typeof zodBag !== "object" || zodBag === null) return {};
3391
+ const def = Reflect.get(zodBag, "def");
3392
+ if (typeof def !== "object" || def === null) return {};
3393
+ return def;
3363
3394
  }
3364
3395
  function declaredHere(schema) {
3365
3396
  return z.globalRegistry.get(schema)?.secret === true;
@@ -3459,11 +3490,11 @@ function secretArrayPrefixes(path) {
3459
3490
  }
3460
3491
  return prefixes;
3461
3492
  }
3462
- function isRecord$1(value) {
3493
+ function isRecord$2(value) {
3463
3494
  return typeof value === "object" && value !== null && !Array.isArray(value);
3464
3495
  }
3465
3496
  function elementId(element, idKey, declared, prefix) {
3466
- const id = isRecord$1(element) ? element[idKey] : void 0;
3497
+ const id = isRecord$2(element) ? element[idKey] : void 0;
3467
3498
  if (typeof id !== "string" || id.length === 0) throw new InvalidRecordError(`"${declared}": every element of "${prefix}" needs a non-empty string "${idKey}" to carry a secret`);
3468
3499
  return id;
3469
3500
  }
@@ -3474,7 +3505,7 @@ function elementId(element, idKey, declared, prefix) {
3474
3505
  */
3475
3506
  var REMOVE_LEAF = Symbol("remove-leaf");
3476
3507
  function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
3477
- if (!isRecord$1(node)) return node;
3508
+ if (!isRecord$2(node)) return node;
3478
3509
  const segment = segments[index];
3479
3510
  if (segment === void 0) return node;
3480
3511
  if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
@@ -3711,7 +3742,7 @@ function declarationsOf(kinds) {
3711
3742
  }
3712
3743
  //#endregion
3713
3744
  //#region src/records/records-access.ts
3714
- function isRecord(value) {
3745
+ function isRecord$1(value) {
3715
3746
  return typeof value === "object" && value !== null && !Array.isArray(value);
3716
3747
  }
3717
3748
  /** Run a transport call and give a wire failure its typed class back. */
@@ -3836,7 +3867,7 @@ var KindHandle = class {
3836
3867
  }) : data;
3837
3868
  const parsed = this.def.schema.safeParse(shaped);
3838
3869
  if (!parsed.success) throw new InvalidRecordError(`${this.name}/${id}: ${zodSummary(parsed.error)}`);
3839
- if (!isRecord(parsed.data)) throw new InvalidRecordError(`${this.name}/${id}: the body must be an object`);
3870
+ if (!isRecord$1(parsed.data)) throw new InvalidRecordError(`${this.name}/${id}: the body must be an object`);
3840
3871
  return parsed.data;
3841
3872
  }
3842
3873
  async get(id) {
@@ -4005,7 +4036,7 @@ var KindHandle = class {
4005
4036
  }
4006
4037
  };
4007
4038
  function toBody(value) {
4008
- if (!isRecord(value)) throw new InvalidRecordError("the record body must be an object");
4039
+ if (!isRecord$1(value)) throw new InvalidRecordError("the record body must be an object");
4009
4040
  return value;
4010
4041
  }
4011
4042
  /** Build the owner's records handle. */
@@ -4097,6 +4128,318 @@ function defineEntryKind(name, spec) {
4097
4128
  return defined;
4098
4129
  }
4099
4130
  //#endregion
4131
+ //#region src/records/settings-brokers-adopts-from.ts
4132
+ /**
4133
+ * Legacy source for broker entry adoption (B2): brokers live in addon-settings
4134
+ * as one row `<addonId>.brokers` whose value is an array until records-adopt
4135
+ * copies them into the entry kind.
4136
+ */
4137
+ var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
4138
+ /** The `adoptsFrom` value for an addon's broker entry kind. */
4139
+ function settingsBrokersAdoptsFrom(addonId) {
4140
+ return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
4141
+ }
4142
+ /** When non-null, `from` names an addon-settings brokers blob, not a SQL table. */
4143
+ function parseSettingsBrokersAdoptsFrom(from) {
4144
+ if (!from.startsWith("@settings-brokers/")) return null;
4145
+ const addonId = from.slice(18);
4146
+ return addonId.length > 0 ? addonId : null;
4147
+ }
4148
+ //#endregion
4149
+ //#region src/records/settings-array-adopts-from.ts
4150
+ /**
4151
+ * Legacy source for entry adoption (B3): a list stored under addon-settings
4152
+ * `<addonId>.<key>` until records-adopt copies rows into the entry kind.
4153
+ */
4154
+ var SETTINGS_ARRAY_ADOPTS_PREFIX = "@settings-array/";
4155
+ /** The `adoptsFrom` value for an addon-settings array field. */
4156
+ function settingsArrayAdoptsFrom(addonId, settingsKey) {
4157
+ return `${SETTINGS_ARRAY_ADOPTS_PREFIX}${addonId}/${settingsKey}`;
4158
+ }
4159
+ /** When non-null, `from` names an addon-settings array blob, not a SQL table. */
4160
+ function parseSettingsArrayAdoptsFrom(from) {
4161
+ if (!from.startsWith("@settings-array/")) return null;
4162
+ const rest = from.slice(16);
4163
+ const slash = rest.indexOf("/");
4164
+ if (slash <= 0 || slash >= rest.length - 1) return null;
4165
+ const addonId = rest.slice(0, slash);
4166
+ const settingsKey = rest.slice(slash + 1);
4167
+ if (addonId.length === 0 || settingsKey.length === 0) return null;
4168
+ return {
4169
+ addonId,
4170
+ settingsKey
4171
+ };
4172
+ }
4173
+ //#endregion
4174
+ //#region src/records/in-memory-records.ts
4175
+ /**
4176
+ * In-memory `RecordsAccess` for specs. Kinds are declared by the caller.
4177
+ * Lives in `@camstack/types` so a spec does not import another package's source.
4178
+ */
4179
+ function isRecord(value) {
4180
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4181
+ }
4182
+ function markersOf(decl, body) {
4183
+ const out = /* @__PURE__ */ new Map();
4184
+ mapSecretLeaves(body, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
4185
+ if (isSecretMarker(leaf.value)) out.set(leaf.concrete, leaf.value.$secret);
4186
+ return leaf.value;
4187
+ });
4188
+ return out;
4189
+ }
4190
+ function makeSpecKeychain(owner) {
4191
+ const values = /* @__PURE__ */ new Map();
4192
+ return { access: {
4193
+ owner,
4194
+ ref: (scope, fieldPath) => buildSecretRef({
4195
+ owner,
4196
+ scope,
4197
+ fieldPath
4198
+ }),
4199
+ resolve: async (refs) => {
4200
+ const out = {};
4201
+ for (const ref of refs) {
4202
+ const value = values.get(ref);
4203
+ out[ref] = value === void 0 ? { kind: "missing" } : {
4204
+ kind: "value",
4205
+ value,
4206
+ version: 1
4207
+ };
4208
+ }
4209
+ return out;
4210
+ },
4211
+ put: async (ref, value) => {
4212
+ values.set(ref, value);
4213
+ return 1;
4214
+ },
4215
+ delete: async (refs) => {
4216
+ let deleted = 0;
4217
+ for (const ref of refs) if (values.delete(ref)) deleted += 1;
4218
+ return deleted;
4219
+ },
4220
+ state: async () => ({ state: "ready" }),
4221
+ onChange: () => () => void 0,
4222
+ forOwner: null
4223
+ } };
4224
+ }
4225
+ function makeInMemoryRecords(owner = "spec") {
4226
+ const decls = /* @__PURE__ */ new Map();
4227
+ const tables = /* @__PURE__ */ new Map();
4228
+ let clock = 1;
4229
+ let writesFail = false;
4230
+ let readsFail = false;
4231
+ const table = (kind) => {
4232
+ let t = tables.get(kind);
4233
+ if (t === void 0) {
4234
+ t = /* @__PURE__ */ new Map();
4235
+ tables.set(kind, t);
4236
+ }
4237
+ return t;
4238
+ };
4239
+ const declOf = (kind) => {
4240
+ const decl = decls.get(kind);
4241
+ if (decl === void 0) throw new Error(`kind "${kind}" is not declared`);
4242
+ return decl;
4243
+ };
4244
+ const redact = (decl, body) => {
4245
+ if (decl.secretPaths.length === 0) return body;
4246
+ const out = mapSecretLeaves(body, decl.secretPaths, decl.secretArrayKeys, (leaf) => leaf.value === null ? null : REDACTED_SECRET);
4247
+ return isRecord(out) ? out : body;
4248
+ };
4249
+ const view = (kind, row) => ({
4250
+ id: row.id,
4251
+ deviceId: null,
4252
+ at: row.at,
4253
+ expiresAt: null,
4254
+ rev: row.rev,
4255
+ updatedAt: row.updatedAt,
4256
+ data: redact(declOf(kind), row.data)
4257
+ });
4258
+ const enforce = (kind, id, body, stored) => {
4259
+ const decl = declOf(kind);
4260
+ if (decl.secretPaths.length === 0) return {
4261
+ body,
4262
+ released: []
4263
+ };
4264
+ const before = stored === null ? /* @__PURE__ */ new Map() : markersOf(decl, stored);
4265
+ const next = mapSecretLeaves(body, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
4266
+ const expected = recordSecretRef(owner, kind, id, leaf.concrete);
4267
+ if (isSecretMarker(leaf.value)) {
4268
+ if (leaf.value.$secret !== expected) throw new Error("foreign secret marker");
4269
+ return leaf.value;
4270
+ }
4271
+ if (leaf.value === "__camstack_redacted__") {
4272
+ const keep = before.get(leaf.concrete);
4273
+ return keep === void 0 ? REMOVE_LEAF : {
4274
+ $secret: keep,
4275
+ v: 1
4276
+ };
4277
+ }
4278
+ if (leaf.value === null || leaf.value === void 0) return REMOVE_LEAF;
4279
+ throw new Error(`${kind}/${id}: a secret field takes a keychain marker, never a value`);
4280
+ });
4281
+ if (!isRecord(next)) throw new Error("the body must be an object");
4282
+ const after = markersOf(decl, next);
4283
+ return {
4284
+ body: next,
4285
+ released: [...before.entries()].filter(([p, ref]) => after.get(p) !== ref).map(([, r]) => r)
4286
+ };
4287
+ };
4288
+ const write = (kind, input) => {
4289
+ if (writesFail) throw new Error("records engine unreachable");
4290
+ if (declOf(kind).at === "required" && input.at === void 0) throw new Error(`${kind}/${input.id}: the kind needs "at" on every write`);
4291
+ const prev = table(kind).get(input.id);
4292
+ const { body, released } = enforce(kind, input.id, input.data, prev?.data ?? null);
4293
+ const rev = (prev?.rev ?? 0) + 1;
4294
+ clock += 1;
4295
+ table(kind).set(input.id, {
4296
+ id: input.id,
4297
+ at: input.at ?? null,
4298
+ rev,
4299
+ updatedAt: clock,
4300
+ data: body
4301
+ });
4302
+ return {
4303
+ rev,
4304
+ released
4305
+ };
4306
+ };
4307
+ const unimplemented = (op) => {
4308
+ throw new Error(`the fake records transport does not implement ${op}`);
4309
+ };
4310
+ return {
4311
+ records: createRecordsAccess({
4312
+ owner,
4313
+ transport: {
4314
+ declareKinds: async ({ kinds }) => {
4315
+ const out = {};
4316
+ let n = 0;
4317
+ for (const [name, decl] of Object.entries(kinds)) {
4318
+ decls.set(name, decl);
4319
+ n += 1;
4320
+ out[name] = {
4321
+ kindId: n,
4322
+ state: "created",
4323
+ createdIndexes: decl.indexes.map((i) => i.name),
4324
+ adoptionPending: null
4325
+ };
4326
+ }
4327
+ return { kinds: out };
4328
+ },
4329
+ get: async ({ kind, id }) => {
4330
+ if (readsFail) throw new Error("records engine unreachable");
4331
+ const row = table(kind).get(id);
4332
+ return row === void 0 ? null : view(kind, row);
4333
+ },
4334
+ getMany: async ({ kind, ids }) => ids.flatMap((id) => {
4335
+ const row = table(kind).get(id);
4336
+ return row === void 0 ? [] : [view(kind, row)];
4337
+ }),
4338
+ secretRefs: async ({ kind, ids }) => {
4339
+ const decl = declOf(kind);
4340
+ const out = {};
4341
+ for (const id of ids) {
4342
+ const row = table(kind).get(id);
4343
+ if (row !== void 0) out[id] = Object.fromEntries(markersOf(decl, row.data));
4344
+ }
4345
+ return out;
4346
+ },
4347
+ put: async ({ kind, record, ifRev }) => {
4348
+ if (ifRev !== void 0 && (table(kind).get(record.id)?.rev ?? 0) !== ifRev) throw new Error("stale ifRev");
4349
+ const { rev, released } = write(kind, record);
4350
+ return {
4351
+ rev,
4352
+ releasedRefs: released
4353
+ };
4354
+ },
4355
+ putMany: async ({ kind, records }) => {
4356
+ const released = [];
4357
+ for (const record of records) released.push(...write(kind, record).released);
4358
+ return {
4359
+ count: records.length,
4360
+ releasedRefs: released
4361
+ };
4362
+ },
4363
+ patch: async () => unimplemented("patch"),
4364
+ delete: async ({ kind, id }) => {
4365
+ if (writesFail) throw new Error("records engine unreachable");
4366
+ const row = table(kind).get(id);
4367
+ if (row === void 0) return {
4368
+ deleted: false,
4369
+ secretRefs: []
4370
+ };
4371
+ table(kind).delete(id);
4372
+ return {
4373
+ deleted: true,
4374
+ secretRefs: [...markersOf(declOf(kind), row.data).values()]
4375
+ };
4376
+ },
4377
+ deleteMany: async ({ kind, ids }) => {
4378
+ let deleted = 0;
4379
+ const refs = [];
4380
+ for (const id of ids) {
4381
+ const row = table(kind).get(id);
4382
+ if (row === void 0) continue;
4383
+ table(kind).delete(id);
4384
+ deleted += 1;
4385
+ refs.push(...markersOf(declOf(kind), row.data).values());
4386
+ }
4387
+ return {
4388
+ deleted,
4389
+ secretRefs: refs
4390
+ };
4391
+ },
4392
+ query: async (q) => {
4393
+ if (readsFail) throw new Error("records engine unreachable");
4394
+ const decl = declOf(q.kind);
4395
+ const asked = Object.keys(q.where ?? {});
4396
+ if (asked.length > 0) {
4397
+ if (!decl.indexes.some((index) => {
4398
+ const leading = new Set(index.fields.slice(0, asked.length));
4399
+ return asked.length <= index.fields.length && asked.every((f) => leading.has(f));
4400
+ })) throw new Error(`${q.kind}: no declared index serves [${asked.join(", ")}]`);
4401
+ }
4402
+ let rows = [...table(q.kind).values()];
4403
+ for (const [field, wanted] of Object.entries(q.where ?? {})) rows = rows.filter((r) => r.data[field] === wanted);
4404
+ const byAt = q.order === "at" || q.order === void 0 && decl.at === "required";
4405
+ rows.sort((a, b) => byAt ? (a.at ?? 0) - (b.at ?? 0) : a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
4406
+ if (q.desc === true) rows.reverse();
4407
+ const start = q.cursor === void 0 ? 0 : Number(q.cursor);
4408
+ const page = rows.slice(start, start + q.limit);
4409
+ const more = start + q.limit < rows.length;
4410
+ return {
4411
+ records: page.map((r) => view(q.kind, r)),
4412
+ nextCursor: more ? String(start + q.limit) : null
4413
+ };
4414
+ },
4415
+ count: async ({ kind }) => ({ count: table(kind).size }),
4416
+ histogram: async () => unimplemented("histogram"),
4417
+ aggregate: async () => unimplemented("aggregate"),
4418
+ deleteWhere: async () => unimplemented("deleteWhere"),
4419
+ deleteDevice: async () => unimplemented("deleteDevice"),
4420
+ allocateId: async () => unimplemented("allocateId")
4421
+ },
4422
+ secrets: makeSpecKeychain(owner).access
4423
+ }),
4424
+ tables,
4425
+ failWrites: (on) => {
4426
+ writesFail = on;
4427
+ },
4428
+ failReads: (on) => {
4429
+ readsFail = on;
4430
+ },
4431
+ seed: (kind, row) => {
4432
+ table(kind).set(row.id, {
4433
+ id: row.id,
4434
+ at: row.at ?? null,
4435
+ rev: 1,
4436
+ updatedAt: 1,
4437
+ data: row.data
4438
+ });
4439
+ }
4440
+ };
4441
+ }
4442
+ //#endregion
4100
4443
  //#region src/capabilities/schemas/streaming-shared.ts
4101
4444
  /** Shared Zod schemas used across streaming capabilities. */
4102
4445
  var CamProfileSchema = z.enum([
@@ -5256,6 +5599,30 @@ function describeCustomActions(catalog) {
5256
5599
  return out;
5257
5600
  }
5258
5601
  //#endregion
5602
+ //#region src/capabilities/caller-stamp.ts
5603
+ /**
5604
+ * Every cap whose provider reads a `callerAddonId` in its input (the keychain's
5605
+ * owner check, device-history's `not-owner`, records' owner).
5606
+ *
5607
+ * The stamp is set ONLY by the transport (`stampCallerAddonId`, or stated by a
5608
+ * hub in-process caller). The generated HTTP/tRPC mount parses input with
5609
+ * `.loose()`, so without this a session could add the key itself and act as
5610
+ * another addon. The mount strips it for these caps.
5611
+ */
5612
+ var CALLER_STAMPED_CAPABILITIES = [
5613
+ "keychain",
5614
+ "device-history",
5615
+ "records",
5616
+ "integrations",
5617
+ "device-manager"
5618
+ ];
5619
+ /** A copy of `input` without the caller stamp. Anything that is not a plain object passes through. */
5620
+ function withoutCallerStamp(input) {
5621
+ if (input === null || typeof input !== "object" || Array.isArray(input)) return input;
5622
+ if (!Object.prototype.hasOwnProperty.call(input, "callerAddonId")) return input;
5623
+ return Object.fromEntries(Object.entries(input).filter(([key]) => key !== "callerAddonId"));
5624
+ }
5625
+ //#endregion
5259
5626
  //#region src/device/children-batch-max.ts
5260
5627
  /**
5261
5628
  * Most parents one `getChildrenBatch` may name.
@@ -5758,6 +6125,50 @@ function isSource(x) {
5758
6125
  return typeof x.read === "function" && typeof x.watch === "function";
5759
6126
  }
5760
6127
  //#endregion
6128
+ //#region src/helpers/addon-slice-handle.ts
6129
+ /** Structural bridge: every `AddonApi` client carries `deviceState` (+ optional `live`). */
6130
+ function addonSliceHandleApi(api) {
6131
+ return api;
6132
+ }
6133
+ //#endregion
6134
+ //#region src/helpers/trpc-leaf.ts
6135
+ function isTrpcProcedureLeaf(value) {
6136
+ if (typeof value !== "object" || value === null) return false;
6137
+ const record = value;
6138
+ return (typeof record.query === "function" || typeof record.mutate === "function" || typeof record.subscribe === "function") && !Array.isArray(value);
6139
+ }
6140
+ function readCapRecord(api, capProp) {
6141
+ const cap = Reflect.get(api, capProp);
6142
+ if (typeof cap !== "object" || cap === null || Array.isArray(cap)) return void 0;
6143
+ return cap;
6144
+ }
6145
+ function readTrpcLeaf(api, capProp, method) {
6146
+ const capRecord = readCapRecord(api, capProp);
6147
+ if (!capRecord) throw new Error(`tRPC client has no router '${capProp}'`);
6148
+ const leaf = capRecord[method];
6149
+ if (!isTrpcProcedureLeaf(leaf)) throw new Error(`tRPC client has no '${capProp}.${method}'`);
6150
+ return leaf;
6151
+ }
6152
+ /**
6153
+ * Invoke `api.<capProp>.<method>.{query|mutate|subscribe}(input)`.
6154
+ * `Result` is the generated proxy method's return. The leaf itself is only
6155
+ * `unknown` (the client is a structural bag), so the assertion is the one
6156
+ * boundary between that bag and the typed proxy.
6157
+ */
6158
+ function invokeTrpcLeaf(api, capProp, method, kind, input, push) {
6159
+ const fn = readTrpcLeaf(api, capProp, method);
6160
+ if (kind === "mutation") {
6161
+ if (typeof fn.mutate !== "function") throw new Error(`tRPC '${capProp}.${method}' has no mutate()`);
6162
+ return fn.mutate(input);
6163
+ }
6164
+ if (kind === "subscription") {
6165
+ if (typeof fn.subscribe !== "function") throw new Error(`tRPC '${capProp}.${method}' has no subscribe()`);
6166
+ return fn.subscribe(input, push);
6167
+ }
6168
+ if (typeof fn.query !== "function") throw new Error(`tRPC '${capProp}.${method}' has no query()`);
6169
+ return fn.query(input);
6170
+ }
6171
+ //#endregion
5761
6172
  //#region src/generated/device-proxy.ts
5762
6173
  /**
5763
6174
  * Build a DeviceProxy that pre-binds deviceId + nodeId on every method call
@@ -5775,8 +6186,7 @@ function isSource(x) {
5775
6186
  * field on the returned object.
5776
6187
  */
5777
6188
  function createDeviceProxy(api, binding, opts) {
5778
- const typedApi = api;
5779
- const stateSource = opts?.stateSource ?? createLazyTrpcSource(api);
6189
+ const stateSource = opts?.stateSource ?? createLazyTrpcSource(addonSliceHandleApi(api));
5780
6190
  /** Merge `{deviceId, nodeId?}` into the caller-supplied input. */
5781
6191
  function mergeInput(input, nodeId) {
5782
6192
  const base = typeof input === "object" && input !== null ? input : {};
@@ -5789,20 +6199,8 @@ function createDeviceProxy(api, binding, opts) {
5789
6199
  deviceId: binding.deviceId
5790
6200
  };
5791
6201
  }
5792
- /**
5793
- * Invoke `api.<capProp>.<method>.{query|mutate|subscribe}(merged)`.
5794
- * Returns `any` so the caller-side per-method declaration assigns
5795
- * cleanly into the strongly-typed `InferDeviceProxyCap<...>` shape on
5796
- * the `DeviceProxy` interface — the proxy's contract is enforced by
5797
- * the interface, not the dispatch helper.
5798
- */
5799
6202
  function callLeaf(capProp, method, kind, merged, push) {
5800
- const leaf = typedApi[capProp]?.[method];
5801
- if (!leaf) throw new Error(`DeviceProxy: api has no '${capProp}.${method}'`);
5802
- const fn = leaf;
5803
- if (kind === "mutation") return fn.mutate(merged);
5804
- if (kind === "subscription") return fn.subscribe(merged, push);
5805
- return fn.query(merged);
6203
+ return invokeTrpcLeaf(api, capProp, method, kind, merged, push);
5806
6204
  }
5807
6205
  /**
5808
6206
  * Device-scoped cap dispatch. Looks up the binding entry for `capName`
@@ -7074,4 +7472,4 @@ function sleepCancellable(ms, signal) {
7074
7472
  });
7075
7473
  }
7076
7474
  //#endregion
7077
- export { nodePin as $, mergeSecretStatePaths as $n, AdoptionPendingError as $t, RawStateResultSchema as A, RECORD_SETTINGS_MAX_ROWS as An, isSecretFieldView as Ar, defineEntryKind as At, DEVICE_SETTINGS_CONTRIBUTION_METHODS as B, scrubKnownSecrets as Bn, schemaDeclaresAnyField as Br, declarationsOf as Bt, createLazyTrpcSource as C, RECORD_DELETE_BATCH as Cn, collectHydratedFieldEntries as Cr, StreamSourceSchema as Ct, HF_BASE_URL as D, RECORD_MAX_INDEX_FIELDS as Dn, SECRET_CLEAR as Dr, makeSourceBrokerId as Dt, DEFAULT_TOKEN_EXPIRY as E, RECORD_MAX_INDEXES as En, resolveHydratedFieldValue as Er, makeProfileBrokerId as Et, defineCustomActions as F, MIN_SCRUBBED_LENGTH as Fn, REDACTED_SECRET as Fr, RecordIndexSchema as Ft, event as G, PEER_BYTES_TICKET_TTL_MS as Gn, parseSecretPath as Gt, HISTORY_DEFAULT_MIN_INTERVAL_MS as H, PEER_BYTES_CHUNK_BYTES as Hn, audioChunkBytesPerSample as Hr, REMOVE_LEAF as Ht, describeCustomActions as I, clearKnownSecrets as In, collectKeychainStoredKeys as Ir, RecordKindDeclarationSchema as It, method as J, SHARE_VIEW_KINDS as Jn, recordSecretRef as Jt, expandCapMethods as K, PeerBytesTicketSchema as Kn, recordArrayItemPath as Kt, deviceCustomAction as L, forgetKnownSecret as Ln, collectSecretConfigKeys as Lr, RecordKindNameSchema as Lt, viewerUiCapability as M, resolveSecretViewsIn as Mn, isSecretMarkerLike as Mr, createRecordsAccess as Mt, DEVICE_CHILDREN_BATCH_MAX as N, REVALIDATE_AFTER_MS as Nn, makeSecretMarker as Nr, EntryDescriptorSchema as Nt, HF_REPO as O, RECORD_QUERY_MAX as On, classifySecretWrite as Or, parseProfileBrokerId as Ot, customAction as P, createSecretsAccess as Pn, toSecretFieldView as Pr, RecordFieldPathSchema as Pt, CAP_NODE_PIN_CONTEXT_KEY as Q, normalizeAddonInitResult as Qn, isZodSecret as Qt, adminUiCapability as R, knownSecretCount as Rn, isKeychainStoredField as Rr, RecordRetentionSchema as Rt, createEventBusSliceSource as S, RECORD_DEFAULT_MAX_DATA_BYTES as Sn, WELL_KNOWN_TAB_MAP as Sr, StreamSourceEntrySchema$1 as St, createSliceHandle as T, RECORD_MAX_DATA_BYTES as Tn, hydrateSchema as Tr, SubscribeAudioChunksResultSchema as Tt, HISTORY_UNIT_LABELS as U, PEER_BYTES_MAX_OUTSTANDING as Un, expandAudioChunkToF32le as Ur, collectSecretLeaves as Ut, DEVICE_STATUS_METHOD as V, shortSecretRefHash as Vn, AUDIO_CHUNK_FORMATS as Vr, defineRecordKinds as Vt, PROVIDER_PIN_FIELD as W, PEER_BYTES_STALL_MS as Wn, isAudioChunkFormat as Wr, mapSecretLeaves as Wt, resolveCapMount as X, BaseAddon as Xn, SECRET_META as Xt, optionalMethod as Y, DisposerChain as Yn, secretArrayPrefixes as Yt, systemMethod as Z, classifyStoreError as Zn, collectZodSecretPaths as Zt, readErrorI18n as _, recordsErrorFromMessage as _n, createDurableState as _r, DecodedAudioChunkSchema as _t, asJsonArray as a, NoCallerError as an, isSecretRefOwnedBy as ar, emitDownForOwnedCaps as at, isDeviceScopedCap as b, RECORD_CLASSES as bn, isEvent as br, ProfileSlotSchema as bt, asString as c, RecordNotFoundError as cn, SECRET_REF_SCHEME as cr, AudioChunkFormatSchema as ct, parseJsonUnknown as d, RecordUniqueViolationError as dn, formatSecretScope as dr, BrokerStatusSchema as dt, BatchTooLargeError as en, parseSecretStatePath as er, readNodePin as et, hfModelUrl as f, RecordsError as fn, globalSecretScope as fr, CAM_PROFILE_ORDER as ft, ErrorI18nPayloadSchema as g, asRecordsError as gn, normalizeNodeId as gr, CameraStreamSchema as gt, ErrorCodeSchema as h, UnknownRecordKindError as hn, parseSecretRef as hr, CamStreamResolutionSchema as ht, asBoolean as i, InvalidRecordError as in, collectSecretMarkerRefs as ir, ReadinessTimeoutError as it, deviceOpsCapability as j, RECORD_SWEEP_INTERVAL_MS as jn, isSecretMarker as jr, entryBody as jt, RUNTIME_DEFAULTS as k, RECORD_SECRET_COLLECTION_PREFIX as kn, isSecretClear as kr, selectAssignedProfileSlots as kt, parseJsonArray as l, RecordSecretUnavailableError as ln, arrayItemFieldPath as lr, AudioStreamPickSchema as lt, CamstackError as m, UnindexedFilterError as mn, normalizeSecretOwner as mr, CamStreamKindSchema as mt, sleepCancellable as n, FilterRequiredError as nn, secretTreeFromSchema as nr, MODEL_FORMATS as nt, asJsonObject as o, PlaintextSecretError as on, resolveSecretMarkers as or, readinessKey as ot, BOOT_RECOVERY_BACKOFF_MS as p, RevConflictError as pn, isSecretRef as pr, CamProfileSchema as pt, isDeviceConfigCap as q, DATAPLANE_SECRET_HEADER as qn, recordSecretCollection as qt, maskUrlCredentials as r, ForeignSecretMarkerError as rn, KeychainWriteRefusedError as rr, ReadinessRegistry as rt, asNumber as s, RECORDS_ERROR_CODES as sn, transformSecretWrite as sr, scopeKey as st, sleep as t, DeclarationRefusedError as tn, secretTreeFromPaths as tr, toNodeId as tt, parseJsonObject as u, RecordTooLargeError as un, buildSecretRef as ur, BrokerStatsSchema as ut, userError as v, RECORD_BATCH_MAX as vn, createEvent as vr, FrameHandleSchema as vt, createMirrorSource as w, RECORD_ID_MAX_LENGTH as wn, collectHydratedFieldValues as wr, SubscribeAudioChunksInputSchema as wt, createDeviceProxy as x, RECORD_DATABASES as xn, WELL_KNOWN_TABS as xr, ProfileSlotStatusSchema as xt, DEVICE_SCOPED_CAPS as y, RECORD_BATCH_MAX_BYTES as yn, emitReadiness as yr, ProfileRtspEntrySchema as yt, DEFAULT_RUNTIME_STATE_DURABILITY as z, registerKnownSecret as zn, isSecretConfigField as zr, assertValidDeclaration as zt };
7475
+ export { optionalMethod as $, PEER_BYTES_CHUNK_BYTES as $n, schemaDeclaresAnyField as $r, REMOVE_LEAF as $t, HF_REPO as A, RECORD_BATCH_MAX_BYTES as An, emitReadiness as Ar, makeProfileBrokerId as At, describeCustomActions as B, RECORD_SECRET_COLLECTION_PREFIX as Bn, SECRET_CLEAR as Br, settingsBrokersAdoptsFrom as Bt, addonSliceHandleApi as C, RecordsError as Cn, globalSecretScope as Cr, ProfileRtspEntrySchema as Ct, createSliceHandle as D, asRecordsError as Dn, normalizeNodeId as Dr, StreamSourceSchema as Dt, createMirrorSource as E, UnknownRecordKindError as En, parseSecretRef as Er, StreamSourceEntrySchema$1 as Et, DEVICE_CHILDREN_BATCH_MAX as F, RECORD_ID_MAX_LENGTH as Fn, collectHydratedFieldValues as Fr, SETTINGS_ARRAY_ADOPTS_PREFIX as Ft, DEVICE_STATUS_METHOD as G, createSecretsAccess as Gn, isSecretMarkerLike as Gr, RecordFieldPathSchema as Gt, adminUiCapability as H, RECORD_SWEEP_INTERVAL_MS as Hn, isSecretClear as Hr, entryBody as Ht, CALLER_STAMPED_CAPABILITIES as I, RECORD_MAX_DATA_BYTES as In, dehydrateConfigField as Ir, parseSettingsArrayAdoptsFrom as It, PROVIDER_PIN_FIELD as J, forgetKnownSecret as Jn, REDACTED_SECRET as Jr, RecordKindNameSchema as Jt, HISTORY_DEFAULT_MIN_INTERVAL_MS as K, MIN_SCRUBBED_LENGTH as Kn, makeSecretMarker as Kr, RecordIndexSchema as Kt, withoutCallerStamp as L, RECORD_MAX_INDEXES as Ln, dehydrateSchema as Lr, settingsArrayAdoptsFrom as Lt, RawStateResultSchema as M, RECORD_DATABASES as Mn, WELL_KNOWN_TABS as Mr, parseProfileBrokerId as Mt, deviceOpsCapability as N, RECORD_DEFAULT_MAX_DATA_BYTES as Nn, WELL_KNOWN_TAB_MAP as Nr, selectAssignedProfileSlots as Nt, DEFAULT_TOKEN_EXPIRY as O, recordsErrorFromMessage as On, createDurableState as Or, SubscribeAudioChunksInputSchema as Ot, viewerUiCapability as P, RECORD_DELETE_BATCH as Pn, collectHydratedFieldEntries as Pr, makeInMemoryRecords as Pt, method as Q, shortSecretRefHash as Qn, isSecretConfigField as Qr, defineRecordKinds as Qt, customAction as R, RECORD_MAX_INDEX_FIELDS as Rn, hydrateSchema as Rr, SETTINGS_BROKERS_ADOPTS_PREFIX as Rt, invokeTrpcLeaf as S, RecordUniqueViolationError as Sn, formatSecretScope as Sr, FrameHandleSchema as St, createLazyTrpcSource as T, UnindexedFilterError as Tn, normalizeSecretOwner as Tr, ProfileSlotStatusSchema as Tt, DEFAULT_RUNTIME_STATE_DURABILITY as U, resolveSecretViewsIn as Un, isSecretFieldView as Ur, createRecordsAccess as Ut, deviceCustomAction as V, RECORD_SETTINGS_MAX_ROWS as Vn, classifySecretWrite as Vr, defineEntryKind as Vt, DEVICE_SETTINGS_CONTRIBUTION_METHODS as W, REVALIDATE_AFTER_MS as Wn, isSecretMarker as Wr, EntryDescriptorSchema as Wt, expandCapMethods as X, registerKnownSecret as Xn, collectSecretConfigKeys as Xr, assertValidDeclaration as Xt, event as Y, knownSecretCount as Yn, collectKeychainStoredKeys as Yr, RecordRetentionSchema as Yt, isDeviceConfigCap as Z, scrubKnownSecrets as Zn, isKeychainStoredField as Zr, declarationsOf as Zt, readErrorI18n as _, PlaintextSecretError as _n, resolveSecretMarkers as _r, CamProfileSchema as _t, asJsonArray as a, recordSecretRef as an, SHARE_VIEW_KINDS as ar, toNodeId as at, isDeviceScopedCap as b, RecordSecretUnavailableError as bn, arrayItemFieldPath as br, CameraStreamSchema as bt, asString as c, collectZodSecretPaths as cn, classifyStoreError as cr, ReadinessTimeoutError as ct, parseJsonUnknown as d, BatchTooLargeError as dn, parseSecretStatePath as dr, scopeKey as dt, AUDIO_CHUNK_FORMATS as ei, collectSecretLeaves as en, PEER_BYTES_MAX_OUTSTANDING as er, resolveCapMount as et, hfModelUrl as f, DeclarationRefusedError as fn, secretTreeFromPaths as fr, AudioChunkFormatSchema as ft, ErrorI18nPayloadSchema as g, NoCallerError as gn, isSecretRefOwnedBy as gr, CAM_PROFILE_ORDER as gt, ErrorCodeSchema as h, InvalidRecordError as hn, collectSecretMarkerRefs as hr, BrokerStatusSchema as ht, asBoolean as i, recordSecretCollection as in, DATAPLANE_SECRET_HEADER as ir, readNodePin as it, RUNTIME_DEFAULTS as j, RECORD_CLASSES as jn, isEvent as jr, makeSourceBrokerId as jt, HF_BASE_URL as k, RECORD_BATCH_MAX as kn, createEvent as kr, SubscribeAudioChunksResultSchema as kt, parseJsonArray as l, isZodSecret as ln, normalizeAddonInitResult as lr, emitDownForOwnedCaps as lt, CamstackError as m, ForeignSecretMarkerError as mn, KeychainWriteRefusedError as mr, BrokerStatsSchema as mt, sleepCancellable as n, expandAudioChunkToF32le as ni, parseSecretPath as nn, PEER_BYTES_TICKET_TTL_MS as nr, CAP_NODE_PIN_CONTEXT_KEY as nt, asJsonObject as o, secretArrayPrefixes as on, DisposerChain as or, MODEL_FORMATS as ot, BOOT_RECOVERY_BACKOFF_MS as p, FilterRequiredError as pn, secretTreeFromSchema as pr, AudioStreamPickSchema as pt, HISTORY_UNIT_LABELS as q, clearKnownSecrets as qn, toSecretFieldView as qr, RecordKindDeclarationSchema as qt, maskUrlCredentials as r, isAudioChunkFormat as ri, recordArrayItemPath as rn, PeerBytesTicketSchema as rr, nodePin as rt, asNumber as s, SECRET_META as sn, BaseAddon as sr, ReadinessRegistry as st, sleep as t, audioChunkBytesPerSample as ti, mapSecretLeaves as tn, PEER_BYTES_STALL_MS as tr, systemMethod as tt, parseJsonObject as u, AdoptionPendingError as un, mergeSecretStatePaths as ur, readinessKey as ut, userError as v, RECORDS_ERROR_CODES as vn, transformSecretWrite as vr, CamStreamKindSchema as vt, createEventBusSliceSource as w, RevConflictError as wn, isSecretRef as wr, ProfileSlotSchema as wt, createDeviceProxy as x, RecordTooLargeError as xn, buildSecretRef as xr, DecodedAudioChunkSchema as xt, DEVICE_SCOPED_CAPS as y, RecordNotFoundError as yn, SECRET_REF_SCHEME as yr, CamStreamResolutionSchema as yt, defineCustomActions as z, RECORD_QUERY_MAX as zn, resolveHydratedFieldValue as zr, parseSettingsBrokersAdoptsFrom as zt };