@camstack/addon-provider-onvif 1.2.132 → 1.2.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +419 -124
  2. package/dist/addon.mjs +419 -124
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -5417,7 +5417,7 @@ var ZodIssueCode = {
5417
5417
  var ZodFirstPartyTypeKind;
5418
5418
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5419
5419
  //#endregion
5420
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5420
+ //#region ../types/dist/sleep-BSuCCFjf.mjs
5421
5421
  /**
5422
5422
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5423
5423
  * window to float samples (D455).
@@ -7800,9 +7800,9 @@ function normalizeAddonInitResult(result) {
7800
7800
  return result;
7801
7801
  }
7802
7802
  /**
7803
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7804
- * and validates them (`share-token.service.ts` builds its enum from this
7805
- * list); a data plane names the kinds it ACCEPTS in `share`.
7803
+ * The share-view scope kinds a share-link token can carry. The hub mints
7804
+ * and validates them (`ShareViewGrantSchema` builds its
7805
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7806
7806
  */
7807
7807
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7808
7808
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12421,7 +12421,7 @@ var ConvertResultSchema = object({
12421
12421
  * `super_admin` — collapsed onto the single boolean because every
12422
12422
  * non-admin caller is governed by the same scope-check rules; the
12423
12423
  * distinction was only ever used to route role-specific procedures
12424
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12424
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12425
12425
  * with `isAdmin: false` + an explicit scope list.
12426
12426
  */
12427
12427
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12610,10 +12610,12 @@ var AddonRoutesScopeSchema = object({
12610
12610
  type: literal("addon-routes"),
12611
12611
  access: array(MethodAccessSchema).min(1)
12612
12612
  });
12613
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12613
12614
  var CredentialScopeSchema = union([
12614
12615
  literal("*"),
12615
12616
  ShareViewScopeSchema,
12616
12617
  AddonRoutesScopeSchema,
12618
+ PreferencesSelfScopeSchema,
12617
12619
  TokenScopeSchema
12618
12620
  ]);
12619
12621
  object({
@@ -12622,6 +12624,55 @@ object({
12622
12624
  jti: string().min(16),
12623
12625
  scopes: array(CredentialScopeSchema).min(1)
12624
12626
  });
12627
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12628
+ /** A namespace's value: a JSON object, opaque to the hub. */
12629
+ var PreferenceValueSchema = record(string(), unknown());
12630
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12631
+ /** A stored row, as the owner reads it. */
12632
+ var PreferenceRowSchema = object({
12633
+ namespace: PreferenceNamespaceSchema,
12634
+ value: PreferenceValueSchema,
12635
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12636
+ revision: number().int().positive(),
12637
+ updatedAt: number().int(),
12638
+ /** The client id the last writer sent; `null` when it sent none. */
12639
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12640
+ });
12641
+ object({
12642
+ /** Absent: every namespace the caller holds. */
12643
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12644
+ object({ rows: array(PreferenceRowSchema) });
12645
+ object({
12646
+ namespace: PreferenceNamespaceSchema,
12647
+ value: PreferenceValueSchema,
12648
+ /**
12649
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12650
+ * namespace must not exist yet. Any other value that is not the current
12651
+ * revision answers `conflict` and writes nothing.
12652
+ */
12653
+ baseRevision: number().int().nonnegative().optional(),
12654
+ deviceId: PreferenceDeviceIdSchema.optional()
12655
+ });
12656
+ discriminatedUnion("status", [object({
12657
+ status: literal("saved"),
12658
+ row: PreferenceRowSchema
12659
+ }), object({
12660
+ status: literal("conflict"),
12661
+ current: PreferenceRowSchema.nullable()
12662
+ })]);
12663
+ object({ namespace: PreferenceNamespaceSchema });
12664
+ object({
12665
+ /** `false` when the namespace did not exist. */
12666
+ deleted: boolean() });
12667
+ object({
12668
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12669
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12670
+ object({
12671
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12672
+ rows: array(PreferenceRowSchema),
12673
+ /** Namespaces the client listed that no longer exist. */
12674
+ deleted: array(PreferenceNamespaceSchema)
12675
+ });
12625
12676
  _enum(["new-session", "step-up"]);
12626
12677
  /** The languages the hub's app landing pages are written in (D858). */
12627
12678
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -16769,7 +16820,19 @@ var DeviceHistorySubjectSchema = discriminatedUnion("kind", [object({
16769
16820
  kind: literal("node"),
16770
16821
  nodeId: string().min(1)
16771
16822
  })]);
16823
+ /**
16824
+ * `enum` stores a STATE as the ordinal of its value in the series' value list
16825
+ * (`DeviceHistorySeriesInfo.values`, append-only, so an ordinal never changes
16826
+ * meaning); a rollup keeps the time spent in each state (`states`).
16827
+ */
16772
16828
  var DeviceHistoryKindSchema = _enum([
16829
+ "gauge",
16830
+ "counter",
16831
+ "boolean",
16832
+ "enum"
16833
+ ]);
16834
+ /** What a PRODUCER may declare. `enum` is cap-only: its value list is the cap field's. */
16835
+ var DeviceHistoryProducerKindSchema = _enum([
16773
16836
  "gauge",
16774
16837
  "counter",
16775
16838
  "boolean"
@@ -16806,7 +16869,13 @@ var SeriesInfoSchema = object({
16806
16869
  /** `null` is unknown (a `unitFrom` series whose device does not state a unit right now), never a guess. */
16807
16870
  unit: string().nullable(),
16808
16871
  displayName: string(),
16809
- source: _enum(["cap", "addon"]),
16872
+ source: _enum([
16873
+ "cap",
16874
+ "addon",
16875
+ "derived"
16876
+ ]),
16877
+ /** `enum`: the value of each ordinal (index = ordinal); `null` for every other kind. */
16878
+ values: array(string()).readonly().nullable(),
16810
16879
  firstTs: number(),
16811
16880
  lastTs: number()
16812
16881
  });
@@ -16820,17 +16889,31 @@ var QueryPointSchema = object({
16820
16889
  twMean: number().nullable(),
16821
16890
  min: number(),
16822
16891
  max: number(),
16823
- /** `null` is unknown, never zero (D393). */
16824
- last: number().nullable()
16892
+ /** `null` is unknown, never zero (D393). For an `enum` series: the ordinal of {@link state}. */
16893
+ last: number().nullable(),
16894
+ /**
16895
+ * The increase over the point: a `counter`'s growth since the previous point
16896
+ * or bucket (a drop is a reset, counted from zero), and for
16897
+ * {@link DEVICE_HISTORY_ENERGY_KEY} the kWh used in the bucket. `null` for
16898
+ * every other kind, and when it cannot be known.
16899
+ */
16900
+ delta: number().nullable(),
16901
+ /** `enum`: the state in force at the end of the point (the name of `last`); `null` otherwise. */
16902
+ state: string().nullable(),
16903
+ /** `enum` rollup: milliseconds spent in each state inside the bucket; `null` for raw points and other kinds. */
16904
+ states: record(string(), number()).nullable()
16825
16905
  });
16826
16906
  var QuerySeriesSchema = object({
16827
16907
  scope: string(),
16828
16908
  /** The last point STRICTLY BEFORE `from` in the chosen tier, so a step chart can start at the held value. */
16829
16909
  before: object({
16830
16910
  t: number(),
16831
- value: number().nullable()
16911
+ value: number().nullable(),
16912
+ state: string().nullable()
16832
16913
  }).nullable(),
16833
- points: array(QueryPointSchema).readonly()
16914
+ points: array(QueryPointSchema).readonly(),
16915
+ /** A derived key: the stored key its points were computed from; `null` for a stored series. */
16916
+ derivedFrom: string().nullable()
16834
16917
  });
16835
16918
  /** The window part of a query, shared by the device and node forms. */
16836
16919
  var QueryWindowShape = {
@@ -16846,6 +16929,23 @@ var QueryResultSchema = object({
16846
16929
  series: array(QuerySeriesSchema).readonly(),
16847
16930
  truncated: boolean()
16848
16931
  });
16932
+ /** One read of a batch: a device's key or a node's key (exactly one subject). */
16933
+ var QueryManyItemSchema = union([object({
16934
+ deviceId: number().int(),
16935
+ key: string(),
16936
+ scope: string().optional()
16937
+ }), object({
16938
+ forNodeId: string().min(1),
16939
+ key: string(),
16940
+ scope: string().optional()
16941
+ })]);
16942
+ var QueryManyEntrySchema = discriminatedUnion("ok", [object({
16943
+ ok: literal(true),
16944
+ result: QueryResultSchema
16945
+ }), object({
16946
+ ok: literal(false),
16947
+ error: string()
16948
+ })]);
16849
16949
  var TierStatusSchema = object({
16850
16950
  tier: DeviceHistoryResolutionSchema,
16851
16951
  /** `null` until the first background count answered. */
@@ -16901,16 +17001,22 @@ var DeviceHistoryStatusSchema = object({
16901
17001
  lastRefreshAt: number().nullable()
16902
17002
  })
16903
17003
  });
16904
- method(object({ deviceId: number().int() }), array(SeriesInfoSchema).readonly()), method(object({ nodeId: string().min(1) }), array(SeriesInfoSchema).readonly(), { auth: "admin" }), method(object({
17004
+ method(object({ deviceId: number().int() }), array(SeriesInfoSchema).readonly()), method(object({ forNodeId: string().min(1) }), array(SeriesInfoSchema).readonly(), { auth: "admin" }), method(object({
16905
17005
  deviceId: number().int(),
16906
17006
  ...QueryWindowShape
16907
17007
  }), QueryResultSchema), method(object({
16908
- nodeId: string().min(1),
17008
+ forNodeId: string().min(1),
16909
17009
  ...QueryWindowShape
16910
17010
  }), QueryResultSchema, { auth: "admin" }), method(object({
17011
+ items: array(QueryManyItemSchema).min(1).max(24),
17012
+ from: QueryWindowShape.from,
17013
+ to: QueryWindowShape.to,
17014
+ resolution: QueryWindowShape.resolution,
17015
+ maxPoints: QueryWindowShape.maxPoints
17016
+ }), object({ results: array(QueryManyEntrySchema).readonly() }), { auth: "admin" }), method(object({
16911
17017
  name: string().regex(/^[a-z0-9-]+$/),
16912
17018
  subjectKind: _enum(["device", "node"]),
16913
- kind: DeviceHistoryKindSchema,
17019
+ kind: DeviceHistoryProducerKindSchema,
16914
17020
  unit: string().optional(),
16915
17021
  displayName: string().min(1),
16916
17022
  ingest: _enum(["points", "buckets"])
@@ -39694,38 +39800,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39694
39800
  auth: "admin",
39695
39801
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39696
39802
  });
39803
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
39804
+ /** What a model (or, by default, every model of a kind) can do. */
39805
+ var LlmModelFeaturesSchema = object({
39806
+ vision: boolean(),
39807
+ tools: boolean(),
39808
+ streaming: boolean()
39809
+ });
39810
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
39811
+ var LlmModelInfoSchema = object({
39812
+ id: string(),
39813
+ label: string().optional(),
39814
+ contextLength: number().int().positive().optional(),
39815
+ features: LlmModelFeaturesSchema.partial().optional()
39816
+ });
39697
39817
  /**
39698
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39699
- * methods concat-fan across providers; single-row methods route to ONE
39700
- * provider by the `addonId` in the call input (the notification-output
39701
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39702
- * (hub-placed); the cap stays open for future providers.
39703
- *
39704
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39705
- * `apiKey` is a password field — providers REDACT it on read and merge on
39706
- * write; a stored key NEVER round-trips to a client.
39818
+ * The provider-specific part of a profile, validated by the provider that owns
39819
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
39820
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
39821
+ * keychain, never in the row, and reads back as the redaction marker.
39707
39822
  */
39708
- var LlmProfileKindSchema = _enum([
39709
- "openai-compatible",
39710
- "openai",
39711
- "anthropic",
39712
- "google",
39713
- "managed-local",
39714
- "apple-foundation"
39715
- ]);
39823
+ var LlmProviderConfigSchema = record(string(), unknown());
39716
39824
  var LlmProfileSchema = object({
39717
39825
  id: string(),
39718
39826
  name: string(),
39827
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39719
39828
  kind: LlmProfileKindSchema,
39720
39829
  /** Stamped by the provider — keeps the fanned catalog routable. */
39721
39830
  addonId: string(),
39722
39831
  enabled: boolean(),
39723
39832
  /** Vendor model id, or the managed runtime's loaded model. */
39724
39833
  model: string(),
39725
- /** Required for openai-compatible; override for cloud kinds. */
39726
- baseUrl: string().optional(),
39727
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39728
- apiKey: string().optional(),
39729
39834
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39730
39835
  * degraded to text — that shipped once and produced a confident answer to a
39731
39836
  * question about a picture nobody sent. */
@@ -39733,15 +39838,11 @@ var LlmProfileSchema = object({
39733
39838
  temperature: number().min(0).max(2).optional(),
39734
39839
  /** Nucleus sampling. Every wire we speak has it. */
39735
39840
  topP: number().min(0).max(1).optional(),
39736
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39737
- * wire does, and the client drops it there (measured: the request body gets
39738
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39739
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
39841
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
39842
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39740
39843
  topK: number().int().positive().optional(),
39741
39844
  maxTokens: number().int().positive().optional(),
39742
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
39743
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
39744
- * the model with, so it is the one field that changes a PROCESS. */
39845
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
39745
39846
  contextLength: number().int().positive().optional(),
39746
39847
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
39747
39848
  * two system prompts fighting is worse than either alone). */
@@ -39767,16 +39868,37 @@ var LlmProfileSchema = object({
39767
39868
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
39768
39869
  * `true` here buys the wiring, not behaviour, until tools are registered. */
39769
39870
  toolsEnabled: boolean().default(false),
39770
- extraHeaders: record(string(), string()).optional(),
39771
- /** kind === 'managed-local' only (spec §4). */
39772
- runtime: ManagedRuntimeConfigSchema.optional(),
39773
- /**
39774
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
39775
- * to configure (no key, no URL, no download; `model` is `apple-system`).
39776
- * `supportsVision` on such a row is stamped by the provider from the node's
39777
- * reported `imageInput`, never taken from the operator (D62).
39778
- */
39779
- appleFoundation: object({ nodeId: string() }).optional()
39871
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
39872
+ providerConfig: LlmProviderConfigSchema.default({})
39873
+ });
39874
+ /**
39875
+ * The common profile fields a kind's editor offers. The editor owns how each
39876
+ * one is drawn; the provider says which of them mean something on its wire.
39877
+ */
39878
+ var LlmProfileFieldSchema = _enum([
39879
+ "temperature",
39880
+ "topP",
39881
+ "topK",
39882
+ "maxTokens",
39883
+ "contextLength",
39884
+ "systemPrompt",
39885
+ "timeoutMs",
39886
+ "connectTimeoutMs",
39887
+ "firstTokenTimeoutMs",
39888
+ "idleTimeoutMs",
39889
+ "retry",
39890
+ "toolsEnabled"
39891
+ ]);
39892
+ /**
39893
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
39894
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
39895
+ * picker: that widget owns the model choice.
39896
+ */
39897
+ var LlmProviderWidgetSchema = object({
39898
+ id: string(),
39899
+ placement: _enum(["connection", "model"]),
39900
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
39901
+ requires: array(string()).optional()
39780
39902
  });
39781
39903
  /** ConfigUISchema tree passed through untyped on the wire (the
39782
39904
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -39785,11 +39907,56 @@ var ConfigSchemaPassthrough$3 = unknown();
39785
39907
  var LlmProfileKindDescriptorSchema = object({
39786
39908
  kind: LlmProfileKindSchema,
39787
39909
  label: string(),
39910
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
39788
39911
  icon: string(),
39789
39912
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
39790
39913
  addonId: string(),
39791
- configSchema: ConfigSchemaPassthrough$3
39914
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
39915
+ connectionSchema: ConfigSchemaPassthrough$3,
39916
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
39917
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
39918
+ /** The kind's defaults; a model from `listModels` may override any of them. */
39919
+ features: LlmModelFeaturesSchema,
39920
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
39921
+ visionEditable: boolean(),
39922
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
39923
+ modelCatalog: _enum([
39924
+ "fetch",
39925
+ "static",
39926
+ "none"
39927
+ ]),
39928
+ staticModels: array(LlmModelInfoSchema).optional(),
39929
+ /** The common fields that mean something on this kind's wire. */
39930
+ profileFields: array(LlmProfileFieldSchema),
39931
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
39932
+ });
39933
+ /**
39934
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
39935
+ * (the editor's form); with `profileId` too, a secret the draft leaves
39936
+ * untouched (absent or the redaction marker) is resolved server-side from the
39937
+ * stored profile — the browser never receives it.
39938
+ */
39939
+ var LlmListModelsInputSchema = object({
39940
+ addonId: string(),
39941
+ kind: LlmProfileKindSchema,
39942
+ profileId: string().optional(),
39943
+ connection: LlmProviderConfigSchema.optional()
39792
39944
  });
39945
+ var LlmListModelsErrorCodeSchema = _enum([
39946
+ "auth",
39947
+ "network",
39948
+ "unsupported",
39949
+ "invalid"
39950
+ ]);
39951
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
39952
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
39953
+ ok: literal(true),
39954
+ models: array(LlmModelInfoSchema)
39955
+ }), object({
39956
+ ok: literal(false),
39957
+ code: LlmListModelsErrorCodeSchema,
39958
+ message: string()
39959
+ })]);
39793
39960
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
39794
39961
  var LlmDefaultSchema = object({
39795
39962
  selector: LlmDefaultSelectorSchema,
@@ -39889,7 +40056,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39889
40056
  kind: "mutation",
39890
40057
  auth: "admin",
39891
40058
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39892
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40059
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40060
+ kind: "mutation",
40061
+ auth: "admin"
40062
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
39893
40063
  selector: LlmDefaultSelectorSchema,
39894
40064
  profileId: string().nullable()
39895
40065
  }), _void(), {
@@ -40057,14 +40227,106 @@ var LogEntrySchema = object({
40057
40227
  meta: record(string(), unknown()).optional(),
40058
40228
  tags: record(string(), string()).optional()
40059
40229
  });
40060
- method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
40061
- scope: array(string()).optional(),
40230
+ /**
40231
+ * A history READ against one destination (D898).
40232
+ *
40233
+ * Every filter is applied by the PROVIDER, before the limit — a filter the
40234
+ * browser applied after the limit is what made a rare device's lines
40235
+ * unreachable behind a busy one's. `before` / `after` are cursors the provider
40236
+ * minted (opaque to everyone else): a file position for the rotated files, a
40237
+ * nanosecond timestamp for Loki.
40238
+ *
40239
+ * A read is BOUNDED by `budgetMs`: a filter that matches nothing on a 30-day
40240
+ * store answers `done: false` with the cursor it reached and the bytes it
40241
+ * scanned, and the caller decides whether to go on. That is what makes a long
40242
+ * scan show progress and stop when asked — `cancelRead` ends the slice in
40243
+ * flight, and not asking for the next slice ends the scan.
40244
+ */
40245
+ var LogReadQuerySchema = object({
40246
+ /** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
40247
+ requestId: string().min(1).max(64).optional(),
40248
+ /** The device the line is about (`tags.deviceId`, numeric). */
40249
+ deviceId: number().int().optional(),
40250
+ /**
40251
+ * The emitting addon — bare manifest id; `@<version>` / `::<sub>` suffixes
40252
+ * match. Not `addonId`: a cap router reads that name as "which provider".
40253
+ */
40254
+ fromAddonId: string().min(1).max(200).optional(),
40255
+ /**
40256
+ * The emitting node: matches the agent that emitted the line, the node
40257
+ * itself, or a worker under it (`<agent>/<runner>`) — the `agentId`
40258
+ * semantics of `matchesLogTags`. Not `nodeId`: a cap router reads that
40259
+ * name as "which node's provider".
40260
+ */
40261
+ fromNodeId: string().min(1).max(200).optional(),
40262
+ /** Any other tag, exact match (AND). */
40263
+ tags: record(string(), union([string(), number()])).optional(),
40264
+ /** Severity FLOOR: this level and above. */
40062
40265
  level: LogLevelSchema.optional(),
40063
- since: date().optional(),
40064
- until: date().optional(),
40065
- limit: number().optional(),
40066
- tags: record(string(), string()).optional()
40067
- }), array(LogEntrySchema).readonly());
40266
+ /** Case-insensitive substring over message, scope, tag values and meta values. */
40267
+ text: string().min(1).max(200).optional(),
40268
+ /** Epoch ms, inclusive. */
40269
+ since: number().optional(),
40270
+ /** Epoch ms, inclusive. */
40271
+ until: number().optional(),
40272
+ /** Older than this cursor (exclusive). Absent with `after` absent ⇒ from the newest. */
40273
+ before: string().min(1).max(1024).optional(),
40274
+ /** Newer than this cursor (exclusive). */
40275
+ after: string().min(1).max(1024).optional(),
40276
+ limit: number().int().min(1).max(1e3).optional(),
40277
+ /** Wall-clock bound of this slice. The provider caps it. */
40278
+ budgetMs: number().int().min(50).max(1e4).optional()
40279
+ });
40280
+ var LogReadResultSchema = object({
40281
+ /** Newest first. */
40282
+ entries: array(object({
40283
+ /** `<bootId>.<seq>` minted by the emitting LogManager — the dedupe key. */
40284
+ id: string().optional(),
40285
+ /** Epoch ms. */
40286
+ timestamp: number(),
40287
+ level: LogLevelSchema,
40288
+ scope: string().optional(),
40289
+ message: string(),
40290
+ tags: record(string(), union([string(), number()])).optional(),
40291
+ meta: record(string(), unknown()).optional()
40292
+ })),
40293
+ /** Pass as `before` for the next older page; null when nothing older exists. */
40294
+ nextBefore: string().nullable(),
40295
+ /** Pass as `after` to read what arrived since; null when unknown. */
40296
+ nextAfter: string().nullable(),
40297
+ /** Bytes this slice read (files) or received (remote). Progress, not a promise. */
40298
+ scannedBytes: number().int().nonnegative(),
40299
+ /**
40300
+ * True when the scan in this direction reached the end of the store.
40301
+ * False with fewer than `limit` entries means the budget ran out first —
40302
+ * call again with `nextBefore` to go on.
40303
+ */
40304
+ done: boolean(),
40305
+ /** True when `cancelRead` ended this slice early. */
40306
+ cancelled: boolean().optional()
40307
+ });
40308
+ var LogReadCapabilitiesSchema = object({
40309
+ /** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
40310
+ readable: boolean(),
40311
+ /** Why not, when `readable` is false — rendered next to the source. */
40312
+ reason: string().nullable(),
40313
+ /** Filters the provider applies itself. A false one is applied by nobody. */
40314
+ filters: object({
40315
+ deviceId: boolean(),
40316
+ addonId: boolean(),
40317
+ nodeId: boolean(),
40318
+ tags: boolean(),
40319
+ level: boolean(),
40320
+ text: boolean(),
40321
+ timeRange: boolean()
40322
+ }),
40323
+ /** How far back the store reaches, when the provider knows (days). */
40324
+ retentionDays: number().nullable()
40325
+ });
40326
+ 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() }), {
40327
+ kind: "mutation",
40328
+ auth: "admin"
40329
+ });
40068
40330
  /**
40069
40331
  * `login-method` — collection cap through which auth addons contribute
40070
40332
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -42620,6 +42882,33 @@ var NcRuleTargetSchema = object({
42620
42882
  params: record(string(), unknown()).optional()
42621
42883
  });
42622
42884
  /**
42885
+ * WHAT THE NOTIFICATION'S PICTURE IS (D897) — the ONE media choice of a rule.
42886
+ *
42887
+ * Every mode starts from the same CLEAN source frame of the trigger moment
42888
+ * (keyFrame → sceneFrame → lastSceneFrame, narrowed to the trigger instant and
42889
+ * to the zone that fired the rule) and renders it once at send time:
42890
+ * - `scene-boxes` — the whole scene, the subject outlined thick in the accent
42891
+ * colour and every OTHER track visible at that instant outlined thin, each
42892
+ * labelled with class and confidence ("dog 87%").
42893
+ * - `crop` — the subject cut out of that frame around its box at that instant.
42894
+ * - `clean` — the whole scene with nothing drawn on it.
42895
+ * - `none` — no picture.
42896
+ *
42897
+ * A mode that cannot be honoured (no box at that instant, a photograph with no
42898
+ * tracked subject) ships `clean` and names the reason in the log, per camera.
42899
+ * It replaces the `attach` × `frame` × `zoneCrop` triple, which let one rule
42900
+ * ship a crop on one event and a boxed scene on the next depending on which
42901
+ * stored kind had landed.
42902
+ */
42903
+ var NcMediaImageSchema = _enum([
42904
+ "scene-boxes",
42905
+ "crop",
42906
+ "clean",
42907
+ "none"
42908
+ ]);
42909
+ /**
42910
+ * @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
42911
+ *
42623
42912
  * Media attachment policy (P1 still-image subset).
42624
42913
  * - `best` — the best AVAILABLE subject image at dispatch time (D-3).
42625
42914
  * - `best-matching` — the media that explains WHY the rule fired: a rule
@@ -42633,6 +42922,8 @@ var NcRuleTargetSchema = object({
42633
42922
  * - `none` — no attachment.
42634
42923
  */
42635
42924
  /**
42925
+ * @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
42926
+ *
42636
42927
  * WHAT THE PICTURE SHOWS — chosen explicitly, because the implicit ladders
42637
42928
  * conflate it with the selection strategy and betray the request: asking for
42638
42929
  * the clean scene frame on an object-event owner used to start at
@@ -42661,16 +42952,29 @@ var NcMediaFrameSchema = _enum([
42661
42952
  */
42662
42953
  var NcLinkedCameraModeSchema = _enum(["mosaic", "each"]);
42663
42954
  var NcMediaPolicySchema = object({
42955
+ /**
42956
+ * The picture — see {@link NcMediaImageSchema}. Absent on a rule nobody has
42957
+ * saved since D897: `normalizeNcMediaPolicy` derives it from the legacy
42958
+ * triple below, at load and at every write, and the store keeps only this.
42959
+ */
42960
+ image: NcMediaImageSchema.optional(),
42961
+ /**
42962
+ * Draw the zone that FIRED the rule on the picture (`scene-boxes` / `clean`;
42963
+ * a `crop` never shows it). Valid only on a rule whose trigger is a zone —
42964
+ * `conditions.zones` or an occupancy zone — and refused on save otherwise.
42965
+ * Replaces `zoneCrop`.
42966
+ */
42967
+ showTriggerZone: boolean().optional(),
42968
+ /** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
42664
42969
  attach: _enum([
42665
42970
  "best",
42666
42971
  "best-matching",
42667
42972
  "keyFrame",
42668
42973
  "none"
42669
- ]).default("best"),
42670
- /** What the still shows. Absent = `cropped` (the historical `best` shape). */
42974
+ ]).optional(),
42975
+ /** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
42671
42976
  frame: NcMediaFrameSchema.optional(),
42672
- /** Crop the attached still to the rule's condition-zone bbox (padded) —
42673
- * "show me the ZONE", not the whole scene or the subject crop. */
42977
+ /** @deprecated D897 — folded into `image: 'clean'` + `showTriggerZone` on save. */
42674
42978
  zoneCrop: boolean().optional(),
42675
42979
  /**
42676
42980
  * Also attach a short GIF cut from the stream broker's clip ring around the
@@ -42842,7 +43146,9 @@ var NcRuleInputSchema = object({
42842
43146
  * targets.
42843
43147
  */
42844
43148
  targetUsers: array(string()).optional(),
42845
- media: NcMediaPolicySchema.default({ attach: "best" }),
43149
+ /** Absent = the kind's default picture (`resolveNcMediaImage`): the subject crop for a
43150
+ * detection, the clean scene for a sensor or a sound. Set explicitly on save (D897). */
43151
+ media: NcMediaPolicySchema.default({}),
42846
43152
  throttle: NcThrottleSchema.default({
42847
43153
  cooldownSec: 60,
42848
43154
  scope: "rule-device"
@@ -43779,13 +44085,37 @@ var NcAlarmModeOpeningsSchema = object({
43779
44085
  /** Covered devices whose state could not be read (D49): neither open nor closed. */
43780
44086
  unknown: array(number().int())
43781
44087
  });
44088
+ /**
44089
+ * One alarm INPUT — a (rule, device) pair — the operator bypassed until the
44090
+ * next disarm ("Bypass this input until disarm" on a trigger notification, or
44091
+ * `nc.bypassAlarmInput`). Reported so an armed alarm with a silenced input
44092
+ * never looks fully armed (D62: off must never look like broken).
44093
+ */
44094
+ var NcAlarmInputBypassViewSchema = object({
44095
+ ruleId: string(),
44096
+ /** The rule's current name (its frozen name when the rule is gone). */
44097
+ ruleName: string(),
44098
+ /** The input: the sensor of the match, else its camera. */
44099
+ deviceId: number().int(),
44100
+ /** The input's current name. */
44101
+ name: string(),
44102
+ /** When it was bypassed (ms epoch). */
44103
+ since: number(),
44104
+ /** Triggers from this input dropped since. */
44105
+ dropped: number().int().min(0)
44106
+ });
43782
44107
  var NcAlarmLiveSchema = object({
43783
44108
  state: AlarmStateSchema,
43784
44109
  /** The mode being armed into (exit delay) or held; null when disarmed. */
43785
44110
  targetMode: AlarmArmModeSchema.nullable(),
43786
44111
  availableModes: array(AlarmArmModeSchema),
43787
44112
  openings: array(NcAlarmModeOpeningsSchema),
43788
- exclusions: array(NcAlarmExclusionViewSchema)
44113
+ exclusions: array(NcAlarmExclusionViewSchema),
44114
+ /**
44115
+ * Inputs bypassed for the rest of this arm session; cleared on disarm.
44116
+ * Defaulted so an older hub answer still parses (as "none known").
44117
+ */
44118
+ bypassedInputs: array(NcAlarmInputBypassViewSchema).default([])
43789
44119
  });
43790
44120
  var NcAlarmConfigSchema = object({
43791
44121
  /**
@@ -61080,26 +61410,6 @@ var ApiKeySummarySchema = object({
61080
61410
  createdAt: number(),
61081
61411
  lastUsedAt: number().optional()
61082
61412
  });
61083
- var ScopedTokenSummarySchema = object({
61084
- id: string(),
61085
- userId: string(),
61086
- name: string(),
61087
- tokenPrefix: string(),
61088
- scopes: array(TokenScopeSchema),
61089
- expiresAt: number().nullish(),
61090
- lastUsedAt: number().nullish(),
61091
- createdAt: number()
61092
- });
61093
- var CreateScopedTokenInputSchema = object({
61094
- userId: string(),
61095
- name: string(),
61096
- scopes: array(TokenScopeSchema),
61097
- expiresAt: number().optional()
61098
- });
61099
- var CreateScopedTokenResultSchema = object({
61100
- token: string(),
61101
- record: ScopedTokenSummarySchema
61102
- });
61103
61413
  var OauthSessionSummarySchema = object({
61104
61414
  id: string(),
61105
61415
  userId: string(),
@@ -61121,11 +61431,11 @@ var TotpStatusSchema = object({
61121
61431
  confirmedAt: number().nullable()
61122
61432
  });
61123
61433
  /**
61124
- * user-management — singleton capability for user accounts, API keys,
61125
- * and scoped tokens.
61434
+ * user-management — singleton capability for user accounts and the
61435
+ * legacy API-key rows.
61126
61436
  *
61127
61437
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
61128
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
61438
+ * — the subset check on `setUserScopes` is moot
61129
61439
  * because non-admins never reach these. If/when we open non-admin
61130
61440
  * delegation, structural caller-scope subset check goes inside the
61131
61441
  * provider.
@@ -61182,15 +61492,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
61182
61492
  kind: "mutation",
61183
61493
  auth: "admin",
61184
61494
  access: "delete"
61185
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
61186
- kind: "mutation",
61187
- auth: "admin",
61188
- access: "create"
61189
- }), method(object({ id: string() }), object({ success: literal(true) }), {
61190
- kind: "mutation",
61191
- auth: "admin",
61192
- access: "delete"
61193
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
61495
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
61194
61496
  kind: "mutation",
61195
61497
  auth: "admin",
61196
61498
  access: "create"
@@ -66171,7 +66473,7 @@ Object.freeze({
66171
66473
  capName: "llm",
66172
66474
  capScope: "system",
66173
66475
  addonId: null,
66174
- access: "view"
66476
+ access: "create"
66175
66477
  },
66176
66478
  "llm.listNodeModels": {
66177
66479
  capName: "llm",
@@ -66473,7 +66775,19 @@ Object.freeze({
66473
66775
  addonId: null,
66474
66776
  access: "view"
66475
66777
  },
66476
- "logDestination.query": {
66778
+ "logDestination.cancelRead": {
66779
+ capName: "log-destination",
66780
+ capScope: "system",
66781
+ addonId: null,
66782
+ access: "create"
66783
+ },
66784
+ "logDestination.describeRead": {
66785
+ capName: "log-destination",
66786
+ capScope: "system",
66787
+ addonId: null,
66788
+ access: "view"
66789
+ },
66790
+ "logDestination.read": {
66477
66791
  capName: "log-destination",
66478
66792
  capScope: "system",
66479
66793
  addonId: null,
@@ -70835,12 +71149,6 @@ Object.freeze({
70835
71149
  addonId: null,
70836
71150
  access: "create"
70837
71151
  },
70838
- "userManagement.createScopedToken": {
70839
- capName: "user-management",
70840
- capScope: "system",
70841
- addonId: null,
70842
- access: "create"
70843
- },
70844
71152
  "userManagement.createUser": {
70845
71153
  capName: "user-management",
70846
71154
  capScope: "system",
@@ -70889,12 +71197,6 @@ Object.freeze({
70889
71197
  addonId: null,
70890
71198
  access: "view"
70891
71199
  },
70892
- "userManagement.listScopedTokens": {
70893
- capName: "user-management",
70894
- capScope: "system",
70895
- addonId: null,
70896
- access: "view"
70897
- },
70898
71200
  "userManagement.listUsers": {
70899
71201
  capName: "user-management",
70900
71202
  capScope: "system",
@@ -70949,12 +71251,6 @@ Object.freeze({
70949
71251
  addonId: null,
70950
71252
  access: "delete"
70951
71253
  },
70952
- "userManagement.revokeScopedToken": {
70953
- capName: "user-management",
70954
- capScope: "system",
70955
- addonId: null,
70956
- access: "delete"
70957
- },
70958
71254
  "userManagement.setupTotp": {
70959
71255
  capName: "user-management",
70960
71256
  capScope: "system",
@@ -70985,12 +71281,6 @@ Object.freeze({
70985
71281
  addonId: null,
70986
71282
  access: "view"
70987
71283
  },
70988
- "userManagement.validateScopedToken": {
70989
- capName: "user-management",
70990
- capScope: "system",
70991
- addonId: null,
70992
- access: "view"
70993
- },
70994
71284
  "userManagement.verifyTotp": {
70995
71285
  capName: "user-management",
70996
71286
  capScope: "system",
@@ -72570,6 +72860,11 @@ Object.freeze({
72570
72860
  form: "single",
72571
72861
  optional: false
72572
72862
  }],
72863
+ "logDestination.read": [{
72864
+ name: "deviceId",
72865
+ form: "single",
72866
+ optional: true
72867
+ }],
72573
72868
  "mediaPlayer.getStatus": [{
72574
72869
  name: "deviceId",
72575
72870
  form: "single",