@camstack/addon-auth 1.2.152 → 1.2.154

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.
@@ -5580,7 +5580,7 @@ var ZodIssueCode = {
5580
5580
  var ZodFirstPartyTypeKind;
5581
5581
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5582
5582
  //#endregion
5583
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5583
+ //#region ../types/dist/sleep-BSuCCFjf.mjs
5584
5584
  /**
5585
5585
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5586
5586
  * window to float samples (D455).
@@ -7963,9 +7963,9 @@ function normalizeAddonInitResult(result) {
7963
7963
  return result;
7964
7964
  }
7965
7965
  /**
7966
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7967
- * and validates them (`share-token.service.ts` builds its enum from this
7968
- * list); a data plane names the kinds it ACCEPTS in `share`.
7966
+ * The share-view scope kinds a share-link token can carry. The hub mints
7967
+ * and validates them (`ShareViewGrantSchema` builds its
7968
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7969
7969
  */
7970
7970
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7971
7971
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12953,7 +12953,7 @@ var ConvertResultSchema = object({
12953
12953
  * `super_admin` — collapsed onto the single boolean because every
12954
12954
  * non-admin caller is governed by the same scope-check rules; the
12955
12955
  * distinction was only ever used to route role-specific procedures
12956
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12956
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12957
12957
  * with `isAdmin: false` + an explicit scope list.
12958
12958
  */
12959
12959
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13142,10 +13142,12 @@ var AddonRoutesScopeSchema = object({
13142
13142
  type: literal("addon-routes"),
13143
13143
  access: array(MethodAccessSchema).min(1)
13144
13144
  });
13145
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13145
13146
  var CredentialScopeSchema = union([
13146
13147
  literal("*"),
13147
13148
  ShareViewScopeSchema,
13148
13149
  AddonRoutesScopeSchema,
13150
+ PreferencesSelfScopeSchema,
13149
13151
  TokenScopeSchema
13150
13152
  ]);
13151
13153
  object({
@@ -13154,6 +13156,55 @@ object({
13154
13156
  jti: string().min(16),
13155
13157
  scopes: array(CredentialScopeSchema).min(1)
13156
13158
  });
13159
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13160
+ /** A namespace's value: a JSON object, opaque to the hub. */
13161
+ var PreferenceValueSchema = record(string(), unknown());
13162
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13163
+ /** A stored row, as the owner reads it. */
13164
+ var PreferenceRowSchema = object({
13165
+ namespace: PreferenceNamespaceSchema,
13166
+ value: PreferenceValueSchema,
13167
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13168
+ revision: number().int().positive(),
13169
+ updatedAt: number().int(),
13170
+ /** The client id the last writer sent; `null` when it sent none. */
13171
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13172
+ });
13173
+ object({
13174
+ /** Absent: every namespace the caller holds. */
13175
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13176
+ object({ rows: array(PreferenceRowSchema) });
13177
+ object({
13178
+ namespace: PreferenceNamespaceSchema,
13179
+ value: PreferenceValueSchema,
13180
+ /**
13181
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13182
+ * namespace must not exist yet. Any other value that is not the current
13183
+ * revision answers `conflict` and writes nothing.
13184
+ */
13185
+ baseRevision: number().int().nonnegative().optional(),
13186
+ deviceId: PreferenceDeviceIdSchema.optional()
13187
+ });
13188
+ discriminatedUnion("status", [object({
13189
+ status: literal("saved"),
13190
+ row: PreferenceRowSchema
13191
+ }), object({
13192
+ status: literal("conflict"),
13193
+ current: PreferenceRowSchema.nullable()
13194
+ })]);
13195
+ object({ namespace: PreferenceNamespaceSchema });
13196
+ object({
13197
+ /** `false` when the namespace did not exist. */
13198
+ deleted: boolean() });
13199
+ object({
13200
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13201
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13202
+ object({
13203
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13204
+ rows: array(PreferenceRowSchema),
13205
+ /** Namespaces the client listed that no longer exist. */
13206
+ deleted: array(PreferenceNamespaceSchema)
13207
+ });
13157
13208
  /**
13158
13209
  * The viewer app's custom-scheme callback — the ONE list of URLs a hub flow
13159
13210
  * may hand a browser back to the native app at.
@@ -17560,7 +17611,19 @@ var DeviceHistorySubjectSchema = discriminatedUnion("kind", [object({
17560
17611
  kind: literal("node"),
17561
17612
  nodeId: string().min(1)
17562
17613
  })]);
17614
+ /**
17615
+ * `enum` stores a STATE as the ordinal of its value in the series' value list
17616
+ * (`DeviceHistorySeriesInfo.values`, append-only, so an ordinal never changes
17617
+ * meaning); a rollup keeps the time spent in each state (`states`).
17618
+ */
17563
17619
  var DeviceHistoryKindSchema = _enum([
17620
+ "gauge",
17621
+ "counter",
17622
+ "boolean",
17623
+ "enum"
17624
+ ]);
17625
+ /** What a PRODUCER may declare. `enum` is cap-only: its value list is the cap field's. */
17626
+ var DeviceHistoryProducerKindSchema = _enum([
17564
17627
  "gauge",
17565
17628
  "counter",
17566
17629
  "boolean"
@@ -17597,7 +17660,13 @@ var SeriesInfoSchema = object({
17597
17660
  /** `null` is unknown (a `unitFrom` series whose device does not state a unit right now), never a guess. */
17598
17661
  unit: string().nullable(),
17599
17662
  displayName: string(),
17600
- source: _enum(["cap", "addon"]),
17663
+ source: _enum([
17664
+ "cap",
17665
+ "addon",
17666
+ "derived"
17667
+ ]),
17668
+ /** `enum`: the value of each ordinal (index = ordinal); `null` for every other kind. */
17669
+ values: array(string()).readonly().nullable(),
17601
17670
  firstTs: number(),
17602
17671
  lastTs: number()
17603
17672
  });
@@ -17611,17 +17680,31 @@ var QueryPointSchema = object({
17611
17680
  twMean: number().nullable(),
17612
17681
  min: number(),
17613
17682
  max: number(),
17614
- /** `null` is unknown, never zero (D393). */
17615
- last: number().nullable()
17683
+ /** `null` is unknown, never zero (D393). For an `enum` series: the ordinal of {@link state}. */
17684
+ last: number().nullable(),
17685
+ /**
17686
+ * The increase over the point: a `counter`'s growth since the previous point
17687
+ * or bucket (a drop is a reset, counted from zero), and for
17688
+ * {@link DEVICE_HISTORY_ENERGY_KEY} the kWh used in the bucket. `null` for
17689
+ * every other kind, and when it cannot be known.
17690
+ */
17691
+ delta: number().nullable(),
17692
+ /** `enum`: the state in force at the end of the point (the name of `last`); `null` otherwise. */
17693
+ state: string().nullable(),
17694
+ /** `enum` rollup: milliseconds spent in each state inside the bucket; `null` for raw points and other kinds. */
17695
+ states: record(string(), number()).nullable()
17616
17696
  });
17617
17697
  var QuerySeriesSchema = object({
17618
17698
  scope: string(),
17619
17699
  /** The last point STRICTLY BEFORE `from` in the chosen tier, so a step chart can start at the held value. */
17620
17700
  before: object({
17621
17701
  t: number(),
17622
- value: number().nullable()
17702
+ value: number().nullable(),
17703
+ state: string().nullable()
17623
17704
  }).nullable(),
17624
- points: array(QueryPointSchema).readonly()
17705
+ points: array(QueryPointSchema).readonly(),
17706
+ /** A derived key: the stored key its points were computed from; `null` for a stored series. */
17707
+ derivedFrom: string().nullable()
17625
17708
  });
17626
17709
  /** The window part of a query, shared by the device and node forms. */
17627
17710
  var QueryWindowShape = {
@@ -17637,6 +17720,23 @@ var QueryResultSchema = object({
17637
17720
  series: array(QuerySeriesSchema).readonly(),
17638
17721
  truncated: boolean()
17639
17722
  });
17723
+ /** One read of a batch: a device's key or a node's key (exactly one subject). */
17724
+ var QueryManyItemSchema = union([object({
17725
+ deviceId: number().int(),
17726
+ key: string(),
17727
+ scope: string().optional()
17728
+ }), object({
17729
+ forNodeId: string().min(1),
17730
+ key: string(),
17731
+ scope: string().optional()
17732
+ })]);
17733
+ var QueryManyEntrySchema = discriminatedUnion("ok", [object({
17734
+ ok: literal(true),
17735
+ result: QueryResultSchema
17736
+ }), object({
17737
+ ok: literal(false),
17738
+ error: string()
17739
+ })]);
17640
17740
  var TierStatusSchema = object({
17641
17741
  tier: DeviceHistoryResolutionSchema,
17642
17742
  /** `null` until the first background count answered. */
@@ -17692,16 +17792,22 @@ var DeviceHistoryStatusSchema = object({
17692
17792
  lastRefreshAt: number().nullable()
17693
17793
  })
17694
17794
  });
17695
- method(object({ deviceId: number().int() }), array(SeriesInfoSchema).readonly()), method(object({ nodeId: string().min(1) }), array(SeriesInfoSchema).readonly(), { auth: "admin" }), method(object({
17795
+ method(object({ deviceId: number().int() }), array(SeriesInfoSchema).readonly()), method(object({ forNodeId: string().min(1) }), array(SeriesInfoSchema).readonly(), { auth: "admin" }), method(object({
17696
17796
  deviceId: number().int(),
17697
17797
  ...QueryWindowShape
17698
17798
  }), QueryResultSchema), method(object({
17699
- nodeId: string().min(1),
17799
+ forNodeId: string().min(1),
17700
17800
  ...QueryWindowShape
17701
17801
  }), QueryResultSchema, { auth: "admin" }), method(object({
17802
+ items: array(QueryManyItemSchema).min(1).max(24),
17803
+ from: QueryWindowShape.from,
17804
+ to: QueryWindowShape.to,
17805
+ resolution: QueryWindowShape.resolution,
17806
+ maxPoints: QueryWindowShape.maxPoints
17807
+ }), object({ results: array(QueryManyEntrySchema).readonly() }), { auth: "admin" }), method(object({
17702
17808
  name: string().regex(/^[a-z0-9-]+$/),
17703
17809
  subjectKind: _enum(["device", "node"]),
17704
- kind: DeviceHistoryKindSchema,
17810
+ kind: DeviceHistoryProducerKindSchema,
17705
17811
  unit: string().optional(),
17706
17812
  displayName: string().min(1),
17707
17813
  ingest: _enum(["points", "buckets"])
@@ -40309,38 +40415,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40309
40415
  auth: "admin",
40310
40416
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40311
40417
  });
40418
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40419
+ /** What a model (or, by default, every model of a kind) can do. */
40420
+ var LlmModelFeaturesSchema = object({
40421
+ vision: boolean(),
40422
+ tools: boolean(),
40423
+ streaming: boolean()
40424
+ });
40425
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40426
+ var LlmModelInfoSchema = object({
40427
+ id: string(),
40428
+ label: string().optional(),
40429
+ contextLength: number().int().positive().optional(),
40430
+ features: LlmModelFeaturesSchema.partial().optional()
40431
+ });
40312
40432
  /**
40313
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40314
- * methods concat-fan across providers; single-row methods route to ONE
40315
- * provider by the `addonId` in the call input (the notification-output
40316
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40317
- * (hub-placed); the cap stays open for future providers.
40318
- *
40319
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40320
- * `apiKey` is a password field — providers REDACT it on read and merge on
40321
- * write; a stored key NEVER round-trips to a client.
40433
+ * The provider-specific part of a profile, validated by the provider that owns
40434
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40435
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40436
+ * keychain, never in the row, and reads back as the redaction marker.
40322
40437
  */
40323
- var LlmProfileKindSchema = _enum([
40324
- "openai-compatible",
40325
- "openai",
40326
- "anthropic",
40327
- "google",
40328
- "managed-local",
40329
- "apple-foundation"
40330
- ]);
40438
+ var LlmProviderConfigSchema = record(string(), unknown());
40331
40439
  var LlmProfileSchema = object({
40332
40440
  id: string(),
40333
40441
  name: string(),
40442
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40334
40443
  kind: LlmProfileKindSchema,
40335
40444
  /** Stamped by the provider — keeps the fanned catalog routable. */
40336
40445
  addonId: string(),
40337
40446
  enabled: boolean(),
40338
40447
  /** Vendor model id, or the managed runtime's loaded model. */
40339
40448
  model: string(),
40340
- /** Required for openai-compatible; override for cloud kinds. */
40341
- baseUrl: string().optional(),
40342
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40343
- apiKey: string().optional(),
40344
40449
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40345
40450
  * degraded to text — that shipped once and produced a confident answer to a
40346
40451
  * question about a picture nobody sent. */
@@ -40348,15 +40453,11 @@ var LlmProfileSchema = object({
40348
40453
  temperature: number().min(0).max(2).optional(),
40349
40454
  /** Nucleus sampling. Every wire we speak has it. */
40350
40455
  topP: number().min(0).max(1).optional(),
40351
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40352
- * wire does, and the client drops it there (measured: the request body gets
40353
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40354
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40456
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40457
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40355
40458
  topK: number().int().positive().optional(),
40356
40459
  maxTokens: number().int().positive().optional(),
40357
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40358
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40359
- * the model with, so it is the one field that changes a PROCESS. */
40460
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40360
40461
  contextLength: number().int().positive().optional(),
40361
40462
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40362
40463
  * two system prompts fighting is worse than either alone). */
@@ -40382,16 +40483,37 @@ var LlmProfileSchema = object({
40382
40483
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40383
40484
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40384
40485
  toolsEnabled: boolean().default(false),
40385
- extraHeaders: record(string(), string()).optional(),
40386
- /** kind === 'managed-local' only (spec §4). */
40387
- runtime: ManagedRuntimeConfigSchema.optional(),
40388
- /**
40389
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40390
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40391
- * `supportsVision` on such a row is stamped by the provider from the node's
40392
- * reported `imageInput`, never taken from the operator (D62).
40393
- */
40394
- appleFoundation: object({ nodeId: string() }).optional()
40486
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40487
+ providerConfig: LlmProviderConfigSchema.default({})
40488
+ });
40489
+ /**
40490
+ * The common profile fields a kind's editor offers. The editor owns how each
40491
+ * one is drawn; the provider says which of them mean something on its wire.
40492
+ */
40493
+ var LlmProfileFieldSchema = _enum([
40494
+ "temperature",
40495
+ "topP",
40496
+ "topK",
40497
+ "maxTokens",
40498
+ "contextLength",
40499
+ "systemPrompt",
40500
+ "timeoutMs",
40501
+ "connectTimeoutMs",
40502
+ "firstTokenTimeoutMs",
40503
+ "idleTimeoutMs",
40504
+ "retry",
40505
+ "toolsEnabled"
40506
+ ]);
40507
+ /**
40508
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40509
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40510
+ * picker: that widget owns the model choice.
40511
+ */
40512
+ var LlmProviderWidgetSchema = object({
40513
+ id: string(),
40514
+ placement: _enum(["connection", "model"]),
40515
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40516
+ requires: array(string()).optional()
40395
40517
  });
40396
40518
  /** ConfigUISchema tree passed through untyped on the wire (the
40397
40519
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40400,11 +40522,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40400
40522
  var LlmProfileKindDescriptorSchema = object({
40401
40523
  kind: LlmProfileKindSchema,
40402
40524
  label: string(),
40525
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40403
40526
  icon: string(),
40404
40527
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40405
40528
  addonId: string(),
40406
- configSchema: ConfigSchemaPassthrough$3
40529
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40530
+ connectionSchema: ConfigSchemaPassthrough$3,
40531
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40532
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40533
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40534
+ features: LlmModelFeaturesSchema,
40535
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40536
+ visionEditable: boolean(),
40537
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40538
+ modelCatalog: _enum([
40539
+ "fetch",
40540
+ "static",
40541
+ "none"
40542
+ ]),
40543
+ staticModels: array(LlmModelInfoSchema).optional(),
40544
+ /** The common fields that mean something on this kind's wire. */
40545
+ profileFields: array(LlmProfileFieldSchema),
40546
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40547
+ });
40548
+ /**
40549
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40550
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40551
+ * untouched (absent or the redaction marker) is resolved server-side from the
40552
+ * stored profile — the browser never receives it.
40553
+ */
40554
+ var LlmListModelsInputSchema = object({
40555
+ addonId: string(),
40556
+ kind: LlmProfileKindSchema,
40557
+ profileId: string().optional(),
40558
+ connection: LlmProviderConfigSchema.optional()
40407
40559
  });
40560
+ var LlmListModelsErrorCodeSchema = _enum([
40561
+ "auth",
40562
+ "network",
40563
+ "unsupported",
40564
+ "invalid"
40565
+ ]);
40566
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40567
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40568
+ ok: literal(true),
40569
+ models: array(LlmModelInfoSchema)
40570
+ }), object({
40571
+ ok: literal(false),
40572
+ code: LlmListModelsErrorCodeSchema,
40573
+ message: string()
40574
+ })]);
40408
40575
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40409
40576
  var LlmDefaultSchema = object({
40410
40577
  selector: LlmDefaultSelectorSchema,
@@ -40504,7 +40671,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40504
40671
  kind: "mutation",
40505
40672
  auth: "admin",
40506
40673
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40507
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40674
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40675
+ kind: "mutation",
40676
+ auth: "admin"
40677
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40508
40678
  selector: LlmDefaultSelectorSchema,
40509
40679
  profileId: string().nullable()
40510
40680
  }), _void(), {
@@ -40672,14 +40842,106 @@ var LogEntrySchema = object({
40672
40842
  meta: record(string(), unknown()).optional(),
40673
40843
  tags: record(string(), string()).optional()
40674
40844
  });
40675
- method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
40676
- scope: array(string()).optional(),
40845
+ /**
40846
+ * A history READ against one destination (D898).
40847
+ *
40848
+ * Every filter is applied by the PROVIDER, before the limit — a filter the
40849
+ * browser applied after the limit is what made a rare device's lines
40850
+ * unreachable behind a busy one's. `before` / `after` are cursors the provider
40851
+ * minted (opaque to everyone else): a file position for the rotated files, a
40852
+ * nanosecond timestamp for Loki.
40853
+ *
40854
+ * A read is BOUNDED by `budgetMs`: a filter that matches nothing on a 30-day
40855
+ * store answers `done: false` with the cursor it reached and the bytes it
40856
+ * scanned, and the caller decides whether to go on. That is what makes a long
40857
+ * scan show progress and stop when asked — `cancelRead` ends the slice in
40858
+ * flight, and not asking for the next slice ends the scan.
40859
+ */
40860
+ var LogReadQuerySchema = object({
40861
+ /** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
40862
+ requestId: string().min(1).max(64).optional(),
40863
+ /** The device the line is about (`tags.deviceId`, numeric). */
40864
+ deviceId: number().int().optional(),
40865
+ /**
40866
+ * The emitting addon — bare manifest id; `@<version>` / `::<sub>` suffixes
40867
+ * match. Not `addonId`: a cap router reads that name as "which provider".
40868
+ */
40869
+ fromAddonId: string().min(1).max(200).optional(),
40870
+ /**
40871
+ * The emitting node: matches the agent that emitted the line, the node
40872
+ * itself, or a worker under it (`<agent>/<runner>`) — the `agentId`
40873
+ * semantics of `matchesLogTags`. Not `nodeId`: a cap router reads that
40874
+ * name as "which node's provider".
40875
+ */
40876
+ fromNodeId: string().min(1).max(200).optional(),
40877
+ /** Any other tag, exact match (AND). */
40878
+ tags: record(string(), union([string(), number()])).optional(),
40879
+ /** Severity FLOOR: this level and above. */
40677
40880
  level: LogLevelSchema.optional(),
40678
- since: date().optional(),
40679
- until: date().optional(),
40680
- limit: number().optional(),
40681
- tags: record(string(), string()).optional()
40682
- }), array(LogEntrySchema).readonly());
40881
+ /** Case-insensitive substring over message, scope, tag values and meta values. */
40882
+ text: string().min(1).max(200).optional(),
40883
+ /** Epoch ms, inclusive. */
40884
+ since: number().optional(),
40885
+ /** Epoch ms, inclusive. */
40886
+ until: number().optional(),
40887
+ /** Older than this cursor (exclusive). Absent with `after` absent ⇒ from the newest. */
40888
+ before: string().min(1).max(1024).optional(),
40889
+ /** Newer than this cursor (exclusive). */
40890
+ after: string().min(1).max(1024).optional(),
40891
+ limit: number().int().min(1).max(1e3).optional(),
40892
+ /** Wall-clock bound of this slice. The provider caps it. */
40893
+ budgetMs: number().int().min(50).max(1e4).optional()
40894
+ });
40895
+ var LogReadResultSchema = object({
40896
+ /** Newest first. */
40897
+ entries: array(object({
40898
+ /** `<bootId>.<seq>` minted by the emitting LogManager — the dedupe key. */
40899
+ id: string().optional(),
40900
+ /** Epoch ms. */
40901
+ timestamp: number(),
40902
+ level: LogLevelSchema,
40903
+ scope: string().optional(),
40904
+ message: string(),
40905
+ tags: record(string(), union([string(), number()])).optional(),
40906
+ meta: record(string(), unknown()).optional()
40907
+ })),
40908
+ /** Pass as `before` for the next older page; null when nothing older exists. */
40909
+ nextBefore: string().nullable(),
40910
+ /** Pass as `after` to read what arrived since; null when unknown. */
40911
+ nextAfter: string().nullable(),
40912
+ /** Bytes this slice read (files) or received (remote). Progress, not a promise. */
40913
+ scannedBytes: number().int().nonnegative(),
40914
+ /**
40915
+ * True when the scan in this direction reached the end of the store.
40916
+ * False with fewer than `limit` entries means the budget ran out first —
40917
+ * call again with `nextBefore` to go on.
40918
+ */
40919
+ done: boolean(),
40920
+ /** True when `cancelRead` ended this slice early. */
40921
+ cancelled: boolean().optional()
40922
+ });
40923
+ var LogReadCapabilitiesSchema = object({
40924
+ /** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
40925
+ readable: boolean(),
40926
+ /** Why not, when `readable` is false — rendered next to the source. */
40927
+ reason: string().nullable(),
40928
+ /** Filters the provider applies itself. A false one is applied by nobody. */
40929
+ filters: object({
40930
+ deviceId: boolean(),
40931
+ addonId: boolean(),
40932
+ nodeId: boolean(),
40933
+ tags: boolean(),
40934
+ level: boolean(),
40935
+ text: boolean(),
40936
+ timeRange: boolean()
40937
+ }),
40938
+ /** How far back the store reaches, when the provider knows (days). */
40939
+ retentionDays: number().nullable()
40940
+ });
40941
+ 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() }), {
40942
+ kind: "mutation",
40943
+ auth: "admin"
40944
+ });
40683
40945
  /**
40684
40946
  * `login-method` — collection cap through which auth addons contribute
40685
40947
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -43243,6 +43505,33 @@ var NcRuleTargetSchema = object({
43243
43505
  params: record(string(), unknown()).optional()
43244
43506
  });
43245
43507
  /**
43508
+ * WHAT THE NOTIFICATION'S PICTURE IS (D897) — the ONE media choice of a rule.
43509
+ *
43510
+ * Every mode starts from the same CLEAN source frame of the trigger moment
43511
+ * (keyFrame → sceneFrame → lastSceneFrame, narrowed to the trigger instant and
43512
+ * to the zone that fired the rule) and renders it once at send time:
43513
+ * - `scene-boxes` — the whole scene, the subject outlined thick in the accent
43514
+ * colour and every OTHER track visible at that instant outlined thin, each
43515
+ * labelled with class and confidence ("dog 87%").
43516
+ * - `crop` — the subject cut out of that frame around its box at that instant.
43517
+ * - `clean` — the whole scene with nothing drawn on it.
43518
+ * - `none` — no picture.
43519
+ *
43520
+ * A mode that cannot be honoured (no box at that instant, a photograph with no
43521
+ * tracked subject) ships `clean` and names the reason in the log, per camera.
43522
+ * It replaces the `attach` × `frame` × `zoneCrop` triple, which let one rule
43523
+ * ship a crop on one event and a boxed scene on the next depending on which
43524
+ * stored kind had landed.
43525
+ */
43526
+ var NcMediaImageSchema = _enum([
43527
+ "scene-boxes",
43528
+ "crop",
43529
+ "clean",
43530
+ "none"
43531
+ ]);
43532
+ /**
43533
+ * @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
43534
+ *
43246
43535
  * Media attachment policy (P1 still-image subset).
43247
43536
  * - `best` — the best AVAILABLE subject image at dispatch time (D-3).
43248
43537
  * - `best-matching` — the media that explains WHY the rule fired: a rule
@@ -43256,6 +43545,8 @@ var NcRuleTargetSchema = object({
43256
43545
  * - `none` — no attachment.
43257
43546
  */
43258
43547
  /**
43548
+ * @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
43549
+ *
43259
43550
  * WHAT THE PICTURE SHOWS — chosen explicitly, because the implicit ladders
43260
43551
  * conflate it with the selection strategy and betray the request: asking for
43261
43552
  * the clean scene frame on an object-event owner used to start at
@@ -43284,16 +43575,29 @@ var NcMediaFrameSchema = _enum([
43284
43575
  */
43285
43576
  var NcLinkedCameraModeSchema = _enum(["mosaic", "each"]);
43286
43577
  var NcMediaPolicySchema = object({
43578
+ /**
43579
+ * The picture — see {@link NcMediaImageSchema}. Absent on a rule nobody has
43580
+ * saved since D897: `normalizeNcMediaPolicy` derives it from the legacy
43581
+ * triple below, at load and at every write, and the store keeps only this.
43582
+ */
43583
+ image: NcMediaImageSchema.optional(),
43584
+ /**
43585
+ * Draw the zone that FIRED the rule on the picture (`scene-boxes` / `clean`;
43586
+ * a `crop` never shows it). Valid only on a rule whose trigger is a zone —
43587
+ * `conditions.zones` or an occupancy zone — and refused on save otherwise.
43588
+ * Replaces `zoneCrop`.
43589
+ */
43590
+ showTriggerZone: boolean().optional(),
43591
+ /** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
43287
43592
  attach: _enum([
43288
43593
  "best",
43289
43594
  "best-matching",
43290
43595
  "keyFrame",
43291
43596
  "none"
43292
- ]).default("best"),
43293
- /** What the still shows. Absent = `cropped` (the historical `best` shape). */
43597
+ ]).optional(),
43598
+ /** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
43294
43599
  frame: NcMediaFrameSchema.optional(),
43295
- /** Crop the attached still to the rule's condition-zone bbox (padded) —
43296
- * "show me the ZONE", not the whole scene or the subject crop. */
43600
+ /** @deprecated D897 — folded into `image: 'clean'` + `showTriggerZone` on save. */
43297
43601
  zoneCrop: boolean().optional(),
43298
43602
  /**
43299
43603
  * Also attach a short GIF cut from the stream broker's clip ring around the
@@ -43465,7 +43769,9 @@ var NcRuleInputSchema = object({
43465
43769
  * targets.
43466
43770
  */
43467
43771
  targetUsers: array(string()).optional(),
43468
- media: NcMediaPolicySchema.default({ attach: "best" }),
43772
+ /** Absent = the kind's default picture (`resolveNcMediaImage`): the subject crop for a
43773
+ * detection, the clean scene for a sensor or a sound. Set explicitly on save (D897). */
43774
+ media: NcMediaPolicySchema.default({}),
43469
43775
  throttle: NcThrottleSchema.default({
43470
43776
  cooldownSec: 60,
43471
43777
  scope: "rule-device"
@@ -44402,13 +44708,37 @@ var NcAlarmModeOpeningsSchema = object({
44402
44708
  /** Covered devices whose state could not be read (D49): neither open nor closed. */
44403
44709
  unknown: array(number().int())
44404
44710
  });
44711
+ /**
44712
+ * One alarm INPUT — a (rule, device) pair — the operator bypassed until the
44713
+ * next disarm ("Bypass this input until disarm" on a trigger notification, or
44714
+ * `nc.bypassAlarmInput`). Reported so an armed alarm with a silenced input
44715
+ * never looks fully armed (D62: off must never look like broken).
44716
+ */
44717
+ var NcAlarmInputBypassViewSchema = object({
44718
+ ruleId: string(),
44719
+ /** The rule's current name (its frozen name when the rule is gone). */
44720
+ ruleName: string(),
44721
+ /** The input: the sensor of the match, else its camera. */
44722
+ deviceId: number().int(),
44723
+ /** The input's current name. */
44724
+ name: string(),
44725
+ /** When it was bypassed (ms epoch). */
44726
+ since: number(),
44727
+ /** Triggers from this input dropped since. */
44728
+ dropped: number().int().min(0)
44729
+ });
44405
44730
  var NcAlarmLiveSchema = object({
44406
44731
  state: AlarmStateSchema,
44407
44732
  /** The mode being armed into (exit delay) or held; null when disarmed. */
44408
44733
  targetMode: AlarmArmModeSchema.nullable(),
44409
44734
  availableModes: array(AlarmArmModeSchema),
44410
44735
  openings: array(NcAlarmModeOpeningsSchema),
44411
- exclusions: array(NcAlarmExclusionViewSchema)
44736
+ exclusions: array(NcAlarmExclusionViewSchema),
44737
+ /**
44738
+ * Inputs bypassed for the rest of this arm session; cleared on disarm.
44739
+ * Defaulted so an older hub answer still parses (as "none known").
44740
+ */
44741
+ bypassedInputs: array(NcAlarmInputBypassViewSchema).default([])
44412
44742
  });
44413
44743
  var NcAlarmConfigSchema = object({
44414
44744
  /**
@@ -61558,26 +61888,6 @@ var ApiKeySummarySchema = object({
61558
61888
  createdAt: number(),
61559
61889
  lastUsedAt: number().optional()
61560
61890
  });
61561
- var ScopedTokenSummarySchema = object({
61562
- id: string(),
61563
- userId: string(),
61564
- name: string(),
61565
- tokenPrefix: string(),
61566
- scopes: array(TokenScopeSchema),
61567
- expiresAt: number().nullish(),
61568
- lastUsedAt: number().nullish(),
61569
- createdAt: number()
61570
- });
61571
- var CreateScopedTokenInputSchema = object({
61572
- userId: string(),
61573
- name: string(),
61574
- scopes: array(TokenScopeSchema),
61575
- expiresAt: number().optional()
61576
- });
61577
- var CreateScopedTokenResultSchema = object({
61578
- token: string(),
61579
- record: ScopedTokenSummarySchema
61580
- });
61581
61891
  var OauthSessionSummarySchema = object({
61582
61892
  id: string(),
61583
61893
  userId: string(),
@@ -61599,11 +61909,11 @@ var TotpStatusSchema = object({
61599
61909
  confirmedAt: number().nullable()
61600
61910
  });
61601
61911
  /**
61602
- * user-management — singleton capability for user accounts, API keys,
61603
- * and scoped tokens.
61912
+ * user-management — singleton capability for user accounts and the
61913
+ * legacy API-key rows.
61604
61914
  *
61605
61915
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
61606
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
61916
+ * — the subset check on `setUserScopes` is moot
61607
61917
  * because non-admins never reach these. If/when we open non-admin
61608
61918
  * delegation, structural caller-scope subset check goes inside the
61609
61919
  * provider.
@@ -61660,15 +61970,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
61660
61970
  kind: "mutation",
61661
61971
  auth: "admin",
61662
61972
  access: "delete"
61663
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
61664
- kind: "mutation",
61665
- auth: "admin",
61666
- access: "create"
61667
- }), method(object({ id: string() }), object({ success: literal(true) }), {
61668
- kind: "mutation",
61669
- auth: "admin",
61670
- access: "delete"
61671
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
61973
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
61672
61974
  kind: "mutation",
61673
61975
  auth: "admin",
61674
61976
  access: "create"
@@ -65824,7 +66126,7 @@ Object.freeze({
65824
66126
  capName: "llm",
65825
66127
  capScope: "system",
65826
66128
  addonId: null,
65827
- access: "view"
66129
+ access: "create"
65828
66130
  },
65829
66131
  "llm.listNodeModels": {
65830
66132
  capName: "llm",
@@ -66126,7 +66428,19 @@ Object.freeze({
66126
66428
  addonId: null,
66127
66429
  access: "view"
66128
66430
  },
66129
- "logDestination.query": {
66431
+ "logDestination.cancelRead": {
66432
+ capName: "log-destination",
66433
+ capScope: "system",
66434
+ addonId: null,
66435
+ access: "create"
66436
+ },
66437
+ "logDestination.describeRead": {
66438
+ capName: "log-destination",
66439
+ capScope: "system",
66440
+ addonId: null,
66441
+ access: "view"
66442
+ },
66443
+ "logDestination.read": {
66130
66444
  capName: "log-destination",
66131
66445
  capScope: "system",
66132
66446
  addonId: null,
@@ -70488,12 +70802,6 @@ Object.freeze({
70488
70802
  addonId: null,
70489
70803
  access: "create"
70490
70804
  },
70491
- "userManagement.createScopedToken": {
70492
- capName: "user-management",
70493
- capScope: "system",
70494
- addonId: null,
70495
- access: "create"
70496
- },
70497
70805
  "userManagement.createUser": {
70498
70806
  capName: "user-management",
70499
70807
  capScope: "system",
@@ -70542,12 +70850,6 @@ Object.freeze({
70542
70850
  addonId: null,
70543
70851
  access: "view"
70544
70852
  },
70545
- "userManagement.listScopedTokens": {
70546
- capName: "user-management",
70547
- capScope: "system",
70548
- addonId: null,
70549
- access: "view"
70550
- },
70551
70853
  "userManagement.listUsers": {
70552
70854
  capName: "user-management",
70553
70855
  capScope: "system",
@@ -70602,12 +70904,6 @@ Object.freeze({
70602
70904
  addonId: null,
70603
70905
  access: "delete"
70604
70906
  },
70605
- "userManagement.revokeScopedToken": {
70606
- capName: "user-management",
70607
- capScope: "system",
70608
- addonId: null,
70609
- access: "delete"
70610
- },
70611
70907
  "userManagement.setupTotp": {
70612
70908
  capName: "user-management",
70613
70909
  capScope: "system",
@@ -70638,12 +70934,6 @@ Object.freeze({
70638
70934
  addonId: null,
70639
70935
  access: "view"
70640
70936
  },
70641
- "userManagement.validateScopedToken": {
70642
- capName: "user-management",
70643
- capScope: "system",
70644
- addonId: null,
70645
- access: "view"
70646
- },
70647
70937
  "userManagement.verifyTotp": {
70648
70938
  capName: "user-management",
70649
70939
  capScope: "system",
@@ -72157,6 +72447,11 @@ Object.freeze({
72157
72447
  form: "single",
72158
72448
  optional: false
72159
72449
  }],
72450
+ "logDestination.read": [{
72451
+ name: "deviceId",
72452
+ form: "single",
72453
+ optional: true
72454
+ }],
72160
72455
  "mediaPlayer.getStatus": [{
72161
72456
  name: "deviceId",
72162
72457
  form: "single",