@camstack/types 1.2.235 → 1.2.237

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.
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-CsgPITp-.js");
2
+ const require_sleep = require("./sleep-Cqxm5OIN.js");
3
3
  const require_event_category = require("./event-category-BVfsrBYA.js");
4
4
  const require_err_msg = require("./err-msg-COpsHMw2.js");
5
5
  //#region src/generated/cap-input-defaults.ts
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as DeviceType, At as emitReadiness, Ct as DATAPLANE_SECRET_HEADER, Dt as normalizeAddonInitResult, Et as BaseAddon, G as ReadinessRegistry, H as nodePin, I as expandCapMethods, K as ReadinessTimeoutError, S as DEVICE_CHILDREN_BATCH_MAX, T as describeCustomActions, Tt as DisposerChain, U as readNodePin, Y as scopeKey, a as asJsonObject, b as deviceOpsCapability, d as BOOT_RECOVERY_BACKOFF_MS, f as DEVICE_SCOPED_CAPS, h as createEventBusSliceSource, j as adminUiCapability, m as createDeviceProxy, p as isDeviceScopedCap, s as asString, t as sleep, u as parseJsonUnknown, x as viewerUiCapability } from "./sleep-7AN_Txmu.mjs";
1
+ import { A as DeviceType, At as emitReadiness, Ct as DATAPLANE_SECRET_HEADER, Dt as normalizeAddonInitResult, Et as BaseAddon, G as ReadinessRegistry, H as nodePin, I as expandCapMethods, K as ReadinessTimeoutError, S as DEVICE_CHILDREN_BATCH_MAX, T as describeCustomActions, Tt as DisposerChain, U as readNodePin, Y as scopeKey, a as asJsonObject, b as deviceOpsCapability, d as BOOT_RECOVERY_BACKOFF_MS, f as DEVICE_SCOPED_CAPS, h as createEventBusSliceSource, j as adminUiCapability, m as createDeviceProxy, p as isDeviceScopedCap, s as asString, t as sleep, u as parseJsonUnknown, x as viewerUiCapability } from "./sleep-CaB_hL5g.mjs";
2
2
  import { t as EventCategory } from "./event-category-BVDXG4tB.mjs";
3
3
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
4
4
  //#region src/generated/cap-input-defaults.ts
@@ -1361,29 +1361,30 @@ export declare const deviceManagerCapability: {
1361
1361
  }, z.core.$strip>>;
1362
1362
  }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
1363
1363
  /**
1364
- * Activate (or deactivate) a wrapper addon — or ONE of its sources — for a
1365
- * (device, cap) pair.
1364
+ * Activate (or deactivate) a wrapper addon for a (device, cap) pair — the
1365
+ * per-camera function switch's ONE authority (D62).
1366
1366
  *
1367
- * Persists the binding via ctx.settings; `active: false` on a SINGLETON cap
1368
- * clears the wrapper (falling back to native if one is registered). On a
1369
- * COLLECTION cap it adds to the per-device DENY set instead, and the
1370
- * wrapper binding is left exactly as it was — a cap with several sources
1371
- * has no "which one" for `getBindings` to answer (D556).
1367
+ * SINGLETON capabilities only. Persists the binding via ctx.settings;
1368
+ * `active: false` clears the wrapper (falling back to native if one is
1369
+ * registered) by persisting the explicit `{ wrapperAddonId: null }` marker,
1370
+ * which is what stops `getBindings` re-binding a `defaultActive` wrapper.
1372
1371
  *
1373
- * `sourceId` is what makes the switch match its label. One addon can serve
1374
- * several of a device's sources (`addon-provider-reolink` answers a hub
1375
- * child with `native:reolink:onboard` AND `native:reolink:hub`), so a
1376
- * toggle keyed by addon would turn off both while saying it turned off one
1377
- * — the D62 defect with the polarity reversed (D557). Naming the source
1378
- * denies exactly that source. OMITTING it keeps the cap-wide meaning
1379
- * D556 shipped: every source this addon serves for this device, which is
1380
- * also how a deny entry persisted before the re-key is still read.
1372
+ * **A COLLECTION capability is REFUSED by name.** It briefly took a
1373
+ * `sourceId` and wrote a per-device DENY set, so one of an addon's several
1374
+ * sources could be switched off without switching off the rest (D556, then
1375
+ * D555's re-key by source). The operator removed the whole idea the same
1376
+ * day: *"tutti i providers funzionano sempre, non serve
1377
+ * disattivarli/attivarli … loro vivono lì"* (D557 amended, third). A
1378
+ * collection cap's providers are a DERIVED set — every addon that provides
1379
+ * the cap for this device type, computed on every read and persisted
1380
+ * nowhere — so there is nothing here to activate, and a verb that accepted
1381
+ * the call could only write a field the enumeration does not read. That is
1382
+ * the D62 shape, and this repo has shipped it four times.
1381
1383
  */
