@camstack/addon-mqtt-broker 1.2.129 → 1.2.131

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.
@@ -5587,7 +5587,7 @@ var ZodIssueCode = {
5587
5587
  var ZodFirstPartyTypeKind;
5588
5588
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5589
5589
  //#endregion
5590
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5590
+ //#region ../types/dist/sleep-BSuCCFjf.mjs
5591
5591
  /**
5592
5592
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5593
5593
  * window to float samples (D455).
@@ -7970,9 +7970,9 @@ function normalizeAddonInitResult(result) {
7970
7970
  return result;
7971
7971
  }
7972
7972
  /**
7973
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7974
- * and validates them (`share-token.service.ts` builds its enum from this
7975
- * list); a data plane names the kinds it ACCEPTS in `share`.
7973
+ * The share-view scope kinds a share-link token can carry. The hub mints
7974
+ * and validates them (`ShareViewGrantSchema` builds its
7975
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7976
7976
  */
7977
7977
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7978
7978
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12857,7 +12857,7 @@ var ConvertResultSchema = object({
12857
12857
  * `super_admin` — collapsed onto the single boolean because every
12858
12858
  * non-admin caller is governed by the same scope-check rules; the
12859
12859
  * distinction was only ever used to route role-specific procedures
12860
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12860
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12861
12861
  * with `isAdmin: false` + an explicit scope list.
12862
12862
  */
12863
12863
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13046,10 +13046,12 @@ var AddonRoutesScopeSchema = object({
13046
13046
  type: literal("addon-routes"),
13047
13047
  access: array(MethodAccessSchema).min(1)
13048
13048
  });
13049
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13049
13050
  var CredentialScopeSchema = union([
13050
13051
  literal("*"),
13051
13052
  ShareViewScopeSchema,
13052
13053
  AddonRoutesScopeSchema,
13054
+ PreferencesSelfScopeSchema,
13053
13055
  TokenScopeSchema
13054
13056
  ]);
13055
13057
  object({
@@ -13058,6 +13060,55 @@ object({
13058
13060
  jti: string().min(16),
13059
13061
  scopes: array(CredentialScopeSchema).min(1)
13060
13062
  });
13063
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13064
+ /** A namespace's value: a JSON object, opaque to the hub. */
13065
+ var PreferenceValueSchema = record(string(), unknown());
13066
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13067
+ /** A stored row, as the owner reads it. */
13068
+ var PreferenceRowSchema = object({
13069
+ namespace: PreferenceNamespaceSchema,
13070
+ value: PreferenceValueSchema,
13071
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13072
+ revision: number().int().positive(),
13073
+ updatedAt: number().int(),
13074
+ /** The client id the last writer sent; `null` when it sent none. */
13075
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13076
+ });
13077
+ object({
13078
+ /** Absent: every namespace the caller holds. */
13079
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13080
+ object({ rows: array(PreferenceRowSchema) });
13081
+ object({
13082
+ namespace: PreferenceNamespaceSchema,
13083
+ value: PreferenceValueSchema,
13084
+ /**
13085
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13086
+ * namespace must not exist yet. Any other value that is not the current
13087
+ * revision answers `conflict` and writes nothing.
13088
+ */
13089
+ baseRevision: number().int().nonnegative().optional(),
13090
+ deviceId: PreferenceDeviceIdSchema.optional()
13091
+ });
13092
+ discriminatedUnion("status", [object({
13093
+ status: literal("saved"),
13094
+ row: PreferenceRowSchema
13095
+ }), object({
13096
+ status: literal("conflict"),
13097
+ current: PreferenceRowSchema.nullable()
13098
+ })]);
13099
+ object({ namespace: PreferenceNamespaceSchema });
13100
+ object({
13101
+ /** `false` when the namespace did not exist. */
13102
+ deleted: boolean() });
13103
+ object({
13104
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13105
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13106
+ object({
13107
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13108
+ rows: array(PreferenceRowSchema),
13109
+ /** Namespaces the client listed that no longer exist. */
13110
+ deleted: array(PreferenceNamespaceSchema)
13111
+ });
13061
13112
  _enum(["new-session", "step-up"]);
13062
13113
  /** The languages the hub's app landing pages are written in (D858). */
13063
13114
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -17254,7 +17305,19 @@ var DeviceHistorySubjectSchema = discriminatedUnion("kind", [object({
17254
17305
  kind: literal("node"),
17255
17306
  nodeId: string().min(1)
17256
17307
  })]);
17308
+ /**
17309
+ * `enum` stores a STATE as the ordinal of its value in the series' value list
17310
+ * (`DeviceHistorySeriesInfo.values`, append-only, so an ordinal never changes
17311
+ * meaning); a rollup keeps the time spent in each state (`states`).
17312
+ */
17257
17313
  var DeviceHistoryKindSchema = _enum([
17314
+ "gauge",
17315
+ "counter",
17316
+ "boolean",
17317
+ "enum"
17318
+ ]);
17319
+ /** What a PRODUCER may declare. `enum` is cap-only: its value list is the cap field's. */
17320
+ var DeviceHistoryProducerKindSchema = _enum([
17258
17321
  "gauge",
17259
17322
  "counter",
17260
17323
  "boolean"
@@ -17291,7 +17354,13 @@ var SeriesInfoSchema = object({
17291
17354
  /** `null` is unknown (a `unitFrom` series whose device does not state a unit right now), never a guess. */
17292
17355
  unit: string().nullable(),
17293
17356
  displayName: string(),
17294
- source: _enum(["cap", "addon"]),
17357
+ source: _enum([
17358
+ "cap",
17359
+ "addon",
17360
+ "derived"
17361
+ ]),
17362
+ /** `enum`: the value of each ordinal (index = ordinal); `null` for every other kind. */
17363
+ values: array(string()).readonly().nullable(),
17295
17364
  firstTs: number(),
17296
17365
  lastTs: number()
17297
17366
  });
@@ -17305,17 +17374,31 @@ var QueryPointSchema = object({
17305
17374
  twMean: number().nullable(),
17306
17375
  min: number(),
17307
17376
  max: number(),
17308
- /** `null` is unknown, never zero (D393). */
17309
- last: number().nullable()
17377
+ /** `null` is unknown, never zero (D393). For an `enum` series: the ordinal of {@link state}. */
17378
+ last: number().nullable(),
17379
+ /**
17380
+ * The increase over the point: a `counter`'s growth since the previous point
17381
+ * or bucket (a drop is a reset, counted from zero), and for
17382
+ * {@link DEVICE_HISTORY_ENERGY_KEY} the kWh used in the bucket. `null` for
17383
+ * every other kind, and when it cannot be known.
17384
+ */
17385
+ delta: number().nullable(),
17386
+ /** `enum`: the state in force at the end of the point (the name of `last`); `null` otherwise. */
17387
+ state: string().nullable(),
17388
+ /** `enum` rollup: milliseconds spent in each state inside the bucket; `null` for raw points and other kinds. */
17389
+ states: record(string(), number()).nullable()
17310
17390
  });
17311
17391
  var QuerySeriesSchema = object({
17312
17392
  scope: string(),
17313
17393
  /** The last point STRICTLY BEFORE `from` in the chosen tier, so a step chart can start at the held value. */
17314
17394
  before: object({
17315
17395
  t: number(),
17316
- value: number().nullable()
17396
+ value: number().nullable(),
17397
+ state: string().nullable()
17317
17398
  }).nullable(),
17318
- points: array(QueryPointSchema).readonly()
17399
+ points: array(QueryPointSchema).readonly(),
17400
+ /** A derived key: the stored key its points were computed from; `null` for a stored series. */
17401
+ derivedFrom: string().nullable()
17319
17402
  });
17320
17403
  /** The window part of a query, shared by the device and node forms. */
17321
17404
  var QueryWindowShape = {
@@ -17331,6 +17414,23 @@ var QueryResultSchema = object({
17331
17414
  series: array(QuerySeriesSchema).readonly(),
17332
17415
  truncated: boolean()
17333
17416
  });
17417
+ /** One read of a batch: a device's key or a node's key (exactly one subject). */
17418
+ var QueryManyItemSchema = union([object({
17419
+ deviceId: number().int(),
17420
+ key: string(),
17421
+ scope: string().optional()
17422
+ }), object({
17423
+ forNodeId: string().min(1),
17424
+ key: string(),
17425
+ scope: string().optional()
17426
+ })]);
17427
+ var QueryManyEntrySchema = discriminatedUnion("ok", [object({
17428
+ ok: literal(true),
17429
+ result: QueryResultSchema
17430
+ }), object({
17431
+ ok: literal(false),
17432
+ error: string()
17433
+ })]);
17334
17434
  var TierStatusSchema = object({
17335
17435
  tier: DeviceHistoryResolutionSchema,
17336
17436
  /** `null` until the first background count answered. */
@@ -17386,16 +17486,22 @@ var DeviceHistoryStatusSchema = object({
17386
17486
  lastRefreshAt: number().nullable()
17387
17487
  })
17388
17488
  });
17389
- method(object({ deviceId: number().int() }), array(SeriesInfoSchema).readonly()), method(object({ nodeId: string().min(1) }), array(SeriesInfoSchema).readonly(), { auth: "admin" }), method(object({
17489
+ method(object({ deviceId: number().int() }), array(SeriesInfoSchema).readonly()), method(object({ forNodeId: string().min(1) }), array(SeriesInfoSchema).readonly(), { auth: "admin" }), method(object({
17390
17490
  deviceId: number().int(),
17391
17491
  ...QueryWindowShape
17392
17492
  }), QueryResultSchema), method(object({
17393
- nodeId: string().min(1),
17493
+ forNodeId: string().min(1),
17394
17494
  ...QueryWindowShape
17395
17495
  }), QueryResultSchema, { auth: "admin" }), method(object({
17496
+ items: array(QueryManyItemSchema).min(1).max(24),
17497
+ from: QueryWindowShape.from,
17498
+ to: QueryWindowShape.to,
17499
+ resolution: QueryWindowShape.resolution,
17500
+ maxPoints: QueryWindowShape.maxPoints
17501
+ }), object({ results: array(QueryManyEntrySchema).readonly() }), { auth: "admin" }), method(object({
17396
17502
  name: string().regex(/^[a-z0-9-]+$/),
17397
17503
  subjectKind: _enum(["device", "node"]),
17398
- kind: DeviceHistoryKindSchema,
17504
+ kind: DeviceHistoryProducerKindSchema,
17399
17505
  unit: string().optional(),
17400
17506
  displayName: string().min(1),
17401
17507
  ingest: _enum(["points", "buckets"])
@@ -39985,38 +40091,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39985
40091
  auth: "admin",
39986
40092
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39987
40093
  });
40094
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40095
+ /** What a model (or, by default, every model of a kind) can do. */
40096
+ var LlmModelFeaturesSchema = object({
40097
+ vision: boolean(),
40098
+ tools: boolean(),
40099
+ streaming: boolean()
40100
+ });
40101
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40102
+ var LlmModelInfoSchema = object({
40103
+ id: string(),
40104
+ label: string().optional(),
40105
+ contextLength: number().int().positive().optional(),
40106
+ features: LlmModelFeaturesSchema.partial().optional()
40107
+ });
39988
40108
  /**
39989
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39990
- * methods concat-fan across providers; single-row methods route to ONE
39991
- * provider by the `addonId` in the call input (the notification-output
39992
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39993
- * (hub-placed); the cap stays open for future providers.
39994
- *
39995
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39996
- * `apiKey` is a password field — providers REDACT it on read and merge on
39997
- * write; a stored key NEVER round-trips to a client.
40109
+ * The provider-specific part of a profile, validated by the provider that owns
40110
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40111
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40112
+ * keychain, never in the row, and reads back as the redaction marker.
39998
40113
  */
39999
- var LlmProfileKindSchema = _enum([
40000
- "openai-compatible",
40001
- "openai",
40002
- "anthropic",
40003
- "google",
40004
- "managed-local",
40005
- "apple-foundation"
40006
- ]);
40114
+ var LlmProviderConfigSchema = record(string(), unknown());
40007
40115
  var LlmProfileSchema = object({
40008
40116
  id: string(),
40009
40117
  name: string(),
40118
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40010
40119
  kind: LlmProfileKindSchema,
40011
40120
  /** Stamped by the provider — keeps the fanned catalog routable. */
40012
40121
  addonId: string(),
40013
40122
  enabled: boolean(),
40014
40123
  /** Vendor model id, or the managed runtime's loaded model. */
40015
40124
  model: string(),
40016
- /** Required for openai-compatible; override for cloud kinds. */
40017
- baseUrl: string().optional(),
40018
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40019
- apiKey: string().optional(),
40020
40125
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40021
40126
  * degraded to text — that shipped once and produced a confident answer to a
40022
40127
  * question about a picture nobody sent. */
@@ -40024,15 +40129,11 @@ var LlmProfileSchema = object({
40024
40129
  temperature: number().min(0).max(2).optional(),
40025
40130
  /** Nucleus sampling. Every wire we speak has it. */
40026
40131
  topP: number().min(0).max(1).optional(),
40027
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40028
- * wire does, and the client drops it there (measured: the request body gets
40029
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40030
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40132
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40133
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40031
40134
  topK: number().int().positive().optional(),
40032
40135
  maxTokens: number().int().positive().optional(),
40033
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40034
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40035
- * the model with, so it is the one field that changes a PROCESS. */
40136
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40036
40137
  contextLength: number().int().positive().optional(),
40037
40138
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40038
40139
  * two system prompts fighting is worse than either alone). */
@@ -40058,16 +40159,37 @@ var LlmProfileSchema = object({
40058
40159
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40059
40160
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40060
40161
  toolsEnabled: boolean().default(false),
40061
- extraHeaders: record(string(), string()).optional(),
40062
- /** kind === 'managed-local' only (spec §4). */
40063
- runtime: ManagedRuntimeConfigSchema.optional(),
40064
- /**
40065
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40066
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40067
- * `supportsVision` on such a row is stamped by the provider from the node's
40068
- * reported `imageInput`, never taken from the operator (D62).
40069
- */
40070
- appleFoundation: object({ nodeId: string() }).optional()
40162
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40163
+ providerConfig: LlmProviderConfigSchema.default({})
40164
+ });
40165
+ /**
40166
+ * The common profile fields a kind's editor offers. The editor owns how each
40167
+ * one is drawn; the provider says which of them mean something on its wire.
40168
+ */
40169
+ var LlmProfileFieldSchema = _enum([
40170
+ "temperature",
40171
+ "topP",
40172
+ "topK",
40173
+ "maxTokens",
40174
+ "contextLength",
40175
+ "systemPrompt",
40176
+ "timeoutMs",
40177
+ "connectTimeoutMs",
40178
+ "firstTokenTimeoutMs",
40179
+ "idleTimeoutMs",
40180
+ "retry",
40181
+ "toolsEnabled"
40182
+ ]);
40183
+ /**
40184
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40185
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40186
+ * picker: that widget owns the model choice.
40187
+ */
40188
+ var LlmProviderWidgetSchema = object({
40189
+ id: string(),
40190
+ placement: _enum(["connection", "model"]),
40191
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40192
+ requires: array(string()).optional()
40071
40193
  });
40072
40194
  /** ConfigUISchema tree passed through untyped on the wire (the
40073
40195
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40076,11 +40198,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40076
40198
  var LlmProfileKindDescriptorSchema = object({
40077
40199
  kind: LlmProfileKindSchema,
40078
40200
  label: string(),
40201
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40079
40202
  icon: string(),
40080
40203
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40081
40204
  addonId: string(),
40082
- configSchema: ConfigSchemaPassthrough$3
40205
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40206
+ connectionSchema: ConfigSchemaPassthrough$3,
40207
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40208
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40209
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40210
+ features: LlmModelFeaturesSchema,
40211
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40212
+ visionEditable: boolean(),
40213
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40214
+ modelCatalog: _enum([
40215
+ "fetch",
40216
+ "static",
40217
+ "none"
40218
+ ]),
40219
+ staticModels: array(LlmModelInfoSchema).optional(),
40220
+ /** The common fields that mean something on this kind's wire. */
40221
+ profileFields: array(LlmProfileFieldSchema),
40222
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40223
+ });
40224
+ /**
40225
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40226
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40227
+ * untouched (absent or the redaction marker) is resolved server-side from the
40228
+ * stored profile — the browser never receives it.
40229
+ */
40230
+ var LlmListModelsInputSchema = object({
40231
+ addonId: string(),
40232
+ kind: LlmProfileKindSchema,
40233
+ profileId: string().optional(),
40234
+ connection: LlmProviderConfigSchema.optional()
40083
40235
  });
40236
+ var LlmListModelsErrorCodeSchema = _enum([
40237
+ "auth",
40238
+ "network",
40239
+ "unsupported",
40240
+ "invalid"
40241
+ ]);
40242
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40243
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40244
+ ok: literal(true),
40245
+ models: array(LlmModelInfoSchema)
40246
+ }), object({
40247
+ ok: literal(false),
40248
+ code: LlmListModelsErrorCodeSchema,
40249
+ message: string()
40250
+ })]);
40084
40251
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40085
40252
  var LlmDefaultSchema = object({
40086
40253
  selector: LlmDefaultSelectorSchema,
@@ -40180,7 +40347,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40180
40347
  kind: "mutation",
40181
40348
  auth: "admin",
40182
40349
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40183
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40350
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40351
+ kind: "mutation",
40352
+ auth: "admin"
40353
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40184
40354
  selector: LlmDefaultSelectorSchema,
40185
40355
  profileId: string().nullable()
40186
40356
  }), _void(), {
@@ -40348,14 +40518,106 @@ var LogEntrySchema = object({
40348
40518
  meta: record(string(), unknown()).optional(),
40349
40519
  tags: record(string(), string()).optional()
40350
40520
  });
40351
- method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
40352
- scope: array(string()).optional(),
40521
+ /**
40522
+ * A history READ against one destination (D898).
40523
+ *
40524
+ * Every filter is applied by the PROVIDER, before the limit — a filter the
40525
+ * browser applied after the limit is what made a rare device's lines
40526
+ * unreachable behind a busy one's. `before` / `after` are cursors the provider
40527
+ * minted (opaque to everyone else): a file position for the rotated files, a
40528
+ * nanosecond timestamp for Loki.
40529
+ *
40530
+ * A read is BOUNDED by `budgetMs`: a filter that matches nothing on a 30-day
40531
+ * store answers `done: false` with the cursor it reached and the bytes it
40532
+ * scanned, and the caller decides whether to go on. That is what makes a long
40533
+ * scan show progress and stop when asked — `cancelRead` ends the slice in
40534
+ * flight, and not asking for the next slice ends the scan.
40535
+ */
40536
+ var LogReadQuerySchema = object({
40537
+ /** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
40538
+ requestId: string().min(1).max(64).optional(),
40539
+ /** The device the line is about (`tags.deviceId`, numeric). */
40540
+ deviceId: number().int().optional(),
40541
+ /**
40542
+ * The emitting addon — bare manifest id; `@<version>` / `::<sub>` suffixes
40543
+ * match. Not `addonId`: a cap router reads that name as "which provider".
40544
+ */
40545
+ fromAddonId: string().min(1).max(200).optional(),
40546
+ /**
40547
+ * The emitting node: matches the agent that emitted the line, the node
40548
+ * itself, or a worker under it (`<agent>/<runner>`) — the `agentId`
40549
+ * semantics of `matchesLogTags`. Not `nodeId`: a cap router reads that
40550
+ * name as "which node's provider".
40551
+ */
40552
+ fromNodeId: string().min(1).max(200).optional(),
40553
+ /** Any other tag, exact match (AND). */
40554
+ tags: record(string(), union([string(), number()])).optional(),
40555
+ /** Severity FLOOR: this level and above. */
40353
40556
  level: LogLevelSchema.optional(),
40354
- since: date().optional(),
40355
- until: date().optional(),
40356
- limit: number().optional(),
40357
- tags: record(string(), string()).optional()
40358
- }), array(LogEntrySchema).readonly());
40557
+ /** Case-insensitive substring over message, scope, tag values and meta values. */
40558
+ text: string().min(1).max(200).optional(),
40559
+ /** Epoch ms, inclusive. */
40560
+ since: number().optional(),
40561
+ /** Epoch ms, inclusive. */
40562
+ until: number().optional(),
40563
+ /** Older than this cursor (exclusive). Absent with `after` absent ⇒ from the newest. */
40564
+ before: string().min(1).max(1024).optional(),
40565
+ /** Newer than this cursor (exclusive). */
40566
+ after: string().min(1).max(1024).optional(),
40567
+ limit: number().int().min(1).max(1e3).optional(),
40568
+ /** Wall-clock bound of this slice. The provider caps it. */
40569
+ budgetMs: number().int().min(50).max(1e4).optional()
40570
+ });
40571
+ var LogReadResultSchema = object({
40572
+ /** Newest first. */
40573
+ entries: array(object({
40574
+ /** `<bootId>.<seq>` minted by the emitting LogManager — the dedupe key. */
40575
+ id: string().optional(),
40576
+ /** Epoch ms. */
40577
+ timestamp: number(),
40578
+ level: LogLevelSchema,
40579
+ scope: string().optional(),
40580
+ message: string(),
40581
+ tags: record(string(), union([string(), number()])).optional(),
40582
+ meta: record(string(), unknown()).optional()
40583
+ })),
40584
+ /** Pass as `before` for the next older page; null when nothing older exists. */
40585
+ nextBefore: string().nullable(),
40586
+ /** Pass as `after` to read what arrived since; null when unknown. */
40587
+ nextAfter: string().nullable(),
40588
+ /** Bytes this slice read (files) or received (remote). Progress, not a promise. */
40589
+ scannedBytes: number().int().nonnegative(),
40590
+ /**
40591
+ * True when the scan in this direction reached the end of the store.
40592
+ * False with fewer than `limit` entries means the budget ran out first —
40593
+ * call again with `nextBefore` to go on.
40594
+ */
40595
+ done: boolean(),
40596
+ /** True when `cancelRead` ended this slice early. */
40597
+ cancelled: boolean().optional()
40598
+ });
40599
+ var LogReadCapabilitiesSchema = object({
40600
+ /** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
40601
+ readable: boolean(),
40602
+ /** Why not, when `readable` is false — rendered next to the source. */
40603
+ reason: string().nullable(),
40604
+ /** Filters the provider applies itself. A false one is applied by nobody. */
40605
+ filters: object({
40606
+ deviceId: boolean(),
40607
+ addonId: boolean(),
40608
+ nodeId: boolean(),
40609
+ tags: boolean(),
40610
+ level: boolean(),
40611
+ text: boolean(),
40612
+ timeRange: boolean()
40613
+ }),
40614
+ /** How far back the store reaches, when the provider knows (days). */
40615
+ retentionDays: number().nullable()
40616
+ });
40617
+ method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(_void(), LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
40618
+ kind: "mutation",
40619
+ auth: "admin"
40620
+ });
40359
40621
  /**
40360
40622
  * `login-method` — collection cap through which auth addons contribute
40361
40623
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -42930,6 +43192,33 @@ var NcRuleTargetSchema = object({
42930
43192
  params: record(string(), unknown()).optional()
42931
43193
  });
42932
43194
  /**
43195
+ * WHAT THE NOTIFICATION'S PICTURE IS (D897) — the ONE media choice of a rule.
43196
+ *
43197
+ * Every mode starts from the same CLEAN source frame of the trigger moment
43198
+ * (keyFrame → sceneFrame → lastSceneFrame, narrowed to the trigger instant and
43199
+ * to the zone that fired the rule) and renders it once at send time:
43200
+ * - `scene-boxes` — the whole scene, the subject outlined thick in the accent
43201
+ * colour and every OTHER track visible at that instant outlined thin, each
43202
+ * labelled with class and confidence ("dog 87%").
43203
+ * - `crop` — the subject cut out of that frame around its box at that instant.
43204
+ * - `clean` — the whole scene with nothing drawn on it.
43205
+ * - `none` — no picture.
43206
+ *
43207
+ * A mode that cannot be honoured (no box at that instant, a photograph with no
43208
+ * tracked subject) ships `clean` and names the reason in the log, per camera.
43209
+ * It replaces the `attach` × `frame` × `zoneCrop` triple, which let one rule
43210
+ * ship a crop on one event and a boxed scene on the next depending on which
43211
+ * stored kind had landed.
43212
+ */
43213
+ var NcMediaImageSchema = _enum([
43214
+ "scene-boxes",
43215
+ "crop",
43216
+ "clean",
43217
+ "none"
43218
+ ]);
43219
+ /**
43220
+ * @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
43221
+ *
42933
43222
  * Media attachment policy (P1 still-image subset).
42934
43223
  * - `best` — the best AVAILABLE subject image at dispatch time (D-3).
42935
43224
  * - `best-matching` — the media that explains WHY the rule fired: a rule
@@ -42943,6 +43232,8 @@ var NcRuleTargetSchema = object({
42943
43232
  * - `none` — no attachment.
42944
43233
  */
42945
43234
  /**
43235
+ * @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
43236
+ *
42946
43237
  * WHAT THE PICTURE SHOWS — chosen explicitly, because the implicit ladders
42947
43238
  * conflate it with the selection strategy and betray the request: asking for
42948
43239
  * the clean scene frame on an object-event owner used to start at
@@ -42971,16 +43262,29 @@ var NcMediaFrameSchema = _enum([
42971
43262
  */
42972
43263
  var NcLinkedCameraModeSchema = _enum(["mosaic", "each"]);
42973
43264
  var NcMediaPolicySchema = object({
43265
+ /**
43266
+ * The picture — see {@link NcMediaImageSchema}. Absent on a rule nobody has
43267
+ * saved since D897: `normalizeNcMediaPolicy` derives it from the legacy
43268
+ * triple below, at load and at every write, and the store keeps only this.
43269
+ */
43270
+ image: NcMediaImageSchema.optional(),
43271
+ /**
43272
+ * Draw the zone that FIRED the rule on the picture (`scene-boxes` / `clean`;
43273
+ * a `crop` never shows it). Valid only on a rule whose trigger is a zone —
43274
+ * `conditions.zones` or an occupancy zone — and refused on save otherwise.
43275
+ * Replaces `zoneCrop`.
43276
+ */
43277
+ showTriggerZone: boolean().optional(),
43278
+ /** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
42974
43279
  attach: _enum([
42975
43280
  "best",
42976
43281
  "best-matching",
42977
43282
  "keyFrame",
42978
43283
  "none"
42979
- ]).default("best"),
42980
- /** What the still shows. Absent = `cropped` (the historical `best` shape). */
43284
+ ]).optional(),
43285
+ /** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
42981
43286
  frame: NcMediaFrameSchema.optional(),
42982
- /** Crop the attached still to the rule's condition-zone bbox (padded) —
42983
- * "show me the ZONE", not the whole scene or the subject crop. */
43287
+ /** @deprecated D897 — folded into `image: 'clean'` + `showTriggerZone` on save. */
42984
43288
  zoneCrop: boolean().optional(),
42985
43289
  /**
42986
43290
  * Also attach a short GIF cut from the stream broker's clip ring around the
@@ -43152,7 +43456,9 @@ var NcRuleInputSchema = object({
43152
43456
  * targets.
43153
43457
  */
43154
43458
  targetUsers: array(string()).optional(),
43155
- media: NcMediaPolicySchema.default({ attach: "best" }),
43459
+ /** Absent = the kind's default picture (`resolveNcMediaImage`): the subject crop for a
43460
+ * detection, the clean scene for a sensor or a sound. Set explicitly on save (D897). */
43461
+ media: NcMediaPolicySchema.default({}),
43156
43462
  throttle: NcThrottleSchema.default({
43157
43463
  cooldownSec: 60,
43158
43464
  scope: "rule-device"
@@ -44089,13 +44395,37 @@ var NcAlarmModeOpeningsSchema = object({
44089
44395
  /** Covered devices whose state could not be read (D49): neither open nor closed. */
44090
44396
  unknown: array(number().int())
44091
44397
  });
44398
+ /**
44399
+ * One alarm INPUT — a (rule, device) pair — the operator bypassed until the
44400
+ * next disarm ("Bypass this input until disarm" on a trigger notification, or
44401
+ * `nc.bypassAlarmInput`). Reported so an armed alarm with a silenced input
44402
+ * never looks fully armed (D62: off must never look like broken).
44403
+ */
44404
+ var NcAlarmInputBypassViewSchema = object({
44405
+ ruleId: string(),
44406
+ /** The rule's current name (its frozen name when the rule is gone). */
44407
+ ruleName: string(),
44408
+ /** The input: the sensor of the match, else its camera. */
44409
+ deviceId: number().int(),
44410
+ /** The input's current name. */
44411
+ name: string(),
44412
+ /** When it was bypassed (ms epoch). */
44413
+ since: number(),
44414
+ /** Triggers from this input dropped since. */
44415
+ dropped: number().int().min(0)
44416
+ });
44092
44417
  var NcAlarmLiveSchema = object({
44093
44418
  state: AlarmStateSchema,
44094
44419
  /** The mode being armed into (exit delay) or held; null when disarmed. */
44095
44420
  targetMode: AlarmArmModeSchema.nullable(),
44096
44421
  availableModes: array(AlarmArmModeSchema),
44097
44422
  openings: array(NcAlarmModeOpeningsSchema),
44098
- exclusions: array(NcAlarmExclusionViewSchema)
44423
+ exclusions: array(NcAlarmExclusionViewSchema),
44424
+ /**
44425
+ * Inputs bypassed for the rest of this arm session; cleared on disarm.
44426
+ * Defaulted so an older hub answer still parses (as "none known").
44427
+ */
44428
+ bypassedInputs: array(NcAlarmInputBypassViewSchema).default([])
44099
44429
  });
44100
44430
  var NcAlarmConfigSchema = object({
44101
44431
  /**
@@ -61194,26 +61524,6 @@ var ApiKeySummarySchema = object({
61194
61524
  createdAt: number(),
61195
61525
  lastUsedAt: number().optional()
61196
61526
  });
61197
- var ScopedTokenSummarySchema = object({
61198
- id: string(),
61199
- userId: string(),
61200
- name: string(),
61201
- tokenPrefix: string(),
61202
- scopes: array(TokenScopeSchema),
61203
- expiresAt: number().nullish(),
61204
- lastUsedAt: number().nullish(),
61205
- createdAt: number()
61206
- });
61207
- var CreateScopedTokenInputSchema = object({
61208
- userId: string(),
61209
- name: string(),
61210
- scopes: array(TokenScopeSchema),
61211
- expiresAt: number().optional()
61212
- });
61213
- var CreateScopedTokenResultSchema = object({
61214
- token: string(),
61215
- record: ScopedTokenSummarySchema
61216
- });
61217
61527
  var OauthSessionSummarySchema = object({
61218
61528
  id: string(),
61219
61529
  userId: string(),
@@ -61235,11 +61545,11 @@ var TotpStatusSchema = object({
61235
61545
  confirmedAt: number().nullable()
61236
61546
  });
61237
61547
  /**
61238
- * user-management — singleton capability for user accounts, API keys,
61239
- * and scoped tokens.
61548
+ * user-management — singleton capability for user accounts and the
61549
+ * legacy API-key rows.
61240
61550
  *
61241
61551
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
61242
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
61552
+ * — the subset check on `setUserScopes` is moot
61243
61553
  * because non-admins never reach these. If/when we open non-admin
61244
61554
  * delegation, structural caller-scope subset check goes inside the
61245
61555
  * provider.
@@ -61296,15 +61606,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
61296
61606
  kind: "mutation",
61297
61607
  auth: "admin",
61298
61608
  access: "delete"
61299
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
61300
- kind: "mutation",
61301
- auth: "admin",
61302
- access: "create"
61303
- }), method(object({ id: string() }), object({ success: literal(true) }), {
61304
- kind: "mutation",
61305
- auth: "admin",
61306
- access: "delete"
61307
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
61609
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
61308
61610
  kind: "mutation",
61309
61611
  auth: "admin",
61310
61612
  access: "create"
@@ -65460,7 +65762,7 @@ Object.freeze({
65460
65762
  capName: "llm",
65461
65763
  capScope: "system",
65462
65764
  addonId: null,
65463
- access: "view"
65765
+ access: "create"
65464
65766
  },
65465
65767
  "llm.listNodeModels": {
65466
65768
  capName: "llm",
@@ -65762,7 +66064,19 @@ Object.freeze({
65762
66064
  addonId: null,
65763
66065
  access: "view"
65764
66066
  },
65765
- "logDestination.query": {
66067
+ "logDestination.cancelRead": {
66068
+ capName: "log-destination",
66069
+ capScope: "system",
66070
+ addonId: null,
66071
+ access: "create"
66072
+ },
66073
+ "logDestination.describeRead": {
66074
+ capName: "log-destination",
66075
+ capScope: "system",
66076
+ addonId: null,
66077
+ access: "view"
66078
+ },
66079
+ "logDestination.read": {
65766
66080
  capName: "log-destination",
65767
66081
  capScope: "system",
65768
66082
  addonId: null,
@@ -70124,12 +70438,6 @@ Object.freeze({
70124
70438
  addonId: null,
70125
70439
  access: "create"
70126
70440
  },
70127
- "userManagement.createScopedToken": {
70128
- capName: "user-management",
70129
- capScope: "system",
70130
- addonId: null,
70131
- access: "create"
70132
- },
70133
70441
  "userManagement.createUser": {
70134
70442
  capName: "user-management",
70135
70443
  capScope: "system",
@@ -70178,12 +70486,6 @@ Object.freeze({
70178
70486
  addonId: null,
70179
70487
  access: "view"
70180
70488
  },
70181
- "userManagement.listScopedTokens": {
70182
- capName: "user-management",
70183
- capScope: "system",
70184
- addonId: null,
70185
- access: "view"
70186
- },
70187
70489
  "userManagement.listUsers": {
70188
70490
  capName: "user-management",
70189
70491
  capScope: "system",
@@ -70238,12 +70540,6 @@ Object.freeze({
70238
70540
  addonId: null,
70239
70541
  access: "delete"
70240
70542
  },
70241
- "userManagement.revokeScopedToken": {
70242
- capName: "user-management",
70243
- capScope: "system",
70244
- addonId: null,
70245
- access: "delete"
70246
- },
70247
70543
  "userManagement.setupTotp": {
70248
70544
  capName: "user-management",
70249
70545
  capScope: "system",
@@ -70274,12 +70570,6 @@ Object.freeze({
70274
70570
  addonId: null,
70275
70571
  access: "view"
70276
70572
  },
70277
- "userManagement.validateScopedToken": {
70278
- capName: "user-management",
70279
- capScope: "system",
70280
- addonId: null,
70281
- access: "view"
70282
- },
70283
70573
  "userManagement.verifyTotp": {
70284
70574
  capName: "user-management",
70285
70575
  capScope: "system",
@@ -71793,6 +72083,11 @@ Object.freeze({
71793
72083
  form: "single",
71794
72084
  optional: false
71795
72085
  }],
72086
+ "logDestination.read": [{
72087
+ name: "deviceId",
72088
+ form: "single",
72089
+ optional: true
72090
+ }],
71796
72091
  "mediaPlayer.getStatus": [{
71797
72092
  name: "deviceId",
71798
72093
  form: "single",