@camstack/addon-post-analysis 1.2.669 → 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 +13 -0
  2. package/dist/{clip-model-registry-CbzBwacH.js → clip-model-registry-BhKHkBsg.js} +573 -547
  3. package/dist/{clip-model-registry-BPvijtCz.mjs → clip-model-registry-CDLYwWsU.mjs} +568 -548
  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-C4QK9e1e.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-CPLvPO3K.mjs → hostInit-D503xVER.mjs} +2 -2
  11. package/dist/pipeline-analytics/index.js +252 -41
  12. package/dist/pipeline-analytics/index.mjs +252 -41
  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-anSYIl3S.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")
@@ -14736,6 +14770,16 @@ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
14736
14770
  precondition: PreconditionSchema
14737
14771
  })
14738
14772
  ])) });
14773
+ /** `JSON.stringify` with object keys sorted, so equal values spell the same. */
14774
+ function canonicalJson(value) {
14775
+ if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item)).join(",")}]`;
14776
+ if (typeof value === "object" && value !== null) return `{${Object.entries(value).filter(([, item]) => item !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, item]) => `${JSON.stringify(key)}:${canonicalJson(item)}`).join(",")}}`;
14777
+ return JSON.stringify(value) ?? "null";
14778
+ }
14779
+ /** The precondition string for a value a plan read (`null` when it read nothing). */
14780
+ function preconditionOf(value) {
14781
+ return canonicalJson(value ?? null);
14782
+ }
14739
14783
  /**
14740
14784
  * What a `procedure` body reports. `already-done` means the rerun observed the
14741
14785
  * work finished (a crash between the work and the ledger row, or a manual fix)
@@ -16254,6 +16298,39 @@ var UnstampedEventMediaCountSchema = object({
16254
16298
  /** Sum across both, or `null` when either lane could not be counted. */
16255
16299
  total: number().int().nonnegative().nullable()
16256
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
+ });
16257
16334
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
16258
16335
  /** The independently selectable logical storage classes — every class
16259
16336
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -47833,52 +47910,7 @@ onBrightnessChanged: { data: object({
47833
47910
  minIntervalMs: 0
47834
47911
  } } }
47835
47912
  };
47836
- /**
47837
- * `broker` — unified pub/sub broker registry, system-scoped collection.
47838
- *
47839
- * The cap models any kind-tagged message broker the user wants to
47840
- * register and that other addons might consume. The first two kinds
47841
- * are MQTT (mosquitto / aedes embedded / cloud bridge) and
47842
- * Home Assistant (HA WebSocket — subscribe_entities + call_service).
47843
- * Future kinds (Zigbee2MQTT bridge, ZHA, KNX, Telegram, …) plug in
47844
- * the same surface.
47845
- *
47846
- * Why one cap, not one cap per kind:
47847
- * - The integrations page wants a single table of "every broker"
47848
- * across kinds; a unified cap drives it without join logic.
47849
- * - Generic admin operations (add / remove / test / status) are
47850
- * identical across kinds — duplicating them per cap was busywork.
47851
- * - The `network-access` cap precedent: same interface, many
47852
- * `providerKind: 'ingress'` implementations (Tailscale, ngrok, …).
47853
- *
47854
- * What stays kind-specific:
47855
- * - `getBrokerConfig` payload (kind decides whether it returns
47856
- * mqtt URL+creds, HA baseUrl+token, …) — typed as
47857
- * `Record<string, unknown>` at the wire; consumers narrow.
47858
- * - `publish` / `subscribe` / `getState` arguments (target / filter /
47859
- * key) — also typed as `Record<string, unknown>` so each kind can
47860
- * evolve its surface (MQTT topic+qos vs HA entity_id+domain)
47861
- * without rebreaking the cap signature.
47862
- * - `add` `settings` payload (different fields per kind, validated by
47863
- * the kind-specific provider).
47864
- *
47865
- * Bidirectionality:
47866
- * - `publish` is RPC — synchronous result (provider-defined).
47867
- * - `subscribe` returns a subscription handle; the actual message
47868
- * stream flows over the typed event-bus as `broker.message` events
47869
- * keyed by `(brokerId, subscriptionId)`. Consumers filter in their
47870
- * event handler. Subscriptions persist across reconnects — the
47871
- * provider re-subscribes upstream after a transport drop.
47872
- *
47873
- * Why event-bus push (not a subscription RPC stream):
47874
- * - Matches the rest of CamStack's D8 contract — events for telemetry,
47875
- * RPC for loss-is-a-bug. Broker messages are telemetry (a single
47876
- * drop is recoverable via `getState({key})`).
47877
- * - Frees `broker.subscribe` from holding a long-lived RPC channel.
47878
- * - Cross-process: events already route through `$event-bus`; no
47879
- * per-broker wire-shaping needed.
47880
- */
47881
- var BrokerStatusEnum = _enum([
47913
+ _enum([
47882
47914
  "connected",
47883
47915
  "disconnected",
47884
47916
  "connecting",
@@ -47886,141 +47918,12 @@ var BrokerStatusEnum = _enum([
47886
47918
  "unreachable",
47887
47919
  "error"
47888
47920
  ]);
47889
- var BrokerInfoSchema = object({
47890
- /** Stable broker id. Persisted; survives addon restarts. */
47891
- id: string(),
47892
- /** Addon id of the provider that OWNS this broker.
47893
- *
47894
- * The `broker` cap is a system-scoped collection: several addons
47895
- * register a `broker` provider, each owning a DISJOINT set of
47896
- * brokers (mqtt-broker owns `mqtt_*`, provider-homeassistant owns
47897
- * `ha_*`). A broker therefore belongs to exactly one addon — like a
47898
- * device belongs to one integration. The admin UI threads this id
47899
- * back as the `{ addonId }` system-collection selector on every
47900
- * id-keyed call (`get` / `getSettings` / `setSettings` / `remove` /
47901
- * `testConnection`), so the call routes to the OWNING provider
47902
- * instead of defaulting to the first-registered one. */
47903
- addonId: string(),
47904
- /** Human-readable name (operator-chosen at add-time). */
47905
- name: string(),
47906
- /** Provider-defined kind tag — `mqtt` / `home-assistant` / future. */
47907
- kind: string(),
47908
- status: BrokerStatusEnum,
47909
- /** Free-form provider-specific info (HA version, MQTT broker
47910
- * flavour, latency, mTLS active, …). */
47911
- info: record(string(), unknown()),
47912
- /** Ms epoch of the last connection probe / status update. */
47913
- lastCheckedAt: number().nullable(),
47914
- /** Last error message, when `status` indicates failure. */
47915
- error: string().nullable()
47916
- });
47917
47921
  var RegistryStatusSchema = object({
47918
47922
  brokerCount: number().int().nonnegative(),
47919
47923
  connectedCount: number().int().nonnegative()
47920
47924
  });
47921
- /**
47922
- * One entry per `broker` provider — which addon provides which broker
47923
- * kind(s). The unified create picker reads this to know, for each
47924
- * (addonId, kind) pair the operator can pick, where to route the
47925
- * follow-up `getSettingsSchema` / `testSettings` / `add` calls (via the
47926
- * `{ addonId }` selector). A provider only advertises a kind here when
47927
- * it implements `getSettingsSchema` for that kind (so the picker never
47928
- * offers a kind whose creation form can't be rendered).
47929
- */
47930
- var BrokerProviderInfoSchema = object({
47931
- /** Addon id of the `broker` provider this entry describes. */
47932
- addonId: string(),
47933
- /** Broker kinds this provider can create, with a display label. */
47934
- kinds: array(object({
47935
- kind: string(),
47936
- label: string(),
47937
- /**
47938
- * Relative hub path to start an interactive account link (OAuth popup).
47939
- * May include `{{brokerId}}`; admin-ui substitutes and appends `?popup=1`.
47940
- */
47941
- interactiveConnectPath: string().min(1).optional(),
47942
- /** Relative hub path to disconnect the linked account (same popup pattern). */
47943
- interactiveDisconnectPath: string().min(1).optional(),
47944
- /**
47945
- * The kind signs in through a server-held interactive session instead of
47946
- * (or before) typed credentials. `basePath` is a hub-relative route set
47947
- * served by the owning addon (`/addon/<id>/...`) speaking the sign-in
47948
- * contract: `POST {basePath}/start` (body: the form's settings) answers
47949
- * `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
47950
- * `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
47951
- * 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
47952
- * (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
47953
- * existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
47954
- * (`{ sessionId }`) drops the session. The dialog that edits a broker
47955
- * offers it as the default path; the fields the session fills are
47956
- * marked `filledBySignIn` in the kind's settings schema.
47957
- *
47958
- * `methods` lists the ways the session can sign in, recommended first:
47959
- * `'device-code'` adds `POST {basePath}/code/start` (body: the form's
47960
- * settings) answering `{ sessionId, userCode, verificationUrl,
47961
- * expiresAt }` — the operator types `userCode` at `verificationUrl` on
47962
- * any device, and the same `status` / `commit` / `cancel` routes follow
47963
- * (status then carries `method`, `userCode`, `verificationUrl`,
47964
- * `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
47965
- * `'proxy'` is the `{basePath}/start` flow above. Absent means
47966
- * `['proxy']`.
47967
- */
47968
- signIn: object({
47969
- basePath: string().min(1),
47970
- methods: array(_enum(["device-code", "proxy"])).optional()
47971
- }).optional()
47972
- }))
47973
- });
47974
- var ListInputSchema = object({
47975
- /** Optional kind filter — `list({kind:'home-assistant'})` returns
47976
- * only HA brokers. Omit to list every broker. */
47977
- kind: string().optional() });
47978
47925
  var GetInputSchema = object({ id: string() });