1382
1384
  readonly setWrapperActive: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
1383
1385
  deviceId: z.ZodNumber;
1384
1386
  capName: z.ZodString;
1385
1387
  wrapperAddonId: z.ZodString;
1386
- sourceId: z.ZodOptional<z.ZodString>;
1387
1388
  active: z.ZodBoolean;
1388
1389
  }, z.core.$strip>, z.ZodVoid, "mutation">;
1389
1390
  /**
@@ -116,8 +116,8 @@ export type { IUserPasskeysProvider, PasskeySummary } from './user-passkeys.cap.
116
116
  export { PasskeySummarySchema, userPasskeysCapability } from './user-passkeys.cap.js';
117
117
  export type { IVectorStoreProvider } from './vector-store.cap.js';
118
118
  export { VectorDeclareIndexInputSchema, VectorDeleteByFilterInputSchema, VectorDeleteInputSchema, VectorDeleteResultSchema, type VectorFilter, VectorFilterSchema, VectorGetInputSchema, VectorGetResultSchema, type VectorItem, VectorItemSchema, type VectorMatch, VectorMatchSchema, type VectorMetadata, VectorMetadataSchema, type VectorMetric, VectorMetricSchema, VectorQueryInputSchema, VectorQueryResultSchema, VectorStatsInputSchema, VectorStatsResultSchema, VectorUpsertInputSchema, VectorUpsertResultSchema, vectorStoreCapability, } from './vector-store.cap.js';
119
- export type { Clip, ClipPlayback, ClipSource, ClipSourceAvailability, IVideoclipsProvider, } from './videoclips.cap.js';
120
- export { ClipPlaybackSchema, ClipSchema, ClipSourceAvailabilitySchema, ClipSourceSchema, MAX_CLIP_EVENT_IDS, MAX_CLIP_LABELS, videoclipsCapability, } from './videoclips.cap.js';
119
+ export type { Clip, ClipPlayback, ClipSource, ClipSourceAvailability, ClipStillDisposition, ClipStillRefusalCode, IVideoclipsProvider, } from './videoclips.cap.js';
120
+ export { CLIP_STILL_DISPOSITION_HEADER, CLIP_STILL_REASON_CODE_HEADER, CLIP_STILL_REASON_HEADER, ClipPlaybackSchema, ClipSchema, ClipSourceAvailabilitySchema, ClipSourceSchema, ClipStillDispositionSchema, ClipStillRefusalCodeSchema, MAX_CLIP_EVENT_IDS, MAX_CLIP_LABELS, videoclipsCapability, } from './videoclips.cap.js';
121
121
  export type { IViewerUiProvider } from './viewer-ui.cap.js';
122
122
  export { viewerUiCapability } from './viewer-ui.cap.js';
123
123
  export { type IWebrtcSessionProvider, type WebrtcClientHints, type WebrtcLadderDecision, WebrtcLadderDecisionSchema, type WebrtcSessionDebug, WebrtcSessionDebugSchema, type WebrtcStreamChoice, WebrtcStreamChoiceSchema, type WebrtcStreamTarget, WebrtcStreamTargetSchema, type WebrtcTierFailure, WebrtcTierFailureSchema, webrtcClientHintsSchema, webrtcSessionCapability, } from './webrtc-session.cap.js';
@@ -4264,6 +4264,40 @@ export declare const pipelineAnalyticsCapability: {
4264
4264
  mediaId: z.ZodNumber;
4265
4265
  sizeBytes: z.ZodNumber;
4266
4266
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
4267
+ /**
4268
+ * Which of `ownerIds` hold at least ONE media row — an INDEX read, never a
4269
+ * blob read, and the LICENCE `videoclips` needs to publish a `thumbnail`.
4270
+ *
4271
+ * The event-media URL is stamped from a template for every event in the
4272
+ * system, so "the plane is up" was being served as "there are bytes": 64 of
4273
+ * one camera's 179 clips pointed at a 404 (device 3836, 2026-08-17). This
4274
+ * is the question that turns the stamp into a claim.
4275
+ *
4276
+ * It is on the WIRE because the clip source is registered by the addon that
4277
+ * owns the FOOTAGE, not by this one (D560) — the probe used to be an
4278
+ * in-process `MediaStore` read. One call per OWNER KIND, never one per
4279
+ * owner: that N+1 is what `MediaStore.ownersWithMedia` was written to
4280
+ * prevent, and crossing a process boundary makes it worse, not better.
4281
+ * `ownerIds` is bounded at the same 5 000 the annotation fetch is bounded
4282
+ * at, so one pathological camera-day cannot mint an unbounded request.
4283
+ *
4284
+ * THROWS rather than answering partially. A probe that quietly
4285
+ * under-reports reads as "these owners have nothing" and the caller drops
4286
+ * thumbnails that exist — the opposite failure to the one above, and
4287
+ * equally invisible.
4288
+ *
4289
+ * `deviceId` is the authorization subject, exactly as on `getEventMedia`.
4290
+ */
4291
+ readonly ownersWithMedia: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
4292
+ deviceId: z.ZodNumber;
4293
+ ownerKind: z.ZodEnum<{
4294
+ motion: "motion";
4295
+ object: "object";
4296
+ audio: "audio";
4297
+ track: "track";
4298
+ }>;
4299
+ ownerIds: z.ZodArray<z.ZodString>;
4300
+ }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodString>>, import("./capability-definition.js").CapabilityMethodKind>;
4267
4301
  /**
4268
4302
  * Search object events by text query using CLIP cosine similarity.
4269
4303
  * Encodes `text` via the `embedding-encoder` cap, queries the
@@ -6,25 +6,34 @@ import { type InferProvider } from './capability-definition.js';
6
6
  *
7
7
  * A device-scoped wrapper COLLECTION (D549 decision 2, D554): every provider a
8
8
  * camera has is a SOURCE, and they are listed beside each other — never one
9
- * substituted for another. The DEFAULT provider (registered by
10
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
11
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
9
+ * substituted for another, and none of them privileged by name. One source,
10
+ * `analytics`, is registered by the RECORDER — the addon that owns the
11
+ * footage, D560 — and composes the analytics event log (markers + thumbnails,
12
+ * read over `ctx.api`) with the recorder's own `getPlaybackManifest`: a clip
12
13
  * is a time-WINDOW over existing footage, never a separate file. A camera that
13
14
  * exposes NATIVE onboard clips (Reolink SD card, a hub's storage, HKSV) adds
14
- * its own catalog ALONGSIDE that one.
15
+ * its own catalog ALONGSIDE that one. (`defaultActive` above is the CAP's
16
+ * auto-bind to cameras, not a ranking among these sources — there is none.)
15
17
  *
16
18
  * The mount stays per-device (`resolveCapMount` → `device-scoped`), and a
17
19
  * device's SOURCES are its BINDINGS: `deviceManager.getBindings(deviceId)` is
18
20
  * what says a provider serves this camera, never the set of addons that
19
21
  * happen to have registered the capability somewhere in the cluster. That is
20
22
  * what stopped one addon appearing three times on 592 — as the device's
21
- * native provider, as the hub-local registration and as
22
- * `pipeline-analytics@little-unraid` (D554 amended 2026-09-20).
23
+ * native provider, as the hub-local registration and as an
24
+ * `<addonId>@<nodeId>` one (D554 amended 2026-09-20).
23
25
  *
24
- * `listClips` is asked of ONE provider at a time
25
- * ({@link videoclipsCapability.methods.listClips} `provider`), defaulting to
26
- * the bound one, which is CamStack on every camera today. It is NOT a union
27
- * over everything a camera has: *"l'utilizzatore è uno solo"*.
26
+ * `listClips` is asked of ONE provider at a time, and NAMING it is REQUIRED
27
+ * ({@link videoclipsCapability.methods.listClips} `provider`, D554 amended). It is not
28
+ * a union over everything a camera has: *"l'utilizzatore è uno solo"*. There
29
+ * is no default, because a collection cap's binding set is DERIVED and PLURAL
30
+ * (D554 amended, `getBindings` step 0) — "the bound one" does not exist to
31
+ * resolve to, and the one thing that could take its place is a second
32
+ * authority naming a provider per camera, which D554 decision 3 rejected.
33
+ * The pick is a SURFACE's to make, from the {@link ClipSourceSchema} rows it
34
+ * already holds, and it says which one it made (D569 § 1–3).
35
+ * {@link videoclipsCapability.methods.listSources} is the method that fans out
36
+ * — one row per source, by construction.
28
37
  * {@link videoclipsCapability.methods.getClipPlayback} dispatches by the
29
38
  * source namespace inside the clip id, which is why ids are self-contained.
30
39
  *
@@ -40,6 +49,52 @@ import { type InferProvider } from './capability-definition.js';
40
49
  export declare const MAX_CLIP_EVENT_IDS = 24;
41
50
  /** Cap on {@link ClipSchema.labels} — the ribbon row has space for ~3 words. */
