@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.
@@ -5546,7 +5546,7 @@ var ZodIssueCode = {
5546
5546
  var ZodFirstPartyTypeKind;
5547
5547
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5548
5548
  //#endregion
5549
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5549
+ //#region ../types/dist/sleep-BSuCCFjf.mjs
5550
5550
  /**
5551
5551
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5552
5552
  * window to float samples (D455).
@@ -7929,9 +7929,9 @@ function normalizeAddonInitResult(result) {
7929
7929
  return result;
7930
7930
  }
7931
7931
  /**
7932
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7933
- * and validates them (`share-token.service.ts` builds its enum from this
7934
- * list); a data plane names the kinds it ACCEPTS in `share`.
7932
+ * The share-view scope kinds a share-link token can carry. The hub mints
7933
+ * and validates them (`ShareViewGrantSchema` builds its
7934
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7935
7935
  */
7936
7936
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7937
7937
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12919,7 +12919,7 @@ var ConvertResultSchema = object({
12919
12919
  * `super_admin` — collapsed onto the single boolean because every
12920
12920
  * non-admin caller is governed by the same scope-check rules; the
12921
12921
  * distinction was only ever used to route role-specific procedures
12922
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12922
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12923
12923
  * with `isAdmin: false` + an explicit scope list.
12924
12924
  */
12925
12925
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13108,10 +13108,12 @@ var AddonRoutesScopeSchema = object({
13108
13108
  type: literal("addon-routes"),
13109
13109
  access: array(MethodAccessSchema).min(1)
13110
13110
  });
13111
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13111
13112
  var CredentialScopeSchema = union([
13112
13113
  literal("*"),
13113
13114
  ShareViewScopeSchema,
13114
13115
  AddonRoutesScopeSchema,
13116
+ PreferencesSelfScopeSchema,
13115
13117
  TokenScopeSchema
13116
13118
  ]);
13117
13119
  object({
@@ -13120,6 +13122,55 @@ object({
13120
13122
  jti: string().min(16),
13121
13123
  scopes: array(CredentialScopeSchema).min(1)
13122
13124
  });
13125
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13126
+ /** A namespace's value: a JSON object, opaque to the hub. */
13127
+ var PreferenceValueSchema = record(string(), unknown());
13128
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13129
+ /** A stored row, as the owner reads it. */
13130
+ var PreferenceRowSchema = object({
13131
+ namespace: PreferenceNamespaceSchema,
13132
+ value: PreferenceValueSchema,
13133
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13134
+ revision: number().int().positive(),
13135
+ updatedAt: number().int(),
13136
+ /** The client id the last writer sent; `null` when it sent none. */
13137
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13138
+ });
13139
+ object({
13140
+ /** Absent: every namespace the caller holds. */
13141
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13142
+ object({ rows: array(PreferenceRowSchema) });
13143
+ object({
13144
+ namespace: PreferenceNamespaceSchema,
13145
+ value: PreferenceValueSchema,
13146
+ /**
13147
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13148
+ * namespace must not exist yet. Any other value that is not the current
13149
+ * revision answers `conflict` and writes nothing.
13150
+ */
13151
+ baseRevision: number().int().nonnegative().optional(),
13152
+ deviceId: PreferenceDeviceIdSchema.optional()
13153
+ });
13154
+ discriminatedUnion("status", [object({
13155
+ status: literal("saved"),
13156
+ row: PreferenceRowSchema
13157
+ }), object({
13158
+ status: literal("conflict"),
13159
+ current: PreferenceRowSchema.nullable()
13160
+ })]);
13161
+ object({ namespace: PreferenceNamespaceSchema });
13162
+ object({
13163
+ /** `false` when the namespace did not exist. */
13164
+ deleted: boolean() });
13165
+ object({
13166
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13167
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13168
+ object({
13169
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13170
+ rows: array(PreferenceRowSchema),
13171
+ /** Namespaces the client listed that no longer exist. */
13172
+ deleted: array(PreferenceNamespaceSchema)
13173
+ });
13123
13174
  /**
13124
13175
  * The viewer app's custom-scheme callback — the ONE list of URLs a hub flow
13125
13176
  * may hand a browser back to the native app at.
@@ -17526,7 +17577,19 @@ var DeviceHistorySubjectSchema = discriminatedUnion("kind", [object({
17526
17577
  kind: literal("node"),
17527
17578
  nodeId: string().min(1)
17528
17579
  })]);
17580
+ /**
17581
+ * `enum` stores a STATE as the ordinal of its value in the series' value list
17582
+ * (`DeviceHistorySeriesInfo.values`, append-only, so an ordinal never changes
17583
+ * meaning); a rollup keeps the time spent in each state (`states`).
17584
+ */
17529
17585
  var DeviceHistoryKindSchema = _enum([
17586
+ "gauge",
17587
+ "counter",
17588
+ "boolean",
17589
+ "enum"
17590
+ ]);
17591
+ /** What a PRODUCER may declare. `enum` is cap-only: its value list is the cap field's. */
17592
+ var DeviceHistoryProducerKindSchema = _enum([
17530
17593
  "gauge",
17531
17594
  "counter",
17532
17595
  "boolean"
@@ -17563,7 +17626,13 @@ var SeriesInfoSchema = object({
17563
17626
  /** `null` is unknown (a `unitFrom` series whose device does not state a unit right now), never a guess. */
17564
17627
  unit: string().nullable(),
17565
17628
  displayName: string(),
17566
- source: _enum(["cap", "addon"]),
17629
+ source: _enum([
17630
+ "cap",
17631
+ "addon",
17632
+ "derived"
17633
+ ]),
17634
+ /** `enum`: the value of each ordinal (index = ordinal); `null` for every other kind. */
17635
+ values: array(string()).readonly().nullable(),
17567
17636
  firstTs: number(),
17568
17637
  lastTs: number()
17569
17638
  });
@@ -17577,17 +17646,31 @@ var QueryPointSchema = object({
17577
17646
  twMean: number().nullable(),
17578
17647
  min: number(),
17579
17648
  max: number(),
17580
- /** `null` is unknown, never zero (D393). */
17581
- last: number().nullable()
17649
+ /** `null` is unknown, never zero (D393). For an `enum` series: the ordinal of {@link state}. */
17650
+ last: number().nullable(),
17651
+ /**
17652
+ * The increase over the point: a `counter`'s growth since the previous point
17653
+ * or bucket (a drop is a reset, counted from zero), and for
17654
+ * {@link DEVICE_HISTORY_ENERGY_KEY} the kWh used in the bucket. `null` for
17655
+ * every other kind, and when it cannot be known.
17656
+ */
17657
+ delta: number().nullable(),
17658
+ /** `enum`: the state in force at the end of the point (the name of `last`); `null` otherwise. */
17659
+ state: string().nullable(),
17660
+ /** `enum` rollup: milliseconds spent in each state inside the bucket; `null` for raw points and other kinds. */
17661
+ states: record(string(), number()).nullable()
17582
17662
  });
17583
17663
  var QuerySeriesSchema = object({
17584
17664
  scope: string(),
17585
17665
  /** The last point STRICTLY BEFORE `from` in the chosen tier, so a step chart can start at the held value. */
17586
17666
  before: object({
17587
17667
  t: number(),
17588
- value: number().nullable()
17668
+ value: number().nullable(),
17669
+ state: string().nullable()
17589
17670
  }).nullable(),
17590
- points: array(QueryPointSchema).readonly()
17671
+ points: array(QueryPointSchema).readonly(),
17672
+ /** A derived key: the stored key its points were computed from; `null` for a stored series. */
17673
+ derivedFrom: string().nullable()
17591
17674
  });
17592
17675
  /** The window part of a query, shared by the device and node forms. */
17593
17676
  var QueryWindowShape = {
@@ -17603,6 +17686,23 @@ var QueryResultSchema = object({
17603
17686
  series: array(QuerySeriesSchema).readonly(),
17604
17687
  truncated: boolean()
17605
17688
  });
17689
+ /** One read of a batch: a device's key or a node's key (exactly one subject). */
17690
+ var QueryManyItemSchema = union([object({
17691
+ deviceId: number().int(),
17692
+ key: string(),
17693
+ scope: string().optional()
17694
+ }), object({
17695
+ forNodeId: string().min(1),
17696
+ key: string(),
17697
+ scope: string().optional()
17698
+ })]);
17699
+ var QueryManyEntrySchema = discriminatedUnion("ok", [object({
17700
+ ok: literal(true),
17701
+ result: QueryResultSchema
17702
+ }), object({
17703
+ ok: literal(false),
17704
+ error: string()
17705
+ })]);
17606
17706
  var TierStatusSchema = object({
17607
17707
  tier: DeviceHistoryResolutionSchema,
17608
17708
  /** `null` until the first background count answered. */
@@ -17658,16 +17758,22 @@ var DeviceHistoryStatusSchema = object({
17658
17758
  lastRefreshAt: number().nullable()
17659
17759
  })
17660
17760
  });
17661
- method(object({ deviceId: number().int() }), array(SeriesInfoSchema).readonly()), method(object({ nodeId: string().min(1) }), array(SeriesInfoSchema).readonly(), { auth: "admin" }), method(object({
17761
+ method(object({ deviceId: number().int() }), array(SeriesInfoSchema).readonly()), method(object({ forNodeId: string().min(1) }), array(SeriesInfoSchema).readonly(), { auth: "admin" }), method(object({
17662
17762
  deviceId: number().int(),
17663
17763
  ...QueryWindowShape
17664
17764
  }), QueryResultSchema), method(object({
17665
- nodeId: string().min(1),
17765
+ forNodeId: string().min(1),
17666
17766
  ...QueryWindowShape
17667
17767
  }), QueryResultSchema, { auth: "admin" }), method(object({
17768
+ items: array(QueryManyItemSchema).min(1).max(24),
17769
+ from: QueryWindowShape.from,
17770
+ to: QueryWindowShape.to,
17771
+ resolution: QueryWindowShape.resolution,
17772
+ maxPoints: QueryWindowShape.maxPoints
17773
+ }), object({ results: array(QueryManyEntrySchema).readonly() }), { auth: "admin" }), method(object({
17668
17774
  name: string().regex(/^[a-z0-9-]+$/),
17669
17775
  subjectKind: _enum(["device", "node"]),
17670
- kind: DeviceHistoryKindSchema,
17776
+ kind: DeviceHistoryProducerKindSchema,
17671
17777
  unit: string().optional(),
17672
17778
  displayName: string().min(1),
17673
17779
  ingest: _enum(["points", "buckets"])
@@ -40275,38 +40381,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40275
40381
  auth: "admin",
40276
40382
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40277
40383
  });
40384
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40385
+ /** What a model (or, by default, every model of a kind) can do. */
40386
+ var LlmModelFeaturesSchema = object({
40387
+ vision: boolean(),
40388
+ tools: boolean(),
40389
+ streaming: boolean()
40390
+ });
40391
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40392
+ var LlmModelInfoSchema = object({
40393
+ id: string(),
40394
+ label: string().optional(),
40395
+ contextLength: number().int().positive().optional(),
40396
+ features: LlmModelFeaturesSchema.partial().optional()
40397
+ });
40278
40398
  /**
40279
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40280
- * methods concat-fan across providers; single-row methods route to ONE
40281
- * provider by the `addonId` in the call input (the notification-output
40282
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40283
- * (hub-placed); the cap stays open for future providers.
40284
- *
40285
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40286
- * `apiKey` is a password field — providers REDACT it on read and merge on
40287
- * write; a stored key NEVER round-trips to a client.
40399
+ * The provider-specific part of a profile, validated by the provider that owns
40400
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40401
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40402
+ * keychain, never in the row, and reads back as the redaction marker.
40288
40403
  */
40289
- var LlmProfileKindSchema = _enum([
40290
- "openai-compatible",
40291
- "openai",
40292
- "anthropic",
40293
- "google",
40294
- "managed-local",
40295
- "apple-foundation"
40296
- ]);
40404
+ var LlmProviderConfigSchema = record(string(), unknown());
40297
40405
  var LlmProfileSchema = object({
40298
40406
  id: string(),
40299
40407
  name: string(),
40408
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40300
40409
  kind: LlmProfileKindSchema,
40301
40410
  /** Stamped by the provider — keeps the fanned catalog routable. */
40302
40411
  addonId: string(),
40303
40412
  enabled: boolean(),
40304
40413
  /** Vendor model id, or the managed runtime's loaded model. */
40305
40414
  model: string(),
40306
- /** Required for openai-compatible; override for cloud kinds. */
40307
- baseUrl: string().optional(),
40308
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40309
- apiKey: string().optional(),
40310
40415
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40311
40416
  * degraded to text — that shipped once and produced a confident answer to a
40312
40417
  * question about a picture nobody sent. */
@@ -40314,15 +40419,11 @@ var LlmProfileSchema = object({
40314
40419
  temperature: number().min(0).max(2).optional(),
40315
40420
  /** Nucleus sampling. Every wire we speak has it. */
40316
40421
  topP: number().min(0).max(1).optional(),
40317
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40318
- * wire does, and the client drops it there (measured: the request body gets
40319
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40320
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40422
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40423
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40321
40424
  topK: number().int().positive().optional(),
40322
40425
  maxTokens: number().int().positive().optional(),
40323
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40324
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40325
- * the model with, so it is the one field that changes a PROCESS. */
40426
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40326
40427
  contextLength: number().int().positive().optional(),
40327
40428
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40328
40429
  * two system prompts fighting is worse than either alone). */
@@ -40348,16 +40449,37 @@ var LlmProfileSchema = object({
40348
40449
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40349
40450
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40350
40451
  toolsEnabled: boolean().default(false),
40351
- extraHeaders: record(string(), string()).optional(),
40352
- /** kind === 'managed-local' only (spec §4). */
40353
- runtime: ManagedRuntimeConfigSchema.optional(),
40354
- /**
40355
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40356
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40357
- * `supportsVision` on such a row is stamped by the provider from the node's
40358
- * reported `imageInput`, never taken from the operator (D62).
40359
- */
40360
- appleFoundation: object({ nodeId: string() }).optional()
40452
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40453
+ providerConfig: LlmProviderConfigSchema.default({})
40454
+ });
40455
+ /**
40456
+ * The common profile fields a kind's editor offers. The editor owns how each
40457
+ * one is drawn; the provider says which of them mean something on its wire.
40458
+ */
40459
+ var LlmProfileFieldSchema = _enum([
40460
+ "temperature",
40461
+ "topP",
40462
+ "topK",
40463
+ "maxTokens",
40464
+ "contextLength",
40465
+ "systemPrompt",
40466
+ "timeoutMs",
40467
+ "connectTimeoutMs",
40468
+ "firstTokenTimeoutMs",
40469
+ "idleTimeoutMs",
40470
+ "retry",
40471
+ "toolsEnabled"
40472
+ ]);
40473
+ /**
40474
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40475
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40476
+ * picker: that widget owns the model choice.
40477
+ */
40478
+ var LlmProviderWidgetSchema = object({
40479
+ id: string(),
40480
+ placement: _enum(["connection", "model"]),
40481
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40482
+ requires: array(string()).optional()
40361
40483
  });
40362
40484
  /** ConfigUISchema tree passed through untyped on the wire (the
40363
40485
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40366,11 +40488,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40366
40488
  var LlmProfileKindDescriptorSchema = object({
40367
40489
  kind: LlmProfileKindSchema,
40368
40490
  label: string(),
40491
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40369
40492
  icon: string(),
40370
40493
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40371
40494
  addonId: string(),
40372
- configSchema: ConfigSchemaPassthrough$3
40495
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40496
+ connectionSchema: ConfigSchemaPassthrough$3,
40497
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40498
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40499
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40500
+ features: LlmModelFeaturesSchema,
40501
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40502
+ visionEditable: boolean(),
40503
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40504
+ modelCatalog: _enum([
40505
+ "fetch",
40506
+ "static",
40507
+ "none"
40508
+ ]),
40509
+ staticModels: array(LlmModelInfoSchema).optional(),
40510
+ /** The common fields that mean something on this kind's wire. */
40511
+ profileFields: array(LlmProfileFieldSchema),
40512
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40513
+ });
40514
+ /**
40515
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40516
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40517
+ * untouched (absent or the redaction marker) is resolved server-side from the
40518
+ * stored profile — the browser never receives it.
40519
+ */
40520
+ var LlmListModelsInputSchema = object({
40521
+ addonId: string(),
40522
+ kind: LlmProfileKindSchema,
40523
+ profileId: string().optional(),
40524
+ connection: LlmProviderConfigSchema.optional()
40373
40525
  });
40526
+ var LlmListModelsErrorCodeSchema = _enum([
40527
+ "auth",
40528
+ "network",
40529
+ "unsupported",
40530
+ "invalid"
40531
+ ]);
40532
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40533
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40534
+ ok: literal(true),
40535
+ models: array(LlmModelInfoSchema)
40536
+ }), object({
40537
+ ok: literal(false),
40538
+ code: LlmListModelsErrorCodeSchema,
40539
+ message: string()
40540
+ })]);
40374
40541
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40375
40542
  var LlmDefaultSchema = object({
40376
40543
  selector: LlmDefaultSelectorSchema,
@@ -40470,7 +40637,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40470
40637
  kind: "mutation",
40471
40638
  auth: "admin",
40472
40639
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40473
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40640
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40641
+ kind: "mutation",
40642
+ auth: "admin"
40643
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40474
40644
  selector: LlmDefaultSelectorSchema,
40475
40645
  profileId: string().nullable()
40476
40646
  }), _void(), {
@@ -40638,14 +40808,106 @@ var LogEntrySchema = object({
40638
40808
  meta: record(string(), unknown()).optional(),
40639
40809
  tags: record(string(), string()).optional()
40640
40810
  });
40641
- method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
40642
- scope: array(string()).optional(),
40811
+ /**
40812
+ * A history READ against one destination (D898).
40813
+ *
40814
+ * Every filter is applied by the PROVIDER, before the limit — a filter the
40815
+ * browser applied after the limit is what made a rare device's lines
40816
+ * unreachable behind a busy one's. `before` / `after` are cursors the provider
40817
+ * minted (opaque to everyone else): a file position for the rotated files, a
40818
+ * nanosecond timestamp for Loki.
40819
+ *
40820
+ * A read is BOUNDED by `budgetMs`: a filter that matches nothing on a 30-day
40821
+ * store answers `done: false` with the cursor it reached and the bytes it
40822
+ * scanned, and the caller decides whether to go on. That is what makes a long
40823
+ * scan show progress and stop when asked — `cancelRead` ends the slice in
40824
+ * flight, and not asking for the next slice ends the scan.
40825
+ */
40826
+ var LogReadQuerySchema = object({
40827
+ /** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
40828
+ requestId: string().min(1).max(64).optional(),
40829
+ /** The device the line is about (`tags.deviceId`, numeric). */
40830
+ deviceId: number().int().optional(),
40831
+ /**
40832
+ * The emitting addon — bare manifest id; `@<version>` / `::<sub>` suffixes
40833
+ * match. Not `addonId`: a cap router reads that name as "which provider".
40834
+ */
40835
+ fromAddonId: string().min(1).max(200).optional(),
40836
+ /**
40837
+ * The emitting node: matches the agent that emitted the line, the node
40838
+ * itself, or a worker under it (`<agent>/<runner>`) — the `agentId`
40839
+ * semantics of `matchesLogTags`. Not `nodeId`: a cap router reads that
40840
+ * name as "which node's provider".
40841
+ */
40842
+ fromNodeId: string().min(1).max(200).optional(),
40843
+ /** Any other tag, exact match (AND). */
40844
+ tags: record(string(), union([string(), number()])).optional(),
40845
+ /** Severity FLOOR: this level and above. */
40643
40846
  level: LogLevelSchema.optional(),
40644
- since: date().optional(),
40645
- until: date().optional(),
40646
- limit: number().optional(),
40647
- tags: record(string(), string()).optional()
40648
- }), array(LogEntrySchema).readonly());
40847
+ /** Case-insensitive substring over message, scope, tag values and meta values. */
40848
+ text: string().min(1).max(200).optional(),
40849
+ /** Epoch ms, inclusive. */
40850
+ since: number().optional(),
40851
+ /** Epoch ms, inclusive. */
40852
+ until: number().optional(),
40853
+ /** Older than this cursor (exclusive). Absent with `after` absent ⇒ from the newest. */
40854
+ before: string().min(1).max(1024).optional(),
40855
+ /** Newer than this cursor (exclusive). */
40856
+ after: string().min(1).max(1024).optional(),
40857
+ limit: number().int().min(1).max(1e3).optional(),
40858
+ /** Wall-clock bound of this slice. The provider caps it. */
40859
+ budgetMs: number().int().min(50).max(1e4).optional()
40860
+ });
40861
+ var LogReadResultSchema = object({
40862
+ /** Newest first. */
40863
+ entries: array(object({
40864
+ /** `<bootId>.<seq>` minted by the emitting LogManager — the dedupe key. */
40865
+ id: string().optional(),
40866
+ /** Epoch ms. */
40867
+ timestamp: number(),
40868
+ level: LogLevelSchema,
40869
+ scope: string().optional(),
40870
+ message: string(),
40871
+ tags: record(string(), union([string(), number()])).optional(),
40872
+ meta: record(string(), unknown()).optional()
40873
+ })),
40874
+ /** Pass as `before` for the next older page; null when nothing older exists. */
40875
+ nextBefore: string().nullable(),
40876
+ /** Pass as `after` to read what arrived since; null when unknown. */
40877
+ nextAfter: string().nullable(),
40878
+ /** Bytes this slice read (files) or received (remote). Progress, not a promise. */
40879
+ scannedBytes: number().int().nonnegative(),
40880
+ /**
40881
+ * True when the scan in this direction reached the end of the store.
40882
+ * False with fewer than `limit` entries means the budget ran out first —
40883
+ * call again with `nextBefore` to go on.
40884
+ */
40885
+ done: boolean(),
40886
+ /** True when `cancelRead` ended this slice early. */
40887
+ cancelled: boolean().optional()
40888
+ });
40889
+ var LogReadCapabilitiesSchema = object({
40890
+ /** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
40891
+ readable: boolean(),
40892
+ /** Why not, when `readable` is false — rendered next to the source. */
40893
+ reason: string().nullable(),
40894
+ /** Filters the provider applies itself. A false one is applied by nobody. */
40895
+ filters: object({
40896
+ deviceId: boolean(),
40897
+ addonId: boolean(),
40898
+ nodeId: boolean(),
40899
+ tags: boolean(),
40900
+ level: boolean(),
40901
+ text: boolean(),
40902
+ timeRange: boolean()
40903
+ }),
40904
+ /** How far back the store reaches, when the provider knows (days). */
40905
+ retentionDays: number().nullable()
40906
+ });
40907
+ 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() }), {
40908
+ kind: "mutation",
40909
+ auth: "admin"
40910
+ });
40649
40911
  /**
40650
40912
  * `login-method` — collection cap through which auth addons contribute
40651
40913
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -43209,6 +43471,33 @@ var NcRuleTargetSchema = object({
43209
43471
  params: record(string(), unknown()).optional()
43210
43472
  });
43211
43473
  /**
43474
+ * WHAT THE NOTIFICATION'S PICTURE IS (D897) — the ONE media choice of a rule.
43475
+ *
43476
+ * Every mode starts from the same CLEAN source frame of the trigger moment
43477
+ * (keyFrame → sceneFrame → lastSceneFrame, narrowed to the trigger instant and
43478
+ * to the zone that fired the rule) and renders it once at send time:
43479
+ * - `scene-boxes` — the whole scene, the subject outlined thick in the accent
43480
+ * colour and every OTHER track visible at that instant outlined thin, each
43481
+ * labelled with class and confidence ("dog 87%").
43482
+ * - `crop` — the subject cut out of that frame around its box at that instant.
43483
+ * - `clean` — the whole scene with nothing drawn on it.
43484
+ * - `none` — no picture.
43485
+ *
43486
+ * A mode that cannot be honoured (no box at that instant, a photograph with no
43487
+ * tracked subject) ships `clean` and names the reason in the log, per camera.
43488
+ * It replaces the `attach` × `frame` × `zoneCrop` triple, which let one rule
43489
+ * ship a crop on one event and a boxed scene on the next depending on which
43490
+ * stored kind had landed.
43491
+ */
43492
+ var NcMediaImageSchema = _enum([
43493
+ "scene-boxes",
43494
+ "crop",
43495
+ "clean",
43496
+ "none"
43497
+ ]);
43498
+ /**
43499
+ * @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
43500
+ *
43212
43501
  * Media attachment policy (P1 still-image subset).
43213
43502
  * - `best` — the best AVAILABLE subject image at dispatch time (D-3).
43214
43503
  * - `best-matching` — the media that explains WHY the rule fired: a rule
@@ -43222,6 +43511,8 @@ var NcRuleTargetSchema = object({
43222
43511
  * - `none` — no attachment.
43223
43512
  */
43224
43513
  /**
43514
+ * @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
43515
+ *
43225
43516
  * WHAT THE PICTURE SHOWS — chosen explicitly, because the implicit ladders
43226
43517
  * conflate it with the selection strategy and betray the request: asking for
43227
43518
  * the clean scene frame on an object-event owner used to start at
@@ -43250,16 +43541,29 @@ var NcMediaFrameSchema = _enum([
43250
43541
  */
43251
43542
  var NcLinkedCameraModeSchema = _enum(["mosaic", "each"]);
43252
43543
  var NcMediaPolicySchema = object({
43544
+ /**
43545
+ * The picture — see {@link NcMediaImageSchema}. Absent on a rule nobody has
43546
+ * saved since D897: `normalizeNcMediaPolicy` derives it from the legacy
43547
+ * triple below, at load and at every write, and the store keeps only this.
43548
+ */
43549
+ image: NcMediaImageSchema.optional(),
43550
+ /**
43551
+ * Draw the zone that FIRED the rule on the picture (`scene-boxes` / `clean`;
43552
+ * a `crop` never shows it). Valid only on a rule whose trigger is a zone —
43553
+ * `conditions.zones` or an occupancy zone — and refused on save otherwise.
43554
+ * Replaces `zoneCrop`.
43555
+ */
43556
+ showTriggerZone: boolean().optional(),
43557
+ /** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
43253
43558
  attach: _enum([
43254
43559
  "best",
43255
43560
  "best-matching",
43256
43561
  "keyFrame",
43257
43562
  "none"
43258
- ]).default("best"),
43259
- /** What the still shows. Absent = `cropped` (the historical `best` shape). */
43563
+ ]).optional(),
43564
+ /** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
43260
43565
  frame: NcMediaFrameSchema.optional(),
43261
- /** Crop the attached still to the rule's condition-zone bbox (padded) —
43262
- * "show me the ZONE", not the whole scene or the subject crop. */
43566
+ /** @deprecated D897 — folded into `image: 'clean'` + `showTriggerZone` on save. */
43263
43567
  zoneCrop: boolean().optional(),
43264
43568
  /**
43265
43569
  * Also attach a short GIF cut from the stream broker's clip ring around the
@@ -43431,7 +43735,9 @@ var NcRuleInputSchema = object({
43431
43735
  * targets.
43432
43736
  */
43433
43737
  targetUsers: array(string()).optional(),
43434
- media: NcMediaPolicySchema.default({ attach: "best" }),
43738
+ /** Absent = the kind's default picture (`resolveNcMediaImage`): the subject crop for a
43739
+ * detection, the clean scene for a sensor or a sound. Set explicitly on save (D897). */
43740
+ media: NcMediaPolicySchema.default({}),
43435
43741
  throttle: NcThrottleSchema.default({
43436
43742
  cooldownSec: 60,
43437
43743
  scope: "rule-device"
@@ -44368,13 +44674,37 @@ var NcAlarmModeOpeningsSchema = object({
44368
44674
  /** Covered devices whose state could not be read (D49): neither open nor closed. */
44369
44675
  unknown: array(number().int())
44370
44676
  });
44677
+ /**
44678
+ * One alarm INPUT — a (rule, device) pair — the operator bypassed until the
44679
+ * next disarm ("Bypass this input until disarm" on a trigger notification, or
44680
+ * `nc.bypassAlarmInput`). Reported so an armed alarm with a silenced input
44681
+ * never looks fully armed (D62: off must never look like broken).
44682
+ */
44683
+ var NcAlarmInputBypassViewSchema = object({
44684
+ ruleId: string(),
44685
+ /** The rule's current name (its frozen name when the rule is gone). */
44686
+ ruleName: string(),
44687
+ /** The input: the sensor of the match, else its camera. */
44688
+ deviceId: number().int(),
44689
+ /** The input's current name. */
44690
+ name: string(),
44691
+ /** When it was bypassed (ms epoch). */
44692
+ since: number(),
44693
+ /** Triggers from this input dropped since. */
44694
+ dropped: number().int().min(0)
44695
+ });
44371
44696
  var NcAlarmLiveSchema = object({
44372
44697
  state: AlarmStateSchema,
44373
44698
  /** The mode being armed into (exit delay) or held; null when disarmed. */
44374
44699
  targetMode: AlarmArmModeSchema.nullable(),
44375
44700
  availableModes: array(AlarmArmModeSchema),
44376
44701
  openings: array(NcAlarmModeOpeningsSchema),
44377
- exclusions: array(NcAlarmExclusionViewSchema)
44702
+ exclusions: array(NcAlarmExclusionViewSchema),
44703
+ /**
44704
+ * Inputs bypassed for the rest of this arm session; cleared on disarm.
44705
+ * Defaulted so an older hub answer still parses (as "none known").
44706
+ */
44707
+ bypassedInputs: array(NcAlarmInputBypassViewSchema).default([])
44378
44708
  });
44379
44709
  var NcAlarmConfigSchema = object({
44380
44710
  /**
@@ -61524,26 +61854,6 @@ var ApiKeySummarySchema = object({
61524
61854
  createdAt: number(),
61525
61855
  lastUsedAt: number().optional()
61526
61856
  });
61527
- var ScopedTokenSummarySchema = object({
61528
- id: string(),
61529
- userId: string(),
61530
- name: string(),
61531
- tokenPrefix: string(),
61532
- scopes: array(TokenScopeSchema),
61533
- expiresAt: number().nullish(),
61534
- lastUsedAt: number().nullish(),
61535
- createdAt: number()
61536
- });
61537
- var CreateScopedTokenInputSchema = object({
61538
- userId: string(),
61539
- name: string(),
61540
- scopes: array(TokenScopeSchema),
61541
- expiresAt: number().optional()
61542
- });
61543
- var CreateScopedTokenResultSchema = object({
61544
- token: string(),
61545
- record: ScopedTokenSummarySchema
61546
- });
61547
61857
  var OauthSessionSummarySchema = object({
61548
61858
  id: string(),
61549
61859
  userId: string(),
@@ -61565,11 +61875,11 @@ var TotpStatusSchema = object({
61565
61875
  confirmedAt: number().nullable()
61566
61876
  });
61567
61877
  /**
61568
- * user-management — singleton capability for user accounts, API keys,
61569
- * and scoped tokens.
61878
+ * user-management — singleton capability for user accounts and the
61879
+ * legacy API-key rows.
61570
61880
  *
61571
61881
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
61572
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
61882
+ * — the subset check on `setUserScopes` is moot
61573
61883
  * because non-admins never reach these. If/when we open non-admin
61574
61884
  * delegation, structural caller-scope subset check goes inside the
61575
61885
  * provider.
@@ -61626,15 +61936,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
61626
61936
  kind: "mutation",
61627
61937
  auth: "admin",
61628
61938
  access: "delete"
61629
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
61630
- kind: "mutation",
61631
- auth: "admin",
61632
- access: "create"
61633
- }), method(object({ id: string() }), object({ success: literal(true) }), {
61634
- kind: "mutation",
61635
- auth: "admin",
61636
- access: "delete"
61637
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
61939
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
61638
61940
  kind: "mutation",
61639
61941
  auth: "admin",
61640
61942
  access: "create"
@@ -65790,7 +66092,7 @@ Object.freeze({
65790
66092
  capName: "llm",
65791
66093
  capScope: "system",
65792
66094
  addonId: null,
65793
- access: "view"
66095
+ access: "create"
65794
66096
  },
65795
66097
  "llm.listNodeModels": {
65796
66098
  capName: "llm",
@@ -66092,7 +66394,19 @@ Object.freeze({
66092
66394
  addonId: null,
66093
66395
  access: "view"
66094
66396
  },
66095
- "logDestination.query": {
66397
+ "logDestination.cancelRead": {
66398
+ capName: "log-destination",
66399
+ capScope: "system",
66400
+ addonId: null,
66401
+ access: "create"
66402
+ },
66403
+ "logDestination.describeRead": {
66404
+ capName: "log-destination",
66405
+ capScope: "system",
66406
+ addonId: null,
66407
+ access: "view"
66408
+ },
66409
+ "logDestination.read": {
66096
66410
  capName: "log-destination",
66097
66411
  capScope: "system",
66098
66412
  addonId: null,
@@ -70454,12 +70768,6 @@ Object.freeze({
70454
70768
  addonId: null,
70455
70769
  access: "create"
70456
70770
  },
70457
- "userManagement.createScopedToken": {
70458
- capName: "user-management",
70459
- capScope: "system",
70460
- addonId: null,
70461
- access: "create"
70462
- },
70463
70771
  "userManagement.createUser": {
70464
70772
  capName: "user-management",
70465
70773
  capScope: "system",
@@ -70508,12 +70816,6 @@ Object.freeze({
70508
70816
  addonId: null,
70509
70817
  access: "view"
70510
70818
  },
70511
- "userManagement.listScopedTokens": {
70512
- capName: "user-management",
70513
- capScope: "system",
70514
- addonId: null,
70515
- access: "view"
70516
- },
70517
70819
  "userManagement.listUsers": {
70518
70820
  capName: "user-management",
70519
70821
  capScope: "system",
@@ -70568,12 +70870,6 @@ Object.freeze({
70568
70870
  addonId: null,
70569
70871
  access: "delete"
70570
70872
  },
70571
- "userManagement.revokeScopedToken": {
70572
- capName: "user-management",
70573
- capScope: "system",
70574
- addonId: null,
70575
- access: "delete"
70576
- },
70577
70873
  "userManagement.setupTotp": {
70578
70874
  capName: "user-management",
70579
70875
  capScope: "system",
@@ -70604,12 +70900,6 @@ Object.freeze({
70604
70900
  addonId: null,
70605
70901
  access: "view"
70606
70902
  },
70607
- "userManagement.validateScopedToken": {
70608
- capName: "user-management",
70609
- capScope: "system",
70610
- addonId: null,
70611
- access: "view"
70612
- },
70613
70903
  "userManagement.verifyTotp": {
70614
70904
  capName: "user-management",
70615
70905
  capScope: "system",
@@ -72123,6 +72413,11 @@ Object.freeze({
72123
72413
  form: "single",
72124
72414
  optional: false
72125
72415
  }],
72416
+ "logDestination.read": [{
72417
+ name: "deviceId",
72418
+ form: "single",
72419
+ optional: true
72420
+ }],
72126
72421
  "mediaPlayer.getStatus": [{
72127
72422
  name: "deviceId",
72128
72423
  form: "single",