@camstack/addon-post-analysis 1.2.670 → 1.2.671

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 (16) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{clip-model-registry-B3x4Npc9.js → clip-model-registry-BhKHkBsg.js} +542 -545
  3. package/dist/{clip-model-registry-7_dm-x-g.mjs → clip-model-registry-CDLYwWsU.mjs} +542 -545
  4. package/dist/embedding-encoder/index.js +1 -1
  5. package/dist/embedding-encoder/index.mjs +1 -1
  6. package/dist/pipeline-analytics/_stub.js +2 -2
  7. package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-BYaeszka.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-CRWJsnQv.mjs} +2 -2
  8. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-D0SgNf77.mjs +26 -0
  9. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DFMFx1IF.mjs +26 -0
  10. package/dist/pipeline-analytics/{hostInit-CNqHuab6.mjs → hostInit-D503xVER.mjs} +2 -2
  11. package/dist/pipeline-analytics/index.js +67 -2
  12. package/dist/pipeline-analytics/index.mjs +67 -2
  13. package/dist/pipeline-analytics/remoteEntry.js +1 -1
  14. package/package.json +2 -2
  15. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-9HsFj_VL.mjs +0 -26
  16. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Bame_Xen.mjs +0 -26
@@ -6069,7 +6069,7 @@ var ZodIssueCode = {
6069
6069
  var ZodFirstPartyTypeKind;
6070
6070
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6071
6071
  //#endregion
6072
- //#region ../types/dist/sleep-DEZaLbiu.mjs
6072
+ //#region ../types/dist/sleep-BX_MqzUe.mjs
6073
6073
  /**
6074
6074
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6075
6075
  * window to float samples (D455).
@@ -7649,6 +7649,28 @@ var SECRET_RETRY_MAX_MS = 5 * 6e4;
7649
7649
  /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
7650
7650
  var SECRET_CHANGE_DEBOUNCE_MS = 250;
7651
7651
  /**
7652
+ * Pair a catalogue with the function that builds its ports FROM THE MIGRATION API. The one
7653
+ * place a catalogue is bound: a migration reaches nothing a ports binder cannot reach
7654
+ * through `api` (guard `check-migration-ports-surface`).
7655
+ */
7656
+ function migrationSet(catalogue, bindPorts) {
7657
+ return { bind: (api) => defineAddonMigrations(catalogue, bindPorts(api)) };
7658
+ }
7659
+ /** A mixed array is a mistake: the other kind would be dropped without a word. */
7660
+ function refuseMixed(form, kept, dropped) {
7661
+ if (dropped > 0) throw new Error(`runMigrations(${form}): ${dropped} of ${kept + dropped} entries are of the other kind and would be dropped; pass one kind per call`);
7662
+ }
7663
+ function catalogueOf(list) {
7664
+ const kept = list.filter((entry) => !("execute" in entry));
7665
+ refuseMixed("catalogue, (api) => ports", kept.length, list.length - kept.length);
7666
+ return kept;
7667
+ }
7668
+ function boundOf(list) {
7669
+ const kept = list.filter((entry) => "execute" in entry);
7670
+ refuseMixed("bound migrations", kept.length, list.length - kept.length);
7671
+ return kept;
7672
+ }
7673
+ /**
7652
7674
  * Base class for CamStack addons. Eliminates settings boilerplate:
7653
7675
  *
7654
7676
  * - Typed `config` property with automatic resolution from store + defaults
@@ -7815,23 +7837,21 @@ var BaseAddon = class {
7815
7837
  await this.loadScopedSchemas();
7816
7838
  return normalized;
7817
7839
  }
7840
+ async runMigrations(first, second, third) {
7841
+ if (typeof second === "function") return this.runMigrationSets([migrationSet(catalogueOf(first), second)], third);
7842
+ return this.runBound(boundOf(first), second);
7843
+ }
7818
7844
  /**
7819
- * Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
7820
- * engine. Call it at the point of the boot where the data must already have the new
7821
- * shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
7822
- * restored devices — with the catalogue bound to the addon's ports
7823
- * (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
7824
- *
7825
- * An engine that cannot be reached or refuses the catalogue is logged and runs
7826
- * nothing; the boot continues. A migration that FAILED (or was blocked by one)
7827
- * and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
7828
- * serve data whose shape it cannot trust; `tolerate` migrations never do.
7829
- *
7830
- * ALWAYS pass the whole catalogue; a phase that must run only some of it passes
7831
- * `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
7832
- * omitted applied ids "newer").
7845
+ * Several catalogues of ONE owner in one declaration (the engine replaces an owner's
7846
+ * catalogue on every declare, so two calls would each judge the other's ids "newer").
7847
+ * Build each entry with `migrationSet(catalogue, (api) => ports)`.
7833
7848
  */
7834
- async runMigrations(migrations, options) {
7849
+ async runMigrationSets(sets, options) {
7850
+ const api = this.ctx.migrationApi;
7851
+ if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
7852
+ return this.runBound(sets.flatMap((set) => set.bind(api)), options);
7853
+ }
7854
+ async runBound(migrations, options) {
7835
7855
  const api = this.ctx.api.migrations;
7836
7856
  const report = await runAddonMigrations({
7837
7857
  declareOwner: (input) => api.declareOwner.mutate(input),
@@ -9236,6 +9256,20 @@ function defineRecordKinds(specs) {
9236
9256
  }
9237
9257
  return out;
9238
9258
  }
9259
+ /**
9260
+ * Entry kinds (D881): every list of user-created entries (notification
9261
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
9262
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
9263
+ * through the `record-entries` capability with password fields derived from
9264
+ * the schema (`.meta({ secret: true })`).
9265
+ */
9266
+ /** The body of a plain entry: a name and the fields the kind adds. */
9267
+ function entryBody(shape) {
9268
+ return object({
9269
+ name: string().min(1),
9270
+ ...shape
9271
+ });
9272
+ }
9239
9273
  object({
9240
9274
  field: string().min(1),
9241
9275
  on: literal("advance")
@@ -16264,6 +16298,39 @@ var UnstampedEventMediaCountSchema = object({
16264
16298
  /** Sum across both, or `null` when either lane could not be counted. */
16265
16299
  total: number().int().nonnegative().nullable()
16266
16300
  }).nullable();
16301
+ /**
16302
+ * Where the stored event media sits, per storage location: how many media rows
16303
+ * and how many bytes carry each location id, how many carry none (legacy,
16304
+ * resolved to the default `eventMedia` location), and how many name a location
16305
+ * that was not asked about (a deleted or never-listed one).
16306
+ *
16307
+ * One covering-index aggregate per asked location plus the NULL one, and one
16308
+ * unfiltered total that scans the covering index: O(rows), not a walk of the
16309
+ * rows themselves. `unlisted` is total minus the ASKED locations minus NULL, so
16310
+ * it is a deleted location only when every location id was asked.
16311
+ * `null` is "could not be measured", never zero.
16312
+ */
16313
+ var MediaLocationCensusInputSchema = object({ locationIds: array(string().min(1)).max(50).readonly() });
16314
+ var MediaLocationCensusSchema = object({
16315
+ locations: array(object({
16316
+ locationId: string(),
16317
+ rows: number().int().nonnegative(),
16318
+ bytes: number().nonnegative()
16319
+ })).readonly(),
16320
+ unstamped: object({
16321
+ rows: number().int().nonnegative(),
16322
+ bytes: number().nonnegative()
16323
+ }),
16324
+ /** Rows stamped with a location id that was not in the asked list. */
16325
+ unlisted: object({
16326
+ rows: number().int().nonnegative(),
16327
+ bytes: number().nonnegative()
16328
+ }),
16329
+ total: object({
16330
+ rows: number().int().nonnegative(),
16331
+ bytes: number().nonnegative()
16332
+ })
16333
+ });
16267
16334
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
16268
16335
  /** The independently selectable logical storage classes — every class
16269
16336
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -47843,52 +47910,7 @@ onBrightnessChanged: { data: object({
47843
47910
  minIntervalMs: 0
47844
47911
  } } }
47845
47912
  };
47846
- /**
47847
- * `broker` — unified pub/sub broker registry, system-scoped collection.
47848
- *
47849
- * The cap models any kind-tagged message broker the user wants to
47850
- * register and that other addons might consume. The first two kinds
47851
- * are MQTT (mosquitto / aedes embedded / cloud bridge) and
47852
- * Home Assistant (HA WebSocket — subscribe_entities + call_service).
47853
- * Future kinds (Zigbee2MQTT bridge, ZHA, KNX, Telegram, …) plug in
47854
- * the same surface.
47855
- *
47856
- * Why one cap, not one cap per kind:
47857
- * - The integrations page wants a single table of "every broker"
47858
- * across kinds; a unified cap drives it without join logic.
47859
- * - Generic admin operations (add / remove / test / status) are
47860
- * identical across kinds — duplicating them per cap was busywork.
47861
- * - The `network-access` cap precedent: same interface, many
47862
- * `providerKind: 'ingress'` implementations (Tailscale, ngrok, …).
47863
- *
47864
- * What stays kind-specific:
47865
- * - `getBrokerConfig` payload (kind decides whether it returns
47866
- * mqtt URL+creds, HA baseUrl+token, …) — typed as
47867
- * `Record<string, unknown>` at the wire; consumers narrow.
47868
- * - `publish` / `subscribe` / `getState` arguments (target / filter /
47869
- * key) — also typed as `Record<string, unknown>` so each kind can
47870
- * evolve its surface (MQTT topic+qos vs HA entity_id+domain)
47871
- * without rebreaking the cap signature.
47872
- * - `add` `settings` payload (different fields per kind, validated by
47873
- * the kind-specific provider).
47874
- *
47875
- * Bidirectionality:
47876
- * - `publish` is RPC — synchronous result (provider-defined).
47877
- * - `subscribe` returns a subscription handle; the actual message
47878
- * stream flows over the typed event-bus as `broker.message` events
47879
- * keyed by `(brokerId, subscriptionId)`. Consumers filter in their
47880
- * event handler. Subscriptions persist across reconnects — the
47881
- * provider re-subscribes upstream after a transport drop.
47882
- *
47883
- * Why event-bus push (not a subscription RPC stream):
47884
- * - Matches the rest of CamStack's D8 contract — events for telemetry,
47885
- * RPC for loss-is-a-bug. Broker messages are telemetry (a single
47886
- * drop is recoverable via `getState({key})`).
47887
- * - Frees `broker.subscribe` from holding a long-lived RPC channel.
47888
- * - Cross-process: events already route through `$event-bus`; no
47889
- * per-broker wire-shaping needed.
47890
- */
47891
- var BrokerStatusEnum = _enum([
47913
+ _enum([
47892
47914
  "connected",
47893
47915
  "disconnected",
47894
47916
  "connecting",
@@ -47896,141 +47918,12 @@ var BrokerStatusEnum = _enum([
47896
47918
  "unreachable",
47897
47919
  "error"
47898
47920
  ]);
47899
- var BrokerInfoSchema = object({
47900
- /** Stable broker id. Persisted; survives addon restarts. */
47901
- id: string(),
47902
- /** Addon id of the provider that OWNS this broker.
47903
- *
47904
- * The `broker` cap is a system-scoped collection: several addons
47905
- * register a `broker` provider, each owning a DISJOINT set of
47906
- * brokers (mqtt-broker owns `mqtt_*`, provider-homeassistant owns
47907
- * `ha_*`). A broker therefore belongs to exactly one addon — like a
47908
- * device belongs to one integration. The admin UI threads this id
47909
- * back as the `{ addonId }` system-collection selector on every
47910
- * id-keyed call (`get` / `getSettings` / `setSettings` / `remove` /
47911
- * `testConnection`), so the call routes to the OWNING provider
47912
- * instead of defaulting to the first-registered one. */
47913
- addonId: string(),
47914
- /** Human-readable name (operator-chosen at add-time). */
47915
- name: string(),
47916
- /** Provider-defined kind tag — `mqtt` / `home-assistant` / future. */
47917
- kind: string(),
47918
- status: BrokerStatusEnum,
47919
- /** Free-form provider-specific info (HA version, MQTT broker
47920
- * flavour, latency, mTLS active, …). */
47921
- info: record(string(), unknown()),
47922
- /** Ms epoch of the last connection probe / status update. */
47923
- lastCheckedAt: number().nullable(),
47924
- /** Last error message, when `status` indicates failure. */
47925
- error: string().nullable()
47926
- });
47927
47921
  var RegistryStatusSchema = object({
47928
47922
  brokerCount: number().int().nonnegative(),
47929
47923
  connectedCount: number().int().nonnegative()
47930
47924
  });
47931
- /**
47932
- * One entry per `broker` provider — which addon provides which broker
47933
- * kind(s). The unified create picker reads this to know, for each
47934
- * (addonId, kind) pair the operator can pick, where to route the
47935
- * follow-up `getSettingsSchema` / `testSettings` / `add` calls (via the
47936
- * `{ addonId }` selector). A provider only advertises a kind here when
47937
- * it implements `getSettingsSchema` for that kind (so the picker never
47938
- * offers a kind whose creation form can't be rendered).
47939
- */
47940
- var BrokerProviderInfoSchema = object({
47941
- /** Addon id of the `broker` provider this entry describes. */
47942
- addonId: string(),
47943
- /** Broker kinds this provider can create, with a display label. */
47944
- kinds: array(object({
47945
- kind: string(),
47946
- label: string(),
47947
- /**
47948
- * Relative hub path to start an interactive account link (OAuth popup).
47949
- * May include `{{brokerId}}`; admin-ui substitutes and appends `?popup=1`.
47950
- */
47951
- interactiveConnectPath: string().min(1).optional(),
47952
- /** Relative hub path to disconnect the linked account (same popup pattern). */
47953
- interactiveDisconnectPath: string().min(1).optional(),
47954
- /**
47955
- * The kind signs in through a server-held interactive session instead of
47956
- * (or before) typed credentials. `basePath` is a hub-relative route set
47957
- * served by the owning addon (`/addon/<id>/...`) speaking the sign-in
47958
- * contract: `POST {basePath}/start` (body: the form's settings) answers
47959
- * `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
47960
- * `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
47961
- * 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
47962
- * (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
47963
- * existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
47964
- * (`{ sessionId }`) drops the session. The dialog that edits a broker
47965
- * offers it as the default path; the fields the session fills are
47966
- * marked `filledBySignIn` in the kind's settings schema.
47967
- *
47968
- * `methods` lists the ways the session can sign in, recommended first:
47969
- * `'device-code'` adds `POST {basePath}/code/start` (body: the form's
47970
- * settings) answering `{ sessionId, userCode, verificationUrl,
47971
- * expiresAt }` — the operator types `userCode` at `verificationUrl` on
47972
- * any device, and the same `status` / `commit` / `cancel` routes follow
47973
- * (status then carries `method`, `userCode`, `verificationUrl`,
47974
- * `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
47975
- * `'proxy'` is the `{basePath}/start` flow above. Absent means
47976
- * `['proxy']`.
47977
- */
47978
- signIn: object({
47979
- basePath: string().min(1),
47980
- methods: array(_enum(["device-code", "proxy"])).optional()
47981
- }).optional()
47982
- }))
47983
- });
47984
- var ListInputSchema = object({
47985
- /** Optional kind filter — `list({kind:'home-assistant'})` returns
47986
- * only HA brokers. Omit to list every broker. */
47987
- kind: string().optional() });
47988
47925
  var GetInputSchema = object({ id: string() });
47989
- var AddInputSchema = object({
47990
- kind: string().min(1),
47991
- name: string().min(1),
47992
- /**
47993
- * ADOPT an existing id instead of minting a new one.
47994
- *
47995
- * Written the day this cost an outage. A broker's id is not a detail: HA
47996
- * devices carry it inside their `stableId` (`ha:ha_004:dev:…`), so a broker
47997
- * lost from config and re-added as `ha_001` leaves every one of its devices
47998
- * bound to a broker that no longer exists. Re-entering the password under the
47999
- * ORIGINAL id turns a multi-step device migration back into re-entering a
48000
- * password.
48001
- *
48002
- * A provider MUST refuse an id that is already in use — adopting a live
48003
- * broker's id would silently take it over.
48004
- */
48005
- id: string().min(1).optional(),
48006
- /** Kind-specific settings (e.g. MQTT `{url,username,password}` or HA
48007
- * `{baseUrl,accessToken}`). Validated by the kind-specific provider
48008
- * branch on receipt — invalid shape rejects the add. */
48009
- settings: record(string(), unknown())
48010
- });
48011
- var AddResultSchema = object({ id: string() });
48012
- var RemoveInputSchema = object({ id: string() });
48013
- var TestConnectionResultSchema = discriminatedUnion("ok", [object({
48014
- ok: literal(true),
48015
- latencyMs: number().nonnegative()
48016
- }), object({
48017
- ok: literal(false),
48018
- error: string()
48019
- })]);
48020
47926
  var SettingsRecordSchema$1 = record(string(), unknown());
48021
- var SettingsSchemaInputSchema = object({ kind: string() });
48022
- var TestSettingsInputSchema = object({
48023
- kind: string(),
48024
- settings: SettingsRecordSchema$1
48025
- });
48026
- var TestSettingsResultSchema = discriminatedUnion("ok", [object({
48027
- ok: literal(true),
48028
- latencyMs: number().nonnegative().optional()
48029
- }).strict(), object({
48030
- ok: literal(false),
48031
- error: string()
48032
- })]);
48033
- var SettingsSchemaResultSchema = unknown().nullable();
48034
47927
  var PublishInputSchema = object({
48035
47928
  brokerId: string(),
48036
47929
  /** Kind-specific routing target.
@@ -48064,25 +47957,7 @@ var GetStateInputSchema = object({
48064
47957
  * HA: entity_id (returns the cached entity state). */
48065
47958
  key: string()
48066
47959
  });
48067
- method(ListInputSchema, array(BrokerInfoSchema)), method(GetInputSchema, BrokerInfoSchema.nullable()), method(_void(), array(BrokerProviderInfoSchema), { auth: "admin" }), method(AddInputSchema, AddResultSchema, {
48068
- kind: "mutation",
48069
- auth: "admin"
48070
- }), method(RemoveInputSchema, _void(), {
48071
- kind: "mutation",
48072
- auth: "admin"
48073
- }), method(GetInputSchema, TestConnectionResultSchema, {
48074
- kind: "mutation",
48075
- auth: "admin"
48076
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(object({
48077
- id: string(),
48078
- settings: SettingsRecordSchema$1
48079
- }), _void(), {
48080
- kind: "mutation",
48081
- auth: "admin"
48082
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(SettingsSchemaInputSchema, SettingsSchemaResultSchema, { auth: "admin" }), method(TestSettingsInputSchema, TestSettingsResultSchema, {
48083
- kind: "mutation",
48084
- auth: "admin"
48085
- }), method(PublishInputSchema, unknown(), {
47960
+ method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
48086
47961
  kind: "mutation",
48087
47962
  auth: "admin"
48088
47963
  }), method(SubscribeInputSchema, SubscribeResultSchema, {
@@ -53019,14 +52894,20 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
53019
52894
  }), array(DiscoveryCandidateSchema), {
53020
52895
  kind: "mutation",
53021
52896
  auth: "admin"
53022
- }), method(object({}), CreationSchemaOutputSchema), method(object({}), object({ deviceType: _enum(DeviceType).nullable() })), method(object({
52897
+ }), method(object({}), CreationSchemaOutputSchema), method(object({
52898
+ /** The integration asked about; a provider whose integrations differ answers per one. */
52899
+ integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })), method(object({
53023
52900
  candidate: DiscoveryCandidateSchema,
53024
52901
  /** The integration the operator adopts into; a provider with several instances needs it. */
53025
52902
  integrationId: string().optional()
53026
52903
  }), DeviceSummarySchema, {
53027
52904
  kind: "mutation",
53028
52905
  auth: "admin"
53029
- }), method(object({}), boolean()), method(object({ type: _enum(DeviceType) }), CreationSchemaOutputSchema), method(object({
52906
+ }), method(object({}), boolean()), method(object({
52907
+ type: _enum(DeviceType),
52908
+ /** The integration asked about; a provider whose integrations differ answers per one. */
52909
+ integrationId: string().optional()
52910
+ }), CreationSchemaOutputSchema), method(object({
53030
52911
  type: _enum(DeviceType),
53031
52912
  config: record(string(), unknown()),
53032
52913
  /** The integration the operator adds the device to; a provider with several instances needs it. */
@@ -53744,7 +53625,10 @@ method(object({
53744
53625
  auth: "admin"
53745
53626
  }), method(object({
53746
53627
  addonId: string(),
53747
- type: _enum(DeviceType)
53628
+ type: _enum(DeviceType),
53629
+ /** The integration the form is for; a provider whose integrations differ (a hub
53630
+ * integration takes no manual add) answers per integration. Absent = the addon's own. */
53631
+ integrationId: string().optional()
53748
53632
  }), unknown().nullable()), method(object({
53749
53633
  addonId: string(),
53750
53634
  type: _enum(DeviceType),
@@ -53828,7 +53712,11 @@ method(object({
53828
53712
  kind: "mutation",
53829
53713
  auth: "admin",
53830
53714
  timeoutMs: 12e4
53831
- }), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
53715
+ }), method(object({
53716
+ addonId: string(),
53717
+ /** The integration the Add-Device dialog is open on; absent = the addon's own. */
53718
+ integrationId: string().optional()
53719
+ }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
53832
53720
  deviceId: number(),
53833
53721
  key: string(),
53834
53722
  value: unknown()
@@ -57251,7 +57139,7 @@ var TestConnectionStatusEnum = _enum([
57251
57139
  "inconclusive",
57252
57140
  "unsupported"
57253
57141
  ]);
57254
- var TestConnectionResultSchema$1 = object({
57142
+ var TestConnectionResultSchema = object({
57255
57143
  /** True ONLY for `validated`. Never true for a test that did not run. */
57256
57144
  success: boolean(),
57257
57145
  error: string().optional(),
@@ -57296,7 +57184,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
57296
57184
  }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
57297
57185
  addonId: string(),
57298
57186
  settings: record(string(), unknown())
57299
- }), TestConnectionResultSchema$1, {
57187
+ }), TestConnectionResultSchema, {
57300
57188
  kind: "mutation",
57301
57189
  auth: "admin"
57302
57190
  });
@@ -57323,6 +57211,14 @@ var ConfigSchemaPassthrough$3 = custom();
57323
57211
  var IntegrationInstanceIdSchema = string().min(1);
57324
57212
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
57325
57213
  /**
57214
+ * What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
57215
+ * instance is an integration that brings devices (the registry owns its on/off switch);
57216
+ * `services`: a connection configured from the addon's own function page, never listed on
57217
+ * Integrations.
57218
+ * It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
57219
+ */
57220
+ var IntegrationInstanceRoleSchema = _enum(["devices", "services"]);
57221
+ /**
57326
57222
  * One kind of instance a provider can create (an adapter, an account type). The sign-in and
57327
57223
  * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
57328
57224
  * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
@@ -57333,6 +57229,22 @@ var IntegrationInstanceKindSchema = object({
57333
57229
  /** Stable id of the kind, sent back as `createInstance.kind`. */
57334
57230
  id: string().min(1),
57335
57231
  label: string().min(1),
57232
+ /**
57233
+ * The function capability this kind is configured for (`broker`, `smtp-provider`,
57234
+ * `device-provider`, ...). A page section is the kinds whose `functionCap` it names (D1013); a
57235
+ * provider with more than one section must name it on every kind.
57236
+ */
57237
+ functionCap: string().min(1),
57238
+ /**
57239
+ * For `functionCap: 'broker'`: the registry kind of the broker an instance of this kind is
57240
+ * (`matter`, `home-assistant`, ...). A caller that needs a broker of one kind (a link field)
57241
+ * finds the instances whose kind names it; absent takes the kind `id`.
57242
+ */
57243
+ brokerKind: string().min(1).optional(),
57244
+ /** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
57245
+ role: IntegrationInstanceRoleSchema.optional(),
57246
+ /** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
57247
+ canTest: boolean().optional(),
57336
57248
  /** The kind signs in through a server-held interactive session. */
57337
57249
  signIn: object({
57338
57250
  basePath: string().min(1),
@@ -57345,11 +57257,7 @@ var IntegrationInstanceKindSchema = object({
57345
57257
  });
57346
57258
  var IntegrationInstanceDescriptionSchema = object({
57347
57259
  /** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
57348
- role: _enum([
57349
- "devices",
57350
- "services",
57351
- "both"
57352
- ]),
57260
+ role: IntegrationInstanceRoleSchema,
57353
57261
  /** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
57354
57262
  discovery: object({
57355
57263
  mode: _enum([
@@ -57417,10 +57325,16 @@ var IntegrationInstancePatchSchema = object({
57417
57325
  /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
57418
57326
  values: record(string(), unknown())
57419
57327
  });
57420
- method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
57328
+ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({
57329
+ id: IntegrationInstanceIdSchema.nullable(),
57330
+ /** The kind of the create form (`id: null`) of a provider with several. */
57331
+ kind: string().min(1).optional()
57332
+ }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
57421
57333
  id: IntegrationInstanceIdSchema.optional(),
57422
57334
  name: string().min(1),
57423
- kind: string().min(1).optional()
57335
+ kind: string().min(1).optional(),
57336
+ /** Form values written with the record (a link picked in the create dialog). */
57337
+ values: record(string(), unknown()).optional()
57424
57338
  }), object({ id: string() }), {
57425
57339
  kind: "mutation",
57426
57340
  auth: "admin"
@@ -57438,8 +57352,10 @@ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method
57438
57352
  auth: "admin"
57439
57353
  }), optionalMethod(object({
57440
57354
  id: IntegrationInstanceIdSchema.nullable(),
57441
- values: record(string(), unknown())
57442
- }), TestConnectionResultSchema$1, {
57355
+ values: record(string(), unknown()),
57356
+ /** The kind to test when `id` is null and the provider has several. */
57357
+ kind: string().min(1).optional()
57358
+ }), TestConnectionResultSchema, {
57443
57359
  kind: "mutation",
57444
57360
  auth: "admin"
57445
57361
  });
@@ -60314,6 +60230,380 @@ var SystemMetricsSchema = object({
60314
60230
  gpuMemoryPercent: number().optional()
60315
60231
  });
60316
60232
  method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(GetLoadSeriesInputSchema, NodeLoadSeriesSchema);
60233
+ /**
60234
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
60235
+ * config documents, mirrors. The third storage API next to `ctx.settings`
60236
+ * (operator intent, D870) and device-history (numbers over time, D850).
60237
+ *
60238
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
60239
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
60240
+ * that with the addon id closed over). It is deliberately NOT in any input
60241
+ * schema, so a session can never supply it, and a call with no stamp is refused
60242
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
60243
+ * addons go through the owner's capability.
60244
+ *
60245
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
60246
+ * never `[]`. Secret fields are never on the wire: a read shows the
60247
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
60248
+ * resolves itself, and a write may carry only a keychain marker bound to the
60249
+ * row's own ref.
60250
+ *
60251
+ * Internal: addons reach it through `ctx.records`, never directly.
60252
+ */
60253
+ var RecordIdSchema = string().min(1).max(256);
60254
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
60255
+ var RecordBodySchema = record(string(), unknown());
60256
+ var RecordInputSchema = object({
60257
+ id: RecordIdSchema,
60258
+ /** The device this row belongs to (D865 removal, per-device reads). */
60259
+ deviceId: number().int().optional(),
60260
+ /** The domain clock, ms: observed / created / opened. */
60261
+ at: number().int().optional(),
60262
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
60263
+ expiresAt: number().int().optional(),
60264
+ data: RecordBodySchema
60265
+ });
60266
+ var RecordViewSchema = object({
60267
+ id: string(),
60268
+ deviceId: number().int().nullable(),
60269
+ at: number().nullable(),
60270
+ expiresAt: number().nullable(),
60271
+ rev: number().int(),
60272
+ updatedAt: number(),
60273
+ data: RecordBodySchema
60274
+ });
60275
+ /** Declared index fields only. Anything else does not compile, by design. */
60276
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
60277
+ string(),
60278
+ number(),
60279
+ boolean(),
60280
+ object({ in: array(union([
60281
+ string(),
60282
+ number(),
60283
+ boolean()
60284
+ ])).min(1).max(RECORD_BATCH_MAX) }),
60285
+ object({
60286
+ gt: union([string(), number()]).optional(),
60287
+ gte: union([string(), number()]).optional(),
60288
+ lt: union([string(), number()]).optional(),
60289
+ lte: union([string(), number()]).optional()
60290
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
60291
+ ]));
60292
+ var KindShape = { kind: RecordKindNameSchema };
60293
+ var TimeWindowShape = {
60294
+ deviceId: number().int().optional(),
60295
+ atFrom: number().optional(),
60296
+ atTo: number().optional()
60297
+ };
60298
+ var RecordQueryInputSchema = object({
60299
+ ...KindShape,
60300
+ ...TimeWindowShape,
60301
+ where: RecordWhereSchema.optional(),
60302
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
60303
+ order: _enum(["at", "id"]).optional(),
60304
+ desc: boolean().optional(),
60305
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
60306
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
60307
+ cursor: string().min(1).optional()
60308
+ });
60309
+ var RecordQueryResultSchema = object({
60310
+ records: array(RecordViewSchema),
60311
+ nextCursor: string().nullable()
60312
+ });
60313
+ var RecordKindStateSchema = _enum([
60314
+ "created",
60315
+ "unchanged",
60316
+ "updated"
60317
+ ]);
60318
+ var DeclareKindResultSchema = object({
60319
+ kindId: number().int(),
60320
+ state: RecordKindStateSchema,
60321
+ createdIndexes: array(string())
60322
+ });
60323
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
60324
+ var SecretRefsList = array(string());
60325
+ /**
60326
+ * One op of a `transact`: the single-row writes, each on a kind of the caller.
60327
+ * All ops of one call share ONE database file and ONE `transactFamily`.
60328
+ */
60329
+ var RecordTransactOpSchema = discriminatedUnion("op", [
60330
+ object({
60331
+ op: literal("put"),
60332
+ kind: RecordKindNameSchema,
60333
+ record: RecordInputSchema,
60334
+ ifRev: number().int().min(0).optional()
60335
+ }),
60336
+ object({
60337
+ op: literal("patch"),
60338
+ kind: RecordKindNameSchema,
60339
+ id: RecordIdSchema,
60340
+ data: RecordBodySchema,
60341
+ at: number().int().nullable().optional(),
60342
+ expiresAt: number().int().nullable().optional(),
60343
+ ifRev: number().int().min(1).optional()
60344
+ }),
60345
+ object({
60346
+ op: literal("delete"),
60347
+ kind: RecordKindNameSchema,
60348
+ id: RecordIdSchema
60349
+ })
60350
+ ]);
60351
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
60352
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
60353
+ kind: "mutation",
60354
+ auth: "admin"
60355
+ }), method(object({
60356
+ ...KindShape,
60357
+ id: RecordIdSchema
60358
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
60359
+ ...KindShape,
60360
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
60361
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
60362
+ ...KindShape,
60363
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
60364
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
60365
+ ...KindShape,
60366
+ record: RecordInputSchema,
60367
+ /** Compare-and-set. `0` means "the row must not exist". */
60368
+ ifRev: number().int().min(0).optional()
60369
+ }), object({
60370
+ rev: number().int(),
60371
+ releasedRefs: SecretRefsList
60372
+ }), {
60373
+ kind: "mutation",
60374
+ auth: "admin"
60375
+ }), method(object({
60376
+ ...KindShape,
60377
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
60378
+ }), object({
60379
+ count: number().int(),
60380
+ releasedRefs: SecretRefsList
60381
+ }), {
60382
+ kind: "mutation",
60383
+ auth: "admin"
60384
+ }), method(object({
60385
+ ...KindShape,
60386
+ id: RecordIdSchema,
60387
+ data: RecordBodySchema,
60388
+ at: number().int().nullable().optional(),
60389
+ expiresAt: number().int().nullable().optional(),
60390
+ ifRev: number().int().min(1).optional()
60391
+ }), object({
60392
+ rev: number().int(),
60393
+ releasedRefs: SecretRefsList
60394
+ }), {
60395
+ kind: "mutation",
60396
+ auth: "admin"
60397
+ }), method(object({
60398
+ ...KindShape,
60399
+ id: RecordIdSchema
60400
+ }), object({
60401
+ deleted: boolean(),
60402
+ secretRefs: SecretRefsList
60403
+ }), {
60404
+ kind: "mutation",
60405
+ auth: "admin"
60406
+ }), method(object({
60407
+ ...KindShape,
60408
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
60409
+ }), object({
60410
+ deleted: number().int(),
60411
+ secretRefs: SecretRefsList
60412
+ }), {
60413
+ kind: "mutation",
60414
+ auth: "admin"
60415
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
60416
+ ...KindShape,
60417
+ ...TimeWindowShape,
60418
+ where: RecordWhereSchema.optional()
60419
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
60420
+ ...KindShape,
60421
+ deviceId: number().int().optional(),
60422
+ from: number(),
60423
+ to: number(),
60424
+ bucketMs: number().int().positive()
60425
+ }), object({ buckets: array(object({
60426
+ bucketStart: number(),
60427
+ count: number().int()
60428
+ })) }), { auth: "admin" }), method(object({
60429
+ ...KindShape,
60430
+ op: _enum([
60431
+ "sum",
60432
+ "min",
60433
+ "max",
60434
+ "count"
60435
+ ]),
60436
+ field: RecordFieldPathSchema.optional(),
60437
+ groupBy: RecordFieldPathSchema.optional(),
60438
+ where: RecordWhereSchema.optional()
60439
+ }), object({ rows: array(object({
60440
+ group: union([
60441
+ string(),
60442
+ number(),
60443
+ _null()
60444
+ ]),
60445
+ value: number().nullable()
60446
+ })) }), { auth: "admin" }), method(object({
60447
+ ...KindShape,
60448
+ deviceId: number().int().optional(),
60449
+ atBefore: number().optional(),
60450
+ where: RecordWhereSchema.optional()
60451
+ }), object({
60452
+ deleted: number().int(),
60453
+ secretRefs: SecretRefsList
60454
+ }), {
60455
+ kind: "mutation",
60456
+ auth: "admin"
60457
+ }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
60458
+ results: array(object({
60459
+ rev: number().int().nullable(),
60460
+ deleted: boolean()
60461
+ })),
60462
+ releasedRefs: SecretRefsList,
60463
+ secretRefs: SecretRefsList
60464
+ }), {
60465
+ kind: "mutation",
60466
+ auth: "admin"
60467
+ }), method(object({
60468
+ deviceId: number().int(),
60469
+ kinds: array(RecordKindNameSchema).optional()
60470
+ }), object({
60471
+ deleted: record(string(), number().int()),
60472
+ secretRefs: SecretRefsList
60473
+ }), {
60474
+ kind: "mutation",
60475
+ auth: "admin"
60476
+ }), method(object(KindShape), object({ id: number().int() }), {
60477
+ kind: "mutation",
60478
+ auth: "admin"
60479
+ });
60480
+ /**
60481
+ * The wire shapes of the migration API, version 1 (planning#447).
60482
+ *
60483
+ * A migration is code that outlives the server it was written against: an addon at
60484
+ * version 1.4 that is brought to 1.9 in one jump still runs its 1.4 catalogue, against
60485
+ * the 1.9 kernel. The only thing that code may call is {@link MigrationApiV1}; this file
60486
+ * is the contract of every method of it, one Zod pair per method.
60487
+ *
60488
+ * APPEND-ONLY. A released method is never removed and never changes meaning: an input
60489
+ * field is never removed or made required, an enum never narrows, an output field is
60490
+ * never removed. A change that cannot be expressed that way is `migration-api.v2`, next
60491
+ * to this file. `scripts/check-migration-api-append-only.ts` holds the line against
60492
+ * `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
60493
+ * `it('<id>'` in `migration-api.contract.spec.ts`.
60494
+ */
60495
+ var Rows = record(string(), unknown());
60496
+ var IntegrationId = object({ integrationId: string().min(1) });
60497
+ var RecordId = object({ id: string().min(1) });
60498
+ var RecordRowSchema = object({
60499
+ id: string(),
60500
+ deviceId: number().int().nullable(),
60501
+ at: number().nullable(),
60502
+ expiresAt: number().nullable(),
60503
+ rev: number().int(),
60504
+ updatedAt: number(),
60505
+ data: Rows
60506
+ });
60507
+ var RecordPutShape = {
60508
+ id: string().min(1),
60509
+ deviceId: number().int().optional(),
60510
+ at: number().int().optional(),
60511
+ expiresAt: number().int().optional(),
60512
+ data: Rows
60513
+ };
60514
+ var MigrationIntegrationSchema = object({
60515
+ id: string(),
60516
+ addonId: string(),
60517
+ name: string(),
60518
+ info: Rows,
60519
+ originStableId: string().optional()
60520
+ });
60521
+ var MigrationDeviceSchema = object({
60522
+ id: number().int(),
60523
+ integrationId: string().nullable().optional(),
60524
+ /** The owning device; null or absent for a root. */
60525
+ parentDeviceId: number().int().nullable().optional(),
60526
+ type: string().optional(),
60527
+ name: string().optional(),
60528
+ stableId: string().optional()
60529
+ });
60530
+ /** What the engine says about the migration API it serves: lets an addon notice an older server. */
60531
+ var MigrationApiInfoSchema = object({
60532
+ version: number().int(),
60533
+ methods: array(string())
60534
+ });
60535
+ object({
60536
+ message: string(),
60537
+ meta: Rows.optional(),
60538
+ /** Grouping tags of the line; a line about a device carries `{ deviceId }`. */
60539
+ tags: object({ deviceId: number().int().optional() }).optional()
60540
+ });
60541
+ object({
60542
+ owner: string().min(1),
60543
+ metas: array(MigrationMetaSchema)
60544
+ }), object({
60545
+ bootId: string(),
60546
+ snapshot: _enum([
60547
+ "none",
60548
+ "written",
60549
+ "refused"
60550
+ ]),
60551
+ steps: array(MigrationOwnerStepSchema),
60552
+ /** The migration API the engine serves; absent from a server that predates it. */
60553
+ migrationApi: MigrationApiInfoSchema.optional()
60554
+ }), object({ id: string().min(1) }), object({
60555
+ proceed: boolean(),
60556
+ state: union([literal("pending"), MigrationStatusSchema]),
60557
+ reason: string().nullable()
60558
+ }), object({
60559
+ id: string().min(1),
60560
+ result: MigrationOwnerResultSchema
60561
+ }), object({
60562
+ status: MigrationStatusSchema,
60563
+ error: string().nullable(),
60564
+ rowsChanged: number().int().nonnegative()
60565
+ }), object({
60566
+ rows: number().int().nonnegative(),
60567
+ secrets: number().int().nonnegative()
60568
+ }), IntegrationId.extend({ patch: Rows }), object({ written: boolean() }), IntegrationId.extend({ keys: array(string().min(1)) }), object({
60569
+ present: boolean(),
60570
+ removed: Rows
60571
+ }), RecordRowSchema.nullable(), RecordRowSchema.nullable(), object({
60572
+ ...RecordPutShape,
60573
+ ifRev: number().int().optional()
60574
+ }), object({ rev: number().int() }), object({ records: array(object(RecordPutShape)) }), object({ count: number().int().nonnegative() }), RecordId.extend({
60575
+ partial: Rows,
60576
+ ifRev: number().int().optional()
60577
+ }), object({ rev: number().int() }), object({ deleted: boolean() }), object({
60578
+ deviceId: number().int().optional(),
60579
+ atFrom: number().optional(),
60580
+ atTo: number().optional(),
60581
+ where: RecordWhereSchema.optional(),
60582
+ limit: number().int().min(1).optional(),
60583
+ cursor: string().min(1).optional(),
60584
+ resolveSecrets: boolean().optional()
60585
+ }), object({
60586
+ records: array(RecordRowSchema),
60587
+ nextCursor: string().nullable()
60588
+ }), object({
60589
+ deviceId: number().int().optional(),
60590
+ atBefore: number().optional(),
60591
+ where: RecordWhereSchema.optional()
60592
+ }), object({ count: number().int().nonnegative() }), object({}), object({ store: Rows }), object({ patch: Rows }), object({}), object({ keys: array(string().min(1)) }), object({ removed: array(string()) }), object({ refs: array(string()) }), object({ values: record(string(), string().nullable()) }), object({
60593
+ ref: string().min(1),
60594
+ value: string()
60595
+ }), object({}), object({ refs: array(string()) }), object({ deleted: number().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
60596
+ addonId: string().min(1),
60597
+ integrationId: string().min(1).optional()
60598
+ }), object({ devices: array(MigrationDeviceSchema) }), object({ deviceId: number().int() }), object({
60599
+ id: number().int(),
60600
+ integrationId: string().nullable(),
60601
+ /** Whether the device carries any stored config; its content is not offered. */
60602
+ hasConfig: boolean()
60603
+ }).nullable(), object({
60604
+ deviceId: number().int(),
60605
+ integrationId: string().min(1)
60606
+ }), object({}), object({}), object({ nodeId: string() }), object({}), object({});
60317
60607
  method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { auth: "admin" }), method(object({ owner: string().optional() }), object({ pending: array(MigrationPendingEntrySchema) }), { auth: "admin" }), method(object({ id: string().min(1) }), MigrationDryRunResultSchema, { auth: "admin" }), method(object({
60318
60608
  id: string().min(1),
60319
60609
  error: string().min(1)
@@ -60343,7 +60633,9 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
60343
60633
  "written",
60344
60634
  "refused"
60345
60635
  ]),
60346
- steps: array(MigrationOwnerStepSchema)
60636
+ steps: array(MigrationOwnerStepSchema),
60637
+ /** The migration API this engine serves (additive: a server that predates it omits it). */
60638
+ migrationApi: MigrationApiInfoSchema.optional()
60347
60639
  }), {
60348
60640
  kind: "mutation",
60349
60641
  auth: "admin"
@@ -63495,6 +63787,20 @@ var pipelineAnalyticsCapability = {
63495
63787
  */
63496
63788
  countUnstampedEventMedia: method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }),
63497
63789
  /**
63790
+ * Stored media per storage location: rows and bytes stamped with each asked
63791
+ * location id, the rows with none, and the rows naming a location that was
63792
+ * not asked about. One indexed aggregate per location (`idx_media_location_size`,
63793
+ * a covering index) plus the NULL one, and one unfiltered total that is a
63794
+ * covering-index scan: O(rows), cheap per row but not constant, so a hub with
63795
+ * millions of rows pays for it once per call. `unlisted` is relative to the
63796
+ * ids ASKED: it means "gone" only when every location id was asked. A failed
63797
+ * read throws; it never reads as zero.
63798
+ */
63799
+ getMediaLocationCensus: method(MediaLocationCensusInputSchema, MediaLocationCensusSchema, {
63800
+ kind: "query",
63801
+ auth: "admin"
63802
+ }),
63803
+ /**
63498
63804
  * How many rows a pass would STILL act on against `toLocationId`.
63499
63805
  *
63500
63806
  * One derivation, two consumers: it is the media lane's denominator (the
@@ -66574,7 +66880,7 @@ var BrokerStatusSchema$1 = _enum([
66574
66880
  "unreachable",
66575
66881
  "tls-error"
66576
66882
  ]);
66577
- var BrokerInfoSchema$1 = object({
66883
+ var BrokerInfoSchema = object({
66578
66884
  id: string(),
66579
66885
  name: string(),
66580
66886
  url: string(),
@@ -66637,7 +66943,7 @@ var StatusSchema = object({
66637
66943
  brokerCount: number(),
66638
66944
  embeddedRunning: boolean()
66639
66945
  });
66640
- method(_void(), array(BrokerInfoSchema$1)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
66946
+ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
66641
66947
  kind: "mutation",
66642
66948
  auth: "admin"
66643
66949
  }), method(IdInputSchema, _void(), {
@@ -74770,253 +75076,6 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, met
74770
75076
  auth: "admin"
74771
75077
  });
74772
75078
  /**
74773
- * records - an addon's own facts and documents (D881): ledgers, audit rows,
74774
- * config documents, mirrors. The third storage API next to `ctx.settings`
74775
- * (operator intent, D870) and device-history (numbers over time, D850).
74776
- *
74777
- * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
74778
- * crossed a process and stated by a hub in-process caller (`ctx.records` does
74779
- * that with the addon id closed over). It is deliberately NOT in any input
74780
- * schema, so a session can never supply it, and a call with no stamp is refused
74781
- * `records/no-caller`. A kind is readable and writable only by its owner; other
74782
- * addons go through the owner's capability.
74783
- *
74784
- * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
74785
- * never `[]`. Secret fields are never on the wire: a read shows the
74786
- * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
74787
- * resolves itself, and a write may carry only a keychain marker bound to the
74788
- * row's own ref.
74789
- *
74790
- * Internal: addons reach it through `ctx.records`, never directly.
74791
- */
74792
- var RecordIdSchema = string().min(1).max(256);
74793
- /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
74794
- var RecordBodySchema = record(string(), unknown());
74795
- var RecordInputSchema = object({
74796
- id: RecordIdSchema,
74797
- /** The device this row belongs to (D865 removal, per-device reads). */
74798
- deviceId: number().int().optional(),
74799
- /** The domain clock, ms: observed / created / opened. */
74800
- at: number().int().optional(),
74801
- /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
74802
- expiresAt: number().int().optional(),
74803
- data: RecordBodySchema
74804
- });
74805
- var RecordViewSchema = object({
74806
- id: string(),
74807
- deviceId: number().int().nullable(),
74808
- at: number().nullable(),
74809
- expiresAt: number().nullable(),
74810
- rev: number().int(),
74811
- updatedAt: number(),
74812
- data: RecordBodySchema
74813
- });
74814
- /** Declared index fields only. Anything else does not compile, by design. */
74815
- var RecordWhereSchema = record(RecordFieldPathSchema, union([
74816
- string(),
74817
- number(),
74818
- boolean(),
74819
- object({ in: array(union([
74820
- string(),
74821
- number(),
74822
- boolean()
74823
- ])).min(1).max(RECORD_BATCH_MAX) }),
74824
- object({
74825
- gt: union([string(), number()]).optional(),
74826
- gte: union([string(), number()]).optional(),
74827
- lt: union([string(), number()]).optional(),
74828
- lte: union([string(), number()]).optional()
74829
- }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
74830
- ]));
74831
- var KindShape = { kind: RecordKindNameSchema };
74832
- var TimeWindowShape = {
74833
- deviceId: number().int().optional(),
74834
- atFrom: number().optional(),
74835
- atTo: number().optional()
74836
- };
74837
- var RecordQueryInputSchema = object({
74838
- ...KindShape,
74839
- ...TimeWindowShape,
74840
- where: RecordWhereSchema.optional(),
74841
- /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
74842
- order: _enum(["at", "id"]).optional(),
74843
- desc: boolean().optional(),
74844
- limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
74845
- /** Opaque keyset cursor from a previous answer. There is no offset. */
74846
- cursor: string().min(1).optional()
74847
- });
74848
- var RecordQueryResultSchema = object({
74849
- records: array(RecordViewSchema),
74850
- nextCursor: string().nullable()
74851
- });
74852
- var RecordKindStateSchema = _enum([
74853
- "created",
74854
- "unchanged",
74855
- "updated"
74856
- ]);
74857
- var DeclareKindResultSchema = object({
74858
- kindId: number().int(),
74859
- state: RecordKindStateSchema,
74860
- createdIndexes: array(string())
74861
- });
74862
- /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
74863
- var SecretRefsList = array(string());
74864
- /**
74865
- * One op of a `transact`: the single-row writes, each on a kind of the caller.
74866
- * All ops of one call share ONE database file and ONE `transactFamily`.
74867
- */
74868
- var RecordTransactOpSchema = discriminatedUnion("op", [
74869
- object({
74870
- op: literal("put"),
74871
- kind: RecordKindNameSchema,
74872
- record: RecordInputSchema,
74873
- ifRev: number().int().min(0).optional()
74874
- }),
74875
- object({
74876
- op: literal("patch"),
74877
- kind: RecordKindNameSchema,
74878
- id: RecordIdSchema,
74879
- data: RecordBodySchema,
74880
- at: number().int().nullable().optional(),
74881
- expiresAt: number().int().nullable().optional(),
74882
- ifRev: number().int().min(1).optional()
74883
- }),
74884
- object({
74885
- op: literal("delete"),
74886
- kind: RecordKindNameSchema,
74887
- id: RecordIdSchema
74888
- })
74889
- ]);
74890
- var RecordSecretRefsSchema = record(string(), record(string(), string()));
74891
- method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
74892
- kind: "mutation",
74893
- auth: "admin"
74894
- }), method(object({
74895
- ...KindShape,
74896
- id: RecordIdSchema
74897
- }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
74898
- ...KindShape,
74899
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74900
- }), array(RecordViewSchema), { auth: "admin" }), method(object({
74901
- ...KindShape,
74902
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74903
- }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
74904
- ...KindShape,
74905
- record: RecordInputSchema,
74906
- /** Compare-and-set. `0` means "the row must not exist". */
74907
- ifRev: number().int().min(0).optional()
74908
- }), object({
74909
- rev: number().int(),
74910
- releasedRefs: SecretRefsList
74911
- }), {
74912
- kind: "mutation",
74913
- auth: "admin"
74914
- }), method(object({
74915
- ...KindShape,
74916
- records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
74917
- }), object({
74918
- count: number().int(),
74919
- releasedRefs: SecretRefsList
74920
- }), {
74921
- kind: "mutation",
74922
- auth: "admin"
74923
- }), method(object({
74924
- ...KindShape,
74925
- id: RecordIdSchema,
74926
- data: RecordBodySchema,
74927
- at: number().int().nullable().optional(),
74928
- expiresAt: number().int().nullable().optional(),
74929
- ifRev: number().int().min(1).optional()
74930
- }), object({
74931
- rev: number().int(),
74932
- releasedRefs: SecretRefsList
74933
- }), {
74934
- kind: "mutation",
74935
- auth: "admin"
74936
- }), method(object({
74937
- ...KindShape,
74938
- id: RecordIdSchema
74939
- }), object({
74940
- deleted: boolean(),
74941
- secretRefs: SecretRefsList
74942
- }), {
74943
- kind: "mutation",
74944
- auth: "admin"
74945
- }), method(object({
74946
- ...KindShape,
74947
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74948
- }), object({
74949
- deleted: number().int(),
74950
- secretRefs: SecretRefsList
74951
- }), {
74952
- kind: "mutation",
74953
- auth: "admin"
74954
- }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
74955
- ...KindShape,
74956
- ...TimeWindowShape,
74957
- where: RecordWhereSchema.optional()
74958
- }), object({ count: number().int() }), { auth: "admin" }), method(object({
74959
- ...KindShape,
74960
- deviceId: number().int().optional(),
74961
- from: number(),
74962
- to: number(),
74963
- bucketMs: number().int().positive()
74964
- }), object({ buckets: array(object({
74965
- bucketStart: number(),
74966
- count: number().int()
74967
- })) }), { auth: "admin" }), method(object({
74968
- ...KindShape,
74969
- op: _enum([
74970
- "sum",
74971
- "min",
74972
- "max",
74973
- "count"
74974
- ]),
74975
- field: RecordFieldPathSchema.optional(),
74976
- groupBy: RecordFieldPathSchema.optional(),
74977
- where: RecordWhereSchema.optional()
74978
- }), object({ rows: array(object({
74979
- group: union([
74980
- string(),
74981
- number(),
74982
- _null()
74983
- ]),
74984
- value: number().nullable()
74985
- })) }), { auth: "admin" }), method(object({
74986
- ...KindShape,
74987
- deviceId: number().int().optional(),
74988
- atBefore: number().optional(),
74989
- where: RecordWhereSchema.optional()
74990
- }), object({
74991
- deleted: number().int(),
74992
- secretRefs: SecretRefsList
74993
- }), {
74994
- kind: "mutation",
74995
- auth: "admin"
74996
- }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
74997
- results: array(object({
74998
- rev: number().int().nullable(),
74999
- deleted: boolean()
75000
- })),
75001
- releasedRefs: SecretRefsList,
75002
- secretRefs: SecretRefsList
75003
- }), {
75004
- kind: "mutation",
75005
- auth: "admin"
75006
- }), method(object({
75007
- deviceId: number().int(),
75008
- kinds: array(RecordKindNameSchema).optional()
75009
- }), object({
75010
- deleted: record(string(), number().int()),
75011
- secretRefs: SecretRefsList
75012
- }), {
75013
- kind: "mutation",
75014
- auth: "admin"
75015
- }), method(object(KindShape), object({ id: number().int() }), {
75016
- kind: "mutation",
75017
- auth: "admin"
75018
- });
75019
- /**
75020
75079
  * record-entries - the ONE admin surface for every list of user-created entries
75021
75080
  * (D881): notification targets, brokers, LLM profiles, anything an addon
75022
75081
  * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
@@ -85851,20 +85910,6 @@ Object.freeze({
85851
85910
  access: "create",
85852
85911
  role: "viewer"
85853
85912
  },
85854
- "broker.add": {
85855
- capName: "broker",
85856
- capScope: "system",
85857
- addonId: null,
85858
- access: "create",
85859
- role: "admin"
85860
- },
85861
- "broker.get": {
85862
- capName: "broker",
85863
- capScope: "system",
85864
- addonId: null,
85865
- access: "view",
85866
- role: "admin"
85867
- },
85868
85913
  "broker.getBrokerConfig": {
85869
85914
  capName: "broker",
85870
85915
  capScope: "system",
@@ -85872,20 +85917,6 @@ Object.freeze({
85872
85917
  access: "view",
85873
85918
  role: "admin"
85874
85919
  },
85875
- "broker.getSettings": {
85876
- capName: "broker",
85877
- capScope: "system",
85878
- addonId: null,
85879
- access: "view",
85880
- role: "admin"
85881
- },
85882
- "broker.getSettingsSchema": {
85883
- capName: "broker",
85884
- capScope: "system",
85885
- addonId: null,
85886
- access: "view",
85887
- role: "admin"
85888
- },
85889
85920
  "broker.getState": {
85890
85921
  capName: "broker",
85891
85922
  capScope: "system",
@@ -85900,20 +85931,6 @@ Object.freeze({
85900
85931
  access: "view",
85901
85932
  role: "admin"
85902
85933
  },
85903
- "broker.list": {
85904
- capName: "broker",
85905
- capScope: "system",
85906
- addonId: null,
85907
- access: "view",
85908
- role: "admin"
85909
- },
85910
- "broker.listProviders": {
85911
- capName: "broker",
85912
- capScope: "system",
85913
- addonId: null,
85914
- access: "view",
85915
- role: "admin"
85916
- },
85917
85934
  "broker.publish": {
85918
85935
  capName: "broker",
85919
85936
  capScope: "system",
@@ -85921,20 +85938,6 @@ Object.freeze({
85921
85938
  access: "create",
85922
85939
  role: "admin"
85923
85940
  },
85924
- "broker.remove": {
85925
- capName: "broker",
85926
- capScope: "system",
85927
- addonId: null,
85928
- access: "delete",
85929
- role: "admin"
85930
- },
85931
- "broker.setSettings": {
85932
- capName: "broker",
85933
- capScope: "system",
85934
- addonId: null,
85935
- access: "create",
85936
- role: "admin"
85937
- },
85938
85941
  "broker.subscribe": {
85939
85942
  capName: "broker",
85940
85943
  capScope: "system",
@@ -85942,20 +85945,6 @@ Object.freeze({
85942
85945
  access: "create",
85943
85946
  role: "admin"
85944
85947
  },
85945
- "broker.testConnection": {
85946
- capName: "broker",
85947
- capScope: "system",
85948
- addonId: null,
85949
- access: "create",
85950
- role: "admin"
85951
- },
85952
- "broker.testSettings": {
85953
- capName: "broker",
85954
- capScope: "system",
85955
- addonId: null,
85956
- access: "create",
85957
- role: "admin"
85958
- },
85959
85948
  "broker.unsubscribe": {
85960
85949
  capName: "broker",
85961
85950
  capScope: "system",
@@ -90919,6 +90908,13 @@ Object.freeze({
90919
90908
  access: "view",
90920
90909
  role: "viewer"
90921
90910
  },
90911
+ "pipelineAnalytics.getMediaLocationCensus": {
90912
+ capName: "pipeline-analytics",
90913
+ capScope: "device",
90914
+ addonId: null,
90915
+ access: "view",
90916
+ role: "admin"
90917
+ },
90922
90918
  "pipelineAnalytics.getMediaReclaimStatus": {
90923
90919
  capName: "pipeline-analytics",
90924
90920
  capScope: "device",
@@ -103486,6 +103482,7 @@ object({
103486
103482
  delay: number().nonnegative().optional(),
103487
103483
  commands: record(string(), unknown())
103488
103484
  });
103485
+ entryBody({ brokerId: string() });
103489
103486
  //#endregion
103490
103487
  //#region src/pipeline-analytics/cluster-model-pin.ts
103491
103488
  /**