42
51
  export declare const MAX_CLIP_LABELS = 3;
52
+ /**
53
+ * Every reason a still-mint route may refuse, as a TOKEN — never prose.
54
+ *
55
+ * The route also sends the prose (`x-camstack-reason`), because a firmware's
56
+ * own words are the only thing that explains a `camera-refused`. But the token
57
+ * is what a surface may key a table on, and the code and the prose are
58
+ * separate headers precisely because they had been the same one: the route
59
+ * sent `queue-full: 16 thumbnail mints already waiting for host …` and the
60
+ * surface's table was keyed by `queue-full`, so every refusal on this fleet
61
+ * rendered as `Refused: <prose>`.
62
+ */
63
+ export declare const ClipStillRefusalCodeSchema: z.ZodEnum<{
64
+ sleeping: "sleeping";
65
+ unsupported: "unsupported";
66
+ "camera-refused": "camera-refused";
67
+ "no-keyframe": "no-keyframe";
68
+ "queue-full": "queue-full";
69
+ "camera-backoff": "camera-backoff";
70
+ "no-catalog-row": "no-catalog-row";
71
+ "unknown-device": "unknown-device";
72
+ "uid-missing": "uid-missing";
73
+ }>;
74
+ export type ClipStillRefusalCode = z.infer<typeof ClipStillRefusalCodeSchema>;
75
+ /**
76
+ * Whether a refusal is "not yet" or "never" — decided by the BRANCH that
77
+ * refused and carried on the wire, never inferred by the client from the code.
78
+ *
79
+ * `deferred` means the work is queued or the host is resting: the surface
80
+ * shows LOADING and comes back, under a bound. `final` means no retry can
81
+ * change the answer: the surface shows the reason and stops.
82
+ *
83
+ * A response that carries no disposition is read as `final`, which is exactly
84
+ * how every build before this one behaved — an old provider under a new
85
+ * surface keeps the old, safe behaviour rather than gaining a retry loop.
86
+ */
87
+ export declare const ClipStillDispositionSchema: z.ZodEnum<{
88
+ deferred: "deferred";
89
+ final: "final";
90
+ }>;
91
+ export type ClipStillDisposition = z.infer<typeof ClipStillDispositionSchema>;
92
+ /** The camera's / provider's own words. Kept verbatim, never parsed. */
93
+ export declare const CLIP_STILL_REASON_HEADER = "x-camstack-reason";
94
+ /** One {@link ClipStillRefusalCodeSchema} token, alone. */
95
+ export declare const CLIP_STILL_REASON_CODE_HEADER = "x-camstack-reason-code";
96
+ /** One {@link ClipStillDispositionSchema} token, alone. */
97
+ export declare const CLIP_STILL_DISPOSITION_HEADER = "x-camstack-disposition";
43
98
  export declare const ClipSchema: z.ZodObject<{
44
99
  id: z.ZodString;
45
100
  source: z.ZodString;
@@ -87,6 +142,7 @@ export declare const ClipSchema: z.ZodObject<{
87
142
  supportSub: z.ZodOptional<z.ZodBoolean>;
88
143
  playable: z.ZodOptional<z.ZodBoolean>;
89
144
  unplayableReason: z.ZodOptional<z.ZodString>;
145
+ inProgress: z.ZodOptional<z.ZodBoolean>;
90
146
  }, z.core.$strip>;
91
147
  export type Clip = z.infer<typeof ClipSchema>;
92
148
  export declare const ClipPlaybackSchema: z.ZodObject<{
@@ -146,7 +202,6 @@ export declare const ClipSourceSchema: z.ZodObject<{
146
202
  source: z.ZodString;
147
203
  label: z.ZodString;
148
204
  addonId: z.ZodOptional<z.ZodString>;
149
- via: z.ZodOptional<z.ZodString>;
150
205
  availability: z.ZodObject<{
151
206
  state: z.ZodEnum<{
152
207
  ok: "ok";
@@ -158,7 +213,6 @@ export declare const ClipSourceSchema: z.ZodObject<{
158
213
  reason: z.ZodOptional<z.ZodString>;
159
214
  catalogAsOf: z.ZodOptional<z.ZodNumber>;
160
215
  }, z.core.$strip>;
161
- switchedOff: z.ZodOptional<z.ZodBoolean>;
162
216
  }, z.core.$strip>;
163
217
  export type ClipSource = z.infer<typeof ClipSourceSchema>;
164
218
  export declare const videoclipsCapability: {
@@ -213,7 +267,7 @@ export declare const videoclipsCapability: {
213
267
  since: z.ZodNumber;
214
268
  until: z.ZodNumber;
215
269
  limit: z.ZodOptional<z.ZodNumber>;
216
- provider: z.ZodOptional<z.ZodString>;
270
+ provider: z.ZodString;
217
271
  }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
218
272
  id: z.ZodString;
219
273
  source: z.ZodString;
@@ -261,6 +315,7 @@ export declare const videoclipsCapability: {
261
315
  supportSub: z.ZodOptional<z.ZodBoolean>;
262
316
  playable: z.ZodOptional<z.ZodBoolean>;
263
317
  unplayableReason: z.ZodOptional<z.ZodString>;
318
+ inProgress: z.ZodOptional<z.ZodBoolean>;
264
319
  }, z.core.$strip>>>, "query">;
265
320
  /**
266
321
  * The sources this camera has, WITH the reason any of them cannot answer.
@@ -277,7 +332,6 @@ export declare const videoclipsCapability: {
277
332
  source: z.ZodString;
278
333
  label: z.ZodString;
279
334
  addonId: z.ZodOptional<z.ZodString>;
280
- via: z.ZodOptional<z.ZodString>;
281
335
  availability: z.ZodObject<{
282
336
  state: z.ZodEnum<{
283
337
  ok: "ok";
@@ -289,7 +343,6 @@ export declare const videoclipsCapability: {
289
343
  reason: z.ZodOptional<z.ZodString>;
290
344
  catalogAsOf: z.ZodOptional<z.ZodNumber>;
291
345
  }, z.core.$strip>;
292
- switchedOff: z.ZodOptional<z.ZodBoolean>;
293
346
  }, z.core.$strip>>>, "query">;
294
347
  readonly getClipPlayback: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
295
348
  deviceId: z.ZodNumber;
@@ -5630,6 +5630,13 @@ export type AppRouter = TrpcCoreRouter<{
5630
5630
  output: z.infer<typeof pipelineAnalyticsCapability.methods.listEventMedia.output>;
5631
5631
  meta: object;
5632
5632
  }>;
5633
+ ownersWithMedia: TRPCQueryProcedure<{
5634
+ input: {
5635
+ [x: string]: unknown;
5636
+ } & z.input<typeof pipelineAnalyticsCapability.methods.ownersWithMedia.input>;
5637
+ output: z.infer<typeof pipelineAnalyticsCapability.methods.ownersWithMedia.output>;
5638
+ meta: object;
5639
+ }>;
5633
5640
  searchObjectEvents: TRPCQueryProcedure<{
5634
5641
  input: {
5635
5642
  [x: string]: unknown;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 1057 method paths across 131 capabilities.
9
+ * Coverage: 1058 method paths across 131 capabilities.
10
10
  */
11
11
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
12
  export interface MethodAccessRecord {
@@ -6,7 +6,7 @@
6
6
  * system-scope cap that takes a deviceId was previously never device-filtered
7
7
  * — see the generator header).
8
8
  *
9
- * Coverage: 389 methods carry a device reference, of which
9
+ * Coverage: 390 methods carry a device reference, of which
10
10
  * 141 are on SYSTEM-scope caps.
11
11
  *
12
12
  * Top-level fields, number arrays, and one-level arrays of objects carrying
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './audio/audio-chunk-format.js';
2
- export type { EventOwnerType, MediaOwnerKey, MediaOwnerKeyInput, MediaOwnerType, } from './media/media-owner-key.js';
3
- export { EVENT_OWNER_TYPES, EventOwnerTypeSchema, MEDIA_OWNER_TYPES, formatMediaOwnerKey, isEventOwnerType, isMediaOwnerType, parseMediaOwnerKey, } from './media/media-owner-key.js';
2
+ export type { EventOwnerType, MediaOwnerKey, MediaOwnerKeyInput, MediaOwnerType, MediaPresenceOwnerKind, } from './media/media-owner-key.js';
3
+ export { EVENT_OWNER_TYPES, EventOwnerTypeSchema, MEDIA_OWNER_TYPES, MEDIA_PRESENCE_OWNER_KINDS, MediaPresenceOwnerKindSchema, formatMediaOwnerKey, isEventOwnerType, isMediaOwnerType, parseMediaOwnerKey, } from './media/media-owner-key.js';
4
4
  export type { CapabilitiesAccess } from './addon/base-addon.js';
5
5
  export { BaseAddon, normalizeAddonInitResult } from './addon/base-addon.js';
6
6
  export type { AddonRouteInvokeRequest, AddonRouteReplyEnvelope, } from './addon/build-addon-route-provider.js';