@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
@@ -6038,7 +6038,7 @@ var ZodIssueCode = {
6038
6038
  var ZodFirstPartyTypeKind;
6039
6039
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6040
6040
  //#endregion
6041
- //#region ../types/dist/sleep-DEZaLbiu.mjs
6041
+ //#region ../types/dist/sleep-BX_MqzUe.mjs
6042
6042
  /**
6043
6043
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6044
6044
  * window to float samples (D455).
@@ -7618,6 +7618,28 @@ var SECRET_RETRY_MAX_MS = 5 * 6e4;
7618
7618
  /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
7619
7619
  var SECRET_CHANGE_DEBOUNCE_MS = 250;
7620
7620
  /**
7621
+ * Pair a catalogue with the function that builds its ports FROM THE MIGRATION API. The one
7622
+ * place a catalogue is bound: a migration reaches nothing a ports binder cannot reach
7623
+ * through `api` (guard `check-migration-ports-surface`).
7624
+ */
7625
+ function migrationSet(catalogue, bindPorts) {
7626
+ return { bind: (api) => defineAddonMigrations(catalogue, bindPorts(api)) };
7627
+ }
7628
+ /** A mixed array is a mistake: the other kind would be dropped without a word. */
7629
+ function refuseMixed(form, kept, dropped) {
7630
+ 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`);
7631
+ }
7632
+ function catalogueOf(list) {
7633
+ const kept = list.filter((entry) => !("execute" in entry));
7634
+ refuseMixed("catalogue, (api) => ports", kept.length, list.length - kept.length);
7635
+ return kept;
7636
+ }
7637
+ function boundOf(list) {
7638
+ const kept = list.filter((entry) => "execute" in entry);
7639
+ refuseMixed("bound migrations", kept.length, list.length - kept.length);
7640
+ return kept;
7641
+ }
7642
+ /**
7621
7643
  * Base class for CamStack addons. Eliminates settings boilerplate:
7622
7644
  *
7623
7645
  * - Typed `config` property with automatic resolution from store + defaults
@@ -7784,23 +7806,21 @@ var BaseAddon = class {
7784
7806
  await this.loadScopedSchemas();
7785
7807
  return normalized;
7786
7808
  }
7809
+ async runMigrations(first, second, third) {
7810
+ if (typeof second === "function") return this.runMigrationSets([migrationSet(catalogueOf(first), second)], third);
7811
+ return this.runBound(boundOf(first), second);
7812
+ }
7787
7813
  /**
7788
- * Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
7789
- * engine. Call it at the point of the boot where the data must already have the new
7790
- * shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
7791
- * restored devices — with the catalogue bound to the addon's ports
7792
- * (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
7793
- *
7794
- * An engine that cannot be reached or refuses the catalogue is logged and runs
7795
- * nothing; the boot continues. A migration that FAILED (or was blocked by one)
7796
- * and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
7797
- * serve data whose shape it cannot trust; `tolerate` migrations never do.
7798
- *
7799
- * ALWAYS pass the whole catalogue; a phase that must run only some of it passes
7800
- * `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
7801
- * omitted applied ids "newer").
7814
+ * Several catalogues of ONE owner in one declaration (the engine replaces an owner's
7815
+ * catalogue on every declare, so two calls would each judge the other's ids "newer").
7816
+ * Build each entry with `migrationSet(catalogue, (api) => ports)`.
7802
7817
  */
7803
- async runMigrations(migrations, options) {
7818
+ async runMigrationSets(sets, options) {
7819
+ const api = this.ctx.migrationApi;
7820
+ if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
7821
+ return this.runBound(sets.flatMap((set) => set.bind(api)), options);
7822
+ }
7823
+ async runBound(migrations, options) {
7804
7824
  const api = this.ctx.api.migrations;
7805
7825
  const report = await runAddonMigrations({
7806
7826
  declareOwner: (input) => api.declareOwner.mutate(input),
@@ -9205,6 +9225,20 @@ function defineRecordKinds(specs) {
9205
9225
  }
9206
9226
  return out;
9207
9227
  }
9228
+ /**
9229
+ * Entry kinds (D881): every list of user-created entries (notification
9230
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
9231
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
9232
+ * through the `record-entries` capability with password fields derived from
9233
+ * the schema (`.meta({ secret: true })`).
9234
+ */
9235
+ /** The body of a plain entry: a name and the fields the kind adds. */
9236
+ function entryBody(shape) {
9237
+ return object({
9238
+ name: string().min(1),
9239
+ ...shape
9240
+ });
9241
+ }
9208
9242
  object({
9209
9243
  field: string().min(1),
9210
9244
  on: literal("advance")
@@ -16233,6 +16267,39 @@ var UnstampedEventMediaCountSchema = object({
16233
16267
  /** Sum across both, or `null` when either lane could not be counted. */
16234
16268
  total: number().int().nonnegative().nullable()
16235
16269
  }).nullable();
16270
+ /**
16271
+ * Where the stored event media sits, per storage location: how many media rows
16272
+ * and how many bytes carry each location id, how many carry none (legacy,
16273
+ * resolved to the default `eventMedia` location), and how many name a location
16274
+ * that was not asked about (a deleted or never-listed one).
16275
+ *
16276
+ * One covering-index aggregate per asked location plus the NULL one, and one
16277
+ * unfiltered total that scans the covering index: O(rows), not a walk of the
16278
+ * rows themselves. `unlisted` is total minus the ASKED locations minus NULL, so
16279
+ * it is a deleted location only when every location id was asked.
16280
+ * `null` is "could not be measured", never zero.
16281
+ */
16282
+ var MediaLocationCensusInputSchema = object({ locationIds: array(string().min(1)).max(50).readonly() });
16283
+ var MediaLocationCensusSchema = object({
16284
+ locations: array(object({
16285
+ locationId: string(),
16286
+ rows: number().int().nonnegative(),
16287
+ bytes: number().nonnegative()
16288
+ })).readonly(),
16289
+ unstamped: object({
16290
+ rows: number().int().nonnegative(),
16291
+ bytes: number().nonnegative()
16292
+ }),
16293
+ /** Rows stamped with a location id that was not in the asked list. */
16294
+ unlisted: object({
16295
+ rows: number().int().nonnegative(),
16296
+ bytes: number().nonnegative()
16297
+ }),
16298
+ total: object({
16299
+ rows: number().int().nonnegative(),
16300
+ bytes: number().nonnegative()
16301
+ })
16302
+ });
16236
16303
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
16237
16304
  /** The independently selectable logical storage classes — every class
16238
16305
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -47812,52 +47879,7 @@ onBrightnessChanged: { data: object({
47812
47879
  minIntervalMs: 0
47813
47880
  } } }
47814
47881
  };
47815
- /**
47816
- * `broker` — unified pub/sub broker registry, system-scoped collection.
47817
- *
47818
- * The cap models any kind-tagged message broker the user wants to
47819
- * register and that other addons might consume. The first two kinds
47820
- * are MQTT (mosquitto / aedes embedded / cloud bridge) and
47821
- * Home Assistant (HA WebSocket — subscribe_entities + call_service).
47822
- * Future kinds (Zigbee2MQTT bridge, ZHA, KNX, Telegram, …) plug in
47823
- * the same surface.
47824
- *
47825
- * Why one cap, not one cap per kind:
47826
- * - The integrations page wants a single table of "every broker"
47827
- * across kinds; a unified cap drives it without join logic.
47828
- * - Generic admin operations (add / remove / test / status) are
47829
- * identical across kinds — duplicating them per cap was busywork.
47830
- * - The `network-access` cap precedent: same interface, many
47831
- * `providerKind: 'ingress'` implementations (Tailscale, ngrok, …).
47832
- *
47833
- * What stays kind-specific:
47834
- * - `getBrokerConfig` payload (kind decides whether it returns
47835
- * mqtt URL+creds, HA baseUrl+token, …) — typed as
47836
- * `Record<string, unknown>` at the wire; consumers narrow.
47837
- * - `publish` / `subscribe` / `getState` arguments (target / filter /
47838
- * key) — also typed as `Record<string, unknown>` so each kind can
47839
- * evolve its surface (MQTT topic+qos vs HA entity_id+domain)
47840
- * without rebreaking the cap signature.
47841
- * - `add` `settings` payload (different fields per kind, validated by
47842
- * the kind-specific provider).
47843
- *
47844
- * Bidirectionality:
47845
- * - `publish` is RPC — synchronous result (provider-defined).
47846
- * - `subscribe` returns a subscription handle; the actual message
47847
- * stream flows over the typed event-bus as `broker.message` events
47848
- * keyed by `(brokerId, subscriptionId)`. Consumers filter in their
47849
- * event handler. Subscriptions persist across reconnects — the
47850
- * provider re-subscribes upstream after a transport drop.
47851
- *
47852
- * Why event-bus push (not a subscription RPC stream):
47853
- * - Matches the rest of CamStack's D8 contract — events for telemetry,
47854
- * RPC for loss-is-a-bug. Broker messages are telemetry (a single
47855
- * drop is recoverable via `getState({key})`).
47856
- * - Frees `broker.subscribe` from holding a long-lived RPC channel.
47857
- * - Cross-process: events already route through `$event-bus`; no
47858
- * per-broker wire-shaping needed.
47859
- */
47860
- var BrokerStatusEnum = _enum([
47882
+ _enum([
47861
47883
  "connected",
47862
47884
  "disconnected",
47863
47885
  "connecting",
@@ -47865,141 +47887,12 @@ var BrokerStatusEnum = _enum([
47865
47887
  "unreachable",
47866
47888
  "error"
47867
47889
  ]);
47868
- var BrokerInfoSchema = object({
47869
- /** Stable broker id. Persisted; survives addon restarts. */
47870
- id: string(),
47871
- /** Addon id of the provider that OWNS this broker.
47872
- *
47873
- * The `broker` cap is a system-scoped collection: several addons
47874
- * register a `broker` provider, each owning a DISJOINT set of
47875
- * brokers (mqtt-broker owns `mqtt_*`, provider-homeassistant owns
47876
- * `ha_*`). A broker therefore belongs to exactly one addon — like a
47877
- * device belongs to one integration. The admin UI threads this id
47878
- * back as the `{ addonId }` system-collection selector on every
47879
- * id-keyed call (`get` / `getSettings` / `setSettings` / `remove` /
47880
- * `testConnection`), so the call routes to the OWNING provider
47881
- * instead of defaulting to the first-registered one. */
47882
- addonId: string(),
47883
- /** Human-readable name (operator-chosen at add-time). */
47884
- name: string(),
47885
- /** Provider-defined kind tag — `mqtt` / `home-assistant` / future. */
47886
- kind: string(),
47887
- status: BrokerStatusEnum,
47888
- /** Free-form provider-specific info (HA version, MQTT broker
47889
- * flavour, latency, mTLS active, …). */
47890
- info: record(string(), unknown()),
47891
- /** Ms epoch of the last connection probe / status update. */
47892
- lastCheckedAt: number().nullable(),
47893
- /** Last error message, when `status` indicates failure. */
47894
- error: string().nullable()
47895
- });
47896
47890
  var RegistryStatusSchema = object({
47897
47891
  brokerCount: number().int().nonnegative(),
47898
47892
  connectedCount: number().int().nonnegative()
47899
47893
  });
47900
- /**
47901
- * One entry per `broker` provider — which addon provides which broker
47902
- * kind(s). The unified create picker reads this to know, for each
47903
- * (addonId, kind) pair the operator can pick, where to route the
47904
- * follow-up `getSettingsSchema` / `testSettings` / `add` calls (via the
47905
- * `{ addonId }` selector). A provider only advertises a kind here when
47906
- * it implements `getSettingsSchema` for that kind (so the picker never
47907
- * offers a kind whose creation form can't be rendered).
47908
- */
47909
- var BrokerProviderInfoSchema = object({
47910
- /** Addon id of the `broker` provider this entry describes. */
47911
- addonId: string(),
47912
- /** Broker kinds this provider can create, with a display label. */
47913
- kinds: array(object({
47914
- kind: string(),
47915
- label: string(),
47916
- /**
47917
- * Relative hub path to start an interactive account link (OAuth popup).
47918
- * May include `{{brokerId}}`; admin-ui substitutes and appends `?popup=1`.
47919
- */
47920
- interactiveConnectPath: string().min(1).optional(),
47921
- /** Relative hub path to disconnect the linked account (same popup pattern). */
47922
- interactiveDisconnectPath: string().min(1).optional(),
47923
- /**
47924
- * The kind signs in through a server-held interactive session instead of
47925
- * (or before) typed credentials. `basePath` is a hub-relative route set
47926
- * served by the owning addon (`/addon/<id>/...`) speaking the sign-in
47927
- * contract: `POST {basePath}/start` (body: the form's settings) answers
47928
- * `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
47929
- * `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
47930
- * 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
47931
- * (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
47932
- * existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
47933
- * (`{ sessionId }`) drops the session. The dialog that edits a broker
47934
- * offers it as the default path; the fields the session fills are
47935
- * marked `filledBySignIn` in the kind's settings schema.
47936
- *
47937
- * `methods` lists the ways the session can sign in, recommended first:
47938
- * `'device-code'` adds `POST {basePath}/code/start` (body: the form's
47939
- * settings) answering `{ sessionId, userCode, verificationUrl,
47940
- * expiresAt }` — the operator types `userCode` at `verificationUrl` on
47941
- * any device, and the same `status` / `commit` / `cancel` routes follow
47942
- * (status then carries `method`, `userCode`, `verificationUrl`,
47943
- * `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
47944
- * `'proxy'` is the `{basePath}/start` flow above. Absent means
47945
- * `['proxy']`.
47946
- */
47947
- signIn: object({
47948
- basePath: string().min(1),
47949
- methods: array(_enum(["device-code", "proxy"])).optional()
47950
- }).optional()
47951
- }))
47952
- });
47953
- var ListInputSchema = object({
47954
- /** Optional kind filter — `list({kind:'home-assistant'})` returns
47955
- * only HA brokers. Omit to list every broker. */
47956
- kind: string().optional() });
47957
47894
  var GetInputSchema = object({ id: string() });
47958
- var AddInputSchema = object({
47959
- kind: string().min(1),
47960
- name: string().min(1),
47961
- /**
47962
- * ADOPT an existing id instead of minting a new one.
47963
- *
47964
- * Written the day this cost an outage. A broker's id is not a detail: HA
47965
- * devices carry it inside their `stableId` (`ha:ha_004:dev:…`), so a broker
47966
- * lost from config and re-added as `ha_001` leaves every one of its devices
47967
- * bound to a broker that no longer exists. Re-entering the password under the
47968
- * ORIGINAL id turns a multi-step device migration back into re-entering a
47969
- * password.
47970
- *
47971
- * A provider MUST refuse an id that is already in use — adopting a live
47972
- * broker's id would silently take it over.
47973
- */
47974
- id: string().min(1).optional(),
47975
- /** Kind-specific settings (e.g. MQTT `{url,username,password}` or HA
47976
- * `{baseUrl,accessToken}`). Validated by the kind-specific provider
47977
- * branch on receipt — invalid shape rejects the add. */
47978
- settings: record(string(), unknown())
47979
- });
47980
- var AddResultSchema = object({ id: string() });
47981
- var RemoveInputSchema = object({ id: string() });
47982
- var TestConnectionResultSchema = discriminatedUnion("ok", [object({
47983
- ok: literal(true),
47984
- latencyMs: number().nonnegative()
47985
- }), object({
47986
- ok: literal(false),
47987
- error: string()
47988
- })]);
47989
47895
  var SettingsRecordSchema$1 = record(string(), unknown());
47990
- var SettingsSchemaInputSchema = object({ kind: string() });
47991
- var TestSettingsInputSchema = object({
47992
- kind: string(),
47993
- settings: SettingsRecordSchema$1
47994
- });
47995
- var TestSettingsResultSchema = discriminatedUnion("ok", [object({
47996
- ok: literal(true),
47997
- latencyMs: number().nonnegative().optional()
47998
- }).strict(), object({
47999
- ok: literal(false),
48000
- error: string()
48001
- })]);
48002
- var SettingsSchemaResultSchema = unknown().nullable();
48003
47896
  var PublishInputSchema = object({
48004
47897
  brokerId: string(),
48005
47898
  /** Kind-specific routing target.
@@ -48033,25 +47926,7 @@ var GetStateInputSchema = object({
48033
47926
  * HA: entity_id (returns the cached entity state). */
48034
47927
  key: string()
48035
47928
  });
48036
- method(ListInputSchema, array(BrokerInfoSchema)), method(GetInputSchema, BrokerInfoSchema.nullable()), method(_void(), array(BrokerProviderInfoSchema), { auth: "admin" }), method(AddInputSchema, AddResultSchema, {
48037
- kind: "mutation",
48038
- auth: "admin"
48039
- }), method(RemoveInputSchema, _void(), {
48040
- kind: "mutation",
48041
- auth: "admin"
48042
- }), method(GetInputSchema, TestConnectionResultSchema, {
48043
- kind: "mutation",
48044
- auth: "admin"
48045
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(object({
48046
- id: string(),
48047
- settings: SettingsRecordSchema$1
48048
- }), _void(), {
48049
- kind: "mutation",
48050
- auth: "admin"
48051
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(SettingsSchemaInputSchema, SettingsSchemaResultSchema, { auth: "admin" }), method(TestSettingsInputSchema, TestSettingsResultSchema, {
48052
- kind: "mutation",
48053
- auth: "admin"
48054
- }), method(PublishInputSchema, unknown(), {
47929
+ method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
48055
47930
  kind: "mutation",
48056
47931
  auth: "admin"
48057
47932
  }), method(SubscribeInputSchema, SubscribeResultSchema, {
@@ -52988,14 +52863,20 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
52988
52863
  }), array(DiscoveryCandidateSchema), {
52989
52864
  kind: "mutation",
52990
52865
  auth: "admin"
52991
- }), method(object({}), CreationSchemaOutputSchema), method(object({}), object({ deviceType: _enum(DeviceType).nullable() })), method(object({
52866
+ }), method(object({}), CreationSchemaOutputSchema), method(object({
52867
+ /** The integration asked about; a provider whose integrations differ answers per one. */
52868
+ integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })), method(object({
52992
52869
  candidate: DiscoveryCandidateSchema,
52993
52870
  /** The integration the operator adopts into; a provider with several instances needs it. */
52994
52871
  integrationId: string().optional()
52995
52872
  }), DeviceSummarySchema, {
52996
52873
  kind: "mutation",
52997
52874
  auth: "admin"
52998
- }), method(object({}), boolean()), method(object({ type: _enum(DeviceType) }), CreationSchemaOutputSchema), method(object({
52875
+ }), method(object({}), boolean()), method(object({
52876
+ type: _enum(DeviceType),
52877
+ /** The integration asked about; a provider whose integrations differ answers per one. */
52878
+ integrationId: string().optional()
52879
+ }), CreationSchemaOutputSchema), method(object({
52999
52880
  type: _enum(DeviceType),
53000
52881
  config: record(string(), unknown()),
53001
52882
  /** The integration the operator adds the device to; a provider with several instances needs it. */
@@ -53713,7 +53594,10 @@ method(object({
53713
53594
  auth: "admin"
53714
53595
  }), method(object({
53715
53596
  addonId: string(),
53716
- type: _enum(DeviceType)
53597
+ type: _enum(DeviceType),
53598
+ /** The integration the form is for; a provider whose integrations differ (a hub
53599
+ * integration takes no manual add) answers per integration. Absent = the addon's own. */
53600
+ integrationId: string().optional()
53717
53601
  }), unknown().nullable()), method(object({
53718
53602
  addonId: string(),
53719
53603
  type: _enum(DeviceType),
@@ -53797,7 +53681,11 @@ method(object({
53797
53681
  kind: "mutation",
53798
53682
  auth: "admin",
53799
53683
  timeoutMs: 12e4
53800
- }), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
53684
+ }), method(object({
53685
+ addonId: string(),
53686
+ /** The integration the Add-Device dialog is open on; absent = the addon's own. */
53687
+ integrationId: string().optional()
53688
+ }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
53801
53689
  deviceId: number(),
53802
53690
  key: string(),
53803
53691
  value: unknown()
@@ -57220,7 +57108,7 @@ var TestConnectionStatusEnum = _enum([
57220
57108
  "inconclusive",
57221
57109
  "unsupported"
57222
57110
  ]);
57223
- var TestConnectionResultSchema$1 = object({
57111
+ var TestConnectionResultSchema = object({
57224
57112
  /** True ONLY for `validated`. Never true for a test that did not run. */
57225
57113
  success: boolean(),
57226
57114
  error: string().optional(),
@@ -57265,7 +57153,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
57265
57153
  }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
57266
57154
  addonId: string(),
57267
57155
  settings: record(string(), unknown())
57268
- }), TestConnectionResultSchema$1, {
57156
+ }), TestConnectionResultSchema, {
57269
57157
  kind: "mutation",
57270
57158
  auth: "admin"
57271
57159
  });
@@ -57292,6 +57180,14 @@ var ConfigSchemaPassthrough$3 = custom();
57292
57180
  var IntegrationInstanceIdSchema = string().min(1);
57293
57181
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
57294
57182
  /**
57183
+ * What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
57184
+ * instance is an integration that brings devices (the registry owns its on/off switch);
57185
+ * `services`: a connection configured from the addon's own function page, never listed on
57186
+ * Integrations.
57187
+ * It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
57188
+ */
57189
+ var IntegrationInstanceRoleSchema = _enum(["devices", "services"]);
57190
+ /**
57295
57191
  * One kind of instance a provider can create (an adapter, an account type). The sign-in and
57296
57192
  * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
57297
57193
  * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
@@ -57302,6 +57198,22 @@ var IntegrationInstanceKindSchema = object({
57302
57198
  /** Stable id of the kind, sent back as `createInstance.kind`. */
57303
57199
  id: string().min(1),
57304
57200
  label: string().min(1),
57201
+ /**
57202
+ * The function capability this kind is configured for (`broker`, `smtp-provider`,
57203
+ * `device-provider`, ...). A page section is the kinds whose `functionCap` it names (D1013); a
57204
+ * provider with more than one section must name it on every kind.
57205
+ */
57206
+ functionCap: string().min(1),
57207
+ /**
57208
+ * For `functionCap: 'broker'`: the registry kind of the broker an instance of this kind is
57209
+ * (`matter`, `home-assistant`, ...). A caller that needs a broker of one kind (a link field)
57210
+ * finds the instances whose kind names it; absent takes the kind `id`.
57211
+ */
57212
+ brokerKind: string().min(1).optional(),
57213
+ /** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
57214
+ role: IntegrationInstanceRoleSchema.optional(),
57215
+ /** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
57216
+ canTest: boolean().optional(),
57305
57217
  /** The kind signs in through a server-held interactive session. */
57306
57218
  signIn: object({
57307
57219
  basePath: string().min(1),
@@ -57314,11 +57226,7 @@ var IntegrationInstanceKindSchema = object({
57314
57226
  });
57315
57227
  var IntegrationInstanceDescriptionSchema = object({
57316
57228
  /** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
57317
- role: _enum([
57318
- "devices",
57319
- "services",
57320
- "both"
57321
- ]),
57229
+ role: IntegrationInstanceRoleSchema,
57322
57230
  /** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
57323
57231
  discovery: object({
57324
57232
  mode: _enum([
@@ -57386,10 +57294,16 @@ var IntegrationInstancePatchSchema = object({
57386
57294
  /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
57387
57295
  values: record(string(), unknown())
57388
57296
  });
57389
- 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({
57297
+ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({
57298
+ id: IntegrationInstanceIdSchema.nullable(),
57299
+ /** The kind of the create form (`id: null`) of a provider with several. */
57300
+ kind: string().min(1).optional()
57301
+ }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
57390
57302
  id: IntegrationInstanceIdSchema.optional(),
57391
57303
  name: string().min(1),
57392
- kind: string().min(1).optional()
57304
+ kind: string().min(1).optional(),
57305
+ /** Form values written with the record (a link picked in the create dialog). */
57306
+ values: record(string(), unknown()).optional()
57393
57307
  }), object({ id: string() }), {
57394
57308
  kind: "mutation",
57395
57309
  auth: "admin"
@@ -57407,8 +57321,10 @@ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method
57407
57321
  auth: "admin"
57408
57322
  }), optionalMethod(object({
57409
57323
  id: IntegrationInstanceIdSchema.nullable(),
57410
- values: record(string(), unknown())
57411
- }), TestConnectionResultSchema$1, {
57324
+ values: record(string(), unknown()),
57325
+ /** The kind to test when `id` is null and the provider has several. */
57326
+ kind: string().min(1).optional()
57327
+ }), TestConnectionResultSchema, {
57412
57328
  kind: "mutation",
57413
57329
  auth: "admin"
57414
57330
  });
@@ -60283,6 +60199,380 @@ var SystemMetricsSchema = object({
60283
60199
  gpuMemoryPercent: number().optional()
60284
60200
  });
60285
60201
  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);
60202
+ /**
60203
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
60204
+ * config documents, mirrors. The third storage API next to `ctx.settings`
60205
+ * (operator intent, D870) and device-history (numbers over time, D850).
60206
+ *
60207
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
60208
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
60209
+ * that with the addon id closed over). It is deliberately NOT in any input
60210
+ * schema, so a session can never supply it, and a call with no stamp is refused
60211
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
60212
+ * addons go through the owner's capability.
60213
+ *
60214
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
60215
+ * never `[]`. Secret fields are never on the wire: a read shows the
60216
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
60217
+ * resolves itself, and a write may carry only a keychain marker bound to the
60218
+ * row's own ref.
60219
+ *
60220
+ * Internal: addons reach it through `ctx.records`, never directly.
60221
+ */
60222
+ var RecordIdSchema = string().min(1).max(256);
60223
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
60224
+ var RecordBodySchema = record(string(), unknown());
60225
+ var RecordInputSchema = object({
60226
+ id: RecordIdSchema,
60227
+ /** The device this row belongs to (D865 removal, per-device reads). */
60228
+ deviceId: number().int().optional(),
60229
+ /** The domain clock, ms: observed / created / opened. */
60230
+ at: number().int().optional(),
60231
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
60232
+ expiresAt: number().int().optional(),
60233
+ data: RecordBodySchema
60234
+ });
60235
+ var RecordViewSchema = object({
60236
+ id: string(),
60237
+ deviceId: number().int().nullable(),
60238
+ at: number().nullable(),
60239
+ expiresAt: number().nullable(),
60240
+ rev: number().int(),
60241
+ updatedAt: number(),
60242
+ data: RecordBodySchema
60243
+ });
60244
+ /** Declared index fields only. Anything else does not compile, by design. */
60245
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
60246
+ string(),
60247
+ number(),
60248
+ boolean(),
60249
+ object({ in: array(union([
60250
+ string(),
60251
+ number(),
60252
+ boolean()
60253
+ ])).min(1).max(RECORD_BATCH_MAX) }),
60254
+ object({
60255
+ gt: union([string(), number()]).optional(),
60256
+ gte: union([string(), number()]).optional(),
60257
+ lt: union([string(), number()]).optional(),
60258
+ lte: union([string(), number()]).optional()
60259
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
60260
+ ]));
60261
+ var KindShape = { kind: RecordKindNameSchema };
60262
+ var TimeWindowShape = {
60263
+ deviceId: number().int().optional(),
60264
+ atFrom: number().optional(),
60265
+ atTo: number().optional()
60266
+ };
60267
+ var RecordQueryInputSchema = object({
60268
+ ...KindShape,
60269
+ ...TimeWindowShape,
60270
+ where: RecordWhereSchema.optional(),
60271
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
60272
+ order: _enum(["at", "id"]).optional(),
60273
+ desc: boolean().optional(),
60274
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
60275
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
60276
+ cursor: string().min(1).optional()
60277
+ });
60278
+ var RecordQueryResultSchema = object({
60279
+ records: array(RecordViewSchema),
60280
+ nextCursor: string().nullable()
60281
+ });
60282
+ var RecordKindStateSchema = _enum([
60283
+ "created",
60284
+ "unchanged",
60285
+ "updated"
60286
+ ]);
60287
+ var DeclareKindResultSchema = object({
60288
+ kindId: number().int(),
60289
+ state: RecordKindStateSchema,
60290
+ createdIndexes: array(string())
60291
+ });
60292
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
60293
+ var SecretRefsList = array(string());
60294
+ /**
60295
+ * One op of a `transact`: the single-row writes, each on a kind of the caller.
60296
+ * All ops of one call share ONE database file and ONE `transactFamily`.
60297
+ */
60298
+ var RecordTransactOpSchema = discriminatedUnion("op", [
60299
+ object({
60300
+ op: literal("put"),
60301
+ kind: RecordKindNameSchema,
60302
+ record: RecordInputSchema,
60303
+ ifRev: number().int().min(0).optional()
60304
+ }),
60305
+ object({
60306
+ op: literal("patch"),
60307
+ kind: RecordKindNameSchema,
60308
+ id: RecordIdSchema,
60309
+ data: RecordBodySchema,
60310
+ at: number().int().nullable().optional(),
60311
+ expiresAt: number().int().nullable().optional(),
60312
+ ifRev: number().int().min(1).optional()
60313
+ }),
60314
+ object({
60315
+ op: literal("delete"),
60316
+ kind: RecordKindNameSchema,
60317
+ id: RecordIdSchema
60318
+ })
60319
+ ]);
60320
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
60321
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
60322
+ kind: "mutation",
60323
+ auth: "admin"
60324
+ }), method(object({
60325
+ ...KindShape,
60326
+ id: RecordIdSchema
60327
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
60328
+ ...KindShape,
60329
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
60330
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
60331
+ ...KindShape,
60332
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
60333
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
60334
+ ...KindShape,
60335
+ record: RecordInputSchema,
60336
+ /** Compare-and-set. `0` means "the row must not exist". */
60337
+ ifRev: number().int().min(0).optional()
60338
+ }), object({
60339
+ rev: number().int(),
60340
+ releasedRefs: SecretRefsList
60341
+ }), {
60342
+ kind: "mutation",
60343
+ auth: "admin"
60344
+ }), method(object({
60345
+ ...KindShape,
60346
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
60347
+ }), object({
60348
+ count: number().int(),
60349
+ releasedRefs: SecretRefsList
60350
+ }), {
60351
+ kind: "mutation",
60352
+ auth: "admin"
60353
+ }), method(object({
60354
+ ...KindShape,
60355
+ id: RecordIdSchema,
60356
+ data: RecordBodySchema,
60357
+ at: number().int().nullable().optional(),
60358
+ expiresAt: number().int().nullable().optional(),
60359
+ ifRev: number().int().min(1).optional()
60360
+ }), object({
60361
+ rev: number().int(),
60362
+ releasedRefs: SecretRefsList
60363
+ }), {
60364
+ kind: "mutation",
60365
+ auth: "admin"
60366
+ }), method(object({
60367
+ ...KindShape,
60368
+ id: RecordIdSchema
60369
+ }), object({
60370
+ deleted: boolean(),
60371
+ secretRefs: SecretRefsList
60372
+ }), {
60373
+ kind: "mutation",
60374
+ auth: "admin"
60375
+ }), method(object({
60376
+ ...KindShape,
60377
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
60378
+ }), object({
60379
+ deleted: number().int(),
60380
+ secretRefs: SecretRefsList
60381
+ }), {
60382
+ kind: "mutation",
60383
+ auth: "admin"
60384
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
60385
+ ...KindShape,
60386
+ ...TimeWindowShape,
60387
+ where: RecordWhereSchema.optional()
60388
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
60389
+ ...KindShape,
60390
+ deviceId: number().int().optional(),
60391
+ from: number(),
60392
+ to: number(),
60393
+ bucketMs: number().int().positive()
60394
+ }), object({ buckets: array(object({
60395
+ bucketStart: number(),
60396
+ count: number().int()
60397
+ })) }), { auth: "admin" }), method(object({
60398
+ ...KindShape,
60399
+ op: _enum([
60400
+ "sum",
60401
+ "min",
60402
+ "max",
60403
+ "count"
60404
+ ]),
60405
+ field: RecordFieldPathSchema.optional(),
60406
+ groupBy: RecordFieldPathSchema.optional(),
60407
+ where: RecordWhereSchema.optional()
60408
+ }), object({ rows: array(object({
60409
+ group: union([
60410
+ string(),
60411
+ number(),
60412
+ _null()
60413
+ ]),
60414
+ value: number().nullable()
60415
+ })) }), { auth: "admin" }), method(object({
60416
+ ...KindShape,
60417
+ deviceId: number().int().optional(),
60418
+ atBefore: number().optional(),
60419
+ where: RecordWhereSchema.optional()
60420
+ }), object({
60421
+ deleted: number().int(),
60422
+ secretRefs: SecretRefsList
60423
+ }), {
60424
+ kind: "mutation",
60425
+ auth: "admin"
60426
+ }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
60427
+ results: array(object({
60428
+ rev: number().int().nullable(),
60429
+ deleted: boolean()
60430
+ })),
60431
+ releasedRefs: SecretRefsList,
60432
+ secretRefs: SecretRefsList
60433
+ }), {
60434
+ kind: "mutation",
60435
+ auth: "admin"
60436
+ }), method(object({
60437
+ deviceId: number().int(),
60438
+ kinds: array(RecordKindNameSchema).optional()
60439
+ }), object({
60440
+ deleted: record(string(), number().int()),
60441
+ secretRefs: SecretRefsList
60442
+ }), {
60443
+ kind: "mutation",
60444
+ auth: "admin"
60445
+ }), method(object(KindShape), object({ id: number().int() }), {
60446
+ kind: "mutation",
60447
+ auth: "admin"
60448
+ });
60449
+ /**
60450
+ * The wire shapes of the migration API, version 1 (planning#447).
60451
+ *
60452
+ * A migration is code that outlives the server it was written against: an addon at
60453
+ * version 1.4 that is brought to 1.9 in one jump still runs its 1.4 catalogue, against
60454
+ * the 1.9 kernel. The only thing that code may call is {@link MigrationApiV1}; this file
60455
+ * is the contract of every method of it, one Zod pair per method.
60456
+ *
60457
+ * APPEND-ONLY. A released method is never removed and never changes meaning: an input
60458
+ * field is never removed or made required, an enum never narrows, an output field is
60459
+ * never removed. A change that cannot be expressed that way is `migration-api.v2`, next
60460
+ * to this file. `scripts/check-migration-api-append-only.ts` holds the line against
60461
+ * `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
60462
+ * `it('<id>'` in `migration-api.contract.spec.ts`.
60463
+ */
60464
+ var Rows = record(string(), unknown());
60465
+ var IntegrationId = object({ integrationId: string().min(1) });
60466
+ var RecordId = object({ id: string().min(1) });
60467
+ var RecordRowSchema = object({
60468
+ id: string(),
60469
+ deviceId: number().int().nullable(),
60470
+ at: number().nullable(),
60471
+ expiresAt: number().nullable(),
60472
+ rev: number().int(),
60473
+ updatedAt: number(),
60474
+ data: Rows
60475
+ });
60476
+ var RecordPutShape = {
60477
+ id: string().min(1),
60478
+ deviceId: number().int().optional(),
60479
+ at: number().int().optional(),
60480
+ expiresAt: number().int().optional(),
60481
+ data: Rows
60482
+ };
60483
+ var MigrationIntegrationSchema = object({
60484
+ id: string(),
60485
+ addonId: string(),
60486
+ name: string(),
60487
+ info: Rows,
60488
+ originStableId: string().optional()
60489
+ });
60490
+ var MigrationDeviceSchema = object({
60491
+ id: number().int(),
60492
+ integrationId: string().nullable().optional(),
60493
+ /** The owning device; null or absent for a root. */
60494
+ parentDeviceId: number().int().nullable().optional(),
60495
+ type: string().optional(),
60496
+ name: string().optional(),
60497
+ stableId: string().optional()
60498
+ });
60499
+ /** What the engine says about the migration API it serves: lets an addon notice an older server. */
60500
+ var MigrationApiInfoSchema = object({
60501
+ version: number().int(),
60502
+ methods: array(string())
60503
+ });
60504
+ object({
60505
+ message: string(),
60506
+ meta: Rows.optional(),
60507
+ /** Grouping tags of the line; a line about a device carries `{ deviceId }`. */
60508
+ tags: object({ deviceId: number().int().optional() }).optional()
60509
+ });
60510
+ object({
60511
+ owner: string().min(1),
60512
+ metas: array(MigrationMetaSchema)
60513
+ }), object({
60514
+ bootId: string(),
60515
+ snapshot: _enum([
60516
+ "none",
60517
+ "written",
60518
+ "refused"
60519
+ ]),
60520
+ steps: array(MigrationOwnerStepSchema),
60521
+ /** The migration API the engine serves; absent from a server that predates it. */
60522
+ migrationApi: MigrationApiInfoSchema.optional()
60523
+ }), object({ id: string().min(1) }), object({
60524
+ proceed: boolean(),
60525
+ state: union([literal("pending"), MigrationStatusSchema]),
60526
+ reason: string().nullable()
60527
+ }), object({
60528
+ id: string().min(1),
60529
+ result: MigrationOwnerResultSchema
60530
+ }), object({
60531
+ status: MigrationStatusSchema,
60532
+ error: string().nullable(),
60533
+ rowsChanged: number().int().nonnegative()
60534
+ }), object({
60535
+ rows: number().int().nonnegative(),
60536
+ secrets: number().int().nonnegative()
60537
+ }), IntegrationId.extend({ patch: Rows }), object({ written: boolean() }), IntegrationId.extend({ keys: array(string().min(1)) }), object({
60538
+ present: boolean(),
60539
+ removed: Rows
60540
+ }), RecordRowSchema.nullable(), RecordRowSchema.nullable(), object({
60541
+ ...RecordPutShape,
60542
+ ifRev: number().int().optional()
60543
+ }), object({ rev: number().int() }), object({ records: array(object(RecordPutShape)) }), object({ count: number().int().nonnegative() }), RecordId.extend({
60544
+ partial: Rows,
60545
+ ifRev: number().int().optional()
60546
+ }), object({ rev: number().int() }), object({ deleted: boolean() }), object({
60547
+ deviceId: number().int().optional(),
60548
+ atFrom: number().optional(),
60549
+ atTo: number().optional(),
60550
+ where: RecordWhereSchema.optional(),
60551
+ limit: number().int().min(1).optional(),
60552
+ cursor: string().min(1).optional(),
60553
+ resolveSecrets: boolean().optional()
60554
+ }), object({
60555
+ records: array(RecordRowSchema),
60556
+ nextCursor: string().nullable()
60557
+ }), object({
60558
+ deviceId: number().int().optional(),
60559
+ atBefore: number().optional(),
60560
+ where: RecordWhereSchema.optional()
60561
+ }), 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({
60562
+ ref: string().min(1),
60563
+ value: string()
60564
+ }), object({}), object({ refs: array(string()) }), object({ deleted: number().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
60565
+ addonId: string().min(1),
60566
+ integrationId: string().min(1).optional()
60567
+ }), object({ devices: array(MigrationDeviceSchema) }), object({ deviceId: number().int() }), object({
60568
+ id: number().int(),
60569
+ integrationId: string().nullable(),
60570
+ /** Whether the device carries any stored config; its content is not offered. */
60571
+ hasConfig: boolean()
60572
+ }).nullable(), object({
60573
+ deviceId: number().int(),
60574
+ integrationId: string().min(1)
60575
+ }), object({}), object({}), object({ nodeId: string() }), object({}), object({});
60286
60576
  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({
60287
60577
  id: string().min(1),
60288
60578
  error: string().min(1)
@@ -60312,7 +60602,9 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
60312
60602
  "written",
60313
60603
  "refused"
60314
60604
  ]),
60315
- steps: array(MigrationOwnerStepSchema)
60605
+ steps: array(MigrationOwnerStepSchema),
60606
+ /** The migration API this engine serves (additive: a server that predates it omits it). */
60607
+ migrationApi: MigrationApiInfoSchema.optional()
60316
60608
  }), {
60317
60609
  kind: "mutation",
60318
60610
  auth: "admin"
@@ -63464,6 +63756,20 @@ var pipelineAnalyticsCapability = {
63464
63756
  */
63465
63757
  countUnstampedEventMedia: method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }),
63466
63758
  /**
63759
+ * Stored media per storage location: rows and bytes stamped with each asked
63760
+ * location id, the rows with none, and the rows naming a location that was
63761
+ * not asked about. One indexed aggregate per location (`idx_media_location_size`,
63762
+ * a covering index) plus the NULL one, and one unfiltered total that is a
63763
+ * covering-index scan: O(rows), cheap per row but not constant, so a hub with
63764
+ * millions of rows pays for it once per call. `unlisted` is relative to the
63765
+ * ids ASKED: it means "gone" only when every location id was asked. A failed
63766
+ * read throws; it never reads as zero.
63767
+ */
63768
+ getMediaLocationCensus: method(MediaLocationCensusInputSchema, MediaLocationCensusSchema, {
63769
+ kind: "query",
63770
+ auth: "admin"
63771
+ }),
63772
+ /**
63467
63773
  * How many rows a pass would STILL act on against `toLocationId`.
63468
63774
  *
63469
63775
  * One derivation, two consumers: it is the media lane's denominator (the
@@ -66543,7 +66849,7 @@ var BrokerStatusSchema$1 = _enum([
66543
66849
  "unreachable",
66544
66850
  "tls-error"
66545
66851
  ]);
66546
- var BrokerInfoSchema$1 = object({
66852
+ var BrokerInfoSchema = object({
66547
66853
  id: string(),
66548
66854
  name: string(),
66549
66855
  url: string(),
@@ -66606,7 +66912,7 @@ var StatusSchema = object({
66606
66912
  brokerCount: number(),
66607
66913
  embeddedRunning: boolean()
66608
66914
  });
66609
- method(_void(), array(BrokerInfoSchema$1)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
66915
+ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
66610
66916
  kind: "mutation",
66611
66917
  auth: "admin"
66612
66918
  }), method(IdInputSchema, _void(), {
@@ -74739,253 +75045,6 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, met
74739
75045
  auth: "admin"
74740
75046
  });
74741
75047
  /**
74742
- * records - an addon's own facts and documents (D881): ledgers, audit rows,
74743
- * config documents, mirrors. The third storage API next to `ctx.settings`
74744
- * (operator intent, D870) and device-history (numbers over time, D850).
74745
- *
74746
- * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
74747
- * crossed a process and stated by a hub in-process caller (`ctx.records` does
74748
- * that with the addon id closed over). It is deliberately NOT in any input
74749
- * schema, so a session can never supply it, and a call with no stamp is refused
74750
- * `records/no-caller`. A kind is readable and writable only by its owner; other
74751
- * addons go through the owner's capability.
74752
- *
74753
- * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
74754
- * never `[]`. Secret fields are never on the wire: a read shows the
74755
- * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
74756
- * resolves itself, and a write may carry only a keychain marker bound to the
74757
- * row's own ref.
74758
- *
74759
- * Internal: addons reach it through `ctx.records`, never directly.
74760
- */
74761
- var RecordIdSchema = string().min(1).max(256);
74762
- /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
74763
- var RecordBodySchema = record(string(), unknown());
74764
- var RecordInputSchema = object({
74765
- id: RecordIdSchema,
74766
- /** The device this row belongs to (D865 removal, per-device reads). */
74767
- deviceId: number().int().optional(),
74768
- /** The domain clock, ms: observed / created / opened. */
74769
- at: number().int().optional(),
74770
- /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
74771
- expiresAt: number().int().optional(),
74772
- data: RecordBodySchema
74773
- });
74774
- var RecordViewSchema = object({
74775
- id: string(),
74776
- deviceId: number().int().nullable(),
74777
- at: number().nullable(),
74778
- expiresAt: number().nullable(),
74779
- rev: number().int(),
74780
- updatedAt: number(),
74781
- data: RecordBodySchema
74782
- });
74783
- /** Declared index fields only. Anything else does not compile, by design. */
74784
- var RecordWhereSchema = record(RecordFieldPathSchema, union([
74785
- string(),
74786
- number(),
74787
- boolean(),
74788
- object({ in: array(union([
74789
- string(),
74790
- number(),
74791
- boolean()
74792
- ])).min(1).max(RECORD_BATCH_MAX) }),
74793
- object({
74794
- gt: union([string(), number()]).optional(),
74795
- gte: union([string(), number()]).optional(),
74796
- lt: union([string(), number()]).optional(),
74797
- lte: union([string(), number()]).optional()
74798
- }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
74799
- ]));
74800
- var KindShape = { kind: RecordKindNameSchema };
74801
- var TimeWindowShape = {
74802
- deviceId: number().int().optional(),
74803
- atFrom: number().optional(),
74804
- atTo: number().optional()
74805
- };
74806
- var RecordQueryInputSchema = object({
74807
- ...KindShape,
74808
- ...TimeWindowShape,
74809
- where: RecordWhereSchema.optional(),
74810
- /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
74811
- order: _enum(["at", "id"]).optional(),
74812
- desc: boolean().optional(),
74813
- limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
74814
- /** Opaque keyset cursor from a previous answer. There is no offset. */
74815
- cursor: string().min(1).optional()
74816
- });
74817
- var RecordQueryResultSchema = object({
74818
- records: array(RecordViewSchema),
74819
- nextCursor: string().nullable()
74820
- });
74821
- var RecordKindStateSchema = _enum([
74822
- "created",
74823
- "unchanged",
74824
- "updated"
74825
- ]);
74826
- var DeclareKindResultSchema = object({
74827
- kindId: number().int(),
74828
- state: RecordKindStateSchema,
74829
- createdIndexes: array(string())
74830
- });
74831
- /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
74832
- var SecretRefsList = array(string());
74833
- /**
74834
- * One op of a `transact`: the single-row writes, each on a kind of the caller.
74835
- * All ops of one call share ONE database file and ONE `transactFamily`.
74836
- */
74837
- var RecordTransactOpSchema = discriminatedUnion("op", [
74838
- object({
74839
- op: literal("put"),
74840
- kind: RecordKindNameSchema,
74841
- record: RecordInputSchema,
74842
- ifRev: number().int().min(0).optional()
74843
- }),
74844
- object({
74845
- op: literal("patch"),
74846
- kind: RecordKindNameSchema,
74847
- id: RecordIdSchema,
74848
- data: RecordBodySchema,
74849
- at: number().int().nullable().optional(),
74850
- expiresAt: number().int().nullable().optional(),
74851
- ifRev: number().int().min(1).optional()
74852
- }),
74853
- object({
74854
- op: literal("delete"),
74855
- kind: RecordKindNameSchema,
74856
- id: RecordIdSchema
74857
- })
74858
- ]);
74859
- var RecordSecretRefsSchema = record(string(), record(string(), string()));
74860
- method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
74861
- kind: "mutation",
74862
- auth: "admin"
74863
- }), method(object({
74864
- ...KindShape,
74865
- id: RecordIdSchema
74866
- }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
74867
- ...KindShape,
74868
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74869
- }), array(RecordViewSchema), { auth: "admin" }), method(object({
74870
- ...KindShape,
74871
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74872
- }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
74873
- ...KindShape,
74874
- record: RecordInputSchema,
74875
- /** Compare-and-set. `0` means "the row must not exist". */
74876
- ifRev: number().int().min(0).optional()
74877
- }), object({
74878
- rev: number().int(),
74879
- releasedRefs: SecretRefsList
74880
- }), {
74881
- kind: "mutation",
74882
- auth: "admin"
74883
- }), method(object({
74884
- ...KindShape,
74885
- records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
74886
- }), object({
74887
- count: number().int(),
74888
- releasedRefs: SecretRefsList
74889
- }), {
74890
- kind: "mutation",
74891
- auth: "admin"
74892
- }), method(object({
74893
- ...KindShape,
74894
- id: RecordIdSchema,
74895
- data: RecordBodySchema,
74896
- at: number().int().nullable().optional(),
74897
- expiresAt: number().int().nullable().optional(),
74898
- ifRev: number().int().min(1).optional()
74899
- }), object({
74900
- rev: number().int(),
74901
- releasedRefs: SecretRefsList
74902
- }), {
74903
- kind: "mutation",
74904
- auth: "admin"
74905
- }), method(object({
74906
- ...KindShape,
74907
- id: RecordIdSchema
74908
- }), object({
74909
- deleted: boolean(),
74910
- secretRefs: SecretRefsList
74911
- }), {
74912
- kind: "mutation",
74913
- auth: "admin"
74914
- }), method(object({
74915
- ...KindShape,
74916
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
74917
- }), object({
74918
- deleted: number().int(),
74919
- secretRefs: SecretRefsList
74920
- }), {
74921
- kind: "mutation",
74922
- auth: "admin"
74923
- }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
74924
- ...KindShape,
74925
- ...TimeWindowShape,
74926
- where: RecordWhereSchema.optional()
74927
- }), object({ count: number().int() }), { auth: "admin" }), method(object({
74928
- ...KindShape,
74929
- deviceId: number().int().optional(),
74930
- from: number(),
74931
- to: number(),
74932
- bucketMs: number().int().positive()
74933
- }), object({ buckets: array(object({
74934
- bucketStart: number(),
74935
- count: number().int()
74936
- })) }), { auth: "admin" }), method(object({
74937
- ...KindShape,
74938
- op: _enum([
74939
- "sum",
74940
- "min",
74941
- "max",
74942
- "count"
74943
- ]),
74944
- field: RecordFieldPathSchema.optional(),
74945
- groupBy: RecordFieldPathSchema.optional(),
74946
- where: RecordWhereSchema.optional()
74947
- }), object({ rows: array(object({
74948
- group: union([
74949
- string(),
74950
- number(),
74951
- _null()
74952
- ]),
74953
- value: number().nullable()
74954
- })) }), { auth: "admin" }), method(object({
74955
- ...KindShape,
74956
- deviceId: number().int().optional(),
74957
- atBefore: number().optional(),
74958
- where: RecordWhereSchema.optional()
74959
- }), object({
74960
- deleted: number().int(),
74961
- secretRefs: SecretRefsList
74962
- }), {
74963
- kind: "mutation",
74964
- auth: "admin"
74965
- }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
74966
- results: array(object({
74967
- rev: number().int().nullable(),
74968
- deleted: boolean()
74969
- })),
74970
- releasedRefs: SecretRefsList,
74971
- secretRefs: SecretRefsList
74972
- }), {
74973
- kind: "mutation",
74974
- auth: "admin"
74975
- }), method(object({
74976
- deviceId: number().int(),
74977
- kinds: array(RecordKindNameSchema).optional()
74978
- }), object({
74979
- deleted: record(string(), number().int()),
74980
- secretRefs: SecretRefsList
74981
- }), {
74982
- kind: "mutation",
74983
- auth: "admin"
74984
- }), method(object(KindShape), object({ id: number().int() }), {
74985
- kind: "mutation",
74986
- auth: "admin"
74987
- });
74988
- /**
74989
75048
  * record-entries - the ONE admin surface for every list of user-created entries
74990
75049
  * (D881): notification targets, brokers, LLM profiles, anything an addon
74991
75050
  * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
@@ -85820,20 +85879,6 @@ Object.freeze({
85820
85879
  access: "create",
85821
85880
  role: "viewer"
85822
85881
  },
85823
- "broker.add": {
85824
- capName: "broker",
85825
- capScope: "system",
85826
- addonId: null,
85827
- access: "create",
85828
- role: "admin"
85829
- },
85830
- "broker.get": {
85831
- capName: "broker",
85832
- capScope: "system",
85833
- addonId: null,
85834
- access: "view",
85835
- role: "admin"
85836
- },
85837
85882
  "broker.getBrokerConfig": {
85838
85883
  capName: "broker",
85839
85884
  capScope: "system",
@@ -85841,20 +85886,6 @@ Object.freeze({
85841
85886
  access: "view",
85842
85887
  role: "admin"
85843
85888
  },
85844
- "broker.getSettings": {
85845
- capName: "broker",
85846
- capScope: "system",
85847
- addonId: null,
85848
- access: "view",
85849
- role: "admin"
85850
- },
85851
- "broker.getSettingsSchema": {
85852
- capName: "broker",
85853
- capScope: "system",
85854
- addonId: null,
85855
- access: "view",
85856
- role: "admin"
85857
- },
85858
85889
  "broker.getState": {
85859
85890
  capName: "broker",
85860
85891
  capScope: "system",
@@ -85869,20 +85900,6 @@ Object.freeze({
85869
85900
  access: "view",
85870
85901
  role: "admin"
85871
85902
  },
85872
- "broker.list": {
85873
- capName: "broker",
85874
- capScope: "system",
85875
- addonId: null,
85876
- access: "view",
85877
- role: "admin"
85878
- },
85879
- "broker.listProviders": {
85880
- capName: "broker",
85881
- capScope: "system",
85882
- addonId: null,
85883
- access: "view",
85884
- role: "admin"
85885
- },
85886
85903
  "broker.publish": {
85887
85904
  capName: "broker",
85888
85905
  capScope: "system",
@@ -85890,20 +85907,6 @@ Object.freeze({
85890
85907
  access: "create",
85891
85908
  role: "admin"
85892
85909
  },
85893
- "broker.remove": {
85894
- capName: "broker",
85895
- capScope: "system",
85896
- addonId: null,
85897
- access: "delete",
85898
- role: "admin"
85899
- },
85900
- "broker.setSettings": {
85901
- capName: "broker",
85902
- capScope: "system",
85903
- addonId: null,
85904
- access: "create",
85905
- role: "admin"
85906
- },
85907
85910
  "broker.subscribe": {
85908
85911
  capName: "broker",
85909
85912
  capScope: "system",
@@ -85911,20 +85914,6 @@ Object.freeze({
85911
85914
  access: "create",
85912
85915
  role: "admin"
85913
85916
  },
85914
- "broker.testConnection": {
85915
- capName: "broker",
85916
- capScope: "system",
85917
- addonId: null,
85918
- access: "create",
85919
- role: "admin"
85920
- },
85921
- "broker.testSettings": {
85922
- capName: "broker",
85923
- capScope: "system",
85924
- addonId: null,
85925
- access: "create",
85926
- role: "admin"
85927
- },
85928
85917
  "broker.unsubscribe": {
85929
85918
  capName: "broker",
85930
85919
  capScope: "system",
@@ -90888,6 +90877,13 @@ Object.freeze({
90888
90877
  access: "view",
90889
90878
  role: "viewer"
90890
90879
  },
90880
+ "pipelineAnalytics.getMediaLocationCensus": {
90881
+ capName: "pipeline-analytics",
90882
+ capScope: "device",
90883
+ addonId: null,
90884
+ access: "view",
90885
+ role: "admin"
90886
+ },
90891
90887
  "pipelineAnalytics.getMediaReclaimStatus": {
90892
90888
  capName: "pipeline-analytics",
90893
90889
  capScope: "device",
@@ -103455,6 +103451,7 @@ object({
103455
103451
  delay: number().nonnegative().optional(),
103456
103452
  commands: record(string(), unknown())
103457
103453
  });
103454
+ entryBody({ brokerId: string() });
103458
103455
  //#endregion
103459
103456
  //#region src/pipeline-analytics/cluster-model-pin.ts
103460
103457
  /**