47979
- var AddInputSchema = object({
47980
- kind: string().min(1),
47981
- name: string().min(1),
47982
- /**
47983
- * ADOPT an existing id instead of minting a new one.
47984
- *
47985
- * Written the day this cost an outage. A broker's id is not a detail: HA
47986
- * devices carry it inside their `stableId` (`ha:ha_004:dev:…`), so a broker
47987
- * lost from config and re-added as `ha_001` leaves every one of its devices
47988
- * bound to a broker that no longer exists. Re-entering the password under the
47989
- * ORIGINAL id turns a multi-step device migration back into re-entering a
47990
- * password.
47991
- *
47992
- * A provider MUST refuse an id that is already in use — adopting a live
47993
- * broker's id would silently take it over.
47994
- */
47995
- id: string().min(1).optional(),
47996
- /** Kind-specific settings (e.g. MQTT `{url,username,password}` or HA
47997
- * `{baseUrl,accessToken}`). Validated by the kind-specific provider
47998
- * branch on receipt — invalid shape rejects the add. */
47999
- settings: record(string(), unknown())
48000
- });
48001
- var AddResultSchema = object({ id: string() });
48002
- var RemoveInputSchema = object({ id: string() });
48003
- var TestConnectionResultSchema = discriminatedUnion("ok", [object({
48004
- ok: literal(true),
48005
- latencyMs: number().nonnegative()
48006
- }), object({
48007
- ok: literal(false),
48008
- error: string()
48009
- })]);
48010
47926
  var SettingsRecordSchema$1 = record(string(), unknown());
48011
- var SettingsSchemaInputSchema = object({ kind: string() });
48012
- var TestSettingsInputSchema = object({
48013
- kind: string(),
48014
- settings: SettingsRecordSchema$1
48015
- });
48016
- var TestSettingsResultSchema = discriminatedUnion("ok", [object({
48017
- ok: literal(true),
48018
- latencyMs: number().nonnegative().optional()
48019
- }).strict(), object({
48020
- ok: literal(false),
48021
- error: string()
48022
- })]);
48023
- var SettingsSchemaResultSchema = unknown().nullable();
48024
47927
  var PublishInputSchema = object({
48025
47928
  brokerId: string(),
48026
47929
  /** Kind-specific routing target.
@@ -48054,25 +47957,7 @@ var GetStateInputSchema = object({
48054
47957
  * HA: entity_id (returns the cached entity state). */
48055
47958
  key: string()
48056
47959
  });
48057
- method(ListInputSchema, array(BrokerInfoSchema)), method(GetInputSchema, BrokerInfoSchema.nullable()), method(_void(), array(BrokerProviderInfoSchema), { auth: "admin" }), method(AddInputSchema, AddResultSchema, {
48058
- kind: "mutation",
48059
- auth: "admin"
48060
- }), method(RemoveInputSchema, _void(), {
48061
- kind: "mutation",
48062
- auth: "admin"
48063
- }), method(GetInputSchema, TestConnectionResultSchema, {
48064
- kind: "mutation",
48065
- auth: "admin"
48066
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(object({
48067
- id: string(),
48068
- settings: SettingsRecordSchema$1
48069
- }), _void(), {
48070
- kind: "mutation",
48071
- auth: "admin"
48072
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(SettingsSchemaInputSchema, SettingsSchemaResultSchema, { auth: "admin" }), method(TestSettingsInputSchema, TestSettingsResultSchema, {
48073
- kind: "mutation",
48074
- auth: "admin"
48075
- }), method(PublishInputSchema, unknown(), {
47960
+ method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
48076
47961
  kind: "mutation",
48077
47962
  auth: "admin"
48078
47963
  }), method(SubscribeInputSchema, SubscribeResultSchema, {
@@ -52943,7 +52828,14 @@ var DiscoveryCandidateSchema = object({
52943
52828
  /** `stableId` of the gateway candidate this device was found BEHIND. */
52944
52829
  parentStableId: string().optional(),
52945
52830
  /** `false` = shown for context but not pickable. Default true. */
52946
- selectable: boolean().optional()
52831
+ selectable: boolean().optional(),
52832
+ /**
52833
+ * Keys of the provider's creation form (`getChildCreationSchema`) this candidate
52834
+ * cannot be adopted without — a key for an encrypted board, a pairing code. The
52835
+ * admin asks for exactly these, on the creation form prefilled with
52836
+ * `prefilledConfig`, before it adopts. Absent or empty = adopt as it is.
52837
+ */
52838
+ needsParams: array(string()).optional()
52947
52839
  });
52948
52840
  /**
52949
52841
  * Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
@@ -53002,12 +52894,24 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
53002
52894
  }), array(DiscoveryCandidateSchema), {
53003
52895
  kind: "mutation",
53004
52896
  auth: "admin"
53005
- }), method(object({}), CreationSchemaOutputSchema), method(object({}), object({ deviceType: _enum(DeviceType).nullable() })), method(object({ candidate: DiscoveryCandidateSchema }), DeviceSummarySchema, {
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({
52900
+ candidate: DiscoveryCandidateSchema,
52901
+ /** The integration the operator adopts into; a provider with several instances needs it. */
52902
+ integrationId: string().optional()
52903
+ }), DeviceSummarySchema, {
53006
52904
  kind: "mutation",
53007
52905
  auth: "admin"
53008
- }), method(object({}), boolean()), method(object({ type: _enum(DeviceType) }), CreationSchemaOutputSchema), method(object({
52906
+ }), method(object({}), boolean()), method(object({
53009
52907
  type: _enum(DeviceType),
53010
- config: record(string(), unknown())
52908
+ /** The integration asked about; a provider whose integrations differ answers per one. */
52909
+ integrationId: string().optional()
52910
+ }), CreationSchemaOutputSchema), method(object({
52911
+ type: _enum(DeviceType),
52912
+ config: record(string(), unknown()),
52913
+ /** The integration the operator adds the device to; a provider with several instances needs it. */
52914
+ integrationId: string().optional()
53011
52915
  }), DeviceSummarySchema, {
53012
52916
  kind: "mutation",
53013
52917
  auth: "admin"
@@ -53721,7 +53625,10 @@ method(object({
53721
53625
  auth: "admin"
53722
53626
  }), method(object({
53723
53627
  addonId: string(),
53724
- 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()
53725
53632
  }), unknown().nullable()), method(object({
53726
53633
  addonId: string(),
53727
53634
  type: _enum(DeviceType),
@@ -53805,7 +53712,11 @@ method(object({
53805
53712
  kind: "mutation",
53806
53713
  auth: "admin",
53807
53714
  timeoutMs: 12e4
53808
- }), 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({
53809
53720
  deviceId: number(),
53810
53721
  key: string(),
53811
53722
  value: unknown()
@@ -57228,7 +57139,7 @@ var TestConnectionStatusEnum = _enum([
57228
57139
  "inconclusive",
57229
57140
  "unsupported"
57230
57141
  ]);
57231
- var TestConnectionResultSchema$1 = object({
57142
+ var TestConnectionResultSchema = object({
57232
57143
  /** True ONLY for `validated`. Never true for a test that did not run. */
57233
57144
  success: boolean(),
57234
57145
  error: string().optional(),
@@ -57273,7 +57184,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
57273
57184
  }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
57274
57185
  addonId: string(),
57275
57186
  settings: record(string(), unknown())
57276
- }), TestConnectionResultSchema$1, {
57187
+ }), TestConnectionResultSchema, {
57277
57188
  kind: "mutation",
57278
57189
  auth: "admin"
57279
57190
  });
@@ -57300,6 +57211,14 @@ var ConfigSchemaPassthrough$3 = custom();
57300
57211
  var IntegrationInstanceIdSchema = string().min(1);
57301
57212
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
57302
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
+ /**
57303
57222
  * One kind of instance a provider can create (an adapter, an account type). The sign-in and
57304
57223
  * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
57305
57224
  * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
@@ -57310,6 +57229,22 @@ var IntegrationInstanceKindSchema = object({
57310
57229
  /** Stable id of the kind, sent back as `createInstance.kind`. */
57311
57230
  id: string().min(1),
57312
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(),
57313
57248
  /** The kind signs in through a server-held interactive session. */
57314
57249
  signIn: object({
57315
57250
  basePath: string().min(1),
@@ -57322,11 +57257,7 @@ var IntegrationInstanceKindSchema = object({
57322
57257
  });
57323
57258
  var IntegrationInstanceDescriptionSchema = object({
57324
57259
  /** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
57325
- role: _enum([
57326
- "devices",
57327
- "services",
57328
- "both"
57329
- ]),
57260
+ role: IntegrationInstanceRoleSchema,
57330
57261
  /** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
57331
57262
  discovery: object({
57332
57263
  mode: _enum([
@@ -57394,10 +57325,16 @@ var IntegrationInstancePatchSchema = object({
57394
57325
  /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
57395
57326
  values: record(string(), unknown())
57396
57327
  });
57397
- 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({
57398
57333
  id: IntegrationInstanceIdSchema.optional(),
57399
57334
  name: string().min(1),
57400
- 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()
57401
57338
  }), object({ id: string() }), {
57402
57339
  kind: "mutation",
57403
57340
  auth: "admin"
@@ -57415,8 +57352,10 @@ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method
57415
57352
  auth: "admin"
57416
57353
  }), optionalMethod(object({
57417
57354
  id: IntegrationInstanceIdSchema.nullable(),
57418
- values: record(string(), unknown())
57419
- }), 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, {
57420
57359
  kind: "mutation",
57421
57360
  auth: "admin"
57422
57361
  });
@@ -60291,6 +60230,380 @@ var SystemMetricsSchema = object({
60291
60230
  gpuMemoryPercent: number().optional()
60292
60231
  });
60293
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({});
60294
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({
60295
60608
  id: string().min(1),
60296
60609
  error: string().min(1)
@@ -60320,7 +60633,9 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
60320
60633
  "written",
60321
60634
  "refused"
60322
60635
  ]),
60323
- 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()
60324
60639
  }), {
60325
60640
  kind: "mutation",
60326
60641
  auth: "admin"
@@ -63472,6 +63787,20 @@ var pipelineAnalyticsCapability = {
63472
63787
  */
63473
63788
  countUnstampedEventMedia: method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }),
63474
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
+ /**
63475
63804
  * How many rows a pass would STILL act on against `toLocationId`.
63476
63805
  *
63477
63806
  * One derivation, two consumers: it is the media lane's denominator (the
@@ -66551,7 +66880,7 @@ var BrokerStatusSchema$1 = _enum([
66551
66880
  "unreachable",
66552
66881
  "tls-error"
66553
66882
  ]);
66554
- var BrokerInfoSchema$1 = object({
66883
+ var BrokerInfoSchema = object({
66555
66884
  id: string(),
66556
66885
  name: string(),
66557
66886
  url: string(),
@@ -66614,7 +66943,7 @@ var StatusSchema = object({
66614
66943
  brokerCount: number(),
66615
66944
  embeddedRunning: boolean()
66616
66945
  });
66617
- 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, {
66618
66947
  kind: "mutation",
66619
66948
  auth: "admin"
66620
66949
  }), method(IdInputSchema, _void(), {
@@ -74747,253 +75076,6 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, met
74747
75076
  auth: "admin"
74748
75077
  });
74749
75078
  /**
74750
- * records - an addon's own facts and documents (D881): ledgers, audit rows,
74751
- * config documents, mirrors. The third storage API next to `ctx.settings`
74752
- * (operator intent, D870) and device-history (numbers over time, D850).
74753
- *
74754
- * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
74755
- * crossed a process and stated by a hub in-process caller (`ctx.records` does
74756
- * that with the addon id closed over). It is deliberately NOT in any input
74757
- * schema, so a session can never supply it, and a call with no stamp is refused
74758
- * `records/no-caller`. A kind is readable and writable only by its owner; other
74759
- * addons go through the owner's capability.
74760
- *
74761
- * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
74762
- * never `[]`. Secret fields are never on the wire: a read shows the
74763
- * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
74764
- * resolves itself, and a write may carry only a keychain marker bound to the
74765
- * row's own ref.
74766
- *
74767
- * Internal: addons reach it through `ctx.records`, never directly.
74768
- */
74769
- var RecordIdSchema = string().min(1).max(256);
74770
- /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
74771
- var RecordBodySchema = record(string(), unknown());
74772
- var RecordInputSchema = object({
74773
- id: RecordIdSchema,
74774
- /** The device this row belongs to (D865 removal, per-device reads). */
74775
- deviceId: number().int().optional(),
74776
- /** The domain clock, ms: observed / created / opened. */
74777
- at: number().int().optional(),
74778
- /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
74779
- expiresAt: number().int().optional(),
74780
- data: RecordBodySchema
74781
- });
74782
- var RecordViewSchema = object({
74783
- id: string(),
74784
- deviceId: number().int().nullable(),
74785
- at: number().nullable(),
74786
- expiresAt: number().nullable(),
74787
- rev: number().int(),
74788
- updatedAt: number(),
74789
- data: RecordBodySchema
74790
- });
74791
- /** Declared index fields only. Anything else does not compile, by design. */
74792
- var RecordWhereSchema = record(RecordFieldPathSchema, union([
74793
- string(),
74794
- number(),
74795
- boolean(),
74796
- object({ in: array(union([
74797
- string(),
74798
- number(),
74799
- boolean()
74800
- ])).min(1).max(RECORD_BATCH_MAX) }),
74801
- object({
74802
- gt: union([string(), number()]).optional(),
74803
- gte: union([string(), number()]).optional(),
74804
- lt: union([string(), number()]).optional(),
74805
- lte: union([string(), number()]).optional()
74806
- }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
74807
- ]));
74808
- var KindShape = { kind: RecordKindNameSchema };
74809
- var TimeWindowShape = {
74810
- deviceId: number().int().optional(),
74811
- atFrom: number().optional(),
74812
- atTo: number().optional()
74813
- };
74814
- var RecordQueryInputSchema = object({
74815
- ...KindShape,
74816
- ...TimeWindowShape,
74817
- where: RecordWhereSchema.optional(),
74818
- /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
74819
- order: _enum(["at", "id"]).optional(),
74820
- desc: boolean().optional(),
74821
- limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
74822
- /** Opaque keyset cursor from a previous answer. There is no offset. */
74823
- cursor: string().min(1).optional()
74824
- });
74825
- var RecordQueryResultSchema = object({
74826
- records: array(RecordViewSchema),
74827
- nextCursor: string().nullable()
74828
- });
74829
- var RecordKindStateSchema = _enum([
74830
- "created",
74831
- "unchanged",
74832
- "updated"
74833
- ]);
74834
- var DeclareKindResultSchema = object({
74835
- kindId: number().int(),
74836
- state: RecordKindStateSchema,
74837
- createdIndexes: array(string())
74838
- });
74839
- /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
74840
- var SecretRefsList = array(string());
74841
- /**
74842
- * One op of a `transact`: the single-row writes, each on a kind of the caller.
74843
- * All ops of one call share ONE database file and ONE `transactFamily`.
74844
- */
74845
- var RecordTransactOpSchema = discriminatedUnion("op", [
74846
- object({
74847
- op: literal("put"),
74848
- kind: RecordKindNameSchema,
74849
- record: RecordInputSchema,
74850
- ifRev: number().int().min(0).optional()
74851
- }),
74852
- object({
74853
- op: literal("patch"),
74854
- kind: RecordKindNameSchema,
74855
- id: RecordIdSchema,
74856
- data: RecordBodySchema,
74857
- at: number().int().nullable().optional(),
74858
- expiresAt: number().int().nullable().optional(),
74859
- ifRev: number().int().min(1).optional()
74860
- }),
74861
- object({
74862
- op: literal("delete"),
74863
- kind: RecordKindNameSchema,
74864
- id: RecordIdSchema
74865
- })
74866
- ]);
74867
- var RecordSecretRefsSchema = record(string(), record(string(), string()));
74868
- method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
74869
- kind: "mutation",
74870
- auth: "admin"
74871
- }), method(object({
74872
- ...KindShape,
74873
- id: RecordIdSchema
74874
- }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
74875
- ...KindShape,
74876
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74877
- }), array(RecordViewSchema), { auth: "admin" }), method(object({
74878
- ...KindShape,
74879
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74880
- }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
74881
- ...KindShape,
74882
- record: RecordInputSchema,
74883
- /** Compare-and-set. `0` means "the row must not exist". */
74884
- ifRev: number().int().min(0).optional()
74885
- }), object({
74886
- rev: number().int(),
74887
- releasedRefs: SecretRefsList
74888
- }), {
74889
- kind: "mutation",
74890
- auth: "admin"
74891
- }), method(object({
74892
- ...KindShape,
74893
- records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
74894
- }), object({
74895
- count: number().int(),
74896
- releasedRefs: SecretRefsList
74897
- }), {
74898
- kind: "mutation",
74899
- auth: "admin"
74900
- }), method(object({
74901
- ...KindShape,
74902
- id: RecordIdSchema,
74903
- data: RecordBodySchema,
74904
- at: number().int().nullable().optional(),
74905
- expiresAt: number().int().nullable().optional(),
74906
- ifRev: number().int().min(1).optional()
74907
- }), object({
74908
- rev: number().int(),
74909
- releasedRefs: SecretRefsList
74910
- }), {
74911
- kind: "mutation",
74912
- auth: "admin"
74913
- }), method(object({
74914
- ...KindShape,
74915
- id: RecordIdSchema
74916
- }), object({
74917
- deleted: boolean(),
74918
- secretRefs: SecretRefsList
74919
- }), {
74920
- kind: "mutation",
74921
- auth: "admin"
74922
- }), method(object({
74923
- ...KindShape,
74924
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74925
- }), object({
74926
- deleted: number().int(),
74927
- secretRefs: SecretRefsList
74928
- }), {
74929
- kind: "mutation",
74930
- auth: "admin"
74931
- }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
74932
- ...KindShape,
74933
- ...TimeWindowShape,
74934
- where: RecordWhereSchema.optional()
74935
- }), object({ count: number().int() }), { auth: "admin" }), method(object({
74936
- ...KindShape,
74937
- deviceId: number().int().optional(),
74938
- from: number(),
74939
- to: number(),
74940
- bucketMs: number().int().positive()
74941
- }), object({ buckets: array(object({
74942
- bucketStart: number(),
74943
- count: number().int()
74944
- })) }), { auth: "admin" }), method(object({
74945
- ...KindShape,
74946
- op: _enum([
74947
- "sum",
74948
- "min",
74949
- "max",
74950
- "count"
74951
- ]),
74952
- field: RecordFieldPathSchema.optional(),
74953
- groupBy: RecordFieldPathSchema.optional(),
74954
- where: RecordWhereSchema.optional()
74955
- }), object({ rows: array(object({
74956
- group: union([
74957
- string(),
74958
- number(),
74959
- _null()
74960
- ]),
74961
- value: number().nullable()
74962
- })) }), { auth: "admin" }), method(object({
74963
- ...KindShape,
74964
- deviceId: number().int().optional(),
74965
- atBefore: number().optional(),
74966
- where: RecordWhereSchema.optional()
74967
- }), object({
74968
- deleted: number().int(),
74969
- secretRefs: SecretRefsList
74970
- }), {
74971
- kind: "mutation",
74972
- auth: "admin"
74973
- }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
74974
- results: array(object({
74975
- rev: number().int().nullable(),
74976
- deleted: boolean()
74977
- })),
74978
- releasedRefs: SecretRefsList,
74979
- secretRefs: SecretRefsList
74980
- }), {
74981
- kind: "mutation",
74982
- auth: "admin"
74983
- }), method(object({
74984
- deviceId: number().int(),
74985
- kinds: array(RecordKindNameSchema).optional()
74986
- }), object({
74987
- deleted: record(string(), number().int()),
74988
- secretRefs: SecretRefsList
74989
- }), {
74990
- kind: "mutation",
74991
- auth: "admin"
74992
- }), method(object(KindShape), object({ id: number().int() }), {
74993
- kind: "mutation",
74994
- auth: "admin"
74995
- });
74996
- /**
74997
75079
  * record-entries - the ONE admin surface for every list of user-created entries
74998
75080
  * (D881): notification targets, brokers, LLM profiles, anything an addon
74999
75081
  * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
@@ -85828,20 +85910,6 @@ Object.freeze({
85828
85910
  access: "create",
85829
85911
  role: "viewer"
85830
85912
  },
85831
- "broker.add": {
85832
- capName: "broker",
85833
- capScope: "system",
85834
- addonId: null,
85835
- access: "create",
85836
- role: "admin"
85837
- },
85838
- "broker.get": {
85839
- capName: "broker",
85840
- capScope: "system",
85841
- addonId: null,
85842
- access: "view",
85843
- role: "admin"
85844
- },
85845
85913
  "broker.getBrokerConfig": {
85846
85914
  capName: "broker",
85847
85915
  capScope: "system",
@@ -85849,20 +85917,6 @@ Object.freeze({
85849
85917
  access: "view",
85850
85918
  role: "admin"
85851
85919
  },
85852
- "broker.getSettings": {
85853
- capName: "broker",
85854
- capScope: "system",
85855
- addonId: null,
85856
- access: "view",
85857
- role: "admin"
85858
- },
85859
- "broker.getSettingsSchema": {
85860
- capName: "broker",
85861
- capScope: "system",
85862
- addonId: null,
85863
- access: "view",
85864
- role: "admin"
85865
- },
85866
85920
  "broker.getState": {
85867
85921
  capName: "broker",
85868
85922
  capScope: "system",
@@ -85877,20 +85931,6 @@ Object.freeze({
85877
85931
  access: "view",
85878
85932
  role: "admin"
85879
85933
  },
85880
- "broker.list": {
85881
- capName: "broker",
85882
- capScope: "system",
85883
- addonId: null,
85884
- access: "view",
85885
- role: "admin"
85886
- },
85887
- "broker.listProviders": {
85888
- capName: "broker",
85889
- capScope: "system",
85890
- addonId: null,
85891
- access: "view",
85892
- role: "admin"
85893
- },
85894
85934
  "broker.publish": {
85895
85935
  capName: "broker",
85896
85936
  capScope: "system",
@@ -85898,20 +85938,6 @@ Object.freeze({
85898
85938
  access: "create",
85899
85939
  role: "admin"
85900
85940
  },
85901
- "broker.remove": {
85902
- capName: "broker",
85903
- capScope: "system",
85904
- addonId: null,
85905
- access: "delete",
85906
- role: "admin"
85907
- },
85908
- "broker.setSettings": {
85909
- capName: "broker",
85910
- capScope: "system",
85911
- addonId: null,
85912
- access: "create",
85913
- role: "admin"
85914
- },
85915
85941
  "broker.subscribe": {
85916
85942
  capName: "broker",
85917
85943
  capScope: "system",
@@ -85919,20 +85945,6 @@ Object.freeze({
85919
85945
  access: "create",
85920
85946
  role: "admin"
85921
85947
  },
85922
- "broker.testConnection": {
85923
- capName: "broker",
85924
- capScope: "system",
85925
- addonId: null,
85926
- access: "create",
85927
- role: "admin"
85928
- },
85929
- "broker.testSettings": {
85930
- capName: "broker",
85931
- capScope: "system",
85932
- addonId: null,
85933
- access: "create",
85934
- role: "admin"
85935
- },
85936
85948
  "broker.unsubscribe": {
85937
85949
  capName: "broker",
85938
85950
  capScope: "system",
@@ -90896,6 +90908,13 @@ Object.freeze({
90896
90908
  access: "view",
90897
90909
  role: "viewer"
90898
90910
  },
90911
+ "pipelineAnalytics.getMediaLocationCensus": {
90912
+ capName: "pipeline-analytics",
90913
+ capScope: "device",
90914
+ addonId: null,
90915
+ access: "view",
90916
+ role: "admin"
90917
+ },
90899
90918
  "pipelineAnalytics.getMediaReclaimStatus": {
90900
90919
  capName: "pipeline-analytics",
90901
90920
  capScope: "device",
@@ -103463,6 +103482,7 @@ object({
103463
103482
  delay: number().nonnegative().optional(),
103464
103483
  commands: record(string(), unknown())
103465
103484
  });
103485
+ entryBody({ brokerId: string() });
103466
103486
  //#endregion
103467
103487
  //#region src/pipeline-analytics/cluster-model-pin.ts
103468
103488
  /**
@@ -105313,6 +105333,12 @@ Object.defineProperty(exports, "plateGalleryCapability", {
105313
105333
  return plateGalleryCapability;
105314
105334
  }
105315
105335
  });
105336
+ Object.defineProperty(exports, "preconditionOf", {
105337
+ enumerable: true,
105338
+ get: function() {
105339
+ return preconditionOf;
105340
+ }
105341
+ });
105316
105342
  Object.defineProperty(exports, "projectSubjectPath", {
105317
105343
  enumerable: true,
105318
105344
  get: function